Java 类android.support.test.espresso.UiController 实例源码

项目:fullscreen-video-view    文件:CustomChecks.java   
static ViewAction clickNoConstraints() {
    return new ViewAction() {
        @Override
        public Matcher<View> getConstraints() {
            return isEnabled(); // No constraints, isEnabled and isClickable are checked
        }

        @Override
        public String getDescription() {
            return "Click a view with no constraints.";
        }

        @Override
        public void perform(UiController uiController, View view) {
            view.performClick();
        }
    };
}
项目:GitHub    文件:PubkeyListActivityTest.java   
private ViewAction fillEntropy() {
    return new ViewAction() {
        @Override
        public Matcher<View> getConstraints() {
            return allOf(isDisplayed(), isAssignableFrom(EntropyView.class));
        }

        @Override
        public String getDescription() {
            return "Dismisses the 'Gathering entropy...' dialog";
        }

        @Override
        public void perform(final UiController uiController, final View view) {
            ((EntropyView) view).notifyListeners();
        }
    };
}
项目:android-PictureInPicture    文件:MediaSessionPlaybackActivityTest.java   
private static ViewAction showControls() {
    return new ViewAction() {
        @Override
        public Matcher<View> getConstraints() {
            return isAssignableFrom(MovieView.class);
        }

        @Override
        public String getDescription() {
            return "Show controls of MovieView";
        }

        @Override
        public void perform(UiController uiController, View view) {
            uiController.loopMainThreadUntilIdle();
            ((MovieView) view).showControls();
            uiController.loopMainThreadUntilIdle();
        }
    };
}
项目:android-PictureInPicture    文件:MainActivityTest.java   
private static ViewAction showControls() {
    return new ViewAction() {
        @Override
        public Matcher<View> getConstraints() {
            return isAssignableFrom(MovieView.class);
        }

        @Override
        public String getDescription() {
            return "Show controls of MovieView";
        }

        @Override
        public void perform(UiController uiController, View view) {
            uiController.loopMainThreadUntilIdle();
            ((MovieView) view).showControls();
            uiController.loopMainThreadUntilIdle();
        }
    };
}
项目:DiscogsBrowser    文件:TestUtils.java   
/**
 * From: http://stackoverflow.com/questions/33505953/espresso-how-to-test-swiperefreshlayout/33516360#33516360
 * <p>
 * ViewPager will throw an error if not 90% of it is displayed. This reduces the restriction.
 *
 * @param action      Action to be done.
 * @param constraints Restrictions on the view.
 * @return Performs an action on the view.
 */
