Merge lp:~unity-team/unity/phablet.test_IndicatorItem into lp:unity/phablet

Proposed by Andrea Cimitan
Status: Merged
Approved by: Michael Zanetti
Approved revision: no longer in the source branch.
Merged at revision: 590
Proposed branch: lp:~unity-team/unity/phablet.test_IndicatorItem
Merge into: lp:unity/phablet
Diff against target: 158 lines (+92/-3)
5 files modified
Panel/IndicatorItem.qml (+6/-2)
Panel/IndicatorRow.qml (+2/-0)
tests/unittests/CMakeLists.txt (+2/-1)
tests/unittests/Panel/CMakeLists.txt (+1/-0)
tests/unittests/Panel/tst_IndicatorItem.qml (+81/-0)
To merge this branch: bzr merge lp:~unity-team/unity/phablet.test_IndicatorItem
Reviewer Review Type Date Requested Status
PS Jenkins bot (community) continuous-integration Approve
Michael Zanetti (community) Approve
Michał Sawicz Needs Fixing
Nick Dedekind Pending
Review via email: mp+157919@code.launchpad.net

Commit message

Adds tests for IndicatorItem

Description of the change

Adds tests for IndicatorItem

To post a comment you must log in.
Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Approve (continuous-integration)
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: Approve (continuous-integration)
Revision history for this message
Michael Zanetti (mzanetti) wrote :

Now that IndicatorItem is changed to have public properties, you should set them in IndicatorRow.qml. Right now Indicators are broken.

Just add this to the IndicatorItem in IndicatorRow.qml

label: model.label
iconSource: model.iconSource

(I'm wondering if we also should fix tst_IndicatorRow to actually find such issues. Tests are still passing even though it is broken)

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

lgtm

review: Approve
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)
Revision history for this message
Francis Ginther (fginther) wrote :

Last autolanding attempt was aborted so that the job configuration could be updated. A rebuild has already been started.

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

There's a conflict now.

Revision history for this message
Michał Sawicz (saviq) wrote :

Still conflicting!

review: Needs Fixing
Revision history for this message
Michael Zanetti (mzanetti) wrote :

lgtm

