@@ -44,8 +44,11 @@ Item {
44 width: units.gu(20)
44 width: units.gu(20)
45 property int windowHeight: height
45 property int windowHeight: height
46 property int windowWidth: width
46 property int windowWidth: width
47− onWindowHeightChanged: height = windowHeight
47+ state: "normal"
48− onWindowWidthChanged: width = windowWidth
48+
49+ function maximize() {
50 WindowResizeArea {
53 WindowResizeArea {
51 id: windowResizeArea
54 id: windowResizeArea
@@ -214,5 +217,35 @@ Item {
214 tryCompare(fakeWindow, "width", initialWindowWidth);
217 tryCompare(fakeWindow, "width", initialWindowWidth);
215 tryCompare(fakeWindow, "height", initialWindowHeight);
218 tryCompare(fakeWindow, "height", initialWindowHeight);
221+ function test_saveRestoreMaximized() {
222+ var initialWindowX = fakeWindow.x;
223+ var initialWindowY = fakeWindow.y;
225+ var moveDelta = units.gu(5);
227+ fakeWindow.x = initialWindowX + moveDelta
228+ fakeWindow.y = initialWindowY + moveDelta
230+ // Now change the state to maximized. The window should not keep updating the stored values
231+ fakeWindow.state = "maximized"
232+ fakeWindow.x = 31415 // 0 is too risky to pass the test even when broken
233+ fakeWindow.y = 31415
235+ // This will destroy the window and recreate it
236+ windowLoader.active = false;
237+ waitForRendering(root);
238+ windowLoader.active = true;
240+ // Make sure it's again where we left it in normal state before destroying
241+ tryCompare(fakeWindow, "x", initialWindowX + moveDelta)
242+ tryCompare(fakeWindow, "y", initialWindowX + moveDelta)
244+ // Make sure maximize() has been called after restoring
245+ tryCompare(fakeWindow, "state", "maximized")
248+ fakeWindow.state = "normal"