Merge lp:~elopio/ubuntu-ui-toolkit/fix1324556-get_top_container into lp:ubuntu-ui-toolkit/staging

Proposed by Leo Arias
Status: Merged
Merged at revision: 1092
Proposed branch: lp:~elopio/ubuntu-ui-toolkit/fix1324556-get_top_container
Merge into: lp:ubuntu-ui-toolkit/staging
Diff against target: 187 lines (+92/-26)
6 files modified
tests/autopilot/ubuntuuitoolkit/_custom_proxy_objects/_common.py (+16/-0)
tests/autopilot/ubuntuuitoolkit/_custom_proxy_objects/_flickable.py (+0/-17)
tests/autopilot/ubuntuuitoolkit/_custom_proxy_objects/_header.py (+2/-9)
tests/autopilot/ubuntuuitoolkit/tests/custom_proxy_objects/CustomMainView.qml (+23/-0)
tests/autopilot/ubuntuuitoolkit/tests/custom_proxy_objects/test_header.HeaderInCustomMainViewTestCase.qml (+24/-0)
tests/autopilot/ubuntuuitoolkit/tests/custom_proxy_objects/test_header.py (+27/-0)
To merge this branch: bzr merge lp:~elopio/ubuntu-ui-toolkit/fix1324556-get_top_container
Reviewer Review Type Date Requested Status
PS Jenkins bot continuous-integration Approve
Ubuntu SDK team Pending
Review via email: mp+221492@code.launchpad.net

This proposal supersedes a proposal from 2014-05-30.

Commit message

On the autopilot Header helper, do not assume that the top container will be a MainView.

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

FAILED: Continuous integration, rev:1092
http://jenkins.qa.ubuntu.com/job/ubuntu-sdk-team-ubuntu-ui-toolkit-staging-ci/306/
Executed test runs:
    SUCCESS: http://jenkins.qa.ubuntu.com/job/generic-deb-autopilot-utopic-touch/575
    UNSTABLE: http://jenkins.qa.ubuntu.com/job/generic-mediumtests-utopic/525
    SUCCESS: http://jenkins.qa.ubuntu.com/job/ubuntu-sdk-team-ubuntu-ui-toolkit-staging-utopic-amd64-ci/138
    SUCCESS: http://jenkins.qa.ubuntu.com/job/ubuntu-sdk-team-ubuntu-ui-toolkit-staging-utopic-armhf-ci/138
        deb: http://jenkins.qa.ubuntu.com/job/ubuntu-sdk-team-ubuntu-ui-toolkit-staging-utopic-armhf-ci/138/artifact/work/output/*zip*/output.zip
    SUCCESS: http://jenkins.qa.ubuntu.com/job/ubuntu-sdk-team-ubuntu-ui-toolkit-staging-utopic-i386-ci/138
    SUCCESS: http://jenkins.qa.ubuntu.com/job/generic-deb-autopilot-runner-mako/1020
    SUCCESS: http://jenkins.qa.ubuntu.com/job/generic-mediumtests-builder-utopic-armhf/1105
        deb: http://jenkins.qa.ubuntu.com/job/generic-mediumtests-builder-utopic-armhf/1105/artifact/work/output/*zip*/output.zip
    SUCCESS: http://s-jenkins.ubuntu-ci:8080/job/touch-flash-device/7914
    UNSTABLE: http://jenkins.qa.ubuntu.com/job/autopilot-testrunner-otto-utopic/465
    SUCCESS: http://jenkins.qa.ubuntu.com/job/generic-mediumtests-builder-utopic-amd64/663
        deb: http://jenkins.qa.ubuntu.com/job/generic-mediumtests-builder-utopic-amd64/663/artifact/work/output/*zip*/output.zip

Click here to trigger a rebuild:
http://s-jenkins.ubuntu-ci:8080/job/ubuntu-sdk-team-ubuntu-ui-toolkit-staging-ci/306/rebuild

review: Needs Fixing (continuous-integration)
Revision history for this message
PS Jenkins bot (ps-jenkins) wrote : Posted in a previous version of this proposal

