當前位置: 首頁>>代碼示例>>Java>>正文


Java BoundedMatcher類代碼示例

本文整理匯總了Java中android.support.test.espresso.matcher.BoundedMatcher的典型用法代碼示例。如果您正苦於以下問題:Java BoundedMatcher類的具體用法?Java BoundedMatcher怎麽用?Java BoundedMatcher使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。


BoundedMatcher類屬於android.support.test.espresso.matcher包,在下文中一共展示了BoundedMatcher類的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: withPasswordText

import android.support.test.espresso.matcher.BoundedMatcher; //導入依賴的package包/類
/**
 * Returns a matcher that matches {@link TextView}s based on text property value.
 *
 * @param stringMatcher {@link Matcher} of {@link String} with text to match
 */
@NonNull
public static Matcher<View> withPasswordText(final Matcher<String> stringMatcher) {

    return new BoundedMatcher<View, TextView>(TextView.class) {

        @Override
        public void describeTo(final Description description) {
            description.appendText("with error text: ");
            stringMatcher.describeTo(description);
        }

        @Override
        public boolean matchesSafely(final TextView textView) {
            return stringMatcher.matches(textView.getText().toString());
        }
    };
}
 
開發者ID:kevalpatel2106,項目名稱:smart-lens,代碼行數:23,代碼來源:CustomMatchers.java

示例2: withCollapsingToolbarTitle

import android.support.test.espresso.matcher.BoundedMatcher; //導入依賴的package包/類
private static Matcher<Object> withCollapsingToolbarTitle(
        final Matcher<CharSequence> textMatcher) {
    return new BoundedMatcher<Object, CollapsingToolbarLayout>(CollapsingToolbarLayout.class) {

        @Override
        public void describeTo(Description description) {
            description.appendText("with collapsing toolbar title: ");
            textMatcher.describeTo(description);
        }

        @Override
        protected boolean matchesSafely(CollapsingToolbarLayout collapsingToolbarLayout) {
            return textMatcher.matches(collapsingToolbarLayout.getTitle());
        }

    };
}
 
開發者ID:ecarrara-araujo,項目名稱:yabaking,代碼行數:18,代碼來源:ToolbarMatchers.java

示例3: atPosition

import android.support.test.espresso.matcher.BoundedMatcher; //導入依賴的package包/類
public static Matcher<View> atPosition(final int position, final Matcher<View> itemMatcher) {
	return new BoundedMatcher<View, RecyclerView>(RecyclerView.class) {
		@Override
		public void describeTo(Description description) {
			description.appendText("has item at position " + position + ": ");
			itemMatcher.describeTo(description);
		}

		@Override
		protected boolean matchesSafely(final RecyclerView view) {
			RecyclerView.ViewHolder viewHolder = view.findViewHolderForAdapterPosition(position);
			if (viewHolder == null) {
				return false;
			}
			return itemMatcher.matches(viewHolder.itemView);
		}
	};
}
 
開發者ID:leocabral,項目名稱:lacomida,代碼行數:19,代碼來源:EspressoCustomActions.java

示例4: withErrorText

import android.support.test.espresso.matcher.BoundedMatcher; //導入依賴的package包/類
/**
 * Returns a matcher that matches {@link TextView}s based on text property value.
 *
 * @param stringMatcher {@link Matcher} of {@link String} with text to match
 */
@NonNull
public static Matcher<View> withErrorText(final Matcher<String> stringMatcher) {

    return new BoundedMatcher<View, TextView>(TextView.class) {

        @Override
        public void describeTo(final Description description) {
            description.appendText("with error text: ");
            stringMatcher.describeTo(description);
        }

        @Override
        public boolean matchesSafely(final TextView textView) {
            return stringMatcher.matches(textView.getError().toString());
        }
    };
}
 
開發者ID:kevalpatel2106,項目名稱:smart-lens,代碼行數:23,代碼來源:CustomMatchers.java

示例5: hasError

import android.support.test.espresso.matcher.BoundedMatcher; //導入依賴的package包/類
/**
 * Returns a matcher that matches {@link TextView}s based on text property value.
 */
@NonNull
public static Matcher<View> hasError() {

    return new BoundedMatcher<View, TextView>(TextView.class) {

        @Override
        public void describeTo(final Description description) {
            description.appendText("Has error case failed.");
        }

        @Override
        public boolean matchesSafely(final TextView textView) {
            return textView.getError() != null;
        }
    };
}
 
開發者ID:kevalpatel2106,項目名稱:smart-lens,代碼行數:20,代碼來源:CustomMatchers.java

