/** * Returns the text contained within this view. * * @param view the view to scan for text * @return Text contained within this view. */ @SuppressWarnings("UnusedDeclaration") public static String innerText(View view) { ShadowView shadowView = Shadow.extract(view); return shadowView.innerText(); }
/** * Returns a string representation of this {@code ViewGroup} by concatenating all of the * strings contained in all of the descendants of this {@code ViewGroup}. */ @Override public String innerText() { StringBuilder innerText = new StringBuilder(); String delimiter = ""; for (int i = 0; i < realViewGroup.getChildCount(); i++) { View child = realViewGroup.getChildAt(i); ShadowView shadowView = Shadow.extract(child); String childText = shadowView.innerText(); if (childText.length() > 0) { innerText.append(delimiter); delimiter = " "; } innerText.append(childText); } return innerText.toString(); }
private boolean clickOnText(View view, String text) { ShadowView shadowView = Shadow.extract(view); if (text.equals(shadowView.innerText())) { view.performClick(); return true; } if (view instanceof ViewGroup) { ViewGroup viewGroup = (ViewGroup) view; for (int i = 0; i < viewGroup.getChildCount(); i++) { View child = viewGroup.getChildAt(i); if (clickOnText(child, text)) { return true; } } } return false; }
public int findIndexOfItemContainingText(String targetText) { for (int i = 0; i < realAdapterView.getCount(); i++) { View childView = realAdapterView.getAdapter().getView(i, null, new FrameLayout(realAdapterView.getContext())); ShadowView shadowView = Shadow.extract(childView); String innerText = shadowView.innerText(); if (innerText.contains(targetText)) { return i; } } return -1; }
@Override public void onContentChanged() { transcript.add( "onContentChanged was called; title is \"" + shadowOf((View) findViewById(R.id.title)).innerText() + "\""); }
private void assertContains(String expectedText, View view) { String actualText = shadowOf(view).innerText(); assertTrue("Expected <" + actualText + "> to contain <" + expectedText + ">", actualText.contains(expectedText)); }
@Test public void shouldPutTheMessageIntoTheView() { String message = "This is only a test"; shadow.callOnCreate(null); View dialogView = shadow.getView(); assertThat(shadowOf(dialogView).innerText()).doesNotContain(message); dialog.setMessage(message); assertThat(shadowOf(shadow.getView()).innerText()).contains(message); }
/** * Returns the text contained within this view. * * @param view the view to scan for text * @return Text contained within this view. */ @SuppressWarnings("UnusedDeclaration") public static String innerText(View view) { ShadowView shadowView = Shadow.extract(view); return shadowView.innerText(); }
/** * Returns the text contained within this view. * * @param view the view to scan for text * @return Text contained within this view. */ @SuppressWarnings("UnusedDeclaration") public static String innerText(View view) { return shadowOf(view).innerText(); }
/** * Returns the text contained within this view. * * @param view the view to scan for text * @return Text contained within this view. */ @SuppressWarnings("UnusedDeclaration") public static String innerText(View view) { return shadowOf(view).innerText(); }
/** * Returns the text contained within this view. * * @param view the view to scan for text * @return Text contained within this view. */ @SuppressWarnings("UnusedDeclaration") public static String innerText(View view) { return shadowOf(view).innerText(); }
/** * Returns a string representation of this {@code ViewGroup} by concatenating all of the * strings contained in all of the descendants of this {@code ViewGroup}. */ @Override public String innerText() { String innerText = ""; String delimiter = ""; for (int i = 0; i < realViewGroup.getChildCount(); i++) { View child = realViewGroup.getChildAt(i); String childText = Shadows.shadowOf(child).innerText(); if (childText.length() > 0) { innerText += delimiter; delimiter = " "; } innerText += childText; } return innerText; }
private boolean clickOnText(View view, String text) { if (text.equals(Shadows.shadowOf(view).innerText())) { view.performClick(); return true; } if (view instanceof ViewGroup) { ViewGroup viewGroup = (ViewGroup) view; for (int i = 0; i < viewGroup.getChildCount(); i++) { View child = viewGroup.getChildAt(i); if (clickOnText(child, text)) { return true; } } } return false; }
private boolean clickOnText(View view, String text) { ShadowView shadowView = Shadow.extract(view); if (text.equals(shadowView.innerText())) { view.performClick(); return true; } if (view instanceof ViewGroup) { ViewGroup viewGroup = (ViewGroup) view; for (int i = 0; i < viewGroup.getChildCount(); i++) { View child = viewGroup.getChildAt(i); if (clickOnText(child, text)) { return true; } } } return false; }
private boolean clickOnText(View view, String text) { if (text.equals(Shadows.shadowOf(view).innerText())) { view.performClick(); return true; } if (view instanceof ViewGroup) { ViewGroup viewGroup = (ViewGroup) view; for (int i = 0; i < viewGroup.getChildCount(); i++) { View child = viewGroup.getChildAt(i); if (clickOnText(child, text)) { return true; } } } return false; }
private boolean clickOnText(View view, String text) { if (text.equals(Shadows.shadowOf(view).innerText())) { view.performClick(); return true; } if (view instanceof ViewGroup) { ViewGroup viewGroup = (ViewGroup) view; for (int i = 0; i < viewGroup.getChildCount(); i++) { View child = viewGroup.getChildAt(i); if (clickOnText(child, text)) { return true; } } } return false; }
public int findIndexOfItemContainingText(String targetText) { for (int i = 0; i < realAdapterView.getCount(); i++) { View childView = realAdapterView.getAdapter().getView(i, null, new FrameLayout(realAdapterView.getContext())); ShadowView shadowView = Shadow.extract(childView); String innerText = shadowView.innerText(); if (innerText.contains(targetText)) { return i; } } return -1; }
public int findIndexOfItemContainingText(String targetText) { for (int i = 0; i < realAdapterView.getCount(); i++) { View childView = realAdapterView.getAdapter().getView(i, null, new FrameLayout(realAdapterView.getContext())); String innerText = shadowOf(childView).innerText(); if (innerText.contains(targetText)) { return i; } } return -1; }
public int findIndexOfItemContainingText(String targetText) { for (int i = 0; i < realAdapterView.getCount(); i++) { View childView = realAdapterView.getAdapter().getView(i, null, new FrameLayout(realAdapterView.getContext())); String innerText = shadowOf(childView).innerText(); if (innerText.contains(targetText)) { return i; } } return -1; }
public int findIndexOfItemContainingText(String targetText) { for (int i = 0; i < realAdapterView.getCount(); i++) { View childView = realAdapterView.getAdapter().getView(i, null, new FrameLayout(realAdapterView.getContext())); String innerText = shadowOf(childView).innerText(); if (innerText.contains(targetText)) { return i; } } return -1; }