blob: f05b9f6351a74455cf740451a36cfa54893bec6d [file] [log] [blame]
<html>
<head>
<meta charset="ISO-8859-8">
<body>
<p>Test rendering of ISO-8859-8.
<p>
<div class="test">ùðá</div>
<div class="test">ùðá â÷ë </div>
<div class="test">ùðá abc â÷ë</div>
<div class="test">abc ùðá def</div>
<div class="test">ùðá <span dir=ltr>â÷ë</span></div>
<div class="test">ùðá <span dir=rtl>â÷ë</span></div>
<ul id="console" dir=ltr></ul>
<script src="../../../resources/js-test-pre.js"></script>
<script>
var succeed = true;
function checkClientRect(test, index, offset, dir, char)
{
if (test.nodeType == 3) {
for (var i = 0; i < test.textContent.length; ++i) {
range.setStart(test, i);
range.setEnd(test, i+1);
rects = range.getClientRects();
if (dir == "ltr") {
if (rects[0].left < offset) {
testFailed("Test " + index + " LTR: character " + range.toString() + " should be rendered right of " + char);
succeed = false;
}
} else {
if (rects[0].left > offset) {
testFailed("Test " + index + " RTL: character " + range.toString() + " should be rendered left of " + char);
succeed = false;
}
}
offset = rects[0].left;
char = range.toString();
}
} else if (test.nodeType == 1) {
for (var node = test.firstChild; node; node = node.nextSibling) {
checkClientRect(node, index, offset, dir, char);
}
}
}
if (window.testRunner)
testRunner.dumpAsText();
var tests = document.getElementsByClassName('test');
var range = document.createRange();
for (var i = 0; i < tests.length; ++i) {
checkClientRect(tests[i], i, -1, "ltr", " ");
tests[i].style.direction = "rtl";
checkClientRect(tests[i], i, 10000, "rtl", " ");
tests[i].style.display = "none";
}
if (succeed == true)
testPassed("Test completed successfully");
</script>
</body>
</html>