Skip to content
This repository has been archived by the owner on Aug 8, 2023. It is now read-only.

Commit

Permalink
[android] ensure default local ideographs font family is not overwrote
Browse files Browse the repository at this point in the history
  • Loading branch information
LukasPaczos committed Jul 30, 2019
1 parent 05af3e0 commit f86f022
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand Down Expand Up @@ -246,8 +246,14 @@ public static MapboxMapOptions createFromAttributes(@NonNull Context context, @N
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(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,9 @@
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;

Expand All @@ -18,6 +21,7 @@
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;
Expand Down Expand Up @@ -172,5 +176,11 @@ public void testCrossSourceCollisions() {
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());
}
}

0 comments on commit f86f022

Please sign in to comment.