diff options
author | Jason Wray <jason@mapbox.com> | 2019-07-19 16:11:24 -0700 |
---|---|---|
committer | Jason Wray <jason@mapbox.com> | 2019-07-19 16:11:24 -0700 |
commit | 2c24d34e821c6d03f3c7f3913238d4705a762049 (patch) | |
tree | 05c9ee959682d9020c650bda171770615c5eb6fd | |
parent | 1aa4776dc1d7e60989fa7524a816e7db1b92056b (diff) | |
download | qtlocation-mapboxgl-2c24d34e821c6d03f3c7f3913238d4705a762049.tar.gz |
[ios] Add compass button tap test
-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; |