summaryrefslogtreecommitdiff
path: root/hyprtester/src/tests/main/dwindle.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'hyprtester/src/tests/main/dwindle.cpp')
-rw-r--r--hyprtester/src/tests/main/dwindle.cpp95
1 files changed, 95 insertions, 0 deletions
diff --git a/hyprtester/src/tests/main/dwindle.cpp b/hyprtester/src/tests/main/dwindle.cpp
index ef270a62..234bfc33 100644
--- a/hyprtester/src/tests/main/dwindle.cpp
+++ b/hyprtester/src/tests/main/dwindle.cpp
@@ -135,6 +135,98 @@ static void testSplit() {
Tests::killAllWindows();
}
+static void testRotatesplit() {
+ OK(getFromSocket("r/keyword general:gaps_in 0"));
+ OK(getFromSocket("r/keyword general:gaps_out 0"));
+ OK(getFromSocket("r/keyword general:border_size 0"));
+
+ for (auto const& win : {"a", "b"}) {
+ if (!Tests::spawnKitty(win)) {
+ NLog::log("{}Failed to spawn kitty with win class `{}`", Colors::RED, win);
+ ++TESTS_FAILED;
+ ret = 1;
+ return;
+ }
+ }
+
+ {
+ auto str = getFromSocket("/clients");
+ EXPECT_CONTAINS(str, "at: 0,0");
+ EXPECT_CONTAINS(str, "size: 960,1080");
+ }
+
+ // test 4 repeated rotations by 90 degrees
+ OK(getFromSocket("/dispatch layoutmsg rotatesplit"));
+ {
+ auto str = getFromSocket("/clients");
+ EXPECT_CONTAINS(str, "at: 0,0");
+ EXPECT_CONTAINS(str, "size: 1920,540");
+ }
+
+ OK(getFromSocket("/dispatch layoutmsg rotatesplit"));
+ {
+ auto str = getFromSocket("/clients");
+ EXPECT_CONTAINS(str, "at: 960,0");
+ EXPECT_CONTAINS(str, "size: 960,1080");
+ }
+
+ OK(getFromSocket("/dispatch layoutmsg rotatesplit"));
+ {
+ auto str = getFromSocket("/clients");
+ EXPECT_CONTAINS(str, "at: 0,540");
+ EXPECT_CONTAINS(str, "size: 1920,540");
+ }
+
+ OK(getFromSocket("/dispatch layoutmsg rotatesplit"));
+ {
+ auto str = getFromSocket("/clients");
+ EXPECT_CONTAINS(str, "at: 0,0");
+ EXPECT_CONTAINS(str, "size: 960,1080");
+ }
+
+ // test different angles
+ OK(getFromSocket("/dispatch layoutmsg rotatesplit 180"));
+ {
+ auto str = getFromSocket("/clients");
+ EXPECT_CONTAINS(str, "at: 960,0");
+ EXPECT_CONTAINS(str, "size: 960,1080");
+ }
+
+ OK(getFromSocket("/dispatch layoutmsg rotatesplit 270"));
+ {
+ auto str = getFromSocket("/clients");
+ EXPECT_CONTAINS(str, "at: 0,540");
+ EXPECT_CONTAINS(str, "size: 1920,540");
+ }
+
+ OK(getFromSocket("/dispatch layoutmsg rotatesplit 360"));
+ {
+ auto str = getFromSocket("/clients");
+ EXPECT_CONTAINS(str, "at: 0,0");
+ EXPECT_CONTAINS(str, "size: 1920,540");
+ }
+
+ // test negative angles
+ OK(getFromSocket("/dispatch layoutmsg rotatesplit -90"));
+ {
+ auto str = getFromSocket("/clients");
+ EXPECT_CONTAINS(str, "at: 0,0");
+ EXPECT_CONTAINS(str, "size: 960,1080");
+ }
+
+ OK(getFromSocket("/dispatch layoutmsg rotatesplit -180"));
+ {
+ auto str = getFromSocket("/clients");
+ EXPECT_CONTAINS(str, "at: 960,0");
+ EXPECT_CONTAINS(str, "size: 960,1080");
+ }
+
+ NLog::log("{}Killing all windows", Colors::YELLOW);
+ Tests::killAllWindows();
+
+ OK(getFromSocket("/reload"));
+}
+
static bool test() {
NLog::log("{}Testing Dwindle layout", Colors::GREEN);
@@ -148,6 +240,9 @@ static bool test() {
NLog::log("{}Testing splits", Colors::GREEN);
testSplit();
+ NLog::log("{}Testing rotatesplit", Colors::GREEN);
+ testRotatesplit();
+
// clean up
NLog::log("Cleaning up", Colors::YELLOW);
getFromSocket("/dispatch workspace 1");