diff options
| author | Aditya Singh <1adityasingh@proton.me> | 2025-12-28 01:57:59 +0530 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2025-12-27 21:27:59 +0100 |
| commit | e5d20b56bcad78df42c9060a5d330274b0a6e510 (patch) | |
| tree | 8c7829bbe0130a0cb03674b286e21fb09aa8d8e5 /hyprtester/src/tests/main/window.cpp | |
| parent | 5faa66d297752ab0d919bb5719fa0949292fe720 (diff) | |
keybinds: simulate mouse movement after bringing active window to top (#12703)
Fixes https://github.com/hyprwm/Hyprland/discussions/12702
Diffstat (limited to 'hyprtester/src/tests/main/window.cpp')
| -rw-r--r-- | hyprtester/src/tests/main/window.cpp | 41 |
1 files changed, 41 insertions, 0 deletions
diff --git a/hyprtester/src/tests/main/window.cpp b/hyprtester/src/tests/main/window.cpp index 6f23448b..37442790 100644 --- a/hyprtester/src/tests/main/window.cpp +++ b/hyprtester/src/tests/main/window.cpp @@ -373,6 +373,45 @@ static void testMaximizeSize() { EXPECT(Tests::windowCount(), 0); } +static void testBringActiveToTopMouseMovement() { + NLog::log("{}Testing bringactivetotop mouse movement", Colors::GREEN); + + Tests::killAllWindows(); + OK(getFromSocket("/keyword input:follow_mouse 2")); + OK(getFromSocket("/keyword input:float_switch_override_focus 0")); + + EXPECT(spawnKitty("a"), true); + OK(getFromSocket("/dispatch setfloating")); + OK(getFromSocket("/dispatch movewindowpixel exact 500 300,activewindow")); + OK(getFromSocket("/dispatch resizewindowpixel exact 400 400,activewindow")); + + EXPECT(spawnKitty("b"), true); + OK(getFromSocket("/dispatch setfloating")); + OK(getFromSocket("/dispatch movewindowpixel exact 500 300,activewindow")); + OK(getFromSocket("/dispatch resizewindowpixel exact 400 400,activewindow")); + + auto getTopWindow = []() -> std::string { + auto clients = getFromSocket("/clients"); + return (clients.rfind("class: a") > clients.rfind("class: b")) ? "a" : "b"; + }; + + EXPECT(getTopWindow(), std::string("b")); + OK(getFromSocket("/dispatch movecursor 700 500")); + + OK(getFromSocket("/dispatch focuswindow class:a")); + EXPECT_CONTAINS(getFromSocket("/activewindow"), "class: a"); + + OK(getFromSocket("/dispatch bringactivetotop")); + EXPECT(getTopWindow(), std::string("a")); + + OK(getFromSocket("/dispatch plugin:test:click 272,1")); + OK(getFromSocket("/dispatch plugin:test:click 272,0")); + + EXPECT(getTopWindow(), std::string("a")); + + Tests::killAllWindows(); +} + static bool test() { NLog::log("{}Testing windows", Colors::GREEN); @@ -806,6 +845,8 @@ static bool test() { testMaximizeSize(); + testBringActiveToTopMouseMovement(); + NLog::log("{}Reloading config", Colors::YELLOW); OK(getFromSocket("/reload")); |
