on xenial help sign in
Review feedback + some misc fixes
commit86231ced7549528a3202eaa240b77b87fcc6143b authorDaniel d'Andrada <daniel.dandrada@canonical.com> dateMon 4 Apr 2016, 10:38 (11 years ago) parent20b32fc
16 files changed+123−75
debian/unity8-private.install+1 plugins/WindowManager/TopLevelSurfaceList.cpp+25−26 plugins/WindowManager/TopLevelSurfaceList.h+4−5 qml/Components/KeymapSwitcher.qml−1 qml/Shell.qml+4−4 qml/Stages/ApplicationWindow.qml+7−3 qml/Stages/DecoratedWindow.qml+1−1 qml/Stages/DesktopStage.qml−4 qml/Stages/PhoneStage.qml+4−3 qml/Stages/PromptSurfaceAnimations.qml+4 qml/Stages/SurfaceContainer.qml+3−3 qml/Stages/TabletStage.qml+2−3 tests/mocks/Unity/Application/ApplicationManager.cpp−1 tests/mocks/Unity/Application/MirSurface.cpp+28 tests/qmltests/tst_OrientedShell.qml+13−7 tests/qmltests/tst_Shell.qml+27−14
debian/unity8-private.install+1
@@ -14,6 +14,7 @@ usr/lib/*/unity8/qml/Ubuntu
1414usr/lib/*/unity8/qml/Unity
1515usr/lib/*/unity8/qml/UInput
1616usr/lib/*/unity8/qml/Utils
17+usr/lib/*/unity8/qml/WindowManager
1718usr/lib/*/unity8/qml/Wizard
1819usr/share/accountsservice/interfaces
1920usr/share/dbus-1/interfaces
plugins/WindowManager/TopLevelSurfaceList.cpp+25−26
@@ -25,7 +25,7 @@ Q_LOGGING_CATEGORY(UNITY_TOPSURFACELIST, "unity.topsurfacelist")
2525
2626#define DEBUG_MSG qCDebug(UNITY_TOPSURFACELIST).nospace().noquote() << __func__
2727
28−namespace unityapi = unity::shell::application;
28+using namespace unity::shell::application;
2929
3030TopLevelSurfaceList::TopLevelSurfaceList(QObject *parent) :
3131 QAbstractListModel(parent)
@@ -49,7 +49,7 @@ QVariant TopLevelSurfaceList::data(const QModelIndex& index, int role) const
4949 return QVariant();
5050
5151 if (role == SurfaceRole) {
52− unityapi::MirSurfaceInterface *surface = m_surfaceList.at(index.row()).surface;
52+ MirSurfaceInterface *surface = m_surfaceList.at(index.row()).surface;
5353 return QVariant::fromValue(surface);
5454 } else if (role == ApplicationRole) {
5555 return QVariant::fromValue(m_surfaceList.at(index.row()).application);
@@ -60,7 +60,7 @@ QVariant TopLevelSurfaceList::data(const QModelIndex& index, int role) const
6060 }
6161}
6262
63−void TopLevelSurfaceList::raise(unityapi::MirSurfaceInterface *surface)
63+void TopLevelSurfaceList::raise(MirSurfaceInterface *surface)
6464{
6565 if (!surface)
6666 return;
@@ -73,13 +73,13 @@ void TopLevelSurfaceList::raise(unityapi::MirSurfaceInterface *surface)
7373 }
7474}
7575
76−void TopLevelSurfaceList::prependPlaceholder(unityapi::ApplicationInfoInterface *application)
76+void TopLevelSurfaceList::prependPlaceholder(ApplicationInfoInterface *application)
7777{
7878 DEBUG_MSG << "(" << application->appId() << ")";
7979 prependSurfaceHelper(nullptr, application);
8080}
8181
82−void TopLevelSurfaceList::prependSurface(unityapi::MirSurfaceInterface *surface, unityapi::ApplicationInfoInterface *application)
82+void TopLevelSurfaceList::prependSurface(MirSurfaceInterface *surface, ApplicationInfoInterface *application)
8383{
8484 Q_ASSERT(surface != nullptr);
8585
@@ -101,7 +101,7 @@ void TopLevelSurfaceList::prependSurface(unityapi::MirSurfaceInterface *surface,
101101 }
102102}
103103
104−void TopLevelSurfaceList::prependSurfaceHelper(unityapi::MirSurfaceInterface *surface, unityapi::ApplicationInfoInterface *application)
104+void TopLevelSurfaceList::prependSurfaceHelper(MirSurfaceInterface *surface, ApplicationInfoInterface *application)
105105{
106106 beginInsertRows(QModelIndex(), 0 /*first*/, 0 /*last*/);
107107 int id = generateId();
@@ -115,14 +115,14 @@ void TopLevelSurfaceList::prependSurfaceHelper(unityapi::MirSurfaceInterface *su
115115 Q_EMIT listChanged();
116116}
117117
118−void TopLevelSurfaceList::connectSurface(unityapi::MirSurfaceInterface *surface)
118+void TopLevelSurfaceList::connectSurface(MirSurfaceInterface *surface)
119119{
120− connect(surface, &unityapi::MirSurfaceInterface::focusedChanged, this, [this, surface](bool focused){
120+ connect(surface, &MirSurfaceInterface::focusedChanged, this, [this, surface](bool focused){
121121 if (focused) {
122122 this->raise(surface);
123123 }
124124 });
125− connect(surface, &unityapi::MirSurfaceInterface::liveChanged, this, [this, surface](bool live){
125+ connect(surface, &MirSurfaceInterface::liveChanged, this, [this, surface](bool live){
126126 if (!live) {
127127 onSurfaceDied(surface);
128128 }
@@ -130,7 +130,7 @@ void TopLevelSurfaceList::connectSurface(unityapi::MirSurfaceInterface *surface)
130130 connect(surface, &QObject::destroyed, this, [this, surface](){ this->onSurfaceDestroyed(surface); });
131131}
132132
133−void TopLevelSurfaceList::onSurfaceDied(unityapi::MirSurfaceInterface *surface)
133+void TopLevelSurfaceList::onSurfaceDied(MirSurfaceInterface *surface)
134134{
135135 int i = indexOf(surface);
136136 if (i == -1) {
@@ -140,9 +140,9 @@ void TopLevelSurfaceList::onSurfaceDied(unityapi::MirSurfaceInterface *surface)
140140 auto application = m_surfaceList[i].application;
141141
142142 // can't be starting if it already has a surface
143− Q_ASSERT(application->state() != unityapi::ApplicationInfoInterface::Starting);
143+ Q_ASSERT(application->state() != ApplicationInfoInterface::Starting);
144144
145− if (application->state() == unityapi::ApplicationInfoInterface::Running) {
145+ if (application->state() == ApplicationInfoInterface::Running) {
146146 m_surfaceList[i].removeOnceSurfaceDestroyed = true;
147147 } else {
148148 // assume it got killed by the out-of-memory daemon.
@@ -153,7 +153,7 @@ void TopLevelSurfaceList::onSurfaceDied(unityapi::MirSurfaceInterface *surface)
153153 }
154154}
155155
156−void TopLevelSurfaceList::onSurfaceDestroyed(unityapi::MirSurfaceInterface *surface)
156+void TopLevelSurfaceList::onSurfaceDestroyed(MirSurfaceInterface *surface)
157157{
158158 int i = indexOf(surface);
159159 if (i == -1) {
@@ -179,7 +179,7 @@ void TopLevelSurfaceList::removeAt(int index)
179179 Q_EMIT listChanged();
180180}
181181
182−int TopLevelSurfaceList::indexOf(unityapi::MirSurfaceInterface *surface)
182+int TopLevelSurfaceList::indexOf(MirSurfaceInterface *surface)
183183{
184184 for (int i = 0; i < m_surfaceList.count(); ++i) {
185185 if (m_surfaceList.at(i).surface == surface) {
@@ -208,7 +208,7 @@ void TopLevelSurfaceList::moveSurface(int from, int to)
208208 }
209209}
210210
211−unityapi::MirSurfaceInterface *TopLevelSurfaceList::surfaceAt(int index) const
211+MirSurfaceInterface *TopLevelSurfaceList::surfaceAt(int index) const
212212{
213213 if (index >=0 && index < m_surfaceList.count()) {
214214 return m_surfaceList[index].surface;
@@ -217,7 +217,7 @@ unityapi::MirSurfaceInterface *TopLevelSurfaceList::surfaceAt(int index) const
217217 }
218218}
219219
220−unityapi::ApplicationInfoInterface *TopLevelSurfaceList::applicationAt(int index) const
220+ApplicationInfoInterface *TopLevelSurfaceList::applicationAt(int index) const
221221{
222222 if (index >=0 && index < m_surfaceList.count()) {
223223 return m_surfaceList[index].application;
@@ -296,15 +296,15 @@ QString TopLevelSurfaceList::toString()
296296 return str;
297297}
298298
299−void TopLevelSurfaceList::addApplication(unityapi::ApplicationInfoInterface *application)
299+void TopLevelSurfaceList::addApplication(ApplicationInfoInterface *application)
300300{
301301 DEBUG_MSG << "(" << application->appId() << ")";
302302 Q_ASSERT(!m_applications.contains(application));
303303 m_applications.append(application);
304304
305− unityapi::MirSurfaceListInterface *surfaceList = application->surfaceList();
305+ MirSurfaceListInterface *surfaceList = application->surfaceList();
306306
307− if (application->state() != unityapi::ApplicationInfoInterface::Stopped) {
307+ if (application->state() != ApplicationInfoInterface::Stopped) {
308308 if (surfaceList->count() == 0) {
309309 prependPlaceholder(application);
310310 } else {
@@ -323,12 +323,12 @@ void TopLevelSurfaceList::addApplication(unityapi::ApplicationInfoInterface *app
323323 });
324324}
325325
326−void TopLevelSurfaceList::removeApplication(unityapi::ApplicationInfoInterface *application)
326+void TopLevelSurfaceList::removeApplication(ApplicationInfoInterface *application)
327327{
328328 DEBUG_MSG << "(" << application->appId() << ")";
329329 Q_ASSERT(m_applications.contains(application));
330330
331− unityapi::MirSurfaceListInterface *surfaceList = application->surfaceList();
331+ MirSurfaceListInterface *surfaceList = application->surfaceList();
332332
333333 disconnect(surfaceList, 0, this, 0);
334334
@@ -401,23 +401,22 @@ void TopLevelSurfaceList::setApplicationsModel(QAbstractListModel* value)
401401 endResetModel();
402402}
403403
404−unityapi::ApplicationInfoInterface *TopLevelSurfaceList::getApplicationFromModelAt(int index)
404+ApplicationInfoInterface *TopLevelSurfaceList::getApplicationFromModelAt(int index)
405405{
406406 QModelIndex modelIndex = m_applicationsModel->index(index);
407407
408408 QVariant variant = m_applicationsModel->data(modelIndex, m_applicationRole);
409409
410− // variant.value<unityapi::ApplicationInfoInterface*>() returns null for some reason.
411− return static_cast<unityapi::ApplicationInfoInterface*>(variant.value<QObject*>());
410+ // variant.value<ApplicationInfoInterface*>() returns null for some reason.
411+ return static_cast<ApplicationInfoInterface*>(variant.value<QObject*>());
412412}
413413
414414void TopLevelSurfaceList::findApplicationRole()
415415{
416416 QHash<int, QByteArray> namesHash = m_applicationsModel->roleNames();
417− QHash<int, QByteArray>::iterator i;
418417
419418 m_applicationRole = -1;
420− for (i = namesHash.begin(); i != namesHash.end() && m_applicationRole == -1; ++i) {
419+ for (auto i = namesHash.begin(); i != namesHash.end() && m_applicationRole == -1; ++i) {
421420 if (i.value() == "application") {
422421 m_applicationRole = i.key();
423422 }
plugins/WindowManager/TopLevelSurfaceList.h+4−5
@@ -91,11 +91,10 @@ public:
9191 // QAbstractItemModel methods
9292 int rowCount(const QModelIndex &parent = QModelIndex()) const override;
9393 QVariant data(const QModelIndex& index, int role) const override;
94− QHash<int, QByteArray> roleNames() const {
95− QHash<int, QByteArray> roleNames;
96− roleNames.insert(SurfaceRole, "surface");
97− roleNames.insert(ApplicationRole, "application");
98− roleNames.insert(IdRole, "id");
94+ QHash<int, QByteArray> roleNames() const override {
95+ QHash<int, QByteArray> roleNames { {SurfaceRole, "surface"},
96+ {ApplicationRole, "application"},
97+ {IdRole, "id"} };
9998 return roleNames;
10099 }
101100
qml/Components/KeymapSwitcher.qml−1
@@ -59,7 +59,6 @@ QtObject {
5959
6060 property Binding surfaceKeymapBinding: Binding {
6161 target: MirFocusController.focusedSurface
62− when: target != null && target.live
6362 property: "keymap"
6463 value: root.currentKeymap
6564 }
qml/Shell.qml+4−4
@@ -101,19 +101,18 @@ Item {
101101 applicationsDisplayLoader.item ? applicationsDisplayLoader.item.mainApp : null
102102 onMainAppChanged: {
103103 if (mainApp) {
104− _makeGreeterReactToAppChange(mainApp.appId);
104+ _onMainAppChanged(mainApp.appId);
105105 }
106−
107106 }
108107 Connections {
109108 target: ApplicationManager
110109 onFocusRequested: {
111110 if (shell.mainApp && shell.mainApp.appId === appId) {
112− _makeGreeterReactToAppChange(appId);
111+ _onMainAppChanged(appId);
113112 }
114113 }
115114 }
116− function _makeGreeterReactToAppChange(appId) {
115+ function _onMainAppChanged(appId) {
117116 if (tutorial.running && appId != "" && appId != "unity8-dash") {
118117 // If this happens on first boot, we may be in edge
119118 // tutorial or wizard while receiving a call. But a call
@@ -570,6 +569,7 @@ Item {
570569 }
571570 onLauncherApplicationSelected: {
572571 greeter.notifyUserRequestedApp(appId);
572+ shell.activateApplication(appId);
573573 }
574574 onShownChanged: {
575575 if (shown) {
qml/Stages/ApplicationWindow.qml+7−3
@@ -55,6 +55,10 @@ FocusScope {
5555 readonly property int heightIncrement: surface ? surface.heightIncrement : 0
5656
5757 onSurfaceChanged: {
58+ // The order in which the instructions are executed here matters, to that the correct state
59+ // transitions in stateGroup take place.
60+ // More specifically, the moment surfaceContainer.surface gets updated relative to the
61+ // other instructions.
5862 if (surface) {
5963 surfaceContainer.surface = surface;
6064 d.liveSurface = surface.live;
@@ -78,9 +82,9 @@ FocusScope {
7882 onLiveChanged: d.liveSurface = root.surface.live
7983 }
8084 // using liveSurface instead of root.surface.live because with the latter
81− // this expression is not reevaluated when root.surface.live changes
82− property bool needToTakeScreenshot: root.surface && d.surfaceInitialized && !d.liveSurface
83− && applicationState !== ApplicationInfoInterface.Running
85+ // this expression is not reevaluated when root.surface changes
86+ readonly property bool needToTakeScreenshot: root.surface && d.surfaceInitialized && !d.liveSurface
87+ && applicationState !== ApplicationInfoInterface.Running
8488 onNeedToTakeScreenshotChanged: {
8589 if (needToTakeScreenshot && screenshotImage.status === Image.Null) {
8690 screenshotImage.take();
qml/Stages/DecoratedWindow.qml+1−1
@@ -29,7 +29,7 @@ FocusScope {
2929 property alias application: applicationWindow.application
3030 property alias surface: applicationWindow.surface
3131 property alias active: decoration.active
32− property alias title: decoration.title
32+ readonly property alias title: applicationWindow.title
3333 property alias fullscreen: applicationWindow.fullscreen
3434
3535 readonly property bool decorationShown: !fullscreen
qml/Stages/DesktopStage.qml−4
@@ -332,10 +332,6 @@ AbstractStage {
332332
333333 function close() {
334334 model.surface.close();
335− // TODO: Should we brute force and stop the application if it doesn't quit
336− // after having its last window closed?
337− // TODO: Destroy the surface if the application doesn't comply after a given
338− // amount of time.
339335 }
340336
341337 function maximize(animated) {
qml/Stages/PhoneStage.qml+4−3
@@ -291,14 +291,14 @@ AbstractStage {
291291 }
292292 }
293293 function undoContentXReset() {
294− if (contentWidth === -1) {
294+ if (contentWidth <= 0) {
295295 contentWidthOnLastContentXChange = contentWidth;
296296 lastContentX = contentX;
297297 return false;
298298 }
299299
300− if (contentWidth != contentWidthOnLastContentXChange
301− && lastContentX == -shift && contentX == 0) {
300+ if (contentWidth !== contentWidthOnLastContentXChange
301+ && lastContentX === -shift && contentX === 0) {
302302 // Flickable is resetting contentX because contentWidth has changed. Undo it.
303303 contentX = -shift;
304304 return true;
@@ -310,6 +310,7 @@ AbstractStage {
310310 }
311311 property real contentWidthOnLastContentXChange: -1
312312 property real lastContentX: 0
313+ // </FIXME-contentX>
313314
314315 Behavior on contentX {
315316 enabled: root.altTabPressed
qml/Stages/PromptSurfaceAnimations.qml+4
@@ -39,6 +39,7 @@ StateGroup {
3939 transitions: [
4040 Transition {
4141 from: "*"; to: "zombie"
42+ // Slide downwards until it's out of view, through the bottom of the window
4243 SequentialAnimation {
4344 // clip so we don't go out of parent's bounds during spread
4445 PropertyAction { target: root.container.parent; property: "clip"; value: true }
@@ -47,12 +48,15 @@ StateGroup {
4748 PropertyAction { target: root.surfaceItem; property: "visible"; value: false }
4849 PropertyAction { target: container.parent; property: "clip"; value: false }
4950 ScriptAction { script: {
51+ // Unity.Application can't destroy a zombie MirSurface if it's still being
52+ // referenced by a MirSurfaceItem.
5053 root.surfaceItem.surface = null;
5154 } }
5255 }
5356 },
5457 Transition {
5558 from: "*"; to: "ready"
59+ // Slide upwards into view, from the bottom of the window
5660 SequentialAnimation {
5761 // clip so we don't go out of parent's bounds during spread
5862 PropertyAction { target: root.container.parent; property: "clip"; value: true }
qml/Stages/SurfaceContainer.qml+3−3
@@ -36,9 +36,9 @@ FocusScope {
3636 property bool inPromptSession: false
3737
3838 onSurfaceChanged: {
39− // not a binding because in some cases
40− // we remove the surface from the surfaceItem programatically,
41− // even though root.surface is still !null
39+ // Not a binding because animations might remove the surface from the surfaceItem
40+ // programatically (in order to signal that a zombie surface is free for deletion),
41+ // even though root.surface is still !null.
4242 surfaceItem.surface = surface;
4343 }
4444
qml/Stages/TabletStage.qml+2−3
@@ -367,7 +367,7 @@ AbstractStage {
367367 }
368368 }
369369 function undoContentXReset() {
370− if (contentWidth === -1) {
370+ if (contentWidth <= 0) {
371371 contentWidthOnLastContentXChange = contentWidth;
372372 lastContentX = contentX;
373373 return false;
@@ -536,7 +536,6 @@ AbstractStage {
536536 if (index > 2) return index;
537537
538538 var mainStageIndex = root.topLevelSurfaceList.indexForId(priv.mainStageItemId);
539− var sideStageIndex = root.topLevelSurfaceList.indexForId(priv.sideStageItemId);
540539
541540 if (index == mainStageIndex) {
542541 // Active main stage always at 0
@@ -719,7 +718,7 @@ AbstractStage {
719718 id: spreadTile
720719 objectName: "spreadDelegate_" + model.id
721720
722− property int index: model.index
721+ readonly property int index: model.index
723722 width: spreadView.width
724723 height: spreadView.height
725724 active: model.id == priv.mainStageItemId || model.id == priv.sideStageItemId
tests/mocks/Unity/Application/ApplicationManager.cpp−1
@@ -352,7 +352,6 @@ void ApplicationManager::buildListOfAvailableApplications()
352352 application->setName("Camera");
353353 application->setScreenshotId("camera");
354354 application->setIconId("camera");
355− application->setShellChrome(Mir::LowChrome);
356355 application->setFullscreen(true);
357356 application->setSupportedOrientations(Qt::PortraitOrientation
358357 | Qt::LandscapeOrientation
tests/mocks/Unity/Application/MirSurface.cpp+28
@@ -23,6 +23,31 @@
2323
2424#if MIRSURFACE_DEBUG
2525#define DEBUG_MSG(params) qDebug().nospace() << "MirSurface[" << (void*)this << "," << m_name << "]::" << __func__ << " " << params
26+
27+const char *stateToStr(Mir::State state)
28+{
29+ switch(state) {
30+ case Mir::UnknownState:
31+ return "unknown";
32+ case Mir::RestoredState:
33+ return "restored";
34+ case Mir::MinimizedState:
35+ return "minimized";
36+ case Mir::MaximizedState:
37+ return "maximized";
38+ case Mir::VertMaximizedState:
39+ return "vert-maximized";
40+ case Mir::FullscreenState:
41+ return "fullscreen";
42+ case Mir::HorizMaximizedState:
43+ return "horiz-maximized";
44+ case Mir::HiddenState:
45+ return "hidden";
46+ default:
47+ return "???";
48+ };
49+}
50+
2651#else
2752#define DEBUG_MSG(params) ((void)0)
2853#endif
@@ -95,6 +120,7 @@ void MirSurface::setState(Mir::State state)
95120 if (state == m_state)
96121 return;
97122
123+ DEBUG_MSG(stateToStr(state));
98124 m_state = state;
99125 Q_EMIT stateChanged(state);
100126}
@@ -159,6 +185,7 @@ void MirSurface::setOrientationAngle(Mir::OrientationAngle angle)
159185void MirSurface::setKeymap(const QString &value)
160186{
161187 if (value != m_keymap) {
188+ DEBUG_MSG(value);
162189 m_keymap = value;
163190 Q_EMIT keymapChanged(m_keymap);
164191 }
@@ -179,6 +206,7 @@ void MirSurface::setShellChrome(Mir::ShellChrome shellChrome)
179206 if (shellChrome == m_shellChrome)
180207 return;
181208
209+ DEBUG_MSG(shellChrome);
182210 m_shellChrome = shellChrome;
183211 Q_EMIT shellChromeChanged(shellChrome);
184212}
tests/qmltests/tst_OrientedShell.qml+13−7
@@ -495,17 +495,23 @@ Rectangle {
495495 function test_appSupportingOnlyPrimaryOrientationMakesPhoneShellStayPut() {
496496 loadShell("mako");
497497
498+ var spreadRepeater = findChild(shell, "spreadRepeater");
499+ verify(spreadRepeater);
500+
498501 // unity8-dash supports only primary orientation and should be already running
499− var dashAppWindow = findChild(shell, "appWindow_unity8-dash");
500− verify(dashAppWindow);
501− compare(ApplicationManager.focusedApplicationId, "unity8-dash");
502− var dashApp = dashAppWindow.application
502+ compare(spreadRepeater.count, 1);
503+ var dashDelegate = spreadRepeater.itemAt(0);
504+ var dashApp = dashDelegate.application;
503505 verify(dashApp);
506+ compare(dashApp.appId, "unity8-dash");
507+ var dashAppWindow = findChild(dashDelegate, "appWindow");
508+ verify(dashAppWindow);
509+ compare(dashDelegate.focus, true);
504510 compare(dashApp.rotatesWindowContents, false);
505511 compare(dashApp.supportedOrientations, Qt.PrimaryOrientation);
506512 compare(dashApp.stage, ApplicationInfoInterface.MainStage);
507513
508− tryCompareFunction(function(){return dashApp.session.lastSurface != null;}, true);
514+ tryCompareFunction(function(){return dashDelegate.surface != null;}, true);
509515 verify(checkAppSurfaceOrientation(dashAppWindow, dashApp, root.primaryOrientationAngle));
510516
511517 compare(shell.transformRotationAngle, root.primaryOrientationAngle);
@@ -915,9 +921,9 @@ Rectangle {
915921 verify(item.application.appId, "dialer-app");
916922 }
917923
924+ WindowStateStorage.saveStage("dialer-app", ApplicationInfoInterface.SideStage)
918925 var dialerApp = ApplicationManager.startApplication("dialer-app");
919926 verify(dialerApp);
920− dialerApp.stage = ApplicationInfoInterface.SideStage;
921927
922928 // ensure the mock dialer-app is as we expect
923929 compare(dialerApp.rotatesWindowContents, false);
@@ -962,9 +968,9 @@ Rectangle {
962968 verify(item.application.appId, "dialer-app");
963969 }
964970
971+ WindowStateStorage.saveStage("dialer-app", ApplicationInfoInterface.SideStage)
965972 var dialerApp = ApplicationManager.startApplication("dialer-app");
966973 verify(dialerApp);
967− dialerApp.stage = ApplicationInfoInterface.SideStage;
968974
969975 // ensure the mock dialer-app is as we expect
970976 compare(dialerApp.rotatesWindowContents, false);
tests/qmltests/tst_Shell.qml+27−14
@@ -2299,9 +2299,18 @@ Rectangle {
22992299
23002300 tryCompare(launcher, "lockedVisible", true);
23012301
2302− var cameraSurfaceId = topLevelSurfaceList.nextId;
2303− var cameraApp = ApplicationManager.startApplication("camera-app");
2304− waitUntilAppWindowIsFullyLoaded(cameraSurfaceId);
2302+ var surfaceId = topLevelSurfaceList.nextId;
2303+ var app = ApplicationManager.startApplication("gmail-webapp");
2304+
2305+ waitUntilAppWindowIsFullyLoaded(surfaceId);
2306+
2307+ // Sanity check: ensure the fake app we chose creates a surface the way
2308+ // we expect it to.
2309+ compare(app.surfaceList.get(0).shellChrome, Mir.NormalChrome);
2310+
2311+ compare(launcher.lockedVisible, true);
2312+
2313+ app.surfaceList.get(0).state = Mir.FullscreenState;
23052314
23062315 tryCompare(launcher, "lockedVisible", false);
23072316 }
@@ -2361,19 +2370,21 @@ Rectangle {
23612370 AccountsService.keymaps = ["sk", "cz+qwerty", "fr"] // "configure" the keymaps for user
23622371
23632372 // start some app
2373+ var appSurfaceId = topLevelSurfaceList.nextId;
23642374 var app = ApplicationManager.startApplication("dialer-app");
2365− waitUntilAppWindowIsFullyLoaded(app);
2375+ waitUntilAppWindowIsFullyLoaded(appSurfaceId);
2376+ var appSurface = app.surfaceList.get(0);
23662377
23672378 // verify the initial keymap of the newly started app is the first one from the list
2368− tryCompare(app.session.lastSurface, "keymap", "sk");
2379+ tryCompare(appSurface, "keymap", "sk");
23692380
23702381 // switch to next keymap, should go to "cz+qwerty"
23712382 keyClick(Qt.Key_Space, Qt.MetaModifier);
2372− tryCompare(app.session.lastSurface, "keymap", "cz+qwerty");
2383+ tryCompare(appSurface, "keymap", "cz+qwerty");
23732384
23742385 // switch to next keymap, should go to "fr"
23752386 keyClick(Qt.Key_Space, Qt.MetaModifier);
2376− tryCompare(app.session.lastSurface, "keymap", "fr");
2387+ tryCompare(appSurface, "keymap", "fr");
23772388
23782389 // go to e.g. desktop stage
23792390 loadShell("desktop");
@@ -2381,30 +2392,32 @@ Rectangle {
23812392 waitForRendering(shell);
23822393
23832394 // start a second app, should get the last configured keyboard, "fr"
2395+ var app2SurfaceId = topLevelSurfaceList.nextId;
23842396 var app2 = ApplicationManager.startApplication("calendar-app");
2385− waitUntilAppWindowIsFullyLoaded(app2);
2386− tryCompare(app2.session.lastSurface, "keymap", "fr");
2397+ waitUntilAppWindowIsFullyLoaded(app2SurfaceId);
2398+ var app2Surface = app2.surfaceList.get(0);
2399+ tryCompare(app2Surface, "keymap", "fr");
23872400
23882401 // focus our first app, make sure it also has the "fr" keymap
23892402 ApplicationManager.requestFocusApplication("dialer-app");
2390− tryCompare(app.session.lastSurface, "keymap", "fr");
2403+ tryCompare(appSurface, "keymap", "fr");
23912404
23922405 // switch to previous keymap, should be "cz+qwerty"
23932406 keyClick(Qt.Key_Space, Qt.MetaModifier|Qt.ShiftModifier);
2394− tryCompare(app.session.lastSurface, "keymap", "cz+qwerty");
2407+ tryCompare(appSurface, "keymap", "cz+qwerty");
23952408
23962409 // go next twice to "sk", past the end
23972410 keyClick(Qt.Key_Space, Qt.MetaModifier);
23982411 keyClick(Qt.Key_Space, Qt.MetaModifier);
2399− tryCompare(app.session.lastSurface, "keymap", "sk");
2412+ tryCompare(appSurface, "keymap", "sk");
24002413
24012414 // go back once to past the beginning, to "fr"
24022415 keyClick(Qt.Key_Space, Qt.MetaModifier|Qt.ShiftModifier);
2403− tryCompare(app.session.lastSurface, "keymap", "fr");
2416+ tryCompare(appSurface, "keymap", "fr");
24042417
24052418 // switch to app2, should also get "fr"
24062419 ApplicationManager.requestFocusApplication("calendar-app");
2407− tryCompare(app2.session.lastSurface, "keymap", "fr");
2420+ tryCompare(app2Surface, "keymap", "fr");
24082421 }
24092422 }
24102423}