29#include <glib/gstdio.h>
34#define test_dup2 _dup2
35#define test_close _close
40#define test_close close
55 {
"capture.raw",
"raw",
"capture|capture|raw",
"capture.jpg" },
56 {
".profile.jpg",
"jpg",
".profile|.profile|jpg",
".profile.jpg" },
57 {
"/a.b/capture",
NULL,
"capture|capture|",
NULL },
58 {
"C:\\a.b\\capture",
NULL,
"capture|capture|",
NULL },
59 {
".profile",
NULL,
".profile|.profile|",
NULL },
60 {
"capture.",
NULL,
"capture.|capture.|",
NULL },
61 {
"capture",
NULL,
"capture|capture|",
NULL },
199 "$(FILE.NAME)_$(FILE.EXTENSION)_$(SEQUENCE).jpg",
221 char *source =
_make_jpeg(root,
"capture.jpg", 25);
247 char *source =
_make_jpeg(root,
"first.jpg", 35);
291 const size_t sizes[] = { 0, 1, 65535, 65536, 65537, 131073 };
501 char *valid =
_make_jpeg(source,
"valid.jpg", 70);
576 char *first =
_make_jpeg(source,
"capture.jpg", 90);
637 for(
int sequence = 3; sequence < 12; sequence++)
745 char source[] =
"$(FILE.NAME)|$(IMAGE.BASENAME)|$(FILE.EXTENSION)";
850 {
"blocker",
"Unable to create the target folder",
"Not allowed to write",
TRUE },
851 {
"read-only",
"Not allowed to write",
"Unable to create the target folder",
FALSE },
892 if(
fixture->test_case->target_is_file)
922 if(!
fixture->target_created)
goto failed;
936 if(
fixture->diagnostic_fd < 0)
goto failed;
938 if(
fixture->stdout_fd < 0)
goto failed;
940 if(
fixture->stderr_fd < 0)
goto failed;
963 image_path,
sizeof(image_path), &
fixture->discarded);
1016 char *argv[] = {
"ansel-test-import-jobs",
"--library",
":memory:",
"--datadir",
_integration_datadir,
1019 "--disable-opencl",
"--conf",
"write_sidecar_files=FALSE",
"-t",
"1",
NULL };
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.
static const dt_aligned_pixel_simd_t value
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]
struct dt_control_t * control
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_import_onconflict_t on_conflict
GDestroyNotify callback_data_free
void(* file_imported)(const char *source, gboolean success, gpointer user_data)
Optional per-file completion method.
char * target_file_pattern
char * target_subfolder_pattern
struct dt_control_t::@8 progress_system
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)
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.