diff options
| author | Kon <96987701+ChaosInfinited@users.noreply.github.com> | 2026-03-17 14:10:53 +0000 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2026-03-17 09:10:53 -0500 |
| commit | be96e06a965b9ec7c9273234b6299f35626f9e64 (patch) | |
| tree | de2b0e6b5858c57b70f5d5fa1f823050363a978c /hyprtester/src/tests/main/groups.cpp | |
| parent | 30c498acf4173930dfd8afd6279ebceacb1941e9 (diff) | |
view: consolidate group flags and apply window rules (#13694)
* view: consolidate group flags and apply window rules
Replace individual boolean flags with a bitmask for group policies and ensure that window-specific group rules are correctly inherited when windows are initialized or added to a group.
* tests: add cases for locked groups and invade rule
Add tests to verify window grouping behavior, specifically checking that locked groups prevent merging by default and that the 'invade' group rule correctly overrides this lock policy.
Diffstat (limited to 'hyprtester/src/tests/main/groups.cpp')
| -rw-r--r-- | hyprtester/src/tests/main/groups.cpp | 83 |
1 files changed, 83 insertions, 0 deletions
diff --git a/hyprtester/src/tests/main/groups.cpp b/hyprtester/src/tests/main/groups.cpp index 2f9c5062..596bad31 100644 --- a/hyprtester/src/tests/main/groups.cpp +++ b/hyprtester/src/tests/main/groups.cpp @@ -294,6 +294,89 @@ static bool test() { Tests::killAllWindows(); EXPECT(Tests::windowCount(), 0); + // Tests for grouping/merging logic + NLog::log("{}Testing locked groups w/ invade", Colors::GREEN); + + Tests::killAllWindows(); + EXPECT(Tests::windowCount(), 0); + + // Test normal, unlocked groups + { + auto winA = Tests::spawnKitty("unlocked"); + if (!winA) { + NLog::log("{}Error: unlocked kitty did not spawn", Colors::RED); + return false; + } + OK(getFromSocket("/dispatch togglegroup")); + + auto winB = Tests::spawnKitty("top"); + if (!winB) { + NLog::log("{}Error: top kitty did not spawn", Colors::RED); + return false; + } + + // Verify it DID merge into a group + { + auto str = getFromSocket("/clients"); + EXPECT_COUNT_STRING(str, "at: 22,22", 2); + } + } + + Tests::killAllWindows(); + EXPECT(Tests::windowCount(), 0); + + // Test locked groups + { + auto lockedWin = Tests::spawnKitty("locked"); + if (!lockedWin) { + NLog::log("{}Error: locked kitty did not spawn", Colors::RED); + return false; + } + OK(getFromSocket("/dispatch togglegroup")); + OK(getFromSocket(std::format("/dispatch focuswindow pid:{}", lockedWin->pid()))); + OK(getFromSocket("/dispatch lockactivegroup lock")); + + auto winB = Tests::spawnKitty("top"); + if (!winB) { + NLog::log("{}Error: top kitty did not spawn", Colors::RED); + return false; + } + + // Verify it did NOT merge into the locked group + { + auto str = getFromSocket("/clients"); + EXPECT_COUNT_STRING(str, "at: 22,22", 1); + } + } + + Tests::killAllWindows(); + EXPECT(Tests::windowCount(), 0); + + // Test locked groups WITH invade rule + { + OK(getFromSocket("/keyword windowrule[locked-im]:match:class ^locked|invade$")); + OK(getFromSocket("/keyword windowrule[locked-im]:group set always lock invade")); + + auto lockedWin = Tests::spawnKitty("locked"); + if (!lockedWin) { + NLog::log("{}Error: locked kitty did not spawn", Colors::RED); + return false; + } + + auto invadingWin = Tests::spawnKitty("invade"); + if (!invadingWin) { + NLog::log("{}Error: invading kitty did not spawn", Colors::RED); + return false; + } + + // Verify it DID merge into the locked group + auto str = getFromSocket("/clients"); + EXPECT_COUNT_STRING(str, "at: 22,22", 2); + } + + Tests::killAllWindows(); + EXPECT(Tests::windowCount(), 0); + return !ret; } |
