summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
author Keisuke Kuroyanagi <ksk@google.com> 2015-12-10 07:18:55 +0000
committer Android (Google) Code Review <android-gerrit@google.com> 2015-12-10 07:18:55 +0000
commitd2441607bdd829e8a9d5593293f69ced31b5634e (patch)
tree29eab1b78871c1052bb0e9b31c930607c9897919
parentff375577952dad90bfa28073c67f97db68f106db (diff)
parente8b3dd47914a52a229c1726b79fe8f02fb59bb73 (diff)
Merge "TextView test: insertion handle movement tests."
-rw-r--r--core/tests/coretests/src/android/widget/TextViewActivityTest.java40
1 files changed, 40 insertions, 0 deletions
diff --git a/core/tests/coretests/src/android/widget/TextViewActivityTest.java b/core/tests/coretests/src/android/widget/TextViewActivityTest.java
index aa576417e992..d55c3b09ac7e 100644
--- a/core/tests/coretests/src/android/widget/TextViewActivityTest.java
+++ b/core/tests/coretests/src/android/widget/TextViewActivityTest.java
@@ -165,6 +165,46 @@ public class TextViewActivityTest extends ActivityInstrumentationTestCase2<TextV
}
@SmallTest
+ public void testInsertionHandle() throws Exception {
+ final String text = "abcd efg hijk ";
+ onView(withId(R.id.textview)).perform(click());
+ onView(withId(R.id.textview)).perform(typeTextIntoFocusedView(text));
+
+ onView(withId(R.id.textview)).perform(clickOnTextAtIndex(text.length()));
+ onView(withId(R.id.textview)).check(hasInsertionPointerAtIndex(text.length()));
+
+ final TextView textView = (TextView)getActivity().findViewById(R.id.textview);
+
+ onHandleView(com.android.internal.R.id.insertion_handle)
+ .perform(dragHandle(textView, Handle.INSERTION, text.indexOf('a')));
+ onView(withId(R.id.textview)).check(hasInsertionPointerAtIndex(text.indexOf("a")));
+
+ onHandleView(com.android.internal.R.id.insertion_handle)
+ .perform(dragHandle(textView, Handle.INSERTION, text.indexOf('f')));
+ onView(withId(R.id.textview)).check(hasInsertionPointerAtIndex(text.indexOf("f")));
+ }
+
+ @SmallTest
+ public void testInsertionHandle_multiLine() throws Exception {
+ final String text = "abcd\n" + "efg\n" + "hijk\n";
+ onView(withId(R.id.textview)).perform(click());
+ onView(withId(R.id.textview)).perform(typeTextIntoFocusedView(text));
+
+ onView(withId(R.id.textview)).perform(clickOnTextAtIndex(text.length()));
+ onView(withId(R.id.textview)).check(hasInsertionPointerAtIndex(text.length()));
+
+ final TextView textView = (TextView)getActivity().findViewById(R.id.textview);
+
+ onHandleView(com.android.internal.R.id.insertion_handle)
+ .perform(dragHandle(textView, Handle.INSERTION, text.indexOf('a')));
+ onView(withId(R.id.textview)).check(hasInsertionPointerAtIndex(text.indexOf("a")));
+
+ onHandleView(com.android.internal.R.id.insertion_handle)
+ .perform(dragHandle(textView, Handle.INSERTION, text.indexOf('f')));
+ onView(withId(R.id.textview)).check(hasInsertionPointerAtIndex(text.indexOf("f")));
+ }
+
+ @SmallTest
public void testSelectionHandles() throws Exception {
final String text = "abcd efg hijk lmn";
onView(withId(R.id.textview)).perform(click());