diff options
-rw-r--r-- | tests/auto/menu/BLACKLIST | 5 | ||||
-rw-r--r-- | tests/auto/menu/tst_menu.cpp | 7 | ||||
-rw-r--r-- | tests/auto/qquickmenubar/BLACKLIST | 5 | ||||
-rw-r--r-- | tests/auto/qquickmenubar/tst_qquickmenubar.cpp | 3 | ||||
-rw-r--r-- | tests/auto/shared/visualtestutil.cpp | 12 | ||||
-rw-r--r-- | tests/auto/shared/visualtestutil.h | 2 |
6 files changed, 23 insertions, 11 deletions
diff --git a/tests/auto/menu/BLACKLIST b/tests/auto/menu/BLACKLIST deleted file mode 100644 index 868dc441..00000000 --- a/tests/auto/menu/BLACKLIST +++ /dev/null @@ -1,5 +0,0 @@ -# See qtbase/src/testlib/qtestblacklist.cpp for format - -# https://bugreports.qt.io/browse/QTBUG-62383 -[mouse] -ubuntu-16.04 ci diff --git a/tests/auto/menu/tst_menu.cpp b/tests/auto/menu/tst_menu.cpp index 36c143c9..4e96dea4 100644 --- a/tests/auto/menu/tst_menu.cpp +++ b/tests/auto/menu/tst_menu.cpp @@ -132,6 +132,7 @@ void tst_menu::mouse() QQuickApplicationWindow *window = helper.appWindow; window->show(); QVERIFY(QTest::qWaitForWindowActive(window)); + centerOnScreen(window); moveMouseAway(window); QQuickMenu *menu = window->property("menu").value<QQuickMenu*>(); @@ -245,6 +246,7 @@ void tst_menu::contextMenuKeyboard() window->requestActivate(); QVERIFY(QTest::qWaitForWindowActive(window)); QVERIFY(QGuiApplication::focusWindow() == window); + centerOnScreen(window); moveMouseAway(window); QQuickMenu *menu = window->property("menu").value<QQuickMenu*>(); @@ -485,6 +487,7 @@ void tst_menu::menuSeparator() QQuickWindow *window = helper.window; window->show(); QVERIFY(QTest::qWaitForWindowActive(window)); + centerOnScreen(window); moveMouseAway(window); QQuickMenu *menu = window->property("menu").value<QQuickMenu*>(); @@ -625,6 +628,7 @@ void tst_menu::popup() QQuickApplicationWindow *window = helper.appWindow; window->show(); QVERIFY(QTest::qWaitForWindowActive(window)); + centerOnScreen(window); moveMouseAway(window); QQuickMenu *menu = window->property("menu").value<QQuickMenu *>(); @@ -898,6 +902,7 @@ void tst_menu::subMenuMouse() QQuickApplicationWindow *window = helper.appWindow; window->show(); QVERIFY(QTest::qWaitForWindowActive(window)); + centerOnScreen(window); moveMouseAway(window); QQuickMenu *mainMenu = window->property("mainMenu").value<QQuickMenu *>(); @@ -1000,6 +1005,7 @@ void tst_menu::subMenuKeyboard() QQuickApplicationWindow *window = helper.appWindow; window->show(); QVERIFY(QTest::qWaitForWindowActive(window)); + centerOnScreen(window); moveMouseAway(window); if (mirrored) @@ -1139,6 +1145,7 @@ void tst_menu::subMenuPosition() window->show(); QVERIFY(QTest::qWaitForWindowActive(window)); + centerOnScreen(window); moveMouseAway(window); if (mirrored) diff --git a/tests/auto/qquickmenubar/BLACKLIST b/tests/auto/qquickmenubar/BLACKLIST deleted file mode 100644 index 5ec6525d..00000000 --- a/tests/auto/qquickmenubar/BLACKLIST +++ /dev/null @@ -1,5 +0,0 @@ -# See qtbase/src/testlib/qtestblacklist.cpp for format - -# https://bugreports.qt.io/browse/QTBUG-62363 -[mouse] -ubuntu-16.04 ci diff --git a/tests/auto/qquickmenubar/tst_qquickmenubar.cpp b/tests/auto/qquickmenubar/tst_qquickmenubar.cpp index 5e4d075e..932e13bc 100644 --- a/tests/auto/qquickmenubar/tst_qquickmenubar.cpp +++ b/tests/auto/qquickmenubar/tst_qquickmenubar.cpp @@ -83,6 +83,7 @@ void tst_qquickmenubar::mouse() QVERIFY(window); QVERIFY(QTest::qWaitForWindowActive(window.data())); + centerOnScreen(window.data()); moveMouseAway(window.data()); QQuickMenuBar *menuBar = window->property("header").value<QQuickMenuBar *>(); @@ -221,6 +222,7 @@ void tst_qquickmenubar::keys() QVERIFY(window); QVERIFY(QTest::qWaitForWindowActive(window.data())); + centerOnScreen(window.data()); moveMouseAway(window.data()); QQuickMenuBar *menuBar = window->property("header").value<QQuickMenuBar *>(); @@ -408,6 +410,7 @@ void tst_qquickmenubar::mnemonics() QVERIFY(window); QVERIFY(QTest::qWaitForWindowActive(window.data())); + centerOnScreen(window.data()); moveMouseAway(window.data()); QQuickMenuBar *menuBar = window->property("header").value<QQuickMenuBar *>(); diff --git a/tests/auto/shared/visualtestutil.cpp b/tests/auto/shared/visualtestutil.cpp index 47cfd74f..c5e69812 100644 --- a/tests/auto/shared/visualtestutil.cpp +++ b/tests/auto/shared/visualtestutil.cpp @@ -74,7 +74,10 @@ void QQuickVisualTestUtil::dumpTree(QQuickItem *parent, int depth) void QQuickVisualTestUtil::moveMouseAway(QQuickWindow *window) { #if QT_CONFIG(cursor) // Get the cursor out of the way. - QCursor::setPos(window->geometry().topRight() + QPoint(100, 100)); + // Using "bottomRight() + QPoint(100, 100)" was causing issues on Ubuntu, + // where the window was positioned at the bottom right corner of the window + // (even after centering the window on the screen), so we use another position. + QCursor::setPos(window->geometry().bottomLeft() + QPoint(0, 10)); #endif // make sure hover events from QQuickWindowPrivate::flushFrameSynchronousEvents() @@ -82,3 +85,10 @@ void QQuickVisualTestUtil::moveMouseAway(QQuickWindow *window) QEvent leave(QEvent::Leave); QCoreApplication::sendEvent(window, &leave); } + +void QQuickVisualTestUtil::centerOnScreen(QQuickWindow *window) +{ + const QRect screenGeometry = window->screen()->availableGeometry(); + const QPoint offset = QPoint(window->width() / 2, window->height() / 2); + window->setFramePosition(screenGeometry.center() - offset); +} diff --git a/tests/auto/shared/visualtestutil.h b/tests/auto/shared/visualtestutil.h index bcf45660..a6b52fef 100644 --- a/tests/auto/shared/visualtestutil.h +++ b/tests/auto/shared/visualtestutil.h @@ -54,6 +54,8 @@ namespace QQuickVisualTestUtil bool delegateVisible(QQuickItem *item); + void centerOnScreen(QQuickWindow *window); + void moveMouseAway(QQuickWindow *window); /* |