diff options
Diffstat (limited to 'test')
-rw-r--r-- | test/storage/offline.test.cpp | 25 | ||||
-rw-r--r-- | test/storage/offline_database.test.cpp | 112 | ||||
-rw-r--r-- | test/storage/offline_download.test.cpp | 138 |
3 files changed, 144 insertions, 131 deletions
diff --git a/test/storage/offline.test.cpp b/test/storage/offline.test.cpp index 8335e43db1..227f9f7c1a 100644 --- a/test/storage/offline.test.cpp +++ b/test/storage/offline.test.cpp @@ -7,30 +7,37 @@ using namespace mbgl; TEST(OfflineTilePyramidRegionDefinition, EncodeDecode) { - OfflineTilePyramidRegionDefinition region("mapbox://style", LatLngBounds::hull({ 37.6609, -122.5744 }, { 37.8271, -122.3204 }), 0, 20, 1.0, true); + const auto kBounds = LatLngBounds::hull({37.6609, -122.5744}, {37.8271, -122.3204}); + OfflineRegionDefinition region("mapbox://style", kBounds, 0, 20, 1.0, true); auto encoded = encodeOfflineRegionDefinition(region); - auto decoded = decodeOfflineRegionDefinition(encoded).get<OfflineTilePyramidRegionDefinition>(); - + auto decoded = decodeOfflineRegionDefinition(encoded); + EXPECT_EQ(decoded.styleURL, region.styleURL); EXPECT_EQ(decoded.minZoom, region.minZoom); EXPECT_EQ(decoded.maxZoom, region.maxZoom); EXPECT_EQ(decoded.pixelRatio, region.pixelRatio); - EXPECT_EQ(decoded.bounds.southwest(), region.bounds.southwest()); - EXPECT_EQ(decoded.bounds.northeast(), region.bounds.northeast()); + EXPECT_EQ(decoded.location, region.location); + EXPECT_EQ(decoded.isGeometryDefined(), region.isGeometryDefined()); + ASSERT_FALSE(decoded.isGeometryDefined()); + EXPECT_EQ(kBounds, decoded.location.get<LatLngBounds>()); EXPECT_EQ(decoded.includeIdeographs, region.includeIdeographs); } TEST(OfflineGeometryRegionDefinition, EncodeDecode) { - OfflineGeometryRegionDefinition region("mapbox://style", Point<double>(-122.5744, 37.6609), 0, 2, 1.0, false); + const Geometry<double> kGeometry{Point<double>(-122.5744, 37.6609)}; + OfflineRegionDefinition region("mapbox://style", kGeometry, 0, 2, 1.0, false); auto encoded = encodeOfflineRegionDefinition(region); - auto decoded = decodeOfflineRegionDefinition(encoded).get<OfflineGeometryRegionDefinition>(); - + auto decoded = decodeOfflineRegionDefinition(encoded); + EXPECT_EQ(decoded.styleURL, region.styleURL); EXPECT_EQ(decoded.minZoom, region.minZoom); EXPECT_EQ(decoded.maxZoom, region.maxZoom); EXPECT_EQ(decoded.pixelRatio, region.pixelRatio); - EXPECT_EQ(decoded.geometry, region.geometry); + EXPECT_EQ(decoded.location, region.location); + EXPECT_EQ(decoded.isGeometryDefined(), region.isGeometryDefined()); + ASSERT_TRUE(decoded.isGeometryDefined()); + EXPECT_EQ(kGeometry, decoded.location.get<Geometry<double>>()); EXPECT_EQ(decoded.includeIdeographs, region.includeIdeographs); } diff --git a/test/storage/offline_database.test.cpp b/test/storage/offline_database.test.cpp index 6b444bf3d1..ea987a6838 100644 --- a/test/storage/offline_database.test.cpp +++ b/test/storage/offline_database.test.cpp @@ -431,32 +431,29 @@ TEST(OfflineDatabase, PutTileNotFound) { TEST(OfflineDatabase, CreateRegion) { FixtureLog log; OfflineDatabase db(":memory:"); - OfflineTilePyramidRegionDefinition definition { "http://example.com/style", LatLngBounds::hull({1, 2}, {3, 4}), 5, 6, 2.0, true }; + const auto bounds = LatLngBounds::hull({1, 2}, {3, 4}); + OfflineRegionDefinition definition{"http://example.com/style", bounds, 5, 6, 2.0, true}; OfflineRegionMetadata metadata {{ 1, 2, 3 }}; auto region = db.createRegion(definition, metadata); ASSERT_TRUE(region); EXPECT_EQ(0u, log.uncheckedCount()); + const auto& def = region->getDefinition(); + EXPECT_EQ(definition.styleURL, def.styleURL); + EXPECT_EQ(definition.minZoom, def.minZoom); + EXPECT_EQ(definition.maxZoom, def.maxZoom); + EXPECT_EQ(definition.pixelRatio, def.pixelRatio); + EXPECT_EQ(definition.includeIdeographs, def.includeIdeographs); + EXPECT_EQ(definition.isGeometryDefined(), def.isGeometryDefined()); - region->getDefinition().match( - [&](OfflineTilePyramidRegionDefinition& def) { - EXPECT_EQ(definition.styleURL, def.styleURL); - EXPECT_EQ(definition.bounds, def.bounds); - EXPECT_EQ(definition.minZoom, def.minZoom); - EXPECT_EQ(definition.maxZoom, def.maxZoom); - EXPECT_EQ(definition.pixelRatio, def.pixelRatio); - EXPECT_EQ(definition.includeIdeographs, def.includeIdeographs); - }, [](auto&) { - EXPECT_FALSE(false); - } - ); + def.location.match([&](LatLngBounds& bounds_) { EXPECT_EQ(bounds, bounds_); }, [](auto&) { EXPECT_FALSE(false); }); EXPECT_EQ(metadata, region->getMetadata()); } TEST(OfflineDatabase, UpdateMetadata) { FixtureLog log; OfflineDatabase db(":memory:"); - OfflineTilePyramidRegionDefinition definition { "http://example.com/style", LatLngBounds::hull({1, 2}, {3, 4}), 5, 6, 2.0, true }; + OfflineRegionDefinition definition{"http://example.com/style", LatLngBounds::hull({1, 2}, {3, 4}), 5, 6, 2.0, true}; OfflineRegionMetadata metadata {{ 1, 2, 3 }}; auto region = db.createRegion(definition, metadata); ASSERT_TRUE(region); @@ -472,7 +469,8 @@ TEST(OfflineDatabase, UpdateMetadata) { TEST(OfflineDatabase, ListRegions) { FixtureLog log; OfflineDatabase db(":memory:"); - OfflineTilePyramidRegionDefinition definition { "http://example.com/style", LatLngBounds::hull({1, 2}, {3, 4}), 5, 6, 2.0, false }; + OfflineRegionDefinition definition{ + "http://example.com/style", LatLngBounds::hull({1, 2}, {3, 4}), 5, 6, 2.0, false}; OfflineRegionMetadata metadata {{ 1, 2, 3 }}; auto region = db.createRegion(definition, metadata); @@ -482,18 +480,13 @@ TEST(OfflineDatabase, ListRegions) { ASSERT_EQ(1u, regions.size()); EXPECT_EQ(region->getID(), regions.at(0).getID()); - regions.at(0).getDefinition().match( - [&](OfflineTilePyramidRegionDefinition& def) { - EXPECT_EQ(definition.styleURL, def.styleURL); - EXPECT_EQ(definition.bounds, def.bounds); - EXPECT_EQ(definition.minZoom, def.minZoom); - EXPECT_EQ(definition.maxZoom, def.maxZoom); - EXPECT_EQ(definition.pixelRatio, def.pixelRatio); - EXPECT_EQ(definition.includeIdeographs, def.includeIdeographs); - }, - [&](auto&) { - EXPECT_FALSE(false); - }); + const auto& def = regions.at(0).getDefinition(); + EXPECT_EQ(definition.styleURL, def.styleURL); + EXPECT_EQ(definition.location, def.location); + EXPECT_EQ(definition.minZoom, def.minZoom); + EXPECT_EQ(definition.maxZoom, def.maxZoom); + EXPECT_EQ(definition.pixelRatio, def.pixelRatio); + EXPECT_EQ(definition.includeIdeographs, def.includeIdeographs); EXPECT_EQ(metadata, regions.at(0).getMetadata()); EXPECT_EQ(0u, log.uncheckedCount()); @@ -502,25 +495,21 @@ TEST(OfflineDatabase, ListRegions) { TEST(OfflineDatabase, GetRegionDefinition) { FixtureLog log; OfflineDatabase db(":memory:"); - OfflineTilePyramidRegionDefinition definition { "http://example.com/style", LatLngBounds::hull({1, 2}, {3, 4}), 5, 6, 2.0, false }; + OfflineRegionDefinition definition{ + "http://example.com/style", LatLngBounds::hull({1, 2}, {3, 4}), 5, 6, 2.0, false}; OfflineRegionMetadata metadata {{ 1, 2, 3 }}; EXPECT_EQ(0u, log.uncheckedCount()); auto region = db.createRegion(definition, metadata); - db.getRegionDefinition(region->getID())->match( - [&](OfflineTilePyramidRegionDefinition& result) { - EXPECT_EQ(definition.styleURL, result.styleURL); - EXPECT_EQ(definition.bounds, result.bounds); - EXPECT_EQ(definition.minZoom, result.minZoom); - EXPECT_EQ(definition.maxZoom, result.maxZoom); - EXPECT_EQ(definition.pixelRatio, result.pixelRatio); - EXPECT_EQ(definition.includeIdeographs, result.includeIdeographs); - }, - [&](auto&) { - EXPECT_FALSE(false); - } - ); + auto result = db.getRegionDefinition(region->getID()); + ASSERT_TRUE(result); + EXPECT_EQ(definition.styleURL, result->styleURL); + EXPECT_EQ(definition.location, result->location); + EXPECT_EQ(definition.minZoom, result->minZoom); + EXPECT_EQ(definition.maxZoom, result->maxZoom); + EXPECT_EQ(definition.pixelRatio, result->pixelRatio); + EXPECT_EQ(definition.includeIdeographs, result->includeIdeographs); } // Disabled due to flakiness: https://github.com/mapbox/mapbox-gl-native/issues/14966 @@ -546,7 +535,7 @@ TEST(OfflineDatabase, TEST_REQUIRES_WRITE(DISABLED_MaximumAmbientCacheSize)) { OfflineDatabase db(filename); db.setMaximumAmbientCacheSize(maximumSize); // 50 MB - OfflineTilePyramidRegionDefinition definition{ "mapbox://style", LatLngBounds::hull({1, 2}, {3, 4}), 5, 6, 2.0, true }; + OfflineRegionDefinition definition{"mapbox://style", LatLngBounds::hull({1, 2}, {3, 4}), 5, 6, 2.0, true}; OfflineRegionMetadata metadata{{ 1, 2, 3 }}; auto region = db.createRegion(definition, metadata); @@ -690,7 +679,7 @@ TEST(OfflineDatabase, TEST_REQUIRES_WRITE(DeleteRegion)) { OfflineDatabase db(filename); - OfflineTilePyramidRegionDefinition definition{ "mapbox://style", LatLngBounds::hull({1, 2}, {3, 4}), 5, 6, 2.0, true }; + OfflineRegionDefinition definition{"mapbox://style", LatLngBounds::hull({1, 2}, {3, 4}), 5, 6, 2.0, true}; OfflineRegionMetadata metadata{{ 1, 2, 3 }}; auto region1 = db.createRegion(definition, metadata); @@ -787,10 +776,10 @@ TEST(OfflineDatabase, MapboxTileLimitExceeded) { db.putRegionResource(regionID, tile, response); }; - OfflineTilePyramidRegionDefinition definition1{ "mapbox://style1", LatLngBounds::hull({1, 2}, {3, 4}), 5, 6, 2.0, true }; + OfflineRegionDefinition definition1{"mapbox://style1", LatLngBounds::hull({1, 2}, {3, 4}), 5, 6, 2.0, true}; OfflineRegionMetadata metadata1{{ 1, 2, 3 }}; - OfflineTilePyramidRegionDefinition definition2{ "mapbox://style2", LatLngBounds::hull({1, 2}, {3, 4}), 5, 6, 2.0, true }; + OfflineRegionDefinition definition2{"mapbox://style2", LatLngBounds::hull({1, 2}, {3, 4}), 5, 6, 2.0, true}; OfflineRegionMetadata metadata2{{ 1, 2, 3 }}; auto region1 = db.createRegion(definition1, metadata1); @@ -881,7 +870,7 @@ TEST(OfflineDatabase, Invalidate) { const Resource ambientStyle = Resource::style("mapbox://style_ambient"); db.put(ambientStyle, response); - OfflineTilePyramidRegionDefinition definition { "mapbox://style", LatLngBounds::hull({1, 2}, {3, 4}), 5, 6, 2.0, true }; + OfflineRegionDefinition definition{"mapbox://style", LatLngBounds::hull({1, 2}, {3, 4}), 5, 6, 2.0, true}; OfflineRegionMetadata metadata {{ 1, 2, 3 }}; auto region1 = db.createRegion(definition, metadata); @@ -989,17 +978,14 @@ TEST(OfflineDatabase, TEST_REQUIRES_WRITE(ClearAmbientCache)) { TEST(OfflineDatabase, CreateRegionInfiniteMaxZoom) { FixtureLog log; OfflineDatabase db(":memory:"); - OfflineTilePyramidRegionDefinition definition { "", LatLngBounds::world(), 0, INFINITY, 1.0, false }; + OfflineRegionDefinition definition{"", LatLngBounds::world(), 0, INFINITY, 1.0, false}; OfflineRegionMetadata metadata; auto region = db.createRegion(definition, metadata); ASSERT_TRUE(region); EXPECT_EQ(0u, log.uncheckedCount()); - - region->getDefinition().match([&](auto& def) { - EXPECT_EQ(0, def.minZoom); - EXPECT_EQ(INFINITY, def.maxZoom); - }); + EXPECT_EQ(0, region->getDefinition().minZoom); + EXPECT_EQ(INFINITY, region->getDefinition().maxZoom); } TEST(OfflineDatabase, TEST_REQUIRES_WRITE(ConcurrentUse)) { @@ -1091,8 +1077,7 @@ TEST(OfflineDatabase, OfflineRegionDoesNotAffectAmbientCacheSize) { // First 100KB ambient cache resource. db.put(Resource::style("http://example.com/ambient1.json"s), response); - OfflineTilePyramidRegionDefinition definition( - "http://example.com/style.json", LatLngBounds::world(), 0.0, 0.0, 1.0, false); + OfflineRegionDefinition definition("http://example.com/style.json", LatLngBounds::world(), 0.0, 0.0, 1.0, false); auto region = db.createRegion(definition, OfflineRegionMetadata()); // 1MB of offline region data. @@ -1118,7 +1103,7 @@ TEST(OfflineDatabase, PutRegionResourceDoesNotEvict) { OfflineDatabase db(":memory:"); db.setMaximumAmbientCacheSize(1024 * 100); - OfflineTilePyramidRegionDefinition definition { "", LatLngBounds::world(), 0, INFINITY, 1.0, true }; + OfflineRegionDefinition definition{"", LatLngBounds::world(), 0, INFINITY, 1.0, true}; auto region = db.createRegion(definition, OfflineRegionMetadata()); ASSERT_TRUE(region); @@ -1157,7 +1142,8 @@ TEST(OfflineDatabase, PutFailsWhenEvictionInsuffices) { TEST(OfflineDatabase, GetRegionCompletedStatus) { FixtureLog log; OfflineDatabase db(":memory:"); - OfflineTilePyramidRegionDefinition definition { "http://example.com/style", LatLngBounds::hull({1, 2}, {3, 4}), 5, 6, 2.0, false }; + OfflineRegionDefinition definition{ + "http://example.com/style", LatLngBounds::hull({1, 2}, {3, 4}), 5, 6, 2.0, false}; OfflineRegionMetadata metadata; auto region = db.createRegion(definition, metadata); ASSERT_TRUE(region); @@ -1198,7 +1184,7 @@ TEST(OfflineDatabase, HasRegionResource) { OfflineDatabase db(":memory:"); db.setMaximumAmbientCacheSize(1024 * 100); - OfflineTilePyramidRegionDefinition definition { "", LatLngBounds::world(), 0, INFINITY, 1.0, true }; + OfflineRegionDefinition definition{"", LatLngBounds::world(), 0, INFINITY, 1.0, true}; auto region = db.createRegion(definition, OfflineRegionMetadata()); ASSERT_TRUE(region); @@ -1224,7 +1210,7 @@ TEST(OfflineDatabase, HasRegionResourceTile) { OfflineDatabase db(":memory:"); db.setMaximumAmbientCacheSize(1024 * 100); - OfflineTilePyramidRegionDefinition definition { "", LatLngBounds::world(), 0, INFINITY, 1.0, false }; + OfflineRegionDefinition definition{"", LatLngBounds::world(), 0, INFINITY, 1.0, false}; auto region = db.createRegion(definition, OfflineRegionMetadata()); ASSERT_TRUE(region); @@ -1258,7 +1244,7 @@ TEST(OfflineDatabase, HasRegionResourceTile) { TEST(OfflineDatabase, OfflineMapboxTileCount) { FixtureLog log; OfflineDatabase db(":memory:"); - OfflineTilePyramidRegionDefinition definition { "http://example.com/style", LatLngBounds::hull({1, 2}, {3, 4}), 5, 6, 2.0 , true}; + OfflineRegionDefinition definition{"http://example.com/style", LatLngBounds::hull({1, 2}, {3, 4}), 5, 6, 2.0, true}; OfflineRegionMetadata metadata; auto region1 = db.createRegion(definition, metadata); @@ -1321,7 +1307,7 @@ TEST(OfflineDatabase, BatchInsertion) { OfflineDatabase db(":memory:"); db.setMaximumAmbientCacheSize(1024 * 100); - OfflineTilePyramidRegionDefinition definition { "", LatLngBounds::world(), 0, INFINITY, 1.0, true }; + OfflineRegionDefinition definition{"", LatLngBounds::world(), 0, INFINITY, 1.0, true}; auto region = db.createRegion(definition, OfflineRegionMetadata()); ASSERT_TRUE(region); @@ -1349,7 +1335,7 @@ TEST(OfflineDatabase, BatchInsertionMapboxTileCountExceeded) { db.setOfflineMapboxTileCountLimit(1); db.setMaximumAmbientCacheSize(1024 * 100); - OfflineTilePyramidRegionDefinition definition { "", LatLngBounds::world(), 0, INFINITY, 1.0, false }; + OfflineRegionDefinition definition{"", LatLngBounds::world(), 0, INFINITY, 1.0, false}; auto region = db.createRegion(definition, OfflineRegionMetadata()); ASSERT_TRUE(region); @@ -1600,8 +1586,8 @@ TEST(OfflineDatabase, TEST_REQUIRES_WRITE(DisallowedIO)) { EXPECT_EQ(0u, log.uncheckedCount()); // First, create a region object so that we can try deleting it later. - OfflineTilePyramidRegionDefinition definition( - "mapbox://style", LatLngBounds::hull({ 37.66, -122.57 }, { 37.83, -122.32 }), 0, 8, 2, false); + OfflineRegionDefinition definition( + "mapbox://style", LatLngBounds::hull({37.66, -122.57}, {37.83, -122.32}), 0, 8, 2, false); auto region = db.createRegion(definition, {}); ASSERT_TRUE(region); diff --git a/test/storage/offline_download.test.cpp b/test/storage/offline_download.test.cpp index e5178e3901..2e37f3cd7b 100644 --- a/test/storage/offline_download.test.cpp +++ b/test/storage/offline_download.test.cpp @@ -68,7 +68,7 @@ public: std::size_t size = 0; auto createRegion() { - OfflineTilePyramidRegionDefinition definition { "", LatLngBounds::hull({1, 2}, {3, 4}), 5, 6, 1.0, true }; + OfflineRegionDefinition definition{"", LatLngBounds::hull({1, 2}, {3, 4}), 5, 6, 1.0, true}; OfflineRegionMetadata metadata; return db.createRegion(definition, metadata); } @@ -93,8 +93,9 @@ TEST(OfflineDownload, NoSubresources) { ASSERT_TRUE(region); OfflineDownload download( region->getID(), - OfflineTilePyramidRegionDefinition("http://127.0.0.1:3000/style.json", LatLngBounds::world(), 0.0, 0.0, 1.0, false), - test.db, test.fileSource); + OfflineRegionDefinition("http://127.0.0.1:3000/style.json", LatLngBounds::world(), 0.0, 0.0, 1.0, false), + test.db, + test.fileSource); test.fileSource.styleResponse = [&] (const Resource& resource) { EXPECT_EQ("http://127.0.0.1:3000/style.json", resource.url); @@ -134,8 +135,9 @@ TEST(OfflineDownload, InlineSource) { ASSERT_TRUE(region); OfflineDownload download( region->getID(), - OfflineTilePyramidRegionDefinition("http://127.0.0.1:3000/style.json", LatLngBounds::world(), 0.0, 0.0, 1.0, true), - test.db, test.fileSource); + OfflineRegionDefinition("http://127.0.0.1:3000/style.json", LatLngBounds::world(), 0.0, 0.0, 1.0, true), + test.db, + test.fileSource); test.fileSource.styleResponse = [&] (const Resource& resource) { EXPECT_EQ("http://127.0.0.1:3000/style.json", resource.url); @@ -176,8 +178,9 @@ TEST(OfflineDownload, GeoJSONSource) { ASSERT_TRUE(region); OfflineDownload download( region->getID(), - OfflineTilePyramidRegionDefinition("http://127.0.0.1:3000/style.json", LatLngBounds::world(), 0.0, 0.0, 1.0, false), - test.db, test.fileSource); + OfflineRegionDefinition("http://127.0.0.1:3000/style.json", LatLngBounds::world(), 0.0, 0.0, 1.0, false), + test.db, + test.fileSource); test.fileSource.styleResponse = [&] (const Resource& resource) { EXPECT_EQ("http://127.0.0.1:3000/style.json", resource.url); @@ -212,8 +215,9 @@ TEST(OfflineDownload, Activate) { ASSERT_TRUE(region); OfflineDownload download( region->getID(), - OfflineTilePyramidRegionDefinition("http://127.0.0.1:3000/style.json", LatLngBounds::world(), 0.0, 0.0, 1.0, true), - test.db, test.fileSource); + OfflineRegionDefinition("http://127.0.0.1:3000/style.json", LatLngBounds::world(), 0.0, 0.0, 1.0, true), + test.db, + test.fileSource); test.fileSource.styleResponse = [&] (const Resource& resource) { EXPECT_EQ("http://127.0.0.1:3000/style.json", resource.url); @@ -290,10 +294,11 @@ TEST(OfflineDownload, ExcludeIdeographs) { auto region = test.createRegion(); ASSERT_TRUE(region); OfflineDownload download( - region->getID(), - OfflineTilePyramidRegionDefinition("http://127.0.0.1:3000/style.json", LatLngBounds::world(), 0.0, 0.0, 1.0, false), - test.db, test.fileSource); - + region->getID(), + OfflineRegionDefinition("http://127.0.0.1:3000/style.json", LatLngBounds::world(), 0.0, 0.0, 1.0, false), + test.db, + test.fileSource); + test.fileSource.styleResponse = [&] (const Resource& resource) { EXPECT_EQ("http://127.0.0.1:3000/style.json", resource.url); return test.response("style.json"); @@ -371,8 +376,9 @@ TEST(OfflineDownload, DoesNotFloodTheFileSourceWithRequests) { ASSERT_TRUE(region); OfflineDownload download( region->getID(), - OfflineTilePyramidRegionDefinition("http://127.0.0.1:3000/style.json", LatLngBounds::world(), 0.0, 0.0, 1.0, true), - test.db, fileSource); + OfflineRegionDefinition("http://127.0.0.1:3000/style.json", LatLngBounds::world(), 0.0, 0.0, 1.0, true), + test.db, + fileSource); auto observer = std::make_unique<MockObserver>(); @@ -394,8 +400,9 @@ TEST(OfflineDownload, GetStatusNoResources) { ASSERT_TRUE(region); OfflineDownload download( region->getID(), - OfflineTilePyramidRegionDefinition("http://127.0.0.1:3000/style.json", LatLngBounds::world(), 0.0, 0.0, 1.0, false), - test.db, test.fileSource); + OfflineRegionDefinition("http://127.0.0.1:3000/style.json", LatLngBounds::world(), 0.0, 0.0, 1.0, false), + test.db, + test.fileSource); OfflineRegionStatus status = download.getStatus(); EXPECT_EQ(OfflineRegionDownloadState::Inactive, status.downloadState); @@ -414,8 +421,9 @@ TEST(OfflineDownload, GetStatusStyleComplete) { ASSERT_TRUE(region); OfflineDownload download( region->getID(), - OfflineTilePyramidRegionDefinition("http://127.0.0.1:3000/style.json", LatLngBounds::world(), 0.0, 0.0, 1.0, true), - test.db, test.fileSource); + OfflineRegionDefinition("http://127.0.0.1:3000/style.json", LatLngBounds::world(), 0.0, 0.0, 1.0, true), + test.db, + test.fileSource); test.db.putRegionResource(1, Resource::style("http://127.0.0.1:3000/style.json"), @@ -439,8 +447,9 @@ TEST(OfflineDownload, GetStatusStyleAndSourceComplete) { ASSERT_TRUE(region); OfflineDownload download( region->getID(), - OfflineTilePyramidRegionDefinition("http://127.0.0.1:3000/style.json", LatLngBounds::world(), 0.0, 0.0, 1.0, true), - test.db, test.fileSource); + OfflineRegionDefinition("http://127.0.0.1:3000/style.json", LatLngBounds::world(), 0.0, 0.0, 1.0, true), + test.db, + test.fileSource); test.db.putRegionResource(1, Resource::style("http://127.0.0.1:3000/style.json"), @@ -468,8 +477,9 @@ TEST(OfflineDownload, RequestError) { ASSERT_TRUE(region); OfflineDownload download( region->getID(), - OfflineTilePyramidRegionDefinition("http://127.0.0.1:3000/style.json", LatLngBounds::world(), 0.0, 0.0, 1.0, false), - test.db, test.fileSource); + OfflineRegionDefinition("http://127.0.0.1:3000/style.json", LatLngBounds::world(), 0.0, 0.0, 1.0, false), + test.db, + test.fileSource); test.fileSource.styleResponse = [&] (const Resource&) { Response response; @@ -497,8 +507,9 @@ TEST(OfflineDownload, RequestErrorsAreRetried) { ASSERT_TRUE(region); OfflineDownload download( region->getID(), - OfflineTilePyramidRegionDefinition("http://127.0.0.1:3000/style.json", LatLngBounds::world(), 0.0, 0.0, 1.0, true), - test.db, test.fileSource); + OfflineRegionDefinition("http://127.0.0.1:3000/style.json", LatLngBounds::world(), 0.0, 0.0, 1.0, true), + test.db, + test.fileSource); test.fileSource.styleResponse = [&] (const Resource&) { test.fileSource.styleResponse = [&] (const Resource&) { @@ -531,8 +542,9 @@ TEST(OfflineDownload, TileCountLimitExceededNoTileResponse) { ASSERT_TRUE(region); OfflineDownload download( region->getID(), - OfflineTilePyramidRegionDefinition("http://127.0.0.1:3000/style.json", LatLngBounds::world(), 0.0, 0.0, 1.0, false), - test.db, test.fileSource); + OfflineRegionDefinition("http://127.0.0.1:3000/style.json", LatLngBounds::world(), 0.0, 0.0, 1.0, false), + test.db, + test.fileSource); uint64_t tileLimit = 0; @@ -574,8 +586,9 @@ TEST(OfflineDownload, TileCountLimitExceededWithTileResponse) { ASSERT_TRUE(region); OfflineDownload download( region->getID(), - OfflineTilePyramidRegionDefinition("http://127.0.0.1:3000/style.json", LatLngBounds::world(), 0.0, 0.0, 1.0, true), - test.db, test.fileSource); + OfflineRegionDefinition("http://127.0.0.1:3000/style.json", LatLngBounds::world(), 0.0, 0.0, 1.0, true), + test.db, + test.fileSource); uint64_t tileLimit = 1; @@ -629,8 +642,9 @@ TEST(OfflineDownload, WithPreviouslyExistingTile) { ASSERT_TRUE(region); OfflineDownload download( region->getID(), - OfflineTilePyramidRegionDefinition("http://127.0.0.1:3000/style.json", LatLngBounds::world(), 0.0, 0.0, 1.0, false), - test.db, test.fileSource); + OfflineRegionDefinition("http://127.0.0.1:3000/style.json", LatLngBounds::world(), 0.0, 0.0, 1.0, false), + test.db, + test.fileSource); test.fileSource.styleResponse = [&] (const Resource& resource) { EXPECT_EQ("http://127.0.0.1:3000/style.json", resource.url); @@ -664,8 +678,9 @@ TEST(OfflineDownload, ReactivatePreviouslyCompletedDownload) { ASSERT_TRUE(region); OfflineDownload download( region->getID(), - OfflineTilePyramidRegionDefinition("http://127.0.0.1:3000/style.json", LatLngBounds::world(), 0.0, 0.0, 1.0, true), - test.db, test.fileSource); + OfflineRegionDefinition("http://127.0.0.1:3000/style.json", LatLngBounds::world(), 0.0, 0.0, 1.0, true), + test.db, + test.fileSource); test.fileSource.styleResponse = [&] (const Resource& resource) { EXPECT_EQ("http://127.0.0.1:3000/style.json", resource.url); @@ -690,8 +705,9 @@ TEST(OfflineDownload, ReactivatePreviouslyCompletedDownload) { OfflineDownload redownload( region->getID(), - OfflineTilePyramidRegionDefinition("http://127.0.0.1:3000/style.json", LatLngBounds::world(), 0.0, 0.0, 1.0, false), - test.db, test.fileSource); + OfflineRegionDefinition("http://127.0.0.1:3000/style.json", LatLngBounds::world(), 0.0, 0.0, 1.0, false), + test.db, + test.fileSource); std::vector<OfflineRegionStatus> statusesAfterReactivate; @@ -732,8 +748,9 @@ TEST(OfflineDownload, Deactivate) { ASSERT_TRUE(region); OfflineDownload download( region->getID(), - OfflineTilePyramidRegionDefinition("http://127.0.0.1:3000/style.json", LatLngBounds::world(), 0.0, 0.0, 1.0, false), - test.db, test.fileSource); + OfflineRegionDefinition("http://127.0.0.1:3000/style.json", LatLngBounds::world(), 0.0, 0.0, 1.0, false), + test.db, + test.fileSource); test.fileSource.styleResponse = [&] (const Resource& resource) { EXPECT_EQ("http://127.0.0.1:3000/style.json", resource.url); @@ -762,8 +779,9 @@ TEST(OfflineDownload, AllOfflineRequestsHaveLowPriorityAndOfflineUsage) { ASSERT_TRUE(region); OfflineDownload download( region->getID(), - OfflineTilePyramidRegionDefinition("http://127.0.0.1:3000/style.json", LatLngBounds::world(), 0.0, 0.0, 1.0, true), - test.db, test.fileSource); + OfflineRegionDefinition("http://127.0.0.1:3000/style.json", LatLngBounds::world(), 0.0, 0.0, 1.0, true), + test.db, + test.fileSource); test.fileSource.styleResponse = [&] (const Resource& resource) { EXPECT_TRUE(resource.priority == Resource::Priority::Low); @@ -839,8 +857,9 @@ TEST(OfflineDownload, DiskFull) { OfflineDownload download( region->getID(), - OfflineTilePyramidRegionDefinition("http://127.0.0.1:3000/style.json", LatLngBounds::world(), 0.0, 0.0, 1.0, false), - test.db, test.fileSource); + OfflineRegionDefinition("http://127.0.0.1:3000/style.json", LatLngBounds::world(), 0.0, 0.0, 1.0, false), + test.db, + test.fileSource); bool hasRequestedStyle = false; @@ -885,9 +904,10 @@ TEST(OfflineDownload, ResourceOfflineUsageUnset) { OfflineDownload download( region->getID(), - OfflineTilePyramidRegionDefinition("http://127.0.0.1:3000/inline_source.style.json", - LatLngBounds::world(), 0.0, 0.0, 1.0, false), - test.db, test.fileSource); + OfflineRegionDefinition( + "http://127.0.0.1:3000/inline_source.style.json", LatLngBounds::world(), 0.0, 0.0, 1.0, false), + test.db, + test.fileSource); test.fileSource.styleResponse = [&] (const Resource& resource) { EXPECT_TRUE(resource.priority == Resource::Priority::Low); @@ -950,11 +970,11 @@ TEST(OfflineDownload, InterruptAndResume) { OfflineTest test; auto region = test.createRegion(); ASSERT_TRUE(region); - OfflineDownload download(region->getID(), - OfflineTilePyramidRegionDefinition( - "http://127.0.0.1:3000/style.json", LatLngBounds::world(), 0.0, 0.0, 1.0, true), - test.db, - test.fileSource); + OfflineDownload download( + region->getID(), + OfflineRegionDefinition("http://127.0.0.1:3000/style.json", LatLngBounds::world(), 0.0, 0.0, 1.0, true), + test.db, + test.fileSource); test.fileSource.styleResponse = [&](const Resource& resource) { EXPECT_EQ("http://127.0.0.1:3000/style.json", resource.url); @@ -1031,11 +1051,11 @@ TEST(OfflineDownload, NoFreezingOnCachedTilesAndNewStyle) { OfflineTest test; auto region = test.createRegion(); ASSERT_TRUE(region); - OfflineDownload download(region->getID(), - OfflineTilePyramidRegionDefinition( - "http://127.0.0.1:3000/style.json", LatLngBounds::world(), 1.0, 1.0, 1.0, true), - test.db, - test.fileSource); + OfflineDownload download( + region->getID(), + OfflineRegionDefinition("http://127.0.0.1:3000/style.json", LatLngBounds::world(), 1.0, 1.0, 1.0, true), + test.db, + test.fileSource); test.fileSource.setProperty(MAX_CONCURRENT_REQUESTS_KEY, 2u); test.fileSource.styleResponse = [&](const Resource&) { return test.response("inline_source.style.json"); }; @@ -1067,11 +1087,11 @@ TEST(OfflineDownload, NoFreezingOnNotFoundError) { OfflineTest test; auto region = test.createRegion(); ASSERT_TRUE(region); - OfflineDownload download(region->getID(), - OfflineTilePyramidRegionDefinition( - "http://127.0.0.1:3000/style.json", LatLngBounds::world(), 0.0, 0.0, 1.0, true), - test.db, - test.fileSource); + OfflineDownload download( + region->getID(), + OfflineRegionDefinition("http://127.0.0.1:3000/style.json", LatLngBounds::world(), 0.0, 0.0, 1.0, true), + test.db, + test.fileSource); test.fileSource.styleResponse = [&](const Resource& resource) { EXPECT_EQ("http://127.0.0.1:3000/style.json", resource.url); |