EFL: aggressive refactor of actionslider test
authorJoe Konno <joe.konno@intel.com>
Thu, 19 Jul 2012 23:18:58 +0000 (16:18 -0700)
committerJoe Konno <joe.konno@intel.com>
Thu, 19 Jul 2012 23:20:37 +0000 (16:20 -0700)
Utilize EvasObject utility macros. Remove the Actionslider class as there is
not a compelling reason to "objectify" the Actionslider control. Should ease
maintenance down the road.

Signed-off-by: Joe Konno <joe.konno@intel.com>
src/efl/Makefile.am
src/efl/actionslider.cpp [deleted file]
src/efl/actionslider.h [deleted file]
src/efl/test_actionslider.cpp
src/efl/test_dayselector.cpp
src/efl/test_entry.cpp
src/efl/test_fileselector.cpp
src/efl/test_fileselector_button.cpp
src/efl/test_fileselector_entry.cpp

index 57bcced..e20c19f 100644 (file)
@@ -24,7 +24,6 @@ LDFLAGS +=                    \
 bin_PROGRAMS = $(TESTS)
 
 wayland_efl_test_SOURCES =             \
-       actionslider.cpp                \
        application.cpp                 \
        background.cpp                  \
        elmtestharness.cpp              \
diff --git a/src/efl/actionslider.cpp b/src/efl/actionslider.cpp
deleted file mode 100644 (file)
index 66a407e..0000000
+++ /dev/null
@@ -1,38 +0,0 @@
-#include "actionslider.h"
-
-Actionslider::Actionslider(Evas_Object *parent, const std::string& left, const bool leftOn, const std::string& center, const bool centerOn, const std::string& right, const bool rightOn)
-       : EvasObject::EvasObject(
-               elm_actionslider_add(parent)
-       )
-       , parent(parent)
-{
-       elm_object_part_text_set(*this, "left", left.c_str());
-       elm_object_part_text_set(*this, "center", center.c_str());
-       elm_object_part_text_set(*this, "right", right.c_str());
-
-       unsigned int posEnabled = ELM_ACTIONSLIDER_NONE;
-       if (leftOn)
-       {
-               posEnabled |= ELM_ACTIONSLIDER_LEFT;
-       }
-       if (centerOn)
-       {
-               posEnabled |= ELM_ACTIONSLIDER_CENTER;
-       }
-       if (rightOn)
-       {
-               posEnabled |= ELM_ACTIONSLIDER_RIGHT;
-       }
-       elm_actionslider_enabled_pos_set(*this, static_cast<Elm_Actionslider_Pos>(posEnabled));
-}
-
-void Actionslider::setPos(Elm_Actionslider_Pos pos)
-{
-       elm_actionslider_indicator_pos_set(*this, pos);
-}
-
-Elm_Actionslider_Pos Actionslider::getPos()
-{
-       return elm_actionslider_indicator_pos_get(*this);
-}
-
diff --git a/src/efl/actionslider.h b/src/efl/actionslider.h
deleted file mode 100644 (file)
index a8b3f34..0000000
+++ /dev/null
@@ -1,23 +0,0 @@
-#ifndef __WAYLAND_EFL_ACTIONSLIDER_H__
-#define __WAYLAND_EFL_ACTIONSLIDER_H__
-
-#include <string>
-#include <Elementary.h>
-
-#include "evasobject.h"
-
-class Actionslider : public EvasObject
-{
-public:
-       Actionslider(Evas_Object *, const std::string& = "Left", const bool = true, const std::string& = "Center", const bool = true, const std::string& = "Right", const bool = true);
-
-       void setPos(Elm_Actionslider_Pos pos);
-
-       Elm_Actionslider_Pos getPos();
-
-private:
-       Evas_Object *parent;
-};
-
-#endif
-
index 0048b48..2fd0bf8 100644 (file)
@@ -1,11 +1,14 @@
 #include <Elementary.h>
 #include <boost/bind.hpp>
 
+#include <vector>
+
 #include "window.h"
