diff options
-rw-r--r-- | platform/darwin/test/MGLSDKTestHelpers.swift | 47 | ||||
-rw-r--r-- | platform/ios/ios.xcodeproj/project.pbxproj | 26 | ||||
-rw-r--r-- | platform/ios/test/MGLMapViewDelegateIntegrationTests.swift | 82 | ||||
-rw-r--r-- | platform/macos/macos.xcodeproj/project.pbxproj | 32 | ||||
-rw-r--r-- | platform/macos/test/MGLMapViewDelegateIntegrationTests.swift | 56 |
5 files changed, 243 insertions, 0 deletions
diff --git a/platform/darwin/test/MGLSDKTestHelpers.swift b/platform/darwin/test/MGLSDKTestHelpers.swift new file mode 100644 index 0000000000..82b5caa273 --- /dev/null +++ b/platform/darwin/test/MGLSDKTestHelpers.swift @@ -0,0 +1,47 @@ +import Foundation + +class MGLSDKTestHelpers { + + class func checkTestsContainAllMethods(testClass: Swift.AnyClass, in p: Protocol) { + let testMethods = self.classMethodDescriptions(testClass) + let subjectMethods = self.protocolMethodDescriptions(p) + + for method in subjectMethods { + if !testMethods.contains(method) { + XCTFail("\(String(describing: testClass)) does not contain \(method) from \(String(describing: p))") + } + } + + XCTAssert(true) + } + +} + +extension MGLSDKTestHelpers { + + class func protocolMethodDescriptions(_ p: Protocol) -> Set<String> { + var methods = Set<String>() + var methodCount = UInt32() + let methodDescriptionList: UnsafeMutablePointer<objc_method_description>! = protocol_copyMethodDescriptionList(p, false, true, &methodCount) + for i in 0..<Int(methodCount) { + let description: objc_method_description = methodDescriptionList[i] + methods.insert(description.name.description) + } + free(methodDescriptionList) + return methods + } + + class func classMethodDescriptions(_ cls: Swift.AnyClass) -> Set<String> { + var methods = Set<String>() + var methodCount = UInt32() + let methodList: UnsafeMutablePointer<Method?>! = class_copyMethodList(cls, &methodCount) + for i in 0..<Int(methodCount) { + let method = methodList[i] + let selector : Selector = method_getName(method) + methods.insert(selector.description) + } + free(methodList) + return methods + } + +} diff --git a/platform/ios/ios.xcodeproj/project.pbxproj b/platform/ios/ios.xcodeproj/project.pbxproj index a34b5c3ffc..9936c7244f 100644 --- a/platform/ios/ios.xcodeproj/project.pbxproj +++ b/platform/ios/ios.xcodeproj/project.pbxproj @@ -138,6 +138,7 @@ 4018B1C91CDC288A00F666AF /* MGLAnnotationView_Private.h in Headers */ = {isa = PBXBuildFile; fileRef = 4018B1C31CDC277F00F666AF /* MGLAnnotationView_Private.h */; }; 4018B1CA1CDC288E00F666AF /* MGLAnnotationView.h in Headers */ = {isa = PBXBuildFile; fileRef = 4018B1C51CDC277F00F666AF /* MGLAnnotationView.h */; settings = {ATTRIBUTES = (Public, ); }; }; 4018B1CB1CDC288E00F666AF /* MGLAnnotationView.h in Headers */ = {isa = PBXBuildFile; fileRef = 4018B1C51CDC277F00F666AF /* MGLAnnotationView.h */; settings = {ATTRIBUTES = (Public, ); }; }; + 4031ACFF1E9FD29F00A3EA26 /* MGLSDKTestHelpers.swift in Sources */ = {isa = PBXBuildFile; fileRef = 4031ACFE1E9FD29F00A3EA26 /* MGLSDKTestHelpers.swift */; }; 404326891D5B9B27007111BD /* MGLAnnotationContainerView_Private.h in Headers */ = {isa = PBXBuildFile; fileRef = 404326881D5B9B1A007111BD /* MGLAnnotationContainerView_Private.h */; }; 4049C29D1DB6CD6C00B3F799 /* MGLPointCollection.h in Headers */ = {isa = PBXBuildFile; fileRef = 4049C29B1DB6CD6C00B3F799 /* MGLPointCollection.h */; settings = {ATTRIBUTES = (Public, ); }; }; 4049C29E1DB6CD6C00B3F799 /* MGLPointCollection.h in Headers */ = {isa = PBXBuildFile; fileRef = 4049C29B1DB6CD6C00B3F799 /* MGLPointCollection.h */; settings = {ATTRIBUTES = (Public, ); }; }; @@ -160,6 +161,7 @@ 408AA8571DAEDA1700022900 /* NSDictionary+MGLAdditions.h in Headers */ = {isa = PBXBuildFile; fileRef = 408AA8551DAEDA0800022900 /* NSDictionary+MGLAdditions.h */; }; 408AA8581DAEDA1E00022900 /* NSDictionary+MGLAdditions.mm in Sources */ = {isa = PBXBuildFile; fileRef = 408AA8561DAEDA0800022900 /* NSDictionary+MGLAdditions.mm */; }; 408AA8591DAEDA1E00022900 /* NSDictionary+MGLAdditions.mm in Sources */ = {isa = PBXBuildFile; fileRef = 408AA8561DAEDA0800022900 /* NSDictionary+MGLAdditions.mm */; }; + 409F43FD1E9E781C0048729D /* MGLMapViewDelegateIntegrationTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 409F43FC1E9E781C0048729D /* MGLMapViewDelegateIntegrationTests.swift */; }; 40CF6DBB1DAC3C6600A4D18B /* MGLShape_Private.h in Headers */ = {isa = PBXBuildFile; fileRef = 40CF6DBA1DAC3C1800A4D18B /* MGLShape_Private.h */; }; 40CFA6511D7875BB008103BD /* MGLShapeSourceTests.mm in Sources */ = {isa = PBXBuildFile; fileRef = 40CFA6501D787579008103BD /* MGLShapeSourceTests.mm */; }; 40EDA1C01CFE0E0200D9EA68 /* MGLAnnotationContainerView.h in Headers */ = {isa = PBXBuildFile; fileRef = 40EDA1BD1CFE0D4A00D9EA68 /* MGLAnnotationContainerView.h */; }; @@ -612,6 +614,7 @@ 4018B1C41CDC277F00F666AF /* MGLAnnotationView.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = MGLAnnotationView.mm; sourceTree = "<group>"; }; 4018B1C51CDC277F00F666AF /* MGLAnnotationView.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MGLAnnotationView.h; sourceTree = "<group>"; }; 402E9DE01CD2C76200FD4519 /* Mapbox.playground */ = {isa = PBXFileReference; lastKnownFileType = file.playground; path = Mapbox.playground; sourceTree = "<group>"; }; + 4031ACFE1E9FD29F00A3EA26 /* MGLSDKTestHelpers.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; name = MGLSDKTestHelpers.swift; path = ../../darwin/test/MGLSDKTestHelpers.swift; sourceTree = "<group>"; }; 404326881D5B9B1A007111BD /* MGLAnnotationContainerView_Private.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = MGLAnnotationContainerView_Private.h; sourceTree = "<group>"; }; 4049C29B1DB6CD6C00B3F799 /* MGLPointCollection.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MGLPointCollection.h; sourceTree = "<group>"; }; 4049C29C1DB6CD6C00B3F799 /* MGLPointCollection.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = MGLPointCollection.mm; sourceTree = "<group>"; }; @@ -625,6 +628,7 @@ 4085AF081D933DEA00F11B22 /* MGLTileSetTests.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; name = MGLTileSetTests.mm; path = ../../darwin/test/MGLTileSetTests.mm; sourceTree = "<group>"; }; 408AA8551DAEDA0800022900 /* NSDictionary+MGLAdditions.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = "NSDictionary+MGLAdditions.h"; sourceTree = "<group>"; }; 408AA8561DAEDA0800022900 /* NSDictionary+MGLAdditions.mm */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.objcpp; path = "NSDictionary+MGLAdditions.mm"; sourceTree = "<group>"; }; + 409F43FC1E9E781C0048729D /* MGLMapViewDelegateIntegrationTests.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = MGLMapViewDelegateIntegrationTests.swift; sourceTree = "<group>"; }; 40CF6DBA1DAC3C1800A4D18B /* MGLShape_Private.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = MGLShape_Private.h; sourceTree = "<group>"; }; 40CFA6501D787579008103BD /* MGLShapeSourceTests.mm */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.objcpp; name = MGLShapeSourceTests.mm; path = ../../darwin/test/MGLShapeSourceTests.mm; sourceTree = "<group>"; }; 40EDA1BD1CFE0D4A00D9EA68 /* MGLAnnotationContainerView.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MGLAnnotationContainerView.h; sourceTree = "<group>"; }; @@ -1073,6 +1077,22 @@ name = Playground; sourceTree = "<group>"; }; + 4031ACFD1E9FD26900A3EA26 /* Test Helpers */ = { + isa = PBXGroup; + children = ( + 4031ACFE1E9FD29F00A3EA26 /* MGLSDKTestHelpers.swift */, + ); + name = "Test Helpers"; + sourceTree = "<group>"; + }; + 409F43FB1E9E77D10048729D /* Swift Integration */ = { + isa = PBXGroup; + children = ( + 409F43FC1E9E781C0048729D /* MGLMapViewDelegateIntegrationTests.swift */, + ); + name = "Swift Integration"; + sourceTree = "<group>"; + }; 40CFA64E1D78754A008103BD /* Sources */ = { isa = PBXGroup; children = ( @@ -1185,6 +1205,8 @@ DA2E88521CC036F400F24E7B /* SDK Tests */ = { isa = PBXGroup; children = ( + 4031ACFD1E9FD26900A3EA26 /* Test Helpers */, + 409F43FB1E9E77D10048729D /* Swift Integration */, 357579811D502AD4000B822E /* Styling */, DAEDC4331D603417000224FF /* MGLAttributionInfoTests.m */, 353D23951D0B0DFE002BE09D /* MGLAnnotationViewTests.m */, @@ -2087,6 +2109,7 @@ 6407D6701E0085FD00F6A9C3 /* MGLDocumentationExampleTests.swift in Sources */, DA2E88631CC0382C00F24E7B /* MGLOfflineRegionTests.m in Sources */, 3599A3E61DF708BC00E77FB2 /* MGLStyleValueTests.m in Sources */, + 409F43FD1E9E781C0048729D /* MGLMapViewDelegateIntegrationTests.swift in Sources */, DA2E88651CC0382C00F24E7B /* MGLStyleTests.mm in Sources */, DA2E88611CC0382C00F24E7B /* MGLGeometryTests.mm in Sources */, 357579801D501E09000B822E /* MGLFillStyleLayerTests.mm in Sources */, @@ -2116,6 +2139,7 @@ 35E208A71D24210F00EC9A46 /* MGLNSDataAdditionsTests.m in Sources */, DA0CD5901CF56F6A00A5F5A5 /* MGLFeatureTests.mm in Sources */, 556660D81E1D085500E2C41B /* MGLVersionNumber.m in Sources */, + 4031ACFF1E9FD29F00A3EA26 /* MGLSDKTestHelpers.swift in Sources */, ); runOnlyForDeploymentPostprocessing = 0; }; @@ -2609,6 +2633,7 @@ "$(geometry_cflags)", "$(geojson_cflags)", ); + OTHER_SWIFT_FLAGS = "-warnings-as-errors"; PRODUCT_BUNDLE_IDENTIFIER = com.mapbox.test; PRODUCT_NAME = "$(TARGET_NAME)"; SWIFT_OBJC_BRIDGING_HEADER = "../darwin/test/test-Bridging-Header.h"; @@ -2632,6 +2657,7 @@ "$(geometry_cflags)", "$(geojson_cflags)", ); + OTHER_SWIFT_FLAGS = "-warnings-as-errors"; PRODUCT_BUNDLE_IDENTIFIER = com.mapbox.test; PRODUCT_NAME = "$(TARGET_NAME)"; SWIFT_OBJC_BRIDGING_HEADER = "../darwin/test/test-Bridging-Header.h"; diff --git a/platform/ios/test/MGLMapViewDelegateIntegrationTests.swift b/platform/ios/test/MGLMapViewDelegateIntegrationTests.swift new file mode 100644 index 0000000000..50f101e86b --- /dev/null +++ b/platform/ios/test/MGLMapViewDelegateIntegrationTests.swift @@ -0,0 +1,82 @@ +import XCTest +import Mapbox + +class MGLMapViewDelegateIntegrationTests: XCTestCase { + + func testCoverage() { + MGLSDKTestHelpers.checkTestsContainAllMethods(testClass: MGLMapViewDelegateIntegrationTests.self, in: MGLMapViewDelegate.self) + } + +} + +extension MGLMapViewDelegateIntegrationTests: MGLMapViewDelegate { + + func mapViewRegionIsChanging(_ mapView: MGLMapView) {} + + func mapView(_ mapView: MGLMapView, didChange mode: MGLUserTrackingMode, animated: Bool) {} + + func mapViewDidFinishLoadingMap(_ mapView: MGLMapView) {} + + func mapViewDidStopLocatingUser(_ mapView: MGLMapView) {} + + func mapViewWillStartLoadingMap(_ mapView: MGLMapView) {} + + func mapViewWillStartLocatingUser(_ mapView: MGLMapView) {} + + func mapViewWillStartRenderingMap(_ mapView: MGLMapView) {} + + func mapViewWillStartRenderingFrame(_ mapView: MGLMapView) {} + + func mapView(_ mapView: MGLMapView, didFinishLoading style: MGLStyle) {} + + func mapView(_ mapView: MGLMapView, didSelect annotation: MGLAnnotation) {} + + func mapView(_ mapView: MGLMapView, didDeselect annotation: MGLAnnotation) {} + + func mapView(_ mapView: MGLMapView, regionDidChangeAnimated animated: Bool) {} + + func mapView(_ mapView: MGLMapView, regionWillChangeAnimated animated: Bool) {} + + func mapViewDidFailLoadingMap(_ mapView: MGLMapView, withError error: Error) {} + + func mapView(_ mapView: MGLMapView, didUpdate userLocation: MGLUserLocation?) {} + + func mapViewDidFinishRenderingMap(_ mapView: MGLMapView, fullyRendered: Bool) {} + + func mapView(_ mapView: MGLMapView, didFailToLocateUserWithError error: Error) {} + + func mapView(_ mapView: MGLMapView, tapOnCalloutFor annotation: MGLAnnotation) {} + + func mapViewDidFinishRenderingFrame(_ mapView: MGLMapView, fullyRendered: Bool) {} + + func mapView(_ mapView: MGLMapView, didAdd annotationViews: [MGLAnnotationView]) {} + + func mapView(_ mapView: MGLMapView, didSelect annotationView: MGLAnnotationView) {} + + func mapView(_ mapView: MGLMapView, didDeselect annotationView: MGLAnnotationView) {} + + func mapView(_ mapView: MGLMapView, alphaForShapeAnnotation annotation: MGLShape) -> CGFloat { return 0 } + + func mapView(_ mapView: MGLMapView, viewFor annotation: MGLAnnotation) -> MGLAnnotationView? { return nil } + + func mapView(_ mapView: MGLMapView, imageFor annotation: MGLAnnotation) -> MGLAnnotationImage? { return nil } + + func mapView(_ mapView: MGLMapView, annotationCanShowCallout annotation: MGLAnnotation) -> Bool { return false } + + func mapView(_ mapView: MGLMapView, calloutViewFor annotation: MGLAnnotation) -> MGLCalloutView? { return nil } + + func mapView(_ mapView: MGLMapView, strokeColorForShapeAnnotation annotation: MGLShape) -> UIColor { return .black } + + func mapView(_ mapView: MGLMapView, fillColorForPolygonAnnotation annotation: MGLPolygon) -> UIColor { return .black } + + func mapView(_ mapView: MGLMapView, leftCalloutAccessoryViewFor annotation: MGLAnnotation) -> UIView? { return nil } + + func mapView(_ mapView: MGLMapView, lineWidthForPolylineAnnotation annotation: MGLPolyline) -> CGFloat { return 0 } + + func mapView(_ mapView: MGLMapView, rightCalloutAccessoryViewFor annotation: MGLAnnotation) -> UIView? { return nil } + + func mapView(_ mapView: MGLMapView, annotation: MGLAnnotation, calloutAccessoryControlTapped control: UIControl) {} + + func mapView(_ mapView: MGLMapView, shouldChangeFrom oldCamera: MGLMapCamera, to newCamera: MGLMapCamera) -> Bool { return false } + +} diff --git a/platform/macos/macos.xcodeproj/project.pbxproj b/platform/macos/macos.xcodeproj/project.pbxproj index a42619c9bb..175629d126 100644 --- a/platform/macos/macos.xcodeproj/project.pbxproj +++ b/platform/macos/macos.xcodeproj/project.pbxproj @@ -49,6 +49,8 @@ 35C6DF871E214C1800ACA483 /* MGLDistanceFormatterTests.m in Sources */ = {isa = PBXBuildFile; fileRef = 35C6DF861E214C1800ACA483 /* MGLDistanceFormatterTests.m */; }; 35D65C5A1D65AD5500722C23 /* NSDate+MGLAdditions.h in Headers */ = {isa = PBXBuildFile; fileRef = 35D65C581D65AD5500722C23 /* NSDate+MGLAdditions.h */; }; 35D65C5B1D65AD5500722C23 /* NSDate+MGLAdditions.mm in Sources */ = {isa = PBXBuildFile; fileRef = 35D65C591D65AD5500722C23 /* NSDate+MGLAdditions.mm */; }; + 4031ACFC1E9EB3C100A3EA26 /* MGLMapViewDelegateIntegrationTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 4031ACFB1E9EB3C100A3EA26 /* MGLMapViewDelegateIntegrationTests.swift */; }; + 4031AD031E9FD6AA00A3EA26 /* MGLSDKTestHelpers.swift in Sources */ = {isa = PBXBuildFile; fileRef = 4031AD011E9FD6A300A3EA26 /* MGLSDKTestHelpers.swift */; }; 4049C2A51DB6CE7F00B3F799 /* MGLPointCollection.h in Headers */ = {isa = PBXBuildFile; fileRef = 4049C2A11DB6CE7800B3F799 /* MGLPointCollection.h */; settings = {ATTRIBUTES = (Public, ); }; }; 4049C2AD1DB8020600B3F799 /* MGLPointCollection.mm in Sources */ = {isa = PBXBuildFile; fileRef = 4049C2A71DB6D09B00B3F799 /* MGLPointCollection.mm */; }; 408AA85B1DAEECFE00022900 /* MGLShape_Private.h in Headers */ = {isa = PBXBuildFile; fileRef = 408AA85A1DAEECF100022900 /* MGLShape_Private.h */; }; @@ -305,6 +307,8 @@ 35C6DF861E214C1800ACA483 /* MGLDistanceFormatterTests.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = MGLDistanceFormatterTests.m; path = ../../darwin/test/MGLDistanceFormatterTests.m; sourceTree = "<group>"; }; 35D65C581D65AD5500722C23 /* NSDate+MGLAdditions.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "NSDate+MGLAdditions.h"; sourceTree = "<group>"; }; 35D65C591D65AD5500722C23 /* NSDate+MGLAdditions.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = "NSDate+MGLAdditions.mm"; sourceTree = "<group>"; }; + 4031ACFB1E9EB3C100A3EA26 /* MGLMapViewDelegateIntegrationTests.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = MGLMapViewDelegateIntegrationTests.swift; sourceTree = "<group>"; }; + 4031AD011E9FD6A300A3EA26 /* MGLSDKTestHelpers.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; name = MGLSDKTestHelpers.swift; path = ../../darwin/test/MGLSDKTestHelpers.swift; sourceTree = "<group>"; }; 4049C2A11DB6CE7800B3F799 /* MGLPointCollection.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MGLPointCollection.h; sourceTree = "<group>"; }; 4049C2A71DB6D09B00B3F799 /* MGLPointCollection.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = MGLPointCollection.mm; sourceTree = "<group>"; }; 405C03961DB0004E001AC280 /* NSImage+MGLAdditions.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "NSImage+MGLAdditions.h"; sourceTree = "<group>"; }; @@ -661,6 +665,22 @@ name = Styling; sourceTree = "<group>"; }; + 4031ACFA1E9EB39A00A3EA26 /* Swift Integration */ = { + isa = PBXGroup; + children = ( + 4031ACFB1E9EB3C100A3EA26 /* MGLMapViewDelegateIntegrationTests.swift */, + ); + name = "Swift Integration"; + sourceTree = "<group>"; + }; + 4031AD001E9FD61000A3EA26 /* Test Helpers */ = { + isa = PBXGroup; + children = ( + 4031AD011E9FD6A300A3EA26 /* MGLSDKTestHelpers.swift */, + ); + name = "Test Helpers"; + sourceTree = "<group>"; + }; DA839E891CC2E3400062CAFB = { isa = PBXGroup; children = ( @@ -943,6 +963,8 @@ DAE6C3371CC30DB200DB3429 /* SDK Tests */ = { isa = PBXGroup; children = ( + 4031AD001E9FD61000A3EA26 /* Test Helpers */, + 4031ACFA1E9EB39A00A3EA26 /* Swift Integration */, DA8F257D1D51C5F40010E6B5 /* Styling */, DAEDC4311D6033F1000224FF /* MGLAttributionInfoTests.m */, DAEDC4361D606291000224FF /* MGLAttributionButtonTests.m */, @@ -1225,6 +1247,7 @@ TargetAttributes = { DA839E911CC2E3400062CAFB = { CreatedOnToolsVersion = 7.3; + LastSwiftMigration = 0830; }; DAAA17961CE13BAE00731EFE = { CreatedOnToolsVersion = 7.3.1; @@ -1423,6 +1446,8 @@ DA87A9A61DCACC5000810D09 /* MGLCircleStyleLayerTests.mm in Sources */, DA87A99E1DC9DC2100810D09 /* MGLPredicateTests.mm in Sources */, DD58A4C91D822C6700E1F038 /* MGLExpressionTests.mm in Sources */, + 4031ACFC1E9EB3C100A3EA26 /* MGLMapViewDelegateIntegrationTests.swift in Sources */, + 4031AD031E9FD6AA00A3EA26 /* MGLSDKTestHelpers.swift in Sources */, DA87A9A71DCACC5000810D09 /* MGLBackgroundStyleLayerTests.mm in Sources */, DA29875A1E1A4290002299F5 /* MGLDocumentationExampleTests.swift in Sources */, DAE6C3D31CC34C9900DB3429 /* MGLOfflinePackTests.m in Sources */, @@ -1661,12 +1686,15 @@ isa = XCBuildConfiguration; buildSettings = { ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; + CLANG_ENABLE_MODULES = YES; COMBINE_HIDPI_IMAGES = YES; INFOPLIST_FILE = "$(SRCROOT)/app/Info.plist"; LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/../Frameworks"; OTHER_CFLAGS = "-fvisibility=hidden"; PRODUCT_BUNDLE_IDENTIFIER = com.mapbox.MapboxGL; PRODUCT_NAME = "Mapbox GL"; + SWIFT_OPTIMIZATION_LEVEL = "-Onone"; + SWIFT_VERSION = 3.0; }; name = Debug; }; @@ -1674,12 +1702,14 @@ isa = XCBuildConfiguration; buildSettings = { ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; + CLANG_ENABLE_MODULES = YES; COMBINE_HIDPI_IMAGES = YES; INFOPLIST_FILE = "$(SRCROOT)/app/Info.plist"; LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/../Frameworks"; OTHER_CFLAGS = "-fvisibility=hidden"; PRODUCT_BUNDLE_IDENTIFIER = com.mapbox.MapboxGL; PRODUCT_NAME = "Mapbox GL"; + SWIFT_VERSION = 3.0; }; name = Release; }; @@ -1791,6 +1821,7 @@ "$(geometry_cflags)", "$(geojson_cflags)", ); + OTHER_SWIFT_FLAGS = "-warnings-as-errors"; PRODUCT_BUNDLE_IDENTIFIER = com.mapbox.test; PRODUCT_NAME = "$(TARGET_NAME)"; SWIFT_OBJC_BRIDGING_HEADER = "../darwin/test/test-Bridging-Header.h"; @@ -1815,6 +1846,7 @@ "$(geometry_cflags)", "$(geojson_cflags)", ); + OTHER_SWIFT_FLAGS = "-warnings-as-errors"; PRODUCT_BUNDLE_IDENTIFIER = com.mapbox.test; PRODUCT_NAME = "$(TARGET_NAME)"; SWIFT_OBJC_BRIDGING_HEADER = "../darwin/test/test-Bridging-Header.h"; diff --git a/platform/macos/test/MGLMapViewDelegateIntegrationTests.swift b/platform/macos/test/MGLMapViewDelegateIntegrationTests.swift new file mode 100644 index 0000000000..3f82e7c61a --- /dev/null +++ b/platform/macos/test/MGLMapViewDelegateIntegrationTests.swift @@ -0,0 +1,56 @@ +import XCTest +import Mapbox + +class MGLMapViewDelegateIntegrationTests: XCTestCase { + + func testCoverage() { + MGLSDKTestHelpers.checkTestsContainAllMethods(testClass: MGLMapViewDelegateIntegrationTests.self, in: MGLMapViewDelegate.self) + } + +} + +extension MGLMapViewDelegateIntegrationTests: MGLMapViewDelegate { + + func mapView(_ mapView: MGLMapView, shouldChangeFrom oldCamera: MGLMapCamera, to newCamera: MGLMapCamera) -> Bool { return false } + + func mapView(_ mapView: MGLMapView, lineWidthForPolylineAnnotation annotation: MGLPolyline) -> CGFloat { return 0 } + + func mapView(_ mapView: MGLMapView, annotationCanShowCallout annotation: MGLAnnotation) -> Bool { return false } + + func mapView(_ mapView: MGLMapView, imageFor annotation: MGLAnnotation) -> MGLAnnotationImage? { return nil } + + func mapView(_ mapView: MGLMapView, alphaForShapeAnnotation annotation: MGLShape) -> CGFloat { return 0 } + + func mapViewDidFinishRenderingFrame(_ mapView: MGLMapView, fullyRendered: Bool) {} + + func mapViewDidFinishRenderingMap(_ mapView: MGLMapView, fullyRendered: Bool) {} + + func mapViewDidFailLoadingMap(_ mapView: MGLMapView, withError error: Error) {} + + func mapView(_ mapView: MGLMapView, didDeselect annotation: MGLAnnotation) {} + + func mapView(_ mapView: MGLMapView, didSelect annotation: MGLAnnotation) {} + + func mapView(_ mapView: MGLMapView, didFinishLoading style: MGLStyle) {} + + func mapViewWillStartRenderingFrame(_ mapView: MGLMapView) {} + + func mapViewWillStartRenderingMap(_ mapView: MGLMapView) {} + + func mapViewWillStartLoadingMap(_ mapView: MGLMapView) {} + + func mapViewDidFinishLoadingMap(_ mapView: MGLMapView) {} + + func mapViewCameraIsChanging(_ mapView: MGLMapView) {} + + func mapView(_ mapView: MGLMapView, cameraDidChangeAnimated animated: Bool) {} + + func mapView(_ mapView: MGLMapView, cameraWillChangeAnimated animated: Bool) {} + + func mapView(_ mapView: MGLMapView, strokeColorForShapeAnnotation annotation: MGLShape) -> NSColor { return .black } + + func mapView(_ mapView: MGLMapView, fillColorForPolygonAnnotation annotation: MGLPolygon) -> NSColor { return .black } + + func mapView(_ mapView: MGLMapView, calloutViewControllerFor annotation: MGLAnnotation) -> NSViewController? { return nil } + +} |