[update] pull in latest for gl-native
This commit is contained in:
@@ -1288,6 +1288,36 @@ class LocationComponentTest : EspressoTest() {
|
||||
executeComponentTest(componentAction)
|
||||
}
|
||||
|
||||
@Test
|
||||
fun animators_dontZoomWhileTransitioning() {
|
||||
val componentAction = object : LocationComponentAction.OnPerformLocationComponentAction {
|
||||
override fun onLocationComponentAction(
|
||||
component: LocationComponent,
|
||||
mapboxMap: MapboxMap,
|
||||
style: Style,
|
||||
uiController: UiController,
|
||||
context: Context
|
||||
) {
|
||||
component.activateLocationComponent(LocationComponentActivationOptions
|
||||
.builder(context, style)
|
||||
.useDefaultLocationEngine(false)
|
||||
.build())
|
||||
component.isLocationComponentEnabled = true
|
||||
component.forceLocationUpdate(location)
|
||||
|
||||
val zoom = mapboxMap.cameraPosition.zoom
|
||||
component.setCameraMode(CameraMode.TRACKING_GPS, 500L, null, null, null, null)
|
||||
component.zoomWhileTracking(16.0, 1000)
|
||||
uiController.loopMainThreadForAtLeast(1000)
|
||||
TestingAsyncUtils.waitForLayer(uiController, mapView)
|
||||
|
||||
assertEquals(zoom, mapboxMap.cameraPosition.zoom, 0.0001)
|
||||
}
|
||||
}
|
||||
|
||||
executeComponentTest(componentAction)
|
||||
}
|
||||
|
||||
@Test
|
||||
@Ignore
|
||||
fun animators_cancelZoomWhileTracking() {
|
||||
@@ -1433,6 +1463,36 @@ class LocationComponentTest : EspressoTest() {
|
||||
executeComponentTest(componentAction)
|
||||
}
|
||||
|
||||
@Test
|
||||
fun animators_dontTiltWhileTransitioning() {
|
||||
val componentAction = object : LocationComponentAction.OnPerformLocationComponentAction {
|
||||
override fun onLocationComponentAction(
|
||||
component: LocationComponent,
|
||||
mapboxMap: MapboxMap,
|
||||
style: Style,
|
||||
uiController: UiController,
|
||||
context: Context
|
||||
) {
|
||||
component.activateLocationComponent(LocationComponentActivationOptions
|
||||
.builder(context, style)
|
||||
.useDefaultLocationEngine(false)
|
||||
.build())
|
||||
component.isLocationComponentEnabled = true
|
||||
component.forceLocationUpdate(location)
|
||||
|
||||
val tilt = mapboxMap.cameraPosition.tilt
|
||||
component.setCameraMode(CameraMode.TRACKING_GPS, 500L, null, null, null, null)
|
||||
component.tiltWhileTracking(30.0, 1000)
|
||||
uiController.loopMainThreadForAtLeast(1000)
|
||||
TestingAsyncUtils.waitForLayer(uiController, mapView)
|
||||
|
||||
assertEquals(tilt, mapboxMap.cameraPosition.tilt, 0.0001)
|
||||
}
|
||||
}
|
||||
|
||||
executeComponentTest(componentAction)
|
||||
}
|
||||
|
||||
@Test
|
||||
@Ignore
|
||||
fun animators_cancelTiltWhileTracking() {
|
||||
|
||||
@@ -221,6 +221,23 @@ class NativeMapViewTest : AppCenter() {
|
||||
assertEquals("Flag should match", expected, actual)
|
||||
}
|
||||
|
||||
@Test
|
||||
@UiThreadTest
|
||||
fun testPrefetchZoomDelta() {
|
||||
val expected = 2
|
||||
nativeMapView.prefetchZoomDelta = 2
|
||||
val actual = nativeMapView.prefetchZoomDelta
|
||||
assertEquals("Prefetch zoom delta should match", expected, actual)
|
||||
}
|
||||
|
||||
@Test
|
||||
@UiThreadTest
|
||||
fun testPrefetchZoomDeltaDefault() {
|
||||
val expected = 4
|
||||
val actual = nativeMapView.prefetchZoomDelta
|
||||
assertEquals("Prefetch zoom delta should match", expected, actual)
|
||||
}
|
||||
|
||||
@Test
|
||||
@UiThreadTest
|
||||
fun testSetContentPadding() {
|
||||
@@ -254,7 +271,7 @@ class NativeMapViewTest : AppCenter() {
|
||||
@Test
|
||||
@UiThreadTest
|
||||
fun testGetProjectedMetersAtLatitude() {
|
||||
val expected = 38986.83510557766
|
||||
val expected = 77973.67021115532
|
||||
val actual = nativeMapView.getMetersPerPixelAtLatitude(5.0)
|
||||
assertEquals("Get projected meters should match", expected, actual)
|
||||
}
|
||||
|
||||
@@ -4,6 +4,7 @@ import android.content.Context;
|
||||
import android.support.annotation.CallSuper;
|
||||
import android.support.annotation.UiThread;
|
||||
import android.support.test.rule.ActivityTestRule;
|
||||
import android.support.test.rule.GrantPermissionRule;
|
||||
|
||||
import com.mapbox.mapboxsdk.AppCenter;
|
||||
import com.mapbox.mapboxsdk.Mapbox;
|
||||
@@ -35,6 +36,10 @@ public abstract class BaseTest extends AppCenter {
|
||||
@Rule
|
||||
public TestName testName = new TestName();
|
||||
|
||||
@Rule
|
||||
public GrantPermissionRule grantLocationPermissionRule = GrantPermissionRule
|
||||
.grant(android.Manifest.permission.ACCESS_FINE_LOCATION);
|
||||
|
||||
protected MapboxMap mapboxMap;
|
||||
protected MapView mapView;
|
||||
private final CountDownLatch latch = new CountDownLatch(1);
|
||||
@@ -75,7 +80,12 @@ public abstract class BaseTest extends AppCenter {
|
||||
try {
|
||||
rule.runOnUiThread(() -> {
|
||||
mapView = rule.getActivity().findViewById(R.id.mapView);
|
||||
mapView.getMapAsync(this::initMap);
|
||||
if (mapView != null) {
|
||||
mapView.getMapAsync(this::initMap);
|
||||
} else {
|
||||
Timber.w("Skipping map load test since mapView is not found.");
|
||||
latch.countDown();
|
||||
}
|
||||
});
|
||||
} catch (Throwable throwable) {
|
||||
throwable.printStackTrace();
|
||||
|
||||
Reference in New Issue
Block a user