Merge change 3114 into donut

* changes:
  Integrate unsubmitted cupcake change 130903: 	CTS: add test cases for view.Surface
diff --git a/tests/AndroidManifest.xml b/tests/AndroidManifest.xml
index c35205e..cbaa74a 100644
--- a/tests/AndroidManifest.xml
+++ b/tests/AndroidManifest.xml
@@ -499,6 +499,14 @@
             </intent-filter>
         </activity>
 
+        <activity android:name="android.widget.cts.ZoomButtonStubActivity" 
+            android:label="ZoomButtonStubActivity">
+            <intent-filter>
+                <action android:name="android.intent.action.MAIN"/>
+                <category android:name="android.intent.category.FRAMEWORK_INSTRUMENTATION_TEST" />
+            </intent-filter>
+        </activity>
+
         <activity android:name="android.view.cts.SurfaceViewStubActivity"
             android:label="SurfaceViewStubActivity">
             <intent-filter>
diff --git a/tests/res/layout/zoombutton_layout.xml b/tests/res/layout/zoombutton_layout.xml
new file mode 100644
index 0000000..1b1e0b2
--- /dev/null
+++ b/tests/res/layout/zoombutton_layout.xml
@@ -0,0 +1,22 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!--
+ * Copyright (C) 2008 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ -->
+<ZoomButton xmlns:android="http://schemas.android.com/apk/res/android"
+    android:id="@+id/zoombutton_test"
+    android:layout_width="wrap_content"
+    android:layout_height="wrap_content"
+/>
+
diff --git a/tests/src/android/widget/cts/ZoomButtonStubActivity.java b/tests/src/android/widget/cts/ZoomButtonStubActivity.java
new file mode 100644
index 0000000..a49df7a
--- /dev/null
+++ b/tests/src/android/widget/cts/ZoomButtonStubActivity.java
@@ -0,0 +1,36 @@
+/*
+ * Copyright (C) 2009 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package android.widget.cts;
+
+import com.android.cts.stub.R;
+
+import android.app.Activity;
+import android.os.Bundle;
+
+/**
+ * A minimal application for {@link ZoomButton} test.
+ */
+public class ZoomButtonStubActivity extends Activity {
+    /**
+     * Called with the activity is first created.
+     */
+    @Override
+    public void onCreate(Bundle savedInstanceState) {
+        super.onCreate(savedInstanceState);
+        setContentView(R.layout.zoombutton_layout);
+    }
+}
diff --git a/tests/tests/text/src/android/text/cts/TextUtilsTest.java b/tests/tests/text/src/android/text/cts/TextUtilsTest.java
index 31a1b4d..5550db7 100644
--- a/tests/tests/text/src/android/text/cts/TextUtilsTest.java
+++ b/tests/tests/text/src/android/text/cts/TextUtilsTest.java
@@ -44,6 +44,7 @@
 import android.text.style.ReplacementSpan;
 import android.text.style.TextAppearanceSpan;
 import android.text.style.URLSpan;
+import android.util.StringBuilderPrinter;
 
 import java.util.ArrayList;
 import java.util.regex.Pattern;
@@ -83,7 +84,6 @@
 
     @TestTargetNew(
         level = TestLevel.COMPLETE,
-        notes = "Test commaEllipsize method",
         method = "commaEllipsize",
         args = {CharSequence.class, TextPaint.class, float.class, String.class, String.class}
     )
@@ -151,7 +151,6 @@
 
     @TestTargetNew(
         level = TestLevel.COMPLETE,
-        notes = "Test concat method",
         method = "concat",
         args = {CharSequence[].class}
     )
@@ -200,14 +199,12 @@
             TextUtils.concat((CharSequence[]) null);
             fail("Should throw NullPointerException");
         } catch (NullPointerException e) {
-            // issue 1695243, the javadoc for concat() doesn't describe
-            // the expected result when the varargs array is null.
+            // expected
         }
     }
 
     @TestTargetNew(
         level = TestLevel.COMPLETE,
-        notes = "Test copySpansFrom method",
         method = "copySpansFrom",
         args = {Spanned.class, int.class, int.class, Class.class, Spannable.class, int.class}
     )
