void EvasObject::checkSize(const int width, const int height)
{
- FAIL_UNLESS_EQUAL(this->getWidth(), width);
- FAIL_UNLESS_EQUAL(this->getHeight(), height);
+ ASSERT_MSG(getWidth() == width, "width: " << getWidth() << " != " << width);
+ ASSERT_MSG(getHeight() == height, "height: " << getHeight() << " != " << height);
+
+// FAIL_UNLESS_EQUAL(this->getWidth(), width);
+// FAIL_UNLESS_EQUAL(this->getHeight(), height);
}
void EvasObject::checkPosition(const int xcoord, const int ycoord)
{
- FAIL_UNLESS_EQUAL(this->getX(), xcoord);
- FAIL_UNLESS_EQUAL(this->getY(), ycoord);
+ ASSERT_MSG(getX() == xcoord, "x: " << getX() << " != " << xcoord);
+ ASSERT_MSG(getY() == ycoord, "y: " << getY() << " != " << ycoord);
+
+// FAIL_UNLESS_EQUAL(this->getX(), xcoord);
+// FAIL_UNLESS_EQUAL(this->getY(), ycoord);
}
void EvasObject::checkVisible(const Eina_Bool isVisible)
WindowMoveTest()
: ElmTestHarness::ElmTestHarness()
, window_("WindowMoveTest", "Window Move Test")
+ , positions_()
+ , moveDone_(false)
{
return;
}
{
window_.show();
- queueStep(boost::bind(&Window::setPosition, boost::ref(window_), 10, 20));
- queueStep(boost::bind(&Window::checkPosition, boost::ref(window_), 10, 20));
- queueStep(boost::bind(&Window::setPosition, boost::ref(window_), 15, 25));
- queueStep(boost::bind(&Window::checkPosition, boost::ref(window_), 15, 25));
+ positions_.push_back(Position(10, 20));
+ positions_.push_back(Position(15, 25));
+
+ evas_object_event_callback_add(window_, EVAS_CALLBACK_MOVE, &onMove, this);
+
+ nextPosition();
+ }
+
+ static void onMove(void *data, Evas*, Evas_Object*, void*)
+ {
+ WindowMoveTest *test = static_cast<WindowMoveTest*>(data);
+ test->moveDone_ = true;
+ }
+
+ void nextPosition() {
+ moveDone_ = false;
+ if (not positions_.empty()) {
+ Position position(positions_.front());
+ positions_.pop_front();
+ queueStep(boost::bind(&Window::setPosition, boost::ref(window_), position.first, position.second));
+ queueStep(boost::bind(&WindowMoveTest::checkPosition, boost::ref(*this), position.first, position.second, 20));
+ }
+ }
+
+ void checkPosition(int x, int y, unsigned tries)
+ {
+ if (not moveDone_) {
+ ASSERT_MSG(tries != 0,
+ "failed to get EVAS_CALLBACK_MOVE event ("
+ << x << ","
+ << y << ")"
+ );
+ queueStep(boost::bind(&WindowMoveTest::checkPosition, boost::ref(*this), x, y, --tries));
+ } else {
+ window_.checkPosition(x, y);
+ checkServerPosition(Geometry(), 2);
+ }
+ }
+
+ void checkServerPosition(Geometry geometry, unsigned tries) {
+ bool positionMatch(
+ window_.getX() == geometry.x
+ and window_.getY() == geometry.y);
+
+ if (not positionMatch) {
+ ASSERT_MSG(tries != 0, ""
+ << "client position ("
+ << window_.getX() << ","
+ << window_.getY() << ") != "
+ << "server position ("
+ << geometry.x << ","
+ << geometry.y << ")"
+ );
+ GeometryCallback cb = boost::bind(&WindowMoveTest::checkServerPosition, boost::ref(*this), _1, --tries);
+ getSurfaceGeometry(elm_win_wl_window_get(window_)->surface, cb);
+ } else {
+ FAIL_UNLESS(positionMatch);
+ nextPosition();
+ }
}
private:
- Window window_;
+ typedef std::pair<int, int> Position;
+ typedef std::deque<Position> Positions;
+
+ Window window_;
+ Positions positions_;
+ bool moveDone_;
};
class WindowIconifyTest : public ElmTestHarness