review: Approve
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) :
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/IndicatorItem.qml'
2--- Panel/IndicatorItem.qml 2013-04-05 12:44:49 +0000
3+++ Panel/IndicatorItem.qml 2013-04-12 13:17:26 +0000
4@@ -20,6 +20,8 @@
5 Item {
6 id: indicatorItem
7
8+ property alias iconSource: itemImage.source
9+ property alias label: itemLabel.text
10 property bool highlighted: false
11 property bool dimmed: false
12
13@@ -37,6 +39,7 @@
14
15 Row {
16 id: itemRow
17+ objectName: "itemRow"
18 anchors {
19 top: parent.top
20 bottom: parent.bottom
21@@ -46,7 +49,8 @@
22 opacity: dimmed ? 0.4 : 1
23
24 Image {
25- source: iconSource
26+ id: itemImage
27+ objectName: "itemImage"
28 visible: source != ""
29 height: units.gu(2.5)
30 width: units.gu(2.5)
31@@ -55,7 +59,7 @@
32
33 Label {
34 id: itemLabel
35- text: label
36+ objectName: "itemLabel"
37 color: "#f3f3e7"
38 opacity: 0.8
39 font.family: "Ubuntu"
40
41=== modified file 'Panel/IndicatorRow.qml'
42--- Panel/IndicatorRow.qml 2013-04-05 12:44:49 +0000
43+++ Panel/IndicatorRow.qml 2013-04-12 13:17:26 +0000
44@@ -59,6 +59,8 @@
45
46 property int ownIndex: index
47
48+ label: model.label
49+ iconSource: model.iconSource
50 highlighted: indicatorRow.state == "reveal" || indicatorRow.state == "locked" || indicatorRow.state == "commit" ? ownIndex == indicatorRow.currentItemIndex : false
51 dimmed: { //See FIXME in Indicators regarding the "states" change
52 if (indicatorRow.state == "initial" || indicatorRow.state == "") {
53
54=== modified file 'tests/unittests/CMakeLists.txt'
55--- tests/unittests/CMakeLists.txt 2013-04-12 07:49:37 +0000
56+++ tests/unittests/CMakeLists.txt 2013-04-12 13:17:26 +0000
57@@ -4,5 +4,6 @@
58 set(qmltest_DEFAULT_PROPERTIES PROPERTIES ENVIRONMENT "QT_QPA_PLATFORM=minimal")
59
60 add_subdirectory(Components)
61+add_subdirectory(Panel)
62 add_subdirectory(SideStage)
63-add_subdirectory(plugins)
64\ No newline at end of file
65+add_subdirectory(plugins)
66
67=== added directory 'tests/unittests/Panel'
68=== added file 'tests/unittests/Panel/CMakeLists.txt'
69--- tests/unittests/Panel/CMakeLists.txt 1970-01-01 00:00:00 +0000
70+++ tests/unittests/Panel/CMakeLists.txt 2013-04-12 13:17:26 +0000
71@@ -0,0 +1,1 @@
72+add_qml_test(IndicatorItem)
73
74=== added file 'tests/unittests/Panel/tst_IndicatorItem.qml'
75--- tests/unittests/Panel/tst_IndicatorItem.qml 1970-01-01 00:00:00 +0000
76+++ tests/unittests/Panel/tst_IndicatorItem.qml 2013-04-12 13:17:26 +0000
77@@ -0,0 +1,81 @@
78+/*
79+ * Copyright 2013 Canonical Ltd.
80+ *
81+ * This program is free software; you can redistribute it and/or modify
82+ * it under the terms of the GNU General Public License as published by
83+ * the Free Software Foundation; version 3.
84+ *
85+ * This program is distributed in the hope that it will be useful,
86+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
87+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
88+ * GNU General Public License for more details.
89+ *
90+ * You should have received a copy of the GNU General Public License
91+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
92+ */
93+
94+import QtQuick 2.0
95+import QtTest 1.0
96+import "../../qmluitests"
97+import "../../../Panel"
98+import Ubuntu.Components 0.1
99+
100+Rectangle {
101+ width: units.gu(10)
102+ height: units.gu(5)
103+ color: "black"
104+
105+ IndicatorItem {
106+ id: indicatorItem
107+ anchors.fill: parent
108+ iconSource: "../../../Panel/graphics/Clock.png"
109+ label: "Clock"
110+ }
111+
112+ UnityTestCase {
113+ name: "IndicatorItem"
114+
115+ function init_test() {
116+ indicatorItem.iconSource = "../../../Panel/graphics/Clock.png"
117+ indicatorItem.label = "Clock"
118+ }
119+
120+ function test_dimmed() {
121+ init_test()
122+
123+ var itemRow = findChild(indicatorItem, "itemRow")
124+ indicatorItem.dimmed = true
125+ compare(itemRow.opacity > 0, true, "IndicatorItem opacity should not be 0")
126+ compare(itemRow.opacity < 1, true, "IndicatorItem opacity should not be 1")
127+ }
128+
129+ function test_empty() {
130+ init_test()
131+
132+ indicatorItem.iconSource = ""
133+ indicatorItem.label = ""
134+ compare(indicatorItem.visible, false, "IndicatorItem should not be visible")
135+ }
136+
137+ function test_noLabel() {
138+ init_test()
139+
140+ var itemImage = findChild(indicatorItem, "itemImage")
141+ var itemLabel = findChild(indicatorItem, "itemLabel")
142+ indicatorItem.label = ""
143+ compare(itemImage.visible, true, "The image should be visible")
144+ compare(itemImage.width > 0, true, "The image should have a positive width")
145+ compare(itemLabel.width > 0, false, "The label should not have a positive width")
146+ }
147+
148+ function test_noImage() {
149+ init_test()
150+
151+ var itemImage = findChild(indicatorItem, "itemImage")
152+ var itemLabel = findChild(indicatorItem, "itemLabel")
153+ indicatorItem.iconSource = ""
154+ compare(itemImage.visible, false, "The image should not be visible")
155+ compare(itemLabel.width > 0, true, "The label should have a positive width")
156+ }
157+ }
158+}

Subscribers

People subscribed via source and target branches

to all changes: