From 92135fad4851d37ded905cc7f87eef728da4da96 Mon Sep 17 00:00:00 2001 From: Joe Konno Date: Wed, 18 Jul 2012 15:43:20 -0700 Subject: [PATCH] EFL: fileselector_entry tests Signed-off-by: Joe Konno --- src/efl/Makefile.am | 1 + src/efl/test_fileselector_entry.cpp | 215 ++++++++++++++++++++++++++++++++++++ 2 files changed, 216 insertions(+) create mode 100644 src/efl/test_fileselector_entry.cpp diff --git a/src/efl/Makefile.am b/src/efl/Makefile.am index 13f0580..8bc2fc5 100644 --- a/src/efl/Makefile.am +++ b/src/efl/Makefile.am @@ -41,6 +41,7 @@ wayland_efl_test_SOURCES = \ test_engine_set.cpp \ test_entry.cpp \ test_fileselector_button.cpp \ + test_fileselector_entry.cpp \ test_window.cpp \ ../testmain.cpp diff --git a/src/efl/test_fileselector_entry.cpp b/src/efl/test_fileselector_entry.cpp new file mode 100644 index 0000000..5449c54 --- /dev/null +++ b/src/efl/test_fileselector_entry.cpp @@ -0,0 +1,215 @@ +#include +#include + +#include + +#include "window.h" +#include "actionslider.h" +#include "evasobject.h" +#include "elmtestharness.h" + +using std::vector; + +// TODO: FileselectorEntry and FileselectorButton share a lot of commonality +// TODO: so an aggressive refactor with cpp macros could be leveraged. + +class FileselectorEntryExpandableTest : public ElmTestHarness +{ +public: + + FileselectorEntryExpandableTest() + : ElmTestHarness::ElmTestHarness() + , window_("FileselectorEntryExpandableTest", "Fileselector Entry Expandable Test") + , control_(elm_fileselector_entry_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_entry_expandable_set, boost::ref(control_), *it), + boost::bind(&FileselectorEntryExpandableTest::checkExpandable, boost::ref(*this), *it) + ) + ); + } + } + + void checkExpandable(const Eina_Bool expandable) + { + BOOST_CHECK_EQUAL(elm_fileselector_entry_expandable_get(control_), expandable); + } + +private: + Window window_; + EvasObject control_; + vector states_; +}; + +class FileselectorEntryFolderOnlyTest : public ElmTestHarness +{ +public: + + FileselectorEntryFolderOnlyTest() + : ElmTestHarness::ElmTestHarness() + , window_("FileselectorEntryFolderOnlyTest", "Fileselector Entry FolderOnly Test") + , control_(elm_fileselector_entry_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_entry_folder_only_set, boost::ref(control_), *it), + boost::bind(&FileselectorEntryFolderOnlyTest::checkFolderOnly, boost::ref(*this), *it) + ) + ); + } + } + + void checkFolderOnly(const Eina_Bool folderonly) + { + BOOST_CHECK_EQUAL(elm_fileselector_entry_folder_only_get(control_), folderonly); + } + +private: + Window window_; + EvasObject control_; + vector states_; +}; + +class FileselectorEntryIsSaveTest : public ElmTestHarness +{ +public: + + FileselectorEntryIsSaveTest() + : ElmTestHarness::ElmTestHarness() + , window_("FileselectorEntryIsSaveTest", "Fileselector Entry IsSave Test") + , control_(elm_fileselector_entry_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_entry_is_save_set, boost::ref(control_), *it), + boost::bind(&FileselectorEntryIsSaveTest::checkIsSave, boost::ref(*this), *it) + ) + ); + } + } + + void checkIsSave(const Eina_Bool save) + { + BOOST_CHECK_EQUAL(elm_fileselector_entry_is_save_get(control_), save); + } + +private: + Window window_; + EvasObject control_; + vector states_; +}; + +class FileselectorEntryInwinTest : public ElmTestHarness +{ +public: + + FileselectorEntryInwinTest() + : ElmTestHarness::ElmTestHarness() + , window_("FileselectorEntryInwinTest", "Fileselector Entry Inwin Test") + , control_(elm_fileselector_entry_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_entry_inwin_mode_set, boost::ref(control_), *it), + boost::bind(&FileselectorEntryInwinTest::checkInwin, boost::ref(*this), *it) + ) + ); + } + } + + void checkInwin(const Eina_Bool inwin) + { + BOOST_CHECK_EQUAL(elm_fileselector_entry_inwin_mode_get(control_), inwin); + } + +private: + Window window_; + EvasObject control_; + vector states_; +}; + +BOOST_AUTO_TEST_SUITE(EFL) + + BOOST_AUTO_TEST_SUITE(FileSelectorEntry) + + WAYLAND_ELM_HARNESS_TEST_CASE(FileselectorEntryExpandableTest) + WAYLAND_ELM_HARNESS_TEST_CASE(FileselectorEntryFolderOnlyTest) + WAYLAND_ELM_HARNESS_TEST_CASE(FileselectorEntryIsSaveTest) + WAYLAND_ELM_HARNESS_TEST_CASE(FileselectorEntryInwinTest) + + BOOST_AUTO_TEST_SUITE_END() + +BOOST_AUTO_TEST_SUITE_END() -- 2.7.4