fix get width/height to query evas_output_size instead of geometry; some cleanup
authorU. Artie Eoff <ullysses.a.eoff@intel.com>
Wed, 30 May 2012 20:05:44 +0000 (13:05 -0700)
committerU. Artie Eoff <ullysses.a.eoff@intel.com>
Wed, 30 May 2012 20:05:44 +0000 (13:05 -0700)
Signed-off-by: U. Artie Eoff <ullysses.a.eoff@intel.com>
src/efl/application.cpp
src/efl/test_engine_set.cpp
src/efl/test_window_size.cpp
src/efl/window.cpp
src/efl/window.h

index 9f49306..e29217e 100644 (file)
@@ -21,7 +21,7 @@ Application::~Application()
 
 void Application::setEngine(const Engine& engine)
 {
-       std::string strEngine = "software_x11";
+       std::string strEngine;
        switch (engine) {
                case ENGINE_EGL:
                        strEngine = "wayland_egl";
index 1ce844b..eea0c32 100644 (file)
@@ -3,20 +3,34 @@
 
 BOOST_AUTO_TEST_CASE(elm_engine_set_wayland_shm)
 {
+       const std::string engine("wayland_shm");
+
+       BOOST_MESSAGE("engine=" << engine);
+
        elm_init(
                boost::unit_test::framework::master_test_suite().argc,
                boost::unit_test::framework::master_test_suite().argv
        );
-       elm_config_engine_set("wayland_shm");
-       BOOST_CHECK_EQUAL("wayland_shm", elm_config_engine_get());
+
+       elm_config_preferred_engine_set(engine.c_str()); // override's ELM_ENGINE user environment setting
+       elm_config_engine_set(engine.c_str());
+       BOOST_CHECK_EQUAL(engine, std::string(elm_config_preferred_engine_get()));
+       BOOST_CHECK_EQUAL(engine, std::string(elm_config_engine_get()));
 }
 
 BOOST_AUTO_TEST_CASE(elm_engine_set_wayland_egl)
 {
+       const std::string engine("wayland_egl");
+
+       BOOST_MESSAGE("engine=" << engine);
+
        elm_init(
                boost::unit_test::framework::master_test_suite().argc,
                boost::unit_test::framework::master_test_suite().argv
        );
-       elm_config_engine_set("wayland_egl");
-       BOOST_CHECK_EQUAL("wayland_egl", elm_config_engine_get());
+
+       elm_config_preferred_engine_set(engine.c_str()); // override's ELM_ENGINE user environment setting
+       elm_config_engine_set(engine.c_str());
+       BOOST_CHECK_EQUAL(engine, std::string(elm_config_preferred_engine_get()));
+       BOOST_CHECK_EQUAL(engine, std::string(elm_config_engine_get()));
 }
index a32f019..bd47849 100644 (file)
@@ -11,11 +11,11 @@ BOOST_AUTO_TEST_CASE(efl_window_size_shm)
        app.setEngine(Application::ENGINE_SHM);
        Window win("shm-size", "SHM Size");
        win.setSize(400, 400);
-       win.setPosition(0, 0);
+       win.setPosition(100, 100);
        win.show();
 
        app.yield();
-
+//     app.mainLoop();
        BOOST_CHECK_EQUAL(win.getWidth(), 400);
        BOOST_CHECK_EQUAL(win.getHeight(), 400);
 }
index b5ef373..5be51a6 100644 (file)
@@ -1,5 +1,6 @@
 #include <Elementary.h>
 
+#include "../test.h"
 #include "window.h"
 
 Window::Window(const std::string& name, const std::string& title)
@@ -13,31 +14,62 @@ Window::~Window()
        win_ = NULL;
 }
 
+Window::operator Evas*()
+{
+       return evas_object_evas_get(*this);
+}
+
+Window::operator Ecore_Evas*()
+{
+       return ecore_evas_object_ecore_evas_get(*this);
+}
+
+Window::operator Evas_Object*()
+{
+       return win_;
+}
+
 void Window::setSize(int w, int h)
 {
-       evas_object_resize(win_, w, h);
+       evas_object_resize(*this, w, h);
 }
 
 void Window::setPosition(int x, int y)
 {
-       evas_object_move(win_, x, y);
+       evas_object_move(*this, x, y);
 }
 
 void Window::show()
 {
-       evas_object_show(win_);
+       evas_object_show(*this);
+}
+
+int Window::getX()
+{
+       int x;
+       evas_object_geometry_get(*this, &x, NULL, NULL, NULL);
+       return x;
+}
+
+int Window::getY()
+{
+       int y;
+       evas_object_geometry_get(*this, NULL, &y, NULL, NULL);
+       return y;
 }
 
 int Window::getWidth()
 {
-       int x, y, w, h;
-       evas_object_geometry_get(win_, &x, &y, &w, &h);
+       int w;
+//     evas_object_geometry_get(*this, NULL, NULL, &w, NULL);
+       evas_output_size_get(*this, &w, NULL);
        return w;
 }
 
 int Window::getHeight()
 {
-       int x, y, w, h;
-       evas_object_geometry_get(win_, &x, &y, &w, &h);
+       int h;
+//     evas_object_geometry_get(*this, NULL, NULL, NULL, &h);
+       evas_output_size_get(*this, NULL, &h);
        return h;
 }
index b2beb98..acfb7e6 100644 (file)
@@ -3,8 +3,6 @@
 
 #include <string>
 
-// typename Evas_Object;
-
 class Window
 {
 public:
@@ -17,7 +15,13 @@ public:
 
        int getWidth();
        int getHeight();
+       int getX();
+       int getY();
 private:
+       operator Evas*();
+       operator Ecore_Evas*();
+       operator Evas_Object*();
+
        Evas_Object*    win_;
 };