| 1 | # A collection of tests related to whether or not it is needed to |
| 2 | # define characters and braille cells (in character definition rules) |
| 3 | # in order to be able to use them in other rules. |
| 4 | # See also https://github.com/liblouis/liblouis/issues/332. |
| 5 | |
| 6 | # A cell in a multi-cell character definition does not need to be defined in its own character definition. |
| 7 | # It works as long as there is a display rule to display the cell in the output... |
| 8 | table: | |
| 9 | display x 2 |
| 10 | sign a 1 |
| 11 | sign b 1-2 |
| 12 | # ... or as long as the cell does not end up in output. |
| 13 | table: | |
| 14 | sign x 3 |
| 15 | sign a 1 |
| 16 | sign b 1-2 |
| 17 | noback pass2 @2 @3 |
| 18 | nofor pass2 @3 @2 |
| 19 | flags: {testmode: bothDirections} |
| 20 | tests: |
| 21 | - - b |
| 22 | - ax |
| 23 | # If a cell ends up in the output and can not be displayed, it results in an error. |
| 24 | # FIXME: use the expectedError flag (https://github.com/liblouis/liblouis/issues/875) |
| 25 | # table: | |
| 26 | # sign a 1 |
| 27 | # sign b 1-2 |
| 28 | # flags: {testmode: forward} |
| 29 | # tests: |
| 30 | # - - b |
| 31 | # - "a " |
| 32 | |
| 33 | # A braille cell used in a begcapsword rule does not need to be previously defined in a character definition rule. |
| 34 | # It works as long as there is a display rule to display the cell in the output... |
| 35 | table: | |
| 36 | display x 2 |
| 37 | lowercase a 1 |
| 38 | base uppercase A a |
| 39 | begcapsword 2 |
| 40 | # ... or as long as the cell does not end up in output. |
| 41 | table: | |
| 42 | sign x 3 |
| 43 | lowercase a 1 |
| 44 | base uppercase A a |
| 45 | begcapsword 2 |
| 46 | noback pass2 @2 @3 |
| 47 | nofor pass2 @3 @2 |
| 48 | flags: {testmode: bothDirections} |
| 49 | tests: |
| 50 | - - AA |
| 51 | - xaa |
| 52 | # If a cell ends up in the output and can not be displayed, it results in an error. |
| 53 | # FIXME: use the expectedError flag (https://github.com/liblouis/liblouis/issues/875) |
| 54 | # table: | |
| 55 | # lowercase a 1 |
| 56 | # base uppercase A a |
| 57 | # begcapsword 2 |
| 58 | # flags: {testmode: forward} |
| 59 | # tests: |
| 60 | # - - AA |
| 61 | # - " aa" |
| 62 | |
| 63 | # Characters or braille cells used in a context rule do not need to be previously defined in character definition rules. |
| 64 | table: | |
| 65 | display x 1 |
| 66 | noback context "a" @1 |
| 67 | nofor context @1 "a" |
| 68 | flags: {testmode: bothDirections} |
| 69 | tests: |
| 70 | - - a |
| 71 | - x |
| 72 | |
| 73 | # A character used in a class or swap name does not need to be previously defined in a character definition rule. |
| 74 | table: | |
| 75 | sign a 1 |
| 76 | sign b 2 |
| 77 | sign c 3 |
| 78 | attribute foo a |
| 79 | swapcd bar b 3 |
| 80 | noback context %foo @3 |
| 81 | noback context %bar %bar |
| 82 | flags: {testmode: forward} |
| 83 | tests: |
| 84 | - - a |
| 85 | - c |
| 86 | - - b |
| 87 | - c |
| 88 | |
| 89 | # A character that is assigned to a class does not need to be previously defined in a character definition rule. |
| 90 | table: | |
| 91 | display x 1 |
| 92 | attribute foo a |
| 93 | noback context %foo @1 |
| 94 | flags: {testmode: forward} |
| 95 | tests: |
| 96 | - - a |
| 97 | - x |
| 98 | |
| 99 | # Characters in a hyphenation pattern do not need to be previously defined in character definition rules. |
| 100 | table: | |
| 101 | letter a 1 |
| 102 | letter b 2 |
| 103 | include issue-332_hyph.dic # a1b |
| 104 | flags: {testmode: hyphenate} |
| 105 | tests: |
| 106 | - - aaabbb |
| 107 | - aaa-bbb |
| 108 | |
| 109 | # Characters or braille cells used in a always rule do not need to be previously defined in character definition rules. |
| 110 | # It works as long as there is a display rule to display the cell in the output... |
| 111 | table: | |
| 112 | display x 2 |
| 113 | always abc 2 |
| 114 | # ... or as long as the cell does not end up in output. |
| 115 | table: | |
| 116 | sign x 3 |
| 117 | always abc 2 |
| 118 | noback pass2 @2 @3 |
| 119 | nofor pass2 @3 @2 |
| 120 | flags: {testmode: bothDirections} |
| 121 | tests: |
| 122 | - - abc |
| 123 | - x |
| 124 | # If a cell ends up in the output and can not be displayed, it results in an error. |
| 125 | # FIXME: use the expectedError flag (https://github.com/liblouis/liblouis/issues/875) |
| 126 | # table: | |
| 127 | # always a 2 |
| 128 | # flags: {testmode: forward} |
| 129 | # tests: |
| 130 | # - - a |
| 131 | # - " " |
| 132 | |
| 133 | # It does not matter whether the first character of the always rule is given an attribute or not (regression test for #1116) |
| 134 | table: | |
| 135 | display x 2 |
| 136 | attribute foo a |
| 137 | always abc 2 |
| 138 | flags: {testmode: bothDirections} |
| 139 | tests: |
| 140 | - - abc |
| 141 | - x |