<!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  &lt;darin@apple.com&gt;

        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  &lt;darin@apple.com&gt;
+
+        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  &lt;ap@webkit.org&gt;
</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 &quot;PASS&quot; messages, followed by &quot;TEST COMPLETE&quot;.
+
+
+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>+&lt;html&gt;
+&lt;head&gt;
+&lt;link rel=&quot;stylesheet&quot; href=&quot;../js/resources/js-test-style.css&quot;&gt;
+&lt;script src=&quot;../js/resources/js-test-pre.js&quot;&gt;&lt;/script&gt;
+&lt;/head&gt;
+&lt;body&gt;
+&lt;p id=&quot;description&quot;&gt;&lt;/p&gt;
+&lt;div id=&quot;console&quot;&gt;&lt;/div&gt;
+&lt;script&gt;
+
+description(&quot;This tests decoding characters in various character sets.&quot;);
+
+function hex(number)
+{
+    var hexDigit = &quot;0123456789ABCDEF&quot;;
+    var hex = hexDigit.substr(number &amp; 0xf, 1);
+    while (number &gt; 15) {
+        number &gt;&gt;= 4;
+        hex = hexDigit.substr(number &amp; 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=&quot;' + charsetName + '&quot;');
+    req.send('');
+    var code = hex(req.responseText.charCodeAt(0));
+    return &quot;U+&quot; + (&quot;0000&quot; + code).substr(code.length, 4);
+}
+
+function testDecode(charsetName, characterSequence, unicode)
+{
+    shouldBe(&quot;decode('&quot; + charsetName + &quot;', '&quot; + characterSequence + &quot;')&quot;, &quot;'&quot; + unicode + &quot;'&quot;);
+}
+
+testDecode('UTF-8', '%E2%88%9A', 'U+221A');
+testDecode('macintosh', '%C3', 'U+221A');
+testDecode('MacRoman', '%C3', 'U+221A');
+
+debug('');
+
+successfullyParsed = true;
+
+&lt;/script&gt;
+&lt;script src=&quot;../js/resources/js-test-post.js&quot;&gt;&lt;/script&gt;
+&lt;/body&gt;
+&lt;/html&gt;
</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 &quot;PASS&quot; messages, followed by &quot;TEST COMPLETE&quot;.
+
+
+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>+&lt;html&gt;
+&lt;head&gt;
+&lt;link rel=&quot;stylesheet&quot; href=&quot;../js/resources/js-test-style.css&quot;&gt;
+&lt;script src=&quot;../js/resources/js-test-pre.js&quot;&gt;&lt;/script&gt;
+&lt;/head&gt;
+&lt;body&gt;
+&lt;p id=&quot;description&quot;&gt;&lt;/p&gt;
+&lt;div id=&quot;console&quot;&gt;&lt;/div&gt;
+&lt;form id=&quot;form&quot; target=&quot;subframe&quot;&gt;&lt;input type=&quot;text&quot; id=&quot;text&quot; name=&quot;text&quot;&gt;&lt;/form&gt;
+&lt;iframe id=&quot;subframe&quot; name=&quot;subframe&quot;&gt;&lt;/iframe&gt;
+&lt;script&gt;
+
+
+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(&quot;This tests encoding characters in various character sets.&quot;);
+
+    for (i = 0; i &lt; charsets.length; ++i) {
+        shouldBe(&quot;encode('&quot; + charsets[i] + &quot;', '&quot; + unicodes[i] + &quot;')&quot;, &quot;'&quot; + expectedResults[i] + &quot;'&quot;);
+    }
+
+    // Hack; we'd prefer to use js-test-post.js but it runs too soon.
+    shouldBeTrue(&quot;successfullyParsed&quot;);
+    debug('&lt;br&gt;&lt;span class=&quot;pass&quot;&gt;TEST COMPLETE&lt;/span&gt;');
+
+    if (window.layoutTestController)
+        layoutTestController.notifyDone();
+}
+
+function subframeLoaded()
+{
+    var URL = &quot;&quot; + 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 &gt;= 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 = &quot;data:text/plain,x&quot;;
+    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(&quot;UTF-8&quot;, &quot;U+00A0&quot;, &quot;%C2%A0&quot;);
+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;
+
+&lt;/script&gt;
+&lt;/body&gt;
+&lt;/html&gt;
</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 &quot;PASS&quot; messages, followed by &quot;TEST COMPLETE&quot;.
-
-
-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>-&lt;html&gt;
-&lt;head&gt;
-&lt;link rel=&quot;stylesheet&quot; href=&quot;../js/resources/js-test-style.css&quot;&gt;
-&lt;script src=&quot;../js/resources/js-test-pre.js&quot;&gt;&lt;/script&gt;
-&lt;/head&gt;
-&lt;body&gt;
-&lt;p id=&quot;description&quot;&gt;&lt;/p&gt;
-&lt;div id=&quot;console&quot;&gt;&lt;/div&gt;
-&lt;script&gt;
-
-description(&quot;This tests decoding characters in various character sets.&quot;);
-
-function hex(number)
-{
-    var hexDigit = &quot;0123456789ABCDEF&quot;;
-    var hex = hexDigit.substr(number &amp; 0xf, 1);
-    while (number &gt; 15) {
-        number &gt;&gt;= 4;
-        hex = hexDigit.substr(number &amp; 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=&quot;' + charsetName + '&quot;');
-    req.send('');
-    var code = hex(req.responseText.charCodeAt(0));
-    return &quot;U+&quot; + (&quot;0000&quot; + code).substr(code.length, 4);
-}
-
-function testDecode(charsetName, characterSequence, unicode)
-{
-    shouldBe(&quot;decode('&quot; + charsetName + &quot;', '&quot; + characterSequence + &quot;')&quot;, &quot;'&quot; + unicode + &quot;'&quot;);
-}
-
-testDecode('UTF-8', '%E2%88%9A', 'U+221A');
-testDecode('macintosh', '%C3', 'U+221A');
-testDecode('MacRoman', '%C3', 'U+221A');
-
-debug('');
-
-successfullyParsed = true;
-
-&lt;/script&gt;
-&lt;script src=&quot;../js/resources/js-test-post.js&quot;&gt;&lt;/script&gt;
-&lt;/body&gt;
-&lt;/html&gt;
</del></span></pre>
</div>
</div>

</body>
</html>