Merge Chromium + Blink git repositories
[chromium-blink-merge.git] / third_party / WebKit / LayoutTests / inspector / editor / text-editor-reveal-line.html
blob0e810ebd77a9ba7b3095b3bcff0336c0ea48c05c
1 <html>
2 <head>
3 <script src="../../http/tests/inspector/inspector-test.js"></script>
4 <script src="editor-test.js"></script>
5 <script>
6 function test()
8 var out = InspectorTest.addResult;
9 var textEditor = InspectorTest.createTestEditor(500);
10 textEditor.setMimeType("text/javascript");
11 textEditor.setReadOnly(false);
12 textEditor.element.focus();
14 textEditor.setText(new Array(10000).join("\n"));
16 testLineReveal(0);
17 testLineReveal(500);
18 testLineReveal(510);
19 testLineReveal(490);
20 testLineReveal(1000);
21 testLineReveal(100);
22 testLineReveal(9998);
23 testLineReveal(-100);
24 testLineReveal(textEditor.linesCount);
25 testLineReveal(-1);
26 testLineReveal(10100);
28 function testLineReveal(lineNumber)
30 textEditor.revealPosition(lineNumber);
31 var firstLine = textEditor.firstVisibleLine();
32 var lastLine = textEditor.lastVisibleLine();
33 var lineCentered = Math.abs(2 * lineNumber - firstLine - lastLine) <= 1;
34 out("======= Revealing line: " + lineNumber);
35 out(" is line centered: " + lineCentered);
36 out("\n");
38 InspectorTest.completeTest();
41 </script>
42 </head>
44 <body onload="runTest()">
45 <p>
46 This test checks that text editor's revealLine centers line where needed.
47 </p>
49 </body>
50 </html>