Debian Codegraph @

dojox/string/tests/BidiEngine/BidiEngineTestLayouts.js

raw symbols SCIP
1 define(["doh/runner", "dojox/string/BidiEngine"], function(doh, BidiEngine) {
2
3 var unilisrc = [
4 "11"
5 ];
6
7 var bdEngine;
8 var errorMessage = "dojox/string/BidiEngine: the bidi layout string is wrong!";
9
10 doh.register('BidiEngine Parameters Test', [
11 {
12 name:'1. test empty',
13 setUp: function() {
14 bdEngine = new BidiEngine();
15 },
16 runTest:function() {
17 dojo.forEach(unilisrc, function(el, i){
18 doh.is('', bdEngine.bidiTransform(''), "empty string.");
19 },this);
20 }
21 },
22 {
23 name:'2. empty format string.',
24 runTest:function() {
25 dojo.forEach(unilisrc, function(el, i){
26 doh.is(unilisrc[i], bdEngine.bidiTransform(el, '', ''), "default bidi layouts");
27 },this);
28 }
29 },
30 {
31 name:'3. empty output format',
32 runTest:function() {
33 dojo.forEach(unilisrc, function(el, i) {
34 doh.is(unilisrc[i], bdEngine.bidiTransform(el, 'ILYNN'), "output format empty");
35 try{
36 bdEngine.set("outputFormat", "");
37 throw new Error("Didn't threw error!!");
38 }catch(e) {
39 doh.is(errorMessage, e.message, "should throw wrong format message!");
40 }
41 },this);
42 }
43 },
44 {
45 name:'4. empty input format.',
46 runTest:function() {
47 dojo.forEach(unilisrc, function(el, i) {
48 doh.is(unilisrc[i], bdEngine.bidiTransform(el, '', 'ILYNN'), "input format empty");
49 try{
50 bdEngine.set("inputFormat", "");
51 throw new Error("Didn't threw error!!");
52 }catch(e){
53 doh.is(errorMessage, e.message, "should throw wrong format message!");
54 }
55 },this);
56 }
57 },
58 {
59 name:'5. wrong layouts.',
60 runTest:function() {
61 dojo.forEach(unilisrc, function(el, i) {
62 try{
63 doh.is(unilisrc[i], bdEngine.bidiTransform(el, 'V', 'I'), "wrong bidi layouts");
64 throw new Error("Didn't threw error!!");
65 }catch(e) {
66 doh.is(errorMessage, e.message, "should throw wrong format message!");
67 }
68 },this);
69 }
70 },
71 {
72 name:'6. Test first letter.',
73 runTest:function() {
74 dojo.forEach(unilisrc, function(el, i) {
75 try{
76 doh.is(unilisrc[i], bdEngine.bidiTransform(el, 'KLYNN', 'ILNNN'), "wrong first letter (input)");
77 throw new Error("Didn't threw error!!");
78 }catch(e){
79 doh.is(errorMessage, e.message, "should throw wrong format message!");
80 }
81 },this);
82 }
83 },
84 {
85 name:'7. Test first letter.',
86 runTest:function() {
87 dojo.forEach(unilisrc, function(el, i) {
88 try{
89 doh.is(unilisrc[i], bdEngine.bidiTransform(el, 'VLYNN', 'KLNNN'), "wrong first letter (output)");
90 throw new Error("Didn't threw error!!");
91 }catch(e) {
92 doh.is(errorMessage, e.message, "should throw wrong format message!");
93 }
94 },this);
95 }
96 },
97 {
98 name:'8. Test second letter.',
99 runTest:function() {
100 dojo.forEach(unilisrc, function(el, i) {
101 try{
102 doh.is(unilisrc[i], bdEngine.bidiTransform(el, 'VKYNN', 'ILNNN'), "wrong second letter (input)");
103 throw new Error("Didn't threw error!!");
104 }catch(e) {
105 doh.is(errorMessage, e.message, "should throw wrong format message!");
106 }
107 },this);
108 }
109 },
110 {
111 name:'9. Test second letter.',
112 runTest:function() {
113 dojo.forEach(unilisrc, function(el, i) {
114 try{
115 doh.is(unilisrc[i], bdEngine.bidiTransform(el, 'VRYNN', 'IKNNN'), "wrong second letter (output)");
116 throw new Error("Didn't threw error!!");
117 }catch(e) {
118 doh.is(errorMessage, e.message, "should throw wrong format message!");
119 }
120 },this);
121 }
122 },
123 {
124 name:'10. Test third letter.',
125 runTest:function() {
126 dojo.forEach(unilisrc, function(el, i) {
127 try{
128 doh.is(unilisrc[i], bdEngine.bidiTransform(el, 'VRSNN', 'IRNNN'), "wrong third letter (input)");
129 throw new Error("Didn't threw error!!");
130 }catch(e) {
131 doh.is(errorMessage, e.message, "should throw wrong format message!");
132 }
133 },this);
134 }
135 },
136 {
137 name:'11. Test third letter.',
138 runTest:function() {
139 dojo.forEach(unilisrc, function(el, i) {
140 try{
141 doh.is(unilisrc[i], bdEngine.bidiTransform(el, 'VRYNN', 'IRLNN'), "wrong third letter (output)");
142 throw new Error("Didn't threw error!!");
143 }catch(e) {
144 doh.is(errorMessage, e.message,"should throw wrong format message!");
145 }
146 },this);
147 }
148 },
149 {
150 name:'12. Test fourth letter.',
151 runTest:function() {
152 dojo.forEach(unilisrc, function(el, i) {
153 try{
154 doh.is(unilisrc[i], bdEngine.bidiTransform(el, 'VRSNN', 'IRNNN'), "wrong forth letter (input)");
155 throw new Error("Didn't threw error!!");
156 }catch(e) {
157 doh.is(errorMessage, e.message, "should throw wrong format message!");
158 }
159 },this);
160 }
161 },
162 {
163 name:'13. Test fourth letter.',
164 runTest:function() {
165 dojo.forEach(unilisrc, function(el, i) {
166 try{
167 doh.is(unilisrc[i], bdEngine.bidiTransform(el, 'VRYNN', 'IRSNN'), "wrong forth letter (output)");
168 throw new Error("Didn't threw error!!");
169 }catch(e) {
170 doh.is(errorMessage, e.message,"should throw wrong format message!");
171 }
172 },this);
173 }
174 },
175 {
176 name:'14. Test fifth letter.',
177 runTest:function() {
178 dojo.forEach(unilisrc, function(el, i) {
179 try{
180 doh.is(unilisrc[i], bdEngine.bidiTransform(el, 'VRYNA', 'IRCNN'), "wrong fifth letter (input)");
181 throw new Error("Didn't threw error!!");
182 }catch(e) {
183 doh.is(errorMessage, e.message, "should throw wrong format message!");
184 }
185 },this);
186 }
187 },
188 {
189 name:'15. Test fifth letter.',
190 runTest:function() {
191 dojo.forEach(unilisrc, function(el, i) {
192 try{
193 doh.is(unilisrc[i], bdEngine.bidiTransform(el, 'VRYNN', 'ICNNA'), "wrong fifth letter (output)");
194 throw new Error("Didn't threw error!!");
195 }catch(e) {
196 doh.is(errorMessage, e.message, "should throw wrong format message!");
197 }
198 },this);
199 }
200 },
201 {
202 name:'16. Too much letters.',
203 runTest:function() {
204 dojo.forEach(unilisrc, function(el, i) {
205 try{
206 doh.is(unilisrc[i], bdEngine.bidiTransform(el, 'VRYNNN', 'IDYNN'), "too much letters (input)");
207 throw new Error("Didn't threw error!!");
208 }catch(e) {
209 doh.is(errorMessage, e.message, "should throw wrong format message!");
210 }
211 },this);
212 }
213 },
214 {
215 name:'16. Too much letters.',
216 runTest:function() {
217 dojo.forEach(unilisrc, function(el, i) {
218 try{
219 doh.is(unilisrc[i], bdEngine.bidiTransform(el, 'VRYNN', 'ICYNNN'), "too much letters (output)");
220 throw new Error("Didn't threw error!!");
221 }catch(e) {
222 doh.is(errorMessage, e.message, "should throw wrong format message!");
223 }
224 },this);
225 }
226 },
227 {
228 name:'17. Good formats.',
229 runTest:function() {
230 dojo.forEach(unilisrc, function(el, i){
231 doh.is(unilisrc[i], bdEngine.bidiTransform(el, 'ILNNN', 'ILNNN'),"good formats");
232 doh.is(unilisrc[i], bdEngine.bidiTransform(el, 'VLNNN', 'ILNNN'),"good formats");
233 doh.is(unilisrc[i], bdEngine.bidiTransform(el, 'IRNNN', 'ILNNN'),"good formats");
234 doh.is(unilisrc[i], bdEngine.bidiTransform(el, 'VRNNN', 'ILNNN'),"good formats");
235 doh.is(unilisrc[i], bdEngine.bidiTransform(el, 'ICNNN', 'ILNNN'),"good formats");
236 doh.is(unilisrc[i], bdEngine.bidiTransform(el, 'IDNNN', 'ILNNN'),"good formats");
237
238 doh.is(unilisrc[i], bdEngine.bidiTransform(el, 'ILYNN', 'ILNNN'),"good formats");
239 doh.is(unilisrc[i], bdEngine.bidiTransform(el, 'VLYNN', 'ILNNN'),"good formats");
240 doh.is(unilisrc[i], bdEngine.bidiTransform(el, 'IRYNN', 'ILNNN'),"good formats");
241 doh.is(unilisrc[i], bdEngine.bidiTransform(el, 'VRYNN', 'ILNNN'),"good formats");
242 doh.is(unilisrc[i], bdEngine.bidiTransform(el, 'ICYNN', 'ILNNN'),"good formats");
243 doh.is(unilisrc[i], bdEngine.bidiTransform(el, 'IDYNN', 'ILNNN'),"good formats");
244
245 doh.is(unilisrc[i], bdEngine.bidiTransform(el, 'ILYSN', 'ILNNN'),"good formats");
246 doh.is(unilisrc[i], bdEngine.bidiTransform(el, 'VLYSN', 'ILNNN'),"good formats");
247 doh.is(unilisrc[i], bdEngine.bidiTransform(el, 'IRYSN', 'ILNNN'),"good formats");
248 doh.is(unilisrc[i], bdEngine.bidiTransform(el, 'VRYSN', 'ILNNN'),"good formats");
249 doh.is(unilisrc[i], bdEngine.bidiTransform(el, 'ICYSN', 'ILNNN'),"good formats");
250 doh.is(unilisrc[i], bdEngine.bidiTransform(el, 'IDYSN', 'ILNNN'),"good formats");
251
252 doh.is(unilisrc[i], bdEngine.bidiTransform(el, 'ILNSN', 'ILNNN'),"good formats");
253 doh.is(unilisrc[i], bdEngine.bidiTransform(el, 'VLNSN', 'ILNNN'),"good formats");
254 doh.is(unilisrc[i], bdEngine.bidiTransform(el, 'IRNSN', 'ILNNN'),"good formats");
255 doh.is(unilisrc[i], bdEngine.bidiTransform(el, 'VRNSN', 'ILNNN'),"good formats");
256 doh.is(unilisrc[i], bdEngine.bidiTransform(el, 'ICNSN', 'ILNNN'),"good formats");
257 doh.is(unilisrc[i], bdEngine.bidiTransform(el, 'IDNSN', 'ILNNN'),"good formats");
258 },this);
259 }
260 }
261 ]);
262
263 });