Merge lp:~bzoltan/ubuntu-ui-toolkit/landing_28-05 into lp:ubuntu-ui-toolkit

Proposed by Zoltan Balogh
Status: Merged
Merged at revision: 1027
Proposed branch: lp:~bzoltan/ubuntu-ui-toolkit/landing_28-05
Merge into: lp:ubuntu-ui-toolkit
Diff against target: 594 lines (+241/-82)
16 files modified
components.api (+7/-1)
modules/Ubuntu/Components/AnimatedItem.qml (+1/-38)
modules/Ubuntu/Components/ListItems/Base.qml (+1/-1)
modules/Ubuntu/Components/PageStack.qml (+1/-0)
modules/Ubuntu/Components/Pickers/DatePicker.qml (+4/-2)
modules/Ubuntu/Components/plugin/i18n.cpp (+6/-5)
modules/Ubuntu/Components/plugin/thumbnailgenerator.cpp (+6/-3)
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/fixture_setup.py (+45/-0)
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)
tests/autopilot/ubuntuuitoolkit/tests/test_fixture_setup.py (+72/-1)
tests/qmlapicheck.py (+6/-5)
To merge this branch: bzr merge lp:~bzoltan/ubuntu-ui-toolkit/landing_28-05
Reviewer Review Type Date Requested Status
PS Jenkins bot continuous-integration Needs Fixing
Zsombor Egri Pending
Review via email: mp+221199@code.launchpad.net

Commit message

[ Christian Dywan ]
  * Tweak API parsing to include the Button.font property.
    Fixes: https://bugs.launchpad.net/bugs/1322169
  * Call bindtextdomain on /usr if APP_DIR is not defined.
    Fixes: https://bugs.launchpad.net/bugs/1322630
  * More unit tests and property corrections for SortFilterModel.
  * Read ubuntu-ui-toolkit.ini from $XDG_CONFIG_HOME.
  * Skip test_ubuntushape which is flakey and add a FIXME.

  [ Zsombor Egri ]
  * Missing "default" keyword added to children property of Base,
    causing rendering and test case failures on Qt 5.3.
    Fixes: https://bugs.launchpad.net/bugs/1317881

  [ Ugo Riboni ]
  * Allow requesting extra large thumbnails.

  [ Florian Boucault ]
  * AnimatedItem: deprecated as it was not used and still costly.
  * Label: default font weight is now light.

  [ Zoltán Balogh ]
  * Replace split with match to work around failing split()
    function usage.

Description of the change

[ Christian Dywan ]
  * Tweak API parsing to include the Button.font property.
    Fixes: https://bugs.launchpad.net/bugs/1322169
  * Call bindtextdomain on /usr if APP_DIR is not defined.
    Fixes: https://bugs.launchpad.net/bugs/1322630
  * More unit tests and property corrections for SortFilterModel.
  * Read ubuntu-ui-toolkit.ini from $XDG_CONFIG_HOME.
  * Skip test_ubuntushape which is flakey and add a FIXME.

  [ Zsombor Egri ]
  * Missing "default" keyword added to children property of Base,
    causing rendering and test case failures on Qt 5.3.
    Fixes: https://bugs.launchpad.net/bugs/1317881

  [ Ugo Riboni ]
  * Allow requesting extra large thumbnails.

  [ Florian Boucault ]
  * AnimatedItem: deprecated as it was not used and still costly.
  * Label: default font weight is now light.

  [ Zoltán Balogh ]
  * Replace split with match to work around failing split()
    function usage.

To post a comment you must log in.
1088. By Zoltan Balogh

Merged from the trunk

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

Undo changes of r1082 that cause a regression in messaging-app (and contenthub).

Revision history for this message
Tim Peeters (tpeeters) wrote :

I removed the change that was reverted from the commit message

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

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

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

I've confirmed that this landing fixes bug 1324556.
I flashed image 55, ran the gallery tests without the ppa and got the failure.
Then I added the PPA and ran the gallery tests again successfully.
Please note that phablet-test-setup adds an ubuntuuitoolkit folder to /home/phablet/autopilot. That's not the one that comes from the ppa, so you'll need to delete that folder and install ubuntu-ui-toolkit-autopilot.

Revision history for this message
Tim Peeters (tpeeters) wrote :

