summaryrefslogtreecommitdiff
path: root/platform/darwin/test/MGLDocumentationExampleTests.swift
diff options
context:
space:
mode:
Diffstat (limited to 'platform/darwin/test/MGLDocumentationExampleTests.swift')
-rw-r--r--platform/darwin/test/MGLDocumentationExampleTests.swift21
1 files changed, 21 insertions, 0 deletions
diff --git a/platform/darwin/test/MGLDocumentationExampleTests.swift b/platform/darwin/test/MGLDocumentationExampleTests.swift
index d796b4e708..9336db7e49 100644
--- a/platform/darwin/test/MGLDocumentationExampleTests.swift
+++ b/platform/darwin/test/MGLDocumentationExampleTests.swift
@@ -217,4 +217,25 @@ class MGLDocumentationExampleTests: XCTestCase, MGLMapViewDelegate {
XCTAssertNotNil(mapView.style?.layer(withIdentifier: "contour"))
}
+
+ func testMGLMapView() {
+ //#-example-code
+ #if os(macOS)
+ class MapClickGestureRecognizer: NSClickGestureRecognizer {
+ override func shouldRequireFailure(of otherGestureRecognizer: NSGestureRecognizer) -> Bool {
+ return otherGestureRecognizer is NSClickGestureRecognizer
+ }
+ }
+ #else
+ let mapTapGestureRecognizer = UITapGestureRecognizer(target: self, action: #selector(myCustomFunction))
+ for recognizer in mapView.gestureRecognizers! where recognizer is UITapGestureRecognizer {
+ mapTapGestureRecognizer.require(toFail: recognizer)
+ }
+ mapView.addGestureRecognizer(mapTapGestureRecognizer)
+ #endif
+ //#-end-example-code
+ }
+
+ // For testMGLMapView().
+ func myCustomFunction() {}
}