Skip to content
Snippets Groups Projects
Commit f06c76ee authored by AFKessen's avatar AFKessen
Browse files

add tests

parent b87633b6
No related branches found
No related tags found
No related merge requests found
String geojsonNestedGeometryCollection = """{
"type": "FeatureCollection",
"features": [
{
"type": "Feature",
"properties": {"name": "collection"},
"geometry": {
"type": "GeometryCollection",
"geometries": [
{
"type": "GeometryCollection",
"geometries": [
{
"type": "Point",
"coordinates": [0, 0]
},
{
"type": "Point",
"coordinates": [1, 1]
}
]
},
{
"type": "Point",
"coordinates": [0, 0]
}
]
}
}
]
}""";
String geojsonPoint = """{
"type": "FeatureCollection",
"features": [
......
......@@ -7,6 +7,29 @@ import "package:test/test.dart";
import 'data.dart';
void main() {
test("nested geometrycollection", () async {
final features = await featuresFromGeoJson(geojsonNestedGeometryCollection);
expect(features.collection.length, 1);
final feature = features.collection[0];
expect(feature.type, GeoJsonFeatureType.geometryCollection);
final collection = feature.geometry as GeoJsonGeometryCollection;
expect(collection.geometries.length, 2);
expect(
collection.geometries[0].type, GeoJsonFeatureType.geometryCollection);
final innerCollection =
collection.geometries[0].geometry as GeoJsonGeometryCollection;
expect(innerCollection.geometries.length, 2);
expect(
innerCollection.geometries
.every((element) => element.type == GeoJsonFeatureType.point),
true);
expect(collection.geometries[1].type, GeoJsonFeatureType.point);
final point = collection.geometries[1].geometry as GeoJsonPoint;
expect(point.geoPoint.latitude, 0);
expect(point.geoPoint.longitude, 0);
});
test("point", () async {
final features = await featuresFromGeoJson(geojsonPoint);
expect(features.collection.length, 1);
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment