feat(e2e): sync the neutral core from kfde 6b6b7bb5

The recorded kfw and kfde states are now fixtures read by test_recorded.py,
and the sync script copies them. The only change inside komorebi_vm.core is a
diagnostic print in the workspaces scenario. From kfde change vvplllnz.
This commit is contained in:
LGUG2Z committed 2026-10-30 18:22:44 -07:00
1 parent 5ea4057ec5
commit b34b02814f
8 files changed
+935 -3

No files matched your search

@@ -39,6 +39,8 @@ def run(platform: Platform, checks: Checks, clients: list[Client]) -> None:
)
platform.komorebic("focus-workspace", "1")
platform.wait_for(lambda: _in_view(platform, clients) == [last.title])
print(f" in view after the switch: {_in_view(platform, clients)}")
checks.check(
"after 'focus-workspace 1' only the window sent there is in view",
platform.wait_for(lambda: _in_view(platform, clients) == [last.title]),
+164
View File
@@ -0,0 +1,164 @@
{
"monitors": {
"elements": [
{
"id": 1230296105,
"device": "Virtual-0",
"serial_number_id": "Virtual-0",
"workspaces": {
"elements": [
{
"name": null,
"containers": {
"elements": [
{
"id": "maAEzGA_0nRWS6PpcDLlI",
"locked": false,
"windows": {
"elements": [
{
"id": 4,
"rect": {
"left": 20,
"top": 20,
"right": 925,
"bottom": 1040
},
"details": {
"title": "neutral1",
"exe": "foot",
"class": "foot",
"path": "/nix/store/0gkg75w7bmwd7klmf23qy8m697abypvc-foot-1.28.0/bin/foot"
}
},
{
"id": 6,
"rect": {
"left": 20,
"top": 20,
"right": 924,
"bottom": 1037
},
"details": {
"title": "neutral3",
"exe": "foot",
"class": "foot",
"path": "/nix/store/0gkg75w7bmwd7klmf23qy8m697abypvc-foot-1.28.0/bin/foot"
}
}
],
"focused": 1
}
},
{
"id": "z2cN_l7IEJBa53ymxMgvA",
"locked": false,
"windows": {
"elements": [
{
"id": 5,
"rect": {
"left": 975,
"top": 20,
"right": 924,
"bottom": 1037
},
"details": {
"title": "neutral2",
"exe": "foot",
"class": "foot",
"path": "/nix/store/0gkg75w7bmwd7klmf23qy8m697abypvc-foot-1.28.0/bin/foot"
}
}
],
"focused": 0
}
}
],
"focused": 0
},
"monocle_container": null,
"maximized_window": null,
"floating_windows": {
"elements": [],
"focused": 0
},
"layout": {
"Default": "BSP"
},
"layout_options": null,
"layout_rules": [],
"layout_options_rules": [],
"layout_flip": null,
"workspace_padding": null,
"container_padding": null,
"latest_layout": [
{
"left": 20,
"top": 20,
"right": 925,
"bottom": 1040
},
{
"left": 975,
"top": 20,
"right": 925,
"bottom": 1040
}
],
"resize_dimensions": [
null,
null
],
"tile": true,
"work_area_offset": null,
"work_area_offset_rules": [],
"apply_window_based_work_area_offset": true,
"window_container_behaviour": null,
"window_container_behaviour_rules": null,
"float_override": null,
"layer": "Tiling",
"floating_layer_behaviour": null,
"wallpaper": null
}
],
"focused": 0
},
"size": {
"left": 0,
"top": 0,
"right": 1920,
"bottom": 1080
},
"work_area_offset": null,
"work_area_size": {
"left": 0,
"top": 0,
"right": 1920,
"bottom": 1080
},
"window_based_work_area_offset": null,
"window_based_work_area_offset_limit": 1,
"container_padding": null,
"workspace_padding": null,
"last_focused_workspace": 0,
"wallpaper": null,
"floating_layer_behaviour": null
}
],
"focused": 0
},
"monitor_usr_idx_map": {
"0": 0
},
"is_paused": false,
"resize_delta": 50,
"new_window_behaviour": "Create",
"float_override": false,
"cross_monitor_move_behaviour": "Swap",
"monocle_focus_behaviour": "NoOp",
"unmanaged_window_operation_behaviour": "Op",
"work_area_offset": null,
"focus_follows_mouse": null,
"mouse_follows_focus": true
}
+180
View File
@@ -0,0 +1,180 @@
{
"monitors": {
"elements": [
{
"id": 1230296105,
"device": "Virtual-0",
"serial_number_id": "Virtual-0",
"workspaces": {
"elements": [
{
"name": null,
"containers": {
"elements": [
{
"id": "maAEzGA_0nRWS6PpcDLlI",
"locked": false,
"windows": {
"elements": [
{
"id": 4,
"rect": {
"left": 20,
"top": 20,
"right": 925,
"bottom": 1040
},
"details": {
"title": "neutral1",
"exe": "foot",
"class": "foot",
"path": "/nix/store/0gkg75w7bmwd7klmf23qy8m697abypvc-foot-1.28.0/bin/foot"
}
}
],
"focused": 0
}
},
{
"id": "f63LOWKm57v9SDinvNb_K",
"locked": false,
"windows": {
"elements": [
{
"id": 6,
"rect": {
"left": 975,
"top": 20,
"right": 924,
"bottom": 504
},
"details": {
"title": "neutral3",
"exe": "foot",
"class": "foot",
"path": "/nix/store/0gkg75w7bmwd7klmf23qy8m697abypvc-foot-1.28.0/bin/foot"
}
}
],
"focused": 0
}
},
{
"id": "z2cN_l7IEJBa53ymxMgvA",
"locked": false,
"windows": {
"elements": [
{
"id": 5,
"rect": {
"left": 975,
"top": 555,
"right": 924,
"bottom": 504
},
"details": {
"title": "neutral2",
"exe": "foot",
"class": "foot",
"path": "/nix/store/0gkg75w7bmwd7klmf23qy8m697abypvc-foot-1.28.0/bin/foot"
}
}
],
"focused": 0
}
}
],
"focused": 1
},
"monocle_container": null,
"maximized_window": null,
"floating_windows": {
"elements": [],
"focused": 0
},
"layout": {
"Default": "BSP"
},
"layout_options": null,
"layout_rules": [],
"layout_options_rules": [],
"layout_flip": null,
"workspace_padding": null,
"container_padding": null,
"latest_layout": [
{
"left": 20,
"top": 20,
"right": 925,
"bottom": 1040
},
{
"left": 975,
"top": 20,
"right": 925,
"bottom": 505
},
{
"left": 975,
"top": 555,
"right": 925,
"bottom": 505
}
],
"resize_dimensions": [
null,
null,
null
],
"tile": true,
"work_area_offset": null,
"work_area_offset_rules": [],
"apply_window_based_work_area_offset": true,
"window_container_behaviour": null,
"window_container_behaviour_rules": null,
"float_override": null,
"layer": "Tiling",
"floating_layer_behaviour": null,
"wallpaper": null
}
],
"focused": 0
},
"size": {
"left": 0,
"top": 0,
"right": 1920,
"bottom": 1080
},
"work_area_offset": null,
"work_area_size": {
"left": 0,
"top": 0,
"right": 1920,
"bottom": 1080
},
"window_based_work_area_offset": null,
"window_based_work_area_offset_limit": 1,
"container_padding": null,
"workspace_padding": null,
"last_focused_workspace": 0,
"wallpaper": null,
"floating_layer_behaviour": null
}
],
"focused": 0
},
"monitor_usr_idx_map": {
"0": 0
},
"is_paused": false,
"resize_delta": 50,
"new_window_behaviour": "Create",
"float_override": false,
"cross_monitor_move_behaviour": "Swap",
"monocle_focus_behaviour": "NoOp",
"unmanaged_window_operation_behaviour": "Op",
"work_area_offset": null,
"focus_follows_mouse": null,
"mouse_follows_focus": true
}
+160
View File
@@ -0,0 +1,160 @@
{
"monitors": {
"elements": [
{
"id": 65537,
"name": "DISPLAY1",
"device": "Default_Monitor",
"device_id": "Default_Monitor-4&183790ca&0&UID0",
"serial_number_id": null,
"size": {
"left": 0,
"top": 0,
"right": 1280,
"bottom": 800
},
"work_area_size": {
"left": 0,
"top": 0,
"right": 1280,
"bottom": 752
},
"work_area_offset": null,
"window_based_work_area_offset": null,
"window_based_work_area_offset_limit": 1,
"workspaces": {
"elements": [
{
"name": null,
"containers": {
"elements": [
{
"id": "lHDkMLvTxsJGQfBTiKnkt",
"locked": false,
"windows": {
"elements": [
{
"hwnd": 262540,
"title": "win1",
"exe": "komorebi-testwin.exe",
"class": "KomorebiTestWin",
"rect": {
"left": 27,
"top": 27,
"right": 596,
"bottom": 698
}
}
],
"focused": 0
}
},
{
"id": "Zqsuvee3D_fegP33OgBnq",
"locked": false,
"windows": {
"elements": [
{
"hwnd": 131234,
"title": "win2",
"exe": "komorebi-testwin.exe",
"class": "KomorebiTestWin",
"rect": {
"left": 657,
"top": 27,
"right": 596,
"bottom": 698
}
}
],
"focused": 0
}
}
],
"focused": 0
},
"monocle_container": null,
"maximized_window": null,
"floating_windows": {
"elements": [
{
"hwnd": 327778,
"title": "win3",
"exe": "komorebi-testwin.exe",
"class": "KomorebiTestWin",
"rect": {
"left": 27,
"top": 27,
"right": 596,
"bottom": 698
}
}
],
"focused": 0
},
"layout": {
"Default": "BSP"
},
"layout_options": null,
"layout_rules": [],
"layout_options_rules": [],
"work_area_offset_rules": [],
"layout_flip": null,
"workspace_padding": 10,
"container_padding": 10,
"latest_layout": [
{
"left": 27,
"top": 27,
"right": 596,
"bottom": 698
},
{
"left": 657,
"top": 27,
"right": 596,
"bottom": 698
}
],
"resize_dimensions": [
null,
null
],
"tile": true,
"work_area_offset": null,
"apply_window_based_work_area_offset": true,
"window_container_behaviour": null,
"window_container_behaviour_rules": null,
"float_override": null,
"layer": "Floating",
"floating_layer_behaviour": null,
"wallpaper": null
}
],
"focused": 0
},
"workspace_names": {},
"container_padding": null,
"workspace_padding": null,
"wallpaper": null,
"floating_layer_behaviour": null
}
],
"focused": 0
},
"monitor_usr_idx_map": {
"0": 0
},
"is_paused": false,
"resize_delta": 50,
"new_window_behaviour": "Create",
"float_override": false,
"cross_monitor_move_behaviour": "Swap",
"monocle_focus_behaviour": "NoOp",
"unmanaged_window_operation_behaviour": "Op",
"work_area_offset": null,
"focus_follows_mouse": null,
"mouse_follows_focus": true,
"has_pending_raise_op": false,
"virtual_desktop_id": null
}
+159
View File
@@ -0,0 +1,159 @@
{
"monitors": {
"elements": [
{
"id": 65537,
"name": "DISPLAY1",
"device": "Default_Monitor",
"device_id": "Default_Monitor-4&183790ca&0&UID0",
"serial_number_id": null,
"size": {
"left": 0,
"top": 0,
"right": 1280,
"bottom": 800
},
"work_area_size": {
"left": 0,
"top": 0,
"right": 1280,
"bottom": 752
},
"work_area_offset": null,
"window_based_work_area_offset": null,
"window_based_work_area_offset_limit": 1,
"workspaces": {
"elements": [
{
"name": null,
"containers": {
"elements": [
{
"id": "lHDkMLvTxsJGQfBTiKnkt",
"locked": false,
"windows": {
"elements": [
{
"hwnd": 262540,
"title": "win1",
"exe": "komorebi-testwin.exe",
"class": "KomorebiTestWin",
"rect": {
"left": 27,
"top": 27,
"right": 596,
"bottom": 698
}
},
{
"hwnd": 327778,
"title": "win3",
"exe": "komorebi-testwin.exe",
"class": "KomorebiTestWin",
"rect": {
"left": 27,
"top": 27,
"right": 596,
"bottom": 698
}
}
],
"focused": 1
}
},
{
"id": "Zqsuvee3D_fegP33OgBnq",
"locked": false,
"windows": {
"elements": [
{
"hwnd": 131234,
"title": "win2",
"exe": "komorebi-testwin.exe",
"class": "KomorebiTestWin",
"rect": {
"left": 657,
"top": 27,
"right": 596,
"bottom": 698
}
}
],
"focused": 0
}
}
],
"focused": 0
},
"monocle_container": null,
"maximized_window": null,
"floating_windows": {
"elements": [],
"focused": 0
},
"layout": {
"Default": "BSP"
},
"layout_options": null,
"layout_rules": [],
"layout_options_rules": [],
"work_area_offset_rules": [],
"layout_flip": null,
"workspace_padding": 10,
"container_padding": 10,
"latest_layout": [
{
"left": 27,
"top": 27,
"right": 596,
"bottom": 698
},
{
"left": 657,
"top": 27,
"right": 596,
"bottom": 698
}
],
"resize_dimensions": [
null,
null
],
"tile": true,
"work_area_offset": null,
"apply_window_based_work_area_offset": true,
"window_container_behaviour": null,
"window_container_behaviour_rules": null,
"float_override": null,
"layer": "Tiling",
"floating_layer_behaviour": null,
"wallpaper": null
}
],
"focused": 0
},
"workspace_names": {},
"container_padding": null,
"workspace_padding": null,
"wallpaper": null,
"floating_layer_behaviour": null
}
],
"focused": 0
},
"monitor_usr_idx_map": {
"0": 0
},
"is_paused": false,
"resize_delta": 50,
"new_window_behaviour": "Create",
"float_override": false,
"cross_monitor_move_behaviour": "Swap",
"monocle_focus_behaviour": "NoOp",
"unmanaged_window_operation_behaviour": "Op",
"work_area_offset": null,
"focus_follows_mouse": null,
"mouse_follows_focus": true,
"has_pending_raise_op": false,
"virtual_desktop_id": null
}
+175
View File
@@ -0,0 +1,175 @@
{
"monitors": {
"elements": [
{
"id": 65537,
"name": "DISPLAY1",
"device": "Default_Monitor",
"device_id": "Default_Monitor-4&183790ca&0&UID0",
"serial_number_id": null,
"size": {
"left": 0,
"top": 0,
"right": 1280,
"bottom": 800
},
"work_area_size": {
"left": 0,
"top": 0,
"right": 1280,
"bottom": 752
},
"work_area_offset": null,
"window_based_work_area_offset": null,
"window_based_work_area_offset_limit": 1,
"workspaces": {
"elements": [
{
"name": null,
"containers": {
"elements": [
{
"id": "lHDkMLvTxsJGQfBTiKnkt",
"locked": false,
"windows": {
"elements": [
{
"hwnd": 262540,
"title": "win1",
"exe": "komorebi-testwin.exe",
"class": "KomorebiTestWin",
"rect": {
"left": 27,
"top": 27,
"right": 596,
"bottom": 698
}
}
],
"focused": 0
}
},
{
"id": "Zqsuvee3D_fegP33OgBnq",
"locked": false,
"windows": {
"elements": [
{
"hwnd": 131234,
"title": "win2",
"exe": "komorebi-testwin.exe",
"class": "KomorebiTestWin",
"rect": {
"left": 657,
"top": 27,
"right": 596,
"bottom": 332
}
}
],
"focused": 0
}
},
{
"id": "fop08rEXwYLbkqzpy3nE9",
"locked": false,
"windows": {
"elements": [
{
"hwnd": 327778,
"title": "win3",
"exe": "komorebi-testwin.exe",
"class": "KomorebiTestWin",
"rect": {
"left": 657,
"top": 393,
"right": 596,
"bottom": 332
}
}
],
"focused": 0
}
}
],
"focused": 2
},
"monocle_container": null,
"maximized_window": null,
"floating_windows": {
"elements": [],
"focused": 0
},
"layout": {
"Default": "BSP"
},
"layout_options": null,
"layout_rules": [],
"layout_options_rules": [],
"work_area_offset_rules": [],
"layout_flip": null,
"workspace_padding": 10,
"container_padding": 10,
"latest_layout": [
{
"left": 27,
"top": 27,
"right": 596,
"bottom": 698
},
{
"left": 657,
"top": 27,
"right": 596,
"bottom": 332
},
{
"left": 657,
"top": 393,
"right": 596,
"bottom": 332
}
],
"resize_dimensions": [
null,
null,
null
],
"tile": true,
"work_area_offset": null,
"apply_window_based_work_area_offset": true,
"window_container_behaviour": null,
"window_container_behaviour_rules": null,
"float_override": null,
"layer": "Tiling",
"floating_layer_behaviour": null,
"wallpaper": null
}
],
"focused": 0
},
"workspace_names": {},
"container_padding": null,
"workspace_padding": null,
"wallpaper": null,
"floating_layer_behaviour": null
}
],
"focused": 0
},
"monitor_usr_idx_map": {
"0": 0
},
"is_paused": false,
"resize_delta": 50,
"new_window_behaviour": "Create",
"float_override": false,
"cross_monitor_move_behaviour": "Swap",
"monocle_focus_behaviour": "NoOp",
"unmanaged_window_operation_behaviour": "Op",
"work_area_offset": null,
"focus_follows_mouse": null,
"mouse_follows_focus": true,
"has_pending_raise_op": false,
"virtual_desktop_id": null
}
+92
View File
@@ -0,0 +1,92 @@
"""The parser on what each port printed, recorded from a real run.
`fixtures/kfde-*.json` are the `komorebic state` of kfde in a headless KWin (the `core-e2e` suite
writes them into its output); `fixtures/kfw-*.json` are the `komorebic state` of kfw's daemon on a
Windows 11 guest. Both are raw stdout, unedited: they hold only the test windows. What differs
between the two ports is what `Snapshot` exists to hide, so the checks below are the same for both.
"""
import json
from pathlib import Path
import pytest
from komorebi_vm.core.snapshot import Snapshot, parse
FIXTURES = Path(__file__).parent / "fixtures"
# a terminal cell, in pixels, which is how far a `foot` window can be short of the frame asked for
CELL = 24
# the port, and the titles of the three windows its scenario opened
PORTS = {"kfde": {"neutral1", "neutral2", "neutral3"}, "kfw": {"win1", "win2", "win3"}}
def recorded(name: str) -> Snapshot:
return parse(json.loads((FIXTURES / f"{name}.json").read_text()))
@pytest.mark.parametrize("port", PORTS)
def test_three_tiled_windows_are_three_containers_of_one(port: str) -> None:
snap = recorded(f"{port}-tiled")
assert sorted(t for c in snap.containers() for t in c) == sorted(PORTS[port])
assert [len(c) for c in snap.containers()] == [1, 1, 1]
assert snap.managed() == 3
assert snap.workspace().layout == "BSP"
assert snap.workspace().tile
@pytest.mark.parametrize("port", PORTS)
def test_the_layout_has_a_rectangle_for_each_container_inside_the_work_area(port: str) -> None:
snap = recorded(f"{port}-tiled")
layout = snap.workspace().latest_layout
assert len(layout) == 3
area = snap.monitors[0].work_area
assert all(rect.inside(area) for rect in layout)
assert not any(a.overlaps(b) for i, a in enumerate(layout) for b in layout[i + 1 :])
@pytest.mark.parametrize("port", PORTS)
def test_each_window_is_where_its_containers_rectangle_is_up_to_the_clients_rounding(
port: str,
) -> None:
"""The same place, and the size no more than a terminal cell short: kfde's test windows are
`foot`, which sizes itself to whole cells (a frame of 924 by 504 for a layout of 925 by 505),
where kfw's test windows have no granularity."""
snap = recorded(f"{port}-tiled")
workspace = snap.workspace()
for container, rect in zip(workspace.containers, workspace.latest_layout, strict=True):
frame = container[0].rect
assert frame is not None
assert (frame.x, frame.y) == (rect.x, rect.y)
assert 0 <= rect.w - frame.w < CELL
assert 0 <= rect.h - frame.h < CELL
@pytest.mark.parametrize("port", PORTS)
def test_the_focused_window_is_one_of_the_three(port: str) -> None:
assert recorded(f"{port}-tiled").focused_title() in PORTS[port]
@pytest.mark.parametrize("port", PORTS)
def test_a_stack_is_a_container_of_two_and_its_focused_window_is_the_one_the_ring_names(
port: str,
) -> None:
snap = recorded(f"{port}-stack")
assert sorted(len(c) for c in snap.containers()) == [1, 2]
stacked = next(c for c in snap.containers() if len(c) == 2)
assert snap.focused_title() in stacked
assert len(snap.workspace().latest_layout) == 2
assert snap.managed() == 3
def test_a_floating_window_is_not_in_a_container() -> None:
snap = recorded("kfw-float")
workspace = snap.workspace()
assert [w.title for w in workspace.floating] == ["win3"]
assert sorted(t for c in snap.containers() for t in c) == ["win1", "win2"]
assert snap.managed() == 3
def test_what_only_kfw_has_is_kept_aside() -> None:
assert "has_pending_raise_op" in recorded("kfw-tiled").extra
assert "has_pending_raise_op" not in recorded("kfde-tiled").extra
+3 -3
View File
@@ -1,8 +1,8 @@
"""The same scene, as each port prints it, reads as the same Snapshot.
The fixtures are written from the `Serialize` code of the two ports (kfde `komorebi/src/window.rs`,
kfw `komorebi/src/window.rs`), not recorded; a recorded state of each replaces them once a run on
each port exists.
The scenes are written from the `Serialize` code of the two ports (kfde `komorebi/src/window.rs`,
kfw `komorebi/src/window.rs`), so that shapes no run has recorded (a monocle, a stack in a
neighbor's place) can be tried; `test_recorded.py` has what each port really printed.
"""
from typing import Any