Merge lp:~nick-dedekind/unity8/lp1236267 into lp:unity8

Proposed by Nick Dedekind
Status: Merged
Approved by: Albert Astals Cid
Approved revision: 469
Merged at revision: 514
Proposed branch: lp:~nick-dedekind/unity8/lp1236267
Merge into: lp:unity8
Prerequisite: lp:~nick-dedekind/unity8/indicator.submenu-reinit
Diff against target: 345 lines (+217/-21)
8 files modified
Panel/Indicators/DefaultIndicatorWidget.qml (+32/-10)
plugins/Unity/Indicators/qml/IndicatorWidget.qml (+1/-1)
tests/mocks/Unity/Indicators/IndicatorBase.qml (+37/-0)
tests/mocks/Unity/Indicators/IndicatorWidget.qml (+28/-0)
tests/mocks/Unity/Indicators/RootActionState.qml (+18/-10)
tests/mocks/Unity/Indicators/qmldir (+2/-0)
tests/qmltests/CMakeLists.txt (+2/-0)
tests/qmltests/Panel/Indicators/tst_DefaultIndicatorWidget.qml (+97/-0)
To merge this branch: bzr merge lp:~nick-dedekind/unity8/lp1236267
Reviewer Review Type Date Requested Status
PS Jenkins bot (community) continuous-integration Approve
Albert Astals Cid (community) Approve
Review via email: mp+192924@code.launchpad.net

This proposal supersedes a proposal from 2013-10-16.

Commit message

Round indicator widget icon/label width up to closest gu for alignment.

Description of the change

Round indicator widget icon/label width up to closest gu for alignment.
Preserve icon aspect ratio.

Added test for DefaultIndicatorWidget width rounding.

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:466
http://jenkins.qa.ubuntu.com/job/unity8-ci/1421/
Executed test runs:
    UNSTABLE: http://jenkins.qa.ubuntu.com/job/generic-mediumtests-saucy/5047
    FAILURE: http://jenkins.qa.ubuntu.com/job/generic-mediumtests-touch/2985/console
    UNSTABLE: http://jenkins.qa.ubuntu.com/job/unity-phablet-qmluitests-saucy/2289
    SUCCESS: http://jenkins.qa.ubuntu.com/job/unity8-saucy-amd64-ci/444
    SUCCESS: http://jenkins.qa.ubuntu.com/job/unity8-saucy-armhf-ci/1421
        deb: http://jenkins.qa.ubuntu.com/job/unity8-saucy-armhf-ci/1421/artifact/work/output/*zip*/output.zip
    SUCCESS: http://jenkins.qa.ubuntu.com/job/unity8-saucy-i386-ci/1420
    UNSTABLE: http://jenkins.qa.ubuntu.com/job/autopilot-testrunner-otto-saucy/1217
    SUCCESS: http://jenkins.qa.ubuntu.com/job/generic-mediumtests-builder-saucy-amd64/922
        deb: http://jenkins.qa.ubuntu.com/job/generic-mediumtests-builder-saucy-amd64/922/artifact/work/output/*zip*/output.zip
    SUCCESS: http://jenkins.qa.ubuntu.com/job/generic-mediumtests-builder-saucy-armhf/2987
        deb: http://jenkins.qa.ubuntu.com/job/generic-mediumtests-builder-saucy-armhf/2987/artifact/work/output/*zip*/output.zip
    FAILURE: http://jenkins.qa.ubuntu.com/job/generic-mediumtests-runner-maguro/2493/console
    FAILURE: http://jenkins.qa.ubuntu.com/job/generic-mediumtests-runner-mako/2537/console

Click here to trigger a rebuild:
http://10.97.0.26:8080/job/unity8-ci/1421/rebuild

review: Needs Fixing (continuous-integration)
Revision history for this message
Albert Astals Cid (aacid) wrote : Posted in a previous version of this proposal

Do you think it makes sense for guRoundUp to be somewhere more central so it can be eventually reused? Or maybe do it when we need to?

review: Needs Information
Revision history for this message
MichaƂ Sawicz (saviq) wrote : Posted in a previous version of this proposal

On 17.10.2013 11:24, Albert Astals Cid wrote:
> Do you think it makes sense for guRoundUp to be somewhere more central so it can be eventually reused? Or maybe do it when we need to?

Maybe we should even put it in the UITK for others to use? I.e. put it
on units.guRoundUp()?

