group_fuction_create_window 86/124986/3
authorjunkyu han <junkyu.han@samsung.com>
Thu, 13 Apr 2017 08:26:37 +0000 (17:26 +0900)
committerjunkyu han <junkyu.han@samsung.com>
Thu, 13 Apr 2017 08:57:15 +0000 (17:57 +0900)
Change-Id: I9eaae453efe4d156f37ff8f6cd7b9d926a580ad2

src/animation.c
src/boot.c
test/feature_test/feature_test.c [new file with mode: 0755]
test/feature_test/feature_test.h [new file with mode: 0755]
test/function_test/function_test.c [new file with mode: 0755]
test/function_test/function_test.h [new file with mode: 0755]
test/function_test/group_function_app_evas.c [new file with mode: 0755]
test/test_main.c

index 0542680..9c18bba 100644 (file)
@@ -112,7 +112,7 @@ static void __edje_cb(void *d, Evas_Object * obj, const char *e, const char *s)
        }
 }
 
-static Eina_Bool __layout_file_set(int state)
+static Eina_Bool __layout_file_set(Evas_Object *layout, int state)
 {
        char file_name[1024];
        char *on_off;
@@ -130,13 +130,13 @@ static Eina_Bool __layout_file_set(int state)
        ret = access(file_name, 0);
        if (ret == 0) {
                _D("This Resolution[%d]x[%d] is supported !!", s_animation.w, s_animation.h);
-               if (!elm_layout_file_set(s_animation.layout, file_name, on_off)) return EINA_FALSE;
+               if (!elm_layout_file_set(layout, file_name, on_off)) return EINA_FALSE;
        } else {
                _E("This Resolution[%d]x[%d] is STRANGE !!, Set default image '720x1280'", s_animation.w, s_animation.h);
                if (state == TYPE_ON) {
-                       if (!elm_layout_file_set(s_animation.layout, DEFAULT_ON, on_off)) return EINA_FALSE;
+                       if (!elm_layout_file_set(layout, DEFAULT_ON, on_off)) return EINA_FALSE;
                } else {
-                       if (!elm_layout_file_set(s_animation.layout, DEFAULT_OFF, on_off)) return EINA_FALSE;
+                       if (!elm_layout_file_set(layout, DEFAULT_OFF, on_off)) return EINA_FALSE;
                }
        }
 
@@ -152,7 +152,7 @@ static Evas_Object *__create_layout(const char *msg)
                return NULL;
        }
 
-       ret = __layout_file_set(s_animation.state);
+       ret = __layout_file_set(layout, s_animation.state);
        if (ret != EINA_TRUE) {
                _E("Failed to set layout file");
                evas_object_del(layout);
@@ -261,3 +261,10 @@ int fini_animation(void)
        close(1);
        return EXIT_SUCCESS;
 }
+
+#if TEST_MODE
+Evas_Object *__t_create_window(void)
+{
+       return __create_window();
+}
+#endif
index e735eaa..35285f1 100644 (file)
@@ -262,4 +262,12 @@ int main(int argc, char *argv[])
        return 0;
 }
 #endif
