diff options
author | jin0.kim <jin0.kim@samsung.com> | 2017-06-02 20:52:44 +0830 |
---|---|---|
committer | jin0.kim <jin0.kim@samsung.com> | 2017-06-02 21:53:15 +0830 |
commit | 3e381051a62ed7853363c04e0e1ba1ee85e91c72 (patch) | |
tree | 4943e15127ada0465daea71c7009877a15292ef4 /test | |
parent | 67ba42d89d821e2a0da4ebff35307450d90dab2a (diff) | |
download | w3-home-3e381051a62ed7853363c04e0e1ba1ee85e91c72.tar.gz w3-home-3e381051a62ed7853363c04e0e1ba1ee85e91c72.tar.bz2 w3-home-3e381051a62ed7853363c04e0e1ba1ee85e91c72.zip |
Add TEST_CODE for volume
Change-Id: If57cf943d88d305252d035ac2c2c7fc46427bd18
Diffstat (limited to 'test')
-rwxr-xr-x | test/feature_test/group_feature_moments_control_button_status_behavior.c | 119 | ||||
-rwxr-xr-x | test/test_function.h | 1 |
2 files changed, 120 insertions, 0 deletions
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 5f6df97..608ee89 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 @@ -12,6 +12,7 @@ #include <Elementary.h> #include <app.h> +#include <app_manager.h> static struct { unit_group_t * group; @@ -29,6 +30,7 @@ static void __group_set_up(void) __t__update_control_view(); __t__set_do_not_disturb_state(false); __t__set_flight_mode_state(false); + __t__set_volume_level(5); TEST_GROUP_SET_UP_DONE(0.0, s_info.group); } @@ -346,6 +348,118 @@ unit_case_func_t __continue_check_ok_button_clicked_on_flight_mode_popup(void * TEST_CASE_DONE(s_info.group); } +unit_case_func_t __continue_check_volume(void * data); +unit_case_func_t __case_check_volume(void * data) +{ + Eina_List *button_list = __t__get_moments_control_button_list(); + TEST_ASSERT_TRUE_UPGRADE(button_list != NULL); + + Eina_List *l; + control_info_t *button = NULL; + + EINA_LIST_FOREACH(button_list, l, button) { + if (button->index == MOMENTS_CONTROLS_VOLUME) { + break; + } + } + + TEST_ASSERT_TRUE_UPGRADE(button != NULL); + 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); + + Evas_Object *icon = elm_object_part_content_get(button->button_layout, CONTROLS_ICON); + const char *icon_image = NULL; + elm_image_file_get(icon, &icon_image, NULL); + + TEST_ASSERT_TRUE_UPGRADE(icon_image != NULL); + TEST_ASSERT_EQUAL_STRING_UPGRADE(IMAGEDIR"/multimedia.png", icon_image); + + TEST_ASSERT_TRUE_UPGRADE(button->pressed != NULL); + + button->pressed(NULL, NULL, NULL, NULL); + + TEST_CASE_CONTINUE(0.3, __continue_check_volume, NULL); +} + +unit_case_func_t __continue_check_volume(void * data) +{ + TEST_ASSERT_TRUE_UPGRADE(moments_get_visible() == false); + + app_context_h setting_app_context = NULL; + int ret = APP_MANAGER_ERROR_NONE; + + ret = app_manager_get_app_context("org.tizen.watch-setting", &setting_app_context); + TEST_ASSERT_EQUAL_INT_UPGRADE(APP_MANAGER_ERROR_NONE, ret); + + app_state_e setting_app_state = APP_STATE_UNDEFINED; + ret = app_context_get_app_state(setting_app_context , &setting_app_state); + TEST_ASSERT_EQUAL_INT_UPGRADE(APP_MANAGER_ERROR_NONE, ret); + + TEST_ASSERT_EQUAL_INT_UPGRADE(APP_STATE_FOREGROUND, setting_app_state); + + app_context_h home_app_context = NULL; + ret = app_manager_get_app_context(PACKAGE, &home_app_context); + TEST_ASSERT_EQUAL_INT_UPGRADE(APP_MANAGER_ERROR_NONE, ret); + + ret = app_manager_resume_app(home_app_context); + TEST_ASSERT_EQUAL_INT_UPGRADE(APP_MANAGER_ERROR_NONE, ret); + + ret = app_manager_request_terminate_bg_app(setting_app_context); + TEST_ASSERT_EQUAL_INT_UPGRADE(APP_MANAGER_ERROR_NONE, ret); + + ret = app_context_destroy(home_app_context); + TEST_ASSERT_EQUAL_INT_UPGRADE(APP_MANAGER_ERROR_NONE, ret); + + ret = app_context_destroy(setting_app_context); + TEST_ASSERT_EQUAL_INT_UPGRADE(APP_MANAGER_ERROR_NONE, ret); + + TEST_CASE_DONE(s_info.group); +} + +unit_case_func_t __case_check_volume_sound(void * data) +{ + const char *volume_text = elm_object_part_text_get(s_info.current_button->button_layout, CONTROLS_TEXT); + + if (strcmp(volume_text, "2") != 0) { + __t__set_volume_level(2); + TEST_CASE_CONTINUE(0.3, __case_check_volume_sound, NULL); + } + + TEST_ASSERT_EQUAL_STRING_UPGRADE("2", volume_text); + + Evas_Object *icon = elm_object_part_content_get(s_info.current_button->button_layout, CONTROLS_ICON); + const char *icon_image = NULL; + elm_image_file_get(icon, &icon_image, NULL); + + TEST_ASSERT_TRUE_UPGRADE(icon_image != NULL); + TEST_ASSERT_EQUAL_STRING_UPGRADE(IMAGEDIR"/multimedia.png", icon_image); + + TEST_CASE_DONE(s_info.group); +} + +unit_case_func_t __case_check_volume_mute(void * data) +{ + const char *volume_text = elm_object_part_text_get(s_info.current_button->button_layout, CONTROLS_TEXT); + + if (strcmp(volume_text, "0") != 0) { + __t__set_volume_level(0); + TEST_CASE_CONTINUE(0.3, __case_check_volume_mute, NULL); + } + + TEST_ASSERT_EQUAL_STRING_UPGRADE("0", volume_text); + + Evas_Object *icon = elm_object_part_content_get(s_info.current_button->button_layout, CONTROLS_ICON); + const char *icon_image = NULL; + elm_image_file_get(icon, &icon_image, NULL); + + TEST_ASSERT_TRUE_UPGRADE(icon_image != NULL); + TEST_ASSERT_EQUAL_STRING_UPGRADE(IMAGEDIR"/multimedia_off.png", icon_image); + + TEST_CASE_DONE(s_info.group); +} + void group_feature_moments_control_button_status_behavior(unit_group_t * group) { s_info.group = group; @@ -353,6 +467,7 @@ void group_feature_moments_control_button_status_behavior(unit_group_t * group) s_info.group->tear_down = __tear_down; 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); @@ -361,6 +476,10 @@ void group_feature_moments_control_button_status_behavior(unit_group_t * group) 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_GROUP_TEAR_DOWN(s_info.group, __group_tear_down); TEST_GROUP_RUN(s_info.group); diff --git a/test/test_function.h b/test/test_function.h index ea63c82..05a40bf 100755 --- a/test/test_function.h +++ b/test/test_function.h @@ -69,6 +69,7 @@ extern void __t__set_flight_mode_state(bool state); 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); #endif #endif |