summaryrefslogtreecommitdiffstats
path: root/tests/auto/widgets/widgets
diff options
context:
space:
mode:
authorTor Arne Vestbø <tor.arne.vestbo@qt.io>2018-08-08 20:44:37 +0200
committerTor Arne Vestbø <tor.arne.vestbo@qt.io>2018-08-09 22:36:11 +0000
commit6b8e03456b3fdb67438e597f112efcb5d0ea6719 (patch)
treebda450c0408933549c9129b69040c5380c6a101e /tests/auto/widgets/widgets
parentda62e76eacd538eb61e188bc53e24cd1aaf01e49 (diff)
tst_qmenu: Fix funky use of QTRY_VERIFY with qWaitFor
The QTRY_VERIFY was needed because the window doesn't initially have a handle, and QTest::qWaitForWindowActive(QWidget *) only checks the active state of the widget if it does, returning false if not. This broken logic should be fixed, but for now let's make it clear what's actually going on by using an explicit wait for the window handle. Change-Id: I6dd89e0894efed14f4b9a2562dfe8ca76b5ef89c Reviewed-by: Gabriel de Dietrich <gabriel.dedietrich@qt.io> Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
Diffstat (limited to 'tests/auto/widgets/widgets')
-rw-r--r--tests/auto/widgets/widgets/qmenu/tst_qmenu.cpp3
1 files changed, 2 insertions, 1 deletions
diff --git a/tests/auto/widgets/widgets/qmenu/tst_qmenu.cpp b/tests/auto/widgets/widgets/qmenu/tst_qmenu.cpp
index f5c8d59393..a88fd8d19c 100644
--- a/tests/auto/widgets/widgets/qmenu/tst_qmenu.cpp
+++ b/tests/auto/widgets/widgets/qmenu/tst_qmenu.cpp
@@ -724,7 +724,8 @@ void tst_QMenu::submenuTearOffDontClose()
// Move then click to avoid the submenu moves from causing it to close
QTest::mouseMove(menu, submenuPos, 100);
QTest::mouseClick(menu, Qt::LeftButton, 0, submenuPos, 100);
- QTRY_VERIFY(QTest::qWaitForWindowActive(submenu));
+ QVERIFY(QTest::qWaitFor([&]() { return submenu->window()->windowHandle(); }));
+ QVERIFY(QTest::qWaitForWindowActive(submenu));
// Make sure we enter the submenu frame directly on the tear-off area
QTest::mouseMove(submenu, QPoint(10, 3), 100);
if (submenu->style()->styleHint(QStyle::SH_Menu_SubMenuDontStartSloppyOnLeave)) {