示例6: checkTextLength

import android.support.test.espresso.matcher.BoundedMatcher; //導入依賴的package包/類
/**
 * Returns a matcher that matches {@link TextView}s based on text property value.
 */
@NonNull
public static Matcher<View> checkTextLength(final int length) {

    return new BoundedMatcher<View, TextView>(TextView.class) {

        @Override
        public void describeTo(final Description description) {
            description.appendText("Text length is : " + description);
        }

        @Override
        public boolean matchesSafely(final TextView textView) {
            return textView.getText().length() == length;
        }
    };
}
 
開發者ID:kevalpatel2106,項目名稱:smart-lens,代碼行數:20,代碼來源:CustomMatchers.java

示例7: hasText

import android.support.test.espresso.matcher.BoundedMatcher; //導入依賴的package包/類
/**
 * Returns a matcher that matches {@link TextView}s based on text property value.
 */
@NonNull
public static Matcher<View> hasText() {

    return new BoundedMatcher<View, TextView>(TextView.class) {

        @Override
        public void describeTo(final Description description) {
            description.appendText("Text length is : " + description);
        }

        @Override
        public boolean matchesSafely(final TextView textView) {
            return textView.getText().length() > 0;
        }
    };
}
 
開發者ID:kevalpatel2106,項目名稱:smart-lens,代碼行數:20,代碼來源:CustomMatchers.java

示例8: atPosition

import android.support.test.espresso.matcher.BoundedMatcher; //導入依賴的package包/類
public static Matcher<View> atPosition(final int position, @NonNull final Matcher<View> itemMatcher) {
    checkNotNull(itemMatcher);
    return new BoundedMatcher<View, RecyclerView>(RecyclerView.class) {
        @Override
        public void describeTo(Description description) {
            description.appendText("has item at position " + position + ":\n");
            itemMatcher.describeTo(description);
        }

        @Override
        protected boolean matchesSafely(final RecyclerView view) {
            RecyclerView.ViewHolder viewHolder = view.findViewHolderForAdapterPosition(position);
            return viewHolder != null && itemMatcher.matches(viewHolder.itemView);
        }
    };
}
 
開發者ID:sathishmscict,項目名稱:ChipsLayoutManager,代碼行數:17,代碼來源:RecyclerViewEspressoFactory.java

示例9: withTag

import android.support.test.espresso.matcher.BoundedMatcher; //導入依賴的package包/類
/**
 * Matches fragment with specific tag
 *
 * @param tag fragment tag
 * @return BaseMatcher<Fragment>
 */
public static Matcher<Fragment> withTag(final String tag) {
    return new BoundedMatcher<Fragment, Fragment>(Fragment.class) {

        @Override
        public void describeTo(Description description) {
            description.appendText("Matches fragment tag");
        }

        @Override
        protected boolean matchesSafely(Fragment item) {
            String fragTag = item.getTag();
            return fragTag != null && fragTag.equals(tag);
        }
    };
}
 
開發者ID:PGSSoft,項目名稱:espresso-doppio,代碼行數:22,代碼來源:DoppioMatchers.java

示例10: atPosition

import android.support.test.espresso.matcher.BoundedMatcher; //導入依賴的package包/類
public static Matcher<View> atPosition(final int position, @NonNull final Matcher<View> itemMatcher) {
    checkNotNull(itemMatcher);
    return new BoundedMatcher<View, RecyclerView>(RecyclerView.class) {
        @Override
        public void describeTo(Description description) {
            description.appendText("has item at position " + position + ": ");
            itemMatcher.describeTo(description);
        }

        @Override
        protected boolean matchesSafely(final RecyclerView view) {
            RecyclerView.ViewHolder viewHolder = view.findViewHolderForAdapterPosition(position);
            return viewHolder != null && itemMatcher.matches(viewHolder.itemView);
        }
    };
}
 
開發者ID:Kamshak,項目名稱:BrainPhaser,代碼行數:17,代碼來源:TestUtils.java

示例11: atPosition

import android.support.test.espresso.matcher.BoundedMatcher; //導入依賴的package包/類
/**
 * Matcher for finding the SwipeView for a SwipeOpenViewHolders in a RecyclerView
 * @param position the position of the view holder
 * @param itemMatcher matcher to compare the SwipeView to
 * @return a Matcher that compares a SwipeOpenViewHolder at a position with a passed in matcher
 */
