on xenial help sign in
Fixed panel navigation bugs
commit73a76783bc82df018c75109a4e6ee22971dfeabc authorNick Dedekind <nicholas.dedekind@gmail.com> dateFri 10 Jan 2014, 16:56 (13 years ago) parent6bb8faa
8 files changed+182−276
qml/Panel/IndicatorItem.qml+1−1 qml/Panel/IndicatorRow.qml+92−89 qml/Panel/Indicators.qml+7−5 qml/Panel/MenuContent.qml+1 qml/Panel/Panel.qml−1 tests/qmltests/Panel/tst_IndicatorRow.qml+62−163 tests/qmltests/Panel/tst_Indicators.qml+10−6 tests/qmltests/Panel/tst_Panel.qml+9−11
qml/Panel/IndicatorItem.qml+1−1
@@ -28,7 +28,7 @@ Item {
2828 property bool indicatorVisible: loader.item ? loader.item.enabled : false
2929
3030 opacity: dimmed ? 0.4 : 1
31− Behavior on opacity { StandardAnimation {} }
31+ Behavior on opacity { UbuntuNumberAnimation { duration: UbuntuAnimation.BriskDuration } }
3232
3333 width: loader.item ? loader.item.width : 0
3434
qml/Panel/IndicatorRow.qml+92−89
@@ -22,11 +22,11 @@ import "../Components"
2222Item {
2323 id: indicatorRow
2424
25− property QtObject currentItem : null
26− readonly property int currentItemIndex: currentItem ? currentItem.ownIndex : -1
27− property alias row: row
25+ readonly property alias currentItem : itemView.currentItem
26+ readonly property alias currentItemIndex: itemView.currentIndex
27+ readonly property alias row: itemView
2828 property QtObject indicatorsModel: null
29− property var visibleIndicators: defined
29+ property var visibleIndicators: undefined
3030 property int overFlowWidth: width
3131 property bool showAll: false
3232 property real currentItemOffset: 0.0
@@ -40,9 +40,15 @@ Item {
4040 setCurrentItem(0);
4141 }
4242
43− function setCurrentItem(index) {
44− if (currentItemIndex !== index) {
45− currentItem = rowRepeater.itemAt(index);
43+ function setCurrentItemIndex(index) {
44+ itemView.currentIndex = index;
45+ }
46+
47+ function setCurrentItem(item) {
48+ if (item && item.hasOwnProperty("ownIndex")) {
49+ itemView.currentIndex = item.ownIndex;
50+ } else {
51+ itemView.currentIndex = -1;
4652 }
4753 }
4854
@@ -55,96 +61,91 @@ Item {
5561 }
5662 }
5763
58− Row {
59− id: row
64+ ListView {
65+ id: itemView
66+ objectName: "indicatorRowItems"
67+ interactive: false
68+ model: indicatorsModel ? indicatorsModel : null
6069
61− width: children.width
62− height: parent.height
70+ width: childrenRect.width
71+ height: indicatorRow.height
6372 anchors.right: parent.right
73+ orientation: ListView.Horizontal
6474
65− Repeater {
66− id: rowRepeater
67− objectName: "rowRepeater"
68− model: indicatorsModel ? indicatorsModel : undefined
69−
70− property int lastCount: 0
71− onCountChanged: {
72− if (lastCount < count) {
73− showAll = true;
74− allVisible.start();
75− }
76− lastCount = count;
75+ property int lastCount: 0
76+ onCountChanged: {
77+ if (lastCount < count) {
78+ showAll = true;
79+ allVisible.start();
7780 }
81+ lastCount = count;
82+ }
83+
84+ delegate: Item {
85+ id: itemWrapper
86+ objectName: "item" + index
87+ height: indicatorRow.height
88+ width: visible ? indicatorItem.width : 0
89+ visible: indicatorItem.indicatorVisible
90+ opacity: 1 - indicatorRow.unitProgress
91+ y: 0
92+ state: "standard"
93+
94+ property int ownIndex: index
95+ property bool highlighted: indicatorRow.unitProgress > 0 ? ListView.isCurrentItem : false
96+ property bool dimmed: indicatorRow.unitProgress > 0 ? !ListView.isCurrentItem : false
97+
98+ property bool hidden: !showAll && !highlighted && (indicatorRow.state == "locked" || indicatorRow.state == "commit")
99+ property bool overflow: row.width - itemWrapper.x > overFlowWidth
100+
101+ IndicatorItem {
102+ id: indicatorItem
103+ height: parent.height
78104
79− Item {
80− id: itemWrapper
81− height: indicatorRow.height
82− width: indicatorItem.width
83− visible: indicatorItem.indicatorVisible
84− opacity: 1.0 * opacityMultiplier
85− y: 0
86− state: "standard"
87−
88− property int ownIndex: index
89− property bool highlighted: indicatorRow.state != "initial" ? ownIndex == indicatorRow.currentItemIndex : false
90− property bool dimmed: indicatorRow.state != "initial" ? ownIndex != indicatorRow.currentItemIndex : false
91−
92− property bool hidden: !showAll && !highlighted && (indicatorRow.state == "locked" || indicatorRow.state == "commit")
93− property bool overflow: row.width - itemWrapper.x > overFlowWidth
94− property real opacityMultiplier: highlighted ? 1 : (1 - indicatorRow.unitProgress)
95−
96− IndicatorItem {
97− id: indicatorItem
98− height: parent.height
99−
100− dimmed: itemWrapper.dimmed
101−
102− widgetSource: model.widgetSource
103− indicatorProperties : model.indicatorProperties
104−
105− Component.onCompleted: {
106− if (visibleIndicators == undefined) {
107− visibleIndicators = {}
108− }
109− indicatorRow.visibleIndicators[model.identifier] = indicatorVisible;
110− indicatorRow.visibleIndicatorsChanged();
105+ dimmed: itemWrapper.dimmed
106+
107+ widgetSource: model.widgetSource
108+ indicatorProperties : model.indicatorProperties
109+
110+ Component.onCompleted: {
111+ if (visibleIndicators == undefined) {
112+ visibleIndicators = {}
111113 }
112− onIndicatorVisibleChanged: {
113− if (visibleIndicators == undefined) {
114− visibleIndicators = {}
115− }
116− indicatorRow.visibleIndicators[model.identifier] = indicatorVisible;
117− indicatorRow.visibleIndicatorsChanged();
118−
119− if (indicatorVisible) {
120− showAll = true;
121− allVisible.start();
122− }
114+ indicatorRow.visibleIndicators[model.identifier] = indicatorVisible;
115+ indicatorRow.visibleIndicatorsChanged();
116+ }
117+ onIndicatorVisibleChanged: {
118+ if (visibleIndicators == undefined) {
119+ visibleIndicators = {}
123120 }
124− }
121+ indicatorRow.visibleIndicators[model.identifier] = indicatorVisible;
122+ indicatorRow.visibleIndicatorsChanged();
125123
126− states: [
127− State {
128− name: "standard"
129− when: !hidden && !overflow
130− },
131− State {
132− name: "overflow"
133− when: hidden || overflow
134− PropertyChanges { target: itemWrapper; opacity: 0.0 }
135− }
136− ]
137−
138− transitions: [
139− Transition {
140− UbuntuNumberAnimation {
141− target: itemWrapper
142− property: "opacity"
143− duration: UbuntuAnimation.BriskDuration
144− }
145− }
146− ]
124+ if (indicatorVisible) {
125+ showAll = true;
126+ allVisible.start();
127+ }
128+ }
147129 }
130+
131+ states: [
132+ State {
133+ name: "standard"
134+ when: !hidden && !overflow && !highlighted
135+ },
136+ State {
137+ name: "highlighted"
138+ when: highlighted
139+ PropertyChanges { target: itemWrapper; opacity: 1.0 }
140+ },
141+ State {
142+ name: "hidden"
143+ when: hidden || overflow
144+ PropertyChanges { target: itemWrapper; opacity: 0.0 }
145+ }
146+ ]
147+
148+ Behavior on opacity { UbuntuNumberAnimation { duration: UbuntuAnimation.BriskDuration } }
148149 }
149150 }
150151
@@ -155,7 +156,9 @@ Item {
155156 height: units.dp(2)
156157 anchors.top: row.bottom
157158 visible: indicatorRow.currentItem != null
158− x: row.x + (indicatorRow.currentItem != null ? indicatorRow.currentItem.x + centerOffset : 0)
159+
160+ property real intendedX: row.x + (indicatorRow.currentItem != null ? indicatorRow.currentItem.x + centerOffset : 0)
161+ x: intendedX >= row.x ? (intendedX + width <= row.x + row.width ? intendedX : row.x + row.width - width) : row.x // listview boundaries
159162 width: indicatorRow.currentItem != null ? indicatorRow.currentItem.width : 0
160163
161164 property real centerOffset: {
qml/Panel/Indicators.qml+7−5
@@ -31,7 +31,7 @@ Showable {
3131 property alias overFlowWidth: indicatorRow.overFlowWidth
3232 property alias showAll: indicatorRow.showAll
3333
34− property int hintValue
34+ readonly property real hintValue: panelHeight + menuContent.headerHeight
3535 readonly property int lockThreshold: openedHeight / 2
3636 property bool fullyOpened: height == openedHeight
3737 property bool partiallyOpened: height > panelHeight && !fullyOpened
@@ -128,7 +128,7 @@ Showable {
128128
129129 rowCoordinates = indicatorRow.mapToItem(indicatorRow.row, xValue, 0);
130130 // get the current delegate
131− currentItem = indicatorRow.row.childAt(rowCoordinates.x, 0);
131+ currentItem = indicatorRow.row.itemAt(rowCoordinates.x, 0);
132132 if (currentItem) {
133133 itemCoordinates = indicatorRow.row.mapToItem(currentItem, rowCoordinates.x, 0);
134134 distanceFromRightEdge = (currentItem.width - itemCoordinates.x) / (currentItem.width);
@@ -143,7 +143,7 @@ Showable {
143143 }
144144 }
145145 if ((!useBuffer || (useBuffer && bufferExceeded)) || indicatorRow.currentItemIndex < 0 || indicatorRow.currentItem == null) {
146− indicatorRow.currentItem = currentItem;
146+ indicatorRow.setCurrentItem(currentItem);
147147 }
148148
149149 // need to re-init the distanceFromRightEdge for offset calculation
@@ -151,7 +151,7 @@ Showable {
151151 distanceFromRightEdge = (indicatorRow.currentItem.width - itemCoordinates.x) / (indicatorRow.currentItem.width);
152152 }
153153 indicatorRow.currentItemOffset = 1 - (distanceFromRightEdge * 2);
154− } else {
154+ } else if (initalizeItem) {
155155 indicatorRow.setDefaultItem();
156156 indicatorRow.currentItemOffset = 0;
157157 }
@@ -298,6 +298,7 @@ Showable {
298298 onRunningChanged: {
299299 if (showAnimation.running) {
300300 indicators.state = "commit";
301+ indicatorRow.currentItemOffset = 0;
301302 }
302303 }
303304 }
@@ -308,6 +309,7 @@ Showable {
308309 if (hideAnimation.running) {
309310 indicators.state = "initial";
310311 initalizeItem = true;
312+ indicatorRow.currentItemOffset = 0;
311313 menuContent.animateNextMenuChange = false;
312314 }
313315 }
@@ -326,7 +328,7 @@ Showable {
326328 if (!oldActive) return;
327329 d.enableIndexChangeSignal = false;
328330
329− indicatorRow.setCurrentItem(menuContent.currentMenuIndex);
331+ indicatorRow.setCurrentItemIndex(menuContent.currentMenuIndex);
330332
331333 d.enableIndexChangeSignal = oldActive;
332334 }
qml/Panel/MenuContent.qml+1
@@ -34,6 +34,7 @@ MainView {
3434 property bool activeHeader: false
3535 property alias visibleIndicators: visibleIndicatorsModel.visible
3636 property bool animateNextMenuChange: false
37+ property real headerHeight: tabs.tabBar.height
3738
3839 width: units.gu(40)
3940 height: units.gu(42)
qml/Panel/Panel.qml−1
@@ -101,7 +101,6 @@ Item {
101101 y: panelBackground.y
102102 width: root.indicatorsMenuWidth
103103 shown: false
104− hintValue: __panelMinusSeparatorLineHeight * 3
105104 panelHeight: __panelMinusSeparatorLineHeight
106105 openedHeight: parent.height + (pinnedMode ? 0 : root.panelHeight)
107106 pinnedMode: !fullscreenMode
tests/qmltests/Panel/tst_IndicatorRow.qml+62−163
@@ -33,7 +33,7 @@ Item {
3333 function init_test()
3434 {
3535 indicatorRow.state = "initial";
36− indicatorRow.currentItem = null;
36+ indicatorRow.setCurrentItemIndex(-1);
3737 indicatorRow.unitProgress = 0.0;
3838 }
3939
@@ -60,199 +60,98 @@ Item {
6060 name: "IndicatorRow"
6161 when: windowShown
6262
63+ function get_indicator_item_at(index) {
64+ return findChild(indicatorRow.row, "item" + index);
65+ }
66+
6367 function test_set_current_item() {
6468 init_test();
65− indicatorRow.setCurrentItem(0);
69+ indicatorRow.setCurrentItemIndex(0);
6670 compare(indicatorRow.indicatorsModel.get(indicatorRow.currentItemIndex).identifier, "indicator-fake1", "Incorrect item at position 0");
6771
68− indicatorRow.setCurrentItem(1);
72+ indicatorRow.setCurrentItemIndex(1);
6973 compare(indicatorRow.indicatorsModel.get(indicatorRow.currentItemIndex).identifier, "indicator-fake2", "Incorrect item at position 1");
7074
71− indicatorRow.setCurrentItem(2);
75+ indicatorRow.setCurrentItemIndex(2);
7276 compare(indicatorRow.indicatorsModel.get(indicatorRow.currentItemIndex).identifier, "indicator-fake3", "Incorrect item at position 2");
7377 }
74− }
7578
76− UT.UnityTestCase {
77− name: "IndicatorRow_IconPosition"
78− when: windowShown
79−
80− function get_indicator_item_at(index) {
81− return findChild(indicatorRow, "rowRepeater").itemAt(index);
79+ function test_highlight_data() {
80+ return [
81+ { index: 0, progress: 0.0, current: false, other: false },
82+ { index: 0, progress: 0.1, current: true, other: false },
83+ { index: 0, progress: 0.5, current: true, other: false },
84+ { index: 0, progress: 1.0, current: true, other: false },
85+ { index: 2, progress: 0.0, current: false, other: false },
86+ { index: 2, progress: 0.1, current: true, other: false },
87+ { index: 2, progress: 0.5, current: true, other: false },
88+ { index: 2, progress: 1.0, current: true, other: false }
89+ ];
8290 }
8391
84− function test_current_item_commit() {
92+ function test_highlight(data) {
8593 init_test();
8694
87− indicatorRow.setCurrentItem(2);
88− indicatorRow.state = "commit";
89− tryCompare(get_indicator_item_at(0), "opacity", 0.0);
90− tryCompare(get_indicator_item_at(1), "opacity", 0.0);
91− tryCompare(get_indicator_item_at(2), "opacity", 1.0);
92− tryCompare(get_indicator_item_at(3), "opacity", 0.0);
93− tryCompare(get_indicator_item_at(4), "opacity", 0.0);
94− }
95− }
96−
97− UT.UnityTestCase {
98− name: "IndicatorRow_Highlight"
99− when: windowShown
100−
101− function get_indicator_item_at(index) {
102− return findChild(indicatorRow, "rowRepeater").itemAt(index);
103− }
104−
105− function test_intial_state() {
106− init_test();
95+ indicatorRow.unitProgress = data.progress;
96+ indicatorRow.setCurrentItemIndex(data.index);
10797
108− indicatorRow.state = "initial";
109− indicatorRow.setCurrentItem(0);
98+ compare(indicatorRow.currentItem.highlighted, data.current, "Indicator hightlight did not match for current item");
11099
111− compare(indicatorRow.currentItem.highlighted, false, "Indicator should not highlight when in initial state");
112− compare(get_indicator_item_at(1).highlighted, false, "Other indicators should not highlight when in initial state");
113− compare(get_indicator_item_at(2).highlighted, false, "Other indicators should not highlight when in initial state");
114− compare(get_indicator_item_at(3).highlighted, false, "Other indicators should not highlight when in initial state");
115− compare(get_indicator_item_at(4).highlighted, false, "Other indicators should not highlight when in initial state");
100+ for (var i = 0; i < indicatorRow.row.count; i++) {
101+ compare(get_indicator_item_at(i).highlighted, i === data.index ? data.current: data.other, "Indicator hightlight did not match for item iter");
102+ }
116103 }
117104
118− function test_hint_state() {
119− init_test();
120−
121− indicatorRow.state = "hint";
122− indicatorRow.setCurrentItem(0);
123−
124− compare(indicatorRow.currentItem.highlighted, true, "Indicator should highlight when in hint state");
125− compare(get_indicator_item_at(1).highlighted, false, "Other indicators should not highlight when in hint state");
126− compare(get_indicator_item_at(2).highlighted, false, "Other indicators should not highlight when in hint state");
127− compare(get_indicator_item_at(3).highlighted, false, "Other indicators should not highlight when in hint state");
128− compare(get_indicator_item_at(4).highlighted, false, "Other indicators should not highlight when in hint state");
105+ function test_opacity_data() {
106+ return [
107+ { index: 0, progress: 0.0, current: 1.0, other: 1.0 },
108+ { index: 0, progress: 0.1, current: 1.0, other: 0.9 },
109+ { index: 0, progress: 0.5, current: 1.0, other: 0.5 },
110+ { index: 0, progress: 1.0, current: 1.0, other: 0.0 },
111+ { index: 2, progress: 0.0, current: 1.0, other: 1.0 },
112+ { index: 2, progress: 0.1, current: 1.0, other: 0.9 },
113+ { index: 2, progress: 0.5, current: 1.0, other: 0.5 },
114+ { index: 2, progress: 1.0, current: 1.0, other: 0.0 }
115+ ];
129116 }
130117
131− function test_revealed_state() {
118+ function test_opacity(data) {
132119 init_test();
133120
134− indicatorRow.state = "reveal";
135− indicatorRow.setCurrentItem(0);
121+ indicatorRow.unitProgress = data.progress;
122+ indicatorRow.setCurrentItemIndex(data.index);
136123
137− compare(indicatorRow.currentItem.highlighted, true, "Indicator should highlight when in reveal state");
138− compare(get_indicator_item_at(1).highlighted, false, "Other indicators should not highlight when in commit state");
139− compare(get_indicator_item_at(2).highlighted, false, "Other indicators should not highlight when in commit state");
140− compare(get_indicator_item_at(3).highlighted, false, "Other indicators should not highlight when in commit state");
141− compare(get_indicator_item_at(4).highlighted, false, "Other indicators should not highlight when in commit state");
142− }
124+ compare(indicatorRow.currentItem.opacity, data.current, "Indicator opacity did not match for current item");
143125
144− function test_commit_state() {
145− init_test();
146−
147− indicatorRow.state = "commit";
148− indicatorRow.setCurrentItem(0);
149−
150− compare(indicatorRow.currentItem.highlighted, true, "Indicator should highlight when in commit state");
151− compare(get_indicator_item_at(1).highlighted, false, "Other indicators should not highlight when in commit state");
152− compare(get_indicator_item_at(2).highlighted, false, "Other indicators should not highlight when in commit state");
153− compare(get_indicator_item_at(3).highlighted, false, "Other indicators should not highlight when in commit state");
154− compare(get_indicator_item_at(4).highlighted, false, "Other indicators should not highlight when in commit state");
126+ for (var i = 0; i < indicatorRow.row.count; i++) {
127+ tryCompare(get_indicator_item_at(i), "opacity", i === data.index ? data.current: data.other);
128+ }
155129 }
156130
157− function test_locked_state() {
158− init_test();
159−
160− indicatorRow.state = "locked";
161− indicatorRow.setCurrentItem(0);
162−
163− compare(indicatorRow.currentItem.highlighted, true, "Indicator should highlight when in locked state");
164− compare(get_indicator_item_at(1).highlighted, false, "Other indicators should not highlight when in locked state");
165− compare(get_indicator_item_at(2).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");
131+ function test_dimmed_data() {
132+ return [
133+ { index: 0, progress: 0.0, current: false, other: false },
134+ { index: 0, progress: 0.1, current: false, other: true },
135+ { index: 0, progress: 0.5, current: false, other: true },
136+ { index: 0, progress: 1.0, current: false, other: true },
137+ { index: 2, progress: 0.0, current: false, other: false },
138+ { index: 2, progress: 0.1, current: false, other: true },
139+ { index: 2, progress: 0.5, current: false, other: true },
140+ { index: 2, progress: 1.0, current: false, other: true }
141+ ];
168142 }
169143
170− function test_opacity() {
144+ function test_dimmed(data) {
171145 init_test();
172146
173− indicatorRow.state = "reveal";
174− indicatorRow.unitProgress = 0.5;
175− indicatorRow.setCurrentItem(2);
176−
177− compare(get_indicator_item_at(0).opacity, 0.5, "Other indicator opacity should change in response to panel progress");
178− compare(get_indicator_item_at(1).opacity, 0.5, "Other indicator opacity should change in response to panel progress");
179− compare(get_indicator_item_at(2).opacity, 1.0, "Current indicator should not change in response to panel progress");
180− compare(get_indicator_item_at(3).opacity, 0.5, "Other indicator opacity should change in response to panel progress");
181− compare(get_indicator_item_at(4).opacity, 0.5, "Other indicator opacity should change in response to panel progress");
182− }
183− }
184−
185− UT.UnityTestCase {
186− name: "IndicatorRow_Dimmed"
187− when: windowShown
188−
189− function get_indicator_item_at(index) {
190− return findChild(indicatorRow, "rowRepeater").itemAt(index);
191− }
192−
193− function test_intial_state() {
194− init_test();
195−
196− indicatorRow.state = "initial";
197− indicatorRow.setCurrentItem(0);
198−
199− compare(get_indicator_item_at(0).dimmed, false, "Current indicator should not dim when in intiial state");
200− compare(get_indicator_item_at(1).dimmed, false, "Other indicators should not dim when in initial state");
201− compare(get_indicator_item_at(2).dimmed, false, "Other indicators should not dim when in initial state");
202− compare(get_indicator_item_at(3).dimmed, false, "Other indicators should not dim when in initial state");
203− compare(get_indicator_item_at(4).dimmed, false, "Other indicators should not dim when in initial state");
204− }
205−
206− function test_hint_state() {
207− init_test();
208−
209− indicatorRow.state = "hint";
210− indicatorRow.setCurrentItem(0);
211−
212− compare(get_indicator_item_at(0).dimmed, false, "Current indicator should not dim when in hint state");
213− compare(get_indicator_item_at(1).dimmed, true, "Other indicators should dim when in hint state");
214− compare(get_indicator_item_at(2).dimmed, true, "Other indicators should dim when in hint state");
215− compare(get_indicator_item_at(3).dimmed, true, "Other indicators should dim when in hint state");
216− compare(get_indicator_item_at(4).dimmed, true, "Other indicators should dim when in hint state");
217− }
218−
219− function test_revealed_state() {
220− init_test();
221−
222− indicatorRow.state = "reveal";
223− indicatorRow.setCurrentItem(0);
224−
225− compare(get_indicator_item_at(0).dimmed, false, "Current indicator should not dim when in reveal state");
226− compare(get_indicator_item_at(1).dimmed, true, "Other indicators should dim when in reveal state");
227− compare(get_indicator_item_at(2).dimmed, true, "Other indicators should dim when in reveal state");
228− compare(get_indicator_item_at(3).dimmed, true, "Other indicators should dim when in reveal state");
229− compare(get_indicator_item_at(4).dimmed, true, "Other indicators should dim when in reveal state");
230− }
231−
232− function test_commit_state() {
233− init_test();
234−
235− indicatorRow.state = "commit";
236− indicatorRow.setCurrentItem(0);
237−
238− compare(get_indicator_item_at(0).dimmed, false, "Current indicator should not dim when in commit state");
239− compare(get_indicator_item_at(1).dimmed, true, "Other indicators should dim when in commit state");
240− compare(get_indicator_item_at(2).dimmed, true, "Other indicators should dim when in commit state");
241− compare(get_indicator_item_at(3).dimmed, true, "Other indicators should dim when in commit state");
242− compare(get_indicator_item_at(4).dimmed, true, "Other indicators should dim when in commit state");
243− }
244−
245− function test_locked_state() {
246− init_test();
147+ indicatorRow.unitProgress = data.progress;
148+ indicatorRow.setCurrentItemIndex(data.index);
247149
248− indicatorRow.state = "locked";
249− indicatorRow.setCurrentItem(0);
150+ compare(indicatorRow.currentItem.dimmed, data.current, "Indicator dim did not match for current item");
250151
251− compare(get_indicator_item_at(0).dimmed, false, "Current indicator should not dim when in locked state");
252− compare(get_indicator_item_at(1).dimmed, true, "Other indicators should dim when in locked state");
253− compare(get_indicator_item_at(2).dimmed, true, "Other indicators should dim when in locked state");
254− compare(get_indicator_item_at(3).dimmed, true, "Other indicators should dim when in locked state");
255− compare(get_indicator_item_at(4).dimmed, true, "Other indicators should dim when in locked state");
152+ for (var i = 0; i < indicatorRow.row.count; i++) {
153+ compare(get_indicator_item_at(i).dimmed, i === data.index ? data.current: data.other, "Indicator dim did not match for item iter");
154+ }
256155 }
257156 }
258157}
tests/qmltests/Panel/tst_Indicators.qml+10−6
@@ -101,10 +101,10 @@ Item {
101101 // tests changing the lateral position of the revealer activates the correct indicator items.
102102
103103 var indicatorRow = findChild(indicators, "indicatorRow")
104− var rowRepeater = findChild(indicators, "rowRepeater")
104+ verify(indicatorRow !== undefined)
105105
106− for (var i = 0; i < rowRepeater.count; i++) {
107− var indicatorItem = rowRepeater.itemAt(i);
106+ for (var i = 0; i < indicatorRow.row.count; i++) {
107+ var indicatorItem = findChild(indicatorRow.row, "item" + i);
108108
109109 if (!indicatorItem.visible)
110110 continue;
@@ -168,10 +168,14 @@ Item {
168168
169169 function test_row_visible_menuContent_visible(data) {
170170 var indicatorTabs = findChild(indicators, "tabs");
171− var rowRepeater = findChild(indicators, "rowRepeater");
171+ verify(indicatorTabs !== undefined)
172172
173− var indicatorItem = rowRepeater.itemAt(data.index);
174− tryCompareFunction(function() { return indicatorItem.width > 0}, true);
173+ var indicatorRow = findChild(indicators, "indicatorRow");
174+ verify(indicatorRow !== undefined);
175+ var indicatorItem = findChild(indicatorRow.row, "item" + data.index);
176+ verify(indicatorItem !== undefined);
177+
178+ tryCompareFunction(function() { return indicatorItem.width > 0}, data.visible);
175179 tryCompare(indicatorItem, "visible", data.visible);
176180
177181 var indicatorTab = findChild(indicatorTabs, data.name)
tests/qmltests/Panel/tst_Panel.qml+9−11
@@ -62,10 +62,14 @@ Item {
6262 tryCompare(panel.indicators, "state", "initial");
6363 }
6464
65+ function get_indicator_item_at(index) {
66+ }
67+
6568 function get_indicator_item(index) {
66− var rowRepeater = findChild(panel.indicators, "rowRepeater");
67− verify(rowRepeater != undefined);
68− return rowRepeater.itemAt(index);
69+ var indicatorRow = findChild(panel.indicators, "indicatorRow");
70+ verify(indicatorRow != undefined);
71+
72+ return findChild(indicatorRow.row, "item" + index);
6973 }
7074
7175 function get_indicator_item_position(index) {
@@ -145,9 +149,6 @@ Item {
145149 var indicatorRow = findChild(panel.indicators, "indicatorRow");
146150 verify(indicatorRow != undefined);
147151
148− var rowRepeater = findChild(panel.indicators, "rowRepeater");
149− verify(indicatorRow != undefined);
150−
151152 var menuContent = findChild(panel.indicators, "menuContent");
152153 verify(indicatorRow != undefined);
153154
@@ -160,7 +161,7 @@ Item {
160161 }
161162
162163 // do this for each indicator item
163− for (var i = 0; i < rowRepeater.count; i++) {
164+ for (var i = 0; i < indicatorRow.row.count; i++) {
164165
165166 var indicatorItem = get_indicator_item(i);
166167 verify(indicatorItem != undefined);
@@ -234,15 +235,12 @@ Item {
234235 var indicatorRow = findChild(panel.indicators, "indicatorRow");
235236 verify(indicatorRow != undefined);
236237
237− var rowRepeater = findChild(panel.indicators, "rowRepeater");
238− verify(indicatorRow != undefined);
239−
240238 // Get the first indicator
241239 var indicatorItemFirst = get_indicator_item(0);
242240 verify(indicatorItemFirst != undefined);
243241
244242 var indicatorItemCoordFirst = get_indicator_item_position(0);
245− var indicatorItemCoordNext = get_indicator_item_position(indicatorRow.count - 1);
243+ var indicatorItemCoordNext = get_indicator_item_position(indicatorRow.row.count - 1);
246244
247245 touchPress(panel,
248246 indicatorItemCoordFirst.x, panel.panelHeight / 2);