diff options
Diffstat (limited to 'hyprtester/src/tests/main/hyprctl.cpp')
| -rw-r--r-- | hyprtester/src/tests/main/hyprctl.cpp | 25 |
1 files changed, 23 insertions, 2 deletions
diff --git a/hyprtester/src/tests/main/hyprctl.cpp b/hyprtester/src/tests/main/hyprctl.cpp index 2946c630..95f7caae 100644 --- a/hyprtester/src/tests/main/hyprctl.cpp +++ b/hyprtester/src/tests/main/hyprctl.cpp @@ -1,7 +1,9 @@ #include "tests.hpp" #include "../../shared.hpp" #include "../../hyprctlCompat.hpp" +#include <cstdint> #include <print> +#include <string> #include <thread> #include <chrono> #include <hyprutils/os/Process.hpp> @@ -29,6 +31,24 @@ static std::string getCommandStdOut(std::string command) { return stdOut.substr(0, stdOut.length() - 1); } +static bool testDevicesActiveLayoutIndex() { + NLog::log("{}Testing hyprctl devices active_layout_index", Colors::GREEN); + + // configure layouts + getFromSocket("/keyword input:kb_layout us,pl,ua"); + + for (uint8_t i = 0; i < 3; i++) { + // set layout + getFromSocket("/switchxkblayout all " + std::to_string(i)); + std::string devicesJson = getFromSocket("j/devices"); + std::string expected = R"("active_layout_index": )" + std::to_string(i); + // check layout index + EXPECT_CONTAINS(devicesJson, expected); + } + + return true; +} + static bool testGetprop() { NLog::log("{}Testing hyprctl getprop", Colors::GREEN); if (!Tests::spawnKitty()) { @@ -154,8 +174,9 @@ static bool test() { EXPECT(jqProc.exitCode(), 0); } - if (!testGetprop()) - return false; + testGetprop(); + testDevicesActiveLayoutIndex(); + getFromSocket("/reload"); return !ret; } |