Running gallery-app tests from image 55 without the ppa fails big time: http://paste.ubuntu.com/7551664/

I cleared /home/phablet/autopilot, installed the ppa and did another phablet-click-test-setup, which failed because the new uitk-autopilot is not in the archive I guess? http://pastebin.ubuntu.com/7551635/

Installing ubuntu-ui-toolkit-autopilot using apt-get worked, but
phablet-click-test-setup --click com.ubuntu.gallery; fails as above^ missing the uitk-autopilot tests...

Revision history for this message
Tim Peeters (tpeeters) wrote :

After installing the new ubuntu-ui-toolkit-autopilot and manually pushing the autopilot directory of gallery-app to the device (since the scripts don't work here, see previous comment), all gallery-app tests pass! http://paste.ubuntu.com/7551949/

1091. By Zoltan Balogh

Fix changelog

1092. By Zoltan Balogh

Fix changelog

1093. By Zoltan Balogh

Fix changelog

1094. By Zoltan Balogh

Fix changelog

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

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
=== modified file 'components.api'
--- components.api 2014-05-26 11:36:53 +0000
+++ components.api 2014-06-02 11:30:26 +0000
@@ -31,6 +31,7 @@
31AbstractButton31AbstractButton
32 property color color32 property color color
33 property Gradient gradient33 property Gradient gradient
34 property font font
34 property string iconPosition35 property string iconPosition
35CheckBox 0.1 1.036CheckBox 0.1 1.0
36AbstractButton37AbstractButton
@@ -94,7 +95,7 @@
94 property real __leftIconMargin95 property real __leftIconMargin
95 property real __rightIconMargin96 property real __rightIconMargin
96 property bool __iconIsItem97 property bool __iconIsItem
97 property internal children98 default property internal children
98Caption 0.1 1.099Caption 0.1 1.0
99Item100Item
100 property string text101 property string text
@@ -140,6 +141,7 @@
140 property bool expanded141 property bool expanded
141 property bool multiSelection142 property bool multiSelection
142 property bool colourImage143 property bool colourImage
144 property Component delegate
143 property real containerHeight145 property real containerHeight
144 property int selectedIndex146 property int selectedIndex
145 property bool currentlyExpanded147 property bool currentlyExpanded
@@ -204,12 +206,14 @@
204Object 0.1 1.0206Object 0.1 1.0
205QtObject207QtObject
206 default property internal children208 default property internal children
209 property list<QtObject> __defaultPropertyFix
207OptionSelector 0.1 1.0210OptionSelector 0.1 1.0
208ListItem.Empty211ListItem.Empty
209 property var model212 property var model
210 property bool expanded213 property bool expanded
211 property bool multiSelection214 property bool multiSelection
212 property bool colourImage215 property bool colourImage
216 property Component delegate
213 property real containerHeight217 property real containerHeight
214 property int selectedIndex218 property int selectedIndex
215 property bool currentlyExpanded219 property bool currentlyExpanded
@@ -235,6 +239,7 @@
235Page 0.1 1.0239Page 0.1 1.0
236PageTreeNode240PageTreeNode
237 property string title241 property string title
242 property Item tools
238 property Item __customHeaderContents243 property Item __customHeaderContents
239 property Flickable flickable244 property Flickable flickable
240 property list<Action> actions245 property list<Action> actions
@@ -355,6 +360,7 @@
355OrientationHelper360OrientationHelper
356 property Item dismissArea361 property Item dismissArea
357 property bool grabDismissAreaEvents362 property bool grabDismissAreaEvents
363 property PropertyAnimation fadingAnimation
358 function show()364 function show()
359 function hide()365 function hide()
360 function __closeIfHidden()366 function __closeIfHidden()
361367
=== modified file 'modules/Ubuntu/Components/AnimatedItem.qml'
--- modules/Ubuntu/Components/AnimatedItem.qml 2014-04-23 08:50:20 +0000
+++ modules/Ubuntu/Components/AnimatedItem.qml 2014-06-02 11:30:26 +0000
@@ -30,45 +30,8 @@
30 id: root30 id: root
31 /*!31 /*!
32 \preliminary32 \preliminary
33 \deprecated
33 Specifies whether the component is on the visible area of the Flickable or not.34 Specifies whether the component is on the visible area of the Flickable or not.
34 */35 */
35 property bool onScreen: true36 property bool onScreen: true
36
37 QtObject {
38 id: internal
39 property Flickable flickable
40
41 // returns whether the component is in the visible area of the flickable
42 function checkOnScreen()
43 {
44 var pos = root.mapToItem(flickable, 0, 0)
45 root.onScreen = (pos.y + root.height >= 0) && (pos.y <= internal.flickable.height) &&
46 (pos.x + root.width >= 0) && (pos.x <= internal.flickable.width)
47 }
48 // lookup for a flickable parent
49 function updateFlickableParent()
50 {
51 var flickable = root.parent
52 while (flickable) {
53 if (flickable.hasOwnProperty("flicking") && flickable.hasOwnProperty("flickableDirection")) {
54 // non-interactive flickables must be skipped as those do not provide
55 // on-screen detection support
56 if (flickable.interactive)
57 break
58 }
59 flickable = flickable.parent
60 }
61 internal.flickable = flickable
62 }
63 }
64
65 Connections {
66 target: internal.flickable
67
68 onContentXChanged: internal.checkOnScreen()
69 onContentYChanged: internal.checkOnScreen()
70 }
71
72 Component.onCompleted: internal.updateFlickableParent()
73 onParentChanged: internal.updateFlickableParent()
74}37}
7538
=== modified file 'modules/Ubuntu/Components/ListItems/Base.qml'
--- modules/Ubuntu/Components/ListItems/Base.qml 2014-04-28 19:24:56 +0000
+++ modules/Ubuntu/Components/ListItems/Base.qml 2014-06-02 11:30:26 +0000
@@ -159,7 +159,7 @@
159 /*!159 /*!
160 \internal160 \internal
161 */161 */
162 property alias children: middle.data162 default property alias children: middle.data
163 Item {163 Item {
164 id: middle164 id: middle
165 property bool anchorToIconHelper: !__iconIsItem && iconHelper.source != ""165 property bool anchorToIconHelper: !__iconIsItem && iconHelper.source != ""
166166
=== modified file 'modules/Ubuntu/Components/PageStack.qml'
--- modules/Ubuntu/Components/PageStack.qml 2014-05-13 09:09:35 +0000
+++ modules/Ubuntu/Components/PageStack.qml 2014-06-02 11:30:26 +0000
@@ -192,6 +192,7 @@
192 */192 */
193 default property alias data: inactiveNode.data193 default property alias data: inactiveNode.data
194 PageTreeNode {194 PageTreeNode {
195 anchors.fill: parent
195 id: inactiveNode196 id: inactiveNode
196 active: false197 active: false
197 }198 }
198199
=== modified file 'modules/Ubuntu/Components/Pickers/DatePicker.qml'
--- modules/Ubuntu/Components/Pickers/DatePicker.qml 2014-05-07 10:42:31 +0000
+++ modules/Ubuntu/Components/Pickers/DatePicker.qml 2014-06-02 11:30:26 +0000
@@ -523,7 +523,8 @@
523 function updatePickers() {523 function updatePickers() {
524 if (completed) {524 if (completed) {
525 // check mode flags first525 // check mode flags first
526 var modes = datePicker.mode.split(/\W/g);526 // FIXME: The js split(/\W/g) terminates the process on armhf with Qt 5.3 (v4 js) (https://bugreports.qt-project.org/browse/QTBUG-39255)
527 var modes = datePicker.mode.match(/\w+/g);
527528
528 showYearPicker = showMonthPicker = showDayPicker =529 showYearPicker = showMonthPicker = showDayPicker =
529 showHoursPicker = showMinutesPicker = showSecondsPicker = false;530 showHoursPicker = showMinutesPicker = showSecondsPicker = false;
@@ -607,7 +608,8 @@
607 completed = false;608 completed = false;
608609
609 // use short format to exclude any extra characters610 // use short format to exclude any extra characters
610 var format = datePicker.locale.dateFormat(Locale.ShortFormat).split(/\W/g);611 // FIXME: The js split(/\W/g) terminates the process on armhf with Qt 5.3 (v4 js) (https://bugreports.qt-project.org/browse/QTBUG-39255)
612 var format = datePicker.locale.dateFormat(Locale.ShortFormat).match(/\w+/g);
611 // loop through the format to decide the position of the tumbler613 // loop through the format to decide the position of the tumbler
612 var formatIndex = 0;614 var formatIndex = 0;
613 for (var i in format) {615 for (var i in format) {
614616
=== modified file 'modules/Ubuntu/Components/plugin/i18n.cpp'
--- modules/Ubuntu/Components/plugin/i18n.cpp 2014-05-22 15:54:13 +0000
+++ modules/Ubuntu/Components/plugin/i18n.cpp 2014-06-02 11:30:26 +0000
@@ -103,13 +103,14 @@
103 /*103 /*
104 The default is /usr/share/locale if we don't set a folder104 The default is /usr/share/locale if we don't set a folder
105 For click we use APP_DIR/share/locale105 For click we use APP_DIR/share/locale
106 eg. /usr/share/click/preinstalled/com.example.foo/current/share/locale106 e.g. /usr/share/click/preinstalled/com.example.foo/current/share/locale
107 */107 */
108 QDir appDir(getenv("APP_DIR"));108 QString appDir(getenv("APP_DIR"));
109 if (appDir.exists()) {109 if (!QDir::isAbsolutePath (appDir)) {
110 QString localePath(appDir.filePath("share/locale"));110 appDir = "/usr";
111 C::bindtextdomain(domain.toUtf8(), localePath.toUtf8());
112 }111 }
112 QString localePath(QDir(appDir).filePath("share/locale"));
113 C::bindtextdomain(domain.toUtf8(), localePath.toUtf8());
113 Q_EMIT domainChanged();114 Q_EMIT domainChanged();
114}115}
115116
116117
=== modified file 'modules/Ubuntu/Components/plugin/thumbnailgenerator.cpp'
--- modules/Ubuntu/Components/plugin/thumbnailgenerator.cpp 2014-02-25 09:14:23 +0000
+++ modules/Ubuntu/Components/plugin/thumbnailgenerator.cpp 2014-06-02 11:30:26 +0000
@@ -43,12 +43,15 @@
43 * is the only way around the issue for now. */43 * is the only way around the issue for now. */
44 std::string src_path(QUrl(id).path().toUtf8().data());44 std::string src_path(QUrl(id).path().toUtf8().data());
45 std::string tgt_path;45 std::string tgt_path;
46 const int xlarge_cutoff = 512;
47 const int large_cutoff = 256;
48 const int small_cutoff = 128;
46 try {49 try {
47 ThumbnailSize desiredSize;50 ThumbnailSize desiredSize;
48 const int large_cutoff = 256;51 if(requestedSize.width() > xlarge_cutoff || requestedSize.height() > xlarge_cutoff) {
49 const int small_cutoff = 128;
50 if(requestedSize.width() > large_cutoff || requestedSize.height() > large_cutoff) {
51 desiredSize = TN_SIZE_ORIGINAL;52 desiredSize = TN_SIZE_ORIGINAL;
53 } else if(requestedSize.width() > large_cutoff || requestedSize.height() > large_cutoff) {
54 desiredSize = TN_SIZE_XLARGE;
52 } else if(requestedSize.width() > small_cutoff || requestedSize.height() > small_cutoff) {55 } else if(requestedSize.width() > small_cutoff || requestedSize.height() > small_cutoff) {
53 desiredSize = TN_SIZE_LARGE;56 desiredSize = TN_SIZE_LARGE;
54 } else {57 } else {
5558
=== 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-06-02 11:30:26 +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-06-02 11:30:26 +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-06-02 11:30:26 +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
=== modified file 'tests/autopilot/ubuntuuitoolkit/fixture_setup.py'
--- tests/autopilot/ubuntuuitoolkit/fixture_setup.py 2014-04-23 08:50:20 +0000
+++ tests/autopilot/ubuntuuitoolkit/fixture_setup.py 2014-06-02 11:30:26 +0000
@@ -16,6 +16,7 @@
1616
17import copy17import copy
18import os18import os
19import shutil
19import tempfile20import tempfile
2021
21import fixtures22import fixtures
@@ -118,3 +119,47 @@
118 original_value)119 original_value)
119 else:120 else:
120 self.addCleanup(environment.unset_initctl_env_var, variable)121 self.addCleanup(environment.unset_initctl_env_var, variable)
122
123
124class FakeHome(fixtures.Fixture):
125
126 # We copy the Xauthority file to allow executions using XVFB. If it is not
127 # on the user's HOME directory, nothing will happen.
128 should_copy_xauthority_file = True
129
130 def __init__(self, directory=None):
131 super(FakeHome, self).__init__()
132 self.directory = directory
133
134 def setUp(self):
135 super(FakeHome, self).setUp()
136 self.directory = self._make_directory_if_not_specified()
137 if self.should_copy_xauthority_file:
138 self._copy_xauthority_file(self.directory)
139 # We patch both environment variables so it works on the desktop and on
140 # the phone.
141 self.useFixture(
142 InitctlEnvironmentVariable(HOME=self.directory))
143 self.useFixture(
144 fixtures.EnvironmentVariable('HOME', newvalue=self.directory))
145
146 def _make_directory_if_not_specified(self):
147 if self.directory is None:
148 parent_directory = os.path.join(
149 os.environ.get('HOME'), 'autopilot', 'fakeenv')
150 if not os.path.exists(parent_directory):
151 os.makedirs(parent_directory)
152 temp_dir_fixture = fixtures.TempDir(parent_directory)
153 self.useFixture(temp_dir_fixture)
154 return temp_dir_fixture.path
155 else:
156 return self.directory
157
158 def _copy_xauthority_file(self, directory):
159 """Copy the .Xauthority file if it exists in the user's home."""
160 xauthority_file_path = os.path.join(
161 os.environ.get('HOME'), '.Xauthority')
162 if os.path.isfile(xauthority_file_path):
163 shutil.copyfile(
164 xauthority_file_path,
165 os.path.join(directory, '.Xauthority'))
121166
=== 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-06-02 11:30:26 +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-06-02 11:30:26 +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-06-02 11:30:26 +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)
160187
=== modified file 'tests/autopilot/ubuntuuitoolkit/tests/test_fixture_setup.py'
--- tests/autopilot/ubuntuuitoolkit/tests/test_fixture_setup.py 2014-03-10 16:51:01 +0000
+++ tests/autopilot/ubuntuuitoolkit/tests/test_fixture_setup.py 2014-06-02 11:30:26 +0000
@@ -15,6 +15,7 @@
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 os17import os
18import tempfile
1819
19try:20try:
20 # Python 3.21 # Python 3.
@@ -24,7 +25,7 @@
24 import mock25 import mock
25import testtools26import testtools
26from autopilot import testcase as autopilot_testcase27from autopilot import testcase as autopilot_testcase
27from testtools.matchers import Contains, Not, FileExists28from testtools.matchers import Contains, FileExists, Not
2829
29from ubuntuuitoolkit import base, environment, fixture_setup30from ubuntuuitoolkit import base, environment, fixture_setup
3031
@@ -233,3 +234,73 @@
233 self.assertEqual(234 self.assertEqual(
234 'original test value',235 'original test value',
235 environment.get_initctl_env_var('testenvvarforfixture'))236 environment.get_initctl_env_var('testenvvarforfixture'))
237
238
239class FakeHomeTestCase(testtools.TestCase):
240
241 def test_fake_home_fixture_patches_initctl_env_var(self):
242 original_home = environment.get_initctl_env_var('HOME')
243 fake_home = original_home + 'fake'
244 result = testtools.TestResult()
245
246 def inner_test():
247 class TestWithFakeHome(testtools.TestCase):
248 def test_it(self):
249 fake_home_fixture = fixture_setup.FakeHome(fake_home)
250 fake_home_fixture.should_copy_xauthority_file = False
251 self.useFixture(fake_home_fixture)
252 self.assertEqual(
253 fake_home, environment.get_initctl_env_var('HOME'))
254 return TestWithFakeHome('test_it')
255
256 inner_test().run(result)
257
258 self.assertTrue(
259 result.wasSuccessful(),
260 'Failed to fake the home: {}'.format(result.errors))
261 self.assertEqual(
262 original_home,
263 environment.get_initctl_env_var('HOME'))
264
265 def test_fake_home_fixture_patches_env_var(self):
266 original_home = os.environ.get('HOME')
267 fake_home = tempfile.gettempdir()
268 result = testtools.TestResult()
269
270 def inner_test():
271 class TestWithFakeHome(testtools.TestCase):
272 def test_it(self):
273 fake_home_fixture = fixture_setup.FakeHome(fake_home)
274 fake_home_fixture.should_copy_xauthority_file = False
275 self.useFixture(fake_home_fixture)
276 self.assertEqual(
277 fake_home, os.environ.get('HOME'))
278 return TestWithFakeHome('test_it')
279
280 inner_test().run(result)
281
282 self.assertTrue(
283 result.wasSuccessful(),
284 'Failed to fake the home: {}'.format(result.failures))
285 self.assertEqual(original_home, os.environ.get('HOME'))
286
287 def test_fake_home_fixture_must_create_default_directory(self):
288 original_home = os.environ.get('HOME')
289 self.useFixture(fixture_setup.FakeHome())
290
291 home_parent_directory, _ = os.path.split(os.environ.get('HOME'))
292 self.assertEqual(
293 home_parent_directory,
294 os.path.join(original_home, 'autopilot', 'fakeenv'))
295
296 def test_fake_home_fixture_must_copy_xauthority(self):
297 # Fake the home first so we don't write the xauthority on the real
298 # home.
299 self.useFixture(fixture_setup.FakeHome())
300
301 open(os.path.join(os.environ.get('HOME'), '.Xauthority')).close()
302
303 self.useFixture(fixture_setup.FakeHome())
304 self.assertTrue(
305 os.path.exists(
306 os.path.join(os.environ.get('HOME'), '.Xauthority')))
236307
=== modified file 'tests/qmlapicheck.py'
--- tests/qmlapicheck.py 2014-04-24 09:18:38 +0000
+++ tests/qmlapicheck.py 2014-06-02 11:30:26 +0000
@@ -130,10 +130,10 @@
130 if '{' in line and '}' in line:130 if '{' in line and '}' in line:
131 if filetype == 'qmltypes' and not in_builtin_type:131 if filetype == 'qmltypes' and not in_builtin_type:
132 print(' ' + line.strip())132 print(' ' + line.strip())
133 continue133 continue
134134
135 # End of function/ signal/ Item block135 # End of function/ signal/ Item block
136 if '}' in line:136 if '}' in line and not '{' in line:
137 in_block -= 1137 in_block -= 1
138 block_meta = {}138 block_meta = {}
139 if in_block == 1 and in_builtin_type:139 if in_block == 1 and in_builtin_type:
@@ -143,7 +143,7 @@
143 # Only root "Item {" is inspected for QML, otherwise all children143 # Only root "Item {" is inspected for QML, otherwise all children
144 if in_block == 1 or filetype == 'qmltypes':144 if in_block == 1 or filetype == 'qmltypes':
145 # Left hand side specifies a keyword, a type and a variable name145 # Left hand side specifies a keyword, a type and a variable name
146 declaration = line.split(':')[0]146 declaration = line.split(':', 1)[0]
147 words = declaration.strip().split(' ')147 words = declaration.strip().split(' ')
148 # Skip types with prefixes considered builtin148 # Skip types with prefixes considered builtin
149 if filetype == 'qmltypes' and words[0] == 'name':149 if filetype == 'qmltypes' and words[0] == 'name':
@@ -175,7 +175,8 @@
175 for word in words:175 for word in words:
176 if word in keywords:176 if word in keywords:
177 if filetype == 'qml':177 if filetype == 'qml':
178 signature = declaration.split('{')[0].strip()178 separator = '{' if 'function' in declaration else ':'
179 signature = declaration.split(separator, 1)[0].strip()
179 if 'alias' in line:180 if 'alias' in line:
180 no_mods = signature181 no_mods = signature
181 for mod in ['readonly', 'default']:182 for mod in ['readonly', 'default']:
@@ -198,7 +199,7 @@
198 break199 break
199200
200 # Start of function/ signal/ Item block201 # Start of function/ signal/ Item block
201 if '{' in line:202 if '{' in line and not '}' in line:
202 in_block += 1203 in_block += 1
203 block_meta = {}204 block_meta = {}
204 # The parent type can affect API205 # The parent type can affect API

Subscribers

People subscribed via source and target branches

to status/vote changes: