PageRenderTime 51ms CodeModel.GetById 17ms RepoModel.GetById 1ms app.codeStats 0ms

/string/tests/BidiEngine/BidiEngineTestLayouts.js

https://bitbucket.org/dojo/dojox
JavaScript | 1053 lines | 921 code | 132 blank | 0 comment | 0 complexity | 19136fc21cab44bd8722cd494cbbb4f2 MD5 | raw file
Possible License(s): BSD-3-Clause, LGPL-2.0, Apache-2.0, MIT
  1. dojo.provide("dojox.string.tests.BidiEngine.BidiEngineTestLayouts");
  2. dojo.require("dojox.string.BidiEngine");
  3. dojo.addOnLoad(function(){
  4. var unilisrc = [
  5. "11"
  6. ];
  7. var bdEngine;
  8. var errorMessage = "dojox.string.BidiEngine: the bidi layout string is wrong!";
  9. doh.register('dojox.string.tests.BidiEngine.BidiEngine', [
  10. {
  11. name:'1. test empty',
  12. setUp: function(){
  13. bdEngine = new dojox.string.BidiEngine();
  14. },
  15. runTest:function() {
  16. dojo.forEach(unilisrc, function(el, i){
  17. doh.is('', bdEngine.bidiTransform('', 'VLNNN', 'IRYNN'),"empty string.");
  18. },this);
  19. }
  20. },
  21. {
  22. name:'2. empty format string.',
  23. setUp: function(){
  24. bdEngine = new dojox.string.BidiEngine();
  25. },
  26. runTest:function() {
  27. dojo.forEach(unilisrc, function(el, i){
  28. doh.is(unilisrc[i], bdEngine.bidiTransform(el, '', ''),"bidi layouts empty");
  29. },this);
  30. }
  31. },
  32. {
  33. name:'3. show error.',
  34. setUp: function(){
  35. bdEngine = new dojox.string.BidiEngine();
  36. },
  37. runTest:function() {
  38. dojo.forEach(unilisrc, function(el, i){
  39. try{
  40. doh.is(unilisrc[i], bdEngine.bidiTransform(el, 'ILYNN', ''),"bidi layouts empty");
  41. throw new Error("Didn't threw error!!");
  42. }catch(e){
  43. doh.is(errorMessage, e.message,"should throw wrong format message!");
  44. }
  45. },this);
  46. }
  47. },
  48. {
  49. name:'4. show error.',
  50. setUp: function(){
  51. bdEngine = new dojox.string.BidiEngine();
  52. },
  53. runTest:function() {
  54. dojo.forEach(unilisrc, function(el, i){
  55. try{
  56. doh.is(unilisrc[i], bdEngine.bidiTransform(el, '', 'ILYNN'),"bidi layouts empty");
  57. throw new Error("Didn't threw error!!");
  58. }catch(e){
  59. doh.is(errorMessage, e.message,"should throw wrong format message!");
  60. }
  61. },this);
  62. }
  63. },
  64. {
  65. name:'5. show error.',
  66. setUp: function(){
  67. bdEngine = new dojox.string.BidiEngine();
  68. },
  69. runTest:function() {
  70. dojo.forEach(unilisrc, function(el, i){
  71. try{
  72. doh.is(unilisrc[i], bdEngine.bidiTransform(el, 'V', 'I'),"bidi layouts empty");
  73. throw new Error("Didn't threw error!!");
  74. }catch(e){
  75. doh.is(errorMessage, e.message,"should throw wrong format message!");
  76. }
  77. },this);
  78. }
  79. },
  80. {
  81. name:'6. Test first letter.',
  82. setUp: function(){
  83. bdEngine = new dojox.string.BidiEngine();
  84. },
  85. runTest:function() {
  86. dojo.forEach(unilisrc, function(el, i){
  87. try{
  88. doh.is(unilisrc[i], bdEngine.bidiTransform(el, 'KLYNN', 'ILNNN'),"bidi layouts empty");
  89. throw new Error("Didn't threw error!!");
  90. }catch(e){
  91. doh.is(errorMessage, e.message,"should throw wrong format message!");
  92. }
  93. },this);
  94. }
  95. },
  96. {
  97. name:'7. Test first letter.',
  98. setUp: function(){
  99. bdEngine = new dojox.string.BidiEngine();
  100. },
  101. runTest:function() {
  102. dojo.forEach(unilisrc, function(el, i){
  103. try{
  104. doh.is(unilisrc[i], bdEngine.bidiTransform(el, 'VLYNN', 'KLNNN'),"bidi layouts empty");
  105. throw new Error("Didn't threw error!!");
  106. }catch(e){
  107. doh.is(errorMessage, e.message,"should throw wrong format message!");
  108. }
  109. },this);
  110. }
  111. },
  112. {
  113. name:'8. Test second letter.',
  114. setUp: function(){
  115. bdEngine = new dojox.string.BidiEngine();
  116. },
  117. runTest:function() {
  118. dojo.forEach(unilisrc, function(el, i){
  119. try{
  120. doh.is(unilisrc[i], bdEngine.bidiTransform(el, 'VKYNN', 'ILNNN'),"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:'9. Test second letter.',
  130. setUp: function(){
  131. bdEngine = new dojox.string.BidiEngine();
  132. },
  133. runTest:function() {
  134. dojo.forEach(unilisrc, function(el, i){
  135. try{
  136. doh.is(unilisrc[i], bdEngine.bidiTransform(el, 'VRYNN', 'IKNNN'),"bidi layouts empty");
  137. throw new Error("Didn't threw error!!");
  138. }catch(e){
  139. doh.is(errorMessage, e.message,"should throw wrong format message!");
  140. }
  141. },this);
  142. }
  143. },
  144. {
  145. name:'10. Test third letter.',
  146. setUp: function(){
  147. bdEngine = new dojox.string.BidiEngine();
  148. },
  149. runTest:function() {
  150. dojo.forEach(unilisrc, function(el, i){
  151. try{
  152. doh.is(unilisrc[i], bdEngine.bidiTransform(el, 'VRSNN', 'IRNNN'),"bidi layouts empty");
  153. throw new Error("Didn't threw error!!");
  154. }catch(e){
  155. doh.is(errorMessage, e.message,"should throw wrong format message!");
  156. }
  157. },this);
  158. }
  159. },
  160. {
  161. name:'11. Test third letter.',
  162. setUp: function(){
  163. bdEngine = new dojox.string.BidiEngine();
  164. },
  165. runTest:function() {
  166. dojo.forEach(unilisrc, function(el, i){
  167. try{
  168. doh.is(unilisrc[i], bdEngine.bidiTransform(el, 'VRYNN', 'IRLNN'),"bidi layouts empty");
  169. throw new Error("Didn't threw error!!");
  170. }catch(e){
  171. doh.is(errorMessage, e.message,"should throw wrong format message!");
  172. }
  173. },this);
  174. }
  175. },
  176. {
  177. name:'12. Test fourth letter.',
  178. setUp: function(){
  179. bdEngine = new dojox.string.BidiEngine();
  180. },
  181. runTest:function() {
  182. dojo.forEach(unilisrc, function(el, i){
  183. try{
  184. doh.is(unilisrc[i], bdEngine.bidiTransform(el, 'VRSNN', 'IRNNN'),"bidi layouts empty");
  185. throw new Error("Didn't threw error!!");
  186. }catch(e){
  187. doh.is(errorMessage, e.message,"should throw wrong format message!");
  188. }
  189. },this);
  190. }
  191. },
  192. {
  193. name:'13. Test fourth letter.',
  194. setUp: function(){
  195. bdEngine = new dojox.string.BidiEngine();
  196. },
  197. runTest:function() {
  198. dojo.forEach(unilisrc, function(el, i){
  199. try{
  200. doh.is(unilisrc[i], bdEngine.bidiTransform(el, 'VRYNN', 'IRSNN'),"bidi layouts empty");
  201. throw new Error("Didn't threw error!!");
  202. }catch(e){
  203. doh.is(errorMessage, e.message,"should throw wrong format message!");
  204. }
  205. },this);
  206. }
  207. },
  208. {
  209. name:'14. Test fifth letter.',
  210. setUp: function(){
  211. bdEngine = new dojox.string.BidiEngine();
  212. },
  213. runTest:function() {
  214. dojo.forEach(unilisrc, function(el, i){
  215. try{
  216. doh.is(unilisrc[i], bdEngine.bidiTransform(el, 'VRYNA', 'IRCNN'),"bidi layouts empty");
  217. throw new Error("Didn't threw error!!");
  218. }catch(e){
  219. doh.is(errorMessage, e.message,"should throw wrong format message!");
  220. }
  221. },this);
  222. }
  223. },
  224. {
  225. name:'15. Test fifth letter.',
  226. setUp: function(){
  227. bdEngine = new dojox.string.BidiEngine();
  228. },
  229. runTest:function() {
  230. dojo.forEach(unilisrc, function(el, i){
  231. try{
  232. doh.is(unilisrc[i], bdEngine.bidiTransform(el, 'VRYNN', 'ICNNA'),"bidi layouts empty");
  233. throw new Error("Didn't threw error!!");
  234. }catch(e){
  235. doh.is(errorMessage, e.message,"should throw wrong format message!");
  236. }
  237. },this);
  238. }
  239. },
  240. {
  241. name:'16. Too much letters.',
  242. setUp: function(){
  243. bdEngine = new dojox.string.BidiEngine();
  244. },
  245. runTest:function() {
  246. dojo.forEach(unilisrc, function(el, i){
  247. try{
  248. doh.is(unilisrc[i], bdEngine.bidiTransform(el, 'VRYNNN', 'IDYNN'),"bidi layouts empty");
  249. throw new Error("Didn't threw error!!");
  250. }catch(e){
  251. doh.is(errorMessage, e.message,"should throw wrong format message!");
  252. }
  253. },this);
  254. }
  255. },
  256. {
  257. name:'16. Too much letters.',
  258. setUp: function(){
  259. bdEngine = new dojox.string.BidiEngine();
  260. },
  261. runTest:function() {
  262. dojo.forEach(unilisrc, function(el, i){
  263. try{
  264. doh.is(unilisrc[i], bdEngine.bidiTransform(el, 'VRYNN', 'ICYNNN'),"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:'17. Good formats.',
  274. setUp: function(){
  275. bdEngine = new dojox.string.BidiEngine();
  276. },
  277. runTest:function() {
  278. dojo.forEach(unilisrc, function(el, i){
  279. doh.is(unilisrc[i], bdEngine.bidiTransform(el, 'ILNNN', 'ILNNN'),"bidi layouts empty");
  280. doh.is(unilisrc[i], bdEngine.bidiTransform(el, 'VLNNN', 'ILNNN'),"bidi layouts empty");
  281. doh.is(unilisrc[i], bdEngine.bidiTransform(el, 'IRNNN', 'ILNNN'),"bidi layouts empty");
  282. doh.is(unilisrc[i], bdEngine.bidiTransform(el, 'VRNNN', 'ILNNN'),"bidi layouts empty");
  283. doh.is(unilisrc[i], bdEngine.bidiTransform(el, 'ICNNN', 'ILNNN'),"bidi layouts empty");
  284. doh.is(unilisrc[i], bdEngine.bidiTransform(el, 'IDNNN', 'ILNNN'),"bidi layouts empty");
  285. doh.is(unilisrc[i], bdEngine.bidiTransform(el, 'ILYNN', 'ILNNN'),"bidi layouts empty");
  286. doh.is(unilisrc[i], bdEngine.bidiTransform(el, 'VLYNN', 'ILNNN'),"bidi layouts empty");
  287. doh.is(unilisrc[i], bdEngine.bidiTransform(el, 'IRYNN', 'ILNNN'),"bidi layouts empty");
  288. doh.is(unilisrc[i], bdEngine.bidiTransform(el, 'VRYNN', 'ILNNN'),"bidi layouts empty");
  289. doh.is(unilisrc[i], bdEngine.bidiTransform(el, 'ICYNN', 'ILNNN'),"bidi layouts empty");
  290. doh.is(unilisrc[i], bdEngine.bidiTransform(el, 'IDYNN', 'ILNNN'),"bidi layouts empty");
  291. doh.is(unilisrc[i], bdEngine.bidiTransform(el, 'ILYSN', 'ILNNN'),"bidi layouts empty");
  292. doh.is(unilisrc[i], bdEngine.bidiTransform(el, 'VLYSN', 'ILNNN'),"bidi layouts empty");
  293. doh.is(unilisrc[i], bdEngine.bidiTransform(el, 'IRYSN', 'ILNNN'),"bidi layouts empty");
  294. doh.is(unilisrc[i], bdEngine.bidiTransform(el, 'VRYSN', 'ILNNN'),"bidi layouts empty");
  295. doh.is(unilisrc[i], bdEngine.bidiTransform(el, 'ICYSN', 'ILNNN'),"bidi layouts empty");
  296. doh.is(unilisrc[i], bdEngine.bidiTransform(el, 'IDYSN', 'ILNNN'),"bidi layouts empty");
  297. doh.is(unilisrc[i], bdEngine.bidiTransform(el, 'ILNSN', 'ILNNN'),"bidi layouts empty");
  298. doh.is(unilisrc[i], bdEngine.bidiTransform(el, 'VLNSN', 'ILNNN'),"bidi layouts empty");
  299. doh.is(unilisrc[i], bdEngine.bidiTransform(el, 'IRNSN', 'ILNNN'),"bidi layouts empty");
  300. doh.is(unilisrc[i], bdEngine.bidiTransform(el, 'VRNSN', 'ILNNN'),"bidi layouts empty");
  301. doh.is(unilisrc[i], bdEngine.bidiTransform(el, 'ICNSN', 'ILNNN'),"bidi layouts empty");
  302. doh.is(unilisrc[i], bdEngine.bidiTransform(el, 'IDNSN', 'ILNNN'),"bidi layouts empty");
  303. },this);
  304. }
  305. }
  306. ]);
  307. });
  308. dojo.provide("dojox.string.tests.BidiEngine.BidiEngineTestLayouts");
  309. dojo.require("dojox.string.BidiEngine");
  310. dojo.addOnLoad(function(){
  311. var unilisrc = [
  312. "11"
  313. ];
  314. var bdEngine;
  315. var errorMessage = "dojox.string.BidiEngine: the bidi layout string is wrong!";
  316. doh.register('dojox.string.tests.BidiEngine.BidiEngine', [
  317. {
  318. name:'1. test empty',
  319. setUp: function(){
  320. bdEngine = new dojox.string.BidiEngine();
  321. },
  322. runTest:function() {
  323. dojo.forEach(unilisrc, function(el, i){
  324. doh.is('', bdEngine.bidiTransform('', 'VLNNN', 'IRYNN'),"empty string.");
  325. },this);
  326. }
  327. },
  328. {
  329. name:'2. empty format string.',
  330. setUp: function(){
  331. bdEngine = new dojox.string.BidiEngine();
  332. },
  333. runTest:function() {
  334. dojo.forEach(unilisrc, function(el, i){
  335. doh.is(unilisrc[i], bdEngine.bidiTransform(el, '', ''),"bidi layouts empty");
  336. },this);
  337. }
  338. },
  339. {
  340. name:'3. show error.',
  341. setUp: function(){
  342. bdEngine = new dojox.string.BidiEngine();
  343. },
  344. runTest:function() {
  345. dojo.forEach(unilisrc, function(el, i){
  346. try{
  347. doh.is(unilisrc[i], bdEngine.bidiTransform(el, 'ILYNN', ''),"bidi layouts empty");
  348. throw new Error("Didn't threw error!!");
  349. }catch(e){
  350. doh.is(errorMessage, e.message,"should throw wrong format message!");
  351. }
  352. },this);
  353. }
  354. },
  355. {
  356. name:'4. show error.',
  357. setUp: function(){
  358. bdEngine = new dojox.string.BidiEngine();
  359. },
  360. runTest:function() {
  361. dojo.forEach(unilisrc, function(el, i){
  362. try{
  363. doh.is(unilisrc[i], bdEngine.bidiTransform(el, '', 'ILYNN'),"bidi layouts empty");
  364. throw new Error("Didn't threw error!!");
  365. }catch(e){
  366. doh.is(errorMessage, e.message,"should throw wrong format message!");
  367. }
  368. },this);
  369. }
  370. },
  371. {
  372. name:'5. show error.',
  373. setUp: function(){
  374. bdEngine = new dojox.string.BidiEngine();
  375. },
  376. runTest:function() {
  377. dojo.forEach(unilisrc, function(el, i){
  378. try{
  379. doh.is(unilisrc[i], bdEngine.bidiTransform(el, 'V', 'I'),"bidi layouts empty");
  380. throw new Error("Didn't threw error!!");
  381. }catch(e){
  382. doh.is(errorMessage, e.message,"should throw wrong format message!");
  383. }
  384. },this);
  385. }
  386. },
  387. {
  388. name:'6. Test first letter.',
  389. setUp: function(){
  390. bdEngine = new dojox.string.BidiEngine();
  391. },
  392. runTest:function() {
  393. dojo.forEach(unilisrc, function(el, i){
  394. try{
  395. doh.is(unilisrc[i], bdEngine.bidiTransform(el, 'KLYNN', 'ILNNN'),"bidi layouts empty");
  396. throw new Error("Didn't threw error!!");
  397. }catch(e){
  398. doh.is(errorMessage, e.message,"should throw wrong format message!");
  399. }
  400. },this);
  401. }
  402. },
  403. {
  404. name:'7. Test first letter.',
  405. setUp: function(){
  406. bdEngine = new dojox.string.BidiEngine();
  407. },
  408. runTest:function() {
  409. dojo.forEach(unilisrc, function(el, i){
  410. try{
  411. doh.is(unilisrc[i], bdEngine.bidiTransform(el, 'VLYNN', 'KLNNN'),"bidi layouts empty");
  412. throw new Error("Didn't threw error!!");
  413. }catch(e){
  414. doh.is(errorMessage, e.message,"should throw wrong format message!");
  415. }
  416. },this);
  417. }
  418. },
  419. {
  420. name:'8. Test second letter.',
  421. setUp: function(){
  422. bdEngine = new dojox.string.BidiEngine();
  423. },
  424. runTest:function() {
  425. dojo.forEach(unilisrc, function(el, i){
  426. try{
  427. doh.is(unilisrc[i], bdEngine.bidiTransform(el, 'VKYNN', 'ILNNN'),"bidi layouts empty");
  428. throw new Error("Didn't threw error!!");
  429. }catch(e){
  430. doh.is(errorMessage, e.message,"should throw wrong format message!");
  431. }
  432. },this);
  433. }
  434. },
  435. {
  436. name:'9. Test second letter.',
  437. setUp: function(){
  438. bdEngine = new dojox.string.BidiEngine();
  439. },
  440. runTest:function() {
  441. dojo.forEach(unilisrc, function(el, i){
  442. try{
  443. doh.is(unilisrc[i], bdEngine.bidiTransform(el, 'VRYNN', 'IKNNN'),"bidi layouts empty");
  444. throw new Error("Didn't threw error!!");
  445. }catch(e){
  446. doh.is(errorMessage, e.message,"should throw wrong format message!");
  447. }
  448. },this);
  449. }
  450. },
  451. {
  452. name:'10. Test third letter.',
  453. setUp: function(){
  454. bdEngine = new dojox.string.BidiEngine();
  455. },
  456. runTest:function() {
  457. dojo.forEach(unilisrc, function(el, i){
  458. try{
  459. doh.is(unilisrc[i], bdEngine.bidiTransform(el, 'VRSNN', 'IRNNN'),"bidi layouts empty");
  460. throw new Error("Didn't threw error!!");
  461. }catch(e){
  462. doh.is(errorMessage, e.message,"should throw wrong format message!");
  463. }
  464. },this);
  465. }
  466. },
  467. {
  468. name:'11. Test third letter.',
  469. setUp: function(){
  470. bdEngine = new dojox.string.BidiEngine();
  471. },
  472. runTest:function() {
  473. dojo.forEach(unilisrc, function(el, i){
  474. try{
  475. doh.is(unilisrc[i], bdEngine.bidiTransform(el, 'VRYNN', 'IRLNN'),"bidi layouts empty");
  476. throw new Error("Didn't threw error!!");
  477. }catch(e){
  478. doh.is(errorMessage, e.message,"should throw wrong format message!");
  479. }
  480. },this);
  481. }
  482. },
  483. {
  484. name:'12. Test fourth letter.',
  485. setUp: function(){
  486. bdEngine = new dojox.string.BidiEngine();
  487. },
  488. runTest:function() {
  489. dojo.forEach(unilisrc, function(el, i){
  490. try{
  491. doh.is(unilisrc[i], bdEngine.bidiTransform(el, 'VRSNN', 'IRNNN'),"bidi layouts empty");
  492. throw new Error("Didn't threw error!!");
  493. }catch(e){
  494. doh.is(errorMessage, e.message,"should throw wrong format message!");
  495. }
  496. },this);
  497. }
  498. },
  499. {
  500. name:'13. Test fourth letter.',
  501. setUp: function(){
  502. bdEngine = new dojox.string.BidiEngine();
  503. },
  504. runTest:function() {
  505. dojo.forEach(unilisrc, function(el, i){
  506. try{
  507. doh.is(unilisrc[i], bdEngine.bidiTransform(el, 'VRYNN', 'IRSNN'),"bidi layouts empty");
  508. throw new Error("Didn't threw error!!");
  509. }catch(e){
  510. doh.is(errorMessage, e.message,"should throw wrong format message!");
  511. }
  512. },this);
  513. }
  514. },
  515. {
  516. name:'14. Test fifth letter.',
  517. setUp: function(){
  518. bdEngine = new dojox.string.BidiEngine();
  519. },
  520. runTest:function() {
  521. dojo.forEach(unilisrc, function(el, i){
  522. try{
  523. doh.is(unilisrc[i], bdEngine.bidiTransform(el, 'VRYNA', 'IRCNN'),"bidi layouts empty");
  524. throw new Error("Didn't threw error!!");
  525. }catch(e){
  526. doh.is(errorMessage, e.message,"should throw wrong format message!");
  527. }
  528. },this);
  529. }
  530. },
  531. {
  532. name:'15. Test fifth letter.',
  533. setUp: function(){
  534. bdEngine = new dojox.string.BidiEngine();
  535. },
  536. runTest:function() {
  537. dojo.forEach(unilisrc, function(el, i){
  538. try{
  539. doh.is(unilisrc[i], bdEngine.bidiTransform(el, 'VRYNN', 'ICNNA'),"bidi layouts empty");
  540. throw new Error("Didn't threw error!!");
  541. }catch(e){
  542. doh.is(errorMessage, e.message,"should throw wrong format message!");
  543. }
  544. },this);
  545. }
  546. },
  547. {
  548. name:'16. Too much letters.',
  549. setUp: function(){
  550. bdEngine = new dojox.string.BidiEngine();
  551. },
  552. runTest:function() {
  553. dojo.forEach(unilisrc, function(el, i){
  554. try{
  555. doh.is(unilisrc[i], bdEngine.bidiTransform(el, 'VRYNNN', 'IDYNN'),"bidi layouts empty");
  556. throw new Error("Didn't threw error!!");
  557. }catch(e){
  558. doh.is(errorMessage, e.message,"should throw wrong format message!");
  559. }
  560. },this);
  561. }
  562. },
  563. {
  564. name:'16. Too much letters.',
  565. setUp: function(){
  566. bdEngine = new dojox.string.BidiEngine();
  567. },
  568. runTest:function() {
  569. dojo.forEach(unilisrc, function(el, i){
  570. try{
  571. doh.is(unilisrc[i], bdEngine.bidiTransform(el, 'VRYNN', 'ICYNNN'),"bidi layouts empty");
  572. throw new Error("Didn't threw error!!");
  573. }catch(e){
  574. doh.is(errorMessage, e.message,"should throw wrong format message!");
  575. }
  576. },this);
  577. }
  578. },
  579. {
  580. name:'17. Good formats.',
  581. setUp: function(){
  582. bdEngine = new dojox.string.BidiEngine();
  583. },
  584. runTest:function() {
  585. dojo.forEach(unilisrc, function(el, i){
  586. doh.is(unilisrc[i], bdEngine.bidiTransform(el, 'ILNNN', 'ILNNN'),"bidi layouts empty");
  587. doh.is(unilisrc[i], bdEngine.bidiTransform(el, 'VLNNN', 'ILNNN'),"bidi layouts empty");
  588. doh.is(unilisrc[i], bdEngine.bidiTransform(el, 'IRNNN', 'ILNNN'),"bidi layouts empty");
  589. doh.is(unilisrc[i], bdEngine.bidiTransform(el, 'VRNNN', 'ILNNN'),"bidi layouts empty");
  590. doh.is(unilisrc[i], bdEngine.bidiTransform(el, 'ICNNN', 'ILNNN'),"bidi layouts empty");
  591. doh.is(unilisrc[i], bdEngine.bidiTransform(el, 'IDNNN', 'ILNNN'),"bidi layouts empty");
  592. doh.is(unilisrc[i], bdEngine.bidiTransform(el, 'ILYNN', 'ILNNN'),"bidi layouts empty");
  593. doh.is(unilisrc[i], bdEngine.bidiTransform(el, 'VLYNN', 'ILNNN'),"bidi layouts empty");
  594. doh.is(unilisrc[i], bdEngine.bidiTransform(el, 'IRYNN', 'ILNNN'),"bidi layouts empty");
  595. doh.is(unilisrc[i], bdEngine.bidiTransform(el, 'VRYNN', 'ILNNN'),"bidi layouts empty");
  596. doh.is(unilisrc[i], bdEngine.bidiTransform(el, 'ICYNN', 'ILNNN'),"bidi layouts empty");
  597. doh.is(unilisrc[i], bdEngine.bidiTransform(el, 'IDYNN', 'ILNNN'),"bidi layouts empty");
  598. doh.is(unilisrc[i], bdEngine.bidiTransform(el, 'ILYSN', 'ILNNN'),"bidi layouts empty");
  599. doh.is(unilisrc[i], bdEngine.bidiTransform(el, 'VLYSN', 'ILNNN'),"bidi layouts empty");
  600. doh.is(unilisrc[i], bdEngine.bidiTransform(el, 'IRYSN', 'ILNNN'),"bidi layouts empty");
  601. doh.is(unilisrc[i], bdEngine.bidiTransform(el, 'VRYSN', 'ILNNN'),"bidi layouts empty");
  602. doh.is(unilisrc[i], bdEngine.bidiTransform(el, 'ICYSN', 'ILNNN'),"bidi layouts empty");
  603. doh.is(unilisrc[i], bdEngine.bidiTransform(el, 'IDYSN', 'ILNNN'),"bidi layouts empty");
  604. doh.is(unilisrc[i], bdEngine.bidiTransform(el, 'ILNSN', 'ILNNN'),"bidi layouts empty");
  605. doh.is(unilisrc[i], bdEngine.bidiTransform(el, 'VLNSN', 'ILNNN'),"bidi layouts empty");
  606. doh.is(unilisrc[i], bdEngine.bidiTransform(el, 'IRNSN', 'ILNNN'),"bidi layouts empty");
  607. doh.is(unilisrc[i], bdEngine.bidiTransform(el, 'VRNSN', 'ILNNN'),"bidi layouts empty");
  608. doh.is(unilisrc[i], bdEngine.bidiTransform(el, 'ICNSN', 'ILNNN'),"bidi layouts empty");
  609. doh.is(unilisrc[i], bdEngine.bidiTransform(el, 'IDNSN', 'ILNNN'),"bidi layouts empty");
  610. },this);
  611. }
  612. }
  613. ]);
  614. });
  615. dojo.provide("dojox.string.tests.BidiEngine.BidiEngineTestLayouts");
  616. dojo.require("dojox.string.BidiEngine");
  617. dojo.addOnLoad(function(){
  618. var unilisrc = [
  619. "11"
  620. ];
  621. var bdEngine;
  622. var errorMessage = "dojox.string.BidiEngine: the bidi layout string is wrong!";
  623. doh.register('dojox.string.tests.BidiEngine.BidiEngine', [
  624. {
  625. name:'1. test empty',
  626. setUp: function(){
  627. bdEngine = new dojox.string.BidiEngine();
  628. },
  629. runTest:function() {
  630. dojo.forEach(unilisrc, function(el, i){
  631. doh.is('', bdEngine.bidiTransform('', 'VLNNN', 'IRYNN'),"empty string.");
  632. },this);
  633. }
  634. },
  635. {
  636. name:'2. empty format string.',
  637. setUp: function(){
  638. bdEngine = new dojox.string.BidiEngine();
  639. },
  640. runTest:function() {
  641. dojo.forEach(unilisrc, function(el, i){
  642. doh.is(unilisrc[i], bdEngine.bidiTransform(el, '', ''),"bidi layouts empty");
  643. },this);
  644. }
  645. },
  646. {
  647. name:'3. show error.',
  648. setUp: function(){
  649. bdEngine = new dojox.string.BidiEngine();
  650. },
  651. runTest:function() {
  652. dojo.forEach(unilisrc, function(el, i){
  653. try{
  654. doh.is(unilisrc[i], bdEngine.bidiTransform(el, 'ILYNN', ''),"bidi layouts empty");
  655. throw new Error("Didn't threw error!!");
  656. }catch(e){
  657. doh.is(errorMessage, e.message,"should throw wrong format message!");
  658. }
  659. },this);
  660. }
  661. },
  662. {
  663. name:'4. show error.',
  664. setUp: function(){
  665. bdEngine = new dojox.string.BidiEngine();
  666. },
  667. runTest:function() {
  668. dojo.forEach(unilisrc, function(el, i){
  669. try{
  670. doh.is(unilisrc[i], bdEngine.bidiTransform(el, '', 'ILYNN'),"bidi layouts empty");
  671. throw new Error("Didn't threw error!!");
  672. }catch(e){
  673. doh.is(errorMessage, e.message,"should throw wrong format message!");
  674. }
  675. },this);
  676. }
  677. },
  678. {
  679. name:'5. show error.',
  680. setUp: function(){
  681. bdEngine = new dojox.string.BidiEngine();
  682. },
  683. runTest:function() {
  684. dojo.forEach(unilisrc, function(el, i){
  685. try{
  686. doh.is(unilisrc[i], bdEngine.bidiTransform(el, 'V', 'I'),"bidi layouts empty");
  687. throw new Error("Didn't threw error!!");
  688. }catch(e){
  689. doh.is(errorMessage, e.message,"should throw wrong format message!");
  690. }
  691. },this);
  692. }
  693. },
  694. {
  695. name:'6. Test first letter.',
  696. setUp: function(){
  697. bdEngine = new dojox.string.BidiEngine();
  698. },
  699. runTest:function() {
  700. dojo.forEach(unilisrc, function(el, i){
  701. try{
  702. doh.is(unilisrc[i], bdEngine.bidiTransform(el, 'KLYNN', 'ILNNN'),"bidi layouts empty");
  703. throw new Error("Didn't threw error!!");
  704. }catch(e){
  705. doh.is(errorMessage, e.message,"should throw wrong format message!");
  706. }
  707. },this);
  708. }
  709. },
  710. {
  711. name:'7. Test first letter.',
  712. setUp: function(){
  713. bdEngine = new dojox.string.BidiEngine();
  714. },
  715. runTest:function() {
  716. dojo.forEach(unilisrc, function(el, i){
  717. try{
  718. doh.is(unilisrc[i], bdEngine.bidiTransform(el, 'VLYNN', 'KLNNN'),"bidi layouts empty");
  719. throw new Error("Didn't threw error!!");
  720. }catch(e){
  721. doh.is(errorMessage, e.message,"should throw wrong format message!");
  722. }
  723. },this);
  724. }
  725. },
  726. {
  727. name:'8. Test second letter.',
  728. setUp: function(){
  729. bdEngine = new dojox.string.BidiEngine();
  730. },
  731. runTest:function() {
  732. dojo.forEach(unilisrc, function(el, i){
  733. try{
  734. doh.is(unilisrc[i], bdEngine.bidiTransform(el, 'VKYNN', 'ILNNN'),"bidi layouts empty");
  735. throw new Error("Didn't threw error!!");
  736. }catch(e){
  737. doh.is(errorMessage, e.message,"should throw wrong format message!");
  738. }
  739. },this);
  740. }
  741. },
  742. {
  743. name:'9. Test second letter.',
  744. setUp: function(){
  745. bdEngine = new dojox.string.BidiEngine();
  746. },
  747. runTest:function() {
  748. dojo.forEach(unilisrc, function(el, i){
  749. try{
  750. doh.is(unilisrc[i], bdEngine.bidiTransform(el, 'VRYNN', 'IKNNN'),"bidi layouts empty");
  751. throw new Error("Didn't threw error!!");
  752. }catch(e){
  753. doh.is(errorMessage, e.message,"should throw wrong format message!");
  754. }
  755. },this);
  756. }
  757. },
  758. {
  759. name:'10. Test third letter.',
  760. setUp: function(){
  761. bdEngine = new dojox.string.BidiEngine();
  762. },
  763. runTest:function() {
  764. dojo.forEach(unilisrc, function(el, i){
  765. try{
  766. doh.is(unilisrc[i], bdEngine.bidiTransform(el, 'VRSNN', 'IRNNN'),"bidi layouts empty");
  767. throw new Error("Didn't threw error!!");
  768. }catch(e){
  769. doh.is(errorMessage, e.message,"should throw wrong format message!");
  770. }
  771. },this);
  772. }
  773. },
  774. {
  775. name:'11. Test third letter.',
  776. setUp: function(){
  777. bdEngine = new dojox.string.BidiEngine();
  778. },
  779. runTest:function() {
  780. dojo.forEach(unilisrc, function(el, i){
  781. try{
  782. doh.is(unilisrc[i], bdEngine.bidiTransform(el, 'VRYNN', 'IRLNN'),"bidi layouts empty");
  783. throw new Error("Didn't threw error!!");
  784. }catch(e){
  785. doh.is(errorMessage, e.message,"should throw wrong format message!");
  786. }
  787. },this);
  788. }
  789. },
  790. {
  791. name:'12. Test fourth letter.',
  792. setUp: function(){
  793. bdEngine = new dojox.string.BidiEngine();
  794. },
  795. runTest:function() {
  796. dojo.forEach(unilisrc, function(el, i){
  797. try{
  798. doh.is(unilisrc[i], bdEngine.bidiTransform(el, 'VRSNN', 'IRNNN'),"bidi layouts empty");
  799. throw new Error("Didn't threw error!!");
  800. }catch(e){
  801. doh.is(errorMessage, e.message,"should throw wrong format message!");
  802. }
  803. },this);
  804. }
  805. },
  806. {
  807. name:'13. Test fourth letter.',
  808. setUp: function(){
  809. bdEngine = new dojox.string.BidiEngine();
  810. },
  811. runTest:function() {
  812. dojo.forEach(unilisrc, function(el, i){
  813. try{
  814. doh.is(unilisrc[i], bdEngine.bidiTransform(el, 'VRYNN', 'IRSNN'),"bidi layouts empty");
  815. throw new Error("Didn't threw error!!");
  816. }catch(e){
  817. doh.is(errorMessage, e.message,"should throw wrong format message!");
  818. }
  819. },this);
  820. }
  821. },
  822. {
  823. name:'14. Test fifth letter.',
  824. setUp: function(){
  825. bdEngine = new dojox.string.BidiEngine();
  826. },
  827. runTest:function() {
  828. dojo.forEach(unilisrc, function(el, i){
  829. try{
  830. doh.is(unilisrc[i], bdEngine.bidiTransform(el, 'VRYNA', 'IRCNN'),"bidi layouts empty");
  831. throw new Error("Didn't threw error!!");
  832. }catch(e){
  833. doh.is(errorMessage, e.message,"should throw wrong format message!");
  834. }
  835. },this);
  836. }
  837. },
  838. {
  839. name:'15. Test fifth letter.',
  840. setUp: function(){
  841. bdEngine = new dojox.string.BidiEngine();
  842. },
  843. runTest:function() {
  844. dojo.forEach(unilisrc, function(el, i){
  845. try{
  846. doh.is(unilisrc[i], bdEngine.bidiTransform(el, 'VRYNN', 'ICNNA'),"bidi layouts empty");
  847. throw new Error("Didn't threw error!!");
  848. }catch(e){
  849. doh.is(errorMessage, e.message,"should throw wrong format message!");
  850. }
  851. },this);
  852. }
  853. },
  854. {
  855. name:'16. Too much letters.',
  856. setUp: function(){
  857. bdEngine = new dojox.string.BidiEngine();
  858. },
  859. runTest:function() {
  860. dojo.forEach(unilisrc, function(el, i){
  861. try{
  862. doh.is(unilisrc[i], bdEngine.bidiTransform(el, 'VRYNNN', 'IDYNN'),"bidi layouts empty");
  863. throw new Error("Didn't threw error!!");
  864. }catch(e){
  865. doh.is(errorMessage, e.message,"should throw wrong format message!");
  866. }
  867. },this);
  868. }
  869. },
  870. {
  871. name:'16. Too much letters.',
  872. setUp: function(){
  873. bdEngine = new dojox.string.BidiEngine();
  874. },
  875. runTest:function() {
  876. dojo.forEach(unilisrc, function(el, i){
  877. try{
  878. doh.is(unilisrc[i], bdEngine.bidiTransform(el, 'VRYNN', 'ICYNNN'),"bidi layouts empty");
  879. throw new Error("Didn't threw error!!");
  880. }catch(e){
  881. doh.is(errorMessage, e.message,"should throw wrong format message!");
  882. }
  883. },this);
  884. }
  885. },
  886. {
  887. name:'17. Good formats.',
  888. setUp: function(){
  889. bdEngine = new dojox.string.BidiEngine();
  890. },
  891. runTest:function() {
  892. dojo.forEach(unilisrc, function(el, i){
  893. doh.is(unilisrc[i], bdEngine.bidiTransform(el, 'ILNNN', 'ILNNN'),"bidi layouts empty");
  894. doh.is(unilisrc[i], bdEngine.bidiTransform(el, 'VLNNN', 'ILNNN'),"bidi layouts empty");
  895. doh.is(unilisrc[i], bdEngine.bidiTransform(el, 'IRNNN', 'ILNNN'),"bidi layouts empty");
  896. doh.is(unilisrc[i], bdEngine.bidiTransform(el, 'VRNNN', 'ILNNN'),"bidi layouts empty");
  897. doh.is(unilisrc[i], bdEngine.bidiTransform(el, 'ICNNN', 'ILNNN'),"bidi layouts empty");
  898. doh.is(unilisrc[i], bdEngine.bidiTransform(el, 'IDNNN', 'ILNNN'),"bidi layouts empty");
  899. doh.is(unilisrc[i], bdEngine.bidiTransform(el, 'ILYNN', 'ILNNN'),"bidi layouts empty");
  900. doh.is(unilisrc[i], bdEngine.bidiTransform(el, 'VLYNN', 'ILNNN'),"bidi layouts empty");
  901. doh.is(unilisrc[i], bdEngine.bidiTransform(el, 'IRYNN', 'ILNNN'),"bidi layouts empty");
  902. doh.is(unilisrc[i], bdEngine.bidiTransform(el, 'VRYNN', 'ILNNN'),"bidi layouts empty");
  903. doh.is(unilisrc[i], bdEngine.bidiTransform(el, 'ICYNN', 'ILNNN'),"bidi layouts empty");
  904. doh.is(unilisrc[i], bdEngine.bidiTransform(el, 'IDYNN', 'ILNNN'),"bidi layouts empty");
  905. doh.is(unilisrc[i], bdEngine.bidiTransform(el, 'ILYSN', 'ILNNN'),"bidi layouts empty");
  906. doh.is(unilisrc[i], bdEngine.bidiTransform(el, 'VLYSN', 'ILNNN'),"bidi layouts empty");
  907. doh.is(unilisrc[i], bdEngine.bidiTransform(el, 'IRYSN', 'ILNNN'),"bidi layouts empty");
  908. doh.is(unilisrc[i], bdEngine.bidiTransform(el, 'VRYSN', 'ILNNN'),"bidi layouts empty");
  909. doh.is(unilisrc[i], bdEngine.bidiTransform(el, 'ICYSN', 'ILNNN'),"bidi layouts empty");
  910. doh.is(unilisrc[i], bdEngine.bidiTransform(el, 'IDYSN', 'ILNNN'),"bidi layouts empty");
  911. doh.is(unilisrc[i], bdEngine.bidiTransform(el, 'ILNSN', 'ILNNN'),"bidi layouts empty");
  912. doh.is(unilisrc[i], bdEngine.bidiTransform(el, 'VLNSN', 'ILNNN'),"bidi layouts empty");
  913. doh.is(unilisrc[i], bdEngine.bidiTransform(el, 'IRNSN', 'ILNNN'),"bidi layouts empty");
  914. doh.is(unilisrc[i], bdEngine.bidiTransform(el, 'VRNSN', 'ILNNN'),"bidi layouts empty");
  915. doh.is(unilisrc[i], bdEngine.bidiTransform(el, 'ICNSN', 'ILNNN'),"bidi layouts empty");
  916. doh.is(unilisrc[i], bdEngine.bidiTransform(el, 'IDNSN', 'ILNNN'),"bidi layouts empty");
  917. },this);
  918. }
  919. }
  920. ]);
  921. });