From e95378c0ddc69e433491e6d61322e806ce963b72 Mon Sep 17 00:00:00 2001 From: Peter Fajdiga Date: Sat, 5 Oct 2024 14:10:08 +0200 Subject: [PATCH] tests: add external resize test --- src/tests/flows/externalResize.ts | 33 +++++++++++++++++++++++++++++++ 1 file changed, 33 insertions(+) create mode 100644 src/tests/flows/externalResize.ts diff --git a/src/tests/flows/externalResize.ts b/src/tests/flows/externalResize.ts new file mode 100644 index 0000000..4d4e46f --- /dev/null +++ b/src/tests/flows/externalResize.ts @@ -0,0 +1,33 @@ +tests.register("External resize", 1, () => { + const config = getDefaultConfig(); + const { qtMock, workspaceMock, world } = init(config); + + function getClientDesiredFrame(width: number) { + return new MockQmlRect(10, 10, width, 200); + } + + function getTiledFrame(width: number) { + return new MockQmlRect( + Math.round((screen.width - width) / 2), + tilingArea.top, + width, + tilingArea.height, + ); + } + + const client = new MockKwinClient( + 1, + "app1", + "Application 1", + getClientDesiredFrame(100), + ); + + workspaceMock.createWindow(client); + Assert.equalRects(client.frameGeometry, getTiledFrame(100), { message: "We should tile the window, respecting its desired width" }); + + client.frameGeometry = getClientDesiredFrame(110); + Assert.equalRects(client.frameGeometry, getTiledFrame(110), { message: "We should re-arrange the window, respecting its new desired width" }); + + client.frameGeometry = getClientDesiredFrame(120); + Assert.equalRects(client.frameGeometry, getClientDesiredFrame(120), { message: "We should give up and let the client have its desired frame" }); +});