diff options
author | John Firebaugh <john.firebaugh@gmail.com> | 2017-03-30 16:02:59 -0700 |
---|---|---|
committer | John Firebaugh <john.firebaugh@gmail.com> | 2017-03-31 13:26:27 -0700 |
commit | 743d95405363e0eea1b80e8c28bde245211f7868 (patch) | |
tree | 98cc6ab0a8980916ca704efd887a029a40d05d0e /platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/testapp/style/SymbolLayerTest.java | |
parent | c4f9582bfa9be832eb2eb349249918db8b867ec9 (diff) | |
download | qtlocation-mapboxgl-743d95405363e0eea1b80e8c28bde245211f7868.tar.gz |
[core] Add DDS support for text-rotate
Diffstat (limited to 'platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/testapp/style/SymbolLayerTest.java')
-rw-r--r-- | platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/testapp/style/SymbolLayerTest.java | 108 |
1 files changed, 108 insertions, 0 deletions
diff --git a/platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/testapp/style/SymbolLayerTest.java b/platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/testapp/style/SymbolLayerTest.java index 5472d32dc6..4c63509798 100644 --- a/platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/testapp/style/SymbolLayerTest.java +++ b/platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/testapp/style/SymbolLayerTest.java @@ -1294,6 +1294,114 @@ public class SymbolLayerTest extends BaseStyleTest { @Test + public void testTextRotateAsIdentitySourceFunction() { + checkViewIsDisplayed(R.id.mapView); + Timber.i("text-rotate"); + assertNotNull(layer); + + // Set + layer.setProperties( + textRotate(property("FeaturePropertyA", Stops.<Float>identity())) + ); + + // Verify + assertNotNull(layer.getTextRotate()); + assertNotNull(layer.getTextRotate().getFunction()); + assertEquals(SourceFunction.class, layer.getTextRotate().getFunction().getClass()); + assertEquals("FeaturePropertyA", ((SourceFunction) layer.getTextRotate().getFunction()).getProperty()); + assertEquals(IdentityStops.class, layer.getTextRotate().getFunction().getStops().getClass()); + } + + @Test + public void testTextRotateAsExponentialSourceFunction() { + checkViewIsDisplayed(R.id.mapView); + Timber.i("text-rotate"); + assertNotNull(layer); + + // Set + layer.setProperties( + textRotate( + property( + "FeaturePropertyA", + exponential( + stop(0.3f, textRotate(0.3f)) + ).withBase(0.5f) + ) + ) + ); + + // Verify + assertNotNull(layer.getTextRotate()); + assertNotNull(layer.getTextRotate().getFunction()); + assertEquals(SourceFunction.class, layer.getTextRotate().getFunction().getClass()); + assertEquals("FeaturePropertyA", ((SourceFunction) layer.getTextRotate().getFunction()).getProperty()); + assertEquals(ExponentialStops.class, layer.getTextRotate().getFunction().getStops().getClass()); + } + + @Test + public void testTextRotateAsCategoricalSourceFunction() { + checkViewIsDisplayed(R.id.mapView); + Timber.i("text-rotate"); + assertNotNull(layer); + + // Set + layer.setProperties( + textRotate( + property( + "FeaturePropertyA", + categorical( + stop(1.0f, textRotate(0.3f)) + ) + ).withDefaultValue(textRotate(0.3f)) + ) + ); + + // Verify + assertNotNull(layer.getTextRotate()); + assertNotNull(layer.getTextRotate().getFunction()); + assertEquals(SourceFunction.class, layer.getTextRotate().getFunction().getClass()); + assertEquals("FeaturePropertyA", ((SourceFunction) layer.getTextRotate().getFunction()).getProperty()); + assertEquals(CategoricalStops.class, layer.getTextRotate().getFunction().getStops().getClass()); + assertNotNull(((SourceFunction) layer.getTextRotate().getFunction()).getDefaultValue()); + assertNotNull(((SourceFunction) layer.getTextRotate().getFunction()).getDefaultValue().getValue()); + assertEquals(0.3f, ((SourceFunction) layer.getTextRotate().getFunction()).getDefaultValue().getValue()); + } + + @Test + public void testTextRotateAsCompositeFunction() { + checkViewIsDisplayed(R.id.mapView); + Timber.i("text-rotate"); + assertNotNull(layer); + + // Set + layer.setProperties( + textRotate( + composite( + "FeaturePropertyA", + exponential( + stop(0, 0.3f, textRotate(0.9f)) + ).withBase(0.5f) + ).withDefaultValue(textRotate(0.3f)) + ) + ); + + // Verify + assertNotNull(layer.getTextRotate()); + assertNotNull(layer.getTextRotate().getFunction()); + assertEquals(CompositeFunction.class, layer.getTextRotate().getFunction().getClass()); + assertEquals("FeaturePropertyA", ((CompositeFunction) layer.getTextRotate().getFunction()).getProperty()); + assertEquals(ExponentialStops.class, layer.getTextRotate().getFunction().getStops().getClass()); + assertEquals(1, ((ExponentialStops) layer.getTextRotate().getFunction().getStops()).size()); + + ExponentialStops<Stop.CompositeValue<Float, Float>, Float> stops = + (ExponentialStops<Stop.CompositeValue<Float, Float>, Float>) layer.getTextRotate().getFunction().getStops(); + Stop<Stop.CompositeValue<Float, Float>, Float> stop = stops.iterator().next(); + assertEquals(0f, stop.in.zoom, 0.001); + assertEquals(0.3f, stop.in.value, 0.001f); + assertEquals(0.9f, stop.out, 0.001f); + } + + @Test public void testTextPaddingAsConstant() { checkViewIsDisplayed(R.id.mapView); Timber.i("text-padding"); |