Changeset 74225 in webkit
- Timestamp:
- Dec 16, 2010 6:28:48 PM (13 years ago)
- Location:
- trunk/LayoutTests
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/LayoutTests/ChangeLog
r74222 r74225 1 2010-12-16 Yong Li <yoli@rim.com> 2 3 Reviewed by Alexey Proskuryakov. 4 5 https://bugs.webkit.org/show_bug.cgi?id=51199 6 Add decoding tests for UTF-16 LE/BE and their variants. 7 Also, check the full decoded text but not only the first one. 8 9 * fast/encoding/char-decoding.html: 10 * fast/encoding/char-decoding-expected.txt: 11 * fast/encoding/resources/char-decoding-utils.js: 12 1 13 2010-12-16 Jian Li <jianli@chromium.org> 2 14 -
trunk/LayoutTests/fast/encoding/char-decoding-expected.txt
r74186 r74225 156 156 PASS decode('dos-874', '%A1') is 'U+0E01' 157 157 PASS decode('dos-874', '%DB') is 'U+F8C1' 158 PASS decode('UTF-7', '+AD4') is 'U+002B' 159 PASS decode('utf-7', '+AD4') is 'U+002B' 158 PASS decode('UTF-7', '+AD4') is 'U+002B/U+0041/U+0044/U+0034' 159 PASS decode('utf-7', '+AD4') is 'U+002B/U+0041/U+0044/U+0034' 160 PASS decode('UTF-16LE', '%69%D8%D6%DE') is 'U+D869/U+DED6' 161 PASS decode('unicodeFEFF', '%69%D8%D6%DE') is 'U+D869/U+DED6' 162 PASS decode('UTF-16', '%69%D8%D6%DE') is 'U+D869/U+DED6' 163 PASS decode('ISO-10646-UCS-2', '%69%D8%D6%DE') is 'U+D869/U+DED6' 164 PASS decode('UCS-2', '%69%D8%D6%DE') is 'U+D869/U+DED6' 165 PASS decode('Unicode', '%69%D8%D6%DE') is 'U+D869/U+DED6' 166 PASS decode('csUnicode', '%69%D8%D6%DE') is 'U+D869/U+DED6' 167 PASS decode('UTF-16BE', '%D8%69%DE%D6') is 'U+D869/U+DED6' 168 PASS decode('unicodeFFFE', '%D8%69%DE%D6') is 'U+D869/U+DED6' 160 169 PASS successfullyParsed is true 161 170 -
trunk/LayoutTests/fast/encoding/char-decoding.html
r74186 r74225 90 90 // UTF-7 is expressly forbidden, so decoding it should not work correctly. 91 91 // This attempts to decode '<' as UTF-7 (+AD4) but it ends up being decoded 92 // as a '+'. 93 testDecode('UTF-7', '+AD4', 'U+002B'); 94 testDecode('utf-7', '+AD4', 'U+002B'); 92 // as a '+AD4'. 93 testDecode('UTF-7', '+AD4', 'U+002B/U+0041/U+0044/U+0034'); 94 testDecode('utf-7', '+AD4', 'U+002B/U+0041/U+0044/U+0034'); 95 96 // UTF-16LE and variants. 97 testDecode('UTF-16LE', '%69%D8%D6%DE', 'U+D869/U+DED6'); 98 testDecode('unicodeFEFF', '%69%D8%D6%DE', 'U+D869/U+DED6'); 99 // According to HTML5 and for IE compatibility, UTF-16 is treated as little endian. The following tests fail as of Firefox 3.6.13. 100 testDecode('UTF-16', '%69%D8%D6%DE', 'U+D869/U+DED6'); 101 testDecode('ISO-10646-UCS-2', '%69%D8%D6%DE', 'U+D869/U+DED6'); 102 testDecode('UCS-2', '%69%D8%D6%DE', 'U+D869/U+DED6'); 103 testDecode('Unicode', '%69%D8%D6%DE', 'U+D869/U+DED6'); 104 testDecode('csUnicode', '%69%D8%D6%DE', 'U+D869/U+DED6'); 105 106 // UTF-16BE and variants. 107 testDecode('UTF-16BE', '%D8%69%DE%D6', 'U+D869/U+DED6'); 108 testDecode('unicodeFFFE', '%D8%69%DE%D6', 'U+D869/U+DED6'); 95 109 96 110 successfullyParsed = true; -
trunk/LayoutTests/fast/encoding/resources/char-decoding-utils.js
r74186 r74225 10 10 } 11 11 12 function decode (charsetName, characterSequence)12 function decodeText(charsetName, characterSequence) 13 13 { 14 14 var req = new XMLHttpRequest; … … 16 16 req.overrideMimeType('text/plain; charset="' + charsetName + '"'); 17 17 req.send(''); 18 var code = hex(req.responseText.charCodeAt(0)); 19 return "U+" + ("0000" + code).substr(code.length, 4); 18 return req.responseText; 19 } 20 21 function decode(charsetName, characterSequence) 22 { 23 var decodedText = decodeText(charsetName, characterSequence); 24 var result = ""; 25 for (var i = 0; i < decodedText.length; ++i) { 26 var code = hex(decodedText.charCodeAt(i)); 27 if (i) 28 result += "/"; 29 result += "U+" + ("0000" + code).substr(code.length, 4); 30 } 31 return result; 20 32 } 21 33
Note: See TracChangeset
for help on using the changeset viewer.