Ansel 0.0
A darktable fork - bloat + design vision
Loading...
Searching...
No Matches
test_accel_build_path.c File Reference
#include <glib.h>
#include <stdarg.h>
#include <stddef.h>
#include <setjmp.h>
#include <stdint.h>
#include <cmocka.h>
#include "system/mem_alloc.h"
#include "widgets/accelerators.h"
#include "win/main_wrapper.h"
+ Include dependency graph for test_accel_build_path.c:

Go to the source code of this file.

Functions

static void _a_slash_in_the_feature_stays_one_level (void **state __attribute__((unused)))
 
static void _the_scope_keeps_its_levels (void **state __attribute__((unused)))
 
static void _nested_levels_are_built_one_at_a_time (void **state __attribute__((unused)))
 
int main (int argc, char *argv[])
 

Function Documentation

◆ _a_slash_in_the_feature_stays_one_level()

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

The contract of dt_accels_build_path() (widgets/accelerators.c): feature is one level.

Accel paths are built from GUI labels, most of them translated, and "/" is the only structure a path has. The French catalogue translated the geotagging module "Date/heure et GPS", which tripped the assertion that used to forbid a "/" in a module name – in a Debug build only, while a release build silently registered the module one level too deep. A user-typed instance name has no catalogue to review at all. The function now writes a "/" from a label as "-", and these tests pin that, together with the nesting that callers build one level at a time. A "/" in the label stays inside its level.

Definition at line 47 of file test_accel_build_path.c.

References dt_accels_build_path(), and dt_free.

Referenced by main().

◆ _nested_levels_are_built_one_at_a_time()

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

A path built so far is a scope: the root is not repeated, and each level is cleaned on its own – the way a module instance and a module control are nested.

Definition at line 64 of file test_accel_build_path.c.

References dt_accels_build_path(), and dt_free.

Referenced by main().

◆ _the_scope_keeps_its_levels()

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

The scope is a hierarchy: its "/" are levels and are kept.

Definition at line 55 of file test_accel_build_path.c.

References dt_accels_build_path(), and dt_free.

Referenced by main().

◆ main()

int main ( int  argc,
char *  argv[] 
)
Todo:
: test if file with replaced ext exists
Todo:
: add a callback to set the bpp without going through the config
Todo:
: have a parameter in command line to get the export presets

Definition at line 74 of file test_accel_build_path.c.

References _a_slash_in_the_feature_stays_one_level(), _nested_levels_are_built_one_at_a_time(), and _the_scope_keeps_its_levels().