@@ -265,7 +262,7 @@
             TextUtils.copySpansFrom(source2, 0, source2.length(), Object.class, dest4, 0);
             fail("Should throw IndexOutOfBoundsException");
         } catch (IndexOutOfBoundsException e) {
-            // issue 1688347, not clear the expected result when dest.length < end - start.
+            // expected
         }
         TextUtils.copySpansFrom(source2, 0, dest4.length(), Object.class, dest4, 0);
         spans = dest4.getSpans(0, dest4.length(), Object.class);
@@ -291,8 +288,7 @@
                     Object.class, dest5, dest5.length() - source2.length() + 2);
             fail("Should throw IndexOutOfBoundsException");
         } catch (IndexOutOfBoundsException e) {
-            // issue 1688347,
-            // not clear the expected result when dest.length - destoff < end - start.
+            // expected
         }
 
         // issue 1688347, no javadoc about the expected behavior of the exceptional argument.
@@ -357,7 +353,6 @@
 
     @TestTargetNew(
         level = TestLevel.COMPLETE,
-        notes = "Test ellipsize method",
         method = "ellipsize",
         args = {CharSequence.class, TextPaint.class, float.class, TruncateAt.class}
     )
@@ -406,22 +401,19 @@
             TextUtils.ellipsize(text, null, textWidth, TruncateAt.MIDDLE);
             fail("Should throw NullPointerException");
         } catch (NullPointerException e) {
-            // issue 1688347, not clear what is supposed to happen if the TextPaint is null.
+            // expected
         }
 
         try {
             TextUtils.ellipsize(null, p, textWidth, TruncateAt.MIDDLE);
             fail("Should throw NullPointerException");
         } catch (NullPointerException e) {
-            // issue 1688347, not clear what is supposed to happen
-            // if the text to truncate is null.
+            // expected
         }
     }
 
     @TestTargetNew(
         level = TestLevel.COMPLETE,
-        notes = "Test ellipsize method which can set callback class and can enable"
-            + "or disable to preserve length",
         method = "ellipsize",
         args = {CharSequence.class, TextPaint.class, float.class, TruncateAt.class,
                 boolean.class, EllipsizeCallback.class}
@@ -547,11 +539,13 @@
         try {
             TextUtils.ellipsize(text, null, textWidth, TruncateAt.END, true, callback);
         } catch (NullPointerException e) {
+            // expected
         }
 
         try {
             TextUtils.ellipsize(null, p, textWidth, TruncateAt.END, true, callback);
         } catch (NullPointerException e) {
+            // expected
         }
     }
 
@@ -579,7 +573,6 @@
 
     @TestTargetNew(
         level = TestLevel.COMPLETE,
-        notes = "Test equals method",
         method = "equals",
         args = {CharSequence.class, CharSequence.class}
     )
@@ -624,7 +617,6 @@
 
     @TestTargetNew(
         level = TestLevel.COMPLETE,
-        notes = "Test expandTemplate method",
         method = "expandTemplate",
         args = {CharSequence.class, CharSequence[].class}
     )
@@ -709,7 +701,7 @@
         try {
             TextUtils.expandTemplate("template ^2 to be expanded", (CharSequence[]) null);
         } catch (NullPointerException e) {
-            // issue 1695243, not clear what is supposed to happen if values is null
+            // expected
         }
 
         // the template requests 2 values but only one null value is provided
@@ -725,8 +717,7 @@
             TextUtils.expandTemplate("template ^2 to be expanded",
                     (CharSequence) null, (CharSequence) null);
         } catch (NullPointerException e) {
-            // issue 1695243, not clear what is supposed to happen
-            // if all CharSequences substituted into the template are null.
+            // expected
         }
 
         // the template requests 2 values but no value is provided.
@@ -734,13 +725,14 @@
             TextUtils.expandTemplate("template ^2 to be expanded");
             fail("Should throw IllegalArgumentException!");
         } catch (IllegalArgumentException e) {
+            // expected
         }
 
         // template is null
         try {
             TextUtils.expandTemplate(null, "value1");
         } catch (NullPointerException e) {
-            // issue 1695243, not clear what is supposed to happen if template is null.
+            // expected
         }
     }
 
@@ -762,7 +754,6 @@
 
     @TestTargetNew(
         level = TestLevel.COMPLETE,
-        notes = "Test getChars method",
         method = "getChars",
         args = {CharSequence.class, int.class, int.class, char[].class, int.class}
     )
