on xenial help sign in
Merge pull request #262 from peat-psuwit/xenial_-_fix-1337

Fix indicators can't open when drawer is opened

commit41fc20877b1e541799f5d3822376442cabb33b50 authorMarius Gripsgard <marius@ubports.com> dateSat 11 Jan 2020, 01:03 (7 years ago) parent1b30ec8dc3a20d
4 files changed+48−7
qml/Components/Showable.qml+8−6 qml/Stage/Stage.qml+5−1 tests/qmltests/Components/tst_Showable.qml+13 tests/qmltests/Stage/tst_PhoneStage.qml+22
qml/Components/Showable.qml+8−6
@@ -74,6 +74,9 @@ Item {
7474 }
7575
7676 function __reallyShow() {
77+ if (showAnimation != undefined && showAnimation.running)
78+ return;
79+
7780 if (!available) {
7881 __skipShowAnimation = false;
7982 return false;
@@ -86,9 +89,7 @@ Item {
8689 }
8790
8891 if (showAnimation != undefined) {
89− if (!showAnimation.running) {
90− showAnimation.restart()
91− }
92+ showAnimation.restart()
9293 if (__skipShowAnimation || shown) {
9394 showAnimation.complete();
9495 }
@@ -107,6 +108,9 @@ Item {
107108 property var prepareToHide: function(){}
108109
109110 function hide() {
111+ if (hideAnimation != undefined && hideAnimation.running)
112+ return;
113+
110114 if (showAnimation != undefined && showAnimation.running) {
111115 showAnimation.stop()
112116 }
@@ -119,9 +123,7 @@ Item {
119123 }
120124
121125 if (hideAnimation != undefined) {
122− if (!hideAnimation.running) {
123− hideAnimation.restart()
124− }
126+ hideAnimation.restart()
125127 if (__skipHideAnimation || !shown) {
126128 hideAnimation.complete();
127129 }
qml/Stage/Stage.qml+5−1
@@ -962,7 +962,11 @@ FocusScope {
962962 priv.updateMainAndSideStageIndexes();
963963 }
964964 appDelegate.focus = true;
965− priv.focusedAppDelegate = appDelegate;
965+
966+ // Don't set focusedAppDelegate (and signal mainAppChanged) unnecessarily
967+ // which can happen after getting interactive again.
968+ if (priv.focusedAppDelegate !== appDelegate)
969+ priv.focusedAppDelegate = appDelegate;
966970 }
967971
968972 function updateQmlFocusFromMirSurfaceFocus() {
tests/qmltests/Components/tst_Showable.qml+13
@@ -182,5 +182,18 @@ Item {
182182 compare(show1.showAnimation.running, false, "Showable should be done running after delayed showNow");
183183 compare(show1.opacity, 1.0, "Showable should be at end of animation after delayed showNow");
184184 }
185+
186+ // Test consecutive show()/hide() to not just complete the animation.
187+ function test_show_when_showing_hide_when_hiding() {
188+ init_test();
189+
190+ show1.show();
191+ show1.show();
192+ compare(show1.showAnimation.running, true);
193+
194+ show1.hide();
195+ show1.hide();
196+ compare(show1.hideAnimation.running, true);
197+ }
185198 }
186199}
tests/qmltests/Stage/tst_PhoneStage.qml+22
@@ -86,6 +86,12 @@ Item {
8686 }
8787 }
8888
89+ SignalSpy {
90+ id: mainAppChangedSpy
91+ target: stage
92+ signalName: "mainAppChanged"
93+ }
94+
8995 UT.UnityTestCase {
9096 id: testCase
9197 name: "PhoneStage"
@@ -583,5 +589,21 @@ Item {
583589 compare(topLevelSurfaceList.idAt(0), webbrowserSurfaceId);
584590 compare(webbrowserApp.focused, true);
585591 }
592+
593+ /*
594+ Check that set & unset allowInteractivity won't change main app.
595+ */
596+ function test_interactivityShouldNotChangeMainApp()
597+ {
598+ // Have something to focus
599+ var webbrowserSurfaceId = topLevelSurfaceList.nextId;
600+ var webbrowserApp = ApplicationManager.startApplication("morph-browser");
601+ waitUntilAppSurfaceShowsUp(webbrowserSurfaceId);
602+
603+ mainAppChangedSpy.clear();
604+ stage.allowInteractivity = false;
605+ stage.allowInteractivity = true;
606+ compare(mainAppChangedSpy.count, 0);
607+ }
586608 }
587609}