on xenial help sign in
don't trigger the greeter teasing during a movement of the greeter.

Approved by PS Jenkins bot, Andrea Cimitan.

commita7cab4c9a79bdde96ee770126c095da0a8487636 authorMichael Zanetti <michael.zanetti@canonical.com> dateMon 4 Nov 2013, 20:28 (13 years ago) parent0ccfea6582a8c6
2 files changed+19−6
Greeter/Greeter.qml+1−1 tests/qmltests/Greeter/tst_Phone.qml+18−5
Greeter/Greeter.qml+1−1
@@ -52,7 +52,7 @@ Showable {
5252 signal unlocked(int uid)
5353
5454 onRightTeaserPressedChanged: {
55− if (rightTeaserPressed && !locked) {
55+ if (rightTeaserPressed && !locked && x == 0) {
5656 teasingTimer.start();
5757 }
5858 }
tests/qmltests/Greeter/tst_Phone.qml+18−5
@@ -83,8 +83,9 @@ Item {
8383
8484 function test_teaseLockedUnlocked_data() {
8585 return [
86− {tag: "unlocked", locked: false},
87− {tag: "locked", locked: true}
86+ {tag: "unlocked", locked: false, moved: false},
87+ {tag: "locked", locked: true, moved: false},
88+ {tag: "moved", locked: false, moved: true}
8889 ];
8990 }
9091
@@ -93,10 +94,16 @@ Item {
9394 tryCompare(greeter, "x", 0);
9495 greeter.locked = data.locked;
9596
97+ // simulate greeter being in the middle of a swipe
98+ if (data.moved) {
99+ greeter.x = -units.gu(4);
100+ tryCompare(greeter, "x", -units.gu(4));
101+ }
102+
96103 mouseClick(greeter, greeter.width - units.gu(5), greeter.height - units.gu(1));
97104 greeter.minX = 0; // This is needed because the transition actually makes x jump once before animating
98105
99− if (!data.locked) {
106+ if (!data.locked && !data.moved) {
100107 // Check if it has been moved over by 2 GUs. Give it a 2 pixel grace area
101108 // because animation duration and teaseTimer are the same duration and
102109 // might cause slight offsets
@@ -104,10 +111,16 @@ Item {
104111 } else {
105112 // waiting 100ms to make sure nothing moves
106113 wait(100);
107− compare(greeter.minX, 0, "Greeter moved even tho its locked");
114+ compare(greeter.minX, 0, "Greeter teasing not disabled even though it's locked or moving.");
108115 }
116+
117+ // Restore position in case we moved it for the test
118+ if (data.moved) {
119+ greeter.x = 0;
120+ }
121+
109122 // Wait until we're back to 0
110− tryCompareFunction(function() { return greeter.x;}, 0);
123+ tryCompareFunction(function() { return greeter.x;}, 0);
111124 }
112125
113126 function test_statsWelcomeScreen() {