on xenial help sign in
Fixed tests & regressions
2274059Nick Dedekind
Panel/IndicatorItem.qml−1
@@ -23,7 +23,6 @@ Item {
23 id: indicatorItem
23 id: indicatorItem
24
24
25 property alias widgetSource: loader.source
25 property alias widgetSource: loader.source
26− property bool highlighted: false
27 property bool dimmed: false
26 property bool dimmed: false
28 property var indicatorProperties: undefined
27 property var indicatorProperties: undefined
29 property bool indicatorVisible: loader.item ? loader.item.enabled : false
28 property bool indicatorVisible: loader.item ? loader.item.enabled : false
Panel/IndicatorRow.qml+15−8
@@ -30,6 +30,7 @@ Item {
30 property int overFlowWidth: width
30 property int overFlowWidth: width
31 property bool showAll: false
31 property bool showAll: false
32 property real currentItemOffset: 0.0
32 property real currentItemOffset: 0.0
33+ property real unitProgress: 0.0
33
34
34 width: units.gu(40)
35 width: units.gu(40)
35 height: units.gu(3)
36 height: units.gu(3)
@@ -80,23 +81,23 @@ Item {
80 height: indicatorRow.height
81 height: indicatorRow.height
81 width: indicatorItem.width
82 width: indicatorItem.width
82 visible: indicatorItem.indicatorVisible
83 visible: indicatorItem.indicatorVisible
83− opacity: 1.0
84+ opacity: 1.0 * opacityMultiplier
84 y: 0
85 y: 0
85 state: "standard"
86 state: "standard"
86
87
87 property int ownIndex: index
88 property int ownIndex: index
88− property alias highlighted: indicatorItem.highlighted
89+ property bool highlighted: indicatorRow.state != "initial" ? ownIndex == indicatorRow.currentItemIndex : false
89− property alias dimmed: indicatorItem.dimmed
90+ property bool dimmed: indicatorRow.state != "initial" ? ownIndex != indicatorRow.currentItemIndex : false
90
91
91− property bool hidden: !showAll && !indicatorItem.highlighted && (indicatorRow.state == "locked" || indicatorRow.state == "commit")
92+ property bool hidden: !showAll && !highlighted && (indicatorRow.state == "locked" || indicatorRow.state == "commit")
92 property bool overflow: row.width - itemWrapper.x > overFlowWidth
93 property bool overflow: row.width - itemWrapper.x > overFlowWidth
94+ property real opacityMultiplier: highlighted ? 1 : (1 -indicatorRow.unitProgress)
93
95
94 IndicatorItem {
96 IndicatorItem {
95 id: indicatorItem
97 id: indicatorItem
96 height: parent.height
98 height: parent.height
97
99
98− highlighted: indicatorRow.state != "initial" ? itemWrapper.ownIndex == indicatorRow.currentItemIndex : false
100+ dimmed: itemWrapper.dimmed
99− dimmed: indicatorRow.state != "initial" ? itemWrapper.ownIndex != indicatorRow.currentItemIndex : false
100
101
101 widgetSource: model.widgetSource
102 widgetSource: model.widgetSource
102 indicatorProperties : model.indicatorProperties
103 indicatorProperties : model.indicatorProperties
@@ -166,7 +167,13 @@ Item {
166 return 0.0;
167 return 0.0;
167 }
168 }
168
169
170+ Behavior on width {
171+ enabled: unitProgress > 0;
169− Behavior on width { UbuntuNumberAnimation { duration: UbuntuAnimation.FastDuration } }
172+ UbuntuNumberAnimation { duration: UbuntuAnimation.FastDuration }
173+ }
174+ Behavior on x {
175+ enabled: unitProgress > 0;
170− Behavior on x { UbuntuNumberAnimation { duration: UbuntuAnimation.FastDuration } }
176+ UbuntuNumberAnimation { duration: UbuntuAnimation.FastDuration }
177+ }
171 }
178 }
172}
179}
Panel/Indicators.qml+8
@@ -39,6 +39,7 @@ Showable {
39 property bool contentEnabled: true
39 property bool contentEnabled: true
40 property bool initalizeItem: true
40 property bool initalizeItem: true
41 readonly property alias content: menuContent
41 readonly property alias content: menuContent
42+ property real unitProgress: 0.0
42
43
43 // TODO: Perhaps we need a animation standard for showing/hiding? Each showable seems to
44 // TODO: Perhaps we need a animation standard for showing/hiding? Each showable seems to
44 // use its own values. Need to ask design about this.
45 // use its own values. Need to ask design about this.
@@ -142,6 +143,9 @@ Showable {
142 }
143 }
143 }
144 }
144 if ((!useBuffer || (useBuffer && bufferExceeded)) || indicatorRow.currentItemIndex < 0 || indicatorRow.currentItem == null) {
145 if ((!useBuffer || (useBuffer && bufferExceeded)) || indicatorRow.currentItemIndex < 0 || indicatorRow.currentItem == null) {
146+ if (initalizeItem) {
147+ indicatorRow.currentItem = null;
148+ }
145 indicatorRow.currentItem = currentItem;
149 indicatorRow.currentItem = currentItem;
146 }
150 }
147
151
@@ -151,6 +155,9 @@ Showable {
151 }
155 }
152 indicatorRow.currentItemOffset = 1 - (distanceFromRightEdge * 2);
156 indicatorRow.currentItemOffset = 1 - (distanceFromRightEdge * 2);
153 } else {
157 } else {
158+ if (initalizeItem) {
159+ indicatorRow.currentItem = null;
160+ }
154 indicatorRow.setDefaultItem();
161 indicatorRow.setDefaultItem();
155 indicatorRow.currentItemOffset = 0;
162 indicatorRow.currentItemOffset = 0;
156 }
163 }
@@ -276,6 +283,7 @@ Showable {
276 height: indicators.panelHeight
283 height: indicators.panelHeight
277 indicatorsModel: indicatorsModel
284 indicatorsModel: indicatorsModel
278 state: indicators.state
285 state: indicators.state
286+ unitProgress: indicators.unitProgress
279
287
280 Connections {
288 Connections {
281 property bool enableIndexChangeSignal: true
289 property bool enableIndexChangeSignal: true
Panel/Panel.qml+1−1
@@ -107,7 +107,7 @@ Item {
107 pinnedMode: !fullscreenMode
107 pinnedMode: !fullscreenMode
108 overFlowWidth: search.state=="hidden" ? parent.width : parent.width - search.width
108 overFlowWidth: search.state=="hidden" ? parent.width : parent.width - search.width
109
109
110− property real unitProgress: (height - panelHeight) / (openedHeight - panelHeight)
110+ unitProgress: (height - panelHeight) / (openedHeight - panelHeight)
111 }
111 }
112
112
113 PanelSeparatorLine {
113 PanelSeparatorLine {
tests/qmltests/Panel/tst_IndicatorItem.qml−11
@@ -41,17 +41,6 @@ Rectangle {
41 tryCompareFunction(function(){return indicatorItem.opacity < 1.0}, true);
41 tryCompareFunction(function(){return indicatorItem.opacity < 1.0}, true);
42 }
42 }
43
43
44− function test_highlight() {
45− var itemHighlight = findChild(indicatorItem, "highlight");
46− verify(itemHighlight != undefined);
47−
48− indicatorItem.highlighted = true;
49− compare(itemHighlight.visible, true, "Indicator should be highlighted");
50−
51− indicatorItem.highlighted = false;
52− compare(itemHighlight.visible, false, "Indicator should not be highlighted");
53− }
54−
55 function test_empty() {
44 function test_empty() {
56 compare(indicatorItem.indicatorVisible, false, "IndicatorItem should not be visible.");
45 compare(indicatorItem.indicatorVisible, false, "IndicatorItem should not be visible.");
57 indicatorItem.widgetSource = "qrc:/tests/indciators/qml/fake_menu_widget1.qml";
46 indicatorItem.widgetSource = "qrc:/tests/indciators/qml/fake_menu_widget1.qml";
tests/qmltests/Panel/tst_IndicatorRow.qml+18−4
@@ -34,6 +34,7 @@ Item {
34 {
34 {
35 indicatorRow.state = "initial";
35 indicatorRow.state = "initial";
36 indicatorRow.currentItem = null;
36 indicatorRow.currentItem = null;
37+ indicatorRow.unitProgress = 0.0;
37 }
38 }
38
39
39 PanelBackground {
40 PanelBackground {
@@ -83,14 +84,13 @@ Item {
83 function test_current_item_commit() {
84 function test_current_item_commit() {
84 init_test();
85 init_test();
85
86
86− indicatorRow.setCurrentItem(1);
87+ indicatorRow.setCurrentItem(2);
87 indicatorRow.state = "commit";
88 indicatorRow.state = "commit";
88 tryCompare(get_indicator_item_at(0), "opacity", 0.0);
89 tryCompare(get_indicator_item_at(0), "opacity", 0.0);
89− tryCompare(get_indicator_item_at(1), "opacity", 1.0);
90+ tryCompare(get_indicator_item_at(1), "opacity", 0.0);
90− tryCompare(get_indicator_item_at(2), "opacity", 0.0);
91+ tryCompare(get_indicator_item_at(2), "opacity", 1.0);
91 tryCompare(get_indicator_item_at(3), "opacity", 0.0);
92 tryCompare(get_indicator_item_at(3), "opacity", 0.0);
92 tryCompare(get_indicator_item_at(4), "opacity", 0.0);
93 tryCompare(get_indicator_item_at(4), "opacity", 0.0);
93−
94 }
94 }
95 }
95 }
96
96
@@ -166,6 +166,20 @@ Item {
166 compare(get_indicator_item_at(3).highlighted, false, "Other indicators should not highlight when in locked state");
166 compare(get_indicator_item_at(3).highlighted, false, "Other indicators should not highlight when in locked state");
167 compare(get_indicator_item_at(4).highlighted, false, "Other indicators should not highlight when in locked state");
167 compare(get_indicator_item_at(4).highlighted, false, "Other indicators should not highlight when in locked state");
168 }
168 }
169+
170+ function test_opacity() {
171+ init_test();
172+
173+ indicatorRow.state = "reveal";
174+ indicatorRow.unitProgress = 0.5;
175+ indicatorRow.setCurrentItem(2);
176+
177+ compare(get_indicator_item_at(0).opacity, 0.5, "Indicator should highlight when in locked state");
178+ compare(get_indicator_item_at(1).opacity, 0.5, "Other indicators should not highlight when in locked state");
179+ compare(get_indicator_item_at(2).opacity, 1.0, "Other indicators should not highlight when in locked state");
180+ compare(get_indicator_item_at(3).opacity, 0.5, "Other indicators should not highlight when in locked state");
181+ compare(get_indicator_item_at(4).opacity, 0.5, "Other indicators should not highlight when in locked state");
182+ }
169 }
183 }
170
184
171 UT.UnityTestCase {
185 UT.UnityTestCase {