Skip to content

Commit

Permalink
chore(core): add some more marker tests 🙀
Browse files Browse the repository at this point in the history
- one disabled for now

For #9468
  • Loading branch information
srl295 committed Dec 21, 2023
1 parent 12aa9a5 commit 9d1599d
Show file tree
Hide file tree
Showing 2 changed files with 56 additions and 5 deletions.
36 changes: 36 additions & 0 deletions core/tests/unit/ldml/keyboards/k_008_transform_norm-test.xml
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,18 @@
<!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-test-dot0">
<test name="regex-test-dot0a">
<keystroke key="0" />
<keystroke key="stampy" />
<check result="YES0" />
</test>
<test name="regex-test-0b">
<keystroke key="0" />
<keystroke key="lgtm" />
<check result="YES0" />
</test>
</tests>
<tests name="regex-tests-0">
<!-- none of these should match the transform -->
<test name="regex-test-0-a">
Expand Down Expand Up @@ -244,4 +256,28 @@
<check result="YES8d"/> <!-- TODO-LDML: not FAIL?-->
</test>
</tests>
<tests name="regex-tests-9">
<test name="regex-test-9a">
<keystroke key="9" />
<keystroke key="a" />
<check result="9e\u{0300}\u{0320}"/>
</test>
<test name="regex-test-9b">
<keystroke key="9" />
<keystroke key="a" />
<check result="9e\u{0320}\u{0300}"/>
</test>
<!-- TODO-LDML: not working -->
<!-- <test name="regex-test-9c">
<keystroke key="9" />
<keystroke key="c" />
<check result="YES9c"/>
</test> -->
<test name="regex-test-9d">
<keystroke key="9" />
<keystroke key="d" />
<check result="YES9d"/>
</test>
</tests>

</keyboardTest3>
25 changes: 20 additions & 5 deletions core/tests/unit/ldml/keyboards/k_008_transform_norm.xml
Original file line number Diff line number Diff line change
@@ -1,12 +1,13 @@
<?xml version="1.0" encoding="UTF-8"?>

<!--
from https://github.com/unicode-org/cldr/blob/keyboard-preview/docs/ldml/tr35-keyboards.md#element-transform
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" name="k_008_transform_norm"/>
<info author="srl295" indicator="🙀" layout="qwerty" name="k_008_transform_norm" />

<keys>
<key id="u-0320" output="\u{0320}" /> <!-- ◌̠ -->
Expand All @@ -15,8 +16,8 @@ from https://github.com/unicode-org/cldr/blob/keyboard-preview/docs/ldml/tr35-ke
<key id="nfd" output="e\u{0320}\u{0300}" />
<key id="nfc" output="\u{00E8}\u{0320}" />
<key id="not-nfd" output="e\u{0300}\u{0320}" />
<key id="stampy" output="\m{stampy}" />
<key id="lgtm" output="\m{lgtm}" />
<key id="lgtm" output="\m{lgtm}" /> <!-- \m{1} -->
<key id="stampy" output="\m{stampy}" /> <!-- \m{2}-->
</keys>

<layers formId="us">
Expand All @@ -39,6 +40,9 @@ from https://github.com/unicode-org/cldr/blob/keyboard-preview/docs/ldml/tr35-ke

<transforms type="simple">
<transformGroup>
<!-- 0 = any marker -> YES0 -->
<transform from="0\m{.}" to="YES0" />

<!-- these should NOT match-->
<transform from="e[\u{0300}][\u{0320}]" to="NO0" /> <!-- out of order -->
<!-- these SHOULD match -->
Expand Down Expand Up @@ -71,8 +75,19 @@ from https://github.com/unicode-org/cldr/blob/keyboard-preview/docs/ldml/tr35-ke

<transform from="8e\m{stampy}\u{0300}\m{lgtm}\u{0320}" to="YES8a" />
<transform from="8e\u{0300}\m{stampy}\m{lgtm}\u{0320}" to="YES8b" />
<transform from="8e\u{0300}\u{0320}\m{stampy}\m{lgtm}" to="FAIL" /> <!-- denormalized, does not match -->
<transform from="8e\u{0300}\u{0320}\m{stampy}\m{lgtm}" to="FAIL" /> <!-- denormalized, nomatch -->
<transform from="8e\u{0320}\u{0300}\m{stampy}\m{lgtm}" to="YES8d" /> <!-- NFD -->

<!-- normalization in output -->
<transform from="9a" to="9e\u{0300}\u{0320}" /> <!-- no marker, denormalized -->
<transform from="9b" to="9e\u{0320}\u{0300}" /> <!-- no marker, NFD -->
<transform from="9c" to="9ce\u{0300}\m{stampy}\u{0320}\m{lgtm}" /> <!-- marker, denormalized -->
<transform from="9d" to="9de\u{0320}\m{stampy}\u{0300}\m{lgtm}" /> <!-- marker, NFD -->

</transformGroup>
<transformGroup>
<transform from="9ce\m{stampy}[\u{0320}][\u{0300}]\m{lgtm}" to="YES9c" />
<transform from="9de\u{0320}\m{stampy}\u{0300}\m{lgtm}" to="YES9d" />
</transformGroup>
</transforms>
</keyboard3>

0 comments on commit 9d1599d

Please sign in to comment.