Search in sources :

Example 11 with XMLFormattingPreferences

use of org.eclipse.wst.xml.core.internal.formatter.XMLFormattingPreferences in project webtools.sourceediting by eclipse.

the class TestPartitionFormatterXML method testPreserveFormatDTD.

public void testPreserveFormatDTD() throws UnsupportedEncodingException, IOException, CoreException {
    // results are different than old formatter
    // Bug [228495] - Result should have blank lines cleared
    XMLFormattingPreferences prefs = new XMLFormattingPreferences();
    prefs.setClearAllBlankLines(true);
    formatAndAssertEquals("testfiles/xml/xml-space-preserve-dtd.xml", "testfiles/xml/xml-space-preserve-dtd-newfmt.xml", prefs);
}
Also used : XMLFormattingPreferences(org.eclipse.wst.xml.core.internal.formatter.XMLFormattingPreferences)

Example 12 with XMLFormattingPreferences

use of org.eclipse.wst.xml.core.internal.formatter.XMLFormattingPreferences in project webtools.sourceediting by eclipse.

the class TestPartitionFormatterXML method testKeepEmptyLines.

public void testKeepEmptyLines() throws UnsupportedEncodingException, IOException, CoreException {
    // Bug 228495
    // Test that formatting keeps empty lines
    XMLFormattingPreferences prefs = new XMLFormattingPreferences();
    prefs.setClearAllBlankLines(false);
    formatAndAssertEquals("testfiles/xml/xml-keep-blank-lines.xml", "testfiles/xml/xml-keep-blank-lines-fmt.xml", prefs);
}
Also used : XMLFormattingPreferences(org.eclipse.wst.xml.core.internal.formatter.XMLFormattingPreferences)

Example 13 with XMLFormattingPreferences

use of org.eclipse.wst.xml.core.internal.formatter.XMLFormattingPreferences in project webtools.sourceediting by eclipse.

the class TestPartitionFormatterXML method testBug353451.

/**
 * Tests the scenario where two regions are capable of formatting the same whitespace. See
 * https://bugs.eclipse.org/353451
 */
public void testBug353451() throws UnsupportedEncodingException, IOException, CoreException {
    XMLFormattingPreferences prefs = new XMLFormattingPreferences();
    prefs.setClearAllBlankLines(true);
    formatAndAssertEquals("testfiles/xml/bug353451.xml", "testfiles/xml/bug353451-fmt.xml", prefs);
}
Also used : XMLFormattingPreferences(org.eclipse.wst.xml.core.internal.formatter.XMLFormattingPreferences)

Example 14 with XMLFormattingPreferences

use of org.eclipse.wst.xml.core.internal.formatter.XMLFormattingPreferences in project webtools.sourceediting by eclipse.

the class TestPartitionFormatterXML method testSimpleXml.

public void testSimpleXml() throws UnsupportedEncodingException, IOException, CoreException {
    // results are different than old formatter
    // Bug [228495] - Result should have blank lines cleared
    XMLFormattingPreferences prefs = new XMLFormattingPreferences();
    prefs.setClearAllBlankLines(true);
    formatAndAssertEquals("testfiles/xml/simple-standalone.xml", "testfiles/xml/simple-standalone-newfmt.xml", prefs);
}
Also used : XMLFormattingPreferences(org.eclipse.wst.xml.core.internal.formatter.XMLFormattingPreferences)

Example 15 with XMLFormattingPreferences

use of org.eclipse.wst.xml.core.internal.formatter.XMLFormattingPreferences in project webtools.sourceediting by eclipse.

the class TestPartitionFormatterXML method testClearBlankLines.

public void testClearBlankLines() throws UnsupportedEncodingException, IOException, CoreException {
    // Bug 228495
    // Test that formatting clears empty lines
    XMLFormattingPreferences prefs = new XMLFormattingPreferences();
    prefs.setClearAllBlankLines(true);
    formatAndAssertEquals("testfiles/xml/xml-keep-blank-lines.xml", "testfiles/xml/xml-clear-blank-lines-fmt.xml", prefs);
}
Also used : XMLFormattingPreferences(org.eclipse.wst.xml.core.internal.formatter.XMLFormattingPreferences)

Aggregations

XMLFormattingPreferences (org.eclipse.wst.xml.core.internal.formatter.XMLFormattingPreferences)16 ByteArrayOutputStream (java.io.ByteArrayOutputStream)1 BadLocationException (org.eclipse.jface.text.BadLocationException)1 MalformedTreeException (org.eclipse.text.edits.MalformedTreeException)1 TextEdit (org.eclipse.text.edits.TextEdit)1 IStructuredModel (org.eclipse.wst.sse.core.internal.provisional.IStructuredModel)1 IStructuredDocument (org.eclipse.wst.sse.core.internal.provisional.text.IStructuredDocument)1