Co-authored-by: Birk Skyum <74932975+birkskyum@users.noreply.github.com>
This commit is contained in:
@@ -50,11 +50,11 @@ public class CameraPositionTest {
|
||||
float tilt = 44;
|
||||
|
||||
TypedArray typedArray = mock(TypedArray.class);
|
||||
when(typedArray.getFloat(R.styleable.mapbox_MapView_mapbox_cameraBearing, 0.0f)).thenReturn(bearing);
|
||||
when(typedArray.getFloat(R.styleable.mapbox_MapView_mapbox_cameraTargetLat, 0.0f)).thenReturn(latitude);
|
||||
when(typedArray.getFloat(R.styleable.mapbox_MapView_mapbox_cameraTargetLng, 0.0f)).thenReturn(longitude);
|
||||
when(typedArray.getFloat(R.styleable.mapbox_MapView_mapbox_cameraZoom, 0.0f)).thenReturn(zoom);
|
||||
when(typedArray.getFloat(R.styleable.mapbox_MapView_mapbox_cameraTilt, 0.0f)).thenReturn(tilt);
|
||||
when(typedArray.getFloat(R.styleable.maplibre_MapView_maplibre_cameraBearing, 0.0f)).thenReturn(bearing);
|
||||
when(typedArray.getFloat(R.styleable.maplibre_MapView_maplibre_cameraTargetLat, 0.0f)).thenReturn(latitude);
|
||||
when(typedArray.getFloat(R.styleable.maplibre_MapView_maplibre_cameraTargetLng, 0.0f)).thenReturn(longitude);
|
||||
when(typedArray.getFloat(R.styleable.maplibre_MapView_maplibre_cameraZoom, 0.0f)).thenReturn(zoom);
|
||||
when(typedArray.getFloat(R.styleable.maplibre_MapView_maplibre_cameraTilt, 0.0f)).thenReturn(tilt);
|
||||
doNothing().when(typedArray).recycle();
|
||||
|
||||
CameraPosition cameraPosition = new CameraPosition.Builder(typedArray).build();
|
||||
|
||||
@@ -45,10 +45,10 @@ public class LocationComponentActivationOptionsTest {
|
||||
|
||||
@Before
|
||||
public void setUp() throws Exception {
|
||||
when(context.obtainStyledAttributes(R.style.mapbox_LocationComponent, R.styleable.mapbox_LocationComponent))
|
||||
when(context.obtainStyledAttributes(R.style.maplibre_LocationComponent, R.styleable.maplibre_LocationComponent))
|
||||
.thenReturn(array);
|
||||
when(array.getResourceId(R.styleable.mapbox_LocationComponent_mapbox_foregroundDrawable, -1))
|
||||
.thenReturn(R.drawable.mapbox_user_icon);
|
||||
when(array.getResourceId(R.styleable.maplibre_LocationComponent_maplibre_foregroundDrawable, -1))
|
||||
.thenReturn(R.drawable.maplibre_user_icon);
|
||||
when(context.getResources()).thenReturn(resources);
|
||||
}
|
||||
|
||||
@@ -121,7 +121,7 @@ public class LocationComponentActivationOptionsTest {
|
||||
|
||||
LocationComponentActivationOptions.builder(context, style)
|
||||
.locationComponentOptions(locationComponentOptions)
|
||||
.styleRes(R.style.mapbox_LocationComponent)
|
||||
.styleRes(R.style.maplibre_LocationComponent)
|
||||
.build();
|
||||
}
|
||||
|
||||
|
||||
@@ -35,10 +35,10 @@ public class LocationComponentOptionsTest {
|
||||
|
||||
@Before
|
||||
public void setUp() throws Exception {
|
||||
when(context.obtainStyledAttributes(R.style.mapbox_LocationComponent, R.styleable.mapbox_LocationComponent))
|
||||
when(context.obtainStyledAttributes(R.style.maplibre_LocationComponent, R.styleable.maplibre_LocationComponent))
|
||||
.thenReturn(array);
|
||||
when(array.getResourceId(R.styleable.mapbox_LocationComponent_mapbox_foregroundDrawable, -1))
|
||||
.thenReturn(R.drawable.mapbox_user_icon);
|
||||
when(array.getResourceId(R.styleable.maplibre_LocationComponent_maplibre_foregroundDrawable, -1))
|
||||
.thenReturn(R.drawable.maplibre_user_icon);
|
||||
when(context.getResources()).thenReturn(resources);
|
||||
}
|
||||
|
||||
|
||||
@@ -93,15 +93,15 @@ class LocationComponentTest {
|
||||
Assert.assertEquals(locationEngineRequest, locationComponent.locationEngineRequest)
|
||||
|
||||
doReturn(mock(TypedArray::class.java)).`when`(context)
|
||||
.obtainStyledAttributes(R.style.mapbox_LocationComponent, R.styleable.mapbox_LocationComponent)
|
||||
.obtainStyledAttributes(R.style.maplibre_LocationComponent, R.styleable.maplibre_LocationComponent)
|
||||
|
||||
val resources = mock(Resources::class.java)
|
||||
|
||||
doReturn(resources).`when`(context).resources
|
||||
doReturn(0f).`when`(resources)
|
||||
.getDimension(R.dimen.mapbox_locationComponentTrackingMultiFingerMoveThreshold)
|
||||
.getDimension(R.dimen.maplibre_locationComponentTrackingMultiFingerMoveThreshold)
|
||||
doReturn(0f).`when`(resources)
|
||||
.getDimension(R.dimen.mapbox_locationComponentTrackingMultiFingerMoveThreshold)
|
||||
.getDimension(R.dimen.maplibre_locationComponentTrackingMultiFingerMoveThreshold)
|
||||
locationComponent.activateLocationComponent(context, mock(Style::class.java), true, locationEngineRequest)
|
||||
Assert.assertEquals(locationEngineRequest, locationComponent.locationEngineRequest)
|
||||
}
|
||||
|
||||
@@ -77,13 +77,13 @@ class MapboxMapOptionsAttrsTest {
|
||||
|
||||
private fun mockEnableLocalIdeograph(enabled: Boolean) {
|
||||
every {
|
||||
typedArray.getBoolean(R.styleable.mapbox_MapView_mapbox_localIdeographEnabled, true)
|
||||
typedArray.getBoolean(R.styleable.maplibre_MapView_maplibre_localIdeographEnabled, true)
|
||||
}.returns(enabled)
|
||||
}
|
||||
|
||||
private fun mockLocalIdeographString(font: String) {
|
||||
every {
|
||||
typedArray.getString(R.styleable.mapbox_MapView_mapbox_localIdeographFontFamily)
|
||||
typedArray.getString(R.styleable.maplibre_MapView_maplibre_localIdeographFontFamily)
|
||||
}.returns(font)
|
||||
}
|
||||
|
||||
@@ -91,7 +91,7 @@ class MapboxMapOptionsAttrsTest {
|
||||
val resId = 9000
|
||||
|
||||
every {
|
||||
typedArray.getResourceId(R.styleable.mapbox_MapView_mapbox_localIdeographFontFamilies, 0)
|
||||
typedArray.getResourceId(R.styleable.maplibre_MapView_maplibre_localIdeographFontFamilies, 0)
|
||||
}.returns(resId)
|
||||
|
||||
every {
|
||||
|
||||
Reference in New Issue
Block a user