Merge lp:~zsombi/ubuntu-ui-toolkit/fixComboButton into lp:ubuntu-ui-toolkit

Proposed by Zsombor Egri
Status: Merged
Approved by: Zoltan Balogh
Approved revision: 1315
Merged at revision: 1316
Proposed branch: lp:~zsombi/ubuntu-ui-toolkit/fixComboButton
Merge into: lp:ubuntu-ui-toolkit
Diff against target: 259 lines (+244/-0)
2 files modified
src/Ubuntu/Components/1.3/ComboButton.qml (+9/-0)
tests/unit_x11/tst_components/tst_combobutton13.qml (+235/-0)
To merge this branch: bzr merge lp:~zsombi/ubuntu-ui-toolkit/fixComboButton
Reviewer Review Type Date Requested Status
Renato Araujo Oliveira Filho (community) test Approve
PS Jenkins bot continuous-integration Needs Fixing
Ubuntu SDK team Pending
Review via email: mp+294387@code.launchpad.net

Commit message

Fix regression introduced in ComboButton due to the binding loop bug on AbstractButton implicit sizes.

To post a comment you must log in.
Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Needs Fixing (continuous-integration)
Revision history for this message
Renato Araujo Oliveira Filho (renatofilho) wrote :

I can confirm that fixes the address book app problem.