@@ -850,6 +841,7 @@
             TextUtils.getChars(mockCharSequence, -1, end, destResult, destOff);
             fail("Should throw IndexOutOfBoundsException!");
         } catch (IndexOutOfBoundsException e) {
+            // expected
         }
 
         destResult = destOriginal.clone();
@@ -866,6 +858,7 @@
             TextUtils.getChars(mockCharSequence, start, destResult.length + 1, destResult, destOff);
             fail("Should throw IndexOutOfBoundsException!");
         } catch (IndexOutOfBoundsException e) {
+            // expected
         }
 
         destResult = destOriginal.clone();
@@ -899,7 +892,7 @@
             TextUtils.getChars(null, start, end, destResult, destOff);
             fail("Should throw NullPointerException!");
         } catch (NullPointerException e) {
-            // issue 1695243, not clear what is supposed to happen if source is null.
+            // expected
         }
 
         // exceptional destination
@@ -907,7 +900,7 @@
             TextUtils.getChars(mockCharSequence, start, end, null, destOff);
             fail("Should throw NullPointerException!");
         } catch (NullPointerException e) {
-            // issue 1695243, not clear what is supposed to happen if dest is null.
+            // expected
         }
     }
 
@@ -990,7 +983,6 @@
 
     @TestTargetNew(
         level = TestLevel.COMPLETE,
-        notes = "Test getOffsetAfter method",
         method = "getOffsetAfter",
         args = {CharSequence.class, int.class}
     )
@@ -1037,7 +1029,7 @@
             TextUtils.getOffsetAfter(null, 0);
             fail("Should throw NullPointerException!");
         } catch (NullPointerException e) {
-            // issue 1695243, not clear what is supposed to happen if text is null.
+            // expected
         }
     }
 
@@ -1058,7 +1050,6 @@
 
     @TestTargetNew(
         level = TestLevel.COMPLETE,
-        notes = "Test getOffsetBefore method",
         method = "getOffsetBefore",
         args = {CharSequence.class, int.class}
     )
@@ -1105,13 +1096,12 @@
             TextUtils.getOffsetBefore(null, POS_FIRST_DC00);
             fail("Should throw NullPointerException!");
         } catch (NullPointerException e) {
-            // issue 1695243, not clear what is supposed to happen if text is null.
+            // expected
         }
     }
 
     @TestTargetNew(
         level = TestLevel.COMPLETE,
-        notes = "Test getReverse method",
         method = "getReverse",
         args = {CharSequence.class, int.class, int.class}
     )
@@ -1166,13 +1156,12 @@
             result.toString();
             fail("Should throw IndexOutOfBoundsException!");
         } catch (IndexOutOfBoundsException e) {
-            // issue 1695243, not clear what is supposed result if source is null.
+            // expected
         }
     }
 
     @TestTargetNew(
         level = TestLevel.COMPLETE,
-        notes = "Test getTrimmedLength method",
         method = "getTrimmedLength",
         args = {CharSequence.class}
     )
@@ -1197,13 +1186,12 @@
             TextUtils.getTrimmedLength(null);
             fail("Should throw NullPointerException!");
         } catch (NullPointerException e) {
-            // issue 1695243, not clear what is supposed result if the CharSequence is null.
+            // expected
         }
     }
 
     @TestTargetNew(
         level = TestLevel.COMPLETE,
-        notes = "Test htmlEncode method",
         method = "htmlEncode",
         args = {String.class}
     )
@@ -1217,13 +1205,12 @@
              TextUtils.htmlEncode(null);
              fail("Should throw NullPointerException!");
          } catch (NullPointerException e) {
-             // issue 1695243, not clear what is supposed result if the CharSequence is null.
+             // expected
          }
     }
 
     @TestTargetNew(
         level = TestLevel.COMPLETE,
-        notes = "Test indexOf(CharSequence s, char ch)",
         method = "indexOf",
         args = {CharSequence.class, char.class}
     )
@@ -1256,7 +1243,6 @@
 
     @TestTargetNew(
         level = TestLevel.COMPLETE,
-        notes = "Test indexOf(CharSequence s, char ch, int start)",
         method = "indexOf",
         args = {CharSequence.class, char.class, int.class}
     )
@@ -1297,7 +1283,6 @@
 
     @TestTargetNew(
         level = TestLevel.COMPLETE,
-        notes = "Test indexOf(CharSequence s, char ch, int start, int end)",
         method = "indexOf",
         args = {CharSequence.class, char.class, int.class, int.class}
     )
