Ansel 0.0
A darktable fork - bloat + design vision
Loading...
Searching...
No Matches
testdb.h File Reference

Shared fixture for the src/database repository tests. More...

#include <stdarg.h>
#include <stddef.h>
#include <setjmp.h>
#include <stdint.h>
#include <cmocka.h>
#include "database/collection_query.h"
#include "database/colorlabel_repository.h"
#include "database/database.h"
#include "database/film_repository.h"
#include "database/history_repository.h"
#include "database/image_repository.h"
#include "database/metadata_repository.h"
#include "database/preset_repository.h"
#include "database/selection_repository.h"
#include "database/style_repository.h"
#include "database/tag_repository.h"
+ Include dependency graph for testdb.h:
+ This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Functions

static int testdb_setup (void **state)
 
static int testdb_teardown (void **state)
 
static int32_t testdb_make_film (const char *folder)
 
static int32_t testdb_make_image (const int32_t film_id, const char *filename)
 

Detailed Description

Shared fixture for the src/database repository tests.

Opens the one connection on ":memory:" (dt_database_open() then puts data and memory on ":memory:" too, and skips the lock files), and closes it again after finalising every repository's cached statements – the same discipline the application follows at shutdown, and the reason dt_database_close() can be called at all.

Everything a test writes goes through the repository APIs. That is not a convenience: tools/check_module_boundaries.sh holds the module's raw-connection accessor at ZERO call sites outside src/database, and these tests live outside src/database. A test that cannot set up its rows through the public API has found a hole in the API.

Definition in file testdb.h.

Function Documentation

◆ testdb_make_film()

◆ testdb_make_image()

◆ testdb_setup()

static int testdb_setup ( void **  state)
inlinestatic

Definition at line 55 of file testdb.h.

References dt_database_open(), DT_DATABASE_OPEN_OK, FALSE, L, state, and void().

Referenced by main().

◆ testdb_teardown()