summaryrefslogtreecommitdiff
path: root/hyprtester/src/tests/main/layer.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'hyprtester/src/tests/main/layer.cpp')
-rw-r--r--hyprtester/src/tests/main/layer.cpp53
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)