From 567a2de8cd493aabe0055d6dbc367b39447e70dd Mon Sep 17 00:00:00 2001 From: Mitch Curtis Date: Fri, 12 Oct 2018 11:09:14 +0200 Subject: Stabilize tst_qquickmenubar Something about postponing delegate creation to component completion means that the fileMenuBarItem->isHighlighted() check fails occasionally. Give it a chance to sort itself out before sending move events. Change-Id: I140ec835b5cb4ec7d784215a20567469ad422c5b Reviewed-by: Richard Moe Gustavsen --- tests/auto/qquickmenubar/tst_qquickmenubar.cpp | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'tests/auto/qquickmenubar') diff --git a/tests/auto/qquickmenubar/tst_qquickmenubar.cpp b/tests/auto/qquickmenubar/tst_qquickmenubar.cpp index 754e915b..3d6c2bbf 100644 --- a/tests/auto/qquickmenubar/tst_qquickmenubar.cpp +++ b/tests/auto/qquickmenubar/tst_qquickmenubar.cpp @@ -45,6 +45,7 @@ #include #include #include +#include #include #include @@ -106,6 +107,13 @@ void tst_qquickmenubar::mouse() QQuickMenuBarItem *viewMenuBarItem = qobject_cast(viewMenuBarMenu->parentItem()); QQuickMenuBarItem *helpMenuBarItem = qobject_cast(helpMenuBarMenu->parentItem()); QVERIFY(fileMenuBarItem && editMenuBarItem && viewMenuBarItem && helpMenuBarItem); + // Something about postponing delegate creation to component completion + // means that the fileMenuBarItem->isHighlighted() check below fails occasionally. + // Give it a chance to sort itself out before sending move events. + QQuickMenuBarPrivate *menuBarPrivate = QQuickMenuBarPrivate::get(menuBar); + menuBar->polish(); + QVERIFY(menuBarPrivate->polishScheduled); + QTRY_VERIFY(!menuBarPrivate->polishScheduled); // highlight a menubar item QTest::mouseMove(window.data(), fileMenuBarItem->mapToScene(QPointF(fileMenuBarItem->width() / 2, fileMenuBarItem->height() / 2)).toPoint()); -- cgit v1.2.3