on xenial help sign in
update WindowResizeArea tests
commit44b87ddc744b59adb7af654a2c345aedc0f9b2f2 authorMichael Zanetti <michael.zanetti@canonical.com> dateThu 23 Jun 2016, 16:02 (10 years ago) parent08dda84
1 file changed+36−34
tests/qmltests/Stages/tst_WindowResizeArea.qml+36−34
tests/qmltests/Stages/tst_WindowResizeArea.qml+36−34
@@ -44,8 +44,10 @@ Item {
4444 id: fakeWindow
4545 property alias resizeAreaMinWidth: windowResizeArea.minWidth
4646 property alias resizeAreaMinHeight: windowResizeArea.minHeight
47− x: units.gu(20)
48− y: units.gu(20)
47+ x: requestedX
48+ y: requestedY
49+ property real requestedX: units.gu(20)
50+ property real requestedY: units.gu(20)
4951 width: requestedWidth
5052 height: requestedHeight
5153 property real requestedWidth
@@ -226,8 +228,8 @@ Item {
226228 property var fakeWindow: windowLoader.item
227229
228230 function init() {
229− fakeWindow.x = units.gu(20)
230− fakeWindow.y = units.gu(20)
231+ fakeWindow.requestedX = units.gu(20)
232+ fakeWindow.requestedY = units.gu(20)
231233 fakeWindow.requestedWidth = units.gu(20)
232234 fakeWindow.requestedHeight = units.gu(20)
233235 fakeWindow.resizeAreaMinWidth = units.gu(15);
@@ -254,8 +256,8 @@ Item {
254256 }
255257
256258 function test_resizeWindowRightBottom(data) {
257− var initialWindowX = fakeWindow.x;
258− var initialWindowY = fakeWindow.y;
259+ var initialWindowX = fakeWindow.requestedX;
260+ var initialWindowY = fakeWindow.requestedY;
259261 var initialWindowWidth = fakeWindow.width
260262 var initialWindowHeight = fakeWindow.height
261263
@@ -266,8 +268,8 @@ Item {
266268 tryCompare(fakeWindow, "width", Math.max(initialWindowWidth + data.dx, fakeWindow.resizeAreaMinWidth));
267269 tryCompare(fakeWindow, "height", Math.max(initialWindowHeight + data.dy, fakeWindow.resizeAreaMinHeight));
268270
269− compare(fakeWindow.x, initialWindowX);
270− compare(fakeWindow.y, initialWindowY);
271+ compare(fakeWindow.requestedX, initialWindowX);
272+ compare(fakeWindow.requestedY, initialWindowY);
271273 }
272274
273275 function test_resizeWindowLeftTop_data() {
@@ -280,8 +282,8 @@ Item {
280282 }
281283
282284 function test_resizeWindowLeftTop(data) {
283− var initialWindowX = fakeWindow.x;
284− var initialWindowY = fakeWindow.y;
285+ var initialWindowX = fakeWindow.requestedX;
286+ var initialWindowY = fakeWindow.requestedY;
285287 var initialWindowWidth = fakeWindow.width
286288 var initialWindowHeight = fakeWindow.height
287289
@@ -294,13 +296,13 @@ Item {
294296
295297 var maxMoveX = initialWindowWidth - fakeWindow.resizeAreaMinWidth;
296298 var maxMoveY = initialWindowHeight - fakeWindow.resizeAreaMinHeight;
297− compare(fakeWindow.x, Math.min(initialWindowX + data.dx, initialWindowX + maxMoveX));
298− compare(fakeWindow.y, Math.min(initialWindowY + data.dy, initialWindowY + maxMoveY));
299+ compare(fakeWindow.requestedX, Math.min(initialWindowX + data.dx, initialWindowX + maxMoveX));
300+ compare(fakeWindow.requestedY, Math.min(initialWindowY + data.dy, initialWindowY + maxMoveY));
299301 }
300302
301303 function test_saveRestoreSize() {
302− var initialWindowX = fakeWindow.x;
303− var initialWindowY = fakeWindow.y;
304+ var initialWindowX = fakeWindow.requestedX;
305+ var initialWindowY = fakeWindow.requestedY;
304306 var initialWindowWidth = fakeWindow.width
305307 var initialWindowHeight = fakeWindow.height
306308
@@ -332,8 +334,8 @@ Item {
332334 }
333335
334336 function test_resizeSmallerAndLarger(data) {
335− var initialWindowX = fakeWindow.x;
336− var initialWindowY = fakeWindow.y;
337+ var initialWindowX = fakeWindow.requestedX;
338+ var initialWindowY = fakeWindow.requestedY;
337339 var initialWindowWidth = fakeWindow.width
338340 var initialWindowHeight = fakeWindow.height
339341
@@ -348,18 +350,18 @@ Item {
348350 }
349351
350352 function test_saveRestoreMaximized() {
351− var initialWindowX = fakeWindow.x;
352− var initialWindowY = fakeWindow.y;
353+ var initialWindowX = fakeWindow.requestedX;
354+ var initialWindowY = fakeWindow.requestedY;
353355
354356 var moveDelta = units.gu(5);
355357
356− fakeWindow.x = initialWindowX + moveDelta
357− fakeWindow.y = initialWindowY + moveDelta
358+ fakeWindow.requestedX = initialWindowX + moveDelta
359+ fakeWindow.requestedY = initialWindowY + moveDelta
358360
359361 // Now change the state to maximized. The window should not keep updating the stored values
360362 fakeWindow.maximize()
361− fakeWindow.x = 31415 // 0 is too risky to pass the test even when broken
362− fakeWindow.y = 31415
363+ fakeWindow.requestedX = 31415 // 0 is too risky to pass the test even when broken
364+ fakeWindow.requestedY = 31415
363365
364366 // This will destroy the window and recreate it
365367 windowLoader.active = false;
@@ -389,8 +391,8 @@ Item {
389391 }
390392
391393 function test_restoreMovesIntoBounds(data) {
392− fakeWindow.x = data.x;
393− fakeWindow.y = data.y;
394+ fakeWindow.requestedX = data.x;
395+ fakeWindow.requestedY = data.y;
394396 fakeWindow.width = data.w;
395397 fakeWindow.height = data.h;
396398 waitForRendering(root);
@@ -402,10 +404,10 @@ Item {
402404 waitForRendering(root)
403405
404406 // Make sure it's again where we left it in normal state before destroying
405− compare(fakeWindow.x >= 0, true)
406− compare(fakeWindow.y >= PanelState.panelHeight, true)
407− compare(fakeWindow.x + fakeWindow.width <= root.width, true)
408− compare(fakeWindow.y + fakeWindow.height <= root.height, true)
407+ compare(fakeWindow.requestedX >= 0, true)
408+ compare(fakeWindow.requestedY >= PanelState.panelHeight, true)
409+ compare(fakeWindow.requestedX + fakeWindow.width <= root.width, true)
410+ compare(fakeWindow.requestedY + fakeWindow.height <= root.height, true)
409411
410412 waitForRendering(root)
411413 }
@@ -417,8 +419,8 @@ Item {
417419 and height) increment value.
418420 */
419421 function test_sizeIncrement() {
420− var initialWindowX = fakeWindow.x;
421− var initialWindowY = fakeWindow.y;
422+ var initialWindowX = fakeWindow.requestedX;
423+ var initialWindowY = fakeWindow.requestedY;
422424 var initialWindowWidth = fakeWindow.width
423425 var initialWindowHeight = fakeWindow.height
424426
@@ -448,8 +450,8 @@ Item {
448450 Tests that when dragging a window border you cannot make it bigger than its maximum size
449451 */
450452 function test_maximumSize() {
451− fakeWindow.x = units.gu(1);
452− fakeWindow.y = units.gu(1);
453+ fakeWindow.requestedX = units.gu(1);
454+ fakeWindow.requestedY = units.gu(1);
453455 fakeWindow.resizeAreaMinWidth = 1; // so it does not interfere with anything
454456 fakeWindow.resizeAreaMinHeight = 1; // so it does not interfere with anything
455457 fakeWindow.requestedWidth = units.gu(10);
@@ -478,8 +480,8 @@ Item {
478480 Tests that when dragging a window border you cannot make it smaller than its minimum size
479481 */
480482 function test_minimumSize() {
481− fakeWindow.x = units.gu(1);
482− fakeWindow.y = units.gu(1);
483+ fakeWindow.requestedX = units.gu(1);
484+ fakeWindow.requestedY = units.gu(1);
483485 fakeWindow.resizeAreaMinWidth = 1; // so it does not interfere with anything
484486 fakeWindow.resizeAreaMinHeight = 1; // so it does not interfere with anything
485487 fakeWindow.requestedWidth = units.gu(20);