summaryrefslogtreecommitdiff
path: root/platform/android
diff options
context:
space:
mode:
authorŁukasz Paczos <lukas.paczos@gmail.com>2018-11-07 17:17:26 +0100
committerŁukasz Paczos <lukasz.paczos@mapbox.com>2018-11-20 12:22:16 +0100
commit9ac444a08d9701dc7b0da41859842a77d7be8e00 (patch)
tree08ab99d6caa7a24a9106382eedcc5812bf2c1811 /platform/android
parent1d73bda00d1e4c18ef32eac5053afa4cc9bc4b0a (diff)
downloadqtlocation-mapboxgl-9ac444a08d9701dc7b0da41859842a77d7be8e00.tar.gz
[android] removing plain text getter for "text-field"
Diffstat (limited to 'platform/android')
-rw-r--r--platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/style/layers/PropertyFactory.java4
-rw-r--r--platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/style/layers/SymbolLayer.java34
-rw-r--r--platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/style/layers/layer.java.ejs36
-rw-r--r--platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/style/layers/property_factory.java.ejs12
-rw-r--r--platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/style/types/Formatted.java11
-rw-r--r--platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/style/types/FormattedSection.java71
-rw-r--r--platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/testapp/style/BackgroundLayerTest.java21
-rw-r--r--platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/testapp/style/CircleLayerTest.java77
-rw-r--r--platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/testapp/style/ExpressionTest.java67
-rw-r--r--platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/testapp/style/FillExtrusionLayerTest.java49
-rw-r--r--platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/testapp/style/FillLayerTest.java49
-rw-r--r--platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/testapp/style/HeatmapLayerTest.java28
-rw-r--r--platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/testapp/style/HillshadeLayerTest.java42
-rw-r--r--platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/testapp/style/LineLayerTest.java98
-rw-r--r--platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/testapp/style/RasterLayerTest.java56
-rw-r--r--platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/testapp/style/SymbolLayerTest.java400
-rw-r--r--platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/testapp/style/layer.junit.ejs65
-rwxr-xr-xplatform/android/scripts/generate-style-code.js5
-rw-r--r--platform/android/src/style/formatted.cpp27
19 files changed, 571 insertions, 581 deletions
diff --git a/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/style/layers/PropertyFactory.java b/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/style/layers/PropertyFactory.java
index bf5fd35fa5..ace5be3a82 100644
--- a/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/style/layers/PropertyFactory.java
+++ b/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/style/layers/PropertyFactory.java
@@ -2117,8 +2117,8 @@ public class PropertyFactory {
/**
* Value to use for a text label. If a plain `string` is provided, it will be treated as a `formatted` with default/inherited formatting options.
*
- * @param value a String value
- * @return property wrapper around String
+ * @param value a Formatted value
+ * @return property wrapper around Formatted
*/
public static PropertyValue<Expression> textField(Expression value) {
return new LayoutPropertyValue<>("text-field", value);
diff --git a/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/style/layers/SymbolLayer.java b/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/style/layers/SymbolLayer.java
index 25c0a2bb32..ab45cb04f2 100644
--- a/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/style/layers/SymbolLayer.java
+++ b/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/style/layers/SymbolLayer.java
@@ -388,41 +388,11 @@ public class SymbolLayer extends Layer {
/**
* Get the TextField property
*
- * @return property wrapper value around String
- */
- @NonNull
- @SuppressWarnings("unchecked")
- public PropertyValue<String> getTextField() {
- checkThread();
-
- PropertyValue propertyValue = new PropertyValue<>("text-field", nativeGetTextField());
- if (propertyValue.isExpression()) {
- return (PropertyValue<String>) propertyValue;
- } else {
- String text = null;
-
- Formatted formatted = (Formatted) nativeGetTextField();
- if (formatted != null) {
- StringBuilder builder = new StringBuilder();
- for (FormattedSection section : formatted.getFormattedSections()) {
- builder.append(section.getText());
- }
- text = builder.toString();
- }
-
- return (PropertyValue<String>) new PropertyValue("text-field", text);
- }
- }
-
- /**
- * Get the TextField property as {@link Formatted} object
- *
- * @return property wrapper value around String
- * @see Expression#format(Expression.FormatEntry...)
+ * @return property wrapper value around Formatted
*/
@NonNull
@SuppressWarnings("unchecked")
- public PropertyValue<Formatted> getFormattedTextField() {
+ public PropertyValue<Formatted> getTextField() {
checkThread();
return (PropertyValue<Formatted>) new PropertyValue("text-field", nativeGetTextField());
}
diff --git a/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/style/layers/layer.java.ejs b/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/style/layers/layer.java.ejs
index 60bbe941a6..e62c82e3b6 100644
--- a/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/style/layers/layer.java.ejs
+++ b/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/style/layers/layer.java.ejs
@@ -182,44 +182,8 @@ public class <%- camelize(type) %>Layer extends Layer {
@SuppressWarnings("unchecked")
public PropertyValue<<%- propertyType(property) %>> get<%- camelize(property.name) %>() {
checkThread();
-<% if (property.name === 'text-field' && property.type === 'formatted') { -%>
-
- PropertyValue propertyValue = new PropertyValue<>("text-field", nativeGetTextField());
- if (propertyValue.isExpression()) {
- return (PropertyValue<String>) propertyValue;
- } else {
- String text = null;
-
- Formatted formatted = (Formatted) nativeGetTextField();
- if (formatted != null) {
- StringBuilder builder = new StringBuilder();
- for (FormattedSection section : formatted.getFormattedSections()) {
- builder.append(section.getText());
- }
- text = builder.toString();
- }
-
- return (PropertyValue<String>) new PropertyValue("text-field", text);
- }
-<% } else { -%>
return (PropertyValue<<%- propertyType(property) %>>) new PropertyValue("<%- property.name %>", nativeGet<%- camelize(property.name) %>());
-<% } -%>
}
-<% if (property.name === 'text-field' && property.type === 'formatted') { -%>
-
- /**
- * Get the <%- camelize(property.name) %> property as {@link Formatted} object
- *
- * @return property wrapper value around <%- propertyType(property) %>
- * @see Expression#format(Expression.FormatEntry...)
- */
- @NonNull
- @SuppressWarnings("unchecked")
- public PropertyValue<Formatted> getFormatted<%- camelize(property.name) %>() {
- checkThread();
- return (PropertyValue<Formatted>) new PropertyValue("<%- property.name %>", nativeGet<%- camelize(property.name) %>());
- }
-<% } -%>
<% if (property.type == 'color') { -%>
/**
diff --git a/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/style/layers/property_factory.java.ejs b/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/style/layers/property_factory.java.ejs
index 697021b2d5..7474e7ebb8 100644
--- a/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/style/layers/property_factory.java.ejs
+++ b/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/style/layers/property_factory.java.ejs
@@ -63,6 +63,17 @@ public class PropertyFactory {
<% } -%>
<% for (const property of layoutProperties) { -%>
+<% if (property.type === 'formatted') { -%>
+ /**
+ * <%- propertyFactoryMethodDoc(property) %>
+ *
+ * @param value a String value
+ * @return property wrapper around String
+ */
+ public static PropertyValue<String> <%- camelizeWithLeadingLowercase(property.name) %>(String value) {
+ return new LayoutPropertyValue<>("<%- property.name %>", value);
+ }
+<% } else {-%>
/**
* <%- propertyFactoryMethodDoc(property) %>
*
@@ -72,6 +83,7 @@ public class PropertyFactory {
public static PropertyValue<<%- propertyType(property) %>> <%- camelizeWithLeadingLowercase(property.name) %>(<%- propertyTypeAnnotation(property) %><%- iff(() => propertyTypeAnnotation(property), " ") %><%- propertyType(property) %> value) {
return new LayoutPropertyValue<>("<%- property.name %>", value);
}
+<% } -%>
/**
* <%- propertyFactoryMethodDoc(property) %>
diff --git a/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/style/types/Formatted.java b/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/style/types/Formatted.java
index 662ab2df7f..9be08dcebd 100644
--- a/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/style/types/Formatted.java
+++ b/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/style/types/Formatted.java
@@ -2,7 +2,6 @@ package com.mapbox.mapboxsdk.style.types;
import android.support.annotation.Keep;
import android.support.annotation.Nullable;
-import android.support.annotation.VisibleForTesting;
import java.util.Arrays;
@@ -18,9 +17,17 @@ public class Formatted {
/**
* Create a new formatted text.
*
+ * @param formattedSection section with formatting options
+ */
+ public Formatted(FormattedSection formattedSection) {
+ this(new FormattedSection[] {formattedSection});
+ }
+
+ /**
+ * Create a new formatted text.
+ *
* @param formattedSections sections with formatting options
*/
- @VisibleForTesting(otherwise = VisibleForTesting.PROTECTED)
public Formatted(FormattedSection[] formattedSections) {
this.formattedSections = formattedSections;
}
diff --git a/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/style/types/FormattedSection.java b/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/style/types/FormattedSection.java
index 3a9802ebcd..7d0caec992 100644
--- a/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/style/types/FormattedSection.java
+++ b/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/style/types/FormattedSection.java
@@ -3,7 +3,6 @@ package com.mapbox.mapboxsdk.style.types;
import android.support.annotation.Keep;
import android.support.annotation.NonNull;
import android.support.annotation.Nullable;
-import android.support.annotation.VisibleForTesting;
import java.util.Arrays;
@@ -12,20 +11,19 @@ import java.util.Arrays;
*/
@Keep
public class FormattedSection {
- private String text;
- private double fontScale;
- @Nullable
- private String[] fontStack;
+ private final String text;
+ private final Number fontScale;
+ private final String[] fontStack;
/**
* Creates a formatted section.
*
* @param text displayed string
- * @param fontScale scale of the font, 1.0 is default
- * @param fontStack main and fallback fonts that are a part of the style
+ * @param fontScale scale of the font, setting to null will fall back to style's default settings
+ * @param fontStack main and fallback fonts that are a part of the style,
+ * setting null will fall back to style's default settings
*/
- @VisibleForTesting(otherwise = VisibleForTesting.PROTECTED)
- public FormattedSection(@NonNull String text, double fontScale, @Nullable String[] fontStack) {
+ public FormattedSection(@NonNull String text, @Nullable Number fontScale, @Nullable String[] fontStack) {
this.text = text;
this.fontScale = fontScale;
this.fontStack = fontStack;
@@ -35,12 +33,30 @@ public class FormattedSection {
* Creates a formatted section.
*
* @param text displayed string
- * @param fontScale scale of the font, 1.0 is default
+ * @param fontScale scale of the font, setting to null will fall back to style's default settings
*/
- @VisibleForTesting(otherwise = VisibleForTesting.PROTECTED)
- public FormattedSection(@NonNull String text, double fontScale) {
- this.text = text;
- this.fontScale = fontScale;
+ public FormattedSection(@NonNull String text, @Nullable Number fontScale) {
+ this(text, fontScale, null);
+ }
+
+ /**
+ * Creates a formatted section.
+ *
+ * @param text displayed string
+ */
+ public FormattedSection(@NonNull String text) {
+ this(text, null, null);
+ }
+
+ /**
+ * Creates a formatted section.
+ *
+ * @param text displayed string
+ * @param fontStack main and fallback fonts that are a part of the style,
+ * setting null will fall back to style's default settings
+ */
+ public FormattedSection(@NonNull String text, @Nullable String[] fontStack) {
+ this(text, null, fontStack);
}
/**
@@ -56,9 +72,10 @@ public class FormattedSection {
/**
* Returns displayed text's font scale.
*
- * @return font scale, defaults to 1.0
+ * @return font scale
*/
- public double getFontScale() {
+ @Nullable
+ public Number getFontScale() {
return fontScale;
}
@@ -73,7 +90,7 @@ public class FormattedSection {
}
@Override
- public boolean equals(@Nullable Object o) {
+ public boolean equals(Object o) {
if (this == o) {
return true;
}
@@ -81,20 +98,22 @@ public class FormattedSection {
return false;
}
- FormattedSection section = (FormattedSection) o;
+ FormattedSection that = (FormattedSection) o;
- return Double.compare(section.fontScale, fontScale) == 0
- && (text != null ? text.equals(section.text) : section.text == null)
- && Arrays.equals(fontStack, section.fontStack);
+ if (text != null ? !text.equals(that.text) : that.text != null) {
+ return false;
+ }
+ if (fontScale != null ? !fontScale.equals(that.fontScale) : that.fontScale != null) {
+ return false;
+ }
+ // Probably incorrect - comparing Object[] arrays with Arrays.equals
+ return Arrays.equals(fontStack, that.fontStack);
}
@Override
public int hashCode() {
- int result;
- long temp;
- result = text != null ? text.hashCode() : 0;
- temp = Double.doubleToLongBits(fontScale);
- result = 31 * result + (int) (temp ^ (temp >>> 32));
+ int result = text != null ? text.hashCode() : 0;
+ result = 31 * result + (fontScale != null ? fontScale.hashCode() : 0);
result = 31 * result + Arrays.hashCode(fontStack);
return result;
}
diff --git a/platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/testapp/style/BackgroundLayerTest.java b/platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/testapp/style/BackgroundLayerTest.java
index 8fd193e62f..3dd08e1602 100644
--- a/platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/testapp/style/BackgroundLayerTest.java
+++ b/platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/testapp/style/BackgroundLayerTest.java
@@ -82,11 +82,12 @@ public class BackgroundLayerTest extends BaseActivityTest {
Timber.i("background-color");
invoke(mapboxMap, (uiController, mapboxMap) -> {
assertNotNull(layer);
- assertNull((String) layer.getBackgroundColor().getValue());
+ assertNull(layer.getBackgroundColor().getValue());
// Set and Get
- layer.setProperties(backgroundColor("rgba(0, 0, 0, 1)"));
- assertEquals((String) layer.getBackgroundColor().getValue(), (String) "rgba(0, 0, 0, 1)");
+ String propertyValue = "rgba(0, 0, 0, 1)";
+ layer.setProperties(backgroundColor(propertyValue));
+ assertEquals(layer.getBackgroundColor().getValue(), propertyValue);
});
}
@@ -126,11 +127,12 @@ public class BackgroundLayerTest extends BaseActivityTest {
Timber.i("background-pattern");
invoke(mapboxMap, (uiController, mapboxMap) -> {
assertNotNull(layer);
- assertNull((String) layer.getBackgroundPattern().getValue());
+ assertNull(layer.getBackgroundPattern().getValue());
// Set and Get
- layer.setProperties(backgroundPattern("pedestrian-polygon"));
- assertEquals((String) layer.getBackgroundPattern().getValue(), (String) "pedestrian-polygon");
+ String propertyValue = "pedestrian-polygon";
+ layer.setProperties(backgroundPattern(propertyValue));
+ assertEquals(layer.getBackgroundPattern().getValue(), propertyValue);
});
}
@@ -156,11 +158,12 @@ public class BackgroundLayerTest extends BaseActivityTest {
Timber.i("background-opacity");
invoke(mapboxMap, (uiController, mapboxMap) -> {
assertNotNull(layer);
- assertNull((Float) layer.getBackgroundOpacity().getValue());
+ assertNull(layer.getBackgroundOpacity().getValue());
// Set and Get
- layer.setProperties(backgroundOpacity(0.3f));
- assertEquals((Float) layer.getBackgroundOpacity().getValue(), (Float) 0.3f);
+ Float propertyValue = 0.3f;
+ layer.setProperties(backgroundOpacity(propertyValue));
+ assertEquals(layer.getBackgroundOpacity().getValue(), propertyValue);
});
}
}
diff --git a/platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/testapp/style/CircleLayerTest.java b/platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/testapp/style/CircleLayerTest.java
index 2b1af88e32..00e4245587 100644
--- a/platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/testapp/style/CircleLayerTest.java
+++ b/platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/testapp/style/CircleLayerTest.java
@@ -144,11 +144,12 @@ public class CircleLayerTest extends BaseActivityTest {
Timber.i("circle-radius");
invoke(mapboxMap, (uiController, mapboxMap) -> {
assertNotNull(layer);
- assertNull((Float) layer.getCircleRadius().getValue());
+ assertNull(layer.getCircleRadius().getValue());
// Set and Get
- layer.setProperties(circleRadius(0.3f));
- assertEquals((Float) layer.getCircleRadius().getValue(), (Float) 0.3f);
+ Float propertyValue = 0.3f;
+ layer.setProperties(circleRadius(propertyValue));
+ assertEquals(layer.getCircleRadius().getValue(), propertyValue);
});
}
@@ -190,11 +191,12 @@ public class CircleLayerTest extends BaseActivityTest {
Timber.i("circle-color");
invoke(mapboxMap, (uiController, mapboxMap) -> {
assertNotNull(layer);
- assertNull((String) layer.getCircleColor().getValue());
+ assertNull(layer.getCircleColor().getValue());
// Set and Get
- layer.setProperties(circleColor("rgba(0, 0, 0, 1)"));
- assertEquals((String) layer.getCircleColor().getValue(), (String) "rgba(0, 0, 0, 1)");
+ String propertyValue = "rgba(0, 0, 0, 1)";
+ layer.setProperties(circleColor(propertyValue));
+ assertEquals(layer.getCircleColor().getValue(), propertyValue);
});
}
@@ -250,11 +252,12 @@ public class CircleLayerTest extends BaseActivityTest {
Timber.i("circle-blur");
invoke(mapboxMap, (uiController, mapboxMap) -> {
assertNotNull(layer);
- assertNull((Float) layer.getCircleBlur().getValue());
+ assertNull(layer.getCircleBlur().getValue());
// Set and Get
- layer.setProperties(circleBlur(0.3f));
- assertEquals((Float) layer.getCircleBlur().getValue(), (Float) 0.3f);
+ Float propertyValue = 0.3f;
+ layer.setProperties(circleBlur(propertyValue));
+ assertEquals(layer.getCircleBlur().getValue(), propertyValue);
});
}
@@ -296,11 +299,12 @@ public class CircleLayerTest extends BaseActivityTest {
Timber.i("circle-opacity");
invoke(mapboxMap, (uiController, mapboxMap) -> {
assertNotNull(layer);
- assertNull((Float) layer.getCircleOpacity().getValue());
+ assertNull(layer.getCircleOpacity().getValue());
// Set and Get
- layer.setProperties(circleOpacity(0.3f));
- assertEquals((Float) layer.getCircleOpacity().getValue(), (Float) 0.3f);
+ Float propertyValue = 0.3f;
+ layer.setProperties(circleOpacity(propertyValue));
+ assertEquals(layer.getCircleOpacity().getValue(), propertyValue);
});
}
@@ -342,11 +346,12 @@ public class CircleLayerTest extends BaseActivityTest {
Timber.i("circle-translate");
invoke(mapboxMap, (uiController, mapboxMap) -> {
assertNotNull(layer);
- assertNull((Float[]) layer.getCircleTranslate().getValue());
+ assertNull(layer.getCircleTranslate().getValue());
// Set and Get
- layer.setProperties(circleTranslate(new Float[] {0f, 0f}));
- assertEquals((Float[]) layer.getCircleTranslate().getValue(), (Float[]) new Float[] {0f, 0f});
+ Float[] propertyValue = new Float[] {0f, 0f};
+ layer.setProperties(circleTranslate(propertyValue));
+ assertEquals(layer.getCircleTranslate().getValue(), propertyValue);
});
}
@@ -357,11 +362,12 @@ public class CircleLayerTest extends BaseActivityTest {
Timber.i("circle-translate-anchor");
invoke(mapboxMap, (uiController, mapboxMap) -> {
assertNotNull(layer);
- assertNull((String) layer.getCircleTranslateAnchor().getValue());
+ assertNull(layer.getCircleTranslateAnchor().getValue());
// Set and Get
- layer.setProperties(circleTranslateAnchor(CIRCLE_TRANSLATE_ANCHOR_MAP));
- assertEquals((String) layer.getCircleTranslateAnchor().getValue(), (String) CIRCLE_TRANSLATE_ANCHOR_MAP);
+ String propertyValue = CIRCLE_TRANSLATE_ANCHOR_MAP;
+ layer.setProperties(circleTranslateAnchor(propertyValue));
+ assertEquals(layer.getCircleTranslateAnchor().getValue(), propertyValue);
});
}
@@ -372,11 +378,12 @@ public class CircleLayerTest extends BaseActivityTest {
Timber.i("circle-pitch-scale");
invoke(mapboxMap, (uiController, mapboxMap) -> {
assertNotNull(layer);
- assertNull((String) layer.getCirclePitchScale().getValue());
+ assertNull(layer.getCirclePitchScale().getValue());
// Set and Get
- layer.setProperties(circlePitchScale(CIRCLE_PITCH_SCALE_MAP));
- assertEquals((String) layer.getCirclePitchScale().getValue(), (String) CIRCLE_PITCH_SCALE_MAP);
+ String propertyValue = CIRCLE_PITCH_SCALE_MAP;
+ layer.setProperties(circlePitchScale(propertyValue));
+ assertEquals(layer.getCirclePitchScale().getValue(), propertyValue);
});
}
@@ -387,11 +394,12 @@ public class CircleLayerTest extends BaseActivityTest {
Timber.i("circle-pitch-alignment");
invoke(mapboxMap, (uiController, mapboxMap) -> {
assertNotNull(layer);
- assertNull((String) layer.getCirclePitchAlignment().getValue());
+ assertNull(layer.getCirclePitchAlignment().getValue());
// Set and Get
- layer.setProperties(circlePitchAlignment(CIRCLE_PITCH_ALIGNMENT_MAP));
- assertEquals((String) layer.getCirclePitchAlignment().getValue(), (String) CIRCLE_PITCH_ALIGNMENT_MAP);
+ String propertyValue = CIRCLE_PITCH_ALIGNMENT_MAP;
+ layer.setProperties(circlePitchAlignment(propertyValue));
+ assertEquals(layer.getCirclePitchAlignment().getValue(), propertyValue);
});
}
@@ -417,11 +425,12 @@ public class CircleLayerTest extends BaseActivityTest {
Timber.i("circle-stroke-width");
invoke(mapboxMap, (uiController, mapboxMap) -> {
assertNotNull(layer);
- assertNull((Float) layer.getCircleStrokeWidth().getValue());
+ assertNull(layer.getCircleStrokeWidth().getValue());
// Set and Get
- layer.setProperties(circleStrokeWidth(0.3f));
- assertEquals((Float) layer.getCircleStrokeWidth().getValue(), (Float) 0.3f);
+ Float propertyValue = 0.3f;
+ layer.setProperties(circleStrokeWidth(propertyValue));
+ assertEquals(layer.getCircleStrokeWidth().getValue(), propertyValue);
});
}
@@ -463,11 +472,12 @@ public class CircleLayerTest extends BaseActivityTest {
Timber.i("circle-stroke-color");
invoke(mapboxMap, (uiController, mapboxMap) -> {
assertNotNull(layer);
- assertNull((String) layer.getCircleStrokeColor().getValue());
+ assertNull(layer.getCircleStrokeColor().getValue());
// Set and Get
- layer.setProperties(circleStrokeColor("rgba(0, 0, 0, 1)"));
- assertEquals((String) layer.getCircleStrokeColor().getValue(), (String) "rgba(0, 0, 0, 1)");
+ String propertyValue = "rgba(0, 0, 0, 1)";
+ layer.setProperties(circleStrokeColor(propertyValue));
+ assertEquals(layer.getCircleStrokeColor().getValue(), propertyValue);
});
}
@@ -523,11 +533,12 @@ public class CircleLayerTest extends BaseActivityTest {
Timber.i("circle-stroke-opacity");
invoke(mapboxMap, (uiController, mapboxMap) -> {
assertNotNull(layer);
- assertNull((Float) layer.getCircleStrokeOpacity().getValue());
+ assertNull(layer.getCircleStrokeOpacity().getValue());
// Set and Get
- layer.setProperties(circleStrokeOpacity(0.3f));
- assertEquals((Float) layer.getCircleStrokeOpacity().getValue(), (Float) 0.3f);
+ Float propertyValue = 0.3f;
+ layer.setProperties(circleStrokeOpacity(propertyValue));
+ assertEquals(layer.getCircleStrokeOpacity().getValue(), propertyValue);
});
}
diff --git a/platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/testapp/style/ExpressionTest.java b/platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/testapp/style/ExpressionTest.java
index 0574f3e8e4..093fbf2662 100644
--- a/platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/testapp/style/ExpressionTest.java
+++ b/platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/testapp/style/ExpressionTest.java
@@ -278,7 +278,7 @@ public class ExpressionTest extends BaseActivityTest {
}
@Test
- public void testConstFormatExpressionNoParams() {
+ public void testConstFormatExpression() {
validateTestSetup();
invoke(mapboxMap, (uiController, mapboxMap) -> {
LatLng latLng = new LatLng(51, 17);
@@ -295,13 +295,7 @@ public class ExpressionTest extends BaseActivityTest {
.isEmpty());
assertNull(layer.getTextField().getExpression());
- assertEquals("test", layer.getTextField().getValue());
-
- Formatted expected = new Formatted(new FormattedSection[] {
- new FormattedSection("test", 1.0f)
- });
- assertNull(layer.getFormattedTextField().getExpression());
- assertEquals(expected, layer.getFormattedTextField().getValue());
+ assertEquals(new Formatted(new FormattedSection("test")), layer.getTextField().getValue());
});
}
@@ -323,13 +317,7 @@ public class ExpressionTest extends BaseActivityTest {
.isEmpty());
assertNull(layer.getTextField().getExpression());
- assertEquals("test", layer.getTextField().getValue());
-
- Formatted expected = new Formatted(new FormattedSection[] {
- new FormattedSection("test", 1.75f)
- });
- assertNull(layer.getFormattedTextField().getExpression());
- assertEquals(expected, layer.getFormattedTextField().getValue());
+ assertEquals(new Formatted(new FormattedSection("test", 1.75)), layer.getTextField().getValue());
});
}
@@ -345,7 +333,6 @@ public class ExpressionTest extends BaseActivityTest {
Expression expression = format(
formatEntry(
literal("test"),
- formatFontScale(1.0),
formatTextFont(new String[] {"DIN Offc Pro Regular", "Arial Unicode MS Regular"})
)
);
@@ -356,14 +343,10 @@ public class ExpressionTest extends BaseActivityTest {
);
assertNull(layer.getTextField().getExpression());
- assertEquals("test", layer.getTextField().getValue());
-
- Formatted expected = new Formatted(new FormattedSection[] {
- new FormattedSection("test", 1.0f,
+ assertEquals(new Formatted(
+ new FormattedSection("test",
new String[] {"DIN Offc Pro Regular", "Arial Unicode MS Regular"})
- });
- assertNull(layer.getFormattedTextField().getExpression());
- assertEquals(expected, layer.getFormattedTextField().getValue());
+ ), layer.getTextField().getValue());
});
}
@@ -390,12 +373,11 @@ public class ExpressionTest extends BaseActivityTest {
);
assertNull(layer.getTextField().getExpression());
- assertEquals("test", layer.getTextField().getValue());
-
- Formatted expected = new Formatted(new FormattedSection[] {
- new FormattedSection("test", 0.5f, new String[] {"DIN Offc Pro Regular", "Arial Unicode MS Regular"})});
- assertNull(layer.getFormattedTextField().getExpression());
- assertEquals(expected, layer.getFormattedTextField().getValue());
+ assertEquals(new Formatted(
+ new FormattedSection("test",
+ 0.5,
+ new String[] {"DIN Offc Pro Regular", "Arial Unicode MS Regular"})
+ ), layer.getTextField().getValue());
});
}
@@ -423,14 +405,12 @@ public class ExpressionTest extends BaseActivityTest {
);
assertNull(layer.getTextField().getExpression());
- assertEquals("test\ntest2", layer.getTextField().getValue());
-
- Formatted expected = new Formatted(new FormattedSection[] {
- new FormattedSection("test", 1.5f, new String[] {"DIN Offc Pro Regular", "Arial Unicode MS Regular"}),
- new FormattedSection("\ntest2", 2f),
- });
- assertNull(layer.getFormattedTextField().getExpression());
- assertEquals(expected, layer.getFormattedTextField().getValue());
+ assertEquals(new Formatted(
+ new FormattedSection[] {
+ new FormattedSection("test", 1.5, new String[] {"DIN Offc Pro Regular", "Arial Unicode MS Regular"}),
+ new FormattedSection("\ntest2", 2.0),
+ }
+ ), layer.getTextField().getValue());
});
}
@@ -460,9 +440,6 @@ public class ExpressionTest extends BaseActivityTest {
assertEquals(expression, layer.getTextField().getExpression());
assertNull(layer.getTextField().getValue());
-
- assertEquals(expression, layer.getFormattedTextField().getExpression());
- assertNull(layer.getFormattedTextField().getValue());
});
}
@@ -493,9 +470,6 @@ public class ExpressionTest extends BaseActivityTest {
assertEquals(expression, layer.getTextField().getExpression());
assertNull(layer.getTextField().getValue());
-
- assertEquals(expression, layer.getFormattedTextField().getExpression());
- assertNull(layer.getFormattedTextField().getValue());
});
}
@@ -514,11 +488,8 @@ public class ExpressionTest extends BaseActivityTest {
.isEmpty());
assertNull(layer.getTextField().getExpression());
- assertEquals("test", layer.getTextField().getValue());
-
- assertNull(layer.getFormattedTextField().getExpression());
- Formatted expected = new Formatted(new FormattedSection[] {new FormattedSection("test", 1.0f)});
- assertEquals(expected, layer.getFormattedTextField().getValue());
+ assertEquals(new Formatted(
+ new FormattedSection("test")), layer.getTextField().getValue());
});
}
diff --git a/platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/testapp/style/FillExtrusionLayerTest.java b/platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/testapp/style/FillExtrusionLayerTest.java
index 4471cc4e66..7ff8039e1a 100644
--- a/platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/testapp/style/FillExtrusionLayerTest.java
+++ b/platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/testapp/style/FillExtrusionLayerTest.java
@@ -144,11 +144,12 @@ public class FillExtrusionLayerTest extends BaseActivityTest {
Timber.i("fill-extrusion-opacity");
invoke(mapboxMap, (uiController, mapboxMap) -> {
assertNotNull(layer);
- assertNull((Float) layer.getFillExtrusionOpacity().getValue());
+ assertNull(layer.getFillExtrusionOpacity().getValue());
// Set and Get
- layer.setProperties(fillExtrusionOpacity(0.3f));
- assertEquals((Float) layer.getFillExtrusionOpacity().getValue(), (Float) 0.3f);
+ Float propertyValue = 0.3f;
+ layer.setProperties(fillExtrusionOpacity(propertyValue));
+ assertEquals(layer.getFillExtrusionOpacity().getValue(), propertyValue);
});
}
@@ -174,11 +175,12 @@ public class FillExtrusionLayerTest extends BaseActivityTest {
Timber.i("fill-extrusion-color");
invoke(mapboxMap, (uiController, mapboxMap) -> {
assertNotNull(layer);
- assertNull((String) layer.getFillExtrusionColor().getValue());
+ assertNull(layer.getFillExtrusionColor().getValue());
// Set and Get
- layer.setProperties(fillExtrusionColor("rgba(0, 0, 0, 1)"));
- assertEquals((String) layer.getFillExtrusionColor().getValue(), (String) "rgba(0, 0, 0, 1)");
+ String propertyValue = "rgba(0, 0, 0, 1)";
+ layer.setProperties(fillExtrusionColor(propertyValue));
+ assertEquals(layer.getFillExtrusionColor().getValue(), propertyValue);
});
}
@@ -234,11 +236,12 @@ public class FillExtrusionLayerTest extends BaseActivityTest {
Timber.i("fill-extrusion-translate");
invoke(mapboxMap, (uiController, mapboxMap) -> {
assertNotNull(layer);
- assertNull((Float[]) layer.getFillExtrusionTranslate().getValue());
+ assertNull(layer.getFillExtrusionTranslate().getValue());
// Set and Get
- layer.setProperties(fillExtrusionTranslate(new Float[] {0f, 0f}));
- assertEquals((Float[]) layer.getFillExtrusionTranslate().getValue(), (Float[]) new Float[] {0f, 0f});
+ Float[] propertyValue = new Float[] {0f, 0f};
+ layer.setProperties(fillExtrusionTranslate(propertyValue));
+ assertEquals(layer.getFillExtrusionTranslate().getValue(), propertyValue);
});
}
@@ -249,11 +252,12 @@ public class FillExtrusionLayerTest extends BaseActivityTest {
Timber.i("fill-extrusion-translate-anchor");
invoke(mapboxMap, (uiController, mapboxMap) -> {
assertNotNull(layer);
- assertNull((String) layer.getFillExtrusionTranslateAnchor().getValue());
+ assertNull(layer.getFillExtrusionTranslateAnchor().getValue());
// Set and Get
- layer.setProperties(fillExtrusionTranslateAnchor(FILL_EXTRUSION_TRANSLATE_ANCHOR_MAP));
- assertEquals((String) layer.getFillExtrusionTranslateAnchor().getValue(), (String) FILL_EXTRUSION_TRANSLATE_ANCHOR_MAP);
+ String propertyValue = FILL_EXTRUSION_TRANSLATE_ANCHOR_MAP;
+ layer.setProperties(fillExtrusionTranslateAnchor(propertyValue));
+ assertEquals(layer.getFillExtrusionTranslateAnchor().getValue(), propertyValue);
});
}
@@ -279,11 +283,12 @@ public class FillExtrusionLayerTest extends BaseActivityTest {
Timber.i("fill-extrusion-pattern");
invoke(mapboxMap, (uiController, mapboxMap) -> {
assertNotNull(layer);
- assertNull((String) layer.getFillExtrusionPattern().getValue());
+ assertNull(layer.getFillExtrusionPattern().getValue());
// Set and Get
- layer.setProperties(fillExtrusionPattern("pedestrian-polygon"));
- assertEquals((String) layer.getFillExtrusionPattern().getValue(), (String) "pedestrian-polygon");
+ String propertyValue = "pedestrian-polygon";
+ layer.setProperties(fillExtrusionPattern(propertyValue));
+ assertEquals(layer.getFillExtrusionPattern().getValue(), propertyValue);
});
}
@@ -325,11 +330,12 @@ public class FillExtrusionLayerTest extends BaseActivityTest {
Timber.i("fill-extrusion-height");
invoke(mapboxMap, (uiController, mapboxMap) -> {
assertNotNull(layer);
- assertNull((Float) layer.getFillExtrusionHeight().getValue());
+ assertNull(layer.getFillExtrusionHeight().getValue());
// Set and Get
- layer.setProperties(fillExtrusionHeight(0.3f));
- assertEquals((Float) layer.getFillExtrusionHeight().getValue(), (Float) 0.3f);
+ Float propertyValue = 0.3f;
+ layer.setProperties(fillExtrusionHeight(propertyValue));
+ assertEquals(layer.getFillExtrusionHeight().getValue(), propertyValue);
});
}
@@ -371,11 +377,12 @@ public class FillExtrusionLayerTest extends BaseActivityTest {
Timber.i("fill-extrusion-base");
invoke(mapboxMap, (uiController, mapboxMap) -> {
assertNotNull(layer);
- assertNull((Float) layer.getFillExtrusionBase().getValue());
+ assertNull(layer.getFillExtrusionBase().getValue());
// Set and Get
- layer.setProperties(fillExtrusionBase(0.3f));
- assertEquals((Float) layer.getFillExtrusionBase().getValue(), (Float) 0.3f);
+ Float propertyValue = 0.3f;
+ layer.setProperties(fillExtrusionBase(propertyValue));
+ assertEquals(layer.getFillExtrusionBase().getValue(), propertyValue);
});
}
diff --git a/platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/testapp/style/FillLayerTest.java b/platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/testapp/style/FillLayerTest.java
index a1afc544aa..f8adc50590 100644
--- a/platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/testapp/style/FillLayerTest.java
+++ b/platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/testapp/style/FillLayerTest.java
@@ -129,11 +129,12 @@ public class FillLayerTest extends BaseActivityTest {
Timber.i("fill-antialias");
invoke(mapboxMap, (uiController, mapboxMap) -> {
assertNotNull(layer);
- assertNull((Boolean) layer.getFillAntialias().getValue());
+ assertNull(layer.getFillAntialias().getValue());
// Set and Get
- layer.setProperties(fillAntialias(true));
- assertEquals((Boolean) layer.getFillAntialias().getValue(), (Boolean) true);
+ Boolean propertyValue = true;
+ layer.setProperties(fillAntialias(propertyValue));
+ assertEquals(layer.getFillAntialias().getValue(), propertyValue);
});
}
@@ -159,11 +160,12 @@ public class FillLayerTest extends BaseActivityTest {
Timber.i("fill-opacity");
invoke(mapboxMap, (uiController, mapboxMap) -> {
assertNotNull(layer);
- assertNull((Float) layer.getFillOpacity().getValue());
+ assertNull(layer.getFillOpacity().getValue());
// Set and Get
- layer.setProperties(fillOpacity(0.3f));
- assertEquals((Float) layer.getFillOpacity().getValue(), (Float) 0.3f);
+ Float propertyValue = 0.3f;
+ layer.setProperties(fillOpacity(propertyValue));
+ assertEquals(layer.getFillOpacity().getValue(), propertyValue);
});
}
@@ -205,11 +207,12 @@ public class FillLayerTest extends BaseActivityTest {
Timber.i("fill-color");
invoke(mapboxMap, (uiController, mapboxMap) -> {
assertNotNull(layer);
- assertNull((String) layer.getFillColor().getValue());
+ assertNull(layer.getFillColor().getValue());
// Set and Get
- layer.setProperties(fillColor("rgba(0, 0, 0, 1)"));
- assertEquals((String) layer.getFillColor().getValue(), (String) "rgba(0, 0, 0, 1)");
+ String propertyValue = "rgba(0, 0, 0, 1)";
+ layer.setProperties(fillColor(propertyValue));
+ assertEquals(layer.getFillColor().getValue(), propertyValue);
});
}
@@ -265,11 +268,12 @@ public class FillLayerTest extends BaseActivityTest {
Timber.i("fill-outline-color");
invoke(mapboxMap, (uiController, mapboxMap) -> {
assertNotNull(layer);
- assertNull((String) layer.getFillOutlineColor().getValue());
+ assertNull(layer.getFillOutlineColor().getValue());
// Set and Get
- layer.setProperties(fillOutlineColor("rgba(0, 0, 0, 1)"));
- assertEquals((String) layer.getFillOutlineColor().getValue(), (String) "rgba(0, 0, 0, 1)");
+ String propertyValue = "rgba(0, 0, 0, 1)";
+ layer.setProperties(fillOutlineColor(propertyValue));
+ assertEquals(layer.getFillOutlineColor().getValue(), propertyValue);
});
}
@@ -325,11 +329,12 @@ public class FillLayerTest extends BaseActivityTest {
Timber.i("fill-translate");
invoke(mapboxMap, (uiController, mapboxMap) -> {
assertNotNull(layer);
- assertNull((Float[]) layer.getFillTranslate().getValue());
+ assertNull(layer.getFillTranslate().getValue());
// Set and Get
- layer.setProperties(fillTranslate(new Float[] {0f, 0f}));
- assertEquals((Float[]) layer.getFillTranslate().getValue(), (Float[]) new Float[] {0f, 0f});
+ Float[] propertyValue = new Float[] {0f, 0f};
+ layer.setProperties(fillTranslate(propertyValue));
+ assertEquals(layer.getFillTranslate().getValue(), propertyValue);
});
}
@@ -340,11 +345,12 @@ public class FillLayerTest extends BaseActivityTest {
Timber.i("fill-translate-anchor");
invoke(mapboxMap, (uiController, mapboxMap) -> {
assertNotNull(layer);
- assertNull((String) layer.getFillTranslateAnchor().getValue());
+ assertNull(layer.getFillTranslateAnchor().getValue());
// Set and Get
- layer.setProperties(fillTranslateAnchor(FILL_TRANSLATE_ANCHOR_MAP));
- assertEquals((String) layer.getFillTranslateAnchor().getValue(), (String) FILL_TRANSLATE_ANCHOR_MAP);
+ String propertyValue = FILL_TRANSLATE_ANCHOR_MAP;
+ layer.setProperties(fillTranslateAnchor(propertyValue));
+ assertEquals(layer.getFillTranslateAnchor().getValue(), propertyValue);
});
}
@@ -370,11 +376,12 @@ public class FillLayerTest extends BaseActivityTest {
Timber.i("fill-pattern");
invoke(mapboxMap, (uiController, mapboxMap) -> {
assertNotNull(layer);
- assertNull((String) layer.getFillPattern().getValue());
+ assertNull(layer.getFillPattern().getValue());
// Set and Get
- layer.setProperties(fillPattern("pedestrian-polygon"));
- assertEquals((String) layer.getFillPattern().getValue(), (String) "pedestrian-polygon");
+ String propertyValue = "pedestrian-polygon";
+ layer.setProperties(fillPattern(propertyValue));
+ assertEquals(layer.getFillPattern().getValue(), propertyValue);
});
}
diff --git a/platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/testapp/style/HeatmapLayerTest.java b/platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/testapp/style/HeatmapLayerTest.java
index 01d1bc2c61..7c084815ae 100644
--- a/platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/testapp/style/HeatmapLayerTest.java
+++ b/platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/testapp/style/HeatmapLayerTest.java
@@ -144,11 +144,12 @@ public class HeatmapLayerTest extends BaseActivityTest {
Timber.i("heatmap-radius");
invoke(mapboxMap, (uiController, mapboxMap) -> {
assertNotNull(layer);
- assertNull((Float) layer.getHeatmapRadius().getValue());
+ assertNull(layer.getHeatmapRadius().getValue());
// Set and Get
- layer.setProperties(heatmapRadius(0.3f));
- assertEquals((Float) layer.getHeatmapRadius().getValue(), (Float) 0.3f);
+ Float propertyValue = 0.3f;
+ layer.setProperties(heatmapRadius(propertyValue));
+ assertEquals(layer.getHeatmapRadius().getValue(), propertyValue);
});
}
@@ -175,11 +176,12 @@ public class HeatmapLayerTest extends BaseActivityTest {
Timber.i("heatmap-weight");
invoke(mapboxMap, (uiController, mapboxMap) -> {
assertNotNull(layer);
- assertNull((Float) layer.getHeatmapWeight().getValue());
+ assertNull(layer.getHeatmapWeight().getValue());
// Set and Get
- layer.setProperties(heatmapWeight(0.3f));
- assertEquals((Float) layer.getHeatmapWeight().getValue(), (Float) 0.3f);
+ Float propertyValue = 0.3f;
+ layer.setProperties(heatmapWeight(propertyValue));
+ assertEquals(layer.getHeatmapWeight().getValue(), propertyValue);
});
}
@@ -221,11 +223,12 @@ public class HeatmapLayerTest extends BaseActivityTest {
Timber.i("heatmap-intensity");
invoke(mapboxMap, (uiController, mapboxMap) -> {
assertNotNull(layer);
- assertNull((Float) layer.getHeatmapIntensity().getValue());
+ assertNull(layer.getHeatmapIntensity().getValue());
// Set and Get
- layer.setProperties(heatmapIntensity(0.3f));
- assertEquals((Float) layer.getHeatmapIntensity().getValue(), (Float) 0.3f);
+ Float propertyValue = 0.3f;
+ layer.setProperties(heatmapIntensity(propertyValue));
+ assertEquals(layer.getHeatmapIntensity().getValue(), propertyValue);
});
}
@@ -251,11 +254,12 @@ public class HeatmapLayerTest extends BaseActivityTest {
Timber.i("heatmap-opacity");
invoke(mapboxMap, (uiController, mapboxMap) -> {
assertNotNull(layer);
- assertNull((Float) layer.getHeatmapOpacity().getValue());
+ assertNull(layer.getHeatmapOpacity().getValue());
// Set and Get
- layer.setProperties(heatmapOpacity(0.3f));
- assertEquals((Float) layer.getHeatmapOpacity().getValue(), (Float) 0.3f);
+ Float propertyValue = 0.3f;
+ layer.setProperties(heatmapOpacity(propertyValue));
+ assertEquals(layer.getHeatmapOpacity().getValue(), propertyValue);
});
}
}
diff --git a/platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/testapp/style/HillshadeLayerTest.java b/platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/testapp/style/HillshadeLayerTest.java
index bd465a3be4..93279901b3 100644
--- a/platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/testapp/style/HillshadeLayerTest.java
+++ b/platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/testapp/style/HillshadeLayerTest.java
@@ -86,11 +86,12 @@ public class HillshadeLayerTest extends BaseActivityTest {
Timber.i("hillshade-illumination-direction");
invoke(mapboxMap, (uiController, mapboxMap) -> {
assertNotNull(layer);
- assertNull((Float) layer.getHillshadeIlluminationDirection().getValue());
+ assertNull(layer.getHillshadeIlluminationDirection().getValue());
// Set and Get
- layer.setProperties(hillshadeIlluminationDirection(0.3f));
- assertEquals((Float) layer.getHillshadeIlluminationDirection().getValue(), (Float) 0.3f);
+ Float propertyValue = 0.3f;
+ layer.setProperties(hillshadeIlluminationDirection(propertyValue));
+ assertEquals(layer.getHillshadeIlluminationDirection().getValue(), propertyValue);
});
}
@@ -101,11 +102,12 @@ public class HillshadeLayerTest extends BaseActivityTest {
Timber.i("hillshade-illumination-anchor");
invoke(mapboxMap, (uiController, mapboxMap) -> {
assertNotNull(layer);
- assertNull((String) layer.getHillshadeIlluminationAnchor().getValue());
+ assertNull(layer.getHillshadeIlluminationAnchor().getValue());
// Set and Get
- layer.setProperties(hillshadeIlluminationAnchor(HILLSHADE_ILLUMINATION_ANCHOR_MAP));
- assertEquals((String) layer.getHillshadeIlluminationAnchor().getValue(), (String) HILLSHADE_ILLUMINATION_ANCHOR_MAP);
+ String propertyValue = HILLSHADE_ILLUMINATION_ANCHOR_MAP;
+ layer.setProperties(hillshadeIlluminationAnchor(propertyValue));
+ assertEquals(layer.getHillshadeIlluminationAnchor().getValue(), propertyValue);
});
}
@@ -131,11 +133,12 @@ public class HillshadeLayerTest extends BaseActivityTest {
Timber.i("hillshade-exaggeration");
invoke(mapboxMap, (uiController, mapboxMap) -> {
assertNotNull(layer);
- assertNull((Float) layer.getHillshadeExaggeration().getValue());
+ assertNull(layer.getHillshadeExaggeration().getValue());
// Set and Get
- layer.setProperties(hillshadeExaggeration(0.3f));
- assertEquals((Float) layer.getHillshadeExaggeration().getValue(), (Float) 0.3f);
+ Float propertyValue = 0.3f;
+ layer.setProperties(hillshadeExaggeration(propertyValue));
+ assertEquals(layer.getHillshadeExaggeration().getValue(), propertyValue);
});
}
@@ -161,11 +164,12 @@ public class HillshadeLayerTest extends BaseActivityTest {
Timber.i("hillshade-shadow-color");
invoke(mapboxMap, (uiController, mapboxMap) -> {
assertNotNull(layer);
- assertNull((String) layer.getHillshadeShadowColor().getValue());
+ assertNull(layer.getHillshadeShadowColor().getValue());
// Set and Get
- layer.setProperties(hillshadeShadowColor("rgba(0, 0, 0, 1)"));
- assertEquals((String) layer.getHillshadeShadowColor().getValue(), (String) "rgba(0, 0, 0, 1)");
+ String propertyValue = "rgba(0, 0, 0, 1)";
+ layer.setProperties(hillshadeShadowColor(propertyValue));
+ assertEquals(layer.getHillshadeShadowColor().getValue(), propertyValue);
});
}
@@ -205,11 +209,12 @@ public class HillshadeLayerTest extends BaseActivityTest {
Timber.i("hillshade-highlight-color");
invoke(mapboxMap, (uiController, mapboxMap) -> {
assertNotNull(layer);
- assertNull((String) layer.getHillshadeHighlightColor().getValue());
+ assertNull(layer.getHillshadeHighlightColor().getValue());
// Set and Get
- layer.setProperties(hillshadeHighlightColor("rgba(0, 0, 0, 1)"));
- assertEquals((String) layer.getHillshadeHighlightColor().getValue(), (String) "rgba(0, 0, 0, 1)");
+ String propertyValue = "rgba(0, 0, 0, 1)";
+ layer.setProperties(hillshadeHighlightColor(propertyValue));
+ assertEquals(layer.getHillshadeHighlightColor().getValue(), propertyValue);
});
}
@@ -249,11 +254,12 @@ public class HillshadeLayerTest extends BaseActivityTest {
Timber.i("hillshade-accent-color");
invoke(mapboxMap, (uiController, mapboxMap) -> {
assertNotNull(layer);
- assertNull((String) layer.getHillshadeAccentColor().getValue());
+ assertNull(layer.getHillshadeAccentColor().getValue());
// Set and Get
- layer.setProperties(hillshadeAccentColor("rgba(0, 0, 0, 1)"));
- assertEquals((String) layer.getHillshadeAccentColor().getValue(), (String) "rgba(0, 0, 0, 1)");
+ String propertyValue = "rgba(0, 0, 0, 1)";
+ layer.setProperties(hillshadeAccentColor(propertyValue));
+ assertEquals(layer.getHillshadeAccentColor().getValue(), propertyValue);
});
}
diff --git a/platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/testapp/style/LineLayerTest.java b/platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/testapp/style/LineLayerTest.java
index ba4f23ab5d..71b52fdb71 100644
--- a/platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/testapp/style/LineLayerTest.java
+++ b/platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/testapp/style/LineLayerTest.java
@@ -129,11 +129,12 @@ public class LineLayerTest extends BaseActivityTest {
Timber.i("line-cap");
invoke(mapboxMap, (uiController, mapboxMap) -> {
assertNotNull(layer);
- assertNull((String) layer.getLineCap().getValue());
+ assertNull(layer.getLineCap().getValue());
// Set and Get
- layer.setProperties(lineCap(LINE_CAP_BUTT));
- assertEquals((String) layer.getLineCap().getValue(), (String) LINE_CAP_BUTT);
+ String propertyValue = LINE_CAP_BUTT;
+ layer.setProperties(lineCap(propertyValue));
+ assertEquals(layer.getLineCap().getValue(), propertyValue);
});
}
@@ -144,11 +145,12 @@ public class LineLayerTest extends BaseActivityTest {
Timber.i("line-join");
invoke(mapboxMap, (uiController, mapboxMap) -> {
assertNotNull(layer);
- assertNull((String) layer.getLineJoin().getValue());
+ assertNull(layer.getLineJoin().getValue());
// Set and Get
- layer.setProperties(lineJoin(LINE_JOIN_BEVEL));
- assertEquals((String) layer.getLineJoin().getValue(), (String) LINE_JOIN_BEVEL);
+ String propertyValue = LINE_JOIN_BEVEL;
+ layer.setProperties(lineJoin(propertyValue));
+ assertEquals(layer.getLineJoin().getValue(), propertyValue);
});
}
@@ -175,11 +177,12 @@ public class LineLayerTest extends BaseActivityTest {
Timber.i("line-miter-limit");
invoke(mapboxMap, (uiController, mapboxMap) -> {
assertNotNull(layer);
- assertNull((Float) layer.getLineMiterLimit().getValue());
+ assertNull(layer.getLineMiterLimit().getValue());
// Set and Get
- layer.setProperties(lineMiterLimit(0.3f));
- assertEquals((Float) layer.getLineMiterLimit().getValue(), (Float) 0.3f);
+ Float propertyValue = 0.3f;
+ layer.setProperties(lineMiterLimit(propertyValue));
+ assertEquals(layer.getLineMiterLimit().getValue(), propertyValue);
});
}
@@ -190,11 +193,12 @@ public class LineLayerTest extends BaseActivityTest {
Timber.i("line-round-limit");
invoke(mapboxMap, (uiController, mapboxMap) -> {
assertNotNull(layer);
- assertNull((Float) layer.getLineRoundLimit().getValue());
+ assertNull(layer.getLineRoundLimit().getValue());
// Set and Get
- layer.setProperties(lineRoundLimit(0.3f));
- assertEquals((Float) layer.getLineRoundLimit().getValue(), (Float) 0.3f);
+ Float propertyValue = 0.3f;
+ layer.setProperties(lineRoundLimit(propertyValue));
+ assertEquals(layer.getLineRoundLimit().getValue(), propertyValue);
});
}
@@ -220,11 +224,12 @@ public class LineLayerTest extends BaseActivityTest {
Timber.i("line-opacity");
invoke(mapboxMap, (uiController, mapboxMap) -> {
assertNotNull(layer);
- assertNull((Float) layer.getLineOpacity().getValue());
+ assertNull(layer.getLineOpacity().getValue());
// Set and Get
- layer.setProperties(lineOpacity(0.3f));
- assertEquals((Float) layer.getLineOpacity().getValue(), (Float) 0.3f);
+ Float propertyValue = 0.3f;
+ layer.setProperties(lineOpacity(propertyValue));
+ assertEquals(layer.getLineOpacity().getValue(), propertyValue);
});
}
@@ -266,11 +271,12 @@ public class LineLayerTest extends BaseActivityTest {
Timber.i("line-color");
invoke(mapboxMap, (uiController, mapboxMap) -> {
assertNotNull(layer);
- assertNull((String) layer.getLineColor().getValue());
+ assertNull(layer.getLineColor().getValue());
// Set and Get
- layer.setProperties(lineColor("rgba(0, 0, 0, 1)"));
- assertEquals((String) layer.getLineColor().getValue(), (String) "rgba(0, 0, 0, 1)");
+ String propertyValue = "rgba(0, 0, 0, 1)";
+ layer.setProperties(lineColor(propertyValue));
+ assertEquals(layer.getLineColor().getValue(), propertyValue);
});
}
@@ -326,11 +332,12 @@ public class LineLayerTest extends BaseActivityTest {
Timber.i("line-translate");
invoke(mapboxMap, (uiController, mapboxMap) -> {
assertNotNull(layer);
- assertNull((Float[]) layer.getLineTranslate().getValue());
+ assertNull(layer.getLineTranslate().getValue());
// Set and Get
- layer.setProperties(lineTranslate(new Float[] {0f, 0f}));
- assertEquals((Float[]) layer.getLineTranslate().getValue(), (Float[]) new Float[] {0f, 0f});
+ Float[] propertyValue = new Float[] {0f, 0f};
+ layer.setProperties(lineTranslate(propertyValue));
+ assertEquals(layer.getLineTranslate().getValue(), propertyValue);
});
}
@@ -341,11 +348,12 @@ public class LineLayerTest extends BaseActivityTest {
Timber.i("line-translate-anchor");
invoke(mapboxMap, (uiController, mapboxMap) -> {
assertNotNull(layer);
- assertNull((String) layer.getLineTranslateAnchor().getValue());
+ assertNull(layer.getLineTranslateAnchor().getValue());
// Set and Get
- layer.setProperties(lineTranslateAnchor(LINE_TRANSLATE_ANCHOR_MAP));
- assertEquals((String) layer.getLineTranslateAnchor().getValue(), (String) LINE_TRANSLATE_ANCHOR_MAP);
+ String propertyValue = LINE_TRANSLATE_ANCHOR_MAP;
+ layer.setProperties(lineTranslateAnchor(propertyValue));
+ assertEquals(layer.getLineTranslateAnchor().getValue(), propertyValue);
});
}
@@ -371,11 +379,12 @@ public class LineLayerTest extends BaseActivityTest {
Timber.i("line-width");
invoke(mapboxMap, (uiController, mapboxMap) -> {
assertNotNull(layer);
- assertNull((Float) layer.getLineWidth().getValue());
+ assertNull(layer.getLineWidth().getValue());
// Set and Get
- layer.setProperties(lineWidth(0.3f));
- assertEquals((Float) layer.getLineWidth().getValue(), (Float) 0.3f);
+ Float propertyValue = 0.3f;
+ layer.setProperties(lineWidth(propertyValue));
+ assertEquals(layer.getLineWidth().getValue(), propertyValue);
});
}
@@ -417,11 +426,12 @@ public class LineLayerTest extends BaseActivityTest {
Timber.i("line-gap-width");
invoke(mapboxMap, (uiController, mapboxMap) -> {
assertNotNull(layer);
- assertNull((Float) layer.getLineGapWidth().getValue());
+ assertNull(layer.getLineGapWidth().getValue());
// Set and Get
- layer.setProperties(lineGapWidth(0.3f));
- assertEquals((Float) layer.getLineGapWidth().getValue(), (Float) 0.3f);
+ Float propertyValue = 0.3f;
+ layer.setProperties(lineGapWidth(propertyValue));
+ assertEquals(layer.getLineGapWidth().getValue(), propertyValue);
});
}
@@ -463,11 +473,12 @@ public class LineLayerTest extends BaseActivityTest {
Timber.i("line-offset");
invoke(mapboxMap, (uiController, mapboxMap) -> {
assertNotNull(layer);
- assertNull((Float) layer.getLineOffset().getValue());
+ assertNull(layer.getLineOffset().getValue());
// Set and Get
- layer.setProperties(lineOffset(0.3f));
- assertEquals((Float) layer.getLineOffset().getValue(), (Float) 0.3f);
+ Float propertyValue = 0.3f;
+ layer.setProperties(lineOffset(propertyValue));
+ assertEquals(layer.getLineOffset().getValue(), propertyValue);
});
}
@@ -493,11 +504,12 @@ public class LineLayerTest extends BaseActivityTest {
Timber.i("line-blur");
invoke(mapboxMap, (uiController, mapboxMap) -> {
assertNotNull(layer);
- assertNull((Float) layer.getLineBlur().getValue());
+ assertNull(layer.getLineBlur().getValue());
// Set and Get
- layer.setProperties(lineBlur(0.3f));
- assertEquals((Float) layer.getLineBlur().getValue(), (Float) 0.3f);
+ Float propertyValue = 0.3f;
+ layer.setProperties(lineBlur(propertyValue));
+ assertEquals(layer.getLineBlur().getValue(), propertyValue);
});
}
@@ -539,11 +551,12 @@ public class LineLayerTest extends BaseActivityTest {
Timber.i("line-dasharray");
invoke(mapboxMap, (uiController, mapboxMap) -> {
assertNotNull(layer);
- assertNull((Float[]) layer.getLineDasharray().getValue());
+ assertNull(layer.getLineDasharray().getValue());
// Set and Get
- layer.setProperties(lineDasharray(new Float[] {}));
- assertEquals((Float[]) layer.getLineDasharray().getValue(), (Float[]) new Float[] {});
+ Float[] propertyValue = new Float[] {};
+ layer.setProperties(lineDasharray(propertyValue));
+ assertEquals(layer.getLineDasharray().getValue(), propertyValue);
});
}
@@ -569,11 +582,12 @@ public class LineLayerTest extends BaseActivityTest {
Timber.i("line-pattern");
invoke(mapboxMap, (uiController, mapboxMap) -> {
assertNotNull(layer);
- assertNull((String) layer.getLinePattern().getValue());
+ assertNull(layer.getLinePattern().getValue());
// Set and Get
- layer.setProperties(linePattern("pedestrian-polygon"));
- assertEquals((String) layer.getLinePattern().getValue(), (String) "pedestrian-polygon");
+ String propertyValue = "pedestrian-polygon";
+ layer.setProperties(linePattern(propertyValue));
+ assertEquals(layer.getLinePattern().getValue(), propertyValue);
});
}
diff --git a/platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/testapp/style/RasterLayerTest.java b/platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/testapp/style/RasterLayerTest.java
index 7c5cf3a00a..3c8ef99319 100644
--- a/platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/testapp/style/RasterLayerTest.java
+++ b/platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/testapp/style/RasterLayerTest.java
@@ -101,11 +101,12 @@ public class RasterLayerTest extends BaseActivityTest {
Timber.i("raster-opacity");
invoke(mapboxMap, (uiController, mapboxMap) -> {
assertNotNull(layer);
- assertNull((Float) layer.getRasterOpacity().getValue());
+ assertNull(layer.getRasterOpacity().getValue());
// Set and Get
- layer.setProperties(rasterOpacity(0.3f));
- assertEquals((Float) layer.getRasterOpacity().getValue(), (Float) 0.3f);
+ Float propertyValue = 0.3f;
+ layer.setProperties(rasterOpacity(propertyValue));
+ assertEquals(layer.getRasterOpacity().getValue(), propertyValue);
});
}
@@ -131,11 +132,12 @@ public class RasterLayerTest extends BaseActivityTest {
Timber.i("raster-hue-rotate");
invoke(mapboxMap, (uiController, mapboxMap) -> {
assertNotNull(layer);
- assertNull((Float) layer.getRasterHueRotate().getValue());
+ assertNull(layer.getRasterHueRotate().getValue());
// Set and Get
- layer.setProperties(rasterHueRotate(0.3f));
- assertEquals((Float) layer.getRasterHueRotate().getValue(), (Float) 0.3f);
+ Float propertyValue = 0.3f;
+ layer.setProperties(rasterHueRotate(propertyValue));
+ assertEquals(layer.getRasterHueRotate().getValue(), propertyValue);
});
}
@@ -161,11 +163,12 @@ public class RasterLayerTest extends BaseActivityTest {
Timber.i("raster-brightness-min");
invoke(mapboxMap, (uiController, mapboxMap) -> {
assertNotNull(layer);
- assertNull((Float) layer.getRasterBrightnessMin().getValue());
+ assertNull(layer.getRasterBrightnessMin().getValue());
// Set and Get
- layer.setProperties(rasterBrightnessMin(0.3f));
- assertEquals((Float) layer.getRasterBrightnessMin().getValue(), (Float) 0.3f);
+ Float propertyValue = 0.3f;
+ layer.setProperties(rasterBrightnessMin(propertyValue));
+ assertEquals(layer.getRasterBrightnessMin().getValue(), propertyValue);
});
}
@@ -191,11 +194,12 @@ public class RasterLayerTest extends BaseActivityTest {
Timber.i("raster-brightness-max");
invoke(mapboxMap, (uiController, mapboxMap) -> {
assertNotNull(layer);
- assertNull((Float) layer.getRasterBrightnessMax().getValue());
+ assertNull(layer.getRasterBrightnessMax().getValue());
// Set and Get
- layer.setProperties(rasterBrightnessMax(0.3f));
- assertEquals((Float) layer.getRasterBrightnessMax().getValue(), (Float) 0.3f);
+ Float propertyValue = 0.3f;
+ layer.setProperties(rasterBrightnessMax(propertyValue));
+ assertEquals(layer.getRasterBrightnessMax().getValue(), propertyValue);
});
}
@@ -221,11 +225,12 @@ public class RasterLayerTest extends BaseActivityTest {
Timber.i("raster-saturation");
invoke(mapboxMap, (uiController, mapboxMap) -> {
assertNotNull(layer);
- assertNull((Float) layer.getRasterSaturation().getValue());
+ assertNull(layer.getRasterSaturation().getValue());
// Set and Get
- layer.setProperties(rasterSaturation(0.3f));
- assertEquals((Float) layer.getRasterSaturation().getValue(), (Float) 0.3f);
+ Float propertyValue = 0.3f;
+ layer.setProperties(rasterSaturation(propertyValue));
+ assertEquals(layer.getRasterSaturation().getValue(), propertyValue);
});
}
@@ -251,11 +256,12 @@ public class RasterLayerTest extends BaseActivityTest {
Timber.i("raster-contrast");
invoke(mapboxMap, (uiController, mapboxMap) -> {
assertNotNull(layer);
- assertNull((Float) layer.getRasterContrast().getValue());
+ assertNull(layer.getRasterContrast().getValue());
// Set and Get
- layer.setProperties(rasterContrast(0.3f));
- assertEquals((Float) layer.getRasterContrast().getValue(), (Float) 0.3f);
+ Float propertyValue = 0.3f;
+ layer.setProperties(rasterContrast(propertyValue));
+ assertEquals(layer.getRasterContrast().getValue(), propertyValue);
});
}
@@ -266,11 +272,12 @@ public class RasterLayerTest extends BaseActivityTest {
Timber.i("raster-resampling");
invoke(mapboxMap, (uiController, mapboxMap) -> {
assertNotNull(layer);
- assertNull((String) layer.getRasterResampling().getValue());
+ assertNull(layer.getRasterResampling().getValue());
// Set and Get
- layer.setProperties(rasterResampling(RASTER_RESAMPLING_LINEAR));
- assertEquals((String) layer.getRasterResampling().getValue(), (String) RASTER_RESAMPLING_LINEAR);
+ String propertyValue = RASTER_RESAMPLING_LINEAR;
+ layer.setProperties(rasterResampling(propertyValue));
+ assertEquals(layer.getRasterResampling().getValue(), propertyValue);
});
}
@@ -281,11 +288,12 @@ public class RasterLayerTest extends BaseActivityTest {
Timber.i("raster-fade-duration");
invoke(mapboxMap, (uiController, mapboxMap) -> {
assertNotNull(layer);
- assertNull((Float) layer.getRasterFadeDuration().getValue());
+ assertNull(layer.getRasterFadeDuration().getValue());
// Set and Get
- layer.setProperties(rasterFadeDuration(0.3f));
- assertEquals((Float) layer.getRasterFadeDuration().getValue(), (Float) 0.3f);
+ Float propertyValue = 0.3f;
+ layer.setProperties(rasterFadeDuration(propertyValue));
+ assertEquals(layer.getRasterFadeDuration().getValue(), propertyValue);
});
}
}
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 5b985bdba0..9d12ae9401 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
@@ -131,11 +131,12 @@ public class SymbolLayerTest extends BaseActivityTest {
Timber.i("symbol-placement");
invoke(mapboxMap, (uiController, mapboxMap) -> {
assertNotNull(layer);
- assertNull((String) layer.getSymbolPlacement().getValue());
+ assertNull(layer.getSymbolPlacement().getValue());
// Set and Get
- layer.setProperties(symbolPlacement(SYMBOL_PLACEMENT_POINT));
- assertEquals((String) layer.getSymbolPlacement().getValue(), (String) SYMBOL_PLACEMENT_POINT);
+ String propertyValue = SYMBOL_PLACEMENT_POINT;
+ layer.setProperties(symbolPlacement(propertyValue));
+ assertEquals(layer.getSymbolPlacement().getValue(), propertyValue);
});
}
@@ -146,11 +147,12 @@ public class SymbolLayerTest extends BaseActivityTest {
Timber.i("symbol-spacing");
invoke(mapboxMap, (uiController, mapboxMap) -> {
assertNotNull(layer);
- assertNull((Float) layer.getSymbolSpacing().getValue());
+ assertNull(layer.getSymbolSpacing().getValue());
// Set and Get
- layer.setProperties(symbolSpacing(0.3f));
- assertEquals((Float) layer.getSymbolSpacing().getValue(), (Float) 0.3f);
+ Float propertyValue = 0.3f;
+ layer.setProperties(symbolSpacing(propertyValue));
+ assertEquals(layer.getSymbolSpacing().getValue(), propertyValue);
});
}
@@ -161,11 +163,12 @@ public class SymbolLayerTest extends BaseActivityTest {
Timber.i("symbol-avoid-edges");
invoke(mapboxMap, (uiController, mapboxMap) -> {
assertNotNull(layer);
- assertNull((Boolean) layer.getSymbolAvoidEdges().getValue());
+ assertNull(layer.getSymbolAvoidEdges().getValue());
// Set and Get
- layer.setProperties(symbolAvoidEdges(true));
- assertEquals((Boolean) layer.getSymbolAvoidEdges().getValue(), (Boolean) true);
+ Boolean propertyValue = true;
+ layer.setProperties(symbolAvoidEdges(propertyValue));
+ assertEquals(layer.getSymbolAvoidEdges().getValue(), propertyValue);
});
}
@@ -176,11 +179,12 @@ public class SymbolLayerTest extends BaseActivityTest {
Timber.i("symbol-z-order");
invoke(mapboxMap, (uiController, mapboxMap) -> {
assertNotNull(layer);
- assertNull((String) layer.getSymbolZOrder().getValue());
+ assertNull(layer.getSymbolZOrder().getValue());
// Set and Get
- layer.setProperties(symbolZOrder(SYMBOL_Z_ORDER_VIEWPORT_Y));
- assertEquals((String) layer.getSymbolZOrder().getValue(), (String) SYMBOL_Z_ORDER_VIEWPORT_Y);
+ String propertyValue = SYMBOL_Z_ORDER_VIEWPORT_Y;
+ layer.setProperties(symbolZOrder(propertyValue));
+ assertEquals(layer.getSymbolZOrder().getValue(), propertyValue);
});
}
@@ -191,11 +195,12 @@ public class SymbolLayerTest extends BaseActivityTest {
Timber.i("icon-allow-overlap");
invoke(mapboxMap, (uiController, mapboxMap) -> {
assertNotNull(layer);
- assertNull((Boolean) layer.getIconAllowOverlap().getValue());
+ assertNull(layer.getIconAllowOverlap().getValue());
// Set and Get
- layer.setProperties(iconAllowOverlap(true));
- assertEquals((Boolean) layer.getIconAllowOverlap().getValue(), (Boolean) true);
+ Boolean propertyValue = true;
+ layer.setProperties(iconAllowOverlap(propertyValue));
+ assertEquals(layer.getIconAllowOverlap().getValue(), propertyValue);
});
}
@@ -206,11 +211,12 @@ public class SymbolLayerTest extends BaseActivityTest {
Timber.i("icon-ignore-placement");
invoke(mapboxMap, (uiController, mapboxMap) -> {
assertNotNull(layer);
- assertNull((Boolean) layer.getIconIgnorePlacement().getValue());
+ assertNull(layer.getIconIgnorePlacement().getValue());
// Set and Get
- layer.setProperties(iconIgnorePlacement(true));
- assertEquals((Boolean) layer.getIconIgnorePlacement().getValue(), (Boolean) true);
+ Boolean propertyValue = true;
+ layer.setProperties(iconIgnorePlacement(propertyValue));
+ assertEquals(layer.getIconIgnorePlacement().getValue(), propertyValue);
});
}
@@ -221,11 +227,12 @@ public class SymbolLayerTest extends BaseActivityTest {
Timber.i("icon-optional");
invoke(mapboxMap, (uiController, mapboxMap) -> {
assertNotNull(layer);
- assertNull((Boolean) layer.getIconOptional().getValue());
+ assertNull(layer.getIconOptional().getValue());
// Set and Get
- layer.setProperties(iconOptional(true));
- assertEquals((Boolean) layer.getIconOptional().getValue(), (Boolean) true);
+ Boolean propertyValue = true;
+ layer.setProperties(iconOptional(propertyValue));
+ assertEquals(layer.getIconOptional().getValue(), propertyValue);
});
}
@@ -236,11 +243,12 @@ public class SymbolLayerTest extends BaseActivityTest {
Timber.i("icon-rotation-alignment");
invoke(mapboxMap, (uiController, mapboxMap) -> {
assertNotNull(layer);
- assertNull((String) layer.getIconRotationAlignment().getValue());
+ assertNull(layer.getIconRotationAlignment().getValue());
// Set and Get
- layer.setProperties(iconRotationAlignment(ICON_ROTATION_ALIGNMENT_MAP));
- assertEquals((String) layer.getIconRotationAlignment().getValue(), (String) ICON_ROTATION_ALIGNMENT_MAP);
+ String propertyValue = ICON_ROTATION_ALIGNMENT_MAP;
+ layer.setProperties(iconRotationAlignment(propertyValue));
+ assertEquals(layer.getIconRotationAlignment().getValue(), propertyValue);
});
}
@@ -251,11 +259,12 @@ public class SymbolLayerTest extends BaseActivityTest {
Timber.i("icon-size");
invoke(mapboxMap, (uiController, mapboxMap) -> {
assertNotNull(layer);
- assertNull((Float) layer.getIconSize().getValue());
+ assertNull(layer.getIconSize().getValue());
// Set and Get
- layer.setProperties(iconSize(0.3f));
- assertEquals((Float) layer.getIconSize().getValue(), (Float) 0.3f);
+ Float propertyValue = 0.3f;
+ layer.setProperties(iconSize(propertyValue));
+ assertEquals(layer.getIconSize().getValue(), propertyValue);
});
}
@@ -282,11 +291,12 @@ public class SymbolLayerTest extends BaseActivityTest {
Timber.i("icon-text-fit");
invoke(mapboxMap, (uiController, mapboxMap) -> {
assertNotNull(layer);
- assertNull((String) layer.getIconTextFit().getValue());
+ assertNull(layer.getIconTextFit().getValue());
// Set and Get
- layer.setProperties(iconTextFit(ICON_TEXT_FIT_NONE));
- assertEquals((String) layer.getIconTextFit().getValue(), (String) ICON_TEXT_FIT_NONE);
+ String propertyValue = ICON_TEXT_FIT_NONE;
+ layer.setProperties(iconTextFit(propertyValue));
+ assertEquals(layer.getIconTextFit().getValue(), propertyValue);
});
}
@@ -297,11 +307,12 @@ public class SymbolLayerTest extends BaseActivityTest {
Timber.i("icon-text-fit-padding");
invoke(mapboxMap, (uiController, mapboxMap) -> {
assertNotNull(layer);
- assertNull((Float[]) layer.getIconTextFitPadding().getValue());
+ assertNull(layer.getIconTextFitPadding().getValue());
// Set and Get
- layer.setProperties(iconTextFitPadding(new Float[] {0f, 0f, 0f, 0f}));
- assertEquals((Float[]) layer.getIconTextFitPadding().getValue(), (Float[]) new Float[] {0f, 0f, 0f, 0f});
+ Float[] propertyValue = new Float[] {0f, 0f, 0f, 0f};
+ layer.setProperties(iconTextFitPadding(propertyValue));
+ assertEquals(layer.getIconTextFitPadding().getValue(), propertyValue);
});
}
@@ -312,11 +323,12 @@ public class SymbolLayerTest extends BaseActivityTest {
Timber.i("icon-image");
invoke(mapboxMap, (uiController, mapboxMap) -> {
assertNotNull(layer);
- assertNull((String) layer.getIconImage().getValue());
+ assertNull(layer.getIconImage().getValue());
// Set and Get
- layer.setProperties(iconImage("undefined"));
- assertEquals((String) layer.getIconImage().getValue(), (String) "undefined");
+ String propertyValue = "undefined";
+ layer.setProperties(iconImage(propertyValue));
+ assertEquals(layer.getIconImage().getValue(), propertyValue);
layer.setProperties(iconImage("{token}"));
assertEquals(layer.getIconImage().getExpression(), Expression.toString(Expression.get("token")));
@@ -346,11 +358,12 @@ public class SymbolLayerTest extends BaseActivityTest {
Timber.i("icon-rotate");
invoke(mapboxMap, (uiController, mapboxMap) -> {
assertNotNull(layer);
- assertNull((Float) layer.getIconRotate().getValue());
+ assertNull(layer.getIconRotate().getValue());
// Set and Get
- layer.setProperties(iconRotate(0.3f));
- assertEquals((Float) layer.getIconRotate().getValue(), (Float) 0.3f);
+ Float propertyValue = 0.3f;
+ layer.setProperties(iconRotate(propertyValue));
+ assertEquals(layer.getIconRotate().getValue(), propertyValue);
});
}
@@ -377,11 +390,12 @@ public class SymbolLayerTest extends BaseActivityTest {
Timber.i("icon-padding");
invoke(mapboxMap, (uiController, mapboxMap) -> {
assertNotNull(layer);
- assertNull((Float) layer.getIconPadding().getValue());
+ assertNull(layer.getIconPadding().getValue());
// Set and Get
- layer.setProperties(iconPadding(0.3f));
- assertEquals((Float) layer.getIconPadding().getValue(), (Float) 0.3f);
+ Float propertyValue = 0.3f;
+ layer.setProperties(iconPadding(propertyValue));
+ assertEquals(layer.getIconPadding().getValue(), propertyValue);
});
}
@@ -392,11 +406,12 @@ public class SymbolLayerTest extends BaseActivityTest {
Timber.i("icon-keep-upright");
invoke(mapboxMap, (uiController, mapboxMap) -> {
assertNotNull(layer);
- assertNull((Boolean) layer.getIconKeepUpright().getValue());
+ assertNull(layer.getIconKeepUpright().getValue());
// Set and Get
- layer.setProperties(iconKeepUpright(true));
- assertEquals((Boolean) layer.getIconKeepUpright().getValue(), (Boolean) true);
+ Boolean propertyValue = true;
+ layer.setProperties(iconKeepUpright(propertyValue));
+ assertEquals(layer.getIconKeepUpright().getValue(), propertyValue);
});
}
@@ -407,11 +422,12 @@ public class SymbolLayerTest extends BaseActivityTest {
Timber.i("icon-offset");
invoke(mapboxMap, (uiController, mapboxMap) -> {
assertNotNull(layer);
- assertNull((Float[]) layer.getIconOffset().getValue());
+ assertNull(layer.getIconOffset().getValue());
// Set and Get
- layer.setProperties(iconOffset(new Float[] {0f, 0f}));
- assertEquals((Float[]) layer.getIconOffset().getValue(), (Float[]) new Float[] {0f, 0f});
+ Float[] propertyValue = new Float[] {0f, 0f};
+ layer.setProperties(iconOffset(propertyValue));
+ assertEquals(layer.getIconOffset().getValue(), propertyValue);
});
}
@@ -422,11 +438,12 @@ public class SymbolLayerTest extends BaseActivityTest {
Timber.i("icon-anchor");
invoke(mapboxMap, (uiController, mapboxMap) -> {
assertNotNull(layer);
- assertNull((String) layer.getIconAnchor().getValue());
+ assertNull(layer.getIconAnchor().getValue());
// Set and Get
- layer.setProperties(iconAnchor(ICON_ANCHOR_CENTER));
- assertEquals((String) layer.getIconAnchor().getValue(), (String) ICON_ANCHOR_CENTER);
+ String propertyValue = ICON_ANCHOR_CENTER;
+ layer.setProperties(iconAnchor(propertyValue));
+ assertEquals(layer.getIconAnchor().getValue(), propertyValue);
});
}
@@ -453,11 +470,12 @@ public class SymbolLayerTest extends BaseActivityTest {
Timber.i("icon-pitch-alignment");
invoke(mapboxMap, (uiController, mapboxMap) -> {
assertNotNull(layer);
- assertNull((String) layer.getIconPitchAlignment().getValue());
+ assertNull(layer.getIconPitchAlignment().getValue());
// Set and Get
- layer.setProperties(iconPitchAlignment(ICON_PITCH_ALIGNMENT_MAP));
- assertEquals((String) layer.getIconPitchAlignment().getValue(), (String) ICON_PITCH_ALIGNMENT_MAP);
+ String propertyValue = ICON_PITCH_ALIGNMENT_MAP;
+ layer.setProperties(iconPitchAlignment(propertyValue));
+ assertEquals(layer.getIconPitchAlignment().getValue(), propertyValue);
});
}
@@ -468,11 +486,12 @@ public class SymbolLayerTest extends BaseActivityTest {
Timber.i("text-pitch-alignment");
invoke(mapboxMap, (uiController, mapboxMap) -> {
assertNotNull(layer);
- assertNull((String) layer.getTextPitchAlignment().getValue());
+ assertNull(layer.getTextPitchAlignment().getValue());
// Set and Get
- layer.setProperties(textPitchAlignment(TEXT_PITCH_ALIGNMENT_MAP));
- assertEquals((String) layer.getTextPitchAlignment().getValue(), (String) TEXT_PITCH_ALIGNMENT_MAP);
+ String propertyValue = TEXT_PITCH_ALIGNMENT_MAP;
+ layer.setProperties(textPitchAlignment(propertyValue));
+ assertEquals(layer.getTextPitchAlignment().getValue(), propertyValue);
});
}
@@ -483,11 +502,12 @@ public class SymbolLayerTest extends BaseActivityTest {
Timber.i("text-rotation-alignment");
invoke(mapboxMap, (uiController, mapboxMap) -> {
assertNotNull(layer);
- assertNull((String) layer.getTextRotationAlignment().getValue());
+ assertNull(layer.getTextRotationAlignment().getValue());
// Set and Get
- layer.setProperties(textRotationAlignment(TEXT_ROTATION_ALIGNMENT_MAP));
- assertEquals((String) layer.getTextRotationAlignment().getValue(), (String) TEXT_ROTATION_ALIGNMENT_MAP);
+ String propertyValue = TEXT_ROTATION_ALIGNMENT_MAP;
+ layer.setProperties(textRotationAlignment(propertyValue));
+ assertEquals(layer.getTextRotationAlignment().getValue(), propertyValue);
});
}
@@ -498,36 +518,16 @@ public class SymbolLayerTest extends BaseActivityTest {
Timber.i("text-field");
invoke(mapboxMap, (uiController, mapboxMap) -> {
assertNotNull(layer);
- assertNull((String) layer.getTextField().getValue());
+ assertNull(layer.getTextField().getValue());
// Set and Get
- layer.setProperties(textField(""));
- assertEquals((String) layer.getTextField().getValue(), (String) "");
+ Formatted propertyValue = new Formatted(new FormattedSection[]{new FormattedSection("default")});
- layer.setProperties(textField("{token}"));
- assertEquals(layer.getTextField().getExpression(), Expression.format(Expression.formatEntry(Expression.toString(Expression.get("token")))));
- });
- }
-
- @Test
- public void testFormattedTextFieldAsConstant() {
- validateTestSetup();
- setupLayer();
- Timber.i("text-field-formatted");
- invoke(mapboxMap, (uiController, mapboxMap) -> {
- assertNotNull(layer);
- assertNull((String) layer.getTextField().getValue());
-
- Formatted expected = new Formatted(new FormattedSection[] {
- new FormattedSection("", 1.0)
- });
-
- // Set and Get
- layer.setProperties(textField(""));
- assertEquals(layer.getFormattedTextField().getValue(), expected/*(String) ""*/);
+ layer.setProperties(textField("default"));
+ assertEquals(layer.getTextField().getValue(), propertyValue);
layer.setProperties(textField("{token}"));
- assertEquals(layer.getFormattedTextField().getExpression(), Expression.format(Expression.formatEntry(Expression.toString(Expression.get("token")))));
+ assertEquals(layer.getTextField().getExpression(), format(Expression.formatEntry(Expression.toString(Expression.get("token")))));
});
}
@@ -541,25 +541,9 @@ public class SymbolLayerTest extends BaseActivityTest {
assertNull(layer.getTextField().getExpression());
// Set and Get
- Expression expression = string(Expression.get("undefined"));
- layer.setProperties(textField(expression));
- assertEquals(layer.getTextField().getExpression(), Expression.format(Expression.formatEntry(expression)));
- });
- }
-
- @Test
- public void testFormattedTextFieldAsExpression() {
- validateTestSetup();
- setupLayer();
- Timber.i("text-field-formatted-expression");
- invoke(mapboxMap, (uiController, mapboxMap) -> {
- assertNotNull(layer);
- assertNull(layer.getTextField().getExpression());
-
- // Set and Get
- Expression expression = string(Expression.get("undefined"));
+ Expression expression = format(Expression.formatEntry(Expression.get("undefined"), FormatOption.formatFontScale(2.0), FormatOption.formatTextFont(new String[]{"Open Sans Regular", "Arial Unicode MS Regular"})));
layer.setProperties(textField(expression));
- assertEquals(layer.getFormattedTextField().getExpression(), Expression.format(Expression.formatEntry(Expression.string(Expression.get("undefined")))));
+ assertEquals(layer.getTextField().getExpression(), expression);
});
}
@@ -570,11 +554,12 @@ public class SymbolLayerTest extends BaseActivityTest {
Timber.i("text-font");
invoke(mapboxMap, (uiController, mapboxMap) -> {
assertNotNull(layer);
- assertNull((String[]) layer.getTextFont().getValue());
+ assertNull(layer.getTextFont().getValue());
// Set and Get
- layer.setProperties(textFont(new String[]{"Open Sans Regular", "Arial Unicode MS Regular"}));
- assertEquals((String[]) layer.getTextFont().getValue(), (String[]) new String[]{"Open Sans Regular", "Arial Unicode MS Regular"});
+ String[] propertyValue = new String[]{"Open Sans Regular", "Arial Unicode MS Regular"};
+ layer.setProperties(textFont(propertyValue));
+ assertEquals(layer.getTextFont().getValue(), propertyValue);
});
}
@@ -585,11 +570,12 @@ public class SymbolLayerTest extends BaseActivityTest {
Timber.i("text-size");
invoke(mapboxMap, (uiController, mapboxMap) -> {
assertNotNull(layer);
- assertNull((Float) layer.getTextSize().getValue());
+ assertNull(layer.getTextSize().getValue());
// Set and Get
- layer.setProperties(textSize(0.3f));
- assertEquals((Float) layer.getTextSize().getValue(), (Float) 0.3f);
+ Float propertyValue = 0.3f;
+ layer.setProperties(textSize(propertyValue));
+ assertEquals(layer.getTextSize().getValue(), propertyValue);
});
}
@@ -616,11 +602,12 @@ public class SymbolLayerTest extends BaseActivityTest {
Timber.i("text-max-width");
invoke(mapboxMap, (uiController, mapboxMap) -> {
assertNotNull(layer);
- assertNull((Float) layer.getTextMaxWidth().getValue());
+ assertNull(layer.getTextMaxWidth().getValue());
// Set and Get
- layer.setProperties(textMaxWidth(0.3f));
- assertEquals((Float) layer.getTextMaxWidth().getValue(), (Float) 0.3f);
+ Float propertyValue = 0.3f;
+ layer.setProperties(textMaxWidth(propertyValue));
+ assertEquals(layer.getTextMaxWidth().getValue(), propertyValue);
});
}
@@ -647,11 +634,12 @@ public class SymbolLayerTest extends BaseActivityTest {
Timber.i("text-line-height");
invoke(mapboxMap, (uiController, mapboxMap) -> {
assertNotNull(layer);
- assertNull((Float) layer.getTextLineHeight().getValue());
+ assertNull(layer.getTextLineHeight().getValue());
// Set and Get
- layer.setProperties(textLineHeight(0.3f));
- assertEquals((Float) layer.getTextLineHeight().getValue(), (Float) 0.3f);
+ Float propertyValue = 0.3f;
+ layer.setProperties(textLineHeight(propertyValue));
+ assertEquals(layer.getTextLineHeight().getValue(), propertyValue);
});
}
@@ -662,11 +650,12 @@ public class SymbolLayerTest extends BaseActivityTest {
Timber.i("text-letter-spacing");
invoke(mapboxMap, (uiController, mapboxMap) -> {
assertNotNull(layer);
- assertNull((Float) layer.getTextLetterSpacing().getValue());
+ assertNull(layer.getTextLetterSpacing().getValue());
// Set and Get
- layer.setProperties(textLetterSpacing(0.3f));
- assertEquals((Float) layer.getTextLetterSpacing().getValue(), (Float) 0.3f);
+ Float propertyValue = 0.3f;
+ layer.setProperties(textLetterSpacing(propertyValue));
+ assertEquals(layer.getTextLetterSpacing().getValue(), propertyValue);
});
}
@@ -693,11 +682,12 @@ public class SymbolLayerTest extends BaseActivityTest {
Timber.i("text-justify");
invoke(mapboxMap, (uiController, mapboxMap) -> {
assertNotNull(layer);
- assertNull((String) layer.getTextJustify().getValue());
+ assertNull(layer.getTextJustify().getValue());
// Set and Get
- layer.setProperties(textJustify(TEXT_JUSTIFY_LEFT));
- assertEquals((String) layer.getTextJustify().getValue(), (String) TEXT_JUSTIFY_LEFT);
+ String propertyValue = TEXT_JUSTIFY_LEFT;
+ layer.setProperties(textJustify(propertyValue));
+ assertEquals(layer.getTextJustify().getValue(), propertyValue);
});
}
@@ -724,11 +714,12 @@ public class SymbolLayerTest extends BaseActivityTest {
Timber.i("text-anchor");
invoke(mapboxMap, (uiController, mapboxMap) -> {
assertNotNull(layer);
- assertNull((String) layer.getTextAnchor().getValue());
+ assertNull(layer.getTextAnchor().getValue());
// Set and Get
- layer.setProperties(textAnchor(TEXT_ANCHOR_CENTER));
- assertEquals((String) layer.getTextAnchor().getValue(), (String) TEXT_ANCHOR_CENTER);
+ String propertyValue = TEXT_ANCHOR_CENTER;
+ layer.setProperties(textAnchor(propertyValue));
+ assertEquals(layer.getTextAnchor().getValue(), propertyValue);
});
}
@@ -755,11 +746,12 @@ public class SymbolLayerTest extends BaseActivityTest {
Timber.i("text-max-angle");
invoke(mapboxMap, (uiController, mapboxMap) -> {
assertNotNull(layer);
- assertNull((Float) layer.getTextMaxAngle().getValue());
+ assertNull(layer.getTextMaxAngle().getValue());
// Set and Get
- layer.setProperties(textMaxAngle(0.3f));
- assertEquals((Float) layer.getTextMaxAngle().getValue(), (Float) 0.3f);
+ Float propertyValue = 0.3f;
+ layer.setProperties(textMaxAngle(propertyValue));
+ assertEquals(layer.getTextMaxAngle().getValue(), propertyValue);
});
}
@@ -770,11 +762,12 @@ public class SymbolLayerTest extends BaseActivityTest {
Timber.i("text-rotate");
invoke(mapboxMap, (uiController, mapboxMap) -> {
assertNotNull(layer);
- assertNull((Float) layer.getTextRotate().getValue());
+ assertNull(layer.getTextRotate().getValue());
// Set and Get
- layer.setProperties(textRotate(0.3f));
- assertEquals((Float) layer.getTextRotate().getValue(), (Float) 0.3f);
+ Float propertyValue = 0.3f;
+ layer.setProperties(textRotate(propertyValue));
+ assertEquals(layer.getTextRotate().getValue(), propertyValue);
});
}
@@ -801,11 +794,12 @@ public class SymbolLayerTest extends BaseActivityTest {
Timber.i("text-padding");
invoke(mapboxMap, (uiController, mapboxMap) -> {
assertNotNull(layer);
- assertNull((Float) layer.getTextPadding().getValue());
+ assertNull(layer.getTextPadding().getValue());
// Set and Get
- layer.setProperties(textPadding(0.3f));
- assertEquals((Float) layer.getTextPadding().getValue(), (Float) 0.3f);
+ Float propertyValue = 0.3f;
+ layer.setProperties(textPadding(propertyValue));
+ assertEquals(layer.getTextPadding().getValue(), propertyValue);
});
}
@@ -816,11 +810,12 @@ public class SymbolLayerTest extends BaseActivityTest {
Timber.i("text-keep-upright");
invoke(mapboxMap, (uiController, mapboxMap) -> {
assertNotNull(layer);
- assertNull((Boolean) layer.getTextKeepUpright().getValue());
+ assertNull(layer.getTextKeepUpright().getValue());
// Set and Get
- layer.setProperties(textKeepUpright(true));
- assertEquals((Boolean) layer.getTextKeepUpright().getValue(), (Boolean) true);
+ Boolean propertyValue = true;
+ layer.setProperties(textKeepUpright(propertyValue));
+ assertEquals(layer.getTextKeepUpright().getValue(), propertyValue);
});
}
@@ -831,11 +826,12 @@ public class SymbolLayerTest extends BaseActivityTest {
Timber.i("text-transform");
invoke(mapboxMap, (uiController, mapboxMap) -> {
assertNotNull(layer);
- assertNull((String) layer.getTextTransform().getValue());
+ assertNull(layer.getTextTransform().getValue());
// Set and Get
- layer.setProperties(textTransform(TEXT_TRANSFORM_NONE));
- assertEquals((String) layer.getTextTransform().getValue(), (String) TEXT_TRANSFORM_NONE);
+ String propertyValue = TEXT_TRANSFORM_NONE;
+ layer.setProperties(textTransform(propertyValue));
+ assertEquals(layer.getTextTransform().getValue(), propertyValue);
});
}
@@ -862,11 +858,12 @@ public class SymbolLayerTest extends BaseActivityTest {
Timber.i("text-offset");
invoke(mapboxMap, (uiController, mapboxMap) -> {
assertNotNull(layer);
- assertNull((Float[]) layer.getTextOffset().getValue());
+ assertNull(layer.getTextOffset().getValue());
// Set and Get
- layer.setProperties(textOffset(new Float[] {0f, 0f}));
- assertEquals((Float[]) layer.getTextOffset().getValue(), (Float[]) new Float[] {0f, 0f});
+ Float[] propertyValue = new Float[] {0f, 0f};
+ layer.setProperties(textOffset(propertyValue));
+ assertEquals(layer.getTextOffset().getValue(), propertyValue);
});
}
@@ -877,11 +874,12 @@ public class SymbolLayerTest extends BaseActivityTest {
Timber.i("text-allow-overlap");
invoke(mapboxMap, (uiController, mapboxMap) -> {
assertNotNull(layer);
- assertNull((Boolean) layer.getTextAllowOverlap().getValue());
+ assertNull(layer.getTextAllowOverlap().getValue());
// Set and Get
- layer.setProperties(textAllowOverlap(true));
- assertEquals((Boolean) layer.getTextAllowOverlap().getValue(), (Boolean) true);
+ Boolean propertyValue = true;
+ layer.setProperties(textAllowOverlap(propertyValue));
+ assertEquals(layer.getTextAllowOverlap().getValue(), propertyValue);
});
}
@@ -892,11 +890,12 @@ public class SymbolLayerTest extends BaseActivityTest {
Timber.i("text-ignore-placement");
invoke(mapboxMap, (uiController, mapboxMap) -> {
assertNotNull(layer);
- assertNull((Boolean) layer.getTextIgnorePlacement().getValue());
+ assertNull(layer.getTextIgnorePlacement().getValue());
// Set and Get
- layer.setProperties(textIgnorePlacement(true));
- assertEquals((Boolean) layer.getTextIgnorePlacement().getValue(), (Boolean) true);
+ Boolean propertyValue = true;
+ layer.setProperties(textIgnorePlacement(propertyValue));
+ assertEquals(layer.getTextIgnorePlacement().getValue(), propertyValue);
});
}
@@ -907,11 +906,12 @@ public class SymbolLayerTest extends BaseActivityTest {
Timber.i("text-optional");
invoke(mapboxMap, (uiController, mapboxMap) -> {
assertNotNull(layer);
- assertNull((Boolean) layer.getTextOptional().getValue());
+ assertNull(layer.getTextOptional().getValue());
// Set and Get
- layer.setProperties(textOptional(true));
- assertEquals((Boolean) layer.getTextOptional().getValue(), (Boolean) true);
+ Boolean propertyValue = true;
+ layer.setProperties(textOptional(propertyValue));
+ assertEquals(layer.getTextOptional().getValue(), propertyValue);
});
}
@@ -937,11 +937,12 @@ public class SymbolLayerTest extends BaseActivityTest {
Timber.i("icon-opacity");
invoke(mapboxMap, (uiController, mapboxMap) -> {
assertNotNull(layer);
- assertNull((Float) layer.getIconOpacity().getValue());
+ assertNull(layer.getIconOpacity().getValue());
// Set and Get
- layer.setProperties(iconOpacity(0.3f));
- assertEquals((Float) layer.getIconOpacity().getValue(), (Float) 0.3f);
+ Float propertyValue = 0.3f;
+ layer.setProperties(iconOpacity(propertyValue));
+ assertEquals(layer.getIconOpacity().getValue(), propertyValue);
});
}
@@ -983,11 +984,12 @@ public class SymbolLayerTest extends BaseActivityTest {
Timber.i("icon-color");
invoke(mapboxMap, (uiController, mapboxMap) -> {
assertNotNull(layer);
- assertNull((String) layer.getIconColor().getValue());
+ assertNull(layer.getIconColor().getValue());
// Set and Get
- layer.setProperties(iconColor("rgba(0, 0, 0, 1)"));
- assertEquals((String) layer.getIconColor().getValue(), (String) "rgba(0, 0, 0, 1)");
+ String propertyValue = "rgba(0, 0, 0, 1)";
+ layer.setProperties(iconColor(propertyValue));
+ assertEquals(layer.getIconColor().getValue(), propertyValue);
});
}
@@ -1043,11 +1045,12 @@ public class SymbolLayerTest extends BaseActivityTest {
Timber.i("icon-halo-color");
invoke(mapboxMap, (uiController, mapboxMap) -> {
assertNotNull(layer);
- assertNull((String) layer.getIconHaloColor().getValue());
+ assertNull(layer.getIconHaloColor().getValue());
// Set and Get
- layer.setProperties(iconHaloColor("rgba(0, 0, 0, 1)"));
- assertEquals((String) layer.getIconHaloColor().getValue(), (String) "rgba(0, 0, 0, 1)");
+ String propertyValue = "rgba(0, 0, 0, 1)";
+ layer.setProperties(iconHaloColor(propertyValue));
+ assertEquals(layer.getIconHaloColor().getValue(), propertyValue);
});
}
@@ -1103,11 +1106,12 @@ public class SymbolLayerTest extends BaseActivityTest {
Timber.i("icon-halo-width");
invoke(mapboxMap, (uiController, mapboxMap) -> {
assertNotNull(layer);
- assertNull((Float) layer.getIconHaloWidth().getValue());
+ assertNull(layer.getIconHaloWidth().getValue());
// Set and Get
- layer.setProperties(iconHaloWidth(0.3f));
- assertEquals((Float) layer.getIconHaloWidth().getValue(), (Float) 0.3f);
+ Float propertyValue = 0.3f;
+ layer.setProperties(iconHaloWidth(propertyValue));
+ assertEquals(layer.getIconHaloWidth().getValue(), propertyValue);
});
}
@@ -1149,11 +1153,12 @@ public class SymbolLayerTest extends BaseActivityTest {
Timber.i("icon-halo-blur");
invoke(mapboxMap, (uiController, mapboxMap) -> {
assertNotNull(layer);
- assertNull((Float) layer.getIconHaloBlur().getValue());
+ assertNull(layer.getIconHaloBlur().getValue());
// Set and Get
- layer.setProperties(iconHaloBlur(0.3f));
- assertEquals((Float) layer.getIconHaloBlur().getValue(), (Float) 0.3f);
+ Float propertyValue = 0.3f;
+ layer.setProperties(iconHaloBlur(propertyValue));
+ assertEquals(layer.getIconHaloBlur().getValue(), propertyValue);
});
}
@@ -1195,11 +1200,12 @@ public class SymbolLayerTest extends BaseActivityTest {
Timber.i("icon-translate");
invoke(mapboxMap, (uiController, mapboxMap) -> {
assertNotNull(layer);
- assertNull((Float[]) layer.getIconTranslate().getValue());
+ assertNull(layer.getIconTranslate().getValue());
// Set and Get
- layer.setProperties(iconTranslate(new Float[] {0f, 0f}));
- assertEquals((Float[]) layer.getIconTranslate().getValue(), (Float[]) new Float[] {0f, 0f});
+ Float[] propertyValue = new Float[] {0f, 0f};
+ layer.setProperties(iconTranslate(propertyValue));
+ assertEquals(layer.getIconTranslate().getValue(), propertyValue);
});
}
@@ -1210,11 +1216,12 @@ public class SymbolLayerTest extends BaseActivityTest {
Timber.i("icon-translate-anchor");
invoke(mapboxMap, (uiController, mapboxMap) -> {
assertNotNull(layer);
- assertNull((String) layer.getIconTranslateAnchor().getValue());
+ assertNull(layer.getIconTranslateAnchor().getValue());
// Set and Get
- layer.setProperties(iconTranslateAnchor(ICON_TRANSLATE_ANCHOR_MAP));
- assertEquals((String) layer.getIconTranslateAnchor().getValue(), (String) ICON_TRANSLATE_ANCHOR_MAP);
+ String propertyValue = ICON_TRANSLATE_ANCHOR_MAP;
+ layer.setProperties(iconTranslateAnchor(propertyValue));
+ assertEquals(layer.getIconTranslateAnchor().getValue(), propertyValue);
});
}
@@ -1240,11 +1247,12 @@ public class SymbolLayerTest extends BaseActivityTest {
Timber.i("text-opacity");
invoke(mapboxMap, (uiController, mapboxMap) -> {
assertNotNull(layer);
- assertNull((Float) layer.getTextOpacity().getValue());
+ assertNull(layer.getTextOpacity().getValue());
// Set and Get
- layer.setProperties(textOpacity(0.3f));
- assertEquals((Float) layer.getTextOpacity().getValue(), (Float) 0.3f);
+ Float propertyValue = 0.3f;
+ layer.setProperties(textOpacity(propertyValue));
+ assertEquals(layer.getTextOpacity().getValue(), propertyValue);
});
}
@@ -1286,11 +1294,12 @@ public class SymbolLayerTest extends BaseActivityTest {
Timber.i("text-color");
invoke(mapboxMap, (uiController, mapboxMap) -> {
assertNotNull(layer);
- assertNull((String) layer.getTextColor().getValue());
+ assertNull(layer.getTextColor().getValue());
// Set and Get
- layer.setProperties(textColor("rgba(0, 0, 0, 1)"));
- assertEquals((String) layer.getTextColor().getValue(), (String) "rgba(0, 0, 0, 1)");
+ String propertyValue = "rgba(0, 0, 0, 1)";
+ layer.setProperties(textColor(propertyValue));
+ assertEquals(layer.getTextColor().getValue(), propertyValue);
});
}
@@ -1346,11 +1355,12 @@ public class SymbolLayerTest extends BaseActivityTest {
Timber.i("text-halo-color");
invoke(mapboxMap, (uiController, mapboxMap) -> {
assertNotNull(layer);
- assertNull((String) layer.getTextHaloColor().getValue());
+ assertNull(layer.getTextHaloColor().getValue());
// Set and Get
- layer.setProperties(textHaloColor("rgba(0, 0, 0, 1)"));
- assertEquals((String) layer.getTextHaloColor().getValue(), (String) "rgba(0, 0, 0, 1)");
+ String propertyValue = "rgba(0, 0, 0, 1)";
+ layer.setProperties(textHaloColor(propertyValue));
+ assertEquals(layer.getTextHaloColor().getValue(), propertyValue);
});
}
@@ -1406,11 +1416,12 @@ public class SymbolLayerTest extends BaseActivityTest {
Timber.i("text-halo-width");
invoke(mapboxMap, (uiController, mapboxMap) -> {
assertNotNull(layer);
- assertNull((Float) layer.getTextHaloWidth().getValue());
+ assertNull(layer.getTextHaloWidth().getValue());
// Set and Get
- layer.setProperties(textHaloWidth(0.3f));
- assertEquals((Float) layer.getTextHaloWidth().getValue(), (Float) 0.3f);
+ Float propertyValue = 0.3f;
+ layer.setProperties(textHaloWidth(propertyValue));
+ assertEquals(layer.getTextHaloWidth().getValue(), propertyValue);
});
}
@@ -1452,11 +1463,12 @@ public class SymbolLayerTest extends BaseActivityTest {
Timber.i("text-halo-blur");
invoke(mapboxMap, (uiController, mapboxMap) -> {
assertNotNull(layer);
- assertNull((Float) layer.getTextHaloBlur().getValue());
+ assertNull(layer.getTextHaloBlur().getValue());
// Set and Get
- layer.setProperties(textHaloBlur(0.3f));
- assertEquals((Float) layer.getTextHaloBlur().getValue(), (Float) 0.3f);
+ Float propertyValue = 0.3f;
+ layer.setProperties(textHaloBlur(propertyValue));
+ assertEquals(layer.getTextHaloBlur().getValue(), propertyValue);
});
}
@@ -1498,11 +1510,12 @@ public class SymbolLayerTest extends BaseActivityTest {
Timber.i("text-translate");
invoke(mapboxMap, (uiController, mapboxMap) -> {
assertNotNull(layer);
- assertNull((Float[]) layer.getTextTranslate().getValue());
+ assertNull(layer.getTextTranslate().getValue());
// Set and Get
- layer.setProperties(textTranslate(new Float[] {0f, 0f}));
- assertEquals((Float[]) layer.getTextTranslate().getValue(), (Float[]) new Float[] {0f, 0f});
+ Float[] propertyValue = new Float[] {0f, 0f};
+ layer.setProperties(textTranslate(propertyValue));
+ assertEquals(layer.getTextTranslate().getValue(), propertyValue);
});
}
@@ -1513,11 +1526,12 @@ public class SymbolLayerTest extends BaseActivityTest {
Timber.i("text-translate-anchor");
invoke(mapboxMap, (uiController, mapboxMap) -> {
assertNotNull(layer);
- assertNull((String) layer.getTextTranslateAnchor().getValue());
+ assertNull(layer.getTextTranslateAnchor().getValue());
// Set and Get
- layer.setProperties(textTranslateAnchor(TEXT_TRANSLATE_ANCHOR_MAP));
- assertEquals((String) layer.getTextTranslateAnchor().getValue(), (String) TEXT_TRANSLATE_ANCHOR_MAP);
+ String propertyValue = TEXT_TRANSLATE_ANCHOR_MAP;
+ layer.setProperties(textTranslateAnchor(propertyValue));
+ assertEquals(layer.getTextTranslateAnchor().getValue(), propertyValue);
});
}
}
diff --git a/platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/testapp/style/layer.junit.ejs b/platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/testapp/style/layer.junit.ejs
index aca6bbd0ec..2b3c09a34b 100644
--- a/platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/testapp/style/layer.junit.ejs
+++ b/platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/testapp/style/layer.junit.ejs
@@ -167,48 +167,29 @@ public class <%- camelize(type) %>LayerTest extends BaseActivityTest {
Timber.i("<%- property.name %>");
invoke(mapboxMap, (uiController, mapboxMap) -> {
assertNotNull(layer);
- assertNull((<%- propertyType(property) %>) layer.get<%- camelize(property.name) %>().getValue());
+ assertNull(layer.get<%- camelize(property.name) %>().getValue());
// Set and Get
- layer.setProperties(<%- camelizeWithLeadingLowercase(property.name) %>(<%- defaultValueJava(property) %>));
- assertEquals((<%- propertyType(property) %>) layer.get<%- camelize(property.name) %>().getValue(), (<%- propertyType(property) %>) <%- defaultValueJava(property) %>);
+ <%- propertyType(property) %> propertyValue = <%- defaultValueJava(property) %>;
+<% if (property.type === 'formatted') { -%>
+
+ layer.setProperties(<%- camelizeWithLeadingLowercase(property.name) %>("default"));
+ assertEquals(layer.get<%- camelize(property.name) %>().getValue(), propertyValue);
+<% } else {-%>
+ layer.setProperties(<%- camelizeWithLeadingLowercase(property.name) %>(propertyValue));
+ assertEquals(layer.get<%- camelize(property.name) %>().getValue(), propertyValue);
+<% } -%>
<% if (property.tokens) { -%>
layer.setProperties(<%- camelizeWithLeadingLowercase(property.name) %>("{token}"));
<% if (property.type === 'formatted') { -%>
- assertEquals(layer.getTextField().getExpression(), Expression.format(Expression.formatEntry(Expression.toString(Expression.get("token")))));
+ assertEquals(layer.get<%- camelize(property.name) %>().getExpression(), <%- defaultExpressionJava(property) %>(Expression.formatEntry(Expression.toString(Expression.get("token")))));
<% } else {-%>
assertEquals(layer.get<%- camelize(property.name) %>().getExpression(), Expression.toString(Expression.get("token")));
<% } -%>
<% } -%>
});
}
-<% if (property.name === 'text-field' && property.type === 'formatted') { -%>
-
- @Test
- public void testFormatted<%- camelize(property.name) %>AsConstant() {
- validateTestSetup();
- setupLayer();
- Timber.i("<%- property.name %>-formatted");
- invoke(mapboxMap, (uiController, mapboxMap) -> {
- assertNotNull(layer);
- assertNull((<%- propertyType(property) %>) layer.get<%- camelize(property.name) %>().getValue());
-
- Formatted expected = new Formatted(new FormattedSection[] {
- new FormattedSection("", 1.0)
- });
-
- // Set and Get
- layer.setProperties(<%- camelizeWithLeadingLowercase(property.name) %>(<%- defaultValueJava(property) %>));
- assertEquals(layer.getFormatted<%- camelize(property.name) %>().getValue(), expected/*(<%- propertyType(property) %>) <%- defaultValueJava(property) %>*/);
-<% if (property.tokens) { -%>
-
- layer.setProperties(<%- camelizeWithLeadingLowercase(property.name) %>("{token}"));
- assertEquals(layer.getFormattedTextField().getExpression(), Expression.format(Expression.formatEntry(Expression.toString(Expression.get("token")))));
-<% } -%>
- });
- }
-<% } -%>
<% if (property['property-type'] === 'data-driven' || property['property-type'] === 'cross-faded-data-driven') { -%>
<% if (!(property.name.endsWith("-font")||property.name.endsWith("-offset"))) { -%>
@@ -222,35 +203,17 @@ public class <%- camelize(type) %>LayerTest extends BaseActivityTest {
assertNull(layer.get<%- camelize(property.name) %>().getExpression());
// Set and Get
- Expression expression = <%- defaultExpressionJava(property) %>(Expression.get("undefined"));
- layer.setProperties(<%- camelizeWithLeadingLowercase(property.name) %>(expression));
<% if (property.type === 'formatted') { -%>
- assertEquals(layer.getTextField().getExpression(), Expression.format(Expression.formatEntry(expression)));
+ Expression expression = <%- defaultExpressionJava(property) %>(Expression.formatEntry(Expression.get("undefined"), FormatOption.formatFontScale(2.0), FormatOption.formatTextFont(new String[]{"Open Sans Regular", "Arial Unicode MS Regular"})));
<% } else { -%>
- assertEquals(layer.get<%- camelize(property.name) %>().getExpression(), expression);
-<% } -%>
- });
- }
-<% if (property.name === 'text-field' && property.type === 'formatted') { -%>
-
- @Test
- public void testFormatted<%- camelize(property.name) %>AsExpression() {
- validateTestSetup();
- setupLayer();
- Timber.i("<%- property.name %>-formatted-expression");
- invoke(mapboxMap, (uiController, mapboxMap) -> {
- assertNotNull(layer);
- assertNull(layer.get<%- camelize(property.name) %>().getExpression());
-
- // Set and Get
Expression expression = <%- defaultExpressionJava(property) %>(Expression.get("undefined"));
+<% } -%>
layer.setProperties(<%- camelizeWithLeadingLowercase(property.name) %>(expression));
- assertEquals(layer.getFormattedTextField().getExpression(), Expression.format(Expression.formatEntry(Expression.string(Expression.get("undefined")))));
+ assertEquals(layer.get<%- camelize(property.name) %>().getExpression(), expression);
});
}
<% } -%>
<% } -%>
-<% } -%>
<% if (property.type == 'color') { -%>
@Test
diff --git a/platform/android/scripts/generate-style-code.js b/platform/android/scripts/generate-style-code.js
index 4a35b2d6a6..da29c0363c 100755
--- a/platform/android/scripts/generate-style-code.js
+++ b/platform/android/scripts/generate-style-code.js
@@ -56,6 +56,7 @@ global.propertyType = function propertyType(property) {
case 'number':
return 'Float';
case 'formatted':
+ return 'Formatted';
case 'string':
return 'String';
case 'enum':
@@ -76,6 +77,7 @@ global.propertyJavaType = function propertyType(property) {
case 'number':
return 'float';
case 'formatted':
+ return 'Formatted';
case 'string':
return 'String';
case 'enum':
@@ -159,6 +161,7 @@ global.defaultExpressionJava = function(property) {
case 'number':
return 'number';
case 'formatted':
+ return 'format';
case 'string':
return "string";
case 'enum':
@@ -184,6 +187,7 @@ global.defaultValueJava = function(property) {
case 'number':
return '0.3f';
case 'formatted':
+ return 'new Formatted(new FormattedSection[]{new FormattedSection("default")})'
case 'string':
return '"' + property['default'] + '"';
case 'enum':
@@ -192,7 +196,6 @@ global.defaultValueJava = function(property) {
return '"rgba(0, 0, 0, 1)"';
case 'array':
switch (property.value) {
- case 'formatted':
case 'string':
return '[' + property['default'] + "]";
case 'number':
diff --git a/platform/android/src/style/formatted.cpp b/platform/android/src/style/formatted.cpp
index ecbc7be1c8..8659e6961e 100644
--- a/platform/android/src/style/formatted.cpp
+++ b/platform/android/src/style/formatted.cpp
@@ -18,21 +18,28 @@ jni::Local<jni::Object<Formatted>> Formatted::New(jni::JNIEnv& env, const style:
auto section = value.sections.at(i);
auto text = jni::Make<jni::String>(env, section.text);
- double fontScale = 1.0;
- if (section.fontScale) {
- fontScale = section.fontScale.value();
- }
-
- if (section.fontStack) {
+ if (section.fontStack && section.fontScale) {
+ double fontScale = section.fontScale.value();
+ auto fontStack = jni::Array<jni::String>::New(env, section.fontStack.value().size());
+ for (std::size_t j = 0; j < section.fontStack.value().size(); j++) {
+ fontStack.Set(env, j, jni::Make<jni::String>(env, section.fontStack.value().at(j)));
+ }
+ static auto formattedSectionConstructor = formattedSection.GetConstructor<jni::String, jni::Number, jni::Array<jni::String>>(env);
+ sections.Set(env, i, formattedSection.New(env, formattedSectionConstructor, text, jni::Box(env, fontScale), fontStack));
+ } else if (section.fontScale) {
+ double fontScale = section.fontScale.value();
+ static auto formattedSectionConstructor = formattedSection.GetConstructor<jni::String, jni::Number>(env);
+ sections.Set(env, i, formattedSection.New(env, formattedSectionConstructor, text, jni::Box(env, fontScale)));
+ } else if (section.fontStack) {
auto fontStack = jni::Array<jni::String>::New(env, section.fontStack.value().size());
for (std::size_t j = 0; j < section.fontStack.value().size(); j++) {
fontStack.Set(env, j, jni::Make<jni::String>(env, section.fontStack.value().at(j)));
}
- static auto formattedSectionConstructor = formattedSection.GetConstructor<jni::String, double, jni::Array<jni::String>>(env);
- sections.Set(env, i, formattedSection.New(env, formattedSectionConstructor, text, fontScale, fontStack));
+ static auto formattedSectionConstructor = formattedSection.GetConstructor<jni::String, jni::Array<jni::String>>(env);
+ sections.Set(env, i, formattedSection.New(env, formattedSectionConstructor, text, fontStack));
} else {
- static auto formattedSectionConstructor = formattedSection.GetConstructor<jni::String, double>(env);
- sections.Set(env, i, formattedSection.New(env, formattedSectionConstructor, text, fontScale));
+ static auto formattedSectionConstructor = formattedSection.GetConstructor<jni::String>(env);
+ sections.Set(env, i, formattedSection.New(env, formattedSectionConstructor, text));
}
}