diff options
| author | Thedudeman <108754421+RockClapps@users.noreply.github.com> | 2026-03-05 09:08:40 -0500 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2026-03-05 14:08:40 +0000 |
| commit | 3284dd729b3529e744a1c0db7d1c3ff1e296f7ea (patch) | |
| tree | baf24cda001a6a59ea40c5fada3de558cb9e2396 /hyprtester | |
| parent | 803e81ac398ff56816321fbe24f013671cfebc7f (diff) | |
algo/scrolling: add config options for focus and swapcol wrapping (#13518)
Diffstat (limited to 'hyprtester')
| -rw-r--r-- | hyprtester/src/tests/main/scroll.cpp | 149 | ||||
| -rw-r--r-- | hyprtester/test.conf | 2 |
2 files changed, 151 insertions, 0 deletions
diff --git a/hyprtester/src/tests/main/scroll.cpp b/hyprtester/src/tests/main/scroll.cpp index 26be6a9a..8bb950dd 100644 --- a/hyprtester/src/tests/main/scroll.cpp +++ b/hyprtester/src/tests/main/scroll.cpp @@ -57,6 +57,147 @@ static void testFocusCycling() { Tests::killAllWindows(); } +static void testFocusWrapping() { + for (auto const& win : {"a", "b", "c", "d"}) { + if (!Tests::spawnKitty(win)) { + NLog::log("{}Failed to spawn kitty with win class `{}`", Colors::RED, win); + ++TESTS_FAILED; + ret = 1; + return; + } + } + + // set wrap_focus to true + OK(getFromSocket("/keyword scrolling:wrap_focus true")); + + OK(getFromSocket("/dispatch focuswindow class:a")); + + OK(getFromSocket("/dispatch layoutmsg focus l")); + + { + auto str = getFromSocket("/activewindow"); + EXPECT_CONTAINS(str, "class: d"); + } + + OK(getFromSocket("/dispatch layoutmsg focus r")); + + { + auto str = getFromSocket("/activewindow"); + EXPECT_CONTAINS(str, "class: a"); + } + + // set wrap_focus to false + OK(getFromSocket("/keyword scrolling:wrap_focus false")); + + OK(getFromSocket("/dispatch focuswindow class:a")); + + OK(getFromSocket("/dispatch layoutmsg focus l")); + + { + auto str = getFromSocket("/activewindow"); + EXPECT_CONTAINS(str, "class: a"); + } + + OK(getFromSocket("/dispatch focuswindow class:d")); + + OK(getFromSocket("/dispatch layoutmsg focus r")); + + { + auto str = getFromSocket("/activewindow"); + EXPECT_CONTAINS(str, "class: d"); + } + + // clean up + NLog::log("{}Killing all windows", Colors::YELLOW); + Tests::killAllWindows(); +} + +static void testSwapcolWrapping() { + for (auto const& win : {"a", "b", "c", "d"}) { + if (!Tests::spawnKitty(win)) { + NLog::log("{}Failed to spawn kitty with win class `{}`", Colors::RED, win); + ++TESTS_FAILED; + ret = 1; + return; + } + } + + // set wrap_swapcol to true + OK(getFromSocket("/keyword scrolling:wrap_swapcol true")); + + OK(getFromSocket("/dispatch focuswindow class:a")); + + OK(getFromSocket("/dispatch layoutmsg swapcol l")); + OK(getFromSocket("/dispatch layoutmsg focus l")); + + { + auto str = getFromSocket("/activewindow"); + EXPECT_CONTAINS(str, "class: c"); + } + + // clean up + NLog::log("{}Killing all windows", Colors::YELLOW); + Tests::killAllWindows(); + + for (auto const& win : {"a", "b", "c", "d"}) { + if (!Tests::spawnKitty(win)) { + NLog::log("{}Failed to spawn kitty with win class `{}`", Colors::RED, win); + ++TESTS_FAILED; + ret = 1; + return; + } + } + + OK(getFromSocket("/dispatch focuswindow class:d")); + OK(getFromSocket("/dispatch layoutmsg swapcol r")); + OK(getFromSocket("/dispatch layoutmsg focus r")); + + { + auto str = getFromSocket("/activewindow"); + EXPECT_CONTAINS(str, "class: b"); + } + + // clean up + NLog::log("{}Killing all windows", Colors::YELLOW); + Tests::killAllWindows(); + + for (auto const& win : {"a", "b", "c", "d"}) { + if (!Tests::spawnKitty(win)) { + NLog::log("{}Failed to spawn kitty with win class `{}`", Colors::RED, win); + ++TESTS_FAILED; + ret = 1; + return; + } + } + + // set wrap_swapcol to false + OK(getFromSocket("/keyword scrolling:wrap_swapcol false")); + + OK(getFromSocket("/dispatch focuswindow class:a")); + + OK(getFromSocket("/dispatch layoutmsg swapcol l")); + OK(getFromSocket("/dispatch layoutmsg focus r")); + + { + auto str = getFromSocket("/activewindow"); + EXPECT_CONTAINS(str, "class: b"); + } + + OK(getFromSocket("/dispatch focuswindow class:d")); + + OK(getFromSocket("/dispatch layoutmsg swapcol r")); + OK(getFromSocket("/dispatch layoutmsg focus l")); + + { + auto str = getFromSocket("/activewindow"); + EXPECT_CONTAINS(str, "class: c"); + } + + // clean up + NLog::log("{}Killing all windows", Colors::YELLOW); + Tests::killAllWindows(); +} + static bool test() { NLog::log("{}Testing Scroll layout", Colors::GREEN); @@ -68,6 +209,14 @@ static bool test() { NLog::log("{}Testing focus cycling", Colors::GREEN); testFocusCycling(); + // test + NLog::log("{}Testing focus wrap", Colors::GREEN); + testFocusWrapping(); + + // test + NLog::log("{}Testing swapcol wrap", Colors::GREEN); + testSwapcolWrapping(); + // clean up NLog::log("Cleaning up", Colors::YELLOW); OK(getFromSocket("/dispatch workspace 1")); diff --git a/hyprtester/test.conf b/hyprtester/test.conf index f249a80a..e55906e8 100644 --- a/hyprtester/test.conf +++ b/hyprtester/test.conf @@ -186,6 +186,8 @@ scrolling { follow_focus = true follow_min_visible = 1 explicit_column_widths = 0.25, 0.333, 0.5, 0.667, 0.75, 1.0 + wrap_focus = true + wrap_swapcol = true } # https://wiki.hyprland.org/Configuring/Variables/#misc |
