c1928d7672942a1b384daffa1c99e85fc4bf7c79
[framework/uifw/elementary.git] / TC / elm_ts / calendar / utc_UIFW_elm_calendar_selected_time_set_func.c
1 #include <tet_api.h>
2
3
4 // Definitions
5 // For checking the result of the positive test case.
6 #define TET_CHECK_PASS(x1, y...) \
7 { \
8         Evas_Object *err = y; \
9         if (err == (x1)) \
10                 { \
11                         tet_printf("[TET_CHECK_PASS]:: %s[%d] : Test has failed..", __FILE__,__LINE__); \
12                         tet_result(TET_FAIL); \
13                         return; \
14                 } \
15 }
16
17 // For checking the result of the negative test case.
18 #define TET_CHECK_FAIL(x1, y...) \
19 { \
20         Evas_Object *err = y; \
21         if (err != (x1)) \
22                 { \
23                         tet_printf("[TET_CHECK_FAIL]:: %s[%d] : Test has failed..", __FILE__,__LINE__); \
24                         tet_result(TET_FAIL); \
25                         return; \
26                 } \
27 }
28
29 static void startup(void);
30 static void cleanup(void);
31
32 void (*tet_startup)(void) = startup;
33 void (*tet_cleanup)(void) = cleanup;
34
35 static void utc_UIFW_elm_calendar_selected_time_set_func_01(void);
36 static void utc_UIFW_elm_calendar_selected_time_set_func_02(void);
37
38 enum {
39         POSITIVE_TC_IDX = 0x01,
40         NEGATIVE_TC_IDX,
41 };
42
43 struct tet_testlist tet_testlist[] = {
44         { utc_UIFW_elm_calendar_selected_time_set_func_01, POSITIVE_TC_IDX },
45         { utc_UIFW_elm_calendar_selected_time_set_func_02, NEGATIVE_TC_IDX },
46 };
47
48 static void startup(void)
49 {
50    tet_infoline("[[ TET_MSG ]]:: ============ Startup ============ ");
51
52    elm_init(0, NULL);
53    main_win = elm_win_add(NULL, "main", ELM_WIN_BASIC);
54    evas_object_show(main_win);
55 }
56
57 static void cleanup(void)
58 {
59    if ( NULL != main_win ) {
60            evas_object_del(main_win);
61            main_win = NULL;
62    }
63
64    elm_shutdown();
65    tet_infoline("[[ TET_MSG ]]:: ============ Cleanup ============ ");
66 }
67
68 /**
69  * @brief Positive test case of elm_calendar_selected_time_set()
70  */
71 static void utc_UIFW_elm_calendar_selected_time_set_func_01(void)
72 {
73    Evas_Object *test_eo = NULL;
74    struct tm selected_time;
75    time_t current_time;
76    test_eo = elm_calendar_add(main_win);
77    current_time = time(NULL) + 34 * 84600;
78    localtime_r(&current_time, &selected_time);
79    elm_calendar_selected_time_set(test_eo, &selected_time);
80
81    TET_CHECK_PASS(NULL, test_eo);
82
83    tet_result(TET_PASS);
84    tet_infoline("elm_calendar_selected_time_set() passed in positive test case");
85    evas_object_del(test_eo);
86    test_eo = NULL;
87 }
88
89 /**
90  * @brief Negative test case of ug_init elm_calendar_selected_time_set()
91  */
92 static void utc_UIFW_elm_calendar_selected_time_set_func_02(void)
93 {
94    Evas_Object *test_eo = NULL;
95    struct tm selected_time;
96    time_t current_time;
97    test_eo = elm_calendar_add(main_win);
98    current_time = time(NULL) + 34 * 84600;
99    localtime_r(&current_time, &selected_time);
100    elm_calendar_selected_time_set(NULL, &selected_time);
101    tet_infoline("elm_calendar_selected_time_set() passed in negative test case");
102    evas_object_del(test_eo);
103    test_eo = NULL;
104    tet_result(TET_PASS);
105 }