summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPeter Hutterer <peter.hutterer@who-t.net>2022-01-24 11:13:06 +1000
committerRan Benita <ran@unusedvar.com>2022-02-04 12:30:27 +0200
commit1c8ef9e0a5584e883e12a7a59d9b79d21246767d (patch)
tree0b2163dac1133eb72f3ae940206461839e62545c
parentefa99624320f54e6e1ff24e4c4b1fcecdfba43d5 (diff)
downloadxorg-lib-libxkbcommon-1c8ef9e0a5584e883e12a7a59d9b79d21246767d.tar.gz
test: add test for variant inheritance of ISO 639/3166 codes
See efa99624320f54e6e1ff24e4c4b1fcecdfba43d5
-rw-r--r--test/registry.c20
1 files changed, 20 insertions, 0 deletions
diff --git a/test/registry.c b/test/registry.c
index 54313ba..71a480f 100644
--- a/test/registry.c
+++ b/test/registry.c
@@ -685,6 +685,12 @@ test_load_languages(void)
{"l1", "v1", "vbrief1", "vdesc1",
.iso639 = {"efg"},
.iso3166 = {"yz"}},
+ {"l2", NO_VARIANT, "lbrief1", "ldesc1",
+ .iso639 = { "hij", "klm" },
+ .iso3166 = { "op", "qr" }},
+ {"l2", "v2", "lbrief1", "ldesc1",
+ .iso639 = { NULL }, /* inherit from parent */
+ .iso3166 = { NULL }}, /* inherit from parent */
{NULL},
};
struct test_option_group system_groups[] = {
@@ -694,6 +700,8 @@ test_load_languages(void)
};
struct rxkb_context *ctx;
struct rxkb_layout *l;
+ struct rxkb_iso3166_code *iso3166;
+ struct rxkb_iso639_code *iso639;
ctx = test_setup_context(system_models, NULL,
system_layouts, NULL,
@@ -707,6 +715,18 @@ test_load_languages(void)
assert(cmp_layouts(&system_layouts[1], l));
rxkb_layout_unref(l);
+ l = fetch_layout(ctx, "l2", "v2");
+ iso3166 = rxkb_layout_get_iso3166_first(l);
+ assert(streq(rxkb_iso3166_code_get_code(iso3166), "op"));
+ iso3166 = rxkb_iso3166_code_next(iso3166);
+ assert(streq(rxkb_iso3166_code_get_code(iso3166), "qr"));
+
+ iso639 = rxkb_layout_get_iso639_first(l);
+ assert(streq(rxkb_iso639_code_get_code(iso639), "hij"));
+ iso639 = rxkb_iso639_code_next(iso639);
+ assert(streq(rxkb_iso639_code_get_code(iso639), "klm"));
+
+ rxkb_layout_unref(l);
rxkb_context_unref(ctx);
}