Search in sources :

Example 11 with ScaleBarOptions

use of com.mapbox.pluginscalebar.ScaleBarOptions in project mapbox-plugins-android by mapbox.

the class ScaleBarTest method testTextBorder.

@Test
public void testTextBorder() {
    validateTestSetup();
    setupScaleBar();
    invoke(mapboxMap, (uiController, mapboxMap) -> {
        assertEquals(activity.getResources().getDimension(R.dimen.mapbox_scale_bar_text_border_width), scaleBarWidget.getTextBorderWidth(), 0);
        assertTrue(scaleBarWidget.isShowTextBorder());
        ScaleBarOptions option = new ScaleBarOptions(activity);
        option.setTextBorderWidth(R.dimen.fab_margin);
        scaleBarWidget = scaleBarPlugin.create(option);
        assertNotNull(scaleBarWidget);
        assertEquals(activity.getResources().getDimension(R.dimen.fab_margin), scaleBarWidget.getTextBorderWidth(), 0);
        option = new ScaleBarOptions(activity);
        option.setTextBorderWidth(100f);
        scaleBarWidget = scaleBarPlugin.create(option);
        assertNotNull(scaleBarWidget);
        assertEquals(100f, scaleBarWidget.getTextBorderWidth(), 0);
        option = new ScaleBarOptions(activity);
        option.setShowTextBorder(false);
        scaleBarWidget = scaleBarPlugin.create(option);
        assertNotNull(scaleBarWidget);
        assertFalse(scaleBarWidget.isShowTextBorder());
    });
}
Also used : ScaleBarOptions(com.mapbox.pluginscalebar.ScaleBarOptions) Test(org.junit.Test) BaseActivityTest(com.mapbox.mapboxsdk.plugins.BaseActivityTest)

Aggregations

ScaleBarOptions (com.mapbox.pluginscalebar.ScaleBarOptions)11 BaseActivityTest (com.mapbox.mapboxsdk.plugins.BaseActivityTest)9 Test (org.junit.Test)9 ScaleBarPlugin (com.mapbox.pluginscalebar.ScaleBarPlugin)2 SuppressLint (android.annotation.SuppressLint)1 Bundle (android.os.Bundle)1 CameraPosition (com.mapbox.mapboxsdk.camera.CameraPosition)1 LatLng (com.mapbox.mapboxsdk.geometry.LatLng)1 UiSettings (com.mapbox.mapboxsdk.maps.UiSettings)1 Callback (fr.free.nrw.commons.nearby.fragments.AdvanceQueryFragment.Callback)1 IOException (java.io.IOException)1 Date (java.util.Date)1