Wed, 31 Dec 2014 06:09:35 +0100
Cloned upstream origin tor-browser at tor-browser-31.3.0esr-4.5-1-build1
revision ID fc1c9ff7c1b2defdbc039f12214767608f46423f for hacking purpose.
michael@0 | 1 | /* Tests transliteration of new characters in Unicode 5.1, 5.2, and 6.0 |
michael@0 | 2 | */ |
michael@0 | 3 | |
michael@0 | 4 | const inTeluguFractions = "\u0C78\u0C79\u0C7A\u0C7B\u0C7C\u0C7D\u0C7E"; |
michael@0 | 5 | const inMalayalamNumbers = "\u0D70\u0D71\u0D72\u0D73\u0D74\u0D75"; |
michael@0 | 6 | |
michael@0 | 7 | /* MYANMAR SHAN DIGIT ONE, |
michael@0 | 8 | SUNDANESE DIGIT TWO, |
michael@0 | 9 | LEPCHA DIGIT THREE, |
michael@0 | 10 | OL CHIKI DIGIT FOUR, |
michael@0 | 11 | VAI DIGIT FIVE, |
michael@0 | 12 | SAURASHTRA DIGIT SIX |
michael@0 | 13 | KAYAH LI DIGIT SEVEN |
michael@0 | 14 | CHAM DIGIT EIGHT |
michael@0 | 15 | JAVANESE DIGIT NINE |
michael@0 | 16 | MEETEI MAYEK DIGIT ZERO */ |
michael@0 | 17 | const inDigits = "\u1091\u1BB2\u1C43\u1C54\uA625\uA8D6\uA907\uAA58\uA9D9\uABF0"; |
michael@0 | 18 | const inRomanNumerals = "\u2185\u2186\u2187\u2188"; |
michael@0 | 19 | const inSuperSubscripts = "\u2C7C\u2C7D\u2095\u209C"; |
michael@0 | 20 | |
michael@0 | 21 | const expectedTeluguFractions = "[0][1][2][3][1][2][3]"; |
michael@0 | 22 | const expectedMalayalamNumbers = "[10][100][1000][1/4][1/2][3/4]"; |
michael@0 | 23 | const expectedDigits = "1234567890"; |
michael@0 | 24 | const expectedRomanNumerals = "[6][50][50000][100000]"; |
michael@0 | 25 | const expectedSuperSubscripts = "v(j)^(V)v(h)v(t)"; |
michael@0 | 26 | |
michael@0 | 27 | const EntityAfterCharsetConv = 512; |
michael@0 | 28 | const transliterate = 8; |
michael@0 | 29 | |
michael@0 | 30 | const charset = "ISO-8859-1"; |
michael@0 | 31 | |
michael@0 | 32 | function run_test() { |
michael@0 | 33 | var SaveAsCharset = |
michael@0 | 34 | Components.Constructor("@mozilla.org/intl/saveascharset;1", |
michael@0 | 35 | "nsISaveAsCharset", |
michael@0 | 36 | "Init"); |
michael@0 | 37 | |
michael@0 | 38 | var converter = new SaveAsCharset(charset, |
michael@0 | 39 | EntityAfterCharsetConv, |
michael@0 | 40 | transliterate); |
michael@0 | 41 | |
michael@0 | 42 | var outTeluguFractions = converter.Convert(inTeluguFractions); |
michael@0 | 43 | do_check_eq(outTeluguFractions, expectedTeluguFractions); |
michael@0 | 44 | |
michael@0 | 45 | var outMalayalamNumbers = converter.Convert(inMalayalamNumbers); |
michael@0 | 46 | do_check_eq(outMalayalamNumbers, expectedMalayalamNumbers); |
michael@0 | 47 | |
michael@0 | 48 | var outDigits = converter.Convert(inDigits); |
michael@0 | 49 | do_check_eq(outDigits, expectedDigits); |
michael@0 | 50 | |
michael@0 | 51 | var outRomanNumerals = converter.Convert(inRomanNumerals); |
michael@0 | 52 | do_check_eq(outRomanNumerals, expectedRomanNumerals); |
michael@0 | 53 | |
michael@0 | 54 | var outSuperSubscripts = converter.Convert(inSuperSubscripts); |
michael@0 | 55 | do_check_eq(outSuperSubscripts, expectedSuperSubscripts); |
michael@0 | 56 | } |