Merge lp:~aacid/unity8/tablePreviewWidget into lp:unity8
- tablePreviewWidget
- Merge into trunk
Status: | Superseded |
---|---|
Proposed branch: | lp:~aacid/unity8/tablePreviewWidget |
Merge into: | lp:unity8 |
Prerequisite: | lp:~aacid/unity8/scopeSearchHintText |
Diff against target: |
261 lines (+202/-1) 6 files modified
qml/Dash/Previews/PreviewTable.qml (+80/-0) qml/Dash/Previews/PreviewWidgetFactory.qml (+1/-0) tests/qmltests/CMakeLists.txt (+1/-0) tests/qmltests/Dash/Previews/tst_PreviewExpandable.qml (+5/-1) tests/qmltests/Dash/Previews/tst_PreviewTable.qml (+114/-0) tests/qmltests/Dash/Previews/tst_PreviewWidgetFactory.qml (+1/-0) |
To merge this branch: | bzr merge lp:~aacid/unity8/tablePreviewWidget |
Related bugs: |
Reviewer | Review Type | Date Requested | Status |
---|---|---|---|
PS Jenkins bot (community) | continuous-integration | Needs Fixing | |
Michal Hruby | Pending | ||
Review via email: mp+230051@code.launchpad.net |
This proposal supersedes a proposal from 2014-08-08.
This proposal has been superseded by a proposal from 2014-08-14.
Commit message
Table Preview Widget
Description of the change
* Are there any related MPs required for this MP to build/function as expected?
Prereq
* Did you perform an exploratory manual test run of your code change and any related functionality?
Yes, only using tests though since no scope uses it
* Did you make sure that your branch does not contain spurious tags?
Yes
* If you changed the packaging (debian), did you subscribe the ubuntu-unity team to this MP?
N/A
* If you changed the UI, has there been a design review?
N/A
PS Jenkins bot (ps-jenkins) wrote : Posted in a previous version of this proposal | # |
PS Jenkins bot (ps-jenkins) wrote : Posted in a previous version of this proposal | # |
FAILED: Continuous integration, rev:1094
http://
Executed test runs:
SUCCESS: http://
UNSTABLE: http://
SUCCESS: http://
SUCCESS: http://
deb: http://
SUCCESS: http://
SUCCESS: http://
SUCCESS: http://
deb: http://
SUCCESS: http://
Click here to trigger a rebuild:
http://
PS Jenkins bot (ps-jenkins) wrote : Posted in a previous version of this proposal | # |
FAILED: Continuous integration, rev:1095
http://
Executed test runs:
SUCCESS: http://
UNSTABLE: http://
SUCCESS: http://
SUCCESS: http://
deb: http://
SUCCESS: http://
SUCCESS: http://
SUCCESS: http://
deb: http://
SUCCESS: http://
Click here to trigger a rebuild:
http://
Michal Hruby (mhr3) wrote : Posted in a previous version of this proposal | # |
Weren't there designs that also had table headers? Should probably support that too...
Albert Astals Cid (aacid) wrote : Posted in a previous version of this proposal | # |
Maybe they were designs with headers, but there is no mention of headers in the previews spec and i have not seen any design with headers.
PS Jenkins bot (ps-jenkins) wrote : Posted in a previous version of this proposal | # |
FAILED: Continuous integration, rev:1096
http://
Executed test runs:
UNSTABLE: http://
SUCCESS: http://
SUCCESS: http://
SUCCESS: http://
deb: http://
SUCCESS: http://
UNSTABLE: http://
SUCCESS: http://
deb: http://
SUCCESS: http://
Click here to trigger a rebuild:
http://
PS Jenkins bot (ps-jenkins) wrote : Posted in a previous version of this proposal | # |
FAILED: Continuous integration, rev:1097
http://
Executed test runs:
SUCCESS: http://
FAILURE: http://
SUCCESS: http://
SUCCESS: http://
deb: http://
SUCCESS: http://
SUCCESS: http://
SUCCESS: http://
deb: http://
SUCCESS: http://
Click here to trigger a rebuild:
http://
- 1099. By Albert Astals Cid
-
Merge
PS Jenkins bot (ps-jenkins) wrote : | # |
FAILED: Continuous integration, rev:1098
http://
Executed test runs:
SUCCESS: http://
FAILURE: http://
SUCCESS: http://
FAILURE: http://
SUCCESS: http://
SUCCESS: http://
SUCCESS: http://
deb: http://
Click here to trigger a rebuild:
http://
PS Jenkins bot (ps-jenkins) wrote : | # |
FAILED: Continuous integration, rev:1099
http://
Executed test runs:
SUCCESS: http://
FAILURE: http://
SUCCESS: http://
SUCCESS: http://
deb: http://
SUCCESS: http://
SUCCESS: http://
SUCCESS: http://
deb: http://
SUCCESS: http://
Click here to trigger a rebuild:
http://
Unmerged revisions
Preview Diff
1 | === added file 'qml/Dash/Previews/PreviewTable.qml' |
2 | --- qml/Dash/Previews/PreviewTable.qml 1970-01-01 00:00:00 +0000 |
3 | +++ qml/Dash/Previews/PreviewTable.qml 2014-08-08 09:23:52 +0000 |
4 | @@ -0,0 +1,80 @@ |
5 | +/* |
6 | + * Copyright (C) 2014 Canonical, Ltd. |
7 | + * |
8 | + * This program is free software; you can redistribute it and/or modify |
9 | + * it under the terms of the GNU General Public License as published by |
10 | + * the Free Software Foundation; version 3. |
11 | + * |
12 | + * This program is distributed in the hope that it will be useful, |
13 | + * but WITHOUT ANY WARRANTY; without even the implied warranty of |
14 | + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
15 | + * GNU General Public License for more details. |
16 | + * |
17 | + * You should have received a copy of the GNU General Public License |
18 | + * along with this program. If not, see <http://www.gnu.org/licenses/>. |
19 | + */ |
20 | + |
21 | +import QtQuick 2.0 |
22 | +import QtQuick.Layouts 1.1 |
23 | +import Ubuntu.Components 0.1 |
24 | +import "../../Components" |
25 | + |
26 | +/*! \brief Preview widget for table. |
27 | + |
28 | + This widget shows two columns contained in widgetData["values"] |
29 | + as arrays of label,value along with a title that comes from widgetData["title"]. |
30 | + |
31 | + In case the widget is collapsed it only shows 3 lines of values. |
32 | + */ |
33 | + |
34 | +PreviewWidget { |
35 | + id: root |
36 | + implicitHeight: column.implicitHeight |
37 | + |
38 | + readonly property int maximumCollapsedRowCount: 3 |
39 | + |
40 | + Column { |
41 | + id: column |
42 | + objectName: "column" |
43 | + spacing: units.gu(1) |
44 | + |
45 | + Label { |
46 | + id: titleLabel |
47 | + objectName: "titleLabel" |
48 | + anchors { |
49 | + left: parent.left |
50 | + right: parent.right |
51 | + } |
52 | + height: visible ? implicitHeight : 0 |
53 | + fontSize: "large" |
54 | + color: root.scopeStyle ? root.scopeStyle.foreground : "grey" |
55 | + visible: text !== "" |
56 | + opacity: .8 |
57 | + text: widgetData["title"] || "" |
58 | + } |
59 | + |
60 | + GridLayout { |
61 | + objectName: "gridLayout" |
62 | + columns: 2 |
63 | + columnSpacing: units.gu(2) |
64 | + Repeater { |
65 | + id: rowsRepeater |
66 | + model: widgetData["values"] |
67 | + |
68 | + delegate: Repeater { |
69 | + id: perRowRepeater |
70 | + readonly property int rowIndex: index |
71 | + model: widgetData["values"][index] |
72 | + delegate: Label { |
73 | + objectName: "label"+rowIndex+index |
74 | + fontSize: "small" |
75 | + text: perRowRepeater.model[index] |
76 | + visible: root.expanded || rowIndex < maximumCollapsedRowCount |
77 | + color: root.scopeStyle ? root.scopeStyle.foreground : "grey" |
78 | + font.bold: index == 0 |
79 | + } |
80 | + } |
81 | + } |
82 | + } |
83 | + } |
84 | +} |
85 | |
86 | === modified file 'qml/Dash/Previews/PreviewWidgetFactory.qml' |
87 | --- qml/Dash/Previews/PreviewWidgetFactory.qml 2014-07-30 14:08:29 +0000 |
88 | +++ qml/Dash/Previews/PreviewWidgetFactory.qml 2014-08-08 09:23:52 +0000 |
89 | @@ -58,6 +58,7 @@ |
90 | case "payments": return "PreviewPayments.qml"; |
91 | case "rating-input": return "PreviewRatingInput.qml"; |
92 | case "reviews": return "PreviewRatingDisplay.qml"; |
93 | + case "table": return "PreviewTable.qml"; |
94 | case "text": return "PreviewTextSummary.qml"; |
95 | case "video": return "PreviewVideoPlayback.qml"; |
96 | default: return ""; |
97 | |
98 | === modified file 'tests/qmltests/CMakeLists.txt' |
99 | --- tests/qmltests/CMakeLists.txt 2014-08-01 07:38:01 +0000 |
100 | +++ tests/qmltests/CMakeLists.txt 2014-08-08 09:23:52 +0000 |
101 | @@ -49,6 +49,7 @@ |
102 | add_qml_test(Dash/Previews PreviewProgress) |
103 | add_qml_test(Dash/Previews PreviewRatingDisplay) |
104 | add_qml_test(Dash/Previews PreviewRatingInput) |
105 | +add_qml_test(Dash/Previews PreviewTable) |
106 | add_qml_test(Dash/Previews PreviewTextSummary) |
107 | add_qml_test(Dash/Previews PreviewVideoPlayback) |
108 | add_qml_test(Dash/Previews PreviewWidgetFactory) |
109 | |
110 | === modified file 'tests/qmltests/Dash/Previews/tst_PreviewExpandable.qml' |
111 | --- tests/qmltests/Dash/Previews/tst_PreviewExpandable.qml 2014-07-30 14:16:03 +0000 |
112 | +++ tests/qmltests/Dash/Previews/tst_PreviewExpandable.qml 2014-08-08 09:23:52 +0000 |
113 | @@ -30,12 +30,16 @@ |
114 | property string longText2: "This is a very very very long text. 1 This is a very very very long text. 2 This is a very very very long text. 3 This is a very very very long text. 4 This is a very very very long text. 5 This is a very very very long text. 6 This is a very very very long text. 7 This is a very very very long text. 8 This is a very very very long text. 9 This is a very very very long text. 10 This is a very very very long text. 11 This is a very very very long text." |
115 | property string shortText: "This is a short text :)" |
116 | |
117 | + property var tableData: { |
118 | + "values": [ [ "Long Label 1", "Value 1"], [ "Label 2", "Long Value 2"], [ "Label 3", "Value 3"], [ "Label 4", "Value 4"], [ "Label 5", "Value 5"] ] |
119 | + } |
120 | + |
121 | property var widgetData: { |
122 | "title": "Title here", |
123 | "collapsed-widgets": 2, |
124 | "widgets": [ |
125 | { "type": "text", "widgetId" : "text1", "properties" : { "text": longText } }, |
126 | - { "type": "text", "widgetId" : "text2", "properties" : { "text": longText2 } }, |
127 | + { "type": "table", "widgetId" : "table1", "properties" : tableData }, |
128 | { "type": "text", "widgetId" : "text3", "properties" : { "text": shortText } }, |
129 | { "type": "text", "widgetId" : "text4", "properties" : { "text": longText } } |
130 | ] |
131 | |
132 | === added file 'tests/qmltests/Dash/Previews/tst_PreviewTable.qml' |
133 | --- tests/qmltests/Dash/Previews/tst_PreviewTable.qml 1970-01-01 00:00:00 +0000 |
134 | +++ tests/qmltests/Dash/Previews/tst_PreviewTable.qml 2014-08-08 09:23:52 +0000 |
135 | @@ -0,0 +1,114 @@ |
136 | +/* |
137 | + * Copyright 2014 Canonical Ltd. |
138 | + * |
139 | + * This program is free software; you can redistribute it and/or modify |
140 | + * it under the terms of the GNU General Public License as published by |
141 | + * the Free Software Foundation; version 3. |
142 | + * |
143 | + * This program is distributed in the hope that it will be useful, |
144 | + * but WITHOUT ANY WARRANTY; without even the implied warranty of |
145 | + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
146 | + * GNU General Public License for more details. |
147 | + * |
148 | + * You should have received a copy of the GNU General Public License |
149 | + * along with this program. If not, see <http://www.gnu.org/licenses/>. |
150 | + */ |
151 | + |
152 | +import QtQuick 2.0 |
153 | +import QtTest 1.0 |
154 | +import Ubuntu.Components 0.1 |
155 | +import "../../../../qml/Dash/Previews" |
156 | +import Unity.Test 0.1 as UT |
157 | + |
158 | +Rectangle { |
159 | + id: root |
160 | + width: units.gu(40) |
161 | + height: units.gu(80) |
162 | + color: Theme.palette.selected.background |
163 | + |
164 | + property var widgetDataComplete: { |
165 | + "title": "Title here", |
166 | + "values": [ [ "Long Label 1", "Value 1"], [ "Label 2", "Long Value 2"], [ "Label 3", "Value 3"], [ "Label 4", "Value 4"], [ "Label 5", "Value 5"] ] |
167 | + } |
168 | + |
169 | + property var widgetDataNoTitle: { |
170 | + "values": [ [ "Long Label 1", "Value 1"], [ "Label 2", "Long Value 2"], [ "Label 3", "Value 3"], [ "Label 4", "Value 4"], [ "Label 5", "Value 5"] ] |
171 | + } |
172 | + |
173 | + PreviewTable { |
174 | + id: previewTable |
175 | + anchors { left: parent.left; right: parent.right } |
176 | + widgetData: widgetDataComplete |
177 | + |
178 | + Rectangle { |
179 | + color: "red" |
180 | + anchors.fill: parent |
181 | + opacity: 0.5 |
182 | + } |
183 | + } |
184 | + |
185 | + UT.UnityTestCase { |
186 | + name: "PreviewTableTest" |
187 | + when: windowShown |
188 | + |
189 | + function init() { |
190 | + previewTable.widgetData = widgetDataComplete; |
191 | + } |
192 | + |
193 | + function test_values() { |
194 | + compare(findChild(previewTable, "label00").text, "Long Label 1"); |
195 | + compare(findChild(previewTable, "label01").text, "Value 1"); |
196 | + compare(findChild(previewTable, "label10").text, "Label 2"); |
197 | + compare(findChild(previewTable, "label11").text, "Long Value 2"); |
198 | + compare(findChild(previewTable, "label20").text, "Label 3"); |
199 | + compare(findChild(previewTable, "label21").text, "Value 3"); |
200 | + compare(findChild(previewTable, "label30").text, "Label 4"); |
201 | + compare(findChild(previewTable, "label31").text, "Value 4"); |
202 | + compare(findChild(previewTable, "label40").text, "Label 5"); |
203 | + compare(findChild(previewTable, "label41").text, "Value 5"); |
204 | + } |
205 | + |
206 | + function test_optional_title() { |
207 | + var titleLabel = findChild(previewTable, "titleLabel"); |
208 | + compare(titleLabel.visible, true); |
209 | + var titleHeight = titleLabel.height; |
210 | + var prevHeight = previewTable.height; |
211 | + |
212 | + previewTable.widgetData = widgetDataNoTitle; |
213 | + var column = findChild(previewTable, "column"); |
214 | + tryCompare(previewTable, "height", prevHeight - titleHeight - column.spacing ); |
215 | + } |
216 | + |
217 | + function test_show_collapsed() { |
218 | + verify(findChild(previewTable, "label00").visible); |
219 | + verify(findChild(previewTable, "label01").visible); |
220 | + verify(findChild(previewTable, "label10").visible); |
221 | + verify(findChild(previewTable, "label11").visible); |
222 | + verify(findChild(previewTable, "label20").visible); |
223 | + verify(findChild(previewTable, "label21").visible); |
224 | + verify(findChild(previewTable, "label30").visible); |
225 | + verify(findChild(previewTable, "label31").visible); |
226 | + verify(findChild(previewTable, "label40").visible); |
227 | + verify(findChild(previewTable, "label41").visible); |
228 | + |
229 | + waitForRendering(previewTable); |
230 | + var prevHeight = previewTable.height; |
231 | + previewTable.expanded = false; |
232 | + |
233 | + verify(findChild(previewTable, "label00").visible); |
234 | + verify(findChild(previewTable, "label01").visible); |
235 | + verify(findChild(previewTable, "label10").visible); |
236 | + verify(findChild(previewTable, "label11").visible); |
237 | + verify(findChild(previewTable, "label20").visible); |
238 | + verify(findChild(previewTable, "label21").visible); |
239 | + verify(!findChild(previewTable, "label30").visible); |
240 | + verify(!findChild(previewTable, "label31").visible); |
241 | + verify(!findChild(previewTable, "label40").visible); |
242 | + verify(!findChild(previewTable, "label41").visible); |
243 | + |
244 | + var labelHeight = findChild(previewTable, "label00").height; |
245 | + var gridLayout = findChild(previewTable, "gridLayout"); |
246 | + tryCompare(previewTable, "height", prevHeight - labelHeight * 2 - gridLayout.rowSpacing * 2); |
247 | + } |
248 | + } |
249 | +} |
250 | |
251 | === modified file 'tests/qmltests/Dash/Previews/tst_PreviewWidgetFactory.qml' |
252 | --- tests/qmltests/Dash/Previews/tst_PreviewWidgetFactory.qml 2014-07-30 14:08:29 +0000 |
253 | +++ tests/qmltests/Dash/Previews/tst_PreviewWidgetFactory.qml 2014-08-08 09:23:52 +0000 |
254 | @@ -84,6 +84,7 @@ |
255 | { tag: "Progress", type: "progress", source: "PreviewProgress.qml" }, |
256 | { tag: "Rating Input", type: "rating-input", source: "PreviewRatingInput.qml" }, |
257 | { tag: "Rating Display", type: "reviews", source: "PreviewRatingDisplay.qml" }, |
258 | + { tag: "Table", type: "table", source: "PreviewTable.qml" }, |
259 | { tag: "Text", type: "text", source: "PreviewTextSummary.qml" }, |
260 | { tag: "Video", type: "video", source: "PreviewVideoPlayback.qml" }, |
261 | ]; |
FAILED: Continuous integration, rev:1093 jenkins. qa.ubuntu. com/job/ unity8- ci/3700/ jenkins. qa.ubuntu. com/job/ generic- deb-autopilot- utopic- touch/2813/ console jenkins. qa.ubuntu. com/job/ unity-phablet- qmluitests- utopic/ 702/console jenkins. qa.ubuntu. com/job/ unity8- utopic- amd64-ci/ 794/console jenkins. qa.ubuntu. com/job/ unity8- utopic- armhf-ci/ 794/console jenkins. qa.ubuntu. com/job/ unity8- utopic- i386-ci/ 794/console jenkins. qa.ubuntu. com/job/ generic- mediumtests- builder- utopic- armhf/4056/ console
http://
Executed test runs:
FAILURE: http://
FAILURE: http://
FAILURE: http://
FAILURE: http://
FAILURE: http://
FAILURE: http://
Click here to trigger a rebuild: s-jenkins. ubuntu- ci:8080/ job/unity8- ci/3700/ rebuild
http://