From c42b864654d766a12b12a10e8105158467440957 Mon Sep 17 00:00:00 2001 From: Ran Benita Date: Tue, 14 Oct 2014 11:47:25 +0300 Subject: [PATCH] test/compose: test include statement Signed-off-by: Ran Benita --- test/compose.c | 37 +++++++++++++++++++++++++++++++++++++ 1 file changed, 37 insertions(+) diff --git a/test/compose.c b/test/compose.c index b8a004f..9bbef18 100644 --- a/test/compose.c +++ b/test/compose.c @@ -469,6 +469,42 @@ test_modifier_syntax(struct xkb_context *ctx) fprintf(stderr, "\n"); } +static void +test_include(struct xkb_context *ctx) +{ + char *path, *table_string; + int ret; + + path = test_get_path("compose/en_US.UTF-8/Compose"); + assert(path); + + /* We don't have a mechanism to change the include paths like we + * have for keymaps. So we must include the full path. */ + ret = asprintf(&table_string, + " : \"foo\" X\n" + "include \"%s\"\n" + " : \"bar\" Y\n", path); + assert(ret >= 0); + + assert(test_compose_seq_buffer(ctx, table_string, + /* No conflict. */ + XKB_KEY_dead_acute, XKB_COMPOSE_FEED_ACCEPTED, XKB_COMPOSE_COMPOSING, "", XKB_KEY_NoSymbol, + XKB_KEY_dead_acute, XKB_COMPOSE_FEED_ACCEPTED, XKB_COMPOSE_COMPOSED, "´", XKB_KEY_acute, + + /* Comes before - doesn't override. */ + XKB_KEY_dead_tilde, XKB_COMPOSE_FEED_ACCEPTED, XKB_COMPOSE_COMPOSING, "", XKB_KEY_NoSymbol, + XKB_KEY_space, XKB_COMPOSE_FEED_ACCEPTED, XKB_COMPOSE_COMPOSED, "~", XKB_KEY_asciitilde, + + /* Comes after - does override. */ + XKB_KEY_dead_tilde, XKB_COMPOSE_FEED_ACCEPTED, XKB_COMPOSE_COMPOSING, "", XKB_KEY_NoSymbol, + XKB_KEY_dead_tilde, XKB_COMPOSE_FEED_ACCEPTED, XKB_COMPOSE_COMPOSED, "bar", XKB_KEY_Y, + + XKB_KEY_NoSymbol)); + + free(path); + free(table_string); +} + int main(int argc, char *argv[]) { @@ -482,6 +518,7 @@ main(int argc, char *argv[]) test_XCOMPOSEFILE(ctx); test_state(ctx); test_modifier_syntax(ctx); + test_include(ctx); xkb_context_unref(ctx); return 0; -- 2.7.4