diff options
Diffstat (limited to 'platform/darwin/test/MGLDocumentationExampleTests.swift')
-rw-r--r-- | platform/darwin/test/MGLDocumentationExampleTests.swift | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/platform/darwin/test/MGLDocumentationExampleTests.swift b/platform/darwin/test/MGLDocumentationExampleTests.swift index 42c656f203..8762af9ba4 100644 --- a/platform/darwin/test/MGLDocumentationExampleTests.swift +++ b/platform/darwin/test/MGLDocumentationExampleTests.swift @@ -278,6 +278,24 @@ class MGLDocumentationExampleTests: XCTestCase, MGLMapViewDelegate { //#-end-example-code } + func testMGLMapSnapshotter() { + //#-example-code + let camera = MGLMapCamera(lookingAtCenter: CLLocationCoordinate2D(latitude: 37.7184, longitude: -122.4365), fromDistance: 100, pitch: 20, heading: 0) + + let options = MGLMapSnapshotOptions(styleURL: MGLStyle.satelliteStreetsStyleURL(), camera: camera, size: CGSize(width: 320, height: 480)) + options.zoomLevel = 10 + + let snapshotter = MGLMapSnapshotter(options: options) + snapshotter.start { (snapshot, error) in + if error != nil { + // error handler + } else { + // image handler + } + } + //#-end-example-code + } + // For testMGLMapView(). func myCustomFunction() {} } |