Merge "[entry] fixed bug in getting geometry of wd->scroller"
[framework/uifw/elementary.git] / TC / elm_ts / navigationbar / utc_UIFW_elm_navigationbar_title_label_set_func.c
1 #include <tet_api.h>
2 #include <Elementary.h>
3 #define ICON_DIR "usr/share/beat_winset_test/icon"
4
5
6 // Definitions
7 // For checking the result of the positive test case.
8 #define TET_CHECK_PASS(x1, y...) \
9 { \
10         Evas_Object *err = y; \
11         if (err == (x1)) \
12                 { \
13                         tet_printf("[TET_CHECK_PASS]:: %s[%d] : Test has failed..", __FILE__,__LINE__); \
14                         tet_result(TET_FAIL); \
15                         return; \
16                 } \
17 }
18
19 // For checking the result of the negative test case.
20 #define TET_CHECK_FAIL(x1, y...) \
21 { \
22         Evas_Object *err = y; \
23         if (err != (x1)) \
24                 { \
25                         tet_printf("[TET_CHECK_FAIL]:: %s[%d] : Test has failed..", __FILE__,__LINE__); \
26                         tet_result(TET_FAIL); \
27                         return; \
28                 } \
29 }
30
31
32 Evas_Object *main_win, *navibar;
33 char buf[4096];
34
35
36
37 static void startup(void);
38 static void cleanup(void);
39
40 void (*tet_startup)(void) = startup;
41 void (*tet_cleanup)(void) = cleanup;
42
43 static void utc_UIFW_elm_navigationbar_title_label_set_func_01(void);
44 static void utc_UIFW_elm_navigationbar_title_label_set_func_02(void);
45
46 enum {
47         POSITIVE_TC_IDX = 0x01,
48         NEGATIVE_TC_IDX,
49 };
50
51 struct tet_testlist tet_testlist[] = {
52         { utc_UIFW_elm_navigationbar_title_label_set_func_01, POSITIVE_TC_IDX },
53         { utc_UIFW_elm_navigationbar_title_label_set_func_02, NEGATIVE_TC_IDX },
54         { NULL, 0 }
55 };
56
57 static void startup(void)
58 {
59         tet_infoline("[[ TET_MSG ]]:: ============ Startup ============ ");
60         elm_init(0, NULL);
61         main_win = elm_win_add(NULL, "main", ELM_WIN_BASIC);
62         evas_object_show(main_win);
63         navibar = elm_navigationbar_add(main_win);
64         evas_object_show(navibar);
65 }
66
67 static void cleanup(void)
68 {
69         if ( NULL != navibar ) {
70                 evas_object_del(navibar);
71                 navibar = NULL;
72         }
73         if ( NULL != main_win ) {
74                 evas_object_del(main_win);
75                 main_win = NULL;
76         }
77         elm_shutdown();
78         tet_infoline("[[ TET_MSG ]]:: ============ Cleanup ============ ");
79 }
80
81 /**
82  * @brief Positive test case of elm_navigationbar_title_label_set()
83  */
84 static void utc_UIFW_elm_navigationbar_title_label_set_func_01(void)
85 {
86         Evas_Object *content = elm_icon_add(navibar);
87         snprintf(buf, sizeof(buf), "%s/00_volume_icon.png", ICON_DIR);
88         elm_icon_file_set(content, buf, NULL);
89         evas_object_size_hint_aspect_set(content, EVAS_ASPECT_CONTROL_VERTICAL, 1, 1);
90         elm_icon_scale_set(content, 1, 1);
91
92         elm_navigationbar_push(navibar, "title", NULL, NULL, NULL, content);
93         elm_navigationbar_title_label_set(navibar, content, "Title");
94         tet_result(TET_PASS);
95 }
96
97 /**
98  * @brief Negative test case of ug_init elm_navigationbar_title_label_set()
99  */
100 static void utc_UIFW_elm_navigationbar_title_label_set_func_02(void)
101 {
102         Evas_Object *content = elm_icon_add(navibar);
103         snprintf(buf, sizeof(buf), "%s/00_volume_icon.png", ICON_DIR);
104         elm_icon_file_set(content, buf, NULL);
105         evas_object_size_hint_aspect_set(content, EVAS_ASPECT_CONTROL_VERTICAL, 1, 1);
106         elm_icon_scale_set(content, 1, 1);
107
108         elm_navigationbar_push(navibar, "title", NULL, NULL, NULL, content);
109         elm_navigationbar_title_label_set(NULL, NULL, NULL);
110         tet_result(TET_PASS);
111 }