From 5bc9b5171f61170fab7746ac08c79776aed0f4e3 Mon Sep 17 00:00:00 2001 From: Joe Konno Date: Wed, 18 Jul 2012 14:42:15 -0700 Subject: [PATCH] EFL: fileselector_button tests Signed-off-by: Joe Konno --- src/efl/Makefile.am | 37 +++--- src/efl/test_fileselector_button.cpp | 212 +++++++++++++++++++++++++++++++++++ 2 files changed, 231 insertions(+), 18 deletions(-) create mode 100644 src/efl/test_fileselector_button.cpp diff --git a/src/efl/Makefile.am b/src/efl/Makefile.am index 4e2a55b..13f0580 100644 --- a/src/efl/Makefile.am +++ b/src/efl/Makefile.am @@ -23,24 +23,25 @@ LDFLAGS += \ bin_PROGRAMS = $(TESTS) -wayland_efl_test_SOURCES = \ - actionslider.cpp \ - application.cpp \ - background.cpp \ - elmtestharness.cpp \ - evasobject.cpp \ - window.cpp \ - test_actionslider.cpp \ - test_background.cpp \ - test_bubble.cpp \ - test_button.cpp \ - test_check.cpp \ - test_clock.cpp \ - test_colorselector.cpp \ - test_dayselector.cpp \ - test_engine_set.cpp \ - test_entry.cpp \ - test_window.cpp \ +wayland_efl_test_SOURCES = \ + actionslider.cpp \ + application.cpp \ + background.cpp \ + elmtestharness.cpp \ + evasobject.cpp \ + window.cpp \ + test_actionslider.cpp \ + test_background.cpp \ + test_bubble.cpp \ + test_button.cpp \ + test_check.cpp \ + test_clock.cpp \ + test_colorselector.cpp \ + test_dayselector.cpp \ + test_engine_set.cpp \ + test_entry.cpp \ + test_fileselector_button.cpp \ + test_window.cpp \ ../testmain.cpp endif diff --git a/src/efl/test_fileselector_button.cpp b/src/efl/test_fileselector_button.cpp new file mode 100644 index 0000000..93b2f30 --- /dev/null +++ b/src/efl/test_fileselector_button.cpp @@ -0,0 +1,212 @@ +#include +#include + +#include + +#include "window.h" +#include "actionslider.h" +#include "evasobject.h" +#include "elmtestharness.h" + +using std::vector; + +class FileselectorButtonExpandableTest : public ElmTestHarness +{ +public: + + FileselectorButtonExpandableTest() + : ElmTestHarness::ElmTestHarness() + , window_("FileselectorButtonExpandableTest", "Fileselector Button Expandable Test") + , control_(elm_fileselector_button_add(window_)) + { + control_.setSize(100, 100); + control_.setPosition(50, 10); + + states_.push_back(EINA_TRUE); + states_.push_back(EINA_FALSE); + states_.push_back(EINA_TRUE); + + return; + } + + void setup() + { + window_.show(); + control_.show(); + + vector::iterator it; + for (it = states_.begin(); it != states_.end(); it++) + { + queueCallback( + ModifyCheckCallback( + boost::bind(elm_fileselector_button_expandable_set, boost::ref(control_), *it), + boost::bind(&FileselectorButtonExpandableTest::checkExpandable, boost::ref(*this), *it) + ) + ); + } + } + + void checkExpandable(const Eina_Bool expandable) + { + BOOST_CHECK_EQUAL(elm_fileselector_button_expandable_get(control_), expandable); + } + +private: + Window window_; + EvasObject control_; + vector states_; +}; + +class FileselectorButtonFolderOnlyTest : public ElmTestHarness +{ +public: + + FileselectorButtonFolderOnlyTest() + : ElmTestHarness::ElmTestHarness() + , window_("FileselectorButtonFolderOnlyTest", "Fileselector Button FolderOnly Test") + , control_(elm_fileselector_button_add(window_)) + { + control_.setSize(100, 100); + control_.setPosition(50, 10); + + states_.push_back(EINA_TRUE); + states_.push_back(EINA_FALSE); + states_.push_back(EINA_TRUE); + + return; + } + + void setup() + { + window_.show(); + control_.show(); + + vector::iterator it; + for (it = states_.begin(); it != states_.end(); it++) + { + queueCallback( + ModifyCheckCallback( + boost::bind(elm_fileselector_button_folder_only_set, boost::ref(control_), *it), + boost::bind(&FileselectorButtonFolderOnlyTest::checkFolderOnly, boost::ref(*this), *it) + ) + ); + } + } + + void checkFolderOnly(const Eina_Bool folderonly) + { + BOOST_CHECK_EQUAL(elm_fileselector_button_folder_only_get(control_), folderonly); + } + +private: + Window window_; + EvasObject control_; + vector states_; +}; + +class FileselectorButtonIsSaveTest : public ElmTestHarness +{ +public: + + FileselectorButtonIsSaveTest() + : ElmTestHarness::ElmTestHarness() + , window_("FileselectorButtonIsSaveTest", "Fileselector Button IsSave Test") + , control_(elm_fileselector_button_add(window_)) + { + control_.setSize(100, 100); + control_.setPosition(50, 10); + + states_.push_back(EINA_TRUE); + states_.push_back(EINA_FALSE); + states_.push_back(EINA_TRUE); + + return; + } + + void setup() + { + window_.show(); + control_.show(); + + vector::iterator it; + for (it = states_.begin(); it != states_.end(); it++) + { + queueCallback( + ModifyCheckCallback( + boost::bind(elm_fileselector_button_is_save_set, boost::ref(control_), *it), + boost::bind(&FileselectorButtonIsSaveTest::checkIsSave, boost::ref(*this), *it) + ) + ); + } + } + + void checkIsSave(const Eina_Bool save) + { + BOOST_CHECK_EQUAL(elm_fileselector_button_is_save_get(control_), save); + } + +private: + Window window_; + EvasObject control_; + vector states_; +}; + +class FileselectorButtonInwinTest : public ElmTestHarness +{ +public: + + FileselectorButtonInwinTest() + : ElmTestHarness::ElmTestHarness() + , window_("FileselectorButtonInwinTest", "Fileselector Button Inwin Test") + , control_(elm_fileselector_button_add(window_)) + { + states_.push_back(EINA_TRUE); + states_.push_back(EINA_FALSE); + states_.push_back(EINA_TRUE); + + return; + } + + void setup() + { + control_.setSize(100, 100); + control_.setPosition(50, 10); + + window_.show(); + control_.show(); + + vector::iterator it; + for (it = states_.begin(); it != states_.end(); it++) + { + queueCallback( + ModifyCheckCallback( + boost::bind(elm_fileselector_button_inwin_mode_set, boost::ref(control_), *it), + boost::bind(&FileselectorButtonInwinTest::checkInwin, boost::ref(*this), *it) + ) + ); + } + } + + void checkInwin(const Eina_Bool inwin) + { + BOOST_CHECK_EQUAL(elm_fileselector_button_inwin_mode_get(control_), inwin); + } + +private: + Window window_; + EvasObject control_; + vector states_; +}; + +BOOST_AUTO_TEST_SUITE(EFL) + + BOOST_AUTO_TEST_SUITE(FileSelectorButton) + + WAYLAND_ELM_HARNESS_TEST_CASE(FileselectorButtonExpandableTest) + WAYLAND_ELM_HARNESS_TEST_CASE(FileselectorButtonFolderOnlyTest) + WAYLAND_ELM_HARNESS_TEST_CASE(FileselectorButtonIsSaveTest) + WAYLAND_ELM_HARNESS_TEST_CASE(FileselectorButtonInwinTest) + + BOOST_AUTO_TEST_SUITE_END() + +BOOST_AUTO_TEST_SUITE_END() -- 2.7.4