[ios] Fix type conversion warnings in MGLFeatureTests
Fixes: object of type 'MGLPointAnnotation/MGLPolyline *' is not compatible with array element type 'MGLShape<MGLFeature> *' [-Wobjc-literal-conversion]
This commit is contained in:
@@ -298,29 +298,36 @@
|
||||
}
|
||||
|
||||
- (void)testShapeCollectionFeatureGeoJSONDictionary {
|
||||
MGLPointAnnotation *pointFeature = [[MGLPointAnnotation alloc] init];
|
||||
MGLPointFeature *pointFeature = [[MGLPointFeature alloc] init];
|
||||
CLLocationCoordinate2D pointCoordinate = { 10, 10 };
|
||||
pointFeature.coordinate = pointCoordinate;
|
||||
|
||||
CLLocationCoordinate2D coord1 = { 0, 0 };
|
||||
CLLocationCoordinate2D coord2 = { 10, 10 };
|
||||
CLLocationCoordinate2D coords[] = { coord1, coord2 };
|
||||
MGLPolyline *polyline = [MGLPolyline polylineWithCoordinates:coords count:2];
|
||||
MGLPolylineFeature *polylineFeature = [MGLPolylineFeature polylineWithCoordinates:coords count:2];
|
||||
|
||||
MGLShapeCollectionFeature *shapeCollectionFeature = [MGLShapeCollectionFeature shapeCollectionWithShapes:@[pointFeature, polylineFeature]];
|
||||
|
||||
MGLShapeCollectionFeature *shapeCollectionFeature = [MGLShapeCollectionFeature shapeCollectionWithShapes:@[pointFeature,
|
||||
polyline]];
|
||||
// A GeoJSON feature
|
||||
NSDictionary *geoJSONFeature = [shapeCollectionFeature geoJSONDictionary];
|
||||
|
||||
// it has the correct geometry
|
||||
NSDictionary *expectedGeometry = @{@"type": @"GeometryCollection",
|
||||
@"geometries": @[
|
||||
@{@"type": @"Point",
|
||||
@"coordinates": @[@(pointCoordinate.longitude), @(pointCoordinate.latitude)]},
|
||||
@{@"type": @"LineString",
|
||||
@"coordinates": @[@[@(coord1.longitude), @(coord1.latitude)],
|
||||
@[@(coord2.longitude), @(coord2.latitude)]]}
|
||||
]};
|
||||
@{ @"geometry": @{@"type": @"Point",
|
||||
@"coordinates": @[@(pointCoordinate.longitude), @(pointCoordinate.latitude)]},
|
||||
@"properties": [NSNull null],
|
||||
@"type": @"Feature",
|
||||
},
|
||||
@{ @"geometry": @{@"type": @"LineString",
|
||||
@"coordinates": @[@[@(coord1.longitude), @(coord1.latitude)],
|
||||
@[@(coord2.longitude), @(coord2.latitude)]]},
|
||||
@"properties": [NSNull null],
|
||||
@"type": @"Feature",
|
||||
}
|
||||
]
|
||||
};
|
||||
XCTAssertEqualObjects(geoJSONFeature[@"geometry"], expectedGeometry);
|
||||
|
||||
// When the shape collection is created with an empty array of shapes
|
||||
|
||||
Reference in New Issue
Block a user