Revision history for this message
Nick Dedekind (nick-dedekind) wrote : Posted in a previous version of this proposal

> On 17.10.2013 11:24, Albert Astals Cid wrote:
> > Do you think it makes sense for guRoundUp to be somewhere more central so it
> can be eventually reused? Or maybe do it when we need to?
>
> Maybe we should even put it in the UITK for others to use? I.e. put it
> on units.guRoundUp()?

I'll put add a request to the toolkit, and up a TODO in here. Don't think it should be held up until we get that in though.

Revision history for this message
Nick Dedekind (nick-dedekind) wrote : Posted in a previous version of this proposal
Revision history for this message
Albert Astals Cid (aacid) wrote : Posted in a previous version of this proposal

Ok

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

FAILED: Continuous integration, rev:467
http://jenkins.qa.ubuntu.com/job/unity8-ci/1454/
Executed test runs:
    SUCCESS: http://jenkins.qa.ubuntu.com/job/generic-mediumtests-saucy/5107
    FAILURE: http://jenkins.qa.ubuntu.com/job/generic-mediumtests-touch/3081/console
    SUCCESS: http://jenkins.qa.ubuntu.com/job/unity-phablet-qmluitests-saucy/2325
    SUCCESS: http://jenkins.qa.ubuntu.com/job/unity8-saucy-amd64-ci/477
    FAILURE: http://jenkins.qa.ubuntu.com/job/unity8-saucy-armhf-ci/1454/console
    SUCCESS: http://jenkins.qa.ubuntu.com/job/unity8-saucy-i386-ci/1453
    SUCCESS: http://jenkins.qa.ubuntu.com/job/autopilot-testrunner-otto-saucy/1271
    SUCCESS: http://jenkins.qa.ubuntu.com/job/generic-mediumtests-builder-saucy-amd64/982
        deb: http://jenkins.qa.ubuntu.com/job/generic-mediumtests-builder-saucy-amd64/982/artifact/work/output/*zip*/output.zip
    SUCCESS: http://jenkins.qa.ubuntu.com/job/generic-mediumtests-builder-saucy-armhf/3083
        deb: http://jenkins.qa.ubuntu.com/job/generic-mediumtests-builder-saucy-armhf/3083/artifact/work/output/*zip*/output.zip
    FAILURE: http://jenkins.qa.ubuntu.com/job/generic-mediumtests-runner-maguro/2579/console
    FAILURE: http://jenkins.qa.ubuntu.com/job/generic-mediumtests-runner-mako/2630/console
    SUCCESS: http://10.97.0.26:8080/job/touch-flash-device/189
    SUCCESS: http://10.97.0.26:8080/job/touch-flash-device/188

Click here to trigger a rebuild:
http://10.97.0.26:8080/job/unity8-ci/1454/rebuild

review: Needs Fixing (continuous-integration)
Revision history for this message
Michael Zanetti (mzanetti) wrote : Posted in a previous version of this proposal

can we add a test for this?

Revision history for this message
Nick Dedekind (nick-dedekind) wrote : Posted in a previous version of this proposal

> can we add a test for this?

Yes.
I've put it back into 'Needs review' until tests added.

Revision history for this message
Nick Dedekind (nick-dedekind) wrote :

Added DefaultIndicatorWidget width test.
Requires lp:~nick-dedekind/unity8/indicator.submenu-reinit

Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :

FAILED: Continuous integration, rev:469
http://jenkins.qa.ubuntu.com/job/unity8-ci/1508/
Executed test runs:
    FAILURE: http://jenkins.qa.ubuntu.com/job/generic-mediumtests-trusty/138/console
    FAILURE: http://jenkins.qa.ubuntu.com/job/generic-mediumtests-trusty-touch/132/console
    FAILURE: http://jenkins.qa.ubuntu.com/job/unity-phablet-qmluitests-trusty/35/console
    SUCCESS: http://jenkins.qa.ubuntu.com/job/unity8-trusty-amd64-ci/32
    SUCCESS: http://jenkins.qa.ubuntu.com/job/unity8-trusty-armhf-ci/32
        deb: http://jenkins.qa.ubuntu.com/job/unity8-trusty-armhf-ci/32/artifact/work/output/*zip*/output.zip
    FAILURE: http://jenkins.qa.ubuntu.com/job/unity8-trusty-i386-ci/32/console
    FAILURE: http://jenkins.qa.ubuntu.com/job/autopilot-testrunner-otto-trusty/129/console
    SUCCESS: http://jenkins.qa.ubuntu.com/job/generic-mediumtests-builder-trusty-amd64/138
        deb: http://jenkins.qa.ubuntu.com/job/generic-mediumtests-builder-trusty-amd64/138/artifact/work/output/*zip*/output.zip
    SUCCESS: http://jenkins.qa.ubuntu.com/job/generic-mediumtests-builder-trusty-armhf/132
        deb: http://jenkins.qa.ubuntu.com/job/generic-mediumtests-builder-trusty-armhf/132/artifact/work/output/*zip*/output.zip
    FAILURE: http://jenkins.qa.ubuntu.com/job/generic-mediumtests-runner-maguro/2759/console
    SUCCESS: http://jenkins.qa.ubuntu.com/job/generic-mediumtests-runner-mako/2809
    SUCCESS: http://10.97.0.26:8080/job/touch-flash-device/558
    SUCCESS: http://10.97.0.26:8080/job/touch-flash-device/557

