Change fast/s* and fast/t* files to use pre and post js files in LayoutTests/resources.
[WebKit-https.git] / LayoutTests / fast / text / international / iso-8859-8.html
1
2 <html>
3 <head>
4 <meta charset="ISO-8859-8">
5 <body>
6 <p>Test rendering of ISO-8859-8.
7 <p>
8 <div class="test">ùðá</div>
9 <div class="test">ùðá â÷ë </div>
10 <div class="test">ùðá abc â÷ë</div>
11 <div class="test">abc ùðá def</div>
12 <div class="test">ùðá <span dir=ltr>â÷ë</span></div>
13 <div class="test">ùðá <span dir=rtl>â÷ë</span></div>
14 <ul id="console" dir=ltr></ul>
15
16 <script src="../../../resources/js-test-pre.js"></script>
17 <script> 
18     var succeed = true;
19
20     function checkClientRect(test, index, offset, dir, char)
21     {
22         if (test.nodeType == 3) {
23             for (var i = 0; i < test.textContent.length; ++i) {
24                 range.setStart(test, i);
25                 range.setEnd(test, i+1); 
26                 rects = range.getClientRects();
27                 if (dir == "ltr") {
28                     if (rects[0].left < offset) {
29                         testFailed("Test " + index + " LTR: character " + range.toString() + " should be rendered right of " + char);
30                         succeed = false;
31           
32                     }
33                 } else {
34                     if (rects[0].left > offset) {
35                         testFailed("Test " + index + " RTL: character " + range.toString() + " should be rendered left of " + char);
36                         succeed = false;
37                     }
38                 }
39                 offset = rects[0].left;
40                 char = range.toString();
41             }
42
43         } else if (test.nodeType == 1) {
44             for (var node = test.firstChild; node; node = node.nextSibling) {
45                 checkClientRect(node, index, offset, dir, char);
46             }
47         }
48     }
49             
50     if (window.testRunner)
51         testRunner.dumpAsText();
52         
53     var tests = document.getElementsByClassName('test');
54     var range = document.createRange();
55     for (var i = 0; i < tests.length; ++i) {
56         checkClientRect(tests[i], i, -1, "ltr", " ");
57
58         tests[i].style.direction = "rtl";
59         checkClientRect(tests[i], i, 10000, "rtl", " ");
60     
61         tests[i].style.display = "none";
62     }
63     if (succeed == true) 
64         testPassed("Test completed successfully");
65 </script> 
66 </body>
67 </html>