Add power off feature test 47/126147/3
authorjunkyu han <junkyu.han@samsung.com>
Thu, 20 Apr 2017 08:25:25 +0000 (17:25 +0900)
committerjunkyu han <junkyu.han@samsung.com>
Fri, 21 Apr 2017 02:05:31 +0000 (11:05 +0900)
Change-Id: Iab8a5e84ea1a2a4bd122da2ed881667edb1a827c

src/animation.c
test/feature_test/feature_test.c
test/feature_test/feature_test.h
test/feature_test/group_feature_on_off_animation.c [moved from test/feature_test/group_feature_on_animation.c with 51% similarity]
test/function_test/function_test.c
test/unit/inc/unit.h

index 31f21a1..6662a75 100644 (file)
 
 static struct animation {
        Evas_Object *win;
+       Evas_Object *layout;
+       Evas_Object *txt;
+       Evas_Object *display_block;
        Evas_Coord w;
        Evas_Coord h;
-       int t;
-       Evas *evas;
-       Ecore_Evas *ee;
-       Evas_Object *layout;
        int state;
-       Evas_Object *txt;
+       int t;
 } s_animation = {
-       .txt = NULL,};
+       .win = NULL,
+       .layout = NULL,
+       .txt = NULL,
+       .display_block = NULL,
+       .w = 0,
+       .h = 0,
+       .state = 0,
+       .t = 0,
+};
 
 static void win_del(void *data, Evas_Object * obj, void *event_info)
 {
@@ -55,6 +62,17 @@ static void win_del(void *data, Evas_Object * obj, void *event_info)
        elm_exit();
 }
 
