summaryrefslogtreecommitdiff
path: root/src/tests/efreet
diff options
context:
space:
mode:
authorLucas De Marchi <lucas.demarchi@profusion.mobi>2013-01-14 21:04:30 +0000
committerLucas De Marchi <lucas.demarchi@profusion.mobi>2013-01-14 21:04:30 +0000
commit1a4535b5ff5ebfa74ce707bf55d2d4efb7dc6347 (patch)
tree862f86f39497068f90d90e5451280bffc15a4686 /src/tests/efreet
parent2d7e10363d7d209a605329ba692a3e788b37dc68 (diff)
efl/efreet: formatting tests
SVN revision: 82780
Diffstat (limited to 'src/tests/efreet')
-rw-r--r--src/tests/efreet/ef_cache.c302
-rw-r--r--src/tests/efreet/ef_data_dirs.c416
-rw-r--r--src/tests/efreet/ef_desktop.c630
-rw-r--r--src/tests/efreet/ef_icon_theme.c870
-rw-r--r--src/tests/efreet/ef_ini.c228
-rw-r--r--src/tests/efreet/ef_locale.c106
-rw-r--r--src/tests/efreet/ef_menu.c152
-rw-r--r--src/tests/efreet/ef_mime.c48
-rw-r--r--src/tests/efreet/ef_utils.c30
-rw-r--r--src/tests/efreet/main.c130
10 files changed, 1456 insertions, 1456 deletions
diff --git a/src/tests/efreet/ef_cache.c b/src/tests/efreet/ef_cache.c
index cf40eaf..5485584 100644
--- a/src/tests/efreet/ef_cache.c
+++ b/src/tests/efreet/ef_cache.c
@@ -16,184 +16,184 @@ static Eina_Bool desktop_cb = EINA_FALSE;
16static void 16static void
17check(void) 17check(void)
18{ 18{
19 Eina_List *list; 19 Eina_List *list;
20 Efreet_Desktop *desktop, *desktop2; 20 Efreet_Desktop *desktop, *desktop2;
21 double start; 21 double start;
22 const char *id; 22 const char *id;
23 23
24 // EAPI char *efreet_util_path_to_file_id(const char *path); 24 // EAPI char *efreet_util_path_to_file_id(const char *path);
25 start = ecore_time_get(); 25 start = ecore_time_get();
26 id = efreet_util_path_to_file_id("/usr/share/applications/gnome-panel.desktop"); 26 id = efreet_util_path_to_file_id("/usr/share/applications/gnome-panel.desktop");
27 if (id) 27 if (id)
28 { 28 {
29 printf("efreet_util_path_to_file_id(/usr/share/applications/gnome-panel.desktop): %s %.6f\n", id, (ecore_time_get() - start)); 29 printf("efreet_util_path_to_file_id(/usr/share/applications/gnome-panel.desktop): %s %.6f\n", id, (ecore_time_get() - start));
30 } 30 }
31 else 31 else
32 printf("efreet_util_path_to_file_id(/usr/share/applications/gnome-panel.desktop): NULL %.6f\n", (ecore_time_get() - start)); 32 printf("efreet_util_path_to_file_id(/usr/share/applications/gnome-panel.desktop): NULL %.6f\n", (ecore_time_get() - start));
33 33
34 //EAPI Efreet_Desktop *efreet_util_desktop_name_find(const char *name); 34 //EAPI Efreet_Desktop *efreet_util_desktop_name_find(const char *name);
35 start = ecore_time_get(); 35 start = ecore_time_get();
36 desktop = efreet_util_desktop_name_find("Evolution"); 36 desktop = efreet_util_desktop_name_find("Evolution");
37 if (desktop) 37 if (desktop)
38 printf("efreet_util_desktop_name_find(Evolution): %s %.6f\n", desktop->orig_path, (ecore_time_get() - start)); 38 printf("efreet_util_desktop_name_find(Evolution): %s %.6f\n", desktop->orig_path, (ecore_time_get() - start));
39 else 39 else
40 printf("efreet_util_desktop_name_find(Evolution): NULL %.6f\n", (ecore_time_get() - start)); 40 printf("efreet_util_desktop_name_find(Evolution): NULL %.6f\n", (ecore_time_get() - start));
41 efreet_desktop_free(desktop); 41 efreet_desktop_free(desktop);
42 42
43 //EAPI Efreet_Desktop *efreet_util_desktop_generic_name_find(const char *generic_name); 43 //EAPI Efreet_Desktop *efreet_util_desktop_generic_name_find(const char *generic_name);
44 start = ecore_time_get(); 44 start = ecore_time_get();
45 desktop = efreet_util_desktop_generic_name_find("Spreadsheet"); 45 desktop = efreet_util_desktop_generic_name_find("Spreadsheet");
46 if (desktop) 46 if (desktop)
47 printf("efreet_util_desktop_generic_name_find(Spreadsheet): %s %.6f\n", desktop->orig_path, (ecore_time_get() - start)); 47 printf("efreet_util_desktop_generic_name_find(Spreadsheet): %s %.6f\n", desktop->orig_path, (ecore_time_get() - start));
48 else 48 else
49 printf("efreet_util_desktop_generic_name_find(Spreadsheet): NULL %.6f\n", (ecore_time_get() - start)); 49 printf("efreet_util_desktop_generic_name_find(Spreadsheet): NULL %.6f\n", (ecore_time_get() - start));
50 efreet_desktop_free(desktop); 50 efreet_desktop_free(desktop);
51 51
52 //EAPI Efreet_Desktop *efreet_util_desktop_wm_class_find(const char *wmname, const char *wmclass); 52 //EAPI Efreet_Desktop *efreet_util_desktop_wm_class_find(const char *wmname, const char *wmclass);
53 start = ecore_time_get(); 53 start = ecore_time_get();
54 desktop = efreet_util_desktop_wm_class_find("Firefox", NULL); 54 desktop = efreet_util_desktop_wm_class_find("Firefox", NULL);
55 if (desktop) 55 if (desktop)
56 printf("efreet_util_desktop_wm_class_find(Firefox): %s %.6f\n", desktop->orig_path, (ecore_time_get() - start)); 56 printf("efreet_util_desktop_wm_class_find(Firefox): %s %.6f\n", desktop->orig_path, (ecore_time_get() - start));
57 else 57 else
58 printf("efreet_util_desktop_wm_class_find(Firefox): NULL %.6f\n", (ecore_time_get() - start)); 58 printf("efreet_util_desktop_wm_class_find(Firefox): NULL %.6f\n", (ecore_time_get() - start));
59 efreet_desktop_free(desktop); 59 efreet_desktop_free(desktop);
60 60
61 //EAPI Efreet_Desktop *efreet_util_desktop_exec_find(const char *exec); 61 //EAPI Efreet_Desktop *efreet_util_desktop_exec_find(const char *exec);
62 start = ecore_time_get(); 62 start = ecore_time_get();
63 desktop = efreet_util_desktop_exec_find("/usr/bin/update-manager"); 63 desktop = efreet_util_desktop_exec_find("/usr/bin/update-manager");
64 if (desktop) 64 if (desktop)
65 printf("efreet_util_desktop_exec_find(update-manager): %s %.6f\n", desktop->orig_path, (ecore_time_get() - start)); 65 printf("efreet_util_desktop_exec_find(update-manager): %s %.6f\n", desktop->orig_path, (ecore_time_get() - start));
66 else 66 else
67 printf("efreet_util_desktop_exec_find(update-manager): NULL %.6f\n", (ecore_time_get() - start)); 67 printf("efreet_util_desktop_exec_find(update-manager): NULL %.6f\n", (ecore_time_get() - start));
68 efreet_desktop_free(desktop); 68 efreet_desktop_free(desktop);
69 69
70 //EAPI Eina_List *efreet_util_desktop_name_glob_list(const char *glob); 70 //EAPI Eina_List *efreet_util_desktop_name_glob_list(const char *glob);
71 start = ecore_time_get(); 71 start = ecore_time_get();
72 list = efreet_util_desktop_name_glob_list("Ubuntu*"); 72 list = efreet_util_desktop_name_glob_list("Ubuntu*");
73 if (list) 73 if (list)
74 { 74 {
75 EINA_LIST_FREE(list, desktop) 75 EINA_LIST_FREE(list, desktop)
76 { 76 {
77 printf("efreet_util_desktop_name_glob_list(Ubuntu*): %s\n", desktop->name); 77 printf("efreet_util_desktop_name_glob_list(Ubuntu*): %s\n", desktop->name);
78 efreet_desktop_free(desktop); 78 efreet_desktop_free(desktop);
79 } 79 }
80 } 80 }
81 printf("time: %.6f\n", (ecore_time_get() - start)); 81 printf("time: %.6f\n", (ecore_time_get() - start));
82 82
83 //EAPI Eina_List *efreet_util_desktop_mime_list(const char *mime); 83 //EAPI Eina_List *efreet_util_desktop_mime_list(const char *mime);
84 start = ecore_time_get(); 84 start = ecore_time_get();
85 list = efreet_util_desktop_mime_list("application/ogg"); 85 list = efreet_util_desktop_mime_list("application/ogg");
86 if (list) 86 if (list)
87 { 87 {
88 EINA_LIST_FREE(list, desktop) 88 EINA_LIST_FREE(list, desktop)
89 { 89 {
90 printf("efreet_util_desktop_mime_list(application/ogg): %s\n", desktop->name); 90 printf("efreet_util_desktop_mime_list(application/ogg): %s\n", desktop->name);
91 efreet_desktop_free(desktop); 91 efreet_desktop_free(desktop);
92 } 92 }
93 } 93 }
94 printf("time: %.6f\n", (ecore_time_get() - start)); 94 printf("time: %.6f\n", (ecore_time_get() - start));
95 95
96 //EAPI Eina_List *efreet_util_desktop_exec_glob_list(const char *glob); 96 //EAPI Eina_List *efreet_util_desktop_exec_glob_list(const char *glob);
97 start = ecore_time_get(); 97 start = ecore_time_get();
98 list = efreet_util_desktop_exec_glob_list("*gnome*"); 98 list = efreet_util_desktop_exec_glob_list("*gnome*");
99 if (list) 99 if (list)
100 { 100 {
101 EINA_LIST_FREE(list, desktop) 101 EINA_LIST_FREE(list, desktop)
102 { 102 {
103 printf("efreet_util_desktop_exec_glob_list(*gnome*): %s\n", desktop->exec); 103 printf("efreet_util_desktop_exec_glob_list(*gnome*): %s\n", desktop->exec);
104 efreet_desktop_free(desktop); 104 efreet_desktop_free(desktop);
105 } 105 }
106 } 106 }
107 printf("time: %.6f\n", (ecore_time_get() - start)); 107 printf("time: %.6f\n", (ecore_time_get() - start));
108 108
109 //EAPI Eina_List *efreet_util_desktop_categories_list(void); 109 //EAPI Eina_List *efreet_util_desktop_categories_list(void);
110 start = ecore_time_get(); 110 start = ecore_time_get();
111 list = efreet_util_desktop_categories_list(); 111 list = efreet_util_desktop_categories_list();
112 if (list) 112 if (list)
113 { 113 {
114 EINA_LIST_FREE(list, id) 114 EINA_LIST_FREE(list, id)
115 { 115 {
116 printf("efreet_util_desktop_categories_list(): %s\n", id); 116 printf("efreet_util_desktop_categories_list(): %s\n", id);
117 } 117 }
118 } 118 }
119 printf("time: %.6f\n", (ecore_time_get() - start)); 119 printf("time: %.6f\n", (ecore_time_get() - start));
120 120
121 //EAPI Eina_List *efreet_util_desktop_category_list(const char *category); 121 //EAPI Eina_List *efreet_util_desktop_category_list(const char *category);
122 start = ecore_time_get(); 122 start = ecore_time_get();
123 list = efreet_util_desktop_category_list("Graphics"); 123 list = efreet_util_desktop_category_list("Graphics");
124 if (list) 124 if (list)
125 { 125 {
126 EINA_LIST_FREE(list, desktop) 126 EINA_LIST_FREE(list, desktop)
127 { 127 {
128 printf("efreet_util_desktop_category_list(Graphics): %s\n", desktop->name); 128 printf("efreet_util_desktop_category_list(Graphics): %s\n", desktop->name);
129 efreet_desktop_free(desktop); 129 efreet_desktop_free(desktop);
130 } 130 }
131 } 131 }
132 printf("time: %.6f\n", (ecore_time_get() - start)); 132 printf("time: %.6f\n", (ecore_time_get() - start));
133 133
134 desktop = efreet_desktop_get("/opt/google/chrome/google-chrome.desktop"); 134 desktop = efreet_desktop_get("/opt/google/chrome/google-chrome.desktop");
135 if (desktop) 135 if (desktop)
136 printf("%s: %d %d\n", desktop->orig_path, desktop->ref, desktop->eet); 136 printf("%s: %d %d\n", desktop->orig_path, desktop->ref, desktop->eet);
137 desktop2 = efreet_desktop_new("/opt/google/chrome/google-chrome.desktop"); 137 desktop2 = efreet_desktop_new("/opt/google/chrome/google-chrome.desktop");
138 if (desktop2) 138 if (desktop2)
139 { 139 {
140 printf("%s: %d %d\n", desktop2->orig_path, desktop2->ref, desktop2->eet); 140 printf("%s: %d %d\n", desktop2->orig_path, desktop2->ref, desktop2->eet);
141 efreet_desktop_free(desktop2); 141 efreet_desktop_free(desktop2);
142 } 142 }
143 if (desktop) 143 if (desktop)
144 efreet_desktop_free(desktop); 144 efreet_desktop_free(desktop);
145 145
146 desktop = efreet_desktop_get("/usr/share/applications/firefox.desktop"); 146 desktop = efreet_desktop_get("/usr/share/applications/firefox.desktop");
147 if (desktop) 147 if (desktop)
148 printf("%s: %d %d\n", desktop->orig_path, desktop->ref, desktop->eet); 148 printf("%s: %d %d\n", desktop->orig_path, desktop->ref, desktop->eet);
149 desktop2 = efreet_desktop_new("/usr/share/applications/firefox.desktop"); 149 desktop2 = efreet_desktop_new("/usr/share/applications/firefox.desktop");
150 if (desktop2) 150 if (desktop2)
151 { 151 {
152 printf("%s: %d %d\n", desktop2->orig_path, desktop2->ref, desktop2->eet); 152 printf("%s: %d %d\n", desktop2->orig_path, desktop2->ref, desktop2->eet);
153 efreet_desktop_free(desktop2); 153 efreet_desktop_free(desktop2);
154 } 154 }
155 if (desktop) 155 if (desktop)
156 efreet_desktop_free(desktop); 156 efreet_desktop_free(desktop);
157 fflush(stdout); 157 fflush(stdout);
158} 158}
159 159
160static Eina_Bool 160static Eina_Bool
161icon_handler_cb(void *data EINA_UNUSED, int event_type EINA_UNUSED, void *event EINA_UNUSED) 161icon_handler_cb(void *data EINA_UNUSED, int event_type EINA_UNUSED, void *event EINA_UNUSED)
162{ 162{
163 icon_cb = EINA_TRUE; 163 icon_cb = EINA_TRUE;
164 if (icon_cb && desktop_cb) 164 if (icon_cb && desktop_cb)
165 { 165 {
166 check(); 166 check();
167 ecore_main_loop_quit(); 167 ecore_main_loop_quit();
168 } 168 }
169 return ECORE_CALLBACK_PASS_ON; 169 return ECORE_CALLBACK_PASS_ON;
170} 170}
171 171
172static Eina_Bool 172static Eina_Bool
173desktop_handler_cb(void *data EINA_UNUSED, int event_type EINA_UNUSED, void *event EINA_UNUSED) 173desktop_handler_cb(void *data EINA_UNUSED, int event_type EINA_UNUSED, void *event EINA_UNUSED)
174{ 174{
175 desktop_cb = EINA_TRUE; 175 desktop_cb = EINA_TRUE;
176 if (icon_cb && desktop_cb) 176 if (icon_cb && desktop_cb)
177 { 177 {
178 check(); 178 check();
179 ecore_main_loop_quit(); 179 ecore_main_loop_quit();
180 } 180 }
181 return ECORE_CALLBACK_PASS_ON; 181 return ECORE_CALLBACK_PASS_ON;
182} 182}
183 183
184int 184int
185main(int argc EINA_UNUSED, char **argv EINA_UNUSED) 185main(int argc EINA_UNUSED, char **argv EINA_UNUSED)
186{ 186{
187 Ecore_Event_Handler *icon_handler; 187 Ecore_Event_Handler *icon_handler;
188 Ecore_Event_Handler *desktop_handler; 188 Ecore_Event_Handler *desktop_handler;
189 189
190 if (!efreet_init()) return 1; 190 if (!efreet_init()) return 1;
191 icon_handler = ecore_event_handler_add(EFREET_EVENT_ICON_CACHE_UPDATE, icon_handler_cb, NULL); 191 icon_handler = ecore_event_handler_add(EFREET_EVENT_ICON_CACHE_UPDATE, icon_handler_cb, NULL);
192 desktop_handler = ecore_event_handler_add(EFREET_EVENT_DESKTOP_CACHE_UPDATE, desktop_handler_cb, NULL); 192 desktop_handler = ecore_event_handler_add(EFREET_EVENT_DESKTOP_CACHE_UPDATE, desktop_handler_cb, NULL);
193 check(); 193 check();
194 ecore_main_loop_begin(); 194 ecore_main_loop_begin();
195 ecore_event_handler_del(icon_handler); 195 ecore_event_handler_del(icon_handler);
196 ecore_event_handler_del(desktop_handler); 196 ecore_event_handler_del(desktop_handler);
197 efreet_shutdown(); 197 efreet_shutdown();
198 return 0; 198 return 0;
199} 199}
diff --git a/src/tests/efreet/ef_data_dirs.c b/src/tests/efreet/ef_data_dirs.c
index 7f4bb81..2fded43 100644
--- a/src/tests/efreet/ef_data_dirs.c
+++ b/src/tests/efreet/ef_data_dirs.c
@@ -7,324 +7,324 @@
7int 7int
8ef_cb_efreet_data_home(void) 8ef_cb_efreet_data_home(void)
9{ 9{
10 const char *tmp; 10 const char *tmp;
11 int ret = 1; 11 int ret = 1;
12 12
13 efreet_shutdown(); 13 efreet_shutdown();
14 setenv("XDG_DATA_HOME", "/var/tmp", 1); 14 setenv("XDG_DATA_HOME", "/var/tmp", 1);
15 efreet_init(); 15 efreet_init();
16 16
17 tmp = efreet_data_home_get(); 17 tmp = efreet_data_home_get();
18 if (strcmp(tmp, "/var/tmp")) 18 if (strcmp(tmp, "/var/tmp"))
19 { 19 {
20 printf("efreet_data_home_get() returned incorrect " 20 printf("efreet_data_home_get() returned incorrect "
21 "value (%s) on XDG_DATA_HOME=/var/tmp\n", tmp); 21 "value (%s) on XDG_DATA_HOME=/var/tmp\n", tmp);
22 ret = 0; 22 ret = 0;
23 } 23 }
24 24
25 /* reset efreet here so we can set a new home dir */ 25 /* reset efreet here so we can set a new home dir */
26 efreet_shutdown(); 26 efreet_shutdown();
27 unsetenv("XDG_DATA_HOME"); 27 unsetenv("XDG_DATA_HOME");
28 setenv("HOME", "/home/tmp", 1); 28 setenv("HOME", "/home/tmp", 1);
29 efreet_init(); 29 efreet_init();
30 30
31 tmp = efreet_data_home_get(); 31 tmp = efreet_data_home_get();
32 if (strcmp(tmp, "/home/tmp/.local/share")) 32 if (strcmp(tmp, "/home/tmp/.local/share"))
33 { 33 {
34 printf("efreet_data_home_get() returned incorrect " 34 printf("efreet_data_home_get() returned incorrect "
35 "value (%s) on blank XDG_DATA_HOME\n", tmp); 35 "value (%s) on blank XDG_DATA_HOME\n", tmp);
36 ret = 0; 36 ret = 0;
37 } 37 }
38 38
39 /* reset efreet here so we can set a new home dir */ 39 /* reset efreet here so we can set a new home dir */
40 efreet_shutdown(); 40 efreet_shutdown();
41 unsetenv("XDG_DATA_HOME"); 41 unsetenv("XDG_DATA_HOME");
42 unsetenv("HOME"); 42 unsetenv("HOME");
43#ifdef _WIN32 43#ifdef _WIN32
44 unsetenv("USERPROFILE"); 44 unsetenv("USERPROFILE");
45#endif 45#endif
46 efreet_init(); 46 efreet_init();
47 47
48 tmp = efreet_data_home_get(); 48 tmp = efreet_data_home_get();
49 if (strcmp(tmp, "/tmp/.local/share")) 49 if (strcmp(tmp, "/tmp/.local/share"))
50 { 50 {
51 printf("efreet_data_home_get() returned incorrect " 51 printf("efreet_data_home_get() returned incorrect "
52 "value (%s) on blank XDG_DATA_HOME and blank HOME\n", tmp); 52 "value (%s) on blank XDG_DATA_HOME and blank HOME\n", tmp);
53 ret = 0; 53 ret = 0;
54 } 54 }
55 55
56 return ret; 56 return ret;
57} 57}
58 58
59int 59int
60ef_cb_efreet_config_home(void) 60ef_cb_efreet_config_home(void)
61{ 61{
62 const char *tmp; 62 const char *tmp;
63 int ret = 1; 63 int ret = 1;
64 64
65 efreet_shutdown(); 65 efreet_shutdown();
66 setenv("XDG_CONFIG_HOME", "/var/tmp", 1); 66 setenv("XDG_CONFIG_HOME", "/var/tmp", 1);
67 efreet_init(); 67 efreet_init();
68 68
69 tmp = efreet_config_home_get(); 69 tmp = efreet_config_home_get();
70 if (strcmp(tmp, "/var/tmp")) 70 if (strcmp(tmp, "/var/tmp"))
71 { 71 {
72 printf("efreet_config_home_get() returned incorrect " 72 printf("efreet_config_home_get() returned incorrect "
73 "value (%s) on XDG_CONFIG_HOME=/var/tmp\n", tmp); 73 "value (%s) on XDG_CONFIG_HOME=/var/tmp\n", tmp);
74 ret = 0; 74 ret = 0;
75 } 75 }
76 76
77 /* reset efreet here so we can set a new home dir */ 77 /* reset efreet here so we can set a new home dir */
78 efreet_shutdown(); 78 efreet_shutdown();
79 unsetenv("XDG_CONFIG_HOME"); 79 unsetenv("XDG_CONFIG_HOME");
80 setenv("HOME", "/home/tmp", 1); 80 setenv("HOME", "/home/tmp", 1);
81 efreet_init(); 81 efreet_init();
82 82
83 tmp = efreet_config_home_get(); 83 tmp = efreet_config_home_get();
84 if (strcmp(tmp, "/home/tmp/.config")) 84 if (strcmp(tmp, "/home/tmp/.config"))
85 { 85 {
86 printf("efreet_config_home_get() returned incorrect " 86 printf("efreet_config_home_get() returned incorrect "
87 "value (%s) on blank XDG_CONFIG_HOME\n", tmp); 87 "value (%s) on blank XDG_CONFIG_HOME\n", tmp);
88 ret = 0; 88 ret = 0;
89 } 89 }
90 90
91 /* reset efreet here so we can set a new home dir */ 91 /* reset efreet here so we can set a new home dir */
92 efreet_shutdown(); 92 efreet_shutdown();
93 unsetenv("XDG_CONFIG_HOME"); 93 unsetenv("XDG_CONFIG_HOME");
94 unsetenv("HOME"); 94 unsetenv("HOME");
95#ifdef _WIN32 95#ifdef _WIN32
96 unsetenv("USERPROFILE"); 96 unsetenv("USERPROFILE");
97#endif 97#endif
98 efreet_init(); 98 efreet_init();
99 99
100 tmp = efreet_config_home_get(); 100 tmp = efreet_config_home_get();
101 if (strcmp(tmp, "/tmp/.config")) 101 if (strcmp(tmp, "/tmp/.config"))
102 { 102 {
103 printf("efreet_config_home_get() returned incorrect " 103 printf("efreet_config_home_get() returned incorrect "
104 "value (%s) on blank XDG_CONFIG_HOME and blank HOME\n", tmp); 104 "value (%s) on blank XDG_CONFIG_HOME and blank HOME\n", tmp);
105 ret = 0; 105 ret = 0;
106 } 106 }
107 107
108 return ret; 108 return ret;
109} 109}
110 110
111int 111int
112ef_cb_efreet_cache_home(void) 112ef_cb_efreet_cache_home(void)
113{ 113{
114 const char *tmp; 114 const char *tmp;
115 int ret = 1; 115 int ret = 1;
116 116
117 efreet_shutdown(); 117 efreet_shutdown();
118 setenv("XDG_CACHE_HOME", "/var/tmp", 1); 118 setenv("XDG_CACHE_HOME", "/var/tmp", 1);
119 efreet_init(); 119 efreet_init();
120 120
121 tmp = efreet_cache_home_get(); 121 tmp = efreet_cache_home_get();
122 if (strcmp(tmp, "/var/tmp")) 122 if (strcmp(tmp, "/var/tmp"))
123 { 123 {
124 printf("efreet_cache_home_get() returned incorrect " 124 printf("efreet_cache_home_get() returned incorrect "
125 "value (%s) on XDG_CACHE_HOME=/var/tmp\n", tmp); 125 "value (%s) on XDG_CACHE_HOME=/var/tmp\n", tmp);
126 ret = 0; 126 ret = 0;
127 } 127 }
128 128
129 /* reset efreet here so we can set a new home dir */ 129 /* reset efreet here so we can set a new home dir */
130 efreet_shutdown(); 130 efreet_shutdown();
131 unsetenv("XDG_CACHE_HOME"); 131 unsetenv("XDG_CACHE_HOME");
132 setenv("HOME", "/home/tmp", 1); 132 setenv("HOME", "/home/tmp", 1);
133 efreet_init(); 133 efreet_init();
134 134
135 tmp = efreet_cache_home_get(); 135 tmp = efreet_cache_home_get();
136 if (strcmp(tmp, "/home/tmp/.cache")) 136 if (strcmp(tmp, "/home/tmp/.cache"))
137 { 137 {
138 printf("efreet_cache_home_get() returned incorrect " 138 printf("efreet_cache_home_get() returned incorrect "
139 "value (%s) on blank XDG_CACHE_HOME\n", tmp); 139 "value (%s) on blank XDG_CACHE_HOME\n", tmp);
140 ret = 0; 140 ret = 0;
141 } 141 }
142 142
143 /* reset efreet here so we can set a new home dir */ 143 /* reset efreet here so we can set a new home dir */
144 efreet_shutdown(); 144 efreet_shutdown();
145 unsetenv("XDG_CACHE_HOME"); 145 unsetenv("XDG_CACHE_HOME");
146 unsetenv("HOME"); 146 unsetenv("HOME");
147#ifdef _WIN32 147#ifdef _WIN32
148 unsetenv("USERPROFILE"); 148 unsetenv("USERPROFILE");
149#endif 149#endif
150 efreet_init(); 150 efreet_init();
151 151
152 tmp = efreet_cache_home_get(); 152 tmp = efreet_cache_home_get();
153 if (strcmp(tmp, "/tmp/.cache")) 153 if (strcmp(tmp, "/tmp/.cache"))
154 { 154 {
155 printf("efreet_cache_home_get() returned incorrect " 155 printf("efreet_cache_home_get() returned incorrect "
156 "value (%s) on blank XDG_CACHE_HOME and blank HOME\n", tmp); 156 "value (%s) on blank XDG_CACHE_HOME and blank HOME\n", tmp);
157 ret = 0; 157 ret = 0;
158 } 158 }
159 159
160 return ret; 160 return ret;
161} 161}
162 162
163int 163int
164ef_cb_efreet_data_dirs(void) 164ef_cb_efreet_data_dirs(void)
165{ 165{
166 Eina_List *tmp, *l; 166 Eina_List *tmp, *l;
167 int ret = 1; 167 int ret = 1;
168 unsigned int i; 168 unsigned int i;
169 unsigned int ok; 169 unsigned int ok;
170 char dirs[128], *val; 170 char dirs[128], *val;
171 char *vals[] = {"/var/tmp/a", "/tmp/b", "/usr/local/share", "/etc", NULL}; 171 char *vals[] = {"/var/tmp/a", "/tmp/b", "/usr/local/share", "/etc", NULL};
172 char *def_vals[] = {DATA_DIR, "/usr/share", "/usr/local/share", NULL}; 172 char *def_vals[] = {DATA_DIR, "/usr/share", "/usr/local/share", NULL};
173 173
174 dirs[0] = '\0'; 174 dirs[0] = '\0';
175 for (i = 0; vals[i]; i++) 175 for (i = 0; vals[i]; i++)
176 { 176 {
177 if (i > 0) strcat(dirs, ":"); 177 if (i > 0) strcat(dirs, ":");
178 strcat(dirs, vals[i]); 178 strcat(dirs, vals[i]);
179 } 179 }
180 180
181 efreet_shutdown(); 181 efreet_shutdown();
182 setenv("XDG_DATA_DIRS", dirs, 1); 182 setenv("XDG_DATA_DIRS", dirs, 1);
183 efreet_init(); 183 efreet_init();
184 184
185 ok = 0; 185 ok = 0;
186 tmp = efreet_data_dirs_get(); 186 tmp = efreet_data_dirs_get();
187 for (i = 0; vals[i]; i++) 187 for (i = 0; vals[i]; i++)
188 { 188 {
189 char *found; 189 char *found;
190 190
191 found = eina_list_search_unsorted(tmp, EINA_COMPARE_CB(strcmp), vals[i]); 191 found = eina_list_search_unsorted(tmp, EINA_COMPARE_CB(strcmp), vals[i]);
192 if (!ecore_file_exists(vals[i]) && found) 192 if (!ecore_file_exists(vals[i]) && found)
193 { 193 {
194 printf("efreet_data_dirs_get() includes non-existing dir (%s) when " 194 printf("efreet_data_dirs_get() includes non-existing dir (%s) when "
195 "%s set\n", vals[i], dirs); 195 "%s set\n", vals[i], dirs);
196 ret = 0; 196 ret = 0;
197 continue; 197 continue;
198 } 198 }
199 if (ecore_file_exists(vals[i]) && !found) 199 if (ecore_file_exists(vals[i]) && !found)
200 { 200 {
201 printf("efreet_data_dirs_get() is missing dir (%s) when " 201 printf("efreet_data_dirs_get() is missing dir (%s) when "
202 "%s set\n", vals[i], dirs); 202 "%s set\n", vals[i], dirs);
203 ret = 0; 203 ret = 0;
204 continue; 204 continue;
205 } 205 }
206 if (ecore_file_exists(vals[i]) && found) 206 if (ecore_file_exists(vals[i]) && found)
207 ok++; 207 ok++;
208 } 208 }
209 if (eina_list_count(tmp) != ok) 209 if (eina_list_count(tmp) != ok)
210 { 210 {
211 printf("efreet_data_dirs_get() returned more values then it " 211 printf("efreet_data_dirs_get() returned more values then it "
212 "should have given %s as input\n", dirs); 212 "should have given %s as input\n", dirs);
213 ret = 0; 213 ret = 0;
214 } 214 }
215 215
216 efreet_shutdown(); 216 efreet_shutdown();
217 unsetenv("XDG_DATA_DIRS"); 217 unsetenv("XDG_DATA_DIRS");
218 efreet_init(); 218 efreet_init();
219 219
220 i = 0; 220 i = 0;
221 tmp = efreet_data_dirs_get(); 221 tmp = efreet_data_dirs_get();
222 if (eina_list_count(tmp) != 3) 222 if (eina_list_count(tmp) != 3)
223 { 223 {
224 printf("efreet_data_dirs_get() nodes is differnet from expected default\n"); 224 printf("efreet_data_dirs_get() nodes is differnet from expected default\n");
225 ret = 0; 225 ret = 0;
226 } 226 }
227 227
228 EINA_LIST_FOREACH(tmp, l, val) 228 EINA_LIST_FOREACH(tmp, l, val)
229 { 229 {
230 if (!def_vals[i]) 230 if (!def_vals[i])
231 { 231 {
232 printf("efreet_data_dirs_get() returned more values then it " 232 printf("efreet_data_dirs_get() returned more values then it "
233 "should have given %s as input\n", dirs); 233 "should have given %s as input\n", dirs);
234 ret = 0; 234 ret = 0;
235 break; 235 break;
236 } 236 }
237 237
238 if (strcmp(val, def_vals[i])) 238 if (strcmp(val, def_vals[i]))
239 { 239 {
240 printf("efreet_data_dirs_get() returned incorrect value (%s) when " 240 printf("efreet_data_dirs_get() returned incorrect value (%s) when "
241 "XDG_DATA_DIRS= is set %s\n", val, def_vals[i]); 241 "XDG_DATA_DIRS= is set %s\n", val, def_vals[i]);
242 ret = 0; 242 ret = 0;
243 } 243 }
244 244
245 i++; 245 i++;
246 } 246 }
247 return ret; 247 return ret;
248} 248}
249 249
250int 250int
251ef_cb_efreet_config_dirs(void) 251ef_cb_efreet_config_dirs(void)
252{ 252{
253 Eina_List *tmp, *l; 253 Eina_List *tmp, *l;
254 int ret = 1; 254 int ret = 1;
255 unsigned int i; 255 unsigned int i;
256 unsigned int ok; 256 unsigned int ok;
257 char dirs[128], *val; 257 char dirs[128], *val;
258 char *vals[] = {"/var/tmp/a", "/tmp/b", "/usr/local/share", "/etc", NULL}; 258 char *vals[] = {"/var/tmp/a", "/tmp/b", "/usr/local/share", "/etc", NULL};
259 char *def_vals[] = {"/etc/xdg", NULL}; 259 char *def_vals[] = {"/etc/xdg", NULL};
260 260
261 dirs[0] = '\0'; 261 dirs[0] = '\0';
262 262
263 for (i = 0; vals[i]; i++) 263 for (i = 0; vals[i]; i++)
264 { 264 {
265 if (i > 0) strcat(dirs, ":"); 265 if (i > 0) strcat(dirs, ":");
266 strcat(dirs, vals[i]); 266 strcat(dirs, vals[i]);
267 } 267 }
268 268
269 efreet_shutdown(); 269 efreet_shutdown();
270 setenv("XDG_CONFIG_DIRS", dirs, 1); 270 setenv("XDG_CONFIG_DIRS", dirs, 1);
271 efreet_init(); 271 efreet_init();
272 272
273 ok = 0; 273 ok = 0;
274 tmp = efreet_config_dirs_get(); 274 tmp = efreet_config_dirs_get();
275 for (i = 0; vals[i]; i++) 275 for (i = 0; vals[i]; i++)
276 { 276 {
277 char *found; 277 char *found;
278 278
279 found = eina_list_search_unsorted(tmp, EINA_COMPARE_CB(strcmp), vals[i]); 279 found = eina_list_search_unsorted(tmp, EINA_COMPARE_CB(strcmp), vals[i]);
280 if (!ecore_file_exists(vals[i]) && found) 280 if (!ecore_file_exists(vals[i]) && found)
281 { 281 {
282 printf("efreet_data_dirs_get() includes non-existing dir (%s) when " 282 printf("efreet_data_dirs_get() includes non-existing dir (%s) when "
283 "%s set\n", vals[i], dirs); 283 "%s set\n", vals[i], dirs);
284 ret = 0; 284 ret = 0;
285 continue; 285 continue;
286 } 286 }
287 if (ecore_file_exists(vals[i]) && !found) 287 if (ecore_file_exists(vals[i]) && !found)
288 { 288 {
289 printf("efreet_data_dirs_get() is missing dir (%s) when " 289 printf("efreet_data_dirs_get() is missing dir (%s) when "
290 "%s set\n", vals[i], dirs); 290 "%s set\n", vals[i], dirs);
291 ret = 0; 291 ret = 0;
292 continue; 292 continue;
293 } 293 }
294 if (ecore_file_exists(vals[i]) && found) 294 if (ecore_file_exists(vals[i]) && found)
295 ok++; 295 ok++;
296 } 296 }
297 if (eina_list_count(tmp) != ok) 297 if (eina_list_count(tmp) != ok)
298 { 298 {
299 printf("efreet_data_dirs_get() returned more values then it " 299 printf("efreet_data_dirs_get() returned more values then it "
300 "should have given %s as input\n", dirs); 300 "should have given %s as input\n", dirs);
301 ret = 0; 301 ret = 0;
302 } 302 }
303 303
304 efreet_shutdown(); 304 efreet_shutdown();
305 unsetenv("XDG_CONFIG_DIRS"); 305 unsetenv("XDG_CONFIG_DIRS");
306 efreet_init(); 306 efreet_init();
307 307
308 i = 0; 308 i = 0;
309 tmp = efreet_config_dirs_get(); 309 tmp = efreet_config_dirs_get();
310 EINA_LIST_FOREACH(tmp, l, val) 310 EINA_LIST_FOREACH(tmp, l, val)
311 { 311 {
312 if (!def_vals[i]) 312 if (!def_vals[i])
313 { 313 {
314 printf("efreet_config_dirs_get() returned more values then it " 314 printf("efreet_config_dirs_get() returned more values then it "
315 "should have given %s as input\n", dirs); 315 "should have given %s as input\n", dirs);
316 ret = 0; 316 ret = 0;
317 break; 317 break;
318 } 318 }
319 319
320 if (strcmp(val, def_vals[i])) 320 if (strcmp(val, def_vals[i]))
321 { 321 {
322 printf("efreet_config_dirs_get() returned incorrect value (%s) when " 322 printf("efreet_config_dirs_get() returned incorrect value (%s) when "
323 "XDG_CONFIG_DIRS= is set\n", val); 323 "XDG_CONFIG_DIRS= is set\n", val);
324 ret = 0; 324 ret = 0;
325 } 325 }
326 326
327 i++; 327 i++;
328 } 328 }
329 return ret; 329 return ret;
330} 330}
diff --git a/src/tests/efreet/ef_desktop.c b/src/tests/efreet/ef_desktop.c
index d26ba85..6321c18 100644
--- a/src/tests/efreet/ef_desktop.c
+++ b/src/tests/efreet/ef_desktop.c
@@ -7,403 +7,405 @@
7#include <limits.h> 7#include <limits.h>
8#include "ef_test.h" 8#include "ef_test.h"
9 9
10static void *_cb_command(void *data, Efreet_Desktop *desktop, char *exec, int remaining); 10typedef struct
11{
12 Eina_List *expected;
13 int error;
14 char type;
15} Test_Info;
16
17static void *
18_cb_command(void *data, Efreet_Desktop *desktop EINA_UNUSED,
19 char *exec, int remaining EINA_UNUSED)
20{
21 Test_Info *info = data;
22 char *expected;
23
24 expected = eina_list_data_get(info->expected);
25 info->expected = eina_list_demote_list(info->expected, info->expected);
26 if (!expected)
27 {
28 printf(" ERROR: (%%%c) got \"%s\", expected nothing\n",
29 info->type, exec);
30 info->error++;
31 }
32 else
33 {
34 if (strcmp(exec, expected))
35 {
36 printf(" ERROR: (%%%c) got \"%s\", expected \"%s\"\n",
37 info->type, exec, expected);
38 info->error++;
39 }
40 }
41 free(exec);
42 return NULL;
43}
11 44
12 45
13int 46int
14ef_cb_desktop_parse(void) 47ef_cb_desktop_parse(void)
15{ 48{
16 Efreet_Desktop *desktop; 49 Efreet_Desktop *desktop;
17 Eina_List *l; 50 Eina_List *l;
18 int ret = 1; 51 int ret = 1;
19 52
20 desktop = efreet_desktop_get(ef_test_path_get("test.desktop")); 53 desktop = efreet_desktop_get(ef_test_path_get("test.desktop"));
21 if (!desktop) 54 if (!desktop)
22 { 55 {
23 printf("No desktop found.\n"); 56 printf("No desktop found.\n");
24 return 0; 57 return 0;
25 } 58 }
26 59
27 if (!desktop->name || strcmp(desktop->name, "Efreet Test Application")) 60 if (!desktop->name || strcmp(desktop->name, "Efreet Test Application"))
28 { 61 {
29 printf("Invalid Name\n"); 62 printf("Invalid Name\n");
30 ret = 0; 63 ret = 0;
31 } 64 }
32 65
33 if (!desktop->generic_name || 66 if (!desktop->generic_name ||
34 strcmp(desktop->generic_name, "Test Application")) 67 strcmp(desktop->generic_name, "Test Application"))
35 { 68 {
36 printf("Incorrent GenericName\n"); 69 printf("Incorrent GenericName\n");
37 ret = 0; 70 ret = 0;
38 } 71 }
39 72
40 if (!desktop->exec || strcmp(desktop->exec, "efreet_test %F %i")) 73 if (!desktop->exec || strcmp(desktop->exec, "efreet_test %F %i"))
41 { 74 {
42 printf("Incorrect Exec (%s)\n", (desktop->exec ? desktop->exec : "(null)")); 75 printf("Incorrect Exec (%s)\n", (desktop->exec ? desktop->exec : "(null)"));
43 ret = 0; 76 ret = 0;
44 } 77 }
45 78
46 if (desktop->categories) 79 if (desktop->categories)
47 { 80 {
48 const char *categories[] = {"Test", "Enlightenment"}; 81 const char *categories[] = {"Test", "Enlightenment"};
49 const char *cat; 82 const char *cat;
50 int num_categories = 2, i = 0; 83 int num_categories = 2, i = 0;
51 84
52 EINA_LIST_FOREACH(desktop->categories, l, cat) 85 EINA_LIST_FOREACH(desktop->categories, l, cat)
53 { 86 {
54 if (i >= num_categories) 87 if (i >= num_categories)
55 { 88 {
56 printf("Too many categories found.\n"); 89 printf("Too many categories found.\n");
57 ret = 0; 90 ret = 0;
58 break; 91 break;
59 } 92 }
60 93
61 if (!cat || !categories[i] || strcmp(cat, categories[i])) 94 if (!cat || !categories[i] || strcmp(cat, categories[i]))
62 { 95 {
63 printf("Expected category %s, found %s\n", categories[i], cat); 96 printf("Expected category %s, found %s\n", categories[i], cat);
64 ret = 0; 97 ret = 0;
65 } 98 }
66 i++; 99 i++;
67 } 100 }
68 } 101 }
69 else ret = 0; 102 else ret = 0;
70 103
71 efreet_desktop_free(desktop); 104 efreet_desktop_free(desktop);
72 105
73 return ret; 106 return ret;
74} 107}
75 108
76#if 0 109#if 0
77int 110int
78ef_cb_desktop_file_id(void) 111ef_cb_desktop_file_id(void)
79{ 112{
80 Efreet_Desktop *desktop; 113 Efreet_Desktop *desktop;
81 int ret = 1; 114 int ret = 1;
82 115
83 desktop = efreet_desktop_get(ef_test_path_get("test.desktop")); 116 desktop = efreet_desktop_get(ef_test_path_get("test.desktop"));
84 if (desktop) 117 if (desktop)
85 { 118 {
86 const char *id; 119 const char *id;
87 int i = 0; 120 int i = 0;
88 121
89 struct { 122 struct {
90 char *dir; 123 char *dir;
91 int legacy; 124 int legacy;
92 char *prefix; 125 char *prefix;
93 char *expected; 126 char *expected;
94 } tests[] = { 127 } tests[] = {
95 // TODO: once enabled fix to remove PACKAGE_DATA_DIR 128 // TODO: once enabled fix to remove PACKAGE_DATA_DIR
96 {PACKAGE_DATA_DIR"/test/", 0, NULL, "test.desktop"}, 129 {PACKAGE_DATA_DIR"/test/", 0, NULL, "test.desktop"},
97 {PACKAGE_DATA_DIR"/", 0, NULL, "test-test.desktop"}, 130 {PACKAGE_DATA_DIR"/", 0, NULL, "test-test.desktop"},
98 {PACKAGE_DATA_DIR"/", 1, NULL, "test.desktop"}, 131 {PACKAGE_DATA_DIR"/", 1, NULL, "test.desktop"},
99 {PACKAGE_DATA_DIR"/", 1, "prefix", "prefix-test.desktop"}, 132 {PACKAGE_DATA_DIR"/", 1, "prefix", "prefix-test.desktop"},
100 {NULL, 0, NULL, NULL} 133 {NULL, 0, NULL, NULL}
101 }; 134 };
102 135
103 for (i = 0; tests[i].dir != NULL; i++) 136 for (i = 0; tests[i].dir != NULL; i++)
104 { 137 {
105 id = efreet_desktop_id_get(desktop, 138 id = efreet_desktop_id_get(desktop,
106 tests[i].dir, 139 tests[i].dir,
107 tests[i].legacy, 140 tests[i].legacy,
108 tests[i].prefix); 141 tests[i].prefix);
109 if (!id || strcmp(id, tests[i].expected)) 142 if (!id || strcmp(id, tests[i].expected))
110 { 143 {
111 printf("Expecting id: %s, got: %s\n", tests[i].expected, id); 144 printf("Expecting id: %s, got: %s\n", tests[i].expected, id);
112 ret = 0; 145 ret = 0;
113 } 146 }
114 if (id) eina_stringshare_del(id); 147 if (id) eina_stringshare_del(id);
115 } 148 }
116 } 149 }
117 else 150 else
118 ret = 0; 151 ret = 0;
119 152
120 return ret; 153 return ret;
121} 154}
122#endif 155#endif
123 156
124int 157int
125ef_cb_desktop_save(void) 158ef_cb_desktop_save(void)
126{ 159{
127 Efreet_Desktop *desktop; 160 Efreet_Desktop *desktop;
128 161
129 printf("\n"); 162 printf("\n");
130 163
131 if (eina_file_copy(ef_test_path_get("test.desktop"), 164 if (eina_file_copy(ef_test_path_get("test.desktop"),
132 "/tmp/test.desktop", 0, NULL, NULL)) 165 "/tmp/test.desktop", 0, NULL, NULL))
133 { 166 {
134 desktop = efreet_desktop_get("/tmp/test.desktop"); 167 desktop = efreet_desktop_get("/tmp/test.desktop");
135 if (!desktop) 168 if (!desktop)
136 { 169 {
137 unlink("/tmp/test.desktop"); 170 unlink("/tmp/test.desktop");
138 printf("Failed to get Desktop file\n"); 171 printf("Failed to get Desktop file\n");
139 return 0; 172 return 0;
140 } 173 }
141 174
142 printf("save data: %d\n", efreet_desktop_save(desktop)); 175 printf("save data: %d\n", efreet_desktop_save(desktop));
143 efreet_desktop_free(desktop); 176 efreet_desktop_free(desktop);
144 unlink("/tmp/test.desktop"); 177 unlink("/tmp/test.desktop");
145 } 178 }
146 179
147 desktop = efreet_desktop_empty_new("/tmp/test.desktop"); 180 desktop = efreet_desktop_empty_new("/tmp/test.desktop");
148 desktop->name = strdup("Efreet Test Application"); 181 desktop->name = strdup("Efreet Test Application");
149 desktop->type = EFREET_DESKTOP_TYPE_APPLICATION; 182 desktop->type = EFREET_DESKTOP_TYPE_APPLICATION;
150 desktop->generic_name = strdup("Test Application"); 183 desktop->generic_name = strdup("Test Application");
151 desktop->exec = strdup("efreet_test"); 184 desktop->exec = strdup("efreet_test");
152 desktop->categories = NULL; 185 desktop->categories = NULL;
153 desktop->categories = eina_list_append(desktop->categories, eina_stringshare_add("Test")); 186 desktop->categories = eina_list_append(desktop->categories,
154 desktop->categories = eina_list_append(desktop->categories, eina_stringshare_add("Enlightenment")); 187 eina_stringshare_add("Test"));
155 printf("save test: %d\n", efreet_desktop_save(desktop)); 188 desktop->categories = eina_list_append(desktop->categories,
156 unlink("/tmp/test.desktop"); 189 eina_stringshare_add("Enlightenment"));
157 efreet_desktop_free(desktop); 190 printf("save test: %d\n", efreet_desktop_save(desktop));
158 191 unlink("/tmp/test.desktop");
159 return 1; 192 efreet_desktop_free(desktop);
193
194 return 1;
160} 195}
161 196
162typedef struct
163{
164 Eina_List *expected;
165 int error;
166 char type;
167} Test_Info;
168
169int 197int
170ef_cb_desktop_command_get(void) 198ef_cb_desktop_command_get(void)
171{ 199{
172 Efreet_Desktop *desktop; 200 Efreet_Desktop *desktop;
173 Eina_List *files, *expected; 201 Eina_List *files, *expected;
174 char olddir[PATH_MAX]; 202 char olddir[PATH_MAX];
175 Test_Info *info; 203 Test_Info *info;
176 int ret; 204 int ret;
177 205
178 if (getcwd(olddir, PATH_MAX) != 0) ret = 0; 206 if (getcwd(olddir, PATH_MAX) != 0) ret = 0;
179 if (chdir("/") != 0) ret = 0; 207 if (chdir("/") != 0) ret = 0;
180 208
181 printf("\n"); 209 printf("\n");
182 desktop = efreet_desktop_empty_new("test.desktop"); 210 desktop = efreet_desktop_empty_new("test.desktop");
183 211
184 desktop->name = strdup("App Name"); 212 desktop->name = strdup("App Name");
185 desktop->icon = strdup("icon.png"); 213 desktop->icon = strdup("icon.png");
186 214
187 files = NULL; 215 files = NULL;
188 files = eina_list_append(files, "/tmp/absolute_path"); 216 files = eina_list_append(files, "/tmp/absolute_path");
189 files = eina_list_append(files, "relative_path"); 217 files = eina_list_append(files, "relative_path");
190 files = eina_list_append(files, "file:///tmp/absolute_uri"); 218 files = eina_list_append(files, "file:///tmp/absolute_uri");
191 files = eina_list_append(files, "file:relative_uri"); 219 files = eina_list_append(files, "file:relative_uri");
192 220
193 info = NEW(Test_Info, 1); 221 info = NEW(Test_Info, 1);
194 expected = NULL; 222 expected = NULL;
195 info->error = 0; 223 info->error = 0;
196 224
197 /* test single full path */ 225 /* test single full path */
198 info->type = 'f'; 226 info->type = 'f';
199 IF_FREE(desktop->exec); 227 IF_FREE(desktop->exec);
200 desktop->exec = strdup("app %f"); 228 desktop->exec = strdup("app %f");
201 expected = eina_list_append(expected, "app '/tmp/absolute_path'"); 229 expected = eina_list_append(expected, "app '/tmp/absolute_path'");
202 expected = eina_list_append(expected, "app '/relative_path'"); 230 expected = eina_list_append(expected, "app '/relative_path'");
203 expected = eina_list_append(expected, "app '/tmp/absolute_uri'"); 231 expected = eina_list_append(expected, "app '/tmp/absolute_uri'");
204 expected = eina_list_append(expected, "app '/relative_uri'"); 232 expected = eina_list_append(expected, "app '/relative_uri'");
205 233
206 info->expected = expected; 234 info->expected = expected;
207 efreet_desktop_command_get(desktop, files, _cb_command, info); 235 efreet_desktop_command_get(desktop, files, _cb_command, info);
208 expected = eina_list_free(expected); 236 expected = eina_list_free(expected);
209 237
210 /* test single uri */ 238 /* test single uri */
211 info->type = 'u'; 239 info->type = 'u';
212 IF_FREE(desktop->exec); 240 IF_FREE(desktop->exec);
213 desktop->exec = strdup("app %u"); 241 desktop->exec = strdup("app %u");
214 expected = eina_list_append(expected, "app 'file:///tmp/absolute_path'"); 242 expected = eina_list_append(expected, "app 'file:///tmp/absolute_path'");
215 expected = eina_list_append(expected, "app 'file:///relative_path'"); 243 expected = eina_list_append(expected, "app 'file:///relative_path'");
216 expected = eina_list_append(expected, "app 'file:///tmp/absolute_uri'"); 244 expected = eina_list_append(expected, "app 'file:///tmp/absolute_uri'");
217 expected = eina_list_append(expected, "app 'file:///relative_uri'"); 245 expected = eina_list_append(expected, "app 'file:///relative_uri'");
218 246
219 info->expected = expected; 247 info->expected = expected;
220 efreet_desktop_command_get(desktop, files, _cb_command, info); 248 efreet_desktop_command_get(desktop, files, _cb_command, info);
221 expected = eina_list_free(expected); 249 expected = eina_list_free(expected);
222 250
223 /* test single dir */ 251 /* test single dir */
224#if 0 252#if 0
225 info->type = 'd'; 253 info->type = 'd';
226 IF_FREE(desktop->exec); 254 IF_FREE(desktop->exec);
227 desktop->exec = strdup("app %d"); 255 desktop->exec = strdup("app %d");
228 expected = eina_list_append(expected, "app '/tmp'"); 256 expected = eina_list_append(expected, "app '/tmp'");
229 expected = eina_list_append(expected, "app '/'"); 257 expected = eina_list_append(expected, "app '/'");
230 expected = eina_list_append(expected, "app '/tmp'"); 258 expected = eina_list_append(expected, "app '/tmp'");
231 expected = eina_list_append(expected, "app '/'"); 259 expected = eina_list_append(expected, "app '/'");
232 260
233 info->expected = expected; 261 info->expected = expected;
234 efreet_desktop_command_get(desktop, files, _cb_command, info); 262 efreet_desktop_command_get(desktop, files, _cb_command, info);
235 expected = eina_list_free(expected); 263 expected = eina_list_free(expected);
236#endif 264#endif
237 265
238 266
239 /* test single names */ 267 /* test single names */
240#if 0 268#if 0
241 info->type = 'n'; 269 info->type = 'n';
242 IF_FREE(desktop->exec); 270 IF_FREE(desktop->exec);
243 desktop->exec = strdup("app %n"); 271 desktop->exec = strdup("app %n");
244 expected = eina_list_append(expected, "app 'absolute_path'"); 272 expected = eina_list_append(expected, "app 'absolute_path'");
245 expected = eina_list_append(expected, "app 'relative_path'"); 273 expected = eina_list_append(expected, "app 'relative_path'");
246 expected = eina_list_append(expected, "app 'absolute_uri'"); 274 expected = eina_list_append(expected, "app 'absolute_uri'");
247 expected = eina_list_append(expected, "app 'relative_uri'"); 275 expected = eina_list_append(expected, "app 'relative_uri'");
248 276
249 info->expected = expected; 277 info->expected = expected;
250 efreet_desktop_command_get(desktop, files, _cb_command, info); 278 efreet_desktop_command_get(desktop, files, _cb_command, info);
251 expected = eina_list_free(expected); 279 expected = eina_list_free(expected);
252#endif 280#endif
253 281
254 /* test multiple fullpaths */ 282 /* test multiple fullpaths */
255 info->type = 'F'; 283 info->type = 'F';
256 IF_FREE(desktop->exec); 284 IF_FREE(desktop->exec);
257 desktop->exec = strdup("app %F"); 285 desktop->exec = strdup("app %F");
258 expected = eina_list_append(expected, "app '/tmp/absolute_path' '/relative_path' '/tmp/absolute_uri' '/relative_uri'"); 286 expected = eina_list_append(expected, "app '/tmp/absolute_path' '/relative_path' '/tmp/absolute_uri' '/relative_uri'");
259 287
260 info->expected = expected; 288 info->expected = expected;
261 efreet_desktop_command_get(desktop, files, _cb_command, info); 289 efreet_desktop_command_get(desktop, files, _cb_command, info);
262 expected = eina_list_free(expected); 290 expected = eina_list_free(expected);
263 291
264 /* test multiple URIs */ 292 /* test multiple URIs */
265 info->type = 'U'; 293 info->type = 'U';
266 IF_FREE(desktop->exec); 294 IF_FREE(desktop->exec);
267 desktop->exec = strdup("app %U"); 295 desktop->exec = strdup("app %U");
268 expected = eina_list_append(expected, "app 'file:///tmp/absolute_path' 'file:///relative_path' 'file:///tmp/absolute_uri' 'file:///relative_uri'"); 296 expected = eina_list_append(expected, "app 'file:///tmp/absolute_path' 'file:///relative_path' 'file:///tmp/absolute_uri' 'file:///relative_uri'");
269 297
270 info->expected = expected; 298 info->expected = expected;
271 efreet_desktop_command_get(desktop, files, _cb_command, info); 299 efreet_desktop_command_get(desktop, files, _cb_command, info);
272 expected = eina_list_free(expected); 300 expected = eina_list_free(expected);
273 301
274 /* test multiple dirs */ 302 /* test multiple dirs */
275#if 0 303#if 0
276 info->type = 'D'; 304 info->type = 'D';
277 IF_FREE(desktop->exec); 305 IF_FREE(desktop->exec);
278 desktop->exec = strdup("app %D"); 306 desktop->exec = strdup("app %D");
279 expected = eina_list_append(expected, "app '/tmp' '/' '/tmp' '/'"); 307 expected = eina_list_append(expected, "app '/tmp' '/' '/tmp' '/'");
280 308
281 info->expected = expected; 309 info->expected = expected;
282 efreet_desktop_command_get(desktop, files, _cb_command, info); 310 efreet_desktop_command_get(desktop, files, _cb_command, info);
283 expected = eina_list_free(expected); 311 expected = eina_list_free(expected);
284#endif 312#endif
285 313
286 /* test multiple names */ 314 /* test multiple names */
287#if 0 315#if 0
288 info->type = 'N'; 316 info->type = 'N';
289 IF_FREE(desktop->exec); 317 IF_FREE(desktop->exec);
290 desktop->exec = strdup("app %N"); 318 desktop->exec = strdup("app %N");
291 expected = eina_list_append(expected, "app 'absolute_path' 'relative_path' 'absolute_uri' 'relative_uri'"); 319 expected = eina_list_append(expected, "app 'absolute_path' 'relative_path' 'absolute_uri' 'relative_uri'");
292 320
293 info->expected = expected; 321 info->expected = expected;
294 efreet_desktop_command_get(desktop, files, _cb_command, info); 322 efreet_desktop_command_get(desktop, files, _cb_command, info);
295 expected = eina_list_free(expected); 323 expected = eina_list_free(expected);
296#endif 324#endif
297 325
298 /* test icon appending */ 326 /* test icon appending */
299 info->type = 'i'; 327 info->type = 'i';
300 IF_FREE(desktop->exec); 328 IF_FREE(desktop->exec);
301 desktop->exec = strdup("app %i"); 329 desktop->exec = strdup("app %i");
302 expected = eina_list_append(expected, "app --icon 'icon.png'"); 330 expected = eina_list_append(expected, "app --icon 'icon.png'");
303
304 info->expected = expected;
305 efreet_desktop_command_get(desktop, NULL, _cb_command, info);
306 expected = eina_list_free(expected);
307
308 /* test app name */
309 info->type = 'c';
310 IF_FREE(desktop->exec);
311 desktop->exec = strdup("app %c");
312 expected = eina_list_append(expected, "app 'App Name'");
313
314 info->expected = expected;
315 efreet_desktop_command_get(desktop, NULL, _cb_command, info);
316 expected = eina_list_free(expected);
317
318 /* test desktop path */
319 info->type = 'k';
320 IF_FREE(desktop->exec);
321 desktop->exec = strdup("app %k");
322 expected = eina_list_append(expected, "app 'test.desktop'");
323
324 info->expected = expected;
325 efreet_desktop_command_get(desktop, NULL, _cb_command, info);
326 eina_list_free(expected);
327
328 /* clean up */
329 efreet_desktop_free(desktop);
330 eina_list_free(files);
331
332 if (chdir(olddir) != 0) ret = 0;
333
334 ret = info->error > 0 ? 0 : 1;
335 free(info);
336
337 return ret;
338}
339 331
340static void * 332 info->expected = expected;
341_cb_command(void *data, Efreet_Desktop *desktop EINA_UNUSED, 333 efreet_desktop_command_get(desktop, NULL, _cb_command, info);
342 char *exec, int remaining EINA_UNUSED) 334 expected = eina_list_free(expected);
343{ 335
344 Test_Info *info = data; 336 /* test app name */
345 char *expected; 337 info->type = 'c';
346 338 IF_FREE(desktop->exec);
347 expected = eina_list_data_get(info->expected); 339 desktop->exec = strdup("app %c");
348 info->expected = eina_list_demote_list(info->expected, info->expected); 340 expected = eina_list_append(expected, "app 'App Name'");
349 if (!expected) 341
350 { 342 info->expected = expected;
351 printf(" ERROR: (%%%c) got \"%s\", expected nothing\n", info->type, exec); 343 efreet_desktop_command_get(desktop, NULL, _cb_command, info);
352 info->error++; 344 expected = eina_list_free(expected);
353 } 345
354 else 346 /* test desktop path */
355 { 347 info->type = 'k';
356 if (strcmp(exec, expected)) 348 IF_FREE(desktop->exec);
357 { 349 desktop->exec = strdup("app %k");
358 printf(" ERROR: (%%%c) got \"%s\", expected \"%s\"\n", info->type, exec, expected); 350 expected = eina_list_append(expected, "app 'test.desktop'");
359 info->error++; 351
360 } 352 info->expected = expected;
361 } 353 efreet_desktop_command_get(desktop, NULL, _cb_command, info);
362 free(exec); 354 eina_list_free(expected);
363 return NULL; 355
356 /* clean up */
357 efreet_desktop_free(desktop);
358 eina_list_free(files);
359
360 if (chdir(olddir) != 0) ret = 0;
361
362 ret = info->error > 0 ? 0 : 1;
363 free(info);
364
365 return ret;
364} 366}
365 367
366static void * 368static void *
367cb_type_parse(Efreet_Desktop *desktop EINA_UNUSED, Efreet_Ini *ini) 369cb_type_parse(Efreet_Desktop *desktop EINA_UNUSED, Efreet_Ini *ini)
368{ 370{
369 const char *val; 371 const char *val;
370 val = efreet_ini_string_get(ini, "X-Test"); 372 val = efreet_ini_string_get(ini, "X-Test");
371 if (!val) return NULL; 373 if (!val) return NULL;
372 return (void *)strdup(val); 374 return (void *)strdup(val);
373} 375}
374 376
375int 377int
376ef_cb_desktop_type_parse(void) 378ef_cb_desktop_type_parse(void)
377{ 379{
378 Efreet_Desktop *desktop; 380 Efreet_Desktop *desktop;
379 int my_type; 381 int my_type;
380 char *val; 382 char *val;
381 int ret = 1; 383 int ret = 1;
382 384
383 /* add my custom desktop type to efreet */ 385 /* add my custom desktop type to efreet */
384 my_type = efreet_desktop_type_add("My_Type", cb_type_parse, NULL, 386 my_type = efreet_desktop_type_add("My_Type", cb_type_parse, NULL,
385 (Efreet_Desktop_Type_Free_Cb)free); 387 (Efreet_Desktop_Type_Free_Cb)free);
386 388
387 desktop = efreet_desktop_get(ef_test_path_get("test_type.desktop")); 389 desktop = efreet_desktop_get(ef_test_path_get("test_type.desktop"));
388 if (!desktop) 390 if (!desktop)
389 { 391 {
390 printf("No desktop found.\n"); 392 printf("No desktop found.\n");
391 return 0; 393 return 0;
392 } 394 }
393 395
394 if (desktop->type != my_type) 396 if (desktop->type != my_type)
395 { 397 {
396 printf("Invalid type returned in desktop"); 398 printf("Invalid type returned in desktop");
397 ret = 0; 399 ret = 0;
398 } 400 }
399 401
400 val = (char *)efreet_desktop_type_data_get(desktop); 402 val = (char *)efreet_desktop_type_data_get(desktop);
401 if (!val || strcmp(val, "Own key")) 403 if (!val || strcmp(val, "Own key"))
402 { 404 {
403 printf("Invalid value of custom key (%s).\n", val); 405 printf("Invalid value of custom key (%s).\n", val);
404 ret = 0; 406 ret = 0;
405 } 407 }
406 408
407 efreet_desktop_free(desktop); 409 efreet_desktop_free(desktop);
408 return ret; 410 return ret;
409} 411}
diff --git a/src/tests/efreet/ef_icon_theme.c b/src/tests/efreet/ef_icon_theme.c
index 6c531db..ef6dfe6 100644
--- a/src/tests/efreet/ef_icon_theme.c
+++ b/src/tests/efreet/ef_icon_theme.c
@@ -16,471 +16,471 @@
16 16
17static Eina_Bool _hash_keys(Eina_Hash *hash, const char *key, void *list); 17static Eina_Bool _hash_keys(Eina_Hash *hash, const char *key, void *list);
18static void ef_icon_theme_themes_find(const char *search_dir, 18static void ef_icon_theme_themes_find(const char *search_dir,
19 Eina_Hash *themes); 19 Eina_Hash *themes);
20static void ef_icons_find(Efreet_Icon_Theme *theme, Eina_Hash *icons); 20static void ef_icons_find(Efreet_Icon_Theme *theme, Eina_Hash *icons);
21static void ef_read_dir(const char *dir, Eina_Hash *icons); 21static void ef_read_dir(const char *dir, Eina_Hash *icons);
22 22
23int 23int
24ef_cb_efreet_icon_theme(void) 24ef_cb_efreet_icon_theme(void)
25{ 25{
26 int ret = 1; 26 int ret = 1;
27 const char *tmp; 27 const char *tmp;
28 28
29 unsetenv("XDG_DATA_HOME"); 29 unsetenv("XDG_DATA_HOME");
30 efreet_shutdown(); 30 efreet_shutdown();
31 putenv("HOME=/var/tmp"); 31 putenv("HOME=/var/tmp");
32 efreet_init(); 32 efreet_init();
33 33
34 tmp = efreet_icon_user_dir_get(); 34 tmp = efreet_icon_user_dir_get();
35 if (strcmp(tmp, "/var/tmp/.local/share/icons")) 35 if (strcmp(tmp, "/var/tmp/.local/share/icons"))
36 { 36 {
37 printf("efreet_icon_user_dir_get() returned incorrect " 37 printf("efreet_icon_user_dir_get() returned incorrect "
38 "value (%s) on HOME=/var/tmp\n", tmp); 38 "value (%s) on HOME=/var/tmp\n", tmp);
39 ret = 0; 39 ret = 0;
40 } 40 }
41 41
42 efreet_shutdown(); 42 efreet_shutdown();
43 unsetenv("HOME"); 43 unsetenv("HOME");
44#ifdef _WIN32 44#ifdef _WIN32
45 unsetenv("USERPROFILE"); 45 unsetenv("USERPROFILE");
46#endif 46#endif
47 efreet_init(); 47 efreet_init();
48 48
49 tmp = efreet_icon_user_dir_get(); 49 tmp = efreet_icon_user_dir_get();
50 if (strcmp(tmp, "/tmp/.local/share/icons")) 50 if (strcmp(tmp, "/tmp/.local/share/icons"))
51 { 51 {
52 printf("efreet_icon_user_dir_get() returned incorrect " 52 printf("efreet_icon_user_dir_get() returned incorrect "
53 "value (%s) on HOME=\n", tmp); 53 "value (%s) on HOME=\n", tmp);
54 ret = 0; 54 ret = 0;
55 } 55 }
56 56
57 return ret; 57 return ret;
58} 58}
59 59
60static Eina_Bool 60static Eina_Bool
61_hash_keys(Eina_Hash *hash EINA_UNUSED, const char *key, void *list) 61_hash_keys(Eina_Hash *hash EINA_UNUSED, const char *key, void *list)
62{ 62{
63 Eina_List **l = list; 63 Eina_List **l = list;
64 64
65 *l = eina_list_append(*l, key); 65 *l = eina_list_append(*l, key);
66 return EINA_TRUE; 66 return EINA_TRUE;
67} 67}
68 68
69int 69int
70ef_cb_efreet_icon_theme_list(void) 70ef_cb_efreet_icon_theme_list(void)
71{ 71{
72 int ret = 1; 72 int ret = 1;
73 Eina_List *themes; 73 Eina_List *themes;
74 Eina_List *icon_dirs; 74 Eina_List *icon_dirs;
75 Eina_List *l; 75 Eina_List *l;
76 Eina_Hash *dirs; 76 Eina_Hash *dirs;
77 Eina_Iterator *it; 77 Eina_Iterator *it;
78 Efreet_Icon_Theme *theme; 78 Efreet_Icon_Theme *theme;
79 const char *dir; 79 const char *dir;
80 char buf[PATH_MAX]; 80 char buf[PATH_MAX];
81 81
82 dirs = eina_hash_string_superfast_new(free); 82 dirs = eina_hash_string_superfast_new(free);
83 83
84 icon_dirs = efreet_data_dirs_get(); 84 icon_dirs = efreet_data_dirs_get();
85 85
86 ef_icon_theme_themes_find(efreet_icon_user_dir_get(), dirs); 86 ef_icon_theme_themes_find(efreet_icon_user_dir_get(), dirs);
87 EINA_LIST_FOREACH(icon_dirs, l, dir) 87 EINA_LIST_FOREACH(icon_dirs, l, dir)
88 { 88 {
89 snprintf(buf, sizeof(buf), "%s/icons", dir); 89 snprintf(buf, sizeof(buf), "%s/icons", dir);
90 ef_icon_theme_themes_find(buf, dirs); 90 ef_icon_theme_themes_find(buf, dirs);
91 } 91 }
92 EINA_LIST_FOREACH(icon_dirs, l, dir) 92 EINA_LIST_FOREACH(icon_dirs, l, dir)
93 { 93 {
94 snprintf(buf, sizeof(buf), "%s/pixmaps", dir); 94 snprintf(buf, sizeof(buf), "%s/pixmaps", dir);
95 ef_icon_theme_themes_find(buf, dirs); 95 ef_icon_theme_themes_find(buf, dirs);
96 } 96 }
97 ef_icon_theme_themes_find("/usr/share/pixmaps", dirs); 97 ef_icon_theme_themes_find("/usr/share/pixmaps", dirs);
98 98
99 themes = efreet_icon_theme_list_get(); 99 themes = efreet_icon_theme_list_get();
100 EINA_LIST_FOREACH(themes, l, theme) 100 EINA_LIST_FOREACH(themes, l, theme)
101 { 101 {
102 if ((eina_hash_find(dirs, theme->name.internal))) 102 if ((eina_hash_find(dirs, theme->name.internal)))
103 eina_hash_del(dirs, theme->name.internal, NULL); 103 eina_hash_del(dirs, theme->name.internal, NULL);
104 else 104 else
105 { 105 {
106 printf("efreet_icon_theme_list_get() returned %s which we didn't " 106 printf("efreet_icon_theme_list_get() returned %s which we didn't "
107 "see when scanning the directories.\n", theme->name.internal); 107 "see when scanning the directories.\n", theme->name.internal);
108 ret = 0; 108 ret = 0;
109 } 109 }
110 } 110 }
111 while (themes) 111 while (themes)
112 { 112 {
113 themes = eina_list_remove_list(themes, themes); 113 themes = eina_list_remove_list(themes, themes);
114 } 114 }
115 115
116 themes = NULL; 116 themes = NULL;
117 it = eina_hash_iterator_key_new(dirs); 117 it = eina_hash_iterator_key_new(dirs);
118 eina_iterator_foreach(it, EINA_EACH_CB(_hash_keys), &themes); 118 eina_iterator_foreach(it, EINA_EACH_CB(_hash_keys), &themes);
119 eina_iterator_free(it); 119 eina_iterator_free(it);
120 120
121 if (eina_list_count(themes) > 0) 121 if (eina_list_count(themes) > 0)
122 { 122 {
123 printf("efreet_icon_theme_list_get() missed: "); 123 printf("efreet_icon_theme_list_get() missed: ");
124 EINA_LIST_FOREACH(themes, l, dir) 124 EINA_LIST_FOREACH(themes, l, dir)
125 printf("%s ", dir); 125 printf("%s ", dir);
126 printf("\n"); 126 printf("\n");
127 127
128 ret = 0; 128 ret = 0;
129 } 129 }
130 while (themes) 130 while (themes)
131 { 131 {
132 themes = eina_list_remove_list(themes, themes); 132 themes = eina_list_remove_list(themes, themes);
133 } 133 }
134 eina_hash_free(dirs); 134 eina_hash_free(dirs);
135 135
136 return ret; 136 return ret;
137} 137}
138 138
139static void 139static void
140ef_icon_theme_themes_find(const char *search_dir, Eina_Hash *themes) 140ef_icon_theme_themes_find(const char *search_dir, Eina_Hash *themes)
141{ 141{
142 Eina_List *dirs; 142 Eina_List *dirs;
143 char *dir; 143 char *dir;
144 144
145 if (!search_dir || !themes) return; 145 if (!search_dir || !themes) return;
146 146
147 dirs = ecore_file_ls(search_dir); 147 dirs = ecore_file_ls(search_dir);
148 if (!dirs) return; 148 if (!dirs) return;
149 149
150 while ((dir = eina_list_data_get(dirs))) 150 while ((dir = eina_list_data_get(dirs)))
151 { 151 {
152 char p[PATH_MAX]; 152 char p[PATH_MAX];
153 153
154 dirs = eina_list_remove_list(dirs, dirs); 154 dirs = eina_list_remove_list(dirs, dirs);
155 /* if we've already added the theme we're done */ 155 /* if we've already added the theme we're done */
156 if (eina_hash_find(themes, dir)) 156 if (eina_hash_find(themes, dir))
157 { 157 {
158 free(dir); 158 free(dir);
159 continue; 159 continue;
160 } 160 }
161 161
162 /* if the index.theme file exists we open it and look for the hidden 162 /* if the index.theme file exists we open it and look for the hidden
163 * flag. */ 163 * flag. */
164 snprintf(p, sizeof(p), "%s/%s/index.theme", search_dir, dir); 164 snprintf(p, sizeof(p), "%s/%s/index.theme", search_dir, dir);
165 if (ecore_file_exists(p)) 165 if (ecore_file_exists(p))
166 { 166 {
167 Efreet_Ini *ini; 167 Efreet_Ini *ini;
168 char *d; 168 char *d;
169 int skip = 0; 169 int skip = 0;
170 170
171 ini = efreet_ini_new(p); 171 ini = efreet_ini_new(p);
172 efreet_ini_section_set(ini, "Icon Theme"); 172 efreet_ini_section_set(ini, "Icon Theme");
173 173
174 //if (efreet_ini_boolean_get(ini, "Hidden")) skip = 1; 174 //if (efreet_ini_boolean_get(ini, "Hidden")) skip = 1;
175 if (!efreet_ini_localestring_get(ini, "Name")) skip = 1; 175 if (!efreet_ini_localestring_get(ini, "Name")) skip = 1;
176 efreet_ini_free(ini); 176 efreet_ini_free(ini);
177 177
178 if (!skip) 178 if (!skip)
179 { 179 {
180 d = strdup(dir); 180 d = strdup(dir);
181 eina_hash_add(themes, dir, d); 181 eina_hash_add(themes, dir, d);
182 } 182 }
183 } 183 }
184 free(dir); 184 free(dir);
185 } 185 }
186} 186}
187 187
188const char *system_icons[] = 188const char *system_icons[] =
189{ 189{
190 "address-book-new", 190 "address-book-new",
191 "application-exit", 191 "application-exit",
192 "appointment-new", 192 "appointment-new",
193 "contact-new", 193 "contact-new",
194 "dialog-apply", 194 "dialog-apply",
195 "dialog-cancel", 195 "dialog-cancel",
196 "dialog-close", 196 "dialog-close",
197 "dialog-ok", 197 "dialog-ok",
198 "document-new", 198 "document-new",
199 "document-open", 199 "document-open",
200 "document-open-recent", 200 "document-open-recent",
201 "document-page-setup", 201 "document-page-setup",
202 "document-print", 202 "document-print",
203 "document-print-preview", 203 "document-print-preview",
204 "document-properties", 204 "document-properties",
205 "document-revert", 205 "document-revert",
206 "document-save", 206 "document-save",
207 "document-save-as", 207 "document-save-as",
208 "edit-copy", 208 "edit-copy",
209 "edit-cut", 209 "edit-cut",
210 "edit-delete", 210 "edit-delete",
211 "edit-find", 211 "edit-find",
212 "edit-find-replace", 212 "edit-find-replace",
213 "edit-paste", 213 "edit-paste",
214 "edit-redo", 214 "edit-redo",
215 "edit-select-all", 215 "edit-select-all",
216 "edit-undo", 216 "edit-undo",
217 "format-indent-less", 217 "format-indent-less",
218 "format-indent-more", 218 "format-indent-more",
219 "format-justify-center", 219 "format-justify-center",
220 "format-justify-fill", 220 "format-justify-fill",
221 "format-justify-left", 221 "format-justify-left",
222 "format-justify-right", 222 "format-justify-right",
223 "format-text-direction-ltr", 223 "format-text-direction-ltr",
224 "format-text-direction-rtl", 224 "format-text-direction-rtl",
225 "format-text-bold", 225 "format-text-bold",
226 "format-text-italic", 226 "format-text-italic",
227 "format-text-underline", 227 "format-text-underline",
228 "format-text-strikethrough", 228 "format-text-strikethrough",
229 "go-bottom", 229 "go-bottom",
230 "go-down", 230 "go-down",
231 "go-first", 231 "go-first",
232 "go-home", 232 "go-home",
233 "go-jump", 233 "go-jump",
234 "go-last", 234 "go-last",
235 "go-next", 235 "go-next",
236 "go-previous", 236 "go-previous",
237 "go-top", 237 "go-top",
238 "go-up", 238 "go-up",
239 "help-about", 239 "help-about",
240 "help-contents", 240 "help-contents",
241 "help-faq", 241 "help-faq",
242 "insert-image", 242 "insert-image",
243 "insert-link", 243 "insert-link",
244 "insert-object", 244 "insert-object",
245 "insert-text", 245 "insert-text",
246 "list-add", 246 "list-add",
247 "list-remove", 247 "list-remove",
248 "mail-forward", 248 "mail-forward",
249 "mail-mark-important", 249 "mail-mark-important",
250 "mail-mark-junk", 250 "mail-mark-junk",
251 "mail-mark-notjunk", 251 "mail-mark-notjunk",
252 "mail-mark-read", 252 "mail-mark-read",
253 "mail-mark-unread", 253 "mail-mark-unread",
254 "mail-message-new", 254 "mail-message-new",
255 "mail-reply-all", 255 "mail-reply-all",
256 "mail-reply-sender", 256 "mail-reply-sender",
257 "mail-send-receive", 257 "mail-send-receive",
258 "media-eject", 258 "media-eject",
259 "media-playback-pause", 259 "media-playback-pause",
260 "media-playback-start", 260 "media-playback-start",
261 "media-playback-stop", 261 "media-playback-stop",
262 "media-record", 262 "media-record",
263 "media-seek-backward", 263 "media-seek-backward",
264 "media-seek-forward", 264 "media-seek-forward",
265 "media-skip-backward", 265 "media-skip-backward",
266 "media-skip-forward", 266 "media-skip-forward",
267 "system-lock-screen", 267 "system-lock-screen",
268 "system-log-out", 268 "system-log-out",
269 "system-run", 269 "system-run",
270 "system-search", 270 "system-search",
271 "system-search", 271 "system-search",
272 "tools-check-spelling", 272 "tools-check-spelling",
273 "view-fullscreen", 273 "view-fullscreen",
274 "view-refresh", 274 "view-refresh",
275 "view-sort-ascending", 275 "view-sort-ascending",
276 "view-sort-descending", 276 "view-sort-descending",
277 "window-close", 277 "window-close",
278 "window-new", 278 "window-new",
279 "zoom-best-fit", 279 "zoom-best-fit",
280 "zoom-in", 280 "zoom-in",
281 "zoom-original", 281 "zoom-original",
282 "zoom-out", 282 "zoom-out",
283 "process-working", 283 "process-working",
284 "accessories-calculator", 284 "accessories-calculator",
285 "accessories-character-map", 285 "accessories-character-map",
286 "accessories-dictionary", 286 "accessories-dictionary",
287 "accessories-text-editor", 287 "accessories-text-editor",
288 "help-browser", 288 "help-browser",
289 "multimedia-volume-control", 289 "multimedia-volume-control",
290#if 0 290#if 0
291 "preferences-desktop-accessibility", 291 "preferences-desktop-accessibility",
292 "preferences-desktop-font", 292 "preferences-desktop-font",
293 "preferences-desktop-keyboard", 293 "preferences-desktop-keyboard",
294 "preferences-desktop-locale", 294 "preferences-desktop-locale",
295 "preferences-desktop-multimedia", 295 "preferences-desktop-multimedia",
296 "preferences-desktop-screensaver", 296 "preferences-desktop-screensaver",
297 "preferences-desktop-theme", 297 "preferences-desktop-theme",
298 "preferences-desktop-wallpaper", 298 "preferences-desktop-wallpaper",
299 "system-file-manager", 299 "system-file-manager",
300 "system-software-update", 300 "system-software-update",
301 "utilities-terminal", 301 "utilities-terminal",
302 "applications-accessories", 302 "applications-accessories",
303 "applications-development", 303 "applications-development",
304 "applications-games", 304 "applications-games",
305 "applications-graphics", 305 "applications-graphics",
306 "applications-internet", 306 "applications-internet",
307 "applications-multimedia", 307 "applications-multimedia",
308 "applications-office", 308 "applications-office",
309 "applications-other", 309 "applications-other",
310 "applications-system", 310 "applications-system",
311 "applications-utilities", 311 "applications-utilities",
312 "preferences-desktop", 312 "preferences-desktop",
313 "preferences-desktop-accessibility", 313 "preferences-desktop-accessibility",
314 "preferences-desktop-peripherals", 314 "preferences-desktop-peripherals",
315 "preferences-desktop-personal", 315 "preferences-desktop-personal",
316 "preferences-other", 316 "preferences-other",
317 "preferences-system", 317 "preferences-system",
318 "preferences-system-network", 318 "preferences-system-network",
319 "system-help", 319 "system-help",
320 "audio-card", 320 "audio-card",
321 "audio-input-microphone", 321 "audio-input-microphone",
322 "battery", 322 "battery",
323 "camera-photo", 323 "camera-photo",
324 "camera-video", 324 "camera-video",
325 "computer", 325 "computer",
326 "drive-cdrom", 326 "drive-cdrom",
327 "drive-harddisk", 327 "drive-harddisk",
328 "drive-removable-media", 328 "drive-removable-media",
329 "input-gaming", 329 "input-gaming",
330 "input-keyboard", 330 "input-keyboard",
331 "input-mouse", 331 "input-mouse",
332 "media-cdrom", 332 "media-cdrom",
333 "media-floppy", 333 "media-floppy",
334 "multimedia-player", 334 "multimedia-player",
335 "multimedia-player", 335 "multimedia-player",
336 "network-wired", 336 "network-wired",
337 "network-wireless", 337 "network-wireless",
338 "printer", 338 "printer",
339 "emblem-default", 339 "emblem-default",
340 "emblem-documents", 340 "emblem-documents",
341 "emblem-downloads", 341 "emblem-downloads",
342 "emblem-favorite", 342 "emblem-favorite",
343 "emblem-important", 343 "emblem-important",
344 "emblem-mail", 344 "emblem-mail",
345 "emblem-photos", 345 "emblem-photos",
346 "emblem-readonly", 346 "emblem-readonly",
347 "emblem-shared", 347 "emblem-shared",
348 "emblem-symbolic-link", 348 "emblem-symbolic-link",
349 "emblem-synchronized", 349 "emblem-synchronized",
350 "emblem-system", 350 "emblem-system",
351 "emblem-unreadable", 351 "emblem-unreadable",
352 "face-angel", 352 "face-angel",
353 "face-crying", 353 "face-crying",
354 "face-devil-grin", 354 "face-devil-grin",
355 "face-devil-sad", 355 "face-devil-sad",
356 "face-glasses", 356 "face-glasses",
357 "face-kiss", 357 "face-kiss",
358 "face-monkey", 358 "face-monkey",
359 "face-plain", 359 "face-plain",
360 "face-sad", 360 "face-sad",
361 "face-smile", 361 "face-smile",
362 "face-smile-big", 362 "face-smile-big",
363 "face-smirk", 363 "face-smirk",
364 "face-surprise", 364 "face-surprise",
365 "face-wink", 365 "face-wink",
366 "application-x-executable", 366 "application-x-executable",
367 "audio-x-generic", 367 "audio-x-generic",
368 "font-x-generic", 368 "font-x-generic",
369 "image-x-generic", 369 "image-x-generic",
370 "package-x-generic", 370 "package-x-generic",
371 "text-html", 371 "text-html",
372 "text-x-generic", 372 "text-x-generic",
373 "text-x-generic-template", 373 "text-x-generic-template",
374 "text-x-script", 374 "text-x-script",
375 "video-x-generic", 375 "video-x-generic",
376 "x-office-address-book", 376 "x-office-address-book",
377 "x-office-calendar", 377 "x-office-calendar",
378 "x-office-document", 378 "x-office-document",
379 "x-office-presentation", 379 "x-office-presentation",
380 "x-office-spreadsheet", 380 "x-office-spreadsheet",
381 "folder", 381 "folder",
382 "folder-remote", 382 "folder-remote",
383 "network-server", 383 "network-server",
384 "network-workgroup", 384 "network-workgroup",
385 "start-here", 385 "start-here",
386 "user-desktop", 386 "user-desktop",
387 "user-home", 387 "user-home",
388 "user-trash", 388 "user-trash",
389 "appointment-missed", 389 "appointment-missed",
390 "appointment-soon", 390 "appointment-soon",
391 "audio-volume-high", 391 "audio-volume-high",
392 "audio-volume-low", 392 "audio-volume-low",
393 "audio-volume-medium", 393 "audio-volume-medium",
394 "audio-volume-muted", 394 "audio-volume-muted",
395 "battery-caution", 395 "battery-caution",
396 "battery-low", 396 "battery-low",
397 "dialog-error", 397 "dialog-error",
398 "dialog-information", 398 "dialog-information",
399 "dialog-password", 399 "dialog-password",
400 "dialog-question", 400 "dialog-question",
401 "dialog-warning", 401 "dialog-warning",
402 "folder-drag-accept", 402 "folder-drag-accept",
403 "folder-open", 403 "folder-open",
404 "folder-visiting", 404 "folder-visiting",
405 "image-loading", 405 "image-loading",
406 "image-missing", 406 "image-missing",
407 "mail-attachment", 407 "mail-attachment",
408 "mail-unread", 408 "mail-unread",
409 "mail-read", 409 "mail-read",
410 "mail-replied", 410 "mail-replied",
411 "mail-signed", 411 "mail-signed",
412 "mail-signed-verified", 412 "mail-signed-verified",
413 "media-playlist-repeat", 413 "media-playlist-repeat",
414 "media-playlist-shuffle", 414 "media-playlist-shuffle",
415 "network-error", 415 "network-error",
416 "network-idle", 416 "network-idle",
417 "network-offline", 417 "network-offline",
418 "network-receive", 418 "network-receive",
419 "network-transmit", 419 "network-transmit",
420 "network-transmit-receive", 420 "network-transmit-receive",
421 "printer-error", 421 "printer-error",
422 "printer-printing", 422 "printer-printing",
423 "software-update-available", 423 "software-update-available",
424 "software-update-urgent", 424 "software-update-urgent",
425 "sync-error", 425 "sync-error",
426 "sync-synchronizing", 426 "sync-synchronizing",
427 "task-due", 427 "task-due",
428 "task-passed-due", 428 "task-passed-due",
429 "user-away", 429 "user-away",
430 "user-idle", 430 "user-idle",
431 "user-offline", 431 "user-offline",
432 "user-online", 432 "user-online",
433 "user-trash-full", 433 "user-trash-full",
434 "weather-clear", 434 "weather-clear",
435 "weather-clear-night", 435 "weather-clear-night",
436 "weather-few-clouds", 436 "weather-few-clouds",
437 "weather-few-clouds-night", 437 "weather-few-clouds-night",
438 "weather-fog", 438 "weather-fog",
439 "weather-overcast", 439 "weather-overcast",
440 "weather-severe-alert", 440 "weather-severe-alert",
441 "weather-showers", 441 "weather-showers",
442 "weather-showers-scattered", 442 "weather-showers-scattered",
443 "weather-snow", 443 "weather-snow",
444 "weather-storm", 444 "weather-storm",
445#endif 445#endif
446 NULL 446 NULL
447}; 447};
448 448
449int 449int
450ef_cb_efreet_icon_match(void) 450ef_cb_efreet_icon_match(void)
451{ 451{
452 int i, ret = 1; 452 int i, ret = 1;
453 Eina_Hash *icon_hash; 453 Eina_Hash *icon_hash;
454 Efreet_Icon_Theme *theme; 454 Efreet_Icon_Theme *theme;
455 455
456 theme = efreet_icon_theme_find(THEME); 456 theme = efreet_icon_theme_find(THEME);
457 icon_hash = eina_hash_string_superfast_new(free); 457 icon_hash = eina_hash_string_superfast_new(free);
458 458
459 ef_icons_find(theme, icon_hash); 459 ef_icons_find(theme, icon_hash);
460 460
461 double start = ecore_time_get(); 461 double start = ecore_time_get();
462 for (i = 0; system_icons[i]; i++) 462 for (i = 0; system_icons[i]; i++)
463 { 463 {
464 const char *path; 464 const char *path;
465 char *p, *s; 465 char *p, *s;
466 466
467 path = efreet_icon_path_find(THEME, system_icons[i], SIZE); 467 path = efreet_icon_path_find(THEME, system_icons[i], SIZE);
468 468
469 if (!path) 469 if (!path)
470 { 470 {
471#if 1 471#if 1
472 if (eina_hash_find(icon_hash, system_icons[i])) 472 if (eina_hash_find(icon_hash, system_icons[i]))
473 { 473 {
474 printf("NOT FOUND %s\n", system_icons[i]); 474 printf("NOT FOUND %s\n", system_icons[i]);
475 ret = 0; 475 ret = 0;
476 } 476 }
477#endif 477#endif
478 continue; 478 continue;
479 } 479 }
480 else if (!eina_hash_find(icon_hash, system_icons[i])) 480 else if (!eina_hash_find(icon_hash, system_icons[i]))
481 { 481 {
482 printf("Found icon not in hash: %s\n", system_icons[i]); 482 printf("Found icon not in hash: %s\n", system_icons[i]);
483 } 483 }
484 484
485 p = strdup(path); 485 p = strdup(path);
486 s = strrchr(p, '.'); 486 s = strrchr(p, '.');
@@ -489,18 +489,18 @@ ef_cb_efreet_icon_match(void)
489 if (s) s++; 489 if (s) s++;
490 490
491 if (s && strcmp(s, system_icons[i])) 491 if (s && strcmp(s, system_icons[i]))
492 { 492 {
493 printf("Name mismatch name (%s) vs ef (%s)\n", system_icons[i], s); 493 printf("Name mismatch name (%s) vs ef (%s)\n", system_icons[i], s);
494 ret = 0; 494 ret = 0;
495 } 495 }
496 free(p); 496 free(p);
497 } 497 }
498 printf("Time: %f\n", (ecore_time_get() - start)); 498 printf("Time: %f\n", (ecore_time_get() - start));
499 eina_hash_free(icon_hash); 499 eina_hash_free(icon_hash);
500 500
501 start = ecore_time_get(); 501 start = ecore_time_get();
502 for (i = 0; system_icons[i]; i++) 502 for (i = 0; system_icons[i]; i++)
503 { 503 {
504 const char *path; 504 const char *path;
505 char *p, *s; 505 char *p, *s;
506 506
@@ -515,91 +515,91 @@ ef_cb_efreet_icon_match(void)
515 if (s) s++; 515 if (s) s++;
516 516
517 if (s && strcmp(s, system_icons[i])) 517 if (s && strcmp(s, system_icons[i]))
518 { 518 {
519 printf("Name mismatch name (%s) vs ef (%s)\n", system_icons[i], s); 519 printf("Name mismatch name (%s) vs ef (%s)\n", system_icons[i], s);
520 ret = 0; 520 ret = 0;
521 } 521 }
522 free(p); 522 free(p);
523 } 523 }
524 printf("Time: %f\n", (ecore_time_get() - start)); 524 printf("Time: %f\n", (ecore_time_get() - start));
525 525
526 return ret; 526 return ret;
527} 527}
528 528
529static void 529static void
530ef_icons_find(Efreet_Icon_Theme *theme, Eina_Hash *icons) 530ef_icons_find(Efreet_Icon_Theme *theme, Eina_Hash *icons)
531{ 531{
532 Eina_List *l, *ll; 532 Eina_List *l, *ll;
533 char path[PATH_MAX]; 533 char path[PATH_MAX];
534 const char *theme_path; 534 const char *theme_path;
535 535
536 if (!theme || !icons) return; 536 if (!theme || !icons) return;
537 537
538 EINA_LIST_FOREACH(theme->paths, l, theme_path) 538 EINA_LIST_FOREACH(theme->paths, l, theme_path)
539 { 539 {
540 Efreet_Icon_Theme_Directory *dir; 540 Efreet_Icon_Theme_Directory *dir;
541 541
542 EINA_LIST_FOREACH(theme->directories, ll, dir) 542 EINA_LIST_FOREACH(theme->directories, ll, dir)
543 { 543 {
544 snprintf(path, sizeof(path), "%s/%s/", theme_path, dir->name); 544 snprintf(path, sizeof(path), "%s/%s/", theme_path, dir->name);
545 ef_read_dir(path, icons); 545 ef_read_dir(path, icons);
546 } 546 }
547 } 547 }
548 548
549 if (theme->inherits) 549 if (theme->inherits)
550 { 550 {
551 Efreet_Icon_Theme *parent_theme; 551 Efreet_Icon_Theme *parent_theme;
552 char *parent; 552 char *parent;
553 553
554 EINA_LIST_FOREACH(theme->inherits, l, parent) 554 EINA_LIST_FOREACH(theme->inherits, l, parent)
555 { 555 {
556 parent_theme = efreet_icon_theme_find(parent); 556 parent_theme = efreet_icon_theme_find(parent);
557 if (parent_theme) 557 if (parent_theme)
558 ef_icons_find(parent_theme, icons); 558 ef_icons_find(parent_theme, icons);
559 } 559 }
560 } 560 }
561 else if (strcmp(theme->name.internal, "hicolor")) 561 else if (strcmp(theme->name.internal, "hicolor"))
562 { 562 {
563 Efreet_Icon_Theme *parent_theme; 563 Efreet_Icon_Theme *parent_theme;
564 564
565 parent_theme = efreet_icon_theme_find("hicolor"); 565 parent_theme = efreet_icon_theme_find("hicolor");
566 if (parent_theme) 566 if (parent_theme)
567 ef_icons_find(parent_theme, icons); 567 ef_icons_find(parent_theme, icons);
568 } 568 }
569 569
570 ef_read_dir("/usr/share/pixmaps", icons); 570 ef_read_dir("/usr/share/pixmaps", icons);
571} 571}
572 572
573static void 573static void
574ef_read_dir(const char *dir, Eina_Hash *icons) 574ef_read_dir(const char *dir, Eina_Hash *icons)
575{ 575{
576 Eina_List *files; 576 Eina_List *files;
577 char *file; 577 char *file;
578 578
579 if (!dir || !icons) return; 579 if (!dir || !icons) return;
580 580
581 files = ecore_file_ls(dir); 581 files = ecore_file_ls(dir);
582 if (!files) return; 582 if (!files) return;
583 583
584 while ((file = eina_list_data_get(files))) 584 while ((file = eina_list_data_get(files)))
585 { 585 {
586 char *p; 586 char *p;
587 587
588 files = eina_list_remove_list(files, files); 588 files = eina_list_remove_list(files, files);
589 p = strrchr(file, '.'); 589 p = strrchr(file, '.');
590 if (!p) 590 if (!p)
591 { 591 {
592 FREE(file); 592 FREE(file);
593 continue; 593 continue;
594 } 594 }
595 595
596 if (!strcmp(p, ".png") || !strcmp(p, ".xpm")) 596 if (!strcmp(p, ".png") || !strcmp(p, ".xpm"))
597 { 597 {
598 *p = '\0'; 598 *p = '\0';
599 599
600 eina_hash_add(icons, file, strdup(file)); 600 eina_hash_add(icons, file, strdup(file));
601 } 601 }
602 602
603 FREE(file); 603 FREE(file);
604 } 604 }
605} 605}
diff --git a/src/tests/efreet/ef_ini.c b/src/tests/efreet/ef_ini.c
index d80685f..572d3a7 100644
--- a/src/tests/efreet/ef_ini.c
+++ b/src/tests/efreet/ef_ini.c
@@ -8,168 +8,168 @@
8int 8int
9ef_cb_ini_parse(void) 9ef_cb_ini_parse(void)
10{ 10{
11 int ret = 1; 11 int ret = 1;
12 Efreet_Ini *ini; 12 Efreet_Ini *ini;
13 13
14 putenv("LC_ALL=en_US"); 14 putenv("LC_ALL=en_US");
15 15
16 ini = efreet_ini_new(ef_test_path_get("test.ini")); 16 ini = efreet_ini_new(ef_test_path_get("test.ini"));
17 if (!ini) 17 if (!ini)
18 { 18 {
19 printf("efreet_ini_parse() Failed to initialize Efreet_Ini\n"); 19 printf("efreet_ini_parse() Failed to initialize Efreet_Ini\n");
20 return 0; 20 return 0;
21 } 21 }
22 22
23 if (efreet_ini_section_set(ini, "contact")) 23 if (efreet_ini_section_set(ini, "contact"))
24 { 24 {
25 const char *val; 25 const char *val;
26 int ival; 26 int ival;
27 unsigned int bval; 27 unsigned int bval;
28 28
29 val = efreet_ini_string_get(ini, "Name"); 29 val = efreet_ini_string_get(ini, "Name");
30 if (!val || strcmp(val, "Foo Bar")) 30 if (!val || strcmp(val, "Foo Bar"))
31 { 31 {
32 printf("efreet_ini_string_get() Name parsed incorrectly\n"); 32 printf("efreet_ini_string_get() Name parsed incorrectly\n");
33 ret = 0; 33 ret = 0;
34 } 34 }
35 35
36 val = efreet_ini_localestring_get(ini, "Name"); 36 val = efreet_ini_localestring_get(ini, "Name");
37 if (!val || strcmp(val, "English Foo Bar")) 37 if (!val || strcmp(val, "English Foo Bar"))
38 { 38 {
39 printf("efreet_ini_localestring_get() Name parsed incorrectly\n"); 39 printf("efreet_ini_localestring_get() Name parsed incorrectly\n");
40 ret = 0; 40 ret = 0;
41 } 41 }
42 42
43 val = efreet_ini_string_get(ini, "Email"); 43 val = efreet_ini_string_get(ini, "Email");
44 if (!val || strcmp(val, "foo@bar.com")) 44 if (!val || strcmp(val, "foo@bar.com"))
45 { 45 {
46 printf("efreet_ini_string_get() Email parsed incorrectly\n"); 46 printf("efreet_ini_string_get() Email parsed incorrectly\n");
47 ret = 0; 47 ret = 0;
48 } 48 }
49 49
50 val = efreet_ini_localestring_get(ini, "Email"); 50 val = efreet_ini_localestring_get(ini, "Email");
51 if (!val || strcmp(val, "foo@bar.com")) 51 if (!val || strcmp(val, "foo@bar.com"))
52 { 52 {
53 printf("efreet_ini_localestring_get() Email parsed incorrectly\n"); 53 printf("efreet_ini_localestring_get() Email parsed incorrectly\n");
54 ret = 0; 54 ret = 0;
55 } 55 }
56 56
57 ival = efreet_ini_int_get(ini, "Age"); 57 ival = efreet_ini_int_get(ini, "Age");
58 if (ival != 30) 58 if (ival != 30)
59 { 59 {
60 printf("efreet_ini_int_get() Age parsed incorrectly\n"); 60 printf("efreet_ini_int_get() Age parsed incorrectly\n");
61 ret = 0; 61 ret = 0;
62 } 62 }
63 63
64 bval = efreet_ini_boolean_get(ini, "TrueBoolean"); 64 bval = efreet_ini_boolean_get(ini, "TrueBoolean");
65 if (!bval) 65 if (!bval)
66 { 66 {
67 printf("efreet_ini_boolean_get() TrueBoolean parsed incorrectly\n"); 67 printf("efreet_ini_boolean_get() TrueBoolean parsed incorrectly\n");
68 ret = 0; 68 ret = 0;
69 } 69 }
70 70
71 bval = efreet_ini_boolean_get(ini, "FalseBoolean"); 71 bval = efreet_ini_boolean_get(ini, "FalseBoolean");
72 if (bval) 72 if (bval)
73 { 73 {
74 printf("efreet_ini_boolean_get() FalseBoolean parsed incorrectly\n"); 74 printf("efreet_ini_boolean_get() FalseBoolean parsed incorrectly\n");
75 ret = 0; 75 ret = 0;
76 } 76 }
77 77
78 bval = efreet_ini_boolean_get(ini, "InvalidBoolean"); 78 bval = efreet_ini_boolean_get(ini, "InvalidBoolean");
79 if (bval) 79 if (bval)
80 { 80 {
81 printf("efreet_ini_boolean_get() InvalidBoolean parsed incorrectly\n"); 81 printf("efreet_ini_boolean_get() InvalidBoolean parsed incorrectly\n");
82 ret = 0; 82 ret = 0;
83 } 83 }
84 84
85 val = efreet_ini_string_get(ini, "Escaped"); 85 val = efreet_ini_string_get(ini, "Escaped");
86 if (!val || strcmp(val, "line1\nline2\r\nline3\ttabbed \\ with a backslash and spaces")) 86 if (!val || strcmp(val, "line1\nline2\r\nline3\ttabbed \\ with a backslash and spaces"))
87 { 87 {
88 printf("efreet_ini_unescape() improperly unescaped value\n"); 88 printf("efreet_ini_unescape() improperly unescaped value\n");
89 ret = 0; 89 ret = 0;
90 } 90 }
91 } 91 }
92 else 92 else
93 { 93 {
94 printf("efreet_ini_section_set() Failed to set 'contact' section\n"); 94 printf("efreet_ini_section_set() Failed to set 'contact' section\n");
95 ret = 0; 95 ret = 0;
96 } 96 }
97 97
98 efreet_ini_free(ini); 98 efreet_ini_free(ini);
99 99
100 return ret; 100 return ret;
101} 101}
102 102
103int 103int
104ef_cb_ini_long_line(void) 104ef_cb_ini_long_line(void)
105{ 105{
106 Efreet_Ini *ini; 106 Efreet_Ini *ini;
107 int ret = 1; 107 int ret = 1;
108 108
109 struct 109 struct
110 { 110 {
111 char *key; 111 char *key;
112 int len; 112 int len;
113 } tests[] = { 113 } tests[] = {
114 {"key", 5099}, 114 {"key", 5099},
115 {"key2", 5099}, 115 {"key2", 5099},
116 {NULL, 0} 116 {NULL, 0}
117 }; 117 };
118 118
119 ini = efreet_ini_new(ef_test_path_get("long.ini")); 119 ini = efreet_ini_new(ef_test_path_get("long.ini"));
120 if (!ini) 120 if (!ini)
121 { 121 {
122 printf("Ini failed to parse.\n"); 122 printf("Ini failed to parse.\n");
123 ret = 0;
124 }
125
126 if (ret) ret = efreet_ini_section_set(ini, "section");
127 if (ret)
128 {
129 const char *val;
130 int i, len;
131
132 for (i = 0; tests[i].key; i++)
133 {
134 val = efreet_ini_string_get(ini, tests[i].key);
135 if (val)
136 {
137 len = strlen(val);
138 if (len != tests[i].len)
139 {
140 printf("Invalid long line parsing. Value length: %d (expected %d)\n", len, tests[i].len);
141 ret = 0;
142 }
143 }
144 else
145 {
146 printf("Key missing: %s.", tests[i].key);
147 ret = 0; 123 ret = 0;
148 } 124 }
149 } 125
150 } 126 if (ret) ret = efreet_ini_section_set(ini, "section");
151 else 127 if (ret)
152 { 128 {
153 printf("Section missing: 'section'."); 129 const char *val;
154 } 130 int i, len;
155 131
156 if (ini) efreet_ini_free(ini); 132 for (i = 0; tests[i].key; i++)
157 return ret; 133 {
134 val = efreet_ini_string_get(ini, tests[i].key);
135 if (val)
136 {
137 len = strlen(val);
138 if (len != tests[i].len)
139 {
140 printf("Invalid long line parsing. Value length: %d (expected %d)\n", len, tests[i].len);
141 ret = 0;
142 }
143 }
144 else
145 {
146 printf("Key missing: %s.", tests[i].key);
147 ret = 0;
148 }
149 }
150 }
151 else
152 {
153 printf("Section missing: 'section'.");
154 }
155
156 if (ini) efreet_ini_free(ini);
157 return ret;
158} 158}
159 159
160int 160int
161ef_cb_ini_garbage(void) 161ef_cb_ini_garbage(void)
162{ 162{
163 Efreet_Ini *ini; 163 Efreet_Ini *ini;
164 int ret = 1; 164 int ret = 1;
165 165
166 ini = efreet_ini_new(ef_test_path_get("test_garbage")); 166 ini = efreet_ini_new(ef_test_path_get("test_garbage"));
167 if (!ini) 167 if (!ini)
168 { 168 {
169 printf("Ini failed to parse.\n"); 169 printf("Ini failed to parse.\n");
170 return 0; 170 return 0;
171 } 171 }
172 if (ini->data) ret = 0; 172 if (ini->data) ret = 0;
173 efreet_ini_free(ini); 173 efreet_ini_free(ini);
174 return ret; 174 return ret;
175} 175}
diff --git a/src/tests/efreet/ef_locale.c b/src/tests/efreet/ef_locale.c
index 1dcce2e..67753f2 100644
--- a/src/tests/efreet/ef_locale.c
+++ b/src/tests/efreet/ef_locale.c
@@ -8,79 +8,79 @@
8int 8int
9ef_cb_locale(void) 9ef_cb_locale(void)
10{ 10{
11 int ret = 1, i; 11 int ret = 1, i;
12 struct 12 struct
13 { 13 {
14 char *lc_message; 14 char *lc_message;
15 char *lang; 15 char *lang;
16 char *country; 16 char *country;
17 char *modifier; 17 char *modifier;
18 } langs[] = { 18 } langs[] = {
19 /* these are ordered such that when we move from LANG to LC_MESSAGES 19 /* these are ordered such that when we move from LANG to LC_MESSAGES
20 * the LANG env will still be effect. Same with moving from 20 * the LANG env will still be effect. Same with moving from
21 * LC_MESSAGES to LANG */ 21 * LC_MESSAGES to LANG */
22 {"LANG=", NULL, NULL, NULL}, 22 {"LANG=", NULL, NULL, NULL},
23 {"LANG=en", "en", NULL, NULL}, 23 {"LANG=en", "en", NULL, NULL},
24 {"LANG=en@Latn", "en", NULL, "Latn"}, 24 {"LANG=en@Latn", "en", NULL, "Latn"},
25 {"LANG=en_US", "en", "US", NULL}, 25 {"LANG=en_US", "en", "US", NULL},
26 {"LANG=en_US@Latn", "en", "US", "Latn"}, 26 {"LANG=en_US@Latn", "en", "US", "Latn"},
27 {"LANG=en_US.blah@Latn", "en", "US", "Latn"}, 27 {"LANG=en_US.blah@Latn", "en", "US", "Latn"},
28 {"LC_MESSAGES=", "en", "US", "Latn"}, /* This will fallback to LANG */ 28 {"LC_MESSAGES=", "en", "US", "Latn"}, /* This will fallback to LANG */
29 {"LC_MESSAGES=fr", "fr", NULL, NULL}, 29 {"LC_MESSAGES=fr", "fr", NULL, NULL},
30 {"LC_MESSAGES=fr@Blah", "fr", NULL, "Blah"}, 30 {"LC_MESSAGES=fr@Blah", "fr", NULL, "Blah"},
31 {"LC_MESSAGES=fr_FR", "fr", "FR", NULL}, 31 {"LC_MESSAGES=fr_FR", "fr", "FR", NULL},
32 {"LC_MESSAGES=fr_FR@Blah", "fr", "FR", "Blah"}, 32 {"LC_MESSAGES=fr_FR@Blah", "fr", "FR", "Blah"},
33 {"LC_MESSAGES=fr_FR.Foo@Blah", "fr", "FR", "Blah"}, 33 {"LC_MESSAGES=fr_FR.Foo@Blah", "fr", "FR", "Blah"},
34 {"LC_ALL=", "fr", "FR", "Blah"}, /* this will fallback to LC_MESSAGES */ 34 {"LC_ALL=", "fr", "FR", "Blah"}, /* this will fallback to LC_MESSAGES */
35 {"LC_ALL=sr", "sr", NULL, NULL}, 35 {"LC_ALL=sr", "sr", NULL, NULL},
36 {"LC_ALL=sr@Ret", "sr", NULL, "Ret"}, 36 {"LC_ALL=sr@Ret", "sr", NULL, "Ret"},
37 {"LC_ALL=sr_YU", "sr", "YU", NULL}, 37 {"LC_ALL=sr_YU", "sr", "YU", NULL},
38 {"LC_ALL=sr_YU@Ret", "sr", "YU", "Ret"}, 38 {"LC_ALL=sr_YU@Ret", "sr", "YU", "Ret"},
39 {"LC_ALL=sr_YU.ssh@Ret", "sr", "YU", "Ret"}, 39 {"LC_ALL=sr_YU.ssh@Ret", "sr", "YU", "Ret"},
40 {NULL, NULL, NULL, NULL} 40 {NULL, NULL, NULL, NULL}
41 }; 41 };
42 42
43 /* reset everything to blank */ 43 /* reset everything to blank */
44 putenv("LC_ALL="); 44 putenv("LC_ALL=");
45 putenv("LC_MESSAGES="); 45 putenv("LC_MESSAGES=");
46 putenv("LANG="); 46 putenv("LANG=");
47 47
48 for (i = 0; langs[i].lc_message; i++) 48 for (i = 0; langs[i].lc_message; i++)
49 { 49 {
50 const char *tmp; 50 const char *tmp;
51 51
52 putenv(langs[i].lc_message); 52 putenv(langs[i].lc_message);
53 53
54 tmp = efreet_lang_get(); 54 tmp = efreet_lang_get();
55 if ((langs[i].lang && (!tmp || strcmp(tmp, langs[i].lang))) 55 if ((langs[i].lang && (!tmp || strcmp(tmp, langs[i].lang)))
56 || (!langs[i].lang && tmp)) 56 || (!langs[i].lang && tmp))
57 { 57 {
58 printf("efreet_lang_get() is wrong (%s) with %s\n", 58 printf("efreet_lang_get() is wrong (%s) with %s\n",
59 tmp, langs[i].lang); 59 tmp, langs[i].lang);
60 ret = 0; 60 ret = 0;
61 } 61 }
62 62
63 tmp = efreet_lang_country_get(); 63 tmp = efreet_lang_country_get();
64 if ((langs[i].country && (!tmp || strcmp(tmp, langs[i].country))) 64 if ((langs[i].country && (!tmp || strcmp(tmp, langs[i].country)))
65 || (!langs[i].country && tmp)) 65 || (!langs[i].country && tmp))
66 { 66 {
67 printf("efreet_lang_country_get() is wrong (%s) with %s\n", 67 printf("efreet_lang_country_get() is wrong (%s) with %s\n",
68 tmp, langs[i].lang); 68 tmp, langs[i].lang);
69 ret = 0; 69 ret = 0;
70 } 70 }
71 71
72 tmp = efreet_lang_modifier_get(); 72 tmp = efreet_lang_modifier_get();
73 if ((langs[i].modifier && (!tmp || strcmp(tmp, langs[i].modifier))) 73 if ((langs[i].modifier && (!tmp || strcmp(tmp, langs[i].modifier)))
74 || (!langs[i].modifier && tmp)) 74 || (!langs[i].modifier && tmp))
75 { 75 {
76 printf("efreet_lang_modifier_get() is wrong with %s with %s\n", 76 printf("efreet_lang_modifier_get() is wrong with %s with %s\n",
77 tmp, langs[i].lang); 77 tmp, langs[i].lang);
78 ret = 0; 78 ret = 0;
79 } 79 }
80 80
81 efreet_shutdown(); 81 efreet_shutdown();
82 efreet_init(); 82 efreet_init();
83 } 83 }
84 84
85 return ret; 85 return ret;
86} 86}
diff --git a/src/tests/efreet/ef_menu.c b/src/tests/efreet/ef_menu.c
index 7565768..9a4c28a 100644
--- a/src/tests/efreet/ef_menu.c
+++ b/src/tests/efreet/ef_menu.c
@@ -8,144 +8,144 @@
8static void 8static void
9ef_menu_desktop_exec(Efreet_Menu *menu) 9ef_menu_desktop_exec(Efreet_Menu *menu)
10{ 10{
11 Eina_List *l; 11 Eina_List *l;
12 12
13 if (menu->entries) 13 if (menu->entries)
14 { 14 {
15 Efreet_Desktop *desktop; 15 Efreet_Desktop *desktop;
16 16
17 EINA_LIST_FOREACH(menu->entries, l, desktop) 17 EINA_LIST_FOREACH(menu->entries, l, desktop)
18 efreet_desktop_exec(desktop, NULL); 18 efreet_desktop_exec(desktop, NULL);
19 } 19 }
20 if (menu->sub_menus) 20 if (menu->sub_menus)
21 { 21 {
22 Efreet_Menu *sub_menu; 22 Efreet_Menu *sub_menu;
23 23
24 EINA_LIST_FOREACH(menu->sub_menus, l, sub_menu) 24 EINA_LIST_FOREACH(menu->sub_menus, l, sub_menu)
25 ef_menu_desktop_exec(sub_menu); 25 ef_menu_desktop_exec(sub_menu);
26 } 26 }
27} 27}
28#endif 28#endif
29 29
30int 30int
31ef_cb_menu_get(void) 31ef_cb_menu_get(void)
32{ 32{
33 Efreet_Menu *menu; 33 Efreet_Menu *menu;
34 34
35 menu = efreet_menu_get(); 35 menu = efreet_menu_get();
36// menu = efreet_menu_parse(ef_test_path_get("test.menu")); 36 // menu = efreet_menu_parse(ef_test_path_get("test.menu"));
37 if (!menu) 37 if (!menu)
38 { 38 {
39 printf("efreet_menu_get() returned NULL\n"); 39 printf("efreet_menu_get() returned NULL\n");
40 return 0; 40 return 0;
41 } 41 }
42 printf("\n"); 42 printf("\n");
43 efreet_menu_dump(menu, ""); 43 efreet_menu_dump(menu, "");
44 efreet_menu_free(menu); 44 efreet_menu_free(menu);
45 45
46 return 1; 46 return 1;
47} 47}
48 48
49int 49int
50ef_cb_menu_with_slashes(void) 50ef_cb_menu_with_slashes(void)
51{ 51{
52 Efreet_Menu *menu; 52 Efreet_Menu *menu;
53 53
54 menu = efreet_menu_parse(ef_test_path_get("test_menu_slash_bad.menu")); 54 menu = efreet_menu_parse(ef_test_path_get("test_menu_slash_bad.menu"));
55 if (menu) 55 if (menu)
56 { 56 {
57 printf("efreet_menu_get() didn't return NULL\n"); 57 printf("efreet_menu_get() didn't return NULL\n");
58 return 0; 58 return 0;
59 } 59 }
60 60
61 return 1; 61 return 1;
62} 62}
63 63
64int 64int
65ef_cb_menu_save(void) 65ef_cb_menu_save(void)
66{ 66{
67 Efreet_Menu *menu; 67 Efreet_Menu *menu;
68 int ret; 68 int ret;
69 69
70// menu = efreet_menu_get(); 70 // menu = efreet_menu_get();
71 menu = efreet_menu_parse(ef_test_path_get("test.menu")); 71 menu = efreet_menu_parse(ef_test_path_get("test.menu"));
72 if (!menu) 72 if (!menu)
73 { 73 {
74 printf("efreet_menu_get() returned NULL\n"); 74 printf("efreet_menu_get() returned NULL\n");
75 return 0; 75 return 0;
76 } 76 }
77 unlink("/tmp/test.menu"); 77 unlink("/tmp/test.menu");
78 ret = efreet_menu_save(menu, "/tmp/test.menu"); 78 ret = efreet_menu_save(menu, "/tmp/test.menu");
79 efreet_menu_free(menu); 79 efreet_menu_free(menu);
80 return ret; 80 return ret;
81} 81}
82 82
83int 83int
84ef_cb_menu_edit(void) 84ef_cb_menu_edit(void)
85{ 85{
86 Efreet_Menu *menu, *entry; 86 Efreet_Menu *menu, *entry;
87 Efreet_Desktop *desktop; 87 Efreet_Desktop *desktop;
88 88
89// menu = efreet_menu_get(); 89 // menu = efreet_menu_get();
90 menu = efreet_menu_parse(ef_test_path_get("test.menu")); 90 menu = efreet_menu_parse(ef_test_path_get("test.menu"));
91 if (!menu) 91 if (!menu)
92 { 92 {
93 printf("efreet_menu_get() returned NULL\n"); 93 printf("efreet_menu_get() returned NULL\n");
94 return 0; 94 return 0;
95 } 95 }
96#if 0 96#if 0
97 printf("\n"); 97 printf("\n");
98 efreet_menu_dump(menu, ""); 98 efreet_menu_dump(menu, "");
99 printf("\n"); 99 printf("\n");
100#endif 100#endif
101 101
102 desktop = efreet_desktop_get(ef_test_path_get("test.desktop")); 102 desktop = efreet_desktop_get(ef_test_path_get("test.desktop"));
103 if (!desktop) 103 if (!desktop)
104 { 104 {
105 efreet_menu_free(menu); 105 efreet_menu_free(menu);
106 printf("No desktop found.\n"); 106 printf("No desktop found.\n");
107 return 0; 107 return 0;
108 } 108 }
109 109
110 efreet_menu_desktop_insert(menu, desktop, 0); 110 efreet_menu_desktop_insert(menu, desktop, 0);
111#if 0 111#if 0
112 printf("\n"); 112 printf("\n");
113 efreet_menu_dump(menu, ""); 113 efreet_menu_dump(menu, "");
114 printf("\n"); 114 printf("\n");
115#endif 115#endif
116 entry = eina_list_data_get(menu->entries); 116 entry = eina_list_data_get(menu->entries);
117 if (desktop != entry->desktop) 117 if (desktop != entry->desktop)
118 { 118 {
119 efreet_menu_free(menu); 119 efreet_menu_free(menu);
120 return 0; 120 return 0;
121 } 121 }
122 122
123 efreet_menu_desktop_insert(menu, desktop, 2); 123 efreet_menu_desktop_insert(menu, desktop, 2);
124#if 0 124#if 0
125 printf("\n"); 125 printf("\n");
126 efreet_menu_dump(menu, ""); 126 efreet_menu_dump(menu, "");
127 printf("\n"); 127 printf("\n");
128#endif 128#endif
129 entry = eina_list_nth(menu->entries, 2); 129 entry = eina_list_nth(menu->entries, 2);
130 if (desktop != entry->desktop) 130 if (desktop != entry->desktop)
131 { 131 {
132 efreet_menu_free(menu); 132 efreet_menu_free(menu);
133 return 0; 133 return 0;
134 } 134 }
135 135
136 efreet_menu_desktop_insert(menu, desktop, -1); 136 efreet_menu_desktop_insert(menu, desktop, -1);
137#if 0 137#if 0
138 printf("\n"); 138 printf("\n");
139 efreet_menu_dump(menu, ""); 139 efreet_menu_dump(menu, "");
140 printf("\n"); 140 printf("\n");
141#endif 141#endif
142 entry = eina_list_data_get(eina_list_last(menu->entries)); 142 entry = eina_list_data_get(eina_list_last(menu->entries));
143 if (desktop != entry->desktop) 143 if (desktop != entry->desktop)
144 { 144 {
145 efreet_menu_free(menu); 145 efreet_menu_free(menu);
146 return 0; 146 return 0;
147 } 147 }
148 148
149 efreet_menu_free(menu); 149 efreet_menu_free(menu);
150 return 1; 150 return 1;
151} 151}
diff --git a/src/tests/efreet/ef_mime.c b/src/tests/efreet/ef_mime.c
index e059ffa..ecb5d80 100644
--- a/src/tests/efreet/ef_mime.c
+++ b/src/tests/efreet/ef_mime.c
@@ -13,46 +13,46 @@
13int 13int
14ef_mime_cb_get(void) 14ef_mime_cb_get(void)
15{ 15{
16 const char *mime = NULL, *icon; 16 const char *mime = NULL, *icon;
17 int misses = 0, i = 0; 17 int misses = 0, i = 0;
18 struct 18 struct
19 { 19 {
20 char *file; 20 char *file;
21 char *mime; 21 char *mime;
22 } files[] = { 22 } files[] = {
23 {"test_type.desktop", "application/x-desktop"}, 23 {"test_type.desktop", "application/x-desktop"},
24 {"entry.png", "image/png"}, 24 {"entry.png", "image/png"},
25 {"entry", "image/png"}, 25 {"entry", "image/png"},
26 {"sub", "inode/directory"}, 26 {"sub", "inode/directory"},
27 {NULL, NULL} 27 { }
28 }; 28 };
29 double start; 29 double start;
30 30
31 if (!efreet_mime_init()) 31 if (!efreet_mime_init())
32 { 32 {
33 printf("Could not init efreet\n"); 33 printf("Could not init efreet\n");
34 return 1; 34 return 1;
35 } 35 }
36 36
37 for (i = 0; files[i].file; ++i) 37 for (i = 0; files[i].file; ++i)
38 { 38 {
39 mime = efreet_mime_type_get(ef_test_path_get(files[i].file)); 39 mime = efreet_mime_type_get(ef_test_path_get(files[i].file));
40 if (!mime) 40 if (!mime)
41 { 41 {
42 printf("Got %s as null instead of %s\n", files[i].file, files[i].mime); 42 printf("Got %s as null instead of %s\n", files[i].file, files[i].mime);
43 misses ++; 43 misses ++;
44 } 44 }
45 else if (strcmp(mime, files[i].mime)) 45 else if (strcmp(mime, files[i].mime))
46 { 46 {
47 printf("Got %s as %s instead of %s\n", files[i].file, mime, files[i].mime); 47 printf("Got %s as %s instead of %s\n", files[i].file, mime, files[i].mime);
48 misses ++; 48 misses ++;
49 } 49 }
50 start = ecore_time_get(); 50 start = ecore_time_get();
51 icon = efreet_mime_type_icon_get(files[i].mime, THEME, SIZE); 51 icon = efreet_mime_type_icon_get(files[i].mime, THEME, SIZE);
52 printf("mime icon: %s %s %f\n", files[i].mime, icon, ecore_time_get() - start); 52 printf("mime icon: %s %s %f\n", files[i].mime, icon, ecore_time_get() - start);
53 } 53 }
54 54
55 efreet_mime_shutdown(); 55 efreet_mime_shutdown();
56 56
57 return !misses; 57 return !misses;
58} 58}
diff --git a/src/tests/efreet/ef_utils.c b/src/tests/efreet/ef_utils.c
index 0647ef0..c9ad0cd 100644
--- a/src/tests/efreet/ef_utils.c
+++ b/src/tests/efreet/ef_utils.c
@@ -4,25 +4,25 @@
4int 4int
5ef_cb_utils(void) 5ef_cb_utils(void)
6{ 6{
7 Efreet_Desktop *desktop; 7 Efreet_Desktop *desktop;
8 const char *tmp2; 8 const char *tmp2;
9 9
10 printf("\n"); 10 printf("\n");
11 11
12 tmp2 = efreet_util_path_to_file_id("/usr/share/applications/this/tmp/test.desktop"); 12 tmp2 = efreet_util_path_to_file_id("/usr/share/applications/this/tmp/test.desktop");
13 if (tmp2) printf("%s\n", tmp2); 13 if (tmp2) printf("%s\n", tmp2);
14 14
15 desktop = efreet_util_desktop_file_id_find("kde-kresources.desktop"); 15 desktop = efreet_util_desktop_file_id_find("kde-kresources.desktop");
16 printf("kde-kresources.desktop: %p\n", desktop); 16 printf("kde-kresources.desktop: %p\n", desktop);
17 efreet_desktop_free(desktop); 17 efreet_desktop_free(desktop);
18 18
19 desktop = efreet_util_desktop_file_id_find("mplayer.desktop"); 19 desktop = efreet_util_desktop_file_id_find("mplayer.desktop");
20 printf("mplayer.desktop: %p\n", desktop); 20 printf("mplayer.desktop: %p\n", desktop);
21 efreet_desktop_free(desktop); 21 efreet_desktop_free(desktop);
22 22
23 desktop = efreet_util_desktop_file_id_find("nautilus-computer.desktop"); 23 desktop = efreet_util_desktop_file_id_find("nautilus-computer.desktop");
24 printf("nautilus-computer.desktop: %p\n", desktop); 24 printf("nautilus-computer.desktop: %p\n", desktop);
25 efreet_desktop_free(desktop); 25 efreet_desktop_free(desktop);
26 26
27 return 1; 27 return 1;
28} 28}
diff --git a/src/tests/efreet/main.c b/src/tests/efreet/main.c
index 8ba4f0a..10f3575 100644
--- a/src/tests/efreet/main.c
+++ b/src/tests/efreet/main.c
@@ -40,39 +40,39 @@ int ef_mime_cb_get(void);
40typedef struct Efreet_Test Efreet_Test; 40typedef struct Efreet_Test Efreet_Test;
41struct Efreet_Test 41struct Efreet_Test
42{ 42{
43 char *name; 43 char *name;
44 int (*cb)(void); 44 int (*cb)(void);
45}; 45};
46 46
47static Efreet_Test tests[] = { 47static Efreet_Test tests[] = {
48 {"Data Home", ef_cb_efreet_data_home}, 48 {"Data Home", ef_cb_efreet_data_home},
49 {"Config Home", ef_cb_efreet_config_home}, 49 {"Config Home", ef_cb_efreet_config_home},
50 {"Cache Home", ef_cb_efreet_cache_home}, 50 {"Cache Home", ef_cb_efreet_cache_home},
51 {"Data Directories", ef_cb_efreet_data_dirs}, 51 {"Data Directories", ef_cb_efreet_data_dirs},
52 {"Config Directories", ef_cb_efreet_config_dirs}, 52 {"Config Directories", ef_cb_efreet_config_dirs},
53 {"Icon Theme Basic", ef_cb_efreet_icon_theme}, 53 {"Icon Theme Basic", ef_cb_efreet_icon_theme},
54 {"Icon Theme List", ef_cb_efreet_icon_theme_list}, 54 {"Icon Theme List", ef_cb_efreet_icon_theme_list},
55 {"Icon Matching", ef_cb_efreet_icon_match}, 55 {"Icon Matching", ef_cb_efreet_icon_match},
56 {"INI Parsing", ef_cb_ini_parse}, 56 {"INI Parsing", ef_cb_ini_parse},
57 {"INI Long Line Parsing", ef_cb_ini_long_line}, 57 {"INI Long Line Parsing", ef_cb_ini_long_line},
58 {"INI Garbage Parsing", ef_cb_ini_garbage}, 58 {"INI Garbage Parsing", ef_cb_ini_garbage},
59 {"Locale Parsing", ef_cb_locale}, 59 {"Locale Parsing", ef_cb_locale},
60 {"Desktop Parsing", ef_cb_desktop_parse}, 60 {"Desktop Parsing", ef_cb_desktop_parse},
61 {"Desktop Type Parsing", ef_cb_desktop_type_parse}, 61 {"Desktop Type Parsing", ef_cb_desktop_type_parse},
62 {"Desktop Save", ef_cb_desktop_save}, 62 {"Desktop Save", ef_cb_desktop_save},
63 {"Desktop Command", ef_cb_desktop_command_get}, 63 {"Desktop Command", ef_cb_desktop_command_get},
64#if 0 64#if 0
65 {"Desktop File ID", ef_cb_desktop_file_id}, 65 {"Desktop File ID", ef_cb_desktop_file_id},
66#endif 66#endif
67 {"Menu Parsing", ef_cb_menu_get}, 67 {"Menu Parsing", ef_cb_menu_get},
68 {"Menu Incorrect Names", ef_cb_menu_with_slashes}, 68 {"Menu Incorrect Names", ef_cb_menu_with_slashes},
69 {"Menu Save", ef_cb_menu_save}, 69 {"Menu Save", ef_cb_menu_save},
70#if 0 70#if 0
71 {"Menu Edit", ef_cb_menu_edit}, 71 {"Menu Edit", ef_cb_menu_edit},
72#endif 72#endif
73 {"Utils", ef_cb_utils}, 73 {"Utils", ef_cb_utils},
74 {"Mime", ef_mime_cb_get}, 74 {"Mime", ef_mime_cb_get},
75 { } 75 { }
76}; 76};
77 77
78extern char **environ; 78extern char **environ;
@@ -106,47 +106,45 @@ const char *ef_test_path_get(const char *component)
106int 106int
107main(int argc, char ** argv) 107main(int argc, char ** argv)
108{ 108{
109 int i, passed = 0, num_tests = 0; 109 int i, passed = 0, num_tests = 0;
110 Eina_List *run = NULL; 110 Eina_List *run = NULL;
111 double total; 111 double total;
112 112
113 eina_init(); 113 eina_init();
114 ecore_init(); 114 ecore_init();
115 115
116 total = ecore_time_get(); 116 total = ecore_time_get();
117 if (argc > 1) 117 if (argc > 1)
118 { 118 {
119 for (i = 1; i < argc; i++) 119 for (i = 1; i < argc; i++)
120 { 120 {
121 if ((!strcmp(argv[i], "-h")) || 121 if ((!strcmp(argv[i], "-h")) ||
122 (!strcmp(argv[i], "--help"))) 122 (!strcmp(argv[i], "--help")))
123 { 123 {
124 for (i = 0; tests[i].name; i++) 124 for (i = 0; tests[i].name; i++)
125 {
126 printf("%s\n", tests[i].name); 125 printf("%s\n", tests[i].name);
127 } 126 return 1;
128 return 1; 127 }
129 } 128 run = eina_list_append(run, argv[i]);
130 run = eina_list_append(run, argv[i]); 129 }
131 } 130 }
132 } 131
133 132 efreet_cache_update = 0;
134 efreet_cache_update = 0; 133 for (i = 0; tests[i].name; i++)
135 for (i = 0; tests[i].name; i++) 134 {
136 {
137 int ret; 135 int ret;
138 double start; 136 double start;
139 137
140 /* we've been given specific tests and it isn't in the list */ 138 /* we've been given specific tests and it isn't in the list */
141 if (run && !eina_list_search_unsorted(run, EINA_COMPARE_CB(strcasecmp), 139 if (run && !eina_list_search_unsorted(run, EINA_COMPARE_CB(strcasecmp),
142 tests[i].name)) 140 tests[i].name))
143 continue; 141 continue;
144 142
145 if (!efreet_init()) 143 if (!efreet_init())
146 { 144 {
147 printf("Error initializing Efreet\n"); 145 printf("Error initializing Efreet\n");
148 continue; 146 continue;
149 } 147 }
150 148
151 num_tests ++; 149 num_tests ++;
152 150
@@ -158,21 +156,21 @@ main(int argc, char ** argv)
158 ret = tests[i].cb(); 156 ret = tests[i].cb();
159 157
160 printf("%s in %.3f seconds\n", (ret ? "PASSED" : "FAILED"), 158 printf("%s in %.3f seconds\n", (ret ? "PASSED" : "FAILED"),
161 ecore_time_get() - start); 159 ecore_time_get() - start);
162 passed += ret; 160 passed += ret;
163 161
164 efreet_shutdown(); 162 efreet_shutdown();
165 } 163 }
166 164
167 printf("\n-----------------\n"); 165 printf("\n-----------------\n");
168 printf("Passed %d of %d tests.\n", passed, num_tests); 166 printf("Passed %d of %d tests.\n", passed, num_tests);
169 167
170 while (run) 168 while (run)
171 run = eina_list_remove_list(run, run); 169 run = eina_list_remove_list(run, run);
172 170
173 printf("Total run: %.3f seconds\n", ecore_time_get() - total); 171 printf("Total run: %.3f seconds\n", ecore_time_get() - total);
174 172
175 ecore_shutdown(); 173 ecore_shutdown();
176 eina_shutdown(); 174 eina_shutdown();
177 return 0; 175 return 0;
178} 176}