@@ -253,6 +253,24 @@ Rectangle {
253 target: clickThroughTester
253 target: clickThroughTester
259+ signalName: "started"
265+ signalName: "stopped"
271+ signalName: "stopped"
257 id: fakeDismissTimer
275 id: fakeDismissTimer
258 property bool running: false
276 property bool running: false
@@ -276,6 +294,12 @@ Rectangle {
276 function cleanup() {
294 function cleanup() {
277 signalSpy.clear();
295 signalSpy.clear();
278 clickThroughSpy.clear();
296 clickThroughSpy.clear();
298+ startedSpy.target = null;
300+ stoppedSpy.target = null;
301+ stoppedSpy2.clear();
302+ stoppedSpy2.target = null;
279 launcherLoader.active = false;
303 launcherLoader.active = false;
280 // Loader.status might be Loader.Null and Loader.item might be null but the Loader
304 // Loader.status might be Loader.Null and Loader.item might be null but the Loader
281 // item might still be alive. So if we set Loader.active back to true
305 // item might still be alive. So if we set Loader.active back to true
@@ -358,16 +382,6 @@ Rectangle {
358 tryCompare(panel, "x", -panel.width, 1000);
382 tryCompare(panel, "x", -panel.width, 1000);
361− function waitForWiggleToStart(appIcon) {
362− verify(appIcon != undefined)
363− tryCompare(appIcon, "wiggling", true, 1000, "wiggle-anim should not be in stopped state")
366− function waitForWiggleToStop(appIcon) {
367− verify(appIcon != undefined)
368− tryCompare(appIcon, "wiggling", false, 1000, "wiggle-anim should not be in running state")
371 function positionLauncherListAtBeginning() {
385 function positionLauncherListAtBeginning() {
372 var listView = testCase.findChild(launcherLoader.item, "launcherListView");
386 var listView = testCase.findChild(launcherLoader.item, "launcherListView");
373 var moveAnimation = findInvisibleChild(listView, "moveAnimation")
387 var moveAnimation = findInvisibleChild(listView, "moveAnimation")
@@ -1090,10 +1104,13 @@ Rectangle {
1090 verify(listView != undefined)
1104 verify(listView != undefined)
1091 var appIcon6 = findChild(launcher, "launcherDelegate6")
1105 var appIcon6 = findChild(launcher, "launcherDelegate6")
1092 verify(appIcon6 != undefined)
1106 verify(appIcon6 != undefined)
1108+ startedSpy.target = appIcon6.wiggleAnim
1109+ stoppedSpy.target = appIcon6.wiggleAnim
1093 LauncherModel.setAlerting(LauncherModel.get(6).appId, true)
1110 LauncherModel.setAlerting(LauncherModel.get(6).appId, true)
1094− waitForWiggleToStart(appIcon6)
1111+ tryCompare(startedSpy, "count", 1);
1095 LauncherModel.setAlerting(LauncherModel.get(6).appId, false)
1112 LauncherModel.setAlerting(LauncherModel.get(6).appId, false)
1096− waitForWiggleToStop(appIcon6)
1113+ tryCompare(stoppedSpy, "count", 1);
1097 tryCompare(appIcon6, "x", 0, 1000, "x-value of appId #6 should not be non-zero")
1114 tryCompare(appIcon6, "x", 0, 1000, "x-value of appId #6 should not be non-zero")
1098 waitForRendering(listView)
1115 waitForRendering(listView)
@@ -1139,49 +1156,60 @@ Rectangle {
1139 function test_alertMoveIconIntoView() {
1156 function test_alertMoveIconIntoView() {
1140 dragLauncherIntoView();
1157 dragLauncherIntoView();
1141 var appIcon1 = findChild(launcher, "launcherDelegate1");
1158 var appIcon1 = findChild(launcher, "launcherDelegate1");
1142 var appIcon7 = findChild(launcher, "launcherDelegate7");
1160 var appIcon7 = findChild(launcher, "launcherDelegate7");
1162+ stoppedSpy.target = appIcon1.wiggleAnim;
1163+ stoppedSpy2.target = appIcon7.wiggleAnim;
1165+ startedSpy.target = appIcon1.wiggleAnim;
1143 LauncherModel.setAlerting(LauncherModel.get(1).appId, true)
1166 LauncherModel.setAlerting(LauncherModel.get(1).appId, true)
1144 tryCompare(appIcon1, "angle", 0, 1000, "angle of appId #1 should not be non-zero")
1167 tryCompare(appIcon1, "angle", 0, 1000, "angle of appId #1 should not be non-zero")
1145− waitForWiggleToStart(appIcon1)
1168+ tryCompare(startedSpy, "count", 1);
1169+ startedSpy.clear();
1171+ startedSpy.target = appIcon7.wiggleAnim;
1146 LauncherModel.setAlerting(LauncherModel.get(7).appId, true)
1172 LauncherModel.setAlerting(LauncherModel.get(7).appId, true)
1147 tryCompare(appIcon7, "angle", 0, 1000, "angle of appId #7 should not be non-zero")
1173 tryCompare(appIcon7, "angle", 0, 1000, "angle of appId #7 should not be non-zero")
1148− waitForWiggleToStart(appIcon7)
1174+ tryCompare(startedSpy, "count", 1);
1149 LauncherModel.setAlerting(LauncherModel.get(1).appId, false)
1175 LauncherModel.setAlerting(LauncherModel.get(1).appId, false)
1150− waitForWiggleToStop(appIcon1)
1151 LauncherModel.setAlerting(LauncherModel.get(7).appId, false)
1176 LauncherModel.setAlerting(LauncherModel.get(7).appId, false)
1152− waitForWiggleToStop(appIcon7)
1177+ tryCompare(stoppedSpy, "count", 1);
1178+ tryCompare(stoppedSpy2, "count", 1);
1155 function test_alertWigglePeekDrag() {
1181 function test_alertWigglePeekDrag() {
1156 var appIcon5 = findChild(launcher, "launcherDelegate5");
1182 var appIcon5 = findChild(launcher, "launcherDelegate5");
1157− var listView = findChild(launcher, "launcherListView")
1183+ var listView = findChild(launcher, "launcherListView");
1184+ startedSpy.target = appIcon5.wiggleAnim;
1185+ stoppedSpy.target = appIcon5.wiggleAnim;
1158 verify(listView != undefined)
1187 verify(listView != undefined)
1159 LauncherModel.setAlerting(LauncherModel.get(5).appId, true)
1188 LauncherModel.setAlerting(LauncherModel.get(5).appId, true)
1160 tryCompare(listView, "peekingIndex", 5, 1000, "Wrong appId set as peeking-index")
1189 tryCompare(listView, "peekingIndex", 5, 1000, "Wrong appId set as peeking-index")
1161− waitForWiggleToStart(appIcon5)
1162− tryCompare(appIcon5, "wiggling", true, 1000, "appId #6 should not be still")
1190+ tryCompare(startedSpy, "count", 1, 1000, "appId #6 should have wiggled")
1163 dragLauncherIntoView();
1191 dragLauncherIntoView();
1164 tryCompare(listView, "peekingIndex", -1, 1000, "peeking-index should be -1")
1192 tryCompare(listView, "peekingIndex", -1, 1000, "peeking-index should be -1")
1165 LauncherModel.setAlerting(LauncherModel.get(5).appId, false)
1193 LauncherModel.setAlerting(LauncherModel.get(5).appId, false)
1166− waitForWiggleToStop(appIcon5)
1167− tryCompare(appIcon5, "wiggling", false, 1000, "appId #1 should not be wiggling")
1194+ tryCompare(stoppedSpy, "count", 1, 1000, "appId #6 should have stopped wiggling");
1170 function test_alertViaCountAndCountVisible() {
1197 function test_alertViaCountAndCountVisible() {
1171 dragLauncherIntoView();
1198 dragLauncherIntoView();
1172 var appIcon1 = findChild(launcher, "launcherDelegate1")
1199 var appIcon1 = findChild(launcher, "launcherDelegate1")
1173 var oldCount = LauncherModel.get(1).count
1200 var oldCount = LauncherModel.get(1).count
1201+ startedSpy.target = appIcon1.wiggleAnim;
1174 LauncherModel.setCount(LauncherModel.get(1).appId, 42)
1202 LauncherModel.setCount(LauncherModel.get(1).appId, 42)
1175− tryCompare(appIcon1, "wiggling", false, 1000, "appId #1 should be still")
1203+ tryCompare(appIcon1.wiggleAnim, "running", false, 1000, "appId #1 should be still")
1176 LauncherModel.setCountVisible(LauncherModel.get(1).appId, 1)
1204 LauncherModel.setCountVisible(LauncherModel.get(1).appId, 1)
1177− tryCompare(appIcon1, "wiggling", true, 1000, "appId #1 should not be still")
1205+ tryCompare(startedSpy, "count", 1);
1178 LauncherModel.setAlerting(LauncherModel.get(1).appId, false)
1206 LauncherModel.setAlerting(LauncherModel.get(1).appId, false)
1179− waitForWiggleToStop(appIcon1)
1207+ appIcon1.wiggleAnim.complete();
1181 LauncherModel.setCount(LauncherModel.get(1).appId, 4711)
1209 LauncherModel.setCount(LauncherModel.get(1).appId, 4711)
1182− tryCompare(appIcon1, "wiggling", true, 1000, "appId #1 should not be still")
1210+ tryCompare(startedSpy, "count", 2);
1183 LauncherModel.setAlerting(LauncherModel.get(1).appId, false)
1211 LauncherModel.setAlerting(LauncherModel.get(1).appId, false)
1184− waitForWiggleToStop(appIcon1)
1212+ appIcon1.wiggleAnim.complete();
1185 LauncherModel.setCountVisible(LauncherModel.get(1).appId, 0)
1213 LauncherModel.setCountVisible(LauncherModel.get(1).appId, 0)
1186 LauncherModel.setCount(LauncherModel.get(1).appId, oldCount)
1214 LauncherModel.setCount(LauncherModel.get(1).appId, oldCount)
@@ -1561,5 +1589,35 @@ Rectangle {
1562 tryCompare(quickList, "selectedIndex", -1)
1590 tryCompare(quickList, "selectedIndex", -1)
1593+ // Regression test for https://github.com/ubports/ubuntu-touch/issues/1441
1594+ // Short problem description: If the Launcher is dragged out while the
1595+ // Peek animation is running, the Launcher disappears after the peek
1596+ // animation ends. The Launcher does not appear until it is dismissed.
1597+ // To check for a regression: Start the peek animation and show the
1598+ // Launcher while it's running. Once the animation is done, check if
1599+ // it's still visible.
1600+ function test_peekCompletionDoesNotHideLauncher() {
1601+ var launcherPanel = findChild(launcher, "launcherPanel");
1602+ verify(launcherPanel);
1603+ var peekingAnimation = findInvisibleChild(launcherPanel, "peekingAnimation5");
1604+ verify(peekingAnimation);
1605+ startedSpy.target = peekingAnimation;
1607+ LauncherModel.setAlerting(LauncherModel.get(5).appId, true);
1608+ // The timing of this test is very exact! The animation still needs
1609+ // to be running when the Launcher is out...
1610+ tryCompare(startedSpy, "count", 1);
1612+ // ...the Launcher should be visible while the animation is
1614+ compare(peekingAnimation.running, true);
1615+ compare(launcherPanel.visible, true);
1616+ tryCompare(peekingAnimation, "running", false);
1617+ // ..and we need to make sure the Launcher completes its next frame
1618+ // after the animation completes
1619+ waitForRendering(launcherPanel);
1620+ compare(launcherPanel.visible, true);