diff options
| author | Vaxry <43317083+vaxerski@users.noreply.github.com> | 2026-02-28 18:53:26 +0000 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2026-02-28 18:53:26 +0000 |
| commit | b90c61c04f02ae5bbf0d1a1a63da18f3cee6919d (patch) | |
| tree | edacbe4cb2673aa1a0c4abde486353ab9bf68809 /hyprtester/src/tests/main/scroll.cpp | |
| parent | e333a330c0ddb07db39028fa8b3a47b3f7d21b5f (diff) | |
compositor: fix focus edge detection (#13425)
fixes edge detection, making it more relaxed and intuitive
Diffstat (limited to 'hyprtester/src/tests/main/scroll.cpp')
| -rw-r--r-- | hyprtester/src/tests/main/scroll.cpp | 79 |
1 files changed, 79 insertions, 0 deletions
diff --git a/hyprtester/src/tests/main/scroll.cpp b/hyprtester/src/tests/main/scroll.cpp new file mode 100644 index 00000000..26be6a9a --- /dev/null +++ b/hyprtester/src/tests/main/scroll.cpp @@ -0,0 +1,79 @@ +#include "../shared.hpp" +#include "../../shared.hpp" +#include "../../hyprctlCompat.hpp" +#include "tests.hpp" + +static int ret = 0; + +static void testFocusCycling() { + 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:a")); + + OK(getFromSocket("/dispatch movefocus r")); + + { + auto str = getFromSocket("/activewindow"); + EXPECT_CONTAINS(str, "class: b"); + } + + OK(getFromSocket("/dispatch movefocus r")); + + { + auto str = getFromSocket("/activewindow"); + EXPECT_CONTAINS(str, "class: c"); + } + + OK(getFromSocket("/dispatch movefocus r")); + + { + auto str = getFromSocket("/activewindow"); + EXPECT_CONTAINS(str, "class: d"); + } + + OK(getFromSocket("/dispatch movewindow l")); + + { + auto str = getFromSocket("/activewindow"); + EXPECT_CONTAINS(str, "class: d"); + } + + OK(getFromSocket("/dispatch movefocus u")); + + { + 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); + + // setup + OK(getFromSocket("/dispatch workspace name:scroll")); + OK(getFromSocket("/keyword general:layout scrolling")); + + // test + NLog::log("{}Testing focus cycling", Colors::GREEN); + testFocusCycling(); + + // clean up + NLog::log("Cleaning up", Colors::YELLOW); + OK(getFromSocket("/dispatch workspace 1")); + OK(getFromSocket("/reload")); + + return !ret; +} + +REGISTER_TEST_FN(test); |