Click here to trigger a rebuild:
http://10.97.0.26:8080/job/unity8-ci/1508/rebuild

review: Needs Fixing (continuous-integration)
Revision history for this message
Albert Astals Cid (aacid) wrote :

Looks good

review: Approve
Revision history for this message
MichaƂ Sawicz (saviq) wrote :

There's a failed autolanding coming - it's caused by the prerequisite branch.

Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :

FAILED: Autolanding.
More details in the following jenkins job:
http://jenkins.qa.ubuntu.com/job/unity8-autolanding/624/
Executed test runs:
    SUCCESS: http://10.97.0.26:8080/job/generic-cleanup-mbs/3061
    SUCCESS: http://jenkins.qa.ubuntu.com/job/generic-mediumtests-trusty/293
    SUCCESS: http://jenkins.qa.ubuntu.com/job/generic-mediumtests-trusty-touch/283
    UNSTABLE: http://jenkins.qa.ubuntu.com/job/unity-phablet-qmluitests-trusty/81
    SUCCESS: http://jenkins.qa.ubuntu.com/job/unity8-trusty-amd64-autolanding/10
    SUCCESS: http://jenkins.qa.ubuntu.com/job/unity8-trusty-armhf-autolanding/10
        deb: http://jenkins.qa.ubuntu.com/job/unity8-trusty-armhf-autolanding/10/artifact/work/output/*zip*/output.zip
    SUCCESS: http://jenkins.qa.ubuntu.com/job/unity8-trusty-i386-autolanding/10
    SUCCESS: http://jenkins.qa.ubuntu.com/job/autopilot-testrunner-otto-trusty/277
    SUCCESS: http://jenkins.qa.ubuntu.com/job/generic-mediumtests-builder-trusty-amd64/293
        deb: http://jenkins.qa.ubuntu.com/job/generic-mediumtests-builder-trusty-amd64/293/artifact/work/output/*zip*/output.zip
    SUCCESS: http://jenkins.qa.ubuntu.com/job/generic-mediumtests-builder-trusty-armhf/283
        deb: http://jenkins.qa.ubuntu.com/job/generic-mediumtests-builder-trusty-armhf/283/artifact/work/output/*zip*/output.zip
    SUCCESS: http://jenkins.qa.ubuntu.com/job/generic-mediumtests-runner-maguro/2900
    SUCCESS: http://jenkins.qa.ubuntu.com/job/generic-mediumtests-runner-mako/2951
    SUCCESS: http://10.97.0.26:8080/job/touch-flash-device/846
    SUCCESS: http://10.97.0.26:8080/job/touch-flash-device/847

review: Needs Fixing (continuous-integration)
Revision history for this message
Albert Astals Cid (aacid) wrote :

