on xenial help sign in
Better test starting and stopping of alert/wiggle animation.
commite46dc1dc552f1ddbc27de581b49ba5dfda877db4 authorMirco Müller <mirco.mueller@ubuntu.com> dateThu 18 Jun 2015, 17:24 (11 years ago) parentedf3c4b
2 files changed+20−5
qml/Launcher/LauncherDelegate.qml+1 tests/qmltests/Launcher/tst_Launcher.qml+19−5
qml/Launcher/LauncherDelegate.qml+1
@@ -30,6 +30,7 @@ Item {
3030 property bool alerting: false
3131 property bool revealing: false
3232 property bool hiding: false
33+ readonly property alias wiggling: wiggleAnim.running
3334
3435 readonly property int effectiveHeight: Math.cos(angle * Math.PI / 180) * itemHeight
3536 readonly property real foldedHeight: Math.cos(maxAngle * Math.PI / 180) * itemHeight
tests/qmltests/Launcher/tst_Launcher.qml+19−5
@@ -195,6 +195,16 @@ Item {
195195 tryCompare(panel, "x", -panel.width, 1000);
196196 }
197197
198+ function waitForWiggleToStart(appIcon) {
199+ verify(appIcon != undefined)
200+ tryCompare(appIcon, "wiggling", true, 1000, "wiggle-anim should not be in stopped state")
201+ }
202+
203+ function waitForWiggleToStop(appIcon) {
204+ verify(appIcon != undefined)
205+ tryCompare(appIcon, "wiggling", false, 1000, "wiggle-anim should not be in running state")
206+ }
207+
198208 function positionLauncherListAtBeginning() {
199209 var listView = testCase.findChild(launcherLoader.item, "launcherListView");
200210 listView.contentY = -listView.topMargin;
@@ -673,20 +683,20 @@ Item {
673683 }
674684
675685 function test_alertHidingIcon() {
676− var appIcon6 = findChild(launcher, "launcherDelegate6");
686+ var appIcon6 = findChild(launcher, "launcherDelegate6")
687+ verify(appIcon6 != undefined)
677688 LauncherModel.alert(LauncherModel.get(6).appId, true)
678− wait(500)
679− verify(appIcon6.x > 0)
689+ waitForWiggleToStart(appIcon6)
680690 LauncherModel.alert(LauncherModel.get(6).appId, false)
681691 tryCompare(appIcon6, "x", 0, 1000, "x-value of appId #6 should not be non-zero")
682692 }
683693
684694 function test_alertImplicitHidingIcon() {
685− var appIcon4 = findChild(launcher, "launcherDelegate4");
695+ var appIcon4 = findChild(launcher, "launcherDelegate4")
686696 LauncherModel.alert(LauncherModel.get(4).appId, true)
687697 wait(500)
688698 verify(appIcon4.x > 0)
689− dragLauncherIntoView();
699+ dragLauncherIntoView()
690700 tryCompare(appIcon4, "x", 0, 1000, "x-value of appId #4 should not be non-zero")
691701 LauncherModel.alert(LauncherModel.get(4).appId, false)
692702 }
@@ -734,10 +744,14 @@ Item {
734744 var appIcon7 = findChild(launcher, "launcherDelegate7");
735745 LauncherModel.alert(LauncherModel.get(1).appId, true)
736746 tryCompare(appIcon1, "angle", 0, 1000, "angle of appId #1 should not be non-zero")
747+ waitForWiggleToStart(appIcon1)
737748 LauncherModel.alert(LauncherModel.get(7).appId, true)
738749 tryCompare(appIcon7, "angle", 0, 1000, "angle of appId #7 should not be non-zero")
750+ waitForWiggleToStart(appIcon7)
739751 LauncherModel.alert(LauncherModel.get(1).appId, false)
752+ waitForWiggleToStop(appIcon1)
740753 LauncherModel.alert(LauncherModel.get(7).appId, false)
754+ waitForWiggleToStop(appIcon7)
741755 }
742756 }
743757}