| <html> |
| <head> |
| <script src="../../http/tests/inspector/inspector-test.js"></script> |
| <script src="highlighter-test.js"></script> |
| <script> |
| function test() |
| { |
| var src = "/*\n" + |
| " * a comment\n" + |
| " */"; |
| |
| var model = new WebInspector.TextEditorModel(); |
| model.setText(src); |
| function noop() {} |
| var textEditorMainPanel = new WebInspector.TextEditorMainPanel(null, model, '', noop, noop, noop, noop); |
| |
| var selection; |
| function dumpTextModel(msg) |
| { |
| InspectorTest.addResult(msg); |
| InspectorTest.addResult(model.text()); |
| InspectorTest.addResult('Selection ' + selection.startLine + ',' + selection.startColumn + ' ' + selection.endLine + ',' + selection.endColumn + '\n'); |
| } |
| |
| selection = textEditorMainPanel._indentLines(new WebInspector.TextRange(0, 0, 1, 0)); |
| dumpTextModel("After indenting first fully selected line"); |
| |
| selection = textEditorMainPanel._indentLines(new WebInspector.TextRange(0, 5, 1, 0)); |
| dumpTextModel("After indenting first partially selected line"); |
| |
| selection = textEditorMainPanel._unindentLines(new WebInspector.TextRange(0, 0, 2, 0)); |
| dumpTextModel("After unindenting two fully selected lines"); |
| |
| selection = textEditorMainPanel._unindentLines(new WebInspector.TextRange(0, 5, 1, 6)); |
| dumpTextModel("After unindenting two partially selected lines (bug 97462)"); |
| |
| selection = textEditorMainPanel._unindentLines(new WebInspector.TextRange(0, 0, 2, 3)); |
| dumpTextModel("After unindenting three partially selected lines"); |
| |
| InspectorTest.completeTest(); |
| } |
| </script> |
| </head> |
| |
| <body onload="runTest()"> |
| <p> |
| This test checks code indentation and unindentation of several lines of code. |
| </p> |
| </body> |
| </html> |