At this time, the test case fails.
Change-Id: I08d9229f16ede242a3a53154158e154211802e8e
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
{
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
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);
}