当前位置: 首页>>代码示例>>Java>>正文


Java BoundedMatcher类代码示例

本文整理汇总了Java中com.google.android.apps.common.testing.ui.espresso.matcher.BoundedMatcher的典型用法代码示例。如果您正苦于以下问题:Java BoundedMatcher类的具体用法?Java BoundedMatcher怎么用?Java BoundedMatcher使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


BoundedMatcher类属于com.google.android.apps.common.testing.ui.espresso.matcher包,在下文中一共展示了BoundedMatcher类的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: editTextWithText

import com.google.android.apps.common.testing.ui.espresso.matcher.BoundedMatcher; //导入依赖的package包/类
public static Matcher<View> editTextWithText(final int resId) {
    return new BoundedMatcher<View, EditText>(EditText.class) {

        @Override
        protected boolean matchesSafely(EditText editText) {
            String text = editText.getResources().getString(resId);
            if (text == null) return false;

            return text.equals(editText.getText().toString());
        }

        @Override
        public void describeTo(Description description) {
            description.appendText("has content text with resource id ");
            description.appendValue(resId);
        }
    };
}
 
开发者ID:Gchorba,项目名称:NickleAndDimed,代码行数:19,代码来源:CustomViewMatchers.java

示例2: withItemContent

import com.google.android.apps.common.testing.ui.espresso.matcher.BoundedMatcher; //导入依赖的package包/类
/**
 * Creates a matcher against the text stored in R.id.item_content. This text is roughly
 * "item: $row_number".
 */
@SuppressWarnings("rawtypes")
public static Matcher<Object> withItemContent(final Matcher<String> itemTextMatcher) {
  // use preconditions to fail fast when a test is creating an invalid matcher.
  checkNotNull(itemTextMatcher);
  return new BoundedMatcher<Object, Map>(Map.class) {
    @Override
    public boolean matchesSafely(Map map) {
      return hasEntry(equalTo("STR"), itemTextMatcher).matches(map);
    }

    @Override
    public void describeTo(Description description) {
      description.appendText("with item content: ");
      itemTextMatcher.describeTo(description);
    }
  };
}
 
开发者ID:DocuSignDev,项目名称:android-test-kit,代码行数:22,代码来源:LongListMatchers.java

示例3: withItemSize

import com.google.android.apps.common.testing.ui.espresso.matcher.BoundedMatcher; //导入依赖的package包/类
/**
 * Creates a matcher against the text stored in R.id.item_size. This text is the size of the text
 * printed in R.id.item_content.
 */
@SuppressWarnings("rawtypes")
public static Matcher<Object> withItemSize(final Matcher<Integer> itemSizeMatcher) {
  // use preconditions to fail fast when a test is creating an invalid matcher.
  checkNotNull(itemSizeMatcher);
  return new BoundedMatcher<Object, Map>(Map.class) {
    @Override
    public boolean matchesSafely(Map map) {
      return hasEntry(equalTo("LEN"), itemSizeMatcher).matches(map);
    }

    @Override
    public void describeTo(Description description) {
      description.appendText("with item size: ");
      itemSizeMatcher.describeTo(description);
    }
  };
}
 
开发者ID:DocuSignDev,项目名称:android-test-kit,代码行数:22,代码来源:LongListMatchers.java

示例4: emptyEditText

import com.google.android.apps.common.testing.ui.espresso.matcher.BoundedMatcher; //导入依赖的package包/类
public static Matcher<View> emptyEditText() {
    return new BoundedMatcher<View, EditText>(EditText.class) {
        @Override
        protected boolean matchesSafely(EditText editText) {
            return "".equals(editText.getText().toString());
        }

        @Override
        public void describeTo(Description description) {
            description.appendText("empty EditText");
        }
    };
}
 
开发者ID:Gchorba,项目名称:NickleAndDimed,代码行数:14,代码来源:CustomViewMatchers.java

示例5: isOpen

import com.google.android.apps.common.testing.ui.espresso.matcher.BoundedMatcher; //导入依赖的package包/类
/**
 * Returns a matcher that verifies that the drawer is open. Matches only when the drawer is fully
 * open. Use {@link #isClosed()} instead of {@code not(isOpen())} when you wish to check that the
 * drawer is fully closed.
 */
public static Matcher<View> isOpen() {
  return new BoundedMatcher<View, DrawerLayout>(DrawerLayout.class) {
    @Override
    public void describeTo(Description description) {
      description.appendText("is drawer open");
    }

    @Override
    public boolean matchesSafely(DrawerLayout drawer) {
      return drawer.isDrawerOpen(GravityCompat.START);
    }
  };
}
 
开发者ID:DocuSignDev,项目名称:android-test-kit,代码行数:19,代码来源:DrawerMatchers.java

示例6: isClosed

import com.google.android.apps.common.testing.ui.espresso.matcher.BoundedMatcher; //导入依赖的package包/类
/**
 * Returns a matcher that verifies that the drawer is closed. Matches only when the drawer is
 * fully closed. Use {@link #isOpen()} instead of {@code not(isClosed()))} when you wish to check
 * that the drawer is fully open.
 */
public static Matcher<View> isClosed() {
  return new BoundedMatcher<View, DrawerLayout>(DrawerLayout.class) {
    @Override
    public void describeTo(Description description) {
      description.appendText("is drawer closed");
    }

    @Override
    public boolean matchesSafely(DrawerLayout drawer) {
      return !drawer.isDrawerVisible(GravityCompat.START);
    }
  };
}
 
开发者ID:DocuSignDev,项目名称:android-test-kit,代码行数:19,代码来源:DrawerMatchers.java

示例7: withFloatLabelHint

import com.google.android.apps.common.testing.ui.espresso.matcher.BoundedMatcher; //导入依赖的package包/类
/**
 * @param floatLabelHint
 * @return View Matcher for the child EditText
 */
public static Matcher<View> withFloatLabelHint(final String floatLabelHint) {
    return new BoundedMatcher<View, EditText>(EditText.class) {

        @Override
        public void describeTo(Description description) {
            description.appendText("has floatlabel hint ");
            description.appendValue(floatLabelHint);

            if (null != floatLabelHint) {
                description.appendText("[");
                description.appendText(floatLabelHint);
                description.appendText("]");
            }

            if (null != floatLabelHint) {
                description.appendText(" value: ");
                description.appendText(floatLabelHint);
            }
        }

        @Override
        protected boolean matchesSafely(EditText editText) {
            if (!(editText instanceof EditText)) {
                return false;
            }

            String hint = ((EditText) editText).getHint().toString();

            return floatLabelHint.equals(hint);
        }
    };
}
 
开发者ID:bhm,项目名称:Cthulhator,代码行数:37,代码来源:FloatLabelMatchers.java

示例8: withChildCount

import com.google.android.apps.common.testing.ui.espresso.matcher.BoundedMatcher; //导入依赖的package包/类
public static Matcher<View> withChildCount(final Matcher<Integer> numberMatcher) {
    return new BoundedMatcher<View, ViewGroup>(ViewGroup.class) {
        @Override
        protected boolean matchesSafely(ViewGroup viewGroup) {
            return numberMatcher.matches(viewGroup.getChildCount());
        }

        @Override
        public void describeTo(Description description) {
            description.appendText("number of child views ");
            numberMatcher.describeTo(description);
        }
    };
}
 
开发者ID:xrigau,项目名称:droidcon-android-espresso,代码行数:15,代码来源:EspressoTestsMatchers.java


注:本文中的com.google.android.apps.common.testing.ui.espresso.matcher.BoundedMatcher类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。