From 6b8e03456b3fdb67438e597f112efcb5d0ea6719 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tor=20Arne=20Vestb=C3=B8?= Date: Wed, 8 Aug 2018 20:44:37 +0200 Subject: 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 Reviewed-by: Simon Hausmann --- tests/auto/widgets/widgets/qmenu/tst_qmenu.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'tests/auto/widgets/widgets') 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)) { -- cgit v1.2.3