haikuwebkit/LayoutTests/fast/text/offsetForPosition-cluster-a...

36 lines
2.2 KiB
HTML
Raw Permalink Blame History

This file contains invisible Unicode characters

This file contains invisible Unicode characters that are indistinguishable to humans but may be processed differently by a computer. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

<p>
Test for a bug where computing the text offset for a position at the
beginning of a glyph cluster at the beginning of a Core Text run resulted
in an attempt to read past the end of a vector.
</p>
<p>
The test passes if an assertion failure does not occur and the selection is
before the first Thai character.
</p>
<p id="result">
Test did not run.
</p>
<div id="target" style="font-size: 36px;">
ไพ
</div>
<script>
if (window.testRunner) {
testRunner.dumpAsText();
var target = document.getElementById("target");
var result = document.getElementById("result");
var x = target.offsetLeft + 1;
var y = target.offsetTop + target.offsetHeight / 2;
eventSender.mouseMoveTo(x, y);
eventSender.mouseDown();
eventSender.mouseUp();
var selection = getSelection();
if (selection.baseNode === target.firstChild && selection.baseOffset === 5)
result.innerText = "PASS";
else
result.innerText = "FAIL: Selection at " + selection.baseNode + "[" + selection.baseOffset + "]";
}
</script>