fix: repair XIM context lifecycle
This commit is contained in:
38
tests/xim_test.c
Normal file
38
tests/xim_test.c
Normal file
@@ -0,0 +1,38 @@
|
||||
#include <assert.h>
|
||||
#include <stddef.h>
|
||||
#include <stdint.h>
|
||||
#include <xkbcommon/xkbcommon-keysyms.h>
|
||||
#include "../xim/keymap.h"
|
||||
|
||||
enum
|
||||
{
|
||||
ShiftMask = 1<<0,
|
||||
LockMask = 1<<1,
|
||||
Group1 = 1<<13,
|
||||
};
|
||||
|
||||
int
|
||||
main(void)
|
||||
{
|
||||
static const uint32_t letters[] = {
|
||||
XKB_KEY_a, XKB_KEY_A, XKB_KEY_Cyrillic_ef, XKB_KEY_Cyrillic_EF,
|
||||
};
|
||||
static const uint32_t inferred[] = { XKB_KEY_a, XKB_KEY_NoSymbol };
|
||||
static const uint32_t punctuation[] = { XKB_KEY_1, XKB_KEY_exclam };
|
||||
static const uint32_t missing[] = {
|
||||
XKB_KEY_a, XKB_KEY_A, XKB_KEY_NoSymbol, XKB_KEY_NoSymbol,
|
||||
};
|
||||
|
||||
assert(keymaplookup(letters, 4, 0) == XKB_KEY_a);
|
||||
assert(keymaplookup(letters, 4, ShiftMask) == XKB_KEY_A);
|
||||
assert(keymaplookup(letters, 4, LockMask) == XKB_KEY_A);
|
||||
assert(keymaplookup(letters, 4, LockMask|ShiftMask) == XKB_KEY_a);
|
||||
assert(keymaplookup(letters, 4, Group1) == XKB_KEY_Cyrillic_ef);
|
||||
assert(keymaplookup(letters, 4, Group1|ShiftMask) == XKB_KEY_Cyrillic_EF);
|
||||
assert(keymaplookup(inferred, 2, ShiftMask) == XKB_KEY_A);
|
||||
assert(keymaplookup(punctuation, 2, LockMask) == XKB_KEY_1);
|
||||
assert(keymaplookup(punctuation, 2, LockMask|ShiftMask) == XKB_KEY_exclam);
|
||||
assert(keymaplookup(missing, 4, Group1) == XKB_KEY_a);
|
||||
assert(keymaplookup(NULL, 0, 0) == XKB_KEY_NoSymbol);
|
||||
return 0;
|
||||
}
|
||||
Reference in New Issue
Block a user