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.
[core] Load source TileJSON immediately
This reverses #3095. Rationale: * We're now exposing source attributes as a public API. Making those attributes unavailable at certain times complicates that API. * We're preparing to split RenderSource out of Source. Removing this removes a point of coupling between the two.
- Loading branch information
1 parent
c2b0037
commit 197751b
Showing
9 changed files
with
12 additions
and
239 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 |
---|---|---|
@@ -1,73 +1,25 @@ | ||
#import <Mapbox/Mapbox.h> | ||
|
||
#import "NSBundle+MGLAdditions.h" | ||
|
||
#import <XCTest/XCTest.h> | ||
#if TARGET_OS_IPHONE | ||
#import <UIKit/UIKit.h> | ||
#else | ||
#import <Cocoa/Cocoa.h> | ||
#endif | ||
|
||
@interface MGLSourceQueryTests : XCTestCase <MGLMapViewDelegate> | ||
|
||
@property (nonatomic) MGLMapView *mapView; | ||
@property (nonatomic) MGLStyle *style; | ||
|
||
@end | ||
|
||
@implementation MGLSourceQueryTests { | ||
XCTestExpectation *_styleLoadingExpectation; | ||
} | ||
|
||
- (void)setUp { | ||
[super setUp]; | ||
|
||
[MGLAccountManager setAccessToken:@"pk.feedcafedeadbeefbadebede"]; | ||
NSURL *styleURL = [[NSBundle bundleForClass:[self class]] URLForResource:@"query-style" withExtension:@"json"]; | ||
self.mapView = [[MGLMapView alloc] initWithFrame:CGRectMake(0, 0, 100, 100) styleURL:styleURL]; | ||
self.mapView.delegate = self; | ||
if (!self.mapView.style) { | ||
_styleLoadingExpectation = [self expectationWithDescription:@"Map view should finish loading style."]; | ||
[self waitForExpectationsWithTimeout:1 handler:nil]; | ||
} | ||
} | ||
|
||
- (void)mapView:(MGLMapView *)mapView didFinishLoadingStyle:(MGLStyle *)style { | ||
XCTAssertNotNil(mapView.style); | ||
XCTAssertEqual(mapView.style, style); | ||
|
||
[_styleLoadingExpectation fulfill]; | ||
} | ||
|
||
- (void)tearDown { | ||
_styleLoadingExpectation = nil; | ||
self.mapView = nil; | ||
|
||
[super tearDown]; | ||
} | ||
|
||
- (MGLStyle *)style { | ||
return self.mapView.style; | ||
} | ||
@implementation MGLSourceQueryTests | ||
|
||
- (void) testQueryVectorSource { | ||
MGLVectorSource *source = (MGLVectorSource *)[self.style sourceWithIdentifier:@"source5"]; | ||
|
||
MGLVectorSource *source = [[MGLVectorSource alloc] initWithIdentifier:@"vector" tileURLTemplates:@[@"fake"] options:nil]; | ||
NSSet *sourceLayers = [NSSet setWithObjects:@"buildings", @"water", nil]; | ||
NSArray* features = [source featuresInSourceLayersWithIdentifiers:sourceLayers predicate:nil]; | ||
// Source won't be loaded yet, so features is 0 | ||
// Source not added yet, so features is 0 | ||
XCTAssertEqual([features count], 0); | ||
} | ||
|
||
- (void) testQueryShapeSource { | ||
MGLShapeSource *source = (MGLShapeSource *)[self.style sourceWithIdentifier:@"source4"]; | ||
|
||
NSPredicate *eqPredicate = [NSPredicate predicateWithFormat:@"key1 == 'value1'"]; | ||
NSArray* features = [source featuresMatchingPredicate:eqPredicate]; | ||
// Source won't be loaded yet, so features is 0 | ||
MGLShapeSource *source = [[MGLShapeSource alloc] initWithIdentifier:@"shape" shape:[MGLShapeCollection shapeCollectionWithShapes:@[]] options:nil]; | ||
NSArray* features = [source featuresMatchingPredicate:nil]; | ||
// Source not added yet, so features is 0 | ||
XCTAssertEqual([features count], 0); | ||
|
||
} | ||
|
||
@end |
This file was deleted.
Oops, something went wrong.
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
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
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
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 |
---|---|---|
|
@@ -3,7 +3,7 @@ | |
"sources": { | ||
"fake": { | ||
"type": "vector", | ||
"url": "fake" | ||
"tiles": ["fake"] | ||
} | ||
}, | ||
"layers": [{ | ||
|
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
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
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