keysyms: Test keypad

master
Pierre Le Marre 2023-12-05 18:23:02 +01:00 committed by Wismill
parent b5a140832b
commit 82305adb51
1 changed files with 14 additions and 0 deletions

View File

@ -103,6 +103,13 @@ test_modifier(xkb_keysym_t ks)
return false; return false;
} }
static bool
test_keypad(xkb_keysym_t ks, char *name)
{
const char prefix[] = "KP_";
return strncmp(prefix, name, sizeof(prefix) - 1) == 0;
}
static int static int
test_string(const char *string, xkb_keysym_t expected) test_string(const char *string, xkb_keysym_t expected)
{ {
@ -271,6 +278,13 @@ main(void)
assert_printf(got == expected, assert_printf(got == expected,
"xkb_keysym_is_modifier(0x%04"PRIx32"): expected %d, got: %d\n", "xkb_keysym_is_modifier(0x%04"PRIx32"): expected %d, got: %d\n",
ks, expected, got); ks, expected, got);
/* Test keypad keysyms */
expected = test_keypad(ks, name);
got = xkb_keysym_is_keypad(ks);
assert_printf(got == expected,
"xkb_keysym_is_keypad(0x%04"PRIx32") \"%s\": "
"expected %d, got: %d\n",
ks, name, expected, got);
} }
iter = xkb_keysym_iterator_unref(iter); iter = xkb_keysym_iterator_unref(iter);
assert(ks_prev == XKB_KEYSYM_MAX_ASSIGNED); assert(ks_prev == XKB_KEYSYM_MAX_ASSIGNED);