diff options
author | Tor Norbye <tnorbye@google.com> | 2013-03-19 19:46:27 -0700 |
---|---|---|
committer | Tor Norbye <tnorbye@google.com> | 2013-03-19 19:46:27 -0700 |
commit | 8e295a929298d003fb76871518e492179d8a6094 (patch) | |
tree | 8b02ca98a3997e45dba78a36801f9a0794fb5a20 /eclipse/plugins/com.android.ide.eclipse.tests/src/com/android | |
parent | 1f1c499db555c5388f91447d48f24d3b19249dc2 (diff) | |
download | sdk-8e295a929298d003fb76871518e492179d8a6094.zip sdk-8e295a929298d003fb76871518e492179d8a6094.tar.gz sdk-8e295a929298d003fb76871518e492179d8a6094.tar.bz2 |
52407: should add a newline at the end of autogenerated xml files
Change-Id: Ia7a910e4426cf73f9ed25de9dfaf3df63cb88116
Diffstat (limited to 'eclipse/plugins/com.android.ide.eclipse.tests/src/com/android')
-rw-r--r-- | eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/adt/internal/editors/formatting/EclipseXmlPrettyPrinterTest.java | 25 |
1 files changed, 23 insertions, 2 deletions
diff --git a/eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/adt/internal/editors/formatting/EclipseXmlPrettyPrinterTest.java b/eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/adt/internal/editors/formatting/EclipseXmlPrettyPrinterTest.java index 8fc8dd1..ac5fd01 100644 --- a/eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/adt/internal/editors/formatting/EclipseXmlPrettyPrinterTest.java +++ b/eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/adt/internal/editors/formatting/EclipseXmlPrettyPrinterTest.java @@ -63,6 +63,7 @@ public class EclipseXmlPrettyPrinterTest extends TestCase { XmlFormatStyle style = AndroidXmlFormattingStrategy.guessStyle(model, document); EclipseXmlPrettyPrinter printer = new EclipseXmlPrettyPrinter(prefs, style, delimiter); + printer.setEndWithNewline(xml.endsWith("\n")); StringBuilder sb = new StringBuilder(1000); Node startNode = document; @@ -180,7 +181,7 @@ public class EclipseXmlPrettyPrinterTest extends TestCase { " <item name=\"title_container\" type=\"id\"/>\n" + " <item name=\"title_logo\" type=\"id\"/>\n" + "\n" + - "</resources>"); + "</resources>\n"); } public void testResources() throws Exception { @@ -876,7 +877,7 @@ public class EclipseXmlPrettyPrinterTest extends TestCase { " <string name=\"untitled2\"><untitled2></string>\n" + " <string name=\"untitled3\">'untitled3"</string>\n" + "\n" + - "</resources>"); + "</resources>\n"); } public void testCData1() throws Exception { @@ -954,4 +955,24 @@ public class EclipseXmlPrettyPrinterTest extends TestCase { " android:layout_width=\"match_parent\"\n" + " android:layout_height=\"match_parent\" />\n"); } + + public void testPreserveLastNewline() throws Exception { + checkFormat( + "res/values/strings.xml", + "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n" + + "<resources>\n" + + "<string name=\"progress_completed_export_all\">The database has " + + "<b>successfully</b> been exported into: <br /><br /><font size=\"14\">" + + "\\\"<i>%s</i>\\\"</font></string>" + + "</resources>\n", + + "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n" + + "<resources>\n" + + "\n" + + " <string name=\"progress_completed_export_all\">The database has " + + "<b>successfully</b> been exported into: <br /><br /><font size=\"14\">" + + "\\\"<i>%s</i>\\\"</font></string>\n" + + "\n" + + "</resources>\n"); + } } |