-//ELM_MAIN()
+
+#include "test.h"
+#if TEST_MODE
+int __t__prepare_animation(keynode_t * node, void *user_data)
+{
+       return __prepare_animation(node, user_data);
+}
+#endif
+
diff --git a/test/feature_test/feature_test.c b/test/feature_test/feature_test.c
new file mode 100755 (executable)
index 0000000..77b173f
--- /dev/null
@@ -0,0 +1,53 @@
+#include "test.h"
+#if TEST_MODE
+
+#include "feature_test.h"
+
+#include <Elementary.h>
+
+#define TEST_GROUP_COUNT 0
+
+static void __complete_group_cb(void);
+static void __run_next_group(void);
+
+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);
+} s_info = {
+       .current_group = 0,
+       .group_name = {
+                                       ""
+                               },
+       .group_starter_pool = {
+                                       NULL,
+                               },
+};
+
+static void __complete_group_cb(void)
+{
+       s_info.current_group += 1;
+
+       __run_next_group();
+}
+
+static void __run_next_group(void)
+{
+       if (s_info.group_starter_pool[s_info.current_group] == NULL) {
+               return ;
+       }
+
+       TEST_GROUP(s_info.group_name[s_info.current_group], s_info.group_starter_pool[s_info.current_group], __complete_group_cb);
+}
+
+void feature_test(void)
+{
+       unit_clear_log();
+
+       s_info.current_group = 0;
+
+       __run_next_group();
+}
+
+#endif
+
diff --git a/test/feature_test/feature_test.h b/test/feature_test/feature_test.h
new file mode 100755 (executable)
index 0000000..bd373c2
--- /dev/null
@@ -0,0 +1,15 @@
+#ifndef __FEATURE_TEST__
+#define __FEATURE_TEST__
+
+#include "test.h"
+#if TEST_MODE
+
+#include "../unit/inc/unit.h"
+
+#include <app.h>
+
+void feature_test(void);
+
+#endif
+
+#endif
diff --git a/test/function_test/function_test.c b/test/function_test/function_test.c
new file mode 100755 (executable)
index 0000000..326f55b
--- /dev/null
@@ -0,0 +1,49 @@
+#include "test.h"
+#if TEST_MODE
+
+#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);
+} s_info = {
+       .current_group = 0,
+       .group_name = {
+                                       "group_function_create_window",
+                                       ""
+                               },
+       .group_starter_pool = {
+                                       group_function_create_window,
+                                       NULL,
+                               },
+};
+
+static void __complete_group_cb(void);
+static void __run_next_group(void);
+
+static void __complete_group_cb(void)
+{
+       s_info.current_group += 1;
+
+       __run_next_group();
+}
+
+static void __run_next_group(void)
+{
+       if (s_info.group_starter_pool[s_info.current_group]) {
+               TEST_GROUP(s_info.group_name[s_info.current_group], s_info.group_starter_pool[s_info.current_group], __complete_group_cb);
+       }
+}
+
+void function_test(void)
+{
+       unit_clear_log();
+
+       s_info.current_group = 0;
+       __run_next_group();
+}
+
+#endif
diff --git a/test/function_test/function_test.h b/test/function_test/function_test.h
new file mode 100755 (executable)
index 0000000..bc14622
--- /dev/null
@@ -0,0 +1,14 @@
+#ifndef __FUNCTION_TEST__
+#define __FUNCTION_TEST__
+
+#include "test.h"
+#if TEST_MODE
+
+#include "../unit/inc/unit.h"
+
+void function_test(void);
+void group_function_create_window(unit_group_t * group);
+
+#endif
+
+#endif
diff --git a/test/function_test/group_function_app_evas.c b/test/function_test/group_function_app_evas.c
new file mode 100755 (executable)
index 0000000..84e8b43
--- /dev/null
@@ -0,0 +1,24 @@
+#include "test.h"
+#if TEST_MODE
+
+#include "function_test.h"
+#include <Elementary.h>
+
+static void __set_up(void){}
+static void __tear_down(void){}
+
+static void __case_create_win(bool * is_passed)
+{
+       Evas_Object *win = __t_create_window();
+
+       *is_passed = true;
+}
+
+void group_function_create_window(unit_group_t * group)
+{
+       TEST_CASE(group, __case_create_win);
+
+       group->finish(group);
+}
+
+#endif
index 50a322f..9868363 100755 (executable)
@@ -1,13 +1,15 @@
 #include "../inc/test.h"
 #if (TEST_MODE == TEST_APP)
 
-//#include "control/app_manager.h"
-
 #include "unit/inc/unit.h"
-//#include "function_test/function_test.h"
-//#include "feature_test/feature_test.h"
+#include "function_test/function_test.h"
+#include "feature_test/feature_test.h"
+#include "animation.h"
 
 #include <Elementary.h>
+#include <vconf.h>
+
+extern int __t__prepare_animation(keynode_t * node, void *user_data);
 
 static struct {
        Ecore_Timer * feature_test_run_timer;
@@ -15,67 +17,31 @@ static struct {
        .feature_test_run_timer = NULL,
 };
 
-static Eina_Bool __run_timer_callback(void * data);
-
-static bool __create(void * data)
-{
-       if (s_info.feature_test_run_timer) {
-               ecore_timer_del(s_info.feature_test_run_timer);
-               s_info.feature_test_run_timer = NULL;
-       }
-
-       s_info.feature_test_run_timer = ecore_timer_add(0.7, __run_timer_callback, NULL);
-
-       return true;
-}
-
-static void __app_control(app_control_h app_control_handle, void * data)
-{
-       return;
-}
-
-static void __resume(void * data)
-{
-       return;
-}
-
-static void __pause(void * data)
-{
-       return;
-}
-
-static void __terminate(void * data)
-{
-       return;
-}
-
 static Eina_Bool __run_timer_callback(void * data)
 {
        s_info.feature_test_run_timer = NULL;
        return ECORE_CALLBACK_CANCEL;
 }
 
+struct args {
+       int argc;
+       char **argv;
+       char *msg;
+};
+
 int main(int argc, char *argv[])
 {
        unit_init();
 
-       //function_test();
-
-       ui_app_lifecycle_callback_s lifecycle_callback = {NULL, };
+       elm_init(argc, argv);
 
-       lifecycle_callback.create = __create;
-       lifecycle_callback.app_control = __app_control;
-       lifecycle_callback.resume = __resume;
-       lifecycle_callback.pause = __pause;
-       lifecycle_callback.terminate = __terminate;
+       function_test();
 
-       int ret = ui_app_main(argc, argv, &lifecycle_callback, NULL);
-       if (ret != APP_ERROR_NONE) {
-               __T("app_main() is failed. err = %d", ret);
-       }
+       init_animation(1, NULL);
+       
+       elm_run();
 
        unit_fini();
-
        return 0;
 }