Merge lp:~mzanetti/unity8/panel-button-fixes into lp:unity8
- panel-button-fixes
- Merge into trunk
Status: | Superseded |
---|---|
Proposed branch: | lp:~mzanetti/unity8/panel-button-fixes |
Merge into: | lp:unity8 |
Prerequisite: | lp:~dandrader/unity8/mousePointer |
Diff against target: |
479 lines (+224/-37) 11 files modified
CMakeLists.txt (+0/-4) plugins/Utils/windowstatestorage.cpp (+60/-21) plugins/Utils/windowstatestorage.h (+12/-0) qml/Components/WindowControlButtons.qml (+3/-0) qml/Shell.qml (+1/-0) qml/Stages/DesktopStage.qml (+9/-3) qml/Stages/WindowResizeArea.qml (+38/-7) tests/mocks/Utils/windowstatestorage.cpp (+11/-0) tests/mocks/Utils/windowstatestorage.h (+9/-0) tests/qmltests/Stages/tst_WindowResizeArea.qml (+35/-2) tests/qmltests/tst_Shell.qml (+46/-0) |
To merge this branch: | bzr merge lp:~mzanetti/unity8/panel-button-fixes |
Related bugs: |
|
Reviewer | Review Type | Date Requested | Status |
---|---|---|---|
Lukáš Tinkl (community) | Needs Fixing | ||
PS Jenkins bot (community) | continuous-integration | Needs Fixing | |
Michał Sawicz | Abstain | ||
Review via email: mp+272558@code.launchpad.net |
This proposal supersedes a proposal from 2015-09-25.
This proposal has been superseded by a proposal from 2015-10-08.
Commit message
Fixes for the panel buttons
* Hide panel buttons when switching to staged mode
* properly save/restore window states, not just geometry
Description of the change
* Are there any related MPs required for this MP to build/function as expected? Please list.
no
* Did you perform an exploratory manual test run of your code change and any related functionality?
yes
* Did you make sure that your branch does not contain spurious tags?
yes
* If you changed the packaging (debian), did you subscribe the ubuntu-unity team to this MP?
n/a
* If you changed the UI, has there been a design review?
n/a
Daniel d'Andrada (dandrader) wrote : Posted in a previous version of this proposal | # |
Michael Zanetti (mzanetti) wrote : Posted in a previous version of this proposal | # |
ok, will redo it on top of that
PS Jenkins bot (ps-jenkins) wrote : Posted in a previous version of this proposal | # |
FAILED: Continuous integration, rev:1982
http://
Executed test runs:
SUCCESS: http://
UNSTABLE: http://
UNSTABLE: http://
UNSTABLE: http://
SUCCESS: http://
SUCCESS: http://
SUCCESS: http://
SUCCESS: http://
SUCCESS: http://
SUCCESS: http://
deb: http://
SUCCESS: http://
UNSTABLE: http://
SUCCESS: http://
deb: http://
SUCCESS: http://
Click here to trigger a rebuild:
http://
Michael Zanetti (mzanetti) wrote : Posted in a previous version of this proposal | # |
> It should conflict BIG TIME with mousePointer as it changes the resize area as
> well
ok... it really wasn't that BIG TIME but it's rebased on top of that now :)
- 1984. By Michael Zanetti
-
drop some leftover from merge
Michael Zanetti (mzanetti) wrote : | # |
There are some tests failing. Some of them fail because of the prereq branches. I'll update this when the prereqs are fixed.
PS Jenkins bot (ps-jenkins) wrote : Posted in a previous version of this proposal | # |
FAILED: Continuous integration, rev:1983
http://
Executed test runs:
FAILURE: http://
FAILURE: http://
FAILURE: http://
FAILURE: http://
FAILURE: http://
FAILURE: http://
FAILURE: http://
FAILURE: http://
FAILURE: http://
FAILURE: http://
Click here to trigger a rebuild:
http://
PS Jenkins bot (ps-jenkins) wrote : | # |
FAILED: Continuous integration, rev:1984
http://
Executed test runs:
FAILURE: http://
FAILURE: http://
FAILURE: http://
FAILURE: http://
FAILURE: http://
FAILURE: http://
FAILURE: http://
FAILURE: http://
FAILURE: http://
FAILURE: http://
Click here to trigger a rebuild:
http://
- 1985. By Michael Zanetti
-
merge prereq
- 1986. By Michael Zanetti
-
fix tests, add another
PS Jenkins bot (ps-jenkins) wrote : | # |
FAILED: Continuous integration, rev:1986
http://
Executed test runs:
FAILURE: http://
FAILURE: http://
FAILURE: http://
FAILURE: http://
FAILURE: http://
FAILURE: http://
FAILURE: http://
FAILURE: http://
FAILURE: http://
FAILURE: http://
Click here to trigger a rebuild:
http://
PS Jenkins bot (ps-jenkins) wrote : | # |
FAILED: Continuous integration, rev:1986
http://
Executed test runs:
FAILURE: http://
FAILURE: http://
FAILURE: http://
FAILURE: http://
FAILURE: http://
FAILURE: http://
FAILURE: http://
FAILURE: http://
FAILURE: http://
FAILURE: http://
Click here to trigger a rebuild:
http://
Michał Sawicz (saviq) wrote : | # |
Text conflict in debian/control
Text conflict in plugins/
Text conflict in qml/OrientedShe
3 conflicts encountered.
Michael Zanetti (mzanetti) wrote : | # |
> Text conflict in debian/control
> Text conflict in plugins/
> Text conflict in qml/OrientedShe
> 3 conflicts encountered.
They're to be resolved in the prerequisite (mousePointer)
Michał Sawicz (saviq) : | # |
- 1987. By Michael Zanetti
-
merge with prereq
PS Jenkins bot (ps-jenkins) wrote : | # |
FAILED: Continuous integration, rev:1987
http://
Executed test runs:
FAILURE: http://
FAILURE: http://
FAILURE: http://
FAILURE: http://
FAILURE: http://
FAILURE: http://
FAILURE: http://
FAILURE: http://
FAILURE: http://
FAILURE: http://
Click here to trigger a rebuild:
http://
Albert Astals Cid (aacid) wrote : | # |
Text conflict in CMakeLists.txt
1 conflicts encountered.
Lukáš Tinkl (lukas-kde) wrote : | # |
Some inline comments
- 1988. By Michael Zanetti
-
merge new prereq
- 1989. By Michael Zanetti
-
fix some review notes
- 1990. By Michael Zanetti
-
fix default arg handling
- 1991. By Michael Zanetti
-
merge with prereq
- 1992. By Michael Zanetti
-
make sure panel buttons are not visible while greeter is shown
- 1993. By Michael Zanetti
-
drop debug print
- 1994. By Michael Zanetti
-
merge trunk
- 1995. By Michael Zanetti
-
fix tests (clear the mock state store between tests)
- 1996. By Michael Zanetti
-
fix initialisation of window storage state for new apps/windows
Unmerged revisions
Preview Diff
1 | === modified file 'CMakeLists.txt' |
2 | --- CMakeLists.txt 2015-10-08 13:45:27 +0000 |
3 | +++ CMakeLists.txt 2015-10-08 13:45:27 +0000 |
4 | @@ -57,11 +57,7 @@ |
5 | find_package(Qt5Concurrent 5.2 REQUIRED) |
6 | find_package(Qt5Sql 5.2 REQUIRED) |
7 | |
8 | -<<<<<<< TREE |
9 | -pkg_check_modules(APPLICATION_API REQUIRED unity-shell-application>=8) |
10 | -======= |
11 | pkg_check_modules(APPLICATION_API REQUIRED unity-shell-application=9) |
12 | ->>>>>>> MERGE-SOURCE |
13 | |
14 | # Standard install paths |
15 | include(GNUInstallDirs) |
16 | |
17 | === modified file 'plugins/Utils/windowstatestorage.cpp' |
18 | --- plugins/Utils/windowstatestorage.cpp 2015-09-14 09:11:08 +0000 |
19 | +++ plugins/Utils/windowstatestorage.cpp 2015-10-08 13:45:27 +0000 |
20 | @@ -47,10 +47,30 @@ |
21 | m_db.close(); |
22 | } |
23 | |
24 | +void WindowStateStorage::saveState(const QString &windowId, WindowStateStorage::WindowState state) |
25 | +{ |
26 | + QString queryString = QString("INSERT OR REPLACE INTO state (windowId, state) values ('%1', '%2');") |
27 | + .arg(windowId) |
28 | + .arg((int)state); |
29 | + |
30 | + saveValue(queryString); |
31 | +} |
32 | + |
33 | +WindowStateStorage::WindowState WindowStateStorage::getState(const QString &windowId, WindowStateStorage::WindowState defaultValue) |
34 | +{ |
35 | + QString queryString = QString("SELECT * FROM state WHERE windowId = '%1';") |
36 | + .arg(windowId); |
37 | + |
38 | + QSqlQuery query = getValue(queryString); |
39 | + |
40 | + if (!query.first()) { |
41 | + return defaultValue; |
42 | + } |
43 | + return (WindowState)query.value("state").toInt(); |
44 | +} |
45 | + |
46 | void WindowStateStorage::saveGeometry(const QString &windowId, const QRect &rect) |
47 | { |
48 | - QMutexLocker mutexLocker(&s_mutex); |
49 | - |
50 | QString queryString = QStringLiteral("INSERT OR REPLACE INTO geometry (windowId, x, y, width, height) values ('%1', '%2', '%3', '%4', '%5');") |
51 | .arg(windowId) |
52 | .arg(rect.x()) |
53 | @@ -58,15 +78,7 @@ |
54 | .arg(rect.width()) |
55 | .arg(rect.height()); |
56 | |
57 | - QFuture<void> future = QtConcurrent::run(executeAsyncQuery, queryString); |
58 | - m_asyncQueries.append(future); |
59 | - |
60 | - QFutureWatcher<void> *futureWatcher = new QFutureWatcher<void>(); |
61 | - futureWatcher->setFuture(future); |
62 | - connect(futureWatcher, &QFutureWatcher<void>::finished, |
63 | - this, |
64 | - [=](){ m_asyncQueries.removeAll(futureWatcher->future()); |
65 | - futureWatcher->deleteLater(); }); |
66 | + saveValue(queryString); |
67 | } |
68 | |
69 | void WindowStateStorage::executeAsyncQuery(const QString &queryString) |
70 | @@ -84,18 +96,11 @@ |
71 | |
72 | QRect WindowStateStorage::getGeometry(const QString &windowId, const QRect &defaultValue) |
73 | { |
74 | - QMutexLocker l(&s_mutex); |
75 | QString queryString = QStringLiteral("SELECT * FROM geometry WHERE windowId = '%1';") |
76 | .arg(windowId); |
77 | - QSqlQuery query; |
78 | - |
79 | - bool ok = query.exec(queryString); |
80 | - if (!ok) { |
81 | - qWarning() << "Error retrieving window state for" << windowId |
82 | - << "Driver error:" << query.lastError().driverText() |
83 | - << "Database error:" << query.lastError().databaseText(); |
84 | - return defaultValue; |
85 | - } |
86 | + |
87 | + QSqlQuery query = getValue(queryString); |
88 | + |
89 | if (!query.first()) { |
90 | return defaultValue; |
91 | } |
92 | @@ -114,4 +119,38 @@ |
93 | QSqlQuery query; |
94 | query.exec(QStringLiteral("CREATE TABLE geometry(windowId TEXT UNIQUE, x INTEGER, y INTEGER, width INTEGER, height INTEGER);")); |
95 | } |
96 | + |
97 | + if (!m_db.tables().contains("state")) { |
98 | + QSqlQuery query; |
99 | + query.exec("CREATE TABLE state(windowId TEXT UNIQUE, state INTEGER);"); |
100 | + } |
101 | +} |
102 | + |
103 | +void WindowStateStorage::saveValue(const QString &queryString) |
104 | +{ |
105 | + QMutexLocker mutexLocker(&s_mutex); |
106 | + |
107 | + QFuture<void> future = QtConcurrent::run(executeAsyncQuery, queryString); |
108 | + m_asyncQueries.append(future); |
109 | + |
110 | + QFutureWatcher<void> *futureWatcher = new QFutureWatcher<void>(); |
111 | + futureWatcher->setFuture(future); |
112 | + connect(futureWatcher, &QFutureWatcher<void>::finished, |
113 | + this, |
114 | + [=](){ m_asyncQueries.removeAll(futureWatcher->future()); |
115 | + futureWatcher->deleteLater(); }); |
116 | +} |
117 | + |
118 | +QSqlQuery WindowStateStorage::getValue(const QString &queryString) |
119 | +{ |
120 | + QMutexLocker l(&s_mutex); |
121 | + QSqlQuery query; |
122 | + |
123 | + bool ok = query.exec(queryString); |
124 | + if (!ok) { |
125 | + qWarning() << "Error retrieving database query:" << queryString |
126 | + << "Driver error:" << query.lastError().driverText() |
127 | + << "Database error:" << query.lastError().databaseText(); |
128 | + } |
129 | + return query; |
130 | } |
131 | |
132 | === modified file 'plugins/Utils/windowstatestorage.h' |
133 | --- plugins/Utils/windowstatestorage.h 2015-03-13 19:01:32 +0000 |
134 | +++ plugins/Utils/windowstatestorage.h 2015-10-08 13:45:27 +0000 |
135 | @@ -22,16 +22,28 @@ |
136 | class WindowStateStorage: public QObject |
137 | { |
138 | Q_OBJECT |
139 | + Q_ENUMS(WindowState) |
140 | public: |
141 | + enum WindowState { |
142 | + WindowStateNormal, |
143 | + WindowStateMaximized |
144 | + }; |
145 | + |
146 | WindowStateStorage(QObject *parent = 0); |
147 | virtual ~WindowStateStorage(); |
148 | |
149 | + Q_INVOKABLE void saveState(const QString &windowId, WindowState state); |
150 | + Q_INVOKABLE WindowState getState(const QString &windowId, WindowState defaultValue); |
151 | + |
152 | Q_INVOKABLE void saveGeometry(const QString &windowId, const QRect &rect); |
153 | Q_INVOKABLE QRect getGeometry(const QString &windowId, const QRect &defaultValue); |
154 | |
155 | private: |
156 | void initdb(); |
157 | |
158 | + void saveValue(const QString &queryString); |
159 | + QSqlQuery getValue(const QString &queryString); |
160 | + |
161 | static void executeAsyncQuery(const QString &queryString); |
162 | static QMutex s_mutex; |
163 | |
164 | |
165 | === modified file 'qml/Components/WindowControlButtons.qml' |
166 | --- qml/Components/WindowControlButtons.qml 2014-11-24 11:21:38 +0000 |
167 | +++ qml/Components/WindowControlButtons.qml 2015-10-08 13:45:27 +0000 |
168 | @@ -28,6 +28,7 @@ |
169 | signal maximize() |
170 | |
171 | Rectangle { |
172 | + objectName: "closeWindowButton" |
173 | height: parent.height; width: height; radius: height / 2 |
174 | gradient: Gradient { |
175 | GradientStop { color: "#F49073"; position: 0 } |
176 | @@ -38,6 +39,7 @@ |
177 | MouseArea { anchors.fill: parent; onClicked: root.close() } |
178 | } |
179 | Rectangle { |
180 | + objectName: "minimizeWindowButton" |
181 | height: parent.height; width: height; radius: height / 2 |
182 | gradient: Gradient { |
183 | GradientStop { color: "#92918C"; position: 0 } |
184 | @@ -48,6 +50,7 @@ |
185 | MouseArea { anchors.fill: parent; onClicked: root.minimize() } |
186 | } |
187 | Rectangle { |
188 | + objectName: "maximizeWindowButton" |
189 | height: parent.height; width: height; radius: height / 2 |
190 | gradient: Gradient { |
191 | GradientStop { color: "#92918C"; position: 0 } |
192 | |
193 | === modified file 'qml/Shell.qml' |
194 | --- qml/Shell.qml 2015-10-08 13:45:27 +0000 |
195 | +++ qml/Shell.qml 2015-10-08 13:45:27 +0000 |
196 | @@ -58,6 +58,7 @@ |
197 | property bool beingResized |
198 | property string usageScenario: "phone" // supported values: "phone", "tablet" or "desktop" |
199 | property string mode: "full-greeter" |
200 | + property bool cursorVisible: false |
201 | function updateFocusedAppOrientation() { |
202 | applicationsDisplayLoader.item.updateFocusedAppOrientation(); |
203 | } |
204 | |
205 | === modified file 'qml/Stages/DesktopStage.qml' |
206 | --- qml/Stages/DesktopStage.qml 2015-10-08 13:45:27 +0000 |
207 | +++ qml/Stages/DesktopStage.qml 2015-10-08 13:45:27 +0000 |
208 | @@ -111,6 +111,7 @@ |
209 | property: "buttonsVisible" |
210 | value: priv.focusedAppDelegate !== null && priv.focusedAppDelegate.state === "maximized" |
211 | } |
212 | + Component.onDestruction: PanelState.buttonsVisible = false; |
213 | |
214 | FocusScope { |
215 | id: appContainer |
216 | @@ -140,6 +141,7 @@ |
217 | |
218 | property bool maximized: false |
219 | property bool minimized: false |
220 | + property bool animationsEnabled: true |
221 | |
222 | onFocusChanged: { |
223 | if (focus && ApplicationManager.focusedApplicationId !== model.appId) { |
224 | @@ -158,15 +160,18 @@ |
225 | value: ApplicationInfoInterface.RequestedRunning // Always running for now |
226 | } |
227 | |
228 | - function maximize() { |
229 | + function maximize(animated) { |
230 | + animationsEnabled = (animated === undefined) | animated; |
231 | minimized = false; |
232 | maximized = true; |
233 | } |
234 | - function minimize() { |
235 | + function minimize(animated) { |
236 | + animationsEnabled = (animated === undefined) | animated; |
237 | maximized = false; |
238 | minimized = true; |
239 | } |
240 | - function unmaximize() { |
241 | + function unmaximize(animated) { |
242 | + animationsEnabled = (animated === undefined) | animated; |
243 | minimized = false; |
244 | maximized = false; |
245 | } |
246 | @@ -188,6 +193,7 @@ |
247 | Transition { |
248 | from: "maximized,minimized,normal," |
249 | to: "maximized,minimized,normal," |
250 | + enabled: appDelegate.animationsEnabled |
251 | PropertyAnimation { target: appDelegate; properties: "x,y,opacity,width,height,scale" } |
252 | }, |
253 | Transition { |
254 | |
255 | === modified file 'qml/Stages/WindowResizeArea.qml' |
256 | --- qml/Stages/WindowResizeArea.qml 2015-10-08 13:45:27 +0000 |
257 | +++ qml/Stages/WindowResizeArea.qml 2015-10-08 13:45:27 +0000 |
258 | @@ -36,18 +36,49 @@ |
259 | property int minWidth: 0 |
260 | property int minHeight: 0 |
261 | |
262 | + QtObject { |
263 | + id: priv |
264 | + |
265 | + property int normalX: 0 |
266 | + property int normalY: 0 |
267 | + property int normalWidth: 0 |
268 | + property int normalHeight: 0 |
269 | + |
270 | + function updateNormalGeometry() { |
271 | + if (root.target.state == "normal") { |
272 | + normalX = root.target.x |
273 | + normalY = root.target.y |
274 | + normalWidth = root.target.width |
275 | + normalHeight = root.target.height |
276 | + } |
277 | + } |
278 | + } |
279 | + |
280 | + Connections { |
281 | + target: root.target |
282 | + onXChanged: priv.updateNormalGeometry(); |
283 | + onYChanged: priv.updateNormalGeometry(); |
284 | + onWidthChanged: priv.updateNormalGeometry(); |
285 | + onHeightChanged: priv.updateNormalGeometry(); |
286 | + } |
287 | + |
288 | Component.onCompleted: { |
289 | - var windowState = windowStateStorage.getGeometry(root.windowId, Qt.rect(target.x, target.y, target.width, target.height)) |
290 | - if (windowState !== undefined) { |
291 | - target.x = windowState.x |
292 | - target.y = windowState.y |
293 | - target.width = windowState.width |
294 | - target.height = windowState.height |
295 | + var windowGeometry = windowStateStorage.getGeometry(root.windowId, Qt.rect(target.x, target.y, target.width, target.height)) |
296 | + if (windowGeometry !== undefined) { |
297 | + target.x = windowGeometry.x |
298 | + target.y = windowGeometry.y |
299 | + target.width = windowGeometry.width |
300 | + target.height = windowGeometry.height |
301 | + } |
302 | + var windowState = windowStateStorage.getState(root.windowId, WindowStateStorage.WindowStateNormal) |
303 | + if (windowState === WindowStateStorage.WindowStateMaximized) { |
304 | + target.maximize(false) |
305 | } |
306 | } |
307 | |
308 | Component.onDestruction: { |
309 | - windowStateStorage.saveGeometry(root.windowId, Qt.rect(target.x, target.y, target.width, target.height)) |
310 | + windowStateStorage.saveState(root.windowId, target.state == "maximized" ? WindowStateStorage.WindowStateMaximized : WindowStateStorage.WindowStateNormal) |
311 | + windowStateStorage.saveGeometry(root.windowId, Qt.rect(priv.normalX, priv.normalY, priv.normalWidth, priv.normalHeight)) |
312 | } |
313 | |
314 | QtObject { |
315 | |
316 | === modified file 'tests/mocks/Utils/windowstatestorage.cpp' |
317 | --- tests/mocks/Utils/windowstatestorage.cpp 2015-08-24 15:39:53 +0000 |
318 | +++ tests/mocks/Utils/windowstatestorage.cpp 2015-10-08 13:45:27 +0000 |
319 | @@ -44,3 +44,14 @@ |
320 | if (!m_geometry.contains(windowId)) return defaultValue; |
321 | return m_geometry.value(windowId).toRect(); |
322 | } |
323 | + |
324 | +void WindowStateStorage::saveState(const QString &windowId, WindowState state) |
325 | +{ |
326 | + m_state[windowId] = state; |
327 | +} |
328 | + |
329 | +WindowStateStorage::WindowState WindowStateStorage::getState(const QString &windowId, WindowStateStorage::WindowState defaultValue) |
330 | +{ |
331 | + if (!m_state.contains(windowId)) return defaultValue; |
332 | + return m_state.value(windowId); |
333 | +} |
334 | |
335 | === modified file 'tests/mocks/Utils/windowstatestorage.h' |
336 | --- tests/mocks/Utils/windowstatestorage.h 2015-08-24 15:39:53 +0000 |
337 | +++ tests/mocks/Utils/windowstatestorage.h 2015-10-08 13:45:27 +0000 |
338 | @@ -22,9 +22,17 @@ |
339 | { |
340 | Q_OBJECT |
341 | Q_PROPERTY(QVariantMap geometry READ geometry WRITE setGeometry NOTIFY geometryChanged) |
342 | + Q_ENUMS(WindowState) |
343 | public: |
344 | + enum WindowState { |
345 | + WindowStateNormal, |
346 | + WindowStateMaximized |
347 | + }; |
348 | WindowStateStorage(QObject *parent = 0); |
349 | |
350 | + Q_INVOKABLE void saveState(const QString &windowId, WindowState state); |
351 | + Q_INVOKABLE WindowState getState(const QString &windowId, WindowState defaultValue); |
352 | + |
353 | Q_INVOKABLE void saveGeometry(const QString &windowId, const QRect &rect); |
354 | Q_INVOKABLE QRect getGeometry(const QString &windowId, const QRect &defaultValue); |
355 | |
356 | @@ -35,5 +43,6 @@ |
357 | void setGeometry(const QVariantMap& geometry); |
358 | QVariantMap geometry() const; |
359 | |
360 | + QHash<QString, WindowState> m_state; |
361 | QVariantMap m_geometry; |
362 | }; |
363 | |
364 | === modified file 'tests/qmltests/Stages/tst_WindowResizeArea.qml' |
365 | --- tests/qmltests/Stages/tst_WindowResizeArea.qml 2015-10-08 13:45:27 +0000 |
366 | +++ tests/qmltests/Stages/tst_WindowResizeArea.qml 2015-10-08 13:45:27 +0000 |
367 | @@ -44,8 +44,11 @@ |
368 | width: units.gu(20) |
369 | property int windowHeight: height |
370 | property int windowWidth: width |
371 | - onWindowHeightChanged: height = windowHeight |
372 | - onWindowWidthChanged: width = windowWidth |
373 | + state: "normal" |
374 | + |
375 | + function maximize() { |
376 | + state = "maximized" |
377 | + } |
378 | |
379 | WindowResizeArea { |
380 | id: windowResizeArea |
381 | @@ -214,5 +217,35 @@ |
382 | tryCompare(fakeWindow, "width", initialWindowWidth); |
383 | tryCompare(fakeWindow, "height", initialWindowHeight); |
384 | } |
385 | + |
386 | + function test_saveRestoreMaximized() { |
387 | + var initialWindowX = fakeWindow.x; |
388 | + var initialWindowY = fakeWindow.y; |
389 | + |
390 | + var moveDelta = units.gu(5); |
391 | + |
392 | + fakeWindow.x = initialWindowX + moveDelta |
393 | + fakeWindow.y = initialWindowY + moveDelta |
394 | + |
395 | + // Now change the state to maximized. The window should not keep updating the stored values |
396 | + fakeWindow.state = "maximized" |
397 | + fakeWindow.x = 31415 // 0 is too risky to pass the test even when broken |
398 | + fakeWindow.y = 31415 |
399 | + |
400 | + // This will destroy the window and recreate it |
401 | + windowLoader.active = false; |
402 | + waitForRendering(root); |
403 | + windowLoader.active = true; |
404 | + |
405 | + // Make sure it's again where we left it in normal state before destroying |
406 | + tryCompare(fakeWindow, "x", initialWindowX + moveDelta) |
407 | + tryCompare(fakeWindow, "y", initialWindowX + moveDelta) |
408 | + |
409 | + // Make sure maximize() has been called after restoring |
410 | + tryCompare(fakeWindow, "state", "maximized") |
411 | + |
412 | + // clean up |
413 | + fakeWindow.state = "normal" |
414 | + } |
415 | } |
416 | } |
417 | |
418 | === modified file 'tests/qmltests/tst_Shell.qml' |
419 | --- tests/qmltests/tst_Shell.qml 2015-09-18 12:05:32 +0000 |
420 | +++ tests/qmltests/tst_Shell.qml 2015-10-08 13:45:27 +0000 |
421 | @@ -31,6 +31,7 @@ |
422 | import Wizard 0.1 as Wizard |
423 | |
424 | import "../../qml" |
425 | +import "../../qml/Components/PanelState" |
426 | import "Stages" |
427 | |
428 | Rectangle { |
429 | @@ -1731,5 +1732,50 @@ |
430 | |
431 | keyRelease(Qt.Key_Control); |
432 | } |
433 | + |
434 | + // regression test for http://pad.lv/1443319 |
435 | + function test_closeMaximizedAndRestart() { |
436 | + loadDesktopShellWithApps(); |
437 | + |
438 | + var appRepeater = findChild(shell, "appRepeater") |
439 | + var appId = ApplicationManager.get(0).appId; |
440 | + var appDelegate = appRepeater.itemAt(0); |
441 | + var maximizeButton = findChild(appDelegate, "maximizeWindowButton"); |
442 | + |
443 | + tryCompare(appDelegate, "state", "normal"); |
444 | + tryCompare(PanelState, "buttonsVisible", false) |
445 | + |
446 | + mouseClick(maximizeButton, maximizeButton.width / 2, maximizeButton.height / 2); |
447 | + tryCompare(appDelegate, "state", "maximized"); |
448 | + tryCompare(PanelState, "buttonsVisible", true) |
449 | + |
450 | + ApplicationManager.stopApplication(appId); |
451 | + tryCompare(PanelState, "buttonsVisible", false) |
452 | + |
453 | + ApplicationManager.startApplication(appId); |
454 | + tryCompare(PanelState, "buttonsVisible", true) |
455 | + } |
456 | + |
457 | + // bug http://pad.lv/1431566 |
458 | + function test_switchToStagedHidesPanelButtons() { |
459 | + loadDesktopShellWithApps(); |
460 | + var appRepeater = findChild(shell, "appRepeater") |
461 | + var appId = ApplicationManager.get(0).appId; |
462 | + var appDelegate = appRepeater.itemAt(0); |
463 | + |
464 | + tryCompare(appDelegate, "state", "normal"); |
465 | + tryCompare(PanelState, "buttonsVisible", false); |
466 | + |
467 | + appDelegate.maximize(false); |
468 | + tryCompare(PanelState, "buttonsVisible", true); |
469 | + |
470 | + shell.usageScenario = "phone"; |
471 | + waitForRendering(shell); |
472 | + tryCompare(PanelState, "buttonsVisible", false); |
473 | + |
474 | + shell.usageScenario = "desktop"; |
475 | + waitForRendering(shell); |
476 | + tryCompare(PanelState, "buttonsVisible", true); |
477 | + } |
478 | } |
479 | } |
It should conflict BIG TIME with mousePointer as it changes the resize area as well