This repository has been archived by the owner on Aug 8, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 1.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Julian Rex
committed
Sep 10, 2019
1 parent
35f61f0
commit 758acb6
Showing
2 changed files
with
49 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
import XCTest | ||
|
||
class MGLSourceTests: MGLMapViewIntegrationTest { | ||
|
||
// See testForRaisingExceptionsOnStaleStyleObjects for Obj-C sibling. | ||
func testForRaisingExceptionsOnStaleStyleObjectsOnRemoveFromMapView() { | ||
|
||
guard | ||
let configURL = URL(string: "mapbox://examples.2uf7qges") else { | ||
XCTFail() | ||
return | ||
} | ||
|
||
let source = MGLVectorTileSource(identifier: "trees", configurationURL: configURL) | ||
mapView.style?.addSource(source) | ||
|
||
let bundle = Bundle(for: type(of: self)) | ||
|
||
guard let styleURL = bundle.url(forResource: "one-liner", withExtension: "json") else { | ||
XCTFail() | ||
return | ||
} | ||
|
||
styleLoadingExpectation = nil; | ||
|
||
mapView.centerCoordinate = CLLocationCoordinate2D(latitude : 38.897, longitude : -77.039) | ||
mapView.zoomLevel = 10.5 | ||
mapView.styleURL = styleURL | ||
|
||
waitForMapViewToFinishLoadingStyle(withTimeout: 10.0) | ||
|
||
let expect = expectation(description: "Remove source should error") | ||
|
||
do { | ||
try mapView.style?.removeSource(source, error: ()) | ||
} | ||
catch let error as NSError { | ||
XCTAssertEqual(error.domain, MGLErrorDomain) | ||
XCTAssertEqual(error.code, MGLErrorCode.sourceCannotBeRemovedFromStyle.rawValue) | ||
expect.fulfill() | ||
} | ||
|
||
wait(for: [expect], timeout: 0.1) | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters