mirror of
https://github.com/LGUG2Z/komorebi.git
synced 2026-11-30 20:24:09 +01:00
feat(e2e): sync the neutral core from kfde 7db3f9c5
This commit is contained in:
1 parent
3ae77df287
commit
e20e02bd12
3 files changed
+80
-1
No files matched your search
@@ -66,6 +66,7 @@ class FakePlatform:
|
||||
self.display_count = 2
|
||||
self.display_of: dict[str, int] = {}
|
||||
self.forgets_displays = False
|
||||
self.running = True
|
||||
self.moves = moves
|
||||
self.focus_follows_move = focus_follows_move
|
||||
|
||||
@@ -92,7 +93,14 @@ class FakePlatform:
|
||||
return bool(predicate())
|
||||
|
||||
def start_komorebi(self) -> None:
|
||||
pass
|
||||
"""A new daemon knows nothing: every window is tiled on the first workspace."""
|
||||
everyone = [t for containers in self.spaces for stack in containers for t in stack]
|
||||
self.spaces = [[[t] for t in everyone], [], []]
|
||||
self.focuses = [0, 0, 0]
|
||||
self.current = 0
|
||||
self.monocle = None
|
||||
self.running = True
|
||||
self._relayout()
|
||||
|
||||
@property
|
||||
def containers(self) -> list[list[str]]:
|
||||
@@ -120,6 +128,8 @@ class FakePlatform:
|
||||
self.spaces[self.rules[title]].append([title])
|
||||
else:
|
||||
self.containers.append([title])
|
||||
if len(self.containers) > len(self.tiles):
|
||||
self._relayout()
|
||||
return Client(title)
|
||||
|
||||
def _find(self, title: str) -> tuple[int, int]:
|
||||
@@ -202,6 +212,8 @@ class FakePlatform:
|
||||
|
||||
def komorebic_status(self, *args: str) -> tuple[int, str]:
|
||||
"""The fake's answer as a real `komorebic` gives it: exit 0, or 2 for what it lacks."""
|
||||
if not self.running:
|
||||
return 1, "the daemon is not running"
|
||||
if args[:1] == ("state",) or " ".join(args) in PRINTED:
|
||||
return 0, "{}"
|
||||
try:
|
||||
@@ -212,6 +224,8 @@ class FakePlatform:
|
||||
def komorebic(self, *args: str) -> str:
|
||||
n = len(self.containers)
|
||||
match args:
|
||||
case ("stop",):
|
||||
self.running = False
|
||||
case ("focus", "right"):
|
||||
self.focus = min(self.focus + 1, n - 1)
|
||||
case ("focus", "left"):
|
||||
|
||||
@@ -6,6 +6,7 @@ from komorebi_vm.core.scenarios import (
|
||||
commands,
|
||||
focus,
|
||||
hotplug,
|
||||
lifecycle,
|
||||
monocle,
|
||||
moving,
|
||||
resize,
|
||||
@@ -109,6 +110,28 @@ def test_a_daemon_that_is_right_passes_closing() -> None:
|
||||
assert checks.passed > 4
|
||||
|
||||
|
||||
def test_a_daemon_that_is_right_passes_lifecycle() -> None:
|
||||
platform = FakePlatform()
|
||||
checks = Checks()
|
||||
clients = opened(platform, checks)
|
||||
lifecycle.run(platform, checks, clients)
|
||||
assert checks.failed == 0, checks.failures
|
||||
assert checks.passed > 5
|
||||
|
||||
|
||||
def test_a_daemon_that_does_not_take_its_windows_up_again_fails_lifecycle() -> None:
|
||||
class Forgetful(FakePlatform):
|
||||
def start_komorebi(self) -> None:
|
||||
self.running = True
|
||||
self.spaces = [[], [], []]
|
||||
|
||||
platform = Forgetful()
|
||||
checks = Checks()
|
||||
clients = opened(platform, checks)
|
||||
lifecycle.run(platform, checks, clients)
|
||||
assert checks.failed > 0
|
||||
|
||||
|
||||
def test_a_command_the_port_lacks_is_skipped_by_name() -> None:
|
||||
platform = FakePlatform()
|
||||
checks = Checks()
|
||||
|
||||
Reference in new issue
Block a user