Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -43,13 +43,15 @@ public class <%- camelize(type) %>ManagerTest {
private Style style = mock(Style.class);
private GeoJsonSource geoJsonSource = mock(GeoJsonSource.class);
private GeoJsonSource optionedGeoJsonSource = mock(GeoJsonSource.class);
private String layerId = "annotation_layer";
private <%- camelize(type) %>Layer <%- type %>Layer = mock(<%- camelize(type) %>Layer.class);
private <%- camelize(type) %>Manager <%- type %>Manager;
private CoreElementProvider<<%- camelize(type) %>Layer> coreElementProvider = mock(CoreElementProvider.class);
private GeoJsonOptions geoJsonOptions = mock(GeoJsonOptions.class);

@Before
public void beforeTest() {
when(<%- type %>Layer.getId()).thenReturn(layerId);
when(coreElementProvider.getLayer()).thenReturn(<%- type %>Layer);
when(coreElementProvider.getSource(null)).thenReturn(geoJsonSource);
when(coreElementProvider.getSource(geoJsonOptions)).thenReturn(optionedGeoJsonSource);
Expand Down Expand Up @@ -153,6 +155,12 @@ public class <%- camelize(type) %>ManagerTest {
verify(geoJsonSource, times(1)).setGeoJson(any(FeatureCollection.class));
}

@Test
public void testLayerId() {
<%- type %>Manager = new <%- camelize(type) %>Manager(mapView, mapboxMap, style, coreElementProvider, null, null, draggableAnnotationController);
assertEquals(layerId, <%- type %>Manager.getLayerId());
}

@Test
public void testAdd<%- camelize(type) %>() {
<%- type %>Manager = new <%- camelize(type) %>Manager(mapView, mapboxMap, style, coreElementProvider, null, null, draggableAnnotationController);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -101,6 +101,17 @@ public void onStyleLoaded(@NonNull Style loadedStyle) {
});
}

/**
* Returns a layer ID that annotations created by this manager are laid out on.
*
* This reference can be used together with {@link Style#addLayerAbove(Layer, String)}
* or {@link Style#addLayerBelow(Layer, String)} to improve other layers positioning in relation to this manager.
* @return underlying layer's ID
*/
public String getLayerId() {
return layer.getId();
}

/**
* Get a list of current annotations.
*
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,13 +38,15 @@ public class CircleManagerTest {
private Style style = mock(Style.class);
private GeoJsonSource geoJsonSource = mock(GeoJsonSource.class);
private GeoJsonSource optionedGeoJsonSource = mock(GeoJsonSource.class);
private String layerId = "annotation_layer";
private CircleLayer circleLayer = mock(CircleLayer.class);
private CircleManager circleManager;
private CoreElementProvider<CircleLayer> coreElementProvider = mock(CoreElementProvider.class);
private GeoJsonOptions geoJsonOptions = mock(GeoJsonOptions.class);

@Before
public void beforeTest() {
when(circleLayer.getId()).thenReturn(layerId);
when(coreElementProvider.getLayer()).thenReturn(circleLayer);
when(coreElementProvider.getSource(null)).thenReturn(geoJsonSource);
when(coreElementProvider.getSource(geoJsonOptions)).thenReturn(optionedGeoJsonSource);
Expand Down Expand Up @@ -148,6 +150,12 @@ public void testNoUpdateOnStyleReload() {
verify(geoJsonSource, times(1)).setGeoJson(any(FeatureCollection.class));
}

@Test
public void testLayerId() {
circleManager = new CircleManager(mapView, mapboxMap, style, coreElementProvider, null, null, draggableAnnotationController);
assertEquals(layerId, circleManager.getLayerId());
}

@Test
public void testAddCircle() {
circleManager = new CircleManager(mapView, mapboxMap, style, coreElementProvider, null, null, draggableAnnotationController);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,13 +38,15 @@ public class FillManagerTest {
private Style style = mock(Style.class);
private GeoJsonSource geoJsonSource = mock(GeoJsonSource.class);
private GeoJsonSource optionedGeoJsonSource = mock(GeoJsonSource.class);
private String layerId = "annotation_layer";
private FillLayer fillLayer = mock(FillLayer.class);
private FillManager fillManager;
private CoreElementProvider<FillLayer> coreElementProvider = mock(CoreElementProvider.class);
private GeoJsonOptions geoJsonOptions = mock(GeoJsonOptions.class);

@Before
public void beforeTest() {
when(fillLayer.getId()).thenReturn(layerId);
when(coreElementProvider.getLayer()).thenReturn(fillLayer);
when(coreElementProvider.getSource(null)).thenReturn(geoJsonSource);
when(coreElementProvider.getSource(geoJsonOptions)).thenReturn(optionedGeoJsonSource);
Expand Down Expand Up @@ -148,6 +150,12 @@ public void testNoUpdateOnStyleReload() {
verify(geoJsonSource, times(1)).setGeoJson(any(FeatureCollection.class));
}

@Test
public void testLayerId() {
fillManager = new FillManager(mapView, mapboxMap, style, coreElementProvider, null, null, draggableAnnotationController);
assertEquals(layerId, fillManager.getLayerId());
}

@Test
public void testAddFill() {
fillManager = new FillManager(mapView, mapboxMap, style, coreElementProvider, null, null, draggableAnnotationController);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,13 +38,15 @@ public class LineManagerTest {
private Style style = mock(Style.class);
private GeoJsonSource geoJsonSource = mock(GeoJsonSource.class);
private GeoJsonSource optionedGeoJsonSource = mock(GeoJsonSource.class);
private String layerId = "annotation_layer";
private LineLayer lineLayer = mock(LineLayer.class);
private LineManager lineManager;
private CoreElementProvider<LineLayer> coreElementProvider = mock(CoreElementProvider.class);
private GeoJsonOptions geoJsonOptions = mock(GeoJsonOptions.class);

@Before
public void beforeTest() {
when(lineLayer.getId()).thenReturn(layerId);
when(coreElementProvider.getLayer()).thenReturn(lineLayer);
when(coreElementProvider.getSource(null)).thenReturn(geoJsonSource);
when(coreElementProvider.getSource(geoJsonOptions)).thenReturn(optionedGeoJsonSource);
Expand Down Expand Up @@ -148,6 +150,12 @@ public void testNoUpdateOnStyleReload() {
verify(geoJsonSource, times(1)).setGeoJson(any(FeatureCollection.class));
}

@Test
public void testLayerId() {
lineManager = new LineManager(mapView, mapboxMap, style, coreElementProvider, null, null, draggableAnnotationController);
assertEquals(layerId, lineManager.getLayerId());
}

@Test
public void testAddLine() {
lineManager = new LineManager(mapView, mapboxMap, style, coreElementProvider, null, null, draggableAnnotationController);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,13 +38,15 @@ public class SymbolManagerTest {
private Style style = mock(Style.class);
private GeoJsonSource geoJsonSource = mock(GeoJsonSource.class);
private GeoJsonSource optionedGeoJsonSource = mock(GeoJsonSource.class);
private String layerId = "annotation_layer";
private SymbolLayer symbolLayer = mock(SymbolLayer.class);
private SymbolManager symbolManager;
private CoreElementProvider<SymbolLayer> coreElementProvider = mock(CoreElementProvider.class);
private GeoJsonOptions geoJsonOptions = mock(GeoJsonOptions.class);

@Before
public void beforeTest() {
when(symbolLayer.getId()).thenReturn(layerId);
when(coreElementProvider.getLayer()).thenReturn(symbolLayer);
when(coreElementProvider.getSource(null)).thenReturn(geoJsonSource);
when(coreElementProvider.getSource(geoJsonOptions)).thenReturn(optionedGeoJsonSource);
Expand Down Expand Up @@ -148,6 +150,12 @@ public void testNoUpdateOnStyleReload() {
verify(geoJsonSource, times(1)).setGeoJson(any(FeatureCollection.class));
}

@Test
public void testLayerId() {
symbolManager = new SymbolManager(mapView, mapboxMap, style, coreElementProvider, null, null, draggableAnnotationController);
assertEquals(layerId, symbolManager.getLayerId());
}

@Test
public void testAddSymbol() {
symbolManager = new SymbolManager(mapView, mapboxMap, style, coreElementProvider, null, null, draggableAnnotationController);
Expand Down