on xenial help sign in
Merge pull request #262 from peat-psuwit/xenial_-_fix-1337
41fc208Marius Gripsgard
qml/Components/Showable.qml+8−6
@@ -74,6 +74,9 @@ Item {
74 }
74 }
75
75
76 function __reallyShow() {
76 function __reallyShow() {
77+ if (showAnimation != undefined && showAnimation.running)
78+ return;
79+
77 if (!available) {
80 if (!available) {
78 __skipShowAnimation = false;
81 __skipShowAnimation = false;
79 return false;
82 return false;
@@ -86,9 +89,7 @@ Item {
86 }
89 }
87
90
88 if (showAnimation != undefined) {
91 if (showAnimation != undefined) {
89− if (!showAnimation.running) {
90− showAnimation.restart()
92+ showAnimation.restart()
91− }
92 if (__skipShowAnimation || shown) {
93 if (__skipShowAnimation || shown) {
93 showAnimation.complete();
94 showAnimation.complete();
94 }
95 }
@@ -107,6 +108,9 @@ Item {
107 property var prepareToHide: function(){}
108 property var prepareToHide: function(){}
108
109
109 function hide() {
110 function hide() {
111+ if (hideAnimation != undefined && hideAnimation.running)
112+ return;
113+
110 if (showAnimation != undefined && showAnimation.running) {
114 if (showAnimation != undefined && showAnimation.running) {
111 showAnimation.stop()
115 showAnimation.stop()
112 }
116 }
@@ -119,9 +123,7 @@ Item {
119 }
123 }
120
124
121 if (hideAnimation != undefined) {
125 if (hideAnimation != undefined) {
122− if (!hideAnimation.running) {
123− hideAnimation.restart()
126+ hideAnimation.restart()
124− }
125 if (__skipHideAnimation || !shown) {
127 if (__skipHideAnimation || !shown) {
126 hideAnimation.complete();
128 hideAnimation.complete();
127 }
129 }
qml/Stage/Stage.qml+5−1
@@ -962,7 +962,11 @@ FocusScope {
962 priv.updateMainAndSideStageIndexes();
962 priv.updateMainAndSideStageIndexes();
963 }
963 }
964 appDelegate.focus = true;
964 appDelegate.focus = true;
965+
966+ // Don't set focusedAppDelegate (and signal mainAppChanged) unnecessarily
967+ // which can happen after getting interactive again.
968+ if (priv.focusedAppDelegate !== appDelegate)
965− priv.focusedAppDelegate = appDelegate;
969+ priv.focusedAppDelegate = appDelegate;
966 }
970 }
967
971
968 function updateQmlFocusFromMirSurfaceFocus() {
972 function updateQmlFocusFromMirSurfaceFocus() {
tests/qmltests/Components/tst_Showable.qml+13
@@ -182,5 +182,18 @@ Item {
182 compare(show1.showAnimation.running, false, "Showable should be done running after delayed showNow");
182 compare(show1.showAnimation.running, false, "Showable should be done running after delayed showNow");
183 compare(show1.opacity, 1.0, "Showable should be at end of animation after delayed showNow");
183 compare(show1.opacity, 1.0, "Showable should be at end of animation after delayed showNow");
184 }
184 }
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+ }
185 }
198 }
186}
199}
tests/qmltests/Stage/tst_PhoneStage.qml+22
@@ -86,6 +86,12 @@ Item {
86 }
86 }
87 }
87 }
88
88
89+ SignalSpy {
90+ id: mainAppChangedSpy
91+ target: stage
92+ signalName: "mainAppChanged"
93+ }
94+
89 UT.UnityTestCase {
95 UT.UnityTestCase {
90 id: testCase
96 id: testCase
91 name: "PhoneStage"
97 name: "PhoneStage"
@@ -583,5 +589,21 @@ Item {
583 compare(topLevelSurfaceList.idAt(0), webbrowserSurfaceId);
589 compare(topLevelSurfaceList.idAt(0), webbrowserSurfaceId);
584 compare(webbrowserApp.focused, true);
590 compare(webbrowserApp.focused, true);
585 }
591 }
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+ }
586 }
608 }
587}
609}