aboutsummaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
Diffstat (limited to 'tests')
-rw-r--r--tests/test_windows.mjs1
-rw-r--r--tests/test_windows.py14
2 files changed, 15 insertions, 0 deletions
diff --git a/tests/test_windows.mjs b/tests/test_windows.mjs
index 534fd45..b985d65 100644
--- a/tests/test_windows.mjs
+++ b/tests/test_windows.mjs
@@ -25,3 +25,4 @@ assert.equal(windows.peek(st("a")), 0); // a close is not news
assert.equal(windows.peek(st("a", "c")), 5); // a new window is, for [windows] peek seconds
assert.equal(windows.peek({ error: "x" }), false); // an error keeps what it knew
assert.equal(windows.peek(st("a", "c")), 0);
+assert.equal(windows.peek({ windows: [{ id: "a" }, { id: "c" }, { id: "d", dialog: true }], peek: 5 }), 0);
diff --git a/tests/test_windows.py b/tests/test_windows.py
index f05e546..a2a1ff6 100644
--- a/tests/test_windows.py
+++ b/tests/test_windows.py
@@ -108,6 +108,20 @@ class Commands(unittest.TestCase):
st = windows._state(lambda cmd: responses[tuple(cmd)])
self.assertEqual([w["address"] for w in st["windows"]], ["0x1"])
+ def test_state_marks_a_floating_window_of_an_open_app_as_dialog(self):
+ def c(addr, pid, floating):
+ return {"address": addr, "class": "x", "title": "t", "mapped": True,
+ "workspace": {"id": 1}, "pid": pid, "floating": floating}
+ responses = {
+ ("hyprctl", "clients", "-j"): json.dumps(
+ [c("0x1", 10, False), c("0x2", 10, True), c("0x3", 20, True)]),
+ ("hyprctl", "activewindow", "-j"): "{}",
+ ("hyprctl", "workspaces", "-j"): '[{"id": 1}]',
+ }
+ st = windows._state(lambda cmd: responses[tuple(cmd)])
+ self.assertEqual({w["address"]: w["dialog"] for w in st["windows"]},
+ {"0x1": False, "0x2": True, "0x3": False})
+
def test_state_includes_empty_workspaces_and_launch_icons(self):
responses = {
("hyprctl", "clients", "-j"): "[]",