public static ViewAction withCustomConstraints(final ViewAction action, final Matcher<View> constraints)
{
    return new ViewAction()
    {
        @Override
        public Matcher<View> getConstraints()
        {
            return constraints;
        }

        @Override
        public String getDescription()
        {
            return action.getDescription();
        }

        @Override
        public void perform(UiController uiController, View view)
        {
            action.perform(uiController, view);
        }
    };
}
项目:fullscreen-video-view    文件:CustomChecks.java   
static ViewAction setOrientation(final int orientation) {
    return new ViewAction() {
        @Override
        public Matcher<View> getConstraints() {
            return isRoot();
        }

        @Override
        public String getDescription() {
            return "Change orientation";
        }

        @Override
        public void perform(UiController uiController, View view) {
            uiController.loopMainThreadUntilIdle();
            changeOrientation(view, orientation);
        }
    };
}
项目:fullscreen-video-view    文件:CustomChecks.java   
@Override
public void perform(UiController uiController, View view) {
    uiController.loopMainThreadUntilIdle();
    int orientation = getActivityOrientation(view);
    boolean checkOrientation = false;
    switch (orientationType) {
        case PORTRAIT:
            checkOrientation = orientation == ActivityInfo.SCREEN_ORIENTATION_PORTRAIT
                    || orientation == ActivityInfo.SCREEN_ORIENTATION_REVERSE_PORTRAIT
                    || orientation == ActivityInfo.SCREEN_ORIENTATION_SENSOR_PORTRAIT
                    || orientation == ActivityInfo.SCREEN_ORIENTATION_USER_PORTRAIT;
            break;

        case LANDSCAPE:
            checkOrientation = orientation == ActivityInfo.SCREEN_ORIENTATION_LANDSCAPE
                    || orientation == ActivityInfo.SCREEN_ORIENTATION_REVERSE_LANDSCAPE
                    || orientation == ActivityInfo.SCREEN_ORIENTATION_SENSOR_LANDSCAPE
                    || orientation == ActivityInfo.SCREEN_ORIENTATION_USER_LANDSCAPE;
            break;
    }

    if (checkOrientation) {
        isOrientation[0] = true;
    }
}
项目:mapbox-plugins-android    文件:LocationLayerTest.java   
@Test
public void onMapChangeLocationLayerRedrawn() throws Exception {
  executeLocationLayerTest(new LocationLayerPluginAction.onPerformLocationLayerAction() {
    @Override
    public void onLocationLayerAction(LocationLayerPlugin locationLayerPlugin, MapboxMap mapboxMap,
                                      UiController uiController) {
      locationLayerPlugin.setLocationLayerEnabled(LocationLayerMode.TRACKING);
      assertTrue(mapboxMap.getLayer(FOREGROUND_LAYER) != null);
      mapboxMap.setStyleUrl(Style.SATELLITE);
      uiController.loopMainThreadForAtLeast(500);
      assertEquals(locationLayerPlugin.getLocationLayerMode(), LocationLayerMode.TRACKING);
      assertTrue(mapboxMap.getLayer(FOREGROUND_LAYER) != null);
      assertTrue(mapboxMap.getLayer(FOREGROUND_LAYER).getVisibility().getValue()
        .equals(Property.VISIBLE));
    }
  });
}
项目:ChimpCheck    文件:FingerGestures.java   
public static ViewAction swipeOnCoord(final float fromX, final float fromY, final float toX, final float toY) {
    return new ViewAction() {
        @Override
        public Matcher<View> getConstraints() {
            return isRoot();
        }

        @Override
        public String getDescription() {

            return "Swipe from" + fromX + ", " + fromY + " to " + toX + ", " + toY;
        }

        @Override
        public void perform(UiController uiController, final View view) {
            drag(fromX, fromY, toX, toY);
        }
    };
}
项目:DOUSalaries    文件:TestUtils.java   
public void perform(UiController uiController, View view) {
    RecyclerView recyclerView = (RecyclerView) view;
    (new ScrollToPositionViewAction(this.position)).perform(uiController, view);
    uiController.loopMainThreadUntilIdle();

    View targetView = recyclerView.getChildAt(this.position).findViewById(this.viewId);

    if (targetView == null) {
        throw (new PerformException.Builder()).withActionDescription(this.toString())
                .withViewDescription(HumanReadables.describe(view))
                .withCause(new IllegalStateException(
                        "No view with id "
                                + this.viewId
                                + " found at position: "
                                + this.position)
                )
                .build();
    }
    else {
        this.viewAction.perform(uiController, targetView);
    }
}
项目:polling-station-app    文件:TestMainActivity.java   
/**
 * Test if the manual input activity opens.
 */
@Test
public void testGoToManual() {
    onView(withId(R.id.manual_input_button)).check(matches(allOf( isEnabled(), isClickable()))).perform(
            new ViewAction() {
                @Override
                public Matcher<View> getConstraints() {
                    return isEnabled(); // no constraints, they are checked above
                }

                @Override
                public String getDescription() {
                    return "click manual input button";
                }

                @Override
                public void perform(UiController uiController, View view) {
                    view.performClick();
                }
            }
    );
    intended(hasComponent(ManualInputActivity.class.getName()));
}
项目:orgzly-android    文件:EspressoUtils.java   
/**
 * Set value for {@link NumberPicker}
 */