review: Approve (test)

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
=== modified file 'src/Ubuntu/Components/1.3/ComboButton.qml'
--- src/Ubuntu/Components/1.3/ComboButton.qml 2016-03-01 19:00:50 +0000
+++ src/Ubuntu/Components/1.3/ComboButton.qml 2016-05-11 15:40:04 +0000
@@ -301,6 +301,15 @@
301301
302 // update sensing area to report clicks only on the main button area302 // update sensing area to report clicks only on the main button area
303 // area excluding dropDown button and combo list303 // area excluding dropDown button and combo list
304 Component.onCompleted: {
305 __mouseArea.anchors.rightMargin = Qt.binding(function() {
306 return combo.__styleInstance.dropDownWidth;
307 });
308 __mouseArea.anchors.bottomMargin = Qt.binding(function () {
309 return combo.expanded ? (combo.height - combo.collapsedHeight) : 0;
310 });
311 }
312
304 sensingMargins {313 sensingMargins {
305 bottom: -(combo.height - combo.collapsedHeight)314 bottom: -(combo.height - combo.collapsedHeight)
306 right: -combo.__styleInstance.dropDownWidth315 right: -combo.__styleInstance.dropDownWidth
307316
=== added file 'tests/unit_x11/tst_components/tst_combobutton13.qml'
--- tests/unit_x11/tst_components/tst_combobutton13.qml 1970-01-01 00:00:00 +0000
+++ tests/unit_x11/tst_components/tst_combobutton13.qml 2016-05-11 15:40:04 +0000
@@ -0,0 +1,235 @@
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.4
18import QtTest 1.0
19import Ubuntu.Test 1.3
20import Ubuntu.Components 1.3
21import Ubuntu.Components.ListItems 1.3
22
23Item {
24 width: units.gu(40)
25 height: units.gu(71)
26
27 Column {
28 ComboButton {
29 id: combo
30 }
31
32 ComboButton {
33 id: rectCombo
34 onClicked: expanded = false
35
36 Rectangle {
37 id: rect
38 width: parent.width
39 height: units.gu(40)
40 gradient: Gradient {
41 GradientStop {
42 position: 0.0
43 color: "red"
44 }
45 GradientStop {
46 position: 0.5
47 color: "green"
48 }
49 GradientStop {
50 position: 1.0
51 color: "blue"
52 }
53 }
54 }
55 }
56
57 ComboButton {
58 id: columnCombo
59 expandedHeight: -1
60 Column {
61 id: column
62 anchors {
63 left: parent.left
64 right: parent.right
65 }
66 height: childrenRect.height
67 Repeater {
68 model: 5
69 Rectangle {
70 width: parent.width
71 height: units.gu(5)
72 color: Qt.rgba(Math.random(1), Math.random(1), Math.random(1), 1);
73 }
74 }
75 }
76 }
77
78 ComboButton {
79 id: longCombo
80 expandedHeight: units.gu(40)
81 Rectangle {
82 id: longRect
83 height: units.gu(10)
84 color: "cyan"
85 }
86 }
87
88 ComboButton {
89 id: listCombo
90 ListView {
91 id: list
92 model: 20
93 height: listCombo.comboListHeight
94 delegate: Standard {
95 text: modelData
96 }
97 }
98 }
99 }
100
101 SignalSpy { id: spy }
102
103 UbuntuTestCase {
104 name: "ComboButton"
105 when: windowShown
106
107 function cleanup() {
108 rectCombo.expanded =
109 columnCombo.expanded =
110 longCombo.expanded =
111 listCombo.expanded = false;
112 spy.clear();
113 spy.signalName = "";
114 spy.target = undefined;
115 }
116
117 function test_0_defaults() {
118 compare(combo.expanded, false, "not expanded by default");
119 compare(combo.collapsedHeight, combo.implicitHeight, "collapsedHeight is implicitHeight");
120 compare(combo.expandedHeight, combo.collapsedHeight + units.gu(19.5), "expanded height default");
121 var lheight = combo.expandedHeight - combo.collapsedHeight - combo.__styleInstance.comboListMargin;
122 compare(combo.comboListHeight, lheight, "comboListHeight default");
123 compare(combo.comboList.length, 0, "comboList is empty");
124 verify(combo.font === Qt.font({family: "Ubuntu", pixelSize: FontUtils.sizeToPixels("medium")}), "Default font differs.");
125 }
126
127 function test_comboListWidth() {
128 var comboListHolder = findChild(rectCombo, "combobutton_combolist");
129 compare(rect.width, comboListHolder.width, "rectCombo list content width is not adjusted");
130 comboListHolder = findChild(columnCombo, "combobutton_combolist");
131 compare(column.width, comboListHolder.width, "columnCombo list content width is not adjusted");
132 comboListHolder = findChild(longCombo, "combobutton_combolist");
133 compare(longRect.width, comboListHolder.width, "longCombo list content width is not adjusted");
134 comboListHolder = findChild(listCombo, "combobutton_combolist");
135 compare(list.width, comboListHolder.width, "listCombo list content width is not adjusted");
136 }
137
138 function test_expandRectComboThroughProperty() {
139 rectCombo.expanded = true;
140 waitForRendering(rectCombo);
141 var comboListPanel = findChild(rectCombo, "combobutton_combopanel");
142 tryCompareFunction(function() { return comboListPanel.opacity}, 1.0);
143 }
144
145 function test_expandRectComboThroughClick() {
146 var dropDown = findChild(rectCombo, "combobutton_dropdown");
147 mouseClick(dropDown, dropDown.width / 2, dropDown.height / 2);
148 waitForRendering(rectCombo);
149 compare(rectCombo.expanded, true, "combo is not expanded");
150 var comboListPanel = findChild(rectCombo, "combobutton_combopanel");
151 tryCompareFunction(function() { return comboListPanel.opacity}, 1.0);
152 }
153
154 function test_autoCollapse() {
155 var dropDown = findChild(rectCombo, "combobutton_dropdown");
156 var comboListPanel = findChild(rectCombo, "combobutton_combopanel");
157 mouseClick(dropDown, dropDown.width / 2, dropDown.height / 2);
158 waitForRendering(rectCombo);
159 compare(rectCombo.expanded, true, "combo is not expanded");
160 tryCompareFunction(function() { return comboListPanel.opacity}, 1.0);
161
162 mouseClick(rectCombo, rectCombo.width / 2, rectCombo.collapsedHeight / 2);
163 waitForRendering(rectCombo);
164 compare(rectCombo.expanded, false, "combo is not collapsed");
165 tryCompareFunction(function() { return comboListPanel.opacity}, 0.0);
166 }
167
168 function test_flickRectCombo() {
169 // skip the test temporarily due to flakyness on powerpc target
170 // https://bugs.launchpad.net/ubuntu-ui-toolkit/+bug/1315244
171 skip("The test is flaky on powerpc target");
172 var dropDown = findChild(rectCombo, "combobutton_dropdown");
173 var comboListPanel = findChild(rectCombo, "combobutton_combopanel");
174 var comboList = findChild(rectCombo, "combobutton_combolist");
175 mouseClick(dropDown, dropDown.width / 2, dropDown.height / 2);
176 waitForRendering(rectCombo);
177 tryCompareFunction(function() { return comboListPanel.opacity}, 1.0);
178 verify(comboList.height > rectCombo.expandedHeight);
179 // comboList flicker is the combolist parent's parent
180 var comboListFlicker = findChild(rectCombo, "combobutton_contentflicker");
181 compare(comboListFlicker.interactive, true, "combo list holder must be interactive");
182
183 // drag the rectangle, the Flickable should be moving
184 var x = comboListFlicker.width / 2;
185 var y = comboListFlicker.height / 2;
186 var dy = comboListFlicker.height / 6;
187 spy.target = comboListFlicker;
188 spy.signalName = "onMovementEnded";
189 mouseDrag(comboList, x, y, 0, -dy);
190 waitForRendering(comboListFlicker);
191 spy.wait();
192 }
193
194 function test_autoExpandHeight() {
195 var comboListPanel = findChild(columnCombo, "combobutton_combopanel");
196 var comboList = findChild(columnCombo, "combobutton_combolist");
197 columnCombo.expanded = true;
198 waitForRendering(columnCombo);
199 tryCompareFunction(function() { return comboListPanel.opacity}, 1.0);
200 var comboListFlicker = findChild(columnCombo, "combobutton_contentflicker");
201 compare(comboListFlicker.interactive, false, "combo list holder must not be interactive");
202 compare(comboListFlicker.height, columnCombo.comboListHeight, "combo list height differs from the holder height");
203 }
204
205 function test_emptyComboExpanded() {
206 var comboListPanel = findChild(combo, "combobutton_combopanel");
207 var comboList = findChild(combo, "combobutton_combolist");
208 combo.expanded = true;
209 waitForRendering(combo);
210 waitForRendering(comboListPanel);
211 tryCompareFunction(function() { return comboListPanel.opacity}, 0.0, 1000);
212 }
213
214 function test_longCombo() {
215 var comboListPanel = findChild(longCombo, "combobutton_combopanel");
216 var comboList = findChild(longCombo, "combobutton_combolist");
217 longCombo.expanded = true;
218 waitForRendering(longCombo);
219 waitForRendering(comboListPanel);
220 tryCompareFunction(function() { return comboListPanel.opacity}, 1.0);
221 verify(comboListPanel.height < longCombo.expandedHeight);
222 }
223
224 function test_listCombo() {
225 var comboListPanel = findChild(listCombo, "combobutton_combopanel");
226 var comboList = findChild(listCombo, "combobutton_combolist");
227 listCombo.expanded = true;
228 waitForRendering(listCombo);
229 waitForRendering(comboListPanel);
230 tryCompareFunction(function() { return comboListPanel.opacity}, 1.0);
231
232 compare(list.height, comboList.height, "list and comboList height differs");
233 }
234 }
235}

Subscribers

People subscribed via source and target branches

to status/vote changes: