36static const unsigned char params_a[] = { 0x01, 0x02, 0x03, 0x04, 0x05 };
37static const unsigned char params_b[] = { 0x0a, 0x0b, 0x0c };
46 assert_int_equal(
p->op_params_size,
sizeof(
params_a));
55 assert_int_equal(
p->op_params_size,
sizeof(
params_a));
63 assert_int_equal(
p->op_params_size,
sizeof(
params_b));
76 assert_int_equal(g_list_length(rows), 2);
78 int seen_v1 = 0, seen_v2 = 0;
79 for(GList *l = rows; l; l = g_list_next(l))
82 assert_string_equal(
p->name,
"P");
83 if(
p->op_version == 1)
86 assert_int_equal(
p->op_params_size,
sizeof(
params_a));
89 if(
p->op_version == 2)
92 assert_int_equal(
p->op_params_size,
sizeof(
params_b));
96 assert_int_equal(seen_v1, 1);
97 assert_int_equal(seen_v2, 1);
108 int mine = 0, shipped = 0;
109 for(GList *l = rows; l; l = g_list_next(l))
112 if(!g_strcmp0(
p->operation,
"borders"))
114 if(!g_strcmp0(
p->name,
"mine")) mine++;
115 if(!g_strcmp0(
p->name,
"shipped")) shipped++;
116 assert_true(
p->rowid > 0);
119 assert_int_equal(mine, 1);
120 assert_int_equal(shipped, 0);
131 for(GList *l = rows; l; l = g_list_next(l))
134 if(!g_strcmp0(
p->operation,
"vignette") && !g_strcmp0(
p->name,
"treerow")) found =
p;
136 assert_non_null(found);
142int main(
int argc,
char *argv[])
144 const struct CMUnitTest tests[] = {
typedef void((*dt_cache_allocate_t)(void *userdata, dt_cache_entry_t *entry))
void dt_module_preset_free(gpointer data)
Release one dt_module_preset_t. Suits g_list_free_full().
GList * dt_preset_repository_list_all(void)
Every preset, ordered by (operation, name) – the grouping the tree relies on to start a new module no...
void dt_preset_row_free(gpointer data)
Free one dt_preset_row_t. Suits g_list_free_full().
dt_module_preset_t * dt_preset_repository_get_module_preset(const char *operation, const int op_version, const char *name)
One preset by name, or NULL. Free with dt_module_preset_free().
GList * dt_preset_repository_list_editable(void)
Every preset the user may edit (writeprotect = 0), in row order.
GList * dt_preset_repository_list_for_upgrade(const char *operation)
Every preset of operation at any version, with both parameter blobs.
void dt_preset_repository_update_module_params(const char *operation, const char *name, const int op_version, const void *params, const int params_size)
Replace the parameters (and version) of (operation, name).
void dt_preset_identity_free(gpointer data)
Free one dt_preset_identity_t. Suits g_list_free_full().
void dt_preset_repository_add_module_preset(const char *name, const char *operation, const int op_version, const void *params, const int params_size)
Create an empty user preset holding params, as the "new preset" menu item does.
void dt_preset_repository_set_module_version(const char *operation, const char *name, const int op_version)
Set ONLY the version of (operation, name), leaving the parameters alone.
void dt_preset_repository_add_shipped_preset(const char *name, const char *operation, const int op_version, const void *params, const int params_size, const int writeprotect)
Create a preset from code rather than from the menu – the built-in presets a module registers at star...
const float uint32_t state[4]
Identity of one preset, for callers listing rather than loading.
One row of the Preferences preset tree, with its auto-apply conditions.
static const unsigned char params_a[]
static const unsigned char params_b[]
static void test_set_module_version_leaves_params_alone(void **state)
static void test_list_editable_excludes_shipped(void **state)
static void test_list_all_carries_the_tree_row(void **state)
static void test_list_for_upgrade_returns_all_versions(void **state)
Shared fixture for the src/database repository tests.
static int testdb_setup(void **state)
static int testdb_teardown(void **state)