public void testEntityFormat() throws UnsupportedEncodingException, IOException, CoreException { // results are different than old formatter // BUG102076 XMLFormattingPreferences prefs = new XMLFormattingPreferences(); prefs.setClearAllBlankLines(true); formatAndAssertEquals("testfiles/xml/entities.xml", "testfiles/xml/entities-newfmt.xml", prefs); }
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); }
public void testFormatDocumentLevelComment() throws UnsupportedEncodingException, IOException, CoreException { XMLFormattingPreferences prefs = new XMLFormattingPreferences(); prefs.setJoinCommentLines(false); formatAndAssertEquals( "testfiles/xml/xml-format-document-level-comment.xml", "testfiles/xml/xml-format-document-level-comment-fmt.xml", prefs); }
public void testFormatCommentsDisabled() throws UnsupportedEncodingException, IOException, CoreException { XMLFormattingPreferences prefs = new XMLFormattingPreferences(); prefs.setFormatCommentText(false); formatAndAssertEquals( "testfiles/xml/xml-format-comments-disabled.xml", "testfiles/xml/xml-format-comments-disabled-fmt.xml", prefs); }
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); }
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); }
public void testSpaceBeforeEmptyCloseTag() throws UnsupportedEncodingException, IOException, CoreException { // Bug 195264 XMLFormattingPreferences prefs = new XMLFormattingPreferences(); prefs.setSpaceBeforeEmptyCloseTag(false); formatAndAssertEquals( "testfiles/xml/xml-empty-tag-space.xml", "testfiles/xml/xml-empty-tag-space-none-newfmt.xml", prefs); prefs.setSpaceBeforeEmptyCloseTag(true); formatAndAssertEquals( "testfiles/xml/xml-empty-tag-space.xml", "testfiles/xml/xml-empty-tag-space-newfmt.xml", prefs); }
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); }
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); }
public void testAlignEndBracketFormat() throws UnsupportedEncodingException, IOException, CoreException { // results are different than old formatter // BUG113584 XMLFormattingPreferences prefs = new XMLFormattingPreferences(); prefs.setIndentMultipleAttributes(false); prefs.setAlignFinalBracket(true); formatAndAssertEquals( "testfiles/xml/multiattributes.xml", "testfiles/xml/multiattributes-nosplit-yesalign-newfmt.xml", prefs); // results are different than old formatter prefs.setIndentMultipleAttributes(true); prefs.setAlignFinalBracket(true); formatAndAssertEquals( "testfiles/xml/multiattributes.xml", "testfiles/xml/multiattributes-yessplit-yesalign-newfmt.xml", prefs); }
/** * 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); }