[android] Test token strings for icon-image and text-field

This commit is contained in:
John Firebaugh
2018-07-19 12:08:21 -07:00
parent 2c5d0e74a1
commit 5793283142
2 changed files with 11 additions and 0 deletions

View File

@@ -272,6 +272,9 @@ public class SymbolLayerTest extends BaseActivityTest {
// Set and Get
layer.setProperties(iconImage("undefined"));
assertEquals((String) layer.getIconImage().getValue(), (String) "undefined");
layer.setProperties(iconImage("{token}"));
assertEquals(layer.getIconImage().getExpression(), Expression.toString(Expression.get("token")));
});
}
@@ -446,6 +449,9 @@ public class SymbolLayerTest extends BaseActivityTest {
// Set and Get
layer.setProperties(textField(""));
assertEquals((String) layer.getTextField().getValue(), (String) "");
layer.setProperties(textField("{token}"));
assertEquals(layer.getTextField().getExpression(), Expression.toString(Expression.get("token")));
});
}

View File

@@ -148,6 +148,11 @@ public class <%- camelize(type) %>LayerTest extends BaseActivityTest {
// Set and Get
layer.setProperties(<%- camelizeWithLeadingLowercase(property.name) %>(<%- defaultValueJava(property) %>));
assertEquals((<%- propertyType(property) %>) layer.get<%- camelize(property.name) %>().getValue(), (<%- propertyType(property) %>) <%- defaultValueJava(property) %>);
<% if (property.tokens) { -%>
layer.setProperties(<%- camelizeWithLeadingLowercase(property.name) %>("{token}"));
assertEquals(layer.get<%- camelize(property.name) %>().getExpression(), Expression.toString(Expression.get("token")));
<% } -%>
});
}
<% if (property['property-type'] === 'data-driven' || property['property-type'] === 'cross-faded-data-driven') { -%>