From 38d1aa00e67a99166a7526dec50a72c0d89f4d5f Mon Sep 17 00:00:00 2001 From: Joe Konno Date: Mon, 9 Jul 2012 12:36:46 -0700 Subject: [PATCH] EFL: Some bubble widget tests Signed-off-by: Joe Konno --- src/efl/Makefile.am | 1 + src/efl/test_bubble.cpp | 103 ++++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 104 insertions(+) create mode 100644 src/efl/test_bubble.cpp diff --git a/src/efl/Makefile.am b/src/efl/Makefile.am index 36e37ab..20fed76 100644 --- a/src/efl/Makefile.am +++ b/src/efl/Makefile.am @@ -35,6 +35,7 @@ wayland_efl_test_SOURCES = \ test_engine_set.cpp \ test_actionslider.cpp \ test_background.cpp \ + test_bubble.cpp \ ../testmain.cpp endif diff --git a/src/efl/test_bubble.cpp b/src/efl/test_bubble.cpp new file mode 100644 index 0000000..80d68d4 --- /dev/null +++ b/src/efl/test_bubble.cpp @@ -0,0 +1,103 @@ +#include +#include + +#include "window.h" +#include "evasobject.h" +#include "elmtestharness.h" + +class BubblePosTest : public ElmTestHarness +{ +public: + + BubblePosTest() + : ElmTestHarness::ElmTestHarness() + , window_("BubblePosTest", "Bubble Position Test") + , bubble_(elm_bubble_add(window_)) + { + evas_object_resize(bubble_, 200, 100); + return; + } + + void setup() + { + window_.show(); + evas_object_show(bubble_); + + Elm_Bubble_Pos pos[] = { ELM_BUBBLE_POS_TOP_LEFT, + ELM_BUBBLE_POS_TOP_RIGHT, + ELM_BUBBLE_POS_TOP_LEFT, + ELM_BUBBLE_POS_BOTTOM_LEFT, + ELM_BUBBLE_POS_TOP_LEFT, + ELM_BUBBLE_POS_BOTTOM_RIGHT, + ELM_BUBBLE_POS_TOP_LEFT + }; + + for (int i = 0; i < (sizeof(pos) / sizeof(int)); ++i) + { + queueCallback( + ModifyCheckCallback( + boost::bind(&elm_bubble_pos_set, boost::ref(bubble_), pos[i]), + boost::bind(&BubblePosTest::checkPos, boost::ref(*this), pos[i]) + ) + ); + } + } + + void checkPos(Elm_Bubble_Pos pos) + { + BOOST_CHECK_EQUAL(elm_bubble_pos_get(bubble_), pos); + } + +private: + Window window_; + EvasObject bubble_; +}; + +class BubbleTextTest : public ElmTestHarness +{ +public: + + BubbleTextTest() + : ElmTestHarness::ElmTestHarness() + , window_("BubbleTextTest", "Bubble Text Test") + , bubble_(elm_bubble_add(window_)) + { + evas_object_resize(bubble_, 200, 100); + return; + } + + void setup() + { + evas_object_show(bubble_); + window_.show(); + + std::string def[2] = { "default", "DEFAULT" }; + + queueCallback( + ModifyCheckCallback( + boost::bind(elm_object_part_text_set, boost::ref(bubble_), def[0].c_str(), def[1].c_str()), + boost::bind(&BubbleTextTest::checkText, boost::ref(*this), def[0], def[1]) + ) + ); + } + + void checkText(const std::string& part, const std::string& text) + { + const char* raw = elm_object_part_text_get(bubble_, part.c_str()); + std::string control(raw == NULL ? "" : raw); + + BOOST_CHECK_EQUAL(control, text); + } + +private: + Window window_; + EvasObject bubble_; +}; + +BOOST_AUTO_TEST_SUITE(Wayland_EFL_Bubble_Suite) + + WAYLAND_ELM_HARNESS_TEST_CASE(BubblePosTest) + WAYLAND_ELM_HARNESS_TEST_CASE(BubbleTextTest) + +BOOST_AUTO_TEST_SUITE_END() + -- 2.7.4