Fix tst_qcombobox::itemListPosition.

Add font combo to top level via layout and position top level
instead of the (child) font combo.

Change-Id: I0f754c37c009d1ed83615b800d6f2467e858c047
Reviewed-by: Joerg Bornemann <joerg.bornemann@digia.com>
bb10
Friedemann Kleint 2013-06-05 14:50:18 +02:00 committed by The Qt Project
parent b73ad2dd19
commit 1df0f4b2af
1 changed files with 6 additions and 4 deletions

View File

@ -2044,10 +2044,11 @@ void tst_QComboBox::itemListPosition()
//we test QFontComboBox because it has the specific behaviour to set a fixed size
//to the list view
QWidget topLevel;
topLevel.resize(200, 200);
topLevel.move(100, 100);
QHBoxLayout *layout = new QHBoxLayout(&topLevel);
QFontComboBox combo(&topLevel);
layout->addWidget(&combo);
//the code to get the available screen space is copied from QComboBox code
const int scrNumber = QApplication::desktop()->screenNumber(&combo);
@ -2058,11 +2059,12 @@ void tst_QComboBox::itemListPosition()
QApplication::desktop()->screenGeometry(scrNumber) :
QApplication::desktop()->availableGeometry(scrNumber);
combo.move(screen.width()-combo.sizeHint().width(), 0); //puts the combo to the top-right corner
topLevel.move(screen.width() - topLevel.sizeHint().width() - 10, 0); //puts the combo to the top-right corner
topLevel.show();
//wait because the window manager can move the window if there is a right panel
QTRY_VERIFY(combo.isVisible());
QVERIFY(QTest::qWaitForWindowExposed(&topLevel));
combo.showPopup();
QTRY_VERIFY(combo.view());
QTRY_VERIFY(combo.view()->isVisible());