From 6f1d2e771dca1b5eea5ec344ca1b6a80d4fd4ee5 Mon Sep 17 00:00:00 2001 From: ItsOhen Date: Sat, 27 Sep 2025 01:04:22 +0200 Subject: config: fix rules with no parameters not being counted as invalid (#11849) Quite a big whoopsie to insert invalid rules. Also adds special: cases. --- hyprtester/src/tests/main/window.cpp | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) (limited to 'hyprtester/src/tests/main/window.cpp') diff --git a/hyprtester/src/tests/main/window.cpp b/hyprtester/src/tests/main/window.cpp index 4645a26c..9880997e 100644 --- a/hyprtester/src/tests/main/window.cpp +++ b/hyprtester/src/tests/main/window.cpp @@ -237,7 +237,30 @@ static bool test() { EXPECT_CONTAINS(str, "floating: 1"); EXPECT_CONTAINS(str, std::format("size: {},{}", SIZE, SIZE)); EXPECT_NOT_CONTAINS(str, "pinned: 1"); + + OK(getFromSocket("/keyword windowrule plugin:someplugin:variable, class:wr_kitty")); + OK(getFromSocket("/keyword windowrule plugin:someplugin:variable 10, class:wr_kitty")); + OK(getFromSocket("/keyword windowrule workspace 1, class:wr_kitty")); + OK(getFromSocket("/keyword windowrule workspace special:magic, class:magic_kitty")); + + if (!spawnKitty("magic_kitty")) + return false; + EXPECT_CONTAINS(getFromSocket("/activewindow"), "special:magic"); } + NLog::log("{}Testing faulty rules", Colors::YELLOW); + { + const auto PARAM = "Invalid parameter"; + const auto RULE = "Invalid value"; + const auto NORULE = "no rules provided"; + EXPECT_CONTAINS(getFromSocket("/keyword windowrule notarule, class:wr_kitty"), RULE) + EXPECT_CONTAINS(getFromSocket("/keyword windowrule class:wr_kitty"), NORULE) + EXPECT_CONTAINS(getFromSocket("/keyword windowrule float, class:wr_kitty, size"), PARAM) + EXPECT_CONTAINS(getFromSocket("/keyword windowrule float, classI:wr_kitty"), PARAM) + EXPECT_CONTAINS(getFromSocket("/keyword windowrule workspace:, class:wr_kitty"), NORULE) + } + + NLog::log("{}Reloading config", Colors::YELLOW); + OK(getFromSocket("/reload")); NLog::log("{}Killing all windows", Colors::YELLOW); Tests::killAllWindows(); -- cgit v1.2.3