@@ -1349,7 +1334,6 @@
 
     @TestTargetNew(
         level = TestLevel.COMPLETE,
-        notes = "Test indexOf(CharSequence s, CharSequence needle)",
         method = "indexOf",
         args = {CharSequence.class, CharSequence.class}
     )
@@ -1379,7 +1363,6 @@
 
     @TestTargetNew(
         level = TestLevel.COMPLETE,
-        notes = "Test indexOf(CharSequence s, CharSequence needle, int start)",
         method = "indexOf",
         args = {CharSequence.class, CharSequence.class, int.class}
     )
@@ -1430,7 +1413,6 @@
 
     @TestTargetNew(
         level = TestLevel.COMPLETE,
-        notes = "Test indexOf(CharSequence s, CharSequence needle, int start, int end)",
         method = "indexOf",
         args = {CharSequence.class, CharSequence.class, int.class, int.class}
     )
@@ -1488,7 +1470,6 @@
 
     @TestTargetNew(
         level = TestLevel.COMPLETE,
-        notes = "Test isDigitsOnly method",
         method = "isDigitsOnly",
         args = {CharSequence.class}
     )
@@ -1509,7 +1490,6 @@
 
     @TestTargetNew(
         level = TestLevel.COMPLETE,
-        notes = "Test isEmpty method",
         method = "isEmpty",
         args = {CharSequence.class}
     )
@@ -1522,7 +1502,6 @@
 
     @TestTargetNew(
         level = TestLevel.COMPLETE,
-        notes = "Test isGraphic(char c)",
         method = "isGraphic",
         args = {char.class}
     )
@@ -1553,13 +1532,12 @@
             assertFalse(TextUtils.isGraphic((Character) null));
             fail("Should throw NullPointerException!");
         } catch (NullPointerException e) {
-            // issue 1695243, not clear what is supposed result if the Character is null.
+            // expected
         }
     }
 
     @TestTargetNew(
         level = TestLevel.COMPLETE,
-        notes = "Test isGraphic(CharSequence str)",
         method = "isGraphic",
         args = {CharSequence.class}
     )
@@ -1575,14 +1553,13 @@
             TextUtils.isGraphic(null);
             fail("Should throw NullPointerException!");
         } catch (NullPointerException e) {
-            // issue 1695243, not clear what is supposed result if the CharSequence is null.
+            // expected
         }
     }
 
     @SuppressWarnings("unchecked")
     @TestTargetNew(
         level = TestLevel.COMPLETE,
-        notes = "Test join(CharSequence delimiter, Iterable tokens)",
         method = "join",
         args = {CharSequence.class, Iterable.class}
     )
@@ -1614,7 +1591,6 @@
 
     @TestTargetNew(
         level = TestLevel.COMPLETE,
-        notes = "Test join(CharSequence delimiter, Object[] tokens)",
         method = "join",
         args = {CharSequence.class, Object[].class}
     )
@@ -1643,7 +1619,6 @@
 
     @TestTargetNew(
         level = TestLevel.COMPLETE,
-        notes = "Test lastIndexOf(CharSequence s, char ch)",
         method = "lastIndexOf",
         args = {CharSequence.class, char.class}
     )
@@ -1675,7 +1650,6 @@
 
     @TestTargetNew(
         level = TestLevel.COMPLETE,
-        notes = "Test lastIndexOf(CharSequence s, char ch)",
         method = "lastIndexOf",
         args = {CharSequence.class, char.class, int.class}
     )
@@ -1716,7 +1690,6 @@
 
     @TestTargetNew(
         level = TestLevel.COMPLETE,
-        notes = "Test lastIndexOf(CharSequence s, char ch, int start, int last)",
         method = "lastIndexOf",
         args = {CharSequence.class, char.class, int.class, int.class}
     )
@@ -1763,7 +1736,6 @@
 
     @TestTargetNew(
         level = TestLevel.COMPLETE,
-        notes = "Test regionMatches method",
         method = "regionMatches",
         args = {CharSequence.class, int.class, CharSequence.class, int.class, int.class}
     )
@@ -1840,7 +1812,6 @@
 
     @TestTargetNew(
         level = TestLevel.COMPLETE,
-        notes = "Test replace method",
         method = "replace",
         args = {CharSequence.class, String[].class, CharSequence[].class}
     )
