Add feature test for booting on animation 05/125905/7
authorjunkyu han <junkyu.han@samsung.com>
Wed, 19 Apr 2017 09:01:11 +0000 (18:01 +0900)
committerjunkyu han <junkyu.han@samsung.com>
Thu, 20 Apr 2017 06:43:10 +0000 (15:43 +0900)
Change-Id: I4b49ca726a3bbff314b66b1baa7517d0a94fb325

inc/boot.h
src/animation.c
src/boot.c
test/feature_test/feature_test.h
test/feature_test/group_feature_on_animation.c
test/function_test/function_test.c
test/function_test/function_test.h
test/function_test/group_function_animation.c
test/test_main.c

index a80500d..a25ee01 100644 (file)
@@ -56,3 +56,6 @@ enum {
        TYPE_CHECK_ANI,
        TYPE_CHECK_SOUND,
 };
+
+extern void(*boot_exit)(void);
+
index 261474f..31f21a1 100644 (file)
@@ -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
+
index cc1f2bc..786626b 100644 (file)
@@ -58,6 +58,8 @@ struct args {
 #include <mm_sound_private.h>
 #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");
index 9d1a6cb..29ec816 100755 (executable)
@@ -8,6 +8,11 @@
 
 #include <app.h>
 
+#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);
 
index 60f19e8..01d7e0c 100755 (executable)
@@ -8,6 +8,9 @@
 #include <Elementary.h>
 #include <vconf.h>
 
+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
index 326f55b..d3f8a1d 100755 (executable)
@@ -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,
                                },
 };
index bc14622..3712da6 100755 (executable)
@@ -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
 
index 6cf17ba..e162676 100755 (executable)
@@ -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);
index cd8e541..1ced4e7 100755 (executable)
@@ -9,20 +9,6 @@
 #include <Elementary.h>
 #include <vconf.h>
 
-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();