mirror of
https://github.com/LGUG2Z/komorebi.git
synced 2026-11-16 22:01:22 +01:00
feat(nix): the tiling_off scenario
toggle-tiling leaves the windows where they are, a layout change moves none of them, and toggled again every window is tiled where the layout says. core-e2e passes 254 checks on KDE.
This commit is contained in:
1 parent
1e2b10eb86
commit
74ddcce4d9
4 files changed
+67
-1
No files matched your search
@@ -0,0 +1,39 @@
|
||||
"""A workspace with tiling off leaves its windows where they are, and tiling it again tiles them."""
|
||||
|
||||
from komorebi_vm.core.checks import Checks
|
||||
from komorebi_vm.core.platform import Client, Platform
|
||||
from komorebi_vm.core.scenarios.layouts import tiled
|
||||
from komorebi_vm.core.scenarios.support import positions
|
||||
|
||||
|
||||
def run(platform: Platform, checks: Checks, clients: list[Client]) -> None:
|
||||
"""Toggles tiling off on the first workspace, which has `clients` tiled in a container each,
|
||||
and on again, with a layout change in between that must not move anything."""
|
||||
before = positions(platform, clients)
|
||||
|
||||
platform.komorebic("toggle-tiling")
|
||||
checks.check(
|
||||
"after 'toggle-tiling' the daemon has the workspace untiled",
|
||||
platform.wait_for(lambda: not platform.state().workspace().tile, timeout=20),
|
||||
)
|
||||
checks.check("... and no window moved", positions(platform, clients) == before)
|
||||
platform.komorebic("change-layout", "columns")
|
||||
checks.check(
|
||||
"... a layout change does not move them either",
|
||||
not platform.wait_for(lambda: positions(platform, clients) != before, timeout=3),
|
||||
)
|
||||
|
||||
platform.komorebic("toggle-tiling")
|
||||
checks.check(
|
||||
"'toggle-tiling' again has the workspace tiled",
|
||||
platform.wait_for(lambda: platform.state().workspace().tile, timeout=20),
|
||||
)
|
||||
checks.check(
|
||||
"... and every window is where the layout says",
|
||||
platform.wait_for(lambda: tiled(platform, clients), timeout=20),
|
||||
)
|
||||
platform.komorebic("change-layout", "bsp")
|
||||
checks.check(
|
||||
"... and in bsp again",
|
||||
platform.wait_for(lambda: tiled(platform, clients), timeout=20),
|
||||
)
|
||||
@@ -80,6 +80,7 @@ class FakePlatform:
|
||||
self.display_of: dict[str, int] = {}
|
||||
self.forgets_displays = False
|
||||
self.floats: list[str] = []
|
||||
self.tiling = True
|
||||
self.paused = False
|
||||
self.flipped = False
|
||||
self.last = 0
|
||||
@@ -427,6 +428,8 @@ class FakePlatform:
|
||||
self._relayout()
|
||||
case ("toggle-pause",):
|
||||
self.paused = not self.paused
|
||||
case ("toggle-tiling",):
|
||||
self.tiling = not self.tiling
|
||||
case ("toggle-float",):
|
||||
if self.floats:
|
||||
self.containers.insert(self.focus, [self.floats.pop()])
|
||||
@@ -498,7 +501,7 @@ class FakePlatform:
|
||||
"focused": 0,
|
||||
},
|
||||
"layout": {"Default": "Columns"},
|
||||
"tile": True,
|
||||
"tile": self.tiling,
|
||||
"workspace_padding": self.workspace_padding,
|
||||
"container_padding": self.container_padding,
|
||||
"latest_layout": [rect(r) for r in self.tiles[: len(containers)]],
|
||||
|
||||
@@ -26,6 +26,7 @@ from komorebi_vm.core.scenarios import (
|
||||
stacks,
|
||||
startup_rules,
|
||||
tiling,
|
||||
tiling_off,
|
||||
workspace_moves,
|
||||
workspaces,
|
||||
)
|
||||
@@ -361,6 +362,27 @@ def test_a_daemon_that_manages_while_paused_fails_pausing() -> None:
|
||||
assert checks.failed > 0
|
||||
|
||||
|
||||
def test_a_daemon_that_is_right_passes_tiling_off() -> None:
|
||||
platform = FakePlatform()
|
||||
checks = Checks()
|
||||
clients = opened(platform, checks)
|
||||
tiling_off.run(platform, checks, clients)
|
||||
assert checks.failed == 0, checks.failures
|
||||
assert checks.passed > 4
|
||||
|
||||
|
||||
def test_a_daemon_that_ignores_toggle_tiling_fails_tiling_off() -> None:
|
||||
class Stubborn(FakePlatform):
|
||||
def komorebic(self, *args: str) -> str:
|
||||
return "" if args == ("toggle-tiling",) else super().komorebic(*args)
|
||||
|
||||
platform = Stubborn()
|
||||
checks = Checks()
|
||||
clients = opened(platform, checks)
|
||||
tiling_off.run(platform, checks, clients)
|
||||
assert checks.failed > 0
|
||||
|
||||
|
||||
def test_a_command_the_port_lacks_is_skipped_by_name() -> None:
|
||||
platform = FakePlatform()
|
||||
checks = Checks()
|
||||
|
||||
@@ -35,6 +35,7 @@ from komorebi_vm.core.scenarios import (
|
||||
stacks,
|
||||
startup_rules,
|
||||
tiling,
|
||||
tiling_off,
|
||||
workspace_moves,
|
||||
workspaces,
|
||||
)
|
||||
@@ -466,6 +467,7 @@ resize_commands.run(platform, checks, neutral)
|
||||
promoting.run(platform, checks, neutral)
|
||||
flipping.run(platform, checks, neutral)
|
||||
pausing.run(platform, checks, neutral)
|
||||
tiling_off.run(platform, checks, neutral)
|
||||
padding.run(platform, checks, neutral)
|
||||
monocle.run(platform, checks, neutral)
|
||||
workspace_moves.run(platform, checks, neutral)
|
||||
|
||||
Reference in new issue
Block a user