diff --git a/core/tests/unit/ldml/keyboards/meson.build b/core/tests/unit/ldml/keyboards/meson.build index fb00cddecd8..4bce343bd30 100644 --- a/core/tests/unit/ldml/keyboards/meson.build +++ b/core/tests/unit/ldml/keyboards/meson.build @@ -11,6 +11,7 @@ tests_from_cldr = [ 'ja-Latn', 'pt-t-k0-abnt2', 'fr-t-k0-azerty', + 'pcm', ] tests_without_testdata = [ diff --git a/core/tests/unit/ldml/ldml_test_source.cpp b/core/tests/unit/ldml/ldml_test_source.cpp index 673f692f1e0..507468efaa1 100644 --- a/core/tests/unit/ldml/ldml_test_source.cpp +++ b/core/tests/unit/ldml/ldml_test_source.cpp @@ -109,10 +109,16 @@ LdmlTestSource::parse_source_string(std::string const &s) { if (*p == '\\') { p++; km_kbp_usv v; + bool had_open_curly = false; assert(p != s.end()); if (*p == 'u' || *p == 'U') { // Unicode value p++; + if (*p == '{') { + p++; + assert(p != s.end()); + had_open_curly = true; + } size_t n; std::string s1 = s.substr(p - s.begin(), 8); v = std::stoul(s1, &n, 16); @@ -125,6 +131,12 @@ LdmlTestSource::parse_source_string(std::string const &s) { t += km_kbp_cp(Uni_UTF32ToSurrogate1(v)); t += km_kbp_cp(Uni_UTF32ToSurrogate2(v)); } + if (had_open_curly) { + p++; + // close what you opened + assert(*p == '}'); // close curly + assert(p != s.end()); + } } else if (*p == 'd') { // Deadkey // TODO, not yet supported @@ -146,10 +158,16 @@ LdmlTestSource::parse_u8_source_string(std::string const &u8s) { if (*p == '\\') { p++; km_kbp_usv v; + bool had_open_curly = false; assert(p != s.end()); if (*p == 'u' || *p == 'U') { // Unicode value p++; + if (*p == '{') { + p++; + assert(p != s.end()); + had_open_curly = true; + } size_t n; std::u16string s1 = s.substr(p - s.begin(), 8); // TODO-LDML: convert back first? @@ -164,6 +182,12 @@ LdmlTestSource::parse_u8_source_string(std::string const &u8s) { t += km_kbp_cp(Uni_UTF32ToSurrogate1(v)); t += km_kbp_cp(Uni_UTF32ToSurrogate2(v)); } + if (had_open_curly) { + p++; + // close what you opened + assert(*p == '}'); // close curly + assert(p != s.end()); + } } else if (*p == 'd') { // Deadkey // TODO, not yet supported diff --git a/resources/standards-data/ldml-keyboards/techpreview/3.0/pcm.xml b/resources/standards-data/ldml-keyboards/techpreview/3.0/pcm.xml new file mode 100644 index 00000000000..5796575ee85 --- /dev/null +++ b/resources/standards-data/ldml-keyboards/techpreview/3.0/pcm.xml @@ -0,0 +1,58 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/resources/standards-data/ldml-keyboards/techpreview/test/pcm-test.xml b/resources/standards-data/ldml-keyboards/techpreview/test/pcm-test.xml new file mode 100644 index 00000000000..88fc500091e --- /dev/null +++ b/resources/standards-data/ldml-keyboards/techpreview/test/pcm-test.xml @@ -0,0 +1,21 @@ + + + + + + + + + + + + + + + + + + + + +