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


Java ViewMatchers.withText方法代碼示例

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


在下文中一共展示了ViewMatchers.withText方法的3個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: addMatcher_doesNotNegateMatcher_when_negateNextMatcher_isFalse

import android.support.test.espresso.matcher.ViewMatchers; //導入方法依賴的package包/類
@Test
public void addMatcher_doesNotNegateMatcher_when_negateNextMatcher_isFalse() {
    final Start.Matcher matcher = Cortado.view();
    final Cortado cortado = matcher.getCortado();
    assertThat(cortado.matchers).hasSize(0);
    assertThat(cortado.negateNextMatcher).isFalse();
    // no matchers added, negateNextMatcher is false

    org.hamcrest.Matcher<View> viewMatcher = ViewMatchers.withText("test");
    org.hamcrest.Matcher<View> negatedViewMatcher = Matchers.not(viewMatcher);

    cortado.negateNextMatcher = false;

    cortado.addMatcher(viewMatcher);
    assertThat(cortado.matchers).hasSize(1);
    // one matcher added

    assertThat(cortado.negateNextMatcher).isFalse();
    // negateNextMatcher is still false

    final Matcher<? super View> addedMatcher = cortado.matchers.get(0);
    Utils.assertThat(addedMatcher).isEqualTo(viewMatcher);
    Utils.assertThat(addedMatcher).isNotEqualTo(negatedViewMatcher);
}
 
開發者ID:blipinsk,項目名稱:cortado,代碼行數:25,代碼來源:Cortado_Tests.java

示例2: addMatcher_negatesMatcher_when_negateNextMatcher_isTrue

import android.support.test.espresso.matcher.ViewMatchers; //導入方法依賴的package包/類
@Test
public void addMatcher_negatesMatcher_when_negateNextMatcher_isTrue() {
    final Start.Matcher matcher = Cortado.view();
    final Cortado cortado = matcher.getCortado();
    assertThat(cortado.matchers).hasSize(0);
    assertThat(cortado.negateNextMatcher).isFalse();
    // no matchers added, negateNextMatcher is false

    org.hamcrest.Matcher<View> viewMatcher = ViewMatchers.withText("test");
    org.hamcrest.Matcher<View> negatedViewMatcher = Matchers.not(viewMatcher);

    cortado.negateNextMatcher = true;

    cortado.addMatcher(viewMatcher);
    assertThat(cortado.matchers).hasSize(1);
    // one matcher added

    assertThat(cortado.negateNextMatcher).isFalse();
    // negateNextMatcher is back to false

    final Matcher<? super View> addedMatcher = cortado.matchers.get(0);
    Utils.assertThat(addedMatcher).isNotEqualTo(viewMatcher);
    Utils.assertThat(addedMatcher).isEqualTo(negatedViewMatcher);
}
 
開發者ID:blipinsk,項目名稱:cortado,代碼行數:25,代碼來源:Cortado_Tests.java

示例3: withDigit

import android.support.test.espresso.matcher.ViewMatchers; //導入方法依賴的package包/類
/**
 * Helper method that wraps {@link ViewMatchers#withText(String) withText(String)}.
 *
 * @return A Matcher that matches a number key button by its text representation
 *         of {@code digit}.
 */
private static Matcher<View> withDigit(int digit) {
    // TODO: When we're comfortable with the APIs, we can statically import them and
    // make direct calls to these methods and cut down on the verbosity, instead of
    // writing helper methods that wrap these APIs.
    return ViewMatchers.withText(text(digit));
}
 
開發者ID:philliphsu,項目名稱:NumberPadTimePicker,代碼行數:13,代碼來源:NumberPadTimePickerDialogTest.java


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