diff options
author | Peng Liu <peng.liu@mapbox.com> | 2019-09-06 16:49:25 +0300 |
---|---|---|
committer | Peng Liu <peng.liu@mapbox.com> | 2019-09-06 17:14:40 +0300 |
commit | 29a14fb2f29d3a796e70b529722bbd1a22b80336 (patch) | |
tree | 5bf948e33b10543c11599ee2104a96af060663d9 | |
parent | ca579a8ccbf514e7eb60dff732976ef55efa0f69 (diff) | |
download | qtlocation-mapboxgl-29a14fb2f29d3a796e70b529722bbd1a22b80336.tar.gz |
[android] Skip map load tests if no mapView is found, include more generated sanity tests for Android test app.
3 files changed, 11 insertions, 19 deletions
diff --git a/platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/testapp/activity/BaseTest.java b/platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/testapp/activity/BaseTest.java index a66b1256cd..b6c16c8147 100644 --- a/platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/testapp/activity/BaseTest.java +++ b/platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/testapp/activity/BaseTest.java @@ -37,7 +37,8 @@ public abstract class BaseTest extends AppCenter { public TestName testName = new TestName(); @Rule - public GrantPermissionRule grantLocationPermissionRule = GrantPermissionRule.grant(android.Manifest.permission.ACCESS_FINE_LOCATION); + public GrantPermissionRule grantLocationPermissionRule = GrantPermissionRule + .grant(android.Manifest.permission.ACCESS_FINE_LOCATION); protected MapboxMap mapboxMap; protected MapView mapView; @@ -79,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(); diff --git a/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/activity/location/LocationFragmentActivity.kt b/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/activity/location/LocationFragmentActivity.kt index ff2afb50c5..22f76153ff 100644 --- a/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/activity/location/LocationFragmentActivity.kt +++ b/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/activity/location/LocationFragmentActivity.kt @@ -116,7 +116,9 @@ class LocationFragmentActivity : AppCompatActivity() { } override fun onSuccess(result: LocationEngineResult?) { + if (!mapView.isDestroyed) { mapboxMap.animateCamera(CameraUpdateFactory.newLatLngZoom(LatLng(result?.lastLocation), 12.0)) + } } override fun onFailure(exception: Exception) { diff --git a/platform/android/scripts/exclude-activity-gen.json b/platform/android/scripts/exclude-activity-gen.json index 4ec8d2eb57..cf468a44e8 100644 --- a/platform/android/scripts/exclude-activity-gen.json +++ b/platform/android/scripts/exclude-activity-gen.json @@ -1,19 +1,3 @@ [ - "EspressoTestActivity", - "FragmentBackStackActivity", - "MapFragmentActivity", - "MultiMapActivity", - "NestedViewPagerActivity", - "SupportMapFragmentActivity", - "ViewPagerActivity", - "LocationFragmentActivity", - "BottomSheetActivity", - "DebugModeActivity", - "DoubleMapActivity", - "MapInDialogActivity", - "ChangeResourcesCachePathActivity", - "DeleteRegionActivity", - "DownloadRegionActivity", - "UpdateMetadataActivity", - "RenderTestActivity" + "EspressoTestActivity" ] |