EFL: minor refactor of EvasObject
authorJoe Konno <joe.konno@intel.com>
Thu, 19 Jul 2012 22:34:19 +0000 (15:34 -0700)
committerJoe Konno <joe.konno@intel.com>
Thu, 19 Jul 2012 22:34:19 +0000 (15:34 -0700)
Const-ness, as well as some utility methods we could re-use in our test
callbacks.

Signed-off-by: Joe Konno <joe.konno@intel.com>
src/efl/evasobject.cpp
src/efl/evasobject.h

index c697888..65c8180 100644 (file)
@@ -1,6 +1,7 @@
 #include <Ecore_Evas.h>
 
 #include "evasobject.h"
+#include "application.h"
 
 EvasObject::EvasObject(Evas_Object* o)
        : obj_(o)
@@ -47,21 +48,21 @@ void EvasObject::show()
        evas_object_show(*this);
 }
 
-int EvasObject::getX()
+const int EvasObject::getX()
 {
        int x;
        evas_object_geometry_get(*this, &x, NULL, NULL, NULL);
        return x;
 }
 
-int EvasObject::getY()
+const int EvasObject::getY()
 {
        int y;
        evas_object_geometry_get(*this, NULL, &y, NULL, NULL);
        return y;
 }
 
-int EvasObject::getWidth()
+const int EvasObject::getWidth()
 {
        int w;
        evas_object_geometry_get(*this, NULL, NULL, &w, NULL);
@@ -69,10 +70,27 @@ int EvasObject::getWidth()
        return w;
 }
 
-int EvasObject::getHeight()
+const int EvasObject::getHeight()
 {
        int h;
        evas_object_geometry_get(*this, NULL, NULL, NULL, &h);
 //     evas_output_size_get(*this, NULL, &h);
        return h;
 }
+
+void EvasObject::checkSize(const int width, const int height)
+{
+       BOOST_CHECK_EQUAL(getWidth(), width);
+       BOOST_CHECK_EQUAL(getHeight(), height);
+}
+
+void EvasObject::checkPosition(const int xcoord, const int ycoord)
+{
+       BOOST_CHECK_EQUAL(getX(), xcoord);
+       BOOST_CHECK_EQUAL(getY(), ycoord);
+}
+
+void EvasObject::checkVisible(const Eina_Bool isVisible)
+{
+       BOOST_CHECK_EQUAL(evas_object_visible_get(*this), isVisible);
+}
index 871cefa..e232faa 100644 (file)
@@ -12,17 +12,22 @@ public:
        void setPosition(int x, int y);
        void show();
 
-       int getWidth();
-       int getHeight();
-       int getX();
-       int getY();
+       const int getWidth();
+       const int getHeight();
+       const int getX();
+       const int getY();
 
        operator Evas*();
        operator Ecore_Evas*();
        operator Evas_Object*();
 
+       void checkSize(const int width, const int height);
+       void checkPosition(const int x, const int y);
+       void checkVisible(const Eina_Bool isVisible);
+
 private:
        Evas_Object*    obj_;
+
 };