summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorVitalii Vorobiov <vi.vorobiov@samsung.com>2014-11-11 18:09:09 +0200
committerVitalii Vorobiov <vi.vorobiov@samsung.com>2014-11-11 18:09:09 +0200
commitc058aef695d7fd3fa095f98fdd18ea2526c8b9cf (patch)
treeedf2dd6e90cb80e8967ed47eed8f38a59418734d
parent5d3c5c0800545e0bfce8da9f8324e005edaa98c9 (diff)
Combobox: fixing dead code in combobox.
When giving NULL into set_title function it should set "" instead of NULL. But function was returning instany EINA_FALSE instead of doing something. (WITH TESTS) [Prevent fix #52809]
-rw-r--r--src/lib/ewe_combobox.c2
-rw-r--r--tests/test_ewe_combobox/ewe_combobox_item_title_set.c16
-rw-r--r--tests/test_ewe_combobox/test_ewe_combobox.c2
-rw-r--r--tests/test_ewe_combobox/test_ewe_combobox.h8
4 files changed, 17 insertions, 11 deletions
diff --git a/src/lib/ewe_combobox.c b/src/lib/ewe_combobox.c
index f03d43e..e2ee2bd 100644
--- a/src/lib/ewe_combobox.c
+++ b/src/lib/ewe_combobox.c
@@ -313,7 +313,7 @@ _ewe_combobox_item_title_set(Eo *obj EINA_UNUSED,
313 int index, 313 int index,
314 Eina_Stringshare *title) 314 Eina_Stringshare *title)
315{ 315{
316 if (((int)eina_list_count(sd->items) < (index + 1)) || (index < 0) || (!title)) 316 if (((int)eina_list_count(sd->items) < (index + 1)) || (index < 0))
317 return EINA_FALSE; 317 return EINA_FALSE;
318 Ewe_Combobox_Item *item; 318 Ewe_Combobox_Item *item;
319 item = eina_list_nth(sd->items, index); 319 item = eina_list_nth(sd->items, index);
diff --git a/tests/test_ewe_combobox/ewe_combobox_item_title_set.c b/tests/test_ewe_combobox/ewe_combobox_item_title_set.c
index e360cc3..e19cda9 100644
--- a/tests/test_ewe_combobox/ewe_combobox_item_title_set.c
+++ b/tests/test_ewe_combobox/ewe_combobox_item_title_set.c
@@ -112,7 +112,7 @@ END_TEST
112 * @{ 112 * @{
113 * <tr> 113 * <tr>
114 * <td>ewe_combobox_item_title_set</td> 114 * <td>ewe_combobox_item_title_set</td>
115 * <td>ewe_combobox_item_title_set_test_n1</td> 115 * <td>ewe_combobox_item_title_set_test_p3</td>
116 * <td> 116 * <td>
117 * @precondition 117 * @precondition
118 * @step 1 initialized ewe 118 * @step 1 initialized ewe
@@ -125,20 +125,20 @@ END_TEST
125 * @step 2 check that returned value 125 * @step 2 check that returned value
126 * </td> 126 * </td>
127 * <td>Evas_Object *combobox, int 0, NULL</td> 127 * <td>Evas_Object *combobox, int 0, NULL</td>
128 * <td>EINA_FALSE</td> 128 * <td>EINA_TRUE</td>
129 * <td>_REAL_RESULT_</td> 129 * <td>_REAL_RESULT_</td>
130 * <td>_PASSED_</td> 130 * <td>_PASSED_</td>
131 * </tr> 131 * </tr>
132 * @} 132 * @}
133 */ 133 */
134EWE_TEST(ewe_combobox_item_title_set_test_n1) 134EWE_TEST(ewe_combobox_item_title_set_test_p3)
135{ 135{
136 ewe_init(0, 0); 136 ewe_init(0, 0);
137 Evas_Object *win = elm_win_util_standard_add("test", "test"); 137 Evas_Object *win = elm_win_util_standard_add("test", "test");
138 Evas_Object *combobox = ewe_combobox_add(win); 138 Evas_Object *combobox = ewe_combobox_add(win);
139 ewe_combobox_item_add(combobox, NULL); 139 ewe_combobox_item_add(combobox, NULL);
140 140
141 ck_assert_msg(ewe_combobox_item_title_set(combobox, 0, NULL) == EINA_FALSE, "NULL title was set to item"); 141 ck_assert_msg(ewe_combobox_item_title_set(combobox, 0, NULL) == EINA_TRUE, "Could not set NULL title to item");
142 142
143 evas_object_del(win); 143 evas_object_del(win);
144 ewe_shutdown(); 144 ewe_shutdown();
@@ -150,7 +150,7 @@ END_TEST
150 * @{ 150 * @{
151 * <tr> 151 * <tr>
152 * <td>ewe_combobox_item_title_set</td> 152 * <td>ewe_combobox_item_title_set</td>
153 * <td>ewe_combobox_item_title_set_test_n2</td> 153 * <td>ewe_combobox_item_title_set_test_n1</td>
154 * <td> 154 * <td>
155 * @precondition 155 * @precondition
156 * @step 1 initialized ewe 156 * @step 1 initialized ewe
@@ -166,7 +166,7 @@ END_TEST
166 * </tr> 166 * </tr>
167 * @} 167 * @}
168 */ 168 */
169EWE_TEST(ewe_combobox_item_title_set_test_n2) 169EWE_TEST(ewe_combobox_item_title_set_test_n1)
170{ 170{
171 ewe_init(0, 0); 171 ewe_init(0, 0);
172 172
@@ -181,7 +181,7 @@ END_TEST
181 * @{ 181 * @{
182 * <tr> 182 * <tr>
183 * <td>ewe_combobox_item_title_set</td> 183 * <td>ewe_combobox_item_title_set</td>
184 * <td>ewe_combobox_item_title_set_test_n3</td> 184 * <td>ewe_combobox_item_title_set_test_n2</td>
185 * <td> 185 * <td>
186 * @precondition 186 * @precondition
187 * @step 1 initialized ewe 187 * @step 1 initialized ewe
@@ -200,7 +200,7 @@ END_TEST
200 * </tr> 200 * </tr>
201 * @} 201 * @}
202 */ 202 */
203EWE_TEST(ewe_combobox_item_title_set_test_n3) 203EWE_TEST(ewe_combobox_item_title_set_test_n2)
204{ 204{
205 ewe_init(0, 0); 205 ewe_init(0, 0);
206 Evas_Object *win = elm_win_util_standard_add("test", "test"); 206 Evas_Object *win = elm_win_util_standard_add("test", "test");
diff --git a/tests/test_ewe_combobox/test_ewe_combobox.c b/tests/test_ewe_combobox/test_ewe_combobox.c
index bb73c88..4152445 100644
--- a/tests/test_ewe_combobox/test_ewe_combobox.c
+++ b/tests/test_ewe_combobox/test_ewe_combobox.c
@@ -32,9 +32,9 @@ Suite* test_suite (void) {
32 tcase_add_test(tcase, ewe_combobox_item_title_get_test_n2); 32 tcase_add_test(tcase, ewe_combobox_item_title_get_test_n2);
33 tcase_add_test(tcase, ewe_combobox_item_title_set_test_p1); 33 tcase_add_test(tcase, ewe_combobox_item_title_set_test_p1);
34 tcase_add_test(tcase, ewe_combobox_item_title_set_test_p2); 34 tcase_add_test(tcase, ewe_combobox_item_title_set_test_p2);
35 tcase_add_test(tcase, ewe_combobox_item_title_set_test_p3);
35 tcase_add_test(tcase, ewe_combobox_item_title_set_test_n1); 36 tcase_add_test(tcase, ewe_combobox_item_title_set_test_n1);
36 tcase_add_test(tcase, ewe_combobox_item_title_set_test_n2); 37 tcase_add_test(tcase, ewe_combobox_item_title_set_test_n2);
37 tcase_add_test(tcase, ewe_combobox_item_title_set_test_n3);
38 tcase_add_test(tcase, ewe_combobox_items_list_get_test_p); 38 tcase_add_test(tcase, ewe_combobox_items_list_get_test_p);
39 tcase_add_test(tcase, ewe_combobox_items_list_get_test_n); 39 tcase_add_test(tcase, ewe_combobox_items_list_get_test_n);
40 tcase_add_test(tcase, ewe_combobox_select_item_set_test_p); 40 tcase_add_test(tcase, ewe_combobox_select_item_set_test_p);
diff --git a/tests/test_ewe_combobox/test_ewe_combobox.h b/tests/test_ewe_combobox/test_ewe_combobox.h
index 847b68d..204e137 100644
--- a/tests/test_ewe_combobox/test_ewe_combobox.h
+++ b/tests/test_ewe_combobox/test_ewe_combobox.h
@@ -29,21 +29,27 @@ void ewe_combobox_add_test_n(int);
29void ewe_combobox_item_add_test_p1(int); 29void ewe_combobox_item_add_test_p1(int);
30void ewe_combobox_item_add_test_p2(int); 30void ewe_combobox_item_add_test_p2(int);
31void ewe_combobox_item_add_test_n(int); 31void ewe_combobox_item_add_test_n(int);
32
32void ewe_combobox_item_del_test_p(int); 33void ewe_combobox_item_del_test_p(int);
33void ewe_combobox_item_del_test_n(int); 34void ewe_combobox_item_del_test_n(int);
35
34void ewe_combobox_item_title_get_test_p(int); 36void ewe_combobox_item_title_get_test_p(int);
35void ewe_combobox_item_title_get_test_n1(int); 37void ewe_combobox_item_title_get_test_n1(int);
36void ewe_combobox_item_title_get_test_n2(int); 38void ewe_combobox_item_title_get_test_n2(int);
39
37void ewe_combobox_item_title_set_test_p1(int); 40void ewe_combobox_item_title_set_test_p1(int);
38void ewe_combobox_item_title_set_test_p2(int); 41void ewe_combobox_item_title_set_test_p2(int);
42void ewe_combobox_item_title_set_test_p3(int);
39void ewe_combobox_item_title_set_test_n1(int); 43void ewe_combobox_item_title_set_test_n1(int);
40void ewe_combobox_item_title_set_test_n2(int); 44void ewe_combobox_item_title_set_test_n2(int);
41void ewe_combobox_item_title_set_test_n3(int); 45
42void ewe_combobox_items_list_get_test_p(int); 46void ewe_combobox_items_list_get_test_p(int);
43void ewe_combobox_items_list_get_test_n(int); 47void ewe_combobox_items_list_get_test_n(int);
48
44void ewe_combobox_select_item_set_test_p(int); 49void ewe_combobox_select_item_set_test_p(int);
45void ewe_combobox_select_item_set_test_n1(int); 50void ewe_combobox_select_item_set_test_n1(int);
46void ewe_combobox_select_item_set_test_n2(int); 51void ewe_combobox_select_item_set_test_n2(int);
52
47void ewe_combobox_select_item_get_test_p1(int); 53void ewe_combobox_select_item_get_test_p1(int);
48void ewe_combobox_select_item_get_test_p2(int); 54void ewe_combobox_select_item_get_test_p2(int);
49void ewe_combobox_select_item_get_test_n(int); 55void ewe_combobox_select_item_get_test_n(int);