summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorVaxry <43317083+vaxerski@users.noreply.github.com>2025-12-05 14:16:22 +0000
committerGitHub <noreply@github.com>2025-12-05 14:16:22 +0000
commit9264436f35e2c4e94adfdf2a8ea23a346ace3a65 (patch)
tree9fe48ff4728060445e655d8a3b528999fd124ff8 /tests
parentd5c52ef58e57b371a9df8fd4404c5d55a1b26f34 (diff)
desktop: rewrite reserved area handling + improve tests (#12383)
Diffstat (limited to 'tests')
-rw-r--r--tests/desktop/Reserved.cpp38
1 files changed, 38 insertions, 0 deletions
diff --git a/tests/desktop/Reserved.cpp b/tests/desktop/Reserved.cpp
new file mode 100644
index 00000000..8fbb7172
--- /dev/null
+++ b/tests/desktop/Reserved.cpp
@@ -0,0 +1,38 @@
+
+#include <desktop/reserved/ReservedArea.hpp>
+
+#include <gtest/gtest.h>
+
+TEST(Desktop, reservedArea) {
+ Desktop::CReservedArea a{{20, 30}, {40, 50}};
+ CBox box = {1000, 1000, 1000, 1000};
+ a.applyip(box);
+
+ EXPECT_EQ(box.x, 1020);
+ EXPECT_EQ(box.y, 1030);
+ EXPECT_EQ(box.w, 1000 - 20 - 40);
+ EXPECT_EQ(box.h, 1000 - 30 - 50);
+
+ box = a.apply(CBox{1000, 1000, 1000, 1000});
+
+ EXPECT_EQ(box.x, 1020);
+ EXPECT_EQ(box.y, 1030);
+ EXPECT_EQ(box.w, 1000 - 20 - 40);
+ EXPECT_EQ(box.h, 1000 - 30 - 50);
+
+ a.addType(Desktop::RESERVED_DYNAMIC_TYPE_LS, {10, 20}, {30, 40});
+
+ box = a.apply(CBox{1000, 1000, 1000, 1000});
+
+ EXPECT_EQ(box.x, 1000 + 20 + 10);
+ EXPECT_EQ(box.y, 1000 + 30 + 20);
+ EXPECT_EQ(box.w, 1000 - 20 - 40 - 10 - 30);
+ EXPECT_EQ(box.h, 1000 - 30 - 50 - 20 - 40);
+
+ Desktop::CReservedArea b{CBox{10, 10, 1000, 1000}, CBox{20, 30, 900, 900}};
+
+ EXPECT_EQ(b.left(), 20 - 10);
+ EXPECT_EQ(b.top(), 30 - 10);
+ EXPECT_EQ(b.right(), 1010 - 920);
+ EXPECT_EQ(b.bottom(), 1010 - 930);
+} \ No newline at end of file