Merge lp:~aacid/ubuntu-ui-toolkit/focus_54 into lp:ubuntu-ui-toolkit/staging

Proposed by Albert Astals Cid
Status: Merged
Approved by: Zsombor Egri
Approved revision: 1398
Merged at revision: 1395
Proposed branch: lp:~aacid/ubuntu-ui-toolkit/focus_54
Merge into: lp:ubuntu-ui-toolkit/staging
Diff against target: 118 lines (+31/-16)
4 files modified
modules/Ubuntu/Components/Popups/PopupBase.qml (+2/-2)
tests/autopilot/ubuntuuitoolkit/_custom_proxy_objects/_flickable.py (+20/-11)
tests/autopilot/ubuntuuitoolkit/_custom_proxy_objects/_header.py (+6/-3)
tests/autopilot/ubuntuuitoolkit/tests/components/test_textinput.py (+3/-0)
To merge this branch: bzr merge lp:~aacid/ubuntu-ui-toolkit/focus_54
Reviewer Review Type Date Requested Status
Zsombor Egri Approve
PS Jenkins bot continuous-integration Approve
Review via email: mp+248001@code.launchpad.net

Commit message

Don't use Qt::PopupFocusReason to change the focus

Even if it is the correct reason QtQuick is since 5.4 ignoring
focus changes due to PopupFocusReason

More at https://qt.gitorious.org/qt/qtdeclarative/commit/e60d8a28034550ae08b258494726050ea9638602

To post a comment you must log in.
lp:~aacid/ubuntu-ui-toolkit/focus_54 updated
1393. By Cris Dywan

Get arch for push_to_phone.sh from device and handle adb refusal.

Approved by PS Jenkins bot, Tim Peeters.

Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Needs Fixing (continuous-integration)
Revision history for this message
Zsombor Egri (zsombi) wrote :

Tjis is weird... Reading the Qt bug description, I disagree that on OSX the focus is not taken away from the text input when opening a menu. The input does loose the focus, I checked it, and Qt apps are the only ones which behave different on OSX.

This fix is OK for us, but I disagree on the Qt fix comment.

review: Approve
Revision history for this message
Zsombor Egri (zsombi) wrote :

> Tjis is weird... Reading the Qt bug description, I disagree that on OSX the
> focus is not taken away from the text input when opening a menu. The input
> does loose the focus, I checked it, and Qt apps are the only ones which behave
> different on OSX.
>
> This fix is OK for us, but I disagree on the Qt fix comment.

Ouh, premature approval! Seems we have an AP failure that can be related to the fix, could you please check it? Thx!

review: Needs Fixing
lp:~aacid/ubuntu-ui-toolkit/focus_54 updated
1394. By Cris Dywan

Abort export_modules_dir.sh and ergo run_tests.sh if binaries are absent. Fixes: https://bugs.launchpad.net/bugs/1415973.

Approved by PS Jenkins bot, Tim Peeters.

Revision history for this message
Albert Astals Cid (aacid) wrote :

I've had a look at the code and doesn't seem related to me, also run the test a few times and couldn't get to fail locally

lp:~aacid/ubuntu-ui-toolkit/focus_54 updated
1395. By Albert Astals Cid

Don't use Qt::PopupFocusReason to change the focus

Even if it is the correct reason QtQuick is since 5.4 ignoring
focus changes due to PopupFocusReason

More at https://qt.gitorious.org/qt/qtdeclarative/commit/e60d8a28034550ae08b258494726050ea9638602

Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Needs Fixing (continuous-integration)
lp:~aacid/ubuntu-ui-toolkit/focus_54 updated
1396. By Albert Astals Cid

Make tests more stable

I am pretty sure they have nothing to do with this Qt 5.4 bugfix
But if we see they are fixed with these changes it'll be more clear
they were actually unstable ones and not caused by the patch itself

Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Needs Fixing (continuous-integration)
lp:~aacid/ubuntu-ui-toolkit/focus_54 updated
1397. By Albert Astals Cid

Fixup logic for above direction

Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Needs Fixing (continuous-integration)
lp:~aacid/ubuntu-ui-toolkit/focus_54 updated
1398. By Albert Astals Cid

More drag == multiple of range fixes

Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Approve (continuous-integration)
Revision history for this message
Zsombor Egri (zsombi) wrote :

