diff options
| author | Luke Barkess <57995669+Brumus14@users.noreply.github.com> | 2025-11-11 22:59:21 +0000 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2025-11-11 22:59:21 +0000 |
| commit | 308226a4fc2c9b63fa19894d5f85e79e05d75e03 (patch) | |
| tree | 50a5c0d7577113726189824fda971b71c479867c /hyprtester/src/tests/main/keybinds.cpp | |
| parent | ee2168c665c9c01991cd2a0e73633e4e7d833259 (diff) | |
config/keybinds: add a submap universal keybind flag (#12100)
Diffstat (limited to 'hyprtester/src/tests/main/keybinds.cpp')
| -rw-r--r-- | hyprtester/src/tests/main/keybinds.cpp | 41 |
1 files changed, 40 insertions, 1 deletions
diff --git a/hyprtester/src/tests/main/keybinds.cpp b/hyprtester/src/tests/main/keybinds.cpp index 4e224749..a2fe2f37 100644 --- a/hyprtester/src/tests/main/keybinds.cpp +++ b/hyprtester/src/tests/main/keybinds.cpp @@ -34,6 +34,17 @@ static bool checkFlag() { return exists; } +static bool attemptCheckFlag(int attempts, int intervalMs) { + for (int i = 0; i < attempts; i++) { + if (checkFlag()) + return true; + + std::this_thread::sleep_for(std::chrono::milliseconds(intervalMs)); + } + + return false; +} + static std::string readKittyOutput() { std::string output = Tests::execAndGet("kitten @ --to unix:/tmp/hyprtester-kitty.sock get-text --extent all"); // chop off shell prompt @@ -443,6 +454,34 @@ static void testSubmap() { Tests::killAllWindows(); } +static void testSubmapUniversal() { + NLog::log("{}Testing submap universal", Colors::GREEN); + + EXPECT(checkFlag(), false); + EXPECT(getFromSocket("/keyword bindu SUPER,Y,exec,touch " + flagFile), "ok"); + EXPECT_CONTAINS(getFromSocket("/submap"), "default"); + + // keybind works on default submap + OK(getFromSocket("/dispatch plugin:test:keybind 1,7,29")); + OK(getFromSocket("/dispatch plugin:test:keybind 0,7,29")); + EXPECT(attemptCheckFlag(30, 5), true); + + // keybind works on submap1 + getFromSocket("/dispatch plugin:test:keybind 1,7,30"); + getFromSocket("/dispatch plugin:test:keybind 0,7,30"); + EXPECT_CONTAINS(getFromSocket("/submap"), "submap1"); + OK(getFromSocket("/dispatch plugin:test:keybind 1,7,29")); + OK(getFromSocket("/dispatch plugin:test:keybind 0,7,29")); + EXPECT(attemptCheckFlag(30, 5), true); + + // reset to default submap + getFromSocket("/dispatch plugin:test:keybind 1,0,33"); + getFromSocket("/dispatch plugin:test:keybind 0,0,33"); + EXPECT_CONTAINS(getFromSocket("/submap"), "default"); + + EXPECT(getFromSocket("/keyword unbind SUPER,Y"), "ok"); +} + static bool test() { NLog::log("{}Testing keybinds", Colors::GREEN); @@ -462,8 +501,8 @@ static bool test() { testShortcutLongPressKeyRelease(); testShortcutRepeat(); testShortcutRepeatKeyRelease(); - testSubmap(); + testSubmapUniversal(); clearFlag(); return !ret; |
