Merge lp:~jeremywootten/pantheon-files/enable-testing-ctest-part2 into lp:~elementary-apps/pantheon-files/trunk
- enable-testing-ctest-part2
- Merge into trunk
Proposed by
Jeremy Wootten
Status: | Merged |
---|---|
Approved by: | Cody Garver |
Approved revision: | 2444 |
Merged at revision: | 2482 |
Proposed branch: | lp:~jeremywootten/pantheon-files/enable-testing-ctest-part2 |
Merge into: | lp:~elementary-apps/pantheon-files/trunk |
Diff against target: |
1159 lines (+593/-440) 23 files modified
libcore/CMakeLists.txt (+2/-36) libcore/tests/CMakeLists.txt (+4/-0) libcore/tests/GOFDirectoryAsyncTests/CMakeLists.txt (+32/-0) libcore/tests/GOFDirectoryAsyncTests/marlincore-tests-file.c (+100/-0) libcore/tests/GOFDirectoryAsyncTests/marlincore-tests-file.h (+27/-0) libcore/tests/GOFDirectoryAsyncTests/tests.c (+33/-0) libcore/tests/GOFFileTests/CMakeLists.txt (+32/-0) libcore/tests/GOFFileTests/marlincore-tests-gof.c (+99/-0) libcore/tests/GOFFileTests/marlincore-tests-gof.h (+27/-0) libcore/tests/GOFFileTests/tests.c (+33/-0) libcore/tests/Makefile.am (+0/-20) libcore/tests/MarlinIconInfoTests/CMakeLists.txt (+32/-0) libcore/tests/MarlinIconInfoTests/marlincore-tests-icon-info.c (+65/-0) libcore/tests/MarlinIconInfoTests/marlincore-tests-icon-info.h (+28/-0) libcore/tests/MarlinIconInfoTests/tests.c (+34/-0) libcore/tests/UtilTests/CMakeLists.txt (+45/-0) libcore/tests/marlincore-tests-file.c (+0/-100) libcore/tests/marlincore-tests-file.h (+0/-27) libcore/tests/marlincore-tests-gof.c (+0/-99) libcore/tests/marlincore-tests-gof.h (+0/-27) libcore/tests/marlincore-tests-icon-info.c (+0/-65) libcore/tests/marlincore-tests-icon-info.h (+0/-28) libcore/tests/tests.c (+0/-38) |
To merge this branch: | bzr merge lp:~jeremywootten/pantheon-files/enable-testing-ctest-part2 |
Related bugs: |
Reviewer | Review Type | Date Requested | Status |
---|---|---|---|
Cody Garver (community) | Needs Information | ||
Review via email: mp+314455@code.launchpad.net |
Commit message
Restructure unit tests subdirectories
Description of the change
Reorganise /libcore/tests folder structure.
To post a comment you must log in.
- 2440. By Jeremy Wootten
-
Merge updates from parent and resolve conflicts
- 2441. By Jeremy Wootten
-
Merge changes from parent (add default icon theme method)
- 2442. By Jeremy Wootten
-
Merge trunk to r2470
- 2443. By Jeremy Wootten
-
Remove superfluous enable_testing() lines
Revision history for this message
Jeremy Wootten (jeremywootten) wrote : | # |
Cody: You are right - enable_testing () covers subdirectories so is only needed in the root directory, it seems.
Revision history for this message
Cody Garver (codygarver) wrote : | # |
Great. After resolving conflicts, this branch is ready to merge.
- 2444. By Jeremy Wootten
-
Merge trunk to r2481
Revision history for this message
Jeremy Wootten (jeremywootten) wrote : | # |
I didn't get any conflicts when I merged the trunk, but there was a warning of a criss-cross. I tried push --overwrite this time.
Preview Diff
[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1 | === modified file 'libcore/CMakeLists.txt' |
2 | --- libcore/CMakeLists.txt 2017-02-01 14:51:38 +0000 |
3 | +++ libcore/CMakeLists.txt 2017-02-08 11:12:03 +0000 |
4 | @@ -1,5 +1,3 @@ |
5 | -include (Tests) |
6 | - |
7 | set (PKGNAME pantheon-files-core) |
8 | set (PKGNAME_ PANTHEON_FILES_CORE) |
9 | set (${PKGNAME_}_VERSION 0.1) |
10 | @@ -147,37 +145,5 @@ |
11 | |
12 | install (TARGETS ${PKGNAME} DESTINATION ${CMAKE_INSTALL_LIBDIR}) |
13 | |
14 | -add_executable (pantheon-files-core_tests |
15 | - tests/tests.c |
16 | - tests/marlincore-tests-gof.c |
17 | - tests/marlincore-tests-file.c |
18 | - tests/marlincore-tests-icon-info.c) |
19 | - |
20 | -add_test (core pantheon-files-core_tests) |
21 | - |
22 | -target_link_libraries (pantheon-files-core_tests pantheon-files-core ${DEPS_LIBRARIES}) |
23 | -add_dependencies (pantheon-files-core_tests pantheon-files-core) |
24 | - |
25 | -vala_precompile (VALA_TEST_C ${PKGNAME}-vala_tests |
26 | - tests/Tests.vala |
27 | - PACKAGES |
28 | - granite |
29 | - gtk+-3.0 |
30 | - gio-2.0 |
31 | - gee-0.8 |
32 | - gmodule-2.0 |
33 | - libcanberra |
34 | - pantheon-files-core |
35 | - OPTIONS |
36 | - --thread |
37 | - --target-glib=2.32 # Needed for new thread API |
38 | -) |
39 | - |
40 | -add_executable (${PKGNAME}-vala_tests |
41 | - ${VALA_TEST_C} |
42 | -) |
43 | - |
44 | -target_link_libraries (${PKGNAME}-vala_tests pantheon-files-core ${DEPS_LIBRARIES}) |
45 | -add_dependencies (${PKGNAME}-vala_tests pantheon-files-core) |
46 | - |
47 | -add_test (core-vala-tests ${PKGNAME}-vala_tests) |
48 | +add_subdirectory (tests) |
49 | + |
50 | |
51 | === added file 'libcore/tests/CMakeLists.txt' |
52 | --- libcore/tests/CMakeLists.txt 1970-01-01 00:00:00 +0000 |
53 | +++ libcore/tests/CMakeLists.txt 2017-02-08 11:12:03 +0000 |
54 | @@ -0,0 +1,4 @@ |
55 | +add_subdirectory (UtilTests) |
56 | +add_subdirectory (MarlinIconInfoTests) |
57 | +add_subdirectory (GOFFileTests) |
58 | +add_subdirectory (GOFDirectoryAsyncTests) |
59 | |
60 | === added directory 'libcore/tests/GOFDirectoryAsyncTests' |
61 | === added file 'libcore/tests/GOFDirectoryAsyncTests/CMakeLists.txt' |
62 | --- libcore/tests/GOFDirectoryAsyncTests/CMakeLists.txt 1970-01-01 00:00:00 +0000 |
63 | +++ libcore/tests/GOFDirectoryAsyncTests/CMakeLists.txt 2017-02-08 11:12:03 +0000 |
64 | @@ -0,0 +1,32 @@ |
65 | +include_directories(${CMAKE_BINARY_DIR}) |
66 | +include_directories(${CMAKE_CURRENT_SOURCE_DIR}) |
67 | + |
68 | +set (CORE_LIB |
69 | + pantheon-files-core |
70 | +) |
71 | + |
72 | +set (CFLAGS |
73 | + ${DEPS_CFLAGS} ${DEPS_CFLAGS_OTHER} |
74 | +) |
75 | + |
76 | +set (LIB_PATHS |
77 | + ${DEPS_LIBRARY_DIRS} |
78 | +) |
79 | + |
80 | +set (TEST_NAME |
81 | + gof-directory-async_tests |
82 | +) |
83 | + |
84 | +link_directories (${LIB_PATHS}) |
85 | +add_definitions (${CFLAGS} -O2) |
86 | + |
87 | + |
88 | +add_executable (${TEST_NAME} |
89 | + tests.c |
90 | + marlincore-tests-file.c |
91 | +) |
92 | + |
93 | +target_link_libraries (${TEST_NAME} ${CORE_LIB} ${DEPS_LIBRARIES}) |
94 | +add_dependencies (${TEST_NAME} ${CORE_LIB}) |
95 | + |
96 | +add_test (core-${TEST_NAME} ${TEST_NAME}) |
97 | |
98 | === added file 'libcore/tests/GOFDirectoryAsyncTests/marlincore-tests-file.c' |
99 | --- libcore/tests/GOFDirectoryAsyncTests/marlincore-tests-file.c 1970-01-01 00:00:00 +0000 |
100 | +++ libcore/tests/GOFDirectoryAsyncTests/marlincore-tests-file.c 2017-02-08 11:12:03 +0000 |
101 | @@ -0,0 +1,100 @@ |
102 | +/* |
103 | + * Copyright (C) 2011, Lucas Baudin <xapantu@gmail.com> |
104 | + * |
105 | + * Marlin is free software; you can redistribute it and/or |
106 | + * modify it under the terms of the GNU General Public License as |
107 | + * published by the Free Software Foundation; either version 2 of the |
108 | + * License, or (at your option) any later version. |
109 | + * |
110 | + * Marlin is distributed in the hope that it will be useful, |
111 | + * but WITHOUT ANY WARRANTY; without even the implied warranty of |
112 | + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
113 | + * General Public License for more details. |
114 | + * |
115 | + * You should have received a copy of the GNU General Public License |
116 | + * along with this program; if not, write to the Free Software |
117 | + * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. |
118 | + * |
119 | + */ |
120 | + |
121 | +#include <stdlib.h> |
122 | +#include <gtk/gtk.h> |
123 | +#include <glib.h> |
124 | +#include <gio/gio.h> |
125 | +#include "marlincore-tests-file.h" |
126 | +#include "pantheon-files-core.h" |
127 | +#include "gof-file.h" |
128 | + |
129 | +GMainLoop* loop; |
130 | + |
131 | +static gboolean fatal_handler(const gchar* log_domain, |
132 | + GLogLevelFlags log_level, |
133 | + const gchar* message, |
134 | + gpointer user_data) |
135 | +{ |
136 | + return FALSE; |
137 | +} |
138 | + |
139 | +static void second_load_done(GOFDirectoryAsync* dir, gpointer data) |
140 | +{ |
141 | + g_message ("%s", G_STRFUNC); |
142 | + g_assert_cmpint(dir->file->exists, ==, TRUE); |
143 | + |
144 | + GOFDirectoryAsync *dir2 = gof_directory_async_from_file(dir->file); |
145 | + g_assert_cmpint(dir->files_count, ==, dir2->files_count); |
146 | + g_message ("files_count %u", dir->files_count); |
147 | + g_object_unref (dir2); |
148 | + |
149 | + /* some files testing inside a cached directory */ |
150 | + GOFFile *f1 = gof_file_get_by_uri ("file:///tmp/marlin-test/a"); |
151 | + g_object_unref (f1); |
152 | + |
153 | + GOFFile *f2 = gof_file_get_by_uri ("file:///tmp/marlin-test/a"); |
154 | + g_object_unref (f2); |
155 | + |
156 | + /* use a marlin function would show a dialog, FIXME */ |
157 | + system("rm -rf /tmp/marlin-test"); |
158 | + /* free previously allocated dir */ |
159 | + g_object_unref (dir); |
160 | + |
161 | + g_main_loop_quit(loop); |
162 | + |
163 | +} |
164 | + |
165 | +static void first_load_done(GOFDirectoryAsync* dir, gpointer data) |
166 | +{ |
167 | + g_message ("%s", G_STRFUNC); |
168 | + g_assert_cmpint(dir->file->exists, ==, FALSE); |
169 | + |
170 | + system("mkdir /tmp/marlin-test"); |
171 | + system("touch /tmp/marlin-test/a"); |
172 | + system("touch /tmp/marlin-test/b"); |
173 | + system("touch /tmp/marlin-test/c"); |
174 | + system("touch /tmp/marlin-test/d"); |
175 | + |
176 | + /* we use cached directories so better block this callback */ |
177 | + g_signal_handlers_block_by_func (dir, first_load_done, NULL); |
178 | + |
179 | + GOFDirectoryAsync *dir2; |
180 | + dir2 = gof_directory_async_from_file(dir->file); |
181 | + g_signal_connect(dir2, "done_loading", (GCallback) second_load_done, NULL); |
182 | + gof_directory_async_init(dir2, NULL, NULL); |
183 | + |
184 | + /* free previously allocated dir */ |
185 | + g_object_unref (dir); |
186 | +} |
187 | + |
188 | +void marlincore_tests_file(void) |
189 | +{ |
190 | + GOFDirectoryAsync* dir; |
191 | + |
192 | + g_test_log_set_fatal_handler(fatal_handler, NULL); |
193 | + system("rm -rf /tmp/marlin-test"); |
194 | + |
195 | + dir = gof_directory_async_from_gfile(g_file_new_for_path("/tmp/marlin-test")); |
196 | + g_signal_connect(dir, "done_loading", (GCallback) first_load_done, NULL); |
197 | + gof_directory_async_init(dir, NULL, NULL); |
198 | + |
199 | + loop = g_main_loop_new(NULL, FALSE); |
200 | + g_main_loop_run(loop); |
201 | +} |
202 | |
203 | === added file 'libcore/tests/GOFDirectoryAsyncTests/marlincore-tests-file.h' |
204 | --- libcore/tests/GOFDirectoryAsyncTests/marlincore-tests-file.h 1970-01-01 00:00:00 +0000 |
205 | +++ libcore/tests/GOFDirectoryAsyncTests/marlincore-tests-file.h 2017-02-08 11:12:03 +0000 |
206 | @@ -0,0 +1,27 @@ |
207 | +/* |
208 | + * Copyright (C) 2011, Lucas Baudin <xapantu@gmail.com> |
209 | + * |
210 | + * Marlin is free software; you can redistribute it and/or |
211 | + * modify it under the terms of the GNU General Public License as |
212 | + * published by the Free Software Foundation; either version 2 of the |
213 | + * License, or (at your option) any later version. |
214 | + * |
215 | + * Marlin is distributed in the hope that it will be useful, |
216 | + * but WITHOUT ANY WARRANTY; without even the implied warranty of |
217 | + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
218 | + * General Public License for more details. |
219 | + * |
220 | + * You should have received a copy of the GNU General Public License |
221 | + * along with this program; if not, write to the Free Software |
222 | + * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. |
223 | + * |
224 | + */ |
225 | + |
226 | +#ifndef _H_MARLIN_CORE_TESTS_FILE |
227 | +#define _H_MARLIN_CORE_TESTS_FILE |
228 | + |
229 | +#include "gof-file.h" |
230 | + |
231 | +void marlincore_tests_file(void); |
232 | + |
233 | +#endif |
234 | |
235 | === added file 'libcore/tests/GOFDirectoryAsyncTests/tests.c' |
236 | --- libcore/tests/GOFDirectoryAsyncTests/tests.c 1970-01-01 00:00:00 +0000 |
237 | +++ libcore/tests/GOFDirectoryAsyncTests/tests.c 2017-02-08 11:12:03 +0000 |
238 | @@ -0,0 +1,33 @@ |
239 | +/* |
240 | + * Copyright (C) 2011, Lucas Baudin <xapantu@gmail.com> |
241 | + * |
242 | + * Marlin is free software; you can redistribute it and/or |
243 | + * modify it under the terms of the GNU General Public License as |
244 | + * published by the Free Software Foundation; either version 2 of the |
245 | + * License, or (at your option) any later version. |
246 | + * |
247 | + * Marlin is distributed in the hope that it will be useful, |
248 | + * but WITHOUT ANY WARRANTY; without even the implied warranty of |
249 | + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
250 | + * General Public License for more details. |
251 | + * |
252 | + * You should have received a copy of the GNU General Public License |
253 | + * along with this program; if not, write to the Free Software |
254 | + * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. |
255 | + * |
256 | + */ |
257 | + |
258 | +#include <gio/gio.h> |
259 | +#include <gtk/gtk.h> |
260 | +#include <glib.h> |
261 | +#include "marlincore-tests-file.h" |
262 | +#include "pantheon-files-core.h" |
263 | + |
264 | +int main (int argc, char* argv[]) |
265 | +{ |
266 | + g_test_init (&argc, &argv, NULL); |
267 | + |
268 | + g_test_add_func("/marlin/file", marlincore_tests_file); |
269 | + |
270 | + return g_test_run(); |
271 | +} |
272 | |
273 | === added directory 'libcore/tests/GOFFileTests' |
274 | === added file 'libcore/tests/GOFFileTests/CMakeLists.txt' |
275 | --- libcore/tests/GOFFileTests/CMakeLists.txt 1970-01-01 00:00:00 +0000 |
276 | +++ libcore/tests/GOFFileTests/CMakeLists.txt 2017-02-08 11:12:03 +0000 |
277 | @@ -0,0 +1,32 @@ |
278 | +include_directories(${CMAKE_BINARY_DIR}) |
279 | +include_directories(${CMAKE_CURRENT_SOURCE_DIR}) |
280 | + |
281 | +set (CORE_LIB |
282 | + pantheon-files-core |
283 | +) |
284 | + |
285 | +set (CFLAGS |
286 | + ${DEPS_CFLAGS} ${DEPS_CFLAGS_OTHER} |
287 | +) |
288 | + |
289 | +set (LIB_PATHS |
290 | + ${DEPS_LIBRARY_DIRS} |
291 | +) |
292 | + |
293 | +set (TEST_NAME |
294 | + gof-file_tests |
295 | +) |
296 | + |
297 | +link_directories (${LIB_PATHS}) |
298 | +add_definitions (${CFLAGS} -O2) |
299 | + |
300 | + |
301 | +add_executable (${TEST_NAME} |
302 | + tests.c |
303 | + marlincore-tests-gof.c |
304 | +) |
305 | + |
306 | +target_link_libraries (${TEST_NAME} ${CORE_LIB} ${DEPS_LIBRARIES}) |
307 | +add_dependencies (${TEST_NAME} ${CORE_LIB}) |
308 | + |
309 | +add_test (core-${TEST_NAME} ${TEST_NAME}) |
310 | |
311 | === added file 'libcore/tests/GOFFileTests/marlincore-tests-gof.c' |
312 | --- libcore/tests/GOFFileTests/marlincore-tests-gof.c 1970-01-01 00:00:00 +0000 |
313 | +++ libcore/tests/GOFFileTests/marlincore-tests-gof.c 2017-02-08 11:12:03 +0000 |
314 | @@ -0,0 +1,99 @@ |
315 | +/* |
316 | + * Copyright (C) 2011, Lucas Baudin <xapantu@gmail.com> |
317 | + * |
318 | + * Marlin is free software; you can redistribute it and/or |
319 | + * modify it under the terms of the GNU General Public License as |
320 | + * published by the Free Software Foundation; either version 2 of the |
321 | + * License, or (at your option) any later version. |
322 | + * |
323 | + * Marlin is distributed in the hope that it will be useful, |
324 | + * but WITHOUT ANY WARRANTY; without even the implied warranty of |
325 | + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
326 | + * General Public License for more details. |
327 | + * |
328 | + * You should have received a copy of the GNU General Public License |
329 | + * along with this program; if not, write to the Free Software |
330 | + * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. |
331 | + * |
332 | + */ |
333 | + |
334 | +#include <stdlib.h> |
335 | +#include <gtk/gtk.h> |
336 | +#include <glib.h> |
337 | +#include <gio/gio.h> |
338 | +#include "marlincore-tests-gof.h" |
339 | + |
340 | + |
341 | +static gboolean fatal_handler(const gchar* log_domain, |
342 | + GLogLevelFlags log_level, |
343 | + const gchar* message, |
344 | + gpointer user_data) |
345 | +{ |
346 | + return FALSE; |
347 | +} |
348 | + |
349 | + |
350 | +void marlincore_tests_goffile(void) |
351 | +{ |
352 | + GOFFile* file; |
353 | + |
354 | + g_test_log_set_fatal_handler(fatal_handler, NULL); |
355 | + /* The URI is valid, the target exists */ |
356 | + file = gof_file_get_by_uri("file:///usr/share"); |
357 | + g_assert(file != NULL); |
358 | + gof_file_query_update (file); |
359 | + g_assert(file != NULL); |
360 | + g_assert(file->info != NULL); |
361 | + g_assert_cmpstr(g_file_info_get_name (file->info), ==, "share"); |
362 | + g_assert_cmpstr(g_file_info_get_display_name (file->info), ==, "share"); |
363 | + g_assert_cmpstr(file->basename, ==, "share"); |
364 | + g_assert_cmpint(file->is_directory, ==, TRUE); |
365 | + g_assert_cmpint(file->is_hidden, ==, FALSE); |
366 | + g_assert_cmpstr(gof_file_get_ftype (file), ==, "inode/directory"); |
367 | + g_assert_cmpint(gof_file_is_symlink(file), ==, FALSE); |
368 | + /* TODO: formated_type needs a test too, but there are some issues with |
369 | + * translations. */ |
370 | + g_assert_cmpstr(g_file_get_uri(file->location), ==, "file:///usr/share"); |
371 | + g_assert_cmpstr(gof_file_get_uri(file), ==, "file:///usr/share"); |
372 | + |
373 | + /* some allocations tests */ |
374 | + int i; |
375 | + for (i=0; i<5; i++) { |
376 | + GFile *location = g_file_new_for_path ("/usr/share"); |
377 | + file = gof_file_get(location); |
378 | + g_object_unref (location); |
379 | + } |
380 | + for (i=0; i<5; i++) |
381 | + g_object_unref (file); |
382 | + /* we got to remove the file from the cache other the next cache lookup */ |
383 | + gof_file_remove_from_caches (file); |
384 | + g_object_unref (file); |
385 | + file = gof_file_get_by_uri("file:///usr/share"); |
386 | + g_object_unref (file); |
387 | + |
388 | + |
389 | + /* The URI is valid, the target doesn't exist */ |
390 | + g_test_log_set_fatal_handler(fatal_handler, NULL); |
391 | + file = gof_file_get_by_uri("file:///tmp/very/long/path/azerty"); |
392 | + g_assert(file != NULL); |
393 | + |
394 | + system("rm /tmp/.marlin_backup /tmp/marlin_sym -f && touch /tmp/.marlin_backup"); |
395 | + /* The URI is valid, the target exists */ |
396 | + file = gof_file_get_by_uri("file:///tmp/.marlin_backup"); |
397 | + gof_file_query_update (file); |
398 | + g_assert(file != NULL); |
399 | + g_assert_cmpint(file->is_directory, ==, FALSE); |
400 | + g_assert_cmpint(file->is_hidden, ==, TRUE); /* it's a backup, so, it's hidden */ |
401 | + g_assert_cmpint(file->size, ==, 0); /* the file is empty since we just create it it */ |
402 | + |
403 | + system("ln -s /tmp/marlin_backup~ /tmp/marlin_sym "); |
404 | + |
405 | + /* a symlink */ |
406 | + file = gof_file_get_by_uri("file:///tmp/marlin_sym"); |
407 | + gof_file_query_update (file); |
408 | + g_assert(file != NULL); |
409 | + g_assert_cmpstr(gof_file_get_symlink_target(file), ==, "/tmp/marlin_backup~"); |
410 | + g_assert_cmpint(gof_file_is_symlink(file), ==, TRUE); |
411 | + g_assert_cmpint(file->is_directory, ==, FALSE); |
412 | + g_assert_cmpint(file->is_hidden, ==, FALSE); |
413 | +} |
414 | |
415 | === added file 'libcore/tests/GOFFileTests/marlincore-tests-gof.h' |
416 | --- libcore/tests/GOFFileTests/marlincore-tests-gof.h 1970-01-01 00:00:00 +0000 |
417 | +++ libcore/tests/GOFFileTests/marlincore-tests-gof.h 2017-02-08 11:12:03 +0000 |
418 | @@ -0,0 +1,27 @@ |
419 | +/* |
420 | + * Copyright (C) 2011, Lucas Baudin <xapantu@gmail.com> |
421 | + * |
422 | + * Marlin is free software; you can redistribute it and/or |
423 | + * modify it under the terms of the GNU General Public License as |
424 | + * published by the Free Software Foundation; either version 2 of the |
425 | + * License, or (at your option) any later version. |
426 | + * |
427 | + * Marlin is distributed in the hope that it will be useful, |
428 | + * but WITHOUT ANY WARRANTY; without even the implied warranty of |
429 | + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
430 | + * General Public License for more details. |
431 | + * |
432 | + * You should have received a copy of the GNU General Public License |
433 | + * along with this program; if not, write to the Free Software |
434 | + * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. |
435 | + * |
436 | + */ |
437 | + |
438 | +#ifndef _H_MARLIN_CORE_TESTS_GOF |
439 | +#define _H_MARLIN_CORE_TESTS_GOF |
440 | + |
441 | +#include "gof-file.h" |
442 | + |
443 | +void marlincore_tests_goffile(void); |
444 | + |
445 | +#endif |
446 | |
447 | === added file 'libcore/tests/GOFFileTests/tests.c' |
448 | --- libcore/tests/GOFFileTests/tests.c 1970-01-01 00:00:00 +0000 |
449 | +++ libcore/tests/GOFFileTests/tests.c 2017-02-08 11:12:03 +0000 |
450 | @@ -0,0 +1,33 @@ |
451 | +/* |
452 | + * Copyright (C) 2011, Lucas Baudin <xapantu@gmail.com> |
453 | + * |
454 | + * Marlin is free software; you can redistribute it and/or |
455 | + * modify it under the terms of the GNU General Public License as |
456 | + * published by the Free Software Foundation; either version 2 of the |
457 | + * License, or (at your option) any later version. |
458 | + * |
459 | + * Marlin is distributed in the hope that it will be useful, |
460 | + * but WITHOUT ANY WARRANTY; without even the implied warranty of |
461 | + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
462 | + * General Public License for more details. |
463 | + * |
464 | + * You should have received a copy of the GNU General Public License |
465 | + * along with this program; if not, write to the Free Software |
466 | + * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. |
467 | + * |
468 | + */ |
469 | + |
470 | +#include <gio/gio.h> |
471 | +#include <gtk/gtk.h> |
472 | +#include <glib.h> |
473 | +#include "marlincore-tests-gof.h" |
474 | +#include "pantheon-files-core.h" |
475 | + |
476 | +int main (int argc, char* argv[]) |
477 | +{ |
478 | + g_test_init (&argc, &argv, NULL); |
479 | + |
480 | + g_test_add_func("/marlin/goffile", marlincore_tests_goffile); |
481 | + |
482 | + return g_test_run(); |
483 | +} |
484 | |
485 | === removed file 'libcore/tests/Makefile.am' |
486 | --- libcore/tests/Makefile.am 2013-08-10 20:20:23 +0000 |
487 | +++ libcore/tests/Makefile.am 1970-01-01 00:00:00 +0000 |
488 | @@ -1,20 +0,0 @@ |
489 | -# GLIB - Library of useful C routines |
490 | - |
491 | -#GTESTER = gtester # for non-GLIB packages |
492 | -GTESTER = /usr/bin/gtester # for the GLIB package |
493 | -GTESTER_REPORT = /usr/bin/gtester-report # for the GLIB package |
494 | - |
495 | -check_PROGRAMS = coremarlin_tests |
496 | -coremarlin_tests_SOURCES = tests.c \ |
497 | - marlincore-tests-gof.c \ |
498 | - marlincore-tests-file.c |
499 | - |
500 | -coremarlin_tests_LDADD = \ |
501 | - $(top_srcdir)/libcore/libmarlincore.la \ |
502 | - $(top_srcdir)/libwidgets/libmarlinwidgets.la \ |
503 | - $(CORE_LIBS) \ |
504 | - $(NULL) |
505 | -coremarlin_tests_CFLAGS = $(CORE_CFLAGS) -I.. -I$(top_srcdir)/libcore |
506 | -TESTS_ENVIRONMENT= $(GTESTER) |
507 | -TESTS = coremarlin_tests |
508 | - |
509 | |
510 | === added directory 'libcore/tests/MarlinIconInfoTests' |
511 | === added file 'libcore/tests/MarlinIconInfoTests/CMakeLists.txt' |
512 | --- libcore/tests/MarlinIconInfoTests/CMakeLists.txt 1970-01-01 00:00:00 +0000 |
513 | +++ libcore/tests/MarlinIconInfoTests/CMakeLists.txt 2017-02-08 11:12:03 +0000 |
514 | @@ -0,0 +1,32 @@ |
515 | +include_directories(${CMAKE_BINARY_DIR}) |
516 | +include_directories(${CMAKE_CURRENT_SOURCE_DIR}) |
517 | + |
518 | +set (CORE_LIB |
519 | + pantheon-files-core |
520 | +) |
521 | + |
522 | +set (CFLAGS |
523 | + ${DEPS_CFLAGS} ${DEPS_CFLAGS_OTHER} |
524 | +) |
525 | + |
526 | +set (LIB_PATHS |
527 | + ${DEPS_LIBRARY_DIRS} |
528 | +) |
529 | + |
530 | +set (TEST_NAME |
531 | + marlin-icon-info_tests |
532 | +) |
533 | + |
534 | +link_directories (${LIB_PATHS}) |
535 | +add_definitions (${CFLAGS} -O2) |
536 | + |
537 | + |
538 | +add_executable (${TEST_NAME} |
539 | + tests.c |
540 | + marlincore-tests-icon-info.c |
541 | +) |
542 | + |
543 | +target_link_libraries (${TEST_NAME} ${CORE_LIB} ${DEPS_LIBRARIES}) |
544 | +add_dependencies (${TEST_NAME} ${CORE_LIB}) |
545 | + |
546 | +add_test (core-${TEST_NAME} ${TEST_NAME}) |
547 | |
548 | === added file 'libcore/tests/MarlinIconInfoTests/marlincore-tests-icon-info.c' |
549 | --- libcore/tests/MarlinIconInfoTests/marlincore-tests-icon-info.c 1970-01-01 00:00:00 +0000 |
550 | +++ libcore/tests/MarlinIconInfoTests/marlincore-tests-icon-info.c 2017-02-08 11:12:03 +0000 |
551 | @@ -0,0 +1,65 @@ |
552 | +/* |
553 | + * Copyright (C) 2012, ammonkey <am.monkeyd@gmail.com> |
554 | + * |
555 | + * Marlin is free software; you can redistribute it and/or |
556 | + * modify it under the terms of the GNU General Public License as |
557 | + * published by the Free Software Foundation; either version 2 of the |
558 | + * License, or (at your option) any later version. |
559 | + * |
560 | + * Marlin is distributed in the hope that it will be useful, |
561 | + * but WITHOUT ANY WARRANTY; without even the implied warranty of |
562 | + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
563 | + * General Public License for more details. |
564 | + * |
565 | + * You should have received a copy of the GNU General Public License |
566 | + * along with this program; if not, write to the Free Software |
567 | + * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. |
568 | + * |
569 | + */ |
570 | + |
571 | +#include <stdlib.h> |
572 | +#include <gtk/gtk.h> |
573 | +#include <glib.h> |
574 | +#include <gio/gio.h> |
575 | +#include "marlincore-tests-icon-info.h" |
576 | + |
577 | +GMainLoop* loop; |
578 | + |
579 | +static gboolean fatal_handler(const gchar* log_domain, |
580 | + GLogLevelFlags log_level, |
581 | + const gchar* message, |
582 | + gpointer user_data) |
583 | +{ |
584 | + return FALSE; |
585 | +} |
586 | + |
587 | +static gboolean |
588 | +show_infos (gpointer data) |
589 | +{ |
590 | + marlin_icon_info_infos_caches (); |
591 | + g_main_loop_quit (loop); |
592 | + |
593 | + return FALSE; |
594 | +} |
595 | + |
596 | +void marlincore_tests_icon_info (void) |
597 | +{ |
598 | + GOFFile* file; |
599 | + g_test_log_set_fatal_handler (fatal_handler, NULL); |
600 | + /* The URI is valid, the target exists */ |
601 | + file = gof_file_get_by_uri ("file:///usr/share/icons/hicolor/16x16/apps/system-file-manager.svg"); |
602 | + g_assert(file != NULL); |
603 | + gof_file_query_update (file); |
604 | + g_assert(file->pix == NULL); |
605 | + file->flags = 2; |
606 | + gof_file_update_icon (file, 128); |
607 | + g_assert(file->pix != NULL); |
608 | + gof_file_update_icon (file, 32); |
609 | + /*gof_file_update_icon (file, 16);*/ |
610 | + g_message ("pix ref count %u", G_OBJECT (file->pix)->ref_count); |
611 | + g_object_unref (file->pix); |
612 | + g_timeout_add_seconds_full (0, 2, show_infos, NULL, NULL); |
613 | + |
614 | + loop = g_main_loop_new(NULL, FALSE); |
615 | + g_main_loop_run(loop); |
616 | +} |
617 | |
618 | === added file 'libcore/tests/MarlinIconInfoTests/marlincore-tests-icon-info.h' |
619 | --- libcore/tests/MarlinIconInfoTests/marlincore-tests-icon-info.h 1970-01-01 00:00:00 +0000 |
620 | +++ libcore/tests/MarlinIconInfoTests/marlincore-tests-icon-info.h 2017-02-08 11:12:03 +0000 |
621 | @@ -0,0 +1,28 @@ |
622 | +/* |
623 | + * Copyright (C) 2012, ammonkey <am.monkeyd@gmail.com> |
624 | + * |
625 | + * Marlin is free software; you can redistribute it and/or |
626 | + * modify it under the terms of the GNU General Public License as |
627 | + * published by the Free Software Foundation; either version 2 of the |
628 | + * License, or (at your option) any later version. |
629 | + * |
630 | + * Marlin is distributed in the hope that it will be useful, |
631 | + * but WITHOUT ANY WARRANTY; without even the implied warranty of |
632 | + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
633 | + * General Public License for more details. |
634 | + * |
635 | + * You should have received a copy of the GNU General Public License |
636 | + * along with this program; if not, write to the Free Software |
637 | + * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. |
638 | + * |
639 | + */ |
640 | + |
641 | +#ifndef _H_MARLIN_CORE_TESTS_ICON_INFO |
642 | +#define _H_MARLIN_CORE_TESTS_ICON_INFO |
643 | + |
644 | +#include "gof-file.h" |
645 | +#include "marlin-icon-info.h" |
646 | + |
647 | +void marlincore_tests_icon_info (void); |
648 | + |
649 | +#endif |
650 | |
651 | === added file 'libcore/tests/MarlinIconInfoTests/tests.c' |
652 | --- libcore/tests/MarlinIconInfoTests/tests.c 1970-01-01 00:00:00 +0000 |
653 | +++ libcore/tests/MarlinIconInfoTests/tests.c 2017-02-08 11:12:03 +0000 |
654 | @@ -0,0 +1,34 @@ |
655 | +/* |
656 | + * Copyright (C) 2011, Lucas Baudin <xapantu@gmail.com> |
657 | + * |
658 | + * Marlin is free software; you can redistribute it and/or |
659 | + * modify it under the terms of the GNU General Public License as |
660 | + * published by the Free Software Foundation; either version 2 of the |
661 | + * License, or (at your option) any later version. |
662 | + * |
663 | + * Marlin is distributed in the hope that it will be useful, |
664 | + * but WITHOUT ANY WARRANTY; without even the implied warranty of |
665 | + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
666 | + * General Public License for more details. |
667 | + * |
668 | + * You should have received a copy of the GNU General Public License |
669 | + * along with this program; if not, write to the Free Software |
670 | + * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. |
671 | + * |
672 | + */ |
673 | + |
674 | +#include <gio/gio.h> |
675 | +#include <gtk/gtk.h> |
676 | +#include <glib.h> |
677 | +#include "marlincore-tests-icon-info.h" |
678 | +#include "pantheon-files-core.h" |
679 | + |
680 | +int main (int argc, char* argv[]) |
681 | +{ |
682 | + g_test_init (&argc, &argv, NULL); |
683 | + |
684 | + /* only used for local tests with local files */ |
685 | + g_test_add_func ("/marlin/icon_info", marlincore_tests_icon_info); |
686 | + |
687 | + return g_test_run(); |
688 | +} |
689 | |
690 | === added directory 'libcore/tests/UtilTests' |
691 | === added file 'libcore/tests/UtilTests/CMakeLists.txt' |
692 | --- libcore/tests/UtilTests/CMakeLists.txt 1970-01-01 00:00:00 +0000 |
693 | +++ libcore/tests/UtilTests/CMakeLists.txt 2017-02-08 11:12:03 +0000 |
694 | @@ -0,0 +1,45 @@ |
695 | +set (PKGNAME pantheon-files-core) |
696 | +set (PKGNAME_ PANTHEON_FILES_CORE) |
697 | +set (${PKGNAME_}_VERSION 0.1) |
698 | +# increase the version number if you break the API |
699 | + |
700 | +include_directories(${CMAKE_BINARY_DIR}) |
701 | +include_directories(${CMAKE_CURRENT_SOURCE_DIR}) |
702 | + |
703 | +set (CFLAGS |
704 | + ${DEPS_CFLAGS} ${DEPS_CFLAGS_OTHER} |
705 | +) |
706 | + |
707 | +set (LIB_PATHS |
708 | + ${DEPS_LIBRARY_DIRS} |
709 | +) |
710 | + |
711 | +link_directories (${LIB_PATHS}) |
712 | +add_definitions (${CFLAGS} -O2) |
713 | + |
714 | +vala_precompile (VALA_TEST_C ${PKGNAME}-vala_tests |
715 | + UtilTests.vala |
716 | + PACKAGES |
717 | + granite |
718 | + gtk+-3.0 |
719 | + gio-2.0 |
720 | + gee-0.8 |
721 | + gmodule-2.0 |
722 | + libcanberra |
723 | + pantheon-files-core |
724 | + pantheon-files-core-C |
725 | + OPTIONS |
726 | + --vapidir=${CMAKE_CURRENT_SOURCE_DIR}/ |
727 | + --thread |
728 | + --target-glib=2.32 # Needed for new thread API |
729 | +) |
730 | + |
731 | +add_executable (${PKGNAME}-vala_tests |
732 | + ${VALA_TEST_C} |
733 | +) |
734 | + |
735 | +target_link_libraries (${PKGNAME}-vala_tests pantheon-files-core ${DEPS_LIBRARIES}) |
736 | +add_dependencies (${PKGNAME}-vala_tests pantheon-files-core) |
737 | + |
738 | +add_test (core-vala-tests ${PKGNAME}-vala_tests) |
739 | + |
740 | |
741 | === renamed file 'libcore/tests/Tests.vala' => 'libcore/tests/UtilTests/UtilTests.vala' |
742 | === removed file 'libcore/tests/marlincore-tests-file.c' |
743 | --- libcore/tests/marlincore-tests-file.c 2017-01-05 19:16:00 +0000 |
744 | +++ libcore/tests/marlincore-tests-file.c 1970-01-01 00:00:00 +0000 |
745 | @@ -1,100 +0,0 @@ |
746 | -/* |
747 | - * Copyright (C) 2011, Lucas Baudin <xapantu@gmail.com> |
748 | - * |
749 | - * Marlin is free software; you can redistribute it and/or |
750 | - * modify it under the terms of the GNU General Public License as |
751 | - * published by the Free Software Foundation; either version 2 of the |
752 | - * License, or (at your option) any later version. |
753 | - * |
754 | - * Marlin is distributed in the hope that it will be useful, |
755 | - * but WITHOUT ANY WARRANTY; without even the implied warranty of |
756 | - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
757 | - * General Public License for more details. |
758 | - * |
759 | - * You should have received a copy of the GNU General Public License |
760 | - * along with this program; if not, write to the Free Software |
761 | - * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. |
762 | - * |
763 | - */ |
764 | - |
765 | -#include <stdlib.h> |
766 | -#include <gtk/gtk.h> |
767 | -#include <glib.h> |
768 | -#include <gio/gio.h> |
769 | -#include "marlincore-tests-file.h" |
770 | -#include "pantheon-files-core.h" |
771 | -#include "gof-file.h" |
772 | - |
773 | -GMainLoop* loop; |
774 | - |
775 | -static gboolean fatal_handler(const gchar* log_domain, |
776 | - GLogLevelFlags log_level, |
777 | - const gchar* message, |
778 | - gpointer user_data) |
779 | -{ |
780 | - return FALSE; |
781 | -} |
782 | - |
783 | -static void second_load_done(GOFDirectoryAsync* dir, gpointer data) |
784 | -{ |
785 | - g_message ("%s", G_STRFUNC); |
786 | - g_assert_cmpint(dir->file->exists, ==, TRUE); |
787 | - |
788 | - GOFDirectoryAsync *dir2 = gof_directory_async_from_file(dir->file); |
789 | - g_assert_cmpint(dir->files_count, ==, dir2->files_count); |
790 | - g_message ("files_count %u", dir->files_count); |
791 | - g_object_unref (dir2); |
792 | - |
793 | - /* some files testing inside a cached directory */ |
794 | - GOFFile *f1 = gof_file_get_by_uri ("file:///tmp/marlin-test/a"); |
795 | - g_object_unref (f1); |
796 | - |
797 | - GOFFile *f2 = gof_file_get_by_uri ("file:///tmp/marlin-test/a"); |
798 | - g_object_unref (f2); |
799 | - |
800 | - /* use a marlin function would show a dialog, FIXME */ |
801 | - system("rm -rf /tmp/marlin-test"); |
802 | - /* free previously allocated dir */ |
803 | - g_object_unref (dir); |
804 | - |
805 | - g_main_loop_quit(loop); |
806 | - |
807 | -} |
808 | - |
809 | -static void first_load_done(GOFDirectoryAsync* dir, gpointer data) |
810 | -{ |
811 | - g_message ("%s", G_STRFUNC); |
812 | - g_assert_cmpint(dir->file->exists, ==, FALSE); |
813 | - |
814 | - system("mkdir /tmp/marlin-test"); |
815 | - system("touch /tmp/marlin-test/a"); |
816 | - system("touch /tmp/marlin-test/b"); |
817 | - system("touch /tmp/marlin-test/c"); |
818 | - system("touch /tmp/marlin-test/d"); |
819 | - |
820 | - /* we use cached directories so better block this callback */ |
821 | - g_signal_handlers_block_by_func (dir, first_load_done, NULL); |
822 | - |
823 | - GOFDirectoryAsync *dir2; |
824 | - dir2 = gof_directory_async_from_file(dir->file); |
825 | - g_signal_connect(dir2, "done_loading", (GCallback) second_load_done, NULL); |
826 | - gof_directory_async_init(dir2, NULL, NULL); |
827 | - |
828 | - /* free previously allocated dir */ |
829 | - g_object_unref (dir); |
830 | -} |
831 | - |
832 | -void marlincore_tests_file(void) |
833 | -{ |
834 | - GOFDirectoryAsync* dir; |
835 | - |
836 | - g_test_log_set_fatal_handler(fatal_handler, NULL); |
837 | - system("rm -rf /tmp/marlin-test"); |
838 | - |
839 | - dir = gof_directory_async_from_gfile(g_file_new_for_path("/tmp/marlin-test")); |
840 | - g_signal_connect(dir, "done_loading", (GCallback) first_load_done, NULL); |
841 | - gof_directory_async_init(dir, NULL, NULL); |
842 | - |
843 | - loop = g_main_loop_new(NULL, FALSE); |
844 | - g_main_loop_run(loop); |
845 | -} |
846 | |
847 | === removed file 'libcore/tests/marlincore-tests-file.h' |
848 | --- libcore/tests/marlincore-tests-file.h 2011-05-12 19:41:47 +0000 |
849 | +++ libcore/tests/marlincore-tests-file.h 1970-01-01 00:00:00 +0000 |
850 | @@ -1,27 +0,0 @@ |
851 | -/* |
852 | - * Copyright (C) 2011, Lucas Baudin <xapantu@gmail.com> |
853 | - * |
854 | - * Marlin is free software; you can redistribute it and/or |
855 | - * modify it under the terms of the GNU General Public License as |
856 | - * published by the Free Software Foundation; either version 2 of the |
857 | - * License, or (at your option) any later version. |
858 | - * |
859 | - * Marlin is distributed in the hope that it will be useful, |
860 | - * but WITHOUT ANY WARRANTY; without even the implied warranty of |
861 | - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
862 | - * General Public License for more details. |
863 | - * |
864 | - * You should have received a copy of the GNU General Public License |
865 | - * along with this program; if not, write to the Free Software |
866 | - * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. |
867 | - * |
868 | - */ |
869 | - |
870 | -#ifndef _H_MARLIN_CORE_TESTS_FILE |
871 | -#define _H_MARLIN_CORE_TESTS_FILE |
872 | - |
873 | -#include "gof-file.h" |
874 | - |
875 | -void marlincore_tests_file(void); |
876 | - |
877 | -#endif |
878 | |
879 | === removed file 'libcore/tests/marlincore-tests-gof.c' |
880 | --- libcore/tests/marlincore-tests-gof.c 2017-01-05 19:16:00 +0000 |
881 | +++ libcore/tests/marlincore-tests-gof.c 1970-01-01 00:00:00 +0000 |
882 | @@ -1,99 +0,0 @@ |
883 | -/* |
884 | - * Copyright (C) 2011, Lucas Baudin <xapantu@gmail.com> |
885 | - * |
886 | - * Marlin is free software; you can redistribute it and/or |
887 | - * modify it under the terms of the GNU General Public License as |
888 | - * published by the Free Software Foundation; either version 2 of the |
889 | - * License, or (at your option) any later version. |
890 | - * |
891 | - * Marlin is distributed in the hope that it will be useful, |
892 | - * but WITHOUT ANY WARRANTY; without even the implied warranty of |
893 | - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
894 | - * General Public License for more details. |
895 | - * |
896 | - * You should have received a copy of the GNU General Public License |
897 | - * along with this program; if not, write to the Free Software |
898 | - * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. |
899 | - * |
900 | - */ |
901 | - |
902 | -#include <stdlib.h> |
903 | -#include <gtk/gtk.h> |
904 | -#include <glib.h> |
905 | -#include <gio/gio.h> |
906 | -#include "marlincore-tests-gof.h" |
907 | - |
908 | - |
909 | -static gboolean fatal_handler(const gchar* log_domain, |
910 | - GLogLevelFlags log_level, |
911 | - const gchar* message, |
912 | - gpointer user_data) |
913 | -{ |
914 | - return FALSE; |
915 | -} |
916 | - |
917 | - |
918 | -void marlincore_tests_goffile(void) |
919 | -{ |
920 | - GOFFile* file; |
921 | - |
922 | - g_test_log_set_fatal_handler(fatal_handler, NULL); |
923 | - /* The URI is valid, the target exists */ |
924 | - file = gof_file_get_by_uri("file:///usr/share"); |
925 | - g_assert(file != NULL); |
926 | - gof_file_query_update (file); |
927 | - g_assert(file != NULL); |
928 | - g_assert(file->info != NULL); |
929 | - g_assert_cmpstr(g_file_info_get_name (file->info), ==, "share"); |
930 | - g_assert_cmpstr(g_file_info_get_display_name (file->info), ==, "share"); |
931 | - g_assert_cmpstr(file->basename, ==, "share"); |
932 | - g_assert_cmpint(file->is_directory, ==, TRUE); |
933 | - g_assert_cmpint(file->is_hidden, ==, FALSE); |
934 | - g_assert_cmpstr(gof_file_get_ftype (file), ==, "inode/directory"); |
935 | - g_assert_cmpint(gof_file_is_symlink(file), ==, FALSE); |
936 | - /* TODO: formated_type needs a test too, but there are some issues with |
937 | - * translations. */ |
938 | - g_assert_cmpstr(g_file_get_uri(file->location), ==, "file:///usr/share"); |
939 | - g_assert_cmpstr(gof_file_get_uri(file), ==, "file:///usr/share"); |
940 | - |
941 | - /* some allocations tests */ |
942 | - int i; |
943 | - for (i=0; i<5; i++) { |
944 | - GFile *location = g_file_new_for_path ("/usr/share"); |
945 | - file = gof_file_get(location); |
946 | - g_object_unref (location); |
947 | - } |
948 | - for (i=0; i<5; i++) |
949 | - g_object_unref (file); |
950 | - /* we got to remove the file from the cache other the next cache lookup */ |
951 | - gof_file_remove_from_caches (file); |
952 | - g_object_unref (file); |
953 | - file = gof_file_get_by_uri("file:///usr/share"); |
954 | - g_object_unref (file); |
955 | - |
956 | - |
957 | - /* The URI is valid, the target doesn't exist */ |
958 | - g_test_log_set_fatal_handler(fatal_handler, NULL); |
959 | - file = gof_file_get_by_uri("file:///tmp/very/long/path/azerty"); |
960 | - g_assert(file != NULL); |
961 | - |
962 | - system("rm /tmp/.marlin_backup /tmp/marlin_sym -f && touch /tmp/.marlin_backup"); |
963 | - /* The URI is valid, the target exists */ |
964 | - file = gof_file_get_by_uri("file:///tmp/.marlin_backup"); |
965 | - gof_file_query_update (file); |
966 | - g_assert(file != NULL); |
967 | - g_assert_cmpint(file->is_directory, ==, FALSE); |
968 | - g_assert_cmpint(file->is_hidden, ==, TRUE); /* it's a backup, so, it's hidden */ |
969 | - g_assert_cmpint(file->size, ==, 0); /* the file is empty since we just create it it */ |
970 | - |
971 | - system("ln -s /tmp/marlin_backup~ /tmp/marlin_sym "); |
972 | - |
973 | - /* a symlink */ |
974 | - file = gof_file_get_by_uri("file:///tmp/marlin_sym"); |
975 | - gof_file_query_update (file); |
976 | - g_assert(file != NULL); |
977 | - g_assert_cmpstr(gof_file_get_symlink_target(file), ==, "/tmp/marlin_backup~"); |
978 | - g_assert_cmpint(gof_file_is_symlink(file), ==, TRUE); |
979 | - g_assert_cmpint(file->is_directory, ==, FALSE); |
980 | - g_assert_cmpint(file->is_hidden, ==, FALSE); |
981 | -} |
982 | |
983 | === removed file 'libcore/tests/marlincore-tests-gof.h' |
984 | --- libcore/tests/marlincore-tests-gof.h 2011-05-10 07:52:36 +0000 |
985 | +++ libcore/tests/marlincore-tests-gof.h 1970-01-01 00:00:00 +0000 |
986 | @@ -1,27 +0,0 @@ |
987 | -/* |
988 | - * Copyright (C) 2011, Lucas Baudin <xapantu@gmail.com> |
989 | - * |
990 | - * Marlin is free software; you can redistribute it and/or |
991 | - * modify it under the terms of the GNU General Public License as |
992 | - * published by the Free Software Foundation; either version 2 of the |
993 | - * License, or (at your option) any later version. |
994 | - * |
995 | - * Marlin is distributed in the hope that it will be useful, |
996 | - * but WITHOUT ANY WARRANTY; without even the implied warranty of |
997 | - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
998 | - * General Public License for more details. |
999 | - * |
1000 | - * You should have received a copy of the GNU General Public License |
1001 | - * along with this program; if not, write to the Free Software |
1002 | - * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. |
1003 | - * |
1004 | - */ |
1005 | - |
1006 | -#ifndef _H_MARLIN_CORE_TESTS_GOF |
1007 | -#define _H_MARLIN_CORE_TESTS_GOF |
1008 | - |
1009 | -#include "gof-file.h" |
1010 | - |
1011 | -void marlincore_tests_goffile(void); |
1012 | - |
1013 | -#endif |
1014 | |
1015 | === removed file 'libcore/tests/marlincore-tests-icon-info.c' |
1016 | --- libcore/tests/marlincore-tests-icon-info.c 2017-02-01 17:03:01 +0000 |
1017 | +++ libcore/tests/marlincore-tests-icon-info.c 1970-01-01 00:00:00 +0000 |
1018 | @@ -1,65 +0,0 @@ |
1019 | -/* |
1020 | - * Copyright (C) 2012, ammonkey <am.monkeyd@gmail.com> |
1021 | - * |
1022 | - * Marlin is free software; you can redistribute it and/or |
1023 | - * modify it under the terms of the GNU General Public License as |
1024 | - * published by the Free Software Foundation; either version 2 of the |
1025 | - * License, or (at your option) any later version. |
1026 | - * |
1027 | - * Marlin is distributed in the hope that it will be useful, |
1028 | - * but WITHOUT ANY WARRANTY; without even the implied warranty of |
1029 | - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
1030 | - * General Public License for more details. |
1031 | - * |
1032 | - * You should have received a copy of the GNU General Public License |
1033 | - * along with this program; if not, write to the Free Software |
1034 | - * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. |
1035 | - * |
1036 | - */ |
1037 | - |
1038 | -#include <stdlib.h> |
1039 | -#include <gtk/gtk.h> |
1040 | -#include <glib.h> |
1041 | -#include <gio/gio.h> |
1042 | -#include "marlincore-tests-icon-info.h" |
1043 | - |
1044 | -GMainLoop* loop; |
1045 | - |
1046 | -static gboolean fatal_handler(const gchar* log_domain, |
1047 | - GLogLevelFlags log_level, |
1048 | - const gchar* message, |
1049 | - gpointer user_data) |
1050 | -{ |
1051 | - return FALSE; |
1052 | -} |
1053 | - |
1054 | -static gboolean |
1055 | -show_infos (gpointer data) |
1056 | -{ |
1057 | - marlin_icon_info_infos_caches (); |
1058 | - g_main_loop_quit (loop); |
1059 | - |
1060 | - return FALSE; |
1061 | -} |
1062 | - |
1063 | -void marlincore_tests_icon_info (void) |
1064 | -{ |
1065 | - GOFFile* file; |
1066 | - g_test_log_set_fatal_handler (fatal_handler, NULL); |
1067 | - /* The URI is valid, the target exists */ |
1068 | - file = gof_file_get_by_uri ("file:///usr/share/icons/hicolor/16x16/apps/system-file-manager.svg"); |
1069 | - g_assert(file != NULL); |
1070 | - gof_file_query_update (file); |
1071 | - g_assert(file->pix == NULL); |
1072 | - file->flags = 2; |
1073 | - gof_file_update_icon (file, 128); |
1074 | - g_assert(file->pix != NULL); |
1075 | - gof_file_update_icon (file, 32); |
1076 | - /*gof_file_update_icon (file, 16);*/ |
1077 | - g_message ("pix ref count %u", G_OBJECT (file->pix)->ref_count); |
1078 | - g_object_unref (file->pix); |
1079 | - g_timeout_add_seconds_full (0, 2, show_infos, NULL, NULL); |
1080 | - |
1081 | - loop = g_main_loop_new(NULL, FALSE); |
1082 | - g_main_loop_run(loop); |
1083 | -} |
1084 | |
1085 | === removed file 'libcore/tests/marlincore-tests-icon-info.h' |
1086 | --- libcore/tests/marlincore-tests-icon-info.h 2012-01-14 22:01:23 +0000 |
1087 | +++ libcore/tests/marlincore-tests-icon-info.h 1970-01-01 00:00:00 +0000 |
1088 | @@ -1,28 +0,0 @@ |
1089 | -/* |
1090 | - * Copyright (C) 2012, ammonkey <am.monkeyd@gmail.com> |
1091 | - * |
1092 | - * Marlin is free software; you can redistribute it and/or |
1093 | - * modify it under the terms of the GNU General Public License as |
1094 | - * published by the Free Software Foundation; either version 2 of the |
1095 | - * License, or (at your option) any later version. |
1096 | - * |
1097 | - * Marlin is distributed in the hope that it will be useful, |
1098 | - * but WITHOUT ANY WARRANTY; without even the implied warranty of |
1099 | - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
1100 | - * General Public License for more details. |
1101 | - * |
1102 | - * You should have received a copy of the GNU General Public License |
1103 | - * along with this program; if not, write to the Free Software |
1104 | - * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. |
1105 | - * |
1106 | - */ |
1107 | - |
1108 | -#ifndef _H_MARLIN_CORE_TESTS_ICON_INFO |
1109 | -#define _H_MARLIN_CORE_TESTS_ICON_INFO |
1110 | - |
1111 | -#include "gof-file.h" |
1112 | -#include "marlin-icon-info.h" |
1113 | - |
1114 | -void marlincore_tests_icon_info (void); |
1115 | - |
1116 | -#endif |
1117 | |
1118 | === removed file 'libcore/tests/tests.c' |
1119 | --- libcore/tests/tests.c 2017-02-01 17:03:01 +0000 |
1120 | +++ libcore/tests/tests.c 1970-01-01 00:00:00 +0000 |
1121 | @@ -1,38 +0,0 @@ |
1122 | -/* |
1123 | - * Copyright (C) 2011, Lucas Baudin <xapantu@gmail.com> |
1124 | - * |
1125 | - * Marlin is free software; you can redistribute it and/or |
1126 | - * modify it under the terms of the GNU General Public License as |
1127 | - * published by the Free Software Foundation; either version 2 of the |
1128 | - * License, or (at your option) any later version. |
1129 | - * |
1130 | - * Marlin is distributed in the hope that it will be useful, |
1131 | - * but WITHOUT ANY WARRANTY; without even the implied warranty of |
1132 | - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
1133 | - * General Public License for more details. |
1134 | - * |
1135 | - * You should have received a copy of the GNU General Public License |
1136 | - * along with this program; if not, write to the Free Software |
1137 | - * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. |
1138 | - * |
1139 | - */ |
1140 | - |
1141 | -#include <gio/gio.h> |
1142 | -#include <gtk/gtk.h> |
1143 | -#include <glib.h> |
1144 | -#include "marlincore-tests-gof.h" |
1145 | -#include "marlincore-tests-file.h" |
1146 | -#include "marlincore-tests-icon-info.h" |
1147 | -#include "pantheon-files-core.h" |
1148 | - |
1149 | -int main (int argc, char* argv[]) |
1150 | -{ |
1151 | - g_test_init (&argc, &argv, NULL); |
1152 | - |
1153 | - g_test_add_func("/marlin/file", marlincore_tests_file); |
1154 | - g_test_add_func("/marlin/goffile", marlincore_tests_goffile); |
1155 | - /* only used for local tests with local files */ |
1156 | - g_test_add_func ("/marlin/icon_info", marlincore_tests_icon_info); |
1157 | - |
1158 | - return g_test_run(); |
1159 | -} |
I'm concerned that `enable_testing ()` appears 6 times in this diff, are you certain it's needed more than once?