on xenial help sign in
Darkened area behind indicators menu should eat input until it fully disappears
6a4c4e2Daniel d'Andrada
qml/Panel/IndicatorsMenu.qml+1
@@ -164,6 +164,7 @@ Showable {
164
164
165 DragHandle {
165 DragHandle {
166 id: __showDragHandle
166 id: __showDragHandle
167+ objectName: "showDragHandle"
167 anchors.bottom: parent.bottom
168 anchors.bottom: parent.bottom
168 anchors.left: parent.left
169 anchors.left: parent.left
169 anchors.right: parent.right
170 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
@@ -163,6 +163,16 @@ IndicatorTest {
163 return indicatorItem;
163 return indicatorItem;
164 }
164 }
165
165
166+ function pullDownIndicatorsMenu() {
167+ var showDragHandle = findChild(panel, "showDragHandle");
168+ touchFlick(showDragHandle,
169+ showDragHandle.width / 2,
170+ showDragHandle.height / 2,
171+ showDragHandle.width / 2,
172+ showDragHandle.height / 2 + (showDragHandle.autoCompleteDragThreshold * 1.1));
173+ tryCompare(panel.indicators, "fullyOpened", true);
174+ }
175+
166 function test_drag_show_data() {
176 function test_drag_show_data() {
167 return [
177 return [
168 { tag: "pinned", fullscreen: false, call: null,
178 { tag: "pinned", fullscreen: false, call: null,
@@ -330,5 +340,47 @@ IndicatorTest {
330
340
331 compare(backgroundPressedSpy.count, 0);
341 compare(backgroundPressedSpy.count, 0);
332 }
342 }
343+
344+ function test_darkenedAreaEatsAllEvents() {
345+
346+ // The center of the area not covered by the indicators menu
347+ // Ie, the visible darkened area behind the menu
348+ var touchPosX = (panel.width - panel.indicators.width) / 2
349+ var touchPosY = panel.indicators.minimizedPanelHeight +
350+ ((panel.height - panel.indicators.minimizedPanelHeight) / 2)
351+
352+ // input goes through while the indicators menu is closed
353+ tryCompare(panel.indicators, "fullyClosed", true);
354+ compare(backgroundPressedSpy.count, 0);
355+ tap(panel, touchPosX, touchPosY);
356+ compare(backgroundPressedSpy.count, 2);
357+
358+ pullDownIndicatorsMenu();
359+
360+ // Darkened area eats input when the indicators menu is fully opened
361+ tap(panel, touchPosX, touchPosY);
362+ compare(backgroundPressedSpy.count, 2);
363+ backgroundPressedSpy.clear();
364+
365+ // And should continue to eat inpunt until the indicators menu is fully closed
366+ wait(10);
367+ while (!panel.indicators.fullyClosed) {
368+ tap(panel, touchPosX, touchPosY);
369+
370+ // it could have got fully closed during the tap
371+ // so we have to double check here
372+ if (!panel.indicators.fullyClosed) {
373+ compare(backgroundPressedSpy.count, 0);
374+ }
375+
376+ // let the animation go a bit further
377+ wait(50);
378+ }
379+
380+ // Now that's fully closed, input should go through again
381+ backgroundPressedSpy.clear();
382+ tap(panel, touchPosX, touchPosY);
383+ compare(backgroundPressedSpy.count, 2);
384+ }
333 }
385 }
334}
386}