[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();
|
||||
|
||||
@@ -151,6 +151,9 @@ public class BulkMarkerActivity extends AppCompatActivity implements AdapterView
|
||||
@Override
|
||||
protected void onDestroy() {
|
||||
super.onDestroy();
|
||||
if (progressDialog != null) {
|
||||
progressDialog.dismiss();
|
||||
}
|
||||
mapView.onDestroy();
|
||||
}
|
||||
|
||||
|
||||
@@ -81,7 +81,9 @@ public class MapFragmentActivity extends AppCompatActivity implements MapFragmen
|
||||
@Override
|
||||
protected void onDestroy() {
|
||||
super.onDestroy();
|
||||
mapView.removeOnDidFinishRenderingFrameListener(this);
|
||||
if (mapView != null) {
|
||||
mapView.removeOnDidFinishRenderingFrameListener(this);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -116,7 +116,7 @@ class LocationFragmentActivity : AppCompatActivity() {
|
||||
}
|
||||
|
||||
override fun onSuccess(result: LocationEngineResult?) {
|
||||
mapboxMap.animateCamera(CameraUpdateFactory.newLatLngZoom(LatLng(result?.lastLocation), 12.0))
|
||||
if (!mapView.isDestroyed) mapboxMap.animateCamera(CameraUpdateFactory.newLatLngZoom(LatLng(result?.lastLocation), 12.0))
|
||||
}
|
||||
|
||||
override fun onFailure(exception: Exception) {
|
||||
|
||||
@@ -89,6 +89,7 @@ public class MapSnapshotterActivity extends AppCompatActivity {
|
||||
.bearing(randomInRange(0, 360))
|
||||
.tilt(randomInRange(0, 60))
|
||||
.zoom(randomInRange(0, 20))
|
||||
.padding(1, 1, 1, 1)
|
||||
.build()
|
||||
);
|
||||
}
|
||||
|
||||
@@ -362,7 +362,12 @@ public class SymbolGeneratorActivity extends AppCompatActivity implements OnMapR
|
||||
@Override
|
||||
protected void onPostExecute(HashMap<String, Bitmap> bitmapHashMap) {
|
||||
super.onPostExecute(bitmapHashMap);
|
||||
mapboxMap.getStyle().addImagesAsync(bitmapHashMap);
|
||||
mapboxMap.getStyle(new Style.OnStyleLoaded() {
|
||||
@Override
|
||||
public void onStyleLoaded(@NonNull Style style) {
|
||||
style.addImagesAsync(bitmapHashMap);
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user