diff options
Diffstat (limited to 'tests/auto/widgets/widgets/qcombobox/tst_qcombobox.cpp')
-rw-r--r-- | tests/auto/widgets/widgets/qcombobox/tst_qcombobox.cpp | 57 |
1 files changed, 21 insertions, 36 deletions
diff --git a/tests/auto/widgets/widgets/qcombobox/tst_qcombobox.cpp b/tests/auto/widgets/widgets/qcombobox/tst_qcombobox.cpp index 7c1deb8fff..943fb997cd 100644 --- a/tests/auto/widgets/widgets/qcombobox/tst_qcombobox.cpp +++ b/tests/auto/widgets/widgets/qcombobox/tst_qcombobox.cpp @@ -1672,6 +1672,9 @@ void tst_QComboBox::setCustomModelAndView() const QRect subItemRect = view->visualRect(model->indexFromItem(subItem)); QWidget *window = view->window(); QTest::mouseClick(window->windowHandle(), Qt::LeftButton, 0, view->mapTo(window, subItemRect.center())); +#ifdef Q_OS_WINRT + QEXPECT_FAIL("", "Fails on WinRT - QTBUG-68297", Abort); +#endif QTRY_COMPARE(combo.currentText(), subItem21Text); } @@ -2188,8 +2191,8 @@ void tst_QComboBox::itemListPosition() if (const QPlatformTheme *theme = QGuiApplicationPrivate::platformTheme()) useFullScreenForPopupMenu = theme->themeHint(QPlatformTheme::UseFullScreenForPopupMenu).toBool(); const QRect screen = useFullScreenForPopupMenu ? - QApplication::desktop()->screenGeometry(scrNumber) : - QApplication::desktop()->availableGeometry(scrNumber); + QApplication::screens().at(scrNumber)->geometry() : + QApplication::screens().at(scrNumber)->availableGeometry(); topLevel.move(screen.width() - topLevel.sizeHint().width() - 10, 0); //puts the combo to the top-right corner @@ -2311,7 +2314,7 @@ void tst_QComboBox::task191329_size() setFrameless(&tableCombo); tableCombo.move(200, 200); int rows; - if (QApplication::desktop()->screenGeometry().height() < 480) + if (QApplication::primaryScreen()->geometry().height() < 480) rows = 8; else rows = 15; @@ -2376,6 +2379,9 @@ void tst_QComboBox::task190205_setModelAdjustToContents() correctBox.addItems(finalContent); correctBox.showNormal(); +#ifdef Q_OS_WINRT + QEXPECT_FAIL("", "WinRT does not support more than 1 native top level widget", Abort); +#endif QVERIFY(QTest::qWaitForWindowExposed(&box)); QVERIFY(QTest::qWaitForWindowExposed(&correctBox)); @@ -2390,8 +2396,7 @@ void tst_QComboBox::task248169_popupWithMinimalSize() QComboBox comboBox; comboBox.addItems(initialContent); - QDesktopWidget desktop; - QRect desktopSize = desktop.availableGeometry(); + QRect desktopSize = QGuiApplication::primaryScreen()->availableGeometry(); comboBox.view()->setMinimumWidth(desktopSize.width() / 2); comboBox.setGeometry(desktopSize.width() - (desktopSize.width() / 4), (desktopSize.width() / 4), (desktopSize.width() / 2), (desktopSize.width() / 4)); @@ -2407,6 +2412,7 @@ void tst_QComboBox::task248169_popupWithMinimalSize() #if defined QT_BUILD_INTERNAL QFrame *container = comboBox.findChild<QComboBoxPrivateContainer *>(); QVERIFY(container); + QDesktopWidget desktop; QTRY_VERIFY(desktop.screenGeometry(container).contains(container->geometry())); #endif } @@ -2719,32 +2725,18 @@ void tst_QComboBox::resetModel() } -static inline void centerCursor(const QWidget *w) -{ -#ifndef QT_NO_CURSOR - // Force cursor movement to prevent QCursor::setPos() from returning prematurely on QPA: - const QPoint target(w->mapToGlobal(w->rect().center())); - QCursor::setPos(QPoint(target.x() + 1, target.y())); - QCursor::setPos(target); -#else // !QT_NO_CURSOR - Q_UNUSED(w) -#endif -} - void tst_QComboBox::keyBoardNavigationWithMouse() { QComboBox combo; combo.setEditable(false); setFrameless(&combo); - combo.move(200, 200); - for (int i = 0; i < 80; i++) - combo.addItem( QString::number(i)); + for (int i = 0; i < 200; i++) + combo.addItem(QString::number(i)); + combo.move(200, 200); combo.showNormal(); - centerCursor(&combo); // QTBUG-33973, cursor needs to be within view from start on Mac. QApplication::setActiveWindow(&combo); QVERIFY(QTest::qWaitForWindowActive(&combo)); - QCOMPARE(QApplication::activeWindow(), static_cast<QWidget *>(&combo)); QCOMPARE(combo.currentText(), QLatin1String("0")); @@ -2752,18 +2744,12 @@ void tst_QComboBox::keyBoardNavigationWithMouse() QTRY_VERIFY(combo.hasFocus()); QTest::keyClick(combo.lineEdit(), Qt::Key_Space); - QTest::qWait(30); QTRY_VERIFY(combo.view()); QTRY_VERIFY(combo.view()->isVisible()); - QTest::qWait(130); QCOMPARE(combo.currentText(), QLatin1String("0")); - // When calling cursor function, Windows CE responds with: This function is not supported on this system. -#if !defined Q_OS_QNX - // Force cursor movement to prevent QCursor::setPos() from returning prematurely on QPA: - centerCursor(combo.view()); - QTest::qWait(200); + QTest::mouseMove(&combo, combo.rect().center()); #define GET_SELECTION(SEL) \ QCOMPARE(combo.view()->selectionModel()->selection().count(), 1); \ @@ -2771,23 +2757,19 @@ void tst_QComboBox::keyBoardNavigationWithMouse() SEL = combo.view()->selectionModel()->selection().indexes().first().row() int selection; - GET_SELECTION(selection); + GET_SELECTION(selection); // get initial selection - //since we moved the mouse is in the middle it should even be around 5; - QVERIFY2(selection > 3, (QByteArrayLiteral("selection=") + QByteArray::number(selection)).constData()); - - static const int final = 40; + const int final = 40; for (int i = selection + 1; i <= final; i++) { QTest::keyClick(combo.view(), Qt::Key_Down); - QTest::qWait(20); GET_SELECTION(selection); QCOMPARE(selection, i); } QTest::keyClick(combo.view(), Qt::Key_Enter); QTRY_COMPARE(combo.currentText(), QString::number(final)); -#endif +#undef GET_SELECTION } void tst_QComboBox::task_QTBUG_1071_changingFocusEmitsActivated() @@ -3334,6 +3316,9 @@ void tst_QComboBox::task_QTBUG_56693_itemFontFromModel() QVERIFY(container); QVERIFY(QTest::qWaitForWindowExposed(container)); +#ifdef Q_OS_WINRT + QEXPECT_FAIL("", "Fails on WinRT - QTBUG-68297", Abort); +#endif QCOMPARE(proxyStyle->italicItemsNo, 5); box.hidePopup(); |