summaryrefslogtreecommitdiff
path: root/platform/ios/test/MGLMapViewCompassViewTests.mm
diff options
context:
space:
mode:
authorJason Wray <jason@mapbox.com>2019-07-19 16:11:24 -0700
committerJason Wray <jason@mapbox.com>2019-07-19 16:11:24 -0700
commit2c24d34e821c6d03f3c7f3913238d4705a762049 (patch)
tree05c9ee959682d9020c650bda171770615c5eb6fd /platform/ios/test/MGLMapViewCompassViewTests.mm
parent1aa4776dc1d7e60989fa7524a816e7db1b92056b (diff)
downloadqtlocation-mapboxgl-2c24d34e821c6d03f3c7f3913238d4705a762049.tar.gz
[ios] Add compass button tap test
Diffstat (limited to 'platform/ios/test/MGLMapViewCompassViewTests.mm')
-rw-r--r--platform/ios/test/MGLMapViewCompassViewTests.mm14
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;