Loading core/tests/coretests/src/android/widget/TextViewActivityTest.java +40 −0 Original line number Diff line number Diff line Loading @@ -164,6 +164,46 @@ public class TextViewActivityTest extends ActivityInstrumentationTestCase2<TextV assertFloatingToolbarIsDisplayed(getActivity()); } @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"; Loading Loading
core/tests/coretests/src/android/widget/TextViewActivityTest.java +40 −0 Original line number Diff line number Diff line Loading @@ -164,6 +164,46 @@ public class TextViewActivityTest extends ActivityInstrumentationTestCase2<TextV assertFloatingToolbarIsDisplayed(getActivity()); } @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"; Loading