From a1e7aa7cc973adaba4f31673c897724eb8d9f399 Mon Sep 17 00:00:00 2001 From: Tor Norbye Date: Mon, 15 Oct 2012 13:03:40 -0700 Subject: Misc improvements to the multi-configuration editing * Fix bug in switching to preview configurations * Don't draw drop shadows for thumbnails in Dialog themes * Move the preview title labels to sit above each preview thumbnail * Make error thumbnails include rendering error messages (and wrap if necessary), plus tweak appearance * Make switch animation show rectangles animating in both directions Change-Id: I0995617fa277b48419a88c5203abf5b1d49af711 --- .../tests/src/com/android/utils/SdkUtilsTest.java | 49 ++++++++++++++++++++++ 1 file changed, 49 insertions(+) (limited to 'common/tests/src/com/android/utils/SdkUtilsTest.java') 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); + } + + } -- cgit v1.1