Merge lp:~nick-dedekind/unity8/lp1475678.surface-occlude into lp:unity8

Proposed by Nick Dedekind
Status: Superseded
Proposed branch: lp:~nick-dedekind/unity8/lp1475678.surface-occlude
Merge into: lp:unity8
Diff against target: 510 lines (+233/-35)
9 files modified
debian/control (+1/-1)
qml/Stages/DesktopStage.qml (+71/-3)
qml/Stages/PhoneStage.qml (+10/-3)
qml/Stages/TabletStage.qml (+8/-0)
tests/mocks/Unity/Application/MirSurface.cpp (+44/-17)
tests/mocks/Unity/Application/MirSurface.h (+14/-4)
tests/mocks/Unity/Application/MirSurfaceItem.cpp (+12/-2)
tests/mocks/Unity/Application/MirSurfaceItem.h (+1/-0)
tests/qmltests/Stages/tst_DesktopStage.qml (+72/-5)
To merge this branch: bzr merge lp:~nick-dedekind/unity8/lp1475678.surface-occlude
Reviewer Review Type Date Requested Status
PS Jenkins bot (community) continuous-integration Needs Fixing
Michał Sawicz Needs Fixing
Michael Zanetti (community) Abstain
Daniel d'Andrada (community) Needs Fixing
Review via email: mp+273427@code.launchpad.net

This proposal has been superseded by a proposal from 2015-10-27.

Commit message

