当前位置: 首页>>代码示例>>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;未经允许,请勿转载。