Loading core/java/android/widget/Editor.java +3 −1 Original line number Diff line number Diff line Loading @@ -4734,7 +4734,9 @@ public class Editor { public static final int HANDLE_TYPE_SELECTION_START = 0; public static final int HANDLE_TYPE_SELECTION_END = 1; private class SelectionHandleView extends HandleView { /** For selection handles */ @VisibleForTesting public final class SelectionHandleView extends HandleView { // Indicates the handle type, selection start (HANDLE_TYPE_SELECTION_START) or selection // end (HANDLE_TYPE_SELECTION_END). @HandleType Loading core/tests/coretests/src/android/widget/TextViewActivityMouseTest.java +2 −0 Original line number Diff line number Diff line Loading @@ -44,6 +44,7 @@ import static android.widget.espresso.TextViewAssertions.hasSelection; import android.app.Activity; import android.support.test.filters.MediumTest; import android.support.test.filters.Suppress; import android.support.test.rule.ActivityTestRule; import android.support.test.runner.AndroidJUnit4; import android.view.MotionEvent; Loading @@ -62,6 +63,7 @@ import org.junit.runner.RunWith; */ @RunWith(AndroidJUnit4.class) @MediumTest @Suppress // Consistently failing. b/29591177 public class TextViewActivityMouseTest { @Rule Loading core/tests/coretests/src/android/widget/TextViewActivityTest.java +1 −1 Original line number Diff line number Diff line Loading @@ -310,9 +310,9 @@ public class TextViewActivityTest { @Test public void testToolbarAndInsertionHandle() { final String text = "text"; assertFloatingToolbarIsNotDisplayed(); onView(withId(R.id.textview)).perform(replaceText(text)); onView(withId(R.id.textview)).perform(clickOnTextAtIndex(text.length())); assertFloatingToolbarIsNotDisplayed(); onHandleView(com.android.internal.R.id.insertion_handle).perform(click()); sleepForFloatingToolbarPopup(); Loading core/tests/coretests/src/android/widget/espresso/DragHandleUtils.java +13 −12 Original line number Diff line number Diff line Loading @@ -18,11 +18,13 @@ package android.widget.espresso; import static android.support.test.espresso.Espresso.onView; import static android.support.test.espresso.assertion.ViewAssertions.matches; import static android.support.test.espresso.matcher.RootMatchers.isPlatformPopup; import static android.support.test.espresso.matcher.RootMatchers.withDecorView; import static android.support.test.espresso.matcher.ViewMatchers.hasDescendant; import static android.support.test.espresso.matcher.ViewMatchers.isAssignableFrom; import static android.support.test.espresso.matcher.ViewMatchers.isDisplayed; import static android.support.test.espresso.matcher.ViewMatchers.withId; import static org.hamcrest.Matchers.allOf; import android.support.test.espresso.NoMatchingRootException; Loading @@ -30,29 +32,28 @@ import android.support.test.espresso.NoMatchingViewException; import android.support.test.espresso.ViewInteraction; import android.widget.Editor; public class DragHandleUtils { private DragHandleUtils() { public final class DragHandleUtils { } private DragHandleUtils() {} public static void assertNoSelectionHandles() { try { onHandleView(com.android.internal.R.id.selection_start_handle) onView(isAssignableFrom(Editor.SelectionHandleView.class)) .inRoot(isPlatformPopup()) .check(matches(isDisplayed())); } catch (NoMatchingRootException | NoMatchingViewException | AssertionError e) { try { onHandleView(com.android.internal.R.id.selection_end_handle) .check(matches(isDisplayed())); } catch (NoMatchingRootException | NoMatchingViewException | AssertionError e1) { return; } } throw new AssertionError("Selection handle found"); } public static ViewInteraction onHandleView(int id) throws NoMatchingRootException, NoMatchingViewException, AssertionError { return onView(allOf(withId(id), isAssignableFrom(Editor.HandleView.class))) .inRoot(withDecorView(hasDescendant(withId(id)))); return onView(allOf( withId(id), isAssignableFrom(Editor.HandleView.class))) .inRoot(allOf( isPlatformPopup(), withDecorView(hasDescendant(withId(id))))); } } core/tests/coretests/src/android/widget/espresso/FloatingToolbarEspressoUtils.java +4 −1 Original line number Diff line number Diff line Loading @@ -19,6 +19,7 @@ package android.widget.espresso; import static android.support.test.espresso.Espresso.onView; import static android.support.test.espresso.action.ViewActions.click; import static android.support.test.espresso.assertion.ViewAssertions.matches; import static android.support.test.espresso.matcher.RootMatchers.isPlatformPopup; import static android.support.test.espresso.matcher.RootMatchers.withDecorView; import static android.support.test.espresso.matcher.ViewMatchers.hasDescendant; import static android.support.test.espresso.matcher.ViewMatchers.isDisplayed; Loading Loading @@ -58,7 +59,9 @@ public class FloatingToolbarEspressoUtils { private static ViewInteraction onFloatingToolBar() { return onView(withTagValue(is(TAG))) .inRoot(withDecorView(hasDescendant(withTagValue(is(TAG))))); .inRoot(allOf( isPlatformPopup(), withDecorView(hasDescendant(withTagValue(is(TAG)))))); } /** Loading Loading
core/java/android/widget/Editor.java +3 −1 Original line number Diff line number Diff line Loading @@ -4734,7 +4734,9 @@ public class Editor { public static final int HANDLE_TYPE_SELECTION_START = 0; public static final int HANDLE_TYPE_SELECTION_END = 1; private class SelectionHandleView extends HandleView { /** For selection handles */ @VisibleForTesting public final class SelectionHandleView extends HandleView { // Indicates the handle type, selection start (HANDLE_TYPE_SELECTION_START) or selection // end (HANDLE_TYPE_SELECTION_END). @HandleType Loading
core/tests/coretests/src/android/widget/TextViewActivityMouseTest.java +2 −0 Original line number Diff line number Diff line Loading @@ -44,6 +44,7 @@ import static android.widget.espresso.TextViewAssertions.hasSelection; import android.app.Activity; import android.support.test.filters.MediumTest; import android.support.test.filters.Suppress; import android.support.test.rule.ActivityTestRule; import android.support.test.runner.AndroidJUnit4; import android.view.MotionEvent; Loading @@ -62,6 +63,7 @@ import org.junit.runner.RunWith; */ @RunWith(AndroidJUnit4.class) @MediumTest @Suppress // Consistently failing. b/29591177 public class TextViewActivityMouseTest { @Rule Loading
core/tests/coretests/src/android/widget/TextViewActivityTest.java +1 −1 Original line number Diff line number Diff line Loading @@ -310,9 +310,9 @@ public class TextViewActivityTest { @Test public void testToolbarAndInsertionHandle() { final String text = "text"; assertFloatingToolbarIsNotDisplayed(); onView(withId(R.id.textview)).perform(replaceText(text)); onView(withId(R.id.textview)).perform(clickOnTextAtIndex(text.length())); assertFloatingToolbarIsNotDisplayed(); onHandleView(com.android.internal.R.id.insertion_handle).perform(click()); sleepForFloatingToolbarPopup(); Loading
core/tests/coretests/src/android/widget/espresso/DragHandleUtils.java +13 −12 Original line number Diff line number Diff line Loading @@ -18,11 +18,13 @@ package android.widget.espresso; import static android.support.test.espresso.Espresso.onView; import static android.support.test.espresso.assertion.ViewAssertions.matches; import static android.support.test.espresso.matcher.RootMatchers.isPlatformPopup; import static android.support.test.espresso.matcher.RootMatchers.withDecorView; import static android.support.test.espresso.matcher.ViewMatchers.hasDescendant; import static android.support.test.espresso.matcher.ViewMatchers.isAssignableFrom; import static android.support.test.espresso.matcher.ViewMatchers.isDisplayed; import static android.support.test.espresso.matcher.ViewMatchers.withId; import static org.hamcrest.Matchers.allOf; import android.support.test.espresso.NoMatchingRootException; Loading @@ -30,29 +32,28 @@ import android.support.test.espresso.NoMatchingViewException; import android.support.test.espresso.ViewInteraction; import android.widget.Editor; public class DragHandleUtils { private DragHandleUtils() { public final class DragHandleUtils { } private DragHandleUtils() {} public static void assertNoSelectionHandles() { try { onHandleView(com.android.internal.R.id.selection_start_handle) onView(isAssignableFrom(Editor.SelectionHandleView.class)) .inRoot(isPlatformPopup()) .check(matches(isDisplayed())); } catch (NoMatchingRootException | NoMatchingViewException | AssertionError e) { try { onHandleView(com.android.internal.R.id.selection_end_handle) .check(matches(isDisplayed())); } catch (NoMatchingRootException | NoMatchingViewException | AssertionError e1) { return; } } throw new AssertionError("Selection handle found"); } public static ViewInteraction onHandleView(int id) throws NoMatchingRootException, NoMatchingViewException, AssertionError { return onView(allOf(withId(id), isAssignableFrom(Editor.HandleView.class))) .inRoot(withDecorView(hasDescendant(withId(id)))); return onView(allOf( withId(id), isAssignableFrom(Editor.HandleView.class))) .inRoot(allOf( isPlatformPopup(), withDecorView(hasDescendant(withId(id))))); } }
core/tests/coretests/src/android/widget/espresso/FloatingToolbarEspressoUtils.java +4 −1 Original line number Diff line number Diff line Loading @@ -19,6 +19,7 @@ package android.widget.espresso; import static android.support.test.espresso.Espresso.onView; import static android.support.test.espresso.action.ViewActions.click; import static android.support.test.espresso.assertion.ViewAssertions.matches; import static android.support.test.espresso.matcher.RootMatchers.isPlatformPopup; import static android.support.test.espresso.matcher.RootMatchers.withDecorView; import static android.support.test.espresso.matcher.ViewMatchers.hasDescendant; import static android.support.test.espresso.matcher.ViewMatchers.isDisplayed; Loading Loading @@ -58,7 +59,9 @@ public class FloatingToolbarEspressoUtils { private static ViewInteraction onFloatingToolBar() { return onView(withTagValue(is(TAG))) .inRoot(withDecorView(hasDescendant(withTagValue(is(TAG))))); .inRoot(allOf( isPlatformPopup(), withDecorView(hasDescendant(withTagValue(is(TAG)))))); } /** Loading