source: Dev/trunk/src/client/dojox/string/tests/BidiEngine/BidiEngineTestLayouts.js

Last change on this file was 483, checked in by hendrikvanantwerpen, 11 years ago

Added Dojo 1.9.3 release.

File size: 10.0 KB
Line 
1dojo.provide("dojox.string.tests.BidiEngine.BidiEngineTestLayouts");
2dojo.require("dojox.string.BidiEngine");
3dojo.addOnLoad(function(){
4                       
5        var unilisrc = [
6                "11"
7        ];
8
9        var bdEngine;
10        var errorMessage = "dojox.string.BidiEngine: the bidi layout string is wrong!";
11        doh.register('dojox.string.tests.BidiEngine.BidiEngine', [
12                {       
13                        name:'1. test empty',
14
15                        setUp: function(){
16                                bdEngine = new dojox.string.BidiEngine();
17                        },
18                       
19                        runTest:function() {
20                                dojo.forEach(unilisrc, function(el, i){
21                                        doh.is('', bdEngine.bidiTransform('', 'VLNNN', 'IRYNN'),"empty string.");
22                                },this);
23                        }
24                },
25                {       
26                        name:'2. empty format string.',
27
28                        setUp: function(){
29                                bdEngine = new dojox.string.BidiEngine();
30                        },
31                       
32                        runTest:function() {
33                                dojo.forEach(unilisrc, function(el, i){
34                                        doh.is(unilisrc[i], bdEngine.bidiTransform(el, '', ''),"bidi layouts empty");
35                                },this);
36                        }
37                },
38                {       
39                        name:'3. show error.',
40
41                        setUp: function(){
42                                bdEngine = new dojox.string.BidiEngine();
43                        },
44                       
45                        runTest:function() {
46                                dojo.forEach(unilisrc, function(el, i){
47                                        try{
48                                                doh.is(unilisrc[i], bdEngine.bidiTransform(el, 'ILYNN', ''),"bidi layouts empty");
49                                                throw new Error("Didn't threw error!!");
50                                        }catch(e){
51                                         doh.is(errorMessage, e.message,"should throw wrong format message!");
52                                        }
53                                },this);
54                        }
55                },
56                {       
57                        name:'4. show error.',
58
59                        setUp: function(){
60                                bdEngine = new dojox.string.BidiEngine();
61                        },
62                       
63                        runTest:function() {
64                                dojo.forEach(unilisrc, function(el, i){
65                                        try{
66                                                doh.is(unilisrc[i], bdEngine.bidiTransform(el, '', 'ILYNN'),"bidi layouts empty");
67                                                throw new Error("Didn't threw error!!");
68                                        }catch(e){
69                                         doh.is(errorMessage, e.message,"should throw wrong format message!");
70                                        }
71                                },this);
72                        }
73                },
74                {       
75                        name:'5. show error.',
76
77                        setUp: function(){
78                                bdEngine = new dojox.string.BidiEngine();
79                        },
80                       
81                        runTest:function() {
82                                dojo.forEach(unilisrc, function(el, i){
83                                        try{
84                                                doh.is(unilisrc[i], bdEngine.bidiTransform(el, 'V', 'I'),"bidi layouts empty");
85                                                throw new Error("Didn't threw error!!");
86                                        }catch(e){
87                                         doh.is(errorMessage, e.message,"should throw wrong format message!");
88                                        }
89                                },this);
90                        }
91                },
92                {       
93                        name:'6. Test first letter.',
94
95                        setUp: function(){
96                                bdEngine = new dojox.string.BidiEngine();
97                        },
98                       
99                        runTest:function() {
100                                dojo.forEach(unilisrc, function(el, i){
101                                        try{
102                                                doh.is(unilisrc[i], bdEngine.bidiTransform(el, 'KLYNN', 'ILNNN'),"bidi layouts empty");
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:'7. Test first letter.',
112
113                        setUp: function(){
114                                bdEngine = new dojox.string.BidiEngine();
115                        },
116                       
117                        runTest:function() {
118                                dojo.forEach(unilisrc, function(el, i){
119                                        try{
120                                                doh.is(unilisrc[i], bdEngine.bidiTransform(el, 'VLYNN', 'KLNNN'),"bidi layouts empty");
121                                                throw new Error("Didn't threw error!!");
122                                        }catch(e){
123                                         doh.is(errorMessage, e.message,"should throw wrong format message!");
124                                        }
125                                },this);
126                        }
127                },
128                {       
129                        name:'8. Test second letter.',
130
131                        setUp: function(){
132                                bdEngine = new dojox.string.BidiEngine();
133                        },
134                       
135                        runTest:function() {
136                                dojo.forEach(unilisrc, function(el, i){
137                                        try{
138                                                doh.is(unilisrc[i], bdEngine.bidiTransform(el, 'VKYNN', 'ILNNN'),"bidi layouts empty");
139                                                throw new Error("Didn't threw error!!");
140                                        }catch(e){
141                                         doh.is(errorMessage, e.message,"should throw wrong format message!");
142                                        }
143                                },this);
144                        }
145                },
146                {       
147                        name:'9. Test second letter.',
148
149                        setUp: function(){
150                                bdEngine = new dojox.string.BidiEngine();
151                        },
152                       
153                        runTest:function() {
154                                dojo.forEach(unilisrc, function(el, i){
155                                        try{
156                                                doh.is(unilisrc[i], bdEngine.bidiTransform(el, 'VRYNN', 'IKNNN'),"bidi layouts empty");
157                                                throw new Error("Didn't threw error!!");
158                                        }catch(e){
159                                         doh.is(errorMessage, e.message,"should throw wrong format message!");
160                                        }
161                                },this);
162                        }
163                },
164                {       
165                        name:'10. Test third letter.',
166
167                        setUp: function(){
168                                bdEngine = new dojox.string.BidiEngine();
169                        },
170                       
171                        runTest:function() {
172                                dojo.forEach(unilisrc, function(el, i){
173                                        try{
174                                                doh.is(unilisrc[i], bdEngine.bidiTransform(el, 'VRSNN', 'IRNNN'),"bidi layouts empty");
175                                                throw new Error("Didn't threw error!!");
176                                        }catch(e){
177                                         doh.is(errorMessage, e.message,"should throw wrong format message!");
178                                        }
179                                },this);
180                        }
181                },
182                {       
183                        name:'11. Test third letter.',
184
185                        setUp: function(){
186                                bdEngine = new dojox.string.BidiEngine();
187                        },
188                       
189                        runTest:function() {
190                                dojo.forEach(unilisrc, function(el, i){
191                                        try{
192                                                doh.is(unilisrc[i], bdEngine.bidiTransform(el, 'VRYNN', 'IRLNN'),"bidi layouts empty");
193                                                throw new Error("Didn't threw error!!");
194                                        }catch(e){
195                                         doh.is(errorMessage, e.message,"should throw wrong format message!");
196                                        }
197                                },this);
198                        }
199                },
200                {       
201                        name:'12. Test fourth letter.',
202
203                        setUp: function(){
204                                bdEngine = new dojox.string.BidiEngine();
205                        },
206                       
207                        runTest:function() {
208                                dojo.forEach(unilisrc, function(el, i){
209                                        try{
210                                                doh.is(unilisrc[i], bdEngine.bidiTransform(el, 'VRSNN', 'IRNNN'),"bidi layouts empty");
211                                                throw new Error("Didn't threw error!!");
212                                        }catch(e){
213                                         doh.is(errorMessage, e.message,"should throw wrong format message!");
214                                        }
215                                },this);
216                        }
217                },
218                {       
219                        name:'13. Test fourth letter.',
220
221                        setUp: function(){
222                                bdEngine = new dojox.string.BidiEngine();
223                        },
224                       
225                        runTest:function() {
226                                dojo.forEach(unilisrc, function(el, i){
227                                        try{
228                                                doh.is(unilisrc[i], bdEngine.bidiTransform(el, 'VRYNN', 'IRSNN'),"bidi layouts empty");
229                                                throw new Error("Didn't threw error!!");
230                                        }catch(e){
231                                         doh.is(errorMessage, e.message,"should throw wrong format message!");
232                                        }
233                                },this);
234                        }
235                },
236                {       
237                        name:'14. Test fifth letter.',
238
239                        setUp: function(){
240                                bdEngine = new dojox.string.BidiEngine();
241                        },
242                       
243                        runTest:function() {
244                                dojo.forEach(unilisrc, function(el, i){
245                                        try{
246                                                doh.is(unilisrc[i], bdEngine.bidiTransform(el, 'VRYNA', 'IRCNN'),"bidi layouts empty");
247                                                throw new Error("Didn't threw error!!");
248                                        }catch(e){
249                                         doh.is(errorMessage, e.message,"should throw wrong format message!");
250                                        }
251                                },this);
252                        }
253                },
254                {       
255                        name:'15. Test fifth letter.',
256
257                        setUp: function(){
258                                bdEngine = new dojox.string.BidiEngine();
259                        },
260                       
261                        runTest:function() {
262                                dojo.forEach(unilisrc, function(el, i){
263                                        try{
264                                                doh.is(unilisrc[i], bdEngine.bidiTransform(el, 'VRYNN', 'ICNNA'),"bidi layouts empty");
265                                                throw new Error("Didn't threw error!!");
266                                        }catch(e){
267                                         doh.is(errorMessage, e.message,"should throw wrong format message!");
268                                        }
269                                },this);
270                        }
271                },
272                {       
273                        name:'16. Too much letters.',
274
275                        setUp: function(){
276                                bdEngine = new dojox.string.BidiEngine();
277                        },
278                       
279                        runTest:function() {
280                                dojo.forEach(unilisrc, function(el, i){
281                                        try{
282                                                doh.is(unilisrc[i], bdEngine.bidiTransform(el, 'VRYNNN', 'IDYNN'),"bidi layouts empty");
283                                                throw new Error("Didn't threw error!!");
284                                        }catch(e){
285                                         doh.is(errorMessage, e.message,"should throw wrong format message!");
286                                        }
287                                },this);
288                        }
289                },
290                {       
291                        name:'16. Too much letters.',
292
293                        setUp: function(){
294                                bdEngine = new dojox.string.BidiEngine();
295                        },
296                       
297                        runTest:function() {
298                                dojo.forEach(unilisrc, function(el, i){
299                                        try{
300                                                doh.is(unilisrc[i], bdEngine.bidiTransform(el, 'VRYNN', 'ICYNNN'),"bidi layouts empty");
301                                                throw new Error("Didn't threw error!!");
302                                        }catch(e){
303                                         doh.is(errorMessage, e.message,"should throw wrong format message!");
304                                        }
305                                },this);
306                        }
307                },
308                {       
309                        name:'17. Good formats.',
310
311                        setUp: function(){
312                                bdEngine = new dojox.string.BidiEngine();
313                        },
314                       
315                        runTest:function() {
316                                dojo.forEach(unilisrc, function(el, i){
317                                        doh.is(unilisrc[i], bdEngine.bidiTransform(el, 'ILNNN', 'ILNNN'),"bidi layouts empty");
318                                        doh.is(unilisrc[i], bdEngine.bidiTransform(el, 'VLNNN', 'ILNNN'),"bidi layouts empty");
319                                        doh.is(unilisrc[i], bdEngine.bidiTransform(el, 'IRNNN', 'ILNNN'),"bidi layouts empty");
320                                        doh.is(unilisrc[i], bdEngine.bidiTransform(el, 'VRNNN', 'ILNNN'),"bidi layouts empty");
321                                        doh.is(unilisrc[i], bdEngine.bidiTransform(el, 'ICNNN', 'ILNNN'),"bidi layouts empty");
322                                        doh.is(unilisrc[i], bdEngine.bidiTransform(el, 'IDNNN', 'ILNNN'),"bidi layouts empty");
323
324                                        doh.is(unilisrc[i], bdEngine.bidiTransform(el, 'ILYNN', 'ILNNN'),"bidi layouts empty");
325                                        doh.is(unilisrc[i], bdEngine.bidiTransform(el, 'VLYNN', 'ILNNN'),"bidi layouts empty");
326                                        doh.is(unilisrc[i], bdEngine.bidiTransform(el, 'IRYNN', 'ILNNN'),"bidi layouts empty");
327                                        doh.is(unilisrc[i], bdEngine.bidiTransform(el, 'VRYNN', 'ILNNN'),"bidi layouts empty");
328                                        doh.is(unilisrc[i], bdEngine.bidiTransform(el, 'ICYNN', 'ILNNN'),"bidi layouts empty");
329                                        doh.is(unilisrc[i], bdEngine.bidiTransform(el, 'IDYNN', 'ILNNN'),"bidi layouts empty");
330                                       
331                                        doh.is(unilisrc[i], bdEngine.bidiTransform(el, 'ILYSN', 'ILNNN'),"bidi layouts empty");
332                                        doh.is(unilisrc[i], bdEngine.bidiTransform(el, 'VLYSN', 'ILNNN'),"bidi layouts empty");
333                                        doh.is(unilisrc[i], bdEngine.bidiTransform(el, 'IRYSN', 'ILNNN'),"bidi layouts empty");
334                                        doh.is(unilisrc[i], bdEngine.bidiTransform(el, 'VRYSN', 'ILNNN'),"bidi layouts empty");
335                                        doh.is(unilisrc[i], bdEngine.bidiTransform(el, 'ICYSN', 'ILNNN'),"bidi layouts empty");
336                                        doh.is(unilisrc[i], bdEngine.bidiTransform(el, 'IDYSN', 'ILNNN'),"bidi layouts empty");
337                                       
338                                        doh.is(unilisrc[i], bdEngine.bidiTransform(el, 'ILNSN', 'ILNNN'),"bidi layouts empty");
339                                        doh.is(unilisrc[i], bdEngine.bidiTransform(el, 'VLNSN', 'ILNNN'),"bidi layouts empty");
340                                        doh.is(unilisrc[i], bdEngine.bidiTransform(el, 'IRNSN', 'ILNNN'),"bidi layouts empty");
341                                        doh.is(unilisrc[i], bdEngine.bidiTransform(el, 'VRNSN', 'ILNNN'),"bidi layouts empty");
342                                        doh.is(unilisrc[i], bdEngine.bidiTransform(el, 'ICNSN', 'ILNNN'),"bidi layouts empty");
343                                        doh.is(unilisrc[i], bdEngine.bidiTransform(el, 'IDNSN', 'ILNNN'),"bidi layouts empty");
344                                       
345                                },this);
346                        }
347                }
348        ]);
349       
350
351});
Note: See TracBrowser for help on using the repository browser.