diff options
Diffstat (limited to 'test')
-rw-r--r-- | test/common.c | 16 | ||||
-rw-r--r-- | test/test.h | 1 |
2 files changed, 16 insertions, 1 deletions
diff --git a/test/common.c b/test/common.c index df79272..2ed23cf 100644 --- a/test/common.c +++ b/test/common.c @@ -185,8 +185,22 @@ test_read_file(const char *path_rel) struct xkb_context * test_get_context(enum test_context_flags test_flags) { - struct xkb_context *ctx = xkb_context_new(XKB_CONTEXT_NO_DEFAULT_INCLUDES); + enum xkb_context_flags ctx_flags; + struct xkb_context *ctx; + + ctx_flags = XKB_CONTEXT_NO_DEFAULT_INCLUDES; + if (test_flags & CONTEXT_ALLOW_ENVIRONMENT_NAMES) { + unsetenv("XKB_DEFAULT_RULES"); + unsetenv("XKB_DEFAULT_MODEL"); + unsetenv("XKB_DEFAULT_LAYOUT"); + unsetenv("XKB_DEFAULT_VARIANT"); + unsetenv("XKB_DEFAULT_OPTIONS"); + } + else { + ctx_flags |= XKB_CONTEXT_NO_ENVIRONMENT_NAMES; + } + ctx = xkb_context_new(ctx_flags); if (!ctx) return NULL; diff --git a/test/test.h b/test/test.h index b90bdd9..d3e3f62 100644 --- a/test/test.h +++ b/test/test.h @@ -54,6 +54,7 @@ test_read_file(const char *path_rel); enum test_context_flags { CONTEXT_NO_FLAG = 0, + CONTEXT_ALLOW_ENVIRONMENT_NAMES = (1 << 0), }; struct xkb_context * |