29#include <glib/gstdio.h>
36#define test_dup2(fd, fd2) (_dup2((fd), (fd2)) == 0 ? (fd2) : -1)
37#define test_close _close
42#define test_close close
46 gchar *img_path_to_db,
size_t pathname_len, GList **discarded);
57 {
"capture.raw",
"raw",
"capture|capture|raw",
"capture.jpg" },
58 {
".profile.jpg",
"jpg",
".profile|.profile|jpg",
".profile.jpg" },
59 {
"/a.b/capture", NULL,
"capture|capture|", NULL },
60 {
"C:\\a.b\\capture", NULL,
"capture|capture|", NULL },
61 {
".profile", NULL,
".profile|.profile|", NULL },
62 {
"capture.", NULL,
"capture.|capture.|", NULL },
63 {
"capture", NULL,
"capture|capture|", NULL },
64 {
"", NULL,
"||", NULL },
65 {
"/", NULL,
"||", NULL },
66 {
"\\", NULL,
"||", NULL },
87 g_hash_table_insert(completion->
sources, g_strdup(source), GINT_TO_POINTER(success));
106 g_hash_table_destroy(completion->
sources);
111 GDir *
directory = g_dir_open(path, 0, NULL);
118 const char *
name = NULL;
121 char *child = g_build_filename(path,
name, NULL);
140 gchar *actual = NULL;
141 gsize actual_size = 0;
142 assert_true(g_file_get_contents(path, &actual, &actual_size, NULL));
143 assert_int_equal(actual_size, expected_size);
144 assert_int_equal(memcmp(actual, expected, expected_size), 0);
149 const gsize second_size)
151 assert_true(first_size != second_size || memcmp(first, second, first_size) != 0);
157 assert_int_equal(completion->
succeeded, expected_successes);
158 assert_int_equal(g_hash_table_size(completion->
sources), completion->
expected);
167 data.datetime = g_date_time_new_now_local();
169 data.on_conflict = policy;
170 data.base_folder = g_strdup(destination);
171 data.target_subfolder_pattern = g_strdup(
"");
172 data.target_file_pattern = g_strdup(pattern);
174 data.callback_data = completion;
181 char *root = g_dir_make_tmp(
"ansel-import-siblings-XXXXXX", NULL);
182 char *source = g_build_filename(root,
"source", NULL);
183 char *destination = g_build_filename(root,
"destination", NULL);
184 assert_int_equal(g_mkdir(source, 0700), 0);
185 char *jpg =
_make_jpeg(source,
"capture.jpg", 20);
186 char *jpeg =
_make_jpeg(source,
"capture.jpeg", 21);
187 gchar *jpg_bytes = NULL;
188 gchar *jpeg_bytes = NULL;
191 assert_true(g_file_get_contents(jpg, &jpg_bytes, &jpg_size, NULL));
192 assert_true(g_file_get_contents(jpeg, &jpeg_bytes, &jpeg_size, NULL));
199 GList *sources = g_list_append(g_list_append(NULL, jpg), jpeg);
201 "$(FILE.NAME)_$(FILE.EXTENSION)_$(SEQUENCE).jpg",
204 char *first = g_build_filename(destination,
"capture_jpg_0001.jpg", NULL);
205 char *second = g_build_filename(destination,
"capture_jpeg_0001.jpg", NULL);
206 assert_true(g_file_test(first, G_FILE_TEST_IS_REGULAR));
207 assert_true(g_file_test(second, G_FILE_TEST_IS_REGULAR));
221 char *root = g_dir_make_tmp(
"ansel-import-in-place-XXXXXX", NULL);
222 assert_non_null(root);
223 char *source =
_make_jpeg(root,
"capture.jpg", 25);
224 char *source_path = g_strdup(source);
225 char *unused_destination = g_build_filename(root,
"unused", NULL);
234 assert_true(g_file_test(source_path, G_FILE_TEST_IS_REGULAR));
236 assert_false(g_file_test(unused_destination, G_FILE_TEST_EXISTS));
246 char *root = g_dir_make_tmp(
"ansel-import-delete-XXXXXX", NULL);
247 assert_non_null(root);
248 char *destination = g_build_filename(root,
"destination", NULL);
249 char *source =
_make_jpeg(root,
"first.jpg", 35);
250 char *source_path = g_strdup(source);
253 assert_true(g_file_get_contents(source, &bytes, &
size, NULL));
261 assert_false(g_file_test(source_path, G_FILE_TEST_EXISTS));
262 char *copied = g_build_filename(destination,
"fixed.jpg", NULL);
268 source_path = g_strdup(source);
276 assert_true(g_file_test(source_path, G_FILE_TEST_IS_REGULAR));
289 char *
directory = g_dir_make_tmp(
"ansel-stream-compare-XXXXXX", NULL);
291 char *first_path = g_build_filename(
directory,
"first", NULL);
292 char *second_path = g_build_filename(
directory,
"second", NULL);
293 const size_t sizes[] = { 0, 1, 65535, 65536, 65537, 131073 };
294 unsigned char *bytes = g_malloc0(sizes[G_N_ELEMENTS(sizes) - 1]);
295 gboolean streams_opened =
TRUE;
297 while(
i < G_N_ELEMENTS(sizes) && streams_opened)
299 assert_true(g_file_set_contents(first_path, (
const char *)bytes, sizes[
i], NULL));
300 assert_true(g_file_set_contents(second_path, (
const char *)bytes, sizes[
i], NULL));
301 FILE *first = g_fopen(first_path,
"rb");
302 FILE *second = g_fopen(second_path,
"r+b");
314 assert_int_equal(fseek(second, -1, SEEK_END), 0);
315 assert_int_equal(fputc(1, second), 1);
319 assert_int_equal(fseek(second, -1, SEEK_END), 0);
320 assert_int_equal(fputc(0, second), 0);
322 assert_int_equal(fseek(second, 0, SEEK_END), 0);
323 assert_int_equal(fputc(2, second), 2);
328 second = g_fopen(second_path,
"wb");
338 assert_int_equal(equal, 1);
339 assert_int_equal(mismatch, 0);
340 assert_int_equal(longer, 0);
341 if(streams_opened) assert_int_equal(read_error, -1);
346 g_remove(first_path);
347 g_remove(second_path);
352 assert_true(streams_opened);
357 char *root = g_dir_make_tmp(
"ansel-import-fallback-XXXXXX", NULL);
358 char *source = g_build_filename(root,
"source", NULL);
359 char *destination = g_build_filename(root,
"destination", NULL);
360 assert_int_equal(g_mkdir(source, 0700), 0);
361 char *jpg =
_make_jpeg(source,
"capture.jpg", 30);
362 char *jpeg =
_make_jpeg(source,
"capture.jpeg", 31);
363 gchar *first_bytes = NULL;
364 gchar *fallback_bytes = NULL;
365 gsize first_size = 0;
366 gsize fallback_size = 0;
367 assert_true(g_file_get_contents(jpg, &first_bytes, &first_size, NULL));
368 assert_true(g_file_get_contents(jpeg, &fallback_bytes, &fallback_size, NULL));
373 GList *sources = g_list_append(g_list_append(NULL, jpg), jpeg);
377 char *first = g_build_filename(destination,
"capture_0001.jpg", NULL);
378 char *fallback = g_build_filename(destination,
"capture_0002.jpg", NULL);
379 assert_true(g_file_test(first, G_FILE_TEST_IS_REGULAR));
380 assert_true(g_file_test(fallback, G_FILE_TEST_IS_REGULAR));
400 for(
size_t policy = 0; policy < G_N_ELEMENTS(policies); policy++)
402 char *root = g_dir_make_tmp(
"ansel-import-fixed-XXXXXX", NULL);
403 char *source = g_build_filename(root,
"source", NULL);
404 char *destination = g_build_filename(root,
"destination", NULL);
405 assert_int_equal(g_mkdir(source, 0700), 0);
406 char *jpg =
_make_jpeg(source,
"capture.jpg", 40);
407 char *jpeg =
_make_jpeg(source,
"capture.jpeg", 41);
408 gchar *first_bytes = NULL;
409 gchar *second_bytes = NULL;
410 gsize first_size = 0;
411 gsize second_size = 0;
412 assert_true(g_file_get_contents(jpg, &first_bytes, &first_size, NULL));
413 assert_true(g_file_get_contents(jpeg, &second_bytes, &second_size, NULL));
417 GList *sources = g_list_append(g_list_append(NULL, jpg), jpeg);
421 char *fixed = g_build_filename(destination,
"fixed.jpg", NULL);
422 char *unique = g_build_filename(destination,
"fixed_01.jpg", NULL);
423 assert_true(g_file_test(fixed, G_FILE_TEST_IS_REGULAR));
449 for(
size_t policy = 0; policy < G_N_ELEMENTS(policies); policy++)
451 char *root = g_dir_make_tmp(
"ansel-import-unrelated-XXXXXX", NULL);
452 char *source = g_build_filename(root,
"source", NULL);
453 char *destination = g_build_filename(root,
"destination", NULL);
454 assert_int_equal(g_mkdir(source, 0700), 0);
455 char *first_source =
_make_jpeg(source,
"first.jpg", 50);
456 char *second_source =
_make_jpeg(source,
"second.jpg", 60);
457 gchar *first_bytes = NULL;
458 gchar *second_bytes = NULL;
459 gsize first_size = 0;
460 gsize second_size = 0;
461 assert_true(g_file_get_contents(first_source, &first_bytes, &first_size, NULL));
462 assert_true(g_file_get_contents(second_source, &second_bytes, &second_size, NULL));
466 GList *sources = g_list_append(g_list_append(NULL, first_source), second_source);
470 char *fixed = g_build_filename(destination,
"fixed.jpg", NULL);
471 char *fallback = g_build_filename(destination,
"fixed_2.jpg", NULL);
472 char *unique = g_build_filename(destination,
"fixed_01.jpg", NULL);
473 assert_true(g_file_test(fixed, G_FILE_TEST_IS_REGULAR));
474 assert_false(g_file_test(fallback, G_FILE_TEST_EXISTS));
479 assert_true(g_file_test(unique, G_FILE_TEST_IS_REGULAR));
497 char *root = g_dir_make_tmp(
"ansel-import-failures-XXXXXX", NULL);
498 char *source = g_build_filename(root,
"source", NULL);
499 char *destination = g_build_filename(root,
"destination", NULL);
500 assert_int_equal(g_mkdir(source, 0700), 0);
501 char *
missing = g_build_filename(source,
"missing.jpg", NULL);
502 char *invalid = g_build_filename(source,
"invalid.dt", NULL);
503 char *valid =
_make_jpeg(source,
"valid.jpg", 70);
504 char *missing_key = g_strdup(
missing);
505 char *invalid_key = g_strdup(invalid);
506 char *valid_key = g_strdup(valid);
507 assert_true(g_file_set_contents(invalid,
"not a jpeg", -1, NULL));
510 GList *sources = g_list_append(g_list_append(g_list_append(NULL,
missing), invalid), valid);
514 assert_false(GPOINTER_TO_INT(g_hash_table_lookup(completion.
sources, missing_key)));
515 assert_false(GPOINTER_TO_INT(g_hash_table_lookup(completion.
sources, invalid_key)));
516 assert_true(GPOINTER_TO_INT(g_hash_table_lookup(completion.
sources, valid_key)));
517 char *missing_destination = g_build_filename(destination,
"missing_0001.jpg", NULL);
518 char *invalid_destination = g_build_filename(destination,
"invalid_0002.dt", NULL);
519 char *valid_destination = g_build_filename(destination,
"valid_0003.jpg", NULL);
520 assert_false(g_file_test(missing_destination, G_FILE_TEST_EXISTS));
521 assert_true(g_file_test(invalid_destination, G_FILE_TEST_IS_REGULAR));
522 assert_true(g_file_test(valid_destination, G_FILE_TEST_IS_REGULAR));
540 char *root = g_dir_make_tmp(
"ansel-import-copy-reservation-XXXXXX", NULL);
541 char *source = g_build_filename(root,
"source", NULL);
542 char *destination = g_build_filename(root,
"destination", NULL);
543 assert_int_equal(g_mkdir(source, 0700), 0);
544 char *
missing = g_build_filename(source,
"capture.jpg", NULL);
545 char *sibling =
_make_jpeg(source,
"capture.jpeg", 80);
546 char *missing_key = g_strdup(
missing);
547 char *sibling_key = g_strdup(sibling);
550 GList *sources = g_list_append(g_list_append(NULL,
missing), sibling);
554 assert_false(GPOINTER_TO_INT(g_hash_table_lookup(completion.
sources, missing_key)));
555 assert_true(GPOINTER_TO_INT(g_hash_table_lookup(completion.
sources, sibling_key)));
556 char *failed = g_build_filename(destination,
"capture_0001.jpg", NULL);
557 char *fallback = g_build_filename(destination,
"capture_0002.jpg", NULL);
558 assert_false(g_file_test(failed, G_FILE_TEST_EXISTS));
559 assert_true(g_file_test(fallback, G_FILE_TEST_IS_REGULAR));
574 char *root = g_dir_make_tmp(
"ansel-import-db-reservation-XXXXXX", NULL);
575 char *source = g_build_filename(root,
"source", NULL);
576 char *destination = g_build_filename(root,
"destination", NULL);
577 assert_int_equal(g_mkdir(source, 0700), 0);
578 char *first =
_make_jpeg(source,
"capture.jpg", 90);
579 char *sibling =
_make_jpeg(source,
"capture.jpeg", 91);
580 gchar *first_bytes = NULL;
581 gchar *sibling_bytes = NULL;
582 gsize first_size = 0;
583 gsize sibling_size = 0;
584 assert_true(g_file_get_contents(first, &first_bytes, &first_size, NULL));
585 assert_true(g_file_get_contents(sibling, &sibling_bytes, &sibling_size, NULL));
589 char *first_key = g_strdup(first);
590 char *sibling_key = g_strdup(sibling);
593 GList *sources = g_list_append(g_list_append(NULL, first), sibling);
597 assert_false(GPOINTER_TO_INT(g_hash_table_lookup(completion.
sources, first_key)));
598 assert_false(GPOINTER_TO_INT(g_hash_table_lookup(completion.
sources, sibling_key)));
599 char *first_destination = g_build_filename(destination,
"capture_0001.dt", NULL);
600 char *fallback = g_build_filename(destination,
"capture_0002.dt", NULL);
601 assert_true(g_file_test(first_destination, G_FILE_TEST_IS_REGULAR));
602 assert_true(g_file_test(fallback, G_FILE_TEST_IS_REGULAR));
620 for(
size_t policy = 0; policy < G_N_ELEMENTS(policies); policy++)
622 char *root = g_dir_make_tmp(
"ansel-import-reserved-fallback-XXXXXX", NULL);
623 char *source = g_build_filename(root,
"source", NULL);
624 char *destination = g_build_filename(root,
"destination", NULL);
625 assert_int_equal(g_mkdir(source, 0700), 0);
626 char *capture =
_make_jpeg(source,
"capture.jpg", 100);
627 char *fallback_owner =
_make_jpeg(source,
"capture1.jpg", 101);
628 char *capture_key = g_strdup(capture);
629 char *owner_key = g_strdup(fallback_owner);
630 gchar *capture_bytes = NULL;
631 gchar *owner_bytes = NULL;
632 gchar *sibling_bytes = NULL;
633 gsize capture_size = 0;
634 gsize owner_size = 0;
635 gsize sibling_size = 0;
636 assert_true(g_file_get_contents(capture, &capture_bytes, &capture_size, NULL));
637 assert_true(g_file_get_contents(fallback_owner, &owner_bytes, &owner_size, NULL));
638 GList *sources = g_list_append(g_list_append(NULL, capture), fallback_owner);
639 for(
int sequence = 3; sequence < 12; sequence++)
641 char *
name = g_strdup_printf(
"other%d.jpg", sequence);
642 sources = g_list_append(sources,
_make_jpeg(source,
name, (uint8_t)(100 + sequence)));
645 char *sibling =
_make_jpeg(source,
"capture.jpeg", 120);
646 char *sibling_key = g_strdup(sibling);
647 assert_true(g_file_get_contents(sibling, &sibling_bytes, &sibling_size, NULL));
650 sources = g_list_append(sources, sibling);
654 policies[policy], &completion)), 0);
656 assert_true(GPOINTER_TO_INT(g_hash_table_lookup(completion.
sources, capture_key)));
657 assert_true(GPOINTER_TO_INT(g_hash_table_lookup(completion.
sources, owner_key)));
658 assert_true(GPOINTER_TO_INT(g_hash_table_lookup(completion.
sources, sibling_key)));
659 char *first_destination = g_build_filename(destination,
"capture1.jpg", NULL);
660 char *reserved_fallback = g_build_filename(destination,
"capture12.jpg", NULL);
661 char *third_retry = g_build_filename(destination,
"capture13.jpg", NULL);
662 char *unique = g_build_filename(destination,
"capture12_01.jpg", NULL);
663 assert_true(g_file_test(first_destination, G_FILE_TEST_IS_REGULAR));
664 assert_true(g_file_test(reserved_fallback, G_FILE_TEST_IS_REGULAR));
665 assert_false(g_file_test(third_retry, G_FILE_TEST_EXISTS));
692 char *datadir = g_build_filename(tmp_dir,
"data", NULL);
693 char *rawspeed_dir = g_build_filename(datadir,
"rawspeed", NULL);
694 char *rawspeed_xml = g_build_filename(rawspeed_dir,
"cameras.xml", NULL);
695 char *source_xml = g_build_filename(
ANSEL_TEST_SOURCE_DIR,
"src",
"external",
"rawspeed",
"data",
"cameras.xml", NULL);
696 assert_int_equal(g_mkdir(datadir, 0700), 0);
697 assert_int_equal(g_mkdir(rawspeed_dir, 0700), 0);
698 GFile *source_file = g_file_new_for_path(source_xml);
699 GFile *destination_file = g_file_new_for_path(rawspeed_xml);
700 assert_true(g_file_copy(source_file, destination_file, G_FILE_COPY_OVERWRITE, NULL, NULL, NULL, NULL));
701 g_object_unref(destination_file);
702 g_object_unref(source_file);
711 _rcfile = g_build_filename(g_get_tmp_dir(),
"ansel-test-import-jobs.rc", NULL);
737 char *path = g_strdup(test_case->
path);
744 assert_string_equal(path, test_case->
path);
747 char source[] =
"$(FILE.NAME)|$(IMAGE.BASENAME)|$(FILE.EXTENSION)";
749 assert_string_equal(variables, test_case->
variables);
750 assert_string_equal(path, test_case->
path);
756 assert_string_equal(replacement, test_case->
replacement);
758 assert_string_equal(path, test_case->
path);
790 char *
directory = g_dir_make_tmp(
"ansel-test-pattern-expansion-XXXXXX", NULL);
793 data.datetime = g_date_time_new_now_local();
797 assert_null(
data.target_dir);
799 data.target_file_pattern =
"target.raw";
800 data.target_subfolder_pattern =
"";
801 data.base_folder = NULL;
803 assert_null(
data.target_dir);
805 g_date_time_unref(
data.datetime);
812 char *
directory = g_dir_make_tmp(
"ansel-test-image-import-XXXXXX", NULL);
814 char *dotted_directory = g_build_filename(
directory,
"a.b", NULL);
815 assert_int_equal(g_mkdir(dotted_directory, 0700), 0);
817 char *extensionless = g_build_filename(dotted_directory,
"capture", NULL);
818 char *dotfile = g_build_filename(
directory,
".profile", NULL);
819 char *trailing_dot = g_build_filename(
directory,
"capture.", NULL);
820 assert_true(g_file_set_contents(extensionless,
"x", 1, NULL));
821 assert_true(g_file_set_contents(dotfile,
"x", 1, NULL));
822 assert_true(g_file_set_contents(trailing_dot,
"x", 1, NULL));
831 g_remove(extensionless);
833 g_remove(trailing_dot);
834 g_rmdir(dotted_directory);
852 {
"blocker",
"Unable to create the target folder",
"Not allowed to write",
TRUE },
853 {
"read-only",
"Not allowed to write",
"Unable to create the target folder",
FALSE },
895 result = g_remove(fixture->
target);
898 result = g_chmod(fixture->
target, 0700);
899 if(g_rmdir(fixture->
target) != 0) result = -1;
917 fixture->
directory = g_dir_make_tmp(
"ansel-test-import-copy-XXXXXX", NULL);
927 if(g_chmod(fixture->
target, 0500) != 0)
goto failed;
934 ? g_build_filename(fixture->
target,
"missing", NULL) : g_strdup(fixture->
target);
956 int import_result = 0;
957 int stderr_redirect_result = -1;
961 if(stdout_redirect_result != fileno(stdout))
goto restore;
963 if(stderr_redirect_result != fileno(stderr))
goto restore;
965 image_path,
sizeof(image_path), &fixture->
discarded);
972 assert_int_equal(stdout_restore_result, fileno(stdout));
973 assert_int_equal(stderr_restore_result, fileno(stderr));
974 assert_int_equal(stdout_redirect_result, fileno(stdout));
975 assert_int_equal(stderr_redirect_result, fileno(stderr));
976 assert_int_equal(import_result, -1);
977 assert_true(g_file_get_contents(fixture->
diagnostics, &fixture->
output, NULL, NULL));
980 assert_null(strstr(fixture->
output,
"Unable to copy the file"));
981 assert_string_equal(image_path,
"");
986 assert_non_null(strstr(fixture->
control.
log_message[0],
"Impossible to create directory"));
990int main(
int argc,
char *argv[])
996 const struct CMUnitTest tests[] = {
1007 const int unit_result = cmocka_run_group_tests(tests,
_setup,
_teardown);
1008 if(unit_result)
return unit_result;
1010 _integration_config = g_strdup_printf(
"%s/ansel-test-import-config-XXXXXX", g_get_tmp_dir());
1011 _integration_cache = g_strdup_printf(
"%s/ansel-test-import-cache-XXXXXX", g_get_tmp_dir());
1012 _integration_tmp = g_strdup_printf(
"%s/ansel-test-import-tmp-XXXXXX", g_get_tmp_dir());
1018 char *init_argv[] = {
"ansel-test-import-jobs",
"--library",
":memory:",
"--datadir",
_integration_datadir,
1021 "--disable-opencl",
"--conf",
"write_sidecar_files=FALSE",
"-t",
"1", NULL };
1022 assert_int_equal(
dt_init(G_N_ELEMENTS(init_argv) - 1, init_argv,
FALSE,
FALSE), 0);
1026 const struct CMUnitTest integration_tests[] = {
1038 const int integration_result = cmocka_run_group_tests(integration_tests, NULL, NULL);
1048 return integration_result;
const char * extension(dt_imageio_module_data_t *data)
void cleanup(dt_imageio_module_format_t *self)
void dt_conf_cleanup(dt_conf_t *cf)
Free everything cf owns. No dt_conf_*() call is valid afterwards.
void dt_conf_init(dt_conf_t *cf, const char *filename, GSList *override_entries)
Populate cf from filename and from the generated defaults.
int32_t dt_image_import(const int32_t film_id, const char *filename, gboolean raise_signals)
dt_image_flags_t dt_image_flags_from_extension(const char *extension)
void dt_image_init(dt_image_t *img)
int32_t dt_image_get_id_full_path(const gchar *filename)
int dt_init(int argc, char *argv[], const gboolean init_gui, const gboolean load_data)
gchar * directory
documentation root given after –doc, or NULL
static int dt_pthread_mutex_init(dt_pthread_mutex_t *mutex, const pthread_mutexattr_t *mutexattr)
Initialise a mutex. With mutexattr NULL – which is how 54 of the 56 call sites in this tree spell it ...
static int dt_pthread_mutex_destroy(dt_pthread_mutex_t *mutex)
int dt_imageio_jpeg_write(const char *filename, const uint8_t *in, const int width, const int height, const int quality, const void *exif, int exif_len)
gchar * dt_build_filename_from_pattern(const char *const filename, const int index, dt_image_t *img, dt_control_import_t *data)
Build a full path for a given image file, given a pattern.
int dt_control_import(dt_control_import_t data)
Process a list of images to import with or without copying the files on an arbitrary hard-drive.
dt_import_onconflict_t
Behaviour when a copy-on-import destination path already exists.
@ DT_IMPORT_ONCONFLICT_UNIQUE
@ DT_IMPORT_ONCONFLICT_SKIP
@ DT_IMPORT_ONCONFLICT_OVERWRITE
TIFF sidecar I/O API for drawlayer layers.
static const dt_iop_drawlayer_params_t * params
#define IS_NULL_PTR(p)
C is way too permissive with !=, == and if(var) checks, which can mean too many things depending on w...
static void dt_free_gpointer(gpointer ptr)
g_free() one pointer, with the signature GDestroyNotify wants.
#define dt_free(ptr)
g_free() ptr and set it to NULL, skipping both if it is already NULL.
#define DT_PATH_MAX
Buffer size for a filesystem path anywhere in Ansel.
char * dt_variables_expand(dt_variables_params_t *params, gchar *source, gboolean iterate)
void dt_variables_params_destroy(dt_variables_params_t *params)
void dt_variables_params_init(dt_variables_params_t **params)
const float uint32_t state[4]
const char * expected_diagnostic
const char * unexpected_diagnostic
gboolean writable_after_chmod
const directory_failure_case_t * test_case
dt_control_t * saved_control
gboolean mutex_initialized
The whole configuration state. One instance lives at darktable.conf.
dt_pthread_mutex_t log_mutex
char log_message[10][1000]
static int _teardown(void **state __attribute__((unused)))
static int _setup(void **state __attribute__((unused)))
static void _assert_file_bytes(const char *path, const gchar *expected, const gsize expected_size)
static void _test_copy_directory_failure_reports_only_its_cause(void **state)
static char * _integration_datadir
static void _test_pattern_expansion_rejects_missing_patterns(void **state G_GNUC_UNUSED)
static void _assert_different_bytes(const gchar *first, const gsize first_size, const gchar *second, const gsize second_size)
static dt_control_import_t _copy_import(GList *sources, const int elements, const char *destination, const char *pattern, const dt_import_onconflict_t policy, import_completion_t *completion)
static void _test_extension_contract(void **state G_GNUC_UNUSED)
static void _test_public_copy_failure_reservation_forces_sibling_fallback(void **state G_GNUC_UNUSED)
static void _test_stream_comparison_boundaries(void **state G_GNUC_UNUSED)
static void _import_job_disposed(gpointer user_data)
static char * _integration_cache
static void _test_public_siblings_keep_sequence_for_distinct_destinations(void **state G_GNUC_UNUSED)
static void _test_image_import_extension_boundaries(void **state G_GNUC_UNUSED)
static char * _make_jpeg(const char *directory, const char *name, const uint8_t value)
static void _test_public_reserved_fallback_reaches_policy_without_third_expansion(void **state G_GNUC_UNUSED)
static void _test_public_fixed_destination_follows_all_policies(void **state G_GNUC_UNUSED)
static void _test_extension_utility_rejections(void **state G_GNUC_UNUSED)
static void _import_completed(const char *source, gboolean success, gpointer user_data)
static char * _prepare_test_datadir(const char *tmp_dir)
static void _test_public_unrelated_collision_has_no_sibling_fallback(void **state G_GNUC_UNUSED)
static int _setup(void **state G_GNUC_UNUSED)
static int _teardown(void **state G_GNUC_UNUSED)
static const extension_case_t _extension_cases[]
static void _assert_import(import_completion_t *completion, const int expected_successes)
static void _test_public_sibling_collision_reexpands_once(void **state G_GNUC_UNUSED)
static void _completion_cleanup(import_completion_t *completion)
static void _completion_init(import_completion_t *completion, const int expected)
static int _directory_failure_setup(void **state)
Prepare both diagnostic cases without redirecting process-wide output.
static char * _integration_config
static int _directory_failure_teardown(void **state)
Release fixture resources after setup failure, assertion failure, or skip.
int _import_copy_file(const char *filename, const char *destination, dt_control_import_t *data, gchar *img_path_to_db, size_t pathname_len, GList **discarded)
copy a file to a destination path after checking if everything is allright.
static void _test_public_delete_source_requires_successful_copy(void **state G_GNUC_UNUSED)
static void _remove_tree(const char *path)
static void _test_public_in_place_import_preserves_source(void **state G_GNUC_UNUSED)
static char * _integration_tmp
static void _test_public_failures_consume_sequences_and_complete_once(void **state G_GNUC_UNUSED)
static void _test_public_database_failure_reservation_forces_sibling_fallback(void **state G_GNUC_UNUSED)
#define test_dup2(fd, fd2)
static const directory_failure_case_t _directory_failure_cases[]
#define ANSEL_TEST_SOURCE_DIR
#define ANSEL_TEST_BINARY_DIR
gboolean dt_has_same_path_basename(const char *filename1, const char *filename2)
Test whether two paths are byte-identical before their normal extensions.
int dt_util_streams_equal(FILE *first, FILE *second)
Compare the remaining bytes of two borrowed binary streams.
gboolean dt_util_test_writable_dir(const char *path)
const char * dt_util_path_get_extension(const char *path)
Locate a normal filename extension in a path basename.
char * dt_copy_filename_extension(const char *filename1, const char *filename2)
Replace filename1's normal extension with filename2's normal extension.