@@ -1,5 +1,6 @@
2 * Copyright 2013-2016 Canonical Ltd.
2 * Copyright 2013-2016 Canonical Ltd.
3+ * Copyright 2019 UBports Foundation
4 * This program is free software; you can redistribute it and/or modify
5 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License as published by
6 * it under the terms of the GNU General Public License as published by
@@ -137,16 +138,18 @@ PanelTest {
137 when: windowShown
138 when: windowShown
139 function init() {
140 function init() {
140− indicatorsMenu.hide();
141− tryCompare(indicatorsMenu.hideAnimation, "running", false);
142− compare(indicatorsMenu.state, "initial");
144 indicatorsMenu.verticalVelocityThreshold = 0.5
141 indicatorsMenu.verticalVelocityThreshold = 0.5
142+ tryCompare(indicatorsMenu.hideAnimation, "running", false);
143+ tryCompare(indicatorsMenu, "state", "initial");
147 function cleanup() {
147 function cleanup() {
148 clickThroughSpy.clear();
149 clickThroughSpy.clear();
149 showTappedSpy.clear();
150 showTappedSpy.clear();
151+ indicatorsMenu.hideAnimation.complete();
152+ indicatorsMenu.hideNow();
152 function get_indicator_item(index) {
155 function get_indicator_item(index) {
@@ -226,33 +229,45 @@ PanelTest {
226 touchRelease(indicatorsMenu, mappedPosition.x, indicatorsMenu.minimizedPanelHeight / 2);
229 touchRelease(indicatorsMenu, mappedPosition.x, indicatorsMenu.minimizedPanelHeight / 2);
232+ function test_swipeForCurrentItem_data() {
229 // tests swiping on an indicator item activates the correct item.
246 // tests swiping on an indicator item activates the correct item.
230− function test_swipeForCurrentItem()
247+ function test_swipeForCurrentItem(data)
232 var panelItemRow = findChild(indicatorsMenu, "panelItemRow");
249 var panelItemRow = findChild(indicatorsMenu, "panelItemRow");
233 verify(panelItemRow !== null);
250 verify(panelItemRow !== null);
235− for (var i = 0; i < root.originalModelData.length; i++) {
236− var indicatorItem = get_indicator_item(i);
252+ var indicatorItem = get_indicator_item(data.item);
238− var mappedPosition = indicatorsMenu.mapFromItem(indicatorItem, indicatorItem.width/2, indicatorItem.height/2);
254+ var mappedPosition = indicatorsMenu.mapFromItem(indicatorItem, indicatorItem.width/2, indicatorItem.height/2);
240− touchFlick(indicatorsMenu,
256+ touchFlick(indicatorsMenu,
241− mappedPosition.x, mappedPosition.y,
257+ mappedPosition.x, mappedPosition.y,
242− mappedPosition.x, indicatorsMenu.openedHeight / 2,
258+ mappedPosition.x, indicatorsMenu.openedHeight / 2,
243− true /* beginTouch */, false /* endTouch */);
259+ true /* beginTouch */, false /* endTouch */);
245− tryCompare(panelItemRow, "currentItem", indicatorItem, undefined /*timeout, default */,
261+ tryCompare(panelItemRow, "currentItem", indicatorItem, undefined /*timeout, default */,
246− "Incorrect item activated at position " + i);
262+ "Incorrect item activated at position " + data.item);
248− touchFlick(panelItemRow,
264+ touchFlick(panelItemRow,
249− mappedPosition.x, indicatorsMenu.openedHeight / 2,
265+ mappedPosition.x, indicatorsMenu.openedHeight / 2,
250− mappedPosition.x, mappedPosition.y,
266+ mappedPosition.x, mappedPosition.y,
251− false /* beginTouch */, true /* endTouch */);
267+ false /* beginTouch */, true /* endTouch */);
253− // wait until fully closed
269+ // wait until fully closed
254− tryCompare(indicatorsMenu, "fullyClosed", true);
270+ tryCompare(indicatorsMenu, "fullyClosed", true);
258 // Test the vertical velocity check when flicking the indicators open at an angle.
273 // Test the vertical velocity check when flicking the indicators open at an angle.