[core][android][macos][ios] Implement property functions for line-join, text-justify, text-anchor (#9583)

This commit is contained in:
Lauren Budorick
2017-07-26 13:18:47 -07:00
committed by GitHub
parent c5a5b40837
commit a8ef2af353
25 changed files with 352 additions and 158 deletions

View File

@@ -203,6 +203,63 @@ public class LineLayerTest extends BaseActivityTest {
});
}
@Test
public void testLineJoinAsIdentitySourceFunction() {
validateTestSetup();
setupLayer();
Timber.i("line-join");
invoke(mapboxMap, new MapboxMapAction.OnInvokeActionListener() {
@Override
public void onInvokeAction(UiController uiController, MapboxMap mapboxMap) {
assertNotNull(layer);
// Set
layer.setProperties(
lineJoin(property("FeaturePropertyA", Stops.<String>identity()))
);
// Verify
assertNotNull(layer.getLineJoin());
assertNotNull(layer.getLineJoin().getFunction());
assertEquals(SourceFunction.class, layer.getLineJoin().getFunction().getClass());
assertEquals("FeaturePropertyA", ((SourceFunction) layer.getLineJoin().getFunction()).getProperty());
assertEquals(IdentityStops.class, layer.getLineJoin().getFunction().getStops().getClass());
}
});
}
@Test
public void testLineJoinAsIntervalSourceFunction() {
validateTestSetup();
setupLayer();
Timber.i("line-join");
invoke(mapboxMap, new MapboxMapAction.OnInvokeActionListener() {
@Override
public void onInvokeAction(UiController uiController, MapboxMap mapboxMap) {
assertNotNull(layer);
// Set
layer.setProperties(
lineJoin(
property(
"FeaturePropertyA",
interval(
stop(1, lineJoin(LINE_JOIN_BEVEL))
)
)
)
);
// Verify
assertNotNull(layer.getLineJoin());
assertNotNull(layer.getLineJoin().getFunction());
assertEquals(SourceFunction.class, layer.getLineJoin().getFunction().getClass());
assertEquals("FeaturePropertyA", ((SourceFunction) layer.getLineJoin().getFunction()).getProperty());
assertEquals(IntervalStops.class, layer.getLineJoin().getFunction().getStops().getClass());
}
});
}
@Test
public void testLineMiterLimitAsConstant() {
validateTestSetup();

View File

@@ -1887,6 +1887,63 @@ public class SymbolLayerTest extends BaseActivityTest {
});
}
@Test
public void testTextJustifyAsIdentitySourceFunction() {
validateTestSetup();
setupLayer();
Timber.i("text-justify");
invoke(mapboxMap, new MapboxMapAction.OnInvokeActionListener() {
@Override
public void onInvokeAction(UiController uiController, MapboxMap mapboxMap) {
assertNotNull(layer);
// Set
layer.setProperties(
textJustify(property("FeaturePropertyA", Stops.<String>identity()))
);
// Verify
assertNotNull(layer.getTextJustify());
assertNotNull(layer.getTextJustify().getFunction());
assertEquals(SourceFunction.class, layer.getTextJustify().getFunction().getClass());
assertEquals("FeaturePropertyA", ((SourceFunction) layer.getTextJustify().getFunction()).getProperty());
assertEquals(IdentityStops.class, layer.getTextJustify().getFunction().getStops().getClass());
}
});
}
@Test
public void testTextJustifyAsIntervalSourceFunction() {
validateTestSetup();
setupLayer();
Timber.i("text-justify");
invoke(mapboxMap, new MapboxMapAction.OnInvokeActionListener() {
@Override
public void onInvokeAction(UiController uiController, MapboxMap mapboxMap) {
assertNotNull(layer);
// Set
layer.setProperties(
textJustify(
property(
"FeaturePropertyA",
interval(
stop(1, textJustify(TEXT_JUSTIFY_LEFT))
)
)
)
);
// Verify
assertNotNull(layer.getTextJustify());
assertNotNull(layer.getTextJustify().getFunction());
assertEquals(SourceFunction.class, layer.getTextJustify().getFunction().getClass());
assertEquals("FeaturePropertyA", ((SourceFunction) layer.getTextJustify().getFunction()).getProperty());
assertEquals(IntervalStops.class, layer.getTextJustify().getFunction().getStops().getClass());
}
});
}
@Test
public void testTextAnchorAsConstant() {
validateTestSetup();
@@ -1935,6 +1992,63 @@ public class SymbolLayerTest extends BaseActivityTest {
});
}
@Test
public void testTextAnchorAsIdentitySourceFunction() {
validateTestSetup();
setupLayer();
Timber.i("text-anchor");
invoke(mapboxMap, new MapboxMapAction.OnInvokeActionListener() {
@Override
public void onInvokeAction(UiController uiController, MapboxMap mapboxMap) {
assertNotNull(layer);
// Set
layer.setProperties(
textAnchor(property("FeaturePropertyA", Stops.<String>identity()))
);
// Verify
assertNotNull(layer.getTextAnchor());
assertNotNull(layer.getTextAnchor().getFunction());
assertEquals(SourceFunction.class, layer.getTextAnchor().getFunction().getClass());
assertEquals("FeaturePropertyA", ((SourceFunction) layer.getTextAnchor().getFunction()).getProperty());
assertEquals(IdentityStops.class, layer.getTextAnchor().getFunction().getStops().getClass());
}
});
}
@Test
public void testTextAnchorAsIntervalSourceFunction() {
validateTestSetup();
setupLayer();
Timber.i("text-anchor");
invoke(mapboxMap, new MapboxMapAction.OnInvokeActionListener() {
@Override
public void onInvokeAction(UiController uiController, MapboxMap mapboxMap) {
assertNotNull(layer);
// Set
layer.setProperties(
textAnchor(
property(
"FeaturePropertyA",
interval(
stop(1, textAnchor(TEXT_ANCHOR_CENTER))
)
)
)
);
// Verify
assertNotNull(layer.getTextAnchor());
assertNotNull(layer.getTextAnchor().getFunction());
assertEquals(SourceFunction.class, layer.getTextAnchor().getFunction().getClass());
assertEquals("FeaturePropertyA", ((SourceFunction) layer.getTextAnchor().getFunction()).getProperty());
assertEquals(IntervalStops.class, layer.getTextAnchor().getFunction().getStops().getClass());
}
});
}
@Test
public void testTextMaxAngleAsConstant() {
validateTestSetup();