Search in sources :

Example 1 with XMLFormattingPreferences

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

the class TestPartitionFormatterXML method testPreservePCDATAFormat.

public void testPreservePCDATAFormat() throws UnsupportedEncodingException, IOException, CoreException {
    // BUG84688
    XMLFormattingPreferences prefs = new XMLFormattingPreferences();
    prefs.setPCDataWhitespaceStrategy(XMLFormattingPreferences.PRESERVE);
    prefs.setClearAllBlankLines(true);
    formatAndAssertEquals("testfiles/xml/xml-preservepcdata.xml", "testfiles/xml/xml-preservepcdata-yes-fmt.xml", prefs);
    // results are different than old formatter
    prefs.setPCDataWhitespaceStrategy(XMLFormattingPreferences.COLLAPSE);
    formatAndAssertEquals("testfiles/xml/xml-preservepcdata.xml", "testfiles/xml/xml-preservepcdata-no-newfmt.xml", prefs);
}
Also used : XMLFormattingPreferences(org.eclipse.wst.xml.core.internal.formatter.XMLFormattingPreferences)

Example 2 with XMLFormattingPreferences

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

the class TestPartitionFormatterXML method testFormatCommentsJoinLinesDisabled.

public void testFormatCommentsJoinLinesDisabled() throws UnsupportedEncodingException, IOException, CoreException {
    XMLFormattingPreferences prefs = new XMLFormattingPreferences();
    prefs.setJoinCommentLines(false);
    formatAndAssertEquals("testfiles/xml/xml-join-lines-disabled.xml", "testfiles/xml/xml-join-lines-disabled-fmt.xml", prefs);
}
Also used : XMLFormattingPreferences(org.eclipse.wst.xml.core.internal.formatter.XMLFormattingPreferences)

Example 3 with XMLFormattingPreferences

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

the class TestPartitionFormatterXML method testEmptyContentNodeFormat.

public void testEmptyContentNodeFormat() throws UnsupportedEncodingException, IOException, CoreException {
    // BUG174243
    XMLFormattingPreferences prefs = new XMLFormattingPreferences();
    prefs.setIndentMultipleAttributes(true);
    formatAndAssertEquals("testfiles/xml/usetagswithemptycontent.xml", "testfiles/xml/usetagswithemptycontent-fmt.xml", prefs);
}
Also used : XMLFormattingPreferences(org.eclipse.wst.xml.core.internal.formatter.XMLFormattingPreferences)

Example 4 with XMLFormattingPreferences

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

the class TestPartitionFormatterXML method testSplitAttributesFormat.

public void testSplitAttributesFormat() throws UnsupportedEncodingException, IOException, CoreException {
    // BUG113584
    XMLFormattingPreferences prefs = new XMLFormattingPreferences();
    // the below tests are slighty different from old formatter test
    prefs.setIndentMultipleAttributes(true);
    prefs.setAlignFinalBracket(false);
    formatAndAssertEquals("testfiles/xml/multiattributes2.xml", "testfiles/xml/multiattributes2-yessplit-noalign-newfmt.xml", prefs);
    prefs.setIndentMultipleAttributes(false);
    prefs.setAlignFinalBracket(false);
    formatAndAssertEquals("testfiles/xml/multiattributes2.xml", "testfiles/xml/multiattributes2-nosplit-noalign-newfmt.xml", prefs);
}
Also used : XMLFormattingPreferences(org.eclipse.wst.xml.core.internal.formatter.XMLFormattingPreferences)

Example 5 with XMLFormattingPreferences

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

the class TestPartitionFormatterXML method testPreserveFormat.

public void testPreserveFormat() 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-standalone.xml", "testfiles/xml/xml-space-preserve-standalone-newfmt.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