From f1cf48c9cca48e81ac73ab98af5d44d6dcc35aab Mon Sep 17 00:00:00 2001 From: jmkiley Date: Mon, 19 Jun 2017 18:55:24 -0700 Subject: [ios] Added MGLOverlay tests --- platform/ios/ios.xcodeproj/project.pbxproj | 4 +++ .../ios/test/MGLCalloutViewDelegateTests.swift | 35 ++++++++++++++++++++++ platform/ios/test/MGLOverlayTests.swift | 25 ++++++++++++++++ 3 files changed, 64 insertions(+) create mode 100644 platform/ios/test/MGLCalloutViewDelegateTests.swift create mode 100644 platform/ios/test/MGLOverlayTests.swift diff --git a/platform/ios/ios.xcodeproj/project.pbxproj b/platform/ios/ios.xcodeproj/project.pbxproj index 501f42500e..276244ee63 100644 --- a/platform/ios/ios.xcodeproj/project.pbxproj +++ b/platform/ios/ios.xcodeproj/project.pbxproj @@ -141,6 +141,7 @@ 35E79F201D41266300957B9E /* MGLStyleLayer_Private.h in Headers */ = {isa = PBXBuildFile; fileRef = 35E79F1F1D41266300957B9E /* MGLStyleLayer_Private.h */; }; 35E79F211D41266300957B9E /* MGLStyleLayer_Private.h in Headers */ = {isa = PBXBuildFile; fileRef = 35E79F1F1D41266300957B9E /* MGLStyleLayer_Private.h */; }; 36F1153D1D46080700878E1A /* libmbgl-core.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 36F1153B1D46080700878E1A /* libmbgl-core.a */; }; + 3E7148681EF8A2DA00972072 /* MGLOverlayTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 3E7148671EF8A2DA00972072 /* MGLOverlayTests.swift */; }; 3E7E6A4D1EF88569002871F3 /* MGLOfflineStorageDelegateTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 3E7E6A4C1EF88569002871F3 /* MGLOfflineStorageDelegateTests.swift */; }; 400533011DB0862B0069F638 /* NSArray+MGLAdditions.h in Headers */ = {isa = PBXBuildFile; fileRef = 400532FF1DB0862B0069F638 /* NSArray+MGLAdditions.h */; }; 400533021DB0862B0069F638 /* NSArray+MGLAdditions.mm in Sources */ = {isa = PBXBuildFile; fileRef = 400533001DB0862B0069F638 /* NSArray+MGLAdditions.mm */; }; @@ -625,6 +626,7 @@ 35E79F1F1D41266300957B9E /* MGLStyleLayer_Private.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MGLStyleLayer_Private.h; sourceTree = ""; }; 36F1153B1D46080700878E1A /* libmbgl-core.a */ = {isa = PBXFileReference; lastKnownFileType = archive.ar; name = "libmbgl-core.a"; path = "build/Debug-iphoneos/libmbgl-core.a"; sourceTree = ""; }; 36F1153C1D46080700878E1A /* libmbgl-platform-ios.a */ = {isa = PBXFileReference; lastKnownFileType = archive.ar; name = "libmbgl-platform-ios.a"; path = "build/Debug-iphoneos/libmbgl-platform-ios.a"; sourceTree = ""; }; + 3E7148671EF8A2DA00972072 /* MGLOverlayTests.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = MGLOverlayTests.swift; sourceTree = ""; }; 3E7E6A4C1EF88569002871F3 /* MGLOfflineStorageDelegateTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = MGLOfflineStorageDelegateTests.swift; sourceTree = ""; }; 400532FF1DB0862B0069F638 /* NSArray+MGLAdditions.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "NSArray+MGLAdditions.h"; sourceTree = ""; }; 400533001DB0862B0069F638 /* NSArray+MGLAdditions.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = "NSArray+MGLAdditions.mm"; sourceTree = ""; }; @@ -1131,6 +1133,7 @@ 409F43FC1E9E781C0048729D /* MGLMapViewDelegateIntegrationTests.swift */, 409D0A0C1ED614CE00C95D0C /* MGLAnnotationViewIntegrationTests.swift */, 3E7E6A4C1EF88569002871F3 /* MGLOfflineStorageDelegateTests.swift */, + 3E7148671EF8A2DA00972072 /* MGLOverlayTests.swift */, ); name = "Swift Integration"; sourceTree = ""; @@ -2161,6 +2164,7 @@ 357579871D502AFE000B822E /* MGLLineStyleLayerTests.mm in Sources */, 357579891D502B06000B822E /* MGLCircleStyleLayerTests.mm in Sources */, DA2207BF1DC0805F0002F84D /* MGLStyleValueTests.swift in Sources */, + 3E7148681EF8A2DA00972072 /* MGLOverlayTests.swift in Sources */, 40CFA6511D7875BB008103BD /* MGLShapeSourceTests.mm in Sources */, DA35A2C51CCA9F8300E826B2 /* MGLClockDirectionFormatterTests.m in Sources */, 35B8E08C1D6C8B5100E768D2 /* MGLPredicateTests.mm in Sources */, diff --git a/platform/ios/test/MGLCalloutViewDelegateTests.swift b/platform/ios/test/MGLCalloutViewDelegateTests.swift new file mode 100644 index 0000000000..66e9e76fe1 --- /dev/null +++ b/platform/ios/test/MGLCalloutViewDelegateTests.swift @@ -0,0 +1,35 @@ +// +// MGLCalloutViewDelegate.swift +// ios +// +// Created by Jordan Kiley on 6/19/17. +// Copyright © 2017 Mapbox. All rights reserved. +// + +import XCTest + +class MGLCalloutViewDelegate: XCTestCase { + + override func setUp() { + super.setUp() + // Put setup code here. This method is called before the invocation of each test method in the class. + } + + override func tearDown() { + // Put teardown code here. This method is called after the invocation of each test method in the class. + super.tearDown() + } + + func testExample() { + // This is an example of a functional test case. + // Use XCTAssert and related functions to verify your tests produce the correct results. + } + + func testPerformanceExample() { + // This is an example of a performance test case. + self.measure { + // Put the code you want to measure the time of here. + } + } + +} diff --git a/platform/ios/test/MGLOverlayTests.swift b/platform/ios/test/MGLOverlayTests.swift new file mode 100644 index 0000000000..4bdd90cd60 --- /dev/null +++ b/platform/ios/test/MGLOverlayTests.swift @@ -0,0 +1,25 @@ +import XCTest +import Mapbox + +class MGLOverlayTests: XCTestCase { + + func testCoverage() { + MGLSDKTestHelpers.checkTestsContainAllMethods(testClass: CustomOverlay.self, in: MGLOverlay.self) + } + +} + +class CustomOverlay: NSObject, MGLOverlay { + + var coordinate = CLLocationCoordinate2D(latitude: 0, longitude: 0) + var overlayBounds = MGLCoordinateBounds(sw: CLLocationCoordinate2D(latitude: 0, longitude: 0), ne: CLLocationCoordinate2D(latitude: 0, longitude: 0)) + + func testCoordinate() { + XCTAssertNotNil(coordinate) + } + + func testOverlayBounds() { + XCTAssertNotNil(overlayBounds) + } + func intersects(_ overlayBounds: MGLCoordinateBounds) -> Bool { return false } +} -- cgit v1.2.1