Merge lp:~brendan-donegan/ubuntu-ui-toolkit/swipe_into_view_keyboard into lp:ubuntu-ui-toolkit/staging

Proposed by Brendan Donegan
Status: Merged
Approved by: Zoltan Balogh
Approved revision: 1238
Merged at revision: 1712
Proposed branch: lp:~brendan-donegan/ubuntu-ui-toolkit/swipe_into_view_keyboard
Merge into: lp:ubuntu-ui-toolkit/staging
Diff against target: 97 lines (+44/-5)
2 files modified
tests/autopilot/ubuntuuitoolkit/_custom_proxy_objects/_flickable.py (+3/-0)
tests/autopilot/ubuntuuitoolkit/tests/custom_proxy_objects/test_flickable.py (+41/-5)
To merge this branch: bzr merge lp:~brendan-donegan/ubuntu-ui-toolkit/swipe_into_view_keyboard
Reviewer Review Type Date Requested Status
PS Jenkins bot continuous-integration Approve
Zoltan Balogh Approve
Review via email: mp+273805@code.launchpad.net

This proposal supersedes a proposal from 2015-10-07.

Commit message

Account for presence of OSK in Flickable helpers and add a test for the same

Description of the change

When swiping a component into view, the helpers should account for the fact that the keyboard might be on screen - if it is then we should consider the top of the keyboard to be the bottom of the visible screen.

To post a comment you must log in.
Revision history for this message
PS Jenkins bot (ps-jenkins) wrote : Posted in a previous version of this proposal
review: Needs Fixing (continuous-integration)
Revision history for this message
PS Jenkins bot (ps-jenkins) wrote : Posted in a previous version of this proposal
review: Approve (continuous-integration)
Revision history for this message
Cris Dywan (kalikiana) wrote : Posted in a previous version of this proposal

This must be re-targeted against staging.

Revision history for this message
Brendan Donegan (brendan-donegan) wrote :

Apologies, did that now

Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Approve (continuous-integration)
Revision history for this message
Zoltan Balogh (bzoltan) :
review: Approve
Revision history for this message
PS Jenkins bot (ps-jenkins) :
review: Approve (continuous-integration)

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'tests/autopilot/ubuntuuitoolkit/_custom_proxy_objects/_flickable.py'
2--- tests/autopilot/ubuntuuitoolkit/_custom_proxy_objects/_flickable.py 2015-02-07 00:32:47 +0000
3+++ tests/autopilot/ubuntuuitoolkit/_custom_proxy_objects/_flickable.py 2015-10-08 10:18:25 +0000
4@@ -37,6 +37,9 @@
5 containers_bottom = [
6 container.globalRect.y + container.globalRect.height
7 for container in containers if container.globalRect.height > 0]
8+ keyboard = _common.get_keyboard()
9+ if keyboard._keyboard.is_available():
10+ containers_bottom.append(keyboard._keyboard.keyboard.globalRect.y)
11 return min(containers_bottom)
12
13
14
15=== modified file 'tests/autopilot/ubuntuuitoolkit/tests/custom_proxy_objects/test_flickable.py'
16--- tests/autopilot/ubuntuuitoolkit/tests/custom_proxy_objects/test_flickable.py 2015-09-22 15:56:35 +0000
17+++ tests/autopilot/ubuntuuitoolkit/tests/custom_proxy_objects/test_flickable.py 2015-10-08 10:18:25 +0000
18@@ -16,13 +16,19 @@
19
20 from unittest import mock
21
22+from autopilot.matchers import Eventually
23+from autopilot._fixtures import OSKAlwaysEnabled
24+from testtools.matchers import Equals
25 import testtools
26 import ubuntuuitoolkit
27 from ubuntuuitoolkit import (
28 tests,
29 units,
30 )
31-from ubuntuuitoolkit._custom_proxy_objects import _flickable
32+from ubuntuuitoolkit._custom_proxy_objects import (
33+ _flickable,
34+ _common,
35+)
36
37
38 class FlickableTestCase(testtools.TestCase):
39@@ -127,17 +133,34 @@
40 text: 'Top button'
41 onClicked: clickedLabel.text = objectName
42 }
43- Rectangle {
44- id: emptyRectangle
45- height: units.gu(80)
46+ TextField {
47+ id: topTextField
48+ objectName: 'topTextField'
49 anchors.top: topButton.bottom
50 }
51+ Rectangle {
52+ id: emptyRectangle1
53+ height: units.gu(40)
54+ anchors.top: topTextField.bottom
55+ }
56+ Button {
57+ id: middleButton
58+ objectName: 'middleButton'
59+ text: 'Middle button'
60+ onClicked: clickedLabel.text = objectName
61+ anchors.top: emptyRectangle1.bottom
62+ }
63+ Rectangle {
64+ id: emptyRectangle2
65+ height: units.gu(40)
66+ anchors.top: middleButton.bottom
67+ }
68 Button {
69 id: bottomButton
70 objectName: 'bottomButton'
71 text: 'Bottom button'
72 onClicked: clickedLabel.text = objectName
73- anchors.top: emptyRectangle.bottom
74+ anchors.top: emptyRectangle2.bottom
75 }
76 }
77 }
78@@ -160,6 +183,19 @@
79 self.pointing_device.click_object(button)
80 self.assertEqual(self.label.text, 'bottomButton')
81
82+ def test_swipe_into_view_behind_keyboard(self):
83+ self.main_view.close_toolbar()
84+ self.useFixture(OSKAlwaysEnabled())
85+ keyboard = _common.get_keyboard()
86+ topTextField = self.main_view.select_single(objectName='topTextField')
87+ self.pointing_device.click_object(topTextField)
88+ self.assertTrue(keyboard._keyboard.wait_for_keyboard_ready(),
89+ 'Keyboard not displayed when requested.')
90+ button = self.main_view.select_single(objectName='middleButton')
91+ button.swipe_into_view()
92+ self.pointing_device.click_object(button)
93+ self.assertThat(self.label.text, Eventually(Equals('middleButton')))
94+
95 def test_swipe_into_view_top_element(self):
96 self.main_view.close_toolbar()
97 bottomButton = self.main_view.select_single(objectName='bottomButton')

Subscribers

People subscribed via source and target branches