From e5dadff85967623ec6ff5e7817dd8fa94931fa7f Mon Sep 17 00:00:00 2001 From: Joe Konno Date: Wed, 20 Jun 2012 11:37:10 -0700 Subject: [PATCH] background: incorporate image option tests Tiling, scaling, etc. Signed-off-by: Joe Konno --- src/efl/background.cpp | 10 ++++++++++ src/efl/background.h | 2 ++ src/efl/test_background.cpp | 23 +++++++++++++++++++++++ 3 files changed, 35 insertions(+) diff --git a/src/efl/background.cpp b/src/efl/background.cpp index 471445c..23b965a 100644 --- a/src/efl/background.cpp +++ b/src/efl/background.cpp @@ -19,6 +19,11 @@ void Background::setImage(const path& p) (void) elm_bg_file_set(*this, p.c_str(), NULL); } +void Background::setImageOpt(Elm_Bg_Option option) +{ + elm_bg_option_set(*this, option); +} + void Background::getColor(int* red, int* green, int* blue) { elm_bg_color_get(*this, red, green, blue); @@ -33,6 +38,11 @@ void Background::getImage(path& p) p = ret; } +Elm_Bg_Option Background::getImageOpt() +{ + return elm_bg_option_get(*this); +} + Background::operator Evas_Object*() { return EvasObject::obj_; diff --git a/src/efl/background.h b/src/efl/background.h index d9c4c03..16beab8 100644 --- a/src/efl/background.h +++ b/src/efl/background.h @@ -19,9 +19,11 @@ public: void setColor(int, int, int); void setImage(const path&); + void setImageOpt(Elm_Bg_Option); void getColor(int*, int*, int*); void getImage(path&); + Elm_Bg_Option getImageOpt(); operator Evas_Object*(); diff --git a/src/efl/test_background.cpp b/src/efl/test_background.cpp index c35cfe3..48ea818 100644 --- a/src/efl/test_background.cpp +++ b/src/efl/test_background.cpp @@ -71,6 +71,7 @@ public: { bg_.show(); window_.show(); + window_.maximize(EINA_TRUE); path p(MEDIA_PATH"/crater_lake.png"); @@ -80,6 +81,23 @@ public: boost::bind(&BackgroundImageTest::checkImage, boost::ref(*this), p) ) ); + + Elm_Bg_Option option[] = { ELM_BG_OPTION_CENTER, + ELM_BG_OPTION_SCALE, + ELM_BG_OPTION_STRETCH, + ELM_BG_OPTION_TILE + }; + + unsigned int o; + for (o = 0; o < (sizeof(option) / sizeof(Elm_Bg_Option)); o++) + { + queueCallback( + ModifyCheckCallback( + boost::bind(&Background::setImageOpt, boost::ref(bg_), option[o]), + boost::bind(&BackgroundImageTest::checkImageOpt, boost::ref(*this), option[o]) + ) + ); + } } void checkImage(path& p) @@ -90,6 +108,11 @@ public: BOOST_CHECK_EQUAL(ret, p); } + void checkImageOpt(Elm_Bg_Option option) + { + BOOST_CHECK_EQUAL(option, bg_.getImageOpt()); + } + private: Window window_; Background bg_; -- 2.7.4