All looks fine now, thanks!!

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'modules/Ubuntu/Components/Popups/PopupBase.qml'
2--- modules/Ubuntu/Components/Popups/PopupBase.qml 2014-12-03 14:14:09 +0000
3+++ modules/Ubuntu/Components/Popups/PopupBase.qml 2015-02-03 10:59:03 +0000
4@@ -200,9 +200,9 @@
5 function restoreActiveFocus() {
6 if (prevFocus) {
7 if (prevFocus.hasOwnProperty("requestFocus")) {
8- prevFocus.requestFocus(Qt.PopupFocusReason);
9+ prevFocus.requestFocus(Qt.OtherFocusReason);
10 } else {
11- prevFocus.forceActiveFocus(Qt.PopupFocusReason);
12+ prevFocus.forceActiveFocus(Qt.OtherFocusReason);
13 }
14 }
15 }
16
17=== modified file 'tests/autopilot/ubuntuuitoolkit/_custom_proxy_objects/_flickable.py'
18--- tests/autopilot/ubuntuuitoolkit/_custom_proxy_objects/_flickable.py 2014-10-23 13:35:30 +0000
19+++ tests/autopilot/ubuntuuitoolkit/_custom_proxy_objects/_flickable.py 2015-02-03 10:59:03 +0000
20@@ -74,18 +74,22 @@
21 return (object_center >= visible_top and
22 object_center <= visible_bottom)
23
24- def _slow_drag(self, start_x, stop_x, start_y, stop_y):
25- # If we drag too fast, we end up scrolling more than what we
26- # should, sometimes missing the element we are looking for.
27- original_content_y = self.contentY
28-
29+ def _slow_drag_rate(self):
30 # I found that when the flickDeceleration is 1500, the rate should be
31 # 5 and that when it's 100, the rate should be 1. With those two points
32 # we can get the following equation.
33 # XXX The deceleration might not be linear with respect to the rate,
34 # but this works for the two types of scrollables we have for now.
35 # --elopio - 2014-05-08
36- rate = (self.flickDeceleration + 250) / 350
37+ return (self.flickDeceleration + 250) / 350
38+
39+ def _slow_drag(self, start_x, stop_x, start_y, stop_y, rate=None):
40+ # If we drag too fast, we end up scrolling more than what we
41+ # should, sometimes missing the element we are looking for.
42+ original_content_y = self.contentY
43+
44+ if rate is None:
45+ rate = self._slow_drag_rate()
46 self.pointing_device.drag(start_x, start_y, stop_x, stop_y, rate=rate)
47
48 if self.contentY == original_content_y:
49@@ -140,24 +144,29 @@
50 if containers is None:
51 containers = self._get_containers()
52 start_x = stop_x = self.globalRect.x + (self.globalRect.width // 2)
53+
54+ # Make the drag range be a multiple of the drag "rate" value.
55+ # Workarounds https://bugs.launchpad.net/mir/+bug/1399690
56+ rate = self._slow_drag_rate()
57+
58 # Start and stop just a little under the top and a little over the
59 # bottom.
60- top = _get_visible_container_top(containers) + 5
61- bottom = _get_visible_container_bottom(containers) - 5
62+ top = _get_visible_container_top(containers) + rate
63+ bottom = _get_visible_container_bottom(containers) - rate
64
65 if direction == 'below':
66 # Take into account that swiping from below can open the toolbar or
67 # trigger the bottom edge gesture.
68 # XXX Do this only if we are close to the bottom edge.
69 start_y = bottom - 20
70- stop_y = top
71+ stop_y = start_y + (top - start_y) // rate * rate
72 elif direction == 'above':
73 start_y = top
74- stop_y = bottom
75+ stop_y = start_y + (bottom - start_y) // rate * rate
76 else:
77 raise _common.ToolkitException(
78 'Invalid direction {}.'.format(direction))
79- self._slow_drag(start_x, stop_x, start_y, stop_y)
80+ self._slow_drag(start_x, stop_x, start_y, stop_y, rate)
81 self.dragging.wait_for(False)
82 self.moving.wait_for(False)
83
84
85=== modified file 'tests/autopilot/ubuntuuitoolkit/_custom_proxy_objects/_header.py'
86--- tests/autopilot/ubuntuuitoolkit/_custom_proxy_objects/_header.py 2014-11-24 16:08:45 +0000
87+++ tests/autopilot/ubuntuuitoolkit/_custom_proxy_objects/_header.py 2015-02-03 10:59:03 +0000
88@@ -46,10 +46,13 @@
89 # fills the main view. The header has a flickable property but it
90 # can't be read by autopilot. See bug http://pad.lv/1318829
91 top_container = self._get_top_container()
92- start_x = stop_x = (self.globalRect.x + self.globalRect.width) // 2
93+ # Make the drag range be a multiple of the drag "rate" value.
94+ # Workarounds https://bugs.launchpad.net/mir/+bug/1399690
95+ rate = 10
96+ start_x = stop_x = self.globalRect.x + self.globalRect.width // 2
97 start_y = top_container.globalRect.y + 5
98- stop_y = start_y + self.globalRect.height
99- self.pointing_device.drag(start_x, start_y, stop_x, stop_y)
100+ stop_y = start_y + self.globalRect.height // rate * rate
101+ self.pointing_device.drag(start_x, start_y, stop_x, stop_y, rate)
102 self.y.wait_for(0)
103
104 def wait_for_animation(self):
105
106=== modified file 'tests/autopilot/ubuntuuitoolkit/tests/components/test_textinput.py'
107--- tests/autopilot/ubuntuuitoolkit/tests/components/test_textinput.py 2014-12-01 12:40:23 +0000
108+++ tests/autopilot/ubuntuuitoolkit/tests/components/test_textinput.py 2015-02-03 10:59:03 +0000
109@@ -147,6 +147,9 @@
110 self.pointing_device.click_object(self.textfield)
111 cursor = self.main_view.select_single(
112 objectName='text_cursor_style_cursorPosition')
113+ if (self.textfield.text):
114+ # Let the cursor stabilize
115+ sleep(1)
116 self.pointing_device.click_object(cursor)
117 self.assert_buttons(['Select All', 'Paste'])
118 self.assert_discard_popover()

Subscribers

People subscribed via source and target branches