From: junkyu han Date: Tue, 25 Apr 2017 05:10:03 +0000 (+0900) Subject: Add test code for variable resolution of layout X-Git-Tag: submit/tizen/20170425.085126^0 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=61dcd8891d80b1383481710f28060218ad0452d2;p=apps%2Fnative%2Fboot-animation.git Add test code for variable resolution of layout Change-Id: I028dd313d9695ad834801835ea432e921ac875ad --- diff --git a/res/edje/480x800/480x800_PowerOn.edc b/res/edje/480x800/480x800_PowerOn.edc index 9870e9e..6d4feb2 100644 --- a/res/edje/480x800/480x800_PowerOn.edc +++ b/res/edje/480x800/480x800_PowerOn.edc @@ -55,7 +55,7 @@ collections { signal: "show"; action: STATE_SET "default" 0.0; target: "poweron"; - transition: LINEAR 6.5; + transition: LINEAR 3.5; after: "poweron_end"; } program { diff --git a/src/boot.c b/src/boot.c index 74d1e79..6093dab 100644 --- a/src/boot.c +++ b/src/boot.c @@ -102,25 +102,22 @@ static int __check_on_off_type(void *user_data) _D("argc %d [%s]", i, argv[i]); printf("argc %d [%s]\n", i, argv[i]); } - while ((c = getopt_long(argc, argv, "spom:c", long_options, NULL)) >= 0) { + + while ((c = getopt_long(argc, argv, "sopc", long_options, NULL)) >= 0) { switch (c) { case 's': type = TYPE_ON; - _D("type: s"); - continue; + break; case 'p': - _D("type: p"); type = TYPE_OFF_NOEXIT; - continue; + break; case 'o': - _D("type: o"); type = TYPE_OFF; - continue; + break; case 'c': - _D("type: c"); type = TYPE_OFF_NOEXIT; - continue; + break; default: type = TYPE_UNKNOWN; _D("[Boot-ani] unknown arg [%s]", optarg); @@ -128,6 +125,7 @@ static int __check_on_off_type(void *user_data) return EXIT_FAILURE; } } + optind = 0; return type; } diff --git a/test/feature_test/feature_test.h b/test/feature_test/feature_test.h index ce3643e..6d5e412 100755 --- a/test/feature_test/feature_test.h +++ b/test/feature_test/feature_test.h @@ -8,11 +8,6 @@ #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_off_animation(unit_group_t * group); diff --git a/test/feature_test/group_feature_on_off_animation.c b/test/feature_test/group_feature_on_off_animation.c index 6dd2968..8e948c6 100755 --- a/test/feature_test/group_feature_on_off_animation.c +++ b/test/feature_test/group_feature_on_off_animation.c @@ -19,6 +19,7 @@ static void __case_check_finish_on_animation(bool * is_passed); static void __case_check_finish_off_animation(bool * is_passed); static struct { + int on_off; bool is_exit; int current_step; int step_max; @@ -27,6 +28,7 @@ static struct { int current_case; void(*case_pool[CASE_COUNT_MAX + 1])(bool * is_passed); } s_info = { + .on_off = 0, .is_exit = false, .current_step = 0, .group_timer = NULL, @@ -68,7 +70,7 @@ static void __case_start_on_animation(bool * is_passed) init_animation(TYPE_ON); s_info.current_step = 1; - s_info.step_max = 7; + s_info.on_off = 1; *is_passed = true; } @@ -85,33 +87,69 @@ static void __case_start_off_animation(bool * is_passed) init_animation(TYPE_OFF); s_info.current_step = 1; - s_info.step_max = 3; + s_info.on_off = 2; *is_passed = true; } +static int __get_step_max(int w, int h) +{ + if (w == 360 && h == 360) { + return 3; + } else if (w == 360 && h == 480) { + return 3; + } else if (w == 480 && h == 800) { + if (s_info.on_off == TYPE_ON) { + return 4; + } else { + return 3; + } + } else if (w == 720 && h == 1280) { + if (s_info.on_off == TYPE_ON) { + return 7; + } else { + return 3; + } + } else { + if (s_info.on_off == TYPE_ON) { + return 7; + } else { + return 3; + } + } +} + static void __case_check_animation(bool * is_passed) { int rx, ry, rw, rh; + int screen_w, screen_h; + Evas_Object *window = __t__get_window(); TEST_ASSERT_TRUE(window != NULL); + + elm_win_screen_size_get(window, NULL, NULL, &screen_w, &screen_h); + evas_object_geometry_get(window, &rx, &ry, &rw, &rh); - TEST_ASSERT_EQUAL_INT(BOOT_X, rx); - TEST_ASSERT_EQUAL_INT(BOOT_Y, ry); - TEST_ASSERT_EQUAL_INT(BOOT_W, rw); - TEST_ASSERT_EQUAL_INT(BOOT_H, rh); + TEST_ASSERT_EQUAL_INT(0, rx); + TEST_ASSERT_EQUAL_INT(0, ry); + TEST_ASSERT_EQUAL_INT(screen_w, rw); + TEST_ASSERT_EQUAL_INT(screen_h, rh); TEST_ASSERT_TRUE(evas_object_visible_get(window)); Evas_Object *layout = __t__get_layout(); TEST_ASSERT_TRUE(layout != NULL); evas_object_geometry_get(layout, &rx, &ry, &rw, &rh); - TEST_ASSERT_EQUAL_INT(BOOT_X, rx); - TEST_ASSERT_EQUAL_INT(BOOT_Y, ry); - TEST_ASSERT_EQUAL_INT(BOOT_W, rw); - TEST_ASSERT_EQUAL_INT(BOOT_H, rh); + TEST_ASSERT_EQUAL_INT(0, rx); + TEST_ASSERT_EQUAL_INT(0, ry); + TEST_ASSERT_EQUAL_INT(screen_w, rw); + TEST_ASSERT_EQUAL_INT(screen_h, rh); TEST_ASSERT_TRUE(evas_object_visible_get(layout)); - if (s_info.current_step < s_info.step_max) { + const char *file_name = NULL; + elm_layout_file_get(layout, &file_name, NULL); + TEST_ASSERT_EQUAL_STRING(get_layout_file_name(s_info.on_off, screen_w, screen_h), file_name); + + if (s_info.current_step < __get_step_max(screen_w, screen_h)) { s_info.current_case -= 1; } @@ -129,23 +167,32 @@ static void __case_check_finish_on_animation(bool * is_passed) TEST_ASSERT_TRUE(s_info.is_exit == true); s_info.is_exit = false; + s_info.on_off = 0; *is_passed = true; } static void __case_check_finish_off_animation(bool * is_passed) { + int rx, ry, rw, rh; + int screen_w, screen_h; + + Evas_Object *window = __t__get_window(); + TEST_ASSERT_TRUE(window != NULL); + elm_win_screen_size_get(window, NULL, NULL, &screen_w, &screen_h); + Evas_Object *display_block = __t__get_display_block(); + TEST_ASSERT_TRUE(display_block != NULL); - int rx, ry, rw, rh; evas_object_geometry_get(display_block, &rx, &ry, &rw, &rh); - TEST_ASSERT_TRUE(display_block != NULL); - 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_EQUAL_INT(0, rx); + TEST_ASSERT_EQUAL_INT(0, ry); + TEST_ASSERT_EQUAL_INT(screen_w, rw); + TEST_ASSERT_EQUAL_INT(screen_h, rh); TEST_ASSERT_TRUE(evas_object_visible_get(display_block)); + s_info.on_off = 0; + *is_passed = true; } diff --git a/test/function_test/group_function_animation.c b/test/function_test/group_function_animation.c index 28221a7..3dde346 100755 --- a/test/function_test/group_function_animation.c +++ b/test/function_test/group_function_animation.c @@ -41,7 +41,7 @@ static void __case_check_on_off_type(bool * is_passed) { struct args args; args.argc = 2; - args.argv = (char *)malloc(4 * 2); + args.argv = (char **)malloc(4 * 2); args.argv[0] = "/usr/bin/boot-animation"; args.argv[1] = "--start";