on xenial help sign in
Squash race conditions everywhere
2d12d49Dalton Durst
tests/qmltests/Components/tst_DraggingArea.qml+6−6
@@ -129,8 +129,8 @@ Item {
129 -100, 25,
129 -100, 25,
130 0, Qt.LeftButton);
130 0, Qt.LeftButton);
131
131
132− compare(draggingArea.dragging, true);
132+ tryCompare(draggingArea, "dragging", true);
133− compare(draggingArea.dragValue, -125);
133+ tryCompare(draggingArea, "dragValue", -125);
134 compare(dragStartCount, 1);
134 compare(dragStartCount, 1);
135 compare(dragEndCount, 0);
135 compare(dragEndCount, 0);
136
136
@@ -139,7 +139,7 @@ Item {
139 -100, 25,
139 -100, 25,
140 Qt.LeftButton, Qt.NoModifier, 0);
140 Qt.LeftButton, Qt.NoModifier, 0);
141
141
142− compare(draggingArea.dragging, false);
142+ tryCompare(draggingArea, "dragging", false);
143 compare(dragStartCount, 1);
143 compare(dragStartCount, 1);
144 compare(dragEndCount, 1);
144 compare(dragEndCount, 1);
145 }
145 }
@@ -166,8 +166,8 @@ Item {
166 25, 125,
166 25, 125,
167 0, Qt.LeftButton);
167 0, Qt.LeftButton);
168
168
169− compare(draggingArea.dragging, true);
169+ tryCompare(draggingArea, "dragging", true);
170− compare(draggingArea.dragValue, 100);
170+ tryCompare(draggingArea, "dragValue", 100);
171 compare(dragStartCount, 1);
171 compare(dragStartCount, 1);
172 compare(dragEndCount, 0);
172 compare(dragEndCount, 0);
173
173
@@ -176,7 +176,7 @@ Item {
176 25, 125,
176 25, 125,
177 Qt.LeftButton, Qt.NoModifier, 0);
177 Qt.LeftButton, Qt.NoModifier, 0);
178
178
179− compare(draggingArea.dragging, false);
179+ tryCompare(draggingArea, "dragging", false);
180 compare(dragStartCount, 1);
180 compare(dragStartCount, 1);
181 compare(dragEndCount, 1);
181 compare(dragEndCount, 1);
182 }
182 }
tests/qmltests/Components/tst_Lockscreen.qml+6−6
@@ -184,10 +184,11 @@ Rectangle {
184 function test_loading(data) {
184 function test_loading(data) {
185 pinPadCheckBox.checked = data.alphanumeric
185 pinPadCheckBox.checked = data.alphanumeric
186 waitForLockscreenReady();
186 waitForLockscreenReady();
187+ var button8 = findChild(lockscreen, "pinPadButton8");
187 if (data.pinPadAvailable) {
188 if (data.pinPadAvailable) {
188− compare(findChild(lockscreen, "pinPadButton8").text, "8", "Could not find number 8 on PinPad")
189+ compare(button8.text, "8", "Could not find number 8 on PinPad");
189 } else {
190 } else {
190− compare(findChild(lockscreen, "pinPadButton8"), null, "Could find number 8 on PinPad even though it should be only OSK")
191+ compare(button8, null, "Could find number 8 on PinPad even though it should be only OSK");
191 }
192 }
192 }
193 }
193
194
@@ -292,8 +293,7 @@ Rectangle {
292 lockscreen.clear(data.animation)
293 lockscreen.clear(data.animation)
293 tryCompare(inputField, "text", "")
294 tryCompare(inputField, "text", "")
294
295
295− wait(0) // Trigger event loop to make sure the animation would start running
296− compare(animation.running, data.animation)
296+ tryCompare(animation, "running", data.animation)
297 if (data.animation) {
297 if (data.animation) {
298 if (!data.alphanumeric) {
298 if (!data.alphanumeric) {
299 var label = findChild(lockscreen, "wrongNoticeLabel");
299 var label = findChild(lockscreen, "wrongNoticeLabel");
@@ -326,12 +326,12 @@ Rectangle {
326
326
327 var pinPadButton5 = findChild(lockscreen, "pinPadButton5");
327 var pinPadButton5 = findChild(lockscreen, "pinPadButton5");
328 mouseClick(pinPadButton5, units.gu(1), units.gu(1));
328 mouseClick(pinPadButton5, units.gu(1), units.gu(1));
329− compare(pinEntryField.text, "5");
329+ tryCompare(pinEntryField, "text", "5");
330
330
331 tryCompare(backspaceIcon, "opacity", 1);
331 tryCompare(backspaceIcon, "opacity", 1);
332
332
333 mouseClick(backspaceIcon, units.gu(1), units.gu(1));
333 mouseClick(backspaceIcon, units.gu(1), units.gu(1));
334− compare(pinEntryField.text, "");
334+ tryCompare(pinEntryField, "text", "");
335
335
336 tryCompare(backspaceIcon, "opacity", 0);
336 tryCompare(backspaceIcon, "opacity", 0);
337 }
337 }
tests/qmltests/Components/tst_MediaServices.qml+5−4
@@ -151,10 +151,10 @@ Rectangle {
151
151
152 var mediaPlayer = findInvisibleChild(services, "mediaPlayer");
152 var mediaPlayer = findInvisibleChild(services, "mediaPlayer");
153 verify(mediaPlayer !== null);
153 verify(mediaPlayer !== null);
154− compare(mediaPlayer.playbackState, MediaPlayer.PlayingState, "Media player should be playing");
154+ tryCompare(mediaPlayer, "playbackState", MediaPlayer.PlayingState, 5000, "Media player should be playing");
155
155
156 tap(videoPlayer, videoPlayer.width/2, videoPlayer.height/2);
156 tap(videoPlayer, videoPlayer.width/2, videoPlayer.height/2);
157− compare(mediaPlayer.playbackState, MediaPlayer.PausedState, "Media player should be playing");
157+ tryCompare(mediaPlayer, "playbackState", MediaPlayer.PausedState, 5000, "Media player should be paused");
158 }
158 }
159
159
160 function test_fullscreenSwitch() {
160 function test_fullscreenSwitch() {
@@ -167,7 +167,7 @@ Rectangle {
167 verify(button !== null);
167 verify(button !== null);
168 tap(button);
168 tap(button);
169
169
170− compare(services.fullscreen, true, "Should have switched to fullscreen mode.");
170+ tryCompare(services, "fullscreen", true, 5000, "Should have switched to fullscreen mode.");
171 }
171 }
172
172
173 function test_HeaderVisibleOnlyWhenFullscreen() {
173 function test_HeaderVisibleOnlyWhenFullscreen() {
@@ -200,6 +200,7 @@ Rectangle {
200 var mediaPlayer = findInvisibleChild(services, "mediaPlayer");
200 var mediaPlayer = findInvisibleChild(services, "mediaPlayer");
201 mediaPlayer.play();
201 mediaPlayer.play();
202 mediaPlayer.pause();
202 mediaPlayer.pause();
203+ // Purposefully wait for when controls would normally time out
203 wait(300);
204 wait(300);
204
205
205 compare(services.header.visible, true, "Header should still be visible");
206 compare(services.header.visible, true, "Header should still be visible");
@@ -217,7 +218,7 @@ Rectangle {
217 verify(navigationButton !== null);
218 verify(navigationButton !== null);
218
219
219 tap(navigationButton);
220 tap(navigationButton);
220− compare(serviceCloseSpy.count, 1, "close was not called");
221+ serviceCloseSpy.wait();
221 }
222 }
222
223
223 function test_maximumVideoSize() {
224 function test_maximumVideoSize() {
tests/qmltests/Components/tst_Rating.qml+1−1
@@ -62,7 +62,7 @@ Rectangle {
62
62
63 var averageIconWidth = rating.width / rating.size;
63 var averageIconWidth = rating.width / rating.size;
64 mouseClick(rating, averageIconWidth * data.index + averageIconWidth / 2, rating.height / 2);
64 mouseClick(rating, averageIconWidth * data.index + averageIconWidth / 2, rating.height / 2);
65− compare(rating.value, data.value);
65+ tryCompare(rating, "value", data.value);
66
66
67 rating.interactive = false;
67 rating.interactive = false;
68 }
68 }
tests/qmltests/Components/tst_SharingPicker.qml+3−3
@@ -58,16 +58,16 @@ Rectangle {
58
58
59 function test_open_picker() {
59 function test_open_picker() {
60 sharingPicker.showPeerPicker();
60 sharingPicker.showPeerPicker();
61− compare(peerPicker.visible, true);
61+ tryCompare(peerPicker, "visible", true);
62 }
62 }
63
63
64 function test_createExportedItems() {
64 function test_createExportedItems() {
65 var exportedItems = sharingPicker.createExportedItems(shareData["uri"]);
65 var exportedItems = sharingPicker.createExportedItems(shareData["uri"]);
66 for (var i = 0; i < exportedItems.length; i++) {
66 for (var i = 0; i < exportedItems.length; i++) {
67− compare(exportedItems[i].url, shareData["uri"][i]);
67+ tryCompare(exportedItems[i], "url", shareData["uri"][i]);
68 }
68 }
69 exportedItems = sharingPicker.createExportedItems(shareDataString["uri"]);
69 exportedItems = sharingPicker.createExportedItems(shareDataString["uri"]);
70− compare(exportedItems[0].url, shareDataString["uri"]);
70+ tryCompare(exportedItems[0], "url", shareDataString["uri"]);
71 }
71 }
72 }
72 }
73}
73}
tests/qmltests/Greeter/tst_Greeter.qml+19−18
@@ -185,7 +185,7 @@ Item {
185
185
186 function verifySelected(name) {
186 function verifySelected(name) {
187 var i = getIndexOf(name);
187 var i = getIndexOf(name);
188− compare(view.currentIndex, i);
188+ tryCompare(view, "currentIndex", i);
189 compare(AccountsService.user, name);
189 compare(AccountsService.user, name);
190 if (name[0] === "*") // custom rows have no authenticationUser set
190 if (name[0] === "*") // custom rows have no authenticationUser set
191 compare(LightDM.Greeter.authenticationUser, "");
191 compare(LightDM.Greeter.authenticationUser, "");
@@ -284,19 +284,19 @@ Item {
284 function test_fullyShown() {
284 function test_fullyShown() {
285 compare(greeter.fullyShown, true);
285 compare(greeter.fullyShown, true);
286 view.hide();
286 view.hide();
287− compare(greeter.fullyShown, false);
287+ tryCompare(greeter, "fullyShown", false);
288 }
288 }
289
289
290 function test_alphanumeric() {
290 function test_alphanumeric() {
291 selectUser("has-password");
291 selectUser("has-password");
292− compare(view.alphanumeric, true);
292+ tryCompare(view, "alphanumeric", true);
293 selectUser("has-pin");
293 selectUser("has-pin");
294− compare(view.alphanumeric, false);
294+ tryCompare(view, "alphanumeric", false);
295 }
295 }
296
296
297 function test_background() {
297 function test_background() {
298 greeter.background = "testing";
298 greeter.background = "testing";
299− compare(view.background, Qt.resolvedUrl("testing"));
299+ tryCompare(view, "background", Qt.resolvedUrl("testing"));
300 }
300 }
301
301
302 function test_hasCustomBackground() {
302 function test_hasCustomBackground() {
@@ -307,12 +307,12 @@ Item {
307
307
308 function test_notifyAboutToFocusApp() {
308 function test_notifyAboutToFocusApp() {
309 greeter.notifyUserRequestedApp("fake-app");
309 greeter.notifyUserRequestedApp("fake-app");
310− compare(viewTryToUnlockSpy.count, 1);
310+ viewTryToUnlockSpy.wait();
311 compare(viewTryToUnlockSpy.signalArguments[0][0], false);
311 compare(viewTryToUnlockSpy.signalArguments[0][0], false);
312 }
312 }
313
313
314 function test_notifyShowingDashFromDrag() {
314 function test_notifyShowingDashFromDrag() {
315− compare(greeter.notifyShowingDashFromDrag("fake-app"), true);
315+ verify(greeter.notifyShowingDashFromDrag("fake-app"));
316 compare(viewTryToUnlockSpy.count, 1);
316 compare(viewTryToUnlockSpy.count, 1);
317 compare(viewTryToUnlockSpy.signalArguments[0][0], true);
317 compare(viewTryToUnlockSpy.signalArguments[0][0], true);
318 }
318 }
@@ -456,16 +456,16 @@ Item {
456 function test_dbusHideGreeter() {
456 function test_dbusHideGreeter() {
457 compare(view.required, true);
457 compare(view.required, true);
458 LightDM.Greeter.hideGreeter();
458 LightDM.Greeter.hideGreeter();
459− compare(view.required, false);
459+ tryCompare(view, "required", false);
460 compare(greeter.required, false);
460 compare(greeter.required, false);
461 }
461 }
462
462
463 function test_dbusShowGreeterFromHiddenState() {
463 function test_dbusShowGreeterFromHiddenState() {
464 greeter.hide();
464 greeter.hide();
465− compare(greeter.required, false);
465+ tryCompare(greeter, "required", false);
466
466
467 LightDM.Greeter.showGreeter();
467 LightDM.Greeter.showGreeter();
468− compare(greeter.required, true);
468+ tryCompare(greeter, "required", true);
469 compare(greeter.fullyShown, true);
469 compare(greeter.fullyShown, true);
470 view = findChild(greeter, "testView");
470 view = findChild(greeter, "testView");
471 compare(view.required, true);
471 compare(view.required, true);
@@ -480,7 +480,7 @@ Item {
480
480
481 compare(viewForceShowSpy.count, 0);
481 compare(viewForceShowSpy.count, 0);
482 LightDM.Greeter.showGreeter();
482 LightDM.Greeter.showGreeter();
483− compare(viewForceShowSpy.count, 1);
483+ viewForceShowSpy.wait();
484 }
484 }
485
485
486 function test_selectUserHint() {
486 function test_selectUserHint() {
@@ -554,7 +554,7 @@ Item {
554 verify(biometryd.operation.running);
554 verify(biometryd.operation.running);
555
555
556 biometryd.operation.mockSuccess(LightDM.Users.data(index, LightDM.UserRoles.UidRole));
556 biometryd.operation.mockSuccess(LightDM.Users.data(index, LightDM.UserRoles.UidRole));
557− compare(viewTryToUnlockSpy.count, 1);
557+ viewTryToUnlockSpy.wait();
558 verify(greeter.locked);
558 verify(greeter.locked);
559 }
559 }
560
560
@@ -579,7 +579,7 @@ Item {
579 verify(biometryd.operation.running);
579 verify(biometryd.operation.running);
580
580
581 biometryd.operation.mockFailure("error");
581 biometryd.operation.mockFailure("error");
582− compare(viewShowErrorMessageSpy.count, 1);
582+ viewShowErrorMessageSpy.wait();
583 compare(viewShowErrorMessageSpy.signalArguments[0][0], i18n.tr("Try again"));
583 compare(viewShowErrorMessageSpy.signalArguments[0][0], i18n.tr("Try again"));
584 }
584 }
585
585
@@ -593,16 +593,17 @@ Item {
593 compare(viewTryToUnlockSpy.count, 0);
593 compare(viewTryToUnlockSpy.count, 0);
594
594
595 biometryd.operation.mockFailure("error");
595 biometryd.operation.mockFailure("error");
596+ viewTryToUnlockSpy.wait();
596− compare(viewTryToUnlockSpy.count, 1);
597+ viewTryToUnlockSpy.clear();
597
598
598 // Confirm that we are stuck in this mode until next login
599 // Confirm that we are stuck in this mode until next login
599 biometryd.operation.mockSuccess(LightDM.Users.data(index, LightDM.UserRoles.UidRole));
600 biometryd.operation.mockSuccess(LightDM.Users.data(index, LightDM.UserRoles.UidRole));
600− compare(viewTryToUnlockSpy.count, 2);
601+ viewTryToUnlockSpy.wait();
601
602
602 unlockAndShowGreeter();
603 unlockAndShowGreeter();
603
604
604 biometryd.operation.mockSuccess(LightDM.Users.data(index, LightDM.UserRoles.UidRole));
605 biometryd.operation.mockSuccess(LightDM.Users.data(index, LightDM.UserRoles.UidRole));
605− verify(!greeter.active);
606+ tryCompare(greeter, "active", false);
606 }
607 }
607
608
608 function test_fingerprintFailureCountReset() {
609 function test_fingerprintFailureCountReset() {
@@ -620,7 +621,7 @@ Item {
620 compare(viewTryToUnlockSpy.count, 0);
621 compare(viewTryToUnlockSpy.count, 0);
621
622
622 biometryd.operation.mockFailure("error");
623 biometryd.operation.mockFailure("error");
623− compare(viewTryToUnlockSpy.count, 1);
624+ viewTryToUnlockSpy.wait();
624 }
625 }
625
626
626 function test_fingerprintWrongUid() {
627 function test_fingerprintWrongUid() {
@@ -631,7 +632,7 @@ Item {
631 biometryd.operation.mockSuccess(0);
632 biometryd.operation.mockSuccess(0);
632
633
633 verify(greeter.active);
634 verify(greeter.active);
634− compare(viewShowErrorMessageSpy.count, 1);
635+ viewShowErrorMessageSpy.wait();
635 compare(viewShowErrorMessageSpy.signalArguments[0][0], i18n.tr("Try again"));
636 compare(viewShowErrorMessageSpy.signalArguments[0][0], i18n.tr("Try again"));
636 }
637 }
637
638
tests/qmltests/Greeter/tst_NarrowView.qml+2−2
@@ -319,7 +319,7 @@ Item {
319 function test_tease(data) {
319 function test_tease(data) {
320 view.dragHandleLeftMargin = data.offset;
320 view.dragHandleLeftMargin = data.offset;
321 tap(view, data.x, 0);
321 tap(view, data.x, 0);
322− compare(teaseSpy.count, data.count);
322+ tryCompare(teaseSpy, "count", data.count);
323 }
323 }
324
324
325 function test_customBackground() {
325 function test_customBackground() {
@@ -340,7 +340,7 @@ Item {
340 view.alphanumeric = false;
340 view.alphanumeric = false;
341 swipeAwayCover();
341 swipeAwayCover();
342 typeString("1234");
342 typeString("1234");
343− compare(respondedSpy.count, 1);
343+ respondedSpy.wait();
344 compare(respondedSpy.signalArguments[0][0], "1234");
344 compare(respondedSpy.signalArguments[0][0], "1234");
345 }
345 }
346
346
tests/qmltests/Notifications/tst_Notifications.qml+12−7
@@ -648,7 +648,8 @@ Item {
648
648
649 // only test the left/cancel-button if two actions have been passed in
649 // only test the left/cancel-button if two actions have been passed in
650 if (data.n.actions.count === 2) {
650 if (data.n.actions.count === 2) {
651− tryCompareFunction(function() { mouseClick(buttonCancel); return actionSpy.signalArguments.length > 0; }, true);
651+ mouseClick(buttonCancel);
652+ actionSpy.wait();
652 compare(actionSpy.signalArguments[0][0], data.n.actions.data(1, ActionModel.RoleActionId), "got wrong id for negative action")
653 compare(actionSpy.signalArguments[0][0], data.n.actions.data(1, ActionModel.RoleActionId), "got wrong id for negative action")
653 actionSpy.clear()
654 actionSpy.clear()
654 }
655 }
@@ -657,7 +658,8 @@ Item {
657 verify(buttonAccept.color === data.buttonTinted ? "#3fb24f" : "#dddddd", "button has the wrong color-tint")
658 verify(buttonAccept.color === data.buttonTinted ? "#3fb24f" : "#dddddd", "button has the wrong color-tint")
658
659
659 // click the positive/right button
660 // click the positive/right button
660− tryCompareFunction(function() { mouseClick(buttonAccept); return actionSpy.signalArguments.length > 0; }, true);
661+ mouseClick(buttonAccept);
662+ actionSpy.wait();
661 compare(actionSpy.signalArguments[0][0], data.n.actions.data(0, ActionModel.RoleActionId), "got wrong id positive action")
663 compare(actionSpy.signalArguments[0][0], data.n.actions.data(0, ActionModel.RoleActionId), "got wrong id positive action")
662 actionSpy.clear()
664 actionSpy.clear()
663
665
@@ -671,17 +673,20 @@ Item {
671
673
672 // try clicking on choices in expanded comboList
674 // try clicking on choices in expanded comboList
673 var choiceButton1 = findChild(notification, "notify_button3")
675 var choiceButton1 = findChild(notification, "notify_button3")
674− tryCompareFunction(function() { mouseClick(choiceButton1); return actionSpy.signalArguments.length > 0; }, true);
676+ mouseClick(choiceButton1);
677+ actionSpy.wait();
675 compare(actionSpy.signalArguments[0][0], data.n.actions.data(3, ActionModel.RoleActionId), "got wrong id choice action 1")
678 compare(actionSpy.signalArguments[0][0], data.n.actions.data(3, ActionModel.RoleActionId), "got wrong id choice action 1")
676 actionSpy.clear()
679 actionSpy.clear()
677
680
678 var choiceButton2 = findChild(notification, "notify_button4")
681 var choiceButton2 = findChild(notification, "notify_button4")
679− tryCompareFunction(function() { mouseClick(choiceButton2); return actionSpy.signalArguments.length > 0; }, true);
682+ mouseClick(choiceButton2);
683+ actionSpy.wait();
680 compare(actionSpy.signalArguments[0][0], data.n.actions.data(4, ActionModel.RoleActionId), "got wrong id choice action 2")
684 compare(actionSpy.signalArguments[0][0], data.n.actions.data(4, ActionModel.RoleActionId), "got wrong id choice action 2")
681 actionSpy.clear()
685 actionSpy.clear()
682
686
683 // click to collapse
687 // click to collapse
684− tryCompareFunction(function() { mouseClick(comboButton, comboButton.width / 2, comboButton.height / 2); return !comboButton.expanded; }, true);
688+ mouseClick(comboButton);
689+ tryCompare(comboButton, "expanded", false);
685 } else {
690 } else {
686 tryCompareFunction(function() { mouseClick(buttonCancel); return actionSpy.signalArguments.length > 0; }, true);
691 tryCompareFunction(function() { mouseClick(buttonCancel); return actionSpy.signalArguments.length > 0; }, true);
687 compare(actionSpy.signalArguments[0][0], data.n.actions.data(1, ActionModel.RoleActionId), "got wrong id for negative action");
692 compare(actionSpy.signalArguments[0][0], data.n.actions.data(1, ActionModel.RoleActionId), "got wrong id for negative action");
@@ -816,8 +821,8 @@ Item {
816 var dragY = notification2.height / 2;
821 var dragY = notification2.height / 2;
817 touchFlick(notification2, dragStart, dragY, dragEnd, dragY);
822 touchFlick(notification2, dragStart, dragY, dragEnd, dragY);
818 waitForRendering(notifications);
823 waitForRendering(notifications);
819− tryCompareFunction(function() { return notification1.expanded; }, true);
824+ tryCompare(notification1, "expanded", true);
820− tryCompareFunction(function() { return notification2.expanded; }, undefined);
825+ tryCompare(notification2, "expanded", undefined);
821 }
826 }
822
827
823 function topmostIsFullscreen_data() {
828 function topmostIsFullscreen_data() {
tests/qmltests/Notifications/tst_OptionToggle.qml+12−6
@@ -242,7 +242,8 @@ Row {
242
242
243 // only test the left/cancel-button if two actions have been passed in
243 // only test the left/cancel-button if two actions have been passed in
244 if (data.actions.length == 2) {
244 if (data.actions.length == 2) {
245− tryCompareFunction(function() { mouseClick(buttonCancel); return actionSpy.signalArguments.length > 0; }, true);
245+ mouseClick(buttonCancel);
246+ actionSpy.wait();
246 compare(actionSpy.signalArguments[0][0], data.actions[1]["id"], "got wrong id for negative action")
247 compare(actionSpy.signalArguments[0][0], data.actions[1]["id"], "got wrong id for negative action")
247 actionSpy.clear()
248 actionSpy.clear()
248 }
249 }
@@ -251,7 +252,8 @@ Row {
251 verify(buttonAccept.color === data.buttonTinted ? "#3fb24f" : "#dddddd", "button has the wrong color-tint")
252 verify(buttonAccept.color === data.buttonTinted ? "#3fb24f" : "#dddddd", "button has the wrong color-tint")
252
253
253 // click the positive/right button
254 // click the positive/right button
254− tryCompareFunction(function() { mouseClick(buttonAccept); return actionSpy.signalArguments.length > 0; }, true);
255+ mouseClick(buttonAccept);
256+ actionSpy.wait();
255 compare(actionSpy.signalArguments[0][0], data.actions[0]["id"], "got wrong id positive action")
257 compare(actionSpy.signalArguments[0][0], data.actions[0]["id"], "got wrong id positive action")
256 actionSpy.clear()
258 actionSpy.clear()
257 waitForRendering(notification)
259 waitForRendering(notification)
@@ -259,23 +261,27 @@ Row {
259 // check if there's a OptionToggle created due to more actions being passed
261 // check if there's a OptionToggle created due to more actions being passed
260 if (data.actions.length > 2) {
262 if (data.actions.length > 2) {
261 var optionToggle = findChild(notification, "notify_button2")
263 var optionToggle = findChild(notification, "notify_button2")
262− tryCompareFunction(function() { return optionToggle.expanded == false; }, true);
264+ tryCompare(optionToggle, "expanded", false);
263
265
264 // click to expand
266 // click to expand
265− tryCompareFunction(function() { mouseClick(optionToggle); return optionToggle.expanded == true; }, true);
267+ mouseClick(optionToggle);
268+ tryCompare(optionToggle, "expanded", true);
266
269
267 // try clicking on choices in expanded comboList
270 // try clicking on choices in expanded comboList
268 var choiceButton1 = findChild(notification, "notify_button3")
271 var choiceButton1 = findChild(notification, "notify_button3")
269− tryCompareFunction(function() { mouseClick(choiceButton1); return actionSpy.signalArguments.length > 0; }, true);
272+ mouseClick(choiceButton1);
273+ actionSpy.wait();
270 compare(actionSpy.signalArguments[0][0], data.actions[3]["id"], "got wrong id choice action 1")
274 compare(actionSpy.signalArguments[0][0], data.actions[3]["id"], "got wrong id choice action 1")
271 actionSpy.clear()
275 actionSpy.clear()
272
276
273 var choiceButton2 = findChild(notification, "notify_button4")
277 var choiceButton2 = findChild(notification, "notify_button4")
274− tryCompareFunction(function() { mouseClick(choiceButton2); return actionSpy.signalArguments.length > 0; }, true);
278+ mouseClick(choiceButton2);
279+ actionSpy.wait();
275 compare(actionSpy.signalArguments[0][0], data.actions[4]["id"], "got wrong id choice action 2")
280 compare(actionSpy.signalArguments[0][0], data.actions[4]["id"], "got wrong id choice action 2")
276 actionSpy.clear()
281 actionSpy.clear()
277 } else {
282 } else {
278 mouseClick(buttonCancel)
283 mouseClick(buttonCancel)
284+ actionSpy.wait();
279 compare(actionSpy.signalArguments[0][0], data.actions[1]["id"], "got wrong id for negative action")
285 compare(actionSpy.signalArguments[0][0], data.actions[1]["id"], "got wrong id for negative action")
280 }
286 }
281 }
287 }
tests/qmltests/Notifications/tst_SwipeToAct.qml+6−2
@@ -283,12 +283,14 @@ Item {
283 var y = swipeMouseArea.height / 2
283 var y = swipeMouseArea.height / 2
284
284
285 if(data.checkSwipeToActAccept) {
285 if(data.checkSwipeToActAccept) {
286− tryCompareFunction(function() { mouseDrag(slider, x, y, (swipeMouseArea.width / 2) - slider.width, 0); return actionSpy.signalArguments.length > 0; }, true);
286+ mouseDrag(slider, x, y, (swipeMouseArea.width / 2) - slider.width, 0);
287+ actionSpy.wait();
287 compare(actionSpy.signalArguments[0][0], data.actions.data(0, ActionModel.RoleActionId), "got wrong id for positive action");
288 compare(actionSpy.signalArguments[0][0], data.actions.data(0, ActionModel.RoleActionId), "got wrong id for positive action");
288 actionSpy.clear();
289 actionSpy.clear();
289 }
290 }
290 if(data.checkSwipeToActReject) {
291 if(data.checkSwipeToActReject) {
291− tryCompareFunction(function() { mouseDrag(slider, x, y, -(swipeMouseArea.width / 2), 0); return actionSpy.signalArguments.length > 0; }, true);
292+ mouseDrag(slider, x, y, -(swipeMouseArea.width / 2), 0);
293+ actionSpy.wait();
292 compare(actionSpy.signalArguments[0][0], data.actions.data(1, ActionModel.RoleActionId), "got wrong id for negative action");
294 compare(actionSpy.signalArguments[0][0], data.actions.data(1, ActionModel.RoleActionId), "got wrong id for negative action");
293 actionSpy.clear();
295 actionSpy.clear();
294 }
296 }
@@ -302,12 +304,14 @@ Item {
302
304
303 if(data.checkSwipeToActAccept) {
305 if(data.checkSwipeToActAccept) {
304 mouseClick(rightButton);
306 mouseClick(rightButton);
307+ actionSpy.wait();
305 compare(actionSpy.signalArguments[0][0], data.actions.data(0, ActionModel.RoleActionId), "got wrong id for positive action");
308 compare(actionSpy.signalArguments[0][0], data.actions.data(0, ActionModel.RoleActionId), "got wrong id for positive action");
306 actionSpy.clear();
309 actionSpy.clear();
307 }
310 }
308
311
309 if(data.checkSwipeToActReject) {
312 if(data.checkSwipeToActReject) {
310 mouseClick(leftButton);
313 mouseClick(leftButton);
314+ actionSpy.wait();
311 compare(actionSpy.signalArguments[0][0], data.actions.data(1, ActionModel.RoleActionId), "got wrong id for negative action");
315 compare(actionSpy.signalArguments[0][0], data.actions.data(1, ActionModel.RoleActionId), "got wrong id for negative action");
312 actionSpy.clear();
316 actionSpy.clear();
313 }
317 }
tests/qmltests/Notifications/tst_VisualSnapDecisionsQueue.qml+3−3
@@ -210,9 +210,9 @@ Row {
210 mouseClick(snap_decision[index])
210 mouseClick(snap_decision[index])
211 for (var kindex = 0; kindex < snap_decision.length; kindex++) {
211 for (var kindex = 0; kindex < snap_decision.length; kindex++) {
212 if (kindex == index) {
212 if (kindex == index) {
213− compare(snap_decision[kindex].expanded, true, "state of "+ kindex + ".snap-decision is not expanded");
213+ tryCompare(snap_decision[kindex], "expanded", true, 5000, "state of "+ kindex + ".snap-decision is not expanded");
214 } else {
214 } else {
215− compare(snap_decision[kindex].expanded, false, "state of "+ kindex + ".snap-decision is not contracted");
215+ tryCompare(snap_decision[kindex], "expanded", false, 5000, "state of "+ kindex + ".snap-decision is not contracted");
216 }
216 }
217 }
217 }
218 }
218 }
@@ -225,7 +225,7 @@ Row {
225
225
226 for (var index = 1; index < snap_decision.length; index++) {
226 for (var index = 1; index < snap_decision.length; index++) {
227 removeTopMostNotification();
227 removeTopMostNotification();
228− compare(snap_decision[index].expanded, true, "state of " + index + ". snap-decision is not expanded");
228+ tryCompare(snap_decision[index], "expanded", true, 5000, "state of " + index + ". snap-decision is not expanded");
229 }
229 }
230 }
230 }
231 }
231 }
tests/qmltests/Panel/Indicators/tst_IndicatorMenuItemFactory.qml+33−79
@@ -89,6 +89,12 @@ Item {
89 verify(loader.item == null);
89 verify(loader.item == null);
90 }
90 }
91
91
92+ function loadData(menuData) {
93+ loader.data = menuData;
94+ loader.sourceComponent = factory.load(menuData);
95+ tryVerify(function() { return loader.item; });
96+ }
97+
92 function test_createTypes_data() {
98 function test_createTypes_data() {
93 return [
99 return [
94 { tag: 'volume', type: "unity.widgets.systemsettings.tablet.volumecontrol", objectName: "sliderMenu" },
100 { tag: 'volume', type: "unity.widgets.systemsettings.tablet.volumecontrol", objectName: "sliderMenu" },
@@ -127,9 +133,7 @@ Item {
127 function test_createTypes(data) {
133 function test_createTypes(data) {
128 menuData.type = data.type;
134 menuData.type = data.type;
129
135
130− loader.data = menuData;
136+ loadData(menuData);
131− loader.sourceComponent = factory.load(menuData);
132− tryCompareFunction(function() { return loader.item != undefined; }, true);
133 compare(loader.item.objectName, data.objectName, "Created object name does not match intended object (" + loader.item.objectName + " != " + data.objectName + ")");
137 compare(loader.item.objectName, data.objectName, "Created object name does not match intended object (" + loader.item.objectName + " != " + data.objectName + ")");
134 }
138 }
135
139
@@ -137,27 +141,21 @@ Item {
137 var tmpData = menuData;
141 var tmpData = menuData;
138 tmpData.isCheck = true;
142 tmpData.isCheck = true;
139
143
140− loader.data = tmpData;
144+ loadData(tmpData);
141− loader.sourceComponent = factory.load(tmpData);
142− tryCompareFunction(function() { return loader.item != undefined; }, true);
143 compare(loader.item.objectName, "checkableMenu", "Should have created a checkable menu");
145 compare(loader.item.objectName, "checkableMenu", "Should have created a checkable menu");
144 }
146 }
145
147
146 function test_create_radio() {
148 function test_create_radio() {
147 menuData.isRadio = true;
149 menuData.isRadio = true;
148
150
149− loader.data = menuData;
151+ loadData(menuData);
150− loader.sourceComponent = factory.load(menuData);
151− tryCompareFunction(function() { return loader.item != undefined; }, true);
152 compare(loader.item.objectName, "radioMenu", "Should have created a radio menu");
152 compare(loader.item.objectName, "radioMenu", "Should have created a radio menu");
153 }
153 }
154
154
155 function test_create_separator() {
155 function test_create_separator() {
156 menuData.isSeparator = true;
156 menuData.isSeparator = true;
157
157
158− loader.data = menuData;
158+ loadData(menuData);
159− loader.sourceComponent = factory.load(menuData);
160− tryCompareFunction(function() { return loader.item != undefined; }, true);
161 compare(loader.item.objectName, "separatorMenu", "Should have created a separator menu");
159 compare(loader.item.objectName, "separatorMenu", "Should have created a separator menu");
162 }
160 }
163
161
@@ -180,9 +178,7 @@ Item {
180 };
178 };
181 menuData.actionState = data.value1;
179 menuData.actionState = data.value1;
182
180
183− loader.data = menuData;
181+ loadData(menuData);
184− loader.sourceComponent = factory.load(menuData);
185− tryCompareFunction(function() { return loader.item != undefined; }, true);
186 compare(loader.item.objectName, "sliderMenu", "Should have created a slider menu");
182 compare(loader.item.objectName, "sliderMenu", "Should have created a slider menu");
187
183
188 compare(loader.item.text, data.tag, "Label does not match data");
184 compare(loader.item.text, data.tag, "Label does not match data");
@@ -217,9 +213,7 @@ Item {
217 };
213 };
218 menuData.actionState = data.value1;
214 menuData.actionState = data.value1;
219
215
220− loader.data = menuData;
216+ loadData(menuData);
221− loader.sourceComponent = factory.load(menuData);
222− tryCompareFunction(function() { return loader.item != undefined; }, true);
223 compare(loader.item.value, data.value1, "Value does not match data");
217 compare(loader.item.value, data.value1, "Value does not match data");
224
218
225 var slider = findChild(loader.item, "slider");
219 var slider = findChild(loader.item, "slider");
@@ -247,9 +241,7 @@ Item {
247 menuData.label = data.label;
241 menuData.label = data.label;
248 menuData.sensitive = data.enabled;
242 menuData.sensitive = data.enabled;
249
243
250− loader.data = menuData;
244+ loadData(menuData);
251− loader.sourceComponent = factory.load(menuData);
252− tryCompareFunction(function() { return loader.item != undefined; }, true);
253 compare(loader.item.objectName, "buttonMenu", "Should have created a button menu");
245 compare(loader.item.objectName, "buttonMenu", "Should have created a button menu");
254
246
255 compare(loader.item.buttonText, data.label, "Label does not match data");
247 compare(loader.item.buttonText, data.label, "Label does not match data");
@@ -267,9 +259,7 @@ Item {
267 menuData.type = "com.canonical.indicator.section"
259 menuData.type = "com.canonical.indicator.section"
268 menuData.label = data.label;
260 menuData.label = data.label;
269
261
270− loader.data = menuData;
262+ loadData(menuData);
271− loader.sourceComponent = factory.load(menuData);
272− tryCompareFunction(function() { return loader.item != undefined; }, true);
273 compare(loader.item.objectName, "sectionMenu", "Should have created a section menu");
263 compare(loader.item.objectName, "sectionMenu", "Should have created a section menu");
274
264
275 compare(loader.item.text, data.label, "Label does not match data");
265 compare(loader.item.text, data.label, "Label does not match data");
@@ -287,9 +277,7 @@ Item {
287 menuData.label = data.label;
277 menuData.label = data.label;
288 menuData.actionState = data.value;
278 menuData.actionState = data.value;
289
279
290− loader.data = menuData;
280+ loadData(menuData);
291− loader.sourceComponent = factory.load(menuData);
292− tryCompareFunction(function() { return loader.item != undefined; }, true);
293 compare(loader.item.objectName, "progressMenu", "Should have created a progress menu");
281 compare(loader.item.objectName, "progressMenu", "Should have created a progress menu");
294
282
295 compare(loader.item.text, data.label, "Label does not match data");
283 compare(loader.item.text, data.label, "Label does not match data");
@@ -309,9 +297,7 @@ Item {
309 menuData.sensitive = data.enabled;
297 menuData.sensitive = data.enabled;
310 menuData.icon = data.icon;
298 menuData.icon = data.icon;
311
299
312− loader.data = menuData;
300+ loadData(menuData);
313− loader.sourceComponent = factory.load(menuData);
314− tryCompareFunction(function() { return loader.item != undefined; }, true);
315 compare(loader.item.objectName, "standardMenu", "Should have created a standard menu");
301 compare(loader.item.objectName, "standardMenu", "Should have created a standard menu");
316
302
317 compare(loader.item.text, data.label, "Label does not match data");
303 compare(loader.item.text, data.label, "Label does not match data");
@@ -333,9 +319,7 @@ Item {
333 menuData.isCheck = true;
319 menuData.isCheck = true;
334 menuData.isToggled = data.checked;
320 menuData.isToggled = data.checked;
335
321
336− loader.data = menuData;
322+ loadData(menuData);
337− loader.sourceComponent = factory.load(menuData);
338− tryCompareFunction(function() { return loader.item != undefined; }, true);
339 compare(loader.item.objectName, "checkableMenu", "Should have created a checkable menu");
323 compare(loader.item.objectName, "checkableMenu", "Should have created a checkable menu");
340
324
341 compare(loader.item.text, data.label, "Label does not match data");
325 compare(loader.item.text, data.label, "Label does not match data");
@@ -357,9 +341,7 @@ Item {
357 menuData.isRadio = true;
341 menuData.isRadio = true;
358 menuData.isToggled = data.checked;
342 menuData.isToggled = data.checked;
359
343
360− loader.data = menuData;
344+ loadData(menuData);
361− loader.sourceComponent = factory.load(menuData);
362− tryCompareFunction(function() { return loader.item != undefined; }, true);
363 compare(loader.item.objectName, "radioMenu", "Should have created a radio menu");
345 compare(loader.item.objectName, "radioMenu", "Should have created a radio menu");
364
346
365 compare(loader.item.text, data.label, "Label does not match data");
347 compare(loader.item.text, data.label, "Label does not match data");
@@ -385,9 +367,7 @@ Item {
385 'xCanonicalSubtitleAction': data.subtitleAction,
367 'xCanonicalSubtitleAction': data.subtitleAction,
386 };
368 };
387
369
388− loader.data = menuData;
370+ loadData(menuData);
389− loader.sourceComponent = factory.load(menuData);
390− tryCompareFunction(function() { return loader.item != undefined; }, true);
391 compare(loader.item.objectName, "switchMenu", "Should have created a switch menu");
371 compare(loader.item.objectName, "switchMenu", "Should have created a switch menu");
392
372
393 compare(loader.item.text, data.label, "Label does not match data");
373 compare(loader.item.text, data.label, "Label does not match data");
@@ -415,9 +395,7 @@ Item {
415 'xCanonicalTime': data.time.getTime() / 1000 // expected in seconds
395 'xCanonicalTime': data.time.getTime() / 1000 // expected in seconds
416 };
396 };
417
397
418− loader.data = menuData;
398+ loadData(menuData);
419− loader.sourceComponent = factory.load(menuData);
420− tryCompareFunction(function() { return loader.item != undefined; }, true);
421 compare(loader.item.objectName, "alarmMenu", "Should have created a alarm menu");
399 compare(loader.item.objectName, "alarmMenu", "Should have created a alarm menu");
422
400
423 compare(loader.item.text, data.label, "Label does not match data");
401 compare(loader.item.text, data.label, "Label does not match data");
@@ -445,9 +423,7 @@ Item {
445 'xCanonicalTime': data.time.getTime() / 1000 // expected in seconds
423 'xCanonicalTime': data.time.getTime() / 1000 // expected in seconds
446 };
424 };
447
425
448− loader.data = menuData;
426+ loadData(menuData);
449− loader.sourceComponent = factory.load(menuData);
450− tryCompareFunction(function() { return loader.item != undefined; }, true);
451 compare(loader.item.objectName, "appointmentMenu", "Should have created a appointment menu");
427 compare(loader.item.objectName, "appointmentMenu", "Should have created a appointment menu");
452
428
453 compare(loader.item.text, data.label, "Label does not match data");
429 compare(loader.item.text, data.label, "Label does not match data");
@@ -527,9 +503,7 @@ Item {
527 'xCanonicalUid': data.tag
503 'xCanonicalUid': data.tag
528 };
504 };
529
505
530− loader.data = menuData;
506+ loadData(menuData);
531− loader.sourceComponent = factory.load(menuData);
532− tryCompareFunction(function() { return loader.item != undefined; }, true);
533 compare(loader.item.objectName, "transferMenu", "Should have created a transfer menu");
507 compare(loader.item.objectName, "transferMenu", "Should have created a transfer menu");
534
508
535 compare(loader.item.text, data.label, "Label does not match data");
509 compare(loader.item.text, data.label, "Label does not match data");
@@ -556,9 +530,7 @@ Item {
556 'xCanonicalExtraLabel': data.buttonText
530 'xCanonicalExtraLabel': data.buttonText
557 };
531 };
558
532
559− loader.data = menuData;
533+ loadData(menuData);
560− loader.sourceComponent = factory.load(menuData);
561− tryCompareFunction(function() { return loader.item != undefined; }, true);
562 compare(loader.item.objectName, "buttonSectionMenu", "Should have created a transfer menu");
534 compare(loader.item.objectName, "buttonSectionMenu", "Should have created a transfer menu");
563
535
564 compare(loader.item.text, data.label, "Label does not match data");
536 compare(loader.item.text, data.label, "Label does not match data");
@@ -580,9 +552,7 @@ Item {
580 menuData.label = data.label;
552 menuData.label = data.label;
581 menuData.ext = { 'xCanonicalBusyAction': data.busy }
553 menuData.ext = { 'xCanonicalBusyAction': data.busy }
582
554
583− loader.data = menuData;
555+ loadData(menuData);
584− loader.sourceComponent = factory.load(menuData);
585− tryCompareFunction(function() { return loader.item != undefined; }, true);
586 compare(loader.item.objectName, "wifiSection", "Should have created a wifi section menu");
556 compare(loader.item.objectName, "wifiSection", "Should have created a wifi section menu");
587
557
588 compare(loader.item.text, data.label, "Label does not match data");
558 compare(loader.item.text, data.label, "Label does not match data");
@@ -607,9 +577,7 @@ Item {
607 'xCanonicalWifiApIsAdhoc': data.adHoc,
577 'xCanonicalWifiApIsAdhoc': data.adHoc,
608 };
578 };
609
579
610− loader.data = menuData;
580+ loadData(menuData);
611− loader.sourceComponent = factory.load(menuData);
612− tryCompareFunction(function() { return loader.item != undefined; }, true);
613 compare(loader.item.objectName, "accessPoint", "Should have created a access point menu");
581 compare(loader.item.objectName, "accessPoint", "Should have created a access point menu");
614
582
615 compare(loader.item.text, data.label, "Label does not match data");
583 compare(loader.item.text, data.label, "Label does not match data");
@@ -647,9 +615,7 @@ Item {
647 'xCanonicalModemLockedAction': data.unlockAction,
615 'xCanonicalModemLockedAction': data.unlockAction,
648 };
616 };
649
617
650− loader.data = menuData;
618+ loadData(menuData);
651− loader.sourceComponent = factory.load(menuData);
652− tryCompareFunction(function() { return loader.item != undefined; }, true);
653 compare(loader.item.objectName, "modemInfoItem", "Should have created a modem info item.");
619 compare(loader.item.objectName, "modemInfoItem", "Should have created a modem info item.");
654
620
655 compare(loader.item.statusLabelAction.name, data.statusLabelAction, "StatusLabel action incorrect");
621 compare(loader.item.statusLabelAction.name, data.statusLabelAction, "StatusLabel action incorrect");
@@ -664,9 +630,7 @@ Item {
664 function test_create_messageItem() {
630 function test_create_messageItem() {
665 menuData.type = "com.canonical.indicator.messages.messageitem";
631 menuData.type = "com.canonical.indicator.messages.messageitem";
666
632
667− loader.data = menuData;
633+ loadData(menuData);
668− loader.sourceComponent = factory.load(menuData);
669− tryCompareFunction(function() { return loader.item != undefined; }, true);
670 compare(loader.item.objectName, "messageItem", "Should have created a message menu");
634 compare(loader.item.objectName, "messageItem", "Should have created a message menu");
671 }
635 }
672
636
@@ -686,9 +650,7 @@ Item {
686 menuData.actionState = [data.count];
650 menuData.actionState = [data.count];
687 menuData.isToggled = true;
651 menuData.isToggled = true;
688
652
689− loader.data = menuData;
653+ loadData(menuData);
690− loader.sourceComponent = factory.load(menuData);
691− tryCompareFunction(function() { return loader.item != undefined; }, true);
692 compare(loader.item.objectName, "groupedMessage", "Should have created a group message menu");
654 compare(loader.item.objectName, "groupedMessage", "Should have created a group message menu");
693
655
694 compare(loader.item.text, data.label, "Label does not match data");
656 compare(loader.item.text, data.label, "Label does not match data");
@@ -749,9 +711,7 @@ Item {
749 'state': data.state,
711 'state': data.state,
750 };
712 };
751
713
752− loader.data = menuData;
714+ loadData(menuData);
753− loader.sourceComponent = factory.load(menuData);
754− tryCompareFunction(function() { return loader.item != undefined; }, true);
755 compare(loader.item.objectName, "mediaPayerMenu", "Should have created a media player menu");
715 compare(loader.item.objectName, "mediaPayerMenu", "Should have created a media player menu");
756
716
757 compare(loader.item.playerIcon, data.icon, "Album art does not match data");
717 compare(loader.item.playerIcon, data.icon, "Album art does not match data");
@@ -789,9 +749,7 @@ Item {
789 'xCanonicalPreviousAction': data.previousAction
749 'xCanonicalPreviousAction': data.previousAction
790 };
750 };
791
751
792− loader.data = menuData;
752+ loadData(menuData);
793− loader.sourceComponent = factory.load(menuData);
794− tryCompareFunction(function() { return loader.item != undefined; }, true);
795 compare(loader.item.objectName, "playbackItemMenu", "Should have created a playback menu");
753 compare(loader.item.objectName, "playbackItemMenu", "Should have created a playback menu");
796
754
797 compare(loader.item.playing, false, "Playing does not match data");
755 compare(loader.item.playing, false, "Playing does not match data");
@@ -809,8 +767,7 @@ Item {
809 menuData.sensitive = true;
767 menuData.sensitive = true;
810 menuData.isToggled = false;
768 menuData.isToggled = false;
811
769
812− loader.data = menuData;
770+ loadData(menuData);
813− loader.sourceComponent = factory.load(menuData);
814
771
815 compare(loader.item.checked, false, "Loader did not load check state");
772 compare(loader.item.checked, false, "Loader did not load check state");
816 mouseClick(loader.item,
773 mouseClick(loader.item,
@@ -829,8 +786,7 @@ Item {
829 menuData.sensitive = true;
786 menuData.sensitive = true;
830 menuData.isToggled = false;
787 menuData.isToggled = false;
831
788
832− loader.data = menuData;
789+ loadData(menuData);
833− loader.sourceComponent = factory.load(menuData);
834
790
835 var sync = findInvisibleChild(loader.item, "sync");
791 var sync = findInvisibleChild(loader.item, "sync");
836 verify(sync);
792 verify(sync);
@@ -859,9 +815,7 @@ Item {
859 "appointment-days": data.eventDays
815 "appointment-days": data.eventDays
860 }
816 }
861
817
862− loader.data = menuData;
818+ loadData(menuData);
863− loader.sourceComponent = factory.load(menuData);
864− tryCompareFunction(function() { return loader.item != undefined; }, true);
865 compare(loader.item.objectName, "calendarMenu", "Should have created a calendar menu")
819 compare(loader.item.objectName, "calendarMenu", "Should have created a calendar menu")
866
820
867 compare(loader.item.currentDate.getFullYear(), data.calendarDay.getFullYear(), "Calendar year does not match data")
821 compare(loader.item.currentDate.getFullYear(), data.calendarDay.getFullYear(), "Calendar year does not match data")
tests/qmltests/Panel/tst_ActiveCallHint.qml+8−6
@@ -113,7 +113,7 @@ Item {
113 callManager.foregroundCall = data.call;
113 callManager.foregroundCall = data.call;
114 callManager.callIndicatorVisible = data.visible;
114 callManager.callIndicatorVisible = data.visible;
115
115
116− compare(callHint.active, data.expected, "Call hint should be active when callIndicatorVisible=true");
116+ tryCompare(callHint, "active", data.expected, 5000, "Call hint should be active when callIndicatorVisible=true");
117
117
118 if (data.dialer) {
118 if (data.dialer) {
119 // clean up
119 // clean up
@@ -137,7 +137,7 @@ Item {
137 callManager.backgroundCall = data.background;
137 callManager.backgroundCall = data.background;
138
138
139 var contactLabel = findChild(callHint, "contactLabel");
139 var contactLabel = findChild(callHint, "contactLabel");
140− verify(contactLabel !== null);
140+ verify(contactLabel);
141
141
142 compare(contactLabel.text, data.label, "Contact label does not match call");
142 compare(contactLabel.text, data.label, "Contact label does not match call");
143 }
143 }
@@ -146,7 +146,7 @@ Item {
146 callManager.backgroundCall = call3;
146 callManager.backgroundCall = call3;
147
147
148 var contactLabel = findChild(callHint, "contactLabel");
148 var contactLabel = findChild(callHint, "contactLabel");
149− verify(contactLabel !== null);
149+ verify(contactLabel);
150
150
151 contactWactherData.contactData = { "+447812221113": { "alias": "Bob's Uncle" } };
151 contactWactherData.contactData = { "+447812221113": { "alias": "Bob's Uncle" } };
152 compare(contactLabel.text, "Bob's Uncle", "Contact label does not match call");
152 compare(contactLabel.text, "Bob's Uncle", "Contact label does not match call");
@@ -171,22 +171,24 @@ Item {
171 call1.elapsedTime = data.elpasedTime;
171 call1.elapsedTime = data.elpasedTime;
172
172
173 var timeLabel = findChild(callHint, "timeLabel");
173 var timeLabel = findChild(callHint, "timeLabel");
174− verify(timeLabel !== null);
174+ verify(timeLabel);
175
175
176 compare(timeLabel.text, data.initial);
176 compare(timeLabel.text, data.initial);
177 call1.elapsedTime = call1.elapsedTime + 1;
177 call1.elapsedTime = call1.elapsedTime + 1;
178− compare(timeLabel.text, data.expected);
178+ tryCompare(timeLabel, "text", data.expected);
179 }
179 }
180
180
181 function test_displayedLabelChangesOverTime() {
181 function test_displayedLabelChangesOverTime() {
182 callManager.backgroundCall = call3;
182 callManager.backgroundCall = call3;
183
183
184 var labelPathView = findChild(callHint, "labelPathView");
184 var labelPathView = findChild(callHint, "labelPathView");
185− verify(labelPathView !== null);
185+ verify(labelPathView);
186
186
187 var currentOffset = labelPathView.offset
187 var currentOffset = labelPathView.offset
188+ wait(1100);
188 tryCompareFunction(function() { return labelPathView.offset !== currentOffset }, true);
189 tryCompareFunction(function() { return labelPathView.offset !== currentOffset }, true);
189 currentOffset = labelPathView.offset
190 currentOffset = labelPathView.offset
191+ wait(1100);
190 tryCompareFunction(function() { return labelPathView.offset !== currentOffset }, true);
192 tryCompareFunction(function() { return labelPathView.offset !== currentOffset }, true);
191 }
193 }
192 }
194 }
tests/qmltests/Panel/tst_MenuContent.qml+2−2
@@ -124,7 +124,7 @@ PanelTest {
124
124
125 activate_content(menuIndex);
125 activate_content(menuIndex);
126 testItemObjectName = indicatorsModel.data(menuIndex, Indicators.IndicatorsModelRole.Identifier);
126 testItemObjectName = indicatorsModel.data(menuIndex, Indicators.IndicatorsModelRole.Identifier);
127− compare(listView.currentIndex, menuIndex, "Current tab index does not match selected tab index");
127+ tryCompare(listView, "currentIndex", menuIndex, 5000, "Current tab index does not match selected tab index");
128 tryCompareFunction(current_item_equals_test_item, true);
128 tryCompareFunction(current_item_equals_test_item, true);
129 }
129 }
130 }
130 }
@@ -136,7 +136,7 @@ PanelTest {
136
136
137 for (var i = 0; i < 100; i++) {
137 for (var i = 0; i < 100; i++) {
138 activate_content(i % menuCount);
138 activate_content(i % menuCount);
139− compare(menuContent.currentMenuIndex, i%menuCount);
139+ tryCompare(menuContent, "currentMenuIndex", i%menuCount);
140 }
140 }
141 }
141 }
142 }
142 }
tests/qmltests/Panel/tst_Panel.qml+25−22
@@ -265,7 +265,7 @@ PanelTest {
265
265
266 // Put the mouse somewhere neutral so it doesn't hover over things
266 // Put the mouse somewhere neutral so it doesn't hover over things
267 // and mess up the test
267 // and mess up the test
268− mouseMove(root, 0, 100);
268+ mouseMove(root, 0, 0);
269
269
270 // Wait for the indicators to get into position.
270 // Wait for the indicators to get into position.
271 // (switches between normal and fullscreen modes are animated)
271 // (switches between normal and fullscreen modes are animated)
@@ -285,11 +285,13 @@ PanelTest {
285 panel.indicators.hide();
285 panel.indicators.hide();
286 panel.applicationMenus.hide();
286 panel.applicationMenus.hide();
287 waitForAllAnimationToComplete("initial");
287 waitForAllAnimationToComplete("initial");
288+ tryCompare(panel.indicators, "fullyClosed", true);
289+ tryCompare(panel.applicationMenus, "fullyClosed", true);
288 }
290 }
289
291
290 function get_indicator_item(index) {
292 function get_indicator_item(index) {
291 var indicatorItem = findChild(panel, root.originalModelData[index]["identifier"]+"-panelItem");
293 var indicatorItem = findChild(panel, root.originalModelData[index]["identifier"]+"-panelItem");
292− verify(indicatorItem !== null);
294+ verify(indicatorItem);
293
295
294 return indicatorItem;
296 return indicatorItem;
295 }
297 }
@@ -305,7 +307,7 @@ PanelTest {
305 var indicatorItem = get_indicator_item(i);
307 var indicatorItem = get_indicator_item(i);
306
308
307 var itemState = findInvisibleChild(indicatorItem, "indicatorItemState");
309 var itemState = findInvisibleChild(indicatorItem, "indicatorItemState");
308− verify(itemState !== null);
310+ verify(itemState);
309
311
310 waitUntilTransitionsEnd(itemState);
312 waitUntilTransitionsEnd(itemState);
311 }
313 }
@@ -357,13 +359,13 @@ PanelTest {
357 callManager.foregroundCall = data.call;
359 callManager.foregroundCall = data.call;
358
360
359 var panelRow = findChild(panel.indicators, "panelItemRow");
361 var panelRow = findChild(panel.indicators, "panelItemRow");
360− verify(panelRow !== null);
362+ verify(panelRow);
361
363
362 var menuContent = findChild(panel.indicators, "menuContent");
364 var menuContent = findChild(panel.indicators, "menuContent");
363− verify(menuContent !== null);
365+ verify(menuContent);
364
366
365 var panelArea = findChild(panel, "panelArea");
367 var panelArea = findChild(panel, "panelArea");
366− verify(panelArea !== null);
368+ verify(panelArea);
367
369
368 // Wait for the indicators to get into position.
370 // Wait for the indicators to get into position.
369 // (switches between normal and fullscreen modes are animated)
371 // (switches between normal and fullscreen modes are animated)
@@ -417,10 +419,10 @@ PanelTest {
417 callManager.foregroundCall = data.call;
419 callManager.foregroundCall = data.call;
418
420
419 var panelRow = findChild(data.section, "panelItemRow");
421 var panelRow = findChild(data.section, "panelItemRow");
420− verify(panelRow !== null);
422+ verify(panelRow);
421
423
422 var panelArea = findChild(panel, "panelArea");
424 var panelArea = findChild(panel, "panelArea");
423− verify(panelArea !== null);
425+ verify(panelArea);
424
426
425 // Wait for the indicators to get into position.
427 // Wait for the indicators to get into position.
426 // (switches between normal and fullscreen modes are animated)
428 // (switches between normal and fullscreen modes are animated)
@@ -480,7 +482,7 @@ PanelTest {
480 var hintingAnimation = findInvisibleChild(showDragHandle, "hintingAnimation");
482 var hintingAnimation = findInvisibleChild(showDragHandle, "hintingAnimation");
481 verify(hintingAnimation);
483 verify(hintingAnimation);
482
484
483− compare(hintingAnimation.running, data.hintExpected)
485+ tryCompare(hintingAnimation, "running", data.hintExpected);
484 tryCompare(hintingAnimation, "running", false); // wait till animation completes
486 tryCompare(hintingAnimation, "running", false); // wait till animation completes
485
487
486 // no hint animation when fullscreen
488 // no hint animation when fullscreen
@@ -507,13 +509,13 @@ PanelTest {
507 callManager.foregroundCall = data.call;
509 callManager.foregroundCall = data.call;
508
510
509 var panelRow = findChild(panel.indicators, "panelItemRow");
511 var panelRow = findChild(panel.indicators, "panelItemRow");
510− verify(panelRow !== null);
512+ verify(panelRow);
511
513
512 var menuContent = findChild(panel.indicators, "menuContent");
514 var menuContent = findChild(panel.indicators, "menuContent");
513− verify(menuContent !== null);
515+ verify(menuContent);
514
516
515 var panelArea = findChild(panel, "panelArea");
517 var panelArea = findChild(panel, "panelArea");
516− verify(panelArea !== null);
518+ verify(panelArea);
517
519
518 // Wait for the indicators to get into position.
520 // Wait for the indicators to get into position.
519 // (switches between normal and fullscreen modes are animated)
521 // (switches between normal and fullscreen modes are animated)
@@ -528,7 +530,8 @@ PanelTest {
528 // They should be at least half-way through the screen
530 // They should be at least half-way through the screen
529 tryCompareFunction(
531 tryCompareFunction(
530 function() {return panel.applicationMenus.height >= panel.height * 0.5},
532 function() {return panel.applicationMenus.height >= panel.height * 0.5},
531− true);
533+ true
534+ );
532
535
533 touchRelease(panel, units.gu(1), panel.height);
536 touchRelease(panel, units.gu(1), panel.height);
534
537
@@ -562,7 +565,7 @@ PanelTest {
562 tryCompare(panel.indicators, "fullyClosed", true);
565 tryCompare(panel.indicators, "fullyClosed", true);
563 compare(backgroundPressedSpy.count, 0);
566 compare(backgroundPressedSpy.count, 0);
564 tap(panel, touchPosX, touchPosY);
567 tap(panel, touchPosX, touchPosY);
565− compare(backgroundPressedSpy.count, 2);
568+ tryCompare(backgroundPressedSpy, "count", 2);
566
569
567 pullDownIndicatorsMenu();
570 pullDownIndicatorsMenu();
568
571
@@ -589,7 +592,7 @@ PanelTest {
589 // Now that's fully closed, input should go through again
592 // Now that's fully closed, input should go through again
590 backgroundPressedSpy.clear();
593 backgroundPressedSpy.clear();
591 tap(panel, touchPosX, touchPosY);
594 tap(panel, touchPosX, touchPosY);
592− compare(backgroundPressedSpy.count, 2);
595+ tryCompare(backgroundPressedSpy, "count", 2);
593 }
596 }
594
597
595 function test_darkenedAreaEatsAllApplicationMenuEvents() {
598 function test_darkenedAreaEatsAllApplicationMenuEvents() {
@@ -605,7 +608,7 @@ PanelTest {
605 tryCompare(panel.applicationMenus, "fullyClosed", true);
608 tryCompare(panel.applicationMenus, "fullyClosed", true);
606 compare(backgroundPressedSpy.count, 0);
609 compare(backgroundPressedSpy.count, 0);
607 tap(panel, touchPosX, touchPosY);
610 tap(panel, touchPosX, touchPosY);
608− compare(backgroundPressedSpy.count, 2);
611+ tryCompare(backgroundPressedSpy, "count", 2);
609
612
610 pullDownApplicationsMenu();
613 pullDownApplicationsMenu();
611
614
@@ -632,7 +635,7 @@ PanelTest {
632 // Now that's fully closed, input should go through again
635 // Now that's fully closed, input should go through again
633 backgroundPressedSpy.clear();
636 backgroundPressedSpy.clear();
634 tap(panel, touchPosX, touchPosY);
637 tap(panel, touchPosX, touchPosY);
635− compare(backgroundPressedSpy.count, 2);
638+ tryCompare(backgroundPressedSpy, "count", 2);
636 }
639 }
637
640
638
641
@@ -696,7 +699,7 @@ PanelTest {
696 panel.indicators.width / 2,
699 panel.indicators.width / 2,
697 panel.minimizedPanelHeight / 2);
700 panel.minimizedPanelHeight / 2);
698
701
699− compare(panel.indicators.shown, true);
702+ tryCompare(panel.indicators, "shown", true);
700 tryCompare(panel.indicators, "fullyOpened", true);
703 tryCompare(panel.indicators, "fullyOpened", true);
701
704
702 var handle = findChild(panel.indicators, "handle");
705 var handle = findChild(panel.indicators, "handle");
@@ -704,7 +707,7 @@ PanelTest {
704
707
705 mouseClick(handle);
708 mouseClick(handle);
706
709
707− compare(panel.indicators.shown, false);
710+ tryCompare(panel.indicators, "shown", false);
708 tryCompare(panel.indicators, "fullyClosed", true);
711 tryCompare(panel.indicators, "fullyClosed", true);
709 }
712 }
710
713
@@ -718,7 +721,7 @@ PanelTest {
718 // click in very topleft corner and verify the close button got clicked too
721 // click in very topleft corner and verify the close button got clicked too
719 mouseMove(panel, 0, 0);
722 mouseMove(panel, 0, 0);
720 mouseClick(panel, 0, 0, undefined /*button*/, undefined /*modifiers*/, 100 /*short delay*/);
723 mouseClick(panel, 0, 0, undefined /*button*/, undefined /*modifiers*/, 100 /*short delay*/);
721− compare(windowControlButtonsSpy.count, 1);
724+ windowControlButtonsSpy.wait();
722 }
725 }
723
726
724 function test_hidingKeyboardIndicator_data() {
727 function test_hidingKeyboardIndicator_data() {
@@ -848,7 +851,7 @@ PanelTest {
848
851
849 keyClick(Qt.Key_Right);
852 keyClick(Qt.Key_Right);
850 tryCompare(indicatorsBar, "currentItemIndex", 1);
853 tryCompare(indicatorsBar, "currentItemIndex", 1);
851− compare(aboutToShowCalledSpy.count, 2);
854+ tryCompare(aboutToShowCalledSpy, "count", 2);
852
855
853 compare(aboutToShowCalledSpy.signalArguments[0][0], 0);
856 compare(aboutToShowCalledSpy.signalArguments[0][0], 0);
854 compare(aboutToShowCalledSpy.signalArguments[1][0], 1);
857 compare(aboutToShowCalledSpy.signalArguments[1][0], 1);
@@ -860,7 +863,7 @@ PanelTest {
860 aboutToShowCalledSpy.clear();
863 aboutToShowCalledSpy.clear();
861
864
862 keyClick(Qt.Key_Enter);
865 keyClick(Qt.Key_Enter);
863− compare(aboutToShowCalledSpy.count, 1);
866+ aboutToShowCalledSpy.wait();
864 }
867 }
865
868
866 function test_disabledTopLevel() {
869 function test_disabledTopLevel() {
tests/qmltests/Panel/tst_PanelItemRow.qml+2−2
@@ -255,13 +255,13 @@ PanelTest {
255 var toPosition = indicatorsRow.mapFromItem(toItem, toItem.width/2, toItem.height/2);
255 var toPosition = indicatorsRow.mapFromItem(toItem, toItem.width/2, toItem.height/2);
256
256
257 mousePress(indicatorsRow, fromPosition.x, fromPosition.y);
257 mousePress(indicatorsRow, fromPosition.x, fromPosition.y);
258− compare(indicatorsRow.currentItem, fromItem, "Initial item not selected");
258+ tryCompare(indicatorsRow, "currentItem", fromItem, 5000, "Initial item not selected");
259
259
260 // this uses the MouseArea above to change the indicatorRow lateralPosition
260 // this uses the MouseArea above to change the indicatorRow lateralPosition
261 mouseFlick(indicatorsRow, fromPosition.x, fromPosition.y, toPosition.x, toPosition.y, false, false, units.gu(5), 30);
261 mouseFlick(indicatorsRow, fromPosition.x, fromPosition.y, toPosition.x, toPosition.y, false, false, units.gu(5), 30);
262
262
263 mouseRelease(indicatorsRow, fromPosition.x, fromPosition.y);
263 mouseRelease(indicatorsRow, fromPosition.x, fromPosition.y);
264− compare(indicatorsRow.currentItem, toItem, "Current item did not change to expected item");
264+ tryCompare(indicatorsRow, "currentItem", toItem, 5000, "Current item did not change to expected item");
265 }
265 }
266
266
267 // testing that positive changes to the lateral position offset shifts the highlight offset to the right
267 // testing that positive changes to the lateral position offset shifts the highlight offset to the right
tests/qmltests/Panel/tst_PanelMenu.qml+1−1
@@ -179,7 +179,7 @@ PanelTest {
179 touchPress(indicatorsMenu, firstItemMappedPosition.x, indicatorsMenu.minimizedPanelHeight / 2);
179 touchPress(indicatorsMenu, firstItemMappedPosition.x, indicatorsMenu.minimizedPanelHeight / 2);
180
180
181 indicatorsMenu.height = indicatorsMenu.openedHeight / 2;
181 indicatorsMenu.height = indicatorsMenu.openedHeight / 2;
182− compare(indicatorsMenu.state, "reveal", "Indicators should be revealing when partially opened.");
182+ tryCompare(indicatorsMenu, "state", "reveal", 5000, "Indicators should be revealing when partially opened.");
183
183
184 indicatorsMenu.height = indicatorsMenu.openedHeight;
184 indicatorsMenu.height = indicatorsMenu.openedHeight;
185 compare(indicatorsMenu.state, "reveal", "Indicators should still be revealing when fully opened.");
185 compare(indicatorsMenu.state, "reveal", "Indicators should still be revealing when fully opened.");
tests/qmltests/Stage/tst_DesktopStage.qml+3−3
@@ -264,13 +264,13 @@ Item {
264 var fromAppWindow = findChild(fromDelegate, "appWindow");
264 var fromAppWindow = findChild(fromDelegate, "appWindow");
265 verify(fromAppWindow);
265 verify(fromAppWindow);
266 tap(fromAppWindow);
266 tap(fromAppWindow);
267− compare(fromDelegate.surface.activeFocus, true);
267+ tryCompare(fromDelegate.surface, "activeFocus", true);
268 compare(topSurfaceList.focusedWindow, fromDelegate.window);
268 compare(topSurfaceList.focusedWindow, fromDelegate.window);
269
269
270 var toAppWindow = findChild(toDelegate, "appWindow");
270 var toAppWindow = findChild(toDelegate, "appWindow");
271 verify(toAppWindow);
271 verify(toAppWindow);
272 tap(toAppWindow);
272 tap(toAppWindow);
273− compare(toDelegate.surface.activeFocus, true);
273+ tryCompare(toDelegate.surface, "activeFocus", true);
274 compare(topSurfaceList.focusedWindow, toDelegate.window);
274 compare(topSurfaceList.focusedWindow, toDelegate.window);
275 }
275 }
276
276
@@ -591,7 +591,7 @@ Item {
591 var dialerDelegate = startApplication("dialer-app");
591 var dialerDelegate = startApplication("dialer-app");
592 verify(dialerDelegate);
592 verify(dialerDelegate);
593
593
594− compare(dialerDelegate.visible, true, "Dialer should be visible");
594+ tryCompare(dialerDelegate, "visible", true, 5000, "Dialer should be visible");
595 compare(dashDelegate.visible, true, "Dash should still be visible");
595 compare(dashDelegate.visible, true, "Dash should still be visible");
596 }
596 }
597
597
tests/qmltests/Stage/tst_PhoneStage.qml+9−9
@@ -359,10 +359,10 @@ Item {
359 verify(delegateB);
359 verify(delegateB);
360
360
361 // A is focused and running, B is unfocused and suspended
361 // A is focused and running, B is unfocused and suspended
362− compare(delegateA.focus, true);
362+ tryCompare(delegateA, "focus", true);
363− compare(delegateA.application.requestedState, ApplicationInfoInterface.RequestedRunning);
363+ tryCompare(delegateA.application, "requestedState", ApplicationInfoInterface.RequestedRunning);
364− compare(delegateB.focus, false);
364+ tryCompare(delegateB, "focus", false);
365− compare(delegateB.application.requestedState, ApplicationInfoInterface.RequestedSuspended);
365+ tryCompare(delegateB.application, "requestedState", ApplicationInfoInterface.RequestedSuspended);
366
366
367 // Switch foreground/focused appp from A to B
367 // Switch foreground/focused appp from A to B
368 performEdgeSwipeToShowAppSpread();
368 performEdgeSwipeToShowAppSpread();
@@ -382,8 +382,8 @@ Item {
382 var delegate = findChild(stage, "appDelegate_" + topLevelSurfaceList.idAt(0));
382 var delegate = findChild(stage, "appDelegate_" + topLevelSurfaceList.idAt(0));
383 verify(delegate);
383 verify(delegate);
384
384
385− compare(delegate.focus, true);
385+ tryCompare(delegate, "focus", true);
386− compare(delegate.application.requestedState, ApplicationInfoInterface.RequestedRunning);
386+ tryCompare(delegate.application, "requestedState", ApplicationInfoInterface.RequestedRunning);
387
387
388 stage.suspended = true;
388 stage.suspended = true;
389
389
@@ -398,9 +398,9 @@ Item {
398 addApps(1);
398 addApps(1);
399 // When progress goes to 1 it should switch to spread, but stay there even if progress goes back
399 // When progress goes to 1 it should switch to spread, but stay there even if progress goes back
400 stage.rightEdgePushProgress = 1;
400 stage.rightEdgePushProgress = 1;
401− compare(stage.state, "spread");
401+ tryCompare(stage, "state", "spread");
402 stage.rightEdgePushProgress = 0;
402 stage.rightEdgePushProgress = 0;
403− compare(stage.state, "spread");
403+ tryCompare(stage, "state", "spread");
404 }
404 }
405
405
406 function test_closeSurfaceOfMultiSurfaceApp() {
406 function test_closeSurfaceOfMultiSurfaceApp() {
@@ -494,7 +494,7 @@ Item {
494 tryCompareFunction(function(){return topLevelSurfaceList.idAt(0);}, webbrowserSurfaceId);
494 tryCompareFunction(function(){return topLevelSurfaceList.idAt(0);}, webbrowserSurfaceId);
495
495
496 // and it should eventually get a new surface and get resumed
496 // and it should eventually get a new surface and get resumed
497− tryCompareFunction(function(){return topLevelSurfaceList.surfaceAt(0) !== null;}, true);
497+ tryVerify(function(){return topLevelSurfaceList.surfaceAt(0)});
498 compare(topLevelSurfaceList.count, 2); // still two top-level items
498 compare(topLevelSurfaceList.count, 2); // still two top-level items
499 tryCompare(webbrowserApp, "state", ApplicationInfoInterface.Running);
499 tryCompare(webbrowserApp, "state", ApplicationInfoInterface.Running);
500 compare(webbrowserApp.surfaceList.count, 1);
500 compare(webbrowserApp.surfaceList.count, 1);
tests/qmltests/Stage/tst_SurfaceContainer.qml+7−7
@@ -214,15 +214,15 @@ Rectangle {
214 tap(surfaceContainer);
214 tap(surfaceContainer);
215
215
216 // surface got touches as the surfaceContainer is interactive
216 // surface got touches as the surfaceContainer is interactive
217− compare(surfaceItem.touchPressCount, 1)
217+ tryCompare(surfaceItem, "touchPressCount", 1);
218− compare(surfaceItem.touchReleaseCount, 1);
218+ tryCompare(surfaceItem, "touchPressCount", 1);
219
219
220 interactiveCheckbox.checked = false;
220 interactiveCheckbox.checked = false;
221 tap(surfaceContainer);
221 tap(surfaceContainer);
222
222
223 // surface shouldn't get the touches from the second tap as the surfaceContainer
223 // surface shouldn't get the touches from the second tap as the surfaceContainer
224 // was *not* interactive when it happened.
224 // was *not* interactive when it happened.
225− compare(surfaceItem.touchPressCount, 1)
225+ compare(surfaceItem.touchPressCount, 1);
226 compare(surfaceItem.touchReleaseCount, 1);
226 compare(surfaceItem.touchReleaseCount, 1);
227 }
227 }
228
228
@@ -235,9 +235,9 @@ Rectangle {
235
235
236 surfaceContainer.focus = false;
236 surfaceContainer.focus = false;
237
237
238− compare(surfaceItem.activeFocus, false);
238+ tryCompare(surfaceItem, "activeFocus", false);
239 mouseClick(surfaceContainer);
239 mouseClick(surfaceContainer);
240− compare(surfaceItem.activeFocus, true);
240+ tryCompare(surfaceItem, "activeFocus", true);
241 }
241 }
242
242
243 function test_surfaceItemGetsActiveFocusOnTap() {
243 function test_surfaceItemGetsActiveFocusOnTap() {
@@ -249,9 +249,9 @@ Rectangle {
249
249
250 surfaceContainer.focus = false;
250 surfaceContainer.focus = false;
251
251
252− compare(surfaceItem.activeFocus, false);
252+ tryCompare(surfaceItem, "activeFocus", false);
253 tap(surfaceContainer);
253 tap(surfaceContainer);
254− compare(surfaceItem.activeFocus, true);
254+ tryCompare(surfaceItem, "activeFocus", true);
255 }
255 }
256 }
256 }
257}
257}
tests/qmltests/Stage/tst_WindowDecoration.qml+3−3
@@ -163,7 +163,7 @@ Item {
163 verify(controlButton !== null);
163 verify(controlButton !== null);
164
164
165 mouseClick(controlButton, controlButton.width/2, controlButton.height/2);
165 mouseClick(controlButton, controlButton.width/2, controlButton.height/2);
166− compare(signalSpy.count, 1);
166+ signalSpy.wait();
167 }
167 }
168
168
169 function test_titleRemainsWhenHoveringOnTitleBarWithNoMenu() {
169 function test_titleRemainsWhenHoveringOnTitleBarWithNoMenu() {
@@ -177,8 +177,8 @@ Item {
177 var titleLabel = findChild(decoration, "windowDecorationTitle");
177 var titleLabel = findChild(decoration, "windowDecorationTitle");
178 verify(menuLoader);
178 verify(menuLoader);
179
179
180− compare(menuLoader.opacity, 0, "Menu should not show when present")
180+ tryCompare(menuLoader, "opacity", 0, 5000, "Menu should not show when present")
181− compare(titleLabel.opacity, 1, "Title should always show when app menu not present")
181+ tryCompare(titleLabel, "opacity", 1, 5000, "Title should always show when app menu not present")
182 }
182 }
183
183
184 function test_menuShowsWhenHoveringOnTitleBar() {
184 function test_menuShowsWhenHoveringOnTitleBar() {
tests/qmltests/Stage/tst_WindowResizeArea.qml+2−2
@@ -397,9 +397,9 @@ Item {
397
397
398 mouseFlick(root, startDragX, startDragY, startDragX + deltaX, startDragY + deltaY);
398 mouseFlick(root, startDragX, startDragY, startDragX + deltaX, startDragY + deltaY);
399
399
400− compare(windowRequestedWidthSpy.count, 1);
400+ windowRequestedWidthSpy.wait();
401 compare(fakeWindow.width, initialWindowWidth + fakeWindow.widthIncrement);
401 compare(fakeWindow.width, initialWindowWidth + fakeWindow.widthIncrement);
402− compare(windowRequestedHeightSpy.count, 1);
402+ windowRequestedHeightSpy.wait();
403 compare(fakeWindow.height, initialWindowHeight + fakeWindow.heightIncrement);
403 compare(fakeWindow.height, initialWindowHeight + fakeWindow.heightIncrement);
404 }
404 }
405
405
tests/qmltests/Wizard/tst_Wizard.qml+8−10
@@ -311,7 +311,7 @@ Item {
311 var pages = findChild(wizard, "wizardPages");
311 var pages = findChild(wizard, "wizardPages");
312 var security = findInvisibleChild(pages, "securityPrivacy");
312 var security = findInvisibleChild(pages, "securityPrivacy");
313 security.setSecurity("", "", UbuntuSecurityPrivacyPanel.Passphrase);
313 security.setSecurity("", "", UbuntuSecurityPrivacyPanel.Passphrase);
314− compare(security.securityType, UbuntuSecurityPrivacyPanel.Passphrase);
314+ tryCompare(security, "securityType", UbuntuSecurityPrivacyPanel.Passphrase);
315
315
316 // Make sure that moving from sim page lands on wifi page
316 // Make sure that moving from sim page lands on wifi page
317 tap(findChild(page, "forwardButton"));
317 tap(findChild(page, "forwardButton"));
@@ -346,7 +346,7 @@ Item {
346
346
347 enterPasscode("1112");
347 enterPasscode("1112");
348 var error = findChild(page, "wrongNoticeLabel");
348 var error = findChild(page, "wrongNoticeLabel");
349− tryCompareFunction(function() { return error.text !== ""; }, true);
349+ tryVerify(function() { return error.text !== ""; });
350
350
351 enterPasscode("1111");
351 enterPasscode("1111");
352
352
@@ -355,7 +355,7 @@ Item {
355 waitUntilTransitionsEnd(page);
355 waitUntilTransitionsEnd(page);
356 tap(findChild(page, "finishButton"));
356 tap(findChild(page, "finishButton"));
357
357
358− tryCompare(setSecuritySpy, "count", 1);
358+ setSecuritySpy.wait();
359 compare(setSecuritySpy.signalArguments[0][0], "");
359 compare(setSecuritySpy.signalArguments[0][0], "");
360 compare(setSecuritySpy.signalArguments[0][1], "1111");
360 compare(setSecuritySpy.signalArguments[0][1], "1111");
361 compare(setSecuritySpy.signalArguments[0][2], UbuntuSecurityPrivacyPanel.Passcode);
361 compare(setSecuritySpy.signalArguments[0][2], UbuntuSecurityPrivacyPanel.Passcode);
@@ -393,7 +393,7 @@ Item {
393 waitUntilTransitionsEnd(page);
393 waitUntilTransitionsEnd(page);
394 tap(findChild(page, "finishButton"));
394 tap(findChild(page, "finishButton"));
395
395
396− tryCompare(setSecuritySpy, "count", 1);
396+ setSecuritySpy.wait();
397 compare(setSecuritySpy.signalArguments[0][0], "");
397 compare(setSecuritySpy.signalArguments[0][0], "");
398 compare(setSecuritySpy.signalArguments[0][1], "12345678");
398 compare(setSecuritySpy.signalArguments[0][1], "12345678");
399 compare(setSecuritySpy.signalArguments[0][2], UbuntuSecurityPrivacyPanel.Passphrase);
399 compare(setSecuritySpy.signalArguments[0][2], UbuntuSecurityPrivacyPanel.Passphrase);
@@ -433,7 +433,7 @@ Item {
433
433
434 // go next and verify the (mock) signal got fired
434 // go next and verify the (mock) signal got fired
435 tap(findChild(page, "forwardButton"));
435 tap(findChild(page, "forwardButton"));
436− tryCompare(timezoneSpy, "count", 1);
436+ timezoneSpy.wait();
437 compare(timezoneSpy.signalArguments[0][0], "Europe/London");
437 compare(timezoneSpy.signalArguments[0][0], "Europe/London");
438 compare(timezoneSpy.signalArguments[0][1], "Belfast");
438 compare(timezoneSpy.signalArguments[0][1], "Belfast");
439 }
439 }
@@ -444,7 +444,7 @@ Item {
444 SystemImage.updateAvailable = true;
444 SystemImage.updateAvailable = true;
445 SystemImage.targetBuildNumber = 42;
445 SystemImage.targetBuildNumber = 42;
446 SystemImage.updateDownloaded();
446 SystemImage.updateDownloaded();
447− compare(updateDownloadedSpy.count, 1);
447+ updateDownloadedSpy.wait();
448
448
449 var page = goToPage("systemUpdatePage");
449 var page = goToPage("systemUpdatePage");
450 var updateButton = findChild(page, "installButton");
450 var updateButton = findChild(page, "installButton");
@@ -452,8 +452,8 @@ Item {
452 compare(skipUntilFinishedSpy.count, 0);
452 compare(skipUntilFinishedSpy.count, 0);
453 compare(applyUpdateSpy.count, 0);
453 compare(applyUpdateSpy.count, 0);
454 tap(updateButton);
454 tap(updateButton);
455− compare(skipUntilFinishedSpy.count, 1);
455+ skipUntilFinishedSpy.wait();
456− compare(applyUpdateSpy.count, 1);
456+ applyUpdateSpy.wait();
457 }
457 }
458
458
459 function test_accountPage() {
459 function test_accountPage() {
@@ -472,14 +472,12 @@ Item {
472 var langSelector = findChild(page, "langSelector");
472 var langSelector = findChild(page, "langSelector");
473 verify(langSelector);
473 verify(langSelector);
474 langSelector.selectedIndex = 1; // should be fr_FR
474 langSelector.selectedIndex = 1; // should be fr_FR
475− print("Selected language:", page.selectedLanguage);
476
475
477 // pick some layout
476 // pick some layout
478 var kbdDelegate = findChild(page, "kbdDelegate1");
477 var kbdDelegate = findChild(page, "kbdDelegate1");
479 verify(kbdDelegate);
478 verify(kbdDelegate);
480 mouseClick(kbdDelegate);
479 mouseClick(kbdDelegate);
481 verify(kbdDelegate.isCurrent);
480 verify(kbdDelegate.isCurrent);
482− print("Selected keymap:", page.selectedKeymap);
483
481
484 // verify the keymapsChanged signal got fired
482 // verify the keymapsChanged signal got fired
485 tap(findChild(page, "forwardButton"));
483 tap(findChild(page, "forwardButton"));
tests/qmltests/tst_OrientedShell.qml+4−5
@@ -525,7 +525,7 @@ Rectangle {
525 compare(primaryApp.rotatesWindowContents, false);
525 compare(primaryApp.rotatesWindowContents, false);
526 compare(primaryApp.supportedOrientations, Qt.PrimaryOrientation);
526 compare(primaryApp.supportedOrientations, Qt.PrimaryOrientation);
527
527
528− tryCompareFunction(function(){return primaryDelegate.surface != null;}, true);
528+ tryVerify(function(){return primaryDelegate.surface});
529 verify(checkAppSurfaceOrientation(primaryAppWindow, primaryApp, root.primaryOrientationAngle));
529 verify(checkAppSurfaceOrientation(primaryAppWindow, primaryApp, root.primaryOrientationAngle));
530
530
531 compare(shell.transformRotationAngle, root.primaryOrientationAngle);
531 compare(shell.transformRotationAngle, root.primaryOrientationAngle);
@@ -958,7 +958,7 @@ Rectangle {
958 // app must have portrait aspect ratio
958 // app must have portrait aspect ratio
959 verify(decoratedWindow.width < decoratedWindow.height);
959 verify(decoratedWindow.width < decoratedWindow.height);
960
960
961− // shell should remain in its primery orientation as the app in the main stage
961+ // shell should remain in its primary orientation as the app in the main stage
962 // is the one that dictates its orientation. In this case it's unity8-dash
962 // is the one that dictates its orientation. In this case it's unity8-dash
963 // which supports only primary orientation
963 // which supports only primary orientation
964 compare(shell.orientation, orientedShell.orientations.primary);
964 compare(shell.orientation, orientedShell.orientations.primary);
@@ -1508,7 +1508,6 @@ Rectangle {
1508 }
1508 }
1509 var point = surfaceItem.mapToItem(orientedShell, 0, 0);
1509 var point = surfaceItem.mapToItem(orientedShell, 0, 0);
1510
1510
1511− print("exptectedAngle", expectedAngle, point.x, point.y)
1512 switch (expectedAngle) {
1511 switch (expectedAngle) {
1513 case 0:
1512 case 0:
1514 return point.x === 0 && point.y === PanelState.panelHeight;
1513 return point.x === 0 && point.y === PanelState.panelHeight;
@@ -1625,7 +1624,7 @@ Rectangle {
1625 testCase.showPowerDialog();
1624 testCase.showPowerDialog();
1626
1625
1627 var dialogLoader = findChild(orientedShell, "dialogLoader");
1626 var dialogLoader = findChild(orientedShell, "dialogLoader");
1628− tryCompareFunction(function() { return dialogLoader.item !== null }, true);
1627+ tryVerify(function() { return dialogLoader.item !== null });
1629
1628
1630 keyClick(Qt.Key_Escape);
1629 keyClick(Qt.Key_Escape);
1631
1630
@@ -1635,7 +1634,7 @@ Rectangle {
1635 // Do it twice, our previous solution failed the second time ^_^
1634 // Do it twice, our previous solution failed the second time ^_^
1636 testCase.showPowerDialog();
1635 testCase.showPowerDialog();
1637
1636
1638− tryCompareFunction(function() { return dialogLoader.item !== null }, true);
1637+ tryVerify(function() { return dialogLoader.item !== null });
1639
1638
1640 keyClick(Qt.Key_Escape);
1639 keyClick(Qt.Key_Escape);
1641
1640
tests/qmltests/tst_Shell.qml+35−29
@@ -977,13 +977,13 @@ Rectangle {
977
977
978 var loginList = findChild(view, "loginList");
978 var loginList = findChild(view, "loginList");
979
979
980− compare(view.sessionToStart, greeter.sessionToStart());
980+ tryCompare(view, "sessionToStart", greeter.sessionToStart());
981
981
982 // Ensure another session can actually be selected
982 // Ensure another session can actually be selected
983 compare(LightDMController.numSessions > 1, true);
983 compare(LightDMController.numSessions > 1, true);
984 loginList.currentSession = LightDM.Sessions.data(1, LightDM.SessionRoles.KeyRole);
984 loginList.currentSession = LightDM.Sessions.data(1, LightDM.SessionRoles.KeyRole);
985
985
986− compare(view.sessionToStart, greeter.sessionToStart());
986+ tryCompare(view, "sessionToStart", greeter.sessionToStart());
987
987
988 }
988 }
989
989
@@ -1158,7 +1158,7 @@ Rectangle {
1158 compare(sessionSpy.count, 0);
1158 compare(sessionSpy.count, 0);
1159
1159
1160 swipeAwayGreeter();
1160 swipeAwayGreeter();
1161− compare(sessionSpy.count, 1);
1161+ sessionSpy.wait();
1162 }
1162 }
1163
1163
1164 function test_fullscreen() {
1164 function test_fullscreen() {
@@ -1194,6 +1194,7 @@ Rectangle {
1194
1194
1195 touchFlick(shell, touchStartX, touchStartY, units.gu(2), touchStartY, true, false);
1195 touchFlick(shell, touchStartX, touchStartY, units.gu(2), touchStartY, true, false);
1196
1196
1197+ // We did NOT leave fullscreen
1197 compare(panel.fullscreenMode, true);
1198 compare(panel.fullscreenMode, true);
1198
1199
1199 touchFlick(shell, units.gu(2), touchStartY, shell.width * 0.5, touchStartY, false, false);
1200 touchFlick(shell, units.gu(2), touchStartY, shell.width * 0.5, touchStartY, false, false);
@@ -1235,7 +1236,7 @@ Rectangle {
1235 wizard.hide();
1236 wizard.hide();
1236 tryCompare(wizard, "active", false);
1237 tryCompare(wizard, "active", false);
1237 compare(Wizard.System.wizardEnabled, false);
1238 compare(Wizard.System.wizardEnabled, false);
1238− compare(unlockAllModemsSpy.count, 1);
1239+ unlockAllModemsSpy.wait();
1239 }
1240 }
1240
1241
1241 function test_wizardEarlyExit() {
1242 function test_wizardEarlyExit() {
@@ -1509,7 +1510,7 @@ Rectangle {
1509 shell.usageScenario = data.usageScenario;
1510 shell.usageScenario = data.usageScenario;
1510
1511
1511 var launcher = findChild(shell, "launcher");
1512 var launcher = findChild(shell, "launcher");
1512− compare(launcher.inverted, data.launcherInverted);
1513+ tryCompare(launcher, "inverted", data.launcherInverted);
1513 }
1514 }
1514
1515
1515 function test_unfocusedAppsGetSuspendedAfterEnteringStagedMode() {
1516 function test_unfocusedAppsGetSuspendedAfterEnteringStagedMode() {
@@ -1750,6 +1751,7 @@ Rectangle {
1750
1751
1751 // Close the app using the close button
1752 // Close the app using the close button
1752 // The button doesn't appear until the mouse is over the surface
1753 // The button doesn't appear until the mouse is over the surface
1754+ mouseMove(closeMouseArea, closeMouseArea.width / 2 + 1, closeMouseArea.height / 2, 10);
1753 mouseMove(closeMouseArea, closeMouseArea.width / 2, closeMouseArea.height / 2, 10);
1755 mouseMove(closeMouseArea, closeMouseArea.width / 2, closeMouseArea.height / 2, 10);
1754 tryCompare(closeMouseArea, "visible", true);
1756 tryCompare(closeMouseArea, "visible", true);
1755 mouseClick(closeMouseArea, closeMouseArea.width / 2, closeMouseArea.height / 2);
1757 mouseClick(closeMouseArea, closeMouseArea.width / 2, closeMouseArea.height / 2);
@@ -1819,7 +1821,7 @@ Rectangle {
1819 var spreadFlickable = findChild(shell, "spreadFlickable");
1821 var spreadFlickable = findChild(shell, "spreadFlickable");
1820 waitForRendering(spreadFlickable);
1822 waitForRendering(spreadFlickable);
1821
1823
1822− compare(spreadFlickable.contentX, 0);
1824+ tryCompare(spreadFlickable, "contentX", 0);
1823
1825
1824 // Move the mouse to the right and make sure it scrolls the Flickable
1826 // Move the mouse to the right and make sure it scrolls the Flickable
1825 var shellLeft = launcherPanel.width + 5;
1827 var shellLeft = launcherPanel.width + 5;
@@ -1977,7 +1979,7 @@ Rectangle {
1977 mousePress(appDelegate, appDelegate.width / 2, units.gu(1))
1979 mousePress(appDelegate, appDelegate.width / 2, units.gu(1))
1978 mouseMove(appDelegate, appDelegate.width / 2, -units.gu(100))
1980 mouseMove(appDelegate, appDelegate.width / 2, -units.gu(100))
1979
1981
1980− compare(appDelegate.y >= PanelState.panelHeight, true);
1982+ tryVerify(function() {return (appDelegate.y >= PanelState.panelHeight)});
1981 }
1983 }
1982
1984
1983 function test_cantResizeWindowUnderPanel() {
1985 function test_cantResizeWindowUnderPanel() {
@@ -2005,7 +2007,7 @@ Rectangle {
2005 mouseMove(decoration, decoration.width/2, -units.gu(100));
2007 mouseMove(decoration, decoration.width/2, -units.gu(100));
2006
2008
2007 // verify we don't go past the panel
2009 // verify we don't go past the panel
2008− compare(appDelegate.y >= PanelState.panelHeight, true);
2010+ tryVerify(function() {return (appDelegate.y >= PanelState.panelHeight)});
2009 }
2011 }
2010
2012
2011 function test_restoreWindowStateFixesIfUnderPanel() {
2013 function test_restoreWindowStateFixesIfUnderPanel() {
@@ -2029,7 +2031,7 @@ Rectangle {
2029 tryCompareFunction(function () { return topLevelSurfaceList.applicationAt(0).appId; }, application.appId);
2031 tryCompareFunction(function () { return topLevelSurfaceList.applicationAt(0).appId; }, application.appId);
2030
2032
2031 appDelegate = appRepeater.itemAt(0);
2033 appDelegate = appRepeater.itemAt(0);
2032− compare(appDelegate.y >= PanelState.panelHeight, true);
2034+ tryVerify(function() {return (appDelegate.y >= PanelState.panelHeight)});
2033 }
2035 }
2034
2036
2035 function test_lifecyclePolicyForNonTouchApp_data() {
2037 function test_lifecyclePolicyForNonTouchApp_data() {
@@ -2151,7 +2153,11 @@ Rectangle {
2151
2153
2152 // The popup must appear now, unless in "tablet" mode
2154 // The popup must appear now, unless in "tablet" mode
2153 popup = findChild(root, "modeSwitchWarningDialog");
2155 popup = findChild(root, "modeSwitchWarningDialog");
2154− compare(popup !== null, !data.tabletMode);
2156+ if (data.tabletMode) {
2157+ verify(!popup);
2158+ } else {
2159+ verify(popup);
2160+ }
2155
2161
2156 if (data.replug || data.tabletMode) {
2162 if (data.replug || data.tabletMode) {
2157 shell.usageScenario = "desktop"
2163 shell.usageScenario = "desktop"
@@ -2168,10 +2174,10 @@ Rectangle {
2168
2174
2169 if (data.replug || data.tabletMode) {
2175 if (data.replug || data.tabletMode) {
2170 // Libreoffice must still be running
2176 // Libreoffice must still be running
2171− compare(ApplicationManager.findApplication("libreoffice") !== null, true);
2177+ tryVerify(function() {return ApplicationManager.findApplication("libreoffice")});
2172 } else {
2178 } else {
2173 // Libreoffice must be gone now (or soon at least)
2179 // Libreoffice must be gone now (or soon at least)
2174− tryCompareFunction(function() { return ApplicationManager.findApplication("libreoffice") === null}, true);
2180+ tryVerify(function() {return !ApplicationManager.findApplication("libreoffice")});
2175 }
2181 }
2176 }
2182 }
2177
2183
@@ -2193,7 +2199,7 @@ Rectangle {
2193 var launcher = findChild(shell, "launcher");
2199 var launcher = findChild(shell, "launcher");
2194 var launcherPanel = findChild(launcher, "launcherPanel");
2200 var launcherPanel = findChild(launcher, "launcherPanel");
2195 var firstAppInLauncher = LauncherModel.get(0).appId;
2201 var firstAppInLauncher = LauncherModel.get(0).appId;
2196− compare(launcher.state, data.launcherLocked ? "visible": "");
2202+ tryCompare(launcher, "state", data.launcherLocked ? "visible": "");
2197 compare(launcherPanel.highlightIndex, -2);
2203 compare(launcherPanel.highlightIndex, -2);
2198
2204
2199 // Use Super + Tab Tab to cycle to the first entry in the launcher
2205 // Use Super + Tab Tab to cycle to the first entry in the launcher
@@ -2354,20 +2360,20 @@ Rectangle {
2354 verify(topmostSurfaceItem);
2360 verify(topmostSurfaceItem);
2355
2361
2356 mouseClick(shell, 1, shell.height / 2);
2362 mouseClick(shell, 1, shell.height / 2);
2357− compare(topmostSurfaceItem.mousePressCount, 1);
2363+ tryCompare(topmostSurfaceItem, "mousePressCount", 1);
2358− compare(topmostSurfaceItem.mouseReleaseCount, 1);
2364+ tryCompare(topmostSurfaceItem, "mouseReleaseCount", 1);
2359
2365
2360 mouseClick(shell, shell.width - 1, shell.height / 2);
2366 mouseClick(shell, shell.width - 1, shell.height / 2);
2361− compare(topmostSurfaceItem.mousePressCount, 2);
2367+ tryCompare(topmostSurfaceItem, "mousePressCount", 2);
2362− compare(topmostSurfaceItem.mouseReleaseCount, 2);
2368+ tryCompare(topmostSurfaceItem, "mouseReleaseCount", 2);
2363
2369
2364 tap(shell, 1, shell.height / 2);
2370 tap(shell, 1, shell.height / 2);
2365− compare(topmostSurfaceItem.touchPressCount, 1);
2371+ tryCompare(topmostSurfaceItem, "touchPressCount", 1);
2366− compare(topmostSurfaceItem.touchReleaseCount, 1);
2372+ tryCompare(topmostSurfaceItem, "touchReleaseCount", 1);
2367
2373
2368 tap(shell, shell.width - 1, shell.height / 2);
2374 tap(shell, shell.width - 1, shell.height / 2);
2369− compare(topmostSurfaceItem.touchPressCount, 2);
2375+ tryCompare(topmostSurfaceItem, "touchPressCount", 2);
2370− compare(topmostSurfaceItem.touchReleaseCount, 2);
2376+ tryCompare(topmostSurfaceItem, "touchReleaseCount", 2);
2371 }
2377 }
2372
2378
2373 function test_background_data() {
2379 function test_background_data() {
@@ -2434,7 +2440,7 @@ Rectangle {
2434 var appIcon = findChild(shell, "launcherDelegate0")
2440 var appIcon = findChild(shell, "launcherDelegate0")
2435 tap(appIcon);
2441 tap(appIcon);
2436
2442
2437− tryCompare(broadcastUrlSpy, "count", 1);
2443+ broadcastUrlSpy.wait();
2438 compare(broadcastUrlSpy.signalArguments[0][0], "application:///" + appIcon.appId + ".desktop");
2444 compare(broadcastUrlSpy.signalArguments[0][0], "application:///" + appIcon.appId + ".desktop");
2439 compare(ApplicationManager.count, 0); // confirm no app is open, we didn't start new app
2445 compare(ApplicationManager.count, 0); // confirm no app is open, we didn't start new app
2440
2446
@@ -2457,7 +2463,7 @@ Rectangle {
2457 dragLauncherIntoView();
2463 dragLauncherIntoView();
2458 tap(findChild(shell, "buttonShowDashHome"));
2464 tap(findChild(shell, "buttonShowDashHome"));
2459
2465
2460− tryCompare(broadcastHomeSpy, "count", 1);
2466+ broadcastHomeSpy.wait();
2461 compare(topLevelSurfaceList.applicationAt(0).appId, "gallery-app"); // confirm we didn't raise dash
2467 compare(topLevelSurfaceList.applicationAt(0).appId, "gallery-app"); // confirm we didn't raise dash
2462
2468
2463 var coverPage = findChild(shell, "coverPage");
2469 var coverPage = findChild(shell, "coverPage");
@@ -2475,7 +2481,7 @@ Rectangle {
2475 verify(urlDispatcher.active);
2481 verify(urlDispatcher.active);
2476 urlDispatcher.urlRequested("test:"); // force signal emission
2482 urlDispatcher.urlRequested("test:"); // force signal emission
2477
2483
2478− tryCompare(broadcastUrlSpy, "count", 1);
2484+ broadcastUrlSpy.wait();
2479 compare(broadcastUrlSpy.signalArguments[0][0], "test:");
2485 compare(broadcastUrlSpy.signalArguments[0][0], "test:");
2480 compare(ApplicationManager.count, 0); // confirm no app is open, we didn't start new app
2486 compare(ApplicationManager.count, 0); // confirm no app is open, we didn't start new app
2481
2487
@@ -2772,7 +2778,7 @@ Rectangle {
2772 GSettingsController.setEnableLauncher(data.enabled);
2778 GSettingsController.setEnableLauncher(data.enabled);
2773
2779
2774 var launcher = findChild(shell, "launcher");
2780 var launcher = findChild(shell, "launcher");
2775− compare(launcher.available, data.enabled);
2781+ tryCompare(launcher, "available", data.enabled);
2776
2782
2777 GSettingsController.setEnableLauncher(true);
2783 GSettingsController.setEnableLauncher(true);
2778 }
2784 }
@@ -2790,7 +2796,7 @@ Rectangle {
2790 GSettingsController.setEnableIndicatorMenu(data.enabled);
2796 GSettingsController.setEnableIndicatorMenu(data.enabled);
2791
2797
2792 var panel = findChild(shell, "panel");
2798 var panel = findChild(shell, "panel");
2793− compare(panel.indicators.available, data.enabled);
2799+ tryCompare(panel.indicators, "available", data.enabled);
2794
2800
2795 GSettingsController.setEnableIndicatorMenu(true);
2801 GSettingsController.setEnableIndicatorMenu(true);
2796 }
2802 }
@@ -2910,7 +2916,7 @@ Rectangle {
2910
2916
2911 var panel = findChild(shell, "panel"); verify(panel);
2917 var panel = findChild(shell, "panel"); verify(panel);
2912 var panelTitle = findChild(panel, "panelTitle"); verify(panelTitle);
2918 var panelTitle = findChild(panel, "panelTitle"); verify(panelTitle);
2913− compare(panelTitle.visible, false, "Panel title should not be visible when greeter is shown");
2919+ tryCompare(panelTitle, "visible", false, 5000, "Panel title should not be visible when greeter is shown");
2914
2920
2915 swipeAwayGreeter();
2921 swipeAwayGreeter();
2916
2922
@@ -3097,9 +3103,9 @@ Rectangle {
3097 var launcher = testCase.findChild(shell, "launcher");
3103 var launcher = testCase.findChild(shell, "launcher");
3098 launcher.lockedVisible = data.lockLauncher;
3104 launcher.lockedVisible = data.lockLauncher;
3099 if (data.lockLauncher) {
3105 if (data.lockLauncher) {
3100− compare(panel.applicationMenus.x, launcher.panelWidth);
3106+ tryCompare(panel.applicationMenus, "x", launcher.panelWidth);
3101 } else {
3107 } else {
3102− compare(panel.applicationMenus.x, 0);
3108+ tryCompare(panel.applicationMenus, "x", 0);
3103 }
3109 }
3104 }
3110 }
3105
3111