[core] Enable property functions for text-{field,transform} (#7944)
This commit is contained in:
committed by
John Firebaugh
parent
d4c569a018
commit
062b18374d
@@ -886,6 +886,51 @@ public class SymbolLayerTest extends BaseStyleTest {
|
||||
assertEquals(1, ((IntervalStops) layer.getTextField().getFunction().getStops()).size());
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testTextFieldAsIdentitySourceFunction() {
|
||||
checkViewIsDisplayed(R.id.mapView);
|
||||
Timber.i("text-field");
|
||||
assertNotNull(layer);
|
||||
|
||||
// Set
|
||||
layer.setProperties(
|
||||
textField(property("FeaturePropertyA", Stops.<String>identity()))
|
||||
);
|
||||
|
||||
// Verify
|
||||
assertNotNull(layer.getTextField());
|
||||
assertNotNull(layer.getTextField().getFunction());
|
||||
assertEquals(SourceFunction.class, layer.getTextField().getFunction().getClass());
|
||||
assertEquals("FeaturePropertyA", ((SourceFunction) layer.getTextField().getFunction()).getProperty());
|
||||
assertEquals(IdentityStops.class, layer.getTextField().getFunction().getStops().getClass());
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testTextFieldAsIntervalSourceFunction() {
|
||||
checkViewIsDisplayed(R.id.mapView);
|
||||
Timber.i("text-field");
|
||||
assertNotNull(layer);
|
||||
|
||||
// Set
|
||||
layer.setProperties(
|
||||
textField(
|
||||
property(
|
||||
"FeaturePropertyA",
|
||||
interval(
|
||||
stop(1, textField(""))
|
||||
)
|
||||
)
|
||||
)
|
||||
);
|
||||
|
||||
// Verify
|
||||
assertNotNull(layer.getTextField());
|
||||
assertNotNull(layer.getTextField().getFunction());
|
||||
assertEquals(SourceFunction.class, layer.getTextField().getFunction().getClass());
|
||||
assertEquals("FeaturePropertyA", ((SourceFunction) layer.getTextField().getFunction()).getProperty());
|
||||
assertEquals(IdentityStops.class, layer.getTextField().getFunction().getStops().getClass());
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testTextFontAsConstant() {
|
||||
checkViewIsDisplayed(R.id.mapView);
|
||||
@@ -1325,6 +1370,51 @@ public class SymbolLayerTest extends BaseStyleTest {
|
||||
assertEquals(1, ((IntervalStops) layer.getTextTransform().getFunction().getStops()).size());
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testTextTransformAsIdentitySourceFunction() {
|
||||
checkViewIsDisplayed(R.id.mapView);
|
||||
Timber.i("text-transform");
|
||||
assertNotNull(layer);
|
||||
|
||||
// Set
|
||||
layer.setProperties(
|
||||
textTransform(property("FeaturePropertyA", Stops.<String>identity()))
|
||||
);
|
||||
|
||||
// Verify
|
||||
assertNotNull(layer.getTextTransform());
|
||||
assertNotNull(layer.getTextTransform().getFunction());
|
||||
assertEquals(SourceFunction.class, layer.getTextTransform().getFunction().getClass());
|
||||
assertEquals("FeaturePropertyA", ((SourceFunction) layer.getTextTransform().getFunction()).getProperty());
|
||||
assertEquals(IdentityStops.class, layer.getTextTransform().getFunction().getStops().getClass());
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testTextTransformAsIntervalSourceFunction() {
|
||||
checkViewIsDisplayed(R.id.mapView);
|
||||
Timber.i("text-transform");
|
||||
assertNotNull(layer);
|
||||
|
||||
// Set
|
||||
layer.setProperties(
|
||||
textTransform(
|
||||
property(
|
||||
"FeaturePropertyA",
|
||||
interval(
|
||||
stop(1, textTransform(TEXT_TRANSFORM_NONE))
|
||||
)
|
||||
)
|
||||
)
|
||||
);
|
||||
|
||||
// Verify
|
||||
assertNotNull(layer.getTextTransform());
|
||||
assertNotNull(layer.getTextTransform().getFunction());
|
||||
assertEquals(SourceFunction.class, layer.getTextTransform().getFunction().getClass());
|
||||
assertEquals("FeaturePropertyA", ((SourceFunction) layer.getTextTransform().getFunction()).getProperty());
|
||||
assertEquals(IdentityStops.class, layer.getTextTransform().getFunction().getStops().getClass());
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testTextOffsetAsConstant() {
|
||||
checkViewIsDisplayed(R.id.mapView);
|
||||
|
||||
@@ -177,9 +177,9 @@ public class <%- camelize(type) %>LayerTest extends BaseStyleTest {
|
||||
<% if (property.type == 'color') { -%>
|
||||
stop(Color.RED, <%- camelizeWithLeadingLowercase(property.name) %>(Color.RED))
|
||||
<% } else {-%>
|
||||
1, <%- camelizeWithLeadingLowercase(property.name) %>(<%- defaultValueJava(property) %>))
|
||||
<% } -%>
|
||||
stop(1, <%- camelizeWithLeadingLowercase(property.name) %>(<%- defaultValueJava(property) %>))
|
||||
)
|
||||
<% } -%>
|
||||
)
|
||||
)
|
||||
);
|
||||
|
||||
Reference in New Issue
Block a user