![]() |
Ansel 0.0
A darktable fork - bloat + design vision
|
Include dependency graph for test_removed_image_repository.c:Go to the source code of this file.
Macros | |
| #define | SEEDED_FLAGS 0x51 |
| #define | SEEDED_VERSION 7 |
Functions | |
| static void | _seed_every_table (const int32_t imgid, const char *tag_name, const char *meta_value) |
| static void | _remove (const int32_t imgid) |
| static gboolean | _in_group (const int32_t group_id, const int32_t imgid) |
| static gboolean | _has_flags (const int32_t imgid, const int flags) |
| static void | test_round_trip_restores_every_table (void **state) |
| static void | test_group_leader_restores_membership (void **state) |
| static void | test_film_roll_comes_back_with_its_last_image (void **state) |
| static void | test_partial_undo_repoints_a_departed_leader (void **state) |
| static void | test_whole_group_removed_and_fully_undone_keeps_one_group (void **state) |
| static void | test_clear_drops_the_snapshot (void **state) |
| static void | test_successive_snapshots_do_not_collide (void **state) |
| int | main (void) |
| #define SEEDED_FLAGS 0x51 |
The contract behind "undo remove from library" (doc/removal-undo.md).
Removing an image deletes its main.images row and the foreign keys take its history, masks, tags, colour labels, metadata, module order and history end with it. The undo can only be as good as what was staged first, so what these tests pin is that a snapshot is COMPLETE – every table comes back, not merely the image row, which is the failure this design is exposed to: a restore that looks right because the image is listed again while its edit is gone.
Two properties beyond the round trip get their own tests, because both are invisible in the common case and wrong only at the edges: the group membership of images NOBODY asked to remove (rewritten on the way out, staged separately), and the film roll (swept when its last image goes, and referenced by a foreign key on the way back).
The removal itself is spelled out here rather than called: dt_image_remove_undoable() lives in common/image.c and drags the image cache, the mipmap cache and the undo stack in with it. What is under test is the repository, so _remove() below reproduces the only two database effects the job has – the grouping hand-over and the row delete – through the repository API, the same way testdb.h requires of every test here.
Note what is NOT used: dt_image_repository_load(). It maps the row through dt_image_film_roll_name(), which reads a conf key, and this fixture initialises no conf system. Every assertion below therefore reads its column through a narrower query.
Definition at line 49 of file test_removed_image_repository.c.
| #define SEEDED_VERSION 7 |
Definition at line 51 of file test_removed_image_repository.c.
|
static |
Definition at line 102 of file test_removed_image_repository.c.
References dt_image_repository_get_ids_with_flag_among(), and flags.
Referenced by test_round_trip_restores_every_table(), and test_successive_snapshots_do_not_collide().
|
static |
Definition at line 94 of file test_removed_image_repository.c.
References dt_image_repository_get_group_members(), and IS_NULL_PTR.
Referenced by test_group_leader_restores_membership(), test_partial_undo_repoints_a_departed_leader(), test_round_trip_restores_every_table(), and test_whole_group_removed_and_fully_undone_keeps_one_group().
|
static |
What the removal job does to the database, and nothing else.
Definition at line 81 of file test_removed_image_repository.c.
References dt_image_repository_delete(), dt_image_repository_get_group_members(), dt_image_repository_reassign_group(), and IS_NULL_PTR.
Referenced by test_clear_drops_the_snapshot(), test_film_roll_comes_back_with_its_last_image(), test_group_leader_restores_membership(), test_partial_undo_repoints_a_departed_leader(), test_round_trip_restores_every_table(), test_successive_snapshots_do_not_collide(), and test_whole_group_removed_and_fully_undone_keeps_one_group().
|
static |
Give imgid one row in every table dt_removed_image_repository_create() stages.
Definition at line 54 of file test_removed_image_repository.c.
References dt_colorlabel_repository_set(), dt_history_repository_set_end(), dt_history_repository_set_module_order(), dt_history_repository_write_item(), dt_history_repository_write_mask_item(), dt_image_repository_set_flags(), dt_image_repository_set_group(), dt_image_repository_set_version(), dt_metadata_repository_add(), dt_tag_repository_attach(), dt_tag_repository_insert(), dt_metadata_row_t::imgid, meta, SEEDED_FLAGS, SEEDED_VERSION, and TRUE.
Referenced by test_clear_drops_the_snapshot(), and test_round_trip_restores_every_table().
| int main | ( | void | ) |
Definition at line 338 of file test_removed_image_repository.c.
References test_clear_drops_the_snapshot(), test_film_roll_comes_back_with_its_last_image(), test_group_leader_restores_membership(), test_partial_undo_repoints_a_departed_leader(), test_round_trip_restores_every_table(), test_successive_snapshots_do_not_collide(), test_whole_group_removed_and_fully_undone_keeps_one_group(), testdb_setup(), and testdb_teardown().
Definition at line 293 of file test_removed_image_repository.c.
References _remove(), _seed_every_table(), dt_history_repository_count_items(), dt_image_repository_find_by_film_and_filename(), dt_removed_image_repository_clear(), dt_removed_image_repository_create(), dt_removed_image_repository_restore(), testdb_make_film(), and testdb_make_image().
Referenced by main().
Definition at line 194 of file test_removed_image_repository.c.
References _remove(), dt_film_repository_delete(), dt_film_repository_find_by_folder(), dt_image_repository_get_full_paths(), dt_removed_image_repository_create(), dt_removed_image_repository_restore(), testdb_make_film(), and testdb_make_image().
Referenced by main().
Definition at line 167 of file test_removed_image_repository.c.
References _in_group(), _remove(), dt_image_repository_set_group(), dt_removed_image_repository_create(), dt_removed_image_repository_restore(), testdb_make_film(), and testdb_make_image().
Referenced by main().
Definition at line 223 of file test_removed_image_repository.c.
References _in_group(), _remove(), dt_image_repository_find_by_film_and_filename(), dt_image_repository_set_group(), dt_removed_image_repository_create(), dt_removed_image_repository_restore(), testdb_make_film(), and testdb_make_image().
Referenced by main().
Definition at line 112 of file test_removed_image_repository.c.
References _has_flags(), _in_group(), _remove(), _seed_every_table(), dt_colorlabel_repository_get_list(), dt_colorlabel_repository_has(), dt_history_repository_count_items(), dt_history_repository_count_mask_items(), dt_history_repository_get_end(), dt_history_repository_get_module_order(), dt_image_repository_find_by_film_and_filename(), dt_image_repository_get_version(), dt_metadata_repository_get_values(), dt_module_order_row_cleanup(), dt_removed_image_repository_create(), dt_removed_image_repository_restore(), dt_tag_repository_insert(), dt_tag_repository_is_attached(), dt_module_order_row_t::iop_list, SEEDED_FLAGS, SEEDED_VERSION, testdb_make_film(), testdb_make_image(), and dt_module_order_row_t::version.
Referenced by main().
Definition at line 313 of file test_removed_image_repository.c.
References _has_flags(), _remove(), dt_image_repository_find_by_film_and_filename(), dt_image_repository_set_flags(), dt_image_repository_set_group(), dt_removed_image_repository_create(), dt_removed_image_repository_restore(), SEEDED_FLAGS, testdb_make_film(), and testdb_make_image().
Referenced by main().
Definition at line 251 of file test_removed_image_repository.c.
References _in_group(), _remove(), dt_image_repository_find_by_film_and_filename(), dt_image_repository_set_group(), dt_removed_image_repository_create(), dt_removed_image_repository_restore(), testdb_make_film(), and testdb_make_image().
Referenced by main().