From: junkyu han Date: Wed, 19 Apr 2017 09:01:11 +0000 (+0900) Subject: Add feature test for booting on animation X-Git-Tag: submit/tizen/20170425.085126~3 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=refs%2Fchanges%2F05%2F125905%2F7;p=apps%2Fnative%2Fboot-animation.git Add feature test for booting on animation Change-Id: I4b49ca726a3bbff314b66b1baa7517d0a94fb325 --- diff --git a/inc/boot.h b/inc/boot.h index a80500d..a25ee01 100644 --- a/inc/boot.h +++ b/inc/boot.h @@ -56,3 +56,6 @@ enum { TYPE_CHECK_ANI, TYPE_CHECK_SOUND, }; + +extern void(*boot_exit)(void); + diff --git a/src/animation.c b/src/animation.c index 261474f..31f21a1 100644 --- a/src/animation.c +++ b/src/animation.c @@ -74,7 +74,7 @@ static Eina_Bool __end_cb(void *data) if (vconf_set_int(VCONFKEY_BOOT_ANIMATION_FINISHED, 1) != 0) { _E("Failed to set finished set"); } - elm_exit(); + boot_exit(); } return ECORE_CALLBACK_CANCEL; } @@ -246,3 +246,16 @@ int fini_animation(void) return EXIT_SUCCESS; } +#include "test.h" +#if TEST_MODE +Evas_Object *__t__get_window(void) +{ + return s_animation.win; +} + +Evas_Object *__t__get_layout(void) +{ + return s_animation.layout; +} +#endif + diff --git a/src/boot.c b/src/boot.c index cc1f2bc..786626b 100644 --- a/src/boot.c +++ b/src/boot.c @@ -58,6 +58,8 @@ struct args { #include #endif +void(*boot_exit)(void); + static void print_usages(char *argv0) { printf("Usage) %s {--start|--stop}\n" @@ -236,6 +238,7 @@ int main(int argc, char *argv[]) printf("[%s/%s/%d] fd == %d\n", __FILE__, __func__, __LINE__, fd); elm_init(argc, argv); + boot_exit = elm_exit; if (vconf_set_int(VCONFKEY_BOOT_ANIMATION_FINISHED, 0) != 0) { _D("Failed to set finished value to 0\n"); diff --git a/test/feature_test/feature_test.h b/test/feature_test/feature_test.h index 9d1a6cb..29ec816 100755 --- a/test/feature_test/feature_test.h +++ b/test/feature_test/feature_test.h @@ -8,6 +8,11 @@ #include +#define BOOT_X 0 +#define BOOT_Y 0 +#define BOOT_W 720 +#define BOOT_H 1280 + void feature_test(void); void group_feature_on_animation(unit_group_t * group); diff --git a/test/feature_test/group_feature_on_animation.c b/test/feature_test/group_feature_on_animation.c index 60f19e8..01d7e0c 100755 --- a/test/feature_test/group_feature_on_animation.c +++ b/test/feature_test/group_feature_on_animation.c @@ -8,6 +8,9 @@ #include #include +extern Evas_Object *__t__get_window(void); +extern Evas_Object *__t__get_layout(void); + static void __case_start_on_animation(bool * is_passed); static void __case_check_animation(bool * is_passed); static void __case_check_finish_animation(bool * is_passed); @@ -15,17 +18,19 @@ static void __case_check_finish_animation(bool * is_passed); #define CASE_COUNT 10 static struct { + int current_step; Ecore_Timer * group_timer; unit_group_t * group; int current_case; void(*case_pool[CASE_COUNT + 1])(bool * is_passed); } s_info = { + .current_step = 0, .group_timer = NULL, .group = NULL, .current_case = 0, .case_pool = { __case_start_on_animation, - __case_check_animation, + __case_check_animation, /* x 8 */ __case_check_finish_animation, NULL, }, @@ -36,26 +41,58 @@ static Eina_Bool __group_timer_callback(void * data); static void __set_up(void) {} static void __tear_down(void) {} +static void test_elm_exit(void) {} + static void __case_start_on_animation(bool * is_passed) { int is_finished = -1; + vconf_set_int(VCONFKEY_BOOT_ANIMATION_FINISHED, 0); vconf_get_int(VCONFKEY_BOOT_ANIMATION_FINISHED, &is_finished); TEST_ASSERT_TRUE(is_finished == 0); - //init_animation(TYPE_ON); + boot_exit = test_elm_exit; + init_animation(TYPE_ON); *is_passed = true; } static void __case_check_animation(bool * is_passed) { + int rx, ry, rw, rh; + Evas_Object *window = __t__get_window(); + evas_object_geometry_get(window, &rx, &ry, &rw, &rh); + TEST_ASSERT_EQUAL_INT(rx, BOOT_X); + TEST_ASSERT_EQUAL_INT(ry, BOOT_Y); + TEST_ASSERT_EQUAL_INT(rw, BOOT_W); + TEST_ASSERT_EQUAL_INT(rh, BOOT_H); + TEST_ASSERT_TRUE(evas_object_visible_get(window)); + + Evas_Object *layout = __t__get_layout(); + evas_object_geometry_get(window, &rx, &ry, &rw, &rh); + TEST_ASSERT_EQUAL_INT(rx, BOOT_X); + TEST_ASSERT_EQUAL_INT(ry, BOOT_Y); + TEST_ASSERT_EQUAL_INT(rw, BOOT_W); + TEST_ASSERT_EQUAL_INT(rh, BOOT_H); + TEST_ASSERT_TRUE(evas_object_visible_get(layout)); + + if (s_info.current_step < 8) { + s_info.current_case -= 1; + } + + s_info.current_step += 1; + *is_passed = true; } static void __case_check_finish_animation(bool * is_passed) { + int is_finished = -1; + + vconf_get_int(VCONFKEY_BOOT_ANIMATION_FINISHED, &is_finished); + TEST_ASSERT_TRUE(is_finished == 1); + *is_passed = true; } @@ -81,9 +118,11 @@ void group_feature_on_animation(unit_group_t * group) s_info.group_timer = NULL; } + s_info.current_step = 0; s_info.current_case = 0; s_info.group = group; - s_info.group_timer = ecore_timer_add(0.5, __group_timer_callback, NULL); + /* 0.7 because boot-animation take 6 sec, we should not use divisor */ + s_info.group_timer = ecore_timer_add(0.7, __group_timer_callback, NULL); } #endif diff --git a/test/function_test/function_test.c b/test/function_test/function_test.c index 326f55b..d3f8a1d 100755 --- a/test/function_test/function_test.c +++ b/test/function_test/function_test.c @@ -12,11 +12,11 @@ static struct { } s_info = { .current_group = 0, .group_name = { - "group_function_create_window", + "group_function_create_animation", "" }, .group_starter_pool = { - group_function_create_window, + group_function_create_animation, NULL, }, }; diff --git a/test/function_test/function_test.h b/test/function_test/function_test.h index bc14622..3712da6 100755 --- a/test/function_test/function_test.h +++ b/test/function_test/function_test.h @@ -7,7 +7,7 @@ #include "../unit/inc/unit.h" void function_test(void); -void group_function_create_window(unit_group_t * group); +void group_function_create_animation(unit_group_t * group); #endif diff --git a/test/function_test/group_function_animation.c b/test/function_test/group_function_animation.c index 6cf17ba..e162676 100755 --- a/test/function_test/group_function_animation.c +++ b/test/function_test/group_function_animation.c @@ -165,7 +165,7 @@ static void __case_is_layout_file_exist(bool * is_passed) *is_passed = true; } -void group_function_create_window(unit_group_t * group) +void group_function_create_animation(unit_group_t * group) { TEST_CASE(group, __case_create_win); TEST_CASE(group, __case_get_layout_file_name); diff --git a/test/test_main.c b/test/test_main.c index cd8e541..1ced4e7 100755 --- a/test/test_main.c +++ b/test/test_main.c @@ -9,20 +9,6 @@ #include #include -static struct { - Ecore_Timer * feature_test_run_timer; -} s_info = { - .feature_test_run_timer = NULL, -}; - -static Eina_Bool __run_timer_callback(void * data) -{ - feature_test(); - - s_info.feature_test_run_timer = NULL; - return ECORE_CALLBACK_CANCEL; -} - int main(int argc, char *argv[]) { unit_init(); @@ -31,15 +17,8 @@ int main(int argc, char *argv[]) function_test(); - Evas_Object * win = create_window(); - - if (s_info.feature_test_run_timer) { - ecore_timer_del(s_info.feature_test_run_timer); - s_info.feature_test_run_timer = NULL; - } + feature_test(); - s_info.feature_test_run_timer = ecore_timer_add(1, __run_timer_callback, NULL); - elm_run(); unit_fini();