Skip to content
This repository has been archived by the owner on Aug 8, 2023. It is now read-only.

Commit

Permalink
[android] - expose source layer identifier
Browse files Browse the repository at this point in the history
  • Loading branch information
tobrun committed Apr 13, 2017
1 parent 0810192 commit da28a2f
Show file tree
Hide file tree
Showing 17 changed files with 168 additions and 54 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,15 @@ public CircleLayer withSourceLayer(String sourceLayer) {
return this;
}

/**
* Get the source layer.
*
* @return sourceLayer the source layer to get
*/
public String getSourceLayer() {
return nativeGetSourceLayer();
}

/**
* Set a single filter.
*
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,15 @@ public FillLayer withSourceLayer(String sourceLayer) {
return this;
}

/**
* Get the source layer.
*
* @return sourceLayer the source layer to get
*/
public String getSourceLayer() {
return nativeGetSourceLayer();
}

/**
* Set a single filter.
*
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,8 @@ public void setMaxZoom(float zoom) {

protected native void nativeSetSourceLayer(String sourceLayer);

protected native String nativeGetSourceLayer();

protected native float nativeGetMinZoom();

protected native float nativeGetMaxZoom();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,15 @@ public LineLayer withSourceLayer(String sourceLayer) {
return this;
}

/**
* Get the source layer.
*
* @return sourceLayer the source layer to get
*/
public String getSourceLayer() {
return nativeGetSourceLayer();
}

/**
* Set a single filter.
*
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,15 @@ public SymbolLayer withSourceLayer(String sourceLayer) {
return this;
}

/**
* Get the source layer.
*
* @return sourceLayer the source layer to get
*/
public String getSourceLayer() {
return nativeGetSourceLayer();
}