@@ -1872,32 +1843,31 @@
             TextUtils.replace(template, sources, destinations);
             fail("Should throw ArrayIndexOutOfBoundsException!");
         } catch (ArrayIndexOutOfBoundsException e) {
-            // issue 1695243, no description about this exception in javadoc.
+            // expected
         }
 
         try {
             TextUtils.replace(null, sources, destinations);
             fail("Should throw NullPointerException!");
         } catch (NullPointerException e) {
-            // issue 1695243, not clear what is supposed to happen if template is null.
+            // expected
         }
         try {
             TextUtils.replace(template, null, destinations);
             fail("Should throw NullPointerException!");
         } catch (NullPointerException e) {
-            // issue 1695243, not clear what is supposed to happen if sources is null.
+            // expected
         }
         try {
             TextUtils.replace(template, sources, null);
             fail("Should throw NullPointerException!");
         } catch (NullPointerException e) {
-            // issue 1695243, not clear what is supposed to happen if destinations is null.
+            // expected
         }
     }
 
     @TestTargetNew(
         level = TestLevel.COMPLETE,
-        notes = "Test split(String text, Pattern pattern)",
         method = "split",
         args = {String.class, Pattern.class}
     )
@@ -1952,7 +1922,6 @@
 
     @TestTargetNew(
         level = TestLevel.COMPLETE,
-        notes = "Test split(String text, String expression)",
         method = "split",
         args = {String.class, String.class}
     )
@@ -1989,7 +1958,6 @@
 
     @TestTargetNew(
         level = TestLevel.COMPLETE,
-        notes = "Test stringOrSpannedString method",
         method = "stringOrSpannedString",
         args = {CharSequence.class}
     )
@@ -2016,7 +1984,6 @@
 
     @TestTargetNew(
         level = TestLevel.COMPLETE,
-        notes = "Test substring method",
         method = "substring",
         args = {CharSequence.class, int.class, int.class}
     )
@@ -2034,37 +2001,42 @@
             TextUtils.substring(string, string.length(), 0);
             fail("Should throw IndexOutOfBoundsException!");
         } catch (IndexOutOfBoundsException e) {
+            // expected
         }
 
         try {
             TextUtils.substring(string, -1, string.length());
             fail("Should throw IndexOutOfBoundsException!");
         } catch (IndexOutOfBoundsException e) {
+            // expected
         }
 
         try {
             TextUtils.substring(string, Integer.MAX_VALUE, string.length());
             fail("Should throw IndexOutOfBoundsException!");
         } catch (IndexOutOfBoundsException e) {
+            // expected
         }
 
         try {
             TextUtils.substring(string, 0, -1);
             fail("Should throw IndexOutOfBoundsException!");
         } catch (IndexOutOfBoundsException e) {
+            // expected
         }
 
         try {
             TextUtils.substring(string, 0, Integer.MAX_VALUE);
             fail("Should throw IndexOutOfBoundsException!");
         } catch (IndexOutOfBoundsException e) {
+            // expected
         }
 
         try {
             TextUtils.substring(null, 0, string.length());
             fail("Should throw NullPointerException!");
         } catch (NullPointerException e) {
-            // issue 1695243, not clear what is supposed to happen if source is null.
+            // expected
         }
 
         StringBuffer stringBuffer = new StringBuffer("String Buffer");
@@ -2078,7 +2050,6 @@
 
     @TestTargetNew(
         level = TestLevel.COMPLETE,
-        notes = "Test writeToParcel method",
         method = "writeToParcel",
         args = {CharSequence.class, Parcel.class, int.class}
     )
@@ -2158,7 +2129,7 @@
             TextUtils.writeToParcel(spannableString, null, 0);
             fail("Should throw NullPointerException!");
         } catch (NullPointerException e) {
-            // issue 1695243, not clear what is supposed to happen if the Parcel is null.
+            // expected
         }
     }
 
@@ -2186,10 +2157,6 @@
         assertEquals(TextUtils.CAP_MODE_WORDS,
                 TextUtils.getCapsMode(testString, 0, TextUtils.CAP_MODE_WORDS));
         // issue 1586346
-        // assertEquals(TextUtils.CAP_MODE_SENTENCES,
-        //         TextUtils.getCapsMode(testString, 0, TextUtils.CAP_MODE_SENTENCES));
-        // assertEquals(CAP_MODE_ALL,
-        //         TextUtils.getCapsMode(testString, offset, CAP_MODE_ALL));
         assertEquals(TextUtils.CAP_MODE_WORDS,
                 TextUtils.getCapsMode(testString, 0, TextUtils.CAP_MODE_SENTENCES));
         assertEquals(CAP_MODE_CHARACTERS_AND_WORD,
@@ -2202,8 +2169,6 @@
         assertEquals(TextUtils.CAP_MODE_SENTENCES,
                 TextUtils.getCapsMode(testString, offset, TextUtils.CAP_MODE_SENTENCES));
         // issue 1586346
-        // assertEquals(CAP_MODE_ALL,
-        //         TextUtils.getCapsMode(testString, offset, CAP_MODE_ALL));
         assertEquals(CAP_MODE_CHARACTERS_AND_WORD,
                 TextUtils.getCapsMode(testString, 0, CAP_MODE_ALL));
 
@@ -2214,8 +2179,6 @@
         assertEquals(0,
                 TextUtils.getCapsMode(testString, offset, TextUtils.CAP_MODE_SENTENCES));
         // issue 1586346
-        // assertEquals(CAP_MODE_CHARACTERS_AND_WORD,
-        //         TextUtils.getCapsMode(testString, offset, CAP_MODE_ALL));
         assertEquals(TextUtils.CAP_MODE_CHARACTERS,
                 TextUtils.getCapsMode(testString, offset, CAP_MODE_ALL));
 
@@ -2234,8 +2197,6 @@
         assertEquals(TextUtils.CAP_MODE_WORDS,
                 TextUtils.getCapsMode(testString, offset, TextUtils.CAP_MODE_WORDS));
         // issue 1586346
-        // assertEquals(TextUtils.CAP_MODE_SENTENCES,
-        //         TextUtils.getCapsMode(testString, offset, TextUtils.CAP_MODE_SENTENCES));
         assertEquals(TextUtils.CAP_MODE_WORDS,
                 TextUtils.getCapsMode(testString, offset, TextUtils.CAP_MODE_SENTENCES));
         assertEquals(CAP_MODE_CHARACTERS_AND_WORD,
@@ -2248,8 +2209,6 @@
         assertEquals(TextUtils.CAP_MODE_SENTENCES,
                 TextUtils.getCapsMode(testString, offset, TextUtils.CAP_MODE_SENTENCES));
         // issue 1586346
-        // assertEquals(CAP_MODE_ALL,
-        //         TextUtils.getCapsMode(testString, offset, CAP_MODE_ALL));
         assertEquals(TextUtils.CAP_MODE_SENTENCES | TextUtils.CAP_MODE_CHARACTERS,
                 TextUtils.getCapsMode(testString, offset, CAP_MODE_ALL));
 
@@ -2260,15 +2219,12 @@
         assertEquals(TextUtils.CAP_MODE_SENTENCES,
                 TextUtils.getCapsMode(testString, offset, TextUtils.CAP_MODE_SENTENCES));
         // issue 1586346
-        // assertEquals(CAP_MODE_ALL,
-        //         TextUtils.getCapsMode(testString, offset, CAP_MODE_ALL));
         assertEquals(TextUtils.CAP_MODE_SENTENCES | TextUtils.CAP_MODE_CHARACTERS,
                 TextUtils.getCapsMode(testString, offset, CAP_MODE_ALL));
     }
 
     @TestTargetNew(
         level = TestLevel.COMPLETE,
-        notes = "Test getCapsMode method",
         method = "getCapsMode",
         args = {CharSequence.class, int.class, int.class}
     )
@@ -2286,21 +2242,46 @@
             TextUtils.getCapsMode(null, offset, TextUtils.CAP_MODE_SENTENCES);
             fail("Should throw NullPointerException!");
         } catch (NullPointerException e) {
-            // issue 1695243, not clear what is supposed to happen if the CharSequence is null.
+            // expected
         }
 
         try {
             TextUtils.getCapsMode(testString, -1, TextUtils.CAP_MODE_SENTENCES);
             fail("Should throw IndexOutOfBoundsException!");
         } catch (IndexOutOfBoundsException e) {
-            // issue 1695243, not clear what is supposed to happen if using a exceptional offset.
+            // expected
         }
 
         try {
-            TextUtils.getCapsMode(testString, testString.length() + 1, TextUtils.CAP_MODE_SENTENCES);
+            TextUtils.getCapsMode(testString, testString.length() + 1,
+                    TextUtils.CAP_MODE_SENTENCES);
             fail("Should throw IndexOutOfBoundsException!");
         } catch (IndexOutOfBoundsException e) {
-            // issue 1695243, not clear what is supposed to happen if using a exceptional offset.
+            // expected
         }
     }
