summaryrefslogtreecommitdiff
path: root/hyprtester/src/tests/main/layout_custom.cpp
diff options
context:
space:
mode:
authorVaxry <43317083+vaxerski@users.noreply.github.com>2026-05-06 13:56:12 +0100
committerGitHub <noreply@github.com>2026-05-06 13:56:12 +0100
commit1681bea42dd2f11ba3fe6df05560d0b231de3c76 (patch)
tree899103dbddf675a01758c7cdd379224c9c81a7fb /hyprtester/src/tests/main/layout_custom.cpp
parent5f1350f522d3fe3af78cbe30a98311763b3509d5 (diff)
config/lua: add simple layout API (#14258)
Adds a simple layout lua api
Diffstat (limited to 'hyprtester/src/tests/main/layout_custom.cpp')
-rw-r--r--hyprtester/src/tests/main/layout_custom.cpp56
1 files changed, 56 insertions, 0 deletions
diff --git a/hyprtester/src/tests/main/layout_custom.cpp b/hyprtester/src/tests/main/layout_custom.cpp
new file mode 100644
index 00000000..9a98a74a
--- /dev/null
+++ b/hyprtester/src/tests/main/layout_custom.cpp
@@ -0,0 +1,56 @@
+#include "../shared.hpp"
+#include "../../shared.hpp"
+#include "../../hyprctlCompat.hpp"
+#include "tests.hpp"
+
+TEST_CASE(layoutCustomGrid) {
+ OK(getFromSocket("r/eval hl.config({ general = { layout = 'lua:grid' } })"));
+
+ ASSERT(!!Tests::spawnKitty("kitty_A"), true);
+ ASSERT(!!Tests::spawnKitty("kitty_B"), true);
+
+ {
+ auto clients = getFromSocket("/clients");
+ EXPECT_COUNT_STRING(clients, "size: 931,1036", 2);
+ }
+
+ ASSERT(!!Tests::spawnKitty("kitty_C"), true);
+
+ {
+ auto clients = getFromSocket("/clients");
+ EXPECT_COUNT_STRING(clients, "size: 931,511", 3);
+ }
+
+ ASSERT(!!Tests::spawnKitty("kitty_D"), true);
+
+ {
+ auto clients = getFromSocket("/clients");
+ EXPECT_COUNT_STRING(clients, "size: 931,511", 4);
+ }
+}
+
+TEST_CASE(layoutCustomColumns) {
+ OK(getFromSocket("r/eval hl.config({ general = { layout = 'lua:columns' } })"));
+
+ ASSERT(!!Tests::spawnKitty("kitty_A"), true);
+ ASSERT(!!Tests::spawnKitty("kitty_B"), true);
+
+ {
+ auto clients = getFromSocket("/clients");
+ EXPECT_COUNT_STRING(clients, "size: 931,1036", 2);
+ }
+
+ ASSERT(!!Tests::spawnKitty("kitty_C"), true);
+
+ {
+ auto clients = getFromSocket("/clients");
+ EXPECT_COUNT_STRING(clients, ",1036\n", 3); // this won't split evenly
+ }
+
+ ASSERT(!!Tests::spawnKitty("kitty_D"), true);
+
+ {
+ auto clients = getFromSocket("/clients");
+ EXPECT_COUNT_STRING(clients, ",1036\n", 4); // this won't split evenly
+ }
+}