2 #include <Elementary.h>
5 // For checking the result of the positive test case.
6 #define TET_CHECK_PASS(x1, y...) \
8 Evas_Object *err = y; \
11 tet_printf("[TET_CHECK_PASS]:: %s[%d] : Test has failed..", __FILE__,__LINE__); \
12 tet_result(TET_FAIL); \
17 // For checking the result of the negative test case.
18 #define TET_CHECK_FAIL(x1, y...) \
20 Evas_Object *err = y; \
23 tet_printf("[TET_CHECK_FAIL]:: %s[%d] : Test has failed..", __FILE__,__LINE__); \
24 tet_result(TET_FAIL); \
30 Evas_Object *main_win;
31 static Elm_Genlist_Item_Class itci;
33 static void startup(void);
34 static void cleanup(void);
36 void (*tet_startup)(void) = startup;
37 void (*tet_cleanup)(void) = cleanup;
39 static void utc_UIFW_elm_index_item_data_set_func_01(void);
40 static void utc_UIFW_elm_index_item_data_set_func_02(void);
43 POSITIVE_TC_IDX = 0x01,
47 struct tet_testlist tet_testlist[] = {
48 { utc_UIFW_elm_index_item_data_set_func_01, POSITIVE_TC_IDX },
49 { utc_UIFW_elm_index_item_data_set_func_02, NEGATIVE_TC_IDX },
53 static void startup(void)
55 tet_infoline("[[ TET_MSG ]]:: ============ Startup ============ ");
57 main_win = elm_win_add(NULL, "main", ELM_WIN_BASIC);
58 evas_object_show(main_win);
61 static void cleanup(void)
63 if ( NULL != main_win ) {
64 evas_object_del(main_win);
68 tet_infoline("[[ TET_MSG ]]:: ============ Cleanup ============ ");
71 char *gli_label_get(const void *data, Evas_Object *obj, const char *part)
75 snprintf(buf, sizeof(buf), "%c%c",
76 'A' + ((j >> 4) & 0xf),
82 * @brief Positive test case of elm_index_item_data_set()
84 static void utc_UIFW_elm_index_item_data_set_func_01(void)
86 Evas_Object *idx = NULL;
87 Evas_Object *gl = NULL;
88 Elm_Genlist_Item *it = NULL;
89 Elm_Genlist_Item *it_gl = NULL;
90 Elm_Genlist_Item *it_glist = NULL;
91 Elm_Index_Item *item = NULL;
95 gl = elm_genlist_add(main_win);
96 idx= elm_index_add(main_win);
98 evas_object_show(idx);
99 itci.item_style = "default";
100 itci.func.label_get = gli_label_get;
101 itci.func.icon_get = NULL;
102 itci.func.state_get = NULL;
103 itci.func.del = NULL;
104 for (i = 0; i < 40; i++) {
105 it = elm_genlist_item_append(gl, &itci,(void *)j, NULL, ELM_GENLIST_ITEM_NONE, NULL,NULL);
106 if ((j & 0xf) == 0) {
108 snprintf(buf, sizeof(buf), "%c", 'A' + ((j >> 4) & 0xf));
109 elm_index_item_append(idx, buf, it);
113 if(i==4) it_glist=it;
115 elm_index_item_go(idx, 0);
116 item = elm_index_item_find(idx,it_gl);
117 elm_index_item_data_set(item,it_glist );
118 d = (void *) elm_index_item_data_get(item);
120 tet_infoline("elm_index_item_data_set() failed in positive test case");
121 tet_result(TET_FAIL);
124 tet_result(TET_PASS);
128 * @brief Negative test case of ug_init elm_index_item_data_set()
130 static void utc_UIFW_elm_index_item_data_set_func_02(void)
132 Evas_Object *idx = NULL;
133 Evas_Object *gl = NULL;
134 Elm_Genlist_Item *it = NULL;
135 Elm_Genlist_Item *it_gl = NULL;
136 Elm_Genlist_Item *it_glist = NULL;
137 Elm_Index_Item *item = NULL;
141 gl = elm_genlist_add(main_win);
142 idx= elm_index_add(main_win);
143 evas_object_show(gl);
144 evas_object_show(idx);
145 itci.item_style = "default";
146 itci.func.label_get = gli_label_get;
147 itci.func.icon_get = NULL;
148 itci.func.state_get = NULL;
149 itci.func.del = NULL;
150 for (i = 0; i < 40; i++) {
151 it = elm_genlist_item_append(gl, &itci,(void *)j, NULL, ELM_GENLIST_ITEM_NONE, NULL,NULL);
152 if ((j & 0xf) == 0) {
154 snprintf(buf, sizeof(buf), "%c", 'A' + ((j >> 4) & 0xf));
155 elm_index_item_append(idx, buf, it);
159 if(i==4) it_glist=it;
161 elm_index_item_go(idx, 0);
162 item = elm_index_item_find(idx,it_gl);
163 elm_index_item_data_set(NULL,it_glist );
164 d = (void *) elm_index_item_data_get(item);
166 tet_infoline("elm_index_item_data_set() failed in negative test case");
167 tet_result(TET_FAIL);
170 tet_result(TET_PASS);