+
+    @TestTargetNew(
+        level = TestLevel.COMPLETE,
+        method = "dumpSpans",
+        args = {java.lang.CharSequence.class, android.util.Printer.class, java.lang.String.class}
+    )
+    public void testDumpSpans() {
+        StringBuilder builder = new StringBuilder();
+        StringBuilderPrinter printer = new StringBuilderPrinter(builder);
+        CharSequence source = "test dump spans";
+        String prefix = "prefix";
+
+        assertEquals(0, builder.length());
+        TextUtils.dumpSpans(source, printer, prefix);
+        assertTrue(builder.length() > 0);
+
+        builder = new StringBuilder();
+        printer = new StringBuilderPrinter(builder);
+        assertEquals(0, builder.length());
+        SpannableString spanned = new SpannableString(source);
+        spanned.setSpan(new Object(), 0, source.length(), Spanned.SPAN_INCLUSIVE_INCLUSIVE);
+        TextUtils.dumpSpans(spanned, printer, prefix);
+        assertTrue(builder.length() > 0);
+    }
 }
diff --git a/tests/tests/widget/src/android/widget/cts/ZoomButtonTest.java b/tests/tests/widget/src/android/widget/cts/ZoomButtonTest.java
new file mode 100644
index 0000000..4bb412c
--- /dev/null
+++ b/tests/tests/widget/src/android/widget/cts/ZoomButtonTest.java
@@ -0,0 +1,210 @@
+/*
+ * Copyright (C) 2008 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package android.widget.cts;
+
+import com.android.cts.stub.R;
+
+import dalvik.annotation.TestLevel;
+import dalvik.annotation.TestTargetClass;
+import dalvik.annotation.TestTargetNew;
+import dalvik.annotation.TestTargets;
+import dalvik.annotation.ToBeFixed;
+
+import org.xmlpull.v1.XmlPullParser;
+
+import android.app.Activity;
+import android.test.ActivityInstrumentationTestCase2;
+import android.test.UiThreadTest;
+import android.util.AttributeSet;
+import android.util.Xml;
+import android.view.View;
+import android.view.View.OnClickListener;
+import android.view.animation.cts.DelayedCheck;
+import android.widget.ListView;
+import android.widget.ZoomButton;
+
+@TestTargetClass(ZoomButton.class)
+public class ZoomButtonTest extends ActivityInstrumentationTestCase2<ZoomButtonStubActivity> {
+    private ZoomButton mZoomButton;
+    private Activity mActivity;
+
+    public ZoomButtonTest() {
+        super("com.android.cts.stub", ZoomButtonStubActivity.class);
+    }
+
+    @Override
+    protected void setUp() throws Exception {
+        super.setUp();
+
+        mZoomButton = (ZoomButton) getActivity().findViewById(R.id.zoombutton_test);
+        mActivity = getActivity();
+    }
+
+    @TestTargets({
+        @TestTargetNew(
+            level = TestLevel.COMPLETE,
+            method = "ZoomButton",
+            args = {android.content.Context.class}
+        ),
+        @TestTargetNew(
+            level = TestLevel.COMPLETE,
+            method = "ZoomButton",
+            args = {android.content.Context.class, android.util.AttributeSet.class}
+        ),
+        @TestTargetNew(
+            level = TestLevel.COMPLETE,
+            method = "ZoomButton",
+            args = {android.content.Context.class, android.util.AttributeSet.class, int.class}
+        )
+    })
+    @ToBeFixed(bug = "1695243", explanation = "Android API javadocs are incomplete, " +
+            "should add @throws clause into javadoc.")
+    public void testConstructor() {
+        new ZoomButton(mActivity);
+
+        new ZoomButton(mActivity, null);
+
+        new ZoomButton(mActivity, null, 0);
+
+        XmlPullParser parser = mActivity.getResources().getXml(R.layout.zoombutton_layout);
+        AttributeSet attrs = Xml.asAttributeSet(parser);
+        assertNotNull(attrs);
+        new ZoomButton(mActivity, attrs);
+        new ZoomButton(mActivity, attrs, 0);
+
+        try {
+            new ZoomButton(null);
+            fail("should throw NullPointerException.");
+        } catch (NullPointerException e) {
+        }
+
+        try {
+            new ZoomButton(null, null);
+            fail("should throw NullPointerException.");
+        } catch (NullPointerException e) {
+        }
+
+        try {
+            new ZoomButton(null, null, 0);
+            fail("should throw NullPointerException.");
+        } catch (NullPointerException e) {
+        }
+    }
+
+    @TestTargetNew(
+        level = TestLevel.COMPLETE,
+        method = "setEnabled",
+        args = {boolean.class}
+    )
+    public void testSetEnabled() {
+        assertFalse(mZoomButton.isPressed());
+        mZoomButton.setEnabled(true);
+        assertTrue(mZoomButton.isEnabled());
+        assertFalse(mZoomButton.isPressed());
+
+        mZoomButton.setPressed(true);
+        assertTrue(mZoomButton.isPressed());
+        mZoomButton.setEnabled(true);
+        assertTrue(mZoomButton.isEnabled());
+        assertTrue(mZoomButton.isPressed());
+
+        mZoomButton.setEnabled(false);
+        assertFalse(mZoomButton.isEnabled());
+        assertFalse(mZoomButton.isPressed());
+    }
+
+    @TestTargetNew(
+        level = TestLevel.COMPLETE,
+        notes = "Test {@link ZoomButton#dispatchUnhandledMove(View, int)}, " +
+                "this function always returns false",
+        method = "dispatchUnhandledMove",
+        args = {android.view.View.class, int.class}
+    )
+    @UiThreadTest
+    public void testDispatchUnhandledMove() {
+        assertFalse(mZoomButton.dispatchUnhandledMove(new ListView(mActivity), View.FOCUS_DOWN));
+
+        assertFalse(mZoomButton.dispatchUnhandledMove(null, View.FOCUS_DOWN));
+    }
+
+    @TestTargetNew(
+        level = TestLevel.COMPLETE,
+        notes = "Test {@link ZoomButton#onLongClick(View)}, " +
+                "this function always returns true and the parameter 'View v' is ignored.",
+        method = "onLongClick",
+        args = {android.view.View.class}
+    )
+    public void testOnLongClick() {
+        final MockOnClickListener listener = new MockOnClickListener();
+        mZoomButton.setOnClickListener(listener);
+        mZoomButton.setEnabled(true);
+        long speed = 2000;
+        mZoomButton.setZoomSpeed(speed);
+
+        assertFalse(listener.hasOnClickCalled());
+        mZoomButton.performLongClick();
+        new DelayedCheck(speed + 500) {
+            @Override
+            protected boolean check() {
+                return listener.hasOnClickCalled();
+            }
+        };
+    }
+
+    @TestTargetNew(
+        level = TestLevel.NOT_NECESSARY,
+        method = "onTouchEvent",
+        args = {android.view.MotionEvent.class}
+    )
+    public void testOnTouchEvent() {
+        // Do not test. Implementation details.
+    }
+
+    @TestTargetNew(
+        level = TestLevel.NOT_NECESSARY,
+        method = "onKeyUp",
+        args = {int.class, android.view.KeyEvent.class}
+    )
+    public void testOnKeyUp() {
+        // Do not test. Implementation details.
+    }
+
+    @TestTargetNew(
+        level = TestLevel.PARTIAL_COMPLETE,
+        method = "setZoomSpeed",
+        args = {long.class}
+    )
+    @ToBeFixed(bug = "1400249", explanation = "how to check zoom speed after set.")
+    public void testSetZoomSpeed() {
+        mZoomButton.setZoomSpeed(100);
+
+        mZoomButton.setZoomSpeed(-1);
+        // TODO: how to check?
+    }
+
+    private static class MockOnClickListener implements OnClickListener {
+        private boolean mOnClickCalled = false;
+
+        public boolean hasOnClickCalled() {
+            return mOnClickCalled;
+        }
+
+        public void onClick(View v) {
+            mOnClickCalled = true;
+        }
+    }
+}