| OLD | NEW |
| 1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file |
| 2 // for details. All rights reserved. Use of this source code is governed by a | 2 // for details. All rights reserved. Use of this source code is governed by a |
| 3 // BSD-style license that can be found in the LICENSE file. | 3 // BSD-style license that can be found in the LICENSE file. |
| 4 | 4 |
| 5 | 5 |
| 6 #library('bidi_format_test'); | 6 #library('bidi_format_test'); |
| 7 | 7 |
| 8 #import('../../../lib/i18n/intl.dart'); | 8 #import('../../../lib/i18n/intl.dart'); |
| 9 #import('../../../lib/unittest/unittest.dart'); | 9 #import('../../../lib/unittest/unittest.dart'); |
| 10 | 10 |
| 11 /** | 11 /** |
| 12 * Tests the bidirectional text formatting library. | 12 * Tests the bidirectional text formatting library. |
| 13 */ | 13 */ |
| 14 main() { | 14 main() { |
| 15 var LRM = BidiUtils.LRM; | |
| 16 var RLM = BidiUtils.RLM; | |
| 17 var LRE = BidiUtils.LRE; | |
| 18 var RLE = BidiUtils.RLE; | |
| 19 var PDF = BidiUtils.PDF; | |
| 20 var LTR = TextDirection.LTR; | 15 var LTR = TextDirection.LTR; |
| 21 var RTL = TextDirection.RTL; | 16 var RTL = TextDirection.RTL; |
| 22 var UNKNOWN = TextDirection.UNKNOWN; | 17 var UNKNOWN = TextDirection.UNKNOWN; |
| 23 var he = '\u05e0\u05e1'; | 18 var he = '\u05e0\u05e1'; |
| 24 var en = 'abba'; | 19 var en = 'abba'; |
| 25 var html = '<'; | 20 var html = '<'; |
| 26 var longEn = 'abba sabba gabba '; | 21 var longEn = 'abba sabba gabba '; |
| 27 var longHe = '\u05e0 \u05e1 \u05e0 '; | 22 var longHe = '\u05e0 \u05e1 \u05e0 '; |
| 28 var ltrFmt = new BidiFormatter.LTR(); // LTR context | 23 var ltrFmt = new BidiFormatter.LTR(); // LTR context |
| 29 var rtlFmt = new BidiFormatter.RTL(); // RTL context | 24 var rtlFmt = new BidiFormatter.RTL(); // RTL context |
| (...skipping 177 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 207 expect(rtlFmt.wrapWithUnicode(he, direction : TextDirection.LTR), | 202 expect(rtlFmt.wrapWithUnicode(he, direction : TextDirection.LTR), |
| 208 equals('$LRE$he$PDF$RLM')); | 203 equals('$LRE$he$PDF$RLM')); |
| 209 // Test supposed overall dir (LTR) doesn't match context dir (unknown). | 204 // Test supposed overall dir (LTR) doesn't match context dir (unknown). |
| 210 expect(unkFmt.wrapWithUnicode(he, direction : TextDirection.LTR), | 205 expect(unkFmt.wrapWithUnicode(he, direction : TextDirection.LTR), |
| 211 equals('$LRE$he$PDF')); | 206 equals('$LRE$he$PDF')); |
| 212 // Test supposed overall dir (neutral) doesn't match context dir (LTR). | 207 // Test supposed overall dir (neutral) doesn't match context dir (LTR). |
| 213 expect(ltrFmt.wrapWithUnicode(he, direction : TextDirection.UNKNOWN), | 208 expect(ltrFmt.wrapWithUnicode(he, direction : TextDirection.UNKNOWN), |
| 214 equals('$he$LRM')); | 209 equals('$he$LRM')); |
| 215 }); | 210 }); |
| 216 } | 211 } |
| OLD | NEW |