From: Juyeon Lee Date: Wed, 24 Oct 2018 04:59:35 +0000 (+0900) Subject: e_test_win: add startBGColor, stopBGColor X-Git-Tag: submit/tizen/20181107.044109~2 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=3eeedd6f76c7697ca49eefe6d7f1efa3656e94a7;p=platform%2Fcore%2Fuifw%2Fe-tizen-testcase.git e_test_win: add startBGColor, stopBGColor by calling this apis, test_win keep changes its background color Change-Id: I79c74bea22f6323bf3b019f222a060c5e3933bb0 --- diff --git a/src/e_test_win.cpp b/src/e_test_win.cpp index 91f271a..b543e6d 100644 --- a/src/e_test_win.cpp +++ b/src/e_test_win.cpp @@ -28,7 +28,6 @@ etWin::init(etWin *parent, E_TC_Win_Color color) { int screen_width = 0, screen_height = 0; - Evas_Object *bg = NULL; parent = parent; @@ -45,23 +44,23 @@ etWin::init(etWin *parent, if (usr_geom) elm_win_aux_hint_add(elm_win, "wm.policy.win.user.geometry", "1"); - bg = elm_bg_add(elm_win); - evas_object_size_hint_weight_set(bg, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); - elm_win_resize_object_add(elm_win, bg); + this->bg.obj = elm_bg_add(elm_win); + evas_object_size_hint_weight_set(this->bg.obj, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); + elm_win_resize_object_add(elm_win, this->bg.obj); switch (color) { - case E_TC_WIN_COLOR_BLACK: elm_bg_color_set(bg, 0, 0, 0); break; - case E_TC_WIN_COLOR_WHITE: elm_bg_color_set(bg, 255, 255, 255); break; - case E_TC_WIN_COLOR_RED: elm_bg_color_set(bg, 255, 0, 0); break; - case E_TC_WIN_COLOR_GREEN: elm_bg_color_set(bg, 0, 255, 0); break; - case E_TC_WIN_COLOR_BLUE: elm_bg_color_set(bg, 0, 0, 255); break; - case E_TC_WIN_COLOR_YELLOW: elm_bg_color_set(bg, 255, 255, 0); break; - case E_TC_WIN_COLOR_CYAN: elm_bg_color_set(bg, 0, 255, 255); break; - case E_TC_WIN_COLOR_PURPLE: elm_bg_color_set(bg, 255, 0, 255); break; - default: elm_bg_color_set(bg, 100, 100, 100); break; + case E_TC_WIN_COLOR_BLACK: elm_bg_color_set(this->bg.obj, 0, 0, 0); break; + case E_TC_WIN_COLOR_WHITE: elm_bg_color_set(this->bg.obj, 255, 255, 255); break; + case E_TC_WIN_COLOR_RED: elm_bg_color_set(this->bg.obj, 255, 0, 0); break; + case E_TC_WIN_COLOR_GREEN: elm_bg_color_set(this->bg.obj, 0, 255, 0); break; + case E_TC_WIN_COLOR_BLUE: elm_bg_color_set(this->bg.obj, 0, 0, 255); break; + case E_TC_WIN_COLOR_YELLOW: elm_bg_color_set(this->bg.obj, 255, 255, 0); break; + case E_TC_WIN_COLOR_CYAN: elm_bg_color_set(this->bg.obj, 0, 255, 255); break; + case E_TC_WIN_COLOR_PURPLE: elm_bg_color_set(this->bg.obj, 255, 0, 255); break; + default: elm_bg_color_set(this->bg.obj, 100, 100, 100); break; } - evas_object_show(bg); + evas_object_show(this->bg.obj); elm_win_screen_size_get(elm_win, NULL, NULL, &screen_width, &screen_height); @@ -98,6 +97,12 @@ void etWin::deInit() eina_stringshare_del(name); name = NULL; } + + if (this->bg.timer) + { + ecore_timer_del(this->bg.timer); + this->bg.timer = NULL; + } } void etWin::move(int x, int y) @@ -115,3 +120,44 @@ void etWin::resize(int w, int h) elm_win_aux_hint_add(elm_win, "wm.policy.win.user.geometry", "1"); evas_object_resize(elm_win, w, h); } + +static Eina_Bool _cb_timeout(void *data) +{ + int r = 0, g = 0, b = 0; + etWin *tw = (etWin *)data; + if (!tw) return EINA_FALSE; + + elm_bg_color_get(tw->bg.obj, &r, &g, &b); + if (r) + { + r = (r + 10) % 255; + if (!r) r = 10; + } + if (g) + { + g = (g + 10) % 255; + if (!g) g = 10; + } + if (b) + { + b = (b + 10) % 255; + if (!b) b = 10; + } + elm_bg_color_set(tw->bg.obj, r, g, b); + evas_object_show(tw->bg.obj); + return EINA_TRUE; +} + +void etWin::startBGColor(double time) +{ + ecore_timer_del(this->bg.timer); + this->bg.timer = ecore_timer_add(time, + _cb_timeout, + this); +} + +void etWin::stopBGColor() +{ + ecore_timer_del(this->bg.timer); + this->bg.timer = NULL; +} diff --git a/src/e_test_win.h b/src/e_test_win.h index 87b6633..9d4fbc8 100644 --- a/src/e_test_win.h +++ b/src/e_test_win.h @@ -32,6 +32,11 @@ public: // TODO:: Change to private and add getter & setter Eina_Bool win = EINA_FALSE; Eina_Bool obj = EINA_FALSE; } Focus; + struct + { + Ecore_Timer *timer = NULL; + Evas_Object *obj = NULL; + } bg; public: etWin(); @@ -64,6 +69,8 @@ public: } void move(int x, int y); void resize(int w, int h); + void startBGColor(double time); + void stopBGColor(); /* getter&setter */ Evas_Object *getElmWin() { return elm_win; }