From: SooChan Lim Date: Thu, 18 Jun 2020 02:18:03 +0000 (+0900) Subject: implement the skeleton methods of DSDisplayArea X-Git-Tag: accepted/tizen/unified/20200820.213435~335 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=refs%2Fchanges%2F40%2F241540%2F1;p=platform%2Fcore%2Fuifw%2Flibds.git implement the skeleton methods of DSDisplayArea At this time, the test case fails. Change-Id: I08d9229f16ede242a3a53154158e154211802e8e --- diff --git a/src/DSDisplayArea/DSDisplayArea.cpp b/src/DSDisplayArea/DSDisplayArea.cpp index 34cac5e..a3ab96b 100644 --- a/src/DSDisplayArea/DSDisplayArea.cpp +++ b/src/DSDisplayArea/DSDisplayArea.cpp @@ -2,28 +2,51 @@ namespace display_server { -DSDisplayArea::DSDisplayArea() : mOutput(nullptr) + +DSDisplayArea::DSDisplayArea() + : __output(nullptr), + __x(0), + __y(0), + __width(0), + __height(0) {} -DSDisplayArea::DSDisplayArea(DSOutput *output) : mOutput(output) +DSDisplayArea::DSDisplayArea(DSOutput *output) + : __output(output), + __x(0), + __y(0), + __width(0), + __height(0) {} DSDisplayArea::~DSDisplayArea() {} +bool DSDisplayArea::setPosition(int x, int y) +{ + // position to canvas. + return false; +} + +bool DSDisplayArea::setSize(int width, int height) +{ + return false; +} + int DSDisplayArea::getWidth() { - if (mOutput == nullptr) + if (__output == nullptr) return -1; - return mOutput->getResolutionWidth(); + return __width; } int DSDisplayArea::getHeight() { - if (mOutput == nullptr) + if (__output == nullptr) return -1; - return mOutput->getResolutionHeight(); + return __height; } + } // namespace display_server diff --git a/src/DSDisplayArea/DSDisplayArea.h b/src/DSDisplayArea/DSDisplayArea.h index 1adaf3a..3e3cc99 100644 --- a/src/DSDisplayArea/DSDisplayArea.h +++ b/src/DSDisplayArea/DSDisplayArea.h @@ -7,16 +7,23 @@ namespace display_server { class DSDisplayArea { + public: DSDisplayArea(); DSDisplayArea(DSOutput *output); virtual ~DSDisplayArea(); + + bool setPosition(int x, int y); + bool setSize(int width, int height); int getWidth(); int getHeight(); private: - DSOutput *mOutput; + DSOutput *__output; + int __x, __y; + int __width, __height; }; + } #endif diff --git a/tests/DSDisplayArea-test.cpp b/tests/DSDisplayArea-test.cpp index c967a60..a8de0ad 100644 --- a/tests/DSDisplayArea-test.cpp +++ b/tests/DSDisplayArea-test.cpp @@ -25,16 +25,13 @@ TEST_F(DSDisplayAreaTest, NewDSDisplayArea) ASSERT_TRUE(true); } -TEST_F(DSDisplayAreaTest, GetWidthHeight) +TEST_F(DSDisplayAreaTest, BasicMethods) { - DSOutput *output = new DSOutput; - DSDisplayArea *displayArea = new DSDisplayArea(output); - - int width = displayArea->getWidth(); - EXPECT_TRUE(width == 1280); + DSOutput output; + DSDisplayArea displayArea(&output); - int height = displayArea->getHeight(); - EXPECT_TRUE(height == 720); - - delete displayArea; + EXPECT_TRUE(displayArea.setPosition(0, 0) != 0); + EXPECT_TRUE(displayArea.setSize(100, 100) != 0); + EXPECT_TRUE(displayArea.getHeight() != 0); + EXPECT_TRUE(displayArea.getWidth() != 0); }