jpeg pushed a commit to branch master.

http://git.enlightenment.org/core/efl.git/commit/?id=d299515788ac451d8b9fbf5b68b9ccedf5c419bb

commit d299515788ac451d8b9fbf5b68b9ccedf5c419bb
Author: Jean-Philippe Andre <jp.an...@samsung.com>
Date:   Thu Jun 23 21:54:11 2016 +0900

    config: Test profile APIs
---
 src/tests/elementary/elm_test_config.c | 67 +++++++++++++++++++++++++++++++++-
 1 file 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)
           fail(channels[i].name);
      }
 
-
-
    elm_shutdown();
 }
 END_TEST
@@ -167,9 +165,74 @@ START_TEST (elm_config_win)
 }
 END_TEST
 
+static inline Eina_Bool
+_eina_list_string_has(const Eina_List *list, const char *str)
+{
+   const char *s;
+   Eina_List *l;
+
+   EINA_LIST_FOREACH(list, l, s)
+     if (eina_streq(str, s))
+       return EINA_TRUE;
+
+   return EINA_FALSE;
+}
+
+START_TEST (elm_config_profiles)
+{
+   elm_init(1, NULL);
+
+   // this only tests some of the profile APIs. we're not going to mess with
+   // the global config during make check :)
+
+   Eo *cfg = eo_provider_find(ecore_main_loop_get(), EFL_CONFIG_INTERFACE);
+   fail_if(!cfg);
+
+   for (int hidden = 0; hidden <= 1; hidden++)
+     {
+        Eina_List *list;
+        Eina_Iterator *it;
+        const char *prof;
+        int cnt = 0;
+
+        list = (!hidden) ? elm_config_profile_list_get()
+                         : elm_config_profile_list_full_get();
+        it = efl_config_profile_iterate(cfg, hidden);
+        EINA_ITERATOR_FOREACH(it, prof)
+          {
+             fail_if(!_eina_list_string_has(list, prof));
+             cnt++;
+          }
+        fail_if(cnt != eina_list_count(list));
+        elm_config_profile_list_free(list);
+        eina_iterator_free(it);
+     }
+
+   const char *dir, *profile;
+   Eina_Stringshare *str;
+
+   profile = elm_config_profile_get();
+   dir = elm_config_profile_dir_get(elm_config_profile_get(), EINA_TRUE);
+   str = efl_config_profile_dir_get(cfg, profile, EINA_TRUE);
+   fail_if(!eina_streq(dir, str));
+   elm_config_profile_dir_free(dir);
+   eina_stringshare_del(str);
+
+   dir = elm_config_profile_dir_get(elm_config_profile_get(), EINA_FALSE);
+   str = efl_config_profile_dir_get(cfg, profile, EINA_FALSE);
+   fail_if(!eina_streq(dir, str));
+   elm_config_profile_dir_free(dir);
+   eina_stringshare_del(str);
+
+   fail_if(!elm_config_profile_exists(profile));
+
+   elm_shutdown();
+}
+END_TEST
 
 void elm_test_config(TCase *tc)
 {
    tcase_add_test(tc, elm_config_eoapi);
    tcase_add_test(tc, elm_config_win);
+   tcase_add_test(tc, elm_config_profiles);
 }

-- 


Reply via email to