chore(core): Some failing normalization transform tests 🙀

For: #9468
This commit is contained in:
Steven R. Loomis 2023-10-09 18:45:17 -05:00
parent 900fb7d706
commit dcb6796d5b
3 changed files with 211 additions and 0 deletions

View file

@ -0,0 +1,136 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE keyboardTest3 SYSTEM "../../../../../resources/standards-data/ldml-keyboards/techpreview/dtd/ldmlKeyboardTest3.dtd">
<keyboardTest3 conformsTo="techpreview">
<info keyboard="k_008_transform_norm.xml" author="Team Keyboard" name="transform-norm" />
<tests name="regex-tests-0">
<!-- none of these should match the transform -->
<test name="regex-test-0-a">
<startContext to="" />
<keystroke key="e" />
<keystroke key="u-0300" />
<keystroke key="u-0320" />
<check result="e\u{0300}\u{0320}" />
</test>
<test name="regex-test-0-b">
<startContext to="" />
<keystroke key="e" />
<keystroke key="u-0320" />
<keystroke key="u-0300" />
<check result="e\u{0300}\u{0320}" />
</test>
<test name="regex-test-0-c">
<startContext to="" />
<keystroke key="u-00e0" />
<keystroke key="u-0320" />
<check result="e\u{0300}\u{0320}" />
</test>
</tests>
<tests name="regex-tests-1">
<test name="regex-test-1-nfd">
<startContext to="" />
<keystroke key="1" />
<keystroke key="e" />
<keystroke key="u-0300" />
<keystroke key="u-0320" />
<check result="YES1" />
</test>
<test name="regex-test-1-nfd2">
<startContext to="" />
<keystroke key="1" />
<keystroke key="nfd" />
<check result="YES1" />
</test>
<test name="regex-test-1-nfc">
<startContext to="" />
<keystroke key="1" />
<keystroke key="nfc" />
<check result="YES1" />
</test>
<test name="regex-test-1-nfd-ooo">
<startContext to="" />
<keystroke key="1" />
<keystroke key="e" />
<keystroke key="u-0320" />
<keystroke key="u-0300" />
<check result="YES1" />
</test>
<test name="regex-test-1-nfd-ooo2">
<startContext to="" />
<keystroke key="1" />
<keystroke key="not-nfd" />
<check result="YES1" />
</test>
</tests>
<tests name="regex-tests-2">
<test name="regex-test-2-nfd">
<startContext to="" />
<keystroke key="2" />
<keystroke key="e" />
<keystroke key="u-0300" />
<keystroke key="u-0320" />
<check result="YES2" />
</test>
<test name="regex-test-2-nfd2">
<startContext to="" />
<keystroke key="2" />
<keystroke key="nfd" />
<check result="YES2" />
</test>
<test name="regex-test-2-nfc">
<startContext to="" />
<keystroke key="2" />
<keystroke key="nfc" />
<check result="YES2" />
</test>
<test name="regex-test-2-nfd-ooo">
<startContext to="" />
<keystroke key="2" />
<keystroke key="e" />
<keystroke key="u-0320" />
<keystroke key="u-0300" />
<check result="YES2" />
</test>
<test name="regex-test-2-nfd-ooo2">
<startContext to="" />
<keystroke key="2" />
<keystroke key="not-nfd" />
<check result="YES2" />
</test>
</tests>
<tests name="regex-tests-3">
<test name="regex-test-3-nfd">
<startContext to="" />
<keystroke key="3" />
<keystroke key="e" />
<keystroke key="u-0300" />
<keystroke key="u-0320" />
<check result="YES3" />
</test>
<test name="regex-test-3-nfd2">
<startContext to="" />
<keystroke key="3" />
<keystroke key="nfd" />
<check result="YES3" />
</test>
<test name="regex-test-3-nfc">
<startContext to="" />
<keystroke key="3" />
<keystroke key="nfc" />
<check result="YES3" />
</test>
<test name="regex-test-3-nfd-ooo">
<startContext to="" />
<keystroke key="3" />
<keystroke key="e" />
<keystroke key="u-0320" />
<keystroke key="u-0300" />
<check result="YES3" />
</test>
<test name="regex-test-3-nfd-ooo2">
<startContext to="" />
<keystroke key="3" />
<keystroke key="not-nfd" />
<check result="YES3" />
</test>
</tests>
</keyboardTest3>

View file

@ -0,0 +1,74 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--
from https://github.com/unicode-org/cldr/blob/keyboard-preview/docs/ldml/tr35-keyboards.md#element-transform
-->
<!DOCTYPE keyboard3 SYSTEM "../../../../../resources/standards-data/ldml-keyboards/techpreview/dtd/ldmlKeyboard3.dtd">
<keyboard3 locale="en" conformsTo="techpreview">
<info author="srl295" indicator="🙀" layout="qwerty" normalization="NFC" />
<names>
<name value="k_008_transform_norm" />
</names>
<keys>
<key id="u-0320" to="\u{0320}" />
<key id="u-0300" to="\u{0300}" />
<key id="u-00e0" to="\u{00e0}" />
<key id="nfd" to="e\u{0320}\u{0300}" />
<key id="nfc" to="\u{00E0}\u{0320}" />
<key id="not-nfd" to="e\u{0300}\u{0320}" />
</keys>
<layers form="us">
<layer modifier="none" id="base">
<row keys="u-0320 1 2 3 4 5 6 7 8 9 0" />
<row keys="q w e r t y u i o p" />
<row keys="a s d f g h j k l" />
<row keys="z x c v b n m" />
<row keys="space" />
</layer>
<layer modifier="shift" id="shift">
<row keys="u-0300 u-00e0 nfd nfc not-nfd" />
</layer>
</layers>
<variables>
<string id="under" value="\u{0320}" />
<string id="grave" value="\u{0300}" />
</variables>
<transforms type="simple">
<!-- BEGIN pre normalization-->
<transformGroup>
<!-- TODO: NFC to NFD -->
<transform from="\u{00E0}" to="e\u{0300}" />
</transformGroup>
<transformGroup>
<!-- TODO: reorder -->
<transform from="e\u{0300}\u{0320}" to="e\u{0320}\u{0300}"/>
</transformGroup>
<!-- END pre normalization-->
<transformGroup>
<!-- these should NOT match-->
<transform from="e[\u{0300}][\u{0320}]" to="NO0" /> <!-- out of order -->
<!-- these SHOULD match -->
<transform from="1e\u{0300}\u{0320}" to="YES1" /> <!-- out of order but should get normalized -->
<transform from="2e\u{0320}\u{0300}" to="YES2" /> <!-- in order NFD -->
<transform from="3\u{00E0}\u{0320}" to="YES3" /> <!-- in order NFC -->
</transformGroup>
<!-- BEGIN post normalization -->
<transformGroup>
<!-- TODO: NFC to NFD -->
<transform from="\u{00E0}" to="e\u{0300}" />
</transformGroup>
<transformGroup>
<!-- TODO: reorder -->
<transform from="e\u{0300}\u{0320}" to="e\u{0320}\u{0300}"/>
</transformGroup>
<!-- END post normalization -->
</transforms>
</keyboard3>

View file

@ -34,6 +34,7 @@ tests_without_testdata = [
tests_with_testdata = [
'k_001_tiny',
'k_007_transform_rgx',
'k_008_transform_norm',
'k_020_fr', # TODO-LDML: move to cldr above (fix vkey)
'k_200_reorder_nod_Lana',
'k_210_marker',