summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRan Benita <ran234@gmail.com>2014-10-14 10:53:38 +0300
committerRan Benita <ran234@gmail.com>2014-10-14 11:36:00 +0300
commit3f489730d348ee88e4c6efc218df803e6cf90adb (patch)
tree2b3d38dea40eebd437ef7c792e91cd0b33d20e0a
parentc6e63fd71c9a98d46be9e28b26446bab7df71890 (diff)
downloadxorg-lib-libxkbcommon-3f489730d348ee88e4c6efc218df803e6cf90adb.tar.gz
test/compose: test modifier syntax
Signed-off-by: Ran Benita <ran234@gmail.com>
-rw-r--r--test/compose.c46
1 files changed, 46 insertions, 0 deletions
diff --git a/test/compose.c b/test/compose.c
index 8901d16..b8a004f 100644
--- a/test/compose.c
+++ b/test/compose.c
@@ -424,6 +424,51 @@ test_XCOMPOSEFILE(struct xkb_context *ctx)
xkb_compose_table_unref(table);
}
+static void
+test_modifier_syntax(struct xkb_context *ctx)
+{
+ const char *table_string;
+
+ /* We don't do anything with the modifiers, but make sure we can parse
+ * them. */
+
+ assert(test_compose_seq_buffer(ctx,
+ "None <A> : X \n"
+ "! Shift <B> : Y \n"
+ "! Ctrl <C> : Y \n"
+ "! Alt <D> : Y \n"
+ "! Caps <E> : Y \n"
+ "! Lock <F> : Y \n"
+ "! Shift Ctrl <G> : Y \n"
+ "! ~Shift <H> : Y \n"
+ "! ~Shift Ctrl <I> : Y \n"
+ "! Shift ~Ctrl <J> : Y \n"
+ "! Shift ~Ctrl ~Alt <K> : Y \n"
+ "<L> ! Shift <M> : Y \n"
+ "None <N> ! Shift <O> : Y \n"
+ "None <P> ! Shift <Q> : Y \n",
+ XKB_KEY_NoSymbol));
+
+ fprintf(stderr, "<START bad input string>\n");
+ table_string =
+ "! None <A> : X \n"
+ "! Foo <B> : X \n"
+ "None ! Shift <C> : X \n"
+ "! <D> : X \n"
+ "! ~ <E> : X \n"
+ "! ! <F> : X \n"
+ "! Ctrl ! Ctrl <G> : X \n"
+ "<H> ! : X \n"
+ "<I> None : X \n"
+ "None None <J> : X \n"
+ "<K> : !Shift X \n";
+ assert(!xkb_compose_table_new_from_buffer(ctx, table_string,
+ strlen(table_string), "C",
+ XKB_COMPOSE_FORMAT_TEXT_V1,
+ XKB_COMPOSE_COMPILE_NO_FLAGS));
+ fprintf(stderr, "<END bad input string>\n");
+}
+
int
main(int argc, char *argv[])
{
@@ -436,6 +481,7 @@ main(int argc, char *argv[])
test_conflicting(ctx);
test_XCOMPOSEFILE(ctx);
test_state(ctx);
+ test_modifier_syntax(ctx);
xkb_context_unref(ctx);
return 0;