Search in sources :

Example 1 with Snap

use of com.mapbox.services.android.navigation.v5.snap.Snap in project mapbox-navigation-android by mapbox.

the class MapboxNavigationTest method setSnapEngine_doesReplaceDefaultEngine.

@Test
public void setSnapEngine_doesReplaceDefaultEngine() throws Exception {
    Snap snap = navigation.getSnapEngine();
    assertTrue(snap instanceof SnapToRoute);
    snap = mock(Snap.class);
    navigation.setSnapEngine(snap);
    assertTrue(!(navigation.getSnapEngine() instanceof SnapToRoute));
    assertTrue(navigation.getSnapEngine() instanceof Snap);
}
Also used : SnapToRoute(com.mapbox.services.android.navigation.v5.snap.SnapToRoute) Snap(com.mapbox.services.android.navigation.v5.snap.Snap) Test(org.junit.Test) BaseTest(com.mapbox.services.android.navigation.v5.BaseTest)

Example 2 with Snap

use of com.mapbox.services.android.navigation.v5.snap.Snap in project mapbox-navigation-android by mapbox.

the class SnapToRouteTest method getSnappedLocation_returnsProviderNameCorrectly.

@Test
@Ignore
public void getSnappedLocation_returnsProviderNameCorrectly() throws Exception {
    Snap snap = new SnapToRoute();
    Location location = new Location("test");
    List<Point> coordinates = PolylineUtils.decode(route.legs().get(0).steps().get(1).geometry(), Constants.PRECISION_6);
    Location snappedLocation = snap.getSnappedLocation(location, routeProgress, coordinates);
    assertTrue(snappedLocation.getProvider().equals("test-snapped"));
    assertTrue(location.getProvider().equals("test"));
}
Also used : Point(com.mapbox.geojson.Point) Location(android.location.Location) Ignore(org.junit.Ignore) Test(org.junit.Test) BaseTest(com.mapbox.services.android.navigation.v5.BaseTest)

Aggregations

BaseTest (com.mapbox.services.android.navigation.v5.BaseTest)2 Test (org.junit.Test)2 Location (android.location.Location)1 Point (com.mapbox.geojson.Point)1 Snap (com.mapbox.services.android.navigation.v5.snap.Snap)1 SnapToRoute (com.mapbox.services.android.navigation.v5.snap.SnapToRoute)1 Ignore (org.junit.Ignore)1