diff options
author | Łukasz Paczos <lukasz.paczos@mapbox.com> | 2019-07-30 14:07:58 +0300 |
---|---|---|
committer | Łukasz Paczos <lukasz.paczos@mapbox.com> | 2019-07-30 13:53:03 +0200 |
commit | f86f0226dd7f87fef97378cff225754ae5d69c90 (patch) | |
tree | 120076800201edbc1e0bf8a9c1a33ef789f7fe05 /platform/android | |
parent | 05af3e0e2872063a22bb816465e259194e46caab (diff) | |
download | qtlocation-mapboxgl-f86f0226dd7f87fef97378cff225754ae5d69c90.tar.gz |
[android] ensure default local ideographs font family is not overwrote
Diffstat (limited to 'platform/android')
2 files changed, 19 insertions, 3 deletions
diff --git a/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/maps/MapboxMapOptions.java b/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/maps/MapboxMapOptions.java index 09bb5012d1..a394b97124 100644 --- a/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/maps/MapboxMapOptions.java +++ b/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/maps/MapboxMapOptions.java @@ -69,7 +69,7 @@ public class MapboxMapOptions implements Parcelable { private boolean prefetchesTiles = true; private boolean zMediaOverlay = false; - private String localIdeographFontFamily = "sans-serif"; + private String localIdeographFontFamily; private String apiBaseUri; @@ -246,8 +246,14 @@ public class MapboxMapOptions implements Parcelable { typedArray.getBoolean(R.styleable.mapbox_MapView_mapbox_enableTilePrefetch, true)); mapboxMapOptions.renderSurfaceOnTop( typedArray.getBoolean(R.styleable.mapbox_MapView_mapbox_enableZMediaOverlay, false)); - mapboxMapOptions.localIdeographFontFamily( - typedArray.getString(R.styleable.mapbox_MapView_mapbox_localIdeographFontFamily)); + + String localIdeographFontFamily = + typedArray.getString(R.styleable.mapbox_MapView_mapbox_localIdeographFontFamily); + if (localIdeographFontFamily == null) { + localIdeographFontFamily = "sans-serif"; + } + mapboxMapOptions.localIdeographFontFamily(localIdeographFontFamily); + mapboxMapOptions.pixelRatio( typedArray.getFloat(R.styleable.mapbox_MapView_mapbox_pixelRatio, 0)); mapboxMapOptions.foregroundLoadColor( diff --git a/platform/android/MapboxGLAndroidSDK/src/test/java/com/mapbox/mapboxsdk/maps/MapboxMapOptionsTest.java b/platform/android/MapboxGLAndroidSDK/src/test/java/com/mapbox/mapboxsdk/maps/MapboxMapOptionsTest.java index f03d1fb15f..11035c050f 100644 --- a/platform/android/MapboxGLAndroidSDK/src/test/java/com/mapbox/mapboxsdk/maps/MapboxMapOptionsTest.java +++ b/platform/android/MapboxGLAndroidSDK/src/test/java/com/mapbox/mapboxsdk/maps/MapboxMapOptionsTest.java @@ -8,6 +8,9 @@ import com.mapbox.mapboxsdk.constants.MapboxConstants; import com.mapbox.mapboxsdk.geometry.LatLng; import org.junit.Test; +import org.junit.runner.RunWith; +import org.robolectric.RobolectricTestRunner; +import org.robolectric.RuntimeEnvironment; import java.util.Arrays; @@ -18,6 +21,7 @@ import static org.junit.Assert.assertNotEquals; import static org.junit.Assert.assertNotNull; import static org.junit.Assert.assertTrue; +@RunWith(RobolectricTestRunner.class) public class MapboxMapOptionsTest { private static final double DELTA = 1e-15; @@ -172,5 +176,11 @@ public class MapboxMapOptionsTest { assertTrue(new MapboxMapOptions().crossSourceCollisions(true).getCrossSourceCollisions()); assertFalse(new MapboxMapOptions().crossSourceCollisions(false).getCrossSourceCollisions()); } + + @Test + public void testLocalIdeographFontFamily_enabledByDefault() { + MapboxMapOptions options = MapboxMapOptions.createFromAttributes(RuntimeEnvironment.application, null); + assertEquals("sans-serif", options.getLocalIdeographFontFamily()); + } } |