Ansel 0.0
A darktable fork - bloat + design vision
Loading...
Searching...
No Matches
test_image_repository.c File Reference
#include "testdb.h"
#include "common/image.h"
#include "system/mem_alloc.h"
#include <glib/gstdio.h>
#include <sqlite3.h>
#include "win/main_wrapper.h"
Include dependency graph for test_image_repository.c:

Go to the source code of this file.

Macros

#define TEST_FLAG   2048

Functions

static void test_flag_among_multi_image (void **state)
static void test_set_flags_masked_leaves_other_bits (void **state)
static void test_full_paths (void **state)
static void test_id_range (void **state)
static void test_write_timestamp_is_64bit (void **state)
static void test_group_member_rows (void **state)
static void test_count_distinct_fields (void **state)
static gboolean _count_two_rows (const int32_t imgid, const int64_t write_timestamp, const int version, const char *image_path, const int flags, void *user_data)
static void test_foreach_with_path_stops_when_asked (void **state)
static void test_load_marks_an_absent_image_invalid (void **state __attribute__((unused)))
static int _file_setup (void **state __attribute__((unused)))
static int _file_teardown (void **state)
static void test_load_failure_leaves_the_image_untouched (void **state __attribute__((unused)))
int main (int argc, char *argv[])

Variables

static gchar * _dir = NULL
static gchar * _library = NULL

Macro Definition Documentation

◆ TEST_FLAG

#define TEST_FLAG   2048

Contracts of database/image_repository.h that the migration promised to keep.

The first test is a regression test for a real bug: the callers this repository absorbed used to bind a comma-joined id string to a single IN (?) parameter, which SQLite reads as ONE value – it matched a lone id and matched NOTHING for two or more. The repository builds the set into the statement as integers; these tests hold it there.

Definition at line 40 of file test_image_repository.c.

Referenced by test_flag_among_multi_image(), and test_set_flags_masked_leaves_other_bits().

Function Documentation

◆ _count_two_rows()

gboolean _count_two_rows ( const int32_t imgid,
const int64_t write_timestamp,
const int version,
const char * image_path,
const int flags,
void * user_data )
static

Definition at line 221 of file test_image_repository.c.

References flags, and void().

Referenced by test_foreach_with_path_stops_when_asked().

◆ _file_setup()

int _file_setup ( void **state __attribute__(unused))
static

Definition at line 275 of file test_image_repository.c.

References _dir, _library, dt_database_open(), DT_DATABASE_OPEN_OK, FALSE, IS_NULL_PTR, params, and state.

Referenced by main().

◆ _file_teardown()

int _file_teardown ( void ** state)
static

Definition at line 288 of file test_image_repository.c.

References _dir, _library, d, dt_free, IS_NULL_PTR, name, state, and testdb_teardown().

Referenced by main().

◆ main()

int main ( int argc,
char * argv[] )

◆ test_count_distinct_fields()

◆ test_flag_among_multi_image()

void test_flag_among_multi_image ( void ** state)
static

◆ test_foreach_with_path_stops_when_asked()

void test_foreach_with_path_stops_when_asked ( void ** state)
static

◆ test_full_paths()

void test_full_paths ( void ** state)
static

◆ test_group_member_rows()

◆ test_id_range()

void test_id_range ( void ** state)
static

◆ test_load_failure_leaves_the_image_untouched()

void test_load_failure_leaves_the_image_untouched ( void **state __attribute__(unused))
static

◆ test_load_marks_an_absent_image_invalid()

void test_load_marks_an_absent_image_invalid ( void **state __attribute__(unused))
static

◆ test_set_flags_masked_leaves_other_bits()

◆ test_write_timestamp_is_64bit()

void test_write_timestamp_is_64bit ( void ** state)
static

Variable Documentation

◆ _dir

gchar* _dir = NULL
static

Definition at line 272 of file test_image_repository.c.

◆ _library

gchar* _library = NULL
static

Definition at line 273 of file test_image_repository.c.