on xenial help sign in
Darkened area behind indicators menu should eat input until it fully disappears Fixes: #1417967
95cd8a0Daniel d'Andrada
qml/Panel/IndicatorsMenu.qml+1
@@ -173,6 +173,7 @@ Showable {
173
173
174 DragHandle {
174 DragHandle {
175 id: __showDragHandle
175 id: __showDragHandle
176+ objectName: "showDragHandle"
176 anchors.bottom: parent.bottom
177 anchors.bottom: parent.bottom
177 anchors.left: parent.left
178 anchors.left: parent.left
178 anchors.right: parent.right
179 anchors.right: parent.right
qml/Panel/Panel.qml+1−1
@@ -40,10 +40,10 @@ Item {
40 }
40 }
41 color: "black"
41 color: "black"
42 opacity: indicators.unitProgress * darkenedOpacity
42 opacity: indicators.unitProgress * darkenedOpacity
43+ visible: !indicators.fullyClosed
43
44
44 MouseArea {
45 MouseArea {
45 anchors.fill: parent
46 anchors.fill: parent
46− enabled: indicators.shown
47 onClicked: if (indicators.fullyOpened) indicators.hide();
47 onClicked: if (indicators.fullyOpened) indicators.hide();
48 }
48 }
49 }
49 }
tests/qmltests/Panel/tst_Panel.qml+52
@@ -171,6 +171,16 @@ IndicatorTest {
171 return indicatorItem;
171 return indicatorItem;
172 }
172 }
173
173
174+ function pullDownIndicatorsMenu() {
175+ var showDragHandle = findChild(panel, "showDragHandle");
176+ touchFlick(showDragHandle,
177+ showDragHandle.width / 2,
178+ showDragHandle.height / 2,
179+ showDragHandle.width / 2,
180+ showDragHandle.height / 2 + (showDragHandle.autoCompleteDragThreshold * 1.1));
181+ tryCompare(panel.indicators, "fullyOpened", true);
182+ }
183+
174 function test_drag_show_data() {
184 function test_drag_show_data() {
175 return [
185 return [
176 { tag: "pinned", fullscreen: false, call: null,
186 { tag: "pinned", fullscreen: false, call: null,
@@ -338,5 +348,47 @@ IndicatorTest {
338
348
339 compare(backgroundPressedSpy.count, 0);
349 compare(backgroundPressedSpy.count, 0);
340 }
350 }
351+
352+ function test_darkenedAreaEatsAllEvents() {
353+
354+ // The center of the area not covered by the indicators menu
355+ // Ie, the visible darkened area behind the menu
356+ var touchPosX = (panel.width - panel.indicators.width) / 2
357+ var touchPosY = panel.indicators.minimizedPanelHeight +
358+ ((panel.height - panel.indicators.minimizedPanelHeight) / 2)
359+
360+ // input goes through while the indicators menu is closed
361+ tryCompare(panel.indicators, "fullyClosed", true);
362+ compare(backgroundPressedSpy.count, 0);
363+ tap(panel, touchPosX, touchPosY);
364+ compare(backgroundPressedSpy.count, 2);
365+
366+ pullDownIndicatorsMenu();
367+
368+ // Darkened area eats input when the indicators menu is fully opened
369+ tap(panel, touchPosX, touchPosY);
370+ compare(backgroundPressedSpy.count, 2);
371+ backgroundPressedSpy.clear();
372+
373+ // And should continue to eat inpunt until the indicators menu is fully closed
374+ wait(10);
375+ while (!panel.indicators.fullyClosed) {
376+ tap(panel, touchPosX, touchPosY);
377+
378+ // it could have got fully closed during the tap
379+ // so we have to double check here
380+ if (!panel.indicators.fullyClosed) {
381+ compare(backgroundPressedSpy.count, 0);
382+ }
383+
384+ // let the animation go a bit further
385+ wait(50);
386+ }
387+
388+ // Now that's fully closed, input should go through again
389+ backgroundPressedSpy.clear();
390+ tap(panel, touchPosX, touchPosY);
391+ compare(backgroundPressedSpy.count, 2);
392+ }
341 }
393 }
342}
394}