on xenial help sign in
MenuBar test: Wait for overflow menubar to render (#338)

Prior to this change, it was possible for the menuBar to be behind the backend datasource for multiple frames. This would cause 'menuBackend.insertRow' to be called, say, 5 times while still checking the bar for overflow when it had only rendered 3 of the 5 items. Satisfied with its results at this point, the test function would continue. However, sometimes a new menuItem would be rendered between 'var menuItem...' and the mouseClick on that menuItem. This caused the click target to be set incorrectly and the test to fail. By waiting for the menu bar to render, we ensure that we're checking for the overflow menu's visibility for *this* insertion and not two or three insertions back.

commita4f840aec767a4ec48b7a6ebd8d915964f287992 authorDalton Durst <dalton@ubports.com> dateThu 5 Nov 2020, 09:56 (6 years ago) parentd87fbf7
1 file changed+2−2
tests/qmltests/ApplicationMenus/tst_MenuBar.qml+2−2
tests/qmltests/ApplicationMenus/tst_MenuBar.qml+2−2
@@ -349,7 +349,7 @@ Item {
349349 var menu = { "rowData": { "label": "Short" } };
350350 tryCompareFunction(function() {
351351 menuBackend.insertRow(0, menu);
352− wait(1);
352+ waitForRendering(menuBar);
353353 if (overflow.visible) {
354354 return true;
355355 }
@@ -366,7 +366,7 @@ Item {
366366
367367 tryCompareFunction(function() {
368368 menuBackend.removeRow(0);
369− wait(1);
369+ waitForRendering(menuBar);
370370 if (!overflow.visible) {
371371 return true;
372372 }