@@ -1,5 +1,5 @@
11/*
2− * Copyright 2014-2015 Canonical Ltd.
2+ * Copyright 2014-2016 Canonical Ltd.
33 *
44 * This program is free software; you can redistribute it and/or modify
55 * it under the terms of the GNU General Public License as published by
@@ -24,6 +24,7 @@ import "../../../qml/Stages"
2424import Ubuntu.Components 1.3
2525import Ubuntu.Components.ListItems 1.3 as ListItem
2626import Unity.Application 0.1
27+import Utils 0.1
2728
2829Item {
2930 id: root
@@ -55,10 +56,20 @@ Item {
5556 property real maximumHeight: 0
5657 property real widthIncrement: 0
5758 property real heightIncrement: 0
58− state: "normal"
59+
60+ property int windowState: WindowStateStorage.WindowStateNormal
61+
62+ states: [
63+ State { name: "normal"; when: windowState == WindowStateStorage.WindowStateNormal },
64+ State { name: "maximized"; when: windowState == WindowStateStorage.WindowStateMaximized }
65+ ]
5966
6067 function maximize() {
61− state = "maximized"
68+ windowState = WindowStateStorage.WindowStateMaximized
69+ }
70+
71+ function restoreFromMaximized() {
72+ windowState = WindowStateStorage.WindowStateNormal
6273 }
6374
6475 WindowResizeArea {
@@ -346,7 +357,7 @@ Item {
346357 fakeWindow.y = initialWindowY + moveDelta
347358
348359 // Now change the state to maximized. The window should not keep updating the stored values
349− fakeWindow.state = "maximized"
360+ fakeWindow.maximize()
350361 fakeWindow.x = 31415 // 0 is too risky to pass the test even when broken
351362 fakeWindow.y = 31415
352363
@@ -363,7 +374,7 @@ Item {
363374 tryCompare(fakeWindow, "state", "maximized")
364375
365376 // clean up
366− fakeWindow.state = "normal"
377+ fakeWindow.restoreFromMaximized()
367378 }
368379
369380 function test_restoreMovesIntoBounds_data() {