mirror of
https://github.com/LGUG2Z/komorebi.git
synced 2026-11-16 22:01:22 +01:00
feat(nix): placement takes known failures by case
A port that cannot start with a case's rules, or orders its windows otherwise, is recorded as a known failure for that case, and the other cases run on. kfw does not accept the place as a JSON number, so BEHAVIOUR.md lists the case as a known failure there.
This commit is contained in:
1 parent
b5e9cf5301
commit
b1e041f53d
3 files changed
+46
-3
No files matched your search
@@ -39,6 +39,7 @@ runs, and goes stale when the code changes.
|
||||
| `commands.unknown_monitor` | a window sent to a monitor that does not exist stays managed | **known failure** | **known failure** |
|
||||
| `rules` | initial, permanent and ignore rules by title, and that cleared rules stop applying | see below | pass |
|
||||
| `hotplug` | an unplugged display takes its windows to the other, a plugged one is a monitor | pass | pass |
|
||||
| `placement` | the placement rules of the config put a window first, last, or at a number | pass | 4 of 5 cases pass, **known failure**: the number 2 |
|
||||
| `lifecycle` | a daemon that stops and starts again takes the windows that were in view up again | pass | pass |
|
||||
|
||||
`rules` passes on kfde in every check. One run of the suite that holds it also failed a check that
|
||||
@@ -62,6 +63,14 @@ the totals say `known failures: N`, and one that holds fails the suite to say th
|
||||
`core-e2e` runs it last (section 12c), because the window is lost. The sweep of `commands` is not affected on kfde, which has two outputs, and on
|
||||
kfw the sweep now plugs in a second display first.
|
||||
|
||||
**`placement` on kfw.** The rule `initial_window_placement_rules: 2`, with the place as a JSON
|
||||
number, makes `komorebi.exe` exit at start with `data did not match any variant of untagged enum
|
||||
InitialWindowPlacementRules`, while the string `"2"` works, and kfde accepts both. kfw's own docs
|
||||
for the type say an integer is accepted, but its `PlacementTarget` deserializes with
|
||||
`String::deserialize`. It is a known failure to follow up on later: `placement.run` takes the
|
||||
description of the case and the reason, and records the case that way, whether the daemon does not
|
||||
start or puts the windows elsewhere. The other four cases give the same order on both ports.
|
||||
|
||||
**`resize` on kfw.** Dragging the edge between two tiles by 30, 60 and 120 pixels moved it by 27,
|
||||
53 and 96 on kfw's master, and by 27, 51 and 106 on its animation branch (`0c9acdf4`), where kfde
|
||||
moves it by exactly the pointer's distance. The pointer is not the cause: the same drag of the
|
||||
|
||||
@@ -44,22 +44,38 @@ def _settled(platform: Platform, title: str, count: int) -> None:
|
||||
platform.wait_for(lambda: platform.state().focused_title() == title, timeout=20)
|
||||
|
||||
|
||||
def run(platform: Platform, checks: Checks) -> None:
|
||||
def run(platform: Platform, checks: Checks, known_failures: dict[str, str] | None = None) -> None:
|
||||
"""Starts the daemon with each case's rules, opens its windows one after the other, and checks
|
||||
the order they are in.
|
||||
|
||||
`known_failures` maps the description of a case to why a port is known to fail it, whether
|
||||
its daemon does not start with the rules or puts the windows in another order. The case is
|
||||
then recorded as a known failure, and the others run on.
|
||||
|
||||
Nothing else may be open: the daemon takes up every window in view, and the order would
|
||||
count it. The windows of a case are closed before the next one. A window is opened only after
|
||||
the one before is managed and has the focus, because "after the one in focus" depends on it.
|
||||
"""
|
||||
known = known_failures or {}
|
||||
for description, rules, titles, want in CASES:
|
||||
platform.restart_with(_config(rules))
|
||||
reason = known.get(description)
|
||||
try:
|
||||
platform.restart_with(_config(rules))
|
||||
except Exception as error:
|
||||
if reason is None:
|
||||
raise
|
||||
checks.known_failure(description, False, f"{reason}; it did not start: {error}")
|
||||
continue
|
||||
clients: list[Client] = []
|
||||
for title in titles:
|
||||
clients.append(platform.spawn(title))
|
||||
_settled(platform, title, len(clients))
|
||||
got = _order(platform)
|
||||
checks.check(f"{description}: {', '.join(want)} ({got})", got == want)
|
||||
message = f"{description}: {', '.join(want)} ({got})"
|
||||
if reason is None:
|
||||
checks.check(message, got == want)
|
||||
else:
|
||||
checks.known_failure(message, got == want, reason)
|
||||
for client in clients:
|
||||
platform.close(client)
|
||||
platform.wait_for(lambda: platform.state().managed() == 0, timeout=20)
|
||||
@@ -300,3 +300,21 @@ def test_a_daemon_that_ignores_the_placement_rules_fails() -> None:
|
||||
checks = Checks()
|
||||
placement.run(platform, checks)
|
||||
assert checks.failed == len(placement.CASES) - 1, checks.failures
|
||||
|
||||
|
||||
def test_a_case_a_port_cannot_start_is_a_known_failure_and_the_rest_run() -> None:
|
||||
number = "by the number of the place, counted from 1"
|
||||
|
||||
class Refuses(FakePlatform):
|
||||
def restart_with(self, config: dict) -> None:
|
||||
workspace = config["monitors"][0]["workspaces"][0]
|
||||
if isinstance(workspace.get("initial_window_placement_rules"), int):
|
||||
raise AssertionError("exited at start")
|
||||
super().restart_with(config)
|
||||
|
||||
platform = Refuses()
|
||||
checks = Checks()
|
||||
placement.run(platform, checks, {number: "an integer is not accepted"})
|
||||
assert checks.failed == 0, checks.failures
|
||||
assert checks.passed == len(placement.CASES) - 1
|
||||
assert len(checks.known) == 1 and "exited at start" in checks.known[0]
|
||||
Reference in new issue
Block a user