on xenial help sign in
Work around qt bug to make tests pass
commit87c2ff891b925ee9a62279e8377d5b308b9e01ff authorDaniel d'Andrada <daniel.dandrada@canonical.com> dateThu 9 Oct 2014, 11:41 (12 years ago) parente14200d
2 files changed+15−3
qml/Launcher/Launcher.qml+1 tests/qmltests/tst_Shell.qml+14−3
qml/Launcher/Launcher.qml+1
@@ -219,6 +219,7 @@ Item {
219219
220220 EdgeDragArea {
221221 id: dragArea
222+ objectName: "launcherDragArea"
222223
223224 direction: Direction.Rightwards
224225
tests/qmltests/tst_Shell.qml+14−3
@@ -137,7 +137,19 @@ Row {
137137 sessionSpy.target = findChild(shell, "greeter")
138138 dashCommunicatorSpy.target = findInvisibleChild(shell, "dashCommunicator");
139139
140− launcherShowDashHomeSpy.target = findChild(shell, "launcher");
140+ var launcher = findChild(shell, "launcher");
141+ launcherShowDashHomeSpy.target = launcher;
142+
143+ // For some reason, grabbing touches cause MouseArea.mouseX and mouseY
144+ // to contain wrong info during test runs, which then makes tests fail.
145+ // Therefore we have to avoid grabbing touches to work around this bug
146+ // (still to be further investigated and reported).
147+ //
148+ // Make the left-edge drag area immediately recognize touches that land on it
149+ // thus avoing the DirectionalDragArea from grabbing the touch later on.
150+ var launcherDragArea = findChild(launcher, "launcherDragArea");
151+ launcherDragArea.distanceThreshold = 0
152+ launcherDragArea.compositionTime = 0
141153 }
142154
143155 function cleanup() {
@@ -413,8 +425,7 @@ Row {
413425 touchFlick(launcherPanel, touchStartX, touchStartY, touchStartX, 0);
414426 tryCompare(launcherPanel, "moving", false);
415427
416− // NB tapping (i.e., using touch events) doesn't activate the icon... go figure...
417− mouseClick(appIcon, appIcon.width / 2, appIcon.height / 2);
428+ tap(appIcon, appIcon.width / 2, appIcon.height / 2);
418429 }
419430
420431 function showIndicators() {