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
=== modified file 'tests/autopilot/ubuntuuitoolkit/_custom_proxy_objects/_common.py'
--- tests/autopilot/ubuntuuitoolkit/_custom_proxy_objects/_common.py 2014-04-29 23:03:58 +0000
+++ tests/autopilot/ubuntuuitoolkit/_custom_proxy_objects/_common.py 2014-05-30 07:52:53 +0000
@@ -111,3 +111,19 @@
111 raise ToolkitException(111 raise ToolkitException(
112 "The element is not contained in a Flickable so it can't be "112 "The element is not contained in a Flickable so it can't be "
113 "swiped into view.")113 "swiped into view.")
114
115 def _get_top_container(self):
116 """Return the top-most container with a globalRect."""
117 root = self.get_root_instance()
118 parent = self.get_parent()
119 top_container = None
120 while parent.id != root.id:
121 if hasattr(parent, 'globalRect'):
122 top_container = parent
123
124 parent = parent.get_parent()
125
126 if top_container is None:
127 raise ToolkitException('Could not find the top-most container.')
128 else:
129 return top_container
114130
=== modified file 'tests/autopilot/ubuntuuitoolkit/_custom_proxy_objects/_flickable.py'
--- tests/autopilot/ubuntuuitoolkit/_custom_proxy_objects/_flickable.py 2014-05-20 07:31:55 +0000
+++ tests/autopilot/ubuntuuitoolkit/_custom_proxy_objects/_flickable.py 2014-05-30 07:52:53 +0000
@@ -51,23 +51,6 @@
51 containers = [self._get_top_container(), self]51 containers = [self._get_top_container(), self]
52 return containers52 return containers
5353
54 def _get_top_container(self):
55 """Return the top-most container with a globalRect."""
56 root = self.get_root_instance()
57 parent = self.get_parent()
58 top_container = None
59 while parent.id != root.id:
60 if hasattr(parent, 'globalRect'):
61 top_container = parent
62
63 parent = parent.get_parent()
64
65 if top_container is None:
66 raise _common.ToolkitException(
67 "Couldn't find the top-most container.")
68 else:
69 return top_container
70
71 def _is_child_visible(self, child, containers):54 def _is_child_visible(self, child, containers):
72 """Check if the center of the child is visible.55 """Check if the center of the child is visible.
7356
7457
=== modified file 'tests/autopilot/ubuntuuitoolkit/_custom_proxy_objects/_header.py'
--- tests/autopilot/ubuntuuitoolkit/_custom_proxy_objects/_header.py 2014-05-13 12:43:31 +0000
+++ tests/autopilot/ubuntuuitoolkit/_custom_proxy_objects/_header.py 2014-05-30 07:52:53 +0000
@@ -21,7 +21,6 @@
2121
22from ubuntuuitoolkit._custom_proxy_objects import (22from ubuntuuitoolkit._custom_proxy_objects import (
23 _common,23 _common,
24 _mainview,
25 _tabbar24 _tabbar
26)25)
2726
@@ -35,13 +34,6 @@
35class Header(_common.UbuntuUIToolkitCustomProxyObjectBase):34class Header(_common.UbuntuUIToolkitCustomProxyObjectBase):
36 """Header Autopilot emulator."""35 """Header Autopilot emulator."""
3736
38 def __init__(self, *args):
39 super(Header, self).__init__(*args)
40 # XXX we need a better way to keep reference to the main view.
41 # --elopio - 2014-02-26
42 self.main_view = self.get_root_instance().select_single(
43 _mainview.MainView)
44
45 def _show_if_not_visible(self):37 def _show_if_not_visible(self):
46 if not self._is_visible():38 if not self._is_visible():
47 self._show()39 self._show()
@@ -53,8 +45,9 @@
53 # FIXME This will fail if the header is not linked to a flickable that45 # FIXME This will fail if the header is not linked to a flickable that
54 # fills the main view. The header has a flickable property but it46 # fills the main view. The header has a flickable property but it
55 # can't be read by autopilot. See bug http://pad.lv/131882947 # can't be read by autopilot. See bug http://pad.lv/1318829
48 top_container = self._get_top_container()
56 start_x = stop_x = (self.globalRect.x + self.globalRect.width) // 249 start_x = stop_x = (self.globalRect.x + self.globalRect.width) // 2
57 start_y = self.main_view.globalRect.y + 550 start_y = top_container.globalRect.y + 5
58 stop_y = start_y + self.globalRect.height51 stop_y = start_y + self.globalRect.height
59 self.pointing_device.drag(start_x, start_y, stop_x, stop_y)52 self.pointing_device.drag(start_x, start_y, stop_x, stop_y)
60 self.y.wait_for(0)53 self.y.wait_for(0)
6154
=== added file 'tests/autopilot/ubuntuuitoolkit/tests/custom_proxy_objects/CustomMainView.qml'
--- tests/autopilot/ubuntuuitoolkit/tests/custom_proxy_objects/CustomMainView.qml 1970-01-01 00:00:00 +0000
+++ tests/autopilot/ubuntuuitoolkit/tests/custom_proxy_objects/CustomMainView.qml 2014-05-30 07:52:53 +0000
@@ -0,0 +1,23 @@
1/*
2 * Copyright 2014 Canonical Ltd.
3 *
4 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU Lesser General Public License as published by
6 * the Free Software Foundation; version 3.
7 *
8 * This program is distributed in the hope that it will be useful,
9 * but WITHOUT ANY WARRANTY; without even the implied warranty of
10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 * GNU Lesser General Public License for more details.
12 *
13 * You should have received a copy of the GNU Lesser General Public License
14 * along with this program. If not, see <http://www.gnu.org/licenses/>.
15 */
16
17import QtQuick 2.0
18import Ubuntu.Components 0.1
19
20MainView {
21 objectName: "overview"
22 property string test
23}
024
=== added file 'tests/autopilot/ubuntuuitoolkit/tests/custom_proxy_objects/test_header.HeaderInCustomMainViewTestCase.qml'
--- tests/autopilot/ubuntuuitoolkit/tests/custom_proxy_objects/test_header.HeaderInCustomMainViewTestCase.qml 1970-01-01 00:00:00 +0000
+++ tests/autopilot/ubuntuuitoolkit/tests/custom_proxy_objects/test_header.HeaderInCustomMainViewTestCase.qml 2014-05-30 07:52:53 +0000
@@ -0,0 +1,24 @@
1/*
2 * Copyright 2014 Canonical Ltd.
3 *
4 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU Lesser General Public License as published by
6 * the Free Software Foundation; version 3.
7 *
8 * This program is distributed in the hope that it will be useful,
9 * but WITHOUT ANY WARRANTY; without even the implied warranty of
10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 * GNU Lesser General Public License for more details.
12 *
13 * You should have received a copy of the GNU Lesser General Public License
14 * along with this program. If not, see <http://www.gnu.org/licenses/>.
15 */
16
17import QtQuick 2.0
18import Ubuntu.Components 1.1
19
20CustomMainView {
21
22 objectName: 'mainView'
23
24}
025
=== modified file 'tests/autopilot/ubuntuuitoolkit/tests/custom_proxy_objects/test_header.py'
--- tests/autopilot/ubuntuuitoolkit/tests/custom_proxy_objects/test_header.py 2014-05-20 08:56:28 +0000
+++ tests/autopilot/ubuntuuitoolkit/tests/custom_proxy_objects/test_header.py 2014-05-30 07:52:53 +0000
@@ -14,6 +14,8 @@
14# You should have received a copy of the GNU Lesser General Public License14# You should have received a copy of the GNU Lesser General Public License
15# along with this program. If not, see <http://www.gnu.org/licenses/>.15# along with this program. If not, see <http://www.gnu.org/licenses/>.
1616
17import os
18
17import ubuntuuitoolkit19import ubuntuuitoolkit
18from ubuntuuitoolkit import tests20from ubuntuuitoolkit import tests
1921
@@ -157,3 +159,28 @@
157159
158 # only three actions are visible160 # only three actions are visible
159 self.assertEqual(overflow_button.visible, False)161 self.assertEqual(overflow_button.visible, False)
162
163
164class CustomMainView(ubuntuuitoolkit.MainView):
165 """Autopilot helper for a custom main view."""
166
167
168class HeaderInCustomMainViewTestCase(tests.QMLFileAppTestCase):
169
170 path = os.path.abspath(__file__)
171 dir_path = os.path.dirname(path)
172 test_qml_file_path = os.path.join(
173 dir_path, 'test_header.HeaderInCustomMainViewTestCase.qml')
174
175 @property
176 def main_view(self):
177 return self.app.select_single(CustomMainView)
178
179 def test_get_header_from_custom_main_view(self):
180 """Test that we can get the header from a custom main view.
181
182 This prevents a regression of http://pad.lv/1324556.
183
184 """
185 header = self.main_view.get_header()
186 self.assertIsInstance(header, ubuntuuitoolkit.Header)

Subscribers

People subscribed via source and target branches