feat: add XKB layout indicator, live X11 session replace, and ANODE WM/DE identity
This commit is contained in:
1 parent
8d6236a63f
commit
158345c168
12 files changed
+1303
-48
No files matched your search
@@ -12,6 +12,7 @@
|
||||
#include "anode_wifi_list.h"
|
||||
#include "anode_bt_list.h"
|
||||
#include "anode_power_policy.h"
|
||||
#include "anode_xkb_parse.h"
|
||||
#include "anode-touch-gesture.h"
|
||||
|
||||
static void test_scale_math(void) {
|
||||
@@ -180,6 +181,50 @@ static void test_power_policy_and_gestures(void) {
|
||||
assert(anode_touch_finish(&tr, 1750, 500, 3200, 1920, 1080, 1.0) == ANODE_GEST_CONTROL);
|
||||
}
|
||||
|
||||
static void test_xkb_layout_parser(void) {
|
||||
char buf[16];
|
||||
|
||||
assert(anode_xkb_layout_from_symbols("pc+us+inet(evdev)", 0, buf, sizeof(buf)));
|
||||
assert(strcmp(buf, "us") == 0);
|
||||
|
||||
const char *multi = "pc+us+de(nodeadkeys):2+ru(phonetic):3+inet(evdev)+group(alt_shift_toggle)";
|
||||
assert(anode_xkb_layout_from_symbols(multi, 0, buf, sizeof(buf)));
|
||||
assert(strcmp(buf, "us") == 0);
|
||||
assert(anode_xkb_layout_from_symbols(multi, 1, buf, sizeof(buf)));
|
||||
assert(strcmp(buf, "de") == 0);
|
||||
assert(anode_xkb_layout_from_symbols(multi, 2, buf, sizeof(buf)));
|
||||
assert(strcmp(buf, "ru") == 0);
|
||||
assert(!anode_xkb_layout_from_symbols(multi, 3, buf, sizeof(buf)));
|
||||
|
||||
assert(anode_xkb_layout_from_symbols("pc+US(intl)+FR(oss):2+inet(evdev)", 0, buf, sizeof(buf)));
|
||||
assert(strcmp(buf, "us") == 0);
|
||||
assert(anode_xkb_layout_from_symbols("pc+US(intl)+FR(oss):2+inet(evdev)", 1, buf, sizeof(buf)));
|
||||
assert(strcmp(buf, "fr") == 0);
|
||||
|
||||
assert(anode_xkb_layout_from_symbols("pc+nec_vndr/jp+sun_vndr/us:2+inet(evdev)", 0, buf, sizeof(buf)));
|
||||
assert(strcmp(buf, "jp") == 0);
|
||||
assert(anode_xkb_layout_from_symbols("pc+nec_vndr/jp+sun_vndr/us:2+inet(evdev)", 1, buf, sizeof(buf)));
|
||||
assert(strcmp(buf, "us") == 0);
|
||||
|
||||
assert(anode_xkb_layout_from_symbols("pc+eurosign(e):2+ua:2+inet(evdev)", 1, buf, sizeof(buf)));
|
||||
assert(strcmp(buf, "ua") == 0);
|
||||
|
||||
static const unsigned char rules_prop[] = "evdev\0pc105\0US,de,UA\0,nodeadkeys,\0grp:alt_shift_toggle\0";
|
||||
assert(anode_xkb_layout_from_rules_prop(rules_prop, sizeof(rules_prop), 0, buf, sizeof(buf)));
|
||||
assert(strcmp(buf, "us") == 0);
|
||||
assert(anode_xkb_layout_from_rules_prop(rules_prop, sizeof(rules_prop), 1, buf, sizeof(buf)));
|
||||
assert(strcmp(buf, "de") == 0);
|
||||
assert(anode_xkb_layout_from_rules_prop(rules_prop, sizeof(rules_prop), 2, buf, sizeof(buf)));
|
||||
assert(strcmp(buf, "ua") == 0);
|
||||
assert(!anode_xkb_layout_from_rules_prop(rules_prop, sizeof(rules_prop), 3, buf, sizeof(buf)));
|
||||
|
||||
assert(anode_xkb_layout_from_group_name("English (US)", buf, sizeof(buf)));
|
||||
assert(strcmp(buf, "en") == 0);
|
||||
assert(anode_xkb_layout_from_group_name("Russian", buf, sizeof(buf)));
|
||||
assert(strcmp(buf, "ru") == 0);
|
||||
assert(!anode_xkb_layout_from_group_name("!!!", buf, sizeof(buf)));
|
||||
}
|
||||
|
||||
static void test_platform_probe(void) {
|
||||
anode_net_iface_t ifs[ANODE_MAX_IFACES];
|
||||
int n = anode_list_net_ifaces(ifs, ANODE_MAX_IFACES);
|
||||
@@ -201,6 +246,7 @@ int main(void) {
|
||||
test_audio_parsers();
|
||||
test_wifi_and_bt_parsers();
|
||||
test_power_policy_and_gestures();
|
||||
test_xkb_layout_parser();
|
||||
test_platform_probe();
|
||||
printf("test_units: ALL PASSED\n");
|
||||
return 0;
|
||||
|
||||
Reference in new issue
Block a user