diff options
Diffstat (limited to 'platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/testapp/maps')
5 files changed, 8 insertions, 436 deletions
diff --git a/platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/testapp/maps/StyleLoadTest.kt b/platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/testapp/maps/StyleLoadTest.kt index 1f9acbb291..1397ea95c7 100644 --- a/platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/testapp/maps/StyleLoadTest.kt +++ b/platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/testapp/maps/StyleLoadTest.kt @@ -8,21 +8,17 @@ import com.mapbox.mapboxsdk.maps.Style import com.mapbox.mapboxsdk.style.layers.SymbolLayer import com.mapbox.mapboxsdk.style.sources.GeoJsonSource import com.mapbox.mapboxsdk.testapp.action.MapboxMapAction -import com.mapbox.mapboxsdk.testapp.activity.BaseActivityTest +import com.mapbox.mapboxsdk.testapp.activity.EspressoTest import com.mapbox.mapboxsdk.testapp.activity.espresso.EspressoTestActivity import org.junit.Before import org.junit.Test import org.junit.runner.RunWith @RunWith(AndroidJUnit4::class) -class StyleLoadTest : BaseActivityTest() { +class StyleLoadTest : EspressoTest() { private lateinit var mapView: MapView - override fun getActivityClass(): Class<*> { - return EspressoTestActivity::class.java - } - @Before override fun beforeTest() { super.beforeTest() diff --git a/platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/testapp/maps/VisibleRegionTest.kt b/platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/testapp/maps/VisibleRegionTest.kt deleted file mode 100644 index 72ff293c3e..0000000000 --- a/platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/testapp/maps/VisibleRegionTest.kt +++ /dev/null @@ -1,405 +0,0 @@ -package com.mapbox.mapboxsdk.testapp.maps - -import android.graphics.PointF -import android.support.test.espresso.UiController -import com.mapbox.mapboxsdk.camera.CameraUpdateFactory -import com.mapbox.mapboxsdk.geometry.LatLng -import com.mapbox.mapboxsdk.maps.MapView -import com.mapbox.mapboxsdk.maps.MapboxMap -import com.mapbox.mapboxsdk.testapp.action.MapboxMapAction.invoke -import com.mapbox.mapboxsdk.testapp.activity.BaseActivityTest -import com.mapbox.mapboxsdk.testapp.activity.espresso.EspressoTestActivity -import org.junit.Assert.assertFalse -import org.junit.Assert.assertTrue -import org.junit.Test - -class VisibleRegionTest : BaseActivityTest() { - - private lateinit var mapView: MapView - - override fun getActivityClass(): Class<*> { - return EspressoTestActivity::class.java - } - - override fun beforeTest() { - super.beforeTest() - mapView = (rule.activity as EspressoTestActivity).mapView - } - - @Test - fun visibleRegionTest() { - validateTestSetup() - invoke(mapboxMap) { _: UiController, mapboxMap: MapboxMap -> - mapboxMap.moveCamera(CameraUpdateFactory.newLatLngZoom(LatLng(0.0, 0.0), 8.0)) - val latLngs = listOf( - mapboxMap.getLatLngFromScreenCoords(0f, 0f), - mapboxMap.getLatLngFromScreenCoords(mapView.width / 2f, 0f), - mapboxMap.getLatLngFromScreenCoords(mapView.width.toFloat(), 0f), - mapboxMap.getLatLngFromScreenCoords(mapView.width.toFloat(), mapView.height / 2f), - mapboxMap.getLatLngFromScreenCoords(mapView.width.toFloat(), mapView.height.toFloat()), - mapboxMap.getLatLngFromScreenCoords(mapView.width / 2f, mapView.height.toFloat()), - mapboxMap.getLatLngFromScreenCoords(0f, mapView.height.toFloat()), - mapboxMap.getLatLngFromScreenCoords(0f, mapView.height / 2f), - mapboxMap.getLatLngFromScreenCoords(mapView.width / 2f, mapView.height / 2f) - ) - val visibleRegion = mapboxMap.projection.visibleRegion - assertTrue(latLngs.all { visibleRegion.latLngBounds.contains(it) }) - } - } - - @Test - fun paddedVisibleRegionTest() { - validateTestSetup() - invoke(mapboxMap) { _: UiController, mapboxMap: MapboxMap -> - mapboxMap.moveCamera(CameraUpdateFactory.newLatLngZoom(LatLng(0.0, 0.0), 8.0)) - val latLngs = listOf( - mapboxMap.getLatLngFromScreenCoords(0f, 0f), - mapboxMap.getLatLngFromScreenCoords(mapView.width / 2f, 0f), - mapboxMap.getLatLngFromScreenCoords(mapView.width.toFloat(), 0f), - mapboxMap.getLatLngFromScreenCoords(mapView.width.toFloat(), mapView.height / 2f), - mapboxMap.getLatLngFromScreenCoords(mapView.width.toFloat(), mapView.height.toFloat()), - mapboxMap.getLatLngFromScreenCoords(mapView.width / 2f, mapView.height.toFloat()), - mapboxMap.getLatLngFromScreenCoords(0f, mapView.height.toFloat()), - mapboxMap.getLatLngFromScreenCoords(0f, mapView.height / 2f), - mapboxMap.getLatLngFromScreenCoords(mapView.width / 2f, mapView.height / 2f) - ) - - mapboxMap.setPadding( - mapView.width / 4, - mapView.height / 4, - mapView.width / 4, - mapView.height / 4) - - val visibleRegion = mapboxMap.projection.getVisibleRegion(false) - val filtered = latLngs.filter { visibleRegion.latLngBounds.contains(it) } - assertTrue(filtered.size == 1) - assertTrue(filtered.contains(mapboxMap.getLatLngFromScreenCoords(mapView.width / 2f, mapView.height / 2f))) - } - } - - @Test - fun paddedLeftVisibleRegionTest() { - validateTestSetup() - invoke(mapboxMap) { _: UiController, mapboxMap: MapboxMap -> - mapboxMap.moveCamera(CameraUpdateFactory.newLatLngZoom(LatLng(0.0, 0.0), 8.0)) - val latLngs = listOf( - mapboxMap.getLatLngFromScreenCoords(0f, 0f), - mapboxMap.getLatLngFromScreenCoords(mapView.width / 2f, 0f), - mapboxMap.getLatLngFromScreenCoords(mapView.width.toFloat(), 0f), - mapboxMap.getLatLngFromScreenCoords(mapView.width.toFloat(), mapView.height / 2f), - mapboxMap.getLatLngFromScreenCoords(mapView.width.toFloat(), mapView.height.toFloat()), - mapboxMap.getLatLngFromScreenCoords(mapView.width / 2f, mapView.height.toFloat()), - mapboxMap.getLatLngFromScreenCoords(0f, mapView.height.toFloat()), - mapboxMap.getLatLngFromScreenCoords(0f, mapView.height / 2f), - mapboxMap.getLatLngFromScreenCoords(mapView.width / 2f, mapView.height / 2f) - ) - - mapboxMap.setPadding(mapView.width / 4, 0, 0, 0) - - val visibleRegion = mapboxMap.projection.getVisibleRegion(false) - val filtered = latLngs.filter { visibleRegion.latLngBounds.contains(it) } - assertTrue(filtered.size == 6) - assertFalse(filtered.contains(mapboxMap.getLatLngFromScreenCoords(0f, mapView.height / 2f))) - } - } - - @Test - fun paddedTopVisibleRegionTest() { - validateTestSetup() - invoke(mapboxMap) { _: UiController, mapboxMap: MapboxMap -> - mapboxMap.moveCamera(CameraUpdateFactory.newLatLngZoom(LatLng(0.0, 0.0), 8.0)) - val latLngs = listOf( - mapboxMap.getLatLngFromScreenCoords(0f, 0f), - mapboxMap.getLatLngFromScreenCoords(mapView.width / 2f, 0f), - mapboxMap.getLatLngFromScreenCoords(mapView.width.toFloat(), 0f), - mapboxMap.getLatLngFromScreenCoords(mapView.width.toFloat(), mapView.height / 2f), - mapboxMap.getLatLngFromScreenCoords(mapView.width.toFloat(), mapView.height.toFloat()), - mapboxMap.getLatLngFromScreenCoords(mapView.width / 2f, mapView.height.toFloat()), - mapboxMap.getLatLngFromScreenCoords(0f, mapView.height.toFloat()), - mapboxMap.getLatLngFromScreenCoords(0f, mapView.height / 2f), - mapboxMap.getLatLngFromScreenCoords(mapView.width / 2f, mapView.height / 2f) - ) - - mapboxMap.setPadding(0, mapView.height / 4, 0, 0) - - val visibleRegion = mapboxMap.projection.getVisibleRegion(false) - val filtered = latLngs.filter { visibleRegion.latLngBounds.contains(it) } - assertTrue(filtered.size == 6) - assertFalse(filtered.contains(mapboxMap.getLatLngFromScreenCoords(mapView.width / 2f, 0f))) - } - } - - @Test - fun paddedRightVisibleRegionTest() { - validateTestSetup() - invoke(mapboxMap) { _: UiController, mapboxMap: MapboxMap -> - mapboxMap.moveCamera(CameraUpdateFactory.newLatLngZoom(LatLng(0.0, 0.0), 8.0)) - val latLngs = listOf( - mapboxMap.getLatLngFromScreenCoords(0f, 0f), - mapboxMap.getLatLngFromScreenCoords(mapView.width / 2f, 0f), - mapboxMap.getLatLngFromScreenCoords(mapView.width.toFloat(), 0f), - mapboxMap.getLatLngFromScreenCoords(mapView.width.toFloat(), mapView.height / 2f), - mapboxMap.getLatLngFromScreenCoords(mapView.width.toFloat(), mapView.height.toFloat()), - mapboxMap.getLatLngFromScreenCoords(mapView.width / 2f, mapView.height.toFloat()), - mapboxMap.getLatLngFromScreenCoords(0f, mapView.height.toFloat()), - mapboxMap.getLatLngFromScreenCoords(0f, mapView.height / 2f), - mapboxMap.getLatLngFromScreenCoords(mapView.width / 2f, mapView.height / 2f) - ) - - mapboxMap.setPadding(0, 0, mapView.width / 4, 0) - - val visibleRegion = mapboxMap.projection.getVisibleRegion(false) - val filtered = latLngs.filter { visibleRegion.latLngBounds.contains(it) } - assertTrue(filtered.size == 6) - assertFalse(filtered.contains(mapboxMap.getLatLngFromScreenCoords(mapView.width.toFloat(), mapView.height / 2f))) - } - } - - @Test - fun paddedBottomVisibleRegionTest() { - validateTestSetup() - invoke(mapboxMap) { _: UiController, mapboxMap: MapboxMap -> - mapboxMap.moveCamera(CameraUpdateFactory.newLatLngZoom(LatLng(0.0, 0.0), 8.0)) - val latLngs = listOf( - mapboxMap.getLatLngFromScreenCoords(0f, 0f), - mapboxMap.getLatLngFromScreenCoords(mapView.width / 2f, 0f), - mapboxMap.getLatLngFromScreenCoords(mapView.width.toFloat(), 0f), - mapboxMap.getLatLngFromScreenCoords(mapView.width.toFloat(), mapView.height / 2f), - mapboxMap.getLatLngFromScreenCoords(mapView.width.toFloat(), mapView.height.toFloat()), - mapboxMap.getLatLngFromScreenCoords(mapView.width / 2f, mapView.height.toFloat()), - mapboxMap.getLatLngFromScreenCoords(0f, mapView.height.toFloat()), - mapboxMap.getLatLngFromScreenCoords(0f, mapView.height / 2f), - mapboxMap.getLatLngFromScreenCoords(mapView.width / 2f, mapView.height / 2f) - ) - - mapboxMap.setPadding(0, 0, 0, mapView.height / 4) - - val visibleRegion = mapboxMap.projection.getVisibleRegion(false) - val filtered = latLngs.filter { visibleRegion.latLngBounds.contains(it) } - assertTrue(filtered.size == 6) - assertFalse(filtered.contains(mapboxMap.getLatLngFromScreenCoords(mapView.width / 2f, mapView.height.toFloat()))) - } - } - - @Test - fun visibleRegionOverDatelineTest() { - validateTestSetup() - invoke(mapboxMap) { _: UiController, mapboxMap: MapboxMap -> - mapboxMap.moveCamera(CameraUpdateFactory.newLatLngZoom(LatLng(0.0, 180.0), 8.0)) - val latLngs = listOf( - mapboxMap.getLatLngFromScreenCoords(0f, 0f), - mapboxMap.getLatLngFromScreenCoords(mapView.width / 2f, 0f), - mapboxMap.getLatLngFromScreenCoords(mapView.width.toFloat(), 0f) - .also { it.longitude += 360 }, - mapboxMap.getLatLngFromScreenCoords(mapView.width.toFloat(), mapView.height / 2f) - .also { it.longitude += 360 }, - mapboxMap.getLatLngFromScreenCoords(mapView.width.toFloat(), mapView.height.toFloat()) - .also { it.longitude += 360 }, - mapboxMap.getLatLngFromScreenCoords(mapView.width / 2f, mapView.height.toFloat()), - mapboxMap.getLatLngFromScreenCoords(0f, mapView.height.toFloat()), - mapboxMap.getLatLngFromScreenCoords(0f, mapView.height / 2f), - mapboxMap.getLatLngFromScreenCoords(mapView.width / 2f, mapView.height / 2f) - ) - val visibleRegion = mapboxMap.projection.visibleRegion - assertTrue(latLngs.all { visibleRegion.latLngBounds.contains(it) }) - } - } - - @Test - fun paddedVisibleRegionOverDatelineTest() { - validateTestSetup() - invoke(mapboxMap) { _: UiController, mapboxMap: MapboxMap -> - mapboxMap.moveCamera(CameraUpdateFactory.newLatLngZoom(LatLng(0.0, 180.0), 8.0)) - val latLngs = listOf( - mapboxMap.getLatLngFromScreenCoords(0f, 0f), - mapboxMap.getLatLngFromScreenCoords(mapView.width / 2f, 0f), - mapboxMap.getLatLngFromScreenCoords(mapView.width.toFloat(), 0f), - mapboxMap.getLatLngFromScreenCoords(mapView.width.toFloat(), mapView.height / 2f), - mapboxMap.getLatLngFromScreenCoords(mapView.width.toFloat(), mapView.height.toFloat()), - mapboxMap.getLatLngFromScreenCoords(mapView.width / 2f, mapView.height.toFloat()), - mapboxMap.getLatLngFromScreenCoords(0f, mapView.height.toFloat()), - mapboxMap.getLatLngFromScreenCoords(0f, mapView.height / 2f), - mapboxMap.getLatLngFromScreenCoords(mapView.width / 2f, mapView.height / 2f) - ) - - mapboxMap.setPadding( - mapView.width / 4, - mapView.height / 4, - mapView.width / 4, - mapView.height / 4) - - val visibleRegion = mapboxMap.projection.getVisibleRegion(false) - val filtered = latLngs.filter { visibleRegion.latLngBounds.contains(it) } - assertTrue(filtered.size == 1) - assertTrue(filtered.contains(mapboxMap.getLatLngFromScreenCoords(mapView.width / 2f, mapView.height / 2f))) - } - } - - @Test - fun paddedLeftVisibleRegionOverDatelineTest() { - validateTestSetup() - invoke(mapboxMap) { _: UiController, mapboxMap: MapboxMap -> - mapboxMap.moveCamera(CameraUpdateFactory.newLatLngZoom(LatLng(0.0, 180.0), 8.0)) - val latLngs = listOf( - mapboxMap.getLatLngFromScreenCoords(0f, 0f), - mapboxMap.getLatLngFromScreenCoords(mapView.width / 2f, 0f), - mapboxMap.getLatLngFromScreenCoords(mapView.width.toFloat(), 0f) - .also { it.longitude += 360 }, - mapboxMap.getLatLngFromScreenCoords(mapView.width.toFloat(), mapView.height / 2f) - .also { it.longitude += 360 }, - mapboxMap.getLatLngFromScreenCoords(mapView.width.toFloat(), mapView.height.toFloat()) - .also { it.longitude += 360 }, - mapboxMap.getLatLngFromScreenCoords(mapView.width / 2f, mapView.height.toFloat()), - mapboxMap.getLatLngFromScreenCoords(0f, mapView.height.toFloat()), - mapboxMap.getLatLngFromScreenCoords(0f, mapView.height / 2f), - mapboxMap.getLatLngFromScreenCoords(mapView.width / 2f, mapView.height / 2f) - ) - - mapboxMap.setPadding(mapView.width / 4, 0, 0, 0) - - val visibleRegion = mapboxMap.projection.getVisibleRegion(false) - val filtered = latLngs.filter { visibleRegion.latLngBounds.contains(it) } - assertTrue(filtered.size == 6) - assertFalse(filtered.contains(mapboxMap.getLatLngFromScreenCoords(0f, mapView.height / 2f))) - } - } - - @Test - fun paddedTopVisibleRegionOverDatelineTest() { - validateTestSetup() - invoke(mapboxMap) { _: UiController, mapboxMap: MapboxMap -> - mapboxMap.moveCamera(CameraUpdateFactory.newLatLngZoom(LatLng(0.0, 180.0), 8.0)) - - val latLngs = listOf( - mapboxMap.getLatLngFromScreenCoords(0f, 0f), - mapboxMap.getLatLngFromScreenCoords(mapView.width / 2f, 0f), - mapboxMap.getLatLngFromScreenCoords(mapView.width.toFloat(), 0f) - .also { it.longitude += 360 }, - mapboxMap.getLatLngFromScreenCoords(mapView.width.toFloat(), mapView.height / 2f) - .also { it.longitude += 360 }, - mapboxMap.getLatLngFromScreenCoords(mapView.width.toFloat(), mapView.height.toFloat()) - .also { it.longitude += 360 }, - mapboxMap.getLatLngFromScreenCoords(mapView.width / 2f, mapView.height.toFloat()), - mapboxMap.getLatLngFromScreenCoords(0f, mapView.height.toFloat()), - mapboxMap.getLatLngFromScreenCoords(0f, mapView.height / 2f), - mapboxMap.getLatLngFromScreenCoords(mapView.width / 2f, mapView.height / 2f) - ) - - mapboxMap.setPadding(0, mapView.height / 4, 0, 0) - - val visibleRegion = mapboxMap.projection.getVisibleRegion(false) - val filtered = latLngs.filter { visibleRegion.latLngBounds.contains(it) } - assertTrue(filtered.size == 6) - assertFalse(filtered.contains(mapboxMap.getLatLngFromScreenCoords(mapView.width / 2f, 0f))) - } - } - - @Test - fun paddedRightVisibleRegionOverDatelineTest() { - validateTestSetup() - invoke(mapboxMap) { _: UiController, mapboxMap: MapboxMap -> - mapboxMap.moveCamera(CameraUpdateFactory.newLatLngZoom(LatLng(0.0, 180.0), 8.0)) - val latLngs = listOf( - mapboxMap.getLatLngFromScreenCoords(0f, 0f), - mapboxMap.getLatLngFromScreenCoords(mapView.width / 2f, 0f), - mapboxMap.getLatLngFromScreenCoords(mapView.width.toFloat(), 0f) - .also { it.longitude += 360 }, - mapboxMap.getLatLngFromScreenCoords(mapView.width.toFloat(), mapView.height / 2f) - .also { it.longitude += 360 }, - mapboxMap.getLatLngFromScreenCoords(mapView.width.toFloat(), mapView.height.toFloat()) - .also { it.longitude += 360 }, - mapboxMap.getLatLngFromScreenCoords(mapView.width / 2f, mapView.height.toFloat()), - mapboxMap.getLatLngFromScreenCoords(0f, mapView.height.toFloat()), - mapboxMap.getLatLngFromScreenCoords(0f, mapView.height / 2f), - mapboxMap.getLatLngFromScreenCoords(mapView.width / 2f, mapView.height / 2f) - ) - - mapboxMap.setPadding(0, 0, mapView.width / 4, 0) - - val visibleRegion = mapboxMap.projection.getVisibleRegion(false) - val filtered = latLngs.filter { visibleRegion.latLngBounds.contains(it) } - assertTrue(filtered.size == 6) - assertFalse(filtered.contains(mapboxMap.getLatLngFromScreenCoords(mapView.width.toFloat(), mapView.height / 2f))) - } - } - - @Test - fun paddedBottomVisibleRegionOverDatelineTest() { - validateTestSetup() - invoke(mapboxMap) { _: UiController, mapboxMap: MapboxMap -> - mapboxMap.moveCamera(CameraUpdateFactory.newLatLngZoom(LatLng(0.0, 180.0), 8.0)) - val latLngs = listOf( - mapboxMap.getLatLngFromScreenCoords(0f, 0f), - mapboxMap.getLatLngFromScreenCoords(mapView.width / 2f, 0f), - mapboxMap.getLatLngFromScreenCoords(mapView.width.toFloat(), 0f) - .also { it.longitude += 360 }, - mapboxMap.getLatLngFromScreenCoords(mapView.width.toFloat(), mapView.height / 2f) - .also { it.longitude += 360 }, - mapboxMap.getLatLngFromScreenCoords(mapView.width.toFloat(), mapView.height.toFloat()) - .also { it.longitude += 360 }, - mapboxMap.getLatLngFromScreenCoords(mapView.width / 2f, mapView.height.toFloat()), - mapboxMap.getLatLngFromScreenCoords(0f, mapView.height.toFloat()), - mapboxMap.getLatLngFromScreenCoords(0f, mapView.height / 2f), - mapboxMap.getLatLngFromScreenCoords(mapView.width / 2f, mapView.height / 2f) - ) - - mapboxMap.setPadding(0, 0, 0, mapView.height / 4) - - val visibleRegion = mapboxMap.projection.getVisibleRegion(false) - val filtered = latLngs.filter { visibleRegion.latLngBounds.contains(it) } - assertTrue(filtered.size == 6) - assertFalse(filtered.contains(mapboxMap.getLatLngFromScreenCoords(mapView.width / 2f, mapView.height.toFloat()))) - } - } - - @Test - fun visibleRotatedRegionTest() { - validateTestSetup() - invoke(mapboxMap) { _: UiController, mapboxMap: MapboxMap -> - mapboxMap.moveCamera(CameraUpdateFactory.newLatLngZoom(LatLng(0.0, 0.0), 8.0)) - val d = Math.min(mapboxMap.width, mapboxMap.height) / 4; - val latLngs = listOf( - mapboxMap.getLatLngFromScreenCoords(mapView.width / 2f, mapView.height / 2f), - mapboxMap.getLatLngFromScreenCoords(mapView.width / 2f - d / 2f, mapView.height / 2f), - mapboxMap.getLatLngFromScreenCoords(mapView.width / 2f + d / 2f, mapView.height / 2f), - mapboxMap.getLatLngFromScreenCoords(mapView.width / 2f, mapView.height / 2f - d / 2f), - mapboxMap.getLatLngFromScreenCoords(mapView.width / 2f, mapView.height / 2f + d / 2f) - ) - - - for (bearing in 45 until 360 step 45) { - mapboxMap.moveCamera(CameraUpdateFactory.bearingTo(bearing.toDouble())); - val visibleRegion = mapboxMap.projection.visibleRegion - assertTrue(latLngs.all { visibleRegion.latLngBounds.contains(it) }) - } - } - } - - @Test - fun visibleRotatedRegionOverDatelineTest() { - validateTestSetup() - invoke(mapboxMap) { _: UiController, mapboxMap: MapboxMap -> - mapboxMap.moveCamera(CameraUpdateFactory.newLatLngZoom(LatLng(0.0, 180.0), 8.0)) - val d = Math.min(mapboxMap.width, mapboxMap.height) / 4; - val latLngs = listOf( - mapboxMap.getLatLngFromScreenCoords(mapView.width / 2f, mapView.height / 2f), - mapboxMap.getLatLngFromScreenCoords(mapView.width / 2f - d / 2f, mapView.height / 2f), - mapboxMap.getLatLngFromScreenCoords(mapView.width / 2f + d / 2f, mapView.height / 2f) - .also { it.longitude += 360 }, - mapboxMap.getLatLngFromScreenCoords(mapView.width / 2f, mapView.height / 2f - d / 2f), - mapboxMap.getLatLngFromScreenCoords(mapView.width / 2f, mapView.height / 2f + d / 2f) - ) - - - for (bearing in 45 until 360 step 45) { - mapboxMap.moveCamera(CameraUpdateFactory.bearingTo(bearing.toDouble())); - val visibleRegion = mapboxMap.projection.visibleRegion - assertTrue(latLngs.all { visibleRegion.latLngBounds.contains(it) }) - } - } - } - - private fun MapboxMap.getLatLngFromScreenCoords(x: Float, y: Float): LatLng { - return this.projection.fromScreenLocation(PointF(x, y)) - } -}
\ No newline at end of file diff --git a/platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/testapp/maps/widgets/AttributionTest.java b/platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/testapp/maps/widgets/AttributionTest.java index b70c3e89ad..0fadd33325 100644 --- a/platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/testapp/maps/widgets/AttributionTest.java +++ b/platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/testapp/maps/widgets/AttributionTest.java @@ -15,8 +15,7 @@ import android.view.View; import com.mapbox.mapboxsdk.maps.MapboxMap; import com.mapbox.mapboxsdk.style.sources.Source; import com.mapbox.mapboxsdk.testapp.R; -import com.mapbox.mapboxsdk.testapp.activity.BaseActivityTest; -import com.mapbox.mapboxsdk.testapp.activity.espresso.EspressoTestActivity; +import com.mapbox.mapboxsdk.testapp.activity.EspressoTest; import org.hamcrest.Matcher; import org.junit.After; @@ -39,15 +38,10 @@ import static org.hamcrest.CoreMatchers.allOf; import static org.hamcrest.CoreMatchers.anything; import static org.hamcrest.core.IsNot.not; -public class AttributionTest extends BaseActivityTest { +public class AttributionTest extends EspressoTest { private URLSpan[] urlSpans; - @Override - protected Class getActivityClass() { - return EspressoTestActivity.class; - } - @Before public void beforeTest() { super.beforeTest(); diff --git a/platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/testapp/maps/widgets/CompassViewTest.java b/platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/testapp/maps/widgets/CompassViewTest.java index 26aee2de98..1cdf1423a3 100644 --- a/platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/testapp/maps/widgets/CompassViewTest.java +++ b/platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/testapp/maps/widgets/CompassViewTest.java @@ -4,10 +4,8 @@ import com.mapbox.mapboxsdk.camera.CameraPosition; import com.mapbox.mapboxsdk.camera.CameraUpdateFactory; import com.mapbox.mapboxsdk.geometry.LatLng; import com.mapbox.mapboxsdk.testapp.R; -import com.mapbox.mapboxsdk.testapp.activity.BaseActivityTest; -import com.mapbox.mapboxsdk.testapp.activity.espresso.EspressoTestActivity; +import com.mapbox.mapboxsdk.testapp.activity.EspressoTest; import com.mapbox.mapboxsdk.testapp.utils.TestConstants; - import org.junit.Ignore; import org.junit.Test; @@ -20,12 +18,7 @@ import static com.mapbox.mapboxsdk.testapp.action.MapboxMapAction.invoke; import static org.hamcrest.Matchers.not; import static org.junit.Assert.assertEquals; -public class CompassViewTest extends BaseActivityTest { - - @Override - protected Class getActivityClass() { - return EspressoTestActivity.class; - } +public class CompassViewTest extends EspressoTest { @Test public void testDefault() { diff --git a/platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/testapp/maps/widgets/LogoTest.java b/platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/testapp/maps/widgets/LogoTest.java index 0c189aa316..677ad6caa5 100644 --- a/platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/testapp/maps/widgets/LogoTest.java +++ b/platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/testapp/maps/widgets/LogoTest.java @@ -6,8 +6,7 @@ import android.view.View; import com.mapbox.mapboxsdk.maps.MapboxMap; import com.mapbox.mapboxsdk.testapp.R; -import com.mapbox.mapboxsdk.testapp.activity.BaseActivityTest; -import com.mapbox.mapboxsdk.testapp.activity.espresso.EspressoTestActivity; +import com.mapbox.mapboxsdk.testapp.activity.EspressoTest; import org.hamcrest.Matcher; import org.junit.Test; @@ -18,12 +17,7 @@ import static android.support.test.espresso.matcher.ViewMatchers.isDisplayed; import static android.support.test.espresso.matcher.ViewMatchers.withId; import static org.hamcrest.Matchers.not; -public class LogoTest extends BaseActivityTest { - - @Override - protected Class getActivityClass() { - return EspressoTestActivity.class; - } +public class LogoTest extends EspressoTest { @Test public void testDefault() { |