diff options
| author | Vaxry <43317083+vaxerski@users.noreply.github.com> | 2026-03-02 16:21:20 +0000 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2026-03-02 16:21:20 +0000 |
| commit | 9f98f7440b73a301938c5bc588281dad7b4eded7 (patch) | |
| tree | 1949ed9f13fe78bc3cbe0d26de8999aeb42b87b4 /hyprtester/src/tests/main/dwindle.cpp | |
| parent | 5cb128103584acf8bb5cfbf05927084178413165 (diff) | |
algo/dwindle: add back splitratio (#13498)
Diffstat (limited to 'hyprtester/src/tests/main/dwindle.cpp')
| -rw-r--r-- | hyprtester/src/tests/main/dwindle.cpp | 58 |
1 files changed, 58 insertions, 0 deletions
diff --git a/hyprtester/src/tests/main/dwindle.cpp b/hyprtester/src/tests/main/dwindle.cpp index 4135f2d6..cb645245 100644 --- a/hyprtester/src/tests/main/dwindle.cpp +++ b/hyprtester/src/tests/main/dwindle.cpp @@ -81,6 +81,61 @@ static void test13349() { Tests::killAllWindows(); } +static void testSplit() { + // Test various split methods + + for (auto const& win : {"a", "b"}) { + 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 layoutmsg splitratio -0.2")); + + { + auto str = getFromSocket("/activewindow"); + EXPECT_CONTAINS(str, "at: 22,22"); + EXPECT_CONTAINS(str, "size: 743,1036"); + } + + OK(getFromSocket("/dispatch layoutmsg splitratio 1.6 exact")); + + { + auto str = getFromSocket("/activewindow"); + EXPECT_CONTAINS(str, "at: 22,22"); + EXPECT_CONTAINS(str, "size: 1495,1036"); + } + + EXPECT_NOT(getFromSocket("/dispatch layoutmsg splitratio fhne exact"), "ok"); + EXPECT_NOT(getFromSocket("/dispatch layoutmsg splitratio exact"), "ok"); + EXPECT_NOT(getFromSocket("/dispatch layoutmsg splitratio -....9"), "ok"); + EXPECT_NOT(getFromSocket("/dispatch layoutmsg splitratio ..9"), "ok"); + EXPECT_NOT(getFromSocket("/dispatch layoutmsg splitratio"), "ok"); + + OK(getFromSocket("/dispatch layoutmsg togglesplit")); + + { + auto str = getFromSocket("/activewindow"); + EXPECT_CONTAINS(str, "at: 22,22"); + EXPECT_CONTAINS(str, "size: 1876,823"); + } + + OK(getFromSocket("/dispatch layoutmsg swapsplit")); + + { + auto str = getFromSocket("/activewindow"); + EXPECT_CONTAINS(str, "at: 22,859"); + EXPECT_CONTAINS(str, "size: 1876,199"); + } + + NLog::log("{}Killing all windows", Colors::YELLOW); + Tests::killAllWindows(); +} + static bool test() { NLog::log("{}Testing Dwindle layout", Colors::GREEN); @@ -91,6 +146,9 @@ static bool test() { NLog::log("{}Testing #13349", Colors::GREEN); test13349(); + NLog::log("{}Testing splits", Colors::GREEN); + testSplit(); + // clean up NLog::log("Cleaning up", Colors::YELLOW); getFromSocket("/dispatch workspace 1"); |
