on xenial help sign in
Added Panel/VisibleIndicatorsModel for use with both indicator row & menuContent.

This removes the need to hide indicators in the row and map inicator indexes between row & content. Fixes the indicator highlight line offset not bound by listView position.

commit9dcab0116d119f327905031ae48bf2e477f61620 authorNick Dedekind <nicholas.dedekind@gmail.com> dateWed 29 Jan 2014, 16:10 (13 years ago) parent886ef41a8cb70b
17 files changed+349−403
qml/Panel/IndicatorItem.qml+1−1 qml/Panel/IndicatorRow.qml+73−113 qml/Panel/Indicators.qml+18−28 qml/Panel/Indicators/IndicatorDelegate.qml+34 qml/Panel/Indicators/VisibleIndicators.qml+84 qml/Panel/MenuContent.qml+13−26 qml/Panel/Panel.qml+1−4 tests/mocks/Unity/Indicators/IndicatorsModel.qml+5−5 tests/mocks/Unity/Indicators/qml/fake_menu_page1.qml−1 tests/mocks/Unity/Indicators/qml/fake_menu_page2.qml−1 tests/mocks/Unity/Indicators/qml/fake_menu_page3.qml−1 tests/mocks/Unity/Indicators/qml/fake_menu_page4.qml−1 tests/mocks/Unity/Indicators/qml/fake_menu_page5.qml−1 tests/qmltests/Panel/tst_IndicatorRow.qml+64−163 tests/qmltests/Panel/tst_Indicators.qml+40−32 tests/qmltests/Panel/tst_MenuContent.qml+6−14 tests/qmltests/Panel/tst_Panel.qml+10−12
qml/Panel/IndicatorItem.qml+1−1
@@ -29,7 +29,7 @@ Item {
2929 property string identifier
3030
3131 opacity: dimmed ? 0.4 : 1
32− Behavior on opacity { StandardAnimation {} }
32+ Behavior on opacity { UbuntuNumberAnimation { duration: UbuntuAnimation.BriskDuration } }
3333
3434 width: loader.item ? loader.item.width : 0
3535
qml/Panel/IndicatorRow.qml+73−113
@@ -22,11 +22,10 @@ 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: undefined
3029 property int overFlowWidth: width
3130 property bool showAll: false
3231 property real currentItemOffset: 0.0
@@ -40,9 +39,15 @@ Item {
4039 setCurrentItem(0);
4140 }
4241
43− function setCurrentItem(index) {
44− if (currentItemIndex !== index) {
45− currentItem = rowRepeater.itemAt(index);
42+ function setCurrentItemIndex(index) {
43+ itemView.currentIndex = index;
44+ }
45+
46+ function setCurrentItem(item) {
47+ if (item && item.hasOwnProperty("ownIndex")) {
48+ itemView.currentIndex = item.ownIndex;
49+ } else {
50+ itemView.currentIndex = -1;
4651 }
4752 }
4853
@@ -55,122 +60,75 @@ Item {
5560 }
5661 }
5762
58− Row {
59− id: row
63+ ListView {
64+ id: itemView
65+ objectName: "indicatorRowItems"
66+ interactive: false
67+ model: indicatorsModel ? indicatorsModel : null
6068
61− width: children.width
62− height: parent.height
69+ width: childrenRect.width
70+ height: indicatorRow.height
6371 anchors.right: parent.right
72+ orientation: ListView.Horizontal
6473
65− Repeater {
66− id: rowRepeater
67− objectName: "rowRepeater"
68− model: indicatorsModel ? indicatorsModel : undefined
74+ property int lastCount: 0
75+ onCountChanged: {
76+ if (lastCount < count) {
77+ showAll = true;
78+ allVisible.start();
79+ }
80+ lastCount = count;
81+ }
6982
70− property int lastCount: 0
71− onCountChanged: {
72− if (lastCount < count) {
73− showAll = true;
74− allVisible.start();
75− }
76− lastCount = count;
83+ delegate: Item {
84+ id: itemWrapper
85+ objectName: "item" + index
86+ height: indicatorRow.height
87+ width: indicatorItem.width
88+ opacity: 1 - indicatorRow.unitProgress
89+ y: 0
90+ state: "standard"
91+
92+ property int ownIndex: index
93+ property bool highlighted: indicatorRow.unitProgress > 0 ? ListView.isCurrentItem : false
94+ property bool dimmed: indicatorRow.unitProgress > 0 ? !ListView.isCurrentItem : false
95+
96+ property bool hidden: !showAll && !highlighted && (indicatorRow.state == "locked" || indicatorRow.state == "commit")
97+ property bool overflow: row.width - itemWrapper.x > overFlowWidth
98+
99+ IndicatorItem {
100+ id: indicatorItem
101+ identifier: model.identifier
102+ height: parent.height
103+
104+ dimmed: itemWrapper.dimmed
105+
106+ widgetSource: model.widgetSource
107+ indicatorProperties : model.indicatorProperties
77108 }
78109
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− identifier: model.identifier
99− height: parent.height
100−
101− dimmed: itemWrapper.dimmed
102−
103− widgetSource: model.widgetSource
104− indicatorProperties : model.indicatorProperties
105−
106− Component.onCompleted: {
107− updateVisiblility();
108− }
109− onIndicatorVisibleChanged: {
110− updateVisiblility();
111−
112− if (indicatorVisible) {
113− showAll = true;
114− allVisible.start();
115− }
116− }
117−
118− function updateVisiblility() {
119− if (visibleIndicators == undefined) {
120− visibleIndicators = {}
121− }
122− indicatorRow.visibleIndicators[model.identifier] = indicatorVisible;
123−
124− // removed current index?
125− if (indicatorRow.currentItemIndex === index && !indicatorVisible) {
126− // find the next closest visible indicator (after current, else before)
127− var newIndex = -1;
128− for (var i = index+1; i < rowRepeater.count; i++) {
129− if (indicatorRow.visibleIndicators[i] === undefined || indicatorRow.visibleIndicators[model.identifier]) {
130− newIndex = i;
131− break;
132− }
133− }
134− if (newIndex === -1) {
135− for (i = index - 1; i >= 0; i--) {
136− if (indicatorRow.visibleIndicators[i] === undefined || indicatorRow.visibleIndicators[model.identifier]) {
137− newIndex = i;
138− break;
139− }
140− }
141− }
142− indicatorRow.setCurrentItem(newIndex);
143− }
144−
145− indicatorRow.visibleIndicatorsChanged();
146− }
110+ states: [
111+ State {
112+ name: "standard"
113+ when: !hidden && !overflow && !highlighted
114+ },
115+ State {
116+ name: "highlighted"
117+ when: highlighted
118+ PropertyChanges { target: itemWrapper; opacity: 1.0 }
119+ },
120+ State {
121+ name: "hidden"
122+ when: hidden || overflow
123+ PropertyChanges { target: itemWrapper; opacity: 0.0 }
147124 }
125+ ]
148126
149− states: [
150− State {
151− name: "standard"
152− when: !hidden && !overflow
153− },
154− State {
155− name: "overflow"
156− when: hidden || overflow
157− PropertyChanges { target: itemWrapper; opacity: 0.0 }
158− }
159− ]
160−
161− transitions: [
162− Transition {
163− UbuntuNumberAnimation {
164− target: itemWrapper
165− property: "opacity"
166− duration: UbuntuAnimation.BriskDuration
167− }
168− }
169− ]
170− }
127+ Behavior on opacity { UbuntuNumberAnimation { duration: UbuntuAnimation.BriskDuration } }
171128 }
172129 }
173130
131+
174132 Rectangle {
175133 id: highlight
176134 color: Theme.palette.selected.foreground
@@ -178,7 +136,9 @@ Item {
178136 height: units.dp(2)
179137 anchors.top: row.bottom
180138 visible: indicatorRow.currentItem != null
181− x: row.x + (indicatorRow.currentItem != null ? indicatorRow.currentItem.x + centerOffset : 0)
139+
140+ property real intendedX: row.x + (indicatorRow.currentItem != null ? indicatorRow.currentItem.x + centerOffset : 0)
141+ x: intendedX >= row.x ? (intendedX + width <= row.x + row.width ? intendedX : row.x + row.width - width) : row.x // listview boundaries
182142 width: indicatorRow.currentItem != null ? indicatorRow.currentItem.width : 0
183143
184144 property real centerOffset: {
qml/Panel/Indicators.qml+18−28
@@ -21,6 +21,7 @@ import Unity.Indicators 0.1 as Indicators
2121
2222import "../Components"
2323import "../Components/ListItems"
24+import "Indicators"
2425
2526Showable {
2627 id: indicators
@@ -31,7 +32,7 @@ Showable {
3132 property alias overFlowWidth: indicatorRow.overFlowWidth
3233 property alias showAll: indicatorRow.showAll
3334
34− property int hintValue
35+ readonly property real hintValue: panelHeight + menuContent.headerHeight
3536 readonly property int lockThreshold: openedHeight / 2
3637 property bool fullyOpened: height == openedHeight
3738 property bool partiallyOpened: height > panelHeight && !fullyOpened
@@ -39,7 +40,7 @@ Showable {
3940 property bool contentEnabled: true
4041 property bool initalizeItem: true
4142 readonly property alias content: menuContent
42− property real unitProgress: 0.0
43+ property real unitProgress: (height - panelHeight) / (openedHeight - panelHeight)
4344
4445 // TODO: Perhaps we need a animation standard for showing/hiding? Each showable seems to
4546 // use its own values. Need to ask design about this.
@@ -128,7 +129,7 @@ Showable {
128129
129130 rowCoordinates = indicatorRow.mapToItem(indicatorRow.row, xValue, 0);
130131 // get the current delegate
131− currentItem = indicatorRow.row.childAt(rowCoordinates.x, 0);
132+ currentItem = indicatorRow.row.itemAt(rowCoordinates.x, 0);
132133 if (currentItem) {
133134 itemCoordinates = indicatorRow.row.mapToItem(currentItem, rowCoordinates.x, 0);
134135 distanceFromRightEdge = (currentItem.width - itemCoordinates.x) / (currentItem.width);
@@ -143,7 +144,7 @@ Showable {
143144 }
144145 }
145146 if ((!useBuffer || (useBuffer && bufferExceeded)) || indicatorRow.currentItemIndex < 0 || indicatorRow.currentItem == null) {
146− indicatorRow.currentItem = currentItem;
147+ indicatorRow.setCurrentItem(currentItem);
147148 }
148149
149150 // need to re-init the distanceFromRightEdge for offset calculation
@@ -151,7 +152,7 @@ Showable {
151152 distanceFromRightEdge = (indicatorRow.currentItem.width - itemCoordinates.x) / (indicatorRow.currentItem.width);
152153 }
153154 indicatorRow.currentItemOffset = 1 - (distanceFromRightEdge * 2);
154− } else {
155+ } else if (initalizeItem) {
155156 indicatorRow.setDefaultItem();
156157 indicatorRow.currentItemOffset = 0;
157158 }
@@ -179,6 +180,10 @@ Showable {
179180 source: "graphics/VerticalDivider.png"
180181 }
181182
183+ VisibleIndicators {
184+ id: visibleIndicators
185+ }
186+
182187 MenuContent {
183188 id: menuContent
184189 objectName: "menuContent"
@@ -189,7 +194,7 @@ Showable {
189194 top: indicatorRow.bottom
190195 bottom: handle.top
191196 }
192− indicatorsModel: indicatorsModel
197+ indicatorsModel: visibleIndicators.model
193198 clip: !indicators.fullyOpened
194199 activeHeader: indicators.state == "hint" || indicators.state == "reveal"
195200 enabled: contentEnabled
@@ -220,13 +225,9 @@ Showable {
220225 right: parent.right
221226 bottom: parent.bottom
222227 }
223− height: get_height()
228+ height: Math.max(Math.min(handleImage.height, indicators.height - handleImage.height), 0)
224229 clip: height < handleImage.height
225230
226− function get_height() {
227− return Math.max(Math.min(handleImage.height, indicators.height - handleImage.height), 0);
228− }
229−
230231 BorderImage {
231232 id: handleImage
232233 source: "graphics/handle.sci"
@@ -246,10 +247,6 @@ Showable {
246247 anchors.fill: indicatorRow
247248 }
248249
249− Indicators.IndicatorsModel {
250− id: indicatorsModel
251− }
252−
253250 IndicatorRow {
254251 id: indicatorRow
255252 objectName: "indicatorRow"
@@ -258,18 +255,10 @@ Showable {
258255 right: parent.right
259256 }
260257 height: indicators.panelHeight
261− indicatorsModel: indicatorsModel
258+ indicatorsModel: visibleIndicators.model
262259 state: indicators.state
263260 unitProgress: indicators.unitProgress
264261
265− onVisibleIndicatorsChanged: {
266− // need to do it here so we can control sequence
267− if (visibleIndicators !== undefined) {
268− menuContent.visibleIndicators = visibleIndicators;
269− menuContent.setCurrentMenuIndex(currentItemIndex);
270− }
271− }
272−
273262 EdgeDragArea {
274263 id: rowDragArea
275264 anchors.fill: indicatorRow
@@ -303,6 +292,7 @@ Showable {
303292 onRunningChanged: {
304293 if (showAnimation.running) {
305294 indicators.state = "commit";
295+ indicatorRow.currentItemOffset = 0;
306296 }
307297 }
308298 }
@@ -313,7 +303,7 @@ Showable {
313303 if (hideAnimation.running) {
314304 indicators.state = "initial";
315305 initalizeItem = true;
316− menuContent.animateNextMenuChange = false;
306+ indicatorRow.currentItemOffset = 0;
317307 }
318308 }
319309 }
@@ -331,7 +321,7 @@ Showable {
331321 if (!oldActive) return;
332322 d.enableIndexChangeSignal = false;
333323
334− indicatorRow.setCurrentItem(menuContent.currentMenuIndex);
324+ indicatorRow.setCurrentItemIndex(menuContent.currentMenuIndex);
335325
336326 d.enableIndexChangeSignal = oldActive;
337327 }
@@ -344,7 +334,7 @@ Showable {
344334 if (!oldActive) return;
345335 d.enableIndexChangeSignal = false;
346336
347− menuContent.setCurrentMenuIndex(indicatorRow.currentItemIndex);
337+ menuContent.setCurrentMenuIndex(indicatorRow.currentItemIndex, fullyOpened || partiallyOpened);
348338
349339 d.enableIndexChangeSignal = oldActive;
350340 }
@@ -439,6 +429,6 @@ Showable {
439429
440430 Component.onCompleted: initialise();
441431 function initialise() {
442− indicatorsModel.load();
432+ visibleIndicators.load();
443433 }
444434}
qml/Panel/Indicators/IndicatorDelegate.qmlnew file+34
@@ -0,0 +1,34 @@
1+/*
2+ * Copyright 2013 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+ * Authors:
17+ * Nick Dedekind <nick.dedekind@canonical.com>
18+ */
19+
20+import QtQuick 2.0
21+import Unity.Indicators 0.1 as Indicators
22+
23+Indicators.IndicatorBase {
24+ enabled: false
25+
26+ onRootActionStateChanged: {
27+ if (rootActionState == undefined) {
28+ enabled = false;
29+ return;
30+ }
31+
32+ enabled = rootActionState.visible;
33+ }
34+}
qml/Panel/Indicators/VisibleIndicators.qmlnew file+84
@@ -0,0 +1,84 @@
1+/*
2+ * Copyright 2013 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+ * Authors:
17+ * Nick Dedekind <nick.dedekind@canonical.com>
18+ */
19+
20+import QtQuick 2.0
21+import Unity.Indicators 0.1 as Indicators
22+import Utils 0.1
23+
24+Item {
25+ property SortFilterProxyModel model: filterModel
26+
27+ SortFilterProxyModel {
28+ id: filterModel
29+ filterRole: Indicators.IndicatorsModelRole.IsVisible
30+ filterRegExp: RegExp("^true$")
31+ dynamicSortFilter: true
32+
33+ model: Indicators.VisibleIndicatorsModel {
34+ id: visibleIndicatorsModel
35+ model: indicatorsModel
36+ }
37+ }
38+
39+
40+ Indicators.IndicatorsModel {
41+ id: indicatorsModel
42+ }
43+
44+ Repeater {
45+ id: repeater
46+ model: indicatorsModel
47+
48+ property var visibleIndicators: undefined
49+ onVisibleIndicatorsChanged: {
50+ if (visibleIndicators !== undefined) {
51+ visibleIndicatorsModel.visible = visibleIndicators;
52+ }
53+ }
54+
55+ delegate: IndicatorDelegate {
56+ id: item
57+ objectName: model.identifier + "-delegate"
58+ Component.onCompleted: {
59+ for(var pName in indicatorProperties) {
60+ if (item.hasOwnProperty(pName)) {
61+ item[pName] = indicatorProperties[pName];
62+ }
63+ }
64+ updateVisibility();
65+ }
66+
67+ onEnabledChanged: {
68+ updateVisibility()
69+ }
70+
71+ function updateVisibility() {
72+ if (repeater.visibleIndicators === undefined) {
73+ repeater.visibleIndicators = {}
74+ }
75+ repeater.visibleIndicators[model.identifier] = enabled;
76+ repeater.visibleIndicatorsChanged();
77+ }
78+ }
79+ }
80+
81+ function load() {
82+ indicatorsModel.load();
83+ }
84+}
qml/Panel/MenuContent.qml+13−26
@@ -28,26 +28,22 @@ MainView {
2828
2929 property QtObject indicatorsModel: null
3030 property bool __contentActive: false
31− readonly property int currentMenuIndex : filteredIndicators.mapToSource(tabs.selectedTabIndex)
31+ readonly property int currentMenuIndex: tabs.selectedTabIndex
3232 backgroundColor: "#221e1c" // FIXME not in palette yet
3333 property int contentReleaseInterval: 20000
3434 property bool activeHeader: false
35− property alias visibleIndicators: visibleIndicatorsModel.visible
36− property bool animateNextMenuChange: false
35+ property real headerHeight: tabs.tabBar.height
3736
3837 width: units.gu(40)
3938 height: units.gu(42)
4039
41− function setCurrentMenuIndex(index) {
42− var filteredIndex = filteredIndicators.mapFromSource(index);
43−
44− if (tabs.selectedTabIndex !== filteredIndex) {
45− if (tabs.selectedTabIndex === -1 || !animateNextMenuChange) {
40+ function setCurrentMenuIndex(index, animate) {
41+ if (tabs.selectedTabIndex !== index) {
42+ if (tabs.selectedTabIndex === -1 || !animate) {
4643 tabs.tabBar.animate = false;
4744 }
48− tabs.selectedTabIndex = filteredIndex;
45+ tabs.selectedTabIndex = index;
4946 tabs.tabBar.animate = true;
50− animateNextMenuChange = true;
5147 }
5248 }
5349
@@ -67,29 +63,14 @@ MainView {
6763 tabs.tabBar.alwaysSelectionMode = activeHeader;
6864 }
6965
70− SortFilterProxyModel {
71− id: filteredIndicators
72− model: visibleIndicatorsModel
73− dynamicSortFilter: true
74−
75− filterRole: Indicators.IndicatorsModelRole.IsVisible
76− filterRegExp: RegExp("^true$")
77− }
78−
79− Indicators.VisibleIndicatorsModel {
80− id: visibleIndicatorsModel
81− model: indicatorsModel
82− }
83−
8466 Tabs {
8567 id: tabs
8668 objectName: "tabs"
8769 anchors.fill: parent
88− selectedTabIndex: -1
8970
9071 Repeater {
9172 id: repeater
92− model: filteredIndicators
73+ model: content.indicatorsModel ? content.indicatorsModel : null
9374 objectName: "tabsRepeater"
9475
9576 // FIXME: This is needed because tabs dont handle repeaters well.
@@ -145,6 +126,12 @@ MainView {
145126 property: "title"
146127 value: loader.item && loader.item.hasOwnProperty("title") && loader.item.title !== "" ? loader.item.title : model.identifier
147128 }
129+
130+ Binding {
131+ target: loader.item
132+ property: "objectName"
133+ value: identifier + "-page"
134+ }
148135 }
149136 }
150137 }
qml/Panel/Panel.qml+1−4
@@ -50,7 +50,7 @@ Item {
5050
5151 Connections {
5252 target: indicatorsMenu
53− onShown: hideTimer.stop()
53+ onShownChanged: hideTimer.stop()
5454 }
5555
5656 PanelBackground {
@@ -101,13 +101,10 @@ 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
108107 overFlowWidth: search.state=="hidden" ? parent.width : parent.width - search.width
109−
110− unitProgress: (height - panelHeight) / (openedHeight - panelHeight)
111108 }
112109
113110 PanelSeparatorLine {
tests/mocks/Unity/Indicators/IndicatorsModel.qml+5−5
@@ -28,35 +28,35 @@ ListModel {
2828 "position": 0,
2929 "widgetSource": "qrc:/tests/indciators/qml/fake_menu_widget1.qml",
3030 "pageSource": "qrc:/tests/indciators/qml/fake_menu_page1.qml",
31− "indicatorProperties": ""
31+ "indicatorProperties": { enabled: true }
3232 });
3333
3434 append({ "identifier": "indicator-fake2",
3535 "position": 1,
3636 "widgetSource": "qrc:/tests/indciators/qml/fake_menu_widget2.qml",
3737 "pageSource": "qrc:/tests/indciators/qml/fake_menu_page2.qml",
38− "indicatorProperties": ""
38+ "indicatorProperties": { enabled: true }
3939 });
4040
4141 append({ "identifier": "indicator-fake3",
4242 "position": 2,
4343 "widgetSource": "qrc:/tests/indciators/qml/fake_menu_widget3.qml",
4444 "pageSource": "qrc:/tests/indciators/qml/fake_menu_page3.qml",
45− "indicatorProperties": ""
45+ "indicatorProperties": { enabled: true }
4646 });
4747
4848 append({ "identifier": "indicator-fake4",
4949 "position": 3,
5050 "widgetSource": "qrc:/tests/indciators/qml/fake_menu_widget4.qml",
5151 "pageSource": "qrc:/tests/indciators/qml/fake_menu_page4.qml",
52− "indicatorProperties": ""
52+ "indicatorProperties": { enabled: true }
5353 });
5454
5555 append({ "identifier": "indicator-fake5",
5656 "position": 4,
5757 "widgetSource": "qrc:/tests/indciators/qml/fake_menu_widget5.qml",
5858 "pageSource": "qrc:/tests/indciators/qml/fake_menu_page5.qml",
59− "indicatorProperties": ""
59+ "indicatorProperties": { enabled: true }
6060 });
6161 }
6262}
tests/mocks/Unity/Indicators/qml/fake_menu_page1.qml−1
@@ -19,7 +19,6 @@ import Unity.Indicators 0.1 as Indicators
1919
2020Indicators.FakeMenuPage {
2121 id: menu_plugin1
22− objectName: "menu_page1"
2322
2423 Rectangle {
2524 id: contents
tests/mocks/Unity/Indicators/qml/fake_menu_page2.qml−1
@@ -19,7 +19,6 @@ import Unity.Indicators 0.1 as Indicators
1919
2020Indicators.FakeMenuPage {
2121 id: menu_plugin2
22− objectName: "menu_page2"
2322
2423 Rectangle {
2524 id: contents
tests/mocks/Unity/Indicators/qml/fake_menu_page3.qml−1
@@ -19,7 +19,6 @@ import Unity.Indicators 0.1 as Indicators
1919
2020Indicators.FakeMenuPage {
2121 id: menu_plugin3
22− objectName: "menu_page3"
2322
2423 Rectangle {
2524 id: contents
tests/mocks/Unity/Indicators/qml/fake_menu_page4.qml−1
@@ -19,7 +19,6 @@ import Unity.Indicators 0.1 as Indicators
1919
2020Indicators.FakeMenuPage {
2121 id: menu_plugin4
22− objectName: "menu_page4"
2322
2423 Rectangle {
2524 id: contents
tests/mocks/Unity/Indicators/qml/fake_menu_page5.qml−1
@@ -19,7 +19,6 @@ import Unity.Indicators 0.1 as Indicators
1919
2020Indicators.FakeMenuPage {
2121 id: menu_plugin5
22− objectName: "menu_page5"
2322
2423 Rectangle {
2524 id: contents
tests/qmltests/Panel/tst_IndicatorRow.qml+64−163
@@ -35,7 +35,7 @@ Item {
3535 indicatorModel.load();
3636
3737 indicatorRow.state = "initial";
38− indicatorRow.currentItem = null;
38+ indicatorRow.setCurrentItemIndex(-1);
3939 indicatorRow.unitProgress = 0.0;
4040 }
4141
@@ -51,6 +51,8 @@ Item {
5151 }
5252
5353 indicatorsModel: indicatorModel
54+
55+ Component.onCompleted: indicatorModel.load()
5456 }
5557
5658 Indicators.IndicatorsModel {
@@ -61,199 +63,98 @@ Item {
6163 name: "IndicatorRow"
6264 when: windowShown
6365
66+ function get_indicator_item(index) {
67+ return findChild(indicatorRow.row, "item" + index);
68+ }
69+
6470 function test_set_current_item() {
6571 init_test();
66− indicatorRow.setCurrentItem(0);
72+ indicatorRow.setCurrentItemIndex(0);
6773 compare(indicatorRow.indicatorsModel.get(indicatorRow.currentItemIndex).identifier, "indicator-fake1", "Incorrect item at position 0");
6874
69− indicatorRow.setCurrentItem(1);
75+ indicatorRow.setCurrentItemIndex(1);
7076 compare(indicatorRow.indicatorsModel.get(indicatorRow.currentItemIndex).identifier, "indicator-fake2", "Incorrect item at position 1");
7177
72− indicatorRow.setCurrentItem(2);
78+ indicatorRow.setCurrentItemIndex(2);
7379 compare(indicatorRow.indicatorsModel.get(indicatorRow.currentItemIndex).identifier, "indicator-fake3", "Incorrect item at position 2");
7480 }
75− }
76−
77− UT.UnityTestCase {
78− name: "IndicatorRow_IconPosition"
79− when: windowShown
80−
81− function get_indicator_item_at(index) {
82− return findChild(indicatorRow, "rowRepeater").itemAt(index);
83− }
84−
85− function test_current_item_commit() {
86− init_test();
87−
88− indicatorRow.setCurrentItem(2);
89− indicatorRow.state = "commit";
90− tryCompare(get_indicator_item_at(0), "opacity", 0.0);
91− tryCompare(get_indicator_item_at(1), "opacity", 0.0);
92− tryCompare(get_indicator_item_at(2), "opacity", 1.0);
93− tryCompare(get_indicator_item_at(3), "opacity", 0.0);
94− tryCompare(get_indicator_item_at(4), "opacity", 0.0);
95− }
96− }
97−
98− UT.UnityTestCase {
99− name: "IndicatorRow_Highlight"
100− when: windowShown
101−
102− function get_indicator_item_at(index) {
103− return findChild(indicatorRow, "rowRepeater").itemAt(index);
104− }
105−
106− function test_intial_state() {
107− init_test();
108−
109− indicatorRow.state = "initial";
110− indicatorRow.setCurrentItem(0);
111−
112− compare(indicatorRow.currentItem.highlighted, false, "Indicator should not highlight when in initial state");
113− compare(get_indicator_item_at(1).highlighted, false, "Other indicators should not highlight when in initial state");
114− compare(get_indicator_item_at(2).highlighted, false, "Other indicators should not highlight when in initial state");
115− compare(get_indicator_item_at(3).highlighted, false, "Other indicators should not highlight when in initial state");
116− compare(get_indicator_item_at(4).highlighted, false, "Other indicators should not highlight when in initial state");
117− }
118−
119− function test_hint_state() {
120− init_test();
121−
122− indicatorRow.state = "hint";
123− indicatorRow.setCurrentItem(0);
124−
125− compare(indicatorRow.currentItem.highlighted, true, "Indicator should highlight when in hint state");
126− compare(get_indicator_item_at(1).highlighted, false, "Other indicators should not highlight when in hint state");
127− compare(get_indicator_item_at(2).highlighted, false, "Other indicators should not highlight when in hint state");
128− compare(get_indicator_item_at(3).highlighted, false, "Other indicators should not highlight when in hint state");
129− compare(get_indicator_item_at(4).highlighted, false, "Other indicators should not highlight when in hint state");
130− }
131−
132− function test_revealed_state() {
133− init_test();
134−
135− indicatorRow.state = "reveal";
136− indicatorRow.setCurrentItem(0);
137−
138− compare(indicatorRow.currentItem.highlighted, true, "Indicator should highlight when in reveal state");
139− compare(get_indicator_item_at(1).highlighted, false, "Other indicators should not highlight when in commit state");
140− compare(get_indicator_item_at(2).highlighted, false, "Other indicators should not highlight when in commit state");
141− compare(get_indicator_item_at(3).highlighted, false, "Other indicators should not highlight when in commit state");
142− compare(get_indicator_item_at(4).highlighted, false, "Other indicators should not highlight when in commit state");
143− }
144−
145− function test_commit_state() {
146− init_test();
147−
148− indicatorRow.state = "commit";
149− indicatorRow.setCurrentItem(0);
15081
151− compare(indicatorRow.currentItem.highlighted, true, "Indicator should highlight when in commit state");
152− compare(get_indicator_item_at(1).highlighted, false, "Other indicators should not highlight when in commit state");
153− compare(get_indicator_item_at(2).highlighted, false, "Other indicators should not highlight when in commit state");
154− compare(get_indicator_item_at(3).highlighted, false, "Other indicators should not highlight when in commit state");
155− compare(get_indicator_item_at(4).highlighted, false, "Other indicators should not highlight when in commit state");
82+ function test_highlight_data() {
83+ return [
84+ { index: 0, progress: 0.0, current: false, other: false },
85+ { index: 0, progress: 0.1, current: true, other: false },
86+ { index: 0, progress: 0.5, current: true, other: false },
87+ { index: 0, progress: 1.0, current: true, other: false },
88+ { index: 2, progress: 0.0, current: false, other: false },
89+ { index: 2, progress: 0.1, current: true, other: false },
90+ { index: 2, progress: 0.5, current: true, other: false },
91+ { index: 2, progress: 1.0, current: true, other: false }
92+ ];
15693 }
15794
158− function test_locked_state() {
95+ function test_highlight(data) {
15996 init_test();
16097
161− indicatorRow.state = "locked";
162− indicatorRow.setCurrentItem(0);
98+ indicatorRow.unitProgress = data.progress;
99+ indicatorRow.setCurrentItemIndex(data.index);
163100
164− compare(indicatorRow.currentItem.highlighted, true, "Indicator should highlight when in locked state");
165− compare(get_indicator_item_at(1).highlighted, false, "Other indicators should not highlight when in locked state");
166− compare(get_indicator_item_at(2).highlighted, false, "Other indicators should not highlight when in locked state");
167− compare(get_indicator_item_at(3).highlighted, false, "Other indicators should not highlight when in locked state");
168− compare(get_indicator_item_at(4).highlighted, false, "Other indicators should not highlight when in locked state");
169− }
101+ compare(indicatorRow.currentItem.highlighted, data.current, "Indicator hightlight did not match for current item");
170102
171− function test_opacity() {
172− init_test();
173−
174− indicatorRow.state = "reveal";
175− indicatorRow.unitProgress = 0.5;
176− indicatorRow.setCurrentItem(2);
177−
178− compare(get_indicator_item_at(0).opacity, 0.5, "Other indicator opacity should change in response to panel progress");
179− compare(get_indicator_item_at(1).opacity, 0.5, "Other indicator opacity should change in response to panel progress");
180− compare(get_indicator_item_at(2).opacity, 1.0, "Current indicator should not change in response to panel progress");
181− compare(get_indicator_item_at(3).opacity, 0.5, "Other indicator opacity should change in response to panel progress");
182− compare(get_indicator_item_at(4).opacity, 0.5, "Other indicator opacity should change in response to panel progress");
103+ for (var i = 0; i < indicatorRow.row.count; i++) {
104+ compare(get_indicator_item(i).highlighted, i === data.index ? data.current: data.other, "Indicator hightlight did not match for item iter");
105+ }
183106 }
184− }
185107
186− UT.UnityTestCase {
187− name: "IndicatorRow_Dimmed"
188− when: windowShown
189−
190− function get_indicator_item_at(index) {
191− return findChild(indicatorRow, "rowRepeater").itemAt(index);
108+ function test_opacity_data() {
109+ return [
110+ { index: 0, progress: 0.0, current: 1.0, other: 1.0 },
111+ { index: 0, progress: 0.1, current: 1.0, other: 0.9 },
112+ { index: 0, progress: 0.5, current: 1.0, other: 0.5 },
113+ { index: 0, progress: 1.0, current: 1.0, other: 0.0 },
114+ { index: 2, progress: 0.0, current: 1.0, other: 1.0 },
115+ { index: 2, progress: 0.1, current: 1.0, other: 0.9 },
116+ { index: 2, progress: 0.5, current: 1.0, other: 0.5 },
117+ { index: 2, progress: 1.0, current: 1.0, other: 0.0 }
118+ ];
192119 }
193120
194− function test_intial_state() {
121+ function test_opacity(data) {
195122 init_test();
196123
197− indicatorRow.state = "initial";
198− indicatorRow.setCurrentItem(0);
199−
200− compare(get_indicator_item_at(0).dimmed, false, "Current indicator should not dim when in intiial state");
201− compare(get_indicator_item_at(1).dimmed, false, "Other indicators should not dim when in initial state");
202− compare(get_indicator_item_at(2).dimmed, false, "Other indicators should not dim when in initial state");
203− compare(get_indicator_item_at(3).dimmed, false, "Other indicators should not dim when in initial state");
204− compare(get_indicator_item_at(4).dimmed, false, "Other indicators should not dim when in initial state");
205− }
206−
207− function test_hint_state() {
208− init_test();
124+ indicatorRow.unitProgress = data.progress;
125+ indicatorRow.setCurrentItemIndex(data.index);
209126
210− indicatorRow.state = "hint";
211− indicatorRow.setCurrentItem(0);
127+ tryCompare(indicatorRow.currentItem, "opacity", data.current);
212128
213− compare(get_indicator_item_at(0).dimmed, false, "Current indicator should not dim when in hint state");
214− compare(get_indicator_item_at(1).dimmed, true, "Other indicators should dim when in hint state");
215− compare(get_indicator_item_at(2).dimmed, true, "Other indicators should dim when in hint state");
216− compare(get_indicator_item_at(3).dimmed, true, "Other indicators should dim when in hint state");
217− compare(get_indicator_item_at(4).dimmed, true, "Other indicators should dim when in hint state");
129+ for (var i = 0; i < indicatorRow.row.count; i++) {
130+ tryCompare(get_indicator_item(i), "opacity", i === data.index ? data.current: data.other);
131+ }
218132 }
219133
220− function test_revealed_state() {
221− init_test();
222−
223− indicatorRow.state = "reveal";
224− indicatorRow.setCurrentItem(0);
225−
226− compare(get_indicator_item_at(0).dimmed, false, "Current indicator should not dim when in reveal state");
227− compare(get_indicator_item_at(1).dimmed, true, "Other indicators should dim when in reveal state");
228− compare(get_indicator_item_at(2).dimmed, true, "Other indicators should dim when in reveal state");
229− compare(get_indicator_item_at(3).dimmed, true, "Other indicators should dim when in reveal state");
230− compare(get_indicator_item_at(4).dimmed, true, "Other indicators should dim when in reveal state");
134+ function test_dimmed_data() {
135+ return [
136+ { index: 0, progress: 0.0, current: false, other: false },
137+ { index: 0, progress: 0.1, current: false, other: true },
138+ { index: 0, progress: 0.5, current: false, other: true },
139+ { index: 0, progress: 1.0, current: false, other: true },
140+ { index: 2, progress: 0.0, current: false, other: false },
141+ { index: 2, progress: 0.1, current: false, other: true },
142+ { index: 2, progress: 0.5, current: false, other: true },
143+ { index: 2, progress: 1.0, current: false, other: true }
144+ ];
231145 }
232146
233− function test_commit_state() {
147+ function test_dimmed(data) {
234148 init_test();
235149
236− indicatorRow.state = "commit";
237− indicatorRow.setCurrentItem(0);
238−
239− compare(get_indicator_item_at(0).dimmed, false, "Current indicator should not dim when in commit state");
240− compare(get_indicator_item_at(1).dimmed, true, "Other indicators should dim when in commit state");
241− compare(get_indicator_item_at(2).dimmed, true, "Other indicators should dim when in commit state");
242− compare(get_indicator_item_at(3).dimmed, true, "Other indicators should dim when in commit state");
243− compare(get_indicator_item_at(4).dimmed, true, "Other indicators should dim when in commit state");
244− }
245−
246− function test_locked_state() {
247− init_test();
150+ indicatorRow.unitProgress = data.progress;
151+ indicatorRow.setCurrentItemIndex(data.index);
248152
249− indicatorRow.state = "locked";
250− indicatorRow.setCurrentItem(0);
153+ compare(indicatorRow.currentItem.dimmed, data.current, "Indicator dim did not match for current item");
251154
252− compare(get_indicator_item_at(0).dimmed, false, "Current indicator should not dim when in locked state");
253− compare(get_indicator_item_at(1).dimmed, true, "Other indicators should dim when in locked state");
254− compare(get_indicator_item_at(2).dimmed, true, "Other indicators should dim when in locked state");
255− compare(get_indicator_item_at(3).dimmed, true, "Other indicators should dim when in locked state");
256− compare(get_indicator_item_at(4).dimmed, true, "Other indicators should dim when in locked state");
155+ for (var i = 0; i < indicatorRow.row.count; i++) {
156+ compare(get_indicator_item(i).dimmed, i === data.index ? data.current: data.other, "Indicator dim did not match for item iter");
157+ }
257158 }
258159 }
259160}
tests/qmltests/Panel/tst_Indicators.qml+40−32
@@ -103,21 +103,23 @@ Item {
103103 // tests changing the lateral position of the revealer activates the correct indicator items.
104104
105105 var indicatorRow = findChild(indicators, "indicatorRow")
106− var rowRepeater = findChild(indicators, "rowRepeater")
106+ verify(indicatorRow !== null);
107+ var indicatorRowItems = findChild(indicatorRow, "indicatorRowItems");
108+ verify(indicatorRowItems !== null);
107109
108− for (var i = 0; i < rowRepeater.count; i++) {
109− var indicatorItem = rowRepeater.itemAt(i);
110+ for (var i = 0; i < indicatorRowItems.count; i++) {
111+ var indicatorItem = findChild(indicatorRowItems, "item" + i);
110112
111113 if (!indicatorItem.visible)
112114 continue;
113115
114116 var indicatorPosition = indicators.mapFromItem(indicatorItem,
115− indicatorItem.width/2, indicatorItem.height/2)
117+ indicatorItem.width/2, indicatorItem.height/2);
116118
117119 touchFlick(indicators,
118120 indicatorPosition.x, indicatorPosition.y,
119121 indicatorPosition.x, indicators.openedHeight * 0.4,
120− true /* beginTouch */, false /* endTouch */)
122+ true /* beginTouch */, false /* endTouch */);
121123
122124 compare(indicatorRow.currentItem, indicatorItem,
123125 "Incorrect item activated at position " + i);
@@ -125,10 +127,10 @@ Item {
125127 touchFlick(indicators,
126128 indicatorPosition.x, indicators.openedHeight * 0.4,
127129 indicatorPosition.x, indicatorPosition.y,
128− false /* beginTouch */, true /* endTouch */)
130+ false /* beginTouch */, true /* endTouch */);
129131
130132 // wait until fully closed
131− tryCompare(indicators, "height", indicators.panelHeight)
133+ tryCompare(indicators, "height", indicators.panelHeight);
132134 }
133135 }
134136
@@ -141,20 +143,20 @@ Item {
141143 function test_progress_changes_state_to_not_initial() {
142144 indicators.height = indicators.openedHeight / 2
143145 compare(indicators.state!="initial", true,
144− "Indicators should not be in initial state when partially opened.")
146+ "Indicators should not be in initial state when partially opened.");
145147 }
146148
147149 function test_progress_changes_state_to_locked() {
148150 indicators.height = indicators.openedHeight - indicators.panelHeight
149− compare(indicators.state, "locked", "Indicators should be locked when fully opened.")
151+ compare(indicators.state, "locked", "Indicators should be locked when fully opened.");
150152 }
151153
152154 function test_partially_open() {
153155 indicators.height = indicators.openedHeight / 2
154156 compare(indicators.partiallyOpened, true,
155− "Indicator should show as partially opened when height is half of openedHeight")
157+ "Indicator should show as partially opened when height is half of openedHeight");
156158 compare(indicators.fullyOpened, false,
157− "Indicator should not show as fully opened when height is half of openedHeight")
159+ "Indicator should not show as fully opened when height is half of openedHeight");
158160 }
159161
160162 function test_fully_open() {
@@ -164,8 +166,8 @@ Item {
164166 }
165167
166168 function init_invisible_indicator(identifier) {
167− tryCompareFunction(function() { return findChild(indicators, identifier+"-widget") !== null }, true);
168− var item = findChild(indicators, identifier+"-widget");
169+ tryCompareFunction(function() { return findChild(indicators, identifier+"-delegate") !== undefined }, true);
170+ var item = findChild(indicators, identifier+"-delegate");
169171
170172 item.enabled = false;
171173 }
@@ -179,54 +181,60 @@ Item {
179181 }
180182
181183 function test_row_visible_menuContent_visible(data) {
182−
183184 indicators.show();
184185
185186 var indicatorTabs = findChild(indicators, "tabs");
186− var rowRepeater = findChild(indicators, "rowRepeater")
187−
187+ var indicatorRowItems = findChild(indicators, "indicatorRowItems");
188188
189+ var count = data.visible.length
189190 for (var i = 0; i< data.visible.length; i++) {
190− if (data.visible[i] === false)
191+ if (data.visible[i] === false) {
191192 init_invisible_indicator("indicator-fake" + (i + 1));
193+ count--;
194+ }
192195 }
193196
197+ tryCompare(indicatorRowItems, "count", count);
198+
194199 for (i = 0; i < data.visible.length; i++) {
195− var shouldBeVisible = data.visible[i];
200+ var widgetName = "indicator-fake" + (i + 1 + "-widget");
201+ var pageName = "indicator-fake" + (i + 1 + "-page");
202+
203+ // check for item
204+ tryCompareFunction(function() { return findChild(indicatorRowItems, widgetName) !== null }, data.visible[i]);
196205
197− // check item visibility
198− var indicatorItem = rowRepeater.itemAt(i);
199− tryCompare(indicatorItem, "visible", shouldBeVisible);
200− // check tab visibility
201− tryCompareFunction(function() { return findChild(indicatorTabs, "indicator-fake" + (i + 1)) !== null }, shouldBeVisible);
206+ // check for tab
207+ tryCompareFunction(function() { return findChild(indicatorTabs, pageName) !== null }, data.visible[i]);
202208 }
203209 }
204210
205211 function test_indicator_visible_correct_tabs_data() { return [
206− {tag: "current-first", currentIndex: 0, visible: [false, true, true, true, true], expected: 1 },
207− {tag: "current-last", currentIndex: 4, visible: [true, true, true, true, false], expected: 3 },
208− {tag: "after", currentIndex: 0, visible: [true, false, true, true, true], expected: 0 },
209− {tag: "before", currentIndex: 1, visible: [false, true, true, true, true], expected: 1 }];
212+ {tag: "current-first", currentIndex: 0, visible: [false, true, true, true, true], expectedIndex: 0, expectedTab: "indicator-fake2" },
213+ {tag: "current-last", currentIndex: 4, visible: [true, true, true, true, false], expectedIndex: 3, expectedTab: "indicator-fake4" },
214+ {tag: "after", currentIndex: 0, visible: [true, false, true, true, true], expectedIndex: 0, expectedTab: "indicator-fake1" },
215+ {tag: "before", currentIndex: 1, visible: [false, true, true, true, true], expectedIndex: 1, expectedTab: "indicator-fake2" }];
210216 }
211217
212218 function test_indicator_visible_correct_tabs(data) {
213−
214219 var indicatorTabs = findChild(indicators, "tabs");
215220 var indicatorRow = findChild(indicators, "indicatorRow");
216221
217222 indicators.show();
218− indicatorRow.setCurrentItem(data.currentIndex);
223+ indicatorRow.setCurrentItemIndex(data.currentIndex);
219224 tryCompare(indicators, "fullyOpened", true);
220225
221226 for (var i = 0; i< data.visible.length; i++) {
222− if (data.visible[i] === false)
227+ if (data.visible[i] === false) {
223228 init_invisible_indicator("indicator-fake" + (i + 1));
229+ }
224230 }
225231
226232 // check for current selected item
227− tryCompare(indicatorRow, "currentItemIndex", data.expected);
233+ tryCompare(indicatorRow, "currentItemIndex", data.expectedIndex);
234+
228235 // check for current selected tab
229− tryCompareFunction(function() { return findChild(indicatorTabs, "indicator-fake" + (data.expected + 1)) === indicatorTabs.selectedTab }, true);
236+ tryCompareFunction(function() { return findChild(indicatorTabs, data.expectedTab) === indicatorTabs.selectedTab }, true);
237+
230238 }
231239 }
232240}
tests/qmltests/Panel/tst_MenuContent.qml+6−14
@@ -27,11 +27,11 @@ Item {
2727 height: units.gu(70)
2828
2929 property var indicator_status: {
30− 'menu_page1': { 'started': false, 'reset': 0 },
31− 'menu_page2': { 'started': false, 'reset': 0 },
32− 'menu_page3': { 'started': false, 'reset': 0 },
33− 'menu_page4': { 'started': false, 'reset': 0 },
34− 'menu_page5': { 'started': false, 'reset': 0 }
30+ 'indicator-fake1-page': { 'started': false, 'reset': 0 },
31+ 'indicator-fake2-page': { 'started': false, 'reset': 0 },
32+ 'indicator-fake3-page': { 'started': false, 'reset': 0 },
33+ 'indicator-fake4-page': { 'started': false, 'reset': 0 },
34+ 'indicator-fake5-page': { 'started': false, 'reset': 0 }
3535 }
3636
3737 // Dummy objects
@@ -49,14 +49,6 @@ Item {
4949 indicatorsModel: indicatorsModel
5050 contentReleaseInterval: 50
5151 height: parent.height - 50
52−
53− visibleIndicators: {
54− 'indicator-fake1': true,
55− 'indicator-fake2': true,
56− 'indicator-fake3': true,
57− 'indicator-fake4': true,
58− 'indicator-fake5': true
59− }
6052 }
6153
6254 Rectangle {
@@ -96,7 +88,7 @@ Item {
9688 }
9789
9890 function get_test_menu_objecName(index) {
99− return "menu_page"+(index+1);
91+ return "indicator-fake" + (index + 1) + "-page";
10092 }
10193
10294 property string testTabObjectName : ""
tests/qmltests/Panel/tst_Panel.qml+10−12
@@ -65,9 +65,10 @@ Item {
6565 }
6666
6767 function get_indicator_item(index) {
68− var rowRepeater = findChild(panel.indicators, "rowRepeater");
69− verify(rowRepeater !== null);
70− return rowRepeater.itemAt(index);
68+ var indicatorRow = findChild(panel.indicators, "indicatorRow");
69+ verify(indicatorRow !== null);
70+
71+ return findChild(indicatorRow.row, "item" + index);
7172 }
7273
7374 function get_indicator_item_position(index) {
@@ -144,10 +145,10 @@ Item {
144145 tryCompare(panel.indicators, "fullyOpened", true);
145146 }
146147
147− var indicatorRow = findChild(panel.indicators, "indicatorRow");
148+ var indicatorRow = findChild(panel.indicators, "indicatorRow");
148149 verify(indicatorRow !== null);
149150
150− var rowRepeater = findChild(panel.indicators, "rowRepeater");
151+ var menuContent = findChild(panel.indicators, "menuContent");
151152 verify(indicatorRow !== null);
152153
153154 var menuContent = findChild(panel.indicators, "menuContent");
@@ -162,10 +163,10 @@ Item {
162163 }
163164
164165 // do this for each indicator item
165− for (var i = 0; i < rowRepeater.count; i++) {
166+ for (var i = 0; i < indicatorRow.row.count; i++) {
166167
167168 var indicatorItem = get_indicator_item(i);
168− verify(indicatorItem != undefined);
169+ verify(indicatorItem !== null);
169170
170171 if (!indicatorItem.visible)
171172 continue;
@@ -236,15 +237,12 @@ Item {
236237 var indicatorRow = findChild(panel.indicators, "indicatorRow");
237238 verify(indicatorRow !== null);
238239
239− var rowRepeater = findChild(panel.indicators, "rowRepeater");
240− verify(indicatorRow !== null);
241−
242240 // Get the first indicator
243241 var indicatorItemFirst = get_indicator_item(0);
244− verify(indicatorItemFirst !== undefined);
242+ verify(indicatorItemFirst !== null);
245243
246244 var indicatorItemCoordFirst = get_indicator_item_position(0);
247− var indicatorItemCoordNext = get_indicator_item_position(indicatorRow.count - 1);
245+ var indicatorItemCoordNext = get_indicator_item_position(indicatorRow.row.count - 1);
248246
249247 touchPress(panel,
250248 indicatorItemCoordFirst.x, panel.panelHeight / 2);