diff options
-rw-r--r-- | platform/ios/test/MGLMapViewCompassViewTests.mm | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/platform/ios/test/MGLMapViewCompassViewTests.mm b/platform/ios/test/MGLMapViewCompassViewTests.mm index aaec4b0bf7..4e00d69a67 100644 --- a/platform/ios/test/MGLMapViewCompassViewTests.mm +++ b/platform/ios/test/MGLMapViewCompassViewTests.mm @@ -7,6 +7,10 @@ - (void)resetNorthAnimated:(BOOL)animated; @end +@interface MGLCompassButton (MGLCompassButtonTests) +- (void)handleTapGesture:(__unused UITapGestureRecognizer *)sender; +@end + @interface MGLCompassButtonTests : XCTestCase @property (nonatomic) MGLMapView *mapView; @end @@ -78,6 +82,16 @@ XCTAssertEqual(self.mapView.compassView.alpha, 1, @"Compass should continue to be visible when direction is north."); } +- (void)testCompassTapResetNorth { + self.mapView.zoomLevel = 15.f; + [self.mapView setDirection:45.f animated:false]; + XCTAssertEqualWithAccuracy(self.mapView.direction, 45, 0.001); + XCTAssertEqual(self.mapView.compassView.alpha, 1, @"Compass should continue to be visible when direction changes."); + + [self.mapView.compassView handleTapGesture:nil]; + XCTAssertEqual(self.mapView.direction, 0, @"Tapping the compass should reset direction to north."); +} + - (void)testCompassRotation { self.mapView.zoomLevel = 15; |