Add group_feature_all_page_back
[profile/mobile/apps/native/homescreen-efl.git] / test / test_main.c
1 #include "../inc/test.h"
2 #if (TEST_MODE == TEST_APP)
3
4 #include "unit/inc/unit.h"
5 #include "app_log.h"
6 #include "homescreen-efl.h"
7 #include "feature_test/feature_test.h"
8
9 static struct {
10         Ecore_Timer * feature_test_run_timer;
11 } s_info = {
12         .feature_test_run_timer = NULL,
13 };
14
15 static Eina_Bool __run_timer_callback(void * data);
16
17 static Eina_Bool __run_timer_callback(void * data)
18 {
19         feature_test();
20
21         s_info.feature_test_run_timer = NULL;
22         return ECORE_CALLBACK_CANCEL;
23 }
24
25 static void __test_app_resume_cb(void *data)
26 {
27         __homescreen_efl_app_resume_cb(data);
28
29         if (s_info.feature_test_run_timer) {
30                 ecore_timer_del(s_info.feature_test_run_timer);
31                 s_info.feature_test_run_timer = NULL;
32         }
33
34         unit_init();
35
36         s_info.feature_test_run_timer = ecore_timer_add(0.2, __run_timer_callback, NULL);
37 }
38
39 int main(int argc, char *argv[])
40 {
41         __D("Starting homescreen-efl");
42
43         int ret = 0;
44         ui_app_lifecycle_callback_s event_callback = {0,};
45         app_event_handler_h handlers[5] = {NULL, };
46
47         event_callback.create = __homescreen_efl_app_create_cb;
48         event_callback.terminate = __homescreen_efl_app_terminate_cb;
49         event_callback.pause = __homescreen_efl_app_pause_cb;
50         event_callback.resume = __test_app_resume_cb;
51         event_callback.app_control = __homescreen_efl_app_control_cb;
52
53         ui_app_add_event_handler(&handlers[APP_EVENT_LOW_BATTERY], APP_EVENT_LOW_BATTERY, __homescreen_efl_low_battery_cb, NULL);
54         ui_app_add_event_handler(&handlers[APP_EVENT_LOW_MEMORY], APP_EVENT_LOW_MEMORY, __homescreen_efl_low_memory_cb, NULL);
55         ui_app_add_event_handler(&handlers[APP_EVENT_DEVICE_ORIENTATION_CHANGED], APP_EVENT_DEVICE_ORIENTATION_CHANGED, __homescreen_efl_orient_changed_cb, NULL);
56         ui_app_add_event_handler(&handlers[APP_EVENT_LANGUAGE_CHANGED], APP_EVENT_LANGUAGE_CHANGED, __homescreen_efl_lang_changed_cb, NULL);
57         ui_app_add_event_handler(&handlers[APP_EVENT_REGION_FORMAT_CHANGED], APP_EVENT_REGION_FORMAT_CHANGED, __homescreen_efl_region_changed_cb, NULL);
58
59         ret = ui_app_main(argc, argv, &event_callback, NULL);
60         if (ret != APP_ERROR_NONE)
61                 __E("ui_app_main() is failed. err = %d", ret);
62
63         return ret;
64 }
65
66 #endif