FAILED: Continuous integration, rev:1096
http://jenkins.qa.ubuntu.com/job/ubuntu-sdk-team-ubuntu-ui-toolkit-staging-ci/307/
Executed test runs:
    SUCCESS: http://jenkins.qa.ubuntu.com/job/generic-deb-autopilot-utopic-touch/578
    FAILURE: http://jenkins.qa.ubuntu.com/job/generic-mediumtests-utopic/528/console
    SUCCESS: http://jenkins.qa.ubuntu.com/job/ubuntu-sdk-team-ubuntu-ui-toolkit-staging-utopic-amd64-ci/139
    SUCCESS: http://jenkins.qa.ubuntu.com/job/ubuntu-sdk-team-ubuntu-ui-toolkit-staging-utopic-armhf-ci/139
        deb: http://jenkins.qa.ubuntu.com/job/ubuntu-sdk-team-ubuntu-ui-toolkit-staging-utopic-armhf-ci/139/artifact/work/output/*zip*/output.zip
    SUCCESS: http://jenkins.qa.ubuntu.com/job/ubuntu-sdk-team-ubuntu-ui-toolkit-staging-utopic-i386-ci/139
    SUCCESS: http://jenkins.qa.ubuntu.com/job/generic-deb-autopilot-runner-mako/1022
    SUCCESS: http://jenkins.qa.ubuntu.com/job/generic-mediumtests-builder-utopic-armhf/1113
        deb: http://jenkins.qa.ubuntu.com/job/generic-mediumtests-builder-utopic-armhf/1113/artifact/work/output/*zip*/output.zip
    SUCCESS: http://s-jenkins.ubuntu-ci:8080/job/touch-flash-device/7920
    FAILURE: http://jenkins.qa.ubuntu.com/job/autopilot-testrunner-otto-utopic/468/console
    SUCCESS: http://jenkins.qa.ubuntu.com/job/generic-mediumtests-builder-utopic-amd64/667
        deb: http://jenkins.qa.ubuntu.com/job/generic-mediumtests-builder-utopic-amd64/667/artifact/work/output/*zip*/output.zip

Click here to trigger a rebuild:
http://s-jenkins.ubuntu-ci:8080/job/ubuntu-sdk-team-ubuntu-ui-toolkit-staging-ci/307/rebuild

review: Needs Fixing (continuous-integration)
Revision history for this message
PS Jenkins bot (ps-jenkins) wrote : Posted in a previous version of this proposal

FAILED: Continuous integration, rev:1097
http://jenkins.qa.ubuntu.com/job/ubuntu-sdk-team-ubuntu-ui-toolkit-staging-ci/308/
Executed test runs:
    FAILURE: http://jenkins.qa.ubuntu.com/job/generic-deb-autopilot-utopic-touch/581/console
    SUCCESS: http://jenkins.qa.ubuntu.com/job/generic-mediumtests-utopic/530
    SUCCESS: http://jenkins.qa.ubuntu.com/job/ubuntu-sdk-team-ubuntu-ui-toolkit-staging-utopic-amd64-ci/140
    SUCCESS: http://jenkins.qa.ubuntu.com/job/ubuntu-sdk-team-ubuntu-ui-toolkit-staging-utopic-armhf-ci/140
        deb: http://jenkins.qa.ubuntu.com/job/ubuntu-sdk-team-ubuntu-ui-toolkit-staging-utopic-armhf-ci/140/artifact/work/output/*zip*/output.zip
    SUCCESS: http://jenkins.qa.ubuntu.com/job/ubuntu-sdk-team-ubuntu-ui-toolkit-staging-utopic-i386-ci/140
    FAILURE: http://jenkins.qa.ubuntu.com/job/generic-deb-autopilot-runner-mako/1026/console
    SUCCESS: http://jenkins.qa.ubuntu.com/job/generic-mediumtests-builder-utopic-armhf/1119
        deb: http://jenkins.qa.ubuntu.com/job/generic-mediumtests-builder-utopic-armhf/1119/artifact/work/output/*zip*/output.zip
    SUCCESS: http://s-jenkins.ubuntu-ci:8080/job/touch-flash-device/7930
    SUCCESS: http://jenkins.qa.ubuntu.com/job/autopilot-testrunner-otto-utopic/470
    SUCCESS: http://jenkins.qa.ubuntu.com/job/generic-mediumtests-builder-utopic-amd64/669
        deb: http://jenkins.qa.ubuntu.com/job/generic-mediumtests-builder-utopic-amd64/669/artifact/work/output/*zip*/output.zip

