mirror of
https://github.com/LGUG2Z/komorebi.git
synced 2026-11-20 23:51:40 +01:00
feat(nix): the scrolling scenario
In the scrolling layout each window in turn, given the focus, has it and is inside the work area; changed back to bsp, every window is where the layout says. core-e2e passes 265 checks on KDE.
This commit is contained in:
1 parent
9c29757cff
commit
e375d0a151
3 files changed
+61
No files matched your search
@@ -0,0 +1,33 @@
|
||||
"""In the scrolling layout the window that has the focus is in view, wherever the others are."""
|
||||
|
||||
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 focus_agrees
|
||||
|
||||
|
||||
def run(platform: Platform, checks: Checks, clients: list[Client]) -> None:
|
||||
"""Changes the layout of the first workspace, which has `clients` tiled in a container each,
|
||||
to scrolling, gives each of them the focus in turn, and changes it back to bsp."""
|
||||
area = platform.work_area()
|
||||
|
||||
def in_view(client: Client) -> bool:
|
||||
window = platform.os_window(client)
|
||||
return window is not None and window.frame.inside(area)
|
||||
|
||||
platform.komorebic("change-layout", "scrolling")
|
||||
for client in clients:
|
||||
platform.activate(client)
|
||||
checks.check(
|
||||
f"in scrolling, {client.title} has the focus and is inside the work area",
|
||||
platform.wait_for(
|
||||
lambda c=client: focus_agrees(platform, clients, c.title) and in_view(c),
|
||||
timeout=20,
|
||||
),
|
||||
)
|
||||
|
||||
platform.komorebic("change-layout", "bsp")
|
||||
checks.check(
|
||||
"back in bsp every window is where the layout says",
|
||||
platform.wait_for(lambda: tiled(platform, clients), timeout=20),
|
||||
)
|
||||
@@ -2,6 +2,7 @@
|
||||
|
||||
from komorebi_vm.core.checks import Checks
|
||||
from komorebi_vm.core.geometry import Rect
|
||||
from komorebi_vm.core.platform import OsWindow
|
||||
from komorebi_vm.core.scenarios import (
|
||||
closing,
|
||||
commands,
|
||||
@@ -24,6 +25,7 @@ from komorebi_vm.core.scenarios import (
|
||||
resize,
|
||||
resize_commands,
|
||||
rules,
|
||||
scrolling,
|
||||
stacks,
|
||||
startup_rules,
|
||||
tiling,
|
||||
@@ -407,6 +409,30 @@ def test_a_daemon_that_loses_the_put_away_window_fails_lifecycle_hidden() -> Non
|
||||
assert checks.failed > 0
|
||||
|
||||
|
||||
def test_a_daemon_that_is_right_passes_scrolling() -> None:
|
||||
platform = FakePlatform()
|
||||
checks = Checks()
|
||||
clients = opened(platform, checks)
|
||||
scrolling.run(platform, checks, clients)
|
||||
assert checks.failed == 0, checks.failures
|
||||
assert checks.passed > 3
|
||||
|
||||
|
||||
def test_a_daemon_that_loses_the_focused_window_off_screen_fails_scrolling() -> None:
|
||||
class Off(FakePlatform):
|
||||
def os_window(self, client): # noqa: ANN001, ANN201
|
||||
window = super().os_window(client)
|
||||
if window is not None and window.focused:
|
||||
return OsWindow(window.title, Rect(5000, 0, 100, 100), focused=True)
|
||||
return window
|
||||
|
||||
platform = Off()
|
||||
checks = Checks()
|
||||
clients = opened(platform, checks)
|
||||
scrolling.run(platform, checks, clients)
|
||||
assert checks.failed > 0
|
||||
|
||||
|
||||
def test_a_command_the_port_lacks_is_skipped_by_name() -> None:
|
||||
platform = FakePlatform()
|
||||
checks = Checks()
|
||||
|
||||
@@ -33,6 +33,7 @@ from komorebi_vm.core.scenarios import (
|
||||
promoting,
|
||||
resize_commands,
|
||||
rules,
|
||||
scrolling,
|
||||
stacks,
|
||||
startup_rules,
|
||||
tiling,
|
||||
@@ -469,6 +470,7 @@ promoting.run(platform, checks, neutral)
|
||||
flipping.run(platform, checks, neutral)
|
||||
pausing.run(platform, checks, neutral)
|
||||
tiling_off.run(platform, checks, neutral)
|
||||
scrolling.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