From cdf1d2fc9580e50d4aafc23f47ae2a1e698b8861 Mon Sep 17 00:00:00 2001 From: SooChan Lim Date: Tue, 14 Jul 2020 17:32:58 +0900 Subject: [PATCH] Test: add DSZone test Change-Id: I152ade8e35c38018b2c8de77b26394a51ca07296 --- tests/DSZone-test.cpp | 37 +++++++++++++++++++++++++++++++++++++ tests/meson.build | 1 + 2 files changed, 38 insertions(+) create mode 100644 tests/DSZone-test.cpp diff --git a/tests/DSZone-test.cpp b/tests/DSZone-test.cpp new file mode 100644 index 0000000..0e813ce --- /dev/null +++ b/tests/DSZone-test.cpp @@ -0,0 +1,37 @@ +#include "libds-tests.h" +#include "DSZone.h" +#include "DSPolicyArea.h" +#include "DSPolicyAreaPrivate.h" + +using namespace display_server; + +class DSZoneTest : public ::testing::Test +{ +public: + void SetUp(void) override + {} + void TearDown(void) override + {} +}; + +TEST_F(DSZoneTest, NewDSZone) +{ + auto policyArea = std::make_shared(); + auto zone = std::make_unique(policyArea); + EXPECT_TRUE(zone != nullptr); +} + +TEST_F(DSZoneTest, BasicMethods) +{ + auto policyArea = std::make_shared(); + EXPECT_TRUE(policyArea->setPosition(10, 10) == true); + EXPECT_TRUE(policyArea->setSize(100, 100) == true); + + auto zone = std::make_unique(policyArea); + EXPECT_TRUE(zone != nullptr); + + EXPECT_TRUE(zone->getX() == 10); + EXPECT_TRUE(zone->getY() == 10); + EXPECT_TRUE(zone->getWidth() == 100); + EXPECT_TRUE(zone->getHeight() == 100); +} diff --git a/tests/meson.build b/tests/meson.build index 7d437f8..fb20037 100644 --- a/tests/meson.build +++ b/tests/meson.build @@ -36,6 +36,7 @@ libds_tests_srcs = [ 'DSWaylandPointer-test.cpp', 'DSWaylandKeyboard-test.cpp', 'DSWaylandTouch-test.cpp', + 'DSZone-test.cpp' ] gmock_dep = dependency('gmock', method : 'pkg-config') -- 2.7.4