Move parseFontFaceDescriptor to CSSPropertyParser.cpp
[chromium-blink-merge.git] / third_party / WebKit / LayoutTests / inspector / editor / text-editor-char-to-coordinates.html
blob9de410e1d86e0a7ff2dd1613c973d90411acdbc7
1 <html>
2 <head>
3 <script src="../../http/tests/inspector/inspector-test.js"></script>
4 <script src="editor-test.js"></script>
5 <script>
7 function test()
9 var text = [
10 "function foo(a, b) {",
11 " var f = /*.[a]/.test(a);",
12 " return f;"
14 var textEditor = InspectorTest.createTestEditor();
15 textEditor.setText(text.join("\n"));
17 InspectorTest.runTestSuite([
18 function testCoordinatesToCursorPositionOuter(next)
20 InspectorTest.addResult("Request char at (-1000, -1000)");
21 InspectorTest.addResult("Result:" + JSON.stringify(textEditor.coordinatesToCursorPosition(-1000, -1000)));
22 next();
25 function testTextToCoordinatesCornerCases(next)
27 InspectorTest.addResult("Request (-1, 0):" + JSON.stringify(textEditor.cursorPositionToCoordinates(-1, 0)));
28 InspectorTest.addResult("Request (100, 0):" + JSON.stringify(textEditor.cursorPositionToCoordinates(100, 0)));
29 InspectorTest.addResult("Request (0, -1):" + JSON.stringify(textEditor.cursorPositionToCoordinates(0, -1)));
30 InspectorTest.addResult("Request (0, 100):" + JSON.stringify(textEditor.cursorPositionToCoordinates(0, 100)));
31 InspectorTest.addResult("Request (-100, -1100):" + JSON.stringify(textEditor.cursorPositionToCoordinates(0, 100)));
32 next();
35 function testInverseRelationTextToCoordinates(next)
37 for(var i = 0; i < textEditor.linesCount; ++i) {
38 var line = textEditor.line(i);
39 InspectorTest.addResult("Testing line '" + line + "'");
40 for(var j = 0; j < textEditor.length; ++j) {
41 var xy = textEditor.cursorPositionToCoordinates(i, j);
42 if (!xy) {
43 InspectorTest.addResult("Failed inversion for line=" + i + " column=" + j);
44 continue;
47 var range = textEditor.coordinatesToCursorPosition(xy.x, xy.y);
48 if (range.startLine !== i || range.startColumn !== j)
49 InspectorTest.addResult("Failed inversion for line=" + i + " column=" + j);
52 next();
54 ]);
57 </script>
58 </head>
60 <body onload="runTest()">
61 <p>
62 Test editor cursorPositionToCoordinates and coordinatesToCursorPosition API
63 </p>
64 </body>
65 </html>