Ansel 0.0
A darktable fork - bloat + design vision
Loading...
Searching...
No Matches
test_history_snapshot.c File Reference
#include "develop/develop.h"
#include "develop/dev_history.h"
#include "develop/pixelpipe_hb.h"
#include "system/atomic.h"
#include "system/dtpthread.h"
#include <glib.h>
#include <stdarg.h>
#include <stddef.h>
#include <stdlib.h>
#include <setjmp.h>
#include <stdint.h>
#include <cmocka.h>
+ Include dependency graph for test_history_snapshot.c:

Go to the source code of this file.

Data Structures

struct  _fixture_t
 

Typedefs

typedef struct _fixture_t _fixture_t
 

Functions

static int _setup (void **state)
 
static int _teardown (void **state)
 
static int _refs (const dt_dev_history_item_t *item)
 
static dt_dev_history_item_t * _append (dt_develop_t *dev, const uint64_t hash)
 
static void _a_snapshot_references_every_item_and_releases_them (void **state)
 
static void _history_end_is_clamped_to_the_list_at_snapshot_time (void **state)
 
static void _cow_touch_leaves_an_exclusively_owned_item_alone (void **state)
 
static void _cow_touch_clones_an_item_a_snapshot_is_holding (void **state)
 
static void _cow_touch_repoints_the_pipe_marker_and_balances_every_reference (void **state)
 
static void _cow_touch_ignores_a_marker_naming_a_different_item (void **state)
 
static void _transient_params_serial_advances_with_every_publication (void **state)
 A transient publication must be distinguishable from the one before it.
 
int main (void)
 

Typedef Documentation

◆ _fixture_t

Function Documentation

◆ _a_snapshot_references_every_item_and_releases_them()

◆ _append()

◆ _cow_touch_clones_an_item_a_snapshot_is_holding()

◆ _cow_touch_ignores_a_marker_naming_a_different_item()

◆ _cow_touch_leaves_an_exclusively_owned_item_alone()

static void _cow_touch_leaves_an_exclusively_owned_item_alone ( void **  state)
static

Definition at line 148 of file test_history_snapshot.c.

References _append(), _refs(), dt_dev_history_cow_touch(), f, L, and state.

Referenced by main().

◆ _cow_touch_repoints_the_pipe_marker_and_balances_every_reference()

◆ _history_end_is_clamped_to_the_list_at_snapshot_time()

static void _history_end_is_clamped_to_the_list_at_snapshot_time ( void **  state)
static

◆ _refs()

◆ _setup()

static int _setup ( void **  state)
static

Definition at line 55 of file test_history_snapshot.c.

References dt_pthread_mutex_init(), dt_pthread_rwlock_init(), f, L, and state.

Referenced by main().

◆ _teardown()

static int _teardown ( void **  state)
static

◆ _transient_params_serial_advances_with_every_publication()

static void _transient_params_serial_advances_with_every_publication ( void **  state)
static

A transient publication must be distinguishable from the one before it.

This pins the invariant a realtime module's whole feedback loop rests on, and it is pinned here because nothing else can see it. dt_iop_commit_params() hands the params it is given to module->commit_params() but derives the piece's cache identity from dt_iop_compute_module_hash(), which hashes module->params instead – so a transient edit changes the pixels a recompute would produce WITHOUT changing the hash that decides whether to recompute at all. _sync_focused_in_place() closes that by folding this serial into piece->hash, which only works if the serial actually advances per publication and arrives with the blob it describes.

When this broke, a drawn stroke appeared only after the brush was lifted, every unit test passed, three build configurations were clean, and the log said nothing: the pipe reported success 122 times while exact-hitting the cache. The cost of not having this test was a user-visible regression that only a drawing session could catch.

Definition at line 277 of file test_history_snapshot.c.

References dt_iop_module_t::dev, dt_dev_transient_params_get(), dt_dev_transient_params_set(), f, L, out, params, and state.

Referenced by main().

◆ main()