Merge Chromium + Blink git repositories
[chromium-blink-merge.git] / third_party / WebKit / LayoutTests / fast / text / international / thai-cursor-position.html
blobf0ab3b44f9ee60a6ed61ee8ad9ab8f3ec3dd932b
1 <html>
2 <head>
3 <title></title>
4 </head>
5 <body>
6 <p>This tests that the pixel-level x coordinate of a character range (0,0) doesn't change before and after inserting a Thai character. If this test finishes successfully, this test displays "SUCCEEDED". Otherwise this test displays "FAILED".</p>
7 <div id="test" contenteditable></div>
8 <ul id="console"></ul>
9 <script type="text/javascript">
10 function log(str) {
11 var li = document.createElement("li");
12 li.appendChild(document.createTextNode(str));
13 var console = document.getElementById("console");
14 console.appendChild(li);
17 if (window.testRunner) {
18 testRunner.dumpAsText();
19 var test = document.getElementById("test");
20 test.focus();
22 // Retrieve the pixel-level x coordinate of a character range (0,0) BEFORE inserting a Thai character.
23 var rect0 = textInputController.firstRectForCharacterRange(0, 0);
24 var x0 = rect0.toString().split(',')[0];
26 // Insert a Thai character U+0E01.
27 test.innerText += String.fromCharCode(0x0E01);
29 // Retrieve the pixel-level x coordinate of a character range (0,0) AFTER inserting a Thai character.
30 var rect1 = textInputController.firstRectForCharacterRange(0, 0);
31 var x1 = rect1.toString().split(',')[0];
33 // Compare the x coordinates. (They must be the same.)
34 if (x0 == x1)
35 log('SUCCEEDED');
36 else
37 log('FAILED: before=' + x0 + ', after=' + x1);
39 </script>
40 </body>