tests: add test for kwin shortucts for moving windows to adjacent desktops
This commit is contained in:
10
src/tests/flows/followWindowToDesktop.ts
Normal file
10
src/tests/flows/followWindowToDesktop.ts
Normal file
@@ -0,0 +1,10 @@
|
||||
tests.register("Move and follow window to desktop", 20, () => {
|
||||
// This tests the Kwin shortcuts for moving windows to adjacent desktops.
|
||||
|
||||
const config = getDefaultConfig();
|
||||
const { qtMock, workspaceMock, world } = init(config);
|
||||
|
||||
const [client0, client1] = workspaceMock.createClients(2);
|
||||
client1.moveAndFollowToDesktop(workspaceMock.desktops[1], workspaceMock);
|
||||
Assert.equal(workspaceMock.activeWindow, client1);
|
||||
});
|
||||
@@ -201,6 +201,13 @@ class MockKwinClient {
|
||||
};
|
||||
}
|
||||
|
||||
public moveAndFollowToDesktop(desktop: KwinDesktop, workspaceMock: MockWorkspace) {
|
||||
Assert.assert(workspaceMock.activeWindow === this);
|
||||
this._desktops = [desktop];
|
||||
this.desktopsChanged.fire();
|
||||
workspaceMock.currentDesktop = desktop;
|
||||
}
|
||||
|
||||
public get tile() {
|
||||
return this._tile;
|
||||
}
|
||||
|
||||
@@ -6,12 +6,12 @@ class MockWorkspace {
|
||||
{ __brand: "KwinDesktop", id: "desktop1" },
|
||||
{ __brand: "KwinDesktop", id: "desktop2" },
|
||||
];
|
||||
public currentDesktop = this.desktops[0];
|
||||
public currentActivity = this.activities[0];
|
||||
public activeScreen: Output = { __brand: "Output" };
|
||||
public readonly windows: MockKwinClient[] = [];
|
||||
public cursorPos = new MockQmlPoint(0, 0);
|
||||
|
||||
private _currentDesktop = this.desktops[0];
|
||||
private _activeWindow: KwinClient|null = null;
|
||||
|
||||
public readonly currentDesktopChanged = new MockQSignal<[]>();
|
||||
@@ -126,6 +126,15 @@ class MockWorkspace {
|
||||
window.interactiveMoveResizeFinished.fire();
|
||||
}
|
||||
|
||||
public get currentDesktop() {
|
||||
return this._currentDesktop;
|
||||
}
|
||||
|
||||
public set currentDesktop(currentDesktop: KwinDesktop) {
|
||||
this._currentDesktop = currentDesktop;
|
||||
this.currentDesktopChanged.fire();
|
||||
}
|
||||
|
||||
public get activeWindow() {
|
||||
return this._activeWindow;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user