Ansel 0.0
A darktable fork - bloat + design vision
Loading...
Searching...
No Matches
test_accel_build_path.c
Go to the documentation of this file.
1/*
2 This file is part of Ansel,
3 Copyright (C) 2026 Guillaume Stutin.
4
5 Ansel is free software: you can redistribute it and/or modify
6 it under the terms of the GNU General Public License as published by
7 the Free Software Foundation, either version 3 of the License, or
8 (at your option) any later version.
9
10 Ansel is distributed in the hope that it will be useful,
11 but WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 GNU General Public License for more details.
14
15 You should have received a copy of the GNU General Public License
16 along with Ansel. If not, see <http://www.gnu.org/licenses/>.
17*/
18
29#include <glib.h>
30
31#include <stdarg.h>
32#include <stddef.h>
33// cmocka.h declares `extern jmp_buf global_expect_assert_env' at file scope without including
34// <setjmp.h> itself. Same suppression as the other tests here, and for the same reason.
35#include <setjmp.h> // NOLINT(misc-include-cleaner)
36#include <stdint.h>
37#include <cmocka.h>
38
39#include "system/mem_alloc.h" // dt_free
41
42#ifdef _WIN32
43#include "win/main_wrapper.h"
44#endif
45
48{
49 gchar *path = dt_accels_build_path("Lighttable/Toolboxes", "Date/heure et GPS");
50 assert_string_equal(path, "<Ansel>/Lighttable/Toolboxes/Date-heure et GPS");
51 dt_free(path);
52}
53
55static void _the_scope_keeps_its_levels(void **state __attribute__((unused)))
56{
57 gchar *path = dt_accels_build_path("Darkroom/Modules/Instances", "Exposure");
58 assert_string_equal(path, "<Ansel>/Darkroom/Modules/Instances/Exposure");
59 dt_free(path);
60}
61
65{
66 gchar *module_path = dt_accels_build_path("Darkroom/Modules/Instances", "Tone/curve");
67 gchar *path = dt_accels_build_path(module_path, "sky/ground");
68 assert_string_equal(module_path, "<Ansel>/Darkroom/Modules/Instances/Tone-curve");
69 assert_string_equal(path, "<Ansel>/Darkroom/Modules/Instances/Tone-curve/sky-ground");
70 dt_free(path);
71 dt_free(module_path);
72}
73
74int main(int argc, char *argv[])
75{
76 const struct CMUnitTest tests[] = {
78 cmocka_unit_test(_the_scope_keeps_its_levels),
80 };
81
82 return cmocka_run_group_tests(tests, NULL, NULL);
83}
84
85// clang-format off
86// modelines: These editor modelines have been set for all relevant files by tools/update_modelines.py
87// vim: shiftwidth=2 expandtab tabstop=2 cindent
88// kate: tab-indents: off; indent-width 2; replace-tabs on; indent-mode cstyle; remove-trailing-spaces modified;
89// clang-format on
gchar * dt_accels_build_path(const gchar *scope, const gchar *feature)
Build the accel path of feature under scope.
Handle default and user-set shortcuts (accelerators)
#define dt_free(ptr)
g_free() ptr and set it to NULL, skipping both if it is already NULL.
Definition mem_alloc.h:171
int main()
Definition prova.c:47
float dt_aligned_pixel_simd_t __attribute__((vector_size(16), aligned(16)))
Apply one channel's tone curve to each of the three colour channels, or pass the channel through unto...
Definition simd.h:55
const float uint32_t state[4]
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)))
static void _a_slash_in_the_feature_stays_one_level(void **state __attribute__((unused)))