![]() |
Ansel 0.0
A darktable fork - bloat + design vision
|
#include "common/darktable.h"#include "common/database.h"#include "common/film.h"#include "common/history_actions.h"#include "common/history_merge.h"#include "common/image.h"#include "common/styles.h"#include <assert.h>#include <gio/gio.h>#include <glib/gstdio.h>#include <sqlite3.h>#include <stdio.h>#include <stdlib.h>
Include dependency graph for tests/styles.c:Go to the source code of this file.
Data Structures | |
| struct | dt_style_scenario_result_t |
| One-line scenario result printed after every style has run. More... | |
Macros | |
| #define | ANSEL_TEST_SOURCE_DIR "." |
| #define | ANSEL_TEST_BINARY_DIR "." |
Typedefs | |
| typedef struct dt_style_scenario_result_t | dt_style_scenario_result_t |
| One-line scenario result printed after every style has run. | |
Functions | |
| static int | test_fail (const char *scenario, const char *message, char **failure_reason) |
| static gboolean | is_style_file (const char *filename) |
| static char * | scenario_name_from_style_file (const char *filename) |
| static int | sql_int_for_bound_images (const char *query, const int32_t imgid_a, const int32_t imgid_b) |
| static int | max_style_id (void) |
| static char * | imported_style_name (const int before_import_style_id) |
| static int32_t | create_test_image (const char *source_image_path) |
| static int | load_xmp_on_image (const char *scenario, const int32_t imgid, const char *xmp_path, char **failure_reason) |
| static int | load_start_history (const char *scenario, const int32_t imgid, const char *start_xmp_path, const char *start_xmp_name, char **failure_reason) |
| static void | print_module_order_summary (const char *label, const int32_t imgid) |
| static int | compare_pipe_order (const char *scenario, const int32_t actual_imgid, const int32_t expected_imgid, char **failure_reason) |
| static void | print_enabled_state_summary (const char *label, const int32_t imgid) |
| static int | compare_enabled_state (const char *scenario, const int32_t actual_imgid, const int32_t expected_imgid, char **failure_reason) |
| static int | apply_style_to_image (const char *scenario, const char *style_name, const int32_t imgid, char **failure_reason) |
| static int | run_style_scenario (const char *scenario_dir, const char *source_image_path, const char *style_file, char **failure_reason) |
| static int | run_style_scenarios (const char *scenario_dir, const char *source_image_path) |
| static char * | prepare_test_datadir (const char *tmp_dir) |
| int | main (int argc, char *argv[]) |
Variables | |
| static char * | test_image_dir = NULL |
Run style-application scenarios from tests/styles. | |
| #define ANSEL_TEST_BINARY_DIR "." |
Definition at line 43 of file tests/styles.c.
| #define ANSEL_TEST_SOURCE_DIR "." |
Definition at line 39 of file tests/styles.c.
| typedef struct dt_style_scenario_result_t dt_style_scenario_result_t |
One-line scenario result printed after every style has run.
The full diagnostics are emitted where the failure is detected. This summary keeps only the first failure reason so the final output stays readable when several fixtures are executed in a single run.
|
static |
Definition at line 317 of file tests/styles.c.
References dt_conf_set_bool(), DT_HISTORY_MERGE_APPEND, dt_styles_apply_to_image_merge(), dt_styles_get_id_by_name(), FALSE, test_fail(), and TRUE.
Referenced by run_style_scenario().
|
static |
Definition at line 276 of file tests/styles.c.
References print_enabled_state_summary(), sql_int_for_bound_images(), and test_fail().
Referenced by run_style_scenario().
|
static |
Definition at line 219 of file tests/styles.c.
References print_module_order_summary(), sql_int_for_bound_images(), and test_fail().
Referenced by run_style_scenario().
|
static |
Definition at line 135 of file tests/styles.c.
References dt_film_cleanup(), dt_film_init(), dt_film_new(), dt_free, dt_image_import(), error(), extension(), FALSE, dt_film_t::id, and test_image_dir.
Referenced by run_style_scenario().
|
static |
Definition at line 119 of file tests/styles.c.
References darktable, darktable_t::db, dt_database_get(), and name.
Referenced by run_style_scenario().
|
static |
Definition at line 84 of file tests/styles.c.
References extension(), and IS_NULL_PTR.
Referenced by run_style_scenarios().
|
static |
Definition at line 187 of file tests/styles.c.
References load_xmp_on_image().
Referenced by run_style_scenario().
|
static |
Definition at line 176 of file tests/styles.c.
References dt_history_load_and_apply(), test_fail(), and TRUE.
Referenced by load_start_history(), and run_style_scenario().
| int main | ( | int | argc, |
| char * | argv[] | ||
| ) |
Definition at line 476 of file tests/styles.c.
References ANSEL_TEST_BINARY_DIR, ANSEL_TEST_SOURCE_DIR, dt_cleanup(), dt_free, dt_init(), FALSE, IS_NULL_PTR, prepare_test_datadir(), run_style_scenarios(), and test_image_dir.
|
static |
Definition at line 109 of file tests/styles.c.
References darktable, darktable_t::db, dt_database_get(), and value.
Referenced by run_style_scenario().
|
static |
Definition at line 444 of file tests/styles.c.
References ANSEL_TEST_SOURCE_DIR, dt_free, and error().
Referenced by main().
|
static |
Definition at line 243 of file tests/styles.c.
References darktable, darktable_t::db, and dt_database_get().
Referenced by compare_enabled_state().
|
static |
Definition at line 197 of file tests/styles.c.
References darktable, darktable_t::db, and dt_database_get().
Referenced by compare_pipe_order().
|
static |
Definition at line 332 of file tests/styles.c.
References apply_style_to_image(), compare_enabled_state(), compare_pipe_order(), create_test_image(), dt_free, dt_styles_import_from_file(), imported_style_name(), IS_NULL_PTR, load_start_history(), load_xmp_on_image(), max_style_id(), scenario_name_from_style_file(), and test_fail().
Referenced by run_style_scenarios().
|
static |
Definition at line 379 of file tests/styles.c.
References dt_free, dt_free_gpointer(), error(), IS_NULL_PTR, is_style_file(), dt_style_scenario_result_t::reason, dt_style_scenario_result_t::result, run_style_scenario(), and dt_style_scenario_result_t::style_file.
Referenced by main().
|
static |
Definition at line 90 of file tests/styles.c.
References extension(), and IS_NULL_PTR.
Referenced by run_style_scenario().
|
static |
Definition at line 98 of file tests/styles.c.
References darktable, darktable_t::db, dt_database_get(), and value.
Referenced by compare_enabled_state(), and compare_pipe_order().
|
static |
Definition at line 76 of file tests/styles.c.
References IS_NULL_PTR.
Referenced by apply_style_to_image(), compare_enabled_state(), compare_pipe_order(), load_xmp_on_image(), and run_style_scenario().
|
static |
Run style-application scenarios from tests/styles.
Each *.dtstyle file defines one scenario. The basename of the style file is used to find start_<style>.xmp and end_<style>.xmp. The start sidecar is optional: if it is missing, the runner keeps the raw import history. The end sidecar is required and provides the expected history after applying the style.
The comparison is intentionally limited to the resulting pipe order and final enabled states. The history stack can legitimately differ after a merge, so the enabled-state check only looks at the last active history item for each module instance.
Definition at line 60 of file tests/styles.c.
Referenced by create_test_image(), and main().