on xenial help sign in
Darkened area behind indicators menu should eat input until it fully disappears
commit6a4c4e203e33c440daa31559e02cba9476f9d73d authorDaniel d'Andrada <daniel.dandrada@canonical.com> dateMon 2 Mar 2015, 14:21 (12 years ago) parent22c5c4d
3 files changed+54−1
qml/Panel/IndicatorsMenu.qml+1 qml/Panel/Panel.qml+1−1 tests/qmltests/Panel/tst_Panel.qml+52
qml/Panel/IndicatorsMenu.qml+1
@@ -164,6 +164,7 @@ Showable {
164164
165165 DragHandle {
166166 id: __showDragHandle
167+ objectName: "showDragHandle"
167168 anchors.bottom: parent.bottom
168169 anchors.left: parent.left
169170 anchors.right: parent.right
qml/Panel/Panel.qml+1−1
@@ -40,10 +40,10 @@ Item {
4040 }
4141 color: "black"
4242 opacity: indicators.unitProgress * darkenedOpacity
43+ visible: !indicators.fullyClosed
4344
4445 MouseArea {
4546 anchors.fill: parent
46− enabled: indicators.shown
4747 onClicked: if (indicators.fullyOpened) indicators.hide();
4848 }
4949 }
tests/qmltests/Panel/tst_Panel.qml+52
@@ -163,6 +163,16 @@ IndicatorTest {
163163 return indicatorItem;
164164 }
165165
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+
166176 function test_drag_show_data() {
167177 return [
168178 { tag: "pinned", fullscreen: false, call: null,
@@ -330,5 +340,47 @@ IndicatorTest {
330340
331341 compare(backgroundPressedSpy.count, 0);
332342 }
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+ }
333385 }
334386}