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