summaryrefslogtreecommitdiff
path: root/hyprtester/src/tests/main/window.cpp
diff options
context:
space:
mode:
authorVaxry <vaxry@vaxry.net>2025-11-17 22:37:53 +0000
committerVaxry <vaxry@vaxry.net>2025-11-18 00:59:21 +0000
commitedc311544a54a06ce4acb759b4d9a30853695452 (patch)
tree511cdfc2e97dcb224de24f92a86139ef1782b79f /hyprtester/src/tests/main/window.cpp
parent37fe7b2efde3f572080de33a1fef1b8306ee8bda (diff)
dwindle: Revert rework split logic to be fully gap-aware (#12047)
This reverts commit 151b5f69783b111831e8c5dc062904a221799d7b. Fixes #12380
Diffstat (limited to 'hyprtester/src/tests/main/window.cpp')
-rw-r--r--hyprtester/src/tests/main/window.cpp44
1 files changed, 13 insertions, 31 deletions
diff --git a/hyprtester/src/tests/main/window.cpp b/hyprtester/src/tests/main/window.cpp
index 2cf42eef..87187592 100644
--- a/hyprtester/src/tests/main/window.cpp
+++ b/hyprtester/src/tests/main/window.cpp
@@ -152,40 +152,22 @@ static bool test() {
NLog::log("{}Testing window split ratios", Colors::YELLOW);
{
- const double INITIAL_RATIO = 1.25;
- const int GAPSIN = 5;
- const int GAPSOUT = 20;
- const int BORDERSIZE = 2;
- const int BORDERS = BORDERSIZE * 2;
- const int MONITOR_W = 1920;
- const int MONITOR_H = 1080;
-
- const float totalAvailableHeight = MONITOR_H - (GAPSOUT * 2);
- const int HEIGHT = std::round(totalAvailableHeight) - BORDERS;
- const float availableWidthForSplit = MONITOR_W - (GAPSOUT * 2) - GAPSIN;
-
- auto calculateFinalWidth = [&](double boxWidth, bool isLeftWindow) {
- double gapLeft = isLeftWindow ? GAPSOUT : GAPSIN;
- double gapRight = isLeftWindow ? GAPSIN : GAPSOUT;
- return std::round(boxWidth - gapLeft - gapRight - BORDERS);
- };
-
- double geomBoxWidthA_R1 = (availableWidthForSplit * INITIAL_RATIO / 2.0) + GAPSOUT + (GAPSIN / 2.0);
- double geomBoxWidthB_R1 = MONITOR_W - geomBoxWidthA_R1;
- const int WIDTH1 = calculateFinalWidth(geomBoxWidthB_R1, false);
-
- const double INVERTED_RATIO = 0.75;
- double geomBoxWidthA_R2 = (availableWidthForSplit * INVERTED_RATIO / 2.0) + GAPSOUT + (GAPSIN / 2.0);
- double geomBoxWidthB_R2 = MONITOR_W - geomBoxWidthA_R2;
- const int WIDTH2 = calculateFinalWidth(geomBoxWidthB_R2, false);
- const int WIDTH_A_FINAL = calculateFinalWidth(geomBoxWidthA_R2, true);
+ const double RATIO = 1.25;
+ const double PERCENT = RATIO / 2.0 * 100.0;
+ const int GAPSIN = 5;
+ const int GAPSOUT = 20;
+ const int BORDERS = 2 * 2;
+ const int WTRIM = BORDERS + GAPSIN + GAPSOUT;
+ const int HEIGHT = 1080 - (BORDERS + (GAPSOUT * 2));
+ const int WIDTH1 = std::round(1920.0 / 2.0 * (2 - RATIO)) - WTRIM;
+ const int WIDTH2 = std::round(1920.0 / 2.0 * RATIO) - WTRIM;
OK(getFromSocket("/keyword dwindle:default_split_ratio 1.25"));
if (!spawnKitty("kitty_B"))
return false;
- NLog::log("{}Expecting kitty_B size: {},{}", Colors::YELLOW, WIDTH1, HEIGHT);
+ NLog::log("{}Expecting kitty_B to take up roughly {}% of screen width", Colors::YELLOW, 100 - PERCENT);
EXPECT_CONTAINS(getFromSocket("/activewindow"), std::format("size: {},{}", WIDTH1, HEIGHT));
OK(getFromSocket("/dispatch killwindow activewindow"));
@@ -197,12 +179,12 @@ static bool test() {
if (!spawnKitty("kitty_B"))
return false;
- NLog::log("{}Expecting kitty_B size: {},{}", Colors::YELLOW, WIDTH2, HEIGHT);
+ NLog::log("{}Expecting kitty_B to take up roughly {}% of screen width", Colors::YELLOW, PERCENT);
EXPECT_CONTAINS(getFromSocket("/activewindow"), std::format("size: {},{}", WIDTH2, HEIGHT));
OK(getFromSocket("/dispatch focuswindow class:kitty_A"));
- NLog::log("{}Expecting kitty_A size: {},{}", Colors::YELLOW, WIDTH_A_FINAL, HEIGHT);
- EXPECT_CONTAINS(getFromSocket("/activewindow"), std::format("size: {},{}", WIDTH_A_FINAL, HEIGHT));
+ NLog::log("{}Expecting kitty_A to have the same width as the previous kitty_B", Colors::YELLOW);
+ EXPECT_CONTAINS(getFromSocket("/activewindow"), std::format("size: {},{}", WIDTH1, HEIGHT));
OK(getFromSocket("/keyword dwindle:default_split_ratio 1"));
}