diff options
author | Minh Nguyễn <mxn@1ec5.org> | 2015-04-24 13:30:50 -0700 |
---|---|---|
committer | Minh Nguyễn <mxn@1ec5.org> | 2015-04-24 13:30:50 -0700 |
commit | 1dc2cbc280292c76eaca21fde9dddfbd30060fb0 (patch) | |
tree | 836025881b28fd592bbcef72670345a720e9af0b /test/ios/MapViewTests.m | |
parent | 2c436444d7ebf22ca48ef08e077a144ddea76ffd (diff) | |
download | qtlocation-mapboxgl-1dc2cbc280292c76eaca21fde9dddfbd30060fb0.tar.gz |
Test inset MGLMapView
Verify that the ornaments hug the `MGLMapView` when it’s smaller than the view controller’s root view.
Diffstat (limited to 'test/ios/MapViewTests.m')
-rw-r--r-- | test/ios/MapViewTests.m | 23 |
1 files changed, 23 insertions, 0 deletions
diff --git a/test/ios/MapViewTests.m b/test/ios/MapViewTests.m index deed521b71..2d87b43c15 100644 --- a/test/ios/MapViewTests.m +++ b/test/ios/MapViewTests.m @@ -4,6 +4,7 @@ #import "KIFTestActor+MapboxGL.h" #import "MapboxGL.h" +#import "MGLTViewController.h" @interface MapViewTests : KIFTestCase <MGLMapViewDelegate> @@ -297,6 +298,28 @@ @"rotated device should not have attribution button under toolbar"); } +- (void)testInsetMapView { + [tester.viewController insetMapView]; + [tester waitForAnimationsToFinish]; + + UIView *logoBug = (UIView *)[tester waitForViewWithAccessibilityLabel:@"Mapbox logo"]; + UIView *attributionButton = (UIView *)[tester waitForViewWithAccessibilityLabel:@"Attribution info"]; + + CGRect mapViewFrame = [tester.mapView.superview convertRect:tester.mapView.frame toView:nil]; + + CGRect logoBugFrame = [logoBug.superview convertRect:logoBug.frame toView:nil]; + XCTAssertTrue(CGRectIntersectsRect(logoBugFrame, mapViewFrame), + @"logo bug should lie inside shrunken map view"); + + CGRect attributionButtonFrame = [attributionButton.superview convertRect:attributionButton.frame toView:nil]; + XCTAssertTrue(CGRectIntersectsRect(attributionButtonFrame, mapViewFrame), + @"attribution button should lie inside shrunken map view"); + + CGRect compassFrame = [tester.compass.superview convertRect:tester.compass.frame toView:nil]; + XCTAssertTrue(CGRectIntersectsRect(compassFrame, mapViewFrame), + @"compass should lie inside shrunken map view"); +} + - (void)testDelegateRegionWillChange { __block NSUInteger unanimatedCount; __block NSUInteger animatedCount; |