Merge lp:~canonical-platform-qa/ubuntu-ui-toolkit/fix1401517-overwrite_swipe_borders into lp:ubuntu-ui-toolkit/staging
- fix1401517-overwrite_swipe_borders
- Merge into staging
Status: | Merged |
---|---|
Approved by: | Zsombor Egri |
Approved revision: | 1381 |
Merged at revision: | 1478 |
Proposed branch: | lp:~canonical-platform-qa/ubuntu-ui-toolkit/fix1401517-overwrite_swipe_borders |
Merge into: | lp:ubuntu-ui-toolkit/staging |
Prerequisite: | lp:~canonical-platform-qa/ubuntu-ui-toolkit/grid_units |
Diff against target: |
123 lines (+62/-11) 2 files modified
tests/autopilot/ubuntuuitoolkit/_custom_proxy_objects/_flickable.py (+18/-10) tests/autopilot/ubuntuuitoolkit/tests/custom_proxy_objects/test_flickable.py (+44/-1) |
To merge this branch: | bzr merge lp:~canonical-platform-qa/ubuntu-ui-toolkit/fix1401517-overwrite_swipe_borders |
Related bugs: |
Reviewer | Review Type | Date Requested | Status |
---|---|---|---|
PS Jenkins bot | continuous-integration | Approve | |
Zsombor Egri | Approve | ||
Brendan Donegan (community) | Approve | ||
Leo Arias (community) | Approve | ||
Albert Astals Cid (community) | Abstain | ||
Review via email: mp+248986@code.launchpad.net |
This proposal supersedes a proposal from 2014-12-17.
Commit message
Make it possible to overwrite the bottom margin for the flickable autopilot helper.
Description of the change
PS Jenkins bot (ps-jenkins) wrote : Posted in a previous version of this proposal | # |
PS Jenkins bot (ps-jenkins) wrote : Posted in a previous version of this proposal | # |
FAILED: Continuous integration, rev:1372
http://
Executed test runs:
UNSTABLE: http://
SUCCESS: http://
SUCCESS: http://
deb: http://
SUCCESS: http://
UNSTABLE: http://
SUCCESS: http://
deb: http://
SUCCESS: http://
Click here to trigger a rebuild:
http://
PS Jenkins bot (ps-jenkins) wrote : Posted in a previous version of this proposal | # |
FAILED: Continuous integration, rev:1373
http://
Executed test runs:
UNSTABLE: http://
SUCCESS: http://
SUCCESS: http://
deb: http://
SUCCESS: http://
UNSTABLE: http://
SUCCESS: http://
deb: http://
SUCCESS: http://
Click here to trigger a rebuild:
http://
Tim Peeters (tpeeters) wrote : Posted in a previous version of this proposal | # |
37 elif direction == 'above':
38 - start_y = top
39 - stop_y = bottom
40 + start_y = top + 5
41 + stop_y = bottom - 5
to be consistent, you should use
start_y = top + self.margin_
Tim Peeters (tpeeters) wrote : Posted in a previous version of this proposal | # |
+ # Swiping from below can open the toolbar or trigger the bottom edge
9 + # gesture. Use this margin to start a swipe that will not be that close to
10 + # the bottom edge.
11 + margin_
Where did you get the 25 pixels from? Shouldn't we use grid units here?
We have this in the UITK Panel.qml:
/*!
The size (height for top or bottom-aligned panels, width for left or right-aligned
panels) of the mouse area used to detect edge swipes to open the panel, when
the panel is not opened. Default value: units.gu(2).
*/
property real triggerSize: units.gu(2)
So apps that use the Panel with default settings will need a margin of 2 grid units. Of course apps can override this with their own value (or not use the Panel at all and implement their own bottom-edge).
Leo Arias (elopio) wrote : | # |
@albert, I more or less understand what you did with the drags and the rate.
What I don't understand is why you add the rate to the top and subtract it from the bottom. I removed that part, so can you please take a look and confirm I'm not breaking anything from your change?
PS Jenkins bot (ps-jenkins) wrote : | # |
FAILED: Continuous integration, rev:1378
http://
Executed test runs:
UNSTABLE: http://
SUCCESS: http://
SUCCESS: http://
deb: http://
SUCCESS: http://
UNSTABLE: http://
SUCCESS: http://
deb: http://
SUCCESS: http://
Click here to trigger a rebuild:
http://
Albert Astals Cid (aacid) wrote : | # |
Leo, the idea +/- rate was already there, i kept it as "buffer" zone since we're doing a integer division and then multiplying back byu the rate we may get a big enough number and i did not want to end up past top/bottom but i guess that it's not really possible.
Albert Astals Cid (aacid) wrote : | # |
I'll leave it to the SDK guys
Leo Arias (elopio) wrote : | # |
The prerequisite has a test failing in mako. Work in progress while we find the issue.
PS Jenkins bot (ps-jenkins) wrote : | # |
FAILED: Continuous integration, rev:1380
http://
Executed test runs:
UNSTABLE: http://
SUCCESS: http://
SUCCESS: http://
deb: http://
SUCCESS: http://
UNSTABLE: http://
SUCCESS: http://
deb: http://
SUCCESS: http://
Click here to trigger a rebuild:
http://
Federico Gimenez (fgimenez) wrote : | # |
The failing tests have been fixed and the prerequisite has already landed, back to Needs review
Brendan Donegan (brendan-donegan) wrote : | # |
LGTM +1
Leo Arias (elopio) wrote : | # |
We already have functional tests that do the swiping for real, so I think it's ok for this case to use a mock. One of those swiping tests failed in the latest execution, which makes me uneasy. Can someone retrigger the jenkins job? I don't have the vpn configured in my laptop, I will do it as soon as I get some quiet time.
- 1381. By Federico Gimenez
-
Merged with staging
PS Jenkins bot (ps-jenkins) wrote : | # |
FAILED: Continuous integration, rev:1380
http://
Executed test runs:
UNSTABLE: http://
SUCCESS: http://
SUCCESS: http://
deb: http://
SUCCESS: http://
UNSTABLE: http://
SUCCESS: http://
deb: http://
SUCCESS: http://
Click here to trigger a rebuild:
http://
Leo Arias (elopio) wrote : | # |
+1. There seems to be an qmlscene crash making some tests fail, but on this run all the tests affected are passing.
PS Jenkins bot (ps-jenkins) wrote : | # |
PASSED: Continuous integration, rev:1381
http://
Executed test runs:
SUCCESS: http://
SUCCESS: http://
SUCCESS: http://
deb: http://
SUCCESS: http://
SUCCESS: http://
SUCCESS: http://
deb: http://
SUCCESS: http://
Click here to trigger a rebuild:
http://
Brendan Donegan (brendan-donegan) wrote : | # |
My previous comment didn't come out as an Approve. Approving again
Zsombor Egri (zsombi) wrote : | # |
Looks good to go. Thank you!
PS Jenkins bot (ps-jenkins) : | # |
Preview Diff
1 | === modified file 'tests/autopilot/ubuntuuitoolkit/_custom_proxy_objects/_flickable.py' | |||
2 | --- tests/autopilot/ubuntuuitoolkit/_custom_proxy_objects/_flickable.py 2015-02-03 08:34:58 +0000 | |||
3 | +++ tests/autopilot/ubuntuuitoolkit/_custom_proxy_objects/_flickable.py 2015-04-15 13:48:54 +0000 | |||
4 | @@ -19,6 +19,7 @@ | |||
5 | 19 | import autopilot.exceptions | 19 | import autopilot.exceptions |
6 | 20 | from autopilot import logging as autopilot_logging | 20 | from autopilot import logging as autopilot_logging |
7 | 21 | 21 | ||
8 | 22 | from ubuntuuitoolkit import units | ||
9 | 22 | from ubuntuuitoolkit._custom_proxy_objects import _common | 23 | from ubuntuuitoolkit._custom_proxy_objects import _common |
10 | 23 | 24 | ||
11 | 24 | 25 | ||
12 | @@ -98,6 +99,14 @@ | |||
13 | 98 | 99 | ||
14 | 99 | class QQuickFlickable(Scrollable): | 100 | class QQuickFlickable(Scrollable): |
15 | 100 | 101 | ||
16 | 102 | # Swiping from below can open the toolbar or trigger the bottom edge | ||
17 | 103 | # gesture. Use this margin to start a swipe that will not be that close to | ||
18 | 104 | # the bottom edge. | ||
19 | 105 | margin_to_swipe_from_bottom = units.gu(2) | ||
20 | 106 | # Swiping from above can open the indicators or resize the window. Use this | ||
21 | 107 | # margin to start a swipe that will not be that close to the top edge. | ||
22 | 108 | margin_to_swipe_from_top = units.gu(1) | ||
23 | 109 | |||
24 | 101 | @autopilot_logging.log_action(logger.info) | 110 | @autopilot_logging.log_action(logger.info) |
25 | 102 | def swipe_child_into_view(self, child): | 111 | def swipe_child_into_view(self, child): |
26 | 103 | """Make the child visible. | 112 | """Make the child visible. |
27 | @@ -145,24 +154,23 @@ | |||
28 | 145 | containers = self._get_containers() | 154 | containers = self._get_containers() |
29 | 146 | start_x = stop_x = self.globalRect.x + (self.globalRect.width // 2) | 155 | start_x = stop_x = self.globalRect.x + (self.globalRect.width // 2) |
30 | 147 | 156 | ||
31 | 157 | top = _get_visible_container_top(containers) | ||
32 | 158 | bottom = _get_visible_container_bottom(containers) | ||
33 | 159 | |||
34 | 148 | # Make the drag range be a multiple of the drag "rate" value. | 160 | # Make the drag range be a multiple of the drag "rate" value. |
35 | 149 | # Workarounds https://bugs.launchpad.net/mir/+bug/1399690 | 161 | # Workarounds https://bugs.launchpad.net/mir/+bug/1399690 |
36 | 150 | rate = self._slow_drag_rate() | 162 | rate = self._slow_drag_rate() |
37 | 151 | 163 | ||
43 | 152 | # Start and stop just a little under the top and a little over the | 164 | # The swipes are not done from right at the top and bottom because |
44 | 153 | # bottom. | 165 | # they could trigger edge gestures or resize windows. |
40 | 154 | top = _get_visible_container_top(containers) + rate | ||
41 | 155 | bottom = _get_visible_container_bottom(containers) - rate | ||
42 | 156 | |||
45 | 157 | if direction == 'below': | 166 | if direction == 'below': |
50 | 158 | # Take into account that swiping from below can open the toolbar or | 167 | start_y = bottom - self.margin_to_swipe_from_bottom |
47 | 159 | # trigger the bottom edge gesture. | ||
48 | 160 | # XXX Do this only if we are close to the bottom edge. | ||
49 | 161 | start_y = bottom - 20 | ||
51 | 162 | stop_y = start_y + (top - start_y) // rate * rate | 168 | stop_y = start_y + (top - start_y) // rate * rate |
52 | 169 | |||
53 | 163 | elif direction == 'above': | 170 | elif direction == 'above': |
55 | 164 | start_y = top | 171 | start_y = top + self.margin_to_swipe_from_top |
56 | 165 | stop_y = start_y + (bottom - start_y) // rate * rate | 172 | stop_y = start_y + (bottom - start_y) // rate * rate |
57 | 173 | |||
58 | 166 | else: | 174 | else: |
59 | 167 | raise _common.ToolkitException( | 175 | raise _common.ToolkitException( |
60 | 168 | 'Invalid direction {}.'.format(direction)) | 176 | 'Invalid direction {}.'.format(direction)) |
61 | 169 | 177 | ||
62 | === modified file 'tests/autopilot/ubuntuuitoolkit/tests/custom_proxy_objects/test_flickable.py' | |||
63 | --- tests/autopilot/ubuntuuitoolkit/tests/custom_proxy_objects/test_flickable.py 2015-03-03 13:20:06 +0000 | |||
64 | +++ tests/autopilot/ubuntuuitoolkit/tests/custom_proxy_objects/test_flickable.py 2015-04-15 13:48:54 +0000 | |||
65 | @@ -21,7 +21,11 @@ | |||
66 | 21 | 21 | ||
67 | 22 | import testtools | 22 | import testtools |
68 | 23 | import ubuntuuitoolkit | 23 | import ubuntuuitoolkit |
70 | 24 | from ubuntuuitoolkit import tests | 24 | from ubuntuuitoolkit import ( |
71 | 25 | tests, | ||
72 | 26 | units, | ||
73 | 27 | ) | ||
74 | 28 | from ubuntuuitoolkit._custom_proxy_objects import _flickable | ||
75 | 25 | 29 | ||
76 | 26 | 30 | ||
77 | 27 | class FlickableTestCase(testtools.TestCase): | 31 | class FlickableTestCase(testtools.TestCase): |
78 | @@ -218,6 +222,45 @@ | |||
79 | 218 | self.flickable.swipe_to_show_more_below() | 222 | self.flickable.swipe_to_show_more_below() |
80 | 219 | self.assertFalse(self.flickable.atYBeginning) | 223 | self.assertFalse(self.flickable.atYBeginning) |
81 | 220 | 224 | ||
82 | 225 | def test_swipe_to_show_more_below_with_bottom_margin(self): | ||
83 | 226 | """Calling swipe to show more below will use the margin in the drag.""" | ||
84 | 227 | qquickflickable = self.main_view.select_single( | ||
85 | 228 | ubuntuuitoolkit.QQuickFlickable, objectName='flickable') | ||
86 | 229 | qquickflickable.margin_to_swipe_from_bottom = units.gu(6) | ||
87 | 230 | containers = qquickflickable._get_containers() | ||
88 | 231 | bottom = _flickable._get_visible_container_bottom(containers) | ||
89 | 232 | |||
90 | 233 | with mock.patch.object( | ||
91 | 234 | qquickflickable.pointing_device, 'drag') as mock_drag: | ||
92 | 235 | try: | ||
93 | 236 | qquickflickable.swipe_to_show_more_below() | ||
94 | 237 | except ubuntuuitoolkit.ToolkitException: | ||
95 | 238 | # An exception will be raised because the drag was faked. | ||
96 | 239 | pass | ||
97 | 240 | |||
98 | 241 | mock_drag.assert_called_with( | ||
99 | 242 | mock.ANY, bottom - units.gu(6), mock.ANY, mock.ANY, rate=mock.ANY) | ||
100 | 243 | |||
101 | 244 | def test_swipe_to_show_more_above_with_top_margin(self): | ||
102 | 245 | """Calling swipe to show more above will use the margin in the drag.""" | ||
103 | 246 | qquickflickable = self.main_view.select_single( | ||
104 | 247 | ubuntuuitoolkit.QQuickFlickable, objectName='flickable') | ||
105 | 248 | qquickflickable.margin_to_swipe_from_top = units.gu(6) | ||
106 | 249 | containers = qquickflickable._get_containers() | ||
107 | 250 | top = _flickable._get_visible_container_top(containers) | ||
108 | 251 | |||
109 | 252 | qquickflickable.swipe_to_bottom() | ||
110 | 253 | with mock.patch.object( | ||
111 | 254 | qquickflickable.pointing_device, 'drag') as mock_drag: | ||
112 | 255 | try: | ||
113 | 256 | qquickflickable.swipe_to_show_more_above() | ||
114 | 257 | except ubuntuuitoolkit.ToolkitException: | ||
115 | 258 | # An exception will be raised because the drag was faked. | ||
116 | 259 | pass | ||
117 | 260 | |||
118 | 261 | mock_drag.assert_called_with( | ||
119 | 262 | mock.ANY, top + units.gu(6), mock.ANY, mock.ANY, rate=mock.ANY) | ||
120 | 263 | |||
121 | 221 | def test_failed_drag_must_raise_exception(self): | 264 | def test_failed_drag_must_raise_exception(self): |
122 | 222 | dummy_coordinates = (0, 0, 10, 10) | 265 | dummy_coordinates = (0, 0, 10, 10) |
123 | 223 | # Patch the pointing device so it does nothing and the swipe fails. | 266 | # Patch the pointing device so it does nothing and the swipe fails. |
FAILED: Continuous integration, rev:1371 jenkins. qa.ubuntu. com/job/ ubuntu- sdk-team- ubuntu- ui-toolkit- staging- ci/1337/ jenkins. qa.ubuntu. com/job/ generic- deb-autopilot- vivid-touch/ 617 jenkins. qa.ubuntu. com/job/ ubuntu- sdk-team- ubuntu- ui-toolkit- staging- vivid-amd64- ci/64 jenkins. qa.ubuntu. com/job/ ubuntu- sdk-team- ubuntu- ui-toolkit- staging- vivid-armhf- ci/67 jenkins. qa.ubuntu. com/job/ ubuntu- sdk-team- ubuntu- ui-toolkit- staging- vivid-armhf- ci/67/artifact/ work/output/ *zip*/output. zip jenkins. qa.ubuntu. com/job/ ubuntu- sdk-team- ubuntu- ui-toolkit- staging- vivid-i386- ci/64 jenkins. qa.ubuntu. com/job/ generic- deb-autopilot- runner- vivid-mako/ 530 jenkins. qa.ubuntu. com/job/ generic- mediumtests- builder- vivid-armhf/ 615 jenkins. qa.ubuntu. com/job/ generic- mediumtests- builder- vivid-armhf/ 615/artifact/ work/output/ *zip*/output. zip s-jenkins. ubuntu- ci:8080/ job/touch- flash-device/ 16679
http://
Executed test runs:
UNSTABLE: http://
SUCCESS: http://
SUCCESS: http://
deb: http://
SUCCESS: http://
UNSTABLE: http://
SUCCESS: http://
deb: http://
SUCCESS: http://
Click here to trigger a rebuild: s-jenkins. ubuntu- ci:8080/ job/ubuntu- sdk-team- ubuntu- ui-toolkit- staging- ci/1337/ rebuild
http://