summaryrefslogtreecommitdiff
path: root/platform/android/MapboxGLAndroidSDK/src/test/java/com/mapbox/mapboxsdk/maps/MapPresenterTest.kt
diff options
context:
space:
mode:
Diffstat (limited to 'platform/android/MapboxGLAndroidSDK/src/test/java/com/mapbox/mapboxsdk/maps/MapPresenterTest.kt')
-rw-r--r--platform/android/MapboxGLAndroidSDK/src/test/java/com/mapbox/mapboxsdk/maps/MapPresenterTest.kt58
1 files changed, 44 insertions, 14 deletions
diff --git a/platform/android/MapboxGLAndroidSDK/src/test/java/com/mapbox/mapboxsdk/maps/MapPresenterTest.kt b/platform/android/MapboxGLAndroidSDK/src/test/java/com/mapbox/mapboxsdk/maps/MapPresenterTest.kt
index c1bf44e81c..cd6bca353e 100644
--- a/platform/android/MapboxGLAndroidSDK/src/test/java/com/mapbox/mapboxsdk/maps/MapPresenterTest.kt
+++ b/platform/android/MapboxGLAndroidSDK/src/test/java/com/mapbox/mapboxsdk/maps/MapPresenterTest.kt
@@ -1,7 +1,6 @@
package com.mapbox.mapboxsdk.maps
import android.content.Context
-import com.mapbox.mapboxsdk.maps.renderer.MapRenderer
import org.junit.Before
import org.junit.Test
import org.junit.runner.RunWith
@@ -11,15 +10,14 @@ import org.mockito.junit.MockitoJUnitRunner
@RunWith(MockitoJUnitRunner::class)
class MapPresenterTest {
private lateinit var mapPresenter: MapPresenter
- private lateinit var mapView: MapView
+ private lateinit var mapView: IMapView
private lateinit var context: Context
private lateinit var mapboxMapOptions: MapboxMapOptions
- private lateinit var mapRenderer: MapRenderer
private lateinit var mapChangeReceiver: MapChangeReceiver
@Before
fun setup() {
- mapView = mock(MapView::class.java)
+ mapView = mock(IMapView::class.java)
context = mock(Context::class.java)
mapChangeReceiver = mock(MapChangeReceiver::class.java)
@@ -29,9 +27,6 @@ class MapPresenterTest {
doReturn(null).`when`(mapboxMapOptions).localIdeographFontFamily
doReturn(1f).`when`(mapboxMapOptions).pixelRatio
- doReturn(mapRenderer).`when`(mapView).createSurfaceView(any(), any(), any())
- doReturn(mapRenderer).`when`(mapView).createTextureView(any(), any(), any())
-
mapPresenter = MapPresenterImpl(mapView, context, mapboxMapOptions, mapChangeReceiver)
}
@@ -57,7 +52,7 @@ class MapPresenterTest {
doReturn(false).`when`(mapboxMapOptions).translucentTextureSurface
doReturn(null).`when`(mapboxMapOptions).localIdeographFontFamily
mapPresenter = MapPresenterImpl(mapView, context, mapboxMapOptions, mapChangeReceiver)
- verify(mapView).createTextureView(mapPresenter, null, false)
+ verify(mapView).createTextureView(null, false)
}
@Test
@@ -67,7 +62,7 @@ class MapPresenterTest {
doReturn(true).`when`(mapboxMapOptions).translucentTextureSurface
doReturn(null).`when`(mapboxMapOptions).localIdeographFontFamily
mapPresenter = MapPresenterImpl(mapView, context, mapboxMapOptions, mapChangeReceiver)
- verify(mapView).createTextureView(mapPresenter, null, true)
+ verify(mapView).createTextureView(null, true)
}
@Test
@@ -77,7 +72,7 @@ class MapPresenterTest {
doReturn(true).`when`(mapboxMapOptions).translucentTextureSurface
doReturn("comic-sans").`when`(mapboxMapOptions).localIdeographFontFamily
mapPresenter = MapPresenterImpl(mapView, context, mapboxMapOptions, mapChangeReceiver)
- verify(mapView).createTextureView(mapPresenter, "comic-sans", true)
+ verify(mapView).createTextureView("comic-sans", true)
}
@Test
@@ -87,7 +82,7 @@ class MapPresenterTest {
doReturn(null).`when`(mapboxMapOptions).localIdeographFontFamily
doReturn(false).`when`(mapboxMapOptions).renderSurfaceOnTop
mapPresenter = MapPresenterImpl(mapView, context, mapboxMapOptions, mapChangeReceiver)
- verify(mapView).createSurfaceView(mapPresenter, null, false)
+ verify(mapView).createSurfaceView(null, false)
}
@Test
@@ -97,7 +92,7 @@ class MapPresenterTest {
doReturn("comic-sans").`when`(mapboxMapOptions).localIdeographFontFamily
doReturn(true).`when`(mapboxMapOptions).renderSurfaceOnTop
mapPresenter = MapPresenterImpl(mapView, context, mapboxMapOptions, mapChangeReceiver)
- verify(mapView).createSurfaceView(mapPresenter, "comic-sans", true)
+ verify(mapView).createSurfaceView("comic-sans", true)
}
@Test
@@ -105,7 +100,16 @@ class MapPresenterTest {
reset(mapView)
doReturn(false).`when`(mapboxMapOptions).crossSourceCollisions
mapPresenter = MapPresenterImpl(mapView, context, mapboxMapOptions, mapChangeReceiver)
- verify(mapView).createNativeMapView(1f, false, mapChangeReceiver, mapRenderer)
+ verify(mapView).createNativeMapView(1f, false, mapChangeReceiver)
+ }
+
+ @Test
+ fun init_initializeNativeMapView_pixelDensity() {
+ reset(mapView)
+ doReturn(false).`when`(mapboxMapOptions).crossSourceCollisions
+ doReturn(0.5f).`when`(mapboxMapOptions).pixelRatio
+ mapPresenter = MapPresenterImpl(mapView, context, mapboxMapOptions, mapChangeReceiver)
+ verify(mapView).createNativeMapView(0.5f, false, mapChangeReceiver)
}
@Test
@@ -113,6 +117,32 @@ class MapPresenterTest {
reset(mapView)
doReturn(true).`when`(mapboxMapOptions).crossSourceCollisions
mapPresenter = MapPresenterImpl(mapView, context, mapboxMapOptions, mapChangeReceiver)
- verify(mapView).createNativeMapView(1f, true, mapChangeReceiver, mapRenderer)
+ verify(mapView).createNativeMapView(1f, true, mapChangeReceiver)
+ }
+
+ @Test
+ fun init_order_texture() {
+ reset(mapView)
+ doReturn(true).`when`(mapboxMapOptions).textureMode
+ mapPresenter = MapPresenterImpl(mapView, context, mapboxMapOptions, mapChangeReceiver)
+ val orderVerifier = inOrder(mapView)
+ orderVerifier.verify(mapView).setForegroundColor(anyInt())
+ orderVerifier.verify(mapView).inflateInternalViews()
+ orderVerifier.verify(mapView).setViewOptions()
+ orderVerifier.verify(mapView).createTextureView(null, false)
+ orderVerifier.verify(mapView).createNativeMapView(anyFloat(), anyBoolean(), any(MapChangeReceiver::class.java))
+ }
+
+ @Test
+ fun init_order_surface() {
+ reset(mapView)
+ doReturn(false).`when`(mapboxMapOptions).textureMode
+ mapPresenter = MapPresenterImpl(mapView, context, mapboxMapOptions, mapChangeReceiver)
+ val orderVerifier = inOrder(mapView)
+ orderVerifier.verify(mapView).setForegroundColor(anyInt())
+ orderVerifier.verify(mapView).inflateInternalViews()
+ orderVerifier.verify(mapView).setViewOptions()
+ orderVerifier.verify(mapView).createSurfaceView(null, false)
+ orderVerifier.verify(mapView).createNativeMapView(anyFloat(), anyBoolean(), any(MapChangeReceiver::class.java))
}
} \ No newline at end of file