diff options
author | Tor Norbye <tnorbye@google.com> | 2012-10-15 18:04:19 -0700 |
---|---|---|
committer | Gerrit Code Review <noreply-gerritcodereview@google.com> | 2012-10-15 18:04:20 -0700 |
commit | 6505fb86851a5f1ee73792c2fff8148c7588ab90 (patch) | |
tree | a882deff58ea4fd638421369053660fbc8d21d44 /common/tests/src/com/android/utils/SdkUtilsTest.java | |
parent | 1e6c45d826478a9621f433c28cce38786b890f52 (diff) | |
parent | a1e7aa7cc973adaba4f31673c897724eb8d9f399 (diff) | |
download | sdk-6505fb86851a5f1ee73792c2fff8148c7588ab90.zip sdk-6505fb86851a5f1ee73792c2fff8148c7588ab90.tar.gz sdk-6505fb86851a5f1ee73792c2fff8148c7588ab90.tar.bz2 |
Merge "Misc improvements to the multi-configuration editing"
Diffstat (limited to 'common/tests/src/com/android/utils/SdkUtilsTest.java')
-rw-r--r-- | common/tests/src/com/android/utils/SdkUtilsTest.java | 49 |
1 files changed, 49 insertions, 0 deletions
diff --git a/common/tests/src/com/android/utils/SdkUtilsTest.java b/common/tests/src/com/android/utils/SdkUtilsTest.java index 29a4d51..030e1b7 100644 --- a/common/tests/src/com/android/utils/SdkUtilsTest.java +++ b/common/tests/src/com/android/utils/SdkUtilsTest.java @@ -18,6 +18,7 @@ package com.android.utils; import junit.framework.TestCase; +@SuppressWarnings("javadoc") public class SdkUtilsTest extends TestCase { public void testEndsWithIgnoreCase() { assertTrue(SdkUtils.endsWithIgnoreCase("foo", "foo")); @@ -81,4 +82,52 @@ public class SdkUtilsTest extends TestCase { assertEquals("foobar", SdkUtils.stripWhitespace("foo bar")); assertEquals("foobar", SdkUtils.stripWhitespace(" foo bar \n\t")); } + + public void testWrap() { + String s = + "Hardcoding text attributes directly in layout files is bad for several reasons:\n" + + "\n" + + "* When creating configuration variations (for example for landscape or portrait)" + + "you have to repeat the actual text (and keep it up to date when making changes)\n" + + "\n" + + "* The application cannot be translated to other languages by just adding new " + + "translations for existing string resources."; + String wrapped = SdkUtils.wrap(s, 70, ""); + assertEquals( + "Hardcoding text attributes directly in layout files is bad for several\n" + + "reasons:\n" + + "\n" + + "* When creating configuration variations (for example for landscape or\n" + + "portrait)you have to repeat the actual text (and keep it up to date\n" + + "when making changes)\n" + + "\n" + + "* The application cannot be translated to other languages by just\n" + + "adding new translations for existing string resources.\n", + wrapped); + } + + public void testWrapPrefix() { + String s = + "Hardcoding text attributes directly in layout files is bad for several reasons:\n" + + "\n" + + "* When creating configuration variations (for example for landscape or portrait)" + + "you have to repeat the actual text (and keep it up to date when making changes)\n" + + "\n" + + "* The application cannot be translated to other languages by just adding new " + + "translations for existing string resources."; + String wrapped = SdkUtils.wrap(s, 70, " "); + assertEquals( + "Hardcoding text attributes directly in layout files is bad for several\n" + + " reasons:\n" + + " \n" + + " * When creating configuration variations (for example for\n" + + " landscape or portrait)you have to repeat the actual text (and keep\n" + + " it up to date when making changes)\n" + + " \n" + + " * The application cannot be translated to other languages by just\n" + + " adding new translations for existing string resources.\n", + wrapped); + } + + } |