40#include <glib/gstdio.h>
44#define CRAWL_BIT_A (1 << 4)
45#define CRAWL_BIT_B (1 << 5)
46#define CRAWL_MASK (CRAWL_BIT_A | CRAWL_BIT_B)
61 _rcfile = g_build_filename(g_get_tmp_dir(),
"ansel_test_image_cache_flags.rc", NULL);
88 assert_true(film > 0);
101 GList *one = g_list_append(NULL, GINT_TO_POINTER(imgid));
103 const gboolean found = (g_list_length(got) == 1);
119 assert_non_null(cached);
129 assert_non_null(rated);
145 assert_non_null(cached);
150 assert_non_null(edited);
157 assert_non_null(rated);
189 gchar *dir = g_dir_make_tmp(
"ansel_test_crawl_XXXXXX", NULL);
190 assert_non_null(dir);
191 gchar *raw = g_build_filename(dir,
"shot.raw", NULL);
192 gchar *txt = g_build_filename(dir,
"shot.txt", NULL);
196 gchar *xmp = g_build_filename(dir,
"shot.raw.xmp", NULL);
197 assert_true(g_file_set_contents(raw,
"", 0, NULL));
198 assert_true(g_file_set_contents(txt,
"note", 4, NULL));
199 assert_true(g_file_set_contents(xmp,
"<x/>", 4, NULL));
210 assert_non_null(looked);
217 assert_null(changed);
223 assert_non_null(rated);
253 d.
dir = g_dir_make_tmp(
"ansel_test_crawl_XXXXXX", NULL);
254 assert_non_null(
d.dir);
255 d.raw = g_build_filename(
d.dir,
"shot.raw", NULL);
256 d.xmp = g_build_filename(
d.dir,
"shot.raw.xmp", NULL);
257 d.txt = g_build_filename(
d.dir,
"shot.txt", NULL);
258 assert_true(g_file_set_contents(
d.raw,
"", 0, NULL));
259 assert_true(g_file_set_contents(
d.xmp,
"<x/>", 4, NULL));
260 assert_true(g_file_set_contents(
d.txt,
"note", 4, NULL));
288 assert_non_null(looked);
295 assert_null(changed);
299 assert_non_null(rated);
325 g_mutex_lock(&h->
lock);
327 g_cond_signal(&h->
cond);
328 g_mutex_unlock(&h->
lock);
344 assert_non_null(looked);
348 g_mutex_init(&h.
lock);
349 g_cond_init(&h.
cond);
350 GThread *holder = g_thread_new(
"entry holder",
_hold_entry, &h);
351 g_mutex_lock(&h.
lock);
353 g_mutex_unlock(&h.
lock);
356 assert_null(changed);
357 g_thread_join(holder);
363 g_cond_clear(&h.
cond);
364 g_mutex_clear(&h.
lock);
378 gchar *as_named = g_build_filename(
d.dir,
"SHOT.raw", NULL);
379 const gboolean folds_case = g_file_test(as_named, G_FILE_TEST_EXISTS);
385 assert_null(changed);
396 if(folds_case) skip();
401 const struct CMUnitTest tests[] = {
typedef void((*dt_cache_allocate_t)(void *userdata, dt_cache_entry_t *entry))
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.
GList * dt_control_crawler_run(void)
GtkWidget * folder
destination folder chooser
void dt_image_cache_write_release(dt_image_t *img, dt_image_cache_write_mode_t mode)
dt_image_t * dt_image_cache_testget(const int32_t imgid, char mode)
void dt_image_cache_init(const gboolean verbose)
Initialise the cache.
dt_image_t * dt_image_cache_get(const int32_t imgid, char mode)
void dt_image_cache_read_release(const dt_image_t *img)
void dt_image_cache_cleanup(void)
gboolean dt_image_repository_set_flags_masked(const int32_t imgid, const int mask, const int value)
Write only mask's bits of imgid's flags, taking them from value.
GList * dt_image_repository_get_ids_with_flag_among(GList *imgids, const int flag)
Of the images in imgids, those whose flags carry flag, in row order.
gboolean dt_image_repository_set_group(const int32_t imgid, const int32_t group_id)
Set imgid's group_id.
gboolean dt_image_repository_set_write_timestamp(const int32_t imgid, const int64_t timestamp)
Set write_timestamp of imgid to timestamp (seconds since the epoch). Bound as a 64-bit integer; the c...
gboolean dt_image_repository_set_flags(const int32_t imgid, const int flags)
Replace imgid's whole flags word.
dt_mipmap_buffer_dsc_flags flags
const float uint32_t state[4]
The whole configuration state. One instance lives at darktable.conf.
static void test_crawl_waits_for_a_held_entry(void **state)
static void test_cached_entry_overwrites_a_row_written_behind_it(void **state)
static _crawl_dir_t _crawl_dir_new(const char *db_name)
static gpointer _hold_entry(gpointer data)
static void test_crawl_keeps_a_cached_entry_in_step(void **state)
static int cache_teardown(void **state)
static gboolean _row_has(const int32_t imgid, const int flag)
static void test_editing_the_entry_survives_the_next_rating(void **state)
static void test_crawl_reads_a_miscased_name_as_the_filesystem_does(void **state)
static int cache_setup(void **state)
static int32_t _image_with_flags(const char *folder, const char *name, const int flags)
static void test_testget_does_not_create_an_entry(void **state)
static void test_crawl_corrects_an_entry_the_row_already_agrees_with(void **state)
static void _crawl_dir_free(_crawl_dir_t *d)
Shared fixture for the src/database repository tests.
static int testdb_setup(void **state)
static int32_t testdb_make_film(const char *folder)
static int testdb_teardown(void **state)
static int32_t testdb_make_image(const int32_t film_id, const char *filename)