@@ -1,5 +1,5 @@
2− * Copyright 2014-2015 Canonical Ltd.
2+ * Copyright 2014-2016 Canonical Ltd.
4 * This program is free software; you can redistribute it and/or modify
4 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License as published by
5 * it under the terms of the GNU General Public License as published by
@@ -24,6 +24,7 @@ import "../../../qml/Stages"
24import Ubuntu.Components 1.3
24import Ubuntu.Components 1.3
25import Ubuntu.Components.ListItems 1.3 as ListItem
25import Ubuntu.Components.ListItems 1.3 as ListItem
26import Unity.Application 0.1
26import Unity.Application 0.1
@@ -55,10 +56,20 @@ Item {
55 property real maximumHeight: 0
56 property real maximumHeight: 0
56 property real widthIncrement: 0
57 property real widthIncrement: 0
57 property real heightIncrement: 0
58 property real heightIncrement: 0
60+ property int windowState: WindowStateStorage.WindowStateNormal
63+ State { name: "normal"; when: windowState == WindowStateStorage.WindowStateNormal },
64+ State { name: "maximized"; when: windowState == WindowStateStorage.WindowStateMaximized }
60 function maximize() {
67 function maximize() {
61− state = "maximized"
68+ windowState = WindowStateStorage.WindowStateMaximized
71+ function restoreFromMaximized() {
72+ windowState = WindowStateStorage.WindowStateNormal
64 WindowResizeArea {
75 WindowResizeArea {
@@ -346,7 +357,7 @@ Item {
346 fakeWindow.y = initialWindowY + moveDelta
357 fakeWindow.y = initialWindowY + moveDelta
348 // Now change the state to maximized. The window should not keep updating the stored values
359 // Now change the state to maximized. The window should not keep updating the stored values
349− fakeWindow.state = "maximized"
360+ fakeWindow.maximize()
350 fakeWindow.x = 31415 // 0 is too risky to pass the test even when broken
361 fakeWindow.x = 31415 // 0 is too risky to pass the test even when broken
351 fakeWindow.y = 31415
362 fakeWindow.y = 31415
@@ -363,7 +374,7 @@ Item {
363 tryCompare(fakeWindow, "state", "maximized")
374 tryCompare(fakeWindow, "state", "maximized")
365 // clean up
376 // clean up
366− fakeWindow.state = "normal"
377+ fakeWindow.restoreFromMaximized()
369 function test_restoreMovesIntoBounds_data() {
380 function test_restoreMovesIntoBounds_data() {