From aa0a0e55806ac4a56c42a5d19fa0c4b3e8a9c51e Mon Sep 17 00:00:00 2001 From: Julian Rex Date: Fri, 14 Dec 2018 10:33:53 -0500 Subject: [PATCH 1/6] Initial work in updating styles. --- platform/default/include/mbgl/util/default_styles.hpp | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/platform/default/include/mbgl/util/default_styles.hpp b/platform/default/include/mbgl/util/default_styles.hpp index 13f08252a72..335d3ea5f9b 100644 --- a/platform/default/include/mbgl/util/default_styles.hpp +++ b/platform/default/include/mbgl/util/default_styles.hpp @@ -13,12 +13,12 @@ struct DefaultStyle { const unsigned currentVersion; }; -constexpr const DefaultStyle streets = { "mapbox://styles/mapbox/streets-v10", "Streets", 10 }; -constexpr const DefaultStyle outdoors = { "mapbox://styles/mapbox/outdoors-v10", "Outdoors", 10 }; -constexpr const DefaultStyle light = { "mapbox://styles/mapbox/light-v9", "Light", 9 }; -constexpr const DefaultStyle dark = { "mapbox://styles/mapbox/dark-v9", "Dark", 9 }; +constexpr const DefaultStyle streets = { "mapbox://styles/mapbox/streets-v11", "Streets", 11 }; +constexpr const DefaultStyle outdoors = { "mapbox://styles/mapbox/outdoors-v11", "Outdoors", 11 }; +constexpr const DefaultStyle light = { "mapbox://styles/mapbox/light-v10", "Light", 10 }; +constexpr const DefaultStyle dark = { "mapbox://styles/mapbox/dark-v10", "Dark", 10 }; constexpr const DefaultStyle satellite = { "mapbox://styles/mapbox/satellite-v9", "Satellite", 9 }; -constexpr const DefaultStyle satelliteStreets = { "mapbox://styles/mapbox/satellite-streets-v10", "Satellite Streets", 10 }; +constexpr const DefaultStyle satelliteStreets = { "mapbox://styles/mapbox/satellite-streets-v11", "Satellite Streets", 11 }; const DefaultStyle orderedStyles[] = { streets, outdoors, light, dark, satellite, satelliteStreets, From f5337a751ea5773015e5fa4ad3872ab97fb4f3ea Mon Sep 17 00:00:00 2001 From: Julian Rex Date: Fri, 14 Dec 2018 10:48:51 -0500 Subject: [PATCH 2/6] Update `MGLStyleDefaultVersion` --- platform/darwin/src/MGLStyle.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/platform/darwin/src/MGLStyle.h b/platform/darwin/src/MGLStyle.h index 2b2f0998d42..547b7ccee5a 100644 --- a/platform/darwin/src/MGLStyle.h +++ b/platform/darwin/src/MGLStyle.h @@ -29,7 +29,7 @@ NS_ASSUME_NONNULL_BEGIN the constant itself. Such details may change significantly from version to version. */ -static MGL_EXPORT const NSInteger MGLStyleDefaultVersion = 10; +static MGL_EXPORT const NSInteger MGLStyleDefaultVersion = 11; FOUNDATION_EXTERN MGL_EXPORT MGLExceptionName const MGLInvalidStyleURLException; FOUNDATION_EXTERN MGL_EXPORT MGLExceptionName const MGLRedundantLayerException; From 069af6daab11f18af723fe3eac7ae5ea6e216dc5 Mon Sep 17 00:00:00 2001 From: Julian Rex Date: Mon, 17 Dec 2018 11:49:17 -0500 Subject: [PATCH 3/6] Added entry for streets-v11 --- test/util/mapbox.test.cpp | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/test/util/mapbox.test.cpp b/test/util/mapbox.test.cpp index 33bd6e72ee6..c29be37a382 100644 --- a/test/util/mapbox.test.cpp +++ b/test/util/mapbox.test.cpp @@ -96,6 +96,11 @@ TEST(Mapbox, SpriteURL) { mbgl::util::mapbox::normalizeSpriteURL(util::API_BASE_URL, "mapbox://sprites/mapbox/streets-v10?fresh=true.png", "key")); + EXPECT_EQ( + "https://api.mapbox.com/styles/v1/mapbox/streets-v11/sprite?access_token=key&fresh=true.png", + mbgl::util::mapbox::normalizeSpriteURL(util::API_BASE_URL, + "mapbox://sprites/mapbox/streets-v11?fresh=true.png", + "key")); EXPECT_EQ("mapbox://////", mbgl::util::mapbox::normalizeSpriteURL(util::API_BASE_URL, "mapbox://////", "key")); } From 65f5f96faad3ba55db280eee4b2128dac5e380e2 Mon Sep 17 00:00:00 2001 From: Julian Rex Date: Mon, 17 Dec 2018 15:13:33 -0500 Subject: [PATCH 4/6] Updated changelogs, removed redundant test. --- platform/ios/CHANGELOG.md | 1 + platform/macos/CHANGELOG.md | 2 ++ test/util/mapbox.test.cpp | 5 ----- 3 files changed, 3 insertions(+), 5 deletions(-) diff --git a/platform/ios/CHANGELOG.md b/platform/ios/CHANGELOG.md index ffb4a53cf03..6f17a276190 100644 --- a/platform/ios/CHANGELOG.md +++ b/platform/ios/CHANGELOG.md @@ -18,6 +18,7 @@ Mapbox welcomes participation and contributions from everyone. Please read [CONT * `-[MGLStyle localizeLabelsIntoLocale:]` and `-[NSExpression(MGLAdditions) mgl_expressionLocalizedIntoLocale:]` can automatically localize styles that use version 8 of the Mapbox Streets source. ([#13481](https://github.com/mapbox/mapbox-gl-native/pull/13481)) * Fixed symbol flickering during instantaneous transitions. ([#13535](https://github.com/mapbox/mapbox-gl-native/pull/13535)) * Added an `MGLStyle.enablePlacementTransitions` property to control how long it takes for collided labels to fade out. ([#13565](https://github.com/mapbox/mapbox-gl-native/pull/13565)) +* `MGLMapView`, `MGLShapeOfflineRegion`, and `MGLTilePyramidOfflineRegion` now default to version 11 of the Mapbox Streets style. Similarly, several class properties of `MGLStyle`, such as `MGLStyle.lightStyleURL`, have been updated to return URLs to new versions of their respective styles. ### Map snapshots diff --git a/platform/macos/CHANGELOG.md b/platform/macos/CHANGELOG.md index 3c1ffdd1881..8b84d64ce11 100644 --- a/platform/macos/CHANGELOG.md +++ b/platform/macos/CHANGELOG.md @@ -11,6 +11,8 @@ * Added support for automatic localization of version 8 of the Mapbox Streets source. ([#13481](https://github.com/mapbox/mapbox-gl-native/pull/13481)) * Fixed symbol flickering during instantaneous transitions. ([#13535](https://github.com/mapbox/mapbox-gl-native/pull/13535)) * Added an `MGLStyle.enablePlacementTransitions` property to control how long it takes for collided labels to fade out. ([#13565](https://github.com/mapbox/mapbox-gl-native/pull/13565)) +* `MGLMapView`, `MGLShapeOfflineRegion`, and `MGLTilePyramidOfflineRegion` now default to version 11 of the Mapbox Streets style. Similarly, several class properties of `MGLStyle`, such as `MGLStyle.lightStyleURL`, have been updated to return URLs to new versions of their respective styles. + ### Other changes diff --git a/test/util/mapbox.test.cpp b/test/util/mapbox.test.cpp index c29be37a382..20af31b822d 100644 --- a/test/util/mapbox.test.cpp +++ b/test/util/mapbox.test.cpp @@ -91,11 +91,6 @@ TEST(Mapbox, SpriteURL) { EXPECT_EQ( "https://api.mapbox.com/styles/v1/mapbox/streets-v8/draft/sprite@2x.png?access_token=key", mbgl::util::mapbox::normalizeSpriteURL(util::API_BASE_URL, "mapbox://sprites/mapbox/streets-v8/draft@2x.png", "key")); - EXPECT_EQ( - "https://api.mapbox.com/styles/v1/mapbox/streets-v10/sprite?access_token=key&fresh=true.png", - mbgl::util::mapbox::normalizeSpriteURL(util::API_BASE_URL, - "mapbox://sprites/mapbox/streets-v10?fresh=true.png", - "key")); EXPECT_EQ( "https://api.mapbox.com/styles/v1/mapbox/streets-v11/sprite?access_token=key&fresh=true.png", mbgl::util::mapbox::normalizeSpriteURL(util::API_BASE_URL, From e3f340881d8f29396cc980cdad9100b3489dc944 Mon Sep 17 00:00:00 2001 From: Julian Rex Date: Mon, 17 Dec 2018 18:11:40 -0500 Subject: [PATCH 5/6] Integration test for default style loading --- .../MGLStyleURLIntegrationTest.m | 38 +++++++++++++++++++ platform/ios/ios.xcodeproj/project.pbxproj | 4 ++ 2 files changed, 42 insertions(+) create mode 100644 platform/ios/Integration Tests/MGLStyleURLIntegrationTest.m diff --git a/platform/ios/Integration Tests/MGLStyleURLIntegrationTest.m b/platform/ios/Integration Tests/MGLStyleURLIntegrationTest.m new file mode 100644 index 00000000000..e022248f4d0 --- /dev/null +++ b/platform/ios/Integration Tests/MGLStyleURLIntegrationTest.m @@ -0,0 +1,38 @@ +#import "MGLMapViewIntegrationTest.h" + +@interface MGLStyleURLIntegrationTest : MGLMapViewIntegrationTest +@end + +@implementation MGLStyleURLIntegrationTest + +- (void)testLoadingStreetsStyleURL { + self.mapView.styleURL = [MGLStyle streetsStyleURL]; + [self waitForMapViewToFinishLoadingStyleWithTimeout:5]; +} + +- (void)testLoadingOutdoorsStyleURL { + self.mapView.styleURL = [MGLStyle outdoorsStyleURL]; + [self waitForMapViewToFinishLoadingStyleWithTimeout:5]; +} + +- (void)testLoadingLightStyleURL { + self.mapView.styleURL = [MGLStyle lightStyleURL]; + [self waitForMapViewToFinishLoadingStyleWithTimeout:5]; +} + +- (void)testLoadingDarkStyleURL { + self.mapView.styleURL = [MGLStyle darkStyleURL]; + [self waitForMapViewToFinishLoadingStyleWithTimeout:5]; +} + +- (void)testLoadingSatelliteStyleURL { + self.mapView.styleURL = [MGLStyle satelliteStyleURL]; + [self waitForMapViewToFinishLoadingStyleWithTimeout:5]; +} + +- (void)testLoadingSatelliteStreetsStyleURL { + self.mapView.styleURL = [MGLStyle satelliteStreetsStyleURL]; + [self waitForMapViewToFinishLoadingStyleWithTimeout:5]; +} + +@end diff --git a/platform/ios/ios.xcodeproj/project.pbxproj b/platform/ios/ios.xcodeproj/project.pbxproj index 77cf0dd6d9c..e58bdbac31e 100644 --- a/platform/ios/ios.xcodeproj/project.pbxproj +++ b/platform/ios/ios.xcodeproj/project.pbxproj @@ -478,6 +478,7 @@ CA55CD41202C16AA00CE7095 /* MGLCameraChangeReason.h in Headers */ = {isa = PBXBuildFile; fileRef = CA55CD3E202C16AA00CE7095 /* MGLCameraChangeReason.h */; settings = {ATTRIBUTES = (Public, ); }; }; CA55CD42202C16AA00CE7095 /* MGLCameraChangeReason.h in Headers */ = {isa = PBXBuildFile; fileRef = CA55CD3E202C16AA00CE7095 /* MGLCameraChangeReason.h */; settings = {ATTRIBUTES = (Public, ); }; }; CA6914B520E67F50002DB0EE /* MGLAnnotationViewIntegrationTests.m in Sources */ = {isa = PBXBuildFile; fileRef = CA6914B420E67F50002DB0EE /* MGLAnnotationViewIntegrationTests.m */; }; + CA88DC3021C85D900059ED5A /* MGLStyleURLIntegrationTest.m in Sources */ = {isa = PBXBuildFile; fileRef = CA88DC2F21C85D900059ED5A /* MGLStyleURLIntegrationTest.m */; }; CA8FBC0921A47BB100D1203C /* MGLRendererConfigurationTests.mm in Sources */ = {isa = PBXBuildFile; fileRef = CA8FBC0821A47BB100D1203C /* MGLRendererConfigurationTests.mm */; }; CAA69DA4206DCD0E007279CD /* Mapbox.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = DA4A26961CB6E795000B7809 /* Mapbox.framework */; }; CAA69DA5206DCD0E007279CD /* Mapbox.framework in Embed Frameworks */ = {isa = PBXBuildFile; fileRef = DA4A26961CB6E795000B7809 /* Mapbox.framework */; settings = {ATTRIBUTES = (CodeSignOnCopy, RemoveHeadersOnCopy, ); }; }; @@ -1143,6 +1144,7 @@ CA55CD3E202C16AA00CE7095 /* MGLCameraChangeReason.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MGLCameraChangeReason.h; sourceTree = ""; }; CA5E5042209BDC5F001A8A81 /* MGLTestUtility.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; name = MGLTestUtility.h; path = ../../darwin/test/MGLTestUtility.h; sourceTree = ""; }; CA6914B420E67F50002DB0EE /* MGLAnnotationViewIntegrationTests.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; name = MGLAnnotationViewIntegrationTests.m; path = "Annotation Tests/MGLAnnotationViewIntegrationTests.m"; sourceTree = ""; }; + CA88DC2F21C85D900059ED5A /* MGLStyleURLIntegrationTest.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = MGLStyleURLIntegrationTest.m; sourceTree = ""; }; CA8FBC0821A47BB100D1203C /* MGLRendererConfigurationTests.mm */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.objcpp; name = MGLRendererConfigurationTests.mm; path = ../../darwin/test/MGLRendererConfigurationTests.mm; sourceTree = ""; }; CAE7AD5320F46EF5003B6782 /* integration-Bridging-Header.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = "integration-Bridging-Header.h"; sourceTree = ""; }; CAE7AD5420F46EF5003B6782 /* MGLMapSnapshotterSwiftTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = MGLMapSnapshotterSwiftTests.swift; sourceTree = ""; }; @@ -1484,6 +1486,7 @@ CA0C27932076CA19001CE5B7 /* MGLMapViewIntegrationTest.m */, CA0C27952076CA50001CE5B7 /* MGLMapViewIntegrationTest.h */, CA4EB8C620863487006AB465 /* MGLStyleLayerIntegrationTests.m */, + CA88DC2F21C85D900059ED5A /* MGLStyleURLIntegrationTest.m */, 077061DB215DA11F000FEF62 /* MGLTestLocationManager.h */, 077061D9215DA00E000FEF62 /* MGLTestLocationManager.m */, ); @@ -3027,6 +3030,7 @@ CA4EB8C720863487006AB465 /* MGLStyleLayerIntegrationTests.m in Sources */, CA34C9C3207FD272005C1A06 /* MGLCameraTransitionTests.mm in Sources */, 16376B0A1FFD9DAF0000563E /* MBGLIntegrationTests.m in Sources */, + CA88DC3021C85D900059ED5A /* MGLStyleURLIntegrationTest.m in Sources */, CA0C27942076CA19001CE5B7 /* MGLMapViewIntegrationTest.m in Sources */, CAE7AD5520F46EF5003B6782 /* MGLMapSnapshotterSwiftTests.swift in Sources */, CA0C27922076C804001CE5B7 /* MGLShapeSourceTests.m in Sources */, From 4fe9b9c873bd3a81fd6d9ad131f5f1029dce346a Mon Sep 17 00:00:00 2001 From: Julian Rex Date: Mon, 17 Dec 2018 21:58:26 -0500 Subject: [PATCH 6/6] Rejigged tests. --- .../MGLStyleURLIntegrationTest.m | 28 +++++++++++-------- 1 file changed, 16 insertions(+), 12 deletions(-) diff --git a/platform/ios/Integration Tests/MGLStyleURLIntegrationTest.m b/platform/ios/Integration Tests/MGLStyleURLIntegrationTest.m index e022248f4d0..f9217bae5fc 100644 --- a/platform/ios/Integration Tests/MGLStyleURLIntegrationTest.m +++ b/platform/ios/Integration Tests/MGLStyleURLIntegrationTest.m @@ -5,34 +5,38 @@ @interface MGLStyleURLIntegrationTest : MGLMapViewIntegrationTest @implementation MGLStyleURLIntegrationTest -- (void)testLoadingStreetsStyleURL { - self.mapView.styleURL = [MGLStyle streetsStyleURL]; +- (void)internalTestWithStyleSelector:(SEL)selector { + if (![self validAccessToken]) { + return; + } + + self.mapView.styleURL = [MGLStyle performSelector:selector]; [self waitForMapViewToFinishLoadingStyleWithTimeout:5]; } + +- (void)testLoadingStreetsStyleURL { + [self internalTestWithStyleSelector:@selector(streetsStyleURL)]; +} + - (void)testLoadingOutdoorsStyleURL { - self.mapView.styleURL = [MGLStyle outdoorsStyleURL]; - [self waitForMapViewToFinishLoadingStyleWithTimeout:5]; + [self internalTestWithStyleSelector:@selector(outdoorsStyleURL)]; } - (void)testLoadingLightStyleURL { - self.mapView.styleURL = [MGLStyle lightStyleURL]; - [self waitForMapViewToFinishLoadingStyleWithTimeout:5]; + [self internalTestWithStyleSelector:@selector(lightStyleURL)]; } - (void)testLoadingDarkStyleURL { - self.mapView.styleURL = [MGLStyle darkStyleURL]; - [self waitForMapViewToFinishLoadingStyleWithTimeout:5]; + [self internalTestWithStyleSelector:@selector(darkStyleURL)]; } - (void)testLoadingSatelliteStyleURL { - self.mapView.styleURL = [MGLStyle satelliteStyleURL]; - [self waitForMapViewToFinishLoadingStyleWithTimeout:5]; + [self internalTestWithStyleSelector:@selector(satelliteStyleURL)]; } - (void)testLoadingSatelliteStreetsStyleURL { - self.mapView.styleURL = [MGLStyle satelliteStreetsStyleURL]; - [self waitForMapViewToFinishLoadingStyleWithTimeout:5]; + [self internalTestWithStyleSelector:@selector(satelliteStreetsStyleURL)]; } @end