@@ -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)
33− property bool search_clicked: false
33+ property bool searchClicked: false
35 Connections {
35 Connections {
36 target: panel
36 target: panel
37− onSearchClicked: search_clicked = true
37+ onSearchClicked: searchClicked = true
@@ -54,27 +54,26 @@ Item {
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");
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);
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);
71− var indicator_row = findChild(panel.indicators, "indicatorRow");
72− verify(indicator_row != undefined)
74− var indicator_item = get_indicator_item(index);
73+ var indicatorItem = get_indicator_item(index);
75− verify(indicator_item != undefined);
74+ verify(indicatorItem != undefined);
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);
80 // Pressing on the indicator panel should activate the indicator hints
79 // Pressing on the indicator panel should activate the indicator hints
@@ -83,11 +82,11 @@ Item {
83 panel.fullscreenMode = false;
82 panel.fullscreenMode = false;
84 // Wait for the indicators to get into position.
83 // Wait for the indicators to get into position.
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);
88− var indicator_item_coord = get_indicator_item_position(0);
87+ var indicatorItemCoord = get_indicator_item_position(0);
90− touchPress(panel, indicator_item_coord.x, panel.panelHeight / 2)
89+ touchPress(panel, indicatorItemCoord.x, panel.panelHeight / 2);
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);
99− touchRelease(panel, indicator_item_coord.x, panel.panelHeight/2)
98+ touchRelease(panel, indicatorItemCoord.x, panel.panelHeight/2);
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
@@ -105,31 +104,31 @@ Item {
105 panel.fullscreenMode = true;
104 panel.fullscreenMode = true;
106 // Wait for the indicators to get into position.
105 // Wait for the indicators to get into position.
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);
110− var indicator_item_coord = get_indicator_item_position(0);
109+ var indicatorItemCoord = get_indicator_item_position(0);
112− touchPress(panel, indicator_item_coord.x, panel.panelHeight / 2)
111+ touchPress(panel, indicatorItemCoord.x, panel.panelHeight / 2);
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);
117 // no hint animation when fullscreen
116 // no hint animation when fullscreen
118− compare(panel.indicators.y, -panel.panelHeight)
117+ compare(panel.indicators.y, -panel.panelHeight);
119 var indicatorRow = findChild(panel.indicators, "indicatorRow");
118 var indicatorRow = findChild(panel.indicators, "indicatorRow");
120− verify(indicatorRow != undefined)
119+ verify(indicatorRow != undefined);
121− compare(indicatorRow.y, 0)
120+ compare(indicatorRow.y, 0);
122− compare(panel.indicators.height, panel.indicators.panelHeight)
121+ compare(panel.indicators.height, panel.indicators.panelHeight);
123 compare(panel.indicators.partiallyOpened, false,
122 compare(panel.indicators.partiallyOpened, false,
124 "Indicator should not be partially opened when panel is pressed in" +
123 "Indicator should not be partially opened when panel is pressed in" +
125− " fullscreenmode")
124+ " fullscreenmode");
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");
129− touchRelease(panel, indicator_item_coord.x, panel.panelHeight/2)
128+ touchRelease(panel, indicatorItemCoord.x, panel.panelHeight/2);
132− function test_drag_show_data() { return get_window_data() }
131+ function test_drag_show_data() { return get_window_data(); }
134 // Dragging from a indicator item in the panel will gradually expose the
133 // Dragging from a indicator item in the panel will gradually expose the
135 // indicators, first by running the hint animation, then after dragging down will
134 // indicators, first by running the hint animation, then after dragging down will
@@ -137,53 +136,53 @@ Item {
137 function test_drag_show(data) {
136 function test_drag_show(data) {
138 panel.fullscreenMode = data.fullscreenFlag;
137 panel.fullscreenMode = data.fullscreenFlag;
140− var indicator_row = findChild(panel.indicators, "indicatorRow");
139+ var indicatorRow = findChild(panel.indicators, "indicatorRow");
141− verify(indicator_row != undefined)
140+ verify(indicatorRow != undefined);
143− var row_repeater = findChild(panel.indicators, "rowRepeater");
142+ var rowRepeater = findChild(panel.indicators, "rowRepeater");
144− verify(indicator_row != undefined)
143+ verify(indicatorRow != undefined);
146− var menu_content = findChild(panel.indicators, "menuContent");
145+ var menuContent = findChild(panel.indicators, "menuContent");
147− verify(indicator_row != undefined)
146+ verify(indicatorRow != undefined);
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)
151 if (data.fullscreenFlag) {
150 if (data.fullscreenFlag) {
152− tryCompare(panel.indicators, "y", -panel.panelHeight)
151+ tryCompare(panel.indicators, "y", -panel.panelHeight);
154− tryCompare(panel.indicators, "y", 0)
153+ tryCompare(panel.indicators, "y", 0);
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++) {
160− var indicator_item = get_indicator_item(i);
159+ var indicatorItem = get_indicator_item(i);
161− verify(indicator_item != undefined)
160+ verify(indicatorItem != undefined);
163− var indicator_item_coord = get_indicator_item_position(i);
162+ var indicatorItemCoord = get_indicator_item_position(i);
165 touchPress(panel,
164 touchPress(panel,
166− indicator_item_coord.x, panel.panelHeight / 2)
165+ indicatorItemCoord.x, panel.panelHeight / 2);
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 */);
174 // Indicators height should follow the drag, and therefore increase accordingly.
173 // Indicators height should follow the drag, and therefore increase accordingly.
175 // They should be at least half-way through the screen
174 // They should be at least half-way through the screen
176 tryCompareFunction(
175 tryCompareFunction(
177 function() {return panel.indicators.height >= panel.height * 0.5},
176 function() {return panel.indicators.height >= panel.height * 0.5},
180− touchRelease(panel, indicator_item_coord.x, panel.height * 0.8)
179+ touchRelease(panel, indicatorItemCoord.x, panel.height * 0.8);
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.__shown, true, "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);
186− // init for next indicator_item
185+ // init for next indicatorItem
@@ -192,26 +191,67 @@ Item {
192 panel.fullscreenMode = false;
191 panel.fullscreenMode = false;
193 panel.searchVisible = true;
192 panel.searchVisible = true;
195− var search_indicator = findChild(panel, "search");
194+ var searchIndicator = findChild(panel, "search");
196− verify(search_indicator != undefined);
195+ verify(searchIndicator != undefined);
198− tap(search_indicator, 1, 1)
197+ tap(searchIndicator, 1, 1);
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");
204 function test_search_click_when_not_visible() {
203 function test_search_click_when_not_visible() {
205 panel.fullscreenMode = false;
204 panel.fullscreenMode = false;
206− panel.searchVisible = false
205+ panel.searchVisible = false;
207+ var searchIndicator = findChild(panel, "search");
208+ verify(searchIndicator != undefined);
210+ tap(searchIndicator, 1, 1);
212+ compare(searchClicked, false,
213+ "Tapping search indicator while it was not visible emitted searchClicked signal");
216+ // Test the vertical velocity check when flicking the indicators open at an angle.
217+ // If the vertical velocity is above a specific point, we shouldnt change active indicators
218+ // if the x position changes
219+ function test_vertical_velocity_detector() {
220+ panel.fullscreenMode = false;
221+ panel.searchVisible = false;
223+ var indicatorRow = findChild(panel.indicators, "indicatorRow");
224+ verify(indicatorRow != undefined);
226+ var rowRepeater = findChild(panel.indicators, "rowRepeater");
227+ verify(indicatorRow != undefined);
229+ // Get the first indicator
230+ var indicatorItemFirst = get_indicator_item(0);
231+ verify(indicatorItemFirst != undefined);
233+ var indicatorItemCoordFirst = get_indicator_item_position(0);
234+ var indicatorItemCoordNext = get_indicator_item_position(indicatorRow.count - 1);
237+ indicatorItemCoordFirst.x, panel.panelHeight / 2);
239+ // 1) Drag the mouse down to hint a bit
241+ indicatorItemCoordFirst.x, panel.panelHeight / 2,
242+ indicatorItemCoordFirst.x, panel.panelHeight * 2,
243+ false /* beginTouch */, false /* endTouch */);
208− var search_indicator = findChild(panel, "search");
245+ tryCompare(indicatorRow, "currentItem", indicatorItemFirst)
209− verify(search_indicator != undefined);
211− tap(search_indicator, 1, 1)
247+ // 1) Flick mouse down to bottom
249+ indicatorItemCoordFirst.x, panel.panelHeight * 2,
250+ indicatorItemCoordNext.x, panel.height,
251+ false /* beginTouch */, true /* endTouch */,
252+ units.gu(10) /* speed */, 30 /* iterations */); // more samples needed for accurate velocity
213− compare(search_clicked, false,
254+ compare(indicatorRow.currentItem, indicatorItemFirst, "First indicator should still be the current item");
214− "Tapping search indicator while it was not visible emitted searchClicked signal")