Pre-requisite got merged, try to land again.

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

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'Panel/Indicators/DefaultIndicatorWidget.qml'
2--- Panel/Indicators/DefaultIndicatorWidget.qml 2013-10-02 16:07:39 +0000
3+++ Panel/Indicators/DefaultIndicatorWidget.qml 2013-10-28 18:24:51 +0000
4@@ -24,7 +24,7 @@
5 Indicators.IndicatorWidget {
6 id: indicatorWidget
7
8- width: itemRow.width + units.gu(0.5)
9+ width: itemRow.width
10
11 property alias leftLabel: itemLeftLabel.text
12 property alias rightLabel: itemRightLabel.text
13@@ -32,16 +32,17 @@
14
15 Row {
16 id: itemRow
17+ width: childrenRect.width
18 objectName: "itemRow"
19 anchors {
20 top: parent.top
21 bottom: parent.bottom
22 horizontalCenter: parent.horizontalCenter
23 }
24- spacing: units.gu(0.5)
25
26 Label {
27 id: itemLeftLabel
28+ width: guRoundUp(implicitWidth)
29 objectName: "leftLabel"
30 color: Theme.palette.selected.backgroundText
31 opacity: 0.8
32@@ -57,25 +58,35 @@
33 top: parent.top
34 bottom: parent.bottom
35 }
36- spacing: units.gu(0.5)
37
38 Repeater {
39 model: indicatorWidget.icons
40
41- Image {
42- id: itemImage
43- objectName: "itemImage"
44- visible: source != ""
45- source: modelData
46+ Item {
47+ width: guRoundUp(itemImage.width)
48 height: indicatorWidget.iconSize
49- width: indicatorWidget.iconSize
50- anchors.verticalCenter: parent.verticalCenter
51+
52+ Image {
53+ id: itemImage
54+ objectName: "itemImage"
55+ visible: source != ""
56+ source: modelData
57+ height: parent.height
58+ anchors.horizontalCenter: parent.horizontalCenter
59+ fillMode: Image.PreserveAspectFit
60+
61+ sourceSize {
62+ width: indicatorWidget.iconSize
63+ height: indicatorWidget.iconSize
64+ }
65+ }
66 }
67 }
68 }
69
70 Label {
71 id: itemRightLabel
72+ width: guRoundUp(implicitWidth)
73 objectName: "rightLabel"
74 color: Theme.palette.selected.backgroundText
75 opacity: 0.8
76@@ -86,6 +97,17 @@
77 }
78 }
79
80+ // TODO: Use toolkit function https://bugs.launchpad.net/ubuntu-ui-toolkit/+bug/1242575
81+ function guRoundUp(width) {
82+ if (width == 0) {
83+ return 0;
84+ }
85+ var gu1 = units.gu(1.0);
86+ var mod = (width % gu1);
87+
88+ return mod == 0 ? width : width + (gu1 - mod);
89+ }
90+
91 onRootActionStateChanged: {
92 if (rootActionState == undefined) {
93 leftLabel = "";
94
95=== modified file 'plugins/Unity/Indicators/qml/IndicatorWidget.qml'
96--- plugins/Unity/Indicators/qml/IndicatorWidget.qml 2013-09-30 16:37:55 +0000
97+++ plugins/Unity/Indicators/qml/IndicatorWidget.qml 2013-10-28 18:24:51 +0000
98@@ -24,5 +24,5 @@
99 id: indicatorWidget
100
101 enabled: false
102- property int iconSize: height - units.gu(0.5)
103+ property int iconSize: height
104 }
105
106=== added file 'tests/mocks/Unity/Indicators/IndicatorBase.qml'
107--- tests/mocks/Unity/Indicators/IndicatorBase.qml 1970-01-01 00:00:00 +0000
108+++ tests/mocks/Unity/Indicators/IndicatorBase.qml 2013-10-28 18:24:51 +0000
109@@ -0,0 +1,37 @@
110+/*
111+ * Copyright 2013 Canonical Ltd.
112+ *
113+ * This program is free software; you can redistribute it and/or modify
114+ * it under the terms of the GNU Lesser General Public License as published by
115+ * the Free Software Foundation; version 3.
116+ *
117+ * This program is distributed in the hope that it will be useful,
118+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
119+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
120+ * GNU Lesser General Public License for more details.
121+ *
122+ * You should have received a copy of the GNU Lesser General Public License
123+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
124+ *
125+ * Authors:
126+ * Nick Dedekind <nick.dedekind@canonical.com>
127+ */
128+
129+import QtQuick 2.0
130+import QMenuModel 0.1
131+
132+Item {
133+ id: indicatorBase
134+
135+ //const
136+ property string busName
137+ property string actionsObjectPath
138+ property string rootMenuType: "com.canonical.indicator.root"
139+ property string deviceMenuObjectPath
140+
141+ property var menuModel: UnityMenuModel {}
142+
143+ property RootActionState rootActionState: RootActionState {
144+ onUpdated: indicatorBase.rootActionStateChanged()
145+ }
146+}
147
148=== added file 'tests/mocks/Unity/Indicators/IndicatorWidget.qml'
149--- tests/mocks/Unity/Indicators/IndicatorWidget.qml 1970-01-01 00:00:00 +0000
150+++ tests/mocks/Unity/Indicators/IndicatorWidget.qml 2013-10-28 18:24:51 +0000
151@@ -0,0 +1,28 @@
152+/*
153+ * Copyright 2013 Canonical Ltd.
154+ *
155+ * This program is free software; you can redistribute it and/or modify
156+ * it under the terms of the GNU Lesser General Public License as published by
157+ * the Free Software Foundation; version 3.
158+ *
159+ * This program is distributed in the hope that it will be useful,
160+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
161+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
162+ * GNU Lesser General Public License for more details.
163+ *
164+ * You should have received a copy of the GNU Lesser General Public License
165+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
166+ *
167+ * Authors:
168+ * Nick Dedekind <nick.dedekind@canonical.com>
169+ */
170+
171+import QtQuick 2.0
172+import Unity.Indicators 0.1 as Indicators
173+
174+IndicatorBase {
175+ id: indicatorWidget
176+
177+ enabled: false
178+ property int iconSize: height
179+}
180
181=== modified file 'tests/mocks/Unity/Indicators/RootActionState.qml'
182--- tests/mocks/Unity/Indicators/RootActionState.qml 2013-10-11 18:58:51 +0000
183+++ tests/mocks/Unity/Indicators/RootActionState.qml 2013-10-28 18:24:51 +0000
184@@ -20,14 +20,22 @@
185 import QtQuick 2.0
186
187 QtObject {
188- property var menu
189- property bool valid: false
190- property string title
191- property string leftLabel
192- property string rightLabel
193- property var icons
194- property string accessibleName
195- property bool visible: true
196-
197- signal updated
198+ property var menu
199+ property bool valid: false
200+ property string title
201+ property string leftLabel
202+ property string rightLabel
203+ property var icons
204+ property string accessibleName
205+ property bool visible: true
206+
207+ signal updated
208+
209+ onValidChanged: updated()
210+ onTitleChanged: updated()
211+ onLeftLabelChanged: updated()
212+ onRightLabelChanged: updated()
213+ onIconsChanged: updated()
214+ onAccessibleNameChanged: updated()
215+ onVisibleChanged: updated()
216 }
217
218=== modified file 'tests/mocks/Unity/Indicators/qmldir'
219--- tests/mocks/Unity/Indicators/qmldir 2013-10-11 18:58:51 +0000
220+++ tests/mocks/Unity/Indicators/qmldir 2013-10-28 18:24:51 +0000
221@@ -2,6 +2,8 @@
222 plugin IndicatorsFakeQml
223
224 CachedUnityMenuModel 0.1 CachedUnityMenuModel.qml
225+IndicatorBase 0.1 IndicatorBase.qml
226+IndicatorWidget 0.1 IndicatorWidget.qml
227 IndicatorsModel 0.1 IndicatorsModel.qml
228 FakeMenuPage 0.1 FakeMenuPage.qml
229 RootActionState 0.1 RootActionState.qml
230
231=== modified file 'tests/qmltests/CMakeLists.txt'
232--- tests/qmltests/CMakeLists.txt 2013-10-28 18:24:51 +0000
233+++ tests/qmltests/CMakeLists.txt 2013-10-28 18:24:51 +0000
234@@ -71,6 +71,8 @@
235 add_qml_test(Panel MenuContent IMPORT_PATHS ${CMAKE_BINARY_DIR}/plugins ${qmltest_DEFAULT_IMPORT_PATHS})
236 add_qml_test(Panel Panel IMPORT_PATHS ${CMAKE_BINARY_DIR}/plugins ${qmltest_DEFAULT_IMPORT_PATHS})
237 add_qml_test(Panel SearchIndicator)
238+add_qml_test(Panel/Indicators DefaultIndicatorWidget IMPORT_PATHS ${CMAKE_BINARY_DIR}/plugins ${qmltest_DEFAULT_IMPORT_PATHS}
239+ ENVIRONMENT "LD_LIBRARY_PATH=${CMAKE_BINARY_DIR}/tests/mocks/QMenuModel")
240 add_qml_test(SideStage SideStage IMPORT_PATHS ${qmltest_DEFAULT_IMPORT_PATHS}
241 ${CMAKE_BINARY_DIR}/tests/mocks
242 ${CMAKE_BINARY_DIR}/plugins)
243
244=== added directory 'tests/qmltests/Panel/Indicators'
245=== added file 'tests/qmltests/Panel/Indicators/tst_DefaultIndicatorWidget.qml'
246--- tests/qmltests/Panel/Indicators/tst_DefaultIndicatorWidget.qml 1970-01-01 00:00:00 +0000
247+++ tests/qmltests/Panel/Indicators/tst_DefaultIndicatorWidget.qml 2013-10-28 18:24:51 +0000
248@@ -0,0 +1,97 @@
249+/*
250+ * Copyright 2013 Canonical Ltd.
251+ *
252+ * This program is free software; you can redistribute it and/or modify
253+ * it under the terms of the GNU General Public License as published by
254+ * the Free Software Foundation; version 3.
255+ *
256+ * This program is distributed in the hope that it will be useful,
257+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
258+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
259+ * GNU General Public License for more details.
260+ *
261+ * You should have received a copy of the GNU General Public License
262+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
263+ */
264+
265+import QtQuick 2.0
266+import QtTest 1.0
267+import Unity.Test 0.1 as UT
268+import QMenuModel 0.1
269+import "../../../../Panel/Indicators"
270+
271+Item {
272+ id: testView
273+ width: units.gu(40)
274+ height: units.gu(70)
275+
276+ DefaultIndicatorWidget {
277+ id: widget
278+
279+ anchors {
280+ left: parent.left
281+ top: parent.top
282+ }
283+
284+ busName: "test"
285+ actionsObjectPath: "test"
286+ deviceMenuObjectPath: "test"
287+
288+ rootMenuType: ""
289+
290+ iconSize: units.gu(3.2)
291+ height: units.gu(3)
292+
293+ rootActionState {
294+ icons: [ "image://theme/audio-volume-high", "image://theme/audio-volume-low" ]
295+ leftLabel: "left"
296+ rightLabel: "right"
297+ }
298+ }
299+
300+ UT.UnityTestCase {
301+ name: "DefaultIndicatorWidget"
302+ when: windowShown
303+
304+ function init() {
305+ widget.rootActionState.icons = [];
306+ widget.rootActionState.leftLabel = "";
307+ widget.rootActionState.rightLabel = "";
308+ wait(50);
309+ }
310+
311+ function test_guRoundedWidth_data() {
312+ return [
313+ { tag: "empty", icons: [], leftLabel: "", rightLabel: "" },
314+ { tag: "1-icon-no-label", icons: [ "image://theme/audio-volume-high" ], leftLabel: "", rightLabel: "" },
315+ { tag: "2-icon-no-label", icons: [ "image://theme/audio-volume-high", "image://theme/audio-volume-low" ], leftLabel: "", rightLabel: "" },
316+ { tag: "no-icon-l-label", icons: [], leftLabel: "left", rightLabel: "" },
317+ { tag: "no-icon-lr-label", icons: [], leftLabel: "left", rightLabel: "right" },
318+ { tag: "1-icon-l-label", icons: [ "image://theme/audio-volume-high" ], leftLabel: "left", rightLabel: "" },
319+ { tag: "1-icon-lr-label", icons: [ "image://theme/audio-volume-high" ], leftLabel: "left", rightLabel: "right" },
320+ { tag: "2-icon-l-label", icons: [ "image://theme/audio-volume-high", "image://theme/audio-volume-low" ], leftLabel: "left", rightLabel: "" },
321+ { tag: "2-icon-lr-label", icons: [ "image://theme/audio-volume-high", "image://theme/audio-volume-low" ], leftLabel: "left", rightLabel: "right" }
322+ ];
323+ }
324+
325+ function test_guRoundedWidth(data) {
326+ widget.rootActionState.icons = data.icons
327+ widget.rootActionState.leftLabel = data.leftLabel;
328+ widget.rootActionState.rightLabel = data.rightLabel;
329+ wait(50);
330+
331+ compare(widget.width, guRoundUp(widget.width));
332+ }
333+ }
334+
335+ // TODO: Use toolkit function https://bugs.launchpad.net/ubuntu-ui-toolkit/+bug/1242575
336+ function guRoundUp(width) {
337+ if (width == 0) {
338+ return 0;
339+ }
340+ var gu1 = units.gu(1.0);
341+ var mod = (width % gu1);
342+
343+ return mod == 0 ? width : width + (gu1 - mod);
344+ }
345+}

Subscribers

People subscribed via source and target branches