summaryrefslogtreecommitdiff
path: root/hyprtester/src/tests/main/window.cpp
diff options
context:
space:
mode:
authorerstarr <253168930+erstarr@users.noreply.github.com>2026-05-08 20:34:54 +0200
committerGitHub <noreply@github.com>2026-05-08 19:34:54 +0100
commit1a164704e7596d743dfeade3946385997254b019 (patch)
tree6f2bdb0ea601f7ac0ee5f977b5881d9e2042be8b /hyprtester/src/tests/main/window.cpp
parent544268931a2b5953f021c129d13387f06b625080 (diff)
keybind/actions: `cycle_next` w/ `tiled = true` doesn't choose only tiled windows (#14164)
* fix tiling only selection: actually select only tiling when chosen * clang-format * test: cycle_next float only and tiled only
Diffstat (limited to 'hyprtester/src/tests/main/window.cpp')
-rw-r--r--hyprtester/src/tests/main/window.cpp72
1 files changed, 72 insertions, 0 deletions
diff --git a/hyprtester/src/tests/main/window.cpp b/hyprtester/src/tests/main/window.cpp
index fab4ab76..bb5e0f20 100644
--- a/hyprtester/src/tests/main/window.cpp
+++ b/hyprtester/src/tests/main/window.cpp
@@ -1052,3 +1052,75 @@ TEST_CASE(windows) {
OK(getFromSocket("/eval hl.plugin.test.check_window_rule()"));
}
+
+TEST_CASE(cycle_nextTiled) {
+ // If the user specifically requests a tiled window, give them a tiled window
+
+ if (!spawnKitty("a")) {
+ FAIL_TEST("Could not spawn kitty of class:a");
+ }
+
+ if (!spawnKitty("b")) {
+ FAIL_TEST("Could not spawn kitty of class:b");
+ }
+
+ if (!spawnKitty("c")) {
+ FAIL_TEST("Could not spawn kitty of class:c");
+ }
+
+ if (!spawnKitty("d")) {
+ FAIL_TEST("Could not spawn kitty of class:d");
+ }
+
+ // float the class:a window
+ OK(getFromSocket("/dispatch hl.dsp.window.float({action = 'enable', window = 'class:a'})"));
+ // float the class:c window
+ OK(getFromSocket("/dispatch hl.dsp.window.float({action = 'enable', window = 'class:c'})"));
+ // float the class:d window
+ OK(getFromSocket("/dispatch hl.dsp.window.float({action = 'enable', window = 'class:d'})"));
+
+ // establish focus history
+ OK(getFromSocket("/dispatch hl.dsp.focus({window = 'class:a'})")); // floating
+ OK(getFromSocket("/dispatch hl.dsp.focus({window = 'class:b'})")); // tiled <-- What we want to focus on
+ OK(getFromSocket("/dispatch hl.dsp.focus({window = 'class:c'})")); // floating
+ OK(getFromSocket("/dispatch hl.dsp.focus({window = 'class:d'})")); // floating
+
+ // request a tiled window
+ OK(getFromSocket("/dispatch hl.dsp.window.cycle_next({ next = true, tiled = true, floating = false})"));
+
+ ASSERT_CONTAINS(getFromSocket("/activewindow"), "class: b");
+}
+
+TEST_CASE(cycle_nextFloating) {
+ // If the user specifically requests a floating window, give them a floating window
+
+ if (!spawnKitty("a")) {
+ FAIL_TEST("Could not spawn kitty of class:a");
+ }
+
+ if (!spawnKitty("b")) {
+ FAIL_TEST("Could not spawn kitty of class:b");
+ }
+
+ if (!spawnKitty("c")) {
+ FAIL_TEST("Could not spawn kitty of class:c");
+ }
+
+ if (!spawnKitty("d")) {
+ FAIL_TEST("Could not spawn kitty of class:d");
+ }
+
+ // float the class:b window
+ OK(getFromSocket("/dispatch hl.dsp.window.float({action = 'enable', window = 'class:b'})"));
+
+ // establish focus history
+ OK(getFromSocket("/dispatch hl.dsp.focus({window = 'class:a'})")); // tiled
+ OK(getFromSocket("/dispatch hl.dsp.focus({window = 'class:b'})")); // floating <-- What we want to focus on
+ OK(getFromSocket("/dispatch hl.dsp.focus({window = 'class:c'})")); // tiled
+ OK(getFromSocket("/dispatch hl.dsp.focus({window = 'class:d'})")); // tiled
+
+ // request a floating window
+ OK(getFromSocket("/dispatch hl.dsp.window.cycle_next({ next = true, tiled = false, floating = true})"));
+
+ ASSERT_CONTAINS(getFromSocket("/activewindow"), "class: b");
+} \ No newline at end of file