Click here to trigger a rebuild:
http://s-jenkins.ubuntu-ci:8080/job/ubuntu-sdk-team-ubuntu-ui-toolkit-staging-ci/308/rebuild

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

FAILED: Continuous integration, rev:1097
http://jenkins.qa.ubuntu.com/job/ubuntu-sdk-team-ubuntu-ui-toolkit-staging-ci/309/
Executed test runs:
    FAILURE: http://jenkins.qa.ubuntu.com/job/generic-deb-autopilot-utopic-touch/583/console
    SUCCESS: http://jenkins.qa.ubuntu.com/job/generic-mediumtests-utopic/532
    SUCCESS: http://jenkins.qa.ubuntu.com/job/ubuntu-sdk-team-ubuntu-ui-toolkit-staging-utopic-amd64-ci/141
    SUCCESS: http://jenkins.qa.ubuntu.com/job/ubuntu-sdk-team-ubuntu-ui-toolkit-staging-utopic-armhf-ci/141
        deb: http://jenkins.qa.ubuntu.com/job/ubuntu-sdk-team-ubuntu-ui-toolkit-staging-utopic-armhf-ci/141/artifact/work/output/*zip*/output.zip
    SUCCESS: http://jenkins.qa.ubuntu.com/job/ubuntu-sdk-team-ubuntu-ui-toolkit-staging-utopic-i386-ci/141
    FAILURE: http://jenkins.qa.ubuntu.com/job/generic-deb-autopilot-runner-mako/1027/console
    SUCCESS: http://jenkins.qa.ubuntu.com/job/generic-mediumtests-builder-utopic-armhf/1121
        deb: http://jenkins.qa.ubuntu.com/job/generic-mediumtests-builder-utopic-armhf/1121/artifact/work/output/*zip*/output.zip
    SUCCESS: http://s-jenkins.ubuntu-ci:8080/job/touch-flash-device/7931
    SUCCESS: http://jenkins.qa.ubuntu.com/job/autopilot-testrunner-otto-utopic/472
    SUCCESS: http://jenkins.qa.ubuntu.com/job/generic-mediumtests-builder-utopic-amd64/671
        deb: http://jenkins.qa.ubuntu.com/job/generic-mediumtests-builder-utopic-amd64/671/artifact/work/output/*zip*/output.zip

Click here to trigger a rebuild:
http://s-jenkins.ubuntu-ci:8080/job/ubuntu-sdk-team-ubuntu-ui-toolkit-staging-ci/309/rebuild

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

PASSED: Continuous integration, rev:1097
http://jenkins.qa.ubuntu.com/job/ubuntu-sdk-team-ubuntu-ui-toolkit-staging-ci/318/
Executed test runs:
    SUCCESS: http://jenkins.qa.ubuntu.com/job/generic-deb-autopilot-utopic-touch/618
    SUCCESS: http://jenkins.qa.ubuntu.com/job/generic-mediumtests-utopic/567
    SUCCESS: http://jenkins.qa.ubuntu.com/job/ubuntu-sdk-team-ubuntu-ui-toolkit-staging-utopic-amd64-ci/150
    SUCCESS: http://jenkins.qa.ubuntu.com/job/ubuntu-sdk-team-ubuntu-ui-toolkit-staging-utopic-armhf-ci/150
        deb: http://jenkins.qa.ubuntu.com/job/ubuntu-sdk-team-ubuntu-ui-toolkit-staging-utopic-armhf-ci/150/artifact/work/output/*zip*/output.zip
    SUCCESS: http://jenkins.qa.ubuntu.com/job/ubuntu-sdk-team-ubuntu-ui-toolkit-staging-utopic-i386-ci/150
    SUCCESS: http://jenkins.qa.ubuntu.com/job/generic-deb-autopilot-runner-mako/1056
    SUCCESS: http://jenkins.qa.ubuntu.com/job/generic-mediumtests-builder-utopic-armhf/1191
        deb: http://jenkins.qa.ubuntu.com/job/generic-mediumtests-builder-utopic-armhf/1191/artifact/work/output/*zip*/output.zip
    SUCCESS: http://s-jenkins.ubuntu-ci:8080/job/touch-flash-device/8006
    SUCCESS: http://jenkins.qa.ubuntu.com/job/autopilot-testrunner-otto-utopic/505
    SUCCESS: http://jenkins.qa.ubuntu.com/job/generic-mediumtests-builder-utopic-amd64/706
        deb: http://jenkins.qa.ubuntu.com/job/generic-mediumtests-builder-utopic-amd64/706/artifact/work/output/*zip*/output.zip

