<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN"
"http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head><meta http-equiv="content-type" content="text/html; charset=utf-8" /><style type="text/css"><!--
#msg dl { border: 1px #006 solid; background: #369; padding: 6px; color: #fff; }
#msg dt { float: left; width: 6em; font-weight: bold; }
#msg dt:after { content:':';}
#msg dl, #msg dt, #msg ul, #msg li, #header, #footer { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt; }
#msg dl a { font-weight: bold}
#msg dl a:link { color:#fc3; }
#msg dl a:active { color:#ff0; }
#msg dl a:visited { color:#cc6; }
h3 { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt; font-weight: bold; }
#msg pre { overflow: auto; background: #ffc; border: 1px #fc0 solid; padding: 6px; }
#msg ul, pre { overflow: auto; }
#header, #footer { color: #fff; background: #636; border: 1px #300 solid; padding: 6px; }
#patch { width: 100%; }
#patch h4 {font-family: verdana,arial,helvetica,sans-serif;font-size:10pt;padding:8px;background:#369;color:#fff;margin:0;}
#patch .propset h4, #patch .binary h4 {margin:0;}
#patch pre {padding:0;line-height:1.2em;margin:0;}
#patch .diff {width:100%;background:#eee;padding: 0 0 10px 0;overflow:auto;}
#patch .propset .diff, #patch .binary .diff {padding:10px 0;}
#patch span {display:block;padding:0 10px;}
#patch .modfile, #patch .addfile, #patch .delfile, #patch .propset, #patch .binary, #patch .copfile {border:1px solid #ccc;margin:10px 0;}
#patch ins {background:#dfd;text-decoration:none;display:block;padding:0 10px;}
#patch del {background:#fdd;text-decoration:none;display:block;padding:0 10px;}
#patch .lines, .info {color:#888;background:#fff;}
--></style>
<title>[19969] trunk/LayoutTests</title>
</head>
<body>
<div id="msg">
<dl>
<dt>Revision</dt> <dd><a href="http://trac.webkit.org/projects/webkit/changeset/19969">19969</a></dd>
<dt>Author</dt> <dd>oliver</dd>
<dt>Date</dt> <dd>2007-03-05 15:02:18 -0800 (Mon, 05 Mar 2007)</dd>
</dl>
<h3>Log Message</h3>
<pre>2007-03-05 Darin Adler <darin@apple.com>
Reviewed by Oliver.
Text encoding test case
* fast/encoding/char-encoding-expected.txt: Added.
* fast/encoding/char-encoding.html: Added.
* fast/encoding/charset-names-expected.txt: Moved.
* fast/encoding/charset-names.html: Moved.</pre>
<h3>Modified Paths</h3>
<ul>
<li><a href="#trunkLayoutTestsChangeLog">trunk/LayoutTests/ChangeLog</a></li>
</ul>
<h3>Added Paths</h3>
<ul>
<li><a href="#trunkLayoutTestsfastencodingchardecodingexpectedtxt">trunk/LayoutTests/fast/encoding/char-decoding-expected.txt</a></li>
<li><a href="#trunkLayoutTestsfastencodingchardecodinghtml">trunk/LayoutTests/fast/encoding/char-decoding.html</a></li>
<li><a href="#trunkLayoutTestsfastencodingcharencodingexpectedtxt">trunk/LayoutTests/fast/encoding/char-encoding-expected.txt</a></li>
<li><a href="#trunkLayoutTestsfastencodingcharencodinghtml">trunk/LayoutTests/fast/encoding/char-encoding.html</a></li>
</ul>
<h3>Removed Paths</h3>
<ul>
<li><a href="#trunkLayoutTestsfastencodingcharsetnamesexpectedtxt">trunk/LayoutTests/fast/encoding/charset-names-expected.txt</a></li>
<li><a href="#trunkLayoutTestsfastencodingcharsetnameshtml">trunk/LayoutTests/fast/encoding/charset-names.html</a></li>
</ul>
</div>
<div id="patch">
<h3>Diff</h3>
<a id="trunkLayoutTestsChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/LayoutTests/ChangeLog (19968 => 19969)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/ChangeLog        2007-03-05 20:39:41 UTC (rev 19968)
+++ trunk/LayoutTests/ChangeLog        2007-03-05 23:02:18 UTC (rev 19969)
</span><span class="lines">@@ -1,3 +1,14 @@
</span><ins>+2007-03-05 Darin Adler <darin@apple.com>
+
+ Reviewed by Oliver.
+
+ Text encoding test case
+
+ * fast/encoding/char-encoding-expected.txt: Added.
+ * fast/encoding/char-encoding.html: Added.
+ * fast/encoding/charset-names-expected.txt: Moved.
+ * fast/encoding/charset-names.html: Moved.
+
</ins><span class="cx"> 2007-03-05 Alexey Proskuryakov <ap@webkit.org>
</span><span class="cx">
</span><span class="cx"> Reviewed by Darin.
</span></span></pre></div>
<a id="trunkLayoutTestsfastencodingchardecodingexpectedtxtfromrev19968trunkLayoutTestsfastencodingcharsetnamesexpectedtxt"></a>
<div class="copfile"><h4>Copied: trunk/LayoutTests/fast/encoding/char-decoding-expected.txt (from rev 19968, trunk/LayoutTests/fast/encoding/charset-names-expected.txt) (0 => 19969)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/fast/encoding/char-decoding-expected.txt         (rev 0)
+++ trunk/LayoutTests/fast/encoding/char-decoding-expected.txt        2007-03-05 23:02:18 UTC (rev 19969)
</span><span class="lines">@@ -0,0 +1,13 @@
</span><ins>+This tests decoding characters in various character sets.
+
+On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
+
+
+PASS decode('UTF-8', '%E2%88%9A') is 'U+221A'
+PASS decode('macintosh', '%C3') is 'U+221A'
+PASS decode('MacRoman', '%C3') is 'U+221A'
+
+PASS successfullyParsed is true
+
+TEST COMPLETE
+
</ins></span></pre></div>
<a id="trunkLayoutTestsfastencodingchardecodinghtmlfromrev19968trunkLayoutTestsfastencodingcharsetnameshtml"></a>
<div class="copfile"><h4>Copied: trunk/LayoutTests/fast/encoding/char-decoding.html (from rev 19968, trunk/LayoutTests/fast/encoding/charset-names.html) (0 => 19969)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/fast/encoding/char-decoding.html         (rev 0)
+++ trunk/LayoutTests/fast/encoding/char-decoding.html        2007-03-05 23:02:18 UTC (rev 19969)
</span><span class="lines">@@ -0,0 +1,50 @@
</span><ins>+<html>
+<head>
+<link rel="stylesheet" href="../js/resources/js-test-style.css">
+<script src="../js/resources/js-test-pre.js"></script>
+</head>
+<body>
+<p id="description"></p>
+<div id="console"></div>
+<script>
+
+description("This tests decoding characters in various character sets.");
+
+function hex(number)
+{
+ var hexDigit = "0123456789ABCDEF";
+ var hex = hexDigit.substr(number & 0xf, 1);
+ while (number > 15) {
+ number >>= 4;
+ hex = hexDigit.substr(number & 15, 1) + hex;
+ }
+ return hex;
+}
+
+function decode(charsetName, characterSequence)
+{
+ var req = new XMLHttpRequest;
+ req.open('GET', 'data:text/plain,' + characterSequence, false);
+ req.overrideMimeType('text/plain; charset="' + charsetName + '"');
+ req.send('');
+ var code = hex(req.responseText.charCodeAt(0));
+ return "U+" + ("0000" + code).substr(code.length, 4);
+}
+
+function testDecode(charsetName, characterSequence, unicode)
+{
+ shouldBe("decode('" + charsetName + "', '" + characterSequence + "')", "'" + unicode + "'");
+}
+
+testDecode('UTF-8', '%E2%88%9A', 'U+221A');
+testDecode('macintosh', '%C3', 'U+221A');
+testDecode('MacRoman', '%C3', 'U+221A');
+
+debug('');
+
+successfullyParsed = true;
+
+</script>
+<script src="../js/resources/js-test-post.js"></script>
+</body>
+</html>
</ins></span></pre></div>
<a id="trunkLayoutTestsfastencodingcharencodingexpectedtxt"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/fast/encoding/char-encoding-expected.txt (0 => 19969)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/fast/encoding/char-encoding-expected.txt         (rev 0)
+++ trunk/LayoutTests/fast/encoding/char-encoding-expected.txt        2007-03-05 23:02:18 UTC (rev 19969)
</span><span class="lines">@@ -0,0 +1,12 @@
</span><ins>+This tests encoding characters in various character sets.
+
+On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
+
+
+PASS encode('UTF-8', 'U+00A0') is '%C2%A0'
+PASS encode('macintosh', 'U+221A') is '%C3'
+PASS encode('MacRoman', 'U+221A') is '%C3'
+PASS successfullyParsed is true
+
+TEST COMPLETE
+
</ins></span></pre></div>
<a id="trunkLayoutTestsfastencodingcharencodinghtml"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/fast/encoding/char-encoding.html (0 => 19969)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/fast/encoding/char-encoding.html         (rev 0)
+++ trunk/LayoutTests/fast/encoding/char-encoding.html        2007-03-05 23:02:18 UTC (rev 19969)
</span><span class="lines">@@ -0,0 +1,104 @@
</span><ins>+<html>
+<head>
+<link rel="stylesheet" href="../js/resources/js-test-style.css">
+<script src="../js/resources/js-test-pre.js"></script>
+</head>
+<body>
+<p id="description"></p>
+<div id="console"></div>
+<form id="form" target="subframe"><input type="text" id="text" name="text"></form>
+<iframe id="subframe" name="subframe"></iframe>
+<script>
+
+
+var charsets = new Array;
+var unicodes = new Array;
+var expectedResults = new Array;
+
+var results = new Object;
+
+var i = 0;
+
+function encode(charset, unicode)
+{
+ // Returns a value already encoded, since we can't do it synchronously.
+ return results[charset][unicode];
+}
+
+function testsDone()
+{
+ var form = document.getElementById('form');
+ var subframe = document.getElementById('subframe');
+
+ form.parentNode.removeChild(form);
+ subframe.parentNode.removeChild(subframe);
+
+ description("This tests encoding characters in various character sets.");
+
+ for (i = 0; i < charsets.length; ++i) {
+ shouldBe("encode('" + charsets[i] + "', '" + unicodes[i] + "')", "'" + expectedResults[i] + "'");
+ }
+
+ // Hack; we'd prefer to use js-test-post.js but it runs too soon.
+ shouldBeTrue("successfullyParsed");
+ debug('<br><span class="pass">TEST COMPLETE</span>');
+
+ if (window.layoutTestController)
+ layoutTestController.notifyDone();
+}
+
+function subframeLoaded()
+{
+ var URL = "" + document.getElementById('subframe').contentWindow.location;
+ var charsetResults = results[charsets[i]];
+ if (!charsetResults) {
+ charsetResults = new Object;
+ results[charsets[i]] = charsetResults;
+ }
+ charsetResults[unicodes[i]] = URL.substr(URL.indexOf('=') + 1);
+
+ ++i;
+ runTest();
+}
+
+function runTest()
+{
+ if (i >= charsets.length) {
+ testsDone();
+ return;
+ }
+
+ var form = document.getElementById('form');
+ var text = document.getElementById('text');
+ var subframe = document.getElementById('subframe');
+
+ form.acceptCharset = charsets[i];
+ form.action = "data:text/plain,x";
+ subframe.onload = subframeLoaded;
+ text.value = String.fromCharCode(unicodes[i].replace('U+', '0x'));
+ form.submit();
+}
+
+function testEncode(charsetName, unicode, characterSequence)
+{
+ charsets.push(charsetName);
+ unicodes.push(unicode);
+ expectedResults.push(characterSequence);
+}
+
+testEncode("UTF-8", "U+00A0", "%C2%A0");
+testEncode('macintosh', 'U+221A', '%C3');
+testEncode('MacRoman', 'U+221A', '%C3');
+
+// Turning on this test causes a download to occur. FIXME: A bug?
+//testEncode('UTF-8', 'U+221A', '%E2%88%9A');
+
+if (window.layoutTestController)
+ layoutTestController.waitUntilDone();
+runTest();
+
+successfullyParsed = true;
+
+</script>
+</body>
+</html>
</ins></span></pre></div>
<a id="trunkLayoutTestsfastencodingcharsetnamesexpectedtxt"></a>
<div class="delfile"><h4>Deleted: trunk/LayoutTests/fast/encoding/charset-names-expected.txt (19968 => 19969)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/fast/encoding/charset-names-expected.txt        2007-03-05 20:39:41 UTC (rev 19968)
+++ trunk/LayoutTests/fast/encoding/charset-names-expected.txt        2007-03-05 23:02:18 UTC (rev 19969)
</span><span class="lines">@@ -1,13 +0,0 @@
</span><del>-This tests decoding characters in various character sets.
-
-On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
-
-
-PASS decode('UTF-8', '%E2%88%9A') is 'U+221A'
-PASS decode('macintosh', '%C3') is 'U+221A'
-PASS decode('MacRoman', '%C3') is 'U+221A'
-
-PASS successfullyParsed is true
-
-TEST COMPLETE
-
</del></span></pre></div>
<a id="trunkLayoutTestsfastencodingcharsetnameshtml"></a>
<div class="delfile"><h4>Deleted: trunk/LayoutTests/fast/encoding/charset-names.html (19968 => 19969)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/fast/encoding/charset-names.html        2007-03-05 20:39:41 UTC (rev 19968)
+++ trunk/LayoutTests/fast/encoding/charset-names.html        2007-03-05 23:02:18 UTC (rev 19969)
</span><span class="lines">@@ -1,50 +0,0 @@
</span><del>-<html>
-<head>
-<link rel="stylesheet" href="../js/resources/js-test-style.css">
-<script src="../js/resources/js-test-pre.js"></script>
-</head>
-<body>
-<p id="description"></p>
-<div id="console"></div>
-<script>
-
-description("This tests decoding characters in various character sets.");
-
-function hex(number)
-{
- var hexDigit = "0123456789ABCDEF";
- var hex = hexDigit.substr(number & 0xf, 1);
- while (number > 15) {
- number >>= 4;
- hex = hexDigit.substr(number & 15, 1) + hex;
- }
- return hex;
-}
-
-function decode(charsetName, characterSequence)
-{
- var req = new XMLHttpRequest;
- req.open('GET', 'data:text/plain,' + characterSequence, false);
- req.overrideMimeType('text/plain; charset="' + charsetName + '"');
- req.send('');
- var code = hex(req.responseText.charCodeAt(0));
- return "U+" + ("0000" + code).substr(code.length, 4);
-}
-
-function testDecode(charsetName, characterSequence, unicode)
-{
- shouldBe("decode('" + charsetName + "', '" + characterSequence + "')", "'" + unicode + "'");
-}
-
-testDecode('UTF-8', '%E2%88%9A', 'U+221A');
-testDecode('macintosh', '%C3', 'U+221A');
-testDecode('MacRoman', '%C3', 'U+221A');
-
-debug('');
-
-successfullyParsed = true;
-
-</script>
-<script src="../js/resources/js-test-post.js"></script>
-</body>
-</html>
</del></span></pre>
</div>
</div>
</body>
</html>