[android] add fallback support to local ideograph font families, allow setting a collection of fonts

This commit is contained in:
tobrun
2019-07-30 17:14:26 +03:00
committed by Łukasz Paczos
parent bc09cdbf76
commit 58d7734722
8 changed files with 167 additions and 12 deletions

View File

@@ -0,0 +1,43 @@
package com.mapbox.mapboxsdk.utils;
import android.support.test.runner.AndroidJUnit4;
import com.mapbox.mapboxsdk.constants.MapboxConstants;
import org.junit.Test;
import org.junit.runner.RunWith;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertNull;
@RunWith(AndroidJUnit4.class)
public class FontUtilsTest {
@Test
public void testExtractedFontShouldMatchDefault() {
String[] fonts = new String[] {"foo", "bar"};
String actual = FontUtils.extractValidFont(fonts);
assertEquals("Selected font should match", MapboxConstants.DEFAULT_FONT, actual);
}
@Test
public void testExtractedFontShouldMatchMonospace() {
String expected = "monospace";
String[] fonts = new String[] {"foo", expected};
String actual = FontUtils.extractValidFont(fonts);
assertEquals("Selected font should match", expected, actual);
}
@Test
public void testExtractedFontArrayShouldBeNull() {
String[] fonts = null;
String actual = FontUtils.extractValidFont(fonts);
assertNull(actual);
}
@Test
public void testExtractedFontShouldBeNull() {
String actual = FontUtils.extractValidFont(null);
assertNull(actual);
}
}