diff options
author | jin0.kim <jin0.kim@samsung.com> | 2017-04-26 01:31:24 +0000 |
---|---|---|
committer | Gerrit Code Review <gerrit@review.ap-northeast-2.compute.internal> | 2017-04-26 01:31:24 +0000 |
commit | 44209a1b79e0b875bad185d60225f660f039e3b2 (patch) | |
tree | 15259134115a57b1753db61fea77b49dc2c70f92 | |
parent | c8a8af3c8abe165076cca9d8868f9bcafdcc8148 (diff) | |
parent | 8e5cf237fc5d66449a7683eecefb2a5546fd4f6a (diff) | |
download | w3-home-44209a1b79e0b875bad185d60225f660f039e3b2.tar.gz w3-home-44209a1b79e0b875bad185d60225f660f039e3b2.tar.bz2 w3-home-44209a1b79e0b875bad185d60225f660f039e3b2.zip |
Merge "Add group_feature_moments_default_ui" into tizen
-rwxr-xr-x | CMakeLists.txt | 1 | ||||
-rwxr-xr-x | inc/moments/moments_view_conf.h | 5 | ||||
-rwxr-xr-x | inc/moments/moments_view_edje_conf.h | 2 | ||||
-rwxr-xr-x | res/edje/circle/moments_layout.edc | 16 | ||||
-rwxr-xr-x | src/moments/moments_view.c | 111 | ||||
-rwxr-xr-x | test/feature_test/feature_test.c | 4 | ||||
-rwxr-xr-x | test/feature_test/feature_test.h | 1 | ||||
-rwxr-xr-x | test/feature_test/group_feature_moments_default_ui.c | 133 |
8 files changed, 219 insertions, 54 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt index 816bbee..1c4c3a8 100755 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -219,6 +219,7 @@ ADD_EXECUTABLE(${PROJECT_NAME} test/feature_test/group_feature_moments_show.c test/feature_test/group_feature_status_area_layer_show.c test/feature_test/group_feature_moments_pull_down.c + test/feature_test/group_feature_moments_default_ui.c test/unit/unit_assert.c test/unit/unit.c diff --git a/inc/moments/moments_view_conf.h b/inc/moments/moments_view_conf.h index 91e4ad5..397ebe3 100755 --- a/inc/moments/moments_view_conf.h +++ b/inc/moments/moments_view_conf.h @@ -24,6 +24,11 @@ #define MOMENT_DRAW_UP_LIMIT_Y (int)((320) * (SCALE_H)) #define MOMENT_DRAW_LIMIT (int)((10) * (SCALE_H)) +#define MOMENTS_CENTER_X (int)((50) * (SCALE_W)) +#define MOMENTS_CENTER_Y (int)((64) * (SCALE_H)) +#define MOMENTS_CENTER_W (int)((260) * (SCALE_W)) +#define MOMENTS_CENTER_H (int)((180) * (SCALE_H)) + #define MOMENTS_ANIMATION_INTERVAL 0.01 #define MOMENTS_ANIMATION_SHOW_TIME 0.03 #define MOMENTS_ANIMATION_DRAW_TIME 0.05 diff --git a/inc/moments/moments_view_edje_conf.h b/inc/moments/moments_view_edje_conf.h index e8f6cf0..dbcf77a 100755 --- a/inc/moments/moments_view_edje_conf.h +++ b/inc/moments/moments_view_edje_conf.h @@ -23,6 +23,8 @@ #define MOMENTS_BG "moments_bg" #define MOMENTS_CONTENT "moments_content" #define STATUS_CONTENT "status_content" +#define CENTER_LAYOUT "center_layout" +#define BUTTON_LAYOUT "button_layout" #define SIGNAL_SOURCE "signal_source" #define SIGNAL_MOMENTS_FREEZE_TOUCH "signal_moments_freeze_touch" diff --git a/res/edje/circle/moments_layout.edc b/res/edje/circle/moments_layout.edc index 323cd97..1fcd50c 100755 --- a/res/edje/circle/moments_layout.edc +++ b/res/edje/circle/moments_layout.edc @@ -47,7 +47,19 @@ collections { } } part { - name: MOMENTS_CONTENT; + name: CENTER_LAYOUT; + type: SWALLOW; + mouse_events: 1; + repeat_events: 1; + description { + state: "default" 0.0; + align: 0.5 0.5; + rel1 { relative: 0.1389 0.1778; to: SIZE_SETTER; } + rel2 { relative: 0.8612 0.6778; to: SIZE_SETTER; } + } + } + part { + name: BUTTON_LAYOUT; type: SWALLOW; mouse_events: 1; repeat_events: 1; @@ -94,4 +106,4 @@ collections { } } } -}
\ No newline at end of file +} diff --git a/src/moments/moments_view.c b/src/moments/moments_view.c index 314ade9..7f5974d 100755 --- a/src/moments/moments_view.c +++ b/src/moments/moments_view.c @@ -38,7 +38,8 @@ static struct __view_s { Evas_Object *background_layout; Evas_Object *status_layout; Evas_Object *size_setter; - Evas_Object *content; + Evas_Object *center_layout; + Evas_Object *button_layout; bool is_freeze; bool is_drawing_up; int down_y; @@ -49,7 +50,8 @@ static struct __view_s { .background_layout = NULL, .status_layout = NULL, .size_setter = NULL, - .content = NULL, + .center_layout = NULL, + .button_layout = NULL, .is_freeze = true, .is_drawing_up = false, .down_y = -1, @@ -61,9 +63,9 @@ extern void moments_view_animator_move(Evas_Object *layout[2], MOVEMENT info[2], static Evas_Object *__create_base_layout(Evas_Object *parent); static Evas_Object *__create_status_layout(Evas_Object *parent); - static Evas_Object *__create_base_size_setter(Evas_Object *base_layout); -//atic Evas_Object *__create_moments_content(Evas_Object *base_layout); +static Evas_Object *__create_center_layout(Evas_Object *base_layout); +static Evas_Object *__create_button_layout(Evas_Object *base_layout); static void __put_down(void); static void __freeze_touch_event(void); @@ -89,6 +91,10 @@ Evas_Object *moments_create_ui(Evas_Object *base_win) s_info.status_layout = __create_status_layout(base_win); if (s_info.status_layout == NULL) goto __fail; + s_info.center_layout = __create_center_layout(s_info.background_layout); + + s_info.button_layout = __create_button_layout(s_info.background_layout); + evas_object_event_callback_add(s_info.background_layout, EVAS_CALLBACK_MOUSE_DOWN, __down_cb, NULL); evas_object_event_callback_add(s_info.background_layout, EVAS_CALLBACK_MOUSE_MOVE, __move_cb, NULL); evas_object_event_callback_add(s_info.background_layout, EVAS_CALLBACK_MOUSE_UP, __up_cb, NULL); @@ -108,11 +114,6 @@ void moments_destroy_ui(void) evas_object_event_callback_del(s_info.background_layout, EVAS_CALLBACK_MOUSE_MOVE, __move_cb); evas_object_event_callback_del(s_info.background_layout, EVAS_CALLBACK_MOUSE_DOWN, __down_cb); - if (s_info.content) { - evas_object_del(s_info.content); - } - s_info.content = NULL; - if (s_info.status_layout) evas_object_del(s_info.status_layout); s_info.status_layout = NULL; @@ -251,28 +252,44 @@ static Evas_Object *__create_base_size_setter(Evas_Object *base_layout) return size_setter; } -#ifdef CONTENT_LAYOUT -static Evas_Object *__create_moments_content(Evas_Object *base_layout) +static Evas_Object *__create_center_layout(Evas_Object *base_layout) { - Evas_Object *widget = widget_viewer_evas_add_widget(base_layout, "org.tizen.windicator", NULL, 0); - if (!widget) { - _E("Failed to create widget"); + Evas_Object * center_layout = evas_object_rectangle_add(evas_object_evas_get(base_layout)); + if (!center_layout) { + _E("Failed to create center layout"); return NULL; } - widget_viewer_evas_disable_loading(widget); - evas_object_size_hint_weight_set(widget, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); - evas_object_size_hint_align_set(widget, 0.5, 0.5); - evas_object_resize(widget, WINDOW_W, WINDOW_H); + evas_object_size_hint_min_set(center_layout, MOMENTS_CENTER_W, MOMENTS_CENTER_H); + evas_object_size_hint_weight_set(center_layout, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); + evas_object_size_hint_align_set(center_layout, EVAS_HINT_FILL, EVAS_HINT_FILL); + evas_object_color_set(center_layout, 0, 0, 255, 200); + elm_object_part_content_set(base_layout, CENTER_LAYOUT, center_layout); + + evas_object_show(center_layout); + + return center_layout; +} + + +static Evas_Object *__create_button_layout(Evas_Object *base_layout) +{ + Evas_Object * button_layout = evas_object_rectangle_add(evas_object_evas_get(base_layout)); + if (!button_layout) { + _E("Failed to create center layout"); + return NULL; + } - evas_object_size_hint_min_set(widget, WINDOW_W, WINDOW_H); - evas_object_show(widget); + evas_object_size_hint_min_set(button_layout, WINDOW_W, WINDOW_H); + evas_object_size_hint_weight_set(button_layout, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); + evas_object_size_hint_align_set(button_layout, EVAS_HINT_FILL, EVAS_HINT_FILL); + evas_object_color_set(button_layout, 0, 100, 0, 100); + elm_object_part_content_set(base_layout, BUTTON_LAYOUT, button_layout); - elm_object_part_content_set(base_layout, MOMENTS_CONTENT, widget); + evas_object_show(button_layout); - return widget; + return button_layout; } -#endif static Evas_Object *__create_status_layout(Evas_Object *parent) { @@ -333,51 +350,23 @@ static void __put_down(void) static void __freeze_touch_event(void) { - if (s_info.content == NULL || s_info.background_layout == NULL || s_info.is_freeze) { - return ; - } - s_info.is_freeze = true; - /* It takes a long time for pause widget. - if (widget_viewer_evas_pause_widget(s_info.content) != WIDGET_ERROR_NONE) { - _E("Failed to pause widget"); - } - */ - int id = elm_win_aux_hint_id_get(s_info.win, "wm.policy.win.gesture.disable"); _D("hint set wm.policy.win.gesture.disable 1 id %d", id); elm_win_aux_hint_val_set(s_info.win, id, "1"); - evas_object_event_callback_del(s_info.content, EVAS_CALLBACK_MOUSE_UP, __up_cb); - evas_object_event_callback_del(s_info.content, EVAS_CALLBACK_MOUSE_MOVE, __move_cb); - evas_object_event_callback_del(s_info.content, EVAS_CALLBACK_MOUSE_DOWN, __down_cb); - elm_object_signal_emit(s_info.background_layout, SIGNAL_MOMENTS_FREEZE_TOUCH, SIGNAL_SOURCE); } static void __unfreeze_touch_event(void) { - if (s_info.content == NULL || s_info.background_layout == NULL || !s_info.is_freeze) { - return ; - } - s_info.is_freeze = false; - /* It takes a long time for resume widget. - if (widget_viewer_evas_resume_widget(s_info.content) != WIDGET_ERROR_NONE) { - _E("Failed to resume widget"); - } - */ - int id = elm_win_aux_hint_id_get(s_info.win, "wm.policy.win.gesture.disable"); _D("hint set wm.policy.win.gesture.disable 0 id %d", id); elm_win_aux_hint_val_set(s_info.win, id, "0"); - evas_object_event_callback_add(s_info.content, EVAS_CALLBACK_MOUSE_DOWN, __down_cb, NULL); - evas_object_event_callback_add(s_info.content, EVAS_CALLBACK_MOUSE_MOVE, __move_cb, NULL); - evas_object_event_callback_add(s_info.content, EVAS_CALLBACK_MOUSE_UP, __up_cb, NULL); - elm_object_signal_emit(s_info.background_layout, SIGNAL_MOMENTS_UNFREEZE_TOUCH, SIGNAL_SOURCE); } @@ -530,17 +519,37 @@ void __t__background_layout_mouse_up(int up_x, int up_y) { __background_layout_mouse_up(up_x, up_y); } + void __t__get_dest_y(int from_y, int to_y, int * dest_y) { __get_dest_y(from_y, to_y, dest_y); } + void __t__get_draw_up_view_y(int from_y, int to_y, int * dest_y) { __get_draw_up_view_y(from_y, to_y, dest_y); } + void __t__get_draw_down_view_y(int from_y, int to_y, int * dest_y) { __get_draw_down_view_y(from_y, to_y, dest_y); } + +Evas_Object * __t__get_moments_center_layout(void) +{ + return s_info.center_layout; +} + +Evas_Object * __t__get_moments_size_setter(void) +{ + return s_info.size_setter; +} + +Evas_Object * __t__get_moments_button_layout(void) +{ + return s_info.button_layout; +} + + #endif diff --git a/test/feature_test/feature_test.c b/test/feature_test/feature_test.c index 150d9ae..a9b94bb 100755 --- a/test/feature_test/feature_test.c +++ b/test/feature_test/feature_test.c @@ -6,7 +6,7 @@ #include <Elementary.h> #include <app.h> -#define TEST_GROUP_COUNT 3 +#define TEST_GROUP_COUNT 4 static void __complete_group_cb(void); static void __run_next_group(void); @@ -18,12 +18,14 @@ static struct { } s_info = { .current_group = 0, .group_name = { + "group_feature_moments_default_ui", "group_feature_moments_show", "group_feature_status_area_layer_show", "group_feature_moments_pull_down", "", }, .group_starter_pool = { + group_feature_moments_default_ui, group_feature_moments_show, group_feature_status_area_layer_show, group_feature_moments_pull_down, diff --git a/test/feature_test/feature_test.h b/test/feature_test/feature_test.h index cd91d1e..29069cc 100755 --- a/test/feature_test/feature_test.h +++ b/test/feature_test/feature_test.h @@ -10,6 +10,7 @@ void feature_test(void); void group_feature_moments_show(unit_group_t * group); void group_feature_status_area_layer_show(unit_group_t * group); void group_feature_moments_pull_down(unit_group_t * group); +void group_feature_moments_default_ui(unit_group_t * group); #endif diff --git a/test/feature_test/group_feature_moments_default_ui.c b/test/feature_test/group_feature_moments_default_ui.c new file mode 100755 index 0000000..af245ed --- /dev/null +++ b/test/feature_test/group_feature_moments_default_ui.c @@ -0,0 +1,133 @@ +#include "test.h" +#if TEST_MODE + +#include "feature_test.h" +#include "moments/moments.h" +#include "common_conf.h" +#include "moments/moments_view_conf.h" +#include "home_app_manager.h" + +#include <Elementary.h> +#include <app.h> + +extern Evas_Object * __t__get_moments_center_layout(void); +extern Evas_Object * __t__get_moments_size_setter(void); +extern Evas_Object * __t__get_moments_button_layout(void); +extern void __t__layout_mouse_down(Evas_Object *layout, int down_x, int down_y); +extern void __t__layout_mouse_move(Evas_Object *layout, int cur_x, int cur_y); +extern void __t__layout_mouse_up(Evas_Object *layout, int up_x, int up_y); + +static void __case_check_center_layout(bool * is_passed); +static void __case_check_button_layout(bool * is_passed); + + +static struct { + Ecore_Timer * group_timer; + unit_group_t * group; + int current_case; + void(*case_pool[TEST_CASE_MAX + 1])(bool * is_passed); +} s_info = { + .group_timer = NULL, + .group = NULL, + .current_case = 0, + .case_pool = { + __case_check_center_layout, + __case_check_button_layout, + NULL, + }, +}; + +static Eina_Bool __group_timer_callback(void * data); + +static void __set_up(void) {} +static void __tear_down(void) {} + +static void __case_check_center_layout(bool * is_passed) +{ + Evas_Object * size_setter = __t__get_moments_size_setter(); + TEST_ASSERT_TRUE(size_setter != NULL); + TEST_ASSERT_TRUE(evas_object_visible_get(size_setter)); + + int x = 0, y = 0, w = 0, h = 0; + evas_object_geometry_get(size_setter, &x, &y, &w, &h); + + TEST_ASSERT_EQUAL_INT(0, x); + TEST_ASSERT_EQUAL_INT(0, y); + TEST_ASSERT_EQUAL_INT(WINDOW_W, w); + TEST_ASSERT_EQUAL_INT(WINDOW_W, h); + + Evas_Object * center_layout = __t__get_moments_center_layout(); + TEST_ASSERT_TRUE(center_layout != NULL); + TEST_ASSERT_TRUE(evas_object_visible_get(center_layout)); + + evas_object_geometry_get(center_layout, &x, &y, &w, &h); + + TEST_ASSERT_EQUAL_INT(MOMENTS_CENTER_W, w); + TEST_ASSERT_EQUAL_INT(MOMENTS_CENTER_H, h); + TEST_ASSERT_EQUAL_INT(MOMENTS_CENTER_X, x); + TEST_ASSERT_EQUAL_INT(MOMENTS_CENTER_Y, y); + + *is_passed = true; +} + +static void __case_check_button_layout(bool * is_passed) +{ + Evas_Object * button_layout = __t__get_moments_button_layout(); + TEST_ASSERT_TRUE(button_layout != NULL); + TEST_ASSERT_TRUE(evas_object_visible_get(button_layout)); + + int x = 0, y = 0, w = 0, h = 0; + evas_object_geometry_get(button_layout, &x, &y, &w, &h); + + TEST_ASSERT_EQUAL_INT(WINDOW_W, w); + TEST_ASSERT_EQUAL_INT(WINDOW_W, h); + TEST_ASSERT_EQUAL_INT(0, x); + TEST_ASSERT_EQUAL_INT(0, y); + + *is_passed = true; +} + +static void __moments_pull_down(void) +{ + main_s * info = main_get_info(); + + __t__layout_mouse_down(info->layout, 180, 50); + __t__layout_mouse_move(info->layout, 180, 150); + __t__layout_mouse_up(info->layout, 180, 150); +} + + + +void group_feature_moments_default_ui(unit_group_t * group) +{ + if (s_info.group_timer) { + ecore_timer_del(s_info.group_timer); + s_info.group_timer = NULL; + } + + __moments_pull_down(); + + s_info.current_case = 0; + s_info.group = group; + s_info.group_timer = ecore_timer_add(0.6, __group_timer_callback, NULL); +} + +static Eina_Bool __group_timer_callback(void * data) +{ + if (s_info.case_pool[s_info.current_case] == NULL) { + s_info.group->finish(s_info.group); + + moments_hide(); + + s_info.group_timer = NULL; + return ECORE_CALLBACK_CANCEL; + } + + TEST_CASE(s_info.group, s_info.case_pool[s_info.current_case]); + s_info.current_case += 1; + + return ECORE_CALLBACK_RENEW; +} + +#endif + |