tests: fix tests that were using screen.width/2

This commit is contained in:
Peter Fajdiga
2025-03-08 19:41:14 +01:00
parent 75a548977c
commit 47213a71f5
4 changed files with 7 additions and 7 deletions

View File

@@ -8,7 +8,7 @@ tests.register("External resize", 1, () => {
function getTiledFrame(width: number) {
return new MockQmlRect(
Math.round((screen.width - width) / 2),
tilingArea.left + Math.round((tilingArea.width - width) / 2),
tilingArea.top,
width,
tilingArea.height,

View File

@@ -7,7 +7,7 @@ tests.register("Maximization", 100, () => {
Assert.assert(clientManager.hasClient(kwinClient));
});
const columnLeftX = screen.width/2 - 300/2;
const columnLeftX = tilingArea.left + tilingArea.width/2 - 300/2;
const columnTopY = tilingArea.top;
const columnHeight = tilingArea.height;
Assert.rect(kwinClient.frameGeometry, columnLeftX, columnTopY, 300, columnHeight);
@@ -66,7 +66,7 @@ tests.register("Re-maximize disabled", 100, () => {
});
const columnsWidth = 300 + 400 + config.gapsInnerHorizontal;
const column1LeftX = screen.width/2 - columnsWidth/2;
const column1LeftX = tilingArea.left + tilingArea.width/2 - columnsWidth/2;
const column2LeftX = column1LeftX + 300 + config.gapsInnerHorizontal;
const columnTopY = tilingArea.top;
const columnHeight = tilingArea.height;
@@ -111,7 +111,7 @@ tests.register("Re-maximize enabled", 100, () => {
});
const columnsWidth = 300 + 400 + config.gapsInnerHorizontal;
const column1LeftX = screen.width/2 - columnsWidth/2;
const column1LeftX = tilingArea.left + tilingArea.width/2 - columnsWidth/2;
const column2LeftX = column1LeftX + 300 + config.gapsInnerHorizontal;
const columnTopY = tilingArea.top;
const columnHeight = tilingArea.height;

View File

@@ -7,7 +7,7 @@ tests.register("Preset Widths default", 1, () => {
function getRect(columnWidth: number) {
return new MockQmlRect(
(screen.width - columnWidth) / 2,
tilingArea.left + (tilingArea.width - columnWidth) / 2,
tilingArea.top,
columnWidth,
tilingArea.height,
@@ -43,7 +43,7 @@ tests.register("Preset Widths custom", 1, () => {
function getRect(columnWidth: number) {
return new MockQmlRect(
(screen.width - columnWidth) / 2,
tilingArea.left + (tilingArea.width - columnWidth) / 2,
tilingArea.top,
columnWidth,
tilingArea.height,

View File

@@ -35,7 +35,7 @@ function init(config: Config) {
function getGridBounds(clientLeft: KwinClient, clientRight: KwinClient) {
const columnsWidth = clientRight.frameGeometry.right - clientLeft.frameGeometry.left;
const left = Math.floor((screen.width - columnsWidth) / 2);
const left = tilingArea.left + Math.floor((tilingArea.width - columnsWidth) / 2);
const right = left + columnsWidth;
return { left, right };
}