Click here to trigger a rebuild:
http://s-jenkins.ubuntu-ci:8080/job/ubuntu-sdk-team-ubuntu-ui-toolkit-staging-ci/318/rebuild

review: Approve (continuous-integration)
Revision history for this message
Brendan Donegan (brendan-donegan) wrote :

Just need an approve now from someone - CI was breaking because of an environment issue, resolved now.

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/_common.py'
2--- tests/autopilot/ubuntuuitoolkit/_custom_proxy_objects/_common.py 2014-04-29 23:03:58 +0000
3+++ tests/autopilot/ubuntuuitoolkit/_custom_proxy_objects/_common.py 2014-05-30 07:52:53 +0000
4@@ -111,3 +111,19 @@
5 raise ToolkitException(
6 "The element is not contained in a Flickable so it can't be "
7 "swiped into view.")
8+
9+ def _get_top_container(self):
10+ """Return the top-most container with a globalRect."""
11+ root = self.get_root_instance()
12+ parent = self.get_parent()
13+ top_container = None
14+ while parent.id != root.id:
15+ if hasattr(parent, 'globalRect'):
16+ top_container = parent
17+
18+ parent = parent.get_parent()
19+
20+ if top_container is None:
21+ raise ToolkitException('Could not find the top-most container.')
22+ else:
23+ return top_container
24
25=== modified file 'tests/autopilot/ubuntuuitoolkit/_custom_proxy_objects/_flickable.py'
26--- tests/autopilot/ubuntuuitoolkit/_custom_proxy_objects/_flickable.py 2014-05-20 07:31:55 +0000
27+++ tests/autopilot/ubuntuuitoolkit/_custom_proxy_objects/_flickable.py 2014-05-30 07:52:53 +0000
28@@ -51,23 +51,6 @@
29 containers = [self._get_top_container(), self]
30 return containers
31
32- def _get_top_container(self):
33- """Return the top-most container with a globalRect."""
34- root = self.get_root_instance()
35- parent = self.get_parent()
36- top_container = None
37- while parent.id != root.id:
38- if hasattr(parent, 'globalRect'):
39- top_container = parent
40-
41- parent = parent.get_parent()
42-
43- if top_container is None:
44- raise _common.ToolkitException(
45- "Couldn't find the top-most container.")
46- else:
47- return top_container
48-
49 def _is_child_visible(self, child, containers):
50 """Check if the center of the child is visible.
51
52
53=== modified file 'tests/autopilot/ubuntuuitoolkit/_custom_proxy_objects/_header.py'
54--- tests/autopilot/ubuntuuitoolkit/_custom_proxy_objects/_header.py 2014-05-13 12:43:31 +0000
55+++ tests/autopilot/ubuntuuitoolkit/_custom_proxy_objects/_header.py 2014-05-30 07:52:53 +0000
56@@ -21,7 +21,6 @@
57
58 from ubuntuuitoolkit._custom_proxy_objects import (
59 _common,
60- _mainview,
61 _tabbar
62 )
63
64@@ -35,13 +34,6 @@
65 class Header(_common.UbuntuUIToolkitCustomProxyObjectBase):
66 """Header Autopilot emulator."""
67
68- def __init__(self, *args):
69- super(Header, self).__init__(*args)
70- # XXX we need a better way to keep reference to the main view.
71- # --elopio - 2014-02-26
72- self.main_view = self.get_root_instance().select_single(
73- _mainview.MainView)
74-
75 def _show_if_not_visible(self):
76 if not self._is_visible():
77 self._show()
78@@ -53,8 +45,9 @@
79 # FIXME This will fail if the header is not linked to a flickable that
80 # fills the main view. The header has a flickable property but it
81 # can't be read by autopilot. See bug http://pad.lv/1318829
82+ top_container = self._get_top_container()
83 start_x = stop_x = (self.globalRect.x + self.globalRect.width) // 2
84- start_y = self.main_view.globalRect.y + 5
85+ start_y = top_container.globalRect.y + 5
86 stop_y = start_y + self.globalRect.height
87 self.pointing_device.drag(start_x, start_y, stop_x, stop_y)
88 self.y.wait_for(0)
89
90=== added file 'tests/autopilot/ubuntuuitoolkit/tests/custom_proxy_objects/CustomMainView.qml'
91--- tests/autopilot/ubuntuuitoolkit/tests/custom_proxy_objects/CustomMainView.qml 1970-01-01 00:00:00 +0000
92+++ tests/autopilot/ubuntuuitoolkit/tests/custom_proxy_objects/CustomMainView.qml 2014-05-30 07:52:53 +0000
93@@ -0,0 +1,23 @@
94+/*
95+ * Copyright 2014 Canonical Ltd.
96+ *
97+ * This program is free software; you can redistribute it and/or modify
98+ * it under the terms of the GNU Lesser General Public License as published by
99+ * the Free Software Foundation; version 3.
100+ *
101+ * This program is distributed in the hope that it will be useful,
102+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
103+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
104+ * GNU Lesser General Public License for more details.
105+ *
106+ * You should have received a copy of the GNU Lesser General Public License
107+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
108+ */
109+
110+import QtQuick 2.0
111+import Ubuntu.Components 0.1
112+
113+MainView {
114+ objectName: "overview"
115+ property string test
116+}
117
118=== added file 'tests/autopilot/ubuntuuitoolkit/tests/custom_proxy_objects/test_header.HeaderInCustomMainViewTestCase.qml'
119--- tests/autopilot/ubuntuuitoolkit/tests/custom_proxy_objects/test_header.HeaderInCustomMainViewTestCase.qml 1970-01-01 00:00:00 +0000
120+++ tests/autopilot/ubuntuuitoolkit/tests/custom_proxy_objects/test_header.HeaderInCustomMainViewTestCase.qml 2014-05-30 07:52:53 +0000
121@@ -0,0 +1,24 @@
122+/*
123+ * Copyright 2014 Canonical Ltd.
124+ *
125+ * This program is free software; you can redistribute it and/or modify
126+ * it under the terms of the GNU Lesser General Public License as published by
127+ * the Free Software Foundation; version 3.
128+ *
129+ * This program is distributed in the hope that it will be useful,
130+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
131+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
132+ * GNU Lesser General Public License for more details.
133+ *
134+ * You should have received a copy of the GNU Lesser General Public License
135+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
136+ */
137+
138+import QtQuick 2.0
139+import Ubuntu.Components 1.1
140+
141+CustomMainView {
142+
143+ objectName: 'mainView'
144+
145+}
146
147=== modified file 'tests/autopilot/ubuntuuitoolkit/tests/custom_proxy_objects/test_header.py'
148--- tests/autopilot/ubuntuuitoolkit/tests/custom_proxy_objects/test_header.py 2014-05-20 08:56:28 +0000
149+++ tests/autopilot/ubuntuuitoolkit/tests/custom_proxy_objects/test_header.py 2014-05-30 07:52:53 +0000
150@@ -14,6 +14,8 @@
151 # You should have received a copy of the GNU Lesser General Public License
152 # along with this program. If not, see <http://www.gnu.org/licenses/>.
153
154+import os
155+
156 import ubuntuuitoolkit
157 from ubuntuuitoolkit import tests
158
159@@ -157,3 +159,28 @@
160
161 # only three actions are visible
162 self.assertEqual(overflow_button.visible, False)
163+
164+
165+class CustomMainView(ubuntuuitoolkit.MainView):
166+ """Autopilot helper for a custom main view."""
167+
168+
169+class HeaderInCustomMainViewTestCase(tests.QMLFileAppTestCase):
170+
171+ path = os.path.abspath(__file__)
172+ dir_path = os.path.dirname(path)
173+ test_qml_file_path = os.path.join(
174+ dir_path, 'test_header.HeaderInCustomMainViewTestCase.qml')
175+
176+ @property
177+ def main_view(self):
178+ return self.app.select_single(CustomMainView)
179+
180+ def test_get_header_from_custom_main_view(self):
181+ """Test that we can get the header from a custom main view.
182+
183+ This prevents a regression of http://pad.lv/1324556.
184+
185+ """
186+ header = self.main_view.get_header()
187+ self.assertIsInstance(header, ubuntuuitoolkit.Header)

Subscribers

People subscribed via source and target branches