[tests] Add tests for shape overlays crossing the antimeridian
This adds two tests: AntimeridianAnnotationSmall: Test that a shape that is represented with +-180 longitudinal values is drawn spanning the antimeridian. In other words, it is rendered as a "small" shape as opposed to one that spans around the world to reach the other side of the antimeridian. This test is currently failing at the time of this commit. AntimeridianAnnotationLarge: Test that a shape that is represented with points that do not cross the +-180 boundary is rendered as a "large" shape. In other words, it is rendered by wrapping around the world to reach the other side of the meridian. This test is currently passing at the time of this commit.
This commit is contained in:
committed by
Bruno de Oliveira Abinader
parent
d70eda8504
commit
dfd40b27a5
@@ -79,6 +79,48 @@ TEST(Annotations, FillAnnotation) {
|
||||
test.checkRendering("fill_annotation_max_zoom");
|
||||
}
|
||||
|
||||
TEST(Annotations, AntimeridianAnnotationSmall) {
|
||||
AnnotationTest test;
|
||||
|
||||
double antimeridian = 180;
|
||||
test.map.setLatLngZoom(mbgl::LatLng(0, antimeridian), 0);
|
||||
test.map.setStyleJSON(util::read_file("test/fixtures/api/empty.json"));
|
||||
|
||||
LineString<double> line = {{ { antimeridian, 20 }, { antimeridian, -20 } }};
|
||||
LineAnnotation lineAnnotation { line };
|
||||
lineAnnotation.color = { { 255, 0, 0, 1 } };
|
||||
lineAnnotation.width = { 2 };
|
||||
test.map.addAnnotation(lineAnnotation);
|
||||
|
||||
Polygon<double> polygon = {{ {{ { antimeridian+10, 0 }, { antimeridian - 10, 10 }, { antimeridian-10, -10 } }} }};
|
||||
FillAnnotation polygonAnnotation { polygon };
|
||||
polygonAnnotation.color = { { 0, 0, 255, 1 } };
|
||||
test.map.addAnnotation(polygonAnnotation);
|
||||
|
||||
test.checkRendering("antimeridian_annotation_small");
|
||||
}
|
||||
|
||||
TEST(Annotations, AntimeridianAnnotationLarge) {
|
||||
AnnotationTest test;
|
||||
|
||||
double antimeridian = 180;
|
||||
test.map.setLatLngZoom(mbgl::LatLng(0, antimeridian), 0);
|
||||
test.map.setStyleJSON(util::read_file("test/fixtures/api/empty.json"));
|
||||
|
||||
LineString<double> line = {{ { antimeridian, 20 }, { antimeridian, -20 } }};
|
||||
LineAnnotation lineAnnotation { line };
|
||||
lineAnnotation.color = { { 255, 0, 0, 1 } };
|
||||
lineAnnotation.width = { 2 };
|
||||
test.map.addAnnotation(lineAnnotation);
|
||||
|
||||
Polygon<double> polygon = {{ {{ { antimeridian-10, 0 }, { -antimeridian+10, 10 }, { -antimeridian+10, -10 } }} }};
|
||||
FillAnnotation polygonAnnotation { polygon };
|
||||
polygonAnnotation.color = { { 0, 0, 255, 1 } };
|
||||
test.map.addAnnotation(polygonAnnotation);
|
||||
|
||||
test.checkRendering("antimeridian_annotation_large");
|
||||
}
|
||||
|
||||
TEST(Annotations, OverlappingFillAnnotation) {
|
||||
AnnotationTest test;
|
||||
|
||||
|
||||
BIN
test/fixtures/annotations/antimeridian_annotation_large/expected.png
vendored
Normal file
BIN
test/fixtures/annotations/antimeridian_annotation_large/expected.png
vendored
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 1.5 KiB |
BIN
test/fixtures/annotations/antimeridian_annotation_small/expected.png
vendored
Normal file
BIN
test/fixtures/annotations/antimeridian_annotation_small/expected.png
vendored
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 1.6 KiB |
Reference in New Issue
Block a user