Support server->client visibility change to stop rendering (lp:#1475678)

Description of the change

Support server->client visibility change to stop rendering (lp:#1475678)

 * Are there any related MPs required for this MP to build/function as expected? Please list.
https://code.launchpad.net/~nick-dedekind/qtmir/lp1475678.surface-occlude/+merge/273426
https://code.launchpad.net/~nick-dedekind/unity-api/lp1475678.surface-occlude/+merge/273425
https://code.launchpad.net/~nick-dedekind/qtubuntu/lp1475678.surface-occlude/+merge/273424

 * Did you perform an exploratory manual test run of your code change and any related functionality?
 * Did you make sure that your branch does not contain spurious tags?
 * If you changed the packaging (debian), did you subscribe the ubuntu-unity team to this MP?
 * If you changed the UI, has there been a design review?

To post a comment you must log in.
Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Needs Fixing (continuous-integration)
1974. By Nick Dedekind

occlude on screen power

Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Needs Fixing (continuous-integration)
Revision history for this message
Daniel d'Andrada (dandrader) wrote :

In qml/Stages/TabletStage.qml:

"""
+ // Hiding tiles when their progress is negative or reached the maximum
"""

A TODO item?

review: Needs Information
1975. By Nick Dedekind

update hide comment

Revision history for this message
Nick Dedekind (nick-dedekind) wrote :

> In qml/Stages/TabletStage.qml:
>
> """
> + // Hiding tiles when their progress is negative or reached the maximum
> """
>
> A TODO item?

Yes. Fixed.

Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Needs Fixing (continuous-integration)
Revision history for this message
Daniel d'Andrada (dandrader) wrote :

Shouldn't we do something for DesktopStage.qml as well? I quickly checked its code and it seems it doesn't set windows visibility at all.

Things to check:
 - Minimized windows should have their MirSurfaces invisible/occluded.
 - When a window is focused (on foreground, index 0) and maximized, the MirSurfaces of all others should be invisible/occluded

review: Needs Fixing
Revision history for this message
Michał Sawicz (saviq) wrote :

W dniu 13.10.2015 o 14:41, Daniel d'Andrada pisze:
> Things to check:
> - Minimized windows should have their MirSurfaces invisible/occluded.
> - When a window is focused (on foreground, index 0) and maximized, the MirSurfaces of all others should be invisible/occluded

And (maybe later) we should actually try and determine real visibility -
if a window is completely covered by others (we should probably exclude
windows with alpha from this), it should be made invisible/occluded, too.

Revision history for this message
Lukáš Tinkl (lukas-kde) wrote :

Left some inline comments; also:

> When a window is focused (on foreground, index 0) and maximized, the MirSurfaces of all others
> should be invisible/occluded

Just wondering what happens in multi monitor situations, should all the other windows/surfaces get occluded too in this case?

Revision history for this message
Daniel d'Andrada (dandrader) wrote :

On 13/10/2015 10:32, Lukáš Tinkl wrote:
>> When a window is focused (on foreground, index 0) and maximized, the MirSurfaces of all others
>> >should be invisible/occluded
> Just wondering what happens in multi monitor situations, should all the other windows/surfaces get occluded too in this case?

Since multimonitor hasn't landed and this branch does not build on top
of it, it can't really address multimonitor issues here. Furthermore, on
the first iteration, windows will be shown all in a single screen (be it
the built-in display or an external monitor), so multimonitor doesn't
really affect occlusion scenarios right now.

1976. By Nick Dedekind

dekstop stage item visibility

Revision history for this message
Nick Dedekind (nick-dedekind) wrote :

> Shouldn't we do something for DesktopStage.qml as well? I quickly checked its
> code and it seems it doesn't set windows visibility at all.
>
> Things to check:
> - Minimized windows should have their MirSurfaces invisible/occluded.
> - When a window is focused (on foreground, index 0) and maximized, the
> MirSurfaces of all others should be invisible/occluded

Added.

Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Needs Fixing (continuous-integration)
Revision history for this message
Daniel d'Andrada (dandrader) wrote :

Could you please add a qml test to tst_DesktopStage to cover the "hide windows behind the maximized one" feature? Logic looks involved enough to warrant a test.

Revision history for this message
Michael Zanetti (mzanetti) wrote :

* Open 2 windows so that both are visible. Maximize one, the other will disappear before it's occluded.

* It breaks the alt+tab preview.

review: Needs Fixing
1977. By Nick Dedekind

fixed surface visibility

Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Needs Fixing (continuous-integration)
Revision history for this message
Michael Zanetti (mzanetti) wrote :

> * Open 2 windows so that both are visible. Maximize one, the other will
> disappear before it's occluded.
>
> * It breaks the alt+tab preview.

Both seem to be fixed now.

review: Abstain
1978. By Nick Dedekind

Only visible if in front of maximized application

Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Needs Fixing (continuous-integration)
Revision history for this message
Michał Sawicz (saviq) :
review: Needs Fixing
1979. By Nick Dedekind

merged with trunk

1980. By Nick Dedekind

bump libunity-api version

Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Needs Fixing (continuous-integration)

Unmerged revisions

1980. By Nick Dedekind

bump libunity-api version

1979. By Nick Dedekind

merged with trunk

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
=== modified file 'debian/control'
--- debian/control 2015-10-21 11:51:11 +0000
+++ debian/control 2015-10-26 18:36:26 +0000
@@ -29,7 +29,7 @@
29 libqt5xmlpatterns5-dev,29 libqt5xmlpatterns5-dev,
30 libsystemsettings-dev,30 libsystemsettings-dev,
31 libudev-dev,31 libudev-dev,
32 libunity-api-dev (>= 7.101),32 libunity-api-dev (>= 7.102),
33 libusermetricsoutput1-dev,33 libusermetricsoutput1-dev,
34 libxcb1-dev,34 libxcb1-dev,
35 pkg-config,35 pkg-config,
3636
=== modified file 'qml/Stages/DesktopStage.qml'
--- qml/Stages/DesktopStage.qml 2015-10-19 14:27:57 +0000
+++ qml/Stages/DesktopStage.qml 2015-10-26 18:36:26 +0000
@@ -65,6 +65,11 @@
6565
66 ApplicationManager.requestFocusApplication(appId)66 ApplicationManager.requestFocusApplication(appId)
67 }67 }
68 onApplicationRemoved: {
69 if (priv.foregroundMaximizedAppId === appId) {
70 priv.foregroundMaximizedAppIdIndex = -1;
71 }
72 }
6873
69 onFocusRequested: {74 onFocusRequested: {
70 var appIndex = priv.indexOf(appId);75 var appIndex = priv.indexOf(appId);
@@ -86,6 +91,17 @@
86 var index = indexOf(focusedAppId);91 var index = indexOf(focusedAppId);
87 return index >= 0 && index < appRepeater.count ? appRepeater.itemAt(index) : null92 return index >= 0 && index < appRepeater.count ? appRepeater.itemAt(index) : null
88 }93 }
94 readonly property string foregroundMaximizedAppId: {
95 if (foregroundMaximizedAppIdIndex == -1) {
96 return "";
97 }
98 var app = ApplicationManager.get(foregroundMaximizedAppIdIndex);
99 if (app) {
100 return app.appId;
101 }
102 return "";
103 }
104 property int foregroundMaximizedAppIdIndex: -1
89105
90 function indexOf(appId) {106 function indexOf(appId) {
91 for (var i = 0; i < ApplicationManager.count; i++) {107 for (var i = 0; i < ApplicationManager.count; i++) {
@@ -132,6 +148,7 @@
132148
133 delegate: FocusScope {149 delegate: FocusScope {
134 id: appDelegate150 id: appDelegate
151 objectName: "stageDelegate_" + model.appId
135 z: ApplicationManager.count - index152 z: ApplicationManager.count - index
136 y: units.gu(3)153 y: units.gu(3)
137 width: units.gu(60)154 width: units.gu(60)
@@ -141,12 +158,47 @@
141 property bool maximized: false158 property bool maximized: false
142 property bool minimized: false159 property bool minimized: false
143160
161 property bool visuallyMaximized: false
162 property bool visuallyMinimized: false
163
144 onFocusChanged: {164 onFocusChanged: {
145 if (focus && ApplicationManager.focusedApplicationId !== model.appId) {165 if (focus && ApplicationManager.focusedApplicationId !== model.appId) {
146 ApplicationManager.focusApplication(model.appId);166 ApplicationManager.focusApplication(model.appId);
147 }167 }
148 }168 }
149169
170 onZChanged: updateMaximized()
171 onVisuallyMaximizedChanged: updateMaximized()
172 Connections {
173 target: priv
174 onForegroundMaximizedAppIdIndexChanged: updateMaximized()
175 }
176
177 property bool connectMaxEnabled: true
178 function updateMaximized() {
179 if (!connectMaxEnabled) return;
180 connectMaxEnabled = false;
181
182 // work out if this is the top maximized app.
183 if (visuallyMaximized) {
184 if (priv.foregroundMaximizedAppId === model.appId) {
185 priv.foregroundMaximizedAppIdIndex = index;
186 }
187 else if (priv.foregroundMaximizedAppIdIndex == -1 ||
188 (index >= 0 && index <= priv.foregroundMaximizedAppIdIndex)) {
189 priv.foregroundMaximizedAppIdIndex = index;
190 }
191 } else if (priv.foregroundMaximizedAppId === model.appId) {
192 priv.foregroundMaximizedAppIdIndex = -1;
193 }
194
195 connectMaxEnabled = true;
196 }
197
198 visible: !visuallyMinimized &&
199 (priv.foregroundMaximizedAppIdIndex === -1 || priv.foregroundMaximizedAppIdIndex >= index) ||
200 (spread.focus && index === spread.highlightedIndex)
201
150 Binding {202 Binding {
151 target: ApplicationManager.get(index)203 target: ApplicationManager.get(index)
152 property: "requestedState"204 property: "requestedState"
@@ -186,9 +238,25 @@
186 ]238 ]
187 transitions: [239 transitions: [
188 Transition {240 Transition {
189 from: "maximized,minimized,normal,"241 to: "normal"
190 to: "maximized,minimized,normal,"242 PropertyAction { target: appDelegate; properties: "visuallyMinimized,visuallyMaximized"; value: false }
191 PropertyAnimation { target: appDelegate; properties: "x,y,opacity,width,height,scale" }243 PropertyAnimation { target: appDelegate; properties: "x,y,opacity,width,height,scale," }
244 },
245 Transition {
246 to: "maximized"
247 SequentialAnimation {
248 PropertyAction { target: appDelegate; property: "visuallyMinimized"; value: false }
249 PropertyAnimation { target: appDelegate; properties: "x,y,opacity,width,height,scale" }
250 PropertyAction { target: appDelegate; property: "visuallyMaximized"; value: true }
251 }
252 },
253 Transition {
254 to: "minimized"
255 SequentialAnimation {
256 PropertyAction { target: appDelegate; property: "visuallyMaximized"; value: false }
257 PropertyAnimation { target: appDelegate; properties: "x,y,opacity,width,height,scale" }
258 PropertyAction { target: appDelegate; property: "visuallyMinimized"; value: true }
259 }
192 },260 },
193 Transition {261 Transition {
194 from: ""262 from: ""
195263
=== modified file 'qml/Stages/PhoneStage.qml'
--- qml/Stages/PhoneStage.qml 2015-09-21 13:37:47 +0000
+++ qml/Stages/PhoneStage.qml 2015-10-26 18:36:26 +0000
@@ -20,6 +20,7 @@
20import Unity.Application 0.120import Unity.Application 0.1
21import Unity.Session 0.121import Unity.Session 0.1
22import Utils 0.122import Utils 0.1
23import Powerd 0.1
23import "../Components"24import "../Components"
2425
25Rectangle {26Rectangle {
@@ -531,9 +532,15 @@
531 return progress;532 return progress;
532 }533 }
533534
534 // Hiding tiles when their progress is negative or reached the maximum535 // Hide tile when progress is such that it will be off screen.
535 visible: (progress >= 0 && progress < 1.7)536 property bool occluded: {
536 || (isDash && priv.focusedAppDelegateIsDislocated)537 if (spreadView.active && (progress >= 0 && progress < 1.7)) return false;
538 if (!spreadView.active && isFocused) return false;
539 return true;
540 }
541
542 visible: Powerd.status == Powerd.On &&
543 (!occluded || (isDash && priv.focusedAppDelegateIsDislocated))
537544
538545
539 shellOrientationAngle: root.shellOrientationAngle546 shellOrientationAngle: root.shellOrientationAngle
540547
=== modified file 'qml/Stages/TabletStage.qml'
--- qml/Stages/TabletStage.qml 2015-08-03 13:47:44 +0000
+++ qml/Stages/TabletStage.qml 2015-10-26 18:36:26 +0000
@@ -676,6 +676,14 @@
676 return tileProgress;676 return tileProgress;
677 }677 }
678678
679 // TODO: Hiding tile when progress is such that it will be off screen.
680 property bool occluded: {
681 if (spreadView.active) return false;
682 else if (isFocused) return false;
683 return true;
684 }
685 visible: !occluded
686
679 animatedProgress: {687 animatedProgress: {
680 if (spreadView.phase == 0 && (spreadTile.active || spreadView.nextInStack == index)) {688 if (spreadView.phase == 0 && (spreadTile.active || spreadView.nextInStack == index)) {
681 if (progress < spreadView.positionMarker1) {689 if (progress < spreadView.positionMarker1) {
682690
=== modified file 'tests/mocks/Unity/Application/MirSurface.cpp'
--- tests/mocks/Unity/Application/MirSurface.cpp 2015-09-25 12:13:13 +0000
+++ tests/mocks/Unity/Application/MirSurface.cpp 2015-10-26 18:36:26 +0000
@@ -31,7 +31,7 @@
31 , m_screenshotUrl(screenshot)31 , m_screenshotUrl(screenshot)
32 , m_qmlFilePath(qmlFilePath)32 , m_qmlFilePath(qmlFilePath)
33 , m_live(true)33 , m_live(true)
34 , m_viewCount(0)34 , m_visible(true)
35 , m_activeFocus(false)35 , m_activeFocus(false)
36 , m_width(-1)36 , m_width(-1)
37 , m_height(-1)37 , m_height(-1)
@@ -73,6 +73,11 @@
73 return m_live;73 return m_live;
74}74}
7575
76bool MirSurface::visible() const
77{
78 return m_visible;
79}
80
76void MirSurface::setLive(bool live)81void MirSurface::setLive(bool live)
77{82{
78// qDebug().nospace() << "MirSurface::setLive("<<live<<") " << name();83// qDebug().nospace() << "MirSurface::setLive("<<live<<") " << name();
@@ -82,7 +87,7 @@
82 m_live = live;87 m_live = live;
83 Q_EMIT liveChanged(live);88 Q_EMIT liveChanged(live);
8489
85 if (!m_live && m_viewCount == 0) {90 if (!m_live && m_views.count() == 0) {
86 deleteLater();91 deleteLater();
87 }92 }
88}93}
@@ -120,27 +125,49 @@
120 Q_EMIT orientationAngleChanged(angle);125 Q_EMIT orientationAngleChanged(angle);
121}126}
122127
123void MirSurface::incrementViewCount()128
129
130void MirSurface::registerView(qintptr viewId)
124{131{
125 ++m_viewCount;132 m_views.insert(viewId, MirSurface::View{false});
126// qDebug().nospace() << "MirSurface::incrementViewCount() viewCount(after)=" << m_viewCount << " " << name();133// qDebug().nospace() << "MirSurface[" << name() << "]::registerView(" << viewId << ")"
134// << " after=" << m_views.count();
127}135}
128136
129void MirSurface::decrementViewCount()137void MirSurface::unregisterView(qintptr viewId)
130{138{
131 --m_viewCount;139// qDebug().nospace() << "MirSurface[" << name() << "]::unregisterView(" << viewId << ")"
132// qDebug().nospace() << "MirSurface::decrementViewCount() viewCount(after)=" << m_viewCount << " " << name();140// << " after=" << m_views.count() << " live=" << m_live;
133141 m_views.remove(viewId);
134 Q_ASSERT(m_viewCount >= 0);142 if (!m_live && m_views.count() == 0) {
135
136 if (!m_live && m_viewCount == 0) {
137 deleteLater();143 deleteLater();
138 }144 }
139}145 updateVisibility();
140146}
141int MirSurface::viewCount() const147
142{148void MirSurface::setViewVisibility(qintptr viewId, bool visible)
143 return m_viewCount;149{
150 if (!m_views.contains(viewId)) return;
151
152 m_views[viewId].visible = visible;
153 updateVisibility();
154}
155
156void MirSurface::updateVisibility()
157{
158 bool newVisible = false;
159 QHashIterator<qintptr, View> i(m_views);
160 while (i.hasNext()) {
161 i.next();
162 newVisible |= i.value().visible;
163 }
164
165 if (newVisible != visible()) {
166// qDebug().nospace() << "MirSurface[" << name() << "]::updateVisibility(" << newVisible << ")";
167
168 m_visible = newVisible;
169 Q_EMIT visibleChanged(m_visible);
170 }
144}171}
145172
146bool MirSurface::activeFocus() const173bool MirSurface::activeFocus() const
147174
=== modified file 'tests/mocks/Unity/Application/MirSurface.h'
--- tests/mocks/Unity/Application/MirSurface.h 2015-09-02 10:35:16 +0000
+++ tests/mocks/Unity/Application/MirSurface.h 2015-10-26 18:36:26 +0000
@@ -19,6 +19,7 @@
1919
20#include <QObject>20#include <QObject>
21#include <QUrl>21#include <QUrl>
22#include <QHash>
2223
23// unity-api24// unity-api
24#include <unity/shell/application/MirSurfaceInterface.h>25#include <unity/shell/application/MirSurfaceInterface.h>
@@ -58,6 +59,8 @@
5859
59 bool live() const override;60 bool live() const override;
6061
62 bool visible() const override;
63
61 Mir::OrientationAngle orientationAngle() const override;64 Mir::OrientationAngle orientationAngle() const override;
62 void setOrientationAngle(Mir::OrientationAngle) override;65 void setOrientationAngle(Mir::OrientationAngle) override;
6366
@@ -66,9 +69,10 @@
6669
67 Q_INVOKABLE void setLive(bool live);70 Q_INVOKABLE void setLive(bool live);
6871
69 void incrementViewCount();72 void registerView(qintptr viewId);
70 void decrementViewCount();73 void unregisterView(qintptr viewId);
71 int viewCount() const;74 void setViewVisibility(qintptr viewId, bool visible);
75 int viewCount() const { return m_views.count(); }
7276
73 int width() const;77 int width() const;
74 int height() const;78 int height() const;
@@ -97,6 +101,8 @@
97 void activeFocusChanged(bool);101 void activeFocusChanged(bool);
98102
99private:103private:
104 void updateVisibility();
105
100 const QString m_name;106 const QString m_name;
101 const Mir::Type m_type;107 const Mir::Type m_type;
102 Mir::State m_state;108 Mir::State m_state;
@@ -104,10 +110,14 @@
104 QUrl m_screenshotUrl;110 QUrl m_screenshotUrl;
105 QUrl m_qmlFilePath;111 QUrl m_qmlFilePath;
106 bool m_live;112 bool m_live;
107 int m_viewCount;113 bool m_visible;
108 bool m_activeFocus;114 bool m_activeFocus;
109 int m_width;115 int m_width;
110 int m_height;116 int m_height;
117 struct View {
118 bool visible;
119 };
120 QHash<qintptr, View> m_views;
111};121};
112122
113#endif // MOCK_MIR_SURFACE_H123#endif // MOCK_MIR_SURFACE_H
114124
=== modified file 'tests/mocks/Unity/Application/MirSurfaceItem.cpp'
--- tests/mocks/Unity/Application/MirSurfaceItem.cpp 2015-09-25 12:13:13 +0000
+++ tests/mocks/Unity/Application/MirSurfaceItem.cpp 2015-10-26 18:36:26 +0000
@@ -44,6 +44,8 @@
44 Qt::ExtraButton5 | Qt::ExtraButton6 | Qt::ExtraButton7 | Qt::ExtraButton8 |44 Qt::ExtraButton5 | Qt::ExtraButton6 | Qt::ExtraButton7 | Qt::ExtraButton8 |
45 Qt::ExtraButton9 | Qt::ExtraButton10 | Qt::ExtraButton11 |45 Qt::ExtraButton9 | Qt::ExtraButton10 | Qt::ExtraButton11 |
46 Qt::ExtraButton12 | Qt::ExtraButton13);46 Qt::ExtraButton12 | Qt::ExtraButton13);
47
48 connect(this, &QQuickItem::visibleChanged, this, &MirSurfaceItem::updateMirSurfaceVisibility);
47}49}
4850
49MirSurfaceItem::~MirSurfaceItem()51MirSurfaceItem::~MirSurfaceItem()
@@ -194,17 +196,18 @@
194 m_qmlContentComponent = nullptr;196 m_qmlContentComponent = nullptr;
195197
196 disconnect(m_qmlSurface, nullptr, this, nullptr);198 disconnect(m_qmlSurface, nullptr, this, nullptr);
197 m_qmlSurface->decrementViewCount();199 m_qmlSurface->unregisterView((qintptr)this);
198 }200 }
199201
200 m_qmlSurface = static_cast<MirSurface*>(surface);202 m_qmlSurface = static_cast<MirSurface*>(surface);
201203
202 if (m_qmlSurface) {204 if (m_qmlSurface) {
203 m_qmlSurface->incrementViewCount();205 m_qmlSurface->registerView((qintptr)this);
204206
205 m_qmlSurface->setActiveFocus(hasActiveFocus());207 m_qmlSurface->setActiveFocus(hasActiveFocus());
206208
207 updateSurfaceSize();209 updateSurfaceSize();
210 updateMirSurfaceVisibility();
208211
209 connect(m_qmlSurface, &MirSurface::orientationAngleChanged, this, &MirSurfaceItem::orientationAngleChanged);212 connect(m_qmlSurface, &MirSurface::orientationAngleChanged, this, &MirSurfaceItem::orientationAngleChanged);
210 connect(m_qmlSurface, &MirSurface::screenshotUrlChanged, this, &MirSurfaceItem::updateScreenshot);213 connect(m_qmlSurface, &MirSurface::screenshotUrlChanged, this, &MirSurfaceItem::updateScreenshot);
@@ -253,6 +256,13 @@
253 }256 }
254}257}
255258
259void MirSurfaceItem::updateMirSurfaceVisibility()
260{
261 if (!m_qmlSurface) return;
262
263 m_qmlSurface->setViewVisibility((qintptr)this, isVisible());
264}
265
256void MirSurfaceItem::setConsumesInput(bool value)266void MirSurfaceItem::setConsumesInput(bool value)
257{267{
258 if (m_consumesInput != value) {268 if (m_consumesInput != value) {
259269
=== modified file 'tests/mocks/Unity/Application/MirSurfaceItem.h'
--- tests/mocks/Unity/Application/MirSurfaceItem.h 2015-09-19 07:37:52 +0000
+++ tests/mocks/Unity/Application/MirSurfaceItem.h 2015-10-26 18:36:26 +0000
@@ -87,6 +87,7 @@
87private Q_SLOTS:87private Q_SLOTS:
88 void onComponentStatusChanged(QQmlComponent::Status status);88 void onComponentStatusChanged(QQmlComponent::Status status);
89 void updateScreenshot(QUrl screenshot);89 void updateScreenshot(QUrl screenshot);
90 void updateMirSurfaceVisibility();
9091
91private:92private:
92 void createQmlContentItem();93 void createQmlContentItem();
9394
=== modified file 'tests/qmltests/Stages/tst_DesktopStage.qml'
--- tests/qmltests/Stages/tst_DesktopStage.qml 2015-09-17 12:25:29 +0000
+++ tests/qmltests/Stages/tst_DesktopStage.qml 2015-10-26 18:36:26 +0000
@@ -35,12 +35,15 @@
35 value: false35 value: false
36 }36 }
3737
38 Component.onCompleted: {38 Component.onCompleted: resetGeometry()
39
40 function resetGeometry() {
39 // ensures apps which are tested decorations are in view.41 // ensures apps which are tested decorations are in view.
40 WindowStateStorage.geometry = {42 WindowStateStorage.geometry = {
41 'unity8-dash': Qt.rect(0, units.gu(3), units.gu(50), units.gu(40)),43 'unity8-dash': Qt.rect(0, units.gu(3), units.gu(50), units.gu(40)),
42 'dialer-app': Qt.rect(units.gu(51), units.gu(3), units.gu(50), units.gu(40)),44 'dialer-app': Qt.rect(units.gu(51), units.gu(3), units.gu(50), units.gu(40)),
43 'camera-app': Qt.rect(0, units.gu(44), units.gu(50), units.gu(40)),45 'camera-app': Qt.rect(0, units.gu(44), units.gu(50), units.gu(40)),
46 'gallery-app': Qt.rect(units.gu(51), units.gu(44), units.gu(50), units.gu(40))
44 }47 }
45 }48 }
4649
@@ -110,14 +113,14 @@
110113
111 desktopStageLoader.active = true;114 desktopStageLoader.active = true;
112 tryCompare(desktopStageLoader, "status", Loader.Ready);115 tryCompare(desktopStageLoader, "status", Loader.Ready);
116 root.resetGeometry();
113 }117 }
114118
115 function killAllRunningApps() {119 function killAllRunningApps() {
116 while (ApplicationManager.count > 1) {120 while (ApplicationManager.count > 0) {
117 var appIndex = ApplicationManager.get(0).appId == "unity8-dash" ? 1 : 0121 ApplicationManager.stopApplication(ApplicationManager.get(0).appId);
118 ApplicationManager.stopApplication(ApplicationManager.get(appIndex).appId);
119 }122 }
120 compare(ApplicationManager.count, 1)123 compare(ApplicationManager.count, 0)
121 }124 }
122125
123 function waitUntilAppSurfaceShowsUp(appId) {126 function waitUntilAppSurfaceShowsUp(appId) {
@@ -210,5 +213,69 @@
210 tap(toAppDecoration);213 tap(toAppDecoration);
211 tryCompare(ApplicationManager.findApplication(data.apps[data.focusTo]).session.surface, "activeFocus", true);214 tryCompare(ApplicationManager.findApplication(data.apps[data.focusTo]).session.surface, "activeFocus", true);
212 }215 }
216
217 function test_minimizeApplicationHidesSurface(data) {
218 var dashApp = startApplication("unity8-dash");
219
220 var dashDelegate = findChild(desktopStage, "stageDelegate_unity8-dash");
221 verify(dashDelegate);
222
223 dashDelegate.minimize();
224 tryCompare(dashApp.session.surface, "visible", false);
225 }
226
227 function test_maximizeApplicationHidesSurfacesBehindIt(data) {
228 var dashApp = startApplication("unity8-dash");
229 var dialerApp = startApplication("dialer-app");
230 var cameraApp = startApplication("camera-app");
231
232 var dashDelegate = findChild(desktopStage, "stageDelegate_unity8-dash");
233 verify(dashDelegate);
234 var dialerDelegate = findChild(desktopStage, "stageDelegate_dialer-app");
235 verify(dialerDelegate);
236 var cameraDelegate = findChild(desktopStage, "stageDelegate_camera-app");
237 verify(cameraDelegate);
238
239 dialerDelegate.maximize();
240 tryCompare(dialerDelegate, "visuallyMaximized", true);
241
242 tryCompare(dashApp.session.surface, "visible", false);
243 compare(cameraApp.session.surface.visible, true);
244
245 dialerDelegate.unmaximize();
246 compare(dashApp.session.surface.visible, true);
247 compare(cameraApp.session.surface.visible, true);
248 }
249
250 function test_applicationsBecomeVisibleWhenOccludingAppRemoved(data) {
251 var dashApp = startApplication("unity8-dash");
252 var dialerApp = startApplication("dialer-app");
253 var cameraApp = startApplication("camera-app");
254 var galleryApp = startApplication("gallery-app");
255
256 var dashDelegate = findChild(desktopStage, "stageDelegate_unity8-dash");
257 verify(dashDelegate);
258 var dialerDelegate = findChild(desktopStage, "stageDelegate_dialer-app");
259 verify(dialerDelegate);
260 var cameraDelegate = findChild(desktopStage, "stageDelegate_camera-app");
261 verify(cameraDelegate);
262 var galleryDelegate = findChild(desktopStage, "stageDelegate_gallery-app");
263 verify(galleryDelegate);
264
265 dialerDelegate.maximize();
266 galleryDelegate.maximize();
267 tryCompare(dialerDelegate, "visuallyMaximized", true);
268 tryCompare(galleryDelegate, "visuallyMaximized", true);
269
270 tryCompare(dashApp.session.surface, "visible", false);
271 tryCompare(dialerApp.session.surface, "visible", false);
272 tryCompare(cameraApp.session.surface, "visible", false);
273
274 ApplicationManager.stopApplication("gallery-app");
275
276 compare(cameraApp.session.surface.visible, true);
277 tryCompare(dialerApp.session.surface, "visible", true);
278 tryCompare(dashApp.session.surface, "visible", false); // still occluded by maximised dialer
279 }
213 }280 }
214}281}

Subscribers

People subscribed via source and target branches