diff options
| author | Virt <41426325+VirtCode@users.noreply.github.com> | 2026-03-06 21:11:42 +0100 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2026-03-06 20:11:42 +0000 |
| commit | e0c571005912c342d8d812b368bc490cb6f28796 (patch) | |
| tree | 8591722027f451f2714e982c76421d70fd4b4f24 /hyprtester/src/tests/main/layer.cpp | |
| parent | 42f0a6005b7c502b1486f1f3b4d9883035be3dd8 (diff) | |
layerrules: add dynamically registered rules for plugins (#13331)
* layerrules: add dynamically registered rules for plugins
* be gone
* layerrules: add layer tests with waybar
* fix: use kitty layers instead of waybar
Diffstat (limited to 'hyprtester/src/tests/main/layer.cpp')
| -rw-r--r-- | hyprtester/src/tests/main/layer.cpp | 53 |
1 files changed, 53 insertions, 0 deletions
diff --git a/hyprtester/src/tests/main/layer.cpp b/hyprtester/src/tests/main/layer.cpp new file mode 100644 index 00000000..73e30ba6 --- /dev/null +++ b/hyprtester/src/tests/main/layer.cpp @@ -0,0 +1,53 @@ +#include "../../Log.hpp" +#include "../shared.hpp" +#include "tests.hpp" +#include "../../shared.hpp" +#include "../../hyprctlCompat.hpp" +#include <hyprutils/os/Process.hpp> +#include <hyprutils/memory/WeakPtr.hpp> + +static int ret = 0; + +using namespace Hyprutils::OS; +using namespace Hyprutils::Memory; + +static bool spawnLayer(const std::string& namespace_) { + NLog::log("{}Spawning kitty layer {}", Colors::YELLOW, namespace_); + if (!Tests::spawnLayerKitty(namespace_)) { + NLog::log("{}Error: {} layer did not spawn", Colors::RED, namespace_); + return false; + } + return true; +} + +static bool test() { + NLog::log("{}Testing plugin layerrules", Colors::GREEN); + + if (!spawnLayer("rule-layer")) + return false; + + OK(getFromSocket("/dispatch plugin:test:add_layer_rule")); + OK(getFromSocket("/reload")); + + OK(getFromSocket("/keyword layerrule match:namespace rule-layer, plugin_rule effect")); + + if (!spawnLayer("rule-layer")) + return false; + + if (!spawnLayer("norule-layer")) + return false; + + OK(getFromSocket("/dispatch plugin:test:check_layer_rule")); + + OK(getFromSocket("/reload")); + + NLog::log("{}Killing all layers", Colors::YELLOW); + Tests::killAllLayers(); + + NLog::log("{}Expecting 0 layers", Colors::YELLOW); + EXPECT(Tests::layerCount(), 0); + + return !ret; +} + +REGISTER_TEST_FN(test) |
