56#define XDG_KEY "XDG_CACHE_HOME"
62#define FAKE_ABSOLUTE_DIR G_DIR_SEPARATOR_S "nonexistent-ansel-test" G_DIR_SEPARATOR_S "xdg-cache-home"
71 const gchar *current = g_getenv(
XDG_KEY);
97 assert_string_equal(got, expected);
111 assert_non_null(got);
112 assert_true(g_path_is_absolute(got));
113 assert_string_not_equal(got, G_DIR_SEPARATOR_S
"ansel");
126 assert_non_null(got);
127 assert_true(g_path_is_absolute(got));
128 assert_null(strstr(got,
"relative-cache"));
138 assert_non_null(got);
139 assert_true(g_path_is_absolute(got));
147 const gchar *local_app_data = g_getenv(
"LOCALAPPDATA");
148 if(
IS_NULL_PTR(local_app_data) || !local_app_data[0]) local_app_data = g_get_user_data_dir();
149 gchar *base = g_strdup(local_app_data);
151 gchar *base = g_build_filename(g_get_home_dir(),
".cache", NULL);
153 assert_non_null(base);
154 assert_true(g_str_has_prefix(got, base));
159 assert_null(strstr(got,
"INetCache"));
160 assert_null(strstr(got,
"Temporary Internet Files"));
175 assert_non_null(first);
176 assert_non_null(second);
177 assert_ptr_not_equal(first, second);
178 assert_string_equal(first, second);
184int main(
int argc,
char *argv[])
189 const struct CMUnitTest tests[] = {
gchar * dt_loc_default_user_cache_dir(void)
Resolve the default user cache directory the way dt_loc_init_user_cache_dir() does,...
#define IS_NULL_PTR(p)
C is way too permissive with !=, == and if(var) checks, which can mean too many things depending on w...
#define dt_free(ptr)
g_free() ptr and set it to NULL, skipping both if it is already NULL.
const float uint32_t state[4]
#define FAKE_ABSOLUTE_DIR
static gchar * _saved_xdg
static void _a_relative_xdg_is_ignored(void **state G_GNUC_UNUSED)
static int _setup(void **state G_GNUC_UNUSED)
static void _the_default_is_not_a_shell_managed_temporary_folder(void **state G_GNUC_UNUSED)
static int _teardown(void **state G_GNUC_UNUSED)
static void _an_empty_xdg_is_ignored(void **state G_GNUC_UNUSED)
static void _every_call_answers_the_same(void **state G_GNUC_UNUSED)
static void _xdg_cache_home_wins(void **state G_GNUC_UNUSED)