on xenial help sign in
[tests/mocks] don't focus newly created surface
ba2d37fRatchanan Srirattanamet
tests/mocks/Unity/Application/ApplicationInfo.cpp−3
@@ -99,8 +99,6 @@ void ApplicationInfo::createPromptSurface()
99 surfaceManager->notifySurfaceCreated(surface);
99 surfaceManager->notifySurfaceCreated(surface);
100
100
101 m_promptSurfaceList->addSurface(surface);
101 m_promptSurfaceList->addSurface(surface);
102−
103− surfaceManager->activate(surface);
104}
102}
105
103
106void ApplicationInfo::createSurface()
104void ApplicationInfo::createSurface()
@@ -179,7 +177,6 @@ void ApplicationInfo::createSurface()
179 }
177 }
180
178
181 surfaceManager->notifySurfaceCreated(surface);
179 surfaceManager->notifySurfaceCreated(surface);
182− surfaceManager->activate(surface);
183}
180}
184
181
185void ApplicationInfo::setIconId(const QString &iconId)
182void ApplicationInfo::setIconId(const QString &iconId)
tests/qmltests/Panel/tst_ActiveCallHint.qml+6−3
@@ -102,10 +102,13 @@ Item {
102
102
103 var application = ApplicationManager.startApplication("dialer-app");
103 var application = ApplicationManager.startApplication("dialer-app");
104 tryCompare(application.surfaceList, "count", 1);
104 tryCompare(application.surfaceList, "count", 1);
105− tryCompare(ApplicationManager, "focusedApplicationId", "dialer-app");
106− tryCompare(application, "state", ApplicationInfoInterface.Running);
107
105
108− if (!data.focused) {
106+ if (data.focused) {
107+ // Dialer has to be explicitly activated because we don't have TLWM.
108+ application.surfaceList.get(0).activate();
109+ tryCompare(ApplicationManager, "focusedApplicationId", "dialer-app");
110+ tryCompare(application, "state", ApplicationInfoInterface.Running);
111+ } else {
109 dashApp.surfaceList.get(0).activate();
112 dashApp.surfaceList.get(0).activate();
110 tryCompare(ApplicationManager, "focusedApplicationId", "unity8-dash");
113 tryCompare(ApplicationManager, "focusedApplicationId", "unity8-dash");
111 }
114 }
tests/qmltests/Stage/tst_PhoneStage.qml+15−1
@@ -573,19 +573,33 @@ Item {
573 compare(topLevelSurfaceList.count, 1);
573 compare(topLevelSurfaceList.count, 1);
574 }
574 }
575
575
576+ function test_launchAppWithSpreadOpen_data() {
577+ return [
578+ { tag: "expected", expected: true },
579+ { tag: "unexpected", expected: false },
580+ ];
581+ }
576
582
577 /*
583 /*
578 Check that when an application starts while the spread is open, the
584 Check that when an application starts while the spread is open, the
579 spread closes and that new app is brought to front (gets focused).
585 spread closes and that new app is brought to front (gets focused).
586+
587+ "Expected" means the app is started from the launcher or the spread,
588+ where TLWM's pendingActivation() will be called. "Unexpected" means
589+ the app is launched from outside, such as from the command line.
580 */
590 */
581− function test_launchAppWithSpreadOpen()
591+ function test_launchAppWithSpreadOpen(data)
582 {
592 {
583 performEdgeSwipeToShowAppSpread();
593 performEdgeSwipeToShowAppSpread();
584
594
595+ if (data.expected)
596+ topLevelSurfaceList.pendingActivation();
597+
585 var webbrowserSurfaceId = topLevelSurfaceList.nextId;
598 var webbrowserSurfaceId = topLevelSurfaceList.nextId;
586 var webbrowserApp = ApplicationManager.startApplication("morph-browser");
599 var webbrowserApp = ApplicationManager.startApplication("morph-browser");
587 waitUntilAppSurfaceShowsUp(webbrowserSurfaceId);
600 waitUntilAppSurfaceShowsUp(webbrowserSurfaceId);
588
601
602+ expectFail(/* tag */ "unexpected", "Surprise launch doesn't work properly yet");
589 compare(topLevelSurfaceList.idAt(0), webbrowserSurfaceId);
603 compare(topLevelSurfaceList.idAt(0), webbrowserSurfaceId);
590 compare(webbrowserApp.focused, true);
604 compare(webbrowserApp.focused, true);
591 }
605 }
tests/qmltests/tst_Shell.qml+2
@@ -2494,6 +2494,8 @@ Rectangle {
2494 app.createPromptSurface();
2494 app.createPromptSurface();
2495 var promptSurface = app.promptSurfaceList.get(0);
2495 var promptSurface = app.promptSurfaceList.get(0);
2496 verify(promptSurface);
2496 verify(promptSurface);
2497+ // FIXME: remove when prompt surface focus management is working.
2498+ promptSurface.activate();
2497 tryCompare(appSurface, "keymap", promptSurface.keymap);
2499 tryCompare(appSurface, "keymap", promptSurface.keymap);
2498 // ... and that the controller's surface keymap is also the same
2500 // ... and that the controller's surface keymap is also the same
2499 tryCompare(topLevelSurfaceList.focusedWindow.surface, "keymap", "sk");
2501 tryCompare(topLevelSurfaceList.focusedWindow.surface, "keymap", "sk");