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

Commit

Permalink
[ios, macos] Add test scenarios to testPolyline
Browse files Browse the repository at this point in the history
  • Loading branch information
fabian-guerra committed May 12, 2017
1 parent 41b7c03 commit fd11d8c
Showing 1 changed file with 26 additions and 0 deletions.
26 changes: 26 additions & 0 deletions platform/darwin/test/MGLCodingTests.m
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,32 @@ - (void)testPolyline {
XCTAssertEqual([multiLine coordinate].latitude, multiLineCenter.latitude);
XCTAssertEqual([multiLine coordinate].longitude, multiLineCenter.longitude);

CLLocationCoordinate2D segmentCoordinates[] = {
CLLocationCoordinate2DMake(35.040390, -85.311477),
CLLocationCoordinate2DMake(35.040390, -85.209510),
};

NSUInteger segmentCoordinatesCount = sizeof(segmentCoordinates) / sizeof(CLLocationCoordinate2D);
MGLPolyline *segmentLine = [MGLPolyline polylineWithCoordinates:segmentCoordinates count:segmentCoordinatesCount];
CLLocationCoordinate2D segmentCenter = CLLocationCoordinate2DMake(35.0404006631, -85.2604935);

XCTAssertEqualWithAccuracy([segmentLine coordinate].latitude, segmentCenter.latitude, 1);
XCTAssertEqualWithAccuracy([segmentLine coordinate].longitude, segmentCenter.longitude, 1);

CLLocationCoordinate2D sfToBerkeleyCoordinates[] = {
CLLocationCoordinate2DMake(37.782440, -122.397111),
CLLocationCoordinate2DMake(37.818384, -122.352994),
CLLocationCoordinate2DMake(37.831401, -122.274545),
CLLocationCoordinate2DMake(37.862172, -122.262700),
};

NSUInteger sfToBerkeleyCoordinatesCount = sizeof(sfToBerkeleyCoordinates) / sizeof(CLLocationCoordinate2D);
MGLPolyline *sfToBerkeleyLine = [MGLPolyline polylineWithCoordinates:sfToBerkeleyCoordinates count:sfToBerkeleyCoordinatesCount];
CLLocationCoordinate2D sfToBerkeleyCenter = CLLocationCoordinate2DMake(37.8230575118,-122.324867587);

XCTAssertEqualWithAccuracy([sfToBerkeleyLine coordinate].latitude, sfToBerkeleyCenter.latitude, 1);
XCTAssertEqualWithAccuracy([sfToBerkeleyLine coordinate].longitude, sfToBerkeleyCenter.longitude, 1);

}

- (void)testPolygon {
Expand Down

0 comments on commit fd11d8c

Please sign in to comment.