mirror of
https://github.com/LGUG2Z/komorebi.git
synced 2026-11-19 15:18:40 +01:00
komorebi_vm.core (Rect, Checks, pixels, Snapshot, the Platform protocol and the first scenarios) and its unit tests, copied by kfde's scripts/sync-e2e-core from kfde change mxoqrxnx (accdd653). kfde is the source of truth until the core moves here; the copy is not to be edited in this tree.
54 lines
1.7 KiB
Python
54 lines
1.7 KiB
Python
"""The focus and moving scenarios against a daemon that is right, and against ones that are not."""
|
|
|
|
from komorebi_vm.core.checks import Checks
|
|
from komorebi_vm.core.scenarios import focus, moving, stacks, tiling, workspaces
|
|
from tests.fake_platform import FakePlatform
|
|
|
|
|
|
def opened(platform: FakePlatform, checks: Checks): # noqa: ANN201
|
|
return tiling.run(platform, checks)
|
|
|
|
|
|
def test_a_daemon_that_is_right_passes_both() -> None:
|
|
platform = FakePlatform()
|
|
checks = Checks()
|
|
clients = opened(platform, checks)
|
|
focus.run(platform, checks, clients)
|
|
moving.run(platform, checks, clients)
|
|
assert checks.failed == 0, checks.failures
|
|
assert checks.passed > 10
|
|
|
|
|
|
def test_a_move_that_moves_nothing_fails() -> None:
|
|
platform = FakePlatform(moves=False)
|
|
checks = Checks()
|
|
clients = opened(platform, checks)
|
|
moving.run(platform, checks, clients)
|
|
assert any("swapped tiles" in f for f in checks.failures)
|
|
|
|
|
|
def test_a_move_that_loses_the_focus_fails() -> None:
|
|
platform = FakePlatform(focus_follows_move=False)
|
|
checks = Checks()
|
|
clients = opened(platform, checks)
|
|
moving.run(platform, checks, clients)
|
|
assert any("keeps the focus" in f for f in checks.failures)
|
|
|
|
|
|
def test_a_daemon_that_is_right_passes_stacks() -> None:
|
|
platform = FakePlatform()
|
|
checks = Checks()
|
|
clients = opened(platform, checks)
|
|
stacks.run(platform, checks, clients)
|
|
assert checks.failed == 0, checks.failures
|
|
assert checks.passed > 10
|
|
|
|
|
|
def test_a_daemon_that_is_right_passes_workspaces() -> None:
|
|
platform = FakePlatform()
|
|
checks = Checks()
|
|
clients = opened(platform, checks)
|
|
workspaces.run(platform, checks, clients)
|
|
assert checks.failed == 0, checks.failures
|
|
assert checks.passed > 7
|