From 79ff3853d564fea225c2c16dc2f0f906a97f1c05 Mon Sep 17 00:00:00 2001 From: Joe Konno Date: Wed, 22 Aug 2012 11:06:47 -0700 Subject: [PATCH] EFL: Add Panel tests Signed-off-by: Joe Konno --- src/efl/Makefile.am | 1 + src/efl/test_panel.cpp | 135 +++++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 136 insertions(+) create mode 100644 src/efl/test_panel.cpp diff --git a/src/efl/Makefile.am b/src/efl/Makefile.am index 9c2eb23..d84b1bd 100644 --- a/src/efl/Makefile.am +++ b/src/efl/Makefile.am @@ -57,6 +57,7 @@ wayland_efl_test_SOURCES = \ test_map.cpp \ test_mapbuf.cpp \ test_notify.cpp \ + test_panel.cpp \ test_window.cpp \ ../test.cpp \ ../testmain.cpp diff --git a/src/efl/test_panel.cpp b/src/efl/test_panel.cpp new file mode 100644 index 0000000..7a85a45 --- /dev/null +++ b/src/efl/test_panel.cpp @@ -0,0 +1,135 @@ +#include + +#include "templates.h" + +class Panel : public EvasObject +{ +public: + Panel(EvasObject &parent) + : EvasObject::EvasObject(elm_panel_add(parent)) + { + } +}; + +class PanelOrientTest : public ElmTestHarness +{ +public: + PanelOrientTest() + : ElmTestHarness::ElmTestHarness() + , window_("PanelOrientTest", "Panel Orientation Test") + , control_(window_) + , content_(elm_label_add(window_)) + { + elm_object_text_set(content_, "Panel"); + elm_object_content_set(control_, content_); + + control_.setSize(200, 100); + control_.setPosition(50, 10); + + orients_.push_back(ELM_PANEL_ORIENT_TOP); + orients_.push_back(ELM_PANEL_ORIENT_BOTTOM); + orients_.push_back(ELM_PANEL_ORIENT_TOP); + orients_.push_back(ELM_PANEL_ORIENT_LEFT); + orients_.push_back(ELM_PANEL_ORIENT_TOP); + orients_.push_back(ELM_PANEL_ORIENT_RIGHT); + orients_.push_back(ELM_PANEL_ORIENT_TOP); + } + + void setup() + { + window_.show(); + content_.show(); + control_.show(); + + foreach (const Elm_Panel_Orient orient, orients_) + { + queueCallback( + ModifyCheckCallback( + boost::bind(elm_panel_orient_set, boost::ref(control_), orient), + boost::bind(&PanelOrientTest::checkOrient, boost::ref(*this), orient) + ) + ); + } + } + + void checkOrient(const Elm_Panel_Orient expected) + { + control_.show(); + FAIL_UNLESS_EQUAL(elm_panel_orient_get(control_), expected); + Application::yield(); + } + +private: + Window window_; + Panel control_; + EvasObject content_; + std::vector orients_; +}; + + +// TODO - PanelToggleTest - needs callbacks +class PanelToggleTest : public ElmTestHarness +{ +public: + PanelToggleTest() + : ElmTestHarness::ElmTestHarness() + , window_("PanelToggleTest", "Panel Toggle Test") + , control_(window_) + , content_(elm_label_add(window_)) + { + elm_object_text_set(content_, "Panel"); + elm_object_content_set(control_, content_); + + control_.setSize(200, 100); + control_.setPosition(50, 10); + } + + void setup() + { + window_.show(); + content_.show(); + control_.show(); + + queueCallback( + ModifyCheckCallback( + boost::bind(elm_panel_toggle, boost::ref(control_)), + boost::bind(&EvasObject::checkVisible, boost::ref(control_), EINA_FALSE) + ) + ); + + queueCallback( + ModifyCheckCallback( + boost::bind(&PanelToggleTest::yield, boost::ref(*this)), + boost::bind(&PanelToggleTest::yield, boost::ref(*this)) + ) + ); + + queueCallback( + ModifyCheckCallback( + boost::bind(elm_panel_toggle, boost::ref(control_)), + boost::bind(&EvasObject::checkVisible, boost::ref(control_), EINA_TRUE) + ) + ); + } + + void yield(void) + { + Application::yield(); + } + +private: + Window window_; + Panel control_; + EvasObject content_; +}; + +typedef ResizeObjectTest PanelResizeTest; +typedef PositionObjectTest PanelPositionTest; +typedef VisibleObjectTest PanelVisibilityTest; + +WAYLAND_ELM_HARNESS_TEST_CASE(PanelResizeTest, "Panel") +WAYLAND_ELM_HARNESS_TEST_CASE(PanelPositionTest, "Panel") +WAYLAND_ELM_HARNESS_TEST_CASE(PanelVisibilityTest, "Panel") +WAYLAND_ELM_HARNESS_TEST_CASE(PanelOrientTest, "Panel") +//WAYLAND_ELM_HARNESS_TEST_CASE(PanelToggleTest, "Panel") + -- 2.7.4