tests: handle setMaximize

This commit is contained in:
Peter Fajdiga
2024-09-16 00:09:19 +02:00
parent da6b983e4a
commit cb1b70d4f0
2 changed files with 29 additions and 2 deletions

View File

@@ -6,7 +6,7 @@
1,
"app1",
"Application 1",
new MockQmlRect(0, 0, 200, 200),
new MockQmlRect(0, 0, 300, 200),
);
workspaceMock.createWindow(kwinClient);
@@ -23,6 +23,24 @@
kwinClient.fullScreen = false;
{
const frame = kwinClient.frameGeometry;
assert(frame.width === 200 && frame.height === 200);
assert(frame.width === 300 && frame.height === 200);
}
kwinClient.setMaximize(true, true);
{
const frame = kwinClient.frameGeometry;
assert(frame.width === screenWidth && frame.height === screenHeight);
}
kwinClient.setMaximize(true, false);
{
const frame = kwinClient.frameGeometry;
assert(frame.width === 300 && frame.height === screenHeight);
}
kwinClient.setMaximize(false, false);
{
const frame = kwinClient.frameGeometry;
assert(frame.width === 300 && frame.height === 200);
}
}

View File

@@ -52,6 +52,8 @@ class MockKwinClient {
}
setMaximize(vertically: boolean, horizontally: boolean) {
this.windowed = !(vertically || horizontally);
this.maximizedAboutToChange.fire(
vertically ? (
horizontally ? MaximizedMode.Maximized : MaximizedMode.Vertically
@@ -59,6 +61,13 @@ class MockKwinClient {
horizontally ? MaximizedMode.Horizontally : MaximizedMode.Unmaximized
)
);
this.frameGeometry = new MockQmlRect(
horizontally ? 0 : this.windowedFrameGeometry.x,
vertically ? 0 : this.windowedFrameGeometry.y,
horizontally ? screenWidth : this.windowedFrameGeometry.width,
vertically ? screenHeight : this.windowedFrameGeometry.height,
);
}
public get clientGeometry() {