[android] Fix MapSnapshotter regression and add activity sanity tests (#15580)
* [android] Include more generated sanity tests for Android test app. * [android] Add null check for camera position padding. * [android] Skip map load tests if no mapView is found, include more generated sanity tests for Android test app. * [android] Set mapboxMap to null during the mapView destroy process, fix failed sanity tests. * [android] Add file source related activities to the sanity test exclude list. * [android] Fixes according to @tobrun's review. * [android] Add more activities to exclude list, keep MapSnapshotterActivity for regression test.
This commit is contained in:
@@ -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