Search in sources :

Example 1 with TestData

use of com.intellij.formatting.engine.TestData in project intellij-community by JetBrains.

the class NewLineBlocksIteratorTest method testFirstBlockOnNewLineNotStartsIt.

public void testFirstBlockOnNewLineNotStartsIt() throws IOException, JDOMException {
    String text = "[]varx []=r'''\n" + "'''";
    TestData data = FormatterEngineTestsKt.extractFormattingTestData(text);
    Document document = EditorFactory.getInstance().createDocument(data.getTextToFormat());
    NewLineBlocksIterator iterator = new NewLineBlocksIterator(data.getRootBlock(), document);
    checkStartOffsets(new int[] { 0 }, iterator);
}
Also used : TestData(com.intellij.formatting.engine.TestData) Document(com.intellij.openapi.editor.Document) NewLineBlocksIterator(com.intellij.psi.formatter.common.NewLineBlocksIterator)

Example 2 with TestData

use of com.intellij.formatting.engine.TestData in project intellij-community by JetBrains.

the class FormatterBasedLineInfoBuilderTest method getLineInfos.

private static List<LineIndentInfo> getLineInfos(String text) throws IOException, JDOMException {
    TestData data = FormatterEngineTestsKt.extractFormattingTestData(text);
    Document document = EditorFactory.getInstance().createDocument(data.getTextToFormat());
    FormatterBasedLineIndentInfoBuilder builder = new FormatterBasedLineIndentInfoBuilder(document, data.getRootBlock(), null);
    return builder.build();
}
Also used : TestData(com.intellij.formatting.engine.TestData) Document(com.intellij.openapi.editor.Document)

Aggregations

TestData (com.intellij.formatting.engine.TestData)2 Document (com.intellij.openapi.editor.Document)2 NewLineBlocksIterator (com.intellij.psi.formatter.common.NewLineBlocksIterator)1