diff options
author | jin0.kim <jin0.kim@samsung.com> | 2017-06-08 21:47:49 +0830 |
---|---|---|
committer | jin0.kim <jin0.kim@samsung.com> | 2017-06-08 21:47:49 +0830 |
commit | 0923e2b3ee0c9d947dcc4d41016f9aee74960a23 (patch) | |
tree | c90207fc6511e0dcfcd2ab37db4351827e942781 | |
parent | b60cbceeb05c0369ddb10fbcb5010244707dd70b (diff) | |
download | w3-home-0923e2b3ee0c9d947dcc4d41016f9aee74960a23.tar.gz w3-home-0923e2b3ee0c9d947dcc4d41016f9aee74960a23.tar.bz2 w3-home-0923e2b3ee0c9d947dcc4d41016f9aee74960a23.zip |
Added restore code for control button state
Change-Id: I456609b611bba4ad6091683ed41cfa101629eaa2
-rwxr-xr-x | src/moments/moments_control_view.c | 44 | ||||
-rwxr-xr-x | test/feature_test/group_feature_moments_control_button_status_behavior.c | 78 | ||||
-rwxr-xr-x | test/test_function.h | 6 |
3 files changed, 106 insertions, 22 deletions
diff --git a/src/moments/moments_control_view.c b/src/moments/moments_control_view.c index 94be922..64a1bd2 100755 --- a/src/moments/moments_control_view.c +++ b/src/moments/moments_control_view.c @@ -457,7 +457,7 @@ static void __set_state_bt_with_phone_connection(void) static bool __is_stand_alone(void) { - return true; + return !__is_with_phone(); } static bool __is_with_phone(void) @@ -467,7 +467,7 @@ static bool __is_with_phone(void) static bool __is_with_bt_device(void) { - return false; + return !moments_check_is_3g_device(); } static void __do_not_disturb_popup_cancel_cb(void *data, Evas_Object *obj, void *event_info) @@ -688,6 +688,10 @@ Eina_List *__t__get_moments_control_button_list(void) { return s_info.button_list; } +void __t__update_control_state(void) +{ + __update_control_state(); +} void __t__update_control_view(void) { __update_control_view(); @@ -727,6 +731,16 @@ void __t__set_do_not_disturb_state(bool state) _E("Failed to set vconfkey(%s) : %d", VCONFKEY_SETAPPL_BLOCKMODE_WEARABLE_BOOL, ret); } } +bool __t__get_do_not_disturb_state(void) +{ + int state = 0; + int ret = vconf_get_bool(VCONFKEY_SETAPPL_BLOCKMODE_WEARABLE_BOOL, &state); + if (ret < 0) { + _E("Failed to get vconfkey(%s) : %d", VCONFKEY_SETAPPL_BLOCKMODE_WEARABLE_BOOL, ret); + } + + return (bool)state; +} Evas_Object *__t__get_moments_flight_mode_popup(void) { return s_info.flight_mode_popup; @@ -742,6 +756,18 @@ void __t__set_flight_mode_state(bool state) _E("Failed to set vconfkey(%s) : %d", VCONFKEY_TELEPHONY_FLIGHT_MODE, ret); } } +bool __t__get_flight_mode_state(void) +{ + int is_flight_mode = 0; + + int ret = vconf_get_bool(VCONFKEY_TELEPHONY_FLIGHT_MODE, &is_flight_mode); + if (ret < 0) { + _E("Failed to get vconfkey(%s) : %d", VCONFKEY_TELEPHONY_FLIGHT_MODE, ret); + return 0; + } + + return (bool)is_flight_mode; +} void __t__flight_mode_popup_cancel_cb(void *data, Evas_Object *obj, void *event_info) { __flight_mode_popup_cancel_cb(data, obj, event_info); @@ -763,6 +789,11 @@ void __t__set_volume_level(int level) _E("Fail to set volume"); } } +int __t__get_volume_level() +{ + return __get_current_device_volume_level(); +} + void __t__set_brightness_level(int level) { int ret = device_display_set_brightness(0, level); @@ -770,5 +801,14 @@ void __t__set_brightness_level(int level) _E("Fail to set brightness"); } } +int __t__get_brightness_level(void) +{ + int level = -1; + if (device_display_get_brightness(0, &level) != DEVICE_ERROR_NONE) { + _E("Fail to get device display state"); + return 0; + } + return level; +} #endif diff --git a/test/feature_test/group_feature_moments_control_button_status_behavior.c b/test/feature_test/group_feature_moments_control_button_status_behavior.c index 01f7cab..b09c6ce 100755 --- a/test/feature_test/group_feature_moments_control_button_status_behavior.c +++ b/test/feature_test/group_feature_moments_control_button_status_behavior.c @@ -17,9 +17,19 @@ static struct { unit_group_t * group; control_info_t *current_button; + int control_state; + bool is_do_not_disturb; + bool is_flight_mode; + int volume_level; + int brightness_level; } s_info = { .group = NULL, .current_button = NULL, + .control_state = 0, + .is_do_not_disturb = false, + .is_flight_mode = false, + .volume_level = 0, + .brightness_level = 0, }; extern control_info_t control_button_list[MOMENTS_CONTROLS_MAX]; @@ -28,12 +38,20 @@ static void __group_set_up(void) { __t__set_state_stand_alone(); __t__update_control_view(); + + s_info.is_do_not_disturb = __t__get_do_not_disturb_state(); __t__set_do_not_disturb_state(false); + + s_info.is_flight_mode = __t__get_flight_mode_state(); __t__set_flight_mode_state(false); - __t__set_volume_level(5); - __t__set_brightness_level(50); - TEST_GROUP_SET_UP_DONE(0.0, s_info.group); + s_info.volume_level = __t__get_volume_level(); + __t__set_volume_level(7); + + s_info.brightness_level = __t__get_brightness_level(); + __t__set_brightness_level(70); + + TEST_GROUP_SET_UP_DONE(0.5, s_info.group); } static void __group_tear_down(void) @@ -44,6 +62,13 @@ static void __group_tear_down(void) TEST_GROUP_TEAR_DOWN_DONE(0.6, s_info.group); } + __t__set_do_not_disturb_state(s_info.is_do_not_disturb); + __t__set_flight_mode_state(s_info.is_flight_mode); + __t__set_volume_level(s_info.volume_level); + __t__set_brightness_level(s_info.brightness_level); + __t__update_control_state(); + __t__update_control_view(); + TEST_GROUP_TEAR_DOWN_DONE(0.0, s_info.group); } @@ -56,7 +81,7 @@ static void __set_up(void) __t__layout_mouse_move(info->layout, 180, 300); __t__layout_mouse_up(info->layout, 180, 300); - ecore_timer_add(0.3, s_info.group->set_up_complete, s_info.group); + ecore_timer_add(0.6, s_info.group->set_up_complete, s_info.group); return; } @@ -93,7 +118,7 @@ unit_case_func_t __case_check_do_not_disturb(void * data) button->pressed(NULL, NULL, NULL, NULL); - TEST_CASE_CONTINUE(0.3, __continue_check_do_not_disturb,(void*)button); + TEST_CASE_CONTINUE(0.6, __continue_check_do_not_disturb,(void*)button); } unit_case_func_t __continue_check_do_not_disturb(void * data) @@ -156,7 +181,7 @@ unit_case_func_t __case_check_cancel_button_clicked_on_do_not_disturb_popup(void __t__do_not_disturb_popup_cancel_cb((void*)popup, NULL, NULL); - TEST_CASE_CONTINUE(0.3, __continue_check_cancel_button_clicked_on_do_not_disturb_popup, NULL); + TEST_CASE_CONTINUE(0.5, __continue_check_cancel_button_clicked_on_do_not_disturb_popup, NULL); } unit_case_func_t __continue_check_cancel_button_clicked_on_do_not_disturb_popup(void * data) @@ -192,7 +217,7 @@ unit_case_func_t __case_check_ok_button_clicked_on_do_not_disturb_popup(void * d __t__do_not_disturb_popup_ok_cb((void*)popup, NULL, NULL); - TEST_CASE_CONTINUE(0.3, __continue_check_ok_button_clicked_on_do_not_disturb_popup, NULL); + TEST_CASE_CONTINUE(0.6, __continue_check_ok_button_clicked_on_do_not_disturb_popup, NULL); } unit_case_func_t __continue_check_ok_button_clicked_on_do_not_disturb_popup(void * data) @@ -233,7 +258,7 @@ unit_case_func_t __case_check_flight_mode(void * data) button->pressed(NULL, NULL, NULL, NULL); - TEST_CASE_CONTINUE(0.3, __continue_check_flight_mode, NULL); + TEST_CASE_CONTINUE(0.6, __continue_check_flight_mode, NULL); } unit_case_func_t __continue_check_flight_mode(void * data) @@ -297,7 +322,7 @@ unit_case_func_t __case_check_cancel_button_clicked_on_flight_mode_popup(void * __t__flight_mode_popup_cancel_cb((void*)popup, NULL, NULL); - TEST_CASE_CONTINUE(0.3, __continue_check_cancel_button_clicked_on_flight_mode_popup, NULL); + TEST_CASE_CONTINUE(0.6, __continue_check_cancel_button_clicked_on_flight_mode_popup, NULL); } unit_case_func_t __continue_check_cancel_button_clicked_on_flight_mode_popup(void * data) @@ -333,7 +358,7 @@ unit_case_func_t __case_check_ok_button_clicked_on_flight_mode_popup(void * data __t__flight_mode_popup_ok_cb((void*)popup, NULL, NULL); - TEST_CASE_CONTINUE(0.3, __continue_check_ok_button_clicked_on_flight_mode_popup, NULL); + TEST_CASE_CONTINUE(0.6, __continue_check_ok_button_clicked_on_flight_mode_popup, NULL); } unit_case_func_t __continue_check_ok_button_clicked_on_flight_mode_popup(void * data) @@ -368,7 +393,7 @@ unit_case_func_t __case_check_volume(void * data) s_info.current_button = button; const char *volume_text = elm_object_part_text_get(button->button_layout, CONTROLS_TEXT); - TEST_ASSERT_EQUAL_STRING_UPGRADE("5", volume_text); + TEST_ASSERT_EQUAL_STRING_UPGRADE("7", volume_text); Evas_Object *icon = elm_object_part_content_get(button->button_layout, CONTROLS_ICON); const char *icon_image = NULL; @@ -381,7 +406,7 @@ unit_case_func_t __case_check_volume(void * data) button->pressed(NULL, NULL, NULL, NULL); - TEST_CASE_CONTINUE(0.3, __continue_check_volume, NULL); + TEST_CASE_CONTINUE(0.6, __continue_check_volume, NULL); } unit_case_func_t __continue_check_volume(void * data) @@ -404,6 +429,12 @@ unit_case_func_t __continue_check_volume(void * data) ret = app_manager_get_app_context(PACKAGE, &home_app_context); TEST_ASSERT_EQUAL_INT_UPGRADE(APP_MANAGER_ERROR_NONE, ret); + app_state_e home_app_state = APP_STATE_UNDEFINED; + ret = app_context_get_app_state(home_app_context , &home_app_state); + TEST_ASSERT_EQUAL_INT_UPGRADE(APP_MANAGER_ERROR_NONE, ret); + + TEST_ASSERT_EQUAL_INT_UPGRADE(APP_STATE_BACKGROUND, home_app_state); + ret = app_manager_resume_app(home_app_context); TEST_ASSERT_EQUAL_INT_UPGRADE(APP_MANAGER_ERROR_NONE, ret); @@ -425,7 +456,7 @@ unit_case_func_t __case_check_volume_sound(void * data) if (strcmp(volume_text, "2") != 0) { __t__set_volume_level(2); - TEST_CASE_CONTINUE(0.3, __case_check_volume_sound, NULL); + TEST_CASE_CONTINUE(0.6, __case_check_volume_sound, NULL); } TEST_ASSERT_EQUAL_STRING_UPGRADE("2", volume_text); @@ -446,7 +477,7 @@ unit_case_func_t __case_check_volume_mute(void * data) if (strcmp(volume_text, "0") != 0) { __t__set_volume_level(0); - TEST_CASE_CONTINUE(0.3, __case_check_volume_mute, NULL); + TEST_CASE_CONTINUE(0.6, __case_check_volume_mute, NULL); } TEST_ASSERT_EQUAL_STRING_UPGRADE("0", volume_text); @@ -480,7 +511,7 @@ unit_case_func_t __case_check_brightness(void * data) s_info.current_button = button; const char *brightness_text = elm_object_part_text_get(button->button_layout, CONTROLS_TEXT); - TEST_ASSERT_EQUAL_STRING_UPGRADE("5", brightness_text); + TEST_ASSERT_EQUAL_STRING_UPGRADE("7", brightness_text); Evas_Object *icon = elm_object_part_content_get(button->button_layout, CONTROLS_ICON); const char *icon_image = NULL; @@ -493,7 +524,7 @@ unit_case_func_t __case_check_brightness(void * data) button->pressed(NULL, NULL, NULL, NULL); - TEST_CASE_CONTINUE(0.3, __continue_check_brightness, NULL); + TEST_CASE_CONTINUE(0.6, __continue_check_brightness, NULL); } unit_case_func_t __continue_check_brightness(void * data) @@ -516,6 +547,12 @@ unit_case_func_t __continue_check_brightness(void * data) ret = app_manager_get_app_context(PACKAGE, &home_app_context); TEST_ASSERT_EQUAL_INT_UPGRADE(APP_MANAGER_ERROR_NONE, ret); + app_state_e home_app_state = APP_STATE_UNDEFINED; + ret = app_context_get_app_state(home_app_context , &home_app_state); + TEST_ASSERT_EQUAL_INT_UPGRADE(APP_MANAGER_ERROR_NONE, ret); + + TEST_ASSERT_EQUAL_INT_UPGRADE(APP_STATE_BACKGROUND, home_app_state); + ret = app_manager_resume_app(home_app_context); TEST_ASSERT_EQUAL_INT_UPGRADE(APP_MANAGER_ERROR_NONE, ret); @@ -540,15 +577,18 @@ void group_feature_moments_control_button_status_behavior(unit_group_t * group) TEST_GROUP_SET_UP(s_info.group, __group_set_up); - TEST_CASE_ADD(s_info.group, __case_check_do_not_disturb, NULL); - TEST_CASE_ADD(s_info.group, __case_check_cancel_button_clicked_on_do_not_disturb_popup, NULL); - TEST_CASE_ADD(s_info.group, __case_check_ok_button_clicked_on_do_not_disturb_popup, NULL); TEST_CASE_ADD(s_info.group, __case_check_flight_mode, NULL); TEST_CASE_ADD(s_info.group, __case_check_cancel_button_clicked_on_flight_mode_popup, NULL); TEST_CASE_ADD(s_info.group, __case_check_ok_button_clicked_on_flight_mode_popup, NULL); + TEST_CASE_ADD(s_info.group, __case_check_volume, NULL); TEST_CASE_ADD(s_info.group, __case_check_volume_sound, NULL); TEST_CASE_ADD(s_info.group, __case_check_volume_mute, NULL); + + TEST_CASE_ADD(s_info.group, __case_check_do_not_disturb, NULL); + TEST_CASE_ADD(s_info.group, __case_check_cancel_button_clicked_on_do_not_disturb_popup, NULL); + TEST_CASE_ADD(s_info.group, __case_check_ok_button_clicked_on_do_not_disturb_popup, NULL); + TEST_CASE_ADD(s_info.group, __case_check_brightness, NULL); TEST_GROUP_TEAR_DOWN(s_info.group, __group_tear_down); diff --git a/test/test_function.h b/test/test_function.h index 3e1f1ec..b53e4b0 100755 --- a/test/test_function.h +++ b/test/test_function.h @@ -27,6 +27,7 @@ extern int __t__get_control_layout_alpha(int layout_bottom); extern int __t__get_center_layout_alpha(int layout_bottom); extern void __t__set_connection_status(int status); extern Eina_List *__t__get_moments_control_button_list(void); +extern void __t__update_control_state(void); extern void __t__update_control_view(void); extern void __t__set_state_stand_alone(void); extern void __t__set_state_3g_with_phone_connection(void); @@ -59,14 +60,17 @@ extern Evas_Object *__t__get_moments_do_not_disturb_popup_layout(void); extern void __t__do_not_disturb_popup_cancel_cb(void *data, Evas_Object *obj, void *event_info); extern void __t__do_not_disturb_popup_ok_cb(void *data, Evas_Object *obj, void *event_info); extern void __t__set_do_not_disturb_state(bool state); +extern bool __t__get_do_not_disturb_state(void); extern Evas_Object *__t__get_moments_flight_mode_popup(void); extern Evas_Object *__t__get_moments_flight_mode_popup_layout(void); extern void __t__set_flight_mode_state(bool state); +extern bool __t__get_flight_mode_state(void); extern void __t__flight_mode_popup_cancel_cb(void *data, Evas_Object *obj, void *event_info); extern void __t__flight_mode_popup_ok_cb(void *data, Evas_Object *obj, void *event_info); - extern void __t__set_volume_level(int level); +extern int __t__get_volume_level(); extern void __t__set_brightness_level(int level); +extern int __t__get_brightness_level(void); #endif #endif |