test: add test for variant inheritance of ISO 639/3166 codes See efa99624320f54e6e1ff24e4c4b1fcecdfba43d5
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45
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);
}