+static void __block_display(void)
+{
+       Evas_Object *display_block = NULL;
+       display_block = evas_object_rectangle_add(evas_object_evas_get(s_animation.win));
+       elm_win_resize_object_add(s_animation.win, display_block);
+       evas_object_color_set(display_block, 0, 0, 0, 255);
+       evas_object_show(display_block);
+
+       s_animation.display_block = display_block;
+}
+
 static Eina_Bool __end_cb(void *data)
 {
        int type = (int) data;
@@ -62,13 +80,12 @@ static Eina_Bool __end_cb(void *data)
        if (type == TYPE_OFF) {
                _D("EXIT on SHUTDOWN");
                /* Delete Previous Layout */
-               if (s_animation.layout) evas_object_del(s_animation.layout);
+               if (s_animation.layout) {
+                       evas_object_del(s_animation.layout);
+                       s_animation.layout = NULL;
+               }
 
-               Evas_Object *disp_block = NULL;
-               disp_block = evas_object_rectangle_add(evas_object_evas_get(s_animation.win));
-               elm_win_resize_object_add(s_animation.win, disp_block);
-               evas_object_color_set(disp_block, 0, 0, 0, 255);
-               evas_object_show(disp_block);
+               __block_display();
        } else {
                _D("EXIT on BOOTING");
                if (vconf_set_int(VCONFKEY_BOOT_ANIMATION_FINISHED, 1) != 0) {
@@ -95,8 +112,14 @@ static void __animation_finished_cb(void *d, Evas_Object * obj, const char *e, c
 
 static void __fini_layout(void)
 {
+       if (s_animation.display_block) {
+               evas_object_del(s_animation.display_block);
+               s_animation.display_block = NULL;
+       }
+
        if (s_animation.layout) {
                evas_object_del(s_animation.layout);
+               s_animation.layout = NULL;
        }
 
        if (s_animation.txt) {
@@ -257,5 +280,10 @@ Evas_Object *__t__get_layout(void)
 {
        return s_animation.layout;
 }
+
+Evas_Object *__t__get_display_block(void)
+{
+       return s_animation.display_block;
+}
 #endif
 
index 3151114..a2ecbeb 100755 (executable)
@@ -8,20 +8,18 @@
 static void __complete_group_cb(void);
 static void __run_next_group(void);
 
-#define TEST_GROUP_COUNT 1
-
 static struct {
        int current_group;
-       char group_name[TEST_GROUP_COUNT + 1][128];
-       void(*group_starter_pool[TEST_GROUP_COUNT + 1])(unit_group_t * group);
+       char group_name[GROUP_COUNT_MAX + 1][128];
+       void(*group_starter_pool[GROUP_COUNT_MAX + 1])(unit_group_t * group);
 } s_info = {
        .current_group = 0,
        .group_name = {
-                                       "group_feature_on_animation",
+                                       "group_feature_on_off_animation",
                                        ""
                                },
        .group_starter_pool = {
-                                       group_feature_on_animation,
+                                       group_feature_on_off_animation,
                                        NULL,
                                },
 };
index 29ec816..ce3643e 100755 (executable)
@@ -14,7 +14,7 @@
 #define BOOT_H 1280
 
 void feature_test(void);
-void group_feature_on_animation(unit_group_t * group);
+void group_feature_on_off_animation(unit_group_t * group);
 
 #endif
 
similarity index 51%
rename from test/feature_test/group_feature_on_animation.c
rename to test/feature_test/group_feature_on_off_animation.c
index 01d7e0c..6dd2968 100755 (executable)
 
 extern Evas_Object *__t__get_window(void);
 extern Evas_Object *__t__get_layout(void);
+extern Evas_Object *__t__get_display_block(void);
 
 static void __case_start_on_animation(bool * is_passed);
+static void __case_start_off_animation(bool * is_passed);
 static void __case_check_animation(bool * is_passed);
-static void __case_check_finish_animation(bool * is_passed);
-
-#define CASE_COUNT 10
+static void __case_check_finish_on_animation(bool * is_passed);
+static void __case_check_finish_off_animation(bool * is_passed);
 
 static struct {
+       bool is_exit;
        int current_step;
+       int step_max;
        Ecore_Timer * group_timer;
        unit_group_t * group;
        int current_case;
-       void(*case_pool[CASE_COUNT + 1])(bool * is_passed);
+       void(*case_pool[CASE_COUNT_MAX + 1])(bool * is_passed);
 } s_info = {
+       .is_exit = false,
        .current_step = 0,
        .group_timer = NULL,
        .group = NULL,
@@ -31,7 +35,10 @@ static struct {
        .case_pool = {
                __case_start_on_animation,
                __case_check_animation,         /* x 8 */
-               __case_check_finish_animation,
+               __case_check_finish_on_animation,
+               __case_start_off_animation,
+               __case_check_animation,         /* x 3 */
+               __case_check_finish_off_animation,
                NULL,
        },
 };
@@ -41,7 +48,10 @@ 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 test_elm_exit(void)
+{
+       s_info.is_exit = true;
+}
 
 static void __case_start_on_animation(bool * is_passed)
 {
@@ -50,11 +60,33 @@ static void __case_start_on_animation(bool * is_passed)
        vconf_set_int(VCONFKEY_BOOT_ANIMATION_FINISHED, 0);
 
        vconf_get_int(VCONFKEY_BOOT_ANIMATION_FINISHED, &is_finished);
-       TEST_ASSERT_TRUE(is_finished == 0);
+       TEST_ASSERT_EQUAL_INT(0, is_finished);
 
        boot_exit = test_elm_exit;
+       s_info.is_exit = false;
+
        init_animation(TYPE_ON);
 
+       s_info.current_step = 1;
+       s_info.step_max = 7;
+
+       *is_passed = true;
+}
+
+static void __case_start_off_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_EQUAL_INT(0, is_finished);
+
+       init_animation(TYPE_OFF);
+
+       s_info.current_step = 1;
+       s_info.step_max = 3;
+
        *is_passed = true;
 }
 
@@ -62,22 +94,24 @@ static void __case_check_animation(bool * is_passed)
 {
        int rx, ry, rw, rh;
        Evas_Object *window = __t__get_window();
+       TEST_ASSERT_TRUE(window != NULL);
        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_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_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(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_TRUE(evas_object_visible_get(layout));
 
-       if (s_info.current_step < 8) {
+       if (s_info.current_step < s_info.step_max) {
                s_info.current_case -= 1;
        }
 
@@ -86,13 +120,32 @@ static void __case_check_animation(bool * is_passed)
        *is_passed = true;
 }
 
-static void __case_check_finish_animation(bool * is_passed)
+static void __case_check_finish_on_animation(bool * is_passed)
 {
        int is_finished = -1;
 
        vconf_get_int(VCONFKEY_BOOT_ANIMATION_FINISHED, &is_finished);
        TEST_ASSERT_TRUE(is_finished == 1);
 
+       TEST_ASSERT_TRUE(s_info.is_exit == true);
+       s_info.is_exit = false;
+
+       *is_passed = true;
+}
+
+static void __case_check_finish_off_animation(bool * is_passed)
+{
+       Evas_Object *display_block = __t__get_display_block();
+
+       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_TRUE(evas_object_visible_get(display_block));
+
        *is_passed = true;
 }
 
@@ -111,7 +164,7 @@ static Eina_Bool __group_timer_callback(void * data)
        return ECORE_CALLBACK_RENEW;
 }
 
-void group_feature_on_animation(unit_group_t * group)
+void group_feature_on_off_animation(unit_group_t * group)
 {
        if (s_info.group_timer) {
                ecore_timer_del(s_info.group_timer);
@@ -121,9 +174,8 @@ void group_feature_on_animation(unit_group_t * group)
        s_info.current_step = 0;
        s_info.current_case = 0;
        s_info.group = group;
-       /* 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);
+       /* 0.8 because boot-animation take 6 sec, we should not use divisor */
+       s_info.group_timer = ecore_timer_add(0.8, __group_timer_callback, NULL);
 }
 
 #endif
-
index d3f8a1d..26fce35 100755 (executable)
@@ -3,12 +3,10 @@
 
 #include "function_test.h"
 
-#define TEST_GROUP_COUNT 1
-
 static struct {
        int current_group;
-       char group_name[TEST_GROUP_COUNT + 1][128];
-       void(*group_starter_pool[TEST_GROUP_COUNT + 1])(unit_group_t * group);
+       char group_name[GROUP_COUNT_MAX + 1][128];
+       void(*group_starter_pool[GROUP_COUNT_MAX + 1])(unit_group_t * group);
 } s_info = {
        .current_group = 0,
        .group_name = {
index 3bc372f..b79a9a9 100755 (executable)
@@ -12,6 +12,9 @@
 
 #include <app.h>
 
+#define GROUP_COUNT_MAX 100
+#define CASE_COUNT_MAX 100
+
 #define TEST_GROUP(group_name, group_starter, group_complete_cb) unit_add_group(group_name, group_starter, group_complete_cb)
 #define TEST_CASE(group, case_starter) { \
                        bool is_passed = false; \