Merge pull request #10791 from keymanapp/chore/core/10505-sample-ldml-kbd

This commit is contained in:
Steven R. Loomis 2024-02-22 16:33:27 -06:00 committed by GitHub
commit fc84ad4e9e
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 77 additions and 1 deletions

View file

@ -4,29 +4,90 @@
<info keyboard="ldml_test.xml" author="srl295" name="test" />
<tests name="separate">
<!-- test direct key output
https://www.unicode.org/reports/tr35/tr35-keyboards.html#element-key -->
<test name="key-1">
<keystroke key="1" />
<check result="1:basic:OK" />
</test>
<!-- test a simple transform
https://www.unicode.org/reports/tr35/tr35-keyboards.html#element-transform -->
<test name="key-2">
<keystroke key="2" />
<check result="2:simple_transform:OK" />
</test>
<!-- test a transform using a marker
https://www.unicode.org/reports/tr35/tr35-keyboards.html#markers -->
<test name="key-3">
<keystroke key="3" />
<check result="3:simple_marker:OK" />
</test>
<!-- test a reorder
https://www.unicode.org/reports/tr35/tr35-keyboards.html#element-reorder -->
<test name="key-4">
<keystroke key="4" />
<check result="4:simple_reorder:OK" />
</test>
<!-- test using variable substitution
https://www.unicode.org/reports/tr35/tr35-keyboards.html#element-string -->
<test name="key-5">
<keystroke key="5" />
<check result="5:simple_vars:OK" />
</test>
<!-- test a mapped variable substitution
https://www.unicode.org/reports/tr35/tr35-keyboards.html#replacement-syntax -->
<test name="key-6">
<keystroke key="6" />
<check result="6:map_var:OK" />
</test>
<!-- test a uset substitution
https://www.unicode.org/reports/tr35/tr35-keyboards.html#element-unicodeset -->
<test name="key-7">
<keystroke key="7" />
<check result="7:simple_uset:OK" />
</test>
<!-- test a different uset substitution
https://www.unicode.org/reports/tr35/tr35-keyboards.html#element-unicodeset -->
<test name="key-shift-7">
<keystroke key="shift-7" />
<check result="7:simple_uset:FAIL" />
</test>
<!-- test pre-existing input context
https://www.unicode.org/reports/tr35/tr35-keyboards.html#test-element-startcontext -->
<test name="key-8">
<startContext to="ABC" />
<keystroke key="8" />
<check result="8:ctxt:OK" />
</test>
<!-- test that the input context is required
https://www.unicode.org/reports/tr35/tr35-keyboards.html#test-element-startcontext -->
<test name="key-8-fail">
<startContext to="" /> <!-- w/o context -->
<keystroke key="8" />
<check result="8:ctxt:FAIL"/>
</test>
<!-- test context with a non-BMP character
https://www.unicode.org/reports/tr35/tr35-keyboards.html#test-element-startcontext -->
<test name="key-8-osage">
<startContext to="𐓏" />
<keystroke key="8" />
<check result="8:ctxt:OK" />
</test>
<!-- test using two pieces of context together with non-BMP chars
https://www.unicode.org/reports/tr35/tr35-keyboards.html#test-element-startcontext -->
<test name="key-8-osage2">
<startContext to="𐒻" />
<keystroke key="shift-8" />
<keystroke key="8" />
<check result="8:ctxt:OK" />
</test>
<!-- test using two markers across two keystrokes
https://www.unicode.org/reports/tr35/tr35-keyboards.html#markers -->
<test name="key-9">
<startContext to="" />
<keystroke key="9" />
<keystroke key="shift-9" />
<check result="9:split_marker:OK" />
</test>
</tests>
</keyboardTest3>

View file

@ -13,6 +13,12 @@
<key id="4" output="4:simple_reorder:UNTIED" />
<key id="5" output="5:simple_vars:${varsok}"/>
<key id="6" output="6:map_var:B\m{map1}X\m{map2}"/>
<key id="7" output="7:simple_uset:FAIL\m{uset7}" /> <!-- will produce OK-->
<key id="shift-7" output="7:simple_uset:OK\m{uset7}" /> <!-- will produce FAIL-->
<key id="8" output="\m{8ctxt}8:ctxt:FAIL" />
<key id="shift-8" output="𐒷" />
<key id="9" output="9:split_marker:FAIL\m{marker1}" />
<key id="shift-9" output="\m{marker2}" />
</keys>
<layers formId="us">
@ -24,7 +30,7 @@
<row keys="space"/>
</layer>
<layer modifiers="shift">
<row keys="tilde bang at hash dollar percent caret amp asterisk open-paren close-paren underscore plus"/>
<row keys="tilde bang at hash dollar percent caret shift-7 shift-8 shift-9 close-paren underscore plus"/>
<row keys="Q W E R T Y U I O P open-curly close-curly pipe"/>
<row keys="A S D F G H J K L colon double-quote"/>
<row keys="Z X C V B N M open-angle close-angle question"/>
@ -54,6 +60,9 @@
<!-- 6: regular and rot13 alphabet -->
<set id="alpha" value="$[alpha1] $[alpha2]"/>
<set id="nycun" value="$[alpha2] $[alpha1]"/> <!-- 'nycun' in rot13 -->
<!-- 7: uset -->
<unicodeSet id="7ok" value="[[A_LIFE]-[E]]" /> <!-- = the chars [FAIL]-->
<unicodeSet id="7notok" value="[[A-Z]-$[7ok]]"/> <!-- everything not in [FAIL]-->
</variables>
<transforms type="simple">
@ -98,16 +107,22 @@
<!-- 6: swap back -->
<transformGroup>
<transform from="($[alpha])\m{map2}($[alpha])\m{map1}" to="$2\m{map1}$1\m{map2}" />
<transform from=":(?:$[7notok])+\m{uset7}" to=":FAIL" />
<transform from=":(?:$[7ok])+\m{uset7}" to=":OK" />
</transformGroup>
<transformGroup>
<transform from="simple_transform:FAIL" to="simple_transform:OK" />
<!-- 3: interpret marker results -->
<transform from="FAIL\m{marker}" to="OK" />
<transform from="FAIL\m{marker1}\m{marker2}" to="OK" />
<!-- 4: interpret reorder results -->
<transform from="UNITED" to="OK" />
<transform from="UNTIED" to="FAIL" />
<!-- 6: if untransformed, BX is a failure. -->
<transform from=":B\m{.}X\m{.}" to=":FAIL"/>
<transform from="ABC\m{8ctxt}(8:ctxt):FAIL" to="$1:OK" />
<transform from="𐓏\m{8ctxt}(8:ctxt):FAIL" to="$1:OK" />
<transform from="𐒻𐒷\m{8ctxt}(8:ctxt):FAIL" to="$1:OK" />
</transformGroup>
</transforms>