[android] - fix code generation, remove lamda, fixup color conversion locale
This commit is contained in:
@@ -3,34 +3,38 @@
|
||||
package com.mapbox.mapboxsdk.testapp.style;
|
||||
|
||||
import android.graphics.Color;
|
||||
import android.support.test.espresso.UiController;
|
||||
import android.support.test.runner.AndroidJUnit4;
|
||||
|
||||
import timber.log.Timber;
|
||||
|
||||
import com.mapbox.mapboxsdk.maps.MapboxMap;
|
||||
import com.mapbox.mapboxsdk.style.functions.CompositeFunction;
|
||||
import com.mapbox.mapboxsdk.style.functions.CameraFunction;
|
||||
import com.mapbox.mapboxsdk.style.functions.SourceFunction;
|
||||
import com.mapbox.mapboxsdk.style.functions.stops.CategoricalStops;
|
||||
import com.mapbox.mapboxsdk.style.functions.stops.ExponentialStops;
|
||||
import com.mapbox.mapboxsdk.style.functions.stops.IdentityStops;
|
||||
import com.mapbox.mapboxsdk.style.functions.stops.IntervalStops;
|
||||
import com.mapbox.mapboxsdk.style.functions.stops.Stop;
|
||||
import com.mapbox.mapboxsdk.style.functions.stops.Stops;
|
||||
import com.mapbox.mapboxsdk.style.layers.BackgroundLayer;
|
||||
import com.mapbox.mapboxsdk.style.layers.TransitionOptions;
|
||||
import com.mapbox.mapboxsdk.testapp.action.MapboxMapAction;
|
||||
import com.mapbox.mapboxsdk.testapp.activity.BaseActivityTest;
|
||||
import com.mapbox.mapboxsdk.testapp.activity.espresso.EspressoTestActivity;
|
||||
|
||||
import org.junit.Test;
|
||||
import org.junit.runner.RunWith;
|
||||
|
||||
import timber.log.Timber;
|
||||
|
||||
import static com.mapbox.mapboxsdk.style.functions.Function.zoom;
|
||||
import static com.mapbox.mapboxsdk.style.functions.Function.*;
|
||||
import static com.mapbox.mapboxsdk.style.functions.stops.Stop.stop;
|
||||
import static com.mapbox.mapboxsdk.style.functions.stops.Stops.exponential;
|
||||
import static com.mapbox.mapboxsdk.style.functions.stops.Stops.interval;
|
||||
import static com.mapbox.mapboxsdk.style.layers.Property.NONE;
|
||||
import static com.mapbox.mapboxsdk.style.layers.Property.VISIBLE;
|
||||
import static com.mapbox.mapboxsdk.style.layers.PropertyFactory.backgroundColor;
|
||||
import static com.mapbox.mapboxsdk.style.layers.PropertyFactory.backgroundOpacity;
|
||||
import static com.mapbox.mapboxsdk.style.layers.PropertyFactory.backgroundPattern;
|
||||
import static com.mapbox.mapboxsdk.style.layers.PropertyFactory.visibility;
|
||||
import static com.mapbox.mapboxsdk.style.functions.stops.Stops.*;
|
||||
import static com.mapbox.mapboxsdk.testapp.action.MapboxMapAction.invoke;
|
||||
import static org.junit.Assert.assertEquals;
|
||||
import static org.junit.Assert.assertNotNull;
|
||||
import static org.junit.Assert.*;
|
||||
import static com.mapbox.mapboxsdk.style.layers.Property.*;
|
||||
import static com.mapbox.mapboxsdk.style.layers.PropertyFactory.*;
|
||||
|
||||
import com.mapbox.mapboxsdk.style.layers.TransitionOptions;
|
||||
import com.mapbox.mapboxsdk.testapp.activity.espresso.EspressoTestActivity;
|
||||
|
||||
/**
|
||||
* Basic smoke tests for BackgroundLayer
|
||||
@@ -47,7 +51,12 @@ public class BackgroundLayerTest extends BaseActivityTest {
|
||||
|
||||
private void setupLayer() {
|
||||
Timber.i("Retrieving layer");
|
||||
invoke(mapboxMap, (uiController, mapboxMap) -> layer = mapboxMap.getLayerAs("background"));
|
||||
invoke(mapboxMap, new MapboxMapAction.OnInvokeActionListener() {
|
||||
@Override
|
||||
public void onInvokeAction(UiController uiController, MapboxMap mapboxMap) {
|
||||
layer = mapboxMap.getLayerAs("background");
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@Test
|
||||
@@ -55,15 +64,18 @@ public class BackgroundLayerTest extends BaseActivityTest {
|
||||
validateTestSetup();
|
||||
setupLayer();
|
||||
Timber.i("Visibility");
|
||||
invoke(mapboxMap, (uiController, mapboxMap) -> {
|
||||
assertNotNull(layer);
|
||||
invoke(mapboxMap, new MapboxMapAction.OnInvokeActionListener() {
|
||||
@Override
|
||||
public void onInvokeAction(UiController uiController, MapboxMap mapboxMap) {
|
||||
assertNotNull(layer);
|
||||
|
||||
// Get initial
|
||||
assertEquals(layer.getVisibility().getValue(), VISIBLE);
|
||||
// Get initial
|
||||
assertEquals(layer.getVisibility().getValue(), VISIBLE);
|
||||
|
||||
// Set
|
||||
layer.setProperties(visibility(NONE));
|
||||
assertEquals(layer.getVisibility().getValue(), NONE);
|
||||
// Set
|
||||
layer.setProperties(visibility(NONE));
|
||||
assertEquals(layer.getVisibility().getValue(), NONE);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@@ -72,13 +84,16 @@ public class BackgroundLayerTest extends BaseActivityTest {
|
||||
validateTestSetup();
|
||||
setupLayer();
|
||||
Timber.i("background-colorTransitionOptions");
|
||||
invoke(mapboxMap, (uiController, mapboxMap) -> {
|
||||
assertNotNull(layer);
|
||||
invoke(mapboxMap, new MapboxMapAction.OnInvokeActionListener() {
|
||||
@Override
|
||||
public void onInvokeAction(UiController uiController, MapboxMap mapboxMap) {
|
||||
assertNotNull(layer);
|
||||
|
||||
// Set and Get
|
||||
TransitionOptions options = new TransitionOptions(300, 100);
|
||||
layer.setBackgroundColorTransition(options);
|
||||
assertEquals(layer.getBackgroundColorTransition(), options);
|
||||
// Set and Get
|
||||
TransitionOptions options = new TransitionOptions(300, 100);
|
||||
layer.setBackgroundColorTransition(options);
|
||||
assertEquals(layer.getBackgroundColorTransition(), options);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@@ -87,12 +102,15 @@ public class BackgroundLayerTest extends BaseActivityTest {
|
||||
validateTestSetup();
|
||||
setupLayer();
|
||||
Timber.i("background-color");
|
||||
invoke(mapboxMap, (uiController, mapboxMap) -> {
|
||||
assertNotNull(layer);
|
||||
invoke(mapboxMap, new MapboxMapAction.OnInvokeActionListener() {
|
||||
@Override
|
||||
public void onInvokeAction(UiController uiController, MapboxMap mapboxMap) {
|
||||
assertNotNull(layer);
|
||||
|
||||
// Set and Get
|
||||
layer.setProperties(backgroundColor("rgba(0, 0, 0, 1)"));
|
||||
assertEquals((String) layer.getBackgroundColor().getValue(), (String) "rgba(0, 0, 0, 1)");
|
||||
// Set and Get
|
||||
layer.setProperties(backgroundColor("rgba(0, 0, 0, 1)"));
|
||||
assertEquals((String) layer.getBackgroundColor().getValue(), (String) "rgba(0, 0, 0, 1)");
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@@ -101,27 +119,30 @@ public class BackgroundLayerTest extends BaseActivityTest {
|
||||
validateTestSetup();
|
||||
setupLayer();
|
||||
Timber.i("background-color");
|
||||
invoke(mapboxMap, (uiController, mapboxMap) -> {
|
||||
assertNotNull(layer);
|
||||
invoke(mapboxMap, new MapboxMapAction.OnInvokeActionListener() {
|
||||
@Override
|
||||
public void onInvokeAction(UiController uiController, MapboxMap mapboxMap) {
|
||||
assertNotNull(layer);
|
||||
|
||||
// Set
|
||||
layer.setProperties(
|
||||
backgroundColor(
|
||||
zoom(
|
||||
exponential(
|
||||
stop(2, backgroundColor("rgba(0, 0, 0, 1)"))
|
||||
).withBase(0.5f)
|
||||
// Set
|
||||
layer.setProperties(
|
||||
backgroundColor(
|
||||
zoom(
|
||||
exponential(
|
||||
stop(2, backgroundColor("rgba(0, 0, 0, 1)"))
|
||||
).withBase(0.5f)
|
||||
)
|
||||
)
|
||||
)
|
||||
);
|
||||
);
|
||||
|
||||
// Verify
|
||||
assertNotNull(layer.getBackgroundColor());
|
||||
assertNotNull(layer.getBackgroundColor().getFunction());
|
||||
assertEquals(CameraFunction.class, layer.getBackgroundColor().getFunction().getClass());
|
||||
assertEquals(ExponentialStops.class, layer.getBackgroundColor().getFunction().getStops().getClass());
|
||||
assertEquals(0.5f, ((ExponentialStops) layer.getBackgroundColor().getFunction().getStops()).getBase(), 0.001);
|
||||
assertEquals(1, ((ExponentialStops) layer.getBackgroundColor().getFunction().getStops()).size());
|
||||
// Verify
|
||||
assertNotNull(layer.getBackgroundColor());
|
||||
assertNotNull(layer.getBackgroundColor().getFunction());
|
||||
assertEquals(CameraFunction.class, layer.getBackgroundColor().getFunction().getClass());
|
||||
assertEquals(ExponentialStops.class, layer.getBackgroundColor().getFunction().getStops().getClass());
|
||||
assertEquals(0.5f, ((ExponentialStops) layer.getBackgroundColor().getFunction().getStops()).getBase(), 0.001);
|
||||
assertEquals(1, ((ExponentialStops) layer.getBackgroundColor().getFunction().getStops()).size());
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@@ -130,12 +151,15 @@ public class BackgroundLayerTest extends BaseActivityTest {
|
||||
validateTestSetup();
|
||||
setupLayer();
|
||||
Timber.i("background-color");
|
||||
invoke(mapboxMap, (uiController, mapboxMap) -> {
|
||||
assertNotNull(layer);
|
||||
invoke(mapboxMap, new MapboxMapAction.OnInvokeActionListener() {
|
||||
@Override
|
||||
public void onInvokeAction(UiController uiController, MapboxMap mapboxMap) {
|
||||
assertNotNull(layer);
|
||||
|
||||
// Set and Get
|
||||
layer.setProperties(backgroundColor(Color.RED));
|
||||
assertEquals(layer.getBackgroundColorAsInt(), Color.RED);
|
||||
// Set and Get
|
||||
layer.setProperties(backgroundColor(Color.RED));
|
||||
assertEquals(layer.getBackgroundColorAsInt(), Color.RED);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@@ -144,13 +168,16 @@ public class BackgroundLayerTest extends BaseActivityTest {
|
||||
validateTestSetup();
|
||||
setupLayer();
|
||||
Timber.i("background-patternTransitionOptions");
|
||||
invoke(mapboxMap, (uiController, mapboxMap) -> {
|
||||
assertNotNull(layer);
|
||||
invoke(mapboxMap, new MapboxMapAction.OnInvokeActionListener() {
|
||||
@Override
|
||||
public void onInvokeAction(UiController uiController, MapboxMap mapboxMap) {
|
||||
assertNotNull(layer);
|
||||
|
||||
// Set and Get
|
||||
TransitionOptions options = new TransitionOptions(300, 100);
|
||||
layer.setBackgroundPatternTransition(options);
|
||||
assertEquals(layer.getBackgroundPatternTransition(), options);
|
||||
// Set and Get
|
||||
TransitionOptions options = new TransitionOptions(300, 100);
|
||||
layer.setBackgroundPatternTransition(options);
|
||||
assertEquals(layer.getBackgroundPatternTransition(), options);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@@ -159,12 +186,15 @@ public class BackgroundLayerTest extends BaseActivityTest {
|
||||
validateTestSetup();
|
||||
setupLayer();
|
||||
Timber.i("background-pattern");
|
||||
invoke(mapboxMap, (uiController, mapboxMap) -> {
|
||||
assertNotNull(layer);
|
||||
invoke(mapboxMap, new MapboxMapAction.OnInvokeActionListener() {
|
||||
@Override
|
||||
public void onInvokeAction(UiController uiController, MapboxMap mapboxMap) {
|
||||
assertNotNull(layer);
|
||||
|
||||
// Set and Get
|
||||
layer.setProperties(backgroundPattern("pedestrian-polygon"));
|
||||
assertEquals((String) layer.getBackgroundPattern().getValue(), (String) "pedestrian-polygon");
|
||||
// Set and Get
|
||||
layer.setProperties(backgroundPattern("pedestrian-polygon"));
|
||||
assertEquals((String) layer.getBackgroundPattern().getValue(), (String) "pedestrian-polygon");
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@@ -173,26 +203,29 @@ public class BackgroundLayerTest extends BaseActivityTest {
|
||||
validateTestSetup();
|
||||
setupLayer();
|
||||
Timber.i("background-pattern");
|
||||
invoke(mapboxMap, (uiController, mapboxMap) -> {
|
||||
assertNotNull(layer);
|
||||
invoke(mapboxMap, new MapboxMapAction.OnInvokeActionListener() {
|
||||
@Override
|
||||
public void onInvokeAction(UiController uiController, MapboxMap mapboxMap) {
|
||||
assertNotNull(layer);
|
||||
|
||||
// Set
|
||||
layer.setProperties(
|
||||
backgroundPattern(
|
||||
zoom(
|
||||
interval(
|
||||
stop(2, backgroundPattern("pedestrian-polygon"))
|
||||
// Set
|
||||
layer.setProperties(
|
||||
backgroundPattern(
|
||||
zoom(
|
||||
interval(
|
||||
stop(2, backgroundPattern("pedestrian-polygon"))
|
||||
)
|
||||
)
|
||||
)
|
||||
)
|
||||
);
|
||||
);
|
||||
|
||||
// Verify
|
||||
assertNotNull(layer.getBackgroundPattern());
|
||||
assertNotNull(layer.getBackgroundPattern().getFunction());
|
||||
assertEquals(CameraFunction.class, layer.getBackgroundPattern().getFunction().getClass());
|
||||
assertEquals(IntervalStops.class, layer.getBackgroundPattern().getFunction().getStops().getClass());
|
||||
assertEquals(1, ((IntervalStops) layer.getBackgroundPattern().getFunction().getStops()).size());
|
||||
// Verify
|
||||
assertNotNull(layer.getBackgroundPattern());
|
||||
assertNotNull(layer.getBackgroundPattern().getFunction());
|
||||
assertEquals(CameraFunction.class, layer.getBackgroundPattern().getFunction().getClass());
|
||||
assertEquals(IntervalStops.class, layer.getBackgroundPattern().getFunction().getStops().getClass());
|
||||
assertEquals(1, ((IntervalStops) layer.getBackgroundPattern().getFunction().getStops()).size());
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@@ -201,13 +234,16 @@ public class BackgroundLayerTest extends BaseActivityTest {
|
||||
validateTestSetup();
|
||||
setupLayer();
|
||||
Timber.i("background-opacityTransitionOptions");
|
||||
invoke(mapboxMap, (uiController, mapboxMap) -> {
|
||||
assertNotNull(layer);
|
||||
invoke(mapboxMap, new MapboxMapAction.OnInvokeActionListener() {
|
||||
@Override
|
||||
public void onInvokeAction(UiController uiController, MapboxMap mapboxMap) {
|
||||
assertNotNull(layer);
|
||||
|
||||
// Set and Get
|
||||
TransitionOptions options = new TransitionOptions(300, 100);
|
||||
layer.setBackgroundOpacityTransition(options);
|
||||
assertEquals(layer.getBackgroundOpacityTransition(), options);
|
||||
// Set and Get
|
||||
TransitionOptions options = new TransitionOptions(300, 100);
|
||||
layer.setBackgroundOpacityTransition(options);
|
||||
assertEquals(layer.getBackgroundOpacityTransition(), options);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@@ -216,12 +252,15 @@ public class BackgroundLayerTest extends BaseActivityTest {
|
||||
validateTestSetup();
|
||||
setupLayer();
|
||||
Timber.i("background-opacity");
|
||||
invoke(mapboxMap, (uiController, mapboxMap) -> {
|
||||
assertNotNull(layer);
|
||||
invoke(mapboxMap, new MapboxMapAction.OnInvokeActionListener() {
|
||||
@Override
|
||||
public void onInvokeAction(UiController uiController, MapboxMap mapboxMap) {
|
||||
assertNotNull(layer);
|
||||
|
||||
// Set and Get
|
||||
layer.setProperties(backgroundOpacity(0.3f));
|
||||
assertEquals((Float) layer.getBackgroundOpacity().getValue(), (Float) 0.3f);
|
||||
// Set and Get
|
||||
layer.setProperties(backgroundOpacity(0.3f));
|
||||
assertEquals((Float) layer.getBackgroundOpacity().getValue(), (Float) 0.3f);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@@ -230,27 +269,30 @@ public class BackgroundLayerTest extends BaseActivityTest {
|
||||
validateTestSetup();
|
||||
setupLayer();
|
||||
Timber.i("background-opacity");
|
||||
invoke(mapboxMap, (uiController, mapboxMap) -> {
|
||||
assertNotNull(layer);
|
||||
invoke(mapboxMap, new MapboxMapAction.OnInvokeActionListener() {
|
||||
@Override
|
||||
public void onInvokeAction(UiController uiController, MapboxMap mapboxMap) {
|
||||
assertNotNull(layer);
|
||||
|
||||
// Set
|
||||
layer.setProperties(
|
||||
backgroundOpacity(
|
||||
zoom(
|
||||
exponential(
|
||||
stop(2, backgroundOpacity(0.3f))
|
||||
).withBase(0.5f)
|
||||
// Set
|
||||
layer.setProperties(
|
||||
backgroundOpacity(
|
||||
zoom(
|
||||
exponential(
|
||||
stop(2, backgroundOpacity(0.3f))
|
||||
).withBase(0.5f)
|
||||
)
|
||||
)
|
||||
)
|
||||
);
|
||||
);
|
||||
|
||||
// Verify
|
||||
assertNotNull(layer.getBackgroundOpacity());
|
||||
assertNotNull(layer.getBackgroundOpacity().getFunction());
|
||||
assertEquals(CameraFunction.class, layer.getBackgroundOpacity().getFunction().getClass());
|
||||
assertEquals(ExponentialStops.class, layer.getBackgroundOpacity().getFunction().getStops().getClass());
|
||||
assertEquals(0.5f, ((ExponentialStops) layer.getBackgroundOpacity().getFunction().getStops()).getBase(), 0.001);
|
||||
assertEquals(1, ((ExponentialStops) layer.getBackgroundOpacity().getFunction().getStops()).size());
|
||||
// Verify
|
||||
assertNotNull(layer.getBackgroundOpacity());
|
||||
assertNotNull(layer.getBackgroundOpacity().getFunction());
|
||||
assertEquals(CameraFunction.class, layer.getBackgroundOpacity().getFunction().getClass());
|
||||
assertEquals(ExponentialStops.class, layer.getBackgroundOpacity().getFunction().getStops().getClass());
|
||||
assertEquals(0.5f, ((ExponentialStops) layer.getBackgroundOpacity().getFunction().getStops()).getBase(), 0.001);
|
||||
assertEquals(1, ((ExponentialStops) layer.getBackgroundOpacity().getFunction().getStops()).size());
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
@@ -6,22 +6,24 @@ import android.support.test.espresso.ViewAction;
|
||||
import android.support.test.runner.AndroidJUnit4;
|
||||
import android.view.View;
|
||||
|
||||
import com.mapbox.mapboxsdk.maps.MapboxMap;
|
||||
import com.mapbox.mapboxsdk.style.light.Light;
|
||||
import com.mapbox.mapboxsdk.style.functions.Function;
|
||||
import com.mapbox.mapboxsdk.style.functions.stops.IdentityStops;
|
||||
import com.mapbox.mapboxsdk.style.layers.FillExtrusionLayer;
|
||||
import com.mapbox.mapboxsdk.style.layers.TransitionOptions;
|
||||
import com.mapbox.mapboxsdk.style.light.Light;
|
||||
import com.mapbox.mapboxsdk.style.light.Position;
|
||||
import com.mapbox.mapboxsdk.testapp.R;
|
||||
import com.mapbox.mapboxsdk.testapp.action.MapboxMapAction;
|
||||
import com.mapbox.mapboxsdk.testapp.activity.BaseActivityTest;
|
||||
import com.mapbox.mapboxsdk.testapp.activity.style.FillExtrusionStyleTestActivity;
|
||||
|
||||
import timber.log.Timber;
|
||||
|
||||
import org.hamcrest.Matcher;
|
||||
import org.junit.Test;
|
||||
import org.junit.runner.RunWith;
|
||||
|
||||
import timber.log.Timber;
|
||||
|
||||
import static android.support.test.espresso.Espresso.onView;
|
||||
import static android.support.test.espresso.matcher.ViewMatchers.isDisplayed;
|
||||
import static android.support.test.espresso.matcher.ViewMatchers.withId;
|
||||
@@ -31,6 +33,7 @@ import static com.mapbox.mapboxsdk.style.layers.PropertyFactory.fillExtrusionBas
|
||||
import static com.mapbox.mapboxsdk.style.layers.PropertyFactory.fillExtrusionColor;
|
||||
import static com.mapbox.mapboxsdk.style.layers.PropertyFactory.fillExtrusionHeight;
|
||||
import static com.mapbox.mapboxsdk.style.layers.PropertyFactory.fillExtrusionOpacity;
|
||||
|
||||
import static com.mapbox.mapboxsdk.testapp.action.MapboxMapAction.invoke;
|
||||
import static junit.framework.Assert.assertEquals;
|
||||
import static junit.framework.Assert.assertNotNull;
|
||||
@@ -45,11 +48,14 @@ public class LightTest extends BaseActivityTest {
|
||||
validateTestSetup();
|
||||
setupLight();
|
||||
Timber.i("anchor");
|
||||
invoke(mapboxMap, (uiController, mapboxMap) -> {
|
||||
assertNotNull(light);
|
||||
// Set and Get
|
||||
light.setAnchor(ANCHOR_MAP);
|
||||
assertEquals("Anchor should match", ANCHOR_MAP, light.getAnchor());
|
||||
invoke(mapboxMap, new MapboxMapAction.OnInvokeActionListener() {
|
||||
@Override
|
||||
public void onInvokeAction(UiController uiController, MapboxMap mapboxMap) {
|
||||
assertNotNull(light);
|
||||
// Set and Get
|
||||
light.setAnchor(ANCHOR_MAP);
|
||||
assertEquals("Anchor should match", ANCHOR_MAP, light.getAnchor());
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@@ -58,12 +64,15 @@ public class LightTest extends BaseActivityTest {
|
||||
validateTestSetup();
|
||||
setupLight();
|
||||
Timber.i("positionTransitionOptions");
|
||||
invoke(mapboxMap, (uiController, mapboxMap) -> {
|
||||
assertNotNull(light);
|
||||
// Set and Get
|
||||
TransitionOptions options = new TransitionOptions(300, 100);
|
||||
light.setPositionTransition(options);
|
||||
assertEquals("Transition options should match", options, light.getPositionTransition());
|
||||
invoke(mapboxMap, new MapboxMapAction.OnInvokeActionListener() {
|
||||
@Override
|
||||
public void onInvokeAction(UiController uiController, MapboxMap mapboxMap) {
|
||||
assertNotNull(light);
|
||||
// Set and Get
|
||||
TransitionOptions options = new TransitionOptions(300, 100);
|
||||
light.setPositionTransition(options);
|
||||
assertEquals("Transition options should match", options, light.getPositionTransition());
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@@ -72,12 +81,15 @@ public class LightTest extends BaseActivityTest {
|
||||
validateTestSetup();
|
||||
setupLight();
|
||||
Timber.i("position");
|
||||
invoke(mapboxMap, (uiController, mapboxMap) -> {
|
||||
assertNotNull(light);
|
||||
// Set and Get
|
||||
Position position = new Position(1, 2, 3);
|
||||
light.setPosition(position);
|
||||
assertEquals("Position should match", position, light.getPosition());
|
||||
invoke(mapboxMap, new MapboxMapAction.OnInvokeActionListener() {
|
||||
@Override
|
||||
public void onInvokeAction(UiController uiController, MapboxMap mapboxMap) {
|
||||
assertNotNull(light);
|
||||
// Set and Get
|
||||
Position position = new Position(1, 2, 3);
|
||||
light.setPosition(position);
|
||||
assertEquals("Position should match", position, light.getPosition());
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@@ -86,12 +98,15 @@ public class LightTest extends BaseActivityTest {
|
||||
validateTestSetup();
|
||||
setupLight();
|
||||
Timber.i("colorTransitionOptions");
|
||||
invoke(mapboxMap, (uiController, mapboxMap) -> {
|
||||
assertNotNull(light);
|
||||
// Set and Get
|
||||
TransitionOptions options = new TransitionOptions(300, 100);
|
||||
light.setColorTransition(options);
|
||||
assertEquals("Transition options should match", options, light.getColorTransition());
|
||||
invoke(mapboxMap, new MapboxMapAction.OnInvokeActionListener() {
|
||||
@Override
|
||||
public void onInvokeAction(UiController uiController, MapboxMap mapboxMap) {
|
||||
assertNotNull(light);
|
||||
// Set and Get
|
||||
TransitionOptions options = new TransitionOptions(300, 100);
|
||||
light.setColorTransition(options);
|
||||
assertEquals("Transition options should match", options, light.getColorTransition());
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@@ -100,11 +115,14 @@ public class LightTest extends BaseActivityTest {
|
||||
validateTestSetup();
|
||||
setupLight();
|
||||
Timber.i("color");
|
||||
invoke(mapboxMap, (uiController, mapboxMap) -> {
|
||||
assertNotNull(light);
|
||||
// Set and Get
|
||||
light.setColor("rgba(0, 0, 0, 1)");
|
||||
assertEquals("Color should match", "rgba(0, 0, 0, 1)".replaceAll("\\s+", ""), light.getColor());
|
||||
invoke(mapboxMap, new MapboxMapAction.OnInvokeActionListener() {
|
||||
@Override
|
||||
public void onInvokeAction(UiController uiController, MapboxMap mapboxMap) {
|
||||
assertNotNull(light);
|
||||
// Set and Get
|
||||
light.setColor("rgba(0, 0, 0, 1)");
|
||||
assertEquals("Color should match", "rgba(0, 0, 0, 1)".replaceAll("\\s+", ""), light.getColor());
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@@ -113,12 +131,15 @@ public class LightTest extends BaseActivityTest {
|
||||
validateTestSetup();
|
||||
setupLight();
|
||||
Timber.i("intensityTransitionOptions");
|
||||
invoke(mapboxMap, (uiController, mapboxMap) -> {
|
||||
assertNotNull(light);
|
||||
// Set and Get
|
||||
TransitionOptions options = new TransitionOptions(300, 100);
|
||||
light.setIntensityTransition(options);
|
||||
assertEquals("Transition options should match", options, light.getIntensityTransition());
|
||||
invoke(mapboxMap, new MapboxMapAction.OnInvokeActionListener() {
|
||||
@Override
|
||||
public void onInvokeAction(UiController uiController, MapboxMap mapboxMap) {
|
||||
assertNotNull(light);
|
||||
// Set and Get
|
||||
TransitionOptions options = new TransitionOptions(300, 100);
|
||||
light.setIntensityTransition(options);
|
||||
assertEquals("Transition options should match", options, light.getIntensityTransition());
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@@ -127,11 +148,14 @@ public class LightTest extends BaseActivityTest {
|
||||
validateTestSetup();
|
||||
setupLight();
|
||||
Timber.i("intensity");
|
||||
invoke(mapboxMap, (uiController, mapboxMap) -> {
|
||||
assertNotNull(light);
|
||||
// Set and Get
|
||||
light.setIntensity(0.3f);
|
||||
assertEquals("Intensity should match", 0.3f, light.getIntensity());
|
||||
invoke(mapboxMap, new MapboxMapAction.OnInvokeActionListener() {
|
||||
@Override
|
||||
public void onInvokeAction(UiController uiController, MapboxMap mapboxMap) {
|
||||
assertNotNull(light);
|
||||
// Set and Get
|
||||
light.setIntensity(0.3f);
|
||||
assertEquals("Intensity should match", 0.3f, light.getIntensity());
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -2,36 +2,39 @@
|
||||
|
||||
package com.mapbox.mapboxsdk.testapp.style;
|
||||
|
||||
import android.graphics.Color;
|
||||
import android.support.test.espresso.UiController;
|
||||
import android.support.test.runner.AndroidJUnit4;
|
||||
|
||||
import timber.log.Timber;
|
||||
|
||||
import com.mapbox.mapboxsdk.maps.MapboxMap;
|
||||
import com.mapbox.mapboxsdk.style.functions.CompositeFunction;
|
||||
import com.mapbox.mapboxsdk.style.functions.CameraFunction;
|
||||
import com.mapbox.mapboxsdk.style.functions.SourceFunction;
|
||||
import com.mapbox.mapboxsdk.style.functions.stops.CategoricalStops;
|
||||
import com.mapbox.mapboxsdk.style.functions.stops.ExponentialStops;
|
||||
import com.mapbox.mapboxsdk.style.functions.stops.IdentityStops;
|
||||
import com.mapbox.mapboxsdk.style.functions.stops.IntervalStops;
|
||||
import com.mapbox.mapboxsdk.style.functions.stops.Stop;
|
||||
import com.mapbox.mapboxsdk.style.functions.stops.Stops;
|
||||
import com.mapbox.mapboxsdk.style.layers.RasterLayer;
|
||||
import com.mapbox.mapboxsdk.style.layers.TransitionOptions;
|
||||
import com.mapbox.mapboxsdk.testapp.action.MapboxMapAction;
|
||||
import com.mapbox.mapboxsdk.testapp.activity.BaseActivityTest;
|
||||
import com.mapbox.mapboxsdk.testapp.activity.espresso.EspressoTestActivity;
|
||||
|
||||
import org.junit.Test;
|
||||
import org.junit.runner.RunWith;
|
||||
|
||||
import timber.log.Timber;
|
||||
|
||||
import static com.mapbox.mapboxsdk.style.functions.Function.zoom;
|
||||
import static com.mapbox.mapboxsdk.style.functions.Function.*;
|
||||
import static com.mapbox.mapboxsdk.style.functions.stops.Stop.stop;
|
||||
import static com.mapbox.mapboxsdk.style.functions.stops.Stops.exponential;
|
||||
import static com.mapbox.mapboxsdk.style.layers.Property.NONE;
|
||||
import static com.mapbox.mapboxsdk.style.layers.Property.VISIBLE;
|
||||
import static com.mapbox.mapboxsdk.style.layers.PropertyFactory.rasterBrightnessMax;
|
||||
import static com.mapbox.mapboxsdk.style.layers.PropertyFactory.rasterBrightnessMin;
|
||||
import static com.mapbox.mapboxsdk.style.layers.PropertyFactory.rasterContrast;
|
||||
import static com.mapbox.mapboxsdk.style.layers.PropertyFactory.rasterFadeDuration;
|
||||
import static com.mapbox.mapboxsdk.style.layers.PropertyFactory.rasterHueRotate;
|
||||
import static com.mapbox.mapboxsdk.style.layers.PropertyFactory.rasterOpacity;
|
||||
import static com.mapbox.mapboxsdk.style.layers.PropertyFactory.rasterSaturation;
|
||||
import static com.mapbox.mapboxsdk.style.layers.PropertyFactory.visibility;
|
||||
import static com.mapbox.mapboxsdk.style.functions.stops.Stops.*;
|
||||
import static com.mapbox.mapboxsdk.testapp.action.MapboxMapAction.invoke;
|
||||
import static org.junit.Assert.assertEquals;
|
||||
import static org.junit.Assert.assertNotNull;
|
||||
import static org.junit.Assert.*;
|
||||
import static com.mapbox.mapboxsdk.style.layers.Property.*;
|
||||
import static com.mapbox.mapboxsdk.style.layers.PropertyFactory.*;
|
||||
|
||||
import com.mapbox.mapboxsdk.style.layers.TransitionOptions;
|
||||
import com.mapbox.mapboxsdk.testapp.activity.espresso.EspressoTestActivity;
|
||||
|
||||
/**
|
||||
* Basic smoke tests for RasterLayer
|
||||
@@ -48,14 +51,17 @@ public class RasterLayerTest extends BaseActivityTest {
|
||||
|
||||
private void setupLayer() {
|
||||
Timber.i("Retrieving layer");
|
||||
invoke(mapboxMap, (uiController, mapboxMap) -> {
|
||||
if ((layer = mapboxMap.getLayerAs("my-layer")) == null) {
|
||||
Timber.i("Adding layer");
|
||||
layer = new RasterLayer("my-layer", "composite");
|
||||
layer.setSourceLayer("composite");
|
||||
mapboxMap.addLayer(layer);
|
||||
// Layer reference is now stale, get new reference
|
||||
layer = mapboxMap.getLayerAs("my-layer");
|
||||
invoke(mapboxMap, new MapboxMapAction.OnInvokeActionListener() {
|
||||
@Override
|
||||
public void onInvokeAction(UiController uiController, MapboxMap mapboxMap) {
|
||||
if ((layer = mapboxMap.getLayerAs("my-layer")) == null) {
|
||||
Timber.i("Adding layer");
|
||||
layer = new RasterLayer("my-layer", "composite");
|
||||
layer.setSourceLayer("composite");
|
||||
mapboxMap.addLayer(layer);
|
||||
// Layer reference is now stale, get new reference
|
||||
layer = mapboxMap.getLayerAs("my-layer");
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
@@ -65,15 +71,18 @@ public class RasterLayerTest extends BaseActivityTest {
|
||||
validateTestSetup();
|
||||
setupLayer();
|
||||
Timber.i("Visibility");
|
||||
invoke(mapboxMap, (uiController, mapboxMap) -> {
|
||||
assertNotNull(layer);
|
||||
invoke(mapboxMap, new MapboxMapAction.OnInvokeActionListener() {
|
||||
@Override
|
||||
public void onInvokeAction(UiController uiController, MapboxMap mapboxMap) {
|
||||
assertNotNull(layer);
|
||||
|
||||
// Get initial
|
||||
assertEquals(layer.getVisibility().getValue(), VISIBLE);
|
||||
// Get initial
|
||||
assertEquals(layer.getVisibility().getValue(), VISIBLE);
|
||||
|
||||
// Set
|
||||
layer.setProperties(visibility(NONE));
|
||||
assertEquals(layer.getVisibility().getValue(), NONE);
|
||||
// Set
|
||||
layer.setProperties(visibility(NONE));
|
||||
assertEquals(layer.getVisibility().getValue(), NONE);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@@ -82,13 +91,16 @@ public class RasterLayerTest extends BaseActivityTest {
|
||||
validateTestSetup();
|
||||
setupLayer();
|
||||
Timber.i("raster-opacityTransitionOptions");
|
||||
invoke(mapboxMap, (uiController, mapboxMap) -> {
|
||||
assertNotNull(layer);
|
||||
invoke(mapboxMap, new MapboxMapAction.OnInvokeActionListener() {
|
||||
@Override
|
||||
public void onInvokeAction(UiController uiController, MapboxMap mapboxMap) {
|
||||
assertNotNull(layer);
|
||||
|
||||
// Set and Get
|
||||
TransitionOptions options = new TransitionOptions(300, 100);
|
||||
layer.setRasterOpacityTransition(options);
|
||||
assertEquals(layer.getRasterOpacityTransition(), options);
|
||||
// Set and Get
|
||||
TransitionOptions options = new TransitionOptions(300, 100);
|
||||
layer.setRasterOpacityTransition(options);
|
||||
assertEquals(layer.getRasterOpacityTransition(), options);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@@ -97,12 +109,15 @@ public class RasterLayerTest extends BaseActivityTest {
|
||||
validateTestSetup();
|
||||
setupLayer();
|
||||
Timber.i("raster-opacity");
|
||||
invoke(mapboxMap, (uiController, mapboxMap) -> {
|
||||
assertNotNull(layer);
|
||||
invoke(mapboxMap, new MapboxMapAction.OnInvokeActionListener() {
|
||||
@Override
|
||||
public void onInvokeAction(UiController uiController, MapboxMap mapboxMap) {
|
||||
assertNotNull(layer);
|
||||
|
||||
// Set and Get
|
||||
layer.setProperties(rasterOpacity(0.3f));
|
||||
assertEquals((Float) layer.getRasterOpacity().getValue(), (Float) 0.3f);
|
||||
// Set and Get
|
||||
layer.setProperties(rasterOpacity(0.3f));
|
||||
assertEquals((Float) layer.getRasterOpacity().getValue(), (Float) 0.3f);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@@ -111,27 +126,30 @@ public class RasterLayerTest extends BaseActivityTest {
|
||||
validateTestSetup();
|
||||
setupLayer();
|
||||
Timber.i("raster-opacity");
|
||||
invoke(mapboxMap, (uiController, mapboxMap) -> {
|
||||
assertNotNull(layer);
|
||||
invoke(mapboxMap, new MapboxMapAction.OnInvokeActionListener() {
|
||||
@Override
|
||||
public void onInvokeAction(UiController uiController, MapboxMap mapboxMap) {
|
||||
assertNotNull(layer);
|
||||
|
||||
// Set
|
||||
layer.setProperties(
|
||||
rasterOpacity(
|
||||
zoom(
|
||||
exponential(
|
||||
stop(2, rasterOpacity(0.3f))
|
||||
).withBase(0.5f)
|
||||
// Set
|
||||
layer.setProperties(
|
||||
rasterOpacity(
|
||||
zoom(
|
||||
exponential(
|
||||
stop(2, rasterOpacity(0.3f))
|
||||
).withBase(0.5f)
|
||||
)
|
||||
)
|
||||
)
|
||||
);
|
||||
);
|
||||
|
||||
// Verify
|
||||
assertNotNull(layer.getRasterOpacity());
|
||||
assertNotNull(layer.getRasterOpacity().getFunction());
|
||||
assertEquals(CameraFunction.class, layer.getRasterOpacity().getFunction().getClass());
|
||||
assertEquals(ExponentialStops.class, layer.getRasterOpacity().getFunction().getStops().getClass());
|
||||
assertEquals(0.5f, ((ExponentialStops) layer.getRasterOpacity().getFunction().getStops()).getBase(), 0.001);
|
||||
assertEquals(1, ((ExponentialStops) layer.getRasterOpacity().getFunction().getStops()).size());
|
||||
// Verify
|
||||
assertNotNull(layer.getRasterOpacity());
|
||||
assertNotNull(layer.getRasterOpacity().getFunction());
|
||||
assertEquals(CameraFunction.class, layer.getRasterOpacity().getFunction().getClass());
|
||||
assertEquals(ExponentialStops.class, layer.getRasterOpacity().getFunction().getStops().getClass());
|
||||
assertEquals(0.5f, ((ExponentialStops) layer.getRasterOpacity().getFunction().getStops()).getBase(), 0.001);
|
||||
assertEquals(1, ((ExponentialStops) layer.getRasterOpacity().getFunction().getStops()).size());
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@@ -140,13 +158,16 @@ public class RasterLayerTest extends BaseActivityTest {
|
||||
validateTestSetup();
|
||||
setupLayer();
|
||||
Timber.i("raster-hue-rotateTransitionOptions");
|
||||
invoke(mapboxMap, (uiController, mapboxMap) -> {
|
||||
assertNotNull(layer);
|
||||
invoke(mapboxMap, new MapboxMapAction.OnInvokeActionListener() {
|
||||
@Override
|
||||
public void onInvokeAction(UiController uiController, MapboxMap mapboxMap) {
|
||||
assertNotNull(layer);
|
||||
|
||||
// Set and Get
|
||||
TransitionOptions options = new TransitionOptions(300, 100);
|
||||
layer.setRasterHueRotateTransition(options);
|
||||
assertEquals(layer.getRasterHueRotateTransition(), options);
|
||||
// Set and Get
|
||||
TransitionOptions options = new TransitionOptions(300, 100);
|
||||
layer.setRasterHueRotateTransition(options);
|
||||
assertEquals(layer.getRasterHueRotateTransition(), options);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@@ -155,12 +176,15 @@ public class RasterLayerTest extends BaseActivityTest {
|
||||
validateTestSetup();
|
||||
setupLayer();
|
||||
Timber.i("raster-hue-rotate");
|
||||
invoke(mapboxMap, (uiController, mapboxMap) -> {
|
||||
assertNotNull(layer);
|
||||
invoke(mapboxMap, new MapboxMapAction.OnInvokeActionListener() {
|
||||
@Override
|
||||
public void onInvokeAction(UiController uiController, MapboxMap mapboxMap) {
|
||||
assertNotNull(layer);
|
||||
|
||||
// Set and Get
|
||||
layer.setProperties(rasterHueRotate(0.3f));
|
||||
assertEquals((Float) layer.getRasterHueRotate().getValue(), (Float) 0.3f);
|
||||
// Set and Get
|
||||
layer.setProperties(rasterHueRotate(0.3f));
|
||||
assertEquals((Float) layer.getRasterHueRotate().getValue(), (Float) 0.3f);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@@ -169,27 +193,30 @@ public class RasterLayerTest extends BaseActivityTest {
|
||||
validateTestSetup();
|
||||
setupLayer();
|
||||
Timber.i("raster-hue-rotate");
|
||||
invoke(mapboxMap, (uiController, mapboxMap) -> {
|
||||
assertNotNull(layer);
|
||||
invoke(mapboxMap, new MapboxMapAction.OnInvokeActionListener() {
|
||||
@Override
|
||||
public void onInvokeAction(UiController uiController, MapboxMap mapboxMap) {
|
||||
assertNotNull(layer);
|
||||
|
||||
// Set
|
||||
layer.setProperties(
|
||||
rasterHueRotate(
|
||||
zoom(
|
||||
exponential(
|
||||
stop(2, rasterHueRotate(0.3f))
|
||||
).withBase(0.5f)
|
||||
// Set
|
||||
layer.setProperties(
|
||||
rasterHueRotate(
|
||||
zoom(
|
||||
exponential(
|
||||
stop(2, rasterHueRotate(0.3f))
|
||||
).withBase(0.5f)
|
||||
)
|
||||
)
|
||||
)
|
||||
);
|
||||
);
|
||||
|
||||
// Verify
|
||||
assertNotNull(layer.getRasterHueRotate());
|
||||
assertNotNull(layer.getRasterHueRotate().getFunction());
|
||||
assertEquals(CameraFunction.class, layer.getRasterHueRotate().getFunction().getClass());
|
||||
assertEquals(ExponentialStops.class, layer.getRasterHueRotate().getFunction().getStops().getClass());
|
||||
assertEquals(0.5f, ((ExponentialStops) layer.getRasterHueRotate().getFunction().getStops()).getBase(), 0.001);
|
||||
assertEquals(1, ((ExponentialStops) layer.getRasterHueRotate().getFunction().getStops()).size());
|
||||
// Verify
|
||||
assertNotNull(layer.getRasterHueRotate());
|
||||
assertNotNull(layer.getRasterHueRotate().getFunction());
|
||||
assertEquals(CameraFunction.class, layer.getRasterHueRotate().getFunction().getClass());
|
||||
assertEquals(ExponentialStops.class, layer.getRasterHueRotate().getFunction().getStops().getClass());
|
||||
assertEquals(0.5f, ((ExponentialStops) layer.getRasterHueRotate().getFunction().getStops()).getBase(), 0.001);
|
||||
assertEquals(1, ((ExponentialStops) layer.getRasterHueRotate().getFunction().getStops()).size());
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@@ -198,13 +225,16 @@ public class RasterLayerTest extends BaseActivityTest {
|
||||
validateTestSetup();
|
||||
setupLayer();
|
||||
Timber.i("raster-brightness-minTransitionOptions");
|
||||
invoke(mapboxMap, (uiController, mapboxMap) -> {
|
||||
assertNotNull(layer);
|
||||
invoke(mapboxMap, new MapboxMapAction.OnInvokeActionListener() {
|
||||
@Override
|
||||
public void onInvokeAction(UiController uiController, MapboxMap mapboxMap) {
|
||||
assertNotNull(layer);
|
||||
|
||||
// Set and Get
|
||||
TransitionOptions options = new TransitionOptions(300, 100);
|
||||
layer.setRasterBrightnessMinTransition(options);
|
||||
assertEquals(layer.getRasterBrightnessMinTransition(), options);
|
||||
// Set and Get
|
||||
TransitionOptions options = new TransitionOptions(300, 100);
|
||||
layer.setRasterBrightnessMinTransition(options);
|
||||
assertEquals(layer.getRasterBrightnessMinTransition(), options);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@@ -213,12 +243,15 @@ public class RasterLayerTest extends BaseActivityTest {
|
||||
validateTestSetup();
|
||||
setupLayer();
|
||||
Timber.i("raster-brightness-min");
|
||||
invoke(mapboxMap, (uiController, mapboxMap) -> {
|
||||
assertNotNull(layer);
|
||||
invoke(mapboxMap, new MapboxMapAction.OnInvokeActionListener() {
|
||||
@Override
|
||||
public void onInvokeAction(UiController uiController, MapboxMap mapboxMap) {
|
||||
assertNotNull(layer);
|
||||
|
||||
// Set and Get
|
||||
layer.setProperties(rasterBrightnessMin(0.3f));
|
||||
assertEquals((Float) layer.getRasterBrightnessMin().getValue(), (Float) 0.3f);
|
||||
// Set and Get
|
||||
layer.setProperties(rasterBrightnessMin(0.3f));
|
||||
assertEquals((Float) layer.getRasterBrightnessMin().getValue(), (Float) 0.3f);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@@ -227,27 +260,30 @@ public class RasterLayerTest extends BaseActivityTest {
|
||||
validateTestSetup();
|
||||
setupLayer();
|
||||
Timber.i("raster-brightness-min");
|
||||
invoke(mapboxMap, (uiController, mapboxMap) -> {
|
||||
assertNotNull(layer);
|
||||
invoke(mapboxMap, new MapboxMapAction.OnInvokeActionListener() {
|
||||
@Override
|
||||
public void onInvokeAction(UiController uiController, MapboxMap mapboxMap) {
|
||||
assertNotNull(layer);
|
||||
|
||||
// Set
|
||||
layer.setProperties(
|
||||
rasterBrightnessMin(
|
||||
zoom(
|
||||
exponential(
|
||||
stop(2, rasterBrightnessMin(0.3f))
|
||||
).withBase(0.5f)
|
||||
// Set
|
||||
layer.setProperties(
|
||||
rasterBrightnessMin(
|
||||
zoom(
|
||||
exponential(
|
||||
stop(2, rasterBrightnessMin(0.3f))
|
||||
).withBase(0.5f)
|
||||
)
|
||||
)
|
||||
)
|
||||
);
|
||||
);
|
||||
|
||||
// Verify
|
||||
assertNotNull(layer.getRasterBrightnessMin());
|
||||
assertNotNull(layer.getRasterBrightnessMin().getFunction());
|
||||
assertEquals(CameraFunction.class, layer.getRasterBrightnessMin().getFunction().getClass());
|
||||
assertEquals(ExponentialStops.class, layer.getRasterBrightnessMin().getFunction().getStops().getClass());
|
||||
assertEquals(0.5f, ((ExponentialStops) layer.getRasterBrightnessMin().getFunction().getStops()).getBase(), 0.001);
|
||||
assertEquals(1, ((ExponentialStops) layer.getRasterBrightnessMin().getFunction().getStops()).size());
|
||||
// Verify
|
||||
assertNotNull(layer.getRasterBrightnessMin());
|
||||
assertNotNull(layer.getRasterBrightnessMin().getFunction());
|
||||
assertEquals(CameraFunction.class, layer.getRasterBrightnessMin().getFunction().getClass());
|
||||
assertEquals(ExponentialStops.class, layer.getRasterBrightnessMin().getFunction().getStops().getClass());
|
||||
assertEquals(0.5f, ((ExponentialStops) layer.getRasterBrightnessMin().getFunction().getStops()).getBase(), 0.001);
|
||||
assertEquals(1, ((ExponentialStops) layer.getRasterBrightnessMin().getFunction().getStops()).size());
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@@ -256,13 +292,16 @@ public class RasterLayerTest extends BaseActivityTest {
|
||||
validateTestSetup();
|
||||
setupLayer();
|
||||
Timber.i("raster-brightness-maxTransitionOptions");
|
||||
invoke(mapboxMap, (uiController, mapboxMap) -> {
|
||||
assertNotNull(layer);
|
||||
invoke(mapboxMap, new MapboxMapAction.OnInvokeActionListener() {
|
||||
@Override
|
||||
public void onInvokeAction(UiController uiController, MapboxMap mapboxMap) {
|
||||
assertNotNull(layer);
|
||||
|
||||
// Set and Get
|
||||
TransitionOptions options = new TransitionOptions(300, 100);
|
||||
layer.setRasterBrightnessMaxTransition(options);
|
||||
assertEquals(layer.getRasterBrightnessMaxTransition(), options);
|
||||
// Set and Get
|
||||
TransitionOptions options = new TransitionOptions(300, 100);
|
||||
layer.setRasterBrightnessMaxTransition(options);
|
||||
assertEquals(layer.getRasterBrightnessMaxTransition(), options);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@@ -271,12 +310,15 @@ public class RasterLayerTest extends BaseActivityTest {
|
||||
validateTestSetup();
|
||||
setupLayer();
|
||||
Timber.i("raster-brightness-max");
|
||||
invoke(mapboxMap, (uiController, mapboxMap) -> {
|
||||
assertNotNull(layer);
|
||||
invoke(mapboxMap, new MapboxMapAction.OnInvokeActionListener() {
|
||||
@Override
|
||||
public void onInvokeAction(UiController uiController, MapboxMap mapboxMap) {
|
||||
assertNotNull(layer);
|
||||
|
||||
// Set and Get
|
||||
layer.setProperties(rasterBrightnessMax(0.3f));
|
||||
assertEquals((Float) layer.getRasterBrightnessMax().getValue(), (Float) 0.3f);
|
||||
// Set and Get
|
||||
layer.setProperties(rasterBrightnessMax(0.3f));
|
||||
assertEquals((Float) layer.getRasterBrightnessMax().getValue(), (Float) 0.3f);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@@ -285,27 +327,30 @@ public class RasterLayerTest extends BaseActivityTest {
|
||||
validateTestSetup();
|
||||
setupLayer();
|
||||
Timber.i("raster-brightness-max");
|
||||
invoke(mapboxMap, (uiController, mapboxMap) -> {
|
||||
assertNotNull(layer);
|
||||
invoke(mapboxMap, new MapboxMapAction.OnInvokeActionListener() {
|
||||
@Override
|
||||
public void onInvokeAction(UiController uiController, MapboxMap mapboxMap) {
|
||||
assertNotNull(layer);
|
||||
|
||||
// Set
|
||||
layer.setProperties(
|
||||
rasterBrightnessMax(
|
||||
zoom(
|
||||
exponential(
|
||||
stop(2, rasterBrightnessMax(0.3f))
|
||||
).withBase(0.5f)
|
||||
// Set
|
||||
layer.setProperties(
|
||||
rasterBrightnessMax(
|
||||
zoom(
|
||||
exponential(
|
||||
stop(2, rasterBrightnessMax(0.3f))
|
||||
).withBase(0.5f)
|
||||
)
|
||||
)
|
||||
)
|
||||
);
|
||||
);
|
||||
|
||||
// Verify
|
||||
assertNotNull(layer.getRasterBrightnessMax());
|
||||
assertNotNull(layer.getRasterBrightnessMax().getFunction());
|
||||
assertEquals(CameraFunction.class, layer.getRasterBrightnessMax().getFunction().getClass());
|
||||
assertEquals(ExponentialStops.class, layer.getRasterBrightnessMax().getFunction().getStops().getClass());
|
||||
assertEquals(0.5f, ((ExponentialStops) layer.getRasterBrightnessMax().getFunction().getStops()).getBase(), 0.001);
|
||||
assertEquals(1, ((ExponentialStops) layer.getRasterBrightnessMax().getFunction().getStops()).size());
|
||||
// Verify
|
||||
assertNotNull(layer.getRasterBrightnessMax());
|
||||
assertNotNull(layer.getRasterBrightnessMax().getFunction());
|
||||
assertEquals(CameraFunction.class, layer.getRasterBrightnessMax().getFunction().getClass());
|
||||
assertEquals(ExponentialStops.class, layer.getRasterBrightnessMax().getFunction().getStops().getClass());
|
||||
assertEquals(0.5f, ((ExponentialStops) layer.getRasterBrightnessMax().getFunction().getStops()).getBase(), 0.001);
|
||||
assertEquals(1, ((ExponentialStops) layer.getRasterBrightnessMax().getFunction().getStops()).size());
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@@ -314,13 +359,16 @@ public class RasterLayerTest extends BaseActivityTest {
|
||||
validateTestSetup();
|
||||
setupLayer();
|
||||
Timber.i("raster-saturationTransitionOptions");
|
||||
invoke(mapboxMap, (uiController, mapboxMap) -> {
|
||||
assertNotNull(layer);
|
||||
invoke(mapboxMap, new MapboxMapAction.OnInvokeActionListener() {
|
||||
@Override
|
||||
public void onInvokeAction(UiController uiController, MapboxMap mapboxMap) {
|
||||
assertNotNull(layer);
|
||||
|
||||
// Set and Get
|
||||
TransitionOptions options = new TransitionOptions(300, 100);
|
||||
layer.setRasterSaturationTransition(options);
|
||||
assertEquals(layer.getRasterSaturationTransition(), options);
|
||||
// Set and Get
|
||||
TransitionOptions options = new TransitionOptions(300, 100);
|
||||
layer.setRasterSaturationTransition(options);
|
||||
assertEquals(layer.getRasterSaturationTransition(), options);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@@ -329,12 +377,15 @@ public class RasterLayerTest extends BaseActivityTest {
|
||||
validateTestSetup();
|
||||
setupLayer();
|
||||
Timber.i("raster-saturation");
|
||||
invoke(mapboxMap, (uiController, mapboxMap) -> {
|
||||
assertNotNull(layer);
|
||||
invoke(mapboxMap, new MapboxMapAction.OnInvokeActionListener() {
|
||||
@Override
|
||||
public void onInvokeAction(UiController uiController, MapboxMap mapboxMap) {
|
||||
assertNotNull(layer);
|
||||
|
||||
// Set and Get
|
||||
layer.setProperties(rasterSaturation(0.3f));
|
||||
assertEquals((Float) layer.getRasterSaturation().getValue(), (Float) 0.3f);
|
||||
// Set and Get
|
||||
layer.setProperties(rasterSaturation(0.3f));
|
||||
assertEquals((Float) layer.getRasterSaturation().getValue(), (Float) 0.3f);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@@ -343,27 +394,30 @@ public class RasterLayerTest extends BaseActivityTest {
|
||||
validateTestSetup();
|
||||
setupLayer();
|
||||
Timber.i("raster-saturation");
|
||||
invoke(mapboxMap, (uiController, mapboxMap) -> {
|
||||
assertNotNull(layer);
|
||||
invoke(mapboxMap, new MapboxMapAction.OnInvokeActionListener() {
|
||||
@Override
|
||||
public void onInvokeAction(UiController uiController, MapboxMap mapboxMap) {
|
||||
assertNotNull(layer);
|
||||
|
||||
// Set
|
||||
layer.setProperties(
|
||||
rasterSaturation(
|
||||
zoom(
|
||||
exponential(
|
||||
stop(2, rasterSaturation(0.3f))
|
||||
).withBase(0.5f)
|
||||
// Set
|
||||
layer.setProperties(
|
||||
rasterSaturation(
|
||||
zoom(
|
||||
exponential(
|
||||
stop(2, rasterSaturation(0.3f))
|
||||
).withBase(0.5f)
|
||||
)
|
||||
)
|
||||
)
|
||||
);
|
||||
);
|
||||
|
||||
// Verify
|
||||
assertNotNull(layer.getRasterSaturation());
|
||||
assertNotNull(layer.getRasterSaturation().getFunction());
|
||||
assertEquals(CameraFunction.class, layer.getRasterSaturation().getFunction().getClass());
|
||||
assertEquals(ExponentialStops.class, layer.getRasterSaturation().getFunction().getStops().getClass());
|
||||
assertEquals(0.5f, ((ExponentialStops) layer.getRasterSaturation().getFunction().getStops()).getBase(), 0.001);
|
||||
assertEquals(1, ((ExponentialStops) layer.getRasterSaturation().getFunction().getStops()).size());
|
||||
// Verify
|
||||
assertNotNull(layer.getRasterSaturation());
|
||||
assertNotNull(layer.getRasterSaturation().getFunction());
|
||||
assertEquals(CameraFunction.class, layer.getRasterSaturation().getFunction().getClass());
|
||||
assertEquals(ExponentialStops.class, layer.getRasterSaturation().getFunction().getStops().getClass());
|
||||
assertEquals(0.5f, ((ExponentialStops) layer.getRasterSaturation().getFunction().getStops()).getBase(), 0.001);
|
||||
assertEquals(1, ((ExponentialStops) layer.getRasterSaturation().getFunction().getStops()).size());
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@@ -372,13 +426,16 @@ public class RasterLayerTest extends BaseActivityTest {
|
||||
validateTestSetup();
|
||||
setupLayer();
|
||||
Timber.i("raster-contrastTransitionOptions");
|
||||
invoke(mapboxMap, (uiController, mapboxMap) -> {
|
||||
assertNotNull(layer);
|
||||
invoke(mapboxMap, new MapboxMapAction.OnInvokeActionListener() {
|
||||
@Override
|
||||
public void onInvokeAction(UiController uiController, MapboxMap mapboxMap) {
|
||||
assertNotNull(layer);
|
||||
|
||||
// Set and Get
|
||||
TransitionOptions options = new TransitionOptions(300, 100);
|
||||
layer.setRasterContrastTransition(options);
|
||||
assertEquals(layer.getRasterContrastTransition(), options);
|
||||
// Set and Get
|
||||
TransitionOptions options = new TransitionOptions(300, 100);
|
||||
layer.setRasterContrastTransition(options);
|
||||
assertEquals(layer.getRasterContrastTransition(), options);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@@ -387,12 +444,15 @@ public class RasterLayerTest extends BaseActivityTest {
|
||||
validateTestSetup();
|
||||
setupLayer();
|
||||
Timber.i("raster-contrast");
|
||||
invoke(mapboxMap, (uiController, mapboxMap) -> {
|
||||
assertNotNull(layer);
|
||||
invoke(mapboxMap, new MapboxMapAction.OnInvokeActionListener() {
|
||||
@Override
|
||||
public void onInvokeAction(UiController uiController, MapboxMap mapboxMap) {
|
||||
assertNotNull(layer);
|
||||
|
||||
// Set and Get
|
||||
layer.setProperties(rasterContrast(0.3f));
|
||||
assertEquals((Float) layer.getRasterContrast().getValue(), (Float) 0.3f);
|
||||
// Set and Get
|
||||
layer.setProperties(rasterContrast(0.3f));
|
||||
assertEquals((Float) layer.getRasterContrast().getValue(), (Float) 0.3f);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@@ -401,42 +461,30 @@ public class RasterLayerTest extends BaseActivityTest {
|
||||
validateTestSetup();
|
||||
setupLayer();
|
||||
Timber.i("raster-contrast");
|
||||
invoke(mapboxMap, (uiController, mapboxMap) -> {
|
||||
assertNotNull(layer);
|
||||
invoke(mapboxMap, new MapboxMapAction.OnInvokeActionListener() {
|
||||
@Override
|
||||
public void onInvokeAction(UiController uiController, MapboxMap mapboxMap) {
|
||||
assertNotNull(layer);
|
||||
|
||||
// Set
|
||||
layer.setProperties(
|
||||
rasterContrast(
|
||||
zoom(
|
||||
exponential(
|
||||
stop(2, rasterContrast(0.3f))
|
||||
).withBase(0.5f)
|
||||
// Set
|
||||
layer.setProperties(
|
||||
rasterContrast(
|
||||
zoom(
|
||||
exponential(
|
||||
stop(2, rasterContrast(0.3f))
|
||||
).withBase(0.5f)
|
||||
)
|
||||
)
|
||||
)
|
||||
);
|
||||
);
|
||||
|
||||
// Verify
|
||||
assertNotNull(layer.getRasterContrast());
|
||||
assertNotNull(layer.getRasterContrast().getFunction());
|
||||
assertEquals(CameraFunction.class, layer.getRasterContrast().getFunction().getClass());
|
||||
assertEquals(ExponentialStops.class, layer.getRasterContrast().getFunction().getStops().getClass());
|
||||
assertEquals(0.5f, ((ExponentialStops) layer.getRasterContrast().getFunction().getStops()).getBase(), 0.001);
|
||||
assertEquals(1, ((ExponentialStops) layer.getRasterContrast().getFunction().getStops()).size());
|
||||
});
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testRasterFadeDurationTransition() {
|
||||
validateTestSetup();
|
||||
setupLayer();
|
||||
Timber.i("raster-fade-durationTransitionOptions");
|
||||
invoke(mapboxMap, (uiController, mapboxMap) -> {
|
||||
assertNotNull(layer);
|
||||
|
||||
// Set and Get
|
||||
TransitionOptions options = new TransitionOptions(300, 100);
|
||||
layer.setRasterFadeDurationTransition(options);
|
||||
assertEquals(layer.getRasterFadeDurationTransition(), options);
|
||||
// Verify
|
||||
assertNotNull(layer.getRasterContrast());
|
||||
assertNotNull(layer.getRasterContrast().getFunction());
|
||||
assertEquals(CameraFunction.class, layer.getRasterContrast().getFunction().getClass());
|
||||
assertEquals(ExponentialStops.class, layer.getRasterContrast().getFunction().getStops().getClass());
|
||||
assertEquals(0.5f, ((ExponentialStops) layer.getRasterContrast().getFunction().getStops()).getBase(), 0.001);
|
||||
assertEquals(1, ((ExponentialStops) layer.getRasterContrast().getFunction().getStops()).size());
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@@ -445,12 +493,15 @@ public class RasterLayerTest extends BaseActivityTest {
|
||||
validateTestSetup();
|
||||
setupLayer();
|
||||
Timber.i("raster-fade-duration");
|
||||
invoke(mapboxMap, (uiController, mapboxMap) -> {
|
||||
assertNotNull(layer);
|
||||
invoke(mapboxMap, new MapboxMapAction.OnInvokeActionListener() {
|
||||
@Override
|
||||
public void onInvokeAction(UiController uiController, MapboxMap mapboxMap) {
|
||||
assertNotNull(layer);
|
||||
|
||||
// Set and Get
|
||||
layer.setProperties(rasterFadeDuration(0.3f));
|
||||
assertEquals((Float) layer.getRasterFadeDuration().getValue(), (Float) 0.3f);
|
||||
// Set and Get
|
||||
layer.setProperties(rasterFadeDuration(0.3f));
|
||||
assertEquals((Float) layer.getRasterFadeDuration().getValue(), (Float) 0.3f);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@@ -459,27 +510,30 @@ public class RasterLayerTest extends BaseActivityTest {
|
||||
validateTestSetup();
|
||||
setupLayer();
|
||||
Timber.i("raster-fade-duration");
|
||||
invoke(mapboxMap, (uiController, mapboxMap) -> {
|
||||
assertNotNull(layer);
|
||||
invoke(mapboxMap, new MapboxMapAction.OnInvokeActionListener() {
|
||||
@Override
|
||||
public void onInvokeAction(UiController uiController, MapboxMap mapboxMap) {
|
||||
assertNotNull(layer);
|
||||
|
||||
// Set
|
||||
layer.setProperties(
|
||||
rasterFadeDuration(
|
||||
zoom(
|
||||
exponential(
|
||||
stop(2, rasterFadeDuration(0.3f))
|
||||
).withBase(0.5f)
|
||||
// Set
|
||||
layer.setProperties(
|
||||
rasterFadeDuration(
|
||||
zoom(
|
||||
exponential(
|
||||
stop(2, rasterFadeDuration(0.3f))
|
||||
).withBase(0.5f)
|
||||
)
|
||||
)
|
||||
)
|
||||
);
|
||||
);
|
||||
|
||||
// Verify
|
||||
assertNotNull(layer.getRasterFadeDuration());
|
||||
assertNotNull(layer.getRasterFadeDuration().getFunction());
|
||||
assertEquals(CameraFunction.class, layer.getRasterFadeDuration().getFunction().getClass());
|
||||
assertEquals(ExponentialStops.class, layer.getRasterFadeDuration().getFunction().getStops().getClass());
|
||||
assertEquals(0.5f, ((ExponentialStops) layer.getRasterFadeDuration().getFunction().getStops()).getBase(), 0.001);
|
||||
assertEquals(1, ((ExponentialStops) layer.getRasterFadeDuration().getFunction().getStops()).size());
|
||||
// Verify
|
||||
assertNotNull(layer.getRasterFadeDuration());
|
||||
assertNotNull(layer.getRasterFadeDuration().getFunction());
|
||||
assertEquals(CameraFunction.class, layer.getRasterFadeDuration().getFunction().getClass());
|
||||
assertEquals(ExponentialStops.class, layer.getRasterFadeDuration().getFunction().getStops().getClass());
|
||||
assertEquals(0.5f, ((ExponentialStops) layer.getRasterFadeDuration().getFunction().getStops()).getBase(), 0.001);
|
||||
assertEquals(1, ((ExponentialStops) layer.getRasterFadeDuration().getFunction().getStops()).size());
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
Reference in New Issue
Block a user