Merge lp:~aacid/unity/fixTestMouseFlick into lp:unity/phablet

Proposed by Albert Astals Cid
Status: Merged
Approved by: Michael Zanetti
Approved revision: no longer in the source branch.
Merged at revision: 485
Proposed branch: lp:~aacid/unity/fixTestMouseFlick
Merge into: lp:unity/phablet
Diff against target: 32 lines (+5/-4)
2 files modified
tests/qmluitests/UnityTestCase.qml (+4/-3)
tests/qmluitests/tst_Hud.qml (+1/-1)
To merge this branch: bzr merge lp:~aacid/unity/fixTestMouseFlick
Reviewer Review Type Date Requested Status
PS Jenkins bot (community) continuous-integration Approve
Michael Zanetti (community) Approve
Review via email: mp+154017@code.launchpad.net

Commit message

Fix mouseFlick in UnityTestCase to flick to the correct x, y

To post a comment you must log in.
Revision history for this message
Michael Zanetti (mzanetti) :
review: Approve
Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Approve (continuous-integration)

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
=== modified file 'tests/qmluitests/UnityTestCase.qml'
--- tests/qmluitests/UnityTestCase.qml 2013-03-15 11:12:20 +0000
+++ tests/qmluitests/UnityTestCase.qml 2013-03-19 09:37:24 +0000
@@ -23,11 +23,12 @@
23 function mouseFlick(item, x, y, toX, toY, pressMouse, releaseMouse) {23 function mouseFlick(item, x, y, toX, toY, pressMouse, releaseMouse) {
24 pressMouse = ((pressMouse != null) ? pressMouse : true); // Default to true for pressMouse if not present24 pressMouse = ((pressMouse != null) ? pressMouse : true); // Default to true for pressMouse if not present
25 releaseMouse = ((releaseMouse != null) ? releaseMouse : true); // Default to true for releaseMouse if not present25 releaseMouse = ((releaseMouse != null) ? releaseMouse : true); // Default to true for releaseMouse if not present
26 var diffX = toX - x26 var nIterations = 5
27 var diffY = toY - y27 var diffX = (toX - x) / nIterations
28 var diffY = (toY - y) / nIterations
28 if (pressMouse)29 if (pressMouse)
29 mousePress(item, x, y)30 mousePress(item, x, y)
30 for (var i = 0; i < 5; ++i)31 for (var i = 0; i < nIterations; ++i)
31 mouseMove(item, x + (i + 1) * diffX, y + (i + 1) * diffY)32 mouseMove(item, x + (i + 1) * diffX, y + (i + 1) * diffY)
32 if (releaseMouse)33 if (releaseMouse)
33 mouseRelease(item, toX, toY)34 mouseRelease(item, toX, toY)
3435
=== modified file 'tests/qmluitests/tst_Hud.qml'
--- tests/qmluitests/tst_Hud.qml 2013-03-18 14:43:15 +0000
+++ tests/qmluitests/tst_Hud.qml 2013-03-19 09:37:24 +0000
@@ -89,7 +89,7 @@
8989
90 // Check that when dragging right the special item appears at pos hud.appStack.width - itemwidth90 // Check that when dragging right the special item appears at pos hud.appStack.width - itemwidth
91 start_x = units.gu(1)91 start_x = units.gu(1)
92 stop_x = units.gu(45)92 stop_x = units.gu(150)
93 mouseFlick(hud.appStack.__flickable, start_x, 0, stop_x, 0, true, false)93 mouseFlick(hud.appStack.__flickable, start_x, 0, stop_x, 0, true, false)
94 tryCompare(hud.appStack.__specialItem, "visible", true)94 tryCompare(hud.appStack.__specialItem, "visible", true)
95 compare(hud.appStack.__specialItem.x + hud.appStack.__specialItem.width, hud.appStack.width, "Special item on right")95 compare(hud.appStack.__specialItem.x + hud.appStack.__specialItem.width, hud.appStack.width, "Special item on right")

Subscribers

People subscribed via source and target branches