Java 类com.facebook.testing.screenshot.Screenshot 实例源码

项目:apps-android-wikipedia    文件:ViewTest.java   
protected void snap(@NonNull View subject, @Nullable String... dataPoints) {
    int rtl = layoutDirection == LayoutDirection.RTL
            ? View.LAYOUT_DIRECTION_RTL
            : TextUtilsCompat.getLayoutDirectionFromLocale(locale);
    //noinspection WrongConstant
    subject.setLayoutDirection(rtl);

    ViewHelpers viewHelpers = ViewHelpers.setupView(subject).setExactWidthDp(widthDp);
    if (heightDp != null) {
        viewHelpers.setExactHeightDp(heightDp);
    }
    viewHelpers.layout();

    List<String> list = new ArrayList<>();
    String byHeight = heightDp == null ? "" : ("x" + heightDp);
    list.add(widthDp + byHeight + "dp");
    list.add(locale.toString());
    list.add(layoutDirection == LayoutDirection.RTL ? "rtl" : "ltr");
    list.add("font" + fontScale.multiplier() + "x");
    list.add(theme.toString().toLowerCase(Locale.ENGLISH));
    list.addAll(Arrays.asList(ArrayUtils.nullToEmpty(dataPoints)));
    Screenshot.snap(subject).setName(testName(list)).record();
}
项目:Shot    文件:ScreenshotTest.java   
protected void compareScreenshot(View view, int height) {
  Context context = getInstrumentation().getTargetContext();
  WindowManager windowManager = (WindowManager) context.getSystemService(Context.WINDOW_SERVICE);
  DisplayMetrics metrics = new DisplayMetrics();
  windowManager.getDefaultDisplay().getMetrics(metrics);
  ViewHelpers.setupView(view)
      .setExactHeightPx(context.getResources().getDimensionPixelSize(height))
      .setExactWidthPx(metrics.widthPixels)
      .layout();
  Screenshot.snap(view).record();
}
项目:Isometric    文件:ScreenshotHelper.java   
public static void measureAndScreenshotView(View view, int width, int height) {
    ViewHelpers.setupView(view)
            .setExactWidthPx(width)
            .setExactHeightPx(height)
            .layout();
    Screenshot.snap(view)
            .record();
}
项目:KataScreenshotAndroid    文件:ScreenshotTest.java   
protected void compareScreenshot(View view, int height) {
  Context context = getInstrumentation().getTargetContext();
  WindowManager windowManager = (WindowManager) context.getSystemService(Context.WINDOW_SERVICE);
  DisplayMetrics metrics = new DisplayMetrics();
  windowManager.getDefaultDisplay().getMetrics(metrics);
  ViewHelpers.setupView(view)
      .setExactHeightPx(context.getResources().getDimensionPixelSize(height))
      .setExactWidthPx(metrics.widthPixels)
      .layout();
  Screenshot.snap(view).record();
}
项目:screenshot-tests-for-android    文件:ExampleScreenshotTest.java   
@Test
public void testDefault() {
  Context targetContext = InstrumentationRegistry.getInstrumentation().getTargetContext();
  LayoutInflater inflater = LayoutInflater.from(targetContext);
  LithoView view = (LithoView) inflater.inflate(R.layout.litho_view, null, false);

  view.setComponent(Example.create(view.getComponentContext()).build());

  ViewHelpers.setupView(view).setExactWidthDp(300).layout();
  Screenshot.snap(view).record();
}
项目:screenshot-tests-for-android    文件:ImageRowScreenshotTest.java   
@Test
public void testDefault() {
  Context targetContext = InstrumentationRegistry.getInstrumentation().getTargetContext();
  LayoutInflater inflater = LayoutInflater.from(targetContext);
  LithoView view = (LithoView) inflater.inflate(R.layout.litho_view, null, false);

  view.setComponent(ImageRow.create(view.getComponentContext()).build());

  ViewHelpers.setupView(view).setExactWidthDp(300).layout();
  Screenshot.snap(view).record();
}
项目:the-blue-alliance-android    文件:MatchViewTest.java   
@Test
public void testRenderUnplayed() {
    View view = createView(RED_TEAMS_3, BLUE_TEAMS_3, "?", "?", "blue", 1463883886L, null, MATCH_16);
    ViewHelpers.setupView(view)
               .setExactWidthDp(WIDTH_DP)
               .layout();

    Screenshot.snap(view)
              .record();
}
项目:the-blue-alliance-android    文件:MatchViewTest.java   
@Test
public void testRenderBlueWin() {
    View view = createView(RED_TEAMS_3, BLUE_TEAMS_3, "20", "30", "blue", 1463883886L, VID, MATCH_16);
    ViewHelpers.setupView(view)
               .setExactWidthDp(WIDTH_DP)
               .layout();

    Screenshot.snap(view)
              .record();
}
项目:the-blue-alliance-android    文件:MatchViewTest.java   
@Test
public void testRenderRedWin() {
    View view = createView(RED_TEAMS_3, BLUE_TEAMS_3, "40", "30", "blue", 1463883886L, VID, MATCH_16);
    ViewHelpers.setupView(view)
               .setExactWidthDp(WIDTH_DP)
               .layout();

    Screenshot.snap(view)
              .record();
}
项目:the-blue-alliance-android    文件:MatchViewTest.java   
@Test
public void testRenderTie() {
    View view = createView(RED_TEAMS_3, BLUE_TEAMS_3, "20", "20", "blue", 1463883886L, VID, MATCH_16);
    ViewHelpers.setupView(view)
               .setExactWidthDp(WIDTH_DP)
               .layout();

    Screenshot.snap(view)
              .record();
}
项目:the-blue-alliance-android    文件:MatchViewTest.java   
@Test
public void testRender2Team() {
    View view = createView(RED_TEAMS_2, BLUE_TEAMS_2, "20", "30", "blue", 1463883886L, VID, MATCH_16);
    ViewHelpers.setupView(view)
               .setExactWidthDp(WIDTH_DP)
               .layout();

    Screenshot.snap(view)
              .record();
}
项目:the-blue-alliance-android    文件:MatchViewTest.java   
@Test
public void testRenderNoTime() {
    View view = createView(RED_TEAMS_3, BLUE_TEAMS_3, "20", "30", "blue", 0, VID, MATCH_16);
    ViewHelpers.setupView(view)
               .setExactWidthDp(WIDTH_DP)
               .layout();

    Screenshot.snap(view)
              .record();
}
项目:the-blue-alliance-android    文件:MatchViewTest.java   
@Test
public void testRenderNoVideo() {
    View view = createView(RED_TEAMS_3, BLUE_TEAMS_3, "20", "30", "blue", 1463883886L, null, MATCH_16);
    ViewHelpers.setupView(view)
               .setExactWidthDp(WIDTH_DP)
               .layout();

    Screenshot.snap(view)
              .record();
}
项目:the-blue-alliance-android    文件:MatchViewTest.java   
@Test
public void testNoWinnersIn2015() {
    View view = createView(RED_TEAMS_3, BLUE_TEAMS_3, "20", "30", "", 1463883886L, VID, MATCH_15_Q);
    ViewHelpers.setupView(view)
               .setExactWidthDp(WIDTH_DP)
               .layout();

    Screenshot.snap(view)
              .record();
}
项目:the-blue-alliance-android    文件:MatchViewTest.java   
@Test
public void testWinnersIn2015Finals() {
    View view = createView(RED_TEAMS_3, BLUE_TEAMS_3, "20", "30", "blue", 1463883886L, VID,
                           MATCH_15_F);
    ViewHelpers.setupView(view)
               .setExactWidthDp(WIDTH_DP)
               .layout();

    Screenshot.snap(view)
              .record();
}
项目:the-blue-alliance-android    文件:MatchBreakdownView2017Test.java   
@Test
public void testRenderQualMatch() throws Exception {
    View view = getView("2017week0_qm7");
    ViewHelpers.setupView(view)
               .setExactWidthDp(WIDTH_DP)
               .layout();

    Screenshot.snap(view)
              .record();
}
项目:the-blue-alliance-android    文件:MatchBreakdownView2016Test.java   
@Test
public void testRenderQualMatch() throws Exception {
    View view = getView("2016necmp_qm1");
    ViewHelpers.setupView(view)
               .setExactWidthDp(WIDTH_DP)
               .layout();

    Screenshot.snap(view)
              .record();
}
项目:the-blue-alliance-android    文件:MatchBreakdownView2016Test.java   
@Test
public void testRenderPlayoffMatch() throws Exception {
    View view = getView("2016necmp_f1m1");
    ViewHelpers.setupView(view)
               .setExactWidthDp(WIDTH_DP)
               .layout();

    Screenshot.snap(view)
              .record();
}
项目:the-blue-alliance-android    文件:MatchBreakdownView2015Test.java   
@Test
public void testRenderQualMatch() throws Exception {
    View view = getView("2014necmp_qm1");
    ViewHelpers.setupView(view)
               .setExactWidthDp(WIDTH_DP)
               .layout();

    Screenshot.snap(view)
              .record();
}
项目:the-blue-alliance-android    文件:MatchBreakdownView2015Test.java   
@Test
public void testRenderPlayoffMatch() throws Exception {
    View view = getView("2014necmp_f1m1");
    ViewHelpers.setupView(view)
               .setExactWidthDp(WIDTH_DP)
               .layout();

    Screenshot.snap(view)
              .record();
}
项目:the-blue-alliance-android    文件:AllianceListElementTest.java   
@Test
public void testRender3Team() {
    View view = getView("2016test", "Alliance 1", 1, TEAM_LIST_3, PlayoffAdvancement.SEMI);
    ViewHelpers.setupView(view)
               .setExactWidthDp(WIDTH_DP)
               .layout();

    Screenshot.snap(view)
              .record();
}
项目:the-blue-alliance-android    文件:AllianceListElementTest.java   
@Test
public void testRender4Team() {
    View view = getView("2016test", "Alliance 1", 1, TEAM_LIST_4, PlayoffAdvancement.QUARTER);
    ViewHelpers.setupView(view)
               .setExactWidthDp(WIDTH_DP)
               .layout();

    Screenshot.snap(view)
              .record();
}
项目:the-blue-alliance-android    文件:WebcastListElementTest.java   
@Test
public void testRender(){
    View view = getView("2016test", "Test Event", WEBCAST, 1);
    ViewHelpers.setupView(view)
               .setExactWidthDp(WIDTH_DP)
               .layout();

    Screenshot.snap(view)
              .record();
}
项目:the-blue-alliance-android    文件:ModelListElementTest.java   
@Test
public void testRender() {
    View view = getView("Test Model", "test", ModelType.TEAM);
    ViewHelpers.setupView(view)
               .setExactWidthDp(WIDTH_DP)
               .layout();

    Screenshot.snap(view)
              .record();
}
项目:the-blue-alliance-android    文件:CardedAwardListElementTest.java   
@Test
public void testRenderSingleTeam() {
    View view = getView(null, "Test Award", "2016test", SINGLE_TEAM, TEAM_MAP, null);
    ViewHelpers.setupView(view)
               .setExactWidthDp(WIDTH_DP)
               .layout();

    Screenshot.snap(view)
              .record();
}
项目:the-blue-alliance-android    文件:CardedAwardListElementTest.java   
@Test
public void testRenderSelectedTeam() {
    View view = getView(null, "Test Award", "2016test", SINGLE_TEAM, TEAM_MAP, "1124");
    ViewHelpers.setupView(view)
               .setExactWidthDp(WIDTH_DP)
               .layout();

    Screenshot.snap(view)
              .record();
}
项目:the-blue-alliance-android    文件:CardedAwardListElementTest.java   
@Test
public void testRenderMultiWinner() {
    View view = getView(null, "Test Award", "2016test", MULTI_TEAM, TEAM_MAP, null);
    ViewHelpers.setupView(view)
               .setExactWidthDp(WIDTH_DP)
               .layout();

    Screenshot.snap(view)
              .record();
}
项目:the-blue-alliance-android    文件:CardedAwardListElementTest.java   
@Test
public void testRenderIndividual() {
    View view = getView(null, "Test Award", "2016test", INDIVIDUAL, TEAM_MAP, null);
    ViewHelpers.setupView(view)
               .setExactWidthDp(WIDTH_DP)
               .layout();

    Screenshot.snap(view)
              .record();
}
项目:the-blue-alliance-android    文件:CardedAwardListElementTest.java   
@Test
public void testRenderIndividualNoTeam() {
    View view = getView(null, "Test Award", "2016test", INDIVIDUAL_NO_TEAM, TEAM_MAP, null);
    ViewHelpers.setupView(view)
               .setExactWidthDp(WIDTH_DP)
               .layout();

    Screenshot.snap(view)
              .record();
}
项目:the-blue-alliance-android    文件:CardedAwardListElementTest.java   
@Test
public void testRenderMultiIndividual() {
    View view = getView(null, "Test Award", "2016test", MULTI_INDIVIDUAL, TEAM_MAP, null);
    ViewHelpers.setupView(view)
               .setExactWidthDp(WIDTH_DP)
               .layout();

    Screenshot.snap(view)
              .record();
}
项目:the-blue-alliance-android    文件:EventTypeHeaderTest.java   
@Test
public void testRender() {
    View view = getView("Test Events");
    ViewHelpers.setupView(view)
               .setExactWidthDp(WIDTH_DP)
               .layout();

    Screenshot.snap(view)
              .record();
}
项目:the-blue-alliance-android    文件:DistrictListElementTest.java   
@Test
public void testRenderWithMyTba() {
    View view = getView(DISTRICT, 4, true);
    ViewHelpers.setupView(view)
               .setExactWidthDp(WIDTH_DP)
               .layout();

    Screenshot.snap(view)
              .record();
}
项目:the-blue-alliance-android    文件:DistrictListElementTest.java   
@Test
public void testRenderWithoutMyTba() {
    View view = getView(DISTRICT, 4, false);
    ViewHelpers.setupView(view)
               .setExactWidthDp(WIDTH_DP)
               .layout();

    Screenshot.snap(view)
              .record();
}
项目:the-blue-alliance-android    文件:DistrictTeamListElementTest.java   
@Test
public void testRender() {
    View view = getView("frc1124", "2016ne", "UberBots", 2, 120);
    ViewHelpers.setupView(view)
               .setExactWidthDp(WIDTH_DP)
               .layout();

    Screenshot.snap(view)
              .record();
}
项目:the-blue-alliance-android    文件:DistrictTeamListElementTest.java   
@Test
public void testRenderNoName() {
    View view = getView("frc1124", "2016ne", "", 2, 120);
    ViewHelpers.setupView(view)
               .setExactWidthDp(WIDTH_DP)
               .layout();

    Screenshot.snap(view)
              .record();
}
项目:the-blue-alliance-android    文件:TeamListElementTest.java   
@Test
public void testRenderWithMyTba() {
    View view = getView("frc1124", 1124, "UberBots", "Avon, CT", true, false);
    ViewHelpers.setupView(view)
               .setExactWidthDp(WIDTH_DP)
               .layout();

    Screenshot.snap(view)
              .record();
}
项目:the-blue-alliance-android    文件:TeamListElementTest.java   
@Test
public void testRenderWithoutMyTba() {
    View view = getView("frc1124", 1124, "UberBots", "Avon, CT", false, true);
    ViewHelpers.setupView(view)
               .setExactWidthDp(WIDTH_DP)
               .layout();

    Screenshot.snap(view)
              .record();
}
项目:the-blue-alliance-android    文件:StatsListElementTest.java   
@Test
public void testRender() {
    View view = getView("frc1124", "1124", "UberBots", "11.24", 1.2, 3.4, 5.6);
    ViewHelpers.setupView(view)
               .setExactWidthDp(WIDTH_DP)
               .layout();

    Screenshot.snap(view)
              .record();
}
项目:the-blue-alliance-android    文件:LabelValueListItemTest.java   
@Test
public void testRender() {
    View view = getView("Test", "foobar");
    ViewHelpers.setupView(view)
               .setExactWidthDp(WIDTH_DP)
               .layout();

    Screenshot.snap(view)
              .record();
}
项目:the-blue-alliance-android    文件:EventListElementTest.java   
@Test
public void testRenderWithMyTba() {
    View view = getView("2016test", 2016, "Test Event", "Apr 27, 2016", "New York, NY", true);
    ViewHelpers.setupView(view)
               .setExactWidthDp(WIDTH_DP)
               .layout();

    Screenshot.snap(view)
              .record();
}