diff options
| author | Levizor <levizorri@gmail.com> | 2025-09-09 15:19:51 +0200 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2025-09-09 14:19:51 +0100 |
| commit | 150d693fe794a01aab762a18d2d8a2c8bc54b43c (patch) | |
| tree | bf3bb839bc32d621aa54c597bae5267198e37f84 /hyprtester/src/tests/main/hyprctl.cpp | |
| parent | ecc9e4d8cd7a86f5f7d7541bee9b092122d2fa83 (diff) | |
hyprctl: add an active layout index field in devices (#11531)
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; } |
