summaryrefslogtreecommitdiff
path: root/hyprtester/plugin/src/main.cpp
diff options
context:
space:
mode:
authorVaxry <43317083+vaxerski@users.noreply.github.com>2025-06-26 19:43:39 +0200
committerGitHub <noreply@github.com>2025-06-26 19:43:39 +0200
commit3d6476c9021519995239ec93bbb11f0dce6c60a0 (patch)
tree381edc199f4348e4bb42863b55d47a01e4f550ab /hyprtester/plugin/src/main.cpp
parent9a67e0421b49596060719566996ee4ca81ae8843 (diff)
Core: Add a test suite (#9297)
Adds a test suite for testing hyprland's features with a runtime tester --------- Co-authored-by: Mihai Fufezan <mihai@fufexan.net>
Diffstat (limited to 'hyprtester/plugin/src/main.cpp')
-rw-r--r--hyprtester/plugin/src/main.cpp43
1 files changed, 43 insertions, 0 deletions
diff --git a/hyprtester/plugin/src/main.cpp b/hyprtester/plugin/src/main.cpp
new file mode 100644
index 00000000..1a7136d9
--- /dev/null
+++ b/hyprtester/plugin/src/main.cpp
@@ -0,0 +1,43 @@
+#include <unistd.h>
+#include <src/includes.hpp>
+#include <sstream>
+#include <any>
+
+#define private public
+#include <src/config/ConfigManager.hpp>
+#include <src/config/ConfigDescriptions.hpp>
+#undef private
+
+#include "globals.hpp"
+
+// Do NOT change this function.
+APICALL EXPORT std::string PLUGIN_API_VERSION() {
+ return HYPRLAND_API_VERSION;
+}
+
+static SDispatchResult test(std::string in) {
+ bool success = true;
+ std::string errors = "";
+
+ if (g_pConfigManager->m_configValueNumber != CONFIG_OPTIONS.size() + 1 /* autogenerated is special */) {
+ errors += "config value number mismatches descriptions size\n";
+ success = false;
+ }
+
+ return SDispatchResult{
+ .success = success,
+ .error = errors,
+ };
+}
+
+APICALL EXPORT PLUGIN_DESCRIPTION_INFO PLUGIN_INIT(HANDLE handle) {
+ PHANDLE = handle;
+
+ HyprlandAPI::addDispatcherV2(PHANDLE, "plugin:test:test", ::test);
+
+ return {"hyprtestplugin", "hyprtestplugin", "Vaxry", "1.0"};
+}
+
+APICALL EXPORT void PLUGIN_EXIT() {
+ ;
+}