Merge lp:~elopio/ubuntu-ui-toolkit/fix1314390-click_element_on_unity into lp:ubuntu-ui-toolkit/staging
- fix1314390-click_element_on_unity
- Merge into staging
Status: | Merged |
---|---|
Approved by: | Tim Peeters |
Approved revision: | 1032 |
Merged at revision: | 1057 |
Proposed branch: | lp:~elopio/ubuntu-ui-toolkit/fix1314390-click_element_on_unity |
Merge into: | lp:ubuntu-ui-toolkit/staging |
Diff against target: |
97 lines (+73/-9) 2 files modified
tests/autopilot/ubuntuuitoolkit/_custom_proxy_objects/_flickable.py (+13/-9) tests/autopilot/ubuntuuitoolkit/tests/custom_proxy_objects/test_flickable.py (+60/-0) |
To merge this branch: | bzr merge lp:~elopio/ubuntu-ui-toolkit/fix1314390-click_element_on_unity |
Related bugs: |
Reviewer | Review Type | Date Requested | Status |
---|---|---|---|
PS Jenkins bot | continuous-integration | Approve | |
Tim Peeters | Approve | ||
Cris Dywan | Needs Information | ||
Allan LeSage (community) | Approve | ||
Review via email: mp+217693@code.launchpad.net |
This proposal supersedes a proposal from 2014-04-29.
Commit message
On the autopilot helpers, find the top container starting from the flickable.
Description of the change
Leo Arias (elopio) wrote : | # |
Do you mean this error condition?
25 + if top_container is None:
26 + raise _common.
27 + "Couldn't find the top-most container.")
It will just happen if no parent has a global rect. Which is an unlikely case, but could happen.
PS Jenkins bot (ps-jenkins) wrote : | # |
FAILED: Continuous integration, rev:1028
http://
Executed test runs:
UNSTABLE: http://
SUCCESS: http://
SUCCESS: http://
SUCCESS: http://
deb: http://
SUCCESS: http://
UNSTABLE: http://
SUCCESS: http://
deb: http://
SUCCESS: http://
SUCCESS: http://
SUCCESS: http://
deb: http://
Click here to trigger a rebuild:
http://
PS Jenkins bot (ps-jenkins) wrote : | # |
FAILED: Continuous integration, rev:1029
http://
Executed test runs:
UNSTABLE: http://
SUCCESS: http://
SUCCESS: http://
SUCCESS: http://
deb: http://
SUCCESS: http://
UNSTABLE: http://
SUCCESS: http://
deb: http://
SUCCESS: http://
SUCCESS: http://
SUCCESS: http://
deb: http://
Click here to trigger a rebuild:
http://
PS Jenkins bot (ps-jenkins) wrote : | # |
PASSED: Continuous integration, rev:1030
http://
Executed test runs:
SUCCESS: http://
SUCCESS: http://
SUCCESS: http://
SUCCESS: http://
deb: http://
SUCCESS: http://
SUCCESS: http://
SUCCESS: http://
deb: http://
SUCCESS: http://
SUCCESS: http://
SUCCESS: http://
deb: http://
Click here to trigger a rebuild:
http://
Allan LeSage (allanlesage) wrote : | # |
Thank you for answering my question elopio.
Cris Dywan (kalikiana) wrote : | # |
test_get_
Cris Dywan (kalikiana) wrote : | # |
See lp:~ubuntu-sdk-team/ubuntu-ui-toolkit/engineLauncher for a way to reproduce the difference in the component hierarchy.
Leo Arias (elopio) wrote : | # |
kalikiana, we can merge this and once your branch is ready to be used, I'll update the test.
I say it mainly because this branch is a prerequisite of a branch that's a prerequisite for your tumb branch. For my side, I wouldn't mind waiting.
Tim Peeters (tpeeters) wrote : | # |
I have a branch depending on this one that adds automatic showing of the header in AP tests when needed which is currently blocking the telephony apps, so I would not mind if this one is merged soon.
Tim Peeters (tpeeters) wrote : | # |
no pressure ;)
PS Jenkins bot (ps-jenkins) wrote : | # |
FAILED: Continuous integration, rev:1033
http://
Executed test runs:
FAILURE: http://
FAILURE: http://
FAILURE: http://
FAILURE: http://
FAILURE: http://
FAILURE: http://
FAILURE: http://
Click here to trigger a rebuild:
http://
Tim Peeters (tpeeters) wrote : | # |
Thanks for adding the FIXME.
CI failed on the old 1033 where the repo was messed up, but 1030 was good so the new 1031 should pass soon also.
There are no merge conflicts with staging.
I'm approving so that we can get all the depending branches in, but let's fix the FIXME as soon as possible.
PS Jenkins bot (ps-jenkins) wrote : | # |
FAILED: Autolanding.
More details in the following jenkins job:
http://
Executed test runs:
SUCCESS: http://
UNSTABLE: http://
SUCCESS: http://
SUCCESS: http://
deb: http://
SUCCESS: http://
SUCCESS: http://
SUCCESS: http://
deb: http://
SUCCESS: http://
UNSTABLE: http://
SUCCESS: http://
deb: http://
Cris Dywan (kalikiana) wrote : | # |
_StringException: Traceback (most recent call last):
File "/usr/lib/
flickable = ubuntuuitoolkit
File "/usr/lib/
super(
File "/usr/lib/
self.id
File "/usr/lib/
% type(path).__name__
TypeError: 'path' attribute must be bytes, not 'str'
Leo Arias (elopio) wrote : | # |
It would have been so easy to get this merged without tests ;)
It should work now. I hope.
PS Jenkins bot (ps-jenkins) wrote : | # |
PASSED: Continuous integration, rev:1032
http://
Executed test runs:
SUCCESS: http://
SUCCESS: http://
SUCCESS: http://
SUCCESS: http://
deb: http://
SUCCESS: http://
SUCCESS: http://
SUCCESS: http://
deb: http://
SUCCESS: http://
SUCCESS: http://
SUCCESS: http://
deb: http://
Click here to trigger a rebuild:
http://
PS Jenkins bot (ps-jenkins) wrote : | # |
FAILED: Autolanding.
More details in the following jenkins job:
http://
Executed test runs:
UNSTABLE: http://
SUCCESS: http://
SUCCESS: http://
SUCCESS: http://
deb: http://
SUCCESS: http://
UNSTABLE: http://
SUCCESS: http://
deb: http://
SUCCESS: http://
SUCCESS: http://
SUCCESS: http://
deb: http://
Tim Peeters (tpeeters) wrote : | # |
autolanding failed because of jenkins breakage? happroving again.
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 2014-04-16 21:13:39 +0000 | |||
3 | +++ tests/autopilot/ubuntuuitoolkit/_custom_proxy_objects/_flickable.py 2014-05-16 08:50:05 +0000 | |||
4 | @@ -68,15 +68,19 @@ | |||
5 | 68 | def _get_top_container(self): | 68 | def _get_top_container(self): |
6 | 69 | """Return the top-most container with a globalRect.""" | 69 | """Return the top-most container with a globalRect.""" |
7 | 70 | root = self.get_root_instance() | 70 | root = self.get_root_instance() |
17 | 71 | containers = [root] | 71 | parent = self.get_parent() |
18 | 72 | while len(containers) == 1: | 72 | top_container = None |
19 | 73 | try: | 73 | while parent.id != root.id: |
20 | 74 | containers[0].globalRect | 74 | if hasattr(parent, 'globalRect'): |
21 | 75 | return containers[0] | 75 | top_container = parent |
22 | 76 | except AttributeError: | 76 | |
23 | 77 | containers = containers[0].get_children() | 77 | parent = parent.get_parent() |
24 | 78 | 78 | ||
25 | 79 | raise _common.ToolkitException("Couldn't find the top-most container.") | 79 | if top_container is None: |
26 | 80 | raise _common.ToolkitException( | ||
27 | 81 | "Couldn't find the top-most container.") | ||
28 | 82 | else: | ||
29 | 83 | return top_container | ||
30 | 80 | 84 | ||
31 | 81 | def _is_child_visible(self, child, containers): | 85 | def _is_child_visible(self, child, containers): |
32 | 82 | """Check if the center of the child is visible. | 86 | """Check if the center of the child is visible. |
33 | 83 | 87 | ||
34 | === added file 'tests/autopilot/ubuntuuitoolkit/tests/custom_proxy_objects/test_flickable.py' | |||
35 | --- tests/autopilot/ubuntuuitoolkit/tests/custom_proxy_objects/test_flickable.py 1970-01-01 00:00:00 +0000 | |||
36 | +++ tests/autopilot/ubuntuuitoolkit/tests/custom_proxy_objects/test_flickable.py 2014-05-16 08:50:05 +0000 | |||
37 | @@ -0,0 +1,60 @@ | |||
38 | 1 | # -*- Mode: Python; coding: utf-8; indent-tabs-mode: nil; tab-width: 4 -*- | ||
39 | 2 | # | ||
40 | 3 | # Copyright (C) 2014 Canonical Ltd. | ||
41 | 4 | # | ||
42 | 5 | # This program is free software; you can redistribute it and/or modify | ||
43 | 6 | # it under the terms of the GNU Lesser General Public License as published by | ||
44 | 7 | # the Free Software Foundation; version 3. | ||
45 | 8 | # | ||
46 | 9 | # This program is distributed in the hope that it will be useful, | ||
47 | 10 | # but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
48 | 11 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
49 | 12 | # GNU Lesser General Public License for more details. | ||
50 | 13 | # | ||
51 | 14 | # You should have received a copy of the GNU Lesser General Public License | ||
52 | 15 | # along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
53 | 16 | |||
54 | 17 | |||
55 | 18 | import testtools | ||
56 | 19 | |||
57 | 20 | import ubuntuuitoolkit | ||
58 | 21 | |||
59 | 22 | |||
60 | 23 | class FlickableTestCase(testtools.TestCase): | ||
61 | 24 | |||
62 | 25 | def test_get_unity_top_container(self): | ||
63 | 26 | """Test that we can get the top cointainer in Unity.""" | ||
64 | 27 | # This tests bug http://pad.lv/1314390 | ||
65 | 28 | # On Unity, the top container is not the first child as it is in all | ||
66 | 29 | # the apps that have a MainView. This makes the first implementation of | ||
67 | 30 | # _get_top_container fail. Instead of going from the top looking for | ||
68 | 31 | # a container, we should start from the flickable until we find the | ||
69 | 32 | # top-most container. | ||
70 | 33 | # FIXME we are faking the QML tree because we have no way to launch | ||
71 | 34 | # the app with a tree like the one in Unity8. kalikiana has a branch | ||
72 | 35 | # with an alternate launcher that will let us clean this test. | ||
73 | 36 | # --elopio - 2014-05-15. | ||
74 | 37 | RootClass = type('obj', (object,), {'id': 'root'}) | ||
75 | 38 | mock_root_instance = RootClass() | ||
76 | 39 | # We consider a container is an object with a globalRect. | ||
77 | 40 | MockNonContainerClass = type('obj', (object,), {}) | ||
78 | 41 | mock_non_container = MockNonContainerClass() | ||
79 | 42 | MockContainerClass = type( | ||
80 | 43 | 'obj', (object,), {'id': 'container', 'globalRect': 'dummy'}) | ||
81 | 44 | mock_container = MockContainerClass() | ||
82 | 45 | mock_container.get_parent = lambda: mock_root_instance | ||
83 | 46 | |||
84 | 47 | # The root instance has two children. This exposes the bug. | ||
85 | 48 | mock_root_instance.get_children = lambda: [ | ||
86 | 49 | mock_non_container, mock_container] | ||
87 | 50 | |||
88 | 51 | dummy_state = {'id': '10'} | ||
89 | 52 | flickable = ubuntuuitoolkit.Flickable( | ||
90 | 53 | dummy_state, '/dummy'.encode(), 'dummy') | ||
91 | 54 | |||
92 | 55 | flickable.get_root_instance = lambda: mock_root_instance | ||
93 | 56 | # The top container of the flickable is its immediate parent. | ||
94 | 57 | flickable.get_parent = lambda: mock_container | ||
95 | 58 | |||
96 | 59 | top_container = flickable._get_top_container() | ||
97 | 60 | self.assertEqual(top_container, mock_container) |
Not sure I understand the error condition: it seems like it should mean that you're already at the topmost container (which wouldn't necessarily be an error?), however we'd want to validate that the parent has a globalRect in this case, no?