on xenial help sign in
fixed code style
97f1907Nick Dedekind
tests/qmltests/Panel/tst_Panel.qml+58−59
@@ -30,11 +30,11 @@ Item {
30 width: units.gu(40)
30 width: units.gu(40)
31 height: units.gu(80)
31 height: units.gu(80)
32
32
33− property bool search_clicked: false
33+ property bool searchClicked: false
34
34
35 Connections {
35 Connections {
36 target: panel
36 target: panel
37− onSearchClicked: search_clicked = true
37+ onSearchClicked: searchClicked = true
38 }
38 }
39
39
40 Panel {
40 Panel {
@@ -54,27 +54,26 @@ Item {
54
54
55
55
56 function init() {
56 function init() {
57− search_clicked = false;
57+ searchClicked = false;
58 panel.indicators.hide();
58 panel.indicators.hide();
59 tryCompare(panel.indicators.hideAnimation, "running", false);
59 tryCompare(panel.indicators.hideAnimation, "running", false);
60 tryCompare(panel.indicators, "state", "initial");
60 tryCompare(panel.indicators, "state", "initial");
61 }
61 }
62
62
63 function get_indicator_item(index) {
63 function get_indicator_item(index) {
64− var row_repeater = findChild(panel.indicators, "rowRepeater");
64+ var rowRepeater = findChild(panel.indicators, "rowRepeater");
65− verify(row_repeater != undefined);
65+ verify(rowRepeater != undefined);
66− return row_repeater.itemAt(index);
66+ return rowRepeater.itemAt(index);
67 }
67 }
68
68
69 function get_indicator_item_position(index) {
69 function get_indicator_item_position(index) {
70+ var indicatorRow = findChild(panel.indicators, "indicatorRow");
71+ verify(indicatorRow != undefined);
70
72
71− var indicator_row = findChild(panel.indicators, "indicatorRow");
72− verify(indicator_row != undefined);
73−
74− var indicator_item = get_indicator_item(index);
73+ var indicatorItem = get_indicator_item(index);
75− verify(indicator_item != undefined);
74+ verify(indicatorItem != undefined);
76
75
77− return panel.mapFromItem(indicator_item, indicator_item.width/2, indicator_item.height/2);
76+ return panel.mapFromItem(indicatorItem, indicatorItem.width/2, indicatorItem.height/2);
78 }
77 }
79
78
80 // Pressing on the indicator panel should activate the indicator hints
79 // Pressing on the indicator panel should activate the indicator hints
@@ -85,9 +84,9 @@ Item {
85 // (switches between normal and fullscreen modes are animated)
84 // (switches between normal and fullscreen modes are animated)
86 tryCompare(panel.indicators, "y", 0);
85 tryCompare(panel.indicators, "y", 0);
87
86
88− var indicator_item_coord = get_indicator_item_position(0);
87+ var indicatorItemCoord = get_indicator_item_position(0);
89
88
90− touchPress(panel, indicator_item_coord.x, panel.panelHeight / 2);
89+ touchPress(panel, indicatorItemCoord.x, panel.panelHeight / 2);
91
90
92 // hint animation should be run, meaning that indicators will move downwards
91 // hint animation should be run, meaning that indicators will move downwards
93 // by hintValue pixels without any drag taking place
92 // by hintValue pixels without any drag taking place
@@ -96,7 +95,7 @@ Item {
96 tryCompare(panel.indicators, "partiallyOpened", true);
95 tryCompare(panel.indicators, "partiallyOpened", true);
97 tryCompare(panel.indicators, "fullyOpened", false);
96 tryCompare(panel.indicators, "fullyOpened", false);
98
97
99− touchRelease(panel, indicator_item_coord.x, panel.panelHeight/2);
98+ touchRelease(panel, indicatorItemCoord.x, panel.panelHeight/2);
100 }
99 }
101
100
102 // Pressing on the top edge of the screen should have no effect if the panel
101 // Pressing on the top edge of the screen should have no effect if the panel
@@ -107,9 +106,9 @@ Item {
107 // (switches between normal and fullscreen modes are animated)
106 // (switches between normal and fullscreen modes are animated)
108 tryCompare(panel.indicators, "y", -panel.panelHeight);
107 tryCompare(panel.indicators, "y", -panel.panelHeight);
109
108
110− var indicator_item_coord = get_indicator_item_position(0);
109+ var indicatorItemCoord = get_indicator_item_position(0);
111
110
112− touchPress(panel, indicator_item_coord.x, panel.panelHeight / 2);
111+ touchPress(panel, indicatorItemCoord.x, panel.panelHeight / 2);
113
112
114 // Give some time for a hint animation to change things, if any
113 // Give some time for a hint animation to change things, if any
115 wait(500);
114 wait(500);
@@ -126,7 +125,7 @@ Item {
126 compare(panel.indicators.fullyOpened, false, "Indicator should not be partially" +
125 compare(panel.indicators.fullyOpened, false, "Indicator should not be partially" +
127 " opened when panel is pressed in fullscreenmode");
126 " opened when panel is pressed in fullscreenmode");
128
127
129− touchRelease(panel, indicator_item_coord.x, panel.panelHeight/2);
128+ touchRelease(panel, indicatorItemCoord.x, panel.panelHeight/2);
130 }
129 }
131
130
132 function test_drag_show_data() { return get_window_data(); }
131 function test_drag_show_data() { return get_window_data(); }
@@ -137,14 +136,14 @@ Item {
137 function test_drag_show(data) {
136 function test_drag_show(data) {
138 panel.fullscreenMode = data.fullscreenFlag;
137 panel.fullscreenMode = data.fullscreenFlag;
139
138
140− var indicator_row = findChild(panel.indicators, "indicatorRow");
139+ var indicatorRow = findChild(panel.indicators, "indicatorRow");
141− verify(indicator_row != undefined);
140+ verify(indicatorRow != undefined);
142
141
143− var row_repeater = findChild(panel.indicators, "rowRepeater");
142+ var rowRepeater = findChild(panel.indicators, "rowRepeater");
144− verify(indicator_row != undefined);
143+ verify(indicatorRow != undefined);
145
144
146− var menu_content = findChild(panel.indicators, "menuContent");
145+ var menuContent = findChild(panel.indicators, "menuContent");
147− verify(indicator_row != undefined);
146+ verify(indicatorRow != undefined);
148
147
149 // Wait for the indicators to get into position.
148 // Wait for the indicators to get into position.
150 // (switches between normal and fullscreen modes are animated)
149 // (switches between normal and fullscreen modes are animated)
@@ -155,20 +154,20 @@ Item {
155 }
154 }
156
155
157 // do this for each indicator item
156 // do this for each indicator item
158− for (var i = 0; i < row_repeater.count; i++) {
157+ for (var i = 0; i < rowRepeater.count; i++) {
159
158
160− var indicator_item = get_indicator_item(i);
159+ var indicatorItem = get_indicator_item(i);
161− verify(indicator_item != undefined);
160+ verify(indicatorItem != undefined);
162
161
163− var indicator_item_coord = get_indicator_item_position(i);
162+ var indicatorItemCoord = get_indicator_item_position(i);
164
163
165 touchPress(panel,
164 touchPress(panel,
166− indicator_item_coord.x, panel.panelHeight / 2);
165+ indicatorItemCoord.x, panel.panelHeight / 2);
167
166
168 // 1) Drag the mouse down
167 // 1) Drag the mouse down
169 touchFlick(panel,
168 touchFlick(panel,
170− indicator_item_coord.x, panel.panelHeight / 2,
169+ indicatorItemCoord.x, panel.panelHeight / 2,
171− indicator_item_coord.x, panel.height * 0.8,
170+ indicatorItemCoord.x, panel.height * 0.8,
172 false /* beginTouch */, false /* endTouch */);
171 false /* beginTouch */, false /* endTouch */);
173
172
174 // Indicators height should follow the drag, and therefore increase accordingly.
173 // Indicators height should follow the drag, and therefore increase accordingly.
@@ -177,13 +176,13 @@ Item {
177 function() {return panel.indicators.height >= panel.height * 0.5},
176 function() {return panel.indicators.height >= panel.height * 0.5},
178 true);
177 true);
179
178
180− touchRelease(panel, indicator_item_coord.x, panel.height * 0.8);
179+ touchRelease(panel, indicatorItemCoord.x, panel.height * 0.8);
181
180
182− compare(indicator_row.currentItem, indicator_item,
181+ compare(indicatorRow.currentItem, indicatorItem,
183 "Incorrect item activated at position " + i);
182 "Incorrect item activated at position " + i);
184− compare(menu_content.currentMenuIndex, i, "Menu conetent should be enabled for item at position " + i);
183+ compare(menuContent.currentMenuIndex, i, "Menu conetent should be enabled for item at position " + i);
185
184
186− // init for next indicator_item
185+ // init for next indicatorItem
187 init();
186 init();
188 }
187 }
189 }
188 }
@@ -192,12 +191,12 @@ Item {
192 panel.fullscreenMode = false;
191 panel.fullscreenMode = false;
193 panel.searchVisible = true;
192 panel.searchVisible = true;
194
193
195− var search_indicator = findChild(panel, "search");
194+ var searchIndicator = findChild(panel, "search");
196− verify(search_indicator != undefined);
195+ verify(searchIndicator != undefined);
197
196
198− tap(search_indicator, 1, 1);
197+ tap(searchIndicator, 1, 1);
199
198
200− compare(search_clicked, true,
199+ compare(searchClicked, true,
201 "Tapping search indicator while it was enabled did not emit searchClicked signal");
200 "Tapping search indicator while it was enabled did not emit searchClicked signal");
202 }
201 }
203
202
@@ -205,54 +204,54 @@ Item {
205 panel.fullscreenMode = false;
204 panel.fullscreenMode = false;
206 panel.searchVisible = false;
205 panel.searchVisible = false;
207
206
208− var search_indicator = findChild(panel, "search");
207+ var searchIndicator = findChild(panel, "search");
209− verify(search_indicator != undefined);
208+ verify(searchIndicator != undefined);
210
209
211− tap(search_indicator, 1, 1);
210+ tap(searchIndicator, 1, 1);
212
211
213− compare(search_clicked, false,
212+ compare(searchClicked, false,
214 "Tapping search indicator while it was not visible emitted searchClicked signal");
213 "Tapping search indicator while it was not visible emitted searchClicked signal");
215 }
214 }
216
215
217 // Test the vertical velocity check when flicking the indicators open at an angle.
216 // Test the vertical velocity check when flicking the indicators open at an angle.
218 // If the vertical velocity is above a specific point, we shouldnt change active indicators
217 // If the vertical velocity is above a specific point, we shouldnt change active indicators
219 // if the x position changes
218 // if the x position changes
220− function test_veritcal_velocity_detector() {
219+ function test_vertical_velocity_detector() {
221 panel.fullscreenMode = false;
220 panel.fullscreenMode = false;
222 panel.searchVisible = false;
221 panel.searchVisible = false;
223
222
224− var indicator_row = findChild(panel.indicators, "indicatorRow");
223+ var indicatorRow = findChild(panel.indicators, "indicatorRow");
225− verify(indicator_row != undefined);
224+ verify(indicatorRow != undefined);
226
225
227− var row_repeater = findChild(panel.indicators, "rowRepeater");
226+ var rowRepeater = findChild(panel.indicators, "rowRepeater");
228− verify(indicator_row != undefined);
227+ verify(indicatorRow != undefined);
229
228
230 // Get the first indicator
229 // Get the first indicator
231− var indicator_item_first = get_indicator_item(0);
230+ var indicatorItemFirst = get_indicator_item(0);
232− verify(indicator_item_first != undefined);
231+ verify(indicatorItemFirst != undefined);
233
232
234− var indicator_item_coord_first = get_indicator_item_position(0);
233+ var indicatorItemCoordFirst = get_indicator_item_position(0);
235− var indicator_item_coord_next = get_indicator_item_position(indicator_row.count - 1);
234+ var indicatorItemCoordNext = get_indicator_item_position(indicatorRow.count - 1);
236
235
237 touchPress(panel,
236 touchPress(panel,
238− indicator_item_coord_first.x, panel.panelHeight / 2);
237+ indicatorItemCoordFirst.x, panel.panelHeight / 2);
239
238
240 // 1) Drag the mouse down to hint a bit
239 // 1) Drag the mouse down to hint a bit
241 touchFlick(panel,
240 touchFlick(panel,
242− indicator_item_coord_first.x, panel.panelHeight / 2,
241+ indicatorItemCoordFirst.x, panel.panelHeight / 2,
243− indicator_item_coord_first.x, panel.panelHeight * 2,
242+ indicatorItemCoordFirst.x, panel.panelHeight * 2,
244 false /* beginTouch */, false /* endTouch */);
243 false /* beginTouch */, false /* endTouch */);
245
244
246− tryCompare(indicator_row, "currentItem", indicator_item_first)
245+ tryCompare(indicatorRow, "currentItem", indicatorItemFirst)
247
246
248 // 1) Flick mouse down to bottom
247 // 1) Flick mouse down to bottom
249 touchFlick(panel,
248 touchFlick(panel,
250− indicator_item_coord_first.x, panel.panelHeight * 2,
249+ indicatorItemCoordFirst.x, panel.panelHeight * 2,
251− indicator_item_coord_next.x, panel.height,
250+ indicatorItemCoordNext.x, panel.height,
252 false /* beginTouch */, true /* endTouch */,
251 false /* beginTouch */, true /* endTouch */,
253 units.gu(10) /* speed */, 30 /* iterations */); // more samples needed for accurate velocity
252 units.gu(10) /* speed */, 30 /* iterations */); // more samples needed for accurate velocity
254
253
255− compare(indicator_row.currentItem, indicator_item_first, "First indicator should still be the current item");
254+ compare(indicatorRow.currentItem, indicatorItemFirst, "First indicator should still be the current item");
256 }
255 }
257 }
256 }
258}
257}