summaryrefslogtreecommitdiff
path: root/platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/utils/FontUtilsTest.java
blob: fa068cb973af1d75b6da57d62cf30964617508c5 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
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);
  }
}