summaryrefslogtreecommitdiff
path: root/src/tests/elementary/elm_test_config.c
diff options
context:
space:
mode:
authorJean-Philippe Andre <jp.andre@samsung.com>2016-06-23 21:54:11 +0900
committerJean-Philippe Andre <jp.andre@samsung.com>2016-06-24 17:10:21 +0900
commitd299515788ac451d8b9fbf5b68b9ccedf5c419bb (patch)
tree82c7179981296510b1ba5f4a8a92d9e60cc052d8 /src/tests/elementary/elm_test_config.c
parent0f6268ff44ad3f4f75340b0a171c1f7418e4291e (diff)
config: Test profile APIs
Diffstat (limited to '')
-rw-r--r--src/tests/elementary/elm_test_config.c67
1 files changed, 65 insertions, 2 deletions
diff --git a/src/tests/elementary/elm_test_config.c b/src/tests/elementary/elm_test_config.c
index f74d492..a30860e 100644
--- a/src/tests/elementary/elm_test_config.c
+++ b/src/tests/elementary/elm_test_config.c
@@ -142,8 +142,6 @@ START_TEST (elm_config_eoapi)
142 fail(channels[i].name); 142 fail(channels[i].name);
143 } 143 }
144 144
145
146
147 elm_shutdown(); 145 elm_shutdown();
148} 146}
149END_TEST 147END_TEST
@@ -167,9 +165,74 @@ START_TEST (elm_config_win)
167} 165}
168END_TEST 166END_TEST
169 167
168static inline Eina_Bool
169_eina_list_string_has(const Eina_List *list, const char *str)
170{
171 const char *s;
172 Eina_List *l;
173
174 EINA_LIST_FOREACH(list, l, s)
175 if (eina_streq(str, s))
176 return EINA_TRUE;
177
178 return EINA_FALSE;
179}
180
181START_TEST (elm_config_profiles)
182{
183 elm_init(1, NULL);
184
185 // this only tests some of the profile APIs. we're not going to mess with
186 // the global config during make check :)
187
188 Eo *cfg = eo_provider_find(ecore_main_loop_get(), EFL_CONFIG_INTERFACE);
189 fail_if(!cfg);
190
191 for (int hidden = 0; hidden <= 1; hidden++)
192 {
193 Eina_List *list;
194 Eina_Iterator *it;
195 const char *prof;
196 int cnt = 0;
197
198 list = (!hidden) ? elm_config_profile_list_get()
199 : elm_config_profile_list_full_get();
200 it = efl_config_profile_iterate(cfg, hidden);
201 EINA_ITERATOR_FOREACH(it, prof)
202 {
203 fail_if(!_eina_list_string_has(list, prof));
204 cnt++;
205 }
206 fail_if(cnt != eina_list_count(list));
207 elm_config_profile_list_free(list);
208 eina_iterator_free(it);
209 }
210
211 const char *dir, *profile;
212 Eina_Stringshare *str;
213
214 profile = elm_config_profile_get();
215 dir = elm_config_profile_dir_get(elm_config_profile_get(), EINA_TRUE);
216 str = efl_config_profile_dir_get(cfg, profile, EINA_TRUE);
217 fail_if(!eina_streq(dir, str));
218 elm_config_profile_dir_free(dir);
219 eina_stringshare_del(str);
220
221 dir = elm_config_profile_dir_get(elm_config_profile_get(), EINA_FALSE);
222 str = efl_config_profile_dir_get(cfg, profile, EINA_FALSE);
223 fail_if(!eina_streq(dir, str));
224 elm_config_profile_dir_free(dir);
225 eina_stringshare_del(str);
226
227 fail_if(!elm_config_profile_exists(profile));
228
229 elm_shutdown();
230}
231END_TEST
170 232
171void elm_test_config(TCase *tc) 233void elm_test_config(TCase *tc)
172{ 234{
173 tcase_add_test(tc, elm_config_eoapi); 235 tcase_add_test(tc, elm_config_eoapi);
174 tcase_add_test(tc, elm_config_win); 236 tcase_add_test(tc, elm_config_win);
237 tcase_add_test(tc, elm_config_profiles);
175} 238}