public static Matcher<View> atPosition(final int position, @NonNull final Matcher<View> itemMatcher) {
  checkNotNull(itemMatcher);
  return new BoundedMatcher<View, RecyclerView>(RecyclerView.class) {
    @Override protected boolean matchesSafely(RecyclerView view) {
      RecyclerView.ViewHolder viewHolder = view.findViewHolderForAdapterPosition(position);
      if (viewHolder == null || !(viewHolder instanceof SwipeOpenViewHolder)) {
        // has no item on such position
        return false;
      }
      return itemMatcher.matches(((SwipeOpenViewHolder) viewHolder).getSwipeView());
    }

    @Override
    public void describeTo(Description description) {
      description.appendText("has item at position " + position + ": ");
      itemMatcher.describeTo(description);
    }

  };
}
 
開發者ID:alex-townsend,項目名稱:SwipeOpenItemTouchHelper,代碼行數:27,代碼來源:SwipeOpenItemTouchHelperTest.java

示例12: checkTranslationX

import android.support.test.espresso.matcher.BoundedMatcher; //導入依賴的package包/類
/**
 * Checks for a positive or negative translationX in a View
 * @param positive true if positive translation, false if negative
 * @return matcher for checking positive/negative translationX
 */
public static Matcher<View> checkTranslationX(final boolean positive) {
  return new BoundedMatcher<View, View>(View.class) {

    @Override public void describeTo(Description description) {
      description.appendText("translationX should be non-zero");
    }

    @Override protected boolean matchesSafely(View item) {
      if (positive) {
        return ViewCompat.getTranslationX(item) > 0;
      } else {
        return ViewCompat.getTranslationX(item) < 0;
      }
    }
  };
}
 
開發者ID:alex-townsend,項目名稱:SwipeOpenItemTouchHelper,代碼行數:22,代碼來源:SwipeOpenItemTouchHelperTest.java

示例13: atPosition

import android.support.test.espresso.matcher.BoundedMatcher; //導入依賴的package包/類
public static Matcher<View> atPosition(final int position, @NonNull final Matcher<View> itemMatcher) {
    checkNotNull(itemMatcher);
    return new BoundedMatcher<View, RecyclerView>(RecyclerView.class) {
        @Override
        public void describeTo(Description description) {
            description.appendText("has item at position " + position + ": ");
            itemMatcher.describeTo(description);
        }

        @Override
        protected boolean matchesSafely(final RecyclerView view) {
            RecyclerView.ViewHolder viewHolder = view.findViewHolderForAdapterPosition(position);
            if (viewHolder == null) {
                // has no item on such position
                return false;
            }
            return itemMatcher.matches(viewHolder.itemView);
        }
    };
}
 
開發者ID:mercadopago,項目名稱:px-android,代碼行數:21,代碼來源:CustomMatchers.java

示例14: onMenuItems

import android.support.test.espresso.matcher.BoundedMatcher; //導入依賴的package包/類
public static Matcher<View> onMenuItems(final Matcher<Iterable<MenuItem>> matcher) {
    return new BoundedMatcher<View, NavigationView>(NavigationView.class) {
        @Override
        protected boolean matchesSafely(NavigationView item) {
            try {
                viewResources = item.getResources();
                return matcher.matches(new IterableMenu(item.getMenu()));
            } finally {
                viewResources = null;
            }
        }

        @Override
        public void describeTo(Description description) {
            description.appendText("from navigation menu items ");
            description.appendDescriptionOf(matcher);
        }
    };
}
 
開發者ID:st1hy,項目名稱:Red-Calorie,代碼行數:20,代碼來源:MenuItemMatchers.java

示例15: atPosition

import android.support.test.espresso.matcher.BoundedMatcher; //導入依賴的package包/類
public static Matcher<View> atPosition(final int position, @NonNull final Matcher<View> itemMatcher) {
  checkNotNull(itemMatcher);
  return new BoundedMatcher<View, RecyclerView>(RecyclerView.class) {
    @Override
    public void describeTo(Description description) {
      description.appendText("has item at position " + position + ": ");
      itemMatcher.describeTo(description);
    }

    @Override
    protected boolean matchesSafely(final RecyclerView view) {
      RecyclerView.ViewHolder viewHolder = view.findViewHolderForAdapterPosition(position);
      return viewHolder != null && itemMatcher.matches(viewHolder.itemView);
    }
  };
}
 
開發者ID:xmartlabs,項目名稱:bigbang,代碼行數:17,代碼來源:RecyclerViewAssertions.java


注:本文中的android.support.test.espresso.matcher.BoundedMatcher類示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。