public static ViewAction setNumber(final int n) {
    return new ViewAction() {
        @Override
        public void perform(UiController uiController, View view) {
            ((NumberPicker) view).setValue(n);
        }

        @Override
        public String getDescription() {
            return "Set NumberPicker value";
        }

        @Override
        public Matcher<View> getConstraints() {
            return ViewMatchers.isAssignableFrom(NumberPicker.class);
        }
    };
}
项目:EncryptAndroidSample    文件:ExampleInstrumentedTest.java   
/**
 * Try to getText from TextView
 */
private String getText(final Matcher<View> matcher) {
    final String[] stringHolder = { null };
    onView(matcher).perform(new ViewAction() {
        @Override
        public Matcher<View> getConstraints() {
            return isAssignableFrom(TextView.class);
        }

        @Override
        public String getDescription() {
            return "getting text from a TextView";
        }

        @Override
        public void perform(UiController uiController, View view) {
            TextView tv = (TextView) view;
            stringHolder[0] = tv.getText().toString();
        }
    });
    return stringHolder[0];
}
项目:Mixtape    文件:RecyclerBodyViewViewActions.java   
public static ViewAction scrollToEnd() {
    return new ViewAction() {
        @Override
        public Matcher<View> getConstraints() {
            return isAssignableFrom(RecyclerBodyView.class);
        }

        @Override
        public String getDescription() {
            return "scroll to end";
        }

        @Override
        public void perform(final UiController uiController, final View view) {
            final RecyclerBodyView castView = (RecyclerBodyView) view;
            castView.showItem(castView.getItems().size() - 1);
        }
    };
}
项目:firefox-tv    文件:PullDownToRefreshTest.java   
public static ViewAction withCustomConstraints(final ViewAction action, final Matcher<View> constraints) {
    return new ViewAction() {
        @Override
        public Matcher<View> getConstraints() {
            return constraints;
        }

        @Override
        public String getDescription() {
            return action.getDescription();
        }

        @Override
        public void perform(UiController uiController, View view) {
            action.perform(uiController, view);
        }
    };
}
项目:mapbox-plugins-android    文件:TrafficPluginTest.java   
@Test
public void lineOffsetFunctionMotorwayBaseLayer() throws Exception {
  executeTrafficTest(new TrafficPluginAction.OnPerformTrafficAction() {
    @Override
    public void onTrafficAction(TrafficPlugin trafficPlugin, MapboxMap mapboxMap, UiController controller) {
      LineLayer layer = mapboxMap.getLayerAs(MotorWay.BASE_LAYER_ID);
      assertNotNull(layer.getLineOffset());
      assertNotNull(layer.getLineOffset().getFunction());
      assertEquals(CameraFunction.class, layer.getLineOffset().getFunction().getClass());
      assertEquals(ExponentialStops.class, layer.getLineOffset().getFunction().getStops().getClass());
      assertEquals(1.5f, ((ExponentialStops) layer.getLineOffset().getFunction().getStops()).getBase(), 0.001);
      assertEquals(5, ((ExponentialStops) layer.getLineOffset().getFunction().getStops()).size());
    }
  });
}
项目:mapbox-plugins-android    文件:TrafficPluginTest.java   
@Test
public void lineJoinTrunkCaseLayer() throws Exception {
  executeTrafficTest(new TrafficPluginAction.OnPerformTrafficAction() {
    @Override
    public void onTrafficAction(TrafficPlugin trafficPlugin, MapboxMap mapboxMap, UiController controller) {
      assertEquals(ROUND, ((LineLayer) mapboxMap.getLayerAs(Trunk.CASE_LAYER_ID)).getLineJoin().getValue());
    }
  });
}
项目:mapbox-plugins-android    文件:TrafficPluginTest.java   
@Test
public void lineOffsetFunctionMotorwayCaseLayer() throws Exception {
  executeTrafficTest(new TrafficPluginAction.OnPerformTrafficAction() {
    @Override
    public void onTrafficAction(TrafficPlugin trafficPlugin, MapboxMap mapboxMap, UiController controller) {
      LineLayer layer = mapboxMap.getLayerAs(MotorWay.CASE_LAYER_ID);
      assertNotNull(layer.getLineOffset());
      assertNotNull(layer.getLineOffset().getFunction());
      assertEquals(CameraFunction.class, layer.getLineOffset().getFunction().getClass());
      assertEquals(ExponentialStops.class, layer.getLineOffset().getFunction().getStops().getClass());
      assertEquals(1.5f, ((ExponentialStops) layer.getLineOffset().getFunction().getStops()).getBase(), 0.001);
      assertEquals(5, ((ExponentialStops) layer.getLineOffset().getFunction().getStops()).size());
    }
  });
}
项目:mapbox-plugins-android    文件:TrafficPluginTest.java   
@Test
public void lineJoinTrunkBaseLayer() throws Exception {
  executeTrafficTest(new TrafficPluginAction.OnPerformTrafficAction() {
    @Override
    public void onTrafficAction(TrafficPlugin trafficPlugin, MapboxMap mapboxMap, UiController controller) {
      assertEquals(ROUND, ((LineLayer) mapboxMap.getLayerAs(Trunk.BASE_LAYER_ID)).getLineJoin().getValue());
    }
  });
}
项目:mapbox-navigation-android    文件:NavigationMapRouteTest.java   
@Test
public void routeLayerShieldVisible() throws Exception {
  executeNavigationMapRoute(new NavigationMapRouteAction.OnPerformNavigationMapRouteAction() {
    @Override
    public void onNavigationMapRouteAction(NavigationMapRoute navigationMapRoute, MapboxMap mapboxMap,
                                           UiController controller) {
      assertTrue(mapboxMap.getLayer(GENERIC_ROUTE_SHIELD_LAYER_ID)
        .getVisibility().getValue().equals(Property.VISIBLE));
    }
  });
}
项目:mapbox-navigation-android    文件:NavigationMapRouteTest.java   
@Test
public void routeLayerVisible() throws Exception {
  executeNavigationMapRoute(new NavigationMapRouteAction.OnPerformNavigationMapRouteAction() {
    @Override
    public void onNavigationMapRouteAction(NavigationMapRoute navigationMapRoute, MapboxMap mapboxMap,
                                           UiController controller) {
      assertTrue(mapboxMap.getLayer(GENERIC_ROUTE_LAYER_ID)
        .getVisibility().getValue().equals(Property.VISIBLE));
    }
  });
}
项目:mapbox-navigation-android    文件:NavigationMapRouteTest.java   
@Test
public void removeRouteHidesSheildLayer() throws Exception {
  executeNavigationMapRoute(new NavigationMapRouteAction.OnPerformNavigationMapRouteAction() {
    @Override
    public void onNavigationMapRouteAction(NavigationMapRoute navigationMapRoute, MapboxMap mapboxMap,
                                           UiController controller) {
      navigationMapRoute.removeRoute();
      assertTrue(mapboxMap.getLayer(GENERIC_ROUTE_SHIELD_LAYER_ID)
        .getVisibility().getValue().equals(Property.NONE));
    }
  });
}
项目:mapbox-navigation-android    文件:NavigationMapRouteTest.java   
@Test
public void removeRouteHidesLayer() throws Exception {
  executeNavigationMapRoute(new NavigationMapRouteAction.OnPerformNavigationMapRouteAction() {
    @Override
    public void onNavigationMapRouteAction(NavigationMapRoute navigationMapRoute, MapboxMap mapboxMap,
                                           UiController controller) {
      navigationMapRoute.removeRoute();
      assertTrue(mapboxMap.getLayer(GENERIC_ROUTE_LAYER_ID)
        .getVisibility().getValue().equals(Property.NONE));
    }
  });
}
项目:mapbox-plugins-android    文件:TrafficPluginTest.java   
@Test
public void lineJoinPrimaryBaseLayer() throws Exception {
  executeTrafficTest(new TrafficPluginAction.OnPerformTrafficAction() {
    @Override
    public void onTrafficAction(TrafficPlugin trafficPlugin, MapboxMap mapboxMap, UiController controller) {
      assertEquals(ROUND, ((LineLayer) mapboxMap.getLayerAs(Primary.BASE_LAYER_ID)).getLineJoin().getValue());
    }
  });
}
项目:mapbox-navigation-android    文件:NavigationMapRouteTest.java   
@Test
public void reattachRouteLayerWithLoadNewStyle() throws Exception {
  executeNavigationMapRoute(new NavigationMapRouteAction.OnPerformNavigationMapRouteAction() {
    @Override
    public void onNavigationMapRouteAction(NavigationMapRoute navigationMapRoute, MapboxMap mapboxMap,
                                           UiController controller) {
      mapboxMap.setStyleUrl(Style.DARK);
      controller.loopMainThreadForAtLeast(500);
      assertTrue(mapboxMap.getLayer(GENERIC_ROUTE_LAYER_ID) != null);
    }
  });
}
项目:mapbox-plugins-android    文件:LocationLayerTest.java   
@Test
public void locationSourceAdded() throws Exception {
  executeLocationLayerTest(new LocationLayerPluginAction.onPerformLocationLayerAction() {
    @Override
    public void onLocationLayerAction(LocationLayerPlugin locationLayerPlugin, MapboxMap mapboxMap,
                                      UiController uiController) {
      locationLayerPlugin.setLocationLayerEnabled(LocationLayerMode.TRACKING);
      assertTrue(mapboxMap.getSource(LOCATION_SOURCE) != null);
    }
  });
}
项目:TripleTap    文件:MultiplayerGameFragmentAndroidTests.java   
@Override
public void perform(UiController uiController, View view) {
    view.performClick();
}
项目:mapbox-plugins-android    文件:TrafficPluginTest.java   
@Test
public void lineJoinSecondaryBaseLayer() throws Exception {
  executeTrafficTest(new TrafficPluginAction.OnPerformTrafficAction() {
    @Override
    public void onTrafficAction(TrafficPlugin trafficPlugin, MapboxMap mapboxMap, UiController controller) {
      assertEquals(ROUND, ((LineLayer) mapboxMap.getLayerAs(Secondary.BASE_LAYER_ID)).getLineJoin().getValue());
    }
  });
}
项目:TripleTap    文件:NormalGameFragmentAndroidTests.java   
@Override
public void perform(UiController uiController, View view) {
    view.performClick();
}
项目:mapbox-navigation-android    文件:WaitLoopAction.java   
public static void performWaitLoop(UiController controller, long waitTime) {
  controller.loopMainThreadForAtLeast(waitTime);
}
项目:PXLSRT    文件:CameraViewTest.java   
private static ViewAction waitFor(final long ms) {
    return new AnythingAction("wait") {
        @Override
        public void perform(UiController uiController, View view) {
            SystemClock.sleep(ms);
        }
    };
}
项目:mapbox-plugins-android    文件:TrafficPluginTest.java   
@Test
public void lineJoinPrimaryCaseLayer() throws Exception {
  executeTrafficTest(new TrafficPluginAction.OnPerformTrafficAction() {
    @Override
    public void onTrafficAction(TrafficPlugin trafficPlugin, MapboxMap mapboxMap, UiController controller) {
      assertEquals(ROUND, ((LineLayer) mapboxMap.getLayerAs(Primary.CASE_LAYER_ID)).getLineJoin().getValue());
    }
  });
}
项目:FancyTrendView    文件:OrientationChangeAction.java   
@Override
public void perform(UiController uiController, View view) {
    uiController.loopMainThreadUntilIdle();
    final Activity activity = (Activity) view.getContext();
    activity.setRequestedOrientation(orientation);

    Collection<Activity> resumedActivities = ActivityLifecycleMonitorRegistry.getInstance().getActivitiesInStage(Stage.RESUMED);
    if (resumedActivities.isEmpty()) {
        throw new RuntimeException("Could not change orientation");
    }
}
项目:mapbox-plugins-android    文件:TrafficPluginTest.java   
@Test
public void lineOffsetFunctionPrimaryBaseLayer() throws Exception {
  executeTrafficTest(new TrafficPluginAction.OnPerformTrafficAction() {
    @Override
    public void onTrafficAction(TrafficPlugin trafficPlugin, MapboxMap mapboxMap, UiController controller) {
      LineLayer layer = mapboxMap.getLayerAs(Primary.BASE_LAYER_ID);
      assertNotNull(layer.getLineOffset());
      assertNotNull(layer.getLineOffset().getFunction());
      assertEquals(CameraFunction.class, layer.getLineOffset().getFunction().getClass());
      assertEquals(ExponentialStops.class, layer.getLineOffset().getFunction().getStops().getClass());
      assertEquals(1.5f, ((ExponentialStops) layer.getLineOffset().getFunction().getStops()).getBase(), 0.001);
      assertEquals(4, ((ExponentialStops) layer.getLineOffset().getFunction().getStops()).size());
    }
  });
}
项目:TurboChat    文件:EspressoTestUtils.java   
public static ViewAction clickClickableSpan(final CharSequence textToClick) {
    return new ViewAction() {
        @Override
        public Matcher<View> getConstraints() {
            return instanceOf(TextView.class);
        }

        @Override
        public String getDescription() {
            return "clicking on a ClickableSpan";
        }

        @Override
        public void perform(UiController uiController, View view) {
            TextView textView = (TextView) view;
            SpannableString spannableString = (SpannableString) textView.getText();

            if (spannableString.length() == 0) {
                // TextView is empty, nothing to do
                throw new NoMatchingViewException.Builder()
                        .includeViewHierarchy(true)
                        .withRootView(textView)
                        .build();
            }

            // Get the links inside the TextView and check if we find textToClick
            ClickableSpan[] spans = spannableString.getSpans(0, spannableString.length(), ClickableSpan.class);
            if (spans.length > 0) {
                ClickableSpan spanCandidate;
                for (ClickableSpan span : spans) {
                    spanCandidate = span;
                    int start = spannableString.getSpanStart(spanCandidate);
                    int end = spannableString.getSpanEnd(spanCandidate);
                    CharSequence sequence = spannableString.subSequence(start, end);
                    if (textToClick.toString().equals(sequence.toString())) {
                        span.onClick(textView);
                        return;
                    }
                }
            }

            // textToClick not found in TextView
            throw new NoMatchingViewException.Builder()
                    .includeViewHierarchy(true)
                    .withRootView(textView)
                    .build();

        }
    };
}
项目:mapbox-plugins-android    文件:TrafficPluginTest.java   
@Test
public void lineOffsetFunctionTrunkBaseLayer() throws Exception {
  executeTrafficTest(new TrafficPluginAction.OnPerformTrafficAction() {
    @Override
    public void onTrafficAction(TrafficPlugin trafficPlugin, MapboxMap mapboxMap, UiController controller) {
      LineLayer layer = mapboxMap.getLayerAs(Trunk.BASE_LAYER_ID);
      assertNotNull(layer.getLineOffset());
      assertNotNull(layer.getLineOffset().getFunction());
      assertEquals(CameraFunction.class, layer.getLineOffset().getFunction().getClass());
      assertEquals(ExponentialStops.class, layer.getLineOffset().getFunction().getStops().getClass());
      assertEquals(1.5f, ((ExponentialStops) layer.getLineOffset().getFunction().getStops()).getBase(), 0.001);
      assertEquals(4, ((ExponentialStops) layer.getLineOffset().getFunction().getStops()).size());
    }
  });
}
项目:mapbox-plugins-android    文件:TrafficPluginTest.java   
@Test
public void lineWidthFunctionTrunkCaseLayer() throws Exception {
  executeTrafficTest(new TrafficPluginAction.OnPerformTrafficAction() {
    @Override
    public void onTrafficAction(TrafficPlugin trafficPlugin, MapboxMap mapboxMap, UiController controller) {
      LineLayer layer = mapboxMap.getLayerAs(Trunk.CASE_LAYER_ID);
      assertNotNull(layer.getLineWidth());
      assertNotNull(layer.getLineWidth().getFunction());
      assertEquals(CameraFunction.class, layer.getLineWidth().getFunction().getClass());
      assertEquals(ExponentialStops.class, layer.getLineWidth().getFunction().getStops().getClass());
      assertEquals(1.5f, ((ExponentialStops) layer.getLineWidth().getFunction().getStops()).getBase(), 0.001);
      assertEquals(4, ((ExponentialStops) layer.getLineWidth().getFunction().getStops()).size());
    }
  });
}
项目:mapbox-plugins-android    文件:TrafficPluginTest.java   
@Test
public void lineWidthFunctionMotorwayCaseLayer() throws Exception {
  executeTrafficTest(new TrafficPluginAction.OnPerformTrafficAction() {
    @Override
    public void onTrafficAction(TrafficPlugin trafficPlugin, MapboxMap mapboxMap, UiController controller) {
      LineLayer layer = mapboxMap.getLayerAs(MotorWay.CASE_LAYER_ID);
      assertNotNull(layer.getLineWidth());
      assertNotNull(layer.getLineWidth().getFunction());
      assertEquals(CameraFunction.class, layer.getLineWidth().getFunction().getClass());
      assertEquals(ExponentialStops.class, layer.getLineWidth().getFunction().getStops().getClass());
      assertEquals(1.5f, ((ExponentialStops) layer.getLineWidth().getFunction().getStops()).getBase(), 0.001);
      assertEquals(4, ((ExponentialStops) layer.getLineWidth().getFunction().getStops()).size());
    }
  });
}
项目:mapbox-plugins-android    文件:TrafficPluginTest.java   
@Test
public void lineJoinLocalBaseLayer() throws Exception {
  executeTrafficTest(new TrafficPluginAction.OnPerformTrafficAction() {
    @Override
    public void onTrafficAction(TrafficPlugin trafficPlugin, MapboxMap mapboxMap, UiController controller) {
      assertEquals(ROUND, ((LineLayer) mapboxMap.getLayerAs(Local.BASE_LAYER_ID)).getLineJoin().getValue());
    }
  });
}
项目:mapbox-plugins-android    文件:TrafficPluginTest.java   
@Test
public void lineWidthFunctionPrimaryCaseLayer() throws Exception {
  executeTrafficTest(new TrafficPluginAction.OnPerformTrafficAction() {
    @Override
    public void onTrafficAction(TrafficPlugin trafficPlugin, MapboxMap mapboxMap, UiController controller) {
      LineLayer layer = mapboxMap.getLayerAs(Primary.CASE_LAYER_ID);
      assertNotNull(layer.getLineWidth());
      assertNotNull(layer.getLineWidth().getFunction());
      assertEquals(CameraFunction.class, layer.getLineWidth().getFunction().getClass());
      assertEquals(ExponentialStops.class, layer.getLineWidth().getFunction().getStops().getClass());
      assertEquals(1.5f, ((ExponentialStops) layer.getLineWidth().getFunction().getStops()).getBase(), 0.001);
      assertEquals(3, ((ExponentialStops) layer.getLineWidth().getFunction().getStops()).size());
    }
  });
}