mirror of
https://github.com/LGUG2Z/komorebi.git
synced 2026-11-18 22:58:34 +01:00
feat(e2e): sync the neutral core from kfde 5e7e4ff1
Adds commands.unknown_monitor: a window sent to a monitor that does not exist must stay managed. From kfde change lkprqpuv.
This commit is contained in:
1 parent
d2adcc9c28
commit
76918d5a88
3 files changed
+42
No files matched your search
@@ -353,3 +353,20 @@ def prints(platform: Platform, checks: Checks) -> None:
|
||||
checks.skip(f"komorebic {line}", "the port has no such command")
|
||||
continue
|
||||
checks.check(f"komorebic {line}", status == 0)
|
||||
|
||||
|
||||
def unknown_monitor(platform: Platform, checks: Checks, clients: list[Client]) -> None:
|
||||
"""Sends the focused window to a monitor that does not exist, and checks that no window is lost.
|
||||
|
||||
A port may refuse the command or ignore it, but a window that was managed has to stay managed:
|
||||
a daemon that stops managing it leaves it on the screen with nothing tiling it. The platform
|
||||
has fewer than seven displays.
|
||||
"""
|
||||
managed = platform.state().managed()
|
||||
for command in ("send-to-monitor", "move-to-monitor"):
|
||||
platform.komorebic_status(command, "7")
|
||||
platform.wait_for(lambda: unhealthy(platform, clients) is None, timeout=5)
|
||||
checks.check(
|
||||
f"after {command} 7, which no display has, the daemon still manages every window",
|
||||
platform.state().managed() == managed and unhealthy(platform, clients) is None,
|
||||
)
|
||||
@@ -241,6 +241,8 @@ class FakePlatform:
|
||||
self.spaces[int(number)].append([window])
|
||||
case ("change-layout", _):
|
||||
pass
|
||||
case ("send-to-monitor", _):
|
||||
pass
|
||||
case ("move-to-monitor", number):
|
||||
if int(number) < self.display_count:
|
||||
self.display_of[self.containers[self.focus][0]] = int(number)
|
||||
|
||||
@@ -212,3 +212,26 @@ def test_the_sweep_plugs_in_a_second_display_when_there_is_only_one() -> None:
|
||||
commands.sweep(platform, checks, clients, config="unused", commands=("focus right",))
|
||||
assert platform.display_count == 2
|
||||
assert checks.failed == 0, checks.failures
|
||||
|
||||
|
||||
def test_a_daemon_that_loses_a_window_sent_to_no_monitor_fails() -> None:
|
||||
class Loses(FakePlatform):
|
||||
def komorebic_status(self, *args: str) -> tuple[int, str]:
|
||||
if args[:1] == ("send-to-monitor",):
|
||||
self.containers[self.focus].clear()
|
||||
return 0, ""
|
||||
return super().komorebic_status(*args)
|
||||
|
||||
platform = Loses()
|
||||
checks = Checks()
|
||||
clients = opened(platform, checks)
|
||||
commands.unknown_monitor(platform, checks, clients)
|
||||
assert any("send-to-monitor 7" in f for f in checks.failures)
|
||||
|
||||
|
||||
def test_a_daemon_that_ignores_a_monitor_that_does_not_exist_passes() -> None:
|
||||
platform = FakePlatform()
|
||||
checks = Checks()
|
||||
clients = opened(platform, checks)
|
||||
commands.unknown_monitor(platform, checks, clients)
|
||||
assert checks.failed == 0, checks.failures
|
||||
Reference in new issue
Block a user