background: incorporate image option tests
authorJoe Konno <joe.konno@intel.com>
Wed, 20 Jun 2012 18:37:10 +0000 (11:37 -0700)
committerJoe Konno <joe.konno@intel.com>
Wed, 20 Jun 2012 18:37:10 +0000 (11:37 -0700)
Tiling, scaling, etc.

Signed-off-by: Joe Konno <joe.konno@intel.com>
src/efl/background.cpp
src/efl/background.h
src/efl/test_background.cpp

index 471445c..23b965a 100644 (file)
@@ -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_;
index d9c4c03..16beab8 100644 (file)
@@ -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*();
 
index c35cfe3..48ea818 100644 (file)
@@ -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_;