-#include "actionslider.h"
 #include "evasobject.h"
 #include "elmtestharness.h"
 
+using std::vector;
+
 class ActionsliderPosTest : public ElmTestHarness
 {
 public:
@@ -13,43 +16,46 @@ public:
        ActionsliderPosTest()
                : ElmTestHarness::ElmTestHarness()
                , window_("ActionsliderPosTest", "Actionslider Position Test")
-               , control_(window_)
+               , control_(elm_actionslider_add(window_))
        {
+               positions_.push_back(ELM_ACTIONSLIDER_LEFT);
+               positions_.push_back(ELM_ACTIONSLIDER_CENTER);
+               positions_.push_back(ELM_ACTIONSLIDER_LEFT);
+               positions_.push_back(ELM_ACTIONSLIDER_RIGHT);
+               positions_.push_back(ELM_ACTIONSLIDER_CENTER);
+
                return;
        }
 
        void setup()
        {
-               elm_win_resize_object_add(window_, control_);
-               window_.show();
-               control_.show();
-
-               const Elm_Actionslider_Pos position[] = {
-                                                         ELM_ACTIONSLIDER_LEFT,
-                                                         ELM_ACTIONSLIDER_CENTER,
-                                                         ELM_ACTIONSLIDER_RIGHT
-                                                       };
-
-               unsigned int p;
-               for (p = 0; p < (sizeof(position) / sizeof(Elm_Actionslider_Pos)); p++)
+               SET_CHECK_SHOW(window_);
+               SET_CHECK_SHOW(control_);
+
+               control_.setSize(200, 100);
+               control_.setPosition(50, 10);
+
+               vector<Elm_Actionslider_Pos>::iterator it;
+               for (it = positions_.begin(); it != positions_.end(); it++)
                {
                        queueCallback(
                                ModifyCheckCallback(
-                                       boost::bind(&Actionslider::setPos, boost::ref(control_), position[p]),
-                                       boost::bind(&ActionsliderPosTest::checkPos, boost::ref(*this), position[p])
+                                       boost::bind(elm_actionslider_indicator_pos_set, boost::ref(control_), *it),
+                                       boost::bind(&ActionsliderPosTest::checkPos, boost::ref(*this), *it)
                                )
                        );
                }
        }
 
-       void checkPos(Elm_Actionslider_Pos pos)
+       void checkPos(const Elm_Actionslider_Pos expected)
        {
-               BOOST_CHECK_EQUAL(control_.getPos(), pos);
+               BOOST_CHECK_EQUAL(elm_actionslider_indicator_pos_get(control_), expected);
        }
 
 private:
-       Window          window_;
-       Actionslider    control_;
+       Window                          window_;
+       EvasObject                      control_;
+       vector<Elm_Actionslider_Pos>    positions_;
 };
 
 BOOST_AUTO_TEST_SUITE(EFL)
index a6445d8..55bc967 100644 (file)
@@ -4,7 +4,6 @@
 #include <vector>
 
 #include "window.h"
-#include "actionslider.h"
 #include "evasobject.h"
 #include "elmtestharness.h"
 
index 3710081..4268f4d 100644 (file)
@@ -5,7 +5,6 @@
 #include <string>
 
 #include "window.h"
-#include "actionslider.h"
 #include "evasobject.h"
 #include "elmtestharness.h"
 
index 251f97e..f22e045 100644 (file)
@@ -4,7 +4,6 @@
 #include <vector>
 
 #include "window.h"
-#include "actionslider.h"
 #include "evasobject.h"
 #include "elmtestharness.h"
 
index 93b2f30..c388b8d 100644 (file)
@@ -4,7 +4,6 @@
 #include <vector>
 
 #include "window.h"
-#include "actionslider.h"
 #include "evasobject.h"
 #include "elmtestharness.h"
 
index 5449c54..26d8df2 100644 (file)
@@ -4,7 +4,6 @@
 #include <vector>
 
 #include "window.h"
-#include "actionslider.h"
 #include "evasobject.h"
 #include "elmtestharness.h"