on xenial help sign in
Fixed tests
commit2fe1152d2cc27d1d645f4c4629ea4d08fbe3f8ac authorNick Dedekind <nick.dedekind@canonical.com> dateFri 28 Oct 2016, 12:19 (10 years ago) parentdb1d9d2
2 files changed+63−3
qml/Panel/Panel.qml+1−1 tests/qmltests/Panel/tst_Panel.qml+62−2
qml/Panel/Panel.qml+1−1
@@ -55,7 +55,7 @@ Item {
5555 id: backMouseEater
5656 anchors.fill: parent
5757 anchors.topMargin: panelHeight
58− visible: __indicators.fullyOpened || __applicationMenus.fullyOpened
58+ visible: !indicators.fullyClosed || !applicationMenus.fullyClosed
5959 enabled: visible
6060 hoverEnabled: true // should also eat hover events, otherwise they will pass through
6161
tests/qmltests/Panel/tst_Panel.qml+62−2
@@ -250,10 +250,16 @@ PanelTest {
250250 panel.fullscreenMode = false;
251251 callManager.foregroundCall = null;
252252
253+ PanelState.title = ""
254+
253255 panel.indicators.hide();
254256 // Wait for animation to complete
255257 tryCompare(panel.indicators.hideAnimation, "running", false);
256258
259+ panel.applicationMenus.hide();
260+ // Wait for animation to complete
261+ tryCompare(panel.applicationMenus.hideAnimation, "running", false);
262+
257263 // Wait for the indicators to get into position.
258264 // (switches between normal and fullscreen modes are animated)
259265 var indicatorArea = findChild(panel, "indicatorArea");
@@ -273,7 +279,7 @@ PanelTest {
273279 }
274280
275281 function pullDownIndicatorsMenu() {
276− var showDragHandle = findChild(panel, "showDragHandle");
282+ var showDragHandle = findChild(panel.indicators, "showDragHandle");
277283 touchFlick(showDragHandle,
278284 showDragHandle.width / 2,
279285 showDragHandle.height / 2,
@@ -282,6 +288,16 @@ PanelTest {
282288 tryCompare(panel.indicators, "fullyOpened", true);
283289 }
284290
291+ function pullDownApplicationsMenu() {
292+ var showDragHandle = findChild(panel.applicationMenus, "showDragHandle");
293+ touchFlick(showDragHandle,
294+ showDragHandle.width / 2,
295+ showDragHandle.height / 2,
296+ showDragHandle.width / 2,
297+ showDragHandle.height / 2 + (showDragHandle.autoCompleteDragThreshold * 1.1));
298+ tryCompare(panel.applicationMenus, "fullyOpened", true);
299+ }
300+
285301 function test_drag_show_data() {
286302 return [
287303 { tag: "pinned", fullscreen: false, call: null,
@@ -448,7 +464,7 @@ PanelTest {
448464 }
449465 }
450466
451− function test_darkenedAreaEatsAllEvents() {
467+ function test_darkenedAreaEatsAllIndicatorEvents() {
452468
453469 // The center of the area not covered by the indicators menu
454470 // Ie, the visible darkened area behind the menu
@@ -490,6 +506,50 @@ PanelTest {
490506 compare(backgroundPressedSpy.count, 2);
491507 }
492508
509+ function test_darkenedAreaEatsAllApplicationMenuEvents() {
510+ PanelState.title = "Fake Title"
511+
512+ // The center of the area not covered by the indicators menu
513+ // Ie, the visible darkened area behind the menu
514+ var touchPosX = panel.applicationMenus.width + (panel.width - panel.applicationMenus.width) / 2
515+ var touchPosY = panel.applicationMenus.minimizedPanelHeight +
516+ ((panel.height - panel.applicationMenus.minimizedPanelHeight) / 2)
517+
518+ // input goes through while the indicators menu is closed
519+ tryCompare(panel.applicationMenus, "fullyClosed", true);
520+ compare(backgroundPressedSpy.count, 0);
521+ tap(panel, touchPosX, touchPosY);
522+ compare(backgroundPressedSpy.count, 2);
523+
524+ pullDownApplicationsMenu();
525+
526+ // Darkened area eats input when the indicators menu is fully opened
527+ tap(panel, touchPosX, touchPosY);
528+ compare(backgroundPressedSpy.count, 2);
529+ backgroundPressedSpy.clear();
530+
531+ // And should continue to eat inpunt until the indicators menu is fully closed
532+ wait(10);
533+ while (!panel.applicationMenus.fullyClosed) {
534+ tap(panel, touchPosX, touchPosY);
535+
536+ // it could have got fully closed during the tap
537+ // so we have to double check here
538+ if (!panel.applicationMenus.fullyClosed) {
539+ compare(backgroundPressedSpy.count, 0);
540+ }
541+
542+ // let the animation go a bit further
543+ wait(50);
544+ }
545+
546+ // Now that's fully closed, input should go through again
547+ backgroundPressedSpy.clear();
548+ tap(panel, touchPosX, touchPosY);
549+ compare(backgroundPressedSpy.count, 2);
550+ }
551+
552+
493553 /*
494554 Regression test for https://bugs.launchpad.net/ubuntu/+source/unity8/+bug/1439318
495555 When the panel is in fullscreen mode and the user taps near the top edge,