on xenial help sign in
Basically skip animations if Showable not shown
6d93355Dalton Durst
qml/Components/Showable.qml+3−2
@@ -1,5 +1,6 @@
1/*
1/*
2 * Copyright (C) 2013 Canonical, Ltd.
2 * Copyright (C) 2013 Canonical, Ltd.
3+ * Copyright (C) 2019 UBports Foundation
3 *
4 *
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
@@ -88,7 +89,7 @@ Item {
88 if (!showAnimation.running) {
89 if (!showAnimation.running) {
89 showAnimation.restart()
90 showAnimation.restart()
90 }
91 }
91− if (__skipShowAnimation) {
92+ if (__skipShowAnimation || shown) {
92 showAnimation.complete();
93 showAnimation.complete();
93 }
94 }
94 } else {
95 } else {
@@ -121,7 +122,7 @@ Item {
121 if (!hideAnimation.running) {
122 if (!hideAnimation.running) {
122 hideAnimation.restart()
123 hideAnimation.restart()
123 }
124 }
124− if (__skipHideAnimation) {
125+ if (__skipHideAnimation || !shown) {
125 hideAnimation.complete();
126 hideAnimation.complete();
126 }
127 }
127 } else {
128 } else {
qml/Shell.qml+4−5
@@ -1,5 +1,6 @@
1/*
1/*
2 * Copyright (C) 2013-2016 Canonical, Ltd.
2 * Copyright (C) 2013-2016 Canonical, Ltd.
3+ * Copyright (C) 2019 UBports Foundation
3 *
4 *
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
@@ -405,7 +406,9 @@ StyledItem {
405 }
406 }
406 // Show the launcher when there are no running apps
407 // Show the launcher when there are no running apps
407 else if (topLevelSurfaceList.count < 1) {
408 else if (topLevelSurfaceList.count < 1) {
408− launcher.switchToNextState("visible")
409+ launcher.switchToNextState("visible");
410+ } else {
411+ launcher.hide();
409 }
412 }
410 }
413 }
411 }
414 }
@@ -431,10 +434,6 @@ StyledItem {
431 // left-edge drag
434 // left-edge drag
432 dragHandleLeftMargin: launcher.available ? launcher.dragAreaWidth + 1 : 0
435 dragHandleLeftMargin: launcher.available ? launcher.dragAreaWidth + 1 : 0
433
436
434− onSessionStarted: {
435− launcher.hide();
436− }
437−
438 onTease: {
437 onTease: {
439 if (!tutorial.running) {
438 if (!tutorial.running) {
440 launcher.tease();
439 launcher.tease();
tests/qmltests/Panel/tst_PanelMenu.qml+36−21
@@ -1,5 +1,6 @@
1/*
1/*
2 * Copyright 2013-2016 Canonical Ltd.
2 * Copyright 2013-2016 Canonical Ltd.
3+ * Copyright 2019 UBports Foundation
3 *
4 *
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
138
139
139 function init() {
140 function init() {
140− indicatorsMenu.hide();
141− tryCompare(indicatorsMenu.hideAnimation, "running", false);
142− compare(indicatorsMenu.state, "initial");
143−
144 indicatorsMenu.verticalVelocityThreshold = 0.5
141 indicatorsMenu.verticalVelocityThreshold = 0.5
142+ tryCompare(indicatorsMenu.hideAnimation, "running", false);
143+ tryCompare(indicatorsMenu, "state", "initial");
144+ wait(100);
145 }
145 }
146
146
147 function cleanup() {
147 function cleanup() {
148+ touchRelease(root);
148 clickThroughSpy.clear();
149 clickThroughSpy.clear();
149 showTappedSpy.clear();
150 showTappedSpy.clear();
151+ indicatorsMenu.hideAnimation.complete();
152+ indicatorsMenu.hideNow();
150 }
153 }
151
154
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);
227 }
230 }
228
231
232+ function test_swipeForCurrentItem_data() {
233+ return [
234+ {item: 0},
235+ {item: 1},
236+ {item: 2},
237+ {item: 3},
238+ {item: 4},
239+ {item: 5},
240+ {item: 6},
241+ {item: 7},
242+ {item: 8},
243+ ]
244+ }
245+
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)
231 {
248 {
232 var panelItemRow = findChild(indicatorsMenu, "panelItemRow");
249 var panelItemRow = findChild(indicatorsMenu, "panelItemRow");
233 verify(panelItemRow !== null);
250 verify(panelItemRow !== null);
234
251
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);
237
253
238− var mappedPosition = indicatorsMenu.mapFromItem(indicatorItem, indicatorItem.width/2, indicatorItem.height/2);
254+ var mappedPosition = indicatorsMenu.mapFromItem(indicatorItem, indicatorItem.width/2, indicatorItem.height/2);
239
255
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 */);
244
260
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);
247
263
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 */);
252
268
253− // wait until fully closed
269+ // wait until fully closed
254− tryCompare(indicatorsMenu, "fullyClosed", true);
270+ tryCompare(indicatorsMenu, "fullyClosed", true);
255− }
256 }
271 }
257
272
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.