/**
* Set a single filter.
*
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,15 @@ public class <%- camelize(type) %>Layer extends Layer {
<% } -%>
<% if (type !== 'background' && type !== 'raster') { -%>
/**
* Get the source layer.
*
* @return sourceLayer the source layer to get
*/
public String getSourceLayer() {
return nativeGetSourceLayer();
}
/**
* Set a single filter.
*
Expand All @@ -99,7 +108,7 @@ public class <%- camelize(type) %>Layer extends Layer {
return this;
}
<% } -%>
<% } -%>
/**
* Set a property or properties.
*
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -234,7 +234,6 @@ public void testBackgroundOpacityAsCameraFunction() {
assertEquals(1, ((ExponentialStops) layer.getBackgroundOpacity().getFunction().getStops()).size());
}


@After
public void unregisterIntentServiceIdlingResource() {
Espresso.unregisterIdlingResources(idlingResource);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,21 @@ public void testSetVisibility() {
assertEquals(layer.getVisibility().getValue(), NONE);
}

@Test
public void testSourceLayer() {
checkViewIsDisplayed(R.id.mapView);
Timber.i("Visibility");
assertNotNull(layer);

// Get initial
assertEquals(layer.getSourceLayer(), "composite");

// Set
final String sourceLayer = "test";
layer.setSourceLayer(sourceLayer);
assertEquals(layer.getSourceLayer(), sourceLayer);
}

@Test
public void testCircleRadiusTransition() {
checkViewIsDisplayed(R.id.mapView);
Expand Down Expand Up @@ -737,7 +752,6 @@ public void testCircleTranslateAsCameraFunction() {
assertEquals(1, ((ExponentialStops) layer.getCircleTranslate().getFunction().getStops()).size());
}


@Test
public void testCircleTranslateAnchorAsConstant() {
checkViewIsDisplayed(R.id.mapView);
Expand Down Expand Up @@ -774,7 +788,6 @@ public void testCircleTranslateAnchorAsCameraFunction() {
assertEquals(1, ((IntervalStops) layer.getCircleTranslateAnchor().getFunction().getStops()).size());
}


@Test
public void testCirclePitchScaleAsConstant() {
checkViewIsDisplayed(R.id.mapView);
Expand Down Expand Up @@ -1259,7 +1272,6 @@ public void testCircleStrokeOpacityAsCompositeFunction() {
assertEquals(0.9f, stop.out, 0.001f);
}


@After
public void unregisterIntentServiceIdlingResource() {
Espresso.unregisterIdlingResources(idlingResource);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,20 @@ public void testSetVisibility() {
assertEquals(layer.getVisibility().getValue(), NONE);
}

@Test
public void testSourceLayer() {
checkViewIsDisplayed(R.id.mapView);
Timber.i("Visibility");
assertNotNull(layer);

// Get initial
assertEquals(layer.getSourceLayer(), "composite");

// Set
final String sourceLayer = "test";
layer.setSourceLayer(sourceLayer);
assertEquals(layer.getSourceLayer(), sourceLayer);
}

@Test
public void testFillAntialiasAsConstant() {
Expand Down Expand Up @@ -594,7 +608,6 @@ public void testFillTranslateAsCameraFunction() {
assertEquals(1, ((ExponentialStops) layer.getFillTranslate().getFunction().getStops()).size());
}


@Test
public void testFillTranslateAnchorAsConstant() {
checkViewIsDisplayed(R.id.mapView);
Expand Down Expand Up @@ -679,7 +692,6 @@ public void testFillPatternAsCameraFunction() {
assertEquals(1, ((IntervalStops) layer.getFillPattern().getFunction().getStops()).size());
}


@After
public void unregisterIntentServiceIdlingResource() {
Espresso.unregisterIdlingResources(idlingResource);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,20 @@ public void testSetVisibility() {
assertEquals(layer.getVisibility().getValue(), NONE);
}

@Test
public void testSourceLayer() {
checkViewIsDisplayed(R.id.mapView);
Timber.i("Visibility");
assertNotNull(layer);

// Get initial
assertEquals(layer.getSourceLayer(), "composite");

// Set
final String sourceLayer = "test";
layer.setSourceLayer(sourceLayer);
assertEquals(layer.getSourceLayer(), sourceLayer);
}

@Test
public void testLineCapAsConstant() {
Expand Down Expand Up @@ -120,7 +134,6 @@ public void testLineCapAsCameraFunction() {
assertEquals(1, ((IntervalStops) layer.getLineCap().getFunction().getStops()).size());
}


@Test
public void testLineJoinAsConstant() {
checkViewIsDisplayed(R.id.mapView);
Expand Down Expand Up @@ -157,7 +170,6 @@ public void testLineJoinAsCameraFunction() {
assertEquals(1, ((IntervalStops) layer.getLineJoin().getFunction().getStops()).size());
}


@Test
public void testLineMiterLimitAsConstant() {
checkViewIsDisplayed(R.id.mapView);
Expand Down Expand Up @@ -195,7 +207,6 @@ public void testLineMiterLimitAsCameraFunction() {
assertEquals(1, ((ExponentialStops) layer.getLineMiterLimit().getFunction().getStops()).size());
}


@Test
public void testLineRoundLimitAsConstant() {
checkViewIsDisplayed(R.id.mapView);
Expand Down Expand Up @@ -573,7 +584,6 @@ public void testLineTranslateAsCameraFunction() {
assertEquals(1, ((ExponentialStops) layer.getLineTranslate().getFunction().getStops()).size());
}


@Test
public void testLineTranslateAnchorAsConstant() {
checkViewIsDisplayed(R.id.mapView);
Expand Down Expand Up @@ -1226,7 +1236,6 @@ public void testLinePatternAsCameraFunction() {
assertEquals(1, ((IntervalStops) layer.getLinePattern().getFunction().getStops()).size());
}


@After
public void unregisterIntentServiceIdlingResource() {
Espresso.unregisterIdlingResources(idlingResource);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -426,7 +426,6 @@ public void testRasterFadeDurationAsCameraFunction() {
assertEquals(1, ((ExponentialStops) layer.getRasterFadeDuration().getFunction().getStops()).size());
}


@After
public void unregisterIntentServiceIdlingResource() {
Espresso.unregisterIdlingResources(idlingResource);
Expand Down
Loading

0 comments on commit da28a2f

Please sign in to comment.