efl: split up test_window tests into separate files.
authorU. Artie Eoff <ullysses.a.eoff@intel.com>
Thu, 21 Mar 2013 20:18:03 +0000 (13:18 -0700)
committerU. Artie Eoff <ullysses.a.eoff@intel.com>
Thu, 21 Mar 2013 20:18:03 +0000 (13:18 -0700)
Signed-off-by: U. Artie Eoff <ullysses.a.eoff@intel.com>
src/common/harness.h
src/common/util.h [new file with mode: 0644]
src/efl/Makefile.am
src/efl/evasobject.cpp
src/efl/evasobject.h
src/efl/test_window.cpp
src/efl/test_window_maximize.cpp [new file with mode: 0644]
src/efl/test_window_move.cpp [new file with mode: 0644]
src/efl/test_window_resize.cpp [new file with mode: 0644]

index 6c74969..d8568f4 100644 (file)
@@ -1,10 +1,10 @@
 #ifndef __WFITS_COMMON_HARNESS_H__
 #define __WFITS_COMMON_HARNESS_H__
 
-#include <boost/function.hpp>
-#include <boost/bind.hpp>
 #include <deque>
 
+#include "util.h"
+
 class TestHarness
 {
 public:
diff --git a/src/common/util.h b/src/common/util.h
new file mode 100644 (file)
index 0000000..4ac66b7
--- /dev/null
@@ -0,0 +1,14 @@
+#ifndef __WFITS_COMMON_UTIL_H__
+#define __WFITS_COMMON_UTIL_H__
+
+#include <boost/format.hpp>
+#include <boost/function.hpp>
+#include <boost/bind.hpp>
+#include <boost/lambda/lambda.hpp>
+#include <boost/lambda/bind.hpp>
+
+boost::lambda::placeholder1_type _1_;
+boost::lambda::placeholder2_type _2_;
+boost::lambda::placeholder3_type _3_;
+
+#endif
index fb08a82..7938286 100644 (file)
@@ -44,6 +44,9 @@ libwfits_efl_la_SOURCES = \
        test_popup.cpp                  \
        test_progressbar.cpp            \
        test_window.cpp                 \
+       test_window_resize.cpp          \
+       test_window_move.cpp            \
+       test_window_maximize.cpp        \
        $(top_srcdir)/src/extensions/protocol/wayland-fits-protocol.c
 
 libwfits_efl_la_LIBADD = \
index 11efa08..607e2c3 100644 (file)
@@ -1,5 +1,3 @@
-#include <Evas.h>
-
 #include "evasobject.h"
 #include "common/test.h"
 
index 1cf10dd..3ea8bdc 100644 (file)
@@ -1,6 +1,8 @@
 #ifndef __WAYLAND_EFL_EVAS_OBJECT_H__
 #define __WAYLAND_EFL_EVAS_OBJECT_H__
 
+#include <Evas.h>
+
 class EvasObject
 {
 public:
index 780d7b4..2d29a58 100644 (file)
@@ -1,13 +1,3 @@
-#include <Elementary.h>
-#include <boost/format.hpp>
-#include <boost/bind.hpp>
-#include <boost/lambda/lambda.hpp>
-#include <boost/lambda/bind.hpp>
-
-boost::lambda::placeholder1_type _1_;
-boost::lambda::placeholder2_type _2_;
-boost::lambda::placeholder3_type _3_;
-
 #include <vector>
 
 #include "window.h"
@@ -15,13 +5,12 @@ boost::lambda::placeholder3_type _3_;
 
 using std::vector;
 
-class WindowResizeTest : public ElmTestHarness
+class WindowFullscreenTest : public ElmTestHarness
 {
 public:
-       WindowResizeTest()
+       WindowFullscreenTest()
                : ElmTestHarness::ElmTestHarness()
-               , window_("WindowResizeTest", "Window Resize Test")
-               , resizeDone_(false)
+               , window_("WindowFullscreenTest", "Window Fullscreen Test")
        {
                return;
        }
@@ -30,176 +19,14 @@ public:
        {
                window_.show();
 
-               // This will flush out the window titlebar animation.
-               // However, this is highly dependent on the default animation
-               // and if that changes, then this may not work.  But currently
-               // 20 yields seems to do the trick.
-               for (unsigned i(0); i < 20; ++i)
-                       queueStep(boost::bind(&Application::yield, 0.001*1e6));
-
-               addResizeTest(-10, -10);
-               addResizeTest(-1, 10);
-               addResizeTest(10, -1);
-               addResizeTest(0, 0);
-
-               for (int w(1); w <= 400; w += 89)
-                       for (int h(3); h <= 400; h += 91)
-                               addResizeTest(w, h);
-
-               addResizeTest(3000, 3000);
-
-               evas_object_event_callback_add(window_, EVAS_CALLBACK_RESIZE, &onResize, this);
-       }
-
-       void addResizeTest(int width, int height)
-       {
-               queueStep(
-                       boost::lambda::bind(
-                               &WindowResizeTest::resizeDone_,
-                               boost::ref(*this)
-                       ) = false
-               );
-               queueStep(
-                       boost::bind(
-                               &Window::setSize,
-                               boost::ref(window_),
-                               width,
-                               height
-                       ),
-                       boost::str(
-                               boost::format("resizing to %1% x %2%") % width % height
-                       )
-               );
-               queueStep(
-                       boost::bind(
-                               &WindowResizeTest::stepUntilCondition,
-                               boost::ref(*this),
-                               boost::lambda::bind(&WindowResizeTest::resizeDone_, boost::ref(*this))
-                       ),
-                       "checking resize event"
-               );
-               queueStep(
-                       boost::bind(
-                               &WindowResizeTest::assertCondition,
-                               boost::ref(*this),
-                               boost::lambda::bind(&Window::getWidth, boost::ref(window_)) == std::max(1, width)
-                               and boost::lambda::bind(&Window::getHeight, boost::ref(window_)) == std::max(1, height)
-                       ),
-                       "checking client size"
-               );
-               queueStep(
-                       boost::bind(
-                               &WindowResizeTest::stepUntilCondition,
-                               boost::ref(*this),
-                               boost::lambda::bind(&WindowResizeTest::serverSizeIsEqual, boost::ref(*this))
-                       ),
-                       "checking server size"
-               );
-       }
-
-       static void onResize(void *data, Evas*, Evas_Object*, void*)
-       {
-               WindowResizeTest *test = static_cast<WindowResizeTest*>(data);
-               test->resizeDone_ = true;
-       }
-
-       bool serverSizeIsEqual()
-       {
-               Geometry geometry(getSurfaceGeometry(window_.get_wl_surface()));
-               
-               return window_.getWidth() == geometry.width
-                       and window_.getHeight() == geometry.height;
+               queueStep(boost::bind(&Window::fullscreen, boost::ref(window_), EINA_TRUE));
+               queueStep(boost::bind(&Window::checkFullscreen, boost::ref(window_), EINA_TRUE));
+               queueStep(boost::bind(&Window::fullscreen, boost::ref(window_), EINA_FALSE));
+               queueStep(boost::bind(&Window::checkFullscreen, boost::ref(window_), EINA_FALSE));
        }
 
 private:
        Window  window_;
-       bool    resizeDone_;
-};
-
-class WindowMoveTest : public ElmTestHarness
-{
-public:
-       WindowMoveTest()
-               : ElmTestHarness::ElmTestHarness()
-               , window_("WindowMoveTest", "Window Move Test")
-               , positions_()
-               , moveDone_(false)
-       {
-               return;
-       }
-
-       void setup()
-       {
-               window_.show();
-
-               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(2);
-               }
-       }
-
-       void checkServerPosition(unsigned tries) {
-               Geometry geometry(getSurfaceGeometry(elm_win_wl_window_get(window_)->surface));
-               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 << ")"
-                       );
-                       queueStep(boost::bind(&WindowMoveTest::checkServerPosition, boost::ref(*this), --tries));
-               } else {
-                       FAIL_UNLESS(positionMatch);
-                       nextPosition();
-               }
-       }
-
-private:
-       typedef std::pair<int, int> Position;
-       typedef std::deque<Position> Positions;
-
-       Window          window_;
-       Positions       positions_;
-       bool            moveDone_;
 };
 
 class WindowIconifyTest : public ElmTestHarness
@@ -226,262 +53,6 @@ private:
        Window  window_;
 };
 
-class WindowMaximizeTest : public ElmTestHarness
-{
-public:
-       WindowMaximizeTest()
-               : ElmTestHarness::ElmTestHarness()
-               , window_("WindowMaximizeTest", "Window Maximize Test")
-               , geometry_()
-               , isMaximized_(false)
-               , configureDone_(false)
-               , resizeDone_(false)
-       {
-               return;
-       }
-
-       void setup()
-       {
-               window_.show();
-               Application::yield(0.01*1e6);
-               geometry_ = getSurfaceGeometry(window_.get_wl_surface());
-               std::cout << "...initial server geometry is: "
-                       << geometry_.x << " "
-                       << geometry_.y << " "
-                       << geometry_.width << " "
-                       << geometry_.height << std::endl;
-
-               evas_object_smart_callback_add(window_, "maximized", onMaximize, this);
-               evas_object_smart_callback_add(window_, "unmaximized", onUnMaximize, this);
-               evas_object_event_callback_add(window_, EVAS_CALLBACK_RESIZE, &onResize, this);
-               ecore_event_handler_add(ECORE_WL_EVENT_WINDOW_CONFIGURE, onConfigure, this);
-
-               for(unsigned i(0); i < 5; ++i)
-                       addMaximizeTest();
-       }
-
-       void addMaximizeTest()
-       {
-               // Maximize
-               queueStep(
-                       boost::lambda::bind(
-                               &WindowMaximizeTest::isMaximized_,
-                               boost::ref(*this)
-                       ) = false
-               );
-               queueStep(
-                       boost::lambda::bind(
-                               &WindowMaximizeTest::configureDone_,
-                               boost::ref(*this)
-                       ) = false
-               );
-               queueStep(
-                       boost::lambda::bind(
-                               &WindowMaximizeTest::resizeDone_,
-                               boost::ref(*this)
-                       ) = false
-               );
-               queueStep(
-                       boost::bind(
-                               &Window::maximize, boost::ref(window_),
-                               EINA_TRUE
-                       ),
-                       "maximizing window"
-               );
-               queueStep(
-                       boost::bind(
-                               &WindowMaximizeTest::stepUntilCondition,
-                               boost::ref(*this),
-                               boost::lambda::bind(&WindowMaximizeTest::isMaximized_, boost::ref(*this))
-                       ),
-                       "checking maximized event"
-               );
-               queueStep(
-                       boost::bind(
-                               &WindowMaximizeTest::stepUntilCondition,
-                               boost::ref(*this),
-                               boost::lambda::bind(&WindowMaximizeTest::configureDone_, boost::ref(*this))
-                       ),
-                       "checking configure event"
-               );
-               queueStep(
-                       boost::bind(
-                               &WindowMaximizeTest::stepUntilCondition,
-                               boost::ref(*this),
-                               boost::lambda::bind(&WindowMaximizeTest::resizeDone_, boost::ref(*this))
-                       ),
-                       "checking resize event"
-               );
-               queueStep(
-                       boost::bind(
-                               &WindowMaximizeTest::stepUntilCondition,
-                               boost::ref(*this),
-                               boost::lambda::bind(&Window::getWidth, boost::ref(window_)) > geometry_.width
-                               and boost::lambda::bind(&Window::getHeight, boost::ref(window_)) > geometry_.height
-                       ),
-                       "checking client size > initial server size"
-               );
-               queueStep(
-                       boost::bind(
-                               &WindowMaximizeTest::stepUntilCondition,
-                               boost::ref(*this),
-                               boost::lambda::bind(&WindowMaximizeTest::serverSizeIsEqual, boost::ref(*this))
-                       ),
-                       "checking client size == server size"
-               );
-
-               // UnMaximize
-               queueStep(
-                       boost::lambda::bind(
-                               &WindowMaximizeTest::configureDone_,
-                               boost::ref(*this)
-                       ) = false
-               );
-               queueStep(
-                       boost::lambda::bind(
-                               &WindowMaximizeTest::resizeDone_,
-                               boost::ref(*this)
-                       ) = false
-               );
-               queueStep(
-                       boost::bind(
-                               &Window::maximize, boost::ref(window_),
-                               EINA_FALSE
-                       ),
-                       "unmaximizing window"
-               );
-               queueStep(
-                       boost::bind(
-                               &WindowMaximizeTest::stepUntilCondition,
-                               boost::ref(*this),
-                               boost::lambda::bind(&WindowMaximizeTest::configureDone_, boost::ref(*this))
-                       ),
-                       "checking configure event"
-               );
-               queueStep(
-                       boost::bind(
-                               &WindowMaximizeTest::stepUntilCondition,
-                               boost::ref(*this),
-                               not boost::lambda::bind(&WindowMaximizeTest::isMaximized_, boost::ref(*this))
-                       ),
-                       "checking unmaximized event"
-               );
-               queueStep(
-                       boost::bind(
-                               &WindowMaximizeTest::stepUntilCondition,
-                               boost::ref(*this),
-                               boost::lambda::bind(&WindowMaximizeTest::resizeDone_, boost::ref(*this))
-                       ),
-                       "checking resize event"
-               );
-               queueStep(
-                       boost::bind(
-                               &WindowMaximizeTest::stepUntilCondition,
-                               boost::ref(*this),
-                               boost::lambda::bind(&Window::getWidth, boost::ref(window_)) == geometry_.width
-                               and boost::lambda::bind(&Window::getHeight, boost::ref(window_)) == geometry_.height
-                       ),
-                       "checking client size == initial server size"
-               );
-               queueStep(
-                       boost::bind(
-                               &WindowMaximizeTest::stepUntilCondition,
-                               boost::ref(*this),
-                               boost::lambda::bind(&WindowMaximizeTest::serverSizeIsEqual, boost::ref(*this))
-                       ),
-                       "checking client size == server size"
-               );
-               queueStep(
-                       boost::bind(
-                               &WindowMaximizeTest::serverGeometryIsInitial,
-                               boost::ref(*this)
-                       ),
-                       "checking server geometry == initial server geometry"
-               );
-       }
-
-       bool serverSizeIsEqual()
-       {
-               Geometry g(getSurfaceGeometry(window_.get_wl_surface()));
-
-               return window_.getWidth() == g.width
-                       and window_.getHeight() == g.height;
-       }
-
-       bool serverGeometryIsInitial()
-       {
-               Geometry g(getSurfaceGeometry(window_.get_wl_surface()));
-
-               return geometry_.x == g.x
-                       and geometry_.y == g.y
-                       and geometry_.width == g.width
-                       and geometry_.height == g.height;
-       }
-
-       static Eina_Bool onConfigure(void *data, int type, void *event)
-       {
-               WindowMaximizeTest *test = static_cast<WindowMaximizeTest*>(data);
-               test->configureDone_ = true;
-               Ecore_Wl_Event_Window_Configure *ev = static_cast<Ecore_Wl_Event_Window_Configure *>(event);
-
-               std::cout << "...got configure event: "
-                       << ev->x << " "
-                       << ev->y << " "
-                       << ev->w << " "
-                       << ev->h << std::endl;
-               return ECORE_CALLBACK_PASS_ON;
-       }
-
-       static void onResize(void *data, Evas*, Evas_Object*, void*)
-       {
-               WindowMaximizeTest *test = static_cast<WindowMaximizeTest*>(data);
-               test->resizeDone_ = true;
-       }
-
-       static void onMaximize(void* data, Evas_Object *obj, void* event_info)
-       {
-               WindowMaximizeTest *test = static_cast<WindowMaximizeTest*>(data);
-               test->isMaximized_ = EINA_TRUE;
-       }
-
-       static void onUnMaximize(void *data, Evas_Object*, void*)
-       {
-               WindowMaximizeTest *test = static_cast<WindowMaximizeTest*>(data);
-               test->isMaximized_ = EINA_FALSE;
-       }
-
-private:
-       Window          window_;
-       Geometry        geometry_;
-       bool            isMaximized_;
-       bool            configureDone_;
-       bool            resizeDone_;
-};
-
-class WindowFullscreenTest : public ElmTestHarness
-{
-public:
-       WindowFullscreenTest()
-               : ElmTestHarness::ElmTestHarness()
-               , window_("WindowFullscreenTest", "Window Fullscreen Test")
-       {
-               return;
-       }
-
-       void setup()
-       {
-               window_.show();
-
-               queueStep(boost::bind(&Window::fullscreen, boost::ref(window_), EINA_TRUE));
-               queueStep(boost::bind(&Window::checkFullscreen, boost::ref(window_), EINA_TRUE));
-               queueStep(boost::bind(&Window::fullscreen, boost::ref(window_), EINA_FALSE));
-               queueStep(boost::bind(&Window::checkFullscreen, boost::ref(window_), EINA_FALSE));
-       }
-
-private:
-       Window  window_;
-};
-
 class WindowStickyTest : public ElmTestHarness
 {
 public:
@@ -690,10 +261,7 @@ private:
        Window  window_;
 };
 
-WAYLAND_ELM_HARNESS_TEST_CASE(WindowResizeTest, "Window")
-WAYLAND_ELM_HARNESS_TEST_CASE(WindowMoveTest, "Window")
 WAYLAND_ELM_HARNESS_TEST_CASE(WindowIconifyTest, "Window")
-WAYLAND_ELM_HARNESS_TEST_CASE(WindowMaximizeTest, "Window")
 WAYLAND_ELM_HARNESS_TEST_CASE(WindowFullscreenTest, "Window")
 WAYLAND_ELM_HARNESS_TEST_CASE(WindowStickyTest, "Window")
 WAYLAND_ELM_HARNESS_TEST_CASE(WindowWithdrawnTest, "Window")
diff --git a/src/efl/test_window_maximize.cpp b/src/efl/test_window_maximize.cpp
new file mode 100644 (file)
index 0000000..ff7b136
--- /dev/null
@@ -0,0 +1,236 @@
+#include "window.h"
+#include "elmtestharness.h"
+
+class WindowMaximizeTest : public ElmTestHarness
+{
+public:
+       WindowMaximizeTest()
+               : ElmTestHarness::ElmTestHarness()
+               , window_("WindowMaximizeTest", "Window Maximize Test")
+               , geometry_()
+               , isMaximized_(false)
+               , configureDone_(false)
+               , resizeDone_(false)
+       {
+               return;
+       }
+
+       void setup()
+       {
+               window_.show();
+               Application::yield(0.01*1e6);
+               geometry_ = getSurfaceGeometry(window_.get_wl_surface());
+               std::cout << "...initial server geometry is: "
+                       << geometry_.x << " "
+                       << geometry_.y << " "
+                       << geometry_.width << " "
+                       << geometry_.height << std::endl;
+
+               evas_object_smart_callback_add(window_, "maximized", onMaximize, this);
+               evas_object_smart_callback_add(window_, "unmaximized", onUnMaximize, this);
+               evas_object_event_callback_add(window_, EVAS_CALLBACK_RESIZE, &onResize, this);
+               ecore_event_handler_add(ECORE_WL_EVENT_WINDOW_CONFIGURE, onConfigure, this);
+
+               for(unsigned i(0); i < 5; ++i)
+                       addMaximizeTest();
+       }
+
+       void addMaximizeTest()
+       {
+               // Maximize
+               queueStep(
+                       boost::lambda::bind(
+                               &WindowMaximizeTest::isMaximized_,
+                               boost::ref(*this)
+                       ) = false
+               );
+               queueStep(
+                       boost::lambda::bind(
+                               &WindowMaximizeTest::configureDone_,
+                               boost::ref(*this)
+                       ) = false
+               );
+               queueStep(
+                       boost::lambda::bind(
+                               &WindowMaximizeTest::resizeDone_,
+                               boost::ref(*this)
+                       ) = false
+               );
+               queueStep(
+                       boost::bind(
+                               &Window::maximize, boost::ref(window_),
+                               EINA_TRUE
+                       ),
+                       "maximizing window"
+               );
+               queueStep(
+                       boost::bind(
+                               &WindowMaximizeTest::stepUntilCondition,
+                               boost::ref(*this),
+                               boost::lambda::bind(&WindowMaximizeTest::isMaximized_, boost::ref(*this))
+                       ),
+                       "checking maximized event"
+               );
+               queueStep(
+                       boost::bind(
+                               &WindowMaximizeTest::stepUntilCondition,
+                               boost::ref(*this),
+                               boost::lambda::bind(&WindowMaximizeTest::configureDone_, boost::ref(*this))
+                       ),
+                       "checking configure event"
+               );
+               queueStep(
+                       boost::bind(
+                               &WindowMaximizeTest::stepUntilCondition,
+                               boost::ref(*this),
+                               boost::lambda::bind(&WindowMaximizeTest::resizeDone_, boost::ref(*this))
+                       ),
+                       "checking resize event"
+               );
+               queueStep(
+                       boost::bind(
+                               &WindowMaximizeTest::stepUntilCondition,
+                               boost::ref(*this),
+                               boost::lambda::bind(&Window::getWidth, boost::ref(window_)) > geometry_.width
+                               and boost::lambda::bind(&Window::getHeight, boost::ref(window_)) > geometry_.height
+                       ),
+                       "checking client size > initial server size"
+               );
+               queueStep(
+                       boost::bind(
+                               &WindowMaximizeTest::stepUntilCondition,
+                               boost::ref(*this),
+                               boost::lambda::bind(&WindowMaximizeTest::serverSizeIsEqual, boost::ref(*this))
+                       ),
+                       "checking client size == server size"
+               );
+
+               // UnMaximize
+               queueStep(
+                       boost::lambda::bind(
+                               &WindowMaximizeTest::configureDone_,
+                               boost::ref(*this)
+                       ) = false
+               );
+               queueStep(
+                       boost::lambda::bind(
+                               &WindowMaximizeTest::resizeDone_,
+                               boost::ref(*this)
+                       ) = false
+               );
+               queueStep(
+                       boost::bind(
+                               &Window::maximize, boost::ref(window_),
+                               EINA_FALSE
+                       ),
+                       "unmaximizing window"
+               );
+               queueStep(
+                       boost::bind(
+                               &WindowMaximizeTest::stepUntilCondition,
+                               boost::ref(*this),
+                               boost::lambda::bind(&WindowMaximizeTest::configureDone_, boost::ref(*this))
+                       ),
+                       "checking configure event"
+               );
+               queueStep(
+                       boost::bind(
+                               &WindowMaximizeTest::stepUntilCondition,
+                               boost::ref(*this),
+                               not boost::lambda::bind(&WindowMaximizeTest::isMaximized_, boost::ref(*this))
+                       ),
+                       "checking unmaximized event"
+               );
+               queueStep(
+                       boost::bind(
+                               &WindowMaximizeTest::stepUntilCondition,
+                               boost::ref(*this),
+                               boost::lambda::bind(&WindowMaximizeTest::resizeDone_, boost::ref(*this))
+                       ),
+                       "checking resize event"
+               );
+               queueStep(
+                       boost::bind(
+                               &WindowMaximizeTest::stepUntilCondition,
+                               boost::ref(*this),
+                               boost::lambda::bind(&Window::getWidth, boost::ref(window_)) == geometry_.width
+                               and boost::lambda::bind(&Window::getHeight, boost::ref(window_)) == geometry_.height
+                       ),
+                       "checking client size == initial server size"
+               );
+               queueStep(
+                       boost::bind(
+                               &WindowMaximizeTest::stepUntilCondition,
+                               boost::ref(*this),
+                               boost::lambda::bind(&WindowMaximizeTest::serverSizeIsEqual, boost::ref(*this))
+                       ),
+                       "checking client size == server size"
+               );
+               queueStep(
+                       boost::bind(
+                               &WindowMaximizeTest::serverGeometryIsInitial,
+                               boost::ref(*this)
+                       ),
+                       "checking server geometry == initial server geometry"
+               );
+       }
+
+       bool serverSizeIsEqual()
+       {
+               Geometry g(getSurfaceGeometry(window_.get_wl_surface()));
+
+               return window_.getWidth() == g.width
+                       and window_.getHeight() == g.height;
+       }
+
+       bool serverGeometryIsInitial()
+       {
+               Geometry g(getSurfaceGeometry(window_.get_wl_surface()));
+
+               return geometry_.x == g.x
+                       and geometry_.y == g.y
+                       and geometry_.width == g.width
+                       and geometry_.height == g.height;
+       }
+
+       static Eina_Bool onConfigure(void *data, int type, void *event)
+       {
+               WindowMaximizeTest *test = static_cast<WindowMaximizeTest*>(data);
+               test->configureDone_ = true;
+               Ecore_Wl_Event_Window_Configure *ev = static_cast<Ecore_Wl_Event_Window_Configure *>(event);
+
+               std::cout << "...got configure event: "
+                       << ev->x << " "
+                       << ev->y << " "
+                       << ev->w << " "
+                       << ev->h << std::endl;
+               return ECORE_CALLBACK_PASS_ON;
+       }
+
+       static void onResize(void *data, Evas*, Evas_Object*, void*)
+       {
+               WindowMaximizeTest *test = static_cast<WindowMaximizeTest*>(data);
+               test->resizeDone_ = true;
+       }
+
+       static void onMaximize(void* data, Evas_Object *obj, void* event_info)
+       {
+               WindowMaximizeTest *test = static_cast<WindowMaximizeTest*>(data);
+               test->isMaximized_ = EINA_TRUE;
+       }
+
+       static void onUnMaximize(void *data, Evas_Object*, void*)
+       {
+               WindowMaximizeTest *test = static_cast<WindowMaximizeTest*>(data);
+               test->isMaximized_ = EINA_FALSE;
+       }
+
+private:
+       Window          window_;
+       Geometry        geometry_;
+       bool            isMaximized_;
+       bool            configureDone_;
+       bool            resizeDone_;
+};
+
+WAYLAND_ELM_HARNESS_TEST_CASE(WindowMaximizeTest, "Window")
diff --git a/src/efl/test_window_move.cpp b/src/efl/test_window_move.cpp
new file mode 100644 (file)
index 0000000..613e541
--- /dev/null
@@ -0,0 +1,90 @@
+#include "window.h"
+#include "elmtestharness.h"
+
+class WindowMoveTest : public ElmTestHarness
+{
+public:
+       WindowMoveTest()
+               : ElmTestHarness::ElmTestHarness()
+               , window_("WindowMoveTest", "Window Move Test")
+               , positions_()
+               , moveDone_(false)
+       {
+               return;
+       }
+
+       void setup()
+       {
+               window_.show();
+
+               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(2);
+               }
+       }
+
+       void checkServerPosition(unsigned tries) {
+               Geometry geometry(getSurfaceGeometry(elm_win_wl_window_get(window_)->surface));
+               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 << ")"
+                       );
+                       queueStep(boost::bind(&WindowMoveTest::checkServerPosition, boost::ref(*this), --tries));
+               } else {
+                       FAIL_UNLESS(positionMatch);
+                       nextPosition();
+               }
+       }
+
+private:
+       typedef std::pair<int, int> Position;
+       typedef std::deque<Position> Positions;
+
+       Window          window_;
+       Positions       positions_;
+       bool            moveDone_;
+};
+
+WAYLAND_ELM_HARNESS_TEST_CASE(WindowMoveTest, "Window")
diff --git a/src/efl/test_window_resize.cpp b/src/efl/test_window_resize.cpp
new file mode 100644 (file)
index 0000000..83a6bb3
--- /dev/null
@@ -0,0 +1,105 @@
+#include "window.h"
+#include "elmtestharness.h"
+
+class WindowResizeTest : public ElmTestHarness
+{
+public:
+       WindowResizeTest()
+               : ElmTestHarness::ElmTestHarness()
+               , window_("WindowResizeTest", "Window Resize Test")
+               , resizeDone_(false)
+       {
+               return;
+       }
+
+       void setup()
+       {
+               window_.show();
+
+               // This will flush out the window titlebar animation.
+               // However, this is highly dependent on the default animation
+               // and if that changes, then this may not work.  But currently
+               // 20 yields seems to do the trick.
+               for (unsigned i(0); i < 20; ++i)
+                       queueStep(boost::bind(&Application::yield, 0.001*1e6));
+
+               addResizeTest(-10, -10);
+               addResizeTest(-1, 10);
+               addResizeTest(10, -1);
+               addResizeTest(0, 0);
+
+               for (int w(1); w <= 400; w += 89)
+                       for (int h(3); h <= 400; h += 91)
+                               addResizeTest(w, h);
+
+               addResizeTest(3000, 3000);
+
+               evas_object_event_callback_add(window_, EVAS_CALLBACK_RESIZE, &onResize, this);
+       }
+
+       void addResizeTest(int width, int height)
+       {
+               queueStep(
+                       boost::lambda::bind(
+                               &WindowResizeTest::resizeDone_,
+                               boost::ref(*this)
+                       ) = false
+               );
+               queueStep(
+                       boost::bind(
+                               &Window::setSize,
+                               boost::ref(window_),
+                               width,
+                               height
+                       ),
+                       boost::str(
+                               boost::format("resizing to %1% x %2%") % width % height
+                       )
+               );
+               queueStep(
+                       boost::bind(
+                               &WindowResizeTest::stepUntilCondition,
+                               boost::ref(*this),
+                               boost::lambda::bind(&WindowResizeTest::resizeDone_, boost::ref(*this))
+                       ),
+                       "checking resize event"
+               );
+               queueStep(
+                       boost::bind(
+                               &WindowResizeTest::assertCondition,
+                               boost::ref(*this),
+                               boost::lambda::bind(&Window::getWidth, boost::ref(window_)) == std::max(1, width)
+                               and boost::lambda::bind(&Window::getHeight, boost::ref(window_)) == std::max(1, height)
+                       ),
+                       "checking client size"
+               );
+               queueStep(
+                       boost::bind(
+                               &WindowResizeTest::stepUntilCondition,
+                               boost::ref(*this),
+                               boost::lambda::bind(&WindowResizeTest::serverSizeIsEqual, boost::ref(*this))
+                       ),
+                       "checking server size"
+               );
+       }
+
+       static void onResize(void *data, Evas*, Evas_Object*, void*)
+       {
+               WindowResizeTest *test = static_cast<WindowResizeTest*>(data);
+               test->resizeDone_ = true;
+       }
+
+       bool serverSizeIsEqual()
+       {
+               Geometry geometry(getSurfaceGeometry(window_.get_wl_surface()));
+
+               return window_.getWidth() == geometry.width
+                       and window_.getHeight() == geometry.height;
+       }
+
+private:
+       Window  window_;
+       bool    resizeDone_;
+};
+
+WAYLAND_ELM_HARNESS_TEST_CASE(WindowResizeTest, "Window")