diff options
Diffstat (limited to 'test')
88 files changed, 2012 insertions, 985 deletions
diff --git a/test/algorithm/mock.hpp b/test/algorithm/mock.hpp index 28c78854be..efa76f238e 100644 --- a/test/algorithm/mock.hpp +++ b/test/algorithm/mock.hpp @@ -7,16 +7,12 @@ #include <map> #include <mbgl/tile/tile_id.hpp> - -struct MockSourceInfo { - uint8_t maxZoom = 16; - uint8_t minZoom = 0; -}; +#include <mbgl/util/range.hpp> struct MockTileData; struct MockSource { - MockSourceInfo info; + mbgl::Range<uint8_t> zoomRange { 0, 16 }; std::map<mbgl::OverscaledTileID, std::unique_ptr<MockTileData>> dataTiles; std::set<mbgl::UnwrappedTileID> idealTiles; @@ -29,11 +25,17 @@ struct MockBucket {}; struct MockTileData { MockTileData(const mbgl::OverscaledTileID& tileID_) : tileID(tileID_) {} - bool isRenderable() { + + bool hasTriedOptional() const { + return triedOptional; + } + + bool isRenderable() const { return renderable; } bool renderable = false; + bool triedOptional = false; const mbgl::OverscaledTileID tileID; }; diff --git a/test/algorithm/update_renderables.cpp b/test/algorithm/update_renderables.cpp index 67c7d79a0a..dcc43a83f3 100644 --- a/test/algorithm/update_renderables.cpp +++ b/test/algorithm/update_renderables.cpp @@ -8,9 +8,14 @@ using namespace mbgl; +enum LookupResult : bool { + NotFound = false, + Found = true, +}; + struct GetTileDataAction { const OverscaledTileID tileID; - const bool found; + const LookupResult found; bool operator==(const GetTileDataAction& rhs) const { return tileID == rhs.tileID && found == rhs.found; @@ -20,7 +25,8 @@ struct GetTileDataAction { std::ostream& operator<<(std::ostream& os, const GetTileDataAction& action) { return os << "GetTileDataAction{ { " << int(action.tileID.overscaledZ) << ", { " << int(action.tileID.canonical.z) << ", " << action.tileID.canonical.x << ", " - << action.tileID.canonical.y << " } }, " << (action.found ? "true" : "false") << " }"; + << action.tileID.canonical.y << " } }, " + << (action.found == Found ? "Found" : "NotFound") << " }"; } struct CreateTileDataAction { @@ -37,18 +43,25 @@ std::ostream& operator<<(std::ostream& os, const CreateTileDataAction& action) { << action.tileID.canonical.y << " } } }"; } +enum Necessity : bool { + Optional = false, + Required = true, +}; + struct RetainTileDataAction { const OverscaledTileID tileID; + const Necessity necessity; bool operator==(const RetainTileDataAction& rhs) const { - return tileID == rhs.tileID; + return tileID == rhs.tileID && necessity == rhs.necessity; } }; std::ostream& operator<<(std::ostream& os, const RetainTileDataAction& action) { return os << "RetainTileDataAction{ { " << int(action.tileID.overscaledZ) << ", { " << int(action.tileID.canonical.z) << ", " << action.tileID.canonical.x << ", " - << action.tileID.canonical.y << " } } }"; + << action.tileID.canonical.y << " } }, " + << (action.necessity == Required ? "Required" : "Optional") << " }"; } struct RenderTileAction { @@ -79,7 +92,7 @@ template <typename T> auto getTileDataFn(ActionLog& log, const T& dataTiles) { return [&](const auto& id) { auto it = dataTiles.find(id); - log.emplace_back(GetTileDataAction{ id, it != dataTiles.end() }); + log.emplace_back(GetTileDataAction{ id, it != dataTiles.end() ? Found : NotFound }); return (it != dataTiles.end()) ? it->second.get() : nullptr; }; } @@ -93,7 +106,9 @@ auto createTileDataFn(ActionLog& log, T& dataTiles) { } auto retainTileDataFn(ActionLog& log) { - return [&](auto& tileData) { log.emplace_back(RetainTileDataAction{ tileData.tileID }); }; + return [&](auto& tileData, bool required) { + log.emplace_back(RetainTileDataAction{ tileData.tileID, required ? Required : Optional }); + }; } auto renderTileFn(ActionLog& log) { @@ -117,22 +132,22 @@ TEST(UpdateRenderables, SingleTile) { tile_1_1_1_1->renderable = true; algorithm::updateRenderables(getTileData, createTileData, retainTileData, renderTile, - source.idealTiles, source.info, 1); + source.idealTiles, source.zoomRange, 1); EXPECT_EQ(ActionLog({ - GetTileDataAction{ { 1, { 1, 1, 1 } }, true }, // found ideal tile - RetainTileDataAction{ { 1, { 1, 1, 1 } } }, // - RenderTileAction{ { 1, 1, 1 }, *tile_1_1_1_1 }, // render ideal tile + GetTileDataAction{ { 1, { 1, 1, 1 } }, Found }, // found ideal tile + RetainTileDataAction{ { 1, { 1, 1, 1 } }, Required }, // + RenderTileAction{ { 1, 1, 1 }, *tile_1_1_1_1 }, // render ideal tile }), log); // Check a repeated render with the same data. log.clear(); algorithm::updateRenderables(getTileData, createTileData, retainTileData, renderTile, - source.idealTiles, source.info, 1); + source.idealTiles, source.zoomRange, 1); EXPECT_EQ(ActionLog({ - GetTileDataAction{ { 1, { 1, 1, 1 } }, true }, // found ideal tile - RetainTileDataAction{ { 1, { 1, 1, 1 } } }, // - RenderTileAction{ { 1, 1, 1 }, *tile_1_1_1_1 }, // render ideal tile + GetTileDataAction{ { 1, { 1, 1, 1 } }, Found }, // found ideal tile + RetainTileDataAction{ { 1, { 1, 1, 1 } }, Required }, // + RenderTileAction{ { 1, 1, 1 }, *tile_1_1_1_1 }, // render ideal tile }), log); @@ -140,20 +155,42 @@ TEST(UpdateRenderables, SingleTile) { log.clear(); source.idealTiles.emplace(UnwrappedTileID{ 1, 0, 1 }); algorithm::updateRenderables(getTileData, createTileData, retainTileData, renderTile, - source.idealTiles, source.info, 1); + source.idealTiles, source.zoomRange, 1); EXPECT_EQ(ActionLog({ - GetTileDataAction{ { 1, { 1, 0, 1 } }, false }, // missing ideal tile - CreateTileDataAction{ { 1, { 1, 0, 1 } } }, // create ideal tile - RetainTileDataAction{ { 1, { 1, 0, 1 } } }, // - GetTileDataAction{ { 2, { 2, 0, 2 } }, false }, // four child tiles - GetTileDataAction{ { 2, { 2, 0, 3 } }, false }, // ... - GetTileDataAction{ { 2, { 2, 1, 2 } }, false }, // ... - GetTileDataAction{ { 2, { 2, 1, 3 } }, false }, // ... - GetTileDataAction{ { 0, { 0, 0, 0 } }, false }, // parent tile + GetTileDataAction{ { 1, { 1, 0, 1 } }, NotFound }, // missing ideal tile + CreateTileDataAction{ { 1, { 1, 0, 1 } } }, // create ideal tile + RetainTileDataAction{ { 1, { 1, 0, 1 } }, Required }, // + GetTileDataAction{ { 2, { 2, 0, 2 } }, NotFound }, // four child tiles + GetTileDataAction{ { 2, { 2, 0, 3 } }, NotFound }, // ... + GetTileDataAction{ { 2, { 2, 1, 2 } }, NotFound }, // ... + GetTileDataAction{ { 2, { 2, 1, 3 } }, NotFound }, // ... + GetTileDataAction{ { 0, { 0, 0, 0 } }, NotFound }, // parent tile + + GetTileDataAction{ { 1, { 1, 1, 1 } }, Found }, // found ideal tile + RetainTileDataAction{ { 1, { 1, 1, 1 } }, Required }, // + RenderTileAction{ { 1, 1, 1 }, *tile_1_1_1_1 }, // render found tile + }), + log); - GetTileDataAction{ { 1, { 1, 1, 1 } }, true }, // found ideal tile - RetainTileDataAction{ { 1, { 1, 1, 1 } } }, // - RenderTileAction{ { 1, 1, 1 }, *tile_1_1_1_1 }, // render found tile + // Mark the created tile as having the optional request tried. + log.clear(); + source.dataTiles[{ 1, { 1, 0, 1 } }]->triedOptional = true; + algorithm::updateRenderables(getTileData, createTileData, retainTileData, renderTile, + source.idealTiles, source.zoomRange, 1); + EXPECT_EQ(ActionLog({ + GetTileDataAction{ { 1, { 1, 0, 1 } }, Found }, // missing ideal tile + RetainTileDataAction{ { 1, { 1, 0, 1 } }, Required }, // + GetTileDataAction{ { 2, { 2, 0, 2 } }, NotFound }, // four child tiles + GetTileDataAction{ { 2, { 2, 0, 3 } }, NotFound }, // ... + GetTileDataAction{ { 2, { 2, 1, 2 } }, NotFound }, // ... + GetTileDataAction{ { 2, { 2, 1, 3 } }, NotFound }, // ... + GetTileDataAction{ { 0, { 0, 0, 0 } }, NotFound }, // parent tile + CreateTileDataAction{ { 0, { 0, 0, 0 } } }, // load parent tile + RetainTileDataAction{ { 0, { 0, 0, 0 } }, Optional }, // + + GetTileDataAction{ { 1, { 1, 1, 1 } }, Found }, // found ideal tile + RetainTileDataAction{ { 1, { 1, 1, 1 } }, Required }, // + RenderTileAction{ { 1, 1, 1 }, *tile_1_1_1_1 }, // render found tile }), log); @@ -162,15 +199,15 @@ TEST(UpdateRenderables, SingleTile) { auto tile_1_1_0_1 = source.createTileData(OverscaledTileID{ 1, 0, 1 }); tile_1_1_0_1->renderable = true; algorithm::updateRenderables(getTileData, createTileData, retainTileData, renderTile, - source.idealTiles, source.info, 1); + source.idealTiles, source.zoomRange, 1); EXPECT_EQ(ActionLog({ - GetTileDataAction{ { 1, { 1, 0, 1 } }, true }, // newly added tile - RetainTileDataAction{ { 1, { 1, 0, 1 } } }, // - RenderTileAction{ { 1, 0, 1 }, *tile_1_1_0_1 }, // render ideal tile + GetTileDataAction{ { 1, { 1, 0, 1 } }, Found }, // newly added tile + RetainTileDataAction{ { 1, { 1, 0, 1 } }, Required }, // + RenderTileAction{ { 1, 0, 1 }, *tile_1_1_0_1 }, // render ideal tile - GetTileDataAction{ { 1, { 1, 1, 1 } }, true }, // ideal tile - RetainTileDataAction{ { 1, { 1, 1, 1 } } }, // - RenderTileAction{ { 1, 1, 1 }, *tile_1_1_1_1 }, // render found tile + GetTileDataAction{ { 1, { 1, 1, 1 } }, Found }, // ideal tile + RetainTileDataAction{ { 1, { 1, 1, 1 } }, Required }, // + RenderTileAction{ { 1, 1, 1 }, *tile_1_1_1_1 }, // render found tile }), log); @@ -181,23 +218,25 @@ TEST(UpdateRenderables, SingleTile) { auto tile_1_1_0_0 = source.createTileData(OverscaledTileID{ 1, 0, 0 }); algorithm::updateRenderables(getTileData, createTileData, retainTileData, renderTile, - source.idealTiles, source.info, 1); + source.idealTiles, source.zoomRange, 1); EXPECT_EQ(ActionLog({ - GetTileDataAction{ { 1, { 1, 0, 0 } }, true }, // found tile, not ready - RetainTileDataAction{ { 1, { 1, 0, 0 } } }, // - GetTileDataAction{ { 2, { 2, 0, 0 } }, false }, // four child tiles - GetTileDataAction{ { 2, { 2, 0, 1 } }, false }, // ... - GetTileDataAction{ { 2, { 2, 1, 0 } }, false }, // ... - GetTileDataAction{ { 2, { 2, 1, 1 } }, false }, // ... - GetTileDataAction{ { 0, { 0, 0, 0 } }, false }, // parent tile - - GetTileDataAction{ { 1, { 1, 0, 1 } }, true }, // ideal tile - RetainTileDataAction{ { 1, { 1, 0, 1 } } }, // - RenderTileAction{ { 1, 0, 1 }, *tile_1_1_0_1 }, // render ideal tile - - GetTileDataAction{ { 1, { 1, 1, 1 } }, true }, // ideal tile - RetainTileDataAction{ { 1, { 1, 1, 1 } } }, // - RenderTileAction{ { 1, 1, 1 }, *tile_1_1_1_1 }, // render ideal tile + GetTileDataAction{ { 1, { 1, 0, 0 } }, Found }, // found tile, not ready + RetainTileDataAction{ { 1, { 1, 0, 0 } }, Required }, // + GetTileDataAction{ { 2, { 2, 0, 0 } }, NotFound }, // four child tiles + GetTileDataAction{ { 2, { 2, 0, 1 } }, NotFound }, // ... + GetTileDataAction{ { 2, { 2, 1, 0 } }, NotFound }, // ... + GetTileDataAction{ { 2, { 2, 1, 1 } }, NotFound }, // ... + GetTileDataAction{ { 0, { 0, 0, 0 } }, Found }, // parent tile + RetainTileDataAction{ { 0, { 0, 0, 0 } }, Optional }, // + // optional parent tile was already created before, but is not renderable + + GetTileDataAction{ { 1, { 1, 0, 1 } }, Found }, // ideal tile + RetainTileDataAction{ { 1, { 1, 0, 1 } }, Required }, // + RenderTileAction{ { 1, 0, 1 }, *tile_1_1_0_1 }, // render ideal tile + + GetTileDataAction{ { 1, { 1, 1, 1 } }, Found }, // ideal tile + RetainTileDataAction{ { 1, { 1, 1, 1 } }, Required }, // + RenderTileAction{ { 1, 1, 1 }, *tile_1_1_1_1 }, // render ideal tile }), log); @@ -205,19 +244,19 @@ TEST(UpdateRenderables, SingleTile) { log.clear(); tile_1_1_0_0->renderable = true; algorithm::updateRenderables(getTileData, createTileData, retainTileData, renderTile, - source.idealTiles, source.info, 1); + source.idealTiles, source.zoomRange, 1); EXPECT_EQ(ActionLog({ - GetTileDataAction{ { 1, { 1, 0, 0 } }, true }, // found tile, now ready - RetainTileDataAction{ { 1, { 1, 0, 0 } } }, // - RenderTileAction{ { 1, 0, 0 }, *tile_1_1_0_0 }, // + GetTileDataAction{ { 1, { 1, 0, 0 } }, Found }, // found tile, now ready + RetainTileDataAction{ { 1, { 1, 0, 0 } }, Required }, // + RenderTileAction{ { 1, 0, 0 }, *tile_1_1_0_0 }, // - GetTileDataAction{ { 1, { 1, 0, 1 } }, true }, // ideal tile - RetainTileDataAction{ { 1, { 1, 0, 1 } } }, // - RenderTileAction{ { 1, 0, 1 }, *tile_1_1_0_1 }, // + GetTileDataAction{ { 1, { 1, 0, 1 } }, Found }, // ideal tile + RetainTileDataAction{ { 1, { 1, 0, 1 } }, Required }, // + RenderTileAction{ { 1, 0, 1 }, *tile_1_1_0_1 }, // - GetTileDataAction{ { 1, { 1, 1, 1 } }, true }, // ideal tile - RetainTileDataAction{ { 1, { 1, 1, 1 } } }, // - RenderTileAction{ { 1, 1, 1 }, *tile_1_1_1_1 }, // + GetTileDataAction{ { 1, { 1, 1, 1 } }, Found }, // ideal tile + RetainTileDataAction{ { 1, { 1, 1, 1 } }, Required }, // + RenderTileAction{ { 1, 1, 1 }, *tile_1_1_1_1 }, // }), log); } @@ -238,32 +277,32 @@ TEST(UpdateRenderables, UseParentTile) { auto tile_0_0_0_0 = source.createTileData(OverscaledTileID{ 0, 0, 0 }); tile_0_0_0_0->renderable = true; algorithm::updateRenderables(getTileData, createTileData, retainTileData, renderTile, - source.idealTiles, source.info, 1); - EXPECT_EQ(ActionLog({ - GetTileDataAction{ { 1, { 1, 0, 1 } }, false }, // missing ideal tile - CreateTileDataAction{ { 1, { 1, 0, 1 } } }, // - RetainTileDataAction{ { 1, { 1, 0, 1 } } }, // - GetTileDataAction{ { 2, { 2, 0, 2 } }, false }, // child tile - GetTileDataAction{ { 2, { 2, 0, 3 } }, false }, // ... - GetTileDataAction{ { 2, { 2, 1, 2 } }, false }, // ... - GetTileDataAction{ { 2, { 2, 1, 3 } }, false }, // ... - GetTileDataAction{ { 0, { 0, 0, 0 } }, true }, // parent found! - RetainTileDataAction{ { 0, { 0, 0, 0 } } }, // - RenderTileAction{ { 0, 0, 0 }, *tile_0_0_0_0 }, // render parent - GetTileDataAction{ { 1, { 1, 1, 0 } }, false }, // missing ideal tile - CreateTileDataAction{ { 1, { 1, 1, 0 } } }, // - RetainTileDataAction{ { 1, { 1, 1, 0 } } }, // - GetTileDataAction{ { 2, { 2, 2, 0 } }, false }, // child tile - GetTileDataAction{ { 2, { 2, 2, 1 } }, false }, // ... - GetTileDataAction{ { 2, { 2, 3, 0 } }, false }, // ... - GetTileDataAction{ { 2, { 2, 3, 1 } }, false }, // ... - GetTileDataAction{ { 1, { 1, 1, 1 } }, false }, // missing tile - CreateTileDataAction{ { 1, { 1, 1, 1 } } }, // - RetainTileDataAction{ { 1, { 1, 1, 1 } } }, // - GetTileDataAction{ { 2, { 2, 2, 2 } }, false }, // child tile - GetTileDataAction{ { 2, { 2, 2, 3 } }, false }, // ... - GetTileDataAction{ { 2, { 2, 3, 2 } }, false }, // ... - GetTileDataAction{ { 2, { 2, 3, 3 } }, false }, // ... + source.idealTiles, source.zoomRange, 1); + EXPECT_EQ(ActionLog({ + GetTileDataAction{ { 1, { 1, 0, 1 } }, NotFound }, // missing ideal tile + CreateTileDataAction{ { 1, { 1, 0, 1 } } }, // + RetainTileDataAction{ { 1, { 1, 0, 1 } }, Required }, // + GetTileDataAction{ { 2, { 2, 0, 2 } }, NotFound }, // child tile + GetTileDataAction{ { 2, { 2, 0, 3 } }, NotFound }, // ... + GetTileDataAction{ { 2, { 2, 1, 2 } }, NotFound }, // ... + GetTileDataAction{ { 2, { 2, 1, 3 } }, NotFound }, // ... + GetTileDataAction{ { 0, { 0, 0, 0 } }, Found }, // parent found! + RetainTileDataAction{ { 0, { 0, 0, 0 } }, Optional }, // + RenderTileAction{ { 0, 0, 0 }, *tile_0_0_0_0 }, // render parent + GetTileDataAction{ { 1, { 1, 1, 0 } }, NotFound }, // missing ideal tile + CreateTileDataAction{ { 1, { 1, 1, 0 } } }, // + RetainTileDataAction{ { 1, { 1, 1, 0 } }, Required }, // + GetTileDataAction{ { 2, { 2, 2, 0 } }, NotFound }, // child tile + GetTileDataAction{ { 2, { 2, 2, 1 } }, NotFound }, // ... + GetTileDataAction{ { 2, { 2, 3, 0 } }, NotFound }, // ... + GetTileDataAction{ { 2, { 2, 3, 1 } }, NotFound }, // ... + GetTileDataAction{ { 1, { 1, 1, 1 } }, NotFound }, // missing tile + CreateTileDataAction{ { 1, { 1, 1, 1 } } }, // + RetainTileDataAction{ { 1, { 1, 1, 1 } }, Required }, // + GetTileDataAction{ { 2, { 2, 2, 2 } }, NotFound }, // child tile + GetTileDataAction{ { 2, { 2, 2, 3 } }, NotFound }, // ... + GetTileDataAction{ { 2, { 2, 3, 2 } }, NotFound }, // ... + GetTileDataAction{ { 2, { 2, 3, 3 } }, NotFound }, // ... }), log); } @@ -281,17 +320,36 @@ TEST(UpdateRenderables, DontUseWrongParentTile) { auto tile_1_1_1_0 = source.createTileData(OverscaledTileID{ 1, 1, 0 }); tile_1_1_1_0->renderable = true; algorithm::updateRenderables(getTileData, createTileData, retainTileData, renderTile, - source.idealTiles, source.info, 2); + source.idealTiles, source.zoomRange, 2); + EXPECT_EQ(ActionLog({ + GetTileDataAction{ { 2, { 2, 0, 0 } }, NotFound }, // missing ideal tile + CreateTileDataAction{ { 2, { 2, 0, 0 } } }, // + RetainTileDataAction{ { 2, { 2, 0, 0 } }, Required }, // + GetTileDataAction{ { 3, { 3, 0, 0 } }, NotFound }, // child tile + GetTileDataAction{ { 3, { 3, 0, 1 } }, NotFound }, // ... + GetTileDataAction{ { 3, { 3, 1, 0 } }, NotFound }, // ... + GetTileDataAction{ { 3, { 3, 1, 1 } }, NotFound }, // ... + GetTileDataAction{ { 1, { 1, 0, 0 } }, NotFound }, // parent tile, missing + GetTileDataAction{ { 0, { 0, 0, 0 } }, NotFound }, // parent tile, missing + }), + log); + + // Now mark the created tile as having the optional request tried. + log.clear(); + source.dataTiles[{ 2, { 2, 0, 0 } }]->triedOptional = true; + algorithm::updateRenderables(getTileData, createTileData, retainTileData, renderTile, + source.idealTiles, source.zoomRange, 2); EXPECT_EQ(ActionLog({ - GetTileDataAction{ { 2, { 2, 0, 0 } }, false }, // missing ideal tile - CreateTileDataAction{ { 2, { 2, 0, 0 } } }, // - RetainTileDataAction{ { 2, { 2, 0, 0 } } }, // - GetTileDataAction{ { 3, { 3, 0, 0 } }, false }, // child tile - GetTileDataAction{ { 3, { 3, 0, 1 } }, false }, // ... - GetTileDataAction{ { 3, { 3, 1, 0 } }, false }, // ... - GetTileDataAction{ { 3, { 3, 1, 1 } }, false }, // ... - GetTileDataAction{ { 1, { 1, 0, 0 } }, false }, // parent tile, missing - GetTileDataAction{ { 0, { 0, 0, 0 } }, false }, // parent tile, missing + GetTileDataAction{ { 2, { 2, 0, 0 } }, Found }, // non-ready ideal tile + RetainTileDataAction{ { 2, { 2, 0, 0 } }, Required }, // + GetTileDataAction{ { 3, { 3, 0, 0 } }, NotFound }, // child tile + GetTileDataAction{ { 3, { 3, 0, 1 } }, NotFound }, // ... + GetTileDataAction{ { 3, { 3, 1, 0 } }, NotFound }, // ... + GetTileDataAction{ { 3, { 3, 1, 1 } }, NotFound }, // ... + GetTileDataAction{ { 1, { 1, 0, 0 } }, NotFound }, // parent tile, missing + CreateTileDataAction{ { 1, { 1, 0, 0 } } }, // find optional parent + RetainTileDataAction{ { 1, { 1, 0, 0 } }, Optional }, // + GetTileDataAction{ { 0, { 0, 0, 0 } }, NotFound }, // parent tile, missing }), log); @@ -299,28 +357,29 @@ TEST(UpdateRenderables, DontUseWrongParentTile) { log.clear(); source.idealTiles.emplace(UnwrappedTileID{ 2, 2, 0 }); algorithm::updateRenderables(getTileData, createTileData, retainTileData, renderTile, - source.idealTiles, source.info, 2); + source.idealTiles, source.zoomRange, 2); EXPECT_EQ(ActionLog({ - GetTileDataAction{ { 2, { 2, 0, 0 } }, true }, // non-ready ideal tile - RetainTileDataAction{ { 2, { 2, 0, 0 } } }, // + GetTileDataAction{ { 2, { 2, 0, 0 } }, Found }, // non-ready ideal tile + RetainTileDataAction{ { 2, { 2, 0, 0 } }, Required }, // // this tile was added by the previous invocation of updateRenderables - GetTileDataAction{ { 3, { 3, 0, 0 } }, false }, // child tile - GetTileDataAction{ { 3, { 3, 0, 1 } }, false }, // ... - GetTileDataAction{ { 3, { 3, 1, 0 } }, false }, // ... - GetTileDataAction{ { 3, { 3, 1, 1 } }, false }, // ... - GetTileDataAction{ { 1, { 1, 0, 0 } }, false }, // missing parent tile - GetTileDataAction{ { 0, { 0, 0, 0 } }, false }, // missing parent tile - - GetTileDataAction{ { 2, { 2, 2, 0 } }, false }, // missing ideal tile - CreateTileDataAction{ { 2, { 2, 2, 0 } } }, // - RetainTileDataAction{ { 2, { 2, 2, 0 } } }, // - GetTileDataAction{ { 3, { 3, 4, 0 } }, false }, // child tile - GetTileDataAction{ { 3, { 3, 4, 1 } }, false }, // ... - GetTileDataAction{ { 3, { 3, 5, 0 } }, false }, // ... - GetTileDataAction{ { 3, { 3, 5, 1 } }, false }, // ... - GetTileDataAction{ { 1, { 1, 1, 0 } }, true }, // found parent tile - RetainTileDataAction{ { 1, { 1, 1, 0 } } }, // - RenderTileAction{ { 1, 1, 0 }, *tile_1_1_1_0 }, // render parent tile + GetTileDataAction{ { 3, { 3, 0, 0 } }, NotFound }, // child tile + GetTileDataAction{ { 3, { 3, 0, 1 } }, NotFound }, // ... + GetTileDataAction{ { 3, { 3, 1, 0 } }, NotFound }, // ... + GetTileDataAction{ { 3, { 3, 1, 1 } }, NotFound }, // ... + GetTileDataAction{ { 1, { 1, 0, 0 } }, Found }, // parent tile not ready + RetainTileDataAction{ { 1, { 1, 0, 0 } }, Optional }, // + GetTileDataAction{ { 0, { 0, 0, 0 } }, NotFound }, // missing parent tile + + GetTileDataAction{ { 2, { 2, 2, 0 } }, NotFound }, // missing ideal tile + CreateTileDataAction{ { 2, { 2, 2, 0 } } }, // + RetainTileDataAction{ { 2, { 2, 2, 0 } }, Required }, // + GetTileDataAction{ { 3, { 3, 4, 0 } }, NotFound }, // child tile + GetTileDataAction{ { 3, { 3, 4, 1 } }, NotFound }, // ... + GetTileDataAction{ { 3, { 3, 5, 0 } }, NotFound }, // ... + GetTileDataAction{ { 3, { 3, 5, 1 } }, NotFound }, // ... + GetTileDataAction{ { 1, { 1, 1, 0 } }, Found }, // found parent tile + RetainTileDataAction{ { 1, { 1, 1, 0 } }, Optional }, // + RenderTileAction{ { 1, 1, 0 }, *tile_1_1_1_0 }, // render parent tile }), log); } @@ -343,17 +402,17 @@ TEST(UpdateRenderables, UseParentTileWhenChildNotReady) { // Make sure that it renders the parent tile. algorithm::updateRenderables(getTileData, createTileData, retainTileData, renderTile, - source.idealTiles, source.info, 1); + source.idealTiles, source.zoomRange, 1); EXPECT_EQ(ActionLog({ - GetTileDataAction{ { 1, { 1, 0, 1 } }, true }, // found, but not ready - RetainTileDataAction{ { 1, { 1, 0, 1 } } }, // - GetTileDataAction{ { 2, { 2, 0, 2 } }, false }, // child tile - GetTileDataAction{ { 2, { 2, 0, 3 } }, false }, // ... - GetTileDataAction{ { 2, { 2, 1, 2 } }, false }, // ... - GetTileDataAction{ { 2, { 2, 1, 3 } }, false }, // ... - GetTileDataAction{ { 0, { 0, 0, 0 } }, true }, // parent tile, ready - RetainTileDataAction{ { 0, { 0, 0, 0 } } }, // - RenderTileAction{ { 0, 0, 0 }, *tile_0_0_0_0 }, // render parent tile + GetTileDataAction{ { 1, { 1, 0, 1 } }, Found }, // found, but not ready + RetainTileDataAction{ { 1, { 1, 0, 1 } }, Required }, // + GetTileDataAction{ { 2, { 2, 0, 2 } }, NotFound }, // child tile + GetTileDataAction{ { 2, { 2, 0, 3 } }, NotFound }, // ... + GetTileDataAction{ { 2, { 2, 1, 2 } }, NotFound }, // ... + GetTileDataAction{ { 2, { 2, 1, 3 } }, NotFound }, // ... + GetTileDataAction{ { 0, { 0, 0, 0 } }, Found }, // parent tile, ready + RetainTileDataAction{ { 0, { 0, 0, 0 } }, Optional }, // + RenderTileAction{ { 0, 0, 0 }, *tile_0_0_0_0 }, // render parent tile }), log); @@ -361,11 +420,11 @@ TEST(UpdateRenderables, UseParentTileWhenChildNotReady) { log.clear(); tile_1_1_0_1->renderable = true; algorithm::updateRenderables(getTileData, createTileData, retainTileData, renderTile, - source.idealTiles, source.info, 1); + source.idealTiles, source.zoomRange, 1); EXPECT_EQ(ActionLog({ - GetTileDataAction{ { 1, { 1, 0, 1 } }, true }, // found and ready - RetainTileDataAction{ { 1, { 1, 0, 1 } } }, // - RenderTileAction{ { 1, 0, 1 }, *tile_1_1_0_1 }, // render ideal tile + GetTileDataAction{ { 1, { 1, 0, 1 } }, Found }, // found and ready + RetainTileDataAction{ { 1, { 1, 0, 1 } }, Required }, // + RenderTileAction{ { 1, 0, 1 }, *tile_1_1_0_1 }, // render ideal tile }), log); } @@ -388,22 +447,22 @@ TEST(UpdateRenderables, UseOverlappingParentTile) { tile_1_1_0_1->renderable = true; algorithm::updateRenderables(getTileData, createTileData, retainTileData, renderTile, - source.idealTiles, source.info, 1); + source.idealTiles, source.zoomRange, 1); EXPECT_EQ(ActionLog({ - GetTileDataAction{ { 1, { 1, 0, 0 } }, false }, // ideal tile not found - CreateTileDataAction{ { 1, { 1, 0, 0 } } }, // - RetainTileDataAction{ { 1, { 1, 0, 0 } } }, // - GetTileDataAction{ { 2, { 2, 0, 0 } }, false }, // child tile - GetTileDataAction{ { 2, { 2, 0, 1 } }, false }, // ... - GetTileDataAction{ { 2, { 2, 1, 0 } }, false }, // ... - GetTileDataAction{ { 2, { 2, 1, 1 } }, false }, // ... - GetTileDataAction{ { 0, { 0, 0, 0 } }, true }, // parent tile found - RetainTileDataAction{ { 0, { 0, 0, 0 } } }, // - RenderTileAction{ { 0, 0, 0 }, *tile_0_0_0_0 }, // - - GetTileDataAction{ { 1, { 1, 0, 1 } }, true }, // ideal tile found - RetainTileDataAction{ { 1, { 1, 0, 1 } } }, // - RenderTileAction{ { 1, 0, 1 }, *tile_1_1_0_1 }, // + GetTileDataAction{ { 1, { 1, 0, 0 } }, NotFound }, // ideal tile not found + CreateTileDataAction{ { 1, { 1, 0, 0 } } }, // + RetainTileDataAction{ { 1, { 1, 0, 0 } }, Required }, // + GetTileDataAction{ { 2, { 2, 0, 0 } }, NotFound }, // child tile + GetTileDataAction{ { 2, { 2, 0, 1 } }, NotFound }, // ... + GetTileDataAction{ { 2, { 2, 1, 0 } }, NotFound }, // ... + GetTileDataAction{ { 2, { 2, 1, 1 } }, NotFound }, // ... + GetTileDataAction{ { 0, { 0, 0, 0 } }, Found }, // parent tile found + RetainTileDataAction{ { 0, { 0, 0, 0 } }, Optional }, // + RenderTileAction{ { 0, 0, 0 }, *tile_0_0_0_0 }, // + + GetTileDataAction{ { 1, { 1, 0, 1 } }, Found }, // ideal tile found + RetainTileDataAction{ { 1, { 1, 0, 1 } }, Required }, // + RenderTileAction{ { 1, 0, 1 }, *tile_1_1_0_1 }, // }), log); } @@ -424,19 +483,19 @@ TEST(UpdateRenderables, UseChildTiles) { tile_1_1_1_0->renderable = true; algorithm::updateRenderables(getTileData, createTileData, retainTileData, renderTile, - source.idealTiles, source.info, 0); + source.idealTiles, source.zoomRange, 0); EXPECT_EQ(ActionLog({ - GetTileDataAction{ { 0, { 0, 0, 0 } }, false }, // ideal tile, missing - CreateTileDataAction{ { 0, { 0, 0, 0 } } }, // - RetainTileDataAction{ { 0, { 0, 0, 0 } } }, // - GetTileDataAction{ { 1, { 1, 0, 0 } }, true }, // child tile found - RetainTileDataAction{ { 1, { 1, 0, 0 } } }, // - RenderTileAction{ { 1, 0, 0 }, *tile_1_1_0_0 }, // render child tile - GetTileDataAction{ { 1, { 1, 0, 1 } }, false }, // child tile not found - GetTileDataAction{ { 1, { 1, 1, 0 } }, true }, // child tile found - RetainTileDataAction{ { 1, { 1, 1, 0 } } }, // - RenderTileAction{ { 1, 1, 0 }, *tile_1_1_1_0 }, // render child tile - GetTileDataAction{ { 1, { 1, 1, 1 } }, false }, // child tile not found + GetTileDataAction{ { 0, { 0, 0, 0 } }, NotFound }, // ideal tile, missing + CreateTileDataAction{ { 0, { 0, 0, 0 } } }, // + RetainTileDataAction{ { 0, { 0, 0, 0 } }, Required }, // + GetTileDataAction{ { 1, { 1, 0, 0 } }, Found }, // child tile found + RetainTileDataAction{ { 1, { 1, 0, 0 } }, Optional }, // + RenderTileAction{ { 1, 0, 0 }, *tile_1_1_0_0 }, // render child tile + GetTileDataAction{ { 1, { 1, 0, 1 } }, NotFound }, // child tile not found + GetTileDataAction{ { 1, { 1, 1, 0 } }, Found }, // child tile found + RetainTileDataAction{ { 1, { 1, 1, 0 } }, Optional }, // + RenderTileAction{ { 1, 1, 0 }, *tile_1_1_1_0 }, // render child tile + GetTileDataAction{ { 1, { 1, 1, 1 } }, NotFound }, // child tile not found // no parent tile of 0 to consider }), log); @@ -458,20 +517,20 @@ TEST(UpdateRenderables, PreferChildTiles) { tile_2_2_0_0->renderable = true; algorithm::updateRenderables(getTileData, createTileData, retainTileData, renderTile, - source.idealTiles, source.info, 1); + source.idealTiles, source.zoomRange, 1); EXPECT_EQ(ActionLog({ - GetTileDataAction{ { 1, { 1, 0, 0 } }, false }, // ideal tile, not found - CreateTileDataAction{ { 1, { 1, 0, 0 } } }, // - RetainTileDataAction{ { 1, { 1, 0, 0 } } }, // - GetTileDataAction{ { 2, { 2, 0, 0 } }, true }, // child tile, found - RetainTileDataAction{ { 2, { 2, 0, 0 } } }, // - RenderTileAction{ { 2, 0, 0 }, *tile_2_2_0_0 }, // - GetTileDataAction{ { 2, { 2, 0, 1 } }, false }, // child tile, not found - GetTileDataAction{ { 2, { 2, 1, 0 } }, false }, // ... - GetTileDataAction{ { 2, { 2, 1, 1 } }, false }, // ... - GetTileDataAction{ { 0, { 0, 0, 0 } }, true }, // parent tile, found - RetainTileDataAction{ { 0, { 0, 0, 0 } } }, // - RenderTileAction{ { 0, 0, 0 }, *tile_0_0_0_0 }, // + GetTileDataAction{ { 1, { 1, 0, 0 } }, NotFound }, // ideal tile, not found + CreateTileDataAction{ { 1, { 1, 0, 0 } } }, // + RetainTileDataAction{ { 1, { 1, 0, 0 } }, Required }, // + GetTileDataAction{ { 2, { 2, 0, 0 } }, Found }, // child tile, found + RetainTileDataAction{ { 2, { 2, 0, 0 } }, Optional }, // + RenderTileAction{ { 2, 0, 0 }, *tile_2_2_0_0 }, // + GetTileDataAction{ { 2, { 2, 0, 1 } }, NotFound }, // child tile, not found + GetTileDataAction{ { 2, { 2, 1, 0 } }, NotFound }, // ... + GetTileDataAction{ { 2, { 2, 1, 1 } }, NotFound }, // ... + GetTileDataAction{ { 0, { 0, 0, 0 } }, Found }, // parent tile, found + RetainTileDataAction{ { 0, { 0, 0, 0 } }, Optional }, // + RenderTileAction{ { 0, 0, 0 }, *tile_0_0_0_0 }, // }), log); @@ -481,22 +540,22 @@ TEST(UpdateRenderables, PreferChildTiles) { auto tile_2_2_0_1 = source.createTileData(OverscaledTileID{ 2, 0, 1 }); tile_2_2_0_1->renderable = true; algorithm::updateRenderables(getTileData, createTileData, retainTileData, renderTile, - source.idealTiles, source.info, 1); + source.idealTiles, source.zoomRange, 1); EXPECT_EQ(ActionLog({ - GetTileDataAction{ { 1, { 1, 0, 0 } }, true }, // ideal tile, not ready + GetTileDataAction{ { 1, { 1, 0, 0 } }, Found }, // ideal tile, not ready // ideal tile was added in previous invocation, but is not yet ready - RetainTileDataAction{ { 1, { 1, 0, 0 } } }, // - GetTileDataAction{ { 2, { 2, 0, 0 } }, true }, // child tile, found - RetainTileDataAction{ { 2, { 2, 0, 0 } } }, // - RenderTileAction{ { 2, 0, 0 }, *tile_2_2_0_0 }, // - GetTileDataAction{ { 2, { 2, 0, 1 } }, true }, // ... - RetainTileDataAction{ { 2, { 2, 0, 1 } } }, // ... - RenderTileAction{ { 2, 0, 1 }, *tile_2_2_0_1 }, // - GetTileDataAction{ { 2, { 2, 1, 0 } }, false }, // child tile, not found - GetTileDataAction{ { 2, { 2, 1, 1 } }, false }, // ... - GetTileDataAction{ { 0, { 0, 0, 0 } }, true }, // parent tile, found - RetainTileDataAction{ { 0, { 0, 0, 0 } } }, // - RenderTileAction{ { 0, 0, 0 }, *tile_0_0_0_0 }, // + RetainTileDataAction{ { 1, { 1, 0, 0 } }, Required }, // + GetTileDataAction{ { 2, { 2, 0, 0 } }, Found }, // child tile, found + RetainTileDataAction{ { 2, { 2, 0, 0 } }, Optional }, // + RenderTileAction{ { 2, 0, 0 }, *tile_2_2_0_0 }, // + GetTileDataAction{ { 2, { 2, 0, 1 } }, Found }, // ... + RetainTileDataAction{ { 2, { 2, 0, 1 } }, Optional }, // ... + RenderTileAction{ { 2, 0, 1 }, *tile_2_2_0_1 }, // + GetTileDataAction{ { 2, { 2, 1, 0 } }, NotFound }, // child tile, not found + GetTileDataAction{ { 2, { 2, 1, 1 } }, NotFound }, // ... + GetTileDataAction{ { 0, { 0, 0, 0 } }, Found }, // parent tile, found + RetainTileDataAction{ { 0, { 0, 0, 0 } }, Optional }, // + RenderTileAction{ { 0, 0, 0 }, *tile_0_0_0_0 }, // }), log); @@ -504,24 +563,24 @@ TEST(UpdateRenderables, PreferChildTiles) { auto tile_2_2_1_0 = source.createTileData(OverscaledTileID{ 2, 1, 0 }); tile_2_2_1_0->renderable = true; algorithm::updateRenderables(getTileData, createTileData, retainTileData, renderTile, - source.idealTiles, source.info, 1); + source.idealTiles, source.zoomRange, 1); EXPECT_EQ(ActionLog({ - GetTileDataAction{ { 1, { 1, 0, 0 } }, true }, // ideal tile, not ready + GetTileDataAction{ { 1, { 1, 0, 0 } }, Found }, // ideal tile, not ready // ideal tile was added in first invocation, but is not yet ready - RetainTileDataAction{ { 1, { 1, 0, 0 } } }, // - GetTileDataAction{ { 2, { 2, 0, 0 } }, true }, // child tile, found - RetainTileDataAction{ { 2, { 2, 0, 0 } } }, // - RenderTileAction{ { 2, 0, 0 }, *tile_2_2_0_0 }, // - GetTileDataAction{ { 2, { 2, 0, 1 } }, true }, // ... - RetainTileDataAction{ { 2, { 2, 0, 1 } } }, // - RenderTileAction{ { 2, 0, 1 }, *tile_2_2_0_1 }, // - GetTileDataAction{ { 2, { 2, 1, 0 } }, true }, // ... - RetainTileDataAction{ { 2, { 2, 1, 0 } } }, // - RenderTileAction{ { 2, 1, 0 }, *tile_2_2_1_0 }, // - GetTileDataAction{ { 2, { 2, 1, 1 } }, false }, // child tile, not found - GetTileDataAction{ { 0, { 0, 0, 0 } }, true }, // parent tile, found - RetainTileDataAction{ { 0, { 0, 0, 0 } } }, // - RenderTileAction{ { 0, 0, 0 }, *tile_0_0_0_0 }, // + RetainTileDataAction{ { 1, { 1, 0, 0 } }, Required }, // + GetTileDataAction{ { 2, { 2, 0, 0 } }, Found }, // child tile, found + RetainTileDataAction{ { 2, { 2, 0, 0 } }, Optional }, // + RenderTileAction{ { 2, 0, 0 }, *tile_2_2_0_0 }, // + GetTileDataAction{ { 2, { 2, 0, 1 } }, Found }, // ... + RetainTileDataAction{ { 2, { 2, 0, 1 } }, Optional }, // + RenderTileAction{ { 2, 0, 1 }, *tile_2_2_0_1 }, // + GetTileDataAction{ { 2, { 2, 1, 0 } }, Found }, // ... + RetainTileDataAction{ { 2, { 2, 1, 0 } }, Optional }, // + RenderTileAction{ { 2, 1, 0 }, *tile_2_2_1_0 }, // + GetTileDataAction{ { 2, { 2, 1, 1 } }, NotFound }, // child tile, not found + GetTileDataAction{ { 0, { 0, 0, 0 } }, Found }, // parent tile, found + RetainTileDataAction{ { 0, { 0, 0, 0 } }, Optional }, // + RenderTileAction{ { 0, 0, 0 }, *tile_0_0_0_0 }, // }), log); @@ -530,23 +589,23 @@ TEST(UpdateRenderables, PreferChildTiles) { auto tile_2_2_1_1 = source.createTileData(OverscaledTileID{ 2, 1, 1 }); tile_2_2_1_1->renderable = true; algorithm::updateRenderables(getTileData, createTileData, retainTileData, renderTile, - source.idealTiles, source.info, 1); + source.idealTiles, source.zoomRange, 1); EXPECT_EQ(ActionLog({ - GetTileDataAction{ { 1, { 1, 0, 0 } }, true }, // ideal tile, not ready + GetTileDataAction{ { 1, { 1, 0, 0 } }, Found }, // ideal tile, not ready // ideal tile was added in first invocation, but is not yet ready - RetainTileDataAction{ { 1, { 1, 0, 0 } } }, // - GetTileDataAction{ { 2, { 2, 0, 0 } }, true }, // child tile, found - RetainTileDataAction{ { 2, { 2, 0, 0 } } }, // - RenderTileAction{ { 2, 0, 0 }, *tile_2_2_0_0 }, // - GetTileDataAction{ { 2, { 2, 0, 1 } }, true }, // ... - RetainTileDataAction{ { 2, { 2, 0, 1 } } }, // - RenderTileAction{ { 2, 0, 1 }, *tile_2_2_0_1 }, // - GetTileDataAction{ { 2, { 2, 1, 0 } }, true }, // ... - RetainTileDataAction{ { 2, { 2, 1, 0 } } }, // - RenderTileAction{ { 2, 1, 0 }, *tile_2_2_1_0 }, // - GetTileDataAction{ { 2, { 2, 1, 1 } }, true }, // ... - RetainTileDataAction{ { 2, { 2, 1, 1 } } }, // - RenderTileAction{ { 2, 1, 1 }, *tile_2_2_1_1 }, // + RetainTileDataAction{ { 1, { 1, 0, 0 } }, Required }, // + GetTileDataAction{ { 2, { 2, 0, 0 } }, Found }, // child tile, found + RetainTileDataAction{ { 2, { 2, 0, 0 } }, Optional }, // + RenderTileAction{ { 2, 0, 0 }, *tile_2_2_0_0 }, // + GetTileDataAction{ { 2, { 2, 0, 1 } }, Found }, // ... + RetainTileDataAction{ { 2, { 2, 0, 1 } }, Optional }, // + RenderTileAction{ { 2, 0, 1 }, *tile_2_2_0_1 }, // + GetTileDataAction{ { 2, { 2, 1, 0 } }, Found }, // ... + RetainTileDataAction{ { 2, { 2, 1, 0 } }, Optional }, // + RenderTileAction{ { 2, 1, 0 }, *tile_2_2_1_0 }, // + GetTileDataAction{ { 2, { 2, 1, 1 } }, Found }, // ... + RetainTileDataAction{ { 2, { 2, 1, 1 } }, Optional }, // + RenderTileAction{ { 2, 1, 1 }, *tile_2_2_1_1 }, // }), log); } @@ -568,20 +627,20 @@ TEST(UpdateRenderables, UseParentAndChildTiles) { // Check that it uses the child tile and the parent tile to cover the rest. algorithm::updateRenderables(getTileData, createTileData, retainTileData, renderTile, - source.idealTiles, source.info, 1); + source.idealTiles, source.zoomRange, 1); EXPECT_EQ(ActionLog({ - GetTileDataAction{ { 1, { 1, 0, 0 } }, false }, // ideal tile, missing - CreateTileDataAction{ { 1, { 1, 0, 0 } } }, // - RetainTileDataAction{ { 1, { 1, 0, 0 } } }, // - GetTileDataAction{ { 2, { 2, 0, 0 } }, true }, // - RetainTileDataAction{ { 2, { 2, 0, 0 } } }, // - RenderTileAction{ { 2, 0, 0 }, *tile_2_2_0_0 }, // - GetTileDataAction{ { 2, { 2, 0, 1 } }, false }, // - GetTileDataAction{ { 2, { 2, 1, 0 } }, false }, // - GetTileDataAction{ { 2, { 2, 1, 1 } }, false }, // - GetTileDataAction{ { 0, { 0, 0, 0 } }, true }, // - RetainTileDataAction{ { 0, { 0, 0, 0 } } }, // - RenderTileAction{ { 0, 0, 0 }, *tile_0_0_0_0 }, // + GetTileDataAction{ { 1, { 1, 0, 0 } }, NotFound }, // ideal tile, missing + CreateTileDataAction{ { 1, { 1, 0, 0 } } }, // + RetainTileDataAction{ { 1, { 1, 0, 0 } }, Required }, // + GetTileDataAction{ { 2, { 2, 0, 0 } }, Found }, // child tile + RetainTileDataAction{ { 2, { 2, 0, 0 } }, Optional }, // + RenderTileAction{ { 2, 0, 0 }, *tile_2_2_0_0 }, // + GetTileDataAction{ { 2, { 2, 0, 1 } }, NotFound }, // + GetTileDataAction{ { 2, { 2, 1, 0 } }, NotFound }, // + GetTileDataAction{ { 2, { 2, 1, 1 } }, NotFound }, // + GetTileDataAction{ { 0, { 0, 0, 0 } }, Found }, // parent tile + RetainTileDataAction{ { 0, { 0, 0, 0 } }, Optional }, // + RenderTileAction{ { 0, 0, 0 }, *tile_0_0_0_0 }, // }), log); @@ -589,17 +648,17 @@ TEST(UpdateRenderables, UseParentAndChildTiles) { log.clear(); source.dataTiles.erase(OverscaledTileID{ 2, 0, 0 }); algorithm::updateRenderables(getTileData, createTileData, retainTileData, renderTile, - source.idealTiles, source.info, 1); + source.idealTiles, source.zoomRange, 1); EXPECT_EQ(ActionLog({ - GetTileDataAction{ { 1, { 1, 0, 0 } }, true }, // ideal tile, not ready - RetainTileDataAction{ { 1, { 1, 0, 0 } } }, // - GetTileDataAction{ { 2, { 2, 0, 0 } }, false }, // - GetTileDataAction{ { 2, { 2, 0, 1 } }, false }, // - GetTileDataAction{ { 2, { 2, 1, 0 } }, false }, // - GetTileDataAction{ { 2, { 2, 1, 1 } }, false }, // - GetTileDataAction{ { 0, { 0, 0, 0 } }, true }, // - RetainTileDataAction{ { 0, { 0, 0, 0 } } }, // - RenderTileAction{ { 0, 0, 0 }, *tile_0_0_0_0 }, // + GetTileDataAction{ { 1, { 1, 0, 0 } }, Found }, // ideal tile, not ready + RetainTileDataAction{ { 1, { 1, 0, 0 } }, Required }, // + GetTileDataAction{ { 2, { 2, 0, 0 } }, NotFound }, // + GetTileDataAction{ { 2, { 2, 0, 1 } }, NotFound }, // + GetTileDataAction{ { 2, { 2, 1, 0 } }, NotFound }, // + GetTileDataAction{ { 2, { 2, 1, 1 } }, NotFound }, // + GetTileDataAction{ { 0, { 0, 0, 0 } }, Found }, // parent tile + RetainTileDataAction{ { 0, { 0, 0, 0 } }, Optional }, // + RenderTileAction{ { 0, 0, 0 }, *tile_0_0_0_0 }, // }), log); } @@ -612,22 +671,22 @@ TEST(UpdateRenderables, DontUseTilesLowerThanMinzoom) { auto retainTileData = retainTileDataFn(log); auto renderTile = renderTileFn(log); - source.info.minZoom = 2; + source.zoomRange.min = 2; source.idealTiles.emplace(UnwrappedTileID{ 2, 0, 0 }); auto tile_1_1_0_0 = source.createTileData(OverscaledTileID{ 1, 0, 0 }); tile_1_1_0_0->renderable = true; algorithm::updateRenderables(getTileData, createTileData, retainTileData, renderTile, - source.idealTiles, source.info, 2); + source.idealTiles, source.zoomRange, 2); EXPECT_EQ(ActionLog({ - GetTileDataAction{ { 2, { 2, 0, 0 } }, false }, // ideal tile, missing - CreateTileDataAction{ { 2, { 2, 0, 0 } } }, // - RetainTileDataAction{ { 2, { 2, 0, 0 } } }, // - GetTileDataAction{ { 3, { 3, 0, 0 } }, false }, // - GetTileDataAction{ { 3, { 3, 0, 1 } }, false }, // - GetTileDataAction{ { 3, { 3, 1, 0 } }, false }, // - GetTileDataAction{ { 3, { 3, 1, 1 } }, false }, // + GetTileDataAction{ { 2, { 2, 0, 0 } }, NotFound }, // ideal tile, missing + CreateTileDataAction{ { 2, { 2, 0, 0 } } }, // + RetainTileDataAction{ { 2, { 2, 0, 0 } }, Required }, // + GetTileDataAction{ { 3, { 3, 0, 0 } }, NotFound }, // + GetTileDataAction{ { 3, { 3, 0, 1 } }, NotFound }, // + GetTileDataAction{ { 3, { 3, 1, 0 } }, NotFound }, // + GetTileDataAction{ { 3, { 3, 1, 1 } }, NotFound }, // // no requests for zoom 1 tiles }), log); @@ -641,38 +700,56 @@ TEST(UpdateRenderables, UseOverzoomedTileAfterMaxzoom) { auto retainTileData = retainTileDataFn(log); auto renderTile = renderTileFn(log); - source.info.maxZoom = 2; + source.zoomRange.max = 2; source.idealTiles.emplace(UnwrappedTileID{ 2, 0, 0 }); // Add a child tile (that should never occur in practice) and make sure it's not selected. auto tile_3_3_0_0 = source.createTileData(OverscaledTileID{ 3, 0, 0 }); tile_3_3_0_0->renderable = true; algorithm::updateRenderables(getTileData, createTileData, retainTileData, renderTile, - source.idealTiles, source.info, 2); - EXPECT_EQ(ActionLog({ - GetTileDataAction{ { 2, { 2, 0, 0 } }, false }, // ideal tile, missing - CreateTileDataAction{ { 2, { 2, 0, 0 } } }, // - RetainTileDataAction{ { 2, { 2, 0, 0 } } }, // - GetTileDataAction{ { 3, { 2, 0, 0 } }, false }, // overzoomed tile, not children! - GetTileDataAction{ { 1, { 1, 0, 0 } }, false }, // - GetTileDataAction{ { 0, { 0, 0, 0 } }, false }, // - }), - log); + source.idealTiles, source.zoomRange, 2); + EXPECT_EQ( + ActionLog({ + GetTileDataAction{ { 2, { 2, 0, 0 } }, NotFound }, // ideal tile, missing + CreateTileDataAction{ { 2, { 2, 0, 0 } } }, // + RetainTileDataAction{ { 2, { 2, 0, 0 } }, Required }, // + GetTileDataAction{ { 3, { 2, 0, 0 } }, NotFound }, // overzoomed tile, not children! + GetTileDataAction{ { 1, { 1, 0, 0 } }, NotFound }, // + GetTileDataAction{ { 0, { 0, 0, 0 } }, NotFound }, // + }), + log); + + // Mark the created tile as having tried the optional request. + log.clear(); + source.dataTiles[{ 2, { 2, 0, 0 } }]->triedOptional = true; + algorithm::updateRenderables(getTileData, createTileData, retainTileData, renderTile, + source.idealTiles, source.zoomRange, 2); + EXPECT_EQ( + ActionLog({ + GetTileDataAction{ { 2, { 2, 0, 0 } }, Found }, // ideal tile, missing + RetainTileDataAction{ { 2, { 2, 0, 0 } }, Required }, // + GetTileDataAction{ { 3, { 2, 0, 0 } }, NotFound }, // overzoomed tile, not children! + GetTileDataAction{ { 1, { 1, 0, 0 } }, NotFound }, // + CreateTileDataAction{ { 1, { 1, 0, 0 } } }, // + RetainTileDataAction{ { 1, { 1, 0, 0 } }, Optional }, // + GetTileDataAction{ { 0, { 0, 0, 0 } }, NotFound }, // + }), + log); // Only add a non-overzoomed ("parent") tile at first. log.clear(); auto tile_2_2_0_0 = source.createTileData(OverscaledTileID{ 2, { 2, 0, 0 } }); tile_2_2_0_0->renderable = true; algorithm::updateRenderables(getTileData, createTileData, retainTileData, renderTile, - source.idealTiles, source.info, 3); + source.idealTiles, source.zoomRange, 3); EXPECT_EQ(ActionLog({ - GetTileDataAction{ { 3, { 2, 0, 0 } }, false }, // ideal tile, missing - CreateTileDataAction{ { 3, { 2, 0, 0 } } }, // - RetainTileDataAction{ { 3, { 2, 0, 0 } } }, // - GetTileDataAction{ { 4, { 2, 0, 0 } }, false }, // - GetTileDataAction{ { 2, { 2, 0, 0 } }, true }, // - RetainTileDataAction{ { 2, { 2, 0, 0 } } }, // - RenderTileAction{ { 2, 0, 0 }, *tile_2_2_0_0 }, // + GetTileDataAction{ { 3, { 2, 0, 0 } }, NotFound }, // ideal tile, missing + CreateTileDataAction{ { 3, { 2, 0, 0 } } }, // + RetainTileDataAction{ { 3, { 2, 0, 0 } }, Required }, // + GetTileDataAction{ { 4, { 2, 0, 0 } }, NotFound }, // + GetTileDataAction{ { 2, { 2, 0, 0 } }, Found }, // + RetainTileDataAction{ { 2, { 2, 0, 0 } }, Optional }, // + RenderTileAction{ { 2, 0, 0 }, *tile_2_2_0_0 }, // }), log); @@ -681,22 +758,22 @@ TEST(UpdateRenderables, UseOverzoomedTileAfterMaxzoom) { auto tile_3_2_0_0 = source.createTileData(OverscaledTileID{ 3, { 2, 0, 0 } }); tile_3_2_0_0->renderable = true; algorithm::updateRenderables(getTileData, createTileData, retainTileData, renderTile, - source.idealTiles, source.info, 3); + source.idealTiles, source.zoomRange, 3); EXPECT_EQ(ActionLog({ - GetTileDataAction{ { 3, { 2, 0, 0 } }, true }, // - RetainTileDataAction{ { 3, { 2, 0, 0 } } }, // - RenderTileAction{ { 2, 0, 0 }, *tile_3_2_0_0 }, // + GetTileDataAction{ { 3, { 2, 0, 0 } }, Found }, // + RetainTileDataAction{ { 3, { 2, 0, 0 } }, Required }, // + RenderTileAction{ { 2, 0, 0 }, *tile_3_2_0_0 }, // }), log); // Check that it's switching back to the tile that has the matching overzoom value. log.clear(); algorithm::updateRenderables(getTileData, createTileData, retainTileData, renderTile, - source.idealTiles, source.info, 2); + source.idealTiles, source.zoomRange, 2); EXPECT_EQ(ActionLog({ - GetTileDataAction{ { 2, { 2, 0, 0 } }, true }, // - RetainTileDataAction{ { 2, { 2, 0, 0 } } }, // - RenderTileAction{ { 2, 0, 0 }, *tile_2_2_0_0 }, // + GetTileDataAction{ { 2, { 2, 0, 0 } }, Found }, // + RetainTileDataAction{ { 2, { 2, 0, 0 } }, Required }, // + RenderTileAction{ { 2, 0, 0 }, *tile_2_2_0_0 }, // }), log); @@ -707,14 +784,14 @@ TEST(UpdateRenderables, UseOverzoomedTileAfterMaxzoom) { // Use the overzoomed tile even though it doesn't match the zoom level. algorithm::updateRenderables(getTileData, createTileData, retainTileData, renderTile, - source.idealTiles, source.info, 2); + source.idealTiles, source.zoomRange, 2); EXPECT_EQ(ActionLog({ - GetTileDataAction{ { 2, { 2, 0, 0 } }, false }, // - CreateTileDataAction{ { 2, { 2, 0, 0 } } }, // - RetainTileDataAction{ { 2, { 2, 0, 0 } } }, // - GetTileDataAction{ { 3, { 2, 0, 0 } }, true }, // use overzoomed tile! - RetainTileDataAction{ { 3, { 2, 0, 0 } } }, // - RenderTileAction{ { 2, 0, 0 }, *tile_3_2_0_0 }, // + GetTileDataAction{ { 2, { 2, 0, 0 } }, NotFound }, // + CreateTileDataAction{ { 2, { 2, 0, 0 } } }, // + RetainTileDataAction{ { 2, { 2, 0, 0 } }, Required }, // + GetTileDataAction{ { 3, { 2, 0, 0 } }, Found }, // use overzoomed tile! + RetainTileDataAction{ { 3, { 2, 0, 0 } }, Optional }, // + RenderTileAction{ { 2, 0, 0 }, *tile_3_2_0_0 }, // }), log); } @@ -727,18 +804,18 @@ TEST(UpdateRenderables, AscendToNonOverzoomedTiles) { auto retainTileData = retainTileDataFn(log); auto renderTile = renderTileFn(log); - source.info.maxZoom = 2; + source.zoomRange.max = 2; source.idealTiles.emplace(UnwrappedTileID{ 2, 0, 0 }); // Add a matching overzoomed tile and make sure it gets selected. auto tile_3_2_0_0 = source.createTileData(OverscaledTileID{ 3, { 2, 0, 0 } }); tile_3_2_0_0->renderable = true; algorithm::updateRenderables(getTileData, createTileData, retainTileData, renderTile, - source.idealTiles, source.info, 3); + source.idealTiles, source.zoomRange, 3); EXPECT_EQ(ActionLog({ - GetTileDataAction{ { 3, { 2, 0, 0 } }, true }, // - RetainTileDataAction{ { 3, { 2, 0, 0 } } }, // - RenderTileAction{ { 2, 0, 0 }, *tile_3_2_0_0 }, // + GetTileDataAction{ { 3, { 2, 0, 0 } }, Found }, // + RetainTileDataAction{ { 3, { 2, 0, 0 } }, Required }, // + RenderTileAction{ { 2, 0, 0 }, *tile_3_2_0_0 }, // }), log); @@ -749,15 +826,15 @@ TEST(UpdateRenderables, AscendToNonOverzoomedTiles) { auto tile_2_2_0_0 = source.createTileData(OverscaledTileID{ 2, { 2, 0, 0 } }); tile_2_2_0_0->renderable = true; algorithm::updateRenderables(getTileData, createTileData, retainTileData, renderTile, - source.idealTiles, source.info, 3); + source.idealTiles, source.zoomRange, 3); EXPECT_EQ(ActionLog({ - GetTileDataAction{ { 3, { 2, 0, 0 } }, false }, // - CreateTileDataAction{ { 3, { 2, 0, 0 } } }, // - RetainTileDataAction{ { 3, { 2, 0, 0 } } }, // - GetTileDataAction{ { 4, { 2, 0, 0 } }, false }, // prefer using a child first - GetTileDataAction{ { 2, { 2, 0, 0 } }, true }, // - RetainTileDataAction{ { 2, { 2, 0, 0 } } }, // - RenderTileAction{ { 2, 0, 0 }, *tile_2_2_0_0 }, // + GetTileDataAction{ { 3, { 2, 0, 0 } }, NotFound }, // + CreateTileDataAction{ { 3, { 2, 0, 0 } } }, // + RetainTileDataAction{ { 3, { 2, 0, 0 } }, Required }, // + GetTileDataAction{ { 4, { 2, 0, 0 } }, NotFound }, // prefer using a child first + GetTileDataAction{ { 2, { 2, 0, 0 } }, Found }, // + RetainTileDataAction{ { 2, { 2, 0, 0 } }, Optional }, // + RenderTileAction{ { 2, 0, 0 }, *tile_2_2_0_0 }, // }), log); @@ -768,15 +845,33 @@ TEST(UpdateRenderables, AscendToNonOverzoomedTiles) { auto tile_1_1_0_0 = source.createTileData(OverscaledTileID{ 1, { 1, 0, 0 } }); tile_1_1_0_0->renderable = true; algorithm::updateRenderables(getTileData, createTileData, retainTileData, renderTile, - source.idealTiles, source.info, 3); + source.idealTiles, source.zoomRange, 3); + EXPECT_EQ(ActionLog({ + GetTileDataAction{ { 3, { 2, 0, 0 } }, Found }, // ideal tile, not ready + RetainTileDataAction{ { 3, { 2, 0, 0 } }, Required }, // + GetTileDataAction{ { 4, { 2, 0, 0 } }, NotFound }, // + GetTileDataAction{ { 2, { 2, 0, 0 } }, NotFound }, // + GetTileDataAction{ { 1, { 1, 0, 0 } }, Found }, // + RetainTileDataAction{ { 1, { 1, 0, 0 } }, Optional }, // + RenderTileAction{ { 1, 0, 0 }, *tile_1_1_0_0 }, // + }), + log); + + // Now, mark the created tile as found. + log.clear(); + source.dataTiles[{ 3, { 2, 0, 0 } }]->triedOptional = true; + algorithm::updateRenderables(getTileData, createTileData, retainTileData, renderTile, + source.idealTiles, source.zoomRange, 3); EXPECT_EQ(ActionLog({ - GetTileDataAction{ { 3, { 2, 0, 0 } }, true }, // ideal tile found, but not ready - RetainTileDataAction{ { 3, { 2, 0, 0 } } }, // - GetTileDataAction{ { 4, { 2, 0, 0 } }, false }, // - GetTileDataAction{ { 2, { 2, 0, 0 } }, false }, // - GetTileDataAction{ { 1, { 1, 0, 0 } }, true }, // - RetainTileDataAction{ { 1, { 1, 0, 0 } } }, // - RenderTileAction{ { 1, 0, 0 }, *tile_1_1_0_0 }, // + GetTileDataAction{ { 3, { 2, 0, 0 } }, Found }, // ideal tile, not ready + RetainTileDataAction{ { 3, { 2, 0, 0 } }, Required }, // + GetTileDataAction{ { 4, { 2, 0, 0 } }, NotFound }, // + GetTileDataAction{ { 2, { 2, 0, 0 } }, NotFound }, // + CreateTileDataAction{ { 2, { 2, 0, 0 } } }, // + RetainTileDataAction{ { 2, { 2, 0, 0 } }, Optional }, // + GetTileDataAction{ { 1, { 1, 0, 0 } }, Found }, // + RetainTileDataAction{ { 1, { 1, 0, 0 } }, Optional }, // + RenderTileAction{ { 1, 0, 0 }, *tile_1_1_0_0 }, // }), log); } @@ -793,31 +888,31 @@ TEST(UpdateRenderables, DoNotAscendMultipleTimesIfNotFound) { source.idealTiles.emplace(UnwrappedTileID{ 8, 1, 0 }); algorithm::updateRenderables(getTileData, createTileData, retainTileData, renderTile, - source.idealTiles, source.info, 8); - EXPECT_EQ(ActionLog({ - GetTileDataAction{ { 8, { 8, 0, 0 } }, false }, // ideal tile - CreateTileDataAction{ { 8, { 8, 0, 0 } } }, // - RetainTileDataAction{ { 8, { 8, 0, 0 } } }, // - GetTileDataAction{ { 9, { 9, 0, 0 } }, false }, // child tile - GetTileDataAction{ { 9, { 9, 0, 1 } }, false }, // ... - GetTileDataAction{ { 9, { 9, 1, 0 } }, false }, // ... - GetTileDataAction{ { 9, { 9, 1, 1 } }, false }, // ... - GetTileDataAction{ { 7, { 7, 0, 0 } }, false }, // ascent - GetTileDataAction{ { 6, { 6, 0, 0 } }, false }, // ... - GetTileDataAction{ { 5, { 5, 0, 0 } }, false }, // ... - GetTileDataAction{ { 4, { 4, 0, 0 } }, false }, // ... - GetTileDataAction{ { 3, { 3, 0, 0 } }, false }, // ... - GetTileDataAction{ { 2, { 2, 0, 0 } }, false }, // ... - GetTileDataAction{ { 1, { 1, 0, 0 } }, false }, // ... - GetTileDataAction{ { 0, { 0, 0, 0 } }, false }, // ... - - GetTileDataAction{ { 8, { 8, 1, 0 } }, false }, // ideal tile - CreateTileDataAction{ { 8, { 8, 1, 0 } } }, // - RetainTileDataAction{ { 8, { 8, 1, 0 } } }, // - GetTileDataAction{ { 9, { 9, 2, 0 } }, false }, // child tile - GetTileDataAction{ { 9, { 9, 2, 1 } }, false }, // ... - GetTileDataAction{ { 9, { 9, 3, 0 } }, false }, // ... - GetTileDataAction{ { 9, { 9, 3, 1 } }, false }, // ... + source.idealTiles, source.zoomRange, 8); + EXPECT_EQ(ActionLog({ + GetTileDataAction{ { 8, { 8, 0, 0 } }, NotFound }, // ideal tile + CreateTileDataAction{ { 8, { 8, 0, 0 } } }, // + RetainTileDataAction{ { 8, { 8, 0, 0 } }, Required }, // + GetTileDataAction{ { 9, { 9, 0, 0 } }, NotFound }, // child tile + GetTileDataAction{ { 9, { 9, 0, 1 } }, NotFound }, // ... + GetTileDataAction{ { 9, { 9, 1, 0 } }, NotFound }, // ... + GetTileDataAction{ { 9, { 9, 1, 1 } }, NotFound }, // ... + GetTileDataAction{ { 7, { 7, 0, 0 } }, NotFound }, // ascent + GetTileDataAction{ { 6, { 6, 0, 0 } }, NotFound }, // ... + GetTileDataAction{ { 5, { 5, 0, 0 } }, NotFound }, // ... + GetTileDataAction{ { 4, { 4, 0, 0 } }, NotFound }, // ... + GetTileDataAction{ { 3, { 3, 0, 0 } }, NotFound }, // ... + GetTileDataAction{ { 2, { 2, 0, 0 } }, NotFound }, // ... + GetTileDataAction{ { 1, { 1, 0, 0 } }, NotFound }, // ... + GetTileDataAction{ { 0, { 0, 0, 0 } }, NotFound }, // ... + + GetTileDataAction{ { 8, { 8, 1, 0 } }, NotFound }, // ideal tile + CreateTileDataAction{ { 8, { 8, 1, 0 } } }, // + RetainTileDataAction{ { 8, { 8, 1, 0 } }, Required }, // + GetTileDataAction{ { 9, { 9, 2, 0 } }, NotFound }, // child tile + GetTileDataAction{ { 9, { 9, 2, 1 } }, NotFound }, // ... + GetTileDataAction{ { 9, { 9, 3, 0 } }, NotFound }, // ... + GetTileDataAction{ { 9, { 9, 3, 1 } }, NotFound }, // ... // no second ascent to 0 }), log); @@ -828,27 +923,27 @@ TEST(UpdateRenderables, DoNotAscendMultipleTimesIfNotFound) { tile_4_0_0_0->renderable = true; algorithm::updateRenderables(getTileData, createTileData, retainTileData, renderTile, - source.idealTiles, source.info, 8); - EXPECT_EQ(ActionLog({ - GetTileDataAction{ { 8, { 8, 0, 0 } }, true }, // ideal tile found, but not ready - RetainTileDataAction{ { 8, { 8, 0, 0 } } }, // - GetTileDataAction{ { 9, { 9, 0, 0 } }, false }, // child tile - GetTileDataAction{ { 9, { 9, 0, 1 } }, false }, // ... - GetTileDataAction{ { 9, { 9, 1, 0 } }, false }, // ... - GetTileDataAction{ { 9, { 9, 1, 1 } }, false }, // ... - GetTileDataAction{ { 7, { 7, 0, 0 } }, false }, // ascent - GetTileDataAction{ { 6, { 6, 0, 0 } }, false }, // ... - GetTileDataAction{ { 5, { 5, 0, 0 } }, false }, // ... - GetTileDataAction{ { 4, { 4, 0, 0 } }, true }, // stops ascent - RetainTileDataAction{ { 4, { 4, 0, 0 } } }, // - RenderTileAction{ { 4, 0, 0 }, *tile_4_0_0_0 }, - - GetTileDataAction{ { 8, { 8, 1, 0 } }, true }, // ideal tile found, but not ready - RetainTileDataAction{ { 8, { 8, 1, 0 } } }, // - GetTileDataAction{ { 9, { 9, 2, 0 } }, false }, // child tile - GetTileDataAction{ { 9, { 9, 2, 1 } }, false }, // ... - GetTileDataAction{ { 9, { 9, 3, 0 } }, false }, // ... - GetTileDataAction{ { 9, { 9, 3, 1 } }, false }, // ... + source.idealTiles, source.zoomRange, 8); + EXPECT_EQ(ActionLog({ + GetTileDataAction{ { 8, { 8, 0, 0 } }, Found }, // ideal tile, not ready + RetainTileDataAction{ { 8, { 8, 0, 0 } }, Required }, // + GetTileDataAction{ { 9, { 9, 0, 0 } }, NotFound }, // child tile + GetTileDataAction{ { 9, { 9, 0, 1 } }, NotFound }, // ... + GetTileDataAction{ { 9, { 9, 1, 0 } }, NotFound }, // ... + GetTileDataAction{ { 9, { 9, 1, 1 } }, NotFound }, // ... + GetTileDataAction{ { 7, { 7, 0, 0 } }, NotFound }, // ascent + GetTileDataAction{ { 6, { 6, 0, 0 } }, NotFound }, // ... + GetTileDataAction{ { 5, { 5, 0, 0 } }, NotFound }, // ... + GetTileDataAction{ { 4, { 4, 0, 0 } }, Found }, // stops ascent + RetainTileDataAction{ { 4, { 4, 0, 0 } }, Optional }, // + RenderTileAction{ { 4, 0, 0 }, *tile_4_0_0_0 }, // + + GetTileDataAction{ { 8, { 8, 1, 0 } }, Found }, // ideal tile, not ready + RetainTileDataAction{ { 8, { 8, 1, 0 } }, Required }, // + GetTileDataAction{ { 9, { 9, 2, 0 } }, NotFound }, // child tile + GetTileDataAction{ { 9, { 9, 2, 1 } }, NotFound }, // ... + GetTileDataAction{ { 9, { 9, 3, 0 } }, NotFound }, // ... + GetTileDataAction{ { 9, { 9, 3, 1 } }, NotFound }, // ... // no second ascent to 0 }), log); @@ -868,17 +963,17 @@ TEST(UpdateRenderables, DontRetainUnusedNonIdealTiles) { source.createTileData(OverscaledTileID{ 2, 0, 0 }); algorithm::updateRenderables(getTileData, createTileData, retainTileData, renderTile, - source.idealTiles, source.info, 2); + source.idealTiles, source.zoomRange, 2); EXPECT_EQ(ActionLog({ - GetTileDataAction{ { 2, { 2, 0, 0 } }, true }, // ideal tile, not ready - RetainTileDataAction{ { 2, { 2, 0, 0 } } }, // - GetTileDataAction{ { 3, { 3, 0, 0 } }, false }, // - GetTileDataAction{ { 3, { 3, 0, 1 } }, false }, // - GetTileDataAction{ { 3, { 3, 1, 0 } }, false }, // - GetTileDataAction{ { 3, { 3, 1, 1 } }, false }, // - GetTileDataAction{ { 1, { 1, 0, 0 } }, true }, // parent tile, not ready - // don't retain the parent tile - GetTileDataAction{ { 0, { 0, 0, 0 } }, false }, // + GetTileDataAction{ { 2, { 2, 0, 0 } }, Found }, // ideal tile, not ready + RetainTileDataAction{ { 2, { 2, 0, 0 } }, Required }, // + GetTileDataAction{ { 3, { 3, 0, 0 } }, NotFound }, // + GetTileDataAction{ { 3, { 3, 0, 1 } }, NotFound }, // + GetTileDataAction{ { 3, { 3, 1, 0 } }, NotFound }, // + GetTileDataAction{ { 3, { 3, 1, 1 } }, NotFound }, // + GetTileDataAction{ { 1, { 1, 0, 0 } }, Found }, // parent tile, not ready + RetainTileDataAction{ { 1, { 1, 0, 0 } }, Optional }, // + GetTileDataAction{ { 0, { 0, 0, 0 } }, NotFound }, // }), log); } @@ -900,47 +995,239 @@ TEST(UpdateRenderables, WrappedTiles) { tile_0_0_0_0->renderable = true; algorithm::updateRenderables(getTileData, createTileData, retainTileData, renderTile, - source.idealTiles, source.info, 1); - EXPECT_EQ(ActionLog({ - GetTileDataAction{ { 1, { 1, 1, 0 } }, false }, // ideal tile 1/-1/0 - CreateTileDataAction{ { 1, { 1, 1, 0 } } }, // - RetainTileDataAction{ { 1, { 1, 1, 0 } } }, // - GetTileDataAction{ { 2, { 2, 2, 0 } }, false }, // - GetTileDataAction{ { 2, { 2, 2, 1 } }, false }, // - GetTileDataAction{ { 2, { 2, 3, 0 } }, false }, // - GetTileDataAction{ { 2, { 2, 3, 1 } }, false }, // - GetTileDataAction{ { 0, { 0, 0, 0 } }, true }, // - RetainTileDataAction{ { 0, { 0, 0, 0 } } }, // - RenderTileAction{ { 0, -1, 0 }, *tile_0_0_0_0 }, // - - GetTileDataAction{ { 1, { 1, 0, 0 } }, false }, // ideal tile 1/0/0 - CreateTileDataAction{ { 1, { 1, 0, 0 } } }, // - RetainTileDataAction{ { 1, { 1, 0, 0 } } }, // - GetTileDataAction{ { 2, { 2, 0, 0 } }, false }, // - GetTileDataAction{ { 2, { 2, 0, 1 } }, false }, // - GetTileDataAction{ { 2, { 2, 1, 0 } }, false }, // - GetTileDataAction{ { 2, { 2, 1, 1 } }, false }, // - GetTileDataAction{ { 0, { 0, 0, 0 } }, true }, // - RetainTileDataAction{ { 0, { 0, 0, 0 } } }, // - RenderTileAction{ { 0, 0, 0 }, *tile_0_0_0_0 }, // - - GetTileDataAction{ { 1, { 1, 1, 0 } }, true }, // ideal tile 1/1/0 - RetainTileDataAction{ { 1, { 1, 1, 0 } } }, // - GetTileDataAction{ { 2, { 2, 2, 0 } }, false }, // - GetTileDataAction{ { 2, { 2, 2, 1 } }, false }, // - GetTileDataAction{ { 2, { 2, 3, 0 } }, false }, // - GetTileDataAction{ { 2, { 2, 3, 1 } }, false }, // + source.idealTiles, source.zoomRange, 1); + EXPECT_EQ(ActionLog({ + GetTileDataAction{ { 1, { 1, 1, 0 } }, NotFound }, // ideal tile 1/-1/0 + CreateTileDataAction{ { 1, { 1, 1, 0 } } }, // + RetainTileDataAction{ { 1, { 1, 1, 0 } }, Required }, // + GetTileDataAction{ { 2, { 2, 2, 0 } }, NotFound }, // + GetTileDataAction{ { 2, { 2, 2, 1 } }, NotFound }, // + GetTileDataAction{ { 2, { 2, 3, 0 } }, NotFound }, // + GetTileDataAction{ { 2, { 2, 3, 1 } }, NotFound }, // + GetTileDataAction{ { 0, { 0, 0, 0 } }, Found }, // + RetainTileDataAction{ { 0, { 0, 0, 0 } }, Optional }, // + RenderTileAction{ { 0, -1, 0 }, *tile_0_0_0_0 }, // + + GetTileDataAction{ { 1, { 1, 0, 0 } }, NotFound }, // ideal tile 1/0/0 + CreateTileDataAction{ { 1, { 1, 0, 0 } } }, // + RetainTileDataAction{ { 1, { 1, 0, 0 } }, Required }, // + GetTileDataAction{ { 2, { 2, 0, 0 } }, NotFound }, // + GetTileDataAction{ { 2, { 2, 0, 1 } }, NotFound }, // + GetTileDataAction{ { 2, { 2, 1, 0 } }, NotFound }, // + GetTileDataAction{ { 2, { 2, 1, 1 } }, NotFound }, // + GetTileDataAction{ { 0, { 0, 0, 0 } }, Found }, // + RetainTileDataAction{ { 0, { 0, 0, 0 } }, Optional }, // + RenderTileAction{ { 0, 0, 0 }, *tile_0_0_0_0 }, // + + GetTileDataAction{ { 1, { 1, 1, 0 } }, Found }, // ideal tile 1/1/0 + RetainTileDataAction{ { 1, { 1, 1, 0 } }, Required }, // + GetTileDataAction{ { 2, { 2, 2, 0 } }, NotFound }, // + GetTileDataAction{ { 2, { 2, 2, 1 } }, NotFound }, // + GetTileDataAction{ { 2, { 2, 3, 0 } }, NotFound }, // + GetTileDataAction{ { 2, { 2, 3, 1 } }, NotFound }, // // do not ascent; 0/0/0 has been rendered already for 1/0/0 - GetTileDataAction{ { 1, { 1, 0, 0 } }, true }, // ideal tile 1/2/0 - RetainTileDataAction{ { 1, { 1, 0, 0 } } }, // - GetTileDataAction{ { 2, { 2, 0, 0 } }, false }, // - GetTileDataAction{ { 2, { 2, 0, 1 } }, false }, // - GetTileDataAction{ { 2, { 2, 1, 0 } }, false }, // - GetTileDataAction{ { 2, { 2, 1, 1 } }, false }, // - GetTileDataAction{ { 0, { 0, 0, 0 } }, true }, // - RetainTileDataAction{ { 0, { 0, 0, 0 } } }, // - RenderTileAction{ { 0, 1, 0 }, *tile_0_0_0_0 }, // + GetTileDataAction{ { 1, { 1, 0, 0 } }, Found }, // ideal tile 1/2/0 + RetainTileDataAction{ { 1, { 1, 0, 0 } }, Required }, // + GetTileDataAction{ { 2, { 2, 0, 0 } }, NotFound }, // + GetTileDataAction{ { 2, { 2, 0, 1 } }, NotFound }, // + GetTileDataAction{ { 2, { 2, 1, 0 } }, NotFound }, // + GetTileDataAction{ { 2, { 2, 1, 1 } }, NotFound }, // + GetTileDataAction{ { 0, { 0, 0, 0 } }, Found }, // + RetainTileDataAction{ { 0, { 0, 0, 0 } }, Optional }, // + RenderTileAction{ { 0, 1, 0 }, *tile_0_0_0_0 }, // + }), + log); +} + +TEST(UpdateRenderables, RepeatedRenderWithMissingOptionals) { + ActionLog log; + MockSource source; + auto getTileData = getTileDataFn(log, source.dataTiles); + auto createTileData = createTileDataFn(log, source.dataTiles); + auto retainTileData = retainTileDataFn(log); + auto renderTile = renderTileFn(log); + + source.idealTiles.emplace(UnwrappedTileID{ 6, 0, 0 }); + + algorithm::updateRenderables(getTileData, createTileData, retainTileData, renderTile, + source.idealTiles, source.zoomRange, 6); + EXPECT_EQ(ActionLog({ + GetTileDataAction{ { 6, { 6, 0, 0 } }, NotFound }, // ideal tile, not found + CreateTileDataAction{ { 6, { 6, 0, 0 } } }, // + RetainTileDataAction{ { 6, { 6, 0, 0 } }, Required }, // + GetTileDataAction{ { 7, { 7, 0, 0 } }, NotFound }, // children + GetTileDataAction{ { 7, { 7, 0, 1 } }, NotFound }, // ... + GetTileDataAction{ { 7, { 7, 1, 0 } }, NotFound }, // ... + GetTileDataAction{ { 7, { 7, 1, 1 } }, NotFound }, // ... + GetTileDataAction{ { 5, { 5, 0, 0 } }, NotFound }, // ascent + GetTileDataAction{ { 4, { 4, 0, 0 } }, NotFound }, // ... + GetTileDataAction{ { 3, { 3, 0, 0 } }, NotFound }, // ... + GetTileDataAction{ { 2, { 2, 0, 0 } }, NotFound }, // ... + GetTileDataAction{ { 1, { 1, 0, 0 } }, NotFound }, // ... + GetTileDataAction{ { 0, { 0, 0, 0 } }, NotFound }, // ... + }), + log); + + // Repeat. + log.clear(); + algorithm::updateRenderables(getTileData, createTileData, retainTileData, renderTile, + source.idealTiles, source.zoomRange, 6); + EXPECT_EQ(ActionLog({ + GetTileDataAction{ { 6, { 6, 0, 0 } }, Found }, // ideal tile, not ready + RetainTileDataAction{ { 6, { 6, 0, 0 } }, Required }, // + GetTileDataAction{ { 7, { 7, 0, 0 } }, NotFound }, // children + GetTileDataAction{ { 7, { 7, 0, 1 } }, NotFound }, // ... + GetTileDataAction{ { 7, { 7, 1, 0 } }, NotFound }, // ... + GetTileDataAction{ { 7, { 7, 1, 1 } }, NotFound }, // ... + GetTileDataAction{ { 5, { 5, 0, 0 } }, NotFound }, // ascent + GetTileDataAction{ { 4, { 4, 0, 0 } }, NotFound }, // ... + GetTileDataAction{ { 3, { 3, 0, 0 } }, NotFound }, // ... + GetTileDataAction{ { 2, { 2, 0, 0 } }, NotFound }, // ... + GetTileDataAction{ { 1, { 1, 0, 0 } }, NotFound }, // ... + GetTileDataAction{ { 0, { 0, 0, 0 } }, NotFound }, // ... + }), + log); + + // Mark next level has having tried optional. + log.clear(); + source.dataTiles[{ 6, { 6, 0, 0 } }]->triedOptional = true; + algorithm::updateRenderables(getTileData, createTileData, retainTileData, renderTile, + source.idealTiles, source.zoomRange, 6); + EXPECT_EQ(ActionLog({ + GetTileDataAction{ { 6, { 6, 0, 0 } }, Found }, // ideal tile, not ready + RetainTileDataAction{ { 6, { 6, 0, 0 } }, Required }, // + GetTileDataAction{ { 7, { 7, 0, 0 } }, NotFound }, // children + GetTileDataAction{ { 7, { 7, 0, 1 } }, NotFound }, // ... + GetTileDataAction{ { 7, { 7, 1, 0 } }, NotFound }, // ... + GetTileDataAction{ { 7, { 7, 1, 1 } }, NotFound }, // ... + GetTileDataAction{ { 5, { 5, 0, 0 } }, NotFound }, // ascent + CreateTileDataAction{ { 5, { 5, 0, 0 } } }, // + RetainTileDataAction{ { 5, { 5, 0, 0 } }, Optional }, // + GetTileDataAction{ { 4, { 4, 0, 0 } }, NotFound }, // ... + GetTileDataAction{ { 3, { 3, 0, 0 } }, NotFound }, // ... + GetTileDataAction{ { 2, { 2, 0, 0 } }, NotFound }, // ... + GetTileDataAction{ { 1, { 1, 0, 0 } }, NotFound }, // ... + GetTileDataAction{ { 0, { 0, 0, 0 } }, NotFound }, // ... + }), + log); + + // Repeat. + log.clear(); + algorithm::updateRenderables(getTileData, createTileData, retainTileData, renderTile, + source.idealTiles, source.zoomRange, 6); + EXPECT_EQ(ActionLog({ + GetTileDataAction{ { 6, { 6, 0, 0 } }, Found }, // ideal tile, not ready + RetainTileDataAction{ { 6, { 6, 0, 0 } }, Required }, // + GetTileDataAction{ { 7, { 7, 0, 0 } }, NotFound }, // children + GetTileDataAction{ { 7, { 7, 0, 1 } }, NotFound }, // ... + GetTileDataAction{ { 7, { 7, 1, 0 } }, NotFound }, // ... + GetTileDataAction{ { 7, { 7, 1, 1 } }, NotFound }, // ... + GetTileDataAction{ { 5, { 5, 0, 0 } }, Found }, // ascent + RetainTileDataAction{ { 5, { 5, 0, 0 } }, Optional }, // + GetTileDataAction{ { 4, { 4, 0, 0 } }, NotFound }, // ... + GetTileDataAction{ { 3, { 3, 0, 0 } }, NotFound }, // ... + GetTileDataAction{ { 2, { 2, 0, 0 } }, NotFound }, // ... + GetTileDataAction{ { 1, { 1, 0, 0 } }, NotFound }, // ... + GetTileDataAction{ { 0, { 0, 0, 0 } }, NotFound }, // ... + }), + log); + + // Mark next level has having tried optional. + log.clear(); + source.dataTiles[{ 5, { 5, 0, 0 } }]->triedOptional = true; + algorithm::updateRenderables(getTileData, createTileData, retainTileData, renderTile, + source.idealTiles, source.zoomRange, 6); + EXPECT_EQ(ActionLog({ + GetTileDataAction{ { 6, { 6, 0, 0 } }, Found }, // ideal tile, not ready + RetainTileDataAction{ { 6, { 6, 0, 0 } }, Required }, // + GetTileDataAction{ { 7, { 7, 0, 0 } }, NotFound }, // children + GetTileDataAction{ { 7, { 7, 0, 1 } }, NotFound }, // ... + GetTileDataAction{ { 7, { 7, 1, 0 } }, NotFound }, // ... + GetTileDataAction{ { 7, { 7, 1, 1 } }, NotFound }, // ... + GetTileDataAction{ { 5, { 5, 0, 0 } }, Found }, // ascent + RetainTileDataAction{ { 5, { 5, 0, 0 } }, Optional }, // + GetTileDataAction{ { 4, { 4, 0, 0 } }, NotFound }, // ... + CreateTileDataAction{ { 4, { 4, 0, 0 } } }, // + RetainTileDataAction{ { 4, { 4, 0, 0 } }, Optional }, // + GetTileDataAction{ { 3, { 3, 0, 0 } }, NotFound }, // ... + GetTileDataAction{ { 2, { 2, 0, 0 } }, NotFound }, // ... + GetTileDataAction{ { 1, { 1, 0, 0 } }, NotFound }, // ... + GetTileDataAction{ { 0, { 0, 0, 0 } }, NotFound }, // ... + }), + log); + + // Mark next level has having tried optional. + log.clear(); + source.dataTiles[{ 4, { 4, 0, 0 } }]->triedOptional = true; + algorithm::updateRenderables(getTileData, createTileData, retainTileData, renderTile, + source.idealTiles, source.zoomRange, 6); + EXPECT_EQ(ActionLog({ + GetTileDataAction{ { 6, { 6, 0, 0 } }, Found }, // ideal tile, not ready + RetainTileDataAction{ { 6, { 6, 0, 0 } }, Required }, // + GetTileDataAction{ { 7, { 7, 0, 0 } }, NotFound }, // children + GetTileDataAction{ { 7, { 7, 0, 1 } }, NotFound }, // ... + GetTileDataAction{ { 7, { 7, 1, 0 } }, NotFound }, // ... + GetTileDataAction{ { 7, { 7, 1, 1 } }, NotFound }, // ... + GetTileDataAction{ { 5, { 5, 0, 0 } }, Found }, // ascent + RetainTileDataAction{ { 5, { 5, 0, 0 } }, Optional }, // + GetTileDataAction{ { 4, { 4, 0, 0 } }, Found }, // ... + RetainTileDataAction{ { 4, { 4, 0, 0 } }, Optional }, // + GetTileDataAction{ { 3, { 3, 0, 0 } }, NotFound }, // ... + CreateTileDataAction{ { 3, { 3, 0, 0 } } }, // + RetainTileDataAction{ { 3, { 3, 0, 0 } }, Optional }, // + GetTileDataAction{ { 2, { 2, 0, 0 } }, NotFound }, // ... + GetTileDataAction{ { 1, { 1, 0, 0 } }, NotFound }, // ... + GetTileDataAction{ { 0, { 0, 0, 0 } }, NotFound }, // ... + }), + log); + + // Mark next level has having tried optional. + log.clear(); + source.dataTiles[{ 3, { 3, 0, 0 } }]->triedOptional = true; + algorithm::updateRenderables(getTileData, createTileData, retainTileData, renderTile, + source.idealTiles, source.zoomRange, 6); + EXPECT_EQ(ActionLog({ + GetTileDataAction{ { 6, { 6, 0, 0 } }, Found }, // ideal tile, not ready + RetainTileDataAction{ { 6, { 6, 0, 0 } }, Required }, // + GetTileDataAction{ { 7, { 7, 0, 0 } }, NotFound }, // children + GetTileDataAction{ { 7, { 7, 0, 1 } }, NotFound }, // ... + GetTileDataAction{ { 7, { 7, 1, 0 } }, NotFound }, // ... + GetTileDataAction{ { 7, { 7, 1, 1 } }, NotFound }, // ... + GetTileDataAction{ { 5, { 5, 0, 0 } }, Found }, // ascent + RetainTileDataAction{ { 5, { 5, 0, 0 } }, Optional }, // + GetTileDataAction{ { 4, { 4, 0, 0 } }, Found }, // ... + RetainTileDataAction{ { 4, { 4, 0, 0 } }, Optional }, // + GetTileDataAction{ { 3, { 3, 0, 0 } }, Found }, // ... + RetainTileDataAction{ { 3, { 3, 0, 0 } }, Optional }, // + GetTileDataAction{ { 2, { 2, 0, 0 } }, NotFound }, // ... + CreateTileDataAction{ { 2, { 2, 0, 0 } } }, // + RetainTileDataAction{ { 2, { 2, 0, 0 } }, Optional }, // + GetTileDataAction{ { 1, { 1, 0, 0 } }, NotFound }, // ... + GetTileDataAction{ { 0, { 0, 0, 0 } }, NotFound }, // ... + }), + log); + + // Mark as found + log.clear(); + auto tile_3_3_0_0 = source.dataTiles[{ 3, { 3, 0, 0 } }].get(); + tile_3_3_0_0->renderable = true; + algorithm::updateRenderables(getTileData, createTileData, retainTileData, renderTile, + source.idealTiles, source.zoomRange, 6); + EXPECT_EQ(ActionLog({ + GetTileDataAction{ { 6, { 6, 0, 0 } }, Found }, // ideal tile, not ready + RetainTileDataAction{ { 6, { 6, 0, 0 } }, Required }, // + GetTileDataAction{ { 7, { 7, 0, 0 } }, NotFound }, // children + GetTileDataAction{ { 7, { 7, 0, 1 } }, NotFound }, // ... + GetTileDataAction{ { 7, { 7, 1, 0 } }, NotFound }, // ... + GetTileDataAction{ { 7, { 7, 1, 1 } }, NotFound }, // ... + GetTileDataAction{ { 5, { 5, 0, 0 } }, Found }, // ascent + RetainTileDataAction{ { 5, { 5, 0, 0 } }, Optional }, // + GetTileDataAction{ { 4, { 4, 0, 0 } }, Found }, // ... + RetainTileDataAction{ { 4, { 4, 0, 0 } }, Optional }, // + GetTileDataAction{ { 3, { 3, 0, 0 } }, Found }, // ... + RetainTileDataAction{ { 3, { 3, 0, 0 } }, Optional }, // + RenderTileAction{ { 3, 0, 0 }, *tile_3_3_0_0 }, // }), log); } diff --git a/test/api/annotations.cpp b/test/api/annotations.cpp index 552a386f96..a1e67b29c4 100644 --- a/test/api/annotations.cpp +++ b/test/api/annotations.cpp @@ -8,6 +8,7 @@ #include <mbgl/platform/default/headless_view.hpp> #include <mbgl/util/io.hpp> #include <mbgl/util/run_loop.hpp> +#include <mbgl/util/color.hpp> using namespace mbgl; @@ -41,6 +42,10 @@ TEST(Annotations, SymbolAnnotation) { test.map.addAnnotationIcon("default_marker", namedMarker("default_marker.png")); test.map.addAnnotation(SymbolAnnotation { Point<double>(0, 0), "default_marker" }); test.checkRendering("point_annotation"); + + // FIXME: https://github.com/mapbox/mapbox-gl-native/issues/5419 + //test.map.setZoom(test.map.getMaxZoom()); + //test.checkRendering("point_annotation"); } TEST(Annotations, LineAnnotation) { @@ -48,12 +53,15 @@ TEST(Annotations, LineAnnotation) { LineString<double> line = {{ { 0, 0 }, { 45, 45 }, { 30, 0 } }}; LineAnnotation annotation { line }; - annotation.color = {{ 255, 0, 0, 1 }}; - annotation.width = 5; + annotation.color = { { 255, 0, 0, 1 } }; + annotation.width = { 5 }; test.map.setStyleJSON(util::read_file("test/fixtures/api/empty.json")); test.map.addAnnotation(annotation); test.checkRendering("line_annotation"); + + test.map.setZoom(test.map.getMaxZoom()); + test.checkRendering("line_annotation_max_zoom"); } TEST(Annotations, FillAnnotation) { @@ -61,11 +69,14 @@ TEST(Annotations, FillAnnotation) { Polygon<double> polygon = {{ {{ { 0, 0 }, { 0, 45 }, { 45, 45 }, { 45, 0 } }} }}; FillAnnotation annotation { polygon }; - annotation.color = {{ 255, 0, 0, 1 }}; + annotation.color = { { 255, 0, 0, 1 } }; test.map.setStyleJSON(util::read_file("test/fixtures/api/empty.json")); test.map.addAnnotation(annotation); test.checkRendering("fill_annotation"); + + test.map.setZoom(test.map.getMaxZoom()); + test.checkRendering("fill_annotation_max_zoom"); } TEST(Annotations, OverlappingFillAnnotation) { @@ -114,29 +125,27 @@ TEST(Annotations, NonImmediateAdd) { Polygon<double> polygon = {{ {{ { 0, 0 }, { 0, 45 }, { 45, 45 }, { 45, 0 } }} }}; FillAnnotation annotation { polygon }; - annotation.color = {{ 255, 0, 0, 1 }}; + annotation.color = { { 255, 0, 0, 1 } }; test.map.addAnnotation(annotation); test.checkRendering("non_immediate_add"); } -TEST(Annotations, UpdateIcon) { +TEST(Annotations, UpdateSymbolAnnotationGeometry) { AnnotationTest test; test.map.setStyleJSON(util::read_file("test/fixtures/api/empty.json")); - test.map.addAnnotationIcon("flipped_marker", namedMarker("default_marker.png")); - test.map.addAnnotation(SymbolAnnotation { Point<double> { 0, 0 }, "flipped_marker" }); + test.map.addAnnotationIcon("default_marker", namedMarker("default_marker.png")); + test.map.addAnnotationIcon("flipped_marker", namedMarker("flipped_marker.png")); + AnnotationID point = test.map.addAnnotation(SymbolAnnotation { Point<double> { 0, 0 }, "default_marker" }); test::render(test.map); - test.map.removeAnnotationIcon("flipped_marker"); - test.map.addAnnotationIcon("flipped_marker", namedMarker("flipped_marker.png")); - test.map.update(Update::Annotations); - - test.checkRendering("update_icon"); + test.map.updateAnnotation(point, SymbolAnnotation { Point<double> { -10, 0 }, "default_marker" }); + test.checkRendering("update_point"); } -TEST(Annotations, UpdatePoint) { +TEST(Annotations, UpdateSymbolAnnotationIcon) { AnnotationTest test; test.map.setStyleJSON(util::read_file("test/fixtures/api/empty.json")); @@ -146,8 +155,8 @@ TEST(Annotations, UpdatePoint) { test::render(test.map); - test.map.updateAnnotation(point, SymbolAnnotation { Point<double> { -10, 0 }, "flipped_marker" }); - test.checkRendering("update_point"); + test.map.updateAnnotation(point, SymbolAnnotation { Point<double> { 0, 0 }, "flipped_marker" }); + test.checkRendering("update_icon"); } TEST(Annotations, RemovePoint) { @@ -168,8 +177,8 @@ TEST(Annotations, RemoveShape) { LineString<double> line = {{ { 0, 0 }, { 45, 45 } }}; LineAnnotation annotation { line }; - annotation.color = {{ 255, 0, 0, 1 }}; - annotation.width = 5; + annotation.color = { { 255, 0, 0, 1 } }; + annotation.width = { 5 }; test.map.setStyleJSON(util::read_file("test/fixtures/api/empty.json")); AnnotationID shape = test.map.addAnnotation(annotation); @@ -210,7 +219,7 @@ TEST(Annotations, QueryRenderedFeatures) { test.map.addAnnotation(SymbolAnnotation { Point<double> { 0, 0 }, "default_marker" }); test::render(test.map); - + auto features = test.map.queryRenderedFeatures(test.map.pixelForLatLng({ 0, 0 })); - EXPECT_EQ(features.size(), 1); + EXPECT_EQ(features.size(), 1u); } diff --git a/test/api/api_misuse.cpp b/test/api/api_misuse.cpp index 2400550a68..e9fe307718 100644 --- a/test/api/api_misuse.cpp +++ b/test/api/api_misuse.cpp @@ -13,7 +13,7 @@ using namespace mbgl; TEST(API, RenderWithoutCallback) { - FixtureLogObserver* log = new FixtureLogObserver(); + auto log = new FixtureLogObserver(); Log::setObserver(std::unique_ptr<Log::Observer>(log)); util::RunLoop loop; diff --git a/test/api/custom_layer.cpp b/test/api/custom_layer.cpp index e0be341c4b..90c94aaea4 100644 --- a/test/api/custom_layer.cpp +++ b/test/api/custom_layer.cpp @@ -56,7 +56,7 @@ public: MBGL_CHECK_ERROR(glUseProgram(program)); MBGL_CHECK_ERROR(glBindBuffer(GL_ARRAY_BUFFER, buffer)); MBGL_CHECK_ERROR(glEnableVertexAttribArray(a_pos)); - MBGL_CHECK_ERROR(glVertexAttribPointer(a_pos, 2, GL_FLOAT, GL_FALSE, 0, NULL)); + MBGL_CHECK_ERROR(glVertexAttribPointer(a_pos, 2, GL_FLOAT, GL_FALSE, 0, nullptr)); MBGL_CHECK_ERROR(glDisable(GL_STENCIL_TEST)); MBGL_CHECK_ERROR(glDisable(GL_DEPTH_TEST)); MBGL_CHECK_ERROR(glDrawArrays(GL_TRIANGLE_STRIP, 0, 4)); diff --git a/test/api/render_missing.cpp b/test/api/render_missing.cpp index e0fb8e4c55..135c1ecae5 100644 --- a/test/api/render_missing.cpp +++ b/test/api/render_missing.cpp @@ -56,7 +56,7 @@ TEST(API, TEST_REQUIRES_SERVER(RenderMissingTile)) { auto observer = Log::removeObserver(); auto flo = dynamic_cast<FixtureLogObserver*>(observer.get()); - EXPECT_EQ(1, flo->count(FixtureLog::Message( + EXPECT_EQ(1u, flo->count(FixtureLog::Message( EventSeverity::Error, Event::Style, -1, std::string("Failed to load tile 0/0/0=>0 for source mapbox: " + message)))); auto unchecked = flo->unchecked(); diff --git a/test/api/repeated_render.cpp b/test/api/repeated_render.cpp index 3a71ddb08d..cf71cb8416 100644 --- a/test/api/repeated_render.cpp +++ b/test/api/repeated_render.cpp @@ -42,8 +42,8 @@ TEST(API, RepeatedRender) { loop.runOnce(); } - ASSERT_EQ(256, result.width); - ASSERT_EQ(512, result.height); + ASSERT_EQ(256u, result.width); + ASSERT_EQ(512u, result.height); #if !TEST_READ_ONLY util::write_file("test/fixtures/api/1.png", encodePNG(result)); #endif @@ -60,8 +60,8 @@ TEST(API, RepeatedRender) { loop.runOnce(); } - ASSERT_EQ(256, result.width); - ASSERT_EQ(512, result.height); + ASSERT_EQ(256u, result.width); + ASSERT_EQ(512u, result.height); #if !TEST_READ_ONLY util::write_file("test/fixtures/api/2.png", encodePNG(result)); #endif diff --git a/test/api/set_style.cpp b/test/api/set_style.cpp index fb5027c076..2399e4ea50 100644 --- a/test/api/set_style.cpp +++ b/test/api/set_style.cpp @@ -26,7 +26,7 @@ TEST(API, SetStyle) { auto observer = Log::removeObserver(); auto flo = dynamic_cast<FixtureLogObserver*>(observer.get()); - EXPECT_EQ(1ul, flo->count({ EventSeverity::Error, Event::ParseStyle, -1, + EXPECT_EQ(1u, flo->count({ EventSeverity::Error, Event::ParseStyle, -1, "Error parsing style JSON at 0: Invalid value." })); auto unchecked = flo->unchecked(); EXPECT_TRUE(unchecked.empty()) << unchecked; diff --git a/test/fixtures/annotations/fill_annotation_max_zoom/expected.png b/test/fixtures/annotations/fill_annotation_max_zoom/expected.png Binary files differnew file mode 100644 index 0000000000..4e77e671cd --- /dev/null +++ b/test/fixtures/annotations/fill_annotation_max_zoom/expected.png diff --git a/test/fixtures/annotations/line_annotation_max_zoom/expected.png b/test/fixtures/annotations/line_annotation_max_zoom/expected.png Binary files differnew file mode 100644 index 0000000000..8512d8c06a --- /dev/null +++ b/test/fixtures/annotations/line_annotation_max_zoom/expected.png diff --git a/test/fixtures/annotations/update_icon/expected.png b/test/fixtures/annotations/update_icon/expected.png Binary files differindex 3b6ca22747..408d681ede 100644 --- a/test/fixtures/annotations/update_icon/expected.png +++ b/test/fixtures/annotations/update_icon/expected.png diff --git a/test/fixtures/annotations/update_point/expected.png b/test/fixtures/annotations/update_point/expected.png Binary files differindex 02cf77df8d..30aa39e380 100644 --- a/test/fixtures/annotations/update_point/expected.png +++ b/test/fixtures/annotations/update_point/expected.png diff --git a/test/fixtures/resources/glyphs.pbf b/test/fixtures/resources/glyphs.pbf Binary files differindex 0d160f7898..d2c2b633fa 100644 --- a/test/fixtures/resources/glyphs.pbf +++ b/test/fixtures/resources/glyphs.pbf diff --git a/test/fixtures/resources/raster.png b/test/fixtures/resources/raster.png Binary files differdeleted file mode 100644 index 78ad885baf..0000000000 --- a/test/fixtures/resources/raster.png +++ /dev/null diff --git a/test/fixtures/resources/raster.tile b/test/fixtures/resources/raster.tile Binary files differnew file mode 100644 index 0000000000..43cc9a0c77 --- /dev/null +++ b/test/fixtures/resources/raster.tile diff --git a/test/fixtures/resources/source_raster.json b/test/fixtures/resources/source_raster.json index b114988edb..2ef5ded027 100644 --- a/test/fixtures/resources/source_raster.json +++ b/test/fixtures/resources/source_raster.json @@ -1 +1 @@ -{"attribution":"<a href=\"https://www.mapbox.com/about/maps/\" target=\"_blank\">© Mapbox</a> <a href=\"http://www.openstreetmap.org/about/\" target=\"_blank\">© OpenStreetMap</a> <a class=\"mapbox-improve-map\" href=\"https://www.mapbox.com/map-feedback/\" target=\"_blank\">Improve this map</a> <a href=\"https://www.digitalglobe.com/\" target=\"_blank\">© DigitalGlobe</a>","autoscale":true,"bounds":[-180,-85,180,85],"center":[0,0,3],"description":"","id":"mapbox.satellite","maxzoom":19,"minzoom":0,"name":"Mapbox Satellite","private":true,"scheme":"xyz","tilejson":"2.0.0","tiles":["test/fixtures/resources/raster.png"]} +{"attribution":"<a href=\"https://www.mapbox.com/about/maps/\" target=\"_blank\">© Mapbox</a> <a href=\"http://www.openstreetmap.org/about/\" target=\"_blank\">© OpenStreetMap</a> <a class=\"mapbox-improve-map\" href=\"https://www.mapbox.com/map-feedback/\" target=\"_blank\">Improve this map</a> <a href=\"https://www.digitalglobe.com/\" target=\"_blank\">© DigitalGlobe</a>","autoscale":true,"bounds":[-180,-85,180,85],"cacheControl":"max-age=43200,s-maxage=604800","center":[0,0,3],"created":1358310600000,"description":"","id":"mapbox.satellite","maxzoom":22,"minzoom":0,"modified":1446150592060,"name":"Mapbox Satellite","private":false,"scheme":"xyz","tilejson":"2.0.0","tiles":["https://a.tiles.mapbox.com/v4/mapbox.satellite/{z}/{x}/{y}.png?access_token=pk.accesstoken","https://b.tiles.mapbox.com/v4/mapbox.satellite/{z}/{x}/{y}.png?access_token=pk.accesstoken"],"webpage":"https://a.tiles.mapbox.com/v4/mapbox.satellite/page.html?access_token=pk.accesstoken"}
\ No newline at end of file diff --git a/test/fixtures/resources/source_vector.json b/test/fixtures/resources/source_vector.json index db516f9f95..2cbbc5fd94 100644 --- a/test/fixtures/resources/source_vector.json +++ b/test/fixtures/resources/source_vector.json @@ -1 +1 @@ -{"attribution":"<a href=\"https://www.mapbox.com/about/maps/\" target=\"_blank\">© Mapbox</a> <a href=\"http://www.openstreetmap.org/about/\" target=\"_blank\">© OpenStreetMap</a> <a class=\"mapbox-improve-map\" href=\"https://www.mapbox.com/map-feedback/\" target=\"_blank\">Improve this map</a>","bounds":[-180,-85.0511,180,85.0511],"center":[0,0,0],"format":"pbf","maxzoom":15,"minzoom":0,"name":"Mapbox Streets V6 + Vector Terrain V2","scheme":"xyz","tilejson":"2.0.0","tiles":["test/fixtures/resources/vector.pbf"],"vector_layers":[{"description":"Generalized landcover classification","fields":{"class":"One of: wood, scrub, grass, crop, snow"},"id":"landcover","maxzoom":22,"minzoom":0},{"description":"","fields":{"class":"One of: shadow, highlight","level":"Brightness %. One of: 94, 90, 89, 78, 67, 56"},"id":"hillshade","maxzoom":22,"minzoom":0},{"description":"Elevation contour polygons","fields":{"ele":"Integer. The elevation of the contour in meters.","index":"Indicator for every 2nd, 5th, or 10th contour. Coastlines are given -1. One of: 2, 5, 10, -1, null"},"id":"contour","maxzoom":22,"minzoom":0},{"description":"","fields":{"class":"One of: cemetery, hospital, industrial, park, parking, pitch, sand, school, wood","osm_id":"Unique OSM ID number","type":"OSM tag, more specific than class"},"id":"landuse"},{"description":"","fields":{"class":"One of: river, canal, stream, stream_intermittent, ditch, drain","osm_id":"Unique OSM ID number","type":"One of: river, canal, stream, ditch, drain"},"id":"waterway"},{"description":"","fields":{"osm_id":"Unique OSM ID number"},"id":"water"},{"description":"","fields":{"osm_id":"Unique OSM ID number","type":"One of: runway, taxiway, apron"},"id":"aeroway"},{"description":"","fields":{"class":"One of: fence, hedge, cliff, gate","osm_id":"Unique OSM ID number"},"id":"barrier_line"},{"description":"","fields":{"osm_id":"Unique OSM ID number"},"id":"building"},{"description":"","fields":{"class":"One of: wetland, wetland_noveg","osm_id":"Unique OSM ID number"},"id":"landuse_overlay"},{"description":"","fields":{"class":"One of: motorway, motorway_link, main, street, street_limited, service, driveway, path, major_rail, minor_rail, aerialway","layer":"Number used for ordering overlapping tunnels","oneway":"Number. Oneway roads are 1, all others are 0.","osm_id":"Unique OSM ID number","type":"The value of the tunnel's highway tag"},"id":"tunnel"},{"description":"","fields":{"class":"One of: motorway, motorway_link, main, street, street_limited, service, driveway, path, major_rail, minor_rail, aerialway","oneway":"Number. Oneway roads are 1, all others are 0.","osm_id":"Unique OSM ID number","type":"The value of the road's highway tag"},"id":"road"},{"description":"","fields":{"class":"One of: motorway, motorway_link, main, street, street_limited, service, driveway, path, major_rail, minor_rail, aerialway","layer":"Number used for ordering overlapping bridges","oneway":"Number. Oneway bridges are 1, all others are 0.","osm_id":"Unique OSM ID number","type":"The value of the bridge's highway tag"},"id":"bridge"},{"description":"","fields":{"admin_level":"The OSM administrative level of the boundary","disputed":"Number. Disputed boundaries are 1, all others are 0.","maritime":"Number. Maritime boundaries are 1, all others are 0."},"id":"admin"},{"description":"","fields":{"code":"ISO 3166-1 Alpha-2 code","name":"Local name of the country","name_de":"German name of the country","name_en":"English name of the country","name_es":"Spanish name of the country","name_fr":"French name of the country","name_ru":"Russian name of the country","name_zh":"Chinese name of the country","osm_id":"Unique OSM ID number","parent":"ISO 3166-1 Alpha-2 code of the administering/parent state, if any","scalerank":"Number, 1-6. Useful for styling text sizes.","type":"One of: country, territory, disputed territory, sar"},"id":"country_label"},{"description":"","fields":{"labelrank":"Number, 1-6. Useful for styling text sizes.","name":"Local or international name of the water body","name_de":"German name of the water body","name_en":"English name of the water body","name_es":"Spanish name of the water body","name_fr":"French name of the water body","name_ru":"Russian name of the water body","name_zh":"Chinese name of the water body","placement":"One of: point, line"},"id":"marine_label"},{"description":"","fields":{"abbr":"Abbreviated state name","area":"The area of the state in kilometers²","name":"Local name of the state","name_de":"German name of the state","name_en":"English name of the state","name_es":"Spanish name of the state","name_fr":"French name of the state","name_ru":"Russian name of the state","name_zh":"Chinese name of the state","osm_id":"Unique OSM ID number"},"id":"state_label"},{"description":"","fields":{"capital":"Admin level the city is a capital of, if any. One of: 2, 3, 4, null","ldir":"A hint for label placement at low zoom levels. One of: N, E, S, W, NE, SE, SW, NW, null","localrank":"Number. Priority relative to nearby places. Useful for limiting label density.","name":"Local name of the place","name_de":"German name of the place","name_en":"English name of the place","name_es":"Spanish name of the place","name_fr":"French name of the place","name_ru":"Russian name of the place","name_zh":"Chinese name of the place","osm_id":"Unique OSM ID number","scalerank":"Number, 0-9 or null. Useful for styling text & marker sizes.","type":"One of: city, town, village, hamlet, suburb, neighbourhood"},"id":"place_label"},{"description":"","fields":{"area":"The area of the water polygon in Mercator meters²","name":"Local name of the water body","name_de":"German name of the water body","name_en":"English name of the water body","name_es":"Spanish name of the water body","name_fr":"French name of the water body","name_ru":"Russian name of the water body","name_zh":"Chinese name of the water body","osm_id":"Unique OSM ID number"},"id":"water_label"},{"description":"","fields":{"address":"Street address of the POI","localrank":"Number. Priority relative to nearby POIs. Useful for limiting label density.","maki":"The name of the Maki icon that should be used for the POI","name":"Local name of the POI","name_de":"German name of the POI","name_en":"English name of the POI","name_es":"Spanish name of the POI","name_fr":"French name of the POI","name_ru":"Russian name of the POI","name_zh":"Chinese name of the POI","network":"For rail stations, the network(s) that the station serves. Useful for icon styling.","osm_id":"Unique OSM ID number","ref":"Short reference code, if any","scalerank":"Number. 1-4. Useful for styling icon sizes and minimum zoom levels.","type":"The original OSM tag value","website":"URL of the POI"},"id":"poi_label"},{"description":"","fields":{"class":"One of: motorway, motorway_link, main, street, street_limited, service, driveway, path","len":"Number. Length of the road segment in Mercator meters.","localrank":"Number. Used for shield points only. Priority relative to nearby shields. Useful for limiting shield density.","name":"Local name of the road","name_de":"German name of the road","name_en":"English name of the road","name_es":"Spanish name of the road","name_fr":"French name of the road","name_ru":"Russian name of the road","name_zh":"Chinese name of the road","osm_id":"Unique OSM ID number","ref":"Route number of the road","reflen":"Number. How many characters long the ref tag is. Useful for shield styling.","shield":"The shield style to use. One of: default, mx-federal, mx-state, us-highway, us-highway-alternate, us-highway-business, us-highway-duplex, us-interstate, us-interstate-business, us-interstate-duplex, us-interstate-truck, us-state"},"id":"road_label"},{"description":"","fields":{"class":"One of: river, canal, stream, stream_intermittent","name":"Local name of the waterway","name_de":"German name of the waterway","name_en":"English name of the waterway","name_es":"Spanish name of the waterway","name_fr":"French name of the waterway","name_ru":"Russian name of the waterway","name_zh":"Chinese name of the waterway","osm_id":"Unique OSM ID number","type":"One of: river, canal, stream"},"id":"waterway_label"},{"description":"","fields":{"house_num":"House number","osm_id":"Unique OSM ID number"},"id":"housenum_label"}]} +{"attribution":"<a href=\"https://www.mapbox.com/about/maps/\" target=\"_blank\">© Mapbox</a> <a href=\"http://www.openstreetmap.org/about/\" target=\"_blank\">© OpenStreetMap</a> <a class=\"mapbox-improve-map\" href=\"https://www.mapbox.com/map-feedback/\" target=\"_blank\">Improve this map</a>","bounds":[-180,-85.0511,180,85.0511],"center":[0,0,0],"created":1451865600000,"description":"","filesize":0,"fillzoom":8,"format":"pbf","id":"mapbox.mapbox-streets-v7","maxzoom":16,"minzoom":0,"name":"Mapbox Streets v7","private":false,"scheme":"xyz","tilejson":"2.0.0","tiles":["https://a.tiles.mapbox.com/v4/mapbox.mapbox-streets-v7/{z}/{x}/{y}.vector.pbf?access_token=pk.accesstoken","https://b.tiles.mapbox.com/v4/mapbox.mapbox-streets-v7/{z}/{x}/{y}.vector.pbf?access_token=pk.accesstoken"],"vector_layers":[{"description":"","fields":{"class":"One of: agriculture, cemetery, glacier, grass, hospital, industrial, park, parking, piste, pitch, rock, sand, school, scrub, wood, aboriginal lands","type":"OSM tag, more specific than class"},"id":"landuse","source":"mapbox.mapbox-streets-v7","source_name":"Mapbox Streets V7"},{"description":"","fields":{"class":"One of: river, canal, stream, stream_intermittent, ditch, drain","type":"One of: river, canal, stream, ditch, drain"},"id":"waterway","source":"mapbox.mapbox-streets-v7","source_name":"Mapbox Streets V7"},{"description":"","fields":{},"id":"water","source":"mapbox.mapbox-streets-v7","source_name":"Mapbox Streets V7"},{"description":"","fields":{"type":"One of: runway, taxiway, apron"},"id":"aeroway","source":"mapbox.mapbox-streets-v7","source_name":"Mapbox Streets V7"},{"description":"","fields":{"class":"One of: fence, hedge, cliff, gate"},"id":"barrier_line","source":"mapbox.mapbox-streets-v7","source_name":"Mapbox Streets V7"},{"description":"","fields":{"underground":"Text. Whether building is underground. One of: 'true', 'false'"},"id":"building","source":"mapbox.mapbox-streets-v7","source_name":"Mapbox Streets V7"},{"description":"","fields":{"class":"One of: national_park, wetland, wetland_noveg","type":"OSM tag, more specific than class"},"id":"landuse_overlay","source":"mapbox.mapbox-streets-v7","source_name":"Mapbox Streets V7"},{"description":"","fields":{"class":"One of: 'motorway', 'motorway_link', 'trunk', 'primary', 'secondary', 'tertiary', 'link', 'street', 'street_limited', 'pedestrian', 'construction', 'track', 'service', 'ferry', 'path', 'golf'","layer":"Number. Specifies z-ordering in the case of overlapping road segments. Common range is -5 to 5. Available from zoom level 13+.","oneway":"Text. Whether traffic on the road is one-way. One of: 'true', 'false'","structure":"Text. One of: 'none', 'bridge', 'tunnel', 'ford'. Available from zoom level 13+.","type":"In most cases, values will be that of the primary key from OpenStreetMap tags."},"id":"road","source":"mapbox.mapbox-streets-v7","source_name":"Mapbox Streets V7"},{"description":"","fields":{"admin_level":"The OSM administrative level of the boundary","disputed":"Number. Disputed boundaries are 1, all others are 0.","iso_3166_1":"The ISO 3166-1 alpha-2 code(s) of the state(s) a boundary is part of. Format: 'AA' or 'AA-BB'","maritime":"Number. Maritime boundaries are 1, all others are 0."},"id":"admin","source":"mapbox.mapbox-streets-v7","source_name":"Mapbox Streets V7"},{"description":"","fields":{"code":"ISO 3166-1 Alpha-2 code","name":"Local name of the country","name_de":"German name of the country","name_en":"English name of the country","name_es":"Spanish name of the country","name_fr":"French name of the country","name_ru":"Russian name of the country","name_zh":"Chinese name of the country","parent":"ISO 3166-1 Alpha-2 code of the administering/parent state, if any","scalerank":"Number, 1-6. Useful for styling text sizes.","type":"One of: country, territory, disputed territory, sar"},"id":"country_label","source":"mapbox.mapbox-streets-v7","source_name":"Mapbox Streets V7"},{"description":"","fields":{"labelrank":"Number, 1-6. Useful for styling text sizes.","name":"Local or international name of the water body","name_de":"German name of the water body","name_en":"English name of the water body","name_es":"Spanish name of the water body","name_fr":"French name of the water body","name_ru":"Russian name of the water body","name_zh":"Chinese name of the water body","placement":"One of: point, line"},"id":"marine_label","source":"mapbox.mapbox-streets-v7","source_name":"Mapbox Streets V7"},{"description":"","fields":{"abbr":"Abbreviated state name","area":"The area of the state in kilometers²","name":"Local name of the state","name_de":"German name of the state","name_en":"English name of the state","name_es":"Spanish name of the state","name_fr":"French name of the state","name_ru":"Russian name of the state","name_zh":"Chinese name of the state"},"id":"state_label","source":"mapbox.mapbox-streets-v7","source_name":"Mapbox Streets V7"},{"description":"","fields":{"capital":"Admin level the city is a capital of, if any. One of: 2, 3, 4, 5, 6, null","ldir":"A hint for label placement at low zoom levels. One of: N, E, S, W, NE, SE, SW, NW, null","localrank":"Number. Priority relative to nearby places. Useful for limiting label density.","name":"Local name of the place","name_de":"German name of the place","name_en":"English name of the place","name_es":"Spanish name of the place","name_fr":"French name of the place","name_ru":"Russian name of the place","name_zh":"Chinese name of the place","scalerank":"Number, 0-9 or null. Useful for styling text & marker sizes.","type":"One of: city, town, village, hamlet, suburb, neighbourhood, island, islet, archipelago, residential, aboriginal_lands"},"id":"place_label","source":"mapbox.mapbox-streets-v7","source_name":"Mapbox Streets V7"},{"description":"","fields":{"area":"The area of the water polygon in Mercator meters²","name":"Local name of the water body","name_de":"German name of the water body","name_en":"English name of the water body","name_es":"Spanish name of the water body","name_fr":"French name of the water body","name_ru":"Russian name of the water body","name_zh":"Chinese name of the water body"},"id":"water_label","source":"mapbox.mapbox-streets-v7","source_name":"Mapbox Streets V7"},{"description":"","fields":{"maki":"One of: airport, airfield, heliport, rocket","name":"Local name of the airport","name_de":"German name of the airport","name_en":"English name of the airport","name_es":"Spanish name of the airport","name_fr":"French name of the airport","name_ru":"Russian name of the airport","name_zh":"Chinese name of the airport","ref":"A 3-4 character IATA, FAA, ICAO, or other reference code","scalerank":"Number 1-4. Useful for styling icon sizes."},"id":"airport_label","source":"mapbox.mapbox-streets-v7","source_name":"Mapbox Streets V7"},{"description":"","fields":{"maki":"One of: rail, rail-metro, rail-light, entrance","name":"Local name of the station","name_de":"German name of the station","name_en":"English name of the station","name_es":"Spanish name of the station","name_fr":"French name of the station","name_ru":"Russian name of the station","name_zh":"Chinese name of the station","network":"The network(s) that the station serves. Useful for icon styling."},"id":"rail_station_label","source":"mapbox.mapbox-streets-v7","source_name":"Mapbox Streets V7"},{"description":"","fields":{"elevation_ft":"Integer elevation in feet","elevation_m":"Integer elevation in meters","maki":"One of: 'mountain', 'volcano'","name":"Local name of the peak","name_de":"German name of the peak","name_en":"English name of the peak","name_es":"Spanish name of the peak","name_fr":"French name of the peak","name_ru":"Russian name of the peak","name_zh":"Chinese name of the peak"},"id":"mountain_peak_label","source":"mapbox.mapbox-streets-v7","source_name":"Mapbox Streets V7"},{"description":"","fields":{"localrank":"Number. Priority relative to nearby POIs. Useful for limiting label density.","maki":"The name of the Maki icon that should be used for the POI","name":"Local name of the POI","name_de":"German name of the POI","name_en":"English name of the POI","name_es":"Spanish name of the POI","name_fr":"French name of the POI","name_ru":"Russian name of the POI","name_zh":"Chinese name of the POI","ref":"Short reference code, if any","scalerank":"Number. 1-5. Useful for styling icon sizes and minimum zoom levels.","type":"The original OSM tag value"},"id":"poi_label","source":"mapbox.mapbox-streets-v7","source_name":"Mapbox Streets V7"},{"description":"","fields":{"class":"The class of road the junction is on. Matches the classes in the road layer.","name":"A longer name","ref":"A short identifier","reflen":"The number of characters in the ref field.","type":"The type of road the junction is on. Matches the types in the road layer."},"id":"motorway_junction","source":"mapbox.mapbox-streets-v7","source_name":"Mapbox Streets V7"},{"description":"","fields":{"class":"One of: motorway, motorway_link, 'trunk', 'primary', 'secondary', 'tertiary', 'link', 'street', 'street_limited', 'pedestrian', 'construction', 'track', 'service', 'ferry', 'path', 'golf'","iso_3166_2":"Text. The ISO 3166-2 code of the state/province/region the road is in.","len":"Number. Approximate length of the road segment in Mercator meters.","localrank":"Number. Used for shield points only. Priority relative to nearby shields. Useful for limiting shield density.","name":"Local name of the road","name_de":"German name of the road","name_en":"English name of the road","name_es":"Spanish name of the road","name_fr":"French name of the road","name_ru":"Russian name of the road","name_zh":"Chinese name of the road","ref":"Route number of the road","reflen":"Number. How many characters long the ref tag is. Useful for shield styling.","shield":"The shield style to use. One of: default, mx-federal, mx-state, us-highway, us-highway-alternate, us-highway-business, us-highway-duplex, us-interstate, us-interstate-business, us-interstate-duplex, us-interstate-truck, us-state"},"id":"road_label","source":"mapbox.mapbox-streets-v7","source_name":"Mapbox Streets V7"},{"description":"","fields":{"class":"One of: river, canal, stream, stream_intermittent","name":"Local name of the waterway","name_de":"German name of the waterway","name_en":"English name of the waterway","name_es":"Spanish name of the waterway","name_fr":"French name of the waterway","name_ru":"Russian name of the waterway","name_zh":"Chinese name of the waterway","type":"One of: river, canal, stream"},"id":"waterway_label","source":"mapbox.mapbox-streets-v7","source_name":"Mapbox Streets V7"},{"description":"","fields":{"house_num":"House number"},"id":"housenum_label","source":"mapbox.mapbox-streets-v7","source_name":"Mapbox Streets V7"}],"webpage":"https://a.tiles.mapbox.com/v4/mapbox.mapbox-streets-v7/page.html?access_token=pk.accesstoken"}
\ No newline at end of file diff --git a/test/fixtures/resources/sprite.json b/test/fixtures/resources/sprite.json index dcc2b4808c..2df69488e1 100644 --- a/test/fixtures/resources/sprite.json +++ b/test/fixtures/resources/sprite.json @@ -1 +1 @@ -{"background":{"x":0,"y":20,"width":50,"height":50,"pixelRatio":1,"sdf":false},"grass_pattern":{"x":100,"y":80,"width":50,"height":50,"pixelRatio":1,"sdf":false},"interstate_1":{"x":0,"y":100,"width":41,"height":40,"pixelRatio":1,"sdf":false},"interstate_2":{"x":0,"y":100,"width":41,"height":40,"pixelRatio":1,"sdf":false},"interstate_3":{"x":41,"y":100,"width":48,"height":39,"pixelRatio":1,"sdf":false},"us_state_1":{"x":0,"y":73,"width":29,"height":24,"pixelRatio":1,"sdf":false},"us_state_2":{"x":0,"y":73,"width":29,"height":24,"pixelRatio":1,"sdf":false},"us_state_3":{"x":30,"y":73,"width":32,"height":24,"pixelRatio":1,"sdf":false},"us_highway_1":{"x":0,"y":142,"width":29,"height":29,"pixelRatio":1,"sdf":false},"us_highway_2":{"x":30,"y":142,"width":33,"height":29,"pixelRatio":1,"sdf":false},"us_highway_3":{"x":64,"y":142,"width":36,"height":29,"pixelRatio":1,"sdf":false},"default_1":{"x":0,"y":0,"width":17,"height":16,"pixelRatio":1,"sdf":false},"default_2":{"x":17,"y":0,"width":22,"height":16,"pixelRatio":1,"sdf":false},"default_3":{"x":39,"y":0,"width":27,"height":16,"pixelRatio":1,"sdf":false},"default_4":{"x":66,"y":0,"width":32,"height":16,"pixelRatio":1,"sdf":false},"default_5":{"x":98,"y":0,"width":37,"height":16,"pixelRatio":1,"sdf":false},"default_6":{"x":135,"y":0,"width":42,"height":16,"pixelRatio":1,"sdf":false},"london-overground":{"x":70,"y":25,"width":18,"height":18,"pixelRatio":1,"sdf":false},"london-underground":{"x":88,"y":25,"width":18,"height":18,"pixelRatio":1,"sdf":false},"national-rail":{"x":106,"y":25,"width":18,"height":18,"pixelRatio":1,"sdf":false},"dlr":{"x":106,"y":25,"width":18,"height":18,"pixelRatio":1,"sdf":false},"dlr.london-overground.london-underground.national-rail":{"x":70,"y":25,"width":72,"height":18,"pixelRatio":1,"sdf":false},"dlr.london-underground":{"x":88,"y":25,"width":36,"height":18,"pixelRatio":1,"sdf":false},"dlr.london-underground.national-rail":{"x":88,"y":25,"width":54,"height":18,"pixelRatio":1,"sdf":false},"dlr.national-rail":{"x":106,"y":25,"width":36,"height":18,"pixelRatio":1,"sdf":false},"london-overground.london-underground":{"x":70,"y":25,"width":36,"height":18,"pixelRatio":1,"sdf":false},"london-overground.london-underground.national-rail":{"x":124,"y":25,"width":54,"height":18,"pixelRatio":1,"sdf":false},"london-overground.national-rail":{"x":124,"y":25,"width":36,"height":18,"pixelRatio":1,"sdf":false},"london-underground.national-rail":{"x":124,"y":43,"width":36,"height":18,"pixelRatio":1,"sdf":false},"metro":{"x":71,"y":43,"width":18,"height":18,"pixelRatio":1,"sdf":false},"rer":{"x":87,"y":43,"width":18,"height":18,"pixelRatio":1,"sdf":false},"metro.rer":{"x":71,"y":43,"width":34,"height":18,"pixelRatio":1,"sdf":false},"rer.transilien":{"x":87,"y":43,"width":36,"height":18,"pixelRatio":1,"sdf":false},"u-bahn":{"x":70,"y":62,"width":18,"height":18,"pixelRatio":1,"sdf":false},"s-bahn":{"x":88,"y":62,"width":18,"height":18,"pixelRatio":1,"sdf":false},"s-bahn.u-bahn":{"x":70,"y":62,"width":36,"height":18,"pixelRatio":1,"sdf":false},"washington-metro":{"x":106,"y":62,"width":18,"height":18,"pixelRatio":1,"sdf":false},"wiener-linien":{"x":124,"y":62,"width":18,"height":18,"pixelRatio":1,"sdf":false},"moscow-metro":{"x":142,"y":61,"width":21,"height":18,"pixelRatio":1,"sdf":false},"generic-metro":{"x":160,"y":43,"width":18,"height":18,"pixelRatio":1,"sdf":false},"generic-rail":{"x":178,"y":43,"width":18,"height":18,"pixelRatio":1,"sdf":false},"dot":{"x":166,"y":63,"width":13,"height":13,"pixelRatio":1,"sdf":false},"default_marker":{"x":0,"y":175,"width":33,"height":86,"pixelRatio":1,"sdf":false},"secondary_marker":{"x":33,"y":175,"width":33,"height":86,"pixelRatio":1,"sdf":false},"oneway_motorway":{"x":178,"y":24,"width":21,"height":19,"pixelRatio":1,"sdf":false},"oneway_road":{"x":178,"y":62,"width":21,"height":19,"pixelRatio":1,"sdf":false},"hospital_icon":{"x":157,"y":259,"width":18,"height":18,"pixelRatio":1,"sdf":false},"fire-station_icon":{"x":157,"y":241,"width":18,"height":18,"pixelRatio":1,"sdf":false},"cemetery_icon":{"x":157,"y":79,"width":18,"height":18,"pixelRatio":1,"sdf":false},"zoo_icon":{"x":177,"y":79,"width":18,"height":18,"pixelRatio":1,"sdf":false},"park_icon":{"x":177,"y":97,"width":18,"height":18,"pixelRatio":1,"sdf":false},"golf_icon":{"x":177,"y":115,"width":18,"height":18,"pixelRatio":1,"sdf":false},"school_icon":{"x":177,"y":133,"width":18,"height":18,"pixelRatio":1,"sdf":false},"monument_icon":{"x":177,"y":151,"width":18,"height":18,"pixelRatio":1,"sdf":false},"library_icon":{"x":177,"y":169,"width":18,"height":18,"pixelRatio":1,"sdf":false},"museum_icon":{"x":177,"y":187,"width":18,"height":18,"pixelRatio":1,"sdf":false},"college_icon":{"x":177,"y":205,"width":18,"height":18,"pixelRatio":1,"sdf":false},"religious-christian_icon":{"x":157,"y":115,"width":18,"height":18,"pixelRatio":1,"sdf":false},"religious-jewish_icon":{"x":157,"y":133,"width":18,"height":18,"pixelRatio":1,"sdf":false},"religious-muslim_icon":{"x":157,"y":151,"width":18,"height":18,"pixelRatio":1,"sdf":false},"government_icon":{"x":157,"y":169,"width":18,"height":18,"pixelRatio":1,"sdf":false},"post_icon":{"x":157,"y":205,"width":18,"height":18,"pixelRatio":1,"sdf":false},"embassy_icon":{"x":157,"y":223,"width":18,"height":18,"pixelRatio":1,"sdf":false},"police_icon":{"x":157,"y":169,"width":18,"height":18,"pixelRatio":1,"sdf":false},"marker_icon":{"x":157,"y":169,"width":18,"height":18,"pixelRatio":1,"sdf":false},"prison_icon":{"x":157,"y":169,"width":18,"height":18,"pixelRatio":1,"sdf":false},"airfield_icon":{"x":157,"y":187,"width":18,"height":18,"pixelRatio":1,"sdf":false},"airport_icon":{"x":157,"y":187,"width":18,"height":18,"pixelRatio":1,"sdf":false},"harbor_icon":{"x":139,"y":169,"width":18,"height":18,"pixelRatio":1,"sdf":false},"generic_icon":{"x":139,"y":187,"width":18,"height":18,"pixelRatio":1,"sdf":false},"hospital_striped":{"x":117,"y":135,"width":3,"height":3,"pixelRatio":1,"sdf":false},"school_striped":{"x":114,"y":135,"width":3,"height":3,"pixelRatio":1,"sdf":false},"sand_noise":{"x":75,"y":174,"width":50,"height":50,"pixelRatio":1,"sdf":false}}
\ No newline at end of file +{"pedestrian-polygon":{"width":64,"height":64,"x":0,"y":0,"pixelRatio":1},"turning-circle-outline":{"width":46,"height":46,"x":64,"y":0,"pixelRatio":1},"turning-circle":{"width":42,"height":42,"x":0,"y":64,"pixelRatio":1},"us-interstate-truck-2":{"width":20,"height":40,"x":42,"y":64,"pixelRatio":1},"us-interstate-truck-3":{"width":26,"height":40,"x":62,"y":64,"pixelRatio":1},"us-highway-alternate-2":{"width":20,"height":38,"x":88,"y":64,"pixelRatio":1},"us-highway-alternate-3":{"width":26,"height":38,"x":108,"y":64,"pixelRatio":1},"us-highway-business-2":{"width":20,"height":38,"x":134,"y":64,"pixelRatio":1},"us-highway-business-3":{"width":26,"height":38,"x":154,"y":64,"pixelRatio":1},"us-highway-bypass-2":{"width":20,"height":38,"x":180,"y":64,"pixelRatio":1},"us-highway-bypass-3":{"width":26,"height":38,"x":200,"y":64,"pixelRatio":1},"us-highway-truck-2":{"width":20,"height":38,"x":226,"y":64,"pixelRatio":1},"us-highway-truck-3":{"width":26,"height":38,"x":110,"y":0,"pixelRatio":1},"pe-national-2":{"width":18,"height":26,"x":136,"y":0,"pixelRatio":1},"pe-national-3":{"width":22,"height":26,"x":154,"y":0,"pixelRatio":1},"za-provincial-2":{"width":24,"height":24,"x":176,"y":0,"pixelRatio":1},"br-federal-3":{"width":26,"height":22,"x":200,"y":0,"pixelRatio":1},"in-national-2":{"width":16,"height":22,"x":226,"y":0,"pixelRatio":1},"in-national-3":{"width":20,"height":22,"x":0,"y":106,"pixelRatio":1},"in-national-4":{"width":24,"height":22,"x":20,"y":106,"pixelRatio":1},"in-state-2":{"width":16,"height":22,"x":44,"y":106,"pixelRatio":1},"in-state-3":{"width":20,"height":22,"x":60,"y":106,"pixelRatio":1},"mx-federal-2":{"width":18,"height":22,"x":80,"y":106,"pixelRatio":1},"mx-federal-3":{"width":23,"height":22,"x":98,"y":106,"pixelRatio":1},"mx-federal-4":{"width":28,"height":22,"x":121,"y":106,"pixelRatio":1},"mx-state-2":{"width":18,"height":22,"x":149,"y":106,"pixelRatio":1},"mx-state-3":{"width":23,"height":22,"x":167,"y":106,"pixelRatio":1},"mx-state-4":{"width":28,"height":22,"x":190,"y":106,"pixelRatio":1},"pe-regional-3":{"width":23,"height":22,"x":218,"y":106,"pixelRatio":1},"ro-communal-4":{"width":28,"height":22,"x":0,"y":128,"pixelRatio":1},"ro-communal-5":{"width":23,"height":22,"x":28,"y":128,"pixelRatio":1},"ro-communal-6":{"width":34,"height":22,"x":51,"y":128,"pixelRatio":1},"us-interstate-2":{"width":20,"height":22,"x":85,"y":128,"pixelRatio":1},"us-interstate-3":{"width":26,"height":22,"x":105,"y":128,"pixelRatio":1},"us-interstate-duplex-4":{"width":32,"height":22,"x":131,"y":128,"pixelRatio":1},"us-interstate-duplex-5":{"width":38,"height":22,"x":163,"y":128,"pixelRatio":1},"airfield-15":{"width":21,"height":21,"x":201,"y":128,"pixelRatio":1},"airport-15":{"width":21,"height":21,"x":222,"y":128,"pixelRatio":1},"alcohol-shop-15":{"width":21,"height":21,"x":0,"y":150,"pixelRatio":1},"amusement-park-15":{"width":21,"height":21,"x":21,"y":150,"pixelRatio":1},"aquarium-15":{"width":21,"height":21,"x":42,"y":150,"pixelRatio":1},"art-gallery-15":{"width":21,"height":21,"x":63,"y":150,"pixelRatio":1},"attraction-15":{"width":21,"height":21,"x":84,"y":150,"pixelRatio":1},"bakery-15":{"width":21,"height":21,"x":105,"y":150,"pixelRatio":1},"bank-15":{"width":21,"height":21,"x":126,"y":150,"pixelRatio":1},"bar-15":{"width":21,"height":21,"x":147,"y":150,"pixelRatio":1},"beer-15":{"width":21,"height":21,"x":168,"y":150,"pixelRatio":1},"bicycle-15":{"width":21,"height":21,"x":189,"y":150,"pixelRatio":1},"bicycle-share-15":{"width":21,"height":21,"x":210,"y":150,"pixelRatio":1},"bus-15":{"width":21,"height":21,"x":231,"y":150,"pixelRatio":1},"cafe-15":{"width":21,"height":21,"x":0,"y":171,"pixelRatio":1},"campsite-15":{"width":21,"height":21,"x":21,"y":171,"pixelRatio":1},"car-15":{"width":21,"height":21,"x":42,"y":171,"pixelRatio":1},"castle-15":{"width":21,"height":21,"x":63,"y":171,"pixelRatio":1},"cemetery-15":{"width":21,"height":21,"x":84,"y":171,"pixelRatio":1},"cinema-15":{"width":21,"height":21,"x":105,"y":171,"pixelRatio":1},"circle-15":{"width":21,"height":21,"x":126,"y":171,"pixelRatio":1},"circle-stroked-15":{"width":21,"height":21,"x":147,"y":171,"pixelRatio":1},"clothing-store-15":{"width":21,"height":21,"x":168,"y":171,"pixelRatio":1},"college-15":{"width":21,"height":21,"x":189,"y":171,"pixelRatio":1},"dentist-15":{"width":21,"height":21,"x":210,"y":171,"pixelRatio":1},"doctor-15":{"width":21,"height":21,"x":231,"y":171,"pixelRatio":1},"dog-park-15":{"width":21,"height":21,"x":0,"y":192,"pixelRatio":1},"drinking-water-15":{"width":21,"height":21,"x":21,"y":192,"pixelRatio":1},"embassy-15":{"width":21,"height":21,"x":42,"y":192,"pixelRatio":1},"entrance-15":{"width":21,"height":21,"x":63,"y":192,"pixelRatio":1},"fast-food-15":{"width":21,"height":21,"x":84,"y":192,"pixelRatio":1},"ferry-15":{"width":21,"height":21,"x":105,"y":192,"pixelRatio":1},"fire-station-15":{"width":21,"height":21,"x":126,"y":192,"pixelRatio":1},"fuel-15":{"width":21,"height":21,"x":147,"y":192,"pixelRatio":1},"garden-15":{"width":21,"height":21,"x":168,"y":192,"pixelRatio":1},"golf-15":{"width":21,"height":21,"x":189,"y":192,"pixelRatio":1},"grocery-15":{"width":21,"height":21,"x":210,"y":192,"pixelRatio":1},"harbor-15":{"width":21,"height":21,"x":231,"y":192,"pixelRatio":1},"heliport-15":{"width":21,"height":21,"x":0,"y":213,"pixelRatio":1},"hospital-15":{"width":21,"height":21,"x":21,"y":213,"pixelRatio":1},"ice-cream-15":{"width":21,"height":21,"x":42,"y":213,"pixelRatio":1},"information-15":{"width":21,"height":21,"x":63,"y":213,"pixelRatio":1},"laundry-15":{"width":21,"height":21,"x":84,"y":213,"pixelRatio":1},"library-15":{"width":21,"height":21,"x":105,"y":213,"pixelRatio":1},"lodging-15":{"width":21,"height":21,"x":126,"y":213,"pixelRatio":1},"monument-15":{"width":21,"height":21,"x":147,"y":213,"pixelRatio":1},"mountain-15":{"width":21,"height":21,"x":168,"y":213,"pixelRatio":1},"museum-15":{"width":21,"height":21,"x":189,"y":213,"pixelRatio":1},"music-15":{"width":21,"height":21,"x":210,"y":213,"pixelRatio":1},"park-15":{"width":21,"height":21,"x":231,"y":213,"pixelRatio":1},"pharmacy-15":{"width":21,"height":21,"x":0,"y":234,"pixelRatio":1},"picnic-site-15":{"width":21,"height":21,"x":21,"y":234,"pixelRatio":1},"place-of-worship-15":{"width":21,"height":21,"x":42,"y":234,"pixelRatio":1},"playground-15":{"width":21,"height":21,"x":63,"y":234,"pixelRatio":1},"police-15":{"width":21,"height":21,"x":84,"y":234,"pixelRatio":1},"post-15":{"width":21,"height":21,"x":105,"y":234,"pixelRatio":1},"prison-15":{"width":21,"height":21,"x":126,"y":234,"pixelRatio":1},"rail-15":{"width":21,"height":21,"x":147,"y":234,"pixelRatio":1},"rail-light-15":{"width":21,"height":21,"x":168,"y":234,"pixelRatio":1},"rail-metro-15":{"width":21,"height":21,"x":189,"y":234,"pixelRatio":1},"religious-christian-15":{"width":21,"height":21,"x":210,"y":234,"pixelRatio":1},"religious-jewish-15":{"width":21,"height":21,"x":231,"y":234,"pixelRatio":1},"religious-muslim-15":{"width":21,"height":21,"x":252,"y":150,"pixelRatio":1},"restaurant-15":{"width":21,"height":21,"x":273,"y":150,"pixelRatio":1},"rocket-15":{"width":21,"height":21,"x":294,"y":150,"pixelRatio":1},"school-15":{"width":21,"height":21,"x":315,"y":150,"pixelRatio":1},"shop-15":{"width":21,"height":21,"x":336,"y":150,"pixelRatio":1},"stadium-15":{"width":21,"height":21,"x":357,"y":150,"pixelRatio":1},"star-15":{"width":21,"height":21,"x":378,"y":150,"pixelRatio":1},"suitcase-15":{"width":21,"height":21,"x":399,"y":150,"pixelRatio":1},"swimming-15":{"width":21,"height":21,"x":420,"y":150,"pixelRatio":1},"theatre-15":{"width":21,"height":21,"x":441,"y":150,"pixelRatio":1},"toilet-15":{"width":21,"height":21,"x":462,"y":150,"pixelRatio":1},"town-hall-15":{"width":21,"height":21,"x":483,"y":150,"pixelRatio":1},"triangle-15":{"width":21,"height":21,"x":252,"y":171,"pixelRatio":1},"triangle-stroked-15":{"width":21,"height":21,"x":273,"y":171,"pixelRatio":1},"veterinary-15":{"width":21,"height":21,"x":294,"y":171,"pixelRatio":1},"volcano-15":{"width":21,"height":21,"x":315,"y":171,"pixelRatio":1},"zoo-15":{"width":21,"height":21,"x":336,"y":171,"pixelRatio":1},"br-state-2":{"width":20,"height":20,"x":357,"y":171,"pixelRatio":1},"br-state-3":{"width":28,"height":20,"x":377,"y":171,"pixelRatio":1},"hu-main-2":{"width":20,"height":20,"x":405,"y":171,"pixelRatio":1},"hu-main-3":{"width":26,"height":20,"x":425,"y":171,"pixelRatio":1},"hu-main-4":{"width":32,"height":20,"x":451,"y":171,"pixelRatio":1},"hu-main-5":{"width":38,"height":20,"x":252,"y":192,"pixelRatio":1},"hu-motorway-2":{"width":20,"height":20,"x":483,"y":171,"pixelRatio":1},"hu-motorway-3":{"width":26,"height":20,"x":290,"y":192,"pixelRatio":1},"nz-state-2":{"width":18,"height":20,"x":316,"y":192,"pixelRatio":1},"nz-state-3":{"width":23,"height":20,"x":334,"y":192,"pixelRatio":1},"ro-communal-2":{"width":20,"height":20,"x":357,"y":192,"pixelRatio":1},"ro-communal-3":{"width":26,"height":20,"x":377,"y":192,"pixelRatio":1},"ro-county-3":{"width":26,"height":20,"x":403,"y":192,"pixelRatio":1},"ro-county-4":{"width":32,"height":20,"x":429,"y":192,"pixelRatio":1},"ro-national-2":{"width":20,"height":20,"x":461,"y":192,"pixelRatio":1},"ro-national-3":{"width":26,"height":20,"x":481,"y":192,"pixelRatio":1},"us-highway-2":{"width":20,"height":20,"x":252,"y":213,"pixelRatio":1},"us-highway-3":{"width":26,"height":20,"x":272,"y":213,"pixelRatio":1},"us-highway-4":{"width":32,"height":20,"x":298,"y":213,"pixelRatio":1},"us-highway-duplex-3":{"width":26,"height":20,"x":330,"y":213,"pixelRatio":1},"us-highway-duplex-4":{"width":32,"height":20,"x":356,"y":213,"pixelRatio":1},"us-highway-duplex-5":{"width":38,"height":20,"x":388,"y":213,"pixelRatio":1},"us-interstate-business-2":{"width":20,"height":20,"x":426,"y":213,"pixelRatio":1},"us-interstate-business-3":{"width":26,"height":20,"x":446,"y":213,"pixelRatio":1},"us-state-2":{"width":20,"height":20,"x":472,"y":213,"pixelRatio":1},"us-state-3":{"width":26,"height":20,"x":252,"y":234,"pixelRatio":1},"us-state-4":{"width":32,"height":20,"x":278,"y":234,"pixelRatio":1},"za-national-2":{"width":20,"height":20,"x":492,"y":213,"pixelRatio":1},"barcelona-metro":{"width":19,"height":19,"x":310,"y":234,"pixelRatio":1},"boston-t":{"width":19,"height":19,"x":329,"y":234,"pixelRatio":1},"de-s-bahn":{"width":19,"height":19,"x":348,"y":234,"pixelRatio":1},"de-s-bahn.de-u-bahn":{"width":35,"height":19,"x":367,"y":234,"pixelRatio":1},"delhi-metro":{"width":19,"height":19,"x":402,"y":234,"pixelRatio":1},"kiev-metro":{"width":19,"height":19,"x":421,"y":234,"pixelRatio":1},"madrid-metro":{"width":19,"height":19,"x":440,"y":234,"pixelRatio":1},"new-york-subway":{"width":19,"height":19,"x":459,"y":234,"pixelRatio":1},"oslo-metro":{"width":19,"height":19,"x":478,"y":234,"pixelRatio":1},"paris-metro":{"width":19,"height":19,"x":241,"y":106,"pixelRatio":1},"paris-metro.paris-rer":{"width":37,"height":19,"x":260,"y":106,"pixelRatio":1},"paris-rer":{"width":19,"height":19,"x":297,"y":106,"pixelRatio":1},"paris-rer.paris-transilien":{"width":35,"height":19,"x":316,"y":106,"pixelRatio":1},"stockholm-metro":{"width":19,"height":19,"x":351,"y":106,"pixelRatio":1},"taipei-metro":{"width":19,"height":19,"x":370,"y":106,"pixelRatio":1},"vienna-u-bahn":{"width":19,"height":19,"x":389,"y":106,"pixelRatio":1},"airfield-11":{"width":17,"height":17,"x":408,"y":106,"pixelRatio":1},"airport-11":{"width":17,"height":17,"x":425,"y":106,"pixelRatio":1},"alcohol-shop-11":{"width":17,"height":17,"x":442,"y":106,"pixelRatio":1},"amusement-park-11":{"width":17,"height":17,"x":459,"y":106,"pixelRatio":1},"aquarium-11":{"width":17,"height":17,"x":476,"y":106,"pixelRatio":1},"art-gallery-11":{"width":17,"height":17,"x":493,"y":106,"pixelRatio":1},"attraction-11":{"width":17,"height":17,"x":243,"y":128,"pixelRatio":1},"bakery-11":{"width":17,"height":17,"x":260,"y":128,"pixelRatio":1},"bank-11":{"width":17,"height":17,"x":277,"y":128,"pixelRatio":1},"bar-11":{"width":17,"height":17,"x":294,"y":128,"pixelRatio":1},"beer-11":{"width":17,"height":17,"x":311,"y":128,"pixelRatio":1},"bicycle-11":{"width":17,"height":17,"x":328,"y":128,"pixelRatio":1},"bicycle-share-11":{"width":17,"height":17,"x":345,"y":128,"pixelRatio":1},"bus-11":{"width":17,"height":17,"x":362,"y":128,"pixelRatio":1},"cafe-11":{"width":17,"height":17,"x":379,"y":128,"pixelRatio":1},"campsite-11":{"width":17,"height":17,"x":396,"y":128,"pixelRatio":1},"car-11":{"width":17,"height":17,"x":413,"y":128,"pixelRatio":1},"castle-11":{"width":17,"height":17,"x":430,"y":128,"pixelRatio":1},"cemetery-11":{"width":17,"height":17,"x":447,"y":128,"pixelRatio":1},"chongqing-rail-transit":{"width":25,"height":17,"x":464,"y":128,"pixelRatio":1},"cinema-11":{"width":17,"height":17,"x":489,"y":128,"pixelRatio":1},"circle-11":{"width":17,"height":17,"x":246,"y":64,"pixelRatio":1},"circle-stroked-11":{"width":17,"height":17,"x":263,"y":64,"pixelRatio":1},"clothing-store-11":{"width":17,"height":17,"x":280,"y":64,"pixelRatio":1},"college-11":{"width":17,"height":17,"x":297,"y":64,"pixelRatio":1},"de-u-bahn":{"width":17,"height":17,"x":314,"y":64,"pixelRatio":1},"dentist-11":{"width":17,"height":17,"x":331,"y":64,"pixelRatio":1},"doctor-11":{"width":17,"height":17,"x":348,"y":64,"pixelRatio":1},"dog-park-11":{"width":17,"height":17,"x":365,"y":64,"pixelRatio":1},"drinking-water-11":{"width":17,"height":17,"x":382,"y":64,"pixelRatio":1},"embassy-11":{"width":17,"height":17,"x":399,"y":64,"pixelRatio":1},"entrance":{"width":17,"height":17,"x":416,"y":64,"pixelRatio":1},"entrance-11":{"width":17,"height":17,"x":433,"y":64,"pixelRatio":1},"fast-food-11":{"width":17,"height":17,"x":450,"y":64,"pixelRatio":1},"ferry-11":{"width":17,"height":17,"x":467,"y":64,"pixelRatio":1},"fire-station-11":{"width":17,"height":17,"x":484,"y":64,"pixelRatio":1},"fuel-11":{"width":17,"height":17,"x":242,"y":0,"pixelRatio":1},"garden-11":{"width":17,"height":17,"x":259,"y":0,"pixelRatio":1},"golf-11":{"width":17,"height":17,"x":276,"y":0,"pixelRatio":1},"grocery-11":{"width":17,"height":17,"x":293,"y":0,"pixelRatio":1},"harbor-11":{"width":17,"height":17,"x":310,"y":0,"pixelRatio":1},"heliport-11":{"width":17,"height":17,"x":327,"y":0,"pixelRatio":1},"hong-kong-mtr":{"width":19,"height":17,"x":344,"y":0,"pixelRatio":1},"hospital-11":{"width":17,"height":17,"x":363,"y":0,"pixelRatio":1},"ice-cream-11":{"width":17,"height":17,"x":380,"y":0,"pixelRatio":1},"information-11":{"width":17,"height":17,"x":397,"y":0,"pixelRatio":1},"laundry-11":{"width":17,"height":17,"x":414,"y":0,"pixelRatio":1},"library-11":{"width":17,"height":17,"x":431,"y":0,"pixelRatio":1},"lodging-11":{"width":17,"height":17,"x":448,"y":0,"pixelRatio":1},"mexico-city-metro":{"width":17,"height":17,"x":465,"y":0,"pixelRatio":1},"milan-metro":{"width":17,"height":17,"x":482,"y":0,"pixelRatio":1},"monument-11":{"width":17,"height":17,"x":0,"y":255,"pixelRatio":1},"moscow-metro":{"width":17,"height":17,"x":17,"y":255,"pixelRatio":1},"mountain-11":{"width":17,"height":17,"x":34,"y":255,"pixelRatio":1},"museum-11":{"width":17,"height":17,"x":51,"y":255,"pixelRatio":1},"music-11":{"width":17,"height":17,"x":68,"y":255,"pixelRatio":1},"osaka-subway":{"width":20,"height":17,"x":85,"y":255,"pixelRatio":1},"paris-transilien":{"width":17,"height":17,"x":105,"y":255,"pixelRatio":1},"park-11":{"width":17,"height":17,"x":122,"y":255,"pixelRatio":1},"pharmacy-11":{"width":17,"height":17,"x":139,"y":255,"pixelRatio":1},"philadelphia-septa":{"width":19,"height":17,"x":156,"y":255,"pixelRatio":1},"picnic-site-11":{"width":17,"height":17,"x":175,"y":255,"pixelRatio":1},"place-of-worship-11":{"width":17,"height":17,"x":192,"y":255,"pixelRatio":1},"playground-11":{"width":17,"height":17,"x":209,"y":255,"pixelRatio":1},"police-11":{"width":17,"height":17,"x":226,"y":255,"pixelRatio":1},"post-11":{"width":17,"height":17,"x":243,"y":255,"pixelRatio":1},"prison-11":{"width":17,"height":17,"x":260,"y":255,"pixelRatio":1},"rail":{"width":17,"height":17,"x":277,"y":255,"pixelRatio":1},"rail-11":{"width":17,"height":17,"x":294,"y":255,"pixelRatio":1},"rail-light":{"width":17,"height":17,"x":311,"y":255,"pixelRatio":1},"rail-light-11":{"width":17,"height":17,"x":328,"y":255,"pixelRatio":1},"rail-metro":{"width":17,"height":17,"x":345,"y":255,"pixelRatio":1},"rail-metro-11":{"width":17,"height":17,"x":362,"y":255,"pixelRatio":1},"religious-christian-11":{"width":17,"height":17,"x":379,"y":255,"pixelRatio":1},"religious-jewish-11":{"width":17,"height":17,"x":396,"y":255,"pixelRatio":1},"religious-muslim-11":{"width":17,"height":17,"x":413,"y":255,"pixelRatio":1},"restaurant-11":{"width":17,"height":17,"x":430,"y":255,"pixelRatio":1},"rocket-11":{"width":17,"height":17,"x":447,"y":255,"pixelRatio":1},"san-francisco-bart":{"width":17,"height":17,"x":464,"y":255,"pixelRatio":1},"school-11":{"width":17,"height":17,"x":481,"y":255,"pixelRatio":1},"shop-11":{"width":17,"height":17,"x":0,"y":272,"pixelRatio":1},"singapore-mrt":{"width":17,"height":17,"x":17,"y":272,"pixelRatio":1},"stadium-11":{"width":17,"height":17,"x":34,"y":272,"pixelRatio":1},"star-11":{"width":17,"height":17,"x":51,"y":272,"pixelRatio":1},"suitcase-11":{"width":17,"height":17,"x":68,"y":272,"pixelRatio":1},"swimming-11":{"width":17,"height":17,"x":85,"y":272,"pixelRatio":1},"theatre-11":{"width":17,"height":17,"x":102,"y":272,"pixelRatio":1},"toilet-11":{"width":17,"height":17,"x":119,"y":272,"pixelRatio":1},"tokyo-metro":{"width":17,"height":17,"x":136,"y":272,"pixelRatio":1},"town-hall-11":{"width":17,"height":17,"x":153,"y":272,"pixelRatio":1},"triangle-11":{"width":17,"height":17,"x":170,"y":272,"pixelRatio":1},"triangle-stroked-11":{"width":17,"height":17,"x":187,"y":272,"pixelRatio":1},"veterinary-11":{"width":17,"height":17,"x":204,"y":272,"pixelRatio":1},"volcano-11":{"width":17,"height":17,"x":221,"y":272,"pixelRatio":1},"washington-metro":{"width":17,"height":17,"x":238,"y":272,"pixelRatio":1},"zoo-11":{"width":17,"height":17,"x":255,"y":272,"pixelRatio":1},"ch-motorway-2":{"width":22,"height":16,"x":272,"y":272,"pixelRatio":1},"ch-motorway-3":{"width":28,"height":16,"x":294,"y":272,"pixelRatio":1},"ch-motorway-4":{"width":34,"height":16,"x":322,"y":272,"pixelRatio":1},"de-motorway-2":{"width":22,"height":16,"x":356,"y":272,"pixelRatio":1},"de-motorway-3":{"width":28,"height":16,"x":378,"y":272,"pixelRatio":1},"gb-national-rail.london-dlr":{"width":36,"height":16,"x":406,"y":272,"pixelRatio":1},"gb-national-rail.london-dlr.london-overground.london-tfl-rail.london-underground":{"width":93,"height":16,"x":0,"y":289,"pixelRatio":1},"gb-national-rail.london-dlr.london-overground.london-underground":{"width":74,"height":16,"x":93,"y":289,"pixelRatio":1},"gb-national-rail.london-dlr.london-underground":{"width":55,"height":16,"x":167,"y":289,"pixelRatio":1},"gb-national-rail.london-overground":{"width":36,"height":16,"x":222,"y":289,"pixelRatio":1},"gb-national-rail.london-overground.london-tfl-rail.london-underground":{"width":74,"height":16,"x":258,"y":289,"pixelRatio":1},"gb-national-rail.london-overground.london-underground":{"width":55,"height":16,"x":332,"y":289,"pixelRatio":1},"gb-national-rail.london-tfl-rail":{"width":36,"height":16,"x":387,"y":289,"pixelRatio":1},"gb-national-rail.london-tfl-rail.london-overground":{"width":55,"height":16,"x":423,"y":289,"pixelRatio":1},"gb-national-rail.london-tfl-rail.london-underground":{"width":55,"height":16,"x":442,"y":272,"pixelRatio":1},"gb-national-rail.london-underground":{"width":36,"height":16,"x":0,"y":305,"pixelRatio":1},"gr-motorway-2":{"width":22,"height":16,"x":478,"y":289,"pixelRatio":1},"gr-motorway-3":{"width":28,"height":16,"x":36,"y":305,"pixelRatio":1},"gr-motorway-4":{"width":34,"height":16,"x":64,"y":305,"pixelRatio":1},"hr-motorway-3":{"width":28,"height":16,"x":98,"y":305,"pixelRatio":1},"hr-motorway-4":{"width":34,"height":16,"x":126,"y":305,"pixelRatio":1},"london-dlr":{"width":20,"height":16,"x":160,"y":305,"pixelRatio":1},"london-dlr.london-tfl-rail":{"width":39,"height":16,"x":180,"y":305,"pixelRatio":1},"london-dlr.london-tfl-rail.london-underground":{"width":58,"height":16,"x":219,"y":305,"pixelRatio":1},"london-dlr.london-underground":{"width":39,"height":16,"x":277,"y":305,"pixelRatio":1},"london-overground":{"width":20,"height":16,"x":316,"y":305,"pixelRatio":1},"london-overground.london-tfl-rail":{"width":39,"height":16,"x":336,"y":305,"pixelRatio":1},"london-overground.london-tfl-rail.london-underground":{"width":58,"height":16,"x":375,"y":305,"pixelRatio":1},"london-overground.london-underground":{"width":39,"height":16,"x":433,"y":305,"pixelRatio":1},"london-tfl-rail":{"width":20,"height":16,"x":472,"y":305,"pixelRatio":1},"london-tfl-rail.london-underground":{"width":39,"height":16,"x":0,"y":321,"pixelRatio":1},"london-underground":{"width":20,"height":16,"x":492,"y":305,"pixelRatio":1},"si-motorway-2":{"width":22,"height":16,"x":39,"y":321,"pixelRatio":1},"at-expressway-2":{"width":20,"height":14,"x":61,"y":321,"pixelRatio":1},"at-expressway-3":{"width":26,"height":14,"x":81,"y":321,"pixelRatio":1},"at-motorway-2":{"width":20,"height":14,"x":107,"y":321,"pixelRatio":1},"at-motorway-3":{"width":26,"height":14,"x":127,"y":321,"pixelRatio":1},"at-state-b-2":{"width":20,"height":14,"x":153,"y":321,"pixelRatio":1},"at-state-b-3":{"width":26,"height":14,"x":173,"y":321,"pixelRatio":1},"bg-motorway-2":{"width":20,"height":14,"x":199,"y":321,"pixelRatio":1},"bg-national-2":{"width":20,"height":14,"x":219,"y":321,"pixelRatio":1},"ch-main-2":{"width":20,"height":14,"x":239,"y":321,"pixelRatio":1},"ch-main-3":{"width":26,"height":14,"x":259,"y":321,"pixelRatio":1},"cz-expressway-2":{"width":20,"height":14,"x":285,"y":321,"pixelRatio":1},"cz-expressway-3":{"width":26,"height":14,"x":305,"y":321,"pixelRatio":1},"cz-motorway-2":{"width":20,"height":14,"x":331,"y":321,"pixelRatio":1},"cz-road-2":{"width":20,"height":14,"x":351,"y":321,"pixelRatio":1},"cz-road-3":{"width":26,"height":14,"x":371,"y":321,"pixelRatio":1},"de-federal-2":{"width":20,"height":14,"x":397,"y":321,"pixelRatio":1},"de-federal-3":{"width":26,"height":14,"x":417,"y":321,"pixelRatio":1},"de-federal-4":{"width":32,"height":14,"x":443,"y":321,"pixelRatio":1},"default-2":{"width":20,"height":14,"x":475,"y":321,"pixelRatio":1},"default-3":{"width":26,"height":14,"x":0,"y":337,"pixelRatio":1},"default-4":{"width":32,"height":14,"x":26,"y":337,"pixelRatio":1},"default-5":{"width":38,"height":14,"x":58,"y":337,"pixelRatio":1},"default-6":{"width":44,"height":14,"x":96,"y":337,"pixelRatio":1},"dk-primary-2":{"width":20,"height":14,"x":140,"y":337,"pixelRatio":1},"dk-secondary-3":{"width":26,"height":14,"x":160,"y":337,"pixelRatio":1},"e-road-2":{"width":20,"height":14,"x":186,"y":337,"pixelRatio":1},"e-road-3":{"width":26,"height":14,"x":206,"y":337,"pixelRatio":1},"e-road-4":{"width":32,"height":14,"x":232,"y":337,"pixelRatio":1},"fi-main-2":{"width":20,"height":14,"x":264,"y":337,"pixelRatio":1},"fi-regional-3":{"width":26,"height":14,"x":284,"y":337,"pixelRatio":1},"fi-trunk-2":{"width":20,"height":14,"x":310,"y":337,"pixelRatio":1},"gb-national-rail":{"width":17,"height":14,"x":330,"y":337,"pixelRatio":1},"gr-national-2":{"width":20,"height":14,"x":347,"y":337,"pixelRatio":1},"gr-national-3":{"width":26,"height":14,"x":367,"y":337,"pixelRatio":1},"gr-national-4":{"width":32,"height":14,"x":393,"y":337,"pixelRatio":1},"hr-county-4":{"width":32,"height":14,"x":425,"y":337,"pixelRatio":1},"hr-state-2":{"width":20,"height":14,"x":457,"y":337,"pixelRatio":1},"hr-state-3":{"width":26,"height":14,"x":477,"y":337,"pixelRatio":1},"marker-15":{"width":6,"height":14,"x":503,"y":337,"pixelRatio":1},"motorway-exit-1":{"width":20,"height":14,"x":0,"y":351,"pixelRatio":1},"motorway-exit-2":{"width":20,"height":14,"x":20,"y":351,"pixelRatio":1},"motorway-exit-3":{"width":26,"height":14,"x":40,"y":351,"pixelRatio":1},"motorway-exit-4":{"width":32,"height":14,"x":66,"y":351,"pixelRatio":1},"motorway-exit-5":{"width":38,"height":14,"x":98,"y":351,"pixelRatio":1},"motorway-exit-6":{"width":44,"height":14,"x":136,"y":351,"pixelRatio":1},"motorway-exit-7":{"width":50,"height":14,"x":180,"y":351,"pixelRatio":1},"motorway-exit-8":{"width":56,"height":14,"x":230,"y":351,"pixelRatio":1},"pl-expressway-2":{"width":20,"height":14,"x":286,"y":351,"pixelRatio":1},"pl-expressway-3":{"width":26,"height":14,"x":306,"y":351,"pixelRatio":1},"pl-motorway-2":{"width":20,"height":14,"x":332,"y":351,"pixelRatio":1},"pl-motorway-3":{"width":26,"height":14,"x":352,"y":351,"pixelRatio":1},"pl-national-2":{"width":20,"height":14,"x":378,"y":351,"pixelRatio":1},"pl-voivodeship-3":{"width":26,"height":14,"x":398,"y":351,"pixelRatio":1},"ro-motorway-2":{"width":20,"height":14,"x":424,"y":351,"pixelRatio":1},"ro-motorway-3":{"width":26,"height":14,"x":444,"y":351,"pixelRatio":1},"rs-motorway-3":{"width":26,"height":14,"x":470,"y":351,"pixelRatio":1},"rs-state-1b-2":{"width":20,"height":14,"x":0,"y":365,"pixelRatio":1},"rs-state-2a-3":{"width":26,"height":14,"x":20,"y":365,"pixelRatio":1},"rs-state-2b-3":{"width":26,"height":14,"x":46,"y":365,"pixelRatio":1},"se-main-2":{"width":20,"height":14,"x":72,"y":365,"pixelRatio":1},"se-main-3":{"width":26,"height":14,"x":92,"y":365,"pixelRatio":1},"si-expressway-3":{"width":26,"height":14,"x":118,"y":365,"pixelRatio":1},"si-main-2":{"width":20,"height":14,"x":144,"y":365,"pixelRatio":1},"si-main-3":{"width":26,"height":14,"x":164,"y":365,"pixelRatio":1},"sk-highway-2":{"width":20,"height":14,"x":190,"y":365,"pixelRatio":1},"sk-road-2":{"width":20,"height":14,"x":210,"y":365,"pixelRatio":1},"sk-road-3":{"width":26,"height":14,"x":230,"y":365,"pixelRatio":1},"sk-road-4":{"width":32,"height":14,"x":256,"y":365,"pixelRatio":1},"sk-road-5":{"width":38,"height":14,"x":288,"y":365,"pixelRatio":1},"za-metropolitan-2":{"width":20,"height":14,"x":326,"y":365,"pixelRatio":1},"za-regional-3":{"width":26,"height":14,"x":346,"y":365,"pixelRatio":1},"dot-11":{"width":11,"height":11,"x":496,"y":351,"pixelRatio":1},"marker-11":{"width":6,"height":11,"x":372,"y":365,"pixelRatio":1},"dot-10":{"width":10,"height":10,"x":378,"y":365,"pixelRatio":1},"dot-9":{"width":9,"height":9,"x":388,"y":365,"pixelRatio":1},"oneway-large":{"width":14,"height":6,"x":397,"y":365,"pixelRatio":1},"oneway-white-large":{"width":14,"height":6,"x":411,"y":365,"pixelRatio":1},"oneway-small":{"width":11,"height":5,"x":425,"y":365,"pixelRatio":1},"oneway-white-small":{"width":11,"height":5,"x":436,"y":365,"pixelRatio":1}}
\ No newline at end of file diff --git a/test/fixtures/resources/sprite.png b/test/fixtures/resources/sprite.png Binary files differindex 967f2e76a6..b4db4423c7 100644 --- a/test/fixtures/resources/sprite.png +++ b/test/fixtures/resources/sprite.png diff --git a/test/fixtures/resources/style.json b/test/fixtures/resources/style.json deleted file mode 100644 index 858e2de037..0000000000 --- a/test/fixtures/resources/style.json +++ /dev/null @@ -1,40 +0,0 @@ -{ - "version": 8, - "name": "Test", - "sources": { - "vectorsource": { - "url": "test/fixtures/resources/source_vector.json", - "type": "vector" - }, - "rastersource": { - "url": "test/fixtures/resources/source_raster.json", - "type": "raster", - "tileSize": 512 - } - }, - "sprite": "test/fixtures/resources/sprite", - "glyphs": "test/fixtures/resources/glyphs.pbf", - "layers": [{ - "id": "road", - "type": "symbol", - "source": "vectorsource", - "source-layer": "road_label", - "layout": { - "text-font": ["Open Sans Regular", "Arial Unicode MS Regular"], - "text-field": "{name_en}" - } - }, { - "id": "poi", - "type": "symbol", - "source": "vectorsource", - "source-layer": "poi_label", - "layout": { - "text-font": ["Open Sans Regular", "Arial Unicode MS Regular"], - "icon-image": "{maki}_icon" - } - }, { - "id": "rasterlayer", - "type": "fill", - "source": "rastersource" - }] -} diff --git a/test/fixtures/resources/style_raster.json b/test/fixtures/resources/style_raster.json new file mode 100644 index 0000000000..f0e971daef --- /dev/null +++ b/test/fixtures/resources/style_raster.json @@ -0,0 +1 @@ +{"version":8,"name":"Satellite","metadata":{"mapbox:autocomposite":true,"mapbox:type":"default"},"sources":{"mapbox":{"type":"raster","url":"mapbox://mapbox.satellite","tileSize":256}},"sprite":"mapbox://sprites/mapbox/satellite-v9","glyphs":"mapbox://fonts/mapbox/{fontstack}/{range}.pbf","layers":[{"id":"background","type":"background","paint":{"background-color":"rgb(4,7,14)"}},{"id":"satellite","type":"raster","source":"mapbox","source-layer":"mapbox_satellite_full"}],"created":0,"modified":0,"owner":"mapbox","id":"satellite-v9","draft":false}
\ No newline at end of file diff --git a/test/fixtures/resources/style_vector.json b/test/fixtures/resources/style_vector.json new file mode 100644 index 0000000000..ec0ad95156 --- /dev/null +++ b/test/fixtures/resources/style_vector.json @@ -0,0 +1 @@ +{"version":8,"name":"Mapbox Streets","metadata":{"mapbox:autocomposite":true,"mapbox:type":"default","mapbox:groups":{"1444934828655.3389":{"name":"Aeroways","collapsed":true},"1444933322393.2852":{"name":"POI labels (scalerank 1)","collapsed":true},"1444855898284.2651":{"name":"Aeroways","collapsed":true},"1444862578782.6787":{"name":"Road labels","collapsed":true},"1444934749452.0452":{"name":"Wetlands","collapsed":true},"1444862074717.8372":{"name":"Waterways","collapsed":true},"1444855868004.2437":{"name":"Landuse","collapsed":true},"1444855786460.0557":{"name":"Roads","collapsed":true},"1444856071629.7817":{"name":"Place labels","collapsed":true},"1444933575858.6992":{"name":"Highway shields","collapsed":true},"1444934295202.7542":{"name":"Admin boundaries","collapsed":true},"1444856904773.373":{"name":"Land barriers","collapsed":true},"1444856931506.5164":{"name":"Barriers","collapsed":true},"1444856151690.9143":{"name":"State labels","collapsed":true},"1444933721429.3076":{"name":"Road labels","collapsed":true},"1444933358918.2366":{"name":"POI labels (scalerank 2)","collapsed":true},"1444933808272.805":{"name":"Water labels","collapsed":true},"1444933372896.5967":{"name":"POI labels (scalerank 3)","collapsed":true},"1444855799204.86":{"name":"Bridges","collapsed":true},"1444856087950.3635":{"name":"Marine labels","collapsed":true},"1456969573402.7817":{"name":"Hillshading","collapsed":true},"1444856869758.2375":{"name":"Wetlands","collapsed":true},"1444862510685.128":{"name":"City labels","collapsed":true},"1444856954425.4016":{"name":"Buildings","collapsed":true},"1444855769305.6016":{"name":"Tunnels","collapsed":true},"1456970288113.8113":{"name":"Landcover","collapsed":true},"1444856144497.7825":{"name":"Country labels","collapsed":true},"1444856712129.5933":{"name":"Waterways","collapsed":true},"1444933456003.5437":{"name":"POI labels (scalerank 4)","collapsed":true}}},"sources":{"composite":{"url":"mapbox://mapbox.mapbox-terrain-v2,mapbox.mapbox-streets-v7","type":"vector"}},"sprite":"mapbox://sprites/mapbox/streets-v9","glyphs":"mapbox://fonts/mapbox/{fontstack}/{range}.pbf","layers":[{"id":"background","type":"background","layout":{},"paint":{"background-color":{"base":1,"stops":[[11,"hsl(35, 32%, 91%)"],[13,"hsl(35, 12%, 89%)"]]}}},{"id":"landcover_snow","type":"fill","metadata":{"mapbox:group":"1456970288113.8113"},"source":"composite","source-layer":"landcover","filter":["==","class","snow"],"layout":{},"paint":{"fill-color":"hsl(0, 0%, 100%)","fill-opacity":0.2,"fill-antialias":false}},{"id":"landcover_wood","type":"fill","metadata":{"mapbox:group":"1456970288113.8113"},"source":"composite","source-layer":"landcover","maxzoom":14,"filter":["==","class","wood"],"layout":{},"paint":{"fill-color":"hsl(75, 62%, 81%)","fill-opacity":{"base":1.5,"stops":[[2,0.3],[7,0]]},"fill-antialias":false}},{"id":"landcover_scrub","type":"fill","metadata":{"mapbox:group":"1456970288113.8113"},"source":"composite","source-layer":"landcover","maxzoom":14,"filter":["==","class","scrub"],"layout":{},"paint":{"fill-color":"hsl(75, 62%, 81%)","fill-opacity":{"base":1.5,"stops":[[2,0.3],[7,0]]},"fill-antialias":false}},{"id":"landcover_grass","type":"fill","metadata":{"mapbox:group":"1456970288113.8113"},"source":"composite","source-layer":"landcover","maxzoom":14,"filter":["==","class","grass"],"layout":{},"paint":{"fill-color":"hsl(75, 62%, 81%)","fill-opacity":{"base":1.5,"stops":[[2,0.3],[7,0]]},"fill-antialias":false}},{"id":"landcover_crop","type":"fill","metadata":{"mapbox:group":"1456970288113.8113"},"source":"composite","source-layer":"landcover","maxzoom":14,"filter":["==","class","crop"],"layout":{},"paint":{"fill-color":"hsl(75, 62%, 81%)","fill-opacity":{"base":1.5,"stops":[[2,0.3],[7,0]]},"fill-antialias":false}},{"id":"national_park","type":"fill","source":"composite","source-layer":"landuse_overlay","filter":["==","class","national_park"],"layout":{},"paint":{"fill-color":"hsl(100, 58%, 76%)","fill-opacity":{"base":1,"stops":[[5,0],[6,0.5]]}}},{"id":"hospital","type":"fill","source":"composite","source-layer":"landuse","filter":["==","class","hospital"],"layout":{},"paint":{"fill-color":{"base":1,"stops":[[15.5,"hsl(340, 37%, 87%)"],[16,"hsl(340, 63%, 89%)"]]}}},{"id":"school","type":"fill","source":"composite","source-layer":"landuse","filter":["==","class","school"],"layout":{},"paint":{"fill-color":{"base":1,"stops":[[15.5,"hsl(50, 47%, 81%)"],[16,"hsl(50, 63%, 84%)"]]}}},{"id":"park","type":"fill","source":"composite","source-layer":"landuse","filter":["==","class","park"],"layout":{},"paint":{"fill-color":"hsl(100, 58%, 76%)","fill-opacity":{"base":1,"stops":[[5,0],[6,1]]}}},{"id":"pitch","type":"fill","source":"composite","source-layer":"landuse","filter":["==","class","pitch"],"layout":{},"paint":{"fill-color":"hsl(100, 57%, 72%)"}},{"id":"pitch-line","type":"line","source":"composite","source-layer":"landuse","minzoom":15,"filter":["==","class","pitch"],"layout":{"line-join":"miter"},"paint":{"line-color":"hsl(75, 57%, 84%)"}},{"id":"cemetery","type":"fill","source":"composite","source-layer":"landuse","filter":["==","class","cemetery"],"layout":{},"paint":{"fill-color":"hsl(75, 37%, 81%)"}},{"id":"industrial","type":"fill","source":"composite","source-layer":"landuse","filter":["==","class","industrial"],"layout":{},"paint":{"fill-color":{"base":1,"stops":[[15.5,"hsl(230, 15%, 86%)"],[16,"hsl(230, 29%, 89%)"]]}}},{"id":"sand","type":"fill","source":"composite","source-layer":"landuse","filter":["==","class","sand"],"layout":{},"paint":{"fill-color":"hsl(60, 46%, 87%)"}},{"id":"hillshade_highlight_bright","type":"fill","metadata":{"mapbox:group":"1456969573402.7817"},"source":"composite","source-layer":"hillshade","maxzoom":16,"filter":["==","level",94],"layout":{},"paint":{"fill-color":"hsl(0, 0%, 100%)","fill-opacity":{"stops":[[14,0.12],[16,0]]},"fill-antialias":false}},{"id":"hillshade_highlight_med","type":"fill","metadata":{"mapbox:group":"1456969573402.7817"},"source":"composite","source-layer":"hillshade","maxzoom":16,"filter":["==","level",90],"layout":{},"paint":{"fill-color":"hsl(0, 0%, 100%)","fill-opacity":{"stops":[[14,0.12],[16,0]]},"fill-antialias":false}},{"id":"hillshade_shadow_faint","type":"fill","metadata":{"mapbox:group":"1456969573402.7817"},"source":"composite","source-layer":"hillshade","maxzoom":16,"filter":["==","level",89],"layout":{},"paint":{"fill-color":"hsl(56, 59%, 22%)","fill-opacity":{"stops":[[14,0.05],[16,0]]},"fill-antialias":false}},{"id":"hillshade_shadow_med","type":"fill","metadata":{"mapbox:group":"1456969573402.7817"},"source":"composite","source-layer":"hillshade","maxzoom":16,"filter":["==","level",78],"layout":{},"paint":{"fill-color":"hsl(56, 59%, 22%)","fill-opacity":{"stops":[[14,0.05],[16,0]]},"fill-antialias":false}},{"id":"hillshade_shadow_dark","type":"fill","metadata":{"mapbox:group":"1456969573402.7817"},"source":"composite","source-layer":"hillshade","maxzoom":16,"filter":["==","level",67],"layout":{},"paint":{"fill-color":"hsl(56, 59%, 22%)","fill-opacity":{"stops":[[14,0.06],[16,0]]},"fill-antialias":false}},{"id":"hillshade_shadow_extreme","type":"fill","metadata":{"mapbox:group":"1456969573402.7817"},"source":"composite","source-layer":"hillshade","maxzoom":16,"filter":["==","level",56],"layout":{},"paint":{"fill-color":"hsl(56, 59%, 22%)","fill-opacity":{"stops":[[14,0.06],[16,0]]},"fill-antialias":false}},{"id":"waterway-river-canal","type":"line","source":"composite","source-layer":"waterway","minzoom":8,"filter":["in","class","canal","river"],"layout":{"line-cap":{"base":1,"stops":[[0,"butt"],[11,"round"]]},"line-join":"round"},"paint":{"line-color":"hsl(205, 87%, 76%)","line-width":{"base":1.3,"stops":[[8.5,0.1],[20,8]]},"line-opacity":{"base":1,"stops":[[8,0],[8.5,1]]}}},{"id":"waterway-small","type":"line","source":"composite","source-layer":"waterway","minzoom":13,"filter":["!in","class","canal","river"],"layout":{"line-join":"round","line-cap":"round"},"paint":{"line-color":"hsl(205, 87%, 76%)","line-width":{"base":1.35,"stops":[[13.5,0.1],[20,3]]},"line-opacity":{"base":1,"stops":[[13,0],[13.5,1]]}}},{"id":"water-shadow","type":"fill","source":"composite","source-layer":"water","layout":{},"paint":{"fill-color":"hsl(215, 84%, 69%)","fill-translate":{"base":1.2,"stops":[[7,[0,0]],[16,[-1,-1]]]},"fill-translate-anchor":"viewport","fill-opacity":1}},{"id":"water","ref":"water-shadow","paint":{"fill-color":"hsl(196, 80%, 70%)"}},{"id":"barrier_line-land-polygon","type":"fill","source":"composite","source-layer":"barrier_line","filter":["all",["==","$type","Polygon"],["==","class","land"]],"layout":{},"paint":{"fill-color":"hsl(35, 12%, 89%)"}},{"id":"barrier_line-land-line","type":"line","source":"composite","source-layer":"barrier_line","filter":["all",["==","$type","LineString"],["==","class","land"]],"layout":{"line-cap":"round"},"paint":{"line-width":{"base":1.99,"stops":[[14,0.75],[20,40]]},"line-color":"hsl(35, 12%, 89%)"}},{"id":"aeroway-polygon","type":"fill","metadata":{"mapbox:group":"1444934828655.3389"},"source":"composite","source-layer":"aeroway","minzoom":11,"filter":["all",["==","$type","Polygon"],["!=","type","apron"]],"layout":{},"paint":{"fill-color":{"base":1,"stops":[[15,"hsl(230, 23%, 82%)"],[16,"hsl(230, 37%, 84%)"]]},"fill-opacity":{"base":1,"stops":[[11,0],[11.5,1]]}}},{"id":"aeroway-runway","type":"line","metadata":{"mapbox:group":"1444934828655.3389"},"source":"composite","source-layer":"aeroway","minzoom":9,"filter":["all",["==","$type","LineString"],["==","type","runway"]],"layout":{},"paint":{"line-color":{"base":1,"stops":[[15,"hsl(230, 23%, 82%)"],[16,"hsl(230, 37%, 84%)"]]},"line-width":{"base":1.5,"stops":[[9,1],[18,80]]}}},{"id":"aeroway-taxiway","type":"line","metadata":{"mapbox:group":"1444934828655.3389"},"source":"composite","source-layer":"aeroway","minzoom":9,"filter":["all",["==","$type","LineString"],["==","type","taxiway"]],"layout":{},"paint":{"line-color":{"base":1,"stops":[[15,"hsl(230, 23%, 82%)"],[16,"hsl(230, 37%, 84%)"]]},"line-width":{"base":1.5,"stops":[[10,0.5],[18,20]]}}},{"id":"building-line","type":"line","source":"composite","source-layer":"building","minzoom":15,"filter":["==","underground","false"],"layout":{},"paint":{"line-color":"hsl(230, 24%, 87%)","line-width":{"base":1.5,"stops":[[15,0.75],[20,3]]},"line-opacity":{"base":1,"stops":[[15.5,0],[16,1]]}}},{"id":"building","type":"fill","source":"composite","source-layer":"building","minzoom":15,"filter":["==","underground","false"],"layout":{},"paint":{"fill-color":{"base":1,"stops":[[15,"hsl(35, 11%, 88%)"],[16,"hsl(35, 8%, 85%)"]]},"fill-opacity":{"base":1,"stops":[[15.5,0],[16,1]]},"fill-outline-color":"hsl(35, 6%, 79%)"}},{"id":"tunnel-street-low","type":"line","metadata":{"mapbox:group":"1444855769305.6016"},"source":"composite","source-layer":"road","minzoom":11,"filter":["all",["==","class","street"],["==","structure","tunnel"]],"layout":{"line-cap":"round","line-join":"round"},"paint":{"line-width":{"base":1.5,"stops":[[12.5,0.5],[14,2],[18,18]]},"line-color":"hsl(0, 0%, 100%)","line-opacity":{"stops":[[11.5,0],[12,1],[14,1],[14.01,0]]}}},{"id":"tunnel-street_limited-low","type":"line","metadata":{"mapbox:group":"1444855769305.6016"},"source":"composite","source-layer":"road","minzoom":11,"filter":["all",["==","class","street_limited"],["==","structure","tunnel"]],"layout":{"line-cap":"round","line-join":"round"},"paint":{"line-width":{"base":1.5,"stops":[[12.5,0.5],[14,2],[18,18]]},"line-color":"hsl(0, 0%, 100%)","line-opacity":{"stops":[[11.5,0],[12,1],[14,1],[14.01,0]]}}},{"id":"tunnel-service-link-track-case","type":"line","metadata":{"mapbox:group":"1444855769305.6016"},"source":"composite","source-layer":"road","minzoom":14,"filter":["all",["in","class","link","service","track"],["==","structure","tunnel"],["!=","type","trunk_link"]],"layout":{"line-cap":"round","line-join":"round"},"paint":{"line-width":{"base":1.5,"stops":[[12,0.75],[20,2]]},"line-color":"hsl(230, 19%, 75%)","line-gap-width":{"base":1.5,"stops":[[14,0.5],[18,12]]},"line-dasharray":[3,3]}},{"id":"tunnel-street_limited-case","metadata":{"mapbox:group":"1444855769305.6016"},"ref":"tunnel-street_limited-low","paint":{"line-width":{"base":1.5,"stops":[[12,0.75],[20,2]]},"line-color":"hsl(230, 19%, 75%)","line-gap-width":{"base":1.5,"stops":[[13,0],[14,2],[18,18]]},"line-dasharray":[3,3],"line-opacity":{"base":1,"stops":[[13.99,0],[14,1]]}}},{"id":"tunnel-street-case","metadata":{"mapbox:group":"1444855769305.6016"},"ref":"tunnel-street-low","paint":{"line-width":{"base":1.5,"stops":[[12,0.75],[20,2]]},"line-color":"hsl(230, 19%, 75%)","line-gap-width":{"base":1.5,"stops":[[13,0],[14,2],[18,18]]},"line-dasharray":[3,3],"line-opacity":{"base":1,"stops":[[13.99,0],[14,1]]}}},{"id":"tunnel-secondary-tertiary-case","type":"line","metadata":{"mapbox:group":"1444855769305.6016"},"source":"composite","source-layer":"road","filter":["all",["in","class","secondary","tertiary"],["==","structure","tunnel"]],"layout":{"line-cap":"round","line-join":"round"},"paint":{"line-width":{"base":1.2,"stops":[[10,0.75],[18,2]]},"line-dasharray":[3,3],"line-gap-width":{"base":1.5,"stops":[[8.5,0.5],[10,0.75],[18,26]]},"line-color":"hsl(230, 19%, 75%)"}},{"id":"tunnel-primary-case","type":"line","metadata":{"mapbox:group":"1444855769305.6016"},"source":"composite","source-layer":"road","filter":["all",["==","class","primary"],["==","structure","tunnel"]],"layout":{"line-cap":"round","line-join":"round"},"paint":{"line-width":{"base":1.5,"stops":[[10,1],[16,2]]},"line-dasharray":[3,3],"line-gap-width":{"base":1.5,"stops":[[5,0.75],[18,32]]},"line-color":"hsl(230, 19%, 75%)"}},{"id":"tunnel-trunk_link-case","type":"line","metadata":{"mapbox:group":"1444855769305.6016"},"source":"composite","source-layer":"road","minzoom":13,"filter":["all",["==","structure","tunnel"],["==","type","trunk_link"]],"layout":{"line-cap":"round","line-join":"round"},"paint":{"line-width":{"base":1.5,"stops":[[12,0.75],[20,2]]},"line-color":"hsl(0, 0%, 100%)","line-gap-width":{"base":1.5,"stops":[[12,0.5],[14,2],[18,18]]},"line-dasharray":[3,3]}},{"id":"tunnel-motorway_link-case","type":"line","metadata":{"mapbox:group":"1444855769305.6016"},"source":"composite","source-layer":"road","minzoom":13,"filter":["all",["==","class","motorway_link"],["==","structure","tunnel"]],"layout":{"line-cap":"round","line-join":"round"},"paint":{"line-width":{"base":1.5,"stops":[[12,0.75],[20,2]]},"line-color":"hsl(0, 0%, 100%)","line-gap-width":{"base":1.5,"stops":[[12,0.5],[14,2],[18,18]]},"line-dasharray":[3,3]}},{"id":"tunnel-trunk-case","type":"line","metadata":{"mapbox:group":"1444855769305.6016"},"source":"composite","source-layer":"road","filter":["all",["==","structure","tunnel"],["==","type","trunk"]],"layout":{"line-cap":"round","line-join":"round"},"paint":{"line-width":{"base":1.5,"stops":[[10,1],[16,2]]},"line-color":"hsl(0, 0%, 100%)","line-gap-width":{"base":1.5,"stops":[[5,0.75],[18,32]]},"line-opacity":1,"line-dasharray":[3,3]}},{"id":"tunnel-motorway-case","type":"line","metadata":{"mapbox:group":"1444855769305.6016"},"source":"composite","source-layer":"road","filter":["all",["==","class","motorway"],["==","structure","tunnel"]],"layout":{"line-cap":"round","line-join":"round"},"paint":{"line-width":{"base":1.5,"stops":[[10,1],[16,2]]},"line-color":"hsl(0, 0%, 100%)","line-gap-width":{"base":1.5,"stops":[[5,0.75],[18,32]]},"line-opacity":1,"line-dasharray":[3,3]}},{"id":"tunnel-construction","type":"line","metadata":{"mapbox:group":"1444855769305.6016"},"source":"composite","source-layer":"road","minzoom":14,"filter":["all",["==","class","construction"],["==","structure","tunnel"]],"layout":{"line-join":"miter"},"paint":{"line-width":{"base":1.5,"stops":[[12.5,0.5],[14,2],[18,18]]},"line-color":"hsl(230, 24%, 87%)","line-opacity":{"base":1,"stops":[[13.99,0],[14,1]]},"line-dasharray":{"base":1,"stops":[[14,[0.4,0.8]],[15,[0.3,0.6]],[16,[0.2,0.3]],[17,[0.2,0.25]],[18,[0.15,0.15]]]}}},{"id":"tunnel-path","type":"line","metadata":{"mapbox:group":"1444855769305.6016"},"source":"composite","source-layer":"road","filter":["all",["==","class","path"],["==","structure","tunnel"],["!=","type","steps"]],"layout":{"line-join":"round"},"paint":{"line-width":{"base":1.5,"stops":[[15,1],[18,4]]},"line-dasharray":{"base":1,"stops":[[14,[1,0]],[15,[1.75,1]],[16,[1,0.75]],[17,[1,0.5]]]},"line-color":"hsl(35, 26%, 95%)","line-opacity":{"base":1,"stops":[[14,0],[14.25,1]]}}},{"id":"tunnel-steps","type":"line","metadata":{"mapbox:group":"1444855769305.6016"},"source":"composite","source-layer":"road","filter":["all",["==","$type","LineString"],["all",["==","structure","tunnel"],["==","type","steps"]]],"layout":{"line-join":"round"},"paint":{"line-width":{"base":1.5,"stops":[[15,1],[16,1.6],[18,6]]},"line-color":"hsl(35, 26%, 95%)","line-dasharray":{"base":1,"stops":[[14,[1,0]],[15,[1.75,1]],[16,[1,0.75]],[17,[0.3,0.3]]]},"line-opacity":{"base":1,"stops":[[14,0],[14.25,1]]}}},{"id":"tunnel-trunk_link","metadata":{"mapbox:group":"1444855769305.6016"},"ref":"tunnel-trunk_link-case","paint":{"line-width":{"base":1.5,"stops":[[12,0.5],[14,2],[18,18]]},"line-color":"hsl(46, 77%, 78%)","line-opacity":1,"line-dasharray":[1,0]}},{"id":"tunnel-motorway_link","metadata":{"mapbox:group":"1444855769305.6016"},"ref":"tunnel-motorway_link-case","paint":{"line-width":{"base":1.5,"stops":[[12,0.5],[14,2],[18,18]]},"line-color":"hsl(26, 100%, 78%)","line-opacity":1,"line-dasharray":[1,0]}},{"id":"tunnel-pedestrian","type":"line","metadata":{"mapbox:group":"1444855769305.6016"},"source":"composite","source-layer":"road","minzoom":13,"filter":["all",["==","$type","LineString"],["all",["==","class","pedestrian"],["==","structure","tunnel"]]],"layout":{"line-join":"round"},"paint":{"line-width":{"base":1.5,"stops":[[14,0.5],[18,12]]},"line-color":"hsl(0, 0%, 100%)","line-opacity":1,"line-dasharray":{"base":1,"stops":[[14,[1,0]],[15,[1.5,0.4]],[16,[1,0.2]]]}}},{"id":"tunnel-service-link-track","metadata":{"mapbox:group":"1444855769305.6016"},"ref":"tunnel-service-link-track-case","paint":{"line-width":{"base":1.5,"stops":[[14,0.5],[18,12]]},"line-color":"hsl(0, 0%, 100%)","line-dasharray":[1,0]}},{"id":"tunnel-street_limited","metadata":{"mapbox:group":"1444855769305.6016"},"ref":"tunnel-street_limited-low","paint":{"line-width":{"base":1.5,"stops":[[12.5,0.5],[14,2],[18,18]]},"line-color":"hsl(35, 14%, 93%)","line-opacity":{"base":1,"stops":[[13.99,0],[14,1]]}}},{"id":"tunnel-street","metadata":{"mapbox:group":"1444855769305.6016"},"ref":"tunnel-street-low","paint":{"line-width":{"base":1.5,"stops":[[12.5,0.5],[14,2],[18,18]]},"line-color":"hsl(0, 0%, 100%)","line-opacity":{"base":1,"stops":[[13.99,0],[14,1]]}}},{"id":"tunnel-secondary-tertiary","metadata":{"mapbox:group":"1444855769305.6016"},"ref":"tunnel-secondary-tertiary-case","paint":{"line-width":{"base":1.5,"stops":[[8.5,0.5],[10,0.75],[18,26]]},"line-color":"hsl(0, 0%, 100%)","line-opacity":1,"line-dasharray":[1,0],"line-blur":0}},{"id":"tunnel-primary","metadata":{"mapbox:group":"1444855769305.6016"},"ref":"tunnel-primary-case","paint":{"line-width":{"base":1.5,"stops":[[5,0.75],[18,32]]},"line-color":"hsl(0, 0%, 100%)","line-opacity":1,"line-dasharray":[1,0],"line-blur":0}},{"id":"tunnel-oneway-arrows-blue-minor","type":"symbol","metadata":{"mapbox:group":"1444855769305.6016"},"source":"composite","source-layer":"road","minzoom":16,"filter":["all",["in","class","link","path","pedestrian","service","track"],["==","oneway","true"],["==","structure","tunnel"],["!=","type","trunk_link"]],"layout":{"symbol-placement":"line","icon-image":{"base":1,"stops":[[17,"oneway-small"],[18,"oneway-large"]]},"symbol-spacing":200,"icon-padding":2},"paint":{}},{"id":"tunnel-oneway-arrows-blue-major","type":"symbol","metadata":{"mapbox:group":"1444855769305.6016"},"source":"composite","source-layer":"road","minzoom":15,"filter":["all",["in","class","primary","secondary","street","street_limited","tertiary"],["==","oneway","true"],["==","structure","tunnel"],["!=","type","trunk_link"]],"layout":{"symbol-placement":"line","icon-image":{"base":1,"stops":[[16,"oneway-small"],[17,"oneway-large"]]},"symbol-spacing":200,"icon-padding":2},"paint":{}},{"id":"tunnel-trunk","type":"line","metadata":{"mapbox:group":"1444855769305.6016"},"source":"composite","source-layer":"road","filter":["all",["==","class","trunk"],["==","structure","tunnel"]],"layout":{"line-cap":"round","line-join":"round"},"paint":{"line-width":{"base":1.5,"stops":[[5,0.75],[18,32]]},"line-color":"hsl(46, 77%, 78%)"}},{"id":"tunnel-motorway","metadata":{"mapbox:group":"1444855769305.6016"},"ref":"tunnel-motorway-case","paint":{"line-width":{"base":1.5,"stops":[[5,0.75],[18,32]]},"line-dasharray":[1,0],"line-opacity":1,"line-color":"hsl(26, 100%, 78%)","line-blur":0}},{"id":"tunnel-oneway-arrows-white","type":"symbol","metadata":{"mapbox:group":"1444855769305.6016"},"source":"composite","source-layer":"road","minzoom":16,"filter":["all",["in","class","link","motorway","motorway_link","trunk"],["==","oneway","true"],["==","structure","tunnel"],["!in","type","primary_link","secondary_link","tertiary_link"]],"layout":{"symbol-placement":"line","icon-image":{"base":1,"stops":[[16,"oneway-white-small"],[17,"oneway-white-large"]]},"symbol-spacing":200,"icon-padding":2},"paint":{}},{"id":"ferry","type":"line","source":"composite","source-layer":"road","filter":["==","type","ferry"],"layout":{"line-join":"round"},"paint":{"line-color":{"base":1,"stops":[[15,"hsl(205, 73%, 63%)"],[17,"hsl(230, 73%, 63%)"]]},"line-opacity":1,"line-width":{"base":1.5,"stops":[[14,0.5],[20,1]]},"line-dasharray":{"base":1,"stops":[[12,[1,0]],[13,[12,4]]]}}},{"id":"ferry_auto","type":"line","source":"composite","source-layer":"road","filter":["==","type","ferry_auto"],"layout":{"line-join":"round"},"paint":{"line-color":{"base":1,"stops":[[15,"hsl(205, 73%, 63%)"],[17,"hsl(230, 73%, 63%)"]]},"line-opacity":1,"line-width":{"base":1.5,"stops":[[14,0.5],[20,1]]}}},{"id":"road-path-bg","type":"line","metadata":{"mapbox:group":"1444855786460.0557"},"source":"composite","source-layer":"road","filter":["all",["==","$type","LineString"],["all",["==","class","path"],["!in","structure","bridge","tunnel"],["!in","type","crossing","sidewalk","steps"]]],"layout":{"line-join":"round"},"paint":{"line-width":{"base":1.5,"stops":[[15,2],[18,7]]},"line-dasharray":[1,0],"line-color":"hsl(230, 17%, 82%)","line-blur":0,"line-opacity":{"base":1,"stops":[[14,0],[14.25,0.75]]}}},{"id":"road-steps-bg","type":"line","metadata":{"mapbox:group":"1444855786460.0557"},"source":"composite","source-layer":"road","filter":["all",["==","$type","LineString"],["all",["!in","structure","bridge","tunnel"],["==","type","steps"]]],"layout":{"line-join":"round"},"paint":{"line-width":{"base":1.5,"stops":[[15,2],[17,4.6],[18,7]]},"line-color":"hsl(230, 17%, 82%)","line-dasharray":[1,0],"line-opacity":{"base":1,"stops":[[14,0],[14.25,0.75]]}}},{"id":"road-sidewalk-bg","type":"line","metadata":{"mapbox:group":"1444855786460.0557"},"source":"composite","source-layer":"road","minzoom":16,"filter":["all",["==","$type","LineString"],["all",["!in","structure","bridge","tunnel"],["in","type","crossing","sidewalk"]]],"layout":{"line-join":"round"},"paint":{"line-width":{"base":1.5,"stops":[[15,2],[18,7]]},"line-dasharray":[1,0],"line-color":"hsl(230, 17%, 82%)","line-blur":0,"line-opacity":{"base":1,"stops":[[16,0],[16.25,0.75]]}}},{"id":"turning-features-outline","type":"symbol","metadata":{"mapbox:group":"1444855786460.0557"},"source":"composite","source-layer":"road","minzoom":15,"filter":["in","class","turning_circle","turning_loop"],"layout":{"icon-image":"turning-circle-outline","icon-size":{"base":1.5,"stops":[[14,0.122],[18,0.969],[20,1]]},"icon-allow-overlap":true,"icon-ignore-placement":true,"icon-padding":0,"icon-rotation-alignment":"map"},"paint":{}},{"id":"road-pedestrian-case","type":"line","metadata":{"mapbox:group":"1444855786460.0557"},"source":"composite","source-layer":"road","minzoom":12,"filter":["all",["==","$type","LineString"],["all",["==","class","pedestrian"],["==","structure","none"]]],"layout":{"line-join":"round"},"paint":{"line-width":{"base":1.5,"stops":[[14,2],[18,14.5]]},"line-color":"hsl(230, 24%, 87%)","line-gap-width":0,"line-opacity":{"base":1,"stops":[[13.99,0],[14,1]]}}},{"id":"road-street-low","type":"line","metadata":{"mapbox:group":"1444855786460.0557"},"source":"composite","source-layer":"road","minzoom":11,"filter":["all",["==","$type","LineString"],["all",["==","class","street"],["==","structure","none"]]],"layout":{"line-cap":"round","line-join":"round"},"paint":{"line-width":{"base":1.5,"stops":[[12.5,0.5],[14,2],[18,18]]},"line-color":"hsl(0, 0%, 100%)","line-opacity":{"stops":[[11,0],[11.25,1],[14,1],[14.01,0]]}}},{"id":"road-street_limited-low","type":"line","metadata":{"mapbox:group":"1444855786460.0557"},"source":"composite","source-layer":"road","minzoom":11,"filter":["all",["==","$type","LineString"],["all",["==","class","street_limited"],["==","structure","none"]]],"layout":{"line-cap":"round","line-join":"round"},"paint":{"line-width":{"base":1.5,"stops":[[12.5,0.5],[14,2],[18,18]]},"line-color":"hsl(0, 0%, 100%)","line-opacity":{"stops":[[11,0],[11.25,1],[14,1],[14.01,0]]}}},{"id":"road-service-link-track-case","type":"line","metadata":{"mapbox:group":"1444855786460.0557"},"source":"composite","source-layer":"road","minzoom":14,"filter":["all",["in","class","link","service","track"],["!in","structure","bridge","tunnel"],["!=","type","trunk_link"]],"layout":{"line-cap":"round","line-join":"round"},"paint":{"line-width":{"base":1.5,"stops":[[12,0.75],[20,2]]},"line-color":"hsl(230, 24%, 87%)","line-gap-width":{"base":1.5,"stops":[[14,0.5],[18,12]]}}},{"id":"road-street_limited-case","metadata":{"mapbox:group":"1444855786460.0557"},"ref":"road-street_limited-low","paint":{"line-width":{"base":1.5,"stops":[[12,0.75],[20,2]]},"line-color":"hsl(230, 24%, 87%)","line-gap-width":{"base":1.5,"stops":[[13,0],[14,2],[18,18]]},"line-opacity":{"base":1,"stops":[[13.99,0],[14,1]]}}},{"id":"road-street-case","metadata":{"mapbox:group":"1444855786460.0557"},"ref":"road-street-low","paint":{"line-width":{"base":1.5,"stops":[[12,0.75],[20,2]]},"line-color":"hsl(230, 24%, 87%)","line-gap-width":{"base":1.5,"stops":[[13,0],[14,2],[18,18]]},"line-opacity":{"base":1,"stops":[[13.99,0],[14,1]]}}},{"id":"road-secondary-tertiary-case","type":"line","metadata":{"mapbox:group":"1444855786460.0557"},"source":"composite","source-layer":"road","filter":["all",["in","class","secondary","tertiary"],["!in","structure","bridge","tunnel"]],"layout":{"line-cap":"round","line-join":"round"},"paint":{"line-width":{"base":1.2,"stops":[[10,0.75],[18,2]]},"line-color":"hsl(230, 24%, 87%)","line-gap-width":{"base":1.5,"stops":[[8.5,0.5],[10,0.75],[18,26]]},"line-opacity":{"base":1,"stops":[[9.99,0],[10,1]]}}},{"id":"road-primary-case","type":"line","metadata":{"mapbox:group":"1444855786460.0557"},"source":"composite","source-layer":"road","filter":["all",["==","class","primary"],["!in","structure","bridge","tunnel"]],"layout":{"line-cap":"round","line-join":"round"},"paint":{"line-width":{"base":1.5,"stops":[[10,1],[16,2]]},"line-color":"hsl(230, 24%, 87%)","line-gap-width":{"base":1.5,"stops":[[5,0.75],[18,32]]},"line-opacity":{"base":1,"stops":[[9.99,0],[10,1]]}}},{"id":"road-motorway_link-case","type":"line","metadata":{"mapbox:group":"1444855786460.0557"},"source":"composite","source-layer":"road","minzoom":10,"filter":["all",["==","class","motorway_link"],["!in","structure","bridge","tunnel"]],"layout":{"line-cap":"round","line-join":"round"},"paint":{"line-width":{"base":1.5,"stops":[[12,0.75],[20,2]]},"line-color":"hsl(0, 0%, 100%)","line-gap-width":{"base":1.5,"stops":[[12,0.5],[14,2],[18,18]]},"line-opacity":{"base":1,"stops":[[10.99,0],[11,1]]}}},{"id":"road-trunk_link-case","type":"line","metadata":{"mapbox:group":"1444855786460.0557"},"source":"composite","source-layer":"road","minzoom":11,"filter":["all",["!in","structure","bridge","tunnel"],["==","type","trunk_link"]],"layout":{"line-cap":"round","line-join":"round"},"paint":{"line-width":{"base":1.5,"stops":[[12,0.75],[20,2]]},"line-color":"hsl(0, 0%, 100%)","line-gap-width":{"base":1.5,"stops":[[12,0.5],[14,2],[18,18]]},"line-opacity":{"base":1,"stops":[[10.99,0],[11,1]]}}},{"id":"road-trunk-case","type":"line","metadata":{"mapbox:group":"1444855786460.0557"},"source":"composite","source-layer":"road","filter":["all",["==","class","trunk"],["!in","structure","bridge","tunnel"]],"layout":{"line-cap":"round","line-join":"round"},"paint":{"line-width":{"base":1.5,"stops":[[10,1],[16,2]]},"line-color":"hsl(0, 0%, 100%)","line-gap-width":{"base":1.5,"stops":[[5,0.75],[18,32]]},"line-opacity":{"base":1,"stops":[[6,0],[6.1,1]]}}},{"id":"road-motorway-case","type":"line","metadata":{"mapbox:group":"1444855786460.0557"},"source":"composite","source-layer":"road","filter":["all",["==","class","motorway"],["!in","structure","bridge","tunnel"]],"layout":{"line-cap":"round","line-join":"round"},"paint":{"line-width":{"base":1.5,"stops":[[10,1],[16,2]]},"line-color":"hsl(0, 0%, 100%)","line-gap-width":{"base":1.5,"stops":[[5,0.75],[18,32]]}}},{"id":"road-construction","type":"line","metadata":{"mapbox:group":"1444855786460.0557"},"source":"composite","source-layer":"road","minzoom":14,"filter":["all",["==","$type","LineString"],["all",["==","class","construction"],["==","structure","none"]]],"layout":{"line-join":"miter"},"paint":{"line-width":{"base":1.5,"stops":[[12.5,0.5],[14,2],[18,18]]},"line-color":"hsl(230, 24%, 87%)","line-opacity":{"base":1,"stops":[[13.99,0],[14,1]]},"line-dasharray":{"base":1,"stops":[[14,[0.4,0.8]],[15,[0.3,0.6]],[16,[0.2,0.3]],[17,[0.2,0.25]],[18,[0.15,0.15]]]}}},{"id":"road-sidewalks","metadata":{"mapbox:group":"1444855786460.0557"},"ref":"road-sidewalk-bg","paint":{"line-width":{"base":1.5,"stops":[[15,1],[18,4]]},"line-color":"hsl(0, 0%, 100%)","line-dasharray":{"base":1,"stops":[[14,[1,0]],[15,[1.75,1]],[16,[1,0.75]],[17,[1,0.5]]]},"line-opacity":{"base":1,"stops":[[16,0],[16.25,1]]}}},{"id":"road-path","metadata":{"mapbox:group":"1444855786460.0557"},"ref":"road-path-bg","paint":{"line-width":{"base":1.5,"stops":[[15,1],[18,4]]},"line-color":"hsl(0, 0%, 100%)","line-dasharray":{"base":1,"stops":[[14,[1,0]],[15,[1.75,1]],[16,[1,0.75]],[17,[1,0.5]]]},"line-opacity":{"base":1,"stops":[[14,0],[14.25,1]]}}},{"id":"road-steps","metadata":{"mapbox:group":"1444855786460.0557"},"ref":"road-steps-bg","paint":{"line-width":{"base":1.5,"stops":[[15,1],[16,1.6],[18,6]]},"line-color":"hsl(0, 0%, 100%)","line-dasharray":{"base":1,"stops":[[14,[1,0]],[15,[1.75,1]],[16,[1,0.75]],[17,[0.3,0.3]]]},"line-opacity":{"base":1,"stops":[[14,0],[14.25,1]]}}},{"id":"road-trunk_link","metadata":{"mapbox:group":"1444855786460.0557"},"ref":"road-trunk_link-case","paint":{"line-width":{"base":1.5,"stops":[[12,0.5],[14,2],[18,18]]},"line-color":"hsl(46, 85%, 67%)","line-opacity":1}},{"id":"road-motorway_link","metadata":{"mapbox:group":"1444855786460.0557"},"ref":"road-motorway_link-case","paint":{"line-width":{"base":1.5,"stops":[[12,0.5],[14,2],[18,18]]},"line-color":"hsl(26, 100%, 68%)","line-opacity":1}},{"id":"road-pedestrian","metadata":{"mapbox:group":"1444855786460.0557"},"ref":"road-pedestrian-case","paint":{"line-width":{"base":1.5,"stops":[[14,0.5],[18,12]]},"line-color":"hsl(0, 0%, 100%)","line-opacity":1,"line-dasharray":{"base":1,"stops":[[14,[1,0]],[15,[1.5,0.4]],[16,[1,0.2]]]}}},{"id":"road-pedestrian-polygon-fill","type":"fill","metadata":{"mapbox:group":"1444855786460.0557"},"source":"composite","source-layer":"road","minzoom":12,"filter":["all",["==","$type","Polygon"],["all",["in","class","path","pedestrian"],["==","structure","none"]]],"layout":{},"paint":{"fill-color":{"base":1,"stops":[[16,"hsl(230, 16%, 94%)"],[16.25,"hsl(230, 50%, 98%)"]]},"fill-outline-color":"hsl(230, 26%, 88%)","fill-opacity":1}},{"id":"road-pedestrian-polygon-pattern","metadata":{"mapbox:group":"1444855786460.0557"},"ref":"road-pedestrian-polygon-fill","paint":{"fill-color":"hsl(0, 0%, 100%)","fill-outline-color":"hsl(35, 10%, 83%)","fill-pattern":"pedestrian-polygon","fill-opacity":{"base":1,"stops":[[16,0],[16.25,1]]}}},{"id":"road-service-link-track","metadata":{"mapbox:group":"1444855786460.0557"},"ref":"road-service-link-track-case","paint":{"line-width":{"base":1.5,"stops":[[14,0.5],[18,12]]},"line-color":"hsl(0, 0%, 100%)"}},{"id":"road-street_limited","metadata":{"mapbox:group":"1444855786460.0557"},"ref":"road-street_limited-low","paint":{"line-width":{"base":1.5,"stops":[[12.5,0.5],[14,2],[18,18]]},"line-color":"hsl(35, 14%, 93%)","line-opacity":{"base":1,"stops":[[13.99,0],[14,1]]}}},{"id":"road-street","metadata":{"mapbox:group":"1444855786460.0557"},"ref":"road-street-low","paint":{"line-width":{"base":1.5,"stops":[[12.5,0.5],[14,2],[18,18]]},"line-color":"hsl(0, 0%, 100%)","line-opacity":{"base":1,"stops":[[13.99,0],[14,1]]}}},{"id":"road-secondary-tertiary","metadata":{"mapbox:group":"1444855786460.0557"},"ref":"road-secondary-tertiary-case","paint":{"line-width":{"base":1.5,"stops":[[8.5,0.5],[10,0.75],[18,26]]},"line-color":{"base":1,"stops":[[5,"hsl(35, 32%, 91%)"],[8,"hsl(0, 0%, 100%)"]]},"line-opacity":{"base":1.2,"stops":[[5,0],[5.5,1]]}}},{"id":"road-primary","metadata":{"mapbox:group":"1444855786460.0557"},"ref":"road-primary-case","paint":{"line-width":{"base":1.5,"stops":[[5,0.75],[18,32]]},"line-color":{"base":1,"stops":[[5,"hsl(35, 32%, 91%)"],[7,"hsl(0, 0%, 100%)"]]},"line-opacity":1}},{"id":"road-oneway-arrows-blue-minor","type":"symbol","metadata":{"mapbox:group":"1444855786460.0557"},"source":"composite","source-layer":"road","minzoom":16,"filter":["all",["in","class","link","path","pedestrian","service","track"],["==","oneway","true"],["!in","structure","bridge","tunnel"],["!=","type","trunk_link"]],"layout":{"symbol-placement":"line","icon-image":{"base":1,"stops":[[17,"oneway-small"],[18,"oneway-large"]]},"icon-rotation-alignment":"map","icon-padding":2,"symbol-spacing":200},"paint":{}},{"id":"road-oneway-arrows-blue-major","type":"symbol","metadata":{"mapbox:group":"1444855786460.0557"},"source":"composite","source-layer":"road","minzoom":15,"filter":["all",["in","class","primary","secondary","street","street_limited","tertiary"],["==","oneway","true"],["!in","structure","bridge","tunnel"],["!=","type","trunk_link"]],"layout":{"symbol-placement":"line","icon-image":{"base":1,"stops":[[16,"oneway-small"],[17,"oneway-large"]]},"icon-rotation-alignment":"map","icon-padding":2,"symbol-spacing":200},"paint":{}},{"id":"road-trunk","metadata":{"mapbox:group":"1444855786460.0557"},"ref":"road-trunk-case","paint":{"line-width":{"base":1.5,"stops":[[5,0.75],[18,32]]},"line-color":{"base":1,"stops":[[6,"hsl(0, 0%, 100%)"],[6.1,"hsl(46, 80%, 60%)"],[9,"hsl(46, 85%, 67%)"]]}}},{"id":"road-motorway","metadata":{"mapbox:group":"1444855786460.0557"},"ref":"road-motorway-case","paint":{"line-width":{"base":1.5,"stops":[[5,0.75],[18,32]]},"line-color":{"base":1,"stops":[[8,"hsl(26, 87%, 62%)"],[9,"hsl(26, 100%, 68%)"]]}}},{"id":"road-rail","type":"line","metadata":{"mapbox:group":"1444855786460.0557"},"source":"composite","source-layer":"road","minzoom":13,"filter":["all",["in","class","major_rail","minor_rail"],["!in","structure","bridge","tunnel"]],"layout":{"line-join":"round"},"paint":{"line-color":{"stops":[[13,"hsl(50, 17%, 82%)"],[16,"hsl(230, 10%, 74%)"]]},"line-width":{"base":1.5,"stops":[[14,0.5],[20,1]]}}},{"id":"road-rail-tracks","metadata":{"mapbox:group":"1444855786460.0557"},"ref":"road-rail","paint":{"line-color":{"stops":[[13,"hsl(50, 17%, 82%)"],[16,"hsl(230, 10%, 74%)"]]},"line-width":{"base":1.5,"stops":[[14,4],[20,8]]},"line-dasharray":[0.1,15],"line-opacity":{"base":1,"stops":[[13.75,0],[14,1]]}}},{"id":"road-oneway-arrows-white","type":"symbol","metadata":{"mapbox:group":"1444855786460.0557"},"source":"composite","source-layer":"road","minzoom":16,"filter":["all",["in","class","link","motorway","motorway_link","trunk"],["==","oneway","true"],["!in","structure","bridge","tunnel"],["!in","type","primary_link","secondary_link","tertiary_link"]],"layout":{"symbol-placement":"line","icon-image":{"base":1,"stops":[[16,"oneway-white-small"],[17,"oneway-white-large"]]},"icon-padding":2,"symbol-spacing":200},"paint":{}},{"id":"turning-features","type":"symbol","metadata":{"mapbox:group":"1444855786460.0557"},"source":"composite","source-layer":"road","minzoom":15,"filter":["in","class","turning_circle","turning_loop"],"layout":{"icon-image":"turning-circle","icon-size":{"base":1.5,"stops":[[14,0.095],[18,1]]},"icon-allow-overlap":true,"icon-ignore-placement":true,"icon-padding":0,"icon-rotation-alignment":"map"},"paint":{}},{"id":"bridge-path-bg","type":"line","metadata":{"mapbox:group":"1444855799204.86"},"source":"composite","source-layer":"road","filter":["all",["==","class","path"],["==","structure","bridge"],["!=","type","steps"]],"layout":{"line-cap":"round","line-join":"round"},"paint":{"line-width":{"base":1.5,"stops":[[15,2],[18,7]]},"line-dasharray":[1,0],"line-color":"hsl(230, 17%, 82%)","line-blur":0,"line-opacity":{"base":1,"stops":[[15,0],[15.25,1]]}}},{"id":"bridge-steps-bg","type":"line","metadata":{"mapbox:group":"1444855799204.86"},"source":"composite","source-layer":"road","filter":["all",["==","$type","LineString"],["all",["==","structure","bridge"],["==","type","steps"]]],"layout":{"line-join":"round"},"paint":{"line-width":{"base":1.5,"stops":[[15,2],[17,4.6],[18,7]]},"line-color":"hsl(230, 17%, 82%)","line-dasharray":[1,0],"line-opacity":{"base":1,"stops":[[14,0],[14.25,0.75]]}}},{"id":"bridge-pedestrian-case","type":"line","metadata":{"mapbox:group":"1444855799204.86"},"source":"composite","source-layer":"road","minzoom":13,"filter":["all",["==","$type","LineString"],["all",["==","class","pedestrian"],["==","structure","bridge"]]],"layout":{"line-join":"round"},"paint":{"line-width":{"base":1.5,"stops":[[14,2],[18,14.5]]},"line-color":"hsl(230, 24%, 87%)","line-gap-width":0,"line-opacity":{"base":1,"stops":[[13.99,0],[14,1]]}}},{"id":"bridge-street-low","type":"line","metadata":{"mapbox:group":"1444855799204.86"},"source":"composite","source-layer":"road","minzoom":11,"filter":["all",["==","class","street"],["==","structure","bridge"]],"layout":{"line-cap":"round","line-join":"round"},"paint":{"line-width":{"base":1.5,"stops":[[12.5,0.5],[14,2],[18,18]]},"line-color":"hsl(0, 0%, 100%)","line-opacity":{"stops":[[11.5,0],[12,1],[14,1],[14.01,0]]}}},{"id":"bridge-street_limited-low","type":"line","metadata":{"mapbox:group":"1444855799204.86"},"source":"composite","source-layer":"road","minzoom":11,"filter":["all",["==","class","street_limited"],["==","structure","bridge"]],"layout":{"line-cap":"round","line-join":"round"},"paint":{"line-width":{"base":1.5,"stops":[[12.5,0.5],[14,2],[18,18]]},"line-color":"hsl(0, 0%, 100%)","line-opacity":{"stops":[[11.5,0],[12,1],[14,1],[14.01,0]]}}},{"id":"bridge-service-link-track-case","type":"line","metadata":{"mapbox:group":"1444855799204.86"},"source":"composite","source-layer":"road","minzoom":14,"filter":["all",["in","class","link","service","track"],["==","structure","bridge"],["!=","type","trunk_link"]],"layout":{"line-join":"round"},"paint":{"line-width":{"base":1.5,"stops":[[12,0.75],[20,2]]},"line-color":"hsl(230, 24%, 87%)","line-gap-width":{"base":1.5,"stops":[[14,0.5],[18,12]]}}},{"id":"bridge-street_limited-case","type":"line","metadata":{"mapbox:group":"1444855799204.86"},"source":"composite","source-layer":"road","minzoom":11,"filter":["all",["==","class","street_limited"],["==","structure","bridge"]],"layout":{"line-join":"round"},"paint":{"line-width":{"base":1.5,"stops":[[12,0.75],[20,2]]},"line-color":"hsl(230, 24%, 87%)","line-gap-width":{"base":1.5,"stops":[[13,0],[14,2],[18,18]]}}},{"id":"bridge-street-case","type":"line","metadata":{"mapbox:group":"1444855799204.86"},"source":"composite","source-layer":"road","minzoom":11,"filter":["all",["==","class","street"],["==","structure","bridge"]],"layout":{"line-join":"round"},"paint":{"line-width":{"base":1.5,"stops":[[12,0.75],[20,2]]},"line-color":"hsl(230, 24%, 87%)","line-opacity":{"base":1,"stops":[[13.99,0],[14,1]]},"line-gap-width":{"base":1.5,"stops":[[13,0],[14,2],[18,18]]}}},{"id":"bridge-secondary-tertiary-case","type":"line","metadata":{"mapbox:group":"1444855799204.86"},"source":"composite","source-layer":"road","filter":["all",["in","class","secondary","tertiary"],["==","structure","bridge"]],"layout":{"line-join":"round"},"paint":{"line-width":{"base":1.2,"stops":[[10,0.75],[18,2]]},"line-color":"hsl(230, 24%, 87%)","line-gap-width":{"base":1.5,"stops":[[8.5,0.5],[10,0.75],[18,26]]},"line-translate":[0,0]}},{"id":"bridge-primary-case","type":"line","metadata":{"mapbox:group":"1444855799204.86"},"source":"composite","source-layer":"road","filter":["all",["==","class","primary"],["==","structure","bridge"]],"layout":{"line-join":"round"},"paint":{"line-width":{"base":1.5,"stops":[[10,1],[16,2]]},"line-color":"hsl(230, 24%, 87%)","line-gap-width":{"base":1.5,"stops":[[5,0.75],[18,32]]},"line-translate":[0,0]}},{"id":"bridge-trunk_link-case","type":"line","metadata":{"mapbox:group":"1444855799204.86"},"source":"composite","source-layer":"road","minzoom":13,"filter":["all",["!in","layer",2,3,4,5],["==","structure","bridge"],["==","type","trunk_link"]],"layout":{"line-join":"round"},"paint":{"line-width":{"base":1.5,"stops":[[12,0.75],[20,2]]},"line-color":"hsl(0, 0%, 100%)","line-gap-width":{"base":1.5,"stops":[[12,0.5],[14,2],[18,18]]},"line-opacity":{"base":1,"stops":[[10.99,0],[11,1]]}}},{"id":"bridge-motorway_link-case","type":"line","metadata":{"mapbox:group":"1444855799204.86"},"source":"composite","source-layer":"road","minzoom":13,"filter":["all",["==","class","motorway_link"],["!in","layer",2,3,4,5],["==","structure","bridge"]],"layout":{"line-join":"round"},"paint":{"line-width":{"base":1.5,"stops":[[12,0.75],[20,2]]},"line-color":"hsl(0, 0%, 100%)","line-gap-width":{"base":1.5,"stops":[[12,0.5],[14,2],[18,18]]},"line-opacity":1}},{"id":"bridge-trunk-case","type":"line","metadata":{"mapbox:group":"1444855799204.86"},"source":"composite","source-layer":"road","filter":["all",["==","class","trunk"],["!in","layer",2,3,4,5],["==","structure","bridge"]],"layout":{"line-join":"round"},"paint":{"line-width":{"base":1.5,"stops":[[10,1],[16,2]]},"line-color":"hsl(0, 0%, 100%)","line-gap-width":{"base":1.5,"stops":[[5,0.75],[18,32]]}}},{"id":"bridge-motorway-case","type":"line","metadata":{"mapbox:group":"1444855799204.86"},"source":"composite","source-layer":"road","filter":["all",["==","class","motorway"],["!in","layer",2,3,4,5],["==","structure","bridge"]],"layout":{"line-join":"round"},"paint":{"line-width":{"base":1.5,"stops":[[10,1],[16,2]]},"line-color":"hsl(0, 0%, 100%)","line-gap-width":{"base":1.5,"stops":[[5,0.75],[18,32]]}}},{"id":"bridge-construction","type":"line","metadata":{"mapbox:group":"1444855799204.86"},"source":"composite","source-layer":"road","minzoom":14,"filter":["all",["==","class","construction"],["==","structure","bridge"]],"layout":{"line-join":"miter"},"paint":{"line-width":{"base":1.5,"stops":[[12.5,0.5],[14,2],[18,18]]},"line-color":"hsl(230, 24%, 87%)","line-opacity":{"base":1,"stops":[[13.99,0],[14,1]]},"line-dasharray":{"base":1,"stops":[[14,[0.4,0.8]],[15,[0.3,0.6]],[16,[0.2,0.3]],[17,[0.2,0.25]],[18,[0.15,0.15]]]}}},{"id":"bridge-path","type":"line","metadata":{"mapbox:group":"1444855799204.86"},"source":"composite","source-layer":"road","filter":["all",["==","class","path"],["==","structure","bridge"],["!=","type","steps"]],"layout":{"line-join":"round"},"paint":{"line-width":{"base":1.5,"stops":[[15,1],[18,4]]},"line-color":"hsl(0, 0%, 100%)","line-dasharray":{"base":1,"stops":[[14,[1,0]],[15,[1.75,1]],[16,[1,0.75]],[17,[1,0.5]]]},"line-opacity":{"base":1,"stops":[[14,0],[14.25,1]]}}},{"id":"bridge-steps","metadata":{"mapbox:group":"1444855799204.86"},"ref":"bridge-steps-bg","paint":{"line-width":{"base":1.5,"stops":[[15,1],[16,1.6],[18,6]]},"line-color":"hsl(0, 0%, 100%)","line-dasharray":{"base":1,"stops":[[14,[1,0]],[15,[1.75,1]],[16,[1,0.75]],[17,[0.3,0.3]]]},"line-opacity":{"base":1,"stops":[[14,0],[14.25,1]]}}},{"id":"bridge-trunk_link","type":"line","metadata":{"mapbox:group":"1444855799204.86"},"source":"composite","source-layer":"road","minzoom":13,"filter":["all",["!in","layer",2,3,4,5],["==","structure","bridge"],["==","type","trunk_link"]],"layout":{"line-cap":"round","line-join":"round"},"paint":{"line-width":{"base":1.5,"stops":[[12,0.5],[14,2],[18,18]]},"line-color":"hsl(46, 85%, 67%)"}},{"id":"bridge-motorway_link","type":"line","metadata":{"mapbox:group":"1444855799204.86"},"source":"composite","source-layer":"road","minzoom":13,"filter":["all",["==","class","motorway_link"],["!in","layer",2,3,4,5],["==","structure","bridge"]],"layout":{"line-cap":"round","line-join":"round"},"paint":{"line-width":{"base":1.5,"stops":[[12,0.5],[14,2],[18,18]]},"line-color":"hsl(26, 100%, 68%)"}},{"id":"bridge-pedestrian","metadata":{"mapbox:group":"1444855799204.86"},"ref":"bridge-pedestrian-case","paint":{"line-width":{"base":1.5,"stops":[[14,0.5],[18,12]]},"line-color":"hsl(0, 0%, 100%)","line-opacity":1,"line-dasharray":{"base":1,"stops":[[14,[1,0]],[15,[1.5,0.4]],[16,[1,0.2]]]}}},{"id":"bridge-service-link-track","type":"line","metadata":{"mapbox:group":"1444855799204.86"},"source":"composite","source-layer":"road","minzoom":14,"filter":["all",["in","class","link","service","track"],["==","structure","bridge"],["!=","type","trunk_link"]],"layout":{"line-cap":"round","line-join":"round"},"paint":{"line-width":{"base":1.5,"stops":[[14,0.5],[18,12]]},"line-color":"hsl(0, 0%, 100%)"}},{"id":"bridge-street_limited","metadata":{"mapbox:group":"1444855799204.86"},"ref":"bridge-street_limited-low","paint":{"line-width":{"base":1.5,"stops":[[12.5,0.5],[14,2],[18,18]]},"line-color":"hsl(35, 14%, 93%)","line-opacity":{"base":1,"stops":[[13.99,0],[14,1]]}}},{"id":"bridge-street","metadata":{"mapbox:group":"1444855799204.86"},"ref":"bridge-street-low","paint":{"line-width":{"base":1.5,"stops":[[12.5,0.5],[14,2],[18,18]]},"line-color":"hsl(0, 0%, 100%)","line-opacity":{"base":1,"stops":[[13.99,0],[14,1]]}}},{"id":"bridge-secondary-tertiary","type":"line","metadata":{"mapbox:group":"1444855799204.86"},"source":"composite","source-layer":"road","filter":["all",["==","structure","bridge"],["in","type","secondary","tertiary"]],"layout":{"line-cap":"round","line-join":"round"},"paint":{"line-width":{"base":1.5,"stops":[[8.5,0.5],[10,0.75],[18,26]]},"line-color":"hsl(0, 0%, 100%)","line-opacity":{"base":1.2,"stops":[[5,0],[5.5,1]]}}},{"id":"bridge-primary","type":"line","metadata":{"mapbox:group":"1444855799204.86"},"source":"composite","source-layer":"road","filter":["all",["==","structure","bridge"],["==","type","primary"]],"layout":{"line-cap":"round","line-join":"round"},"paint":{"line-width":{"base":1.5,"stops":[[5,0.75],[18,32]]},"line-color":"hsl(0, 0%, 100%)","line-opacity":1}},{"id":"bridge-oneway-arrows-blue-minor","type":"symbol","metadata":{"mapbox:group":"1444855799204.86"},"source":"composite","source-layer":"road","minzoom":16,"filter":["all",["in","class","link","path","pedestrian","service","track"],["==","oneway","true"],["==","structure","bridge"]],"layout":{"symbol-placement":"line","icon-image":{"base":1,"stops":[[17,"oneway-small"],[18,"oneway-large"]]},"symbol-spacing":200,"icon-rotation-alignment":"map","icon-padding":2},"paint":{}},{"id":"bridge-oneway-arrows-blue-major","type":"symbol","metadata":{"mapbox:group":"1444855799204.86"},"source":"composite","source-layer":"road","minzoom":15,"filter":["all",["in","class","primary","secondary","street","street_limited","tertiary"],["==","oneway","true"],["==","structure","bridge"]],"layout":{"symbol-placement":"line","icon-image":{"base":1,"stops":[[16,"oneway-small"],[17,"oneway-large"]]},"symbol-spacing":200,"icon-rotation-alignment":"map","icon-padding":2},"paint":{}},{"id":"bridge-trunk","type":"line","metadata":{"mapbox:group":"1444855799204.86"},"source":"composite","source-layer":"road","filter":["all",["==","class","trunk"],["!in","layer",2,3,4,5],["==","structure","bridge"]],"layout":{"line-cap":"round","line-join":"round"},"paint":{"line-width":{"base":1.5,"stops":[[5,0.75],[18,32]]},"line-color":"hsl(46, 85%, 67%)"}},{"id":"bridge-motorway","type":"line","metadata":{"mapbox:group":"1444855799204.86"},"source":"composite","source-layer":"road","filter":["all",["==","class","motorway"],["!in","layer",2,3,4,5],["==","structure","bridge"]],"layout":{"line-cap":"round","line-join":"round"},"paint":{"line-width":{"base":1.5,"stops":[[5,0.75],[18,32]]},"line-color":"hsl(26, 100%, 68%)"}},{"id":"bridge-rail","type":"line","metadata":{"mapbox:group":"1444855799204.86"},"source":"composite","source-layer":"road","minzoom":13,"filter":["all",["in","class","major_rail","minor_rail"],["==","structure","bridge"]],"layout":{"line-join":"round"},"paint":{"line-color":{"stops":[[13,"hsl(50, 17%, 82%)"],[16,"hsl(230, 10%, 74%)"]]},"line-width":{"base":1.5,"stops":[[14,0.5],[20,1]]}}},{"id":"bridge-rail-tracks","metadata":{"mapbox:group":"1444855799204.86"},"ref":"bridge-rail","paint":{"line-color":{"stops":[[13,"hsl(50, 17%, 82%)"],[16,"hsl(230, 10%, 74%)"]]},"line-width":{"base":1.5,"stops":[[14,4],[20,8]]},"line-dasharray":[0.1,15],"line-opacity":{"base":1,"stops":[[13.75,0],[20,1]]}}},{"id":"bridge-trunk_link-2-case","type":"line","metadata":{"mapbox:group":"1444855799204.86"},"source":"composite","source-layer":"road","minzoom":13,"filter":["all",[">=","layer",2],["==","structure","bridge"],["==","type","trunk_link"]],"layout":{"line-join":"round"},"paint":{"line-width":{"base":1.5,"stops":[[12,0.75],[20,2]]},"line-color":"hsl(0, 0%, 100%)","line-gap-width":{"base":1.5,"stops":[[12,0.5],[14,2],[18,18]]},"line-opacity":{"base":1,"stops":[[10.99,0],[11,1]]}}},{"id":"bridge-motorway_link-2-case","type":"line","metadata":{"mapbox:group":"1444855799204.86"},"source":"composite","source-layer":"road","minzoom":13,"filter":["all",["==","class","motorway_link"],[">=","layer",2],["==","structure","bridge"]],"layout":{"line-join":"round"},"paint":{"line-width":{"base":1.5,"stops":[[12,0.75],[20,2]]},"line-color":"hsl(0, 0%, 100%)","line-gap-width":{"base":1.5,"stops":[[12,0.5],[14,2],[18,18]]},"line-opacity":1}},{"id":"bridge-trunk-2-case","type":"line","metadata":{"mapbox:group":"1444855799204.86"},"source":"composite","source-layer":"road","filter":["all",["==","class","trunk"],[">=","layer",2],["==","structure","bridge"]],"layout":{"line-join":"round"},"paint":{"line-width":{"base":1.5,"stops":[[10,1],[16,2]]},"line-color":"hsl(0, 0%, 100%)","line-gap-width":{"base":1.5,"stops":[[5,0.75],[18,32]]}}},{"id":"bridge-motorway-2-case","type":"line","metadata":{"mapbox:group":"1444855799204.86"},"source":"composite","source-layer":"road","filter":["all",["==","class","motorway"],[">=","layer",2],["==","structure","bridge"]],"layout":{"line-join":"round"},"paint":{"line-width":{"base":1.5,"stops":[[10,1],[16,2]]},"line-color":"hsl(0, 0%, 100%)","line-gap-width":{"base":1.5,"stops":[[5,0.75],[18,32]]}}},{"id":"bridge-trunk_link-2","type":"line","metadata":{"mapbox:group":"1444855799204.86"},"source":"composite","source-layer":"road","minzoom":13,"filter":["all",[">=","layer",2],["==","structure","bridge"],["==","type","trunk_link"]],"layout":{"line-cap":"round","line-join":"round"},"paint":{"line-width":{"base":1.5,"stops":[[12,0.5],[14,2],[18,18]]},"line-color":"hsl(46, 85%, 67%)"}},{"id":"bridge-motorway_link-2","type":"line","metadata":{"mapbox:group":"1444855799204.86"},"source":"composite","source-layer":"road","minzoom":13,"filter":["all",["==","class","motorway_link"],[">=","layer",2],["==","structure","bridge"]],"layout":{"line-cap":"round","line-join":"round"},"paint":{"line-width":{"base":1.5,"stops":[[12,0.5],[14,2],[18,18]]},"line-color":"hsl(26, 100%, 68%)"}},{"id":"bridge-trunk-2","type":"line","metadata":{"mapbox:group":"1444855799204.86"},"source":"composite","source-layer":"road","filter":["all",["==","class","trunk"],[">=","layer",2],["==","structure","bridge"]],"layout":{"line-cap":"round","line-join":"round"},"paint":{"line-width":{"base":1.5,"stops":[[5,0.75],[18,32]]},"line-color":"hsl(46, 85%, 67%)"}},{"id":"bridge-motorway-2","type":"line","metadata":{"mapbox:group":"1444855799204.86"},"source":"composite","source-layer":"road","filter":["all",["==","class","motorway"],[">=","layer",2],["==","structure","bridge"]],"layout":{"line-cap":"round","line-join":"round"},"paint":{"line-width":{"base":1.5,"stops":[[5,0.75],[18,32]]},"line-color":"hsl(26, 100%, 68%)"}},{"id":"bridge-oneway-arrows-white","type":"symbol","metadata":{"mapbox:group":"1444855799204.86"},"source":"composite","source-layer":"road","minzoom":16,"filter":["all",["in","class","link","motorway","motorway_link","trunk"],["==","oneway","true"],["==","structure","bridge"],["!in","type","primary_link","secondary_link","tertiary_link"]],"layout":{"symbol-placement":"line","icon-image":{"base":1,"stops":[[16,"oneway-white-small"],[17,"oneway-white-large"]]},"symbol-spacing":200,"icon-padding":2},"paint":{}},{"id":"aerialway","type":"line","source":"composite","source-layer":"road","minzoom":13,"filter":["==","class","aerialway"],"layout":{"line-join":"round"},"paint":{"line-color":"hsl(230, 10%, 74%)","line-width":{"base":1.5,"stops":[[14,0.5],[20,1]]}}},{"id":"admin-3-4-boundaries-bg","type":"line","metadata":{"mapbox:group":"1444934295202.7542"},"source":"composite","source-layer":"admin","filter":["all",[">=","admin_level",3],["==","maritime",0]],"layout":{"line-join":"bevel"},"paint":{"line-color":{"base":1,"stops":[[8,"hsl(35, 12%, 89%)"],[16,"hsl(230, 49%, 90%)"]]},"line-width":{"base":1,"stops":[[7,3.75],[12,5.5]]},"line-opacity":{"base":1,"stops":[[7,0],[8,0.75]]},"line-dasharray":[1,0],"line-translate":[0,0],"line-blur":{"base":1,"stops":[[3,0],[8,3]]}}},{"id":"admin-2-boundaries-bg","type":"line","metadata":{"mapbox:group":"1444934295202.7542"},"source":"composite","source-layer":"admin","minzoom":1,"filter":["all",["==","admin_level",2],["==","maritime",0]],"layout":{"line-join":"miter"},"paint":{"line-width":{"base":1,"stops":[[3,3.5],[10,8]]},"line-color":{"base":1,"stops":[[6,"hsl(35, 12%, 89%)"],[8,"hsl(230, 49%, 90%)"]]},"line-opacity":{"base":1,"stops":[[3,0],[4,0.5]]},"line-translate":[0,0],"line-blur":{"base":1,"stops":[[3,0],[10,2]]}}},{"id":"admin-3-4-boundaries","type":"line","metadata":{"mapbox:group":"1444934295202.7542"},"source":"composite","source-layer":"admin","filter":["all",[">=","admin_level",3],["==","maritime",0]],"layout":{"line-join":"round","line-cap":"round"},"paint":{"line-dasharray":{"base":1,"stops":[[6,[2,0]],[7,[2,2,6,2]]]},"line-width":{"base":1,"stops":[[7,0.75],[12,1.5]]},"line-opacity":{"base":1,"stops":[[2,0],[3,1]]},"line-color":{"base":1,"stops":[[3,"hsl(230, 14%, 77%)"],[7,"hsl(230, 8%, 62%)"]]}}},{"id":"admin-2-boundaries","type":"line","metadata":{"mapbox:group":"1444934295202.7542"},"source":"composite","source-layer":"admin","minzoom":1,"filter":["all",["==","admin_level",2],["==","disputed",0],["==","maritime",0]],"layout":{"line-join":"round","line-cap":"round"},"paint":{"line-color":"hsl(230, 8%, 51%)","line-width":{"base":1,"stops":[[3,0.5],[10,2]]}}},{"id":"admin-2-boundaries-dispute","type":"line","metadata":{"mapbox:group":"1444934295202.7542"},"source":"composite","source-layer":"admin","minzoom":1,"filter":["all",["==","admin_level",2],["==","disputed",1],["==","maritime",0]],"layout":{"line-join":"round"},"paint":{"line-dasharray":[1.5,1.5],"line-color":"hsl(230, 8%, 51%)","line-width":{"base":1,"stops":[[3,0.5],[10,2]]}}},{"id":"housenum-label","type":"symbol","source":"composite","source-layer":"housenum_label","minzoom":17,"layout":{"text-field":"{house_num}","text-font":["DIN Offc Pro Italic","Arial Unicode MS Regular"],"text-padding":4,"text-max-width":7,"text-size":9.5},"paint":{"text-color":"hsl(35, 2%, 69%)","text-halo-color":"hsl(35, 8%, 85%)","text-halo-width":0.5,"text-halo-blur":0}},{"id":"waterway-label","type":"symbol","source":"composite","source-layer":"waterway_label","minzoom":12,"filter":["in","class","canal","river"],"layout":{"text-field":"{name_en}","text-font":["DIN Offc Pro Italic","Arial Unicode MS Regular"],"symbol-placement":"line","text-max-angle":30,"text-size":{"base":1,"stops":[[13,12],[18,16]]}},"paint":{"text-halo-width":0.5,"text-halo-color":"hsl(196, 80%, 70%)","text-color":"hsl(230, 48%, 44%)","text-halo-blur":0.5}},{"id":"poi-scalerank4-l15","type":"symbol","metadata":{"mapbox:group":"1444933456003.5437"},"source":"composite","source-layer":"poi_label","minzoom":17,"filter":["all",[">=","localrank",15],["!in","maki","campsite","cemetery","dog-park","garden","golf","park","picnic-site","playground","zoo"],["==","scalerank",4]],"layout":{"text-line-height":1.1,"text-size":{"base":1,"stops":[[16,11],[20,13]]},"icon-image":"{maki}-11","text-max-angle":38,"symbol-spacing":250,"text-font":["DIN Offc Pro Medium","Arial Unicode MS Regular"],"text-padding":2,"text-offset":[0,0.65],"text-rotation-alignment":"viewport","text-anchor":"top","text-field":"{name_en}","text-letter-spacing":0.01,"text-max-width":8},"paint":{"text-color":"hsl(26, 25%, 32%)","text-halo-color":"hsl(0, 0%, 100%)","text-halo-width":0.5,"text-halo-blur":0.5}},{"id":"poi-scalerank4-l1","type":"symbol","metadata":{"mapbox:group":"1444933456003.5437"},"source":"composite","source-layer":"poi_label","minzoom":15,"filter":["all",["<=","localrank",14],["!in","maki","campsite","cemetery","dog-park","garden","golf","park","picnic-site","playground","zoo"],["==","scalerank",4]],"layout":{"text-line-height":1.1,"text-size":{"base":1,"stops":[[16,11],[20,13]]},"icon-image":"{maki}-11","text-max-angle":38,"symbol-spacing":250,"text-font":["DIN Offc Pro Medium","Arial Unicode MS Regular"],"text-padding":1,"text-offset":[0,0.65],"text-rotation-alignment":"viewport","text-anchor":"top","text-field":"{name_en}","text-letter-spacing":0.01,"text-max-width":8},"paint":{"text-color":"hsl(26, 25%, 32%)","text-halo-color":"hsl(0, 0%, 100%)","text-halo-width":0.5,"text-halo-blur":0.5}},{"id":"poi-parks_scalerank4","type":"symbol","metadata":{"mapbox:group":"1444933456003.5437"},"source":"composite","source-layer":"poi_label","minzoom":15,"filter":["all",["in","maki","campsite","cemetery","dog-park","garden","golf","park","picnic-site","playground","zoo"],["==","scalerank",4]],"layout":{"text-line-height":1.1,"text-size":{"base":1,"stops":[[16,11],[20,13]]},"icon-image":"{maki}-11","text-max-angle":38,"symbol-spacing":250,"text-font":["DIN Offc Pro Medium","Arial Unicode MS Regular"],"text-padding":1,"text-offset":[0,0.65],"text-rotation-alignment":"viewport","text-anchor":"top","text-field":"{name_en}","text-letter-spacing":0.01,"text-max-width":8},"paint":{"text-color":"hsl(100, 100%, 20%)","text-halo-color":"hsl(0, 0%, 100%)","text-halo-width":0.5,"text-halo-blur":0.5}},{"id":"poi-scalerank3","type":"symbol","metadata":{"mapbox:group":"1444933372896.5967"},"source":"composite","source-layer":"poi_label","filter":["all",["!in","maki","campsite","cemetery","dog-park","garden","golf","park","picnic-site","playground","zoo"],["==","scalerank",3]],"layout":{"text-line-height":1.1,"text-size":{"base":1,"stops":[[16,11],[20,13]]},"icon-image":"{maki}-11","text-max-angle":38,"symbol-spacing":250,"text-font":["DIN Offc Pro Medium","Arial Unicode MS Regular"],"text-padding":1,"text-offset":[0,0.65],"text-rotation-alignment":"viewport","text-anchor":"top","text-field":"{name_en}","text-letter-spacing":0.01,"text-max-width":8},"paint":{"text-color":"hsl(26, 25%, 32%)","text-halo-color":"hsl(0, 0%, 100%)","text-halo-width":0.5,"text-halo-blur":0.5}},{"id":"poi-parks-scalerank3","type":"symbol","metadata":{"mapbox:group":"1444933372896.5967"},"source":"composite","source-layer":"poi_label","filter":["all",["in","maki","campsite","cemetery","dog-park","garden","golf","park","picnic-site","playground","zoo"],["==","scalerank",3]],"layout":{"text-line-height":1.1,"text-size":{"base":1,"stops":[[16,11],[20,13]]},"icon-image":"{maki}-11","text-max-angle":38,"symbol-spacing":250,"text-font":["DIN Offc Pro Medium","Arial Unicode MS Regular"],"text-padding":2,"text-offset":[0,0.65],"text-rotation-alignment":"viewport","text-anchor":"top","text-field":"{name_en}","text-letter-spacing":0.01,"text-max-width":8},"paint":{"text-color":"hsl(100, 100%, 20%)","text-halo-color":"hsl(0, 0%, 100%)","text-halo-width":0.5,"text-halo-blur":0.5}},{"id":"road-label-small","type":"symbol","metadata":{"mapbox:group":"1444933721429.3076"},"source":"composite","source-layer":"road_label","minzoom":15,"filter":["all",["==","$type","LineString"],["!in","class","link","motorway","pedestrian","primary","secondary","street","street_limited","tertiary","trunk"]],"layout":{"text-size":{"base":1,"stops":[[15,10],[20,13]]},"text-max-angle":30,"symbol-spacing":250,"text-font":["DIN Offc Pro Regular","Arial Unicode MS Regular"],"symbol-placement":"line","text-padding":1,"text-rotation-alignment":"map","text-field":"{name_en}","text-letter-spacing":0.01},"paint":{"text-color":"hsl(0, 0%, 0%)","text-halo-color":"hsl(0, 0%, 100%)","text-halo-width":1.25,"text-halo-blur":1}},{"id":"road-label-medium","type":"symbol","metadata":{"mapbox:group":"1444933721429.3076"},"source":"composite","source-layer":"road_label","minzoom":11,"filter":["all",["==","$type","LineString"],["in","class","link","pedestrian","street","street_limited"]],"layout":{"text-size":{"base":1,"stops":[[11,10],[20,14]]},"text-max-angle":30,"symbol-spacing":250,"text-font":["DIN Offc Pro Regular","Arial Unicode MS Regular"],"symbol-placement":"line","text-padding":1,"text-rotation-alignment":"map","text-field":"{name_en}","text-letter-spacing":0.01},"paint":{"text-color":"hsl(0, 0%, 0%)","text-halo-color":"hsl(0, 0%, 100%)","text-halo-width":1}},{"id":"road-label-large","type":"symbol","metadata":{"mapbox:group":"1444933721429.3076"},"source":"composite","source-layer":"road_label","filter":["in","class","motorway","primary","secondary","tertiary","trunk"],"layout":{"text-size":{"base":1,"stops":[[9,10],[20,16]]},"text-max-angle":30,"symbol-spacing":250,"text-font":["DIN Offc Pro Regular","Arial Unicode MS Regular"],"symbol-placement":"line","text-padding":1,"text-rotation-alignment":"map","text-field":"{name_en}","text-letter-spacing":0.01},"paint":{"text-color":"hsl(0, 0%, 0%)","text-halo-color":"hsla(0, 0%, 100%, 0.75)","text-halo-width":1,"text-halo-blur":1}},{"id":"road-shields-black","type":"symbol","metadata":{"mapbox:group":"1444933575858.6992"},"source":"composite","source-layer":"road_label","filter":["all",["<=","reflen",6],["!in","shield","at-expressway","at-motorway","at-state-b","bg-motorway","bg-national","ch-main","ch-motorway","cz-motorway","cz-road","de-motorway","e-road","fi-main","gr-motorway","gr-national","hr-motorway","hr-state","hu-main","hu-motorway","nz-state","pl-expressway","pl-motorway","pl-national","ro-county","ro-motorway","ro-national","rs-motorway","rs-state-1b","se-main","si-expressway","si-motorway","sk-highway","sk-road","us-interstate","us-interstate-business","us-interstate-duplex","us-interstate-truck","za-metropolitan","za-national","za-provincial","za-regional"]],"layout":{"text-size":9,"icon-image":"{shield}-{reflen}","icon-rotation-alignment":"viewport","text-max-angle":38,"symbol-spacing":{"base":1,"stops":[[11,150],[14,200]]},"text-font":["DIN Offc Pro Bold","Arial Unicode MS Bold"],"symbol-placement":{"base":1,"stops":[[10,"point"],[11,"line"]]},"text-padding":2,"text-rotation-alignment":"viewport","text-field":"{ref}","text-letter-spacing":0.05,"icon-padding":2},"paint":{"text-color":"hsl(0, 0%, 7%)","icon-halo-color":"rgba(0, 0, 0, 1)","icon-halo-width":1,"text-opacity":1,"icon-color":"white","text-halo-color":"hsl(0, 0%, 100%)","text-halo-width":0}},{"id":"road-shields-white","type":"symbol","metadata":{"mapbox:group":"1444933575858.6992"},"source":"composite","source-layer":"road_label","filter":["all",["<=","reflen",6],["in","shield","at-expressway","at-motorway","at-state-b","bg-motorway","bg-national","ch-main","ch-motorway","cz-motorway","cz-road","de-motorway","e-road","fi-main","gr-motorway","gr-national","hr-motorway","hr-state","hu-main","hu-motorway","nz-state","pl-expressway","pl-motorway","pl-national","ro-county","ro-motorway","ro-national","rs-motorway","rs-state-1b","se-main","si-expressway","si-motorway","sk-highway","sk-road","us-interstate","us-interstate-business","us-interstate-duplex","us-interstate-truck","za-metropolitan","za-national","za-provincial","za-regional"]],"layout":{"text-size":9,"icon-image":"{shield}-{reflen}","icon-rotation-alignment":"viewport","text-max-angle":38,"symbol-spacing":{"base":1,"stops":[[11,150],[14,200]]},"text-font":["DIN Offc Pro Bold","Arial Unicode MS Bold"],"symbol-placement":{"base":1,"stops":[[10,"point"],[11,"line"]]},"text-padding":2,"text-rotation-alignment":"viewport","text-field":"{ref}","text-letter-spacing":0.05,"icon-padding":2},"paint":{"text-color":"hsl(0, 0%, 100%)","icon-halo-color":"rgba(0, 0, 0, 1)","icon-halo-width":1,"text-opacity":1,"icon-color":"white","text-halo-color":"hsl(0, 0%, 100%)","text-halo-width":0}},{"id":"motorway-junction","type":"symbol","metadata":{"mapbox:group":"1444933575858.6992"},"source":"composite","source-layer":"motorway_junction","minzoom":14,"filter":[">","reflen",0],"layout":{"text-field":"{ref}","text-size":9,"icon-image":"motorway-exit-{reflen}","text-font":["DIN Offc Pro Bold","Arial Unicode MS Bold"]},"paint":{"text-color":"hsl(0, 0%, 100%)","text-translate":[0,0]}},{"id":"poi-scalerank2","type":"symbol","metadata":{"mapbox:group":"1444933358918.2366"},"source":"composite","source-layer":"poi_label","filter":["all",["!in","maki","campsite","cemetery","dog-park","garden","golf","park","picnic-site","playground","zoo"],["==","scalerank",2]],"layout":{"text-line-height":1.1,"text-size":{"base":1,"stops":[[14,11],[20,14]]},"icon-image":{"stops":[[14,"{maki}-11"],[15,"{maki}-15"]]},"text-max-angle":38,"symbol-spacing":250,"text-font":["DIN Offc Pro Medium","Arial Unicode MS Regular"],"text-padding":2,"text-offset":[0,0.65],"text-rotation-alignment":"viewport","text-anchor":"top","text-field":"{name_en}","text-letter-spacing":0.01,"text-max-width":8},"paint":{"text-color":"hsl(26, 25%, 32%)","text-halo-color":"hsl(0, 0%, 100%)","text-halo-width":0.5,"text-halo-blur":0.5}},{"id":"poi-parks-scalerank2","type":"symbol","metadata":{"mapbox:group":"1444933358918.2366"},"source":"composite","source-layer":"poi_label","filter":["all",["in","maki","campsite","cemetery","dog-park","garden","golf","park","picnic-site","playground","zoo"],["==","scalerank",2]],"layout":{"text-line-height":1.1,"text-size":{"base":1,"stops":[[14,11],[20,14]]},"icon-image":{"stops":[[14,"{maki}-11"],[15,"{maki}-15"]]},"text-max-angle":38,"symbol-spacing":250,"text-font":["DIN Offc Pro Medium","Arial Unicode MS Regular"],"text-padding":2,"text-offset":[0,0.65],"text-rotation-alignment":"viewport","text-anchor":"top","text-field":"{name_en}","text-letter-spacing":0.01,"text-max-width":8},"paint":{"text-color":"hsl(100, 100%, 20%)","text-halo-color":"hsl(0, 0%, 100%)","text-halo-width":0.5,"text-halo-blur":0.5}},{"id":"rail-label","type":"symbol","source":"composite","source-layer":"rail_station_label","minzoom":12,"filter":["!=","maki","entrance"],"layout":{"text-line-height":1.1,"text-size":{"base":1,"stops":[[16,11],[20,13]]},"icon-image":"{network}","symbol-spacing":250,"text-font":["DIN Offc Pro Medium","Arial Unicode MS Regular"],"text-offset":[0,0.85],"text-rotation-alignment":"viewport","text-anchor":"top","text-field":{"base":1,"stops":[[0,""],[13,"{name_en}"]]},"text-letter-spacing":0.01,"icon-padding":0,"text-max-width":7},"paint":{"text-color":"hsl(230, 48%, 44%)","text-halo-color":"hsl(0, 0%, 100%)","text-halo-width":0.5,"icon-halo-width":4,"icon-halo-color":"#fff","text-opacity":{"base":1,"stops":[[13.99,0],[14,1]]},"text-halo-blur":0.5}},{"id":"water-label-sm","type":"symbol","metadata":{"mapbox:group":"1444933808272.805"},"source":"composite","source-layer":"water_label","minzoom":15,"filter":["<=","area",10000],"layout":{"text-field":"{name_en}","text-font":["DIN Offc Pro Italic","Arial Unicode MS Regular"],"text-max-width":7,"text-size":{"base":1,"stops":[[16,13],[20,16]]}},"paint":{"text-color":"hsl(230, 48%, 44%)"}},{"id":"water-label","type":"symbol","metadata":{"mapbox:group":"1444933808272.805"},"source":"composite","source-layer":"water_label","minzoom":5,"filter":[">","area",10000],"layout":{"text-field":"{name_en}","text-font":["DIN Offc Pro Italic","Arial Unicode MS Regular"],"text-max-width":7,"text-size":{"base":1,"stops":[[13,13],[18,18]]}},"paint":{"text-color":"hsl(230, 48%, 44%)"}},{"id":"place-residential","type":"symbol","source":"composite","source-layer":"place_label","minzoom":16,"maxzoom":18,"filter":["all",["<=","localrank",10],["==","type","residential"]],"layout":{"text-line-height":1.2,"text-size":{"base":1,"stops":[[10,11],[18,14]]},"text-max-angle":38,"symbol-spacing":250,"text-font":["DIN Offc Pro Regular","Arial Unicode MS Regular"],"text-padding":2,"visibility":"none","text-offset":[0,0],"text-rotation-alignment":"viewport","text-field":"{name_en}","text-max-width":7},"paint":{"text-color":"hsl(26, 25%, 32%)","text-halo-color":"hsl(0, 0%, 100%)","text-halo-width":1,"text-halo-blur":0.5}},{"id":"poi-parks-scalerank1","type":"symbol","metadata":{"mapbox:group":"1444933322393.2852"},"source":"composite","source-layer":"poi_label","filter":["all",["in","maki","campsite","cemetery","dog-park","garden","golf","park","picnic-site","playground","zoo"],["<=","scalerank",1]],"layout":{"text-line-height":1.1,"text-size":{"base":1,"stops":[[10,11],[18,14]]},"icon-image":{"stops":[[13,"{maki}-11"],[14,"{maki}-15"]]},"text-max-angle":38,"symbol-spacing":250,"text-font":["DIN Offc Pro Medium","Arial Unicode MS Regular"],"text-padding":2,"text-offset":[0,0.65],"text-rotation-alignment":"viewport","text-anchor":"top","text-field":"{name_en}","text-letter-spacing":0.01,"text-max-width":8},"paint":{"text-color":"hsl(100, 100%, 20%)","text-halo-color":"hsl(0, 0%, 100%)","text-halo-width":0.5,"text-halo-blur":0.5}},{"id":"poi-scalerank1","type":"symbol","metadata":{"mapbox:group":"1444933322393.2852"},"source":"composite","source-layer":"poi_label","filter":["all",["!in","maki","campsite","cemetery","dog-park","garden","golf","park","picnic-site","playground","zoo"],["<=","scalerank",1]],"layout":{"text-line-height":1.1,"text-size":{"base":1,"stops":[[10,11],[18,14]]},"icon-image":{"stops":[[13,"{maki}-11"],[14,"{maki}-15"]]},"text-max-angle":38,"symbol-spacing":250,"text-font":["DIN Offc Pro Medium","Arial Unicode MS Regular"],"text-padding":2,"text-offset":[0,0.65],"text-rotation-alignment":"viewport","text-anchor":"top","text-field":"{name_en}","text-letter-spacing":0.01,"text-max-width":8},"paint":{"text-color":"hsl(26, 25%, 32%)","text-halo-color":"hsl(0, 0%, 100%)","text-halo-width":0.5,"text-halo-blur":0.5}},{"id":"airport-label","type":"symbol","source":"composite","source-layer":"airport_label","minzoom":9,"filter":["<=","scalerank",2],"layout":{"text-line-height":1.1,"text-size":{"base":1,"stops":[[10,12],[18,18]]},"icon-image":{"stops":[[12,"{maki}-11"],[13,"{maki}-15"]]},"symbol-spacing":250,"text-font":["DIN Offc Pro Medium","Arial Unicode MS Regular"],"text-padding":2,"text-offset":[0,0.75],"text-rotation-alignment":"viewport","text-anchor":"top","text-field":{"stops":[[11,"{ref}"],[12,"{name_en}"]]},"text-letter-spacing":0.01,"text-max-width":9},"paint":{"text-color":"hsl(230, 48%, 44%)","text-halo-color":"hsl(0, 0%, 100%)","text-halo-width":0.5,"text-halo-blur":0.5}},{"id":"place-islet-archipelago-aboriginal","type":"symbol","source":"composite","source-layer":"place_label","maxzoom":16,"filter":["in","type","aboriginal_lands","archipelago","islet"],"layout":{"text-line-height":1.2,"text-size":{"base":1,"stops":[[10,11],[18,16]]},"text-max-angle":38,"symbol-spacing":250,"text-font":["DIN Offc Pro Regular","Arial Unicode MS Regular"],"text-padding":2,"text-offset":[0,0],"text-rotation-alignment":"viewport","text-field":"{name_en}","text-letter-spacing":0.01,"text-max-width":8},"paint":{"text-color":"hsl(230, 29%, 35%)","text-halo-color":"hsl(0, 0%, 100%)","text-halo-width":1}},{"id":"place-neighbourhood","type":"symbol","source":"composite","source-layer":"place_label","minzoom":10,"maxzoom":16,"filter":["==","type","neighbourhood"],"layout":{"text-field":"{name_en}","text-transform":"uppercase","text-letter-spacing":0.1,"text-max-width":7,"text-font":["DIN Offc Pro Regular","Arial Unicode MS Regular"],"text-padding":3,"text-size":{"base":1,"stops":[[12,11],[16,16]]}},"paint":{"text-halo-color":"hsl(0, 0%, 100%)","text-halo-width":1,"text-color":"hsl(230, 29%, 35%)","text-halo-blur":0.5}},{"id":"place-suburb","type":"symbol","source":"composite","source-layer":"place_label","minzoom":10,"maxzoom":16,"filter":["==","type","suburb"],"layout":{"text-field":"{name_en}","text-transform":"uppercase","text-font":["DIN Offc Pro Regular","Arial Unicode MS Regular"],"text-letter-spacing":0.15,"text-max-width":7,"text-padding":3,"text-size":{"base":1,"stops":[[11,11],[15,18]]}},"paint":{"text-halo-color":"hsl(0, 0%, 100%)","text-halo-width":1,"text-color":"hsl(230, 29%, 35%)","text-halo-blur":0.5}},{"id":"place-hamlet","type":"symbol","source":"composite","source-layer":"place_label","minzoom":10,"maxzoom":16,"filter":["==","type","hamlet"],"layout":{"text-field":"{name_en}","text-font":["DIN Offc Pro Regular","Arial Unicode MS Regular"],"text-size":{"base":1,"stops":[[12,11.5],[15,16]]}},"paint":{"text-halo-color":"hsl(0, 0%, 100%)","text-halo-width":1.25,"text-color":"hsl(0, 0%, 0%)"}},{"id":"place-village","type":"symbol","source":"composite","source-layer":"place_label","minzoom":8,"maxzoom":15,"filter":["==","type","village"],"layout":{"text-field":"{name_en}","text-font":["DIN Offc Pro Regular","Arial Unicode MS Regular"],"text-max-width":7,"text-size":{"base":1,"stops":[[10,11.5],[16,18]]}},"paint":{"text-halo-color":"hsl(0, 0%, 100%)","text-halo-width":1.25,"text-color":"hsl(0, 0%, 0%)"}},{"id":"place-town","type":"symbol","source":"composite","source-layer":"place_label","minzoom":6,"maxzoom":15,"filter":["==","type","town"],"layout":{"icon-image":"dot-9","text-font":{"base":1,"stops":[[11,["DIN Offc Pro Regular","Arial Unicode MS Regular"]],[12,["DIN Offc Pro Medium","Arial Unicode MS Regular"]]]},"text-offset":{"base":1,"stops":[[7,[0,-0.15]],[8,[0,0]]]},"text-anchor":{"base":1,"stops":[[7,"bottom"],[8,"center"]]},"text-field":"{name_en}","text-max-width":7,"text-size":{"base":1,"stops":[[7,11.5],[15,20]]}},"paint":{"text-color":"hsl(0, 0%, 0%)","text-halo-color":"hsl(0, 0%, 100%)","text-halo-width":1.25,"icon-opacity":{"base":1,"stops":[[7.99,1],[8,0]]}}},{"id":"place-island","type":"symbol","source":"composite","source-layer":"place_label","maxzoom":16,"filter":["==","type","island"],"layout":{"text-line-height":1.2,"text-size":{"base":1,"stops":[[10,11],[18,16]]},"text-max-angle":38,"symbol-spacing":250,"text-font":["DIN Offc Pro Regular","Arial Unicode MS Regular"],"text-padding":2,"text-offset":[0,0],"text-rotation-alignment":"viewport","text-field":"{name_en}","text-letter-spacing":0.01,"text-max-width":7},"paint":{"text-color":"hsl(230, 29%, 35%)","text-halo-color":"hsl(0, 0%, 100%)","text-halo-width":1}},{"id":"place-city-sm","type":"symbol","metadata":{"mapbox:group":"1444862510685.128"},"source":"composite","source-layer":"place_label","maxzoom":14,"filter":["all",["!in","scalerank",0,1,2,3,4,5],["==","type","city"]],"layout":{"text-size":{"base":1,"stops":[[6,12],[14,22]]},"icon-image":"dot-9","text-font":{"base":1,"stops":[[7,["DIN Offc Pro Regular","Arial Unicode MS Regular"]],[8,["DIN Offc Pro Medium","Arial Unicode MS Regular"]]]},"text-offset":{"base":1,"stops":[[7.99,[0,-0.2]],[8,[0,0]]]},"text-anchor":{"base":1,"stops":[[7,"bottom"],[8,"center"]]},"text-field":"{name_en}","text-max-width":7},"paint":{"text-color":"hsl(0, 0%, 0%)","text-halo-color":"hsl(0, 0%, 100%)","text-halo-width":1.25,"icon-opacity":{"base":1,"stops":[[7.99,1],[8,0]]}}},{"id":"place-city-md-s","type":"symbol","metadata":{"mapbox:group":"1444862510685.128"},"source":"composite","source-layer":"place_label","maxzoom":14,"filter":["all",["in","ldir","E","S","SE","SW"],["in","scalerank",3,4,5],["==","type","city"]],"layout":{"text-field":"{name_en}","icon-image":"dot-10","text-anchor":{"base":1,"stops":[[7,"top"],[8,"center"]]},"text-offset":{"base":1,"stops":[[7.99,[0,0.1]],[8,[0,0]]]},"text-font":{"base":1,"stops":[[7,["DIN Offc Pro Regular","Arial Unicode MS Regular"]],[8,["DIN Offc Pro Medium","Arial Unicode MS Regular"]]]},"text-size":{"base":0.9,"stops":[[5,12],[12,22]]}},"paint":{"text-halo-width":1,"text-halo-color":"hsl(0, 0%, 100%)","text-color":"hsl(0, 0%, 0%)","text-halo-blur":1,"icon-opacity":{"base":1,"stops":[[7.99,1],[8,0]]}}},{"id":"place-city-md-n","type":"symbol","metadata":{"mapbox:group":"1444862510685.128"},"source":"composite","source-layer":"place_label","maxzoom":14,"filter":["all",["in","ldir","N","NE","NW","W"],["in","scalerank",3,4,5],["==","type","city"]],"layout":{"icon-image":"dot-10","text-font":{"base":1,"stops":[[7,["DIN Offc Pro Regular","Arial Unicode MS Regular"]],[8,["DIN Offc Pro Medium","Arial Unicode MS Regular"]]]},"text-offset":{"base":1,"stops":[[7.99,[0,-0.25]],[8,[0,0]]]},"text-anchor":{"base":1,"stops":[[7,"bottom"],[8,"center"]]},"text-field":"{name_en}","text-max-width":7,"text-size":{"base":0.9,"stops":[[5,12],[12,22]]}},"paint":{"text-color":"hsl(0, 0%, 0%)","text-halo-color":"hsl(0, 0%, 100%)","text-halo-width":1,"icon-opacity":{"base":1,"stops":[[7.99,1],[8,0]]},"text-halo-blur":1}},{"id":"place-city-lg-s","type":"symbol","metadata":{"mapbox:group":"1444862510685.128"},"source":"composite","source-layer":"place_label","minzoom":1,"maxzoom":14,"filter":["all",["in","ldir","E","S","SE","SW"],["<=","scalerank",2],["==","type","city"]],"layout":{"icon-image":"dot-11","text-font":{"base":1,"stops":[[7,["DIN Offc Pro Regular","Arial Unicode MS Regular"]],[8,["DIN Offc Pro Medium","Arial Unicode MS Regular"]]]},"text-offset":{"base":1,"stops":[[7.99,[0,0.15]],[8,[0,0]]]},"text-anchor":{"base":1,"stops":[[7,"top"],[8,"center"]]},"text-field":"{name_en}","text-max-width":7,"text-size":{"base":0.9,"stops":[[4,12],[10,22]]}},"paint":{"text-color":"hsl(0, 0%, 0%)","text-halo-color":"hsl(0, 0%, 100%)","text-halo-width":1,"icon-opacity":{"base":1,"stops":[[7.99,1],[8,0]]},"text-halo-blur":1}},{"id":"place-city-lg-n","type":"symbol","metadata":{"mapbox:group":"1444862510685.128"},"source":"composite","source-layer":"place_label","minzoom":1,"maxzoom":14,"filter":["all",["in","ldir","N","NE","NW","W"],["<=","scalerank",2],["==","type","city"]],"layout":{"icon-image":"dot-11","text-font":{"base":1,"stops":[[7,["DIN Offc Pro Regular","Arial Unicode MS Regular"]],[8,["DIN Offc Pro Medium","Arial Unicode MS Regular"]]]},"text-offset":{"base":1,"stops":[[7.99,[0,-0.25]],[8,[0,0]]]},"text-anchor":{"base":1,"stops":[[7,"bottom"],[8,"center"]]},"text-field":"{name_en}","text-max-width":7,"text-size":{"base":0.9,"stops":[[4,12],[10,22]]}},"paint":{"text-color":"hsl(0, 0%, 0%)","text-opacity":1,"text-halo-color":"hsl(0, 0%, 100%)","text-halo-width":1,"icon-opacity":{"base":1,"stops":[[7.99,1],[8,0]]},"text-halo-blur":1}},{"id":"marine-label-sm-ln","type":"symbol","metadata":{"mapbox:group":"1444856087950.3635"},"source":"composite","source-layer":"marine_label","minzoom":3,"maxzoom":10,"filter":["all",["==","$type","LineString"],[">=","labelrank",4]],"layout":{"text-line-height":1.1,"text-size":{"base":1,"stops":[[3,12],[6,16]]},"symbol-spacing":{"base":1,"stops":[[4,100],[6,400]]},"text-font":["DIN Offc Pro Italic","Arial Unicode MS Regular"],"symbol-placement":"line","text-field":"{name_en}","text-letter-spacing":0.1,"text-max-width":5},"paint":{"text-color":"hsl(205, 83%, 88%)"}},{"id":"marine-label-sm-pt","type":"symbol","metadata":{"mapbox:group":"1444856087950.3635"},"source":"composite","source-layer":"marine_label","minzoom":3,"maxzoom":10,"filter":["all",["==","$type","Point"],[">=","labelrank",4]],"layout":{"text-field":"{name_en}","text-max-width":5,"text-letter-spacing":0.1,"text-line-height":1.5,"text-font":["DIN Offc Pro Italic","Arial Unicode MS Regular"],"text-size":{"base":1,"stops":[[3,12],[6,16]]}},"paint":{"text-color":"hsl(205, 83%, 88%)"}},{"id":"marine-label-md-ln","type":"symbol","metadata":{"mapbox:group":"1444856087950.3635"},"source":"composite","source-layer":"marine_label","minzoom":2,"maxzoom":8,"filter":["all",["==","$type","LineString"],["in","labelrank",2,3]],"layout":{"text-line-height":1.1,"text-size":{"base":1.1,"stops":[[2,12],[5,20]]},"symbol-spacing":250,"text-font":["DIN Offc Pro Italic","Arial Unicode MS Regular"],"symbol-placement":"line","text-field":"{name_en}","text-letter-spacing":0.15,"text-max-width":5},"paint":{"text-color":"hsl(205, 83%, 88%)"}},{"id":"marine-label-md-pt","type":"symbol","metadata":{"mapbox:group":"1444856087950.3635"},"source":"composite","source-layer":"marine_label","minzoom":2,"maxzoom":8,"filter":["all",["==","$type","Point"],["in","labelrank",2,3]],"layout":{"text-field":"{name_en}","text-max-width":5,"text-letter-spacing":0.15,"text-line-height":1.5,"text-font":["DIN Offc Pro Italic","Arial Unicode MS Regular"],"text-size":{"base":1.1,"stops":[[2,14],[5,20]]}},"paint":{"text-color":"hsl(205, 83%, 88%)"}},{"id":"marine-label-lg-ln","type":"symbol","metadata":{"mapbox:group":"1444856087950.3635"},"source":"composite","source-layer":"marine_label","minzoom":1,"maxzoom":4,"filter":["all",["==","$type","LineString"],["==","labelrank",1]],"layout":{"text-field":"{name_en}","text-max-width":4,"text-letter-spacing":0.25,"text-line-height":1.1,"symbol-placement":"line","text-font":["DIN Offc Pro Italic","Arial Unicode MS Regular"],"text-size":{"base":1,"stops":[[1,14],[4,30]]}},"paint":{"text-color":"hsl(205, 83%, 88%)"}},{"id":"marine-label-lg-pt","type":"symbol","metadata":{"mapbox:group":"1444856087950.3635"},"source":"composite","source-layer":"marine_label","minzoom":1,"maxzoom":4,"filter":["all",["==","$type","Point"],["==","labelrank",1]],"layout":{"text-field":"{name_en}","text-max-width":4,"text-letter-spacing":0.25,"text-line-height":1.5,"text-font":["DIN Offc Pro Italic","Arial Unicode MS Regular"],"text-size":{"base":1,"stops":[[1,14],[4,30]]}},"paint":{"text-color":"hsl(205, 83%, 88%)"}},{"id":"state-label-sm","type":"symbol","metadata":{"mapbox:group":"1444856151690.9143"},"source":"composite","source-layer":"state_label","minzoom":3,"maxzoom":9,"filter":["<","area",20000],"layout":{"text-size":{"base":1,"stops":[[6,10],[9,14]]},"text-transform":"uppercase","text-font":["DIN Offc Pro Bold","Arial Unicode MS Bold"],"text-field":{"base":1,"stops":[[0,"{abbr}"],[6,"{name_en}"]]},"text-letter-spacing":0.15,"text-max-width":5},"paint":{"text-opacity":1,"text-color":"hsl(0, 0%, 0%)","text-halo-color":"hsl(0, 0%, 100%)","text-halo-width":1}},{"id":"state-label-md","type":"symbol","metadata":{"mapbox:group":"1444856151690.9143"},"source":"composite","source-layer":"state_label","minzoom":3,"maxzoom":8,"filter":["all",["<","area",80000],[">=","area",20000]],"layout":{"text-size":{"base":1,"stops":[[5,10],[8,16]]},"text-transform":"uppercase","text-font":["DIN Offc Pro Bold","Arial Unicode MS Bold"],"text-field":{"base":1,"stops":[[0,"{abbr}"],[5,"{name_en}"]]},"text-letter-spacing":0.15,"text-max-width":6},"paint":{"text-opacity":1,"text-color":"hsl(0, 0%, 0%)","text-halo-color":"hsl(0, 0%, 100%)","text-halo-width":1}},{"id":"state-label-lg","type":"symbol","metadata":{"mapbox:group":"1444856151690.9143"},"source":"composite","source-layer":"state_label","minzoom":3,"maxzoom":7,"filter":[">=","area",80000],"layout":{"text-size":{"base":1,"stops":[[4,10],[7,18]]},"text-transform":"uppercase","text-font":["DIN Offc Pro Bold","Arial Unicode MS Bold"],"text-padding":1,"text-field":{"base":1,"stops":[[0,"{abbr}"],[4,"{name_en}"]]},"text-letter-spacing":0.15,"text-max-width":6},"paint":{"text-opacity":1,"text-color":"hsl(0, 0%, 0%)","text-halo-color":"hsl(0, 0%, 100%)","text-halo-width":1}},{"id":"country-label-sm","type":"symbol","metadata":{"mapbox:group":"1444856144497.7825"},"source":"composite","source-layer":"country_label","minzoom":1,"maxzoom":10,"filter":[">=","scalerank",5],"layout":{"text-field":"{name_en}","text-max-width":6,"text-font":["DIN Offc Pro Medium","Arial Unicode MS Regular"],"text-size":{"base":0.9,"stops":[[5,14],[9,22]]}},"paint":{"text-color":"hsl(0, 0%, 0%)","text-halo-color":{"base":1,"stops":[[2,"rgba(255,255,255,0.75)"],[3,"hsl(0, 0%, 100%)"]]},"text-halo-width":1.25}},{"id":"country-label-md","type":"symbol","metadata":{"mapbox:group":"1444856144497.7825"},"source":"composite","source-layer":"country_label","minzoom":1,"maxzoom":8,"filter":["in","scalerank",3,4],"layout":{"text-field":{"base":1,"stops":[[0,"{code}"],[2,"{name_en}"]]},"text-max-width":6,"text-font":["DIN Offc Pro Medium","Arial Unicode MS Regular"],"text-size":{"base":1,"stops":[[3,10],[8,24]]}},"paint":{"text-color":"hsl(0, 0%, 0%)","text-halo-color":{"base":1,"stops":[[2,"rgba(255,255,255,0.75)"],[3,"hsl(0, 0%, 100%)"]]},"text-halo-width":1.25}},{"id":"country-label-lg","type":"symbol","metadata":{"mapbox:group":"1444856144497.7825"},"source":"composite","source-layer":"country_label","minzoom":1,"maxzoom":7,"filter":["in","scalerank",1,2],"layout":{"text-field":"{name_en}","text-max-width":{"base":1,"stops":[[0,5],[3,6]]},"text-font":["DIN Offc Pro Medium","Arial Unicode MS Regular"],"text-size":{"base":1,"stops":[[1,10],[6,24]]}},"paint":{"text-color":"hsl(0, 0%, 0%)","text-halo-color":{"base":1,"stops":[[2,"rgba(255,255,255,0.75)"],[3,"hsl(0, 0%, 100%)"]]},"text-halo-width":1.25}}],"created":0,"modified":0,"owner":"mapbox","id":"streets-v9","draft":false}
\ No newline at end of file diff --git a/test/fixtures/resources/vector.pbf b/test/fixtures/resources/vector.pbf Binary files differdeleted file mode 100644 index cea355eeff..0000000000 --- a/test/fixtures/resources/vector.pbf +++ /dev/null diff --git a/test/fixtures/resources/vector.tile b/test/fixtures/resources/vector.tile Binary files differnew file mode 100644 index 0000000000..47e6188854 --- /dev/null +++ b/test/fixtures/resources/vector.tile diff --git a/test/fixtures/style_parser/circle-blur.info.json b/test/fixtures/style_parser/circle-blur.info.json index 397e4cd4d1..40c4632c0e 100644 --- a/test/fixtures/style_parser/circle-blur.info.json +++ b/test/fixtures/style_parser/circle-blur.info.json @@ -1,7 +1,7 @@ { "default": { "log": [ - [1, "WARNING", "ParseStyle", "value of 'circle-blur' must be a number, or a number function"] + [1, "WARNING", "ParseStyle", "value must be a number"] ] } } diff --git a/test/fixtures/style_parser/circle-blur.style.json b/test/fixtures/style_parser/circle-blur.style.json index 8140ad5e47..9c82142c21 100644 --- a/test/fixtures/style_parser/circle-blur.style.json +++ b/test/fixtures/style_parser/circle-blur.style.json @@ -12,7 +12,7 @@ "type": "circle", "source": "mapbox", "paint": { - "circle-blur": null + "circle-blur": "no" } }] } diff --git a/test/fixtures/style_parser/circle-color.info.json b/test/fixtures/style_parser/circle-color.info.json index 70375ce8f5..0dfa6371b7 100644 --- a/test/fixtures/style_parser/circle-color.info.json +++ b/test/fixtures/style_parser/circle-color.info.json @@ -1,7 +1,7 @@ { "default": { "log": [ - [1, "WARNING", "ParseStyle", "value of 'circle-color' must be a string"] + [1, "WARNING", "ParseStyle", "value must be a string"] ] } } diff --git a/test/fixtures/style_parser/circle-color.style.json b/test/fixtures/style_parser/circle-color.style.json index 44c32f99ce..e9c508304b 100644 --- a/test/fixtures/style_parser/circle-color.style.json +++ b/test/fixtures/style_parser/circle-color.style.json @@ -12,7 +12,7 @@ "type": "circle", "source": "mapbox", "paint": { - "circle-color": null + "circle-color": 1 } }] } diff --git a/test/fixtures/style_parser/circle-opacity.info.json b/test/fixtures/style_parser/circle-opacity.info.json index 3e8662bdbe..40c4632c0e 100644 --- a/test/fixtures/style_parser/circle-opacity.info.json +++ b/test/fixtures/style_parser/circle-opacity.info.json @@ -1,7 +1,7 @@ { "default": { "log": [ - [1, "WARNING", "ParseStyle", "value of 'circle-opacity' must be a number, or a number function"] + [1, "WARNING", "ParseStyle", "value must be a number"] ] } } diff --git a/test/fixtures/style_parser/circle-opacity.style.json b/test/fixtures/style_parser/circle-opacity.style.json index 601e81a51b..a993182b1b 100644 --- a/test/fixtures/style_parser/circle-opacity.style.json +++ b/test/fixtures/style_parser/circle-opacity.style.json @@ -12,7 +12,7 @@ "type": "circle", "source": "mapbox", "paint": { - "circle-opacity": null + "circle-opacity": "no" } }] } diff --git a/test/fixtures/style_parser/circle-radius.info.json b/test/fixtures/style_parser/circle-radius.info.json index 7e87aa4fdb..40c4632c0e 100644 --- a/test/fixtures/style_parser/circle-radius.info.json +++ b/test/fixtures/style_parser/circle-radius.info.json @@ -1,7 +1,7 @@ { "default": { "log": [ - [1, "WARNING", "ParseStyle", "value of 'circle-radius' must be a number, or a number function"] + [1, "WARNING", "ParseStyle", "value must be a number"] ] } } diff --git a/test/fixtures/style_parser/circle-radius.style.json b/test/fixtures/style_parser/circle-radius.style.json index a7fb28b2d3..f12cebff97 100644 --- a/test/fixtures/style_parser/circle-radius.style.json +++ b/test/fixtures/style_parser/circle-radius.style.json @@ -12,7 +12,7 @@ "type": "circle", "source": "mapbox", "paint": { - "circle-radius": null + "circle-radius": "no" } }] } diff --git a/test/fixtures/style_parser/function-numeric.info.json b/test/fixtures/style_parser/function-numeric.info.json index e2170eed4f..7dd5a69561 100644 --- a/test/fixtures/style_parser/function-numeric.info.json +++ b/test/fixtures/style_parser/function-numeric.info.json @@ -1,7 +1,7 @@ { "default": { "log": [ - [1, "WARNING", "ParseStyle", "function argument must be a numeric value"] + [1, "WARNING", "ParseStyle", "function stop must be an array"] ] } } diff --git a/test/fixtures/style_parser/function-type.info.json b/test/fixtures/style_parser/function-type.info.json index 1549262bb0..c9e26537f7 100644 --- a/test/fixtures/style_parser/function-type.info.json +++ b/test/fixtures/style_parser/function-type.info.json @@ -1,7 +1,7 @@ { "default": { "log": [ - [1, "WARNING", "ParseStyle", "function must specify a function type"] + [1, "WARNING", "ParseStyle", "function value must specify stops"] ] } } diff --git a/test/fixtures/style_parser/geojson-data-inline.style.json b/test/fixtures/style_parser/geojson-data-inline.style.json index fc4fe97c78..a5d19eea60 100644 --- a/test/fixtures/style_parser/geojson-data-inline.style.json +++ b/test/fixtures/style_parser/geojson-data-inline.style.json @@ -3,7 +3,7 @@ "sources": { "mapbox": { "type": "geojson", - "data": { "type": "Feature", "geometry": { "type": "Point", "coordinates": [100.0, 0.0] } } + "data": { "type": "Feature", "geometry": { "type": "Point", "coordinates": [100.0, 0.0] }, "properties": {} } } } } diff --git a/test/fixtures/style_parser/geojson-invalid-data.info.json b/test/fixtures/style_parser/geojson-invalid-data.info.json index ec4a7e2b75..86f1ef6edd 100644 --- a/test/fixtures/style_parser/geojson-invalid-data.info.json +++ b/test/fixtures/style_parser/geojson-invalid-data.info.json @@ -1,7 +1,7 @@ { "default": { "log": [ - [1, "ERROR", "ParseStyle", "GeoJSON data must be a URL or an object"] + [1, "WARNING", "ParseStyle", "GeoJSON data must be a URL or an object"] ] } } diff --git a/test/fixtures/style_parser/geojson-missing-data.info.json b/test/fixtures/style_parser/geojson-missing-data.info.json index 2c4806c3cf..594d01d19d 100644 --- a/test/fixtures/style_parser/geojson-missing-data.info.json +++ b/test/fixtures/style_parser/geojson-missing-data.info.json @@ -1,7 +1,7 @@ { "default": { "log": [ - [1, "ERROR", "ParseStyle", "GeoJSON source must have a data value"] + [1, "WARNING", "ParseStyle", "GeoJSON source must have a data value"] ] } } diff --git a/test/fixtures/style_parser/line-opacity.info.json b/test/fixtures/style_parser/line-opacity.info.json index 36f02e6e02..40c4632c0e 100644 --- a/test/fixtures/style_parser/line-opacity.info.json +++ b/test/fixtures/style_parser/line-opacity.info.json @@ -1,7 +1,7 @@ { "default": { "log": [ - [1, "WARNING", "ParseStyle", "value of 'line-opacity' must be a number, or a number function"] + [1, "WARNING", "ParseStyle", "value must be a number"] ] } } diff --git a/test/fixtures/style_parser/line-opacity.style.json b/test/fixtures/style_parser/line-opacity.style.json index 712b2b6f50..7d29fb312a 100644 --- a/test/fixtures/style_parser/line-opacity.style.json +++ b/test/fixtures/style_parser/line-opacity.style.json @@ -16,7 +16,7 @@ "paint": { "line-color": "#008", "line-width": 0.9, - "line-opacity": null + "line-opacity": "no" } }] } diff --git a/test/fixtures/style_parser/line-translate.info.json b/test/fixtures/style_parser/line-translate.info.json index ff126bbf22..16df094290 100644 --- a/test/fixtures/style_parser/line-translate.info.json +++ b/test/fixtures/style_parser/line-translate.info.json @@ -1,7 +1,7 @@ { "default": { "log": [ - [1, "WARNING", "ParseStyle", "value of 'line-translate' must be an array of two numbers"] + [1, "WARNING", "ParseStyle", "value must be an array of two numbers"] ] } } diff --git a/test/fixtures/style_parser/line-translate.style.json b/test/fixtures/style_parser/line-translate.style.json index a32b2d8ee4..4890a8b6df 100644 --- a/test/fixtures/style_parser/line-translate.style.json +++ b/test/fixtures/style_parser/line-translate.style.json @@ -12,7 +12,7 @@ "type": "line", "source": "mapbox", "paint": { - "line-translate": null + "line-translate": "no" } }] } diff --git a/test/fixtures/style_parser/line-width.info.json b/test/fixtures/style_parser/line-width.info.json index af2f9b284a..40c4632c0e 100644 --- a/test/fixtures/style_parser/line-width.info.json +++ b/test/fixtures/style_parser/line-width.info.json @@ -1,7 +1,7 @@ { "default": { "log": [ - [1, "WARNING", "ParseStyle", "value of 'line-width' must be a number, or a number function"] + [1, "WARNING", "ParseStyle", "value must be a number"] ] } } diff --git a/test/fixtures/style_parser/line-width.style.json b/test/fixtures/style_parser/line-width.style.json index e5fe6fa8e1..1f677460c4 100644 --- a/test/fixtures/style_parser/line-width.style.json +++ b/test/fixtures/style_parser/line-width.style.json @@ -14,7 +14,7 @@ "source-layer": "waterway", "filter": ["in", "type", "river", "canal"], "paint": { - "line-width": null + "line-width": "no" } }] } diff --git a/test/fixtures/style_parser/non-object.info.json b/test/fixtures/style_parser/non-object.info.json new file mode 100644 index 0000000000..d1b67e2ea6 --- /dev/null +++ b/test/fixtures/style_parser/non-object.info.json @@ -0,0 +1,7 @@ +{ + "default": { + "log": [ + [1, "ERROR", "ParseStyle", "Style JSON must be an object"] + ] + } +}
\ No newline at end of file diff --git a/test/fixtures/style_parser/non-object.style.json b/test/fixtures/style_parser/non-object.style.json new file mode 100644 index 0000000000..3cc762b550 --- /dev/null +++ b/test/fixtures/style_parser/non-object.style.json @@ -0,0 +1 @@ +""
\ No newline at end of file diff --git a/test/fixtures/style_parser/stop-zoom-value.info.json b/test/fixtures/style_parser/stop-zoom-value.info.json index deaba65e25..386dce9d29 100644 --- a/test/fixtures/style_parser/stop-zoom-value.info.json +++ b/test/fixtures/style_parser/stop-zoom-value.info.json @@ -1,7 +1,7 @@ { "default": { "log": [ - [1, "WARNING", "ParseStyle", "stop must have zoom level and value specification"] + [1, "WARNING", "ParseStyle", "function stop must have two elements"] ] } } diff --git a/test/fixtures/style_parser/stops-array.info.json b/test/fixtures/style_parser/stops-array.info.json index 3324958c85..ed66513fee 100644 --- a/test/fixtures/style_parser/stops-array.info.json +++ b/test/fixtures/style_parser/stops-array.info.json @@ -1,7 +1,7 @@ { "default": { "log": [ - [1, "WARNING", "ParseStyle", "stops function must specify a stops array"] + [1, "WARNING", "ParseStyle", "function stops must be an array"] ] } } diff --git a/test/fixtures/style_parser/text-size.info.json b/test/fixtures/style_parser/text-size.info.json index 871a6ad499..40c4632c0e 100644 --- a/test/fixtures/style_parser/text-size.info.json +++ b/test/fixtures/style_parser/text-size.info.json @@ -1,7 +1,7 @@ { "default": { "log": [ - [1, "WARNING", "ParseStyle", "value of 'text-size' must be a number, or a number function"] + [1, "WARNING", "ParseStyle", "value must be a number"] ] } } diff --git a/test/fixtures/style_parser/text-size.style.json b/test/fixtures/style_parser/text-size.style.json index ee6a6c39e4..dafa87d63b 100644 --- a/test/fixtures/style_parser/text-size.style.json +++ b/test/fixtures/style_parser/text-size.style.json @@ -14,7 +14,7 @@ "source-layer": "country_label", "filter": ["==", "$type", "Point"], "layout": { - "text-size": null + "text-size": "no" } }] } diff --git a/test/fixtures/style_parser/version-not-number.info.json b/test/fixtures/style_parser/version-not-number.info.json new file mode 100644 index 0000000000..130c334170 --- /dev/null +++ b/test/fixtures/style_parser/version-not-number.info.json @@ -0,0 +1,7 @@ +{ + "default": { + "log": [ + [1, "WARNING", "ParseStyle", "current renderer implementation only supports style spec version 8; using an outdated style will cause rendering errors"] + ] + } +}
\ No newline at end of file diff --git a/test/fixtures/style_parser/version-not-number.style.json b/test/fixtures/style_parser/version-not-number.style.json new file mode 100644 index 0000000000..ae3ef858a6 --- /dev/null +++ b/test/fixtures/style_parser/version-not-number.style.json @@ -0,0 +1 @@ +{"version":"8"}
\ No newline at end of file diff --git a/test/gl/object.cpp b/test/gl/object.cpp index f2b21ec9f4..1506c33956 100644 --- a/test/gl/object.cpp +++ b/test/gl/object.cpp @@ -6,7 +6,6 @@ #include <mbgl/gl/gl_helper.hpp> #include <mbgl/gl/gl_config.hpp> #include <mbgl/gl/object_store.hpp> -#include <mbgl/gl/texture_pool.hpp> #include <memory> @@ -15,15 +14,17 @@ namespace { static bool getFlag = false; static bool setFlag = false; -}; // namespace +} // namespace struct MockGLObject { using Type = bool; - static const Type Default = false; + static const Type Default; static Type Get() { getFlag = true; return true; } static void Set(const Type&) { setFlag = true; } }; +const bool MockGLObject::Default = false; + TEST(GLObject, Preserve) { getFlag = false; setFlag = false; @@ -62,7 +63,7 @@ TEST(GLObject, Value) { object->reset(); EXPECT_EQ(object->getCurrent(), false); - EXPECT_TRUE(object->getDirty()); + EXPECT_FALSE(object->getDirty()); EXPECT_TRUE(setFlag); } @@ -74,118 +75,43 @@ TEST(GLObject, Store) { EXPECT_TRUE(store.empty()); mbgl::gl::UniqueProgram program = store.createProgram(); - EXPECT_NE(program.get(), 0); + EXPECT_NE(program.get(), 0u); program.reset(); EXPECT_FALSE(store.empty()); store.performCleanup(); EXPECT_TRUE(store.empty()); mbgl::gl::UniqueShader shader = store.createShader(GL_VERTEX_SHADER); - EXPECT_NE(shader.get(), 0); + EXPECT_NE(shader.get(), 0u); shader.reset(); EXPECT_FALSE(store.empty()); store.performCleanup(); EXPECT_TRUE(store.empty()); mbgl::gl::UniqueBuffer buffer = store.createBuffer(); - EXPECT_NE(buffer.get(), 0); + EXPECT_NE(buffer.get(), 0u); buffer.reset(); EXPECT_FALSE(store.empty()); store.performCleanup(); EXPECT_TRUE(store.empty()); mbgl::gl::UniqueTexture texture = store.createTexture(); - EXPECT_NE(texture.get(), 0); + EXPECT_NE(texture.get(), 0u); texture.reset(); EXPECT_FALSE(store.empty()); store.performCleanup(); + EXPECT_FALSE(store.empty()); + store.reset(); EXPECT_TRUE(store.empty()); mbgl::gl::UniqueVAO vao = store.createVAO(); - EXPECT_NE(vao.get(), 0); + EXPECT_NE(vao.get(), 0u); vao.reset(); EXPECT_FALSE(store.empty()); store.performCleanup(); EXPECT_TRUE(store.empty()); - mbgl::gl::UniqueTexturePool texturePool = store.createTexturePool(); - for (auto& id : texturePool.get()) { - EXPECT_NE(id, 0); - } - EXPECT_TRUE(texturePool.get().size() == size_t(mbgl::gl::TextureMax)); - texturePool.reset(); - EXPECT_FALSE(store.empty()); - store.performCleanup(); - EXPECT_TRUE(store.empty()); - - view.deactivate(); -} - -TEST(GLObject, TexturePool) { - mbgl::HeadlessView view(std::make_shared<mbgl::HeadlessDisplay>(), 1); - view.activate(); - - mbgl::gl::ObjectStore store; - EXPECT_TRUE(store.empty()); - - mbgl::gl::TexturePool pool; - - std::vector<mbgl::gl::PooledTexture> ids; - - // Fill an entire texture pool. - for (auto i = 0; i != mbgl::gl::TextureMax; ++i) { - ids.push_back(pool.acquireTexture(store)); - EXPECT_EQ(ids.back().get(), GLuint(i + 1)); - EXPECT_TRUE(store.empty()); - } - - // Reuse texture ids from the same pool. - for (auto i = 0; i != mbgl::gl::TextureMax; ++i) { - ids[i].reset(); - ids.push_back(pool.acquireTexture(store)); - EXPECT_EQ(ids.back().get(), GLuint(i + 1)); - EXPECT_TRUE(store.empty()); - } - - // Trigger a new texture pool creation. - { - mbgl::gl::PooledTexture id = pool.acquireTexture(store); - EXPECT_EQ(id, mbgl::gl::TextureMax + 1); - EXPECT_TRUE(store.empty()); - - id.reset(); - - // Last used texture from pool triggers pool recycling. - EXPECT_FALSE(store.empty()); - - store.performCleanup(); - EXPECT_TRUE(store.empty()); - } - - // First pool is still full, thus creating a new pool. - mbgl::gl::PooledTexture id1 = pool.acquireTexture(store); - EXPECT_GT(id1.get(), mbgl::gl::TextureMax); - EXPECT_TRUE(store.empty()); - - // Release all textures from the first pool. - ids.clear(); - EXPECT_FALSE(store.empty()); - - store.performCleanup(); - EXPECT_TRUE(store.empty()); - - // The first pool is now gone, the next pool is now in use. - mbgl::gl::PooledTexture id2 = pool.acquireTexture(store); - EXPECT_GT(id2.get(), id1.get()); - - id2.reset(); - EXPECT_TRUE(store.empty()); - - // Last used texture from the pool triggers pool recycling. - id1.reset(); - EXPECT_FALSE(store.empty()); - - store.performCleanup(); + store.reset(); EXPECT_TRUE(store.empty()); view.deactivate(); diff --git a/test/include/mbgl/test.hpp b/test/include/mbgl/test.hpp index e398174ef7..ad5b868f30 100644 --- a/test/include/mbgl/test.hpp +++ b/test/include/mbgl/test.hpp @@ -4,4 +4,4 @@ namespace mbgl { int runTests(int argc, char* argv[]); -} +} // namespace mbgl diff --git a/test/map/map.cpp b/test/map/map.cpp index 57adee567d..b304712e1f 100644 --- a/test/map/map.cpp +++ b/test/map/map.cpp @@ -9,6 +9,7 @@ #include <mbgl/util/io.hpp> #include <mbgl/util/run_loop.hpp> #include <mbgl/style/layers/background_layer.hpp> +#include <mbgl/util/color.hpp> using namespace mbgl; using namespace mbgl::style; @@ -67,7 +68,7 @@ TEST(Map, AddLayer) { map.setStyleJSON(util::read_file("test/fixtures/api/empty.json")); auto layer = std::make_unique<BackgroundLayer>("background"); - layer->setBackgroundColor({{{ 1, 0, 0, 1 }}}); + layer->setBackgroundColor({{ 1, 0, 0, 1 }}); map.addLayer(std::move(layer)); test::checkImage("test/fixtures/map/add_layer", test::render(map)); @@ -80,7 +81,7 @@ TEST(Map, RemoveLayer) { map.setStyleJSON(util::read_file("test/fixtures/api/empty.json")); auto layer = std::make_unique<BackgroundLayer>("background"); - layer->setBackgroundColor({{{ 1, 0, 0, 1 }}}); + layer->setBackgroundColor({{ 1, 0, 0, 1 }}); map.addLayer(std::move(layer)); map.removeLayer("background"); diff --git a/test/sprite/sprite_atlas.cpp b/test/sprite/sprite_atlas.cpp index 08b8e54002..d9f96d57d1 100644 --- a/test/sprite/sprite_atlas.cpp +++ b/test/sprite/sprite_atlas.cpp @@ -52,8 +52,8 @@ TEST(Sprite, SpriteAtlas) { EXPECT_EQ(20, metro.pos.h); EXPECT_EQ(18, metro.spriteImage->getWidth()); EXPECT_EQ(18, metro.spriteImage->getHeight()); - EXPECT_EQ(18, metro.spriteImage->image.width); - EXPECT_EQ(18, metro.spriteImage->image.height); + EXPECT_EQ(18u, metro.spriteImage->image.width); + EXPECT_EQ(18u, metro.spriteImage->image.height); EXPECT_EQ(1.0f, metro.spriteImage->pixelRatio); EXPECT_TRUE(atlas.getData()); @@ -108,8 +108,8 @@ TEST(Sprite, SpriteAtlasSize) { EXPECT_EQ(16, metro.pos.h); EXPECT_EQ(18, metro.spriteImage->getWidth()); EXPECT_EQ(18, metro.spriteImage->getHeight()); - EXPECT_EQ(18, metro.spriteImage->image.width); - EXPECT_EQ(18, metro.spriteImage->image.height); + EXPECT_EQ(18u, metro.spriteImage->image.width); + EXPECT_EQ(18u, metro.spriteImage->image.height); EXPECT_EQ(1.0f, metro.spriteImage->pixelRatio); EXPECT_EQ(readImage("test/fixtures/annotations/result-spriteatlassize.png"), @@ -135,8 +135,8 @@ TEST(Sprite, SpriteAtlasUpdates) { EXPECT_EQ(16, one.pos.h); EXPECT_EQ(16, one.spriteImage->getWidth()); EXPECT_EQ(12, one.spriteImage->getHeight()); - EXPECT_EQ(16, one.spriteImage->image.width); - EXPECT_EQ(12, one.spriteImage->image.height); + EXPECT_EQ(16u, one.spriteImage->image.width); + EXPECT_EQ(12u, one.spriteImage->image.height); EXPECT_EQ(1.0f, one.spriteImage->pixelRatio); EXPECT_EQ(readImage("test/fixtures/annotations/result-spriteatlas-empty.png"), diff --git a/test/sprite/sprite_image.cpp b/test/sprite/sprite_image.cpp index 29e96cf134..f8982826a3 100644 --- a/test/sprite/sprite_image.cpp +++ b/test/sprite/sprite_image.cpp @@ -40,9 +40,9 @@ TEST(Sprite, SpriteImage) { PremultipliedImage image(32, 24); SpriteImage sprite(std::move(image), 2.0); EXPECT_EQ(16, sprite.getWidth()); - EXPECT_EQ(32, sprite.image.width); + EXPECT_EQ(32u, sprite.image.width); EXPECT_EQ(12, sprite.getHeight()); - EXPECT_EQ(24, sprite.image.height); + EXPECT_EQ(24u, sprite.image.height); EXPECT_EQ(2, sprite.pixelRatio); } @@ -50,8 +50,8 @@ TEST(Sprite, SpriteImageFractionalRatio) { PremultipliedImage image(20, 12); SpriteImage sprite(std::move(image), 1.5); EXPECT_EQ(float(20.0 / 1.5), sprite.getWidth()); - EXPECT_EQ(20, sprite.image.width); + EXPECT_EQ(20u, sprite.image.width); EXPECT_EQ(float(12.0 / 1.5), sprite.getHeight()); - EXPECT_EQ(12, sprite.image.height); + EXPECT_EQ(12u, sprite.image.height); EXPECT_EQ(1.5, sprite.pixelRatio); } diff --git a/test/sprite/sprite_parser.cpp b/test/sprite/sprite_parser.cpp index 318911674e..85a5387898 100644 --- a/test/sprite/sprite_parser.cpp +++ b/test/sprite/sprite_parser.cpp @@ -60,8 +60,8 @@ TEST(Sprite, SpriteImageCreation1x) { ASSERT_TRUE(sprite.get()); EXPECT_EQ(18, sprite->getWidth()); EXPECT_EQ(18, sprite->getHeight()); - EXPECT_EQ(18, sprite->image.width); - EXPECT_EQ(18, sprite->image.height); + EXPECT_EQ(18u, sprite->image.width); + EXPECT_EQ(18u, sprite->image.height); EXPECT_EQ(1, sprite->pixelRatio); EXPECT_EQ(readImage("test/fixtures/annotations/result-spriteimagecreation1x-museum.png"), sprite->image); @@ -76,8 +76,8 @@ TEST(Sprite, SpriteImageCreation2x) { ASSERT_TRUE(sprite.get()); EXPECT_EQ(18, sprite->getWidth()); EXPECT_EQ(18, sprite->getHeight()); - EXPECT_EQ(36, sprite->image.width); - EXPECT_EQ(36, sprite->image.height); + EXPECT_EQ(36u, sprite->image.width); + EXPECT_EQ(36u, sprite->image.height); EXPECT_EQ(2, sprite->pixelRatio); EXPECT_EQ(readImage("test/fixtures/annotations/result-spriteimagecreation2x.png"), sprite->image); @@ -91,8 +91,8 @@ TEST(Sprite, SpriteImageCreation1_5x) { ASSERT_TRUE(sprite.get()); EXPECT_EQ(24, sprite->getWidth()); EXPECT_EQ(24, sprite->getHeight()); - EXPECT_EQ(36, sprite->image.width); - EXPECT_EQ(36, sprite->image.height); + EXPECT_EQ(36u, sprite->image.width); + EXPECT_EQ(36u, sprite->image.height); EXPECT_EQ(1.5, sprite->pixelRatio); EXPECT_EQ(readImage("test/fixtures/annotations/result-spriteimagecreation1_5x-museum.png"), sprite->image); @@ -102,8 +102,8 @@ TEST(Sprite, SpriteImageCreation1_5x) { ASSERT_TRUE(sprite2.get()); EXPECT_EQ(float(35 / 1.5), sprite2->getWidth()); EXPECT_EQ(float(35 / 1.5), sprite2->getHeight()); - EXPECT_EQ(35, sprite2->image.width); - EXPECT_EQ(35, sprite2->image.height); + EXPECT_EQ(35u, sprite2->image.width); + EXPECT_EQ(35u, sprite2->image.height); EXPECT_EQ(1.5, sprite2->pixelRatio); EXPECT_EQ(readImage("test/fixtures/annotations/result-spriteimagecreation1_5x-hospital.png"), sprite2->image); @@ -198,8 +198,8 @@ TEST(Sprite, SpriteParsing) { auto sprite = images.find("generic-metro")->second; EXPECT_EQ(18, sprite->getWidth()); EXPECT_EQ(18, sprite->getHeight()); - EXPECT_EQ(18, sprite->image.width); - EXPECT_EQ(18, sprite->image.height); + EXPECT_EQ(18u, sprite->image.width); + EXPECT_EQ(18u, sprite->image.height); EXPECT_EQ(1, sprite->pixelRatio); EXPECT_EQ(readImage("test/fixtures/annotations/result-spriteparsing.png"), sprite->image); } diff --git a/test/sprite/sprite_store.cpp b/test/sprite/sprite_store.cpp index 90f1e3b3f1..3c20d3c50e 100644 --- a/test/sprite/sprite_store.cpp +++ b/test/sprite/sprite_store.cpp @@ -153,13 +153,12 @@ TEST(SpriteStore, ReplaceWithDifferentDimensions) { class SpriteStoreTest { public: - SpriteStoreTest() - : spriteStore(1.0) {} + SpriteStoreTest() = default; util::RunLoop loop; StubFileSource fileSource; StubStyleObserver observer; - SpriteStore spriteStore; + SpriteStore spriteStore = { 1.0 }; void run() { // Squelch logging. @@ -181,14 +180,14 @@ Response successfulSpriteImageResponse(const Resource& resource) { Response response; response.data = std::make_shared<std::string>(util::read_file(resource.url)); return response; -}; +} Response successfulSpriteJSONResponse(const Resource& resource) { EXPECT_EQ("test/fixtures/resources/sprite.json", resource.url); Response response; response.data = std::make_shared<std::string>(util::read_file(resource.url)); return response; -}; +} Response failedSpriteResponse(const Resource&) { Response response; @@ -196,13 +195,13 @@ Response failedSpriteResponse(const Resource&) { Response::Error::Reason::Other, "Failed by the test case"); return response; -}; +} Response corruptSpriteResponse(const Resource&) { Response response; response.data = std::make_shared<std::string>("CORRUPT"); return response; -}; +} TEST(SpriteStore, LoadingSuccess) { SpriteStoreTest test; diff --git a/test/src/mbgl/test/fixture_log_observer.cpp b/test/src/mbgl/test/fixture_log_observer.cpp index 302fdc7081..fc0239bb1c 100644 --- a/test/src/mbgl/test/fixture_log_observer.cpp +++ b/test/src/mbgl/test/fixture_log_observer.cpp @@ -1,13 +1,14 @@ #include <mbgl/test/fixture_log_observer.hpp> #include <mbgl/test/util.hpp> +#include <mbgl/util/enum.hpp> namespace mbgl { FixtureLog::Message::Message(EventSeverity severity_, Event event_, int64_t code_, - const std::string& msg_) - : severity(severity_), event(event_), code(code_), msg(msg_) { + std::string msg_) + : severity(severity_), event(event_), code(code_), msg(std::move(msg_)) { } bool FixtureLog::Message::operator==(const Message& rhs) const { @@ -96,7 +97,8 @@ std::vector<FixtureLog::Message> FixtureLogObserver::unchecked() const { } ::std::ostream& operator<<(::std::ostream& os, const FixtureLog::Message& message) { - os << "[\"" << message.severity << "\", \"" << message.event << "\""; + os << "[\"" << Enum<EventSeverity>::toString(message.severity) << "\", \""; + os << Enum<Event>::toString(message.event) << "\""; os << ", " << message.code; os << ", \"" << message.msg << "\""; return os << "]" << std::endl; diff --git a/test/src/mbgl/test/fixture_log_observer.hpp b/test/src/mbgl/test/fixture_log_observer.hpp index 1eabe10095..918bbee18c 100644 --- a/test/src/mbgl/test/fixture_log_observer.hpp +++ b/test/src/mbgl/test/fixture_log_observer.hpp @@ -12,7 +12,7 @@ namespace mbgl { class FixtureLog { public: struct Message { - Message(EventSeverity severity_, Event event_, int64_t code_, const std::string &msg_); + Message(EventSeverity severity_, Event event_, int64_t code_, std::string msg_); Message(); bool operator==(const Message& rhs) const; @@ -30,10 +30,10 @@ public: using LogMessage = Message; Observer(FixtureLog* log = nullptr); - ~Observer(); + ~Observer() override; // Log::Observer implementation - virtual bool onRecord(EventSeverity severity, + bool onRecord(EventSeverity severity, Event event, int64_t code, const std::string& msg) override; diff --git a/test/src/mbgl/test/stub_file_source.cpp b/test/src/mbgl/test/stub_file_source.cpp index 89ccb3b335..75d7e2d072 100644 --- a/test/src/mbgl/test/stub_file_source.cpp +++ b/test/src/mbgl/test/stub_file_source.cpp @@ -10,21 +10,25 @@ public: : fileSource(fileSource_) { } - ~StubFileRequest() { - fileSource.pending.erase(this); + ~StubFileRequest() override { + fileSource.remove(this); } StubFileSource& fileSource; }; StubFileSource::StubFileSource() { - timer.start(10ms, 10ms, [this] { + timer.start(1ms, 1ms, [this] { // Explicit copy to avoid iterator invalidation if ~StubFileRequest gets called within the loop. auto pending_ = pending; for (auto& pair : pending_) { optional<Response> res = std::get<1>(pair.second)(std::get<0>(pair.second)); if (res) { std::get<2>(pair.second)(*res); + + if (!res->error) { + remove(pair.first); + } } } }); @@ -38,6 +42,13 @@ std::unique_ptr<AsyncRequest> StubFileSource::request(const Resource& resource, return std::move(req); } +void StubFileSource::remove(AsyncRequest* req) { + auto it = pending.find(req); + if (it != pending.end()) { + pending.erase(it); + } +} + optional<Response> StubFileSource::defaultResponse(const Resource& resource) { switch (resource.kind) { case Resource::Kind::Style: diff --git a/test/src/mbgl/test/stub_file_source.hpp b/test/src/mbgl/test/stub_file_source.hpp index b88fb59907..ee4175cc3f 100644 --- a/test/src/mbgl/test/stub_file_source.hpp +++ b/test/src/mbgl/test/stub_file_source.hpp @@ -13,6 +13,7 @@ public: ~StubFileSource() override; std::unique_ptr<AsyncRequest> request(const Resource&, Callback) override; + void remove(AsyncRequest*); using ResponseFunction = std::function<optional<Response> (const Resource&)>; @@ -30,8 +31,6 @@ public: ResponseFunction spriteImageResponse; private: - friend class StubFileRequest; - // The default behavior is to throw if no per-kind callback has been set. optional<Response> defaultResponse(const Resource&); diff --git a/test/src/mbgl/test/stub_style_observer.hpp b/test/src/mbgl/test/stub_style_observer.hpp index d70fc5e44c..ae0a23f0aa 100644 --- a/test/src/mbgl/test/stub_style_observer.hpp +++ b/test/src/mbgl/test/stub_style_observer.hpp @@ -43,8 +43,8 @@ public: if (tileError) tileError(source, tileID, error); } - void onResourceLoaded() override { - if (resourceLoaded) resourceLoaded(); + void onNeedsRepaint() override { + if (needsRepaint) needsRepaint(); }; void onResourceError(std::exception_ptr error) override { @@ -59,6 +59,6 @@ public: std::function<void (Source&, std::exception_ptr)> sourceError; std::function<void (Source&, const OverscaledTileID&, bool isNewTile)> tileLoaded; std::function<void (Source&, const OverscaledTileID&, std::exception_ptr)> tileError; - std::function<void ()> resourceLoaded; + std::function<void ()> needsRepaint; std::function<void (std::exception_ptr)> resourceError; }; diff --git a/test/src/mbgl/test/test.cpp b/test/src/mbgl/test/test.cpp index 39afcc97e4..4c3dad1727 100644 --- a/test/src/mbgl/test/test.cpp +++ b/test/src/mbgl/test/test.cpp @@ -14,4 +14,4 @@ int runTests(int argc, char *argv[]) { return RUN_ALL_TESTS(); } -} +} // namespace mbgl diff --git a/test/src/mbgl/test/util.hpp b/test/src/mbgl/test/util.hpp index 76c00d8434..30108a8866 100644 --- a/test/src/mbgl/test/util.hpp +++ b/test/src/mbgl/test/util.hpp @@ -73,5 +73,5 @@ void checkImage(const std::string& base, double imageThreshold = 0, double pixelThreshold = 0); -} -} +} // namespace test +} // namespace mbgl diff --git a/test/storage/asset_file_source.cpp b/test/storage/asset_file_source.cpp index 64f7254807..ab214ff793 100644 --- a/test/storage/asset_file_source.cpp +++ b/test/storage/asset_file_source.cpp @@ -21,7 +21,7 @@ std::string getFileSourceRoot() { using namespace mbgl; -TEST(AssetFileSource, Stress) { +TEST(AssetFileSource, Load) { util::RunLoop loop; AssetFileSource fs(getFileSourceRoot()); diff --git a/test/storage/headers.cpp b/test/storage/headers.cpp index b879c43b12..b7dcfc025d 100644 --- a/test/storage/headers.cpp +++ b/test/storage/headers.cpp @@ -12,12 +12,12 @@ TEST(HTTPHeader, Parsing) { cc = http::CacheControl::parse(R"#(max-age =34)#"); ASSERT_TRUE(bool(cc.maxAge)); - EXPECT_EQ(34, *cc.maxAge); + EXPECT_EQ(34u, *cc.maxAge); EXPECT_FALSE(cc.mustRevalidate); cc = http::CacheControl::parse(R"#(,max-age=1)#"); ASSERT_TRUE(bool(cc.maxAge)); - EXPECT_EQ(1, *cc.maxAge); + EXPECT_EQ(1u, *cc.maxAge); EXPECT_FALSE(cc.mustRevalidate); cc = http::CacheControl::parse(R"#(max-age=-1)#"); @@ -30,12 +30,12 @@ TEST(HTTPHeader, Parsing) { cc = http::CacheControl::parse(R"#(max-age="34,max-age="22,max-age=28)#"); ASSERT_TRUE(bool(cc.maxAge)); - EXPECT_EQ(28, *cc.maxAge); + EXPECT_EQ(28u, *cc.maxAge); EXPECT_FALSE(cc.mustRevalidate); cc = http::CacheControl::parse(R"#(max-age=3,max-age="34)#"); ASSERT_TRUE(bool(cc.maxAge)); - EXPECT_EQ(3, *cc.maxAge); + EXPECT_EQ(3u, *cc.maxAge); EXPECT_FALSE(cc.mustRevalidate); cc = http::CacheControl::parse(R"#(max-age="\",max-age=4,")#"); @@ -44,26 +44,26 @@ TEST(HTTPHeader, Parsing) { cc = http::CacheControl::parse(R"#(private, max-age=0, no-cache)#"); ASSERT_TRUE(bool(cc.maxAge)); - EXPECT_EQ(0, *cc.maxAge); + EXPECT_EQ(0u, *cc.maxAge); EXPECT_FALSE(cc.mustRevalidate); cc = http::CacheControl::parse(R"#(max-age=0, no-cache, no-store)#"); ASSERT_TRUE(bool(cc.maxAge)); - EXPECT_EQ(0, *cc.maxAge); + EXPECT_EQ(0u, *cc.maxAge); EXPECT_FALSE(cc.mustRevalidate); cc = http::CacheControl::parse(R"#(, private , max-bar=3 , no-cache, "\,",,foo=",",,max-age=32)#"); ASSERT_TRUE(bool(cc.maxAge)); - EXPECT_EQ(32, *cc.maxAge); + EXPECT_EQ(32u, *cc.maxAge); EXPECT_FALSE(cc.mustRevalidate); cc = http::CacheControl::parse(R"#(max-age=3600, must-revalidate)#"); ASSERT_TRUE(bool(cc.maxAge)); - EXPECT_EQ(3600, *cc.maxAge); + EXPECT_EQ(3600u, *cc.maxAge); EXPECT_TRUE(cc.mustRevalidate); cc = http::CacheControl::parse(R"#(no-cache="Expires,Via",max-age=3600, must-revalidate)#"); ASSERT_TRUE(bool(cc.maxAge)); - EXPECT_EQ(3600, *cc.maxAge); + EXPECT_EQ(3600u, *cc.maxAge); EXPECT_TRUE(cc.mustRevalidate); } diff --git a/test/storage/offline.cpp b/test/storage/offline.cpp index 06789cd828..0faaabc298 100644 --- a/test/storage/offline.cpp +++ b/test/storage/offline.cpp @@ -1,5 +1,4 @@ #include <mbgl/storage/offline.hpp> -#include <mbgl/util/tileset.hpp> #include <mbgl/tile/tile_id.hpp> #include <gtest/gtest.h> @@ -14,49 +13,42 @@ static const LatLngBounds sanFranciscoWrapped = TEST(OfflineTilePyramidRegionDefinition, TileCoverEmpty) { OfflineTilePyramidRegionDefinition region("", LatLngBounds::empty(), 0, 20, 1.0); - Tileset tileset; - EXPECT_EQ((std::vector<CanonicalTileID>{}), region.tileCover(SourceType::Vector, 512, tileset)); + EXPECT_EQ((std::vector<CanonicalTileID>{}), region.tileCover(SourceType::Vector, 512, { 0, 22 })); } TEST(OfflineTilePyramidRegionDefinition, TileCoverZoomIntersection) { OfflineTilePyramidRegionDefinition region("", sanFrancisco, 2, 2, 1.0); - Tileset tileset; - tileset.minZoom = 0; EXPECT_EQ((std::vector<CanonicalTileID>{ { 2, 0, 1 } }), - region.tileCover(SourceType::Vector, 512, tileset)); + region.tileCover(SourceType::Vector, 512, { 0, 22 })); - tileset.minZoom = 3; - EXPECT_EQ((std::vector<CanonicalTileID>{}), region.tileCover(SourceType::Vector, 512, tileset)); + EXPECT_EQ((std::vector<CanonicalTileID>{}), region.tileCover(SourceType::Vector, 512, { 3, 22 })); } TEST(OfflineTilePyramidRegionDefinition, TileCoverTileSize) { OfflineTilePyramidRegionDefinition region("", LatLngBounds::world(), 0, 0, 1.0); - Tileset tileset; EXPECT_EQ((std::vector<CanonicalTileID>{ { 0, 0, 0 } }), - region.tileCover(SourceType::Vector, 512, tileset)); + region.tileCover(SourceType::Vector, 512, { 0, 22 })); EXPECT_EQ((std::vector<CanonicalTileID>{ { 1, 0, 0 }, { 1, 0, 1 }, { 1, 1, 0 }, { 1, 1, 1 } }), - region.tileCover(SourceType::Vector, 256, tileset)); + region.tileCover(SourceType::Vector, 256, { 0, 22 })); } TEST(OfflineTilePyramidRegionDefinition, TileCoverZoomRounding) { OfflineTilePyramidRegionDefinition region("", sanFrancisco, 0.6, 0.7, 1.0); - Tileset tileset; EXPECT_EQ((std::vector<CanonicalTileID>{ { 0, 0, 0 } }), - region.tileCover(SourceType::Vector, 512, tileset)); + region.tileCover(SourceType::Vector, 512, { 0, 22 })); EXPECT_EQ((std::vector<CanonicalTileID>{ { 1, 0, 0 } }), - region.tileCover(SourceType::Raster, 512, tileset)); + region.tileCover(SourceType::Raster, 512, { 0, 22 })); } TEST(OfflineTilePyramidRegionDefinition, TileCoverWrapped) { OfflineTilePyramidRegionDefinition region("", sanFranciscoWrapped, 0, 0, 1.0); - Tileset tileset; EXPECT_EQ((std::vector<CanonicalTileID>{ { 0, 0, 0 } }), - region.tileCover(SourceType::Vector, 512, tileset)); + region.tileCover(SourceType::Vector, 512, { 0, 22 })); } diff --git a/test/storage/offline_database.cpp b/test/storage/offline_database.cpp index 0f95e927de..6a3262abf6 100644 --- a/test/storage/offline_database.cpp +++ b/test/storage/offline_database.cpp @@ -78,7 +78,7 @@ private: bool locked = false; }; -} +} // namespace TEST(OfflineDatabase, TEST_REQUIRES_WRITE(Create)) { using namespace mbgl; @@ -113,7 +113,7 @@ TEST(OfflineDatabase, TEST_REQUIRES_WRITE(SchemaVersion)) { auto observer = Log::removeObserver(); auto flo = dynamic_cast<FixtureLogObserver*>(observer.get()); - EXPECT_EQ(1ul, flo->count({ EventSeverity::Warning, Event::Database, -1, "Removing existing incompatible offline database" })); + EXPECT_EQ(1u, flo->count({ EventSeverity::Warning, Event::Database, -1, "Removing existing incompatible offline database" })); } TEST(OfflineDatabase, TEST_REQUIRES_WRITE(Invalid)) { @@ -129,7 +129,7 @@ TEST(OfflineDatabase, TEST_REQUIRES_WRITE(Invalid)) { auto observer = Log::removeObserver(); auto flo = dynamic_cast<FixtureLogObserver*>(observer.get()); - EXPECT_EQ(1ul, flo->count({ EventSeverity::Warning, Event::Database, -1, "Removing existing incompatible offline database" })); + EXPECT_EQ(1u, flo->count({ EventSeverity::Warning, Event::Database, -1, "Removing existing incompatible offline database" })); } TEST(OfflineDatabase, PutDoesNotStoreConnectionErrors) { @@ -169,7 +169,7 @@ TEST(OfflineDatabase, PutResource) { response.data = std::make_shared<std::string>("first"); auto insertPutResult = db.put(resource, response); EXPECT_TRUE(insertPutResult.first); - EXPECT_EQ(5, insertPutResult.second); + EXPECT_EQ(5u, insertPutResult.second); auto insertGetResult = db.get(resource); EXPECT_EQ(nullptr, insertGetResult->error.get()); @@ -178,7 +178,7 @@ TEST(OfflineDatabase, PutResource) { response.data = std::make_shared<std::string>("second"); auto updatePutResult = db.put(resource, response); EXPECT_FALSE(updatePutResult.first); - EXPECT_EQ(6, updatePutResult.second); + EXPECT_EQ(6u, updatePutResult.second); auto updateGetResult = db.get(resource); EXPECT_EQ(nullptr, updateGetResult->error.get()); @@ -203,7 +203,7 @@ TEST(OfflineDatabase, PutTile) { response.data = std::make_shared<std::string>("first"); auto insertPutResult = db.put(resource, response); EXPECT_TRUE(insertPutResult.first); - EXPECT_EQ(5, insertPutResult.second); + EXPECT_EQ(5u, insertPutResult.second); auto insertGetResult = db.get(resource); EXPECT_EQ(nullptr, insertGetResult->error.get()); @@ -212,7 +212,7 @@ TEST(OfflineDatabase, PutTile) { response.data = std::make_shared<std::string>("second"); auto updatePutResult = db.put(resource, response); EXPECT_FALSE(updatePutResult.first); - EXPECT_EQ(6, updatePutResult.second); + EXPECT_EQ(6u, updatePutResult.second); auto updateGetResult = db.get(resource); EXPECT_EQ(nullptr, updateGetResult->error.get()); @@ -284,7 +284,7 @@ TEST(OfflineDatabase, ListRegions) { OfflineRegion region = db.createRegion(definition, metadata); std::vector<OfflineRegion> regions = db.listRegions(); - ASSERT_EQ(1, regions.size()); + ASSERT_EQ(1u, regions.size()); EXPECT_EQ(region.getID(), regions.at(0).getID()); EXPECT_EQ(definition.styleURL, regions.at(0).getDefinition().styleURL); EXPECT_EQ(definition.bounds, regions.at(0).getDefinition().bounds); @@ -327,7 +327,7 @@ TEST(OfflineDatabase, DeleteRegion) { db.deleteRegion(std::move(region)); - ASSERT_EQ(0, db.listRegions().size()); + ASSERT_EQ(0u, db.listRegions().size()); } TEST(OfflineDatabase, CreateRegionInfiniteMaxZoom) { @@ -391,15 +391,15 @@ TEST(OfflineDatabase, PutReturnsSize) { Response compressible; compressible.data = std::make_shared<std::string>(1024, 0); - EXPECT_EQ(17, db.put(Resource::style("http://example.com/compressible"), compressible).second); + EXPECT_EQ(17u, db.put(Resource::style("http://example.com/compressible"), compressible).second); Response incompressible; incompressible.data = randomString(1024); - EXPECT_EQ(1024, db.put(Resource::style("http://example.com/incompressible"), incompressible).second); + EXPECT_EQ(1024u, db.put(Resource::style("http://example.com/incompressible"), incompressible).second); Response noContent; noContent.noContent = true; - EXPECT_EQ(0, db.put(Resource::style("http://example.com/noContent"), noContent).second); + EXPECT_EQ(0u, db.put(Resource::style("http://example.com/noContent"), noContent).second); } TEST(OfflineDatabase, PutEvictsLeastRecentlyUsedResources) { @@ -458,10 +458,10 @@ TEST(OfflineDatabase, GetRegionCompletedStatus) { OfflineRegion region = db.createRegion(definition, metadata); OfflineRegionStatus status1 = db.getRegionCompletedStatus(region.getID()); - EXPECT_EQ(0, status1.completedResourceCount); - EXPECT_EQ(0, status1.completedResourceSize); - EXPECT_EQ(0, status1.completedTileCount); - EXPECT_EQ(0, status1.completedTileSize); + EXPECT_EQ(0u, status1.completedResourceCount); + EXPECT_EQ(0u, status1.completedResourceSize); + EXPECT_EQ(0u, status1.completedTileCount); + EXPECT_EQ(0u, status1.completedTileSize); Response response; response.data = std::make_shared<std::string>("data"); @@ -469,17 +469,17 @@ TEST(OfflineDatabase, GetRegionCompletedStatus) { uint64_t styleSize = db.putRegionResource(region.getID(), Resource::style("http://example.com/"), response); OfflineRegionStatus status2 = db.getRegionCompletedStatus(region.getID()); - EXPECT_EQ(1, status2.completedResourceCount); + EXPECT_EQ(1u, status2.completedResourceCount); EXPECT_EQ(styleSize, status2.completedResourceSize); - EXPECT_EQ(0, status2.completedTileCount); - EXPECT_EQ(0, status2.completedTileSize); + EXPECT_EQ(0u, status2.completedTileCount); + EXPECT_EQ(0u, status2.completedTileSize); uint64_t tileSize = db.putRegionResource(region.getID(), Resource::tile("http://example.com/", 1.0, 0, 0, 0), response); OfflineRegionStatus status3 = db.getRegionCompletedStatus(region.getID()); - EXPECT_EQ(2, status3.completedResourceCount); + EXPECT_EQ(2u, status3.completedResourceCount); EXPECT_EQ(styleSize + tileSize, status3.completedResourceSize); - EXPECT_EQ(1, status3.completedTileCount); + EXPECT_EQ(1u, status3.completedTileCount); EXPECT_EQ(tileSize, status3.completedTileSize); } @@ -501,43 +501,43 @@ TEST(OfflineDatabase, OfflineMapboxTileCount) { response.data = std::make_shared<std::string>("data"); // Count is initially zero. - EXPECT_EQ(0, db.getOfflineMapboxTileCount()); + EXPECT_EQ(0u, db.getOfflineMapboxTileCount()); // Count stays the same after putting a non-tile resource. db.putRegionResource(region1.getID(), Resource::style("http://example.com/"), response); - EXPECT_EQ(0, db.getOfflineMapboxTileCount()); + EXPECT_EQ(0u, db.getOfflineMapboxTileCount()); // Count stays the same after putting a non-Mapbox tile. db.putRegionResource(region1.getID(), nonMapboxTile, response); - EXPECT_EQ(0, db.getOfflineMapboxTileCount()); + EXPECT_EQ(0u, db.getOfflineMapboxTileCount()); // Count increases after putting a Mapbox tile not used by another region. db.putRegionResource(region1.getID(), mapboxTile1, response); - EXPECT_EQ(1, db.getOfflineMapboxTileCount()); + EXPECT_EQ(1u, db.getOfflineMapboxTileCount()); // Count stays the same after putting a Mapbox tile used by another region. db.putRegionResource(region2.getID(), mapboxTile1, response); - EXPECT_EQ(1, db.getOfflineMapboxTileCount()); + EXPECT_EQ(1u, db.getOfflineMapboxTileCount()); // Count stays the same after putting a Mapbox tile used by the same region. db.putRegionResource(region2.getID(), mapboxTile1, response); - EXPECT_EQ(1, db.getOfflineMapboxTileCount()); + EXPECT_EQ(1u, db.getOfflineMapboxTileCount()); // Count stays the same after deleting a region when the tile is still used by another region. db.deleteRegion(std::move(region2)); - EXPECT_EQ(1, db.getOfflineMapboxTileCount()); + EXPECT_EQ(1u, db.getOfflineMapboxTileCount()); // Count stays the same after the putting a non-offline Mapbox tile. db.put(mapboxTile2, response); - EXPECT_EQ(1, db.getOfflineMapboxTileCount()); + EXPECT_EQ(1u, db.getOfflineMapboxTileCount()); // Count increases after putting a pre-existing, but non-offline Mapbox tile. db.putRegionResource(region1.getID(), mapboxTile2, response); - EXPECT_EQ(2, db.getOfflineMapboxTileCount()); + EXPECT_EQ(2u, db.getOfflineMapboxTileCount()); // Count decreases after deleting a region when the tiles are not used by other regions. db.deleteRegion(std::move(region1)); - EXPECT_EQ(0, db.getOfflineMapboxTileCount()); + EXPECT_EQ(0u, db.getOfflineMapboxTileCount()); } static int databasePageCount(const std::string& path) { diff --git a/test/storage/offline_download.cpp b/test/storage/offline_download.cpp index 7ac9b94e81..eb676e3b8d 100644 --- a/test/storage/offline_download.cpp +++ b/test/storage/offline_download.cpp @@ -77,12 +77,12 @@ TEST(OfflineDownload, NoSubresources) { if (!expectsInactiveStatus) { expectsInactiveStatus = true; EXPECT_EQ(OfflineRegionDownloadState::Active, status.downloadState); - EXPECT_EQ(1, status.completedResourceCount); + EXPECT_EQ(1u, status.completedResourceCount); EXPECT_EQ(test.size, status.completedResourceSize); EXPECT_TRUE(status.requiredResourceCountIsPrecise); } else { EXPECT_EQ(OfflineRegionDownloadState::Inactive, status.downloadState); - EXPECT_EQ(1, status.completedResourceCount); + EXPECT_EQ(1u, status.completedResourceCount); EXPECT_EQ(test.size, status.completedResourceSize); EXPECT_TRUE(status.requiredResourceCountIsPrecise); test.loop.stop(); @@ -123,7 +123,7 @@ TEST(OfflineDownload, InlineSource) { observer->statusChangedFn = [&] (OfflineRegionStatus status) { if (status.complete()) { - EXPECT_EQ(2, status.completedResourceCount); + EXPECT_EQ(2u, status.completedResourceCount); EXPECT_EQ(test.size, status.completedResourceSize); EXPECT_TRUE(status.requiredResourceCountIsPrecise); test.loop.stop(); @@ -158,7 +158,7 @@ TEST(OfflineDownload, GeoJSONSource) { observer->statusChangedFn = [&] (OfflineRegionStatus status) { if (status.complete()) { - EXPECT_EQ(2, status.completedResourceCount); + EXPECT_EQ(2u, status.completedResourceCount); EXPECT_EQ(test.size, status.completedResourceSize); EXPECT_TRUE(status.requiredResourceCountIsPrecise); test.loop.stop(); @@ -217,7 +217,7 @@ TEST(OfflineDownload, Activate) { observer->statusChangedFn = [&] (OfflineRegionStatus status) { if (status.complete()) { - EXPECT_EQ(261, status.completedResourceCount); // 256 glyphs, 1 tile, 1 style, source, sprite image, and sprite json + EXPECT_EQ(261u, status.completedResourceCount); // 256 glyphs, 1 tile, 1 style, source, sprite image, and sprite json EXPECT_EQ(test.size, status.completedResourceSize); download.setState(OfflineRegionDownloadState::Inactive); @@ -226,6 +226,8 @@ TEST(OfflineDownload, Activate) { EXPECT_EQ(status.requiredResourceCount, computedStatus.requiredResourceCount); EXPECT_EQ(status.completedResourceCount, computedStatus.completedResourceCount); EXPECT_EQ(status.completedResourceSize, computedStatus.completedResourceSize); + EXPECT_EQ(status.completedTileCount, computedStatus.completedTileCount); + EXPECT_EQ(status.completedTileSize, computedStatus.completedTileSize); EXPECT_TRUE(status.requiredResourceCountIsPrecise); test.loop.stop(); @@ -248,9 +250,9 @@ TEST(OfflineDownload, GetStatusNoResources) { OfflineRegionStatus status = download.getStatus(); EXPECT_EQ(OfflineRegionDownloadState::Inactive, status.downloadState); - EXPECT_EQ(0, status.completedResourceCount); - EXPECT_EQ(0, status.completedResourceSize); - EXPECT_EQ(1, status.requiredResourceCount); + EXPECT_EQ(0u, status.completedResourceCount); + EXPECT_EQ(0u, status.completedResourceSize); + EXPECT_EQ(1u, status.requiredResourceCount); EXPECT_FALSE(status.requiredResourceCountIsPrecise); EXPECT_FALSE(status.complete()); } @@ -270,9 +272,9 @@ TEST(OfflineDownload, GetStatusStyleComplete) { OfflineRegionStatus status = download.getStatus(); EXPECT_EQ(OfflineRegionDownloadState::Inactive, status.downloadState); - EXPECT_EQ(1, status.completedResourceCount); + EXPECT_EQ(1u, status.completedResourceCount); EXPECT_EQ(test.size, status.completedResourceSize); - EXPECT_EQ(260, status.requiredResourceCount); + EXPECT_EQ(260u, status.requiredResourceCount); EXPECT_FALSE(status.requiredResourceCountIsPrecise); EXPECT_FALSE(status.complete()); } @@ -296,9 +298,9 @@ TEST(OfflineDownload, GetStatusStyleAndSourceComplete) { OfflineRegionStatus status = download.getStatus(); EXPECT_EQ(OfflineRegionDownloadState::Inactive, status.downloadState); - EXPECT_EQ(2, status.completedResourceCount); + EXPECT_EQ(2u, status.completedResourceCount); EXPECT_EQ(test.size, status.completedResourceSize); - EXPECT_EQ(261, status.requiredResourceCount); + EXPECT_EQ(261u, status.requiredResourceCount); EXPECT_TRUE(status.requiredResourceCountIsPrecise); EXPECT_FALSE(status.complete()); } @@ -353,7 +355,7 @@ TEST(OfflineDownload, RequestErrorsAreRetried) { observer->statusChangedFn = [&] (OfflineRegionStatus status) { if (status.complete()) { - EXPECT_EQ(1, status.completedResourceCount); + EXPECT_EQ(1u, status.completedResourceCount); test.loop.stop(); } }; @@ -391,7 +393,7 @@ TEST(OfflineDownload, TileCountLimitExceededNoTileResponse) { }; observer->statusChangedFn = [&] (OfflineRegionStatus status) { - if (!mapboxTileCountLimitExceededCalled) { + if (!mapboxTileCountLimitExceededCalled) { EXPECT_FALSE(status.complete()); EXPECT_EQ(OfflineRegionDownloadState::Active, status.downloadState); } else { @@ -422,7 +424,7 @@ TEST(OfflineDownload, TileCountLimitExceededWithTileResponse) { EXPECT_EQ("http://127.0.0.1:3000/style.json", resource.url); return test.response("mapbox_source.style.json"); }; - + test.fileSource.tileResponse = [&] (const Resource& resource) { const Resource::TileData& tile = *resource.tileData; EXPECT_EQ("mapbox://{z}-{x}-{y}.vector.pbf", tile.urlTemplate); @@ -442,7 +444,7 @@ TEST(OfflineDownload, TileCountLimitExceededWithTileResponse) { mapboxTileCountLimitExceededCalled = true; }; - observer->statusChangedFn = [&] (OfflineRegionStatus status) { + observer->statusChangedFn = [&] (OfflineRegionStatus status) { if (!mapboxTileCountLimitExceededCalled) { EXPECT_EQ(OfflineRegionDownloadState::Active, status.downloadState); } else { @@ -481,7 +483,7 @@ TEST(OfflineDownload, WithPreviouslyExistingTile) { observer->statusChangedFn = [&] (OfflineRegionStatus status) { if (status.complete()) { - EXPECT_EQ(2, status.completedResourceCount); + EXPECT_EQ(2u, status.completedResourceCount); EXPECT_EQ(test.size, status.completedResourceSize); EXPECT_TRUE(status.requiredResourceCountIsPrecise); test.loop.stop(); @@ -543,22 +545,22 @@ TEST(OfflineDownload, ReactivatePreviouslyCompletedDownload) { test.loop.run(); - ASSERT_EQ(4, statusesAfterReactivate.size()); + ASSERT_EQ(4u, statusesAfterReactivate.size()); EXPECT_EQ(OfflineRegionDownloadState::Active, statusesAfterReactivate[0].downloadState); EXPECT_FALSE(statusesAfterReactivate[0].requiredResourceCountIsPrecise); - EXPECT_EQ(1, statusesAfterReactivate[0].requiredResourceCount); - EXPECT_EQ(0, statusesAfterReactivate[0].completedResourceCount); + EXPECT_EQ(1u, statusesAfterReactivate[0].requiredResourceCount); + EXPECT_EQ(0u, statusesAfterReactivate[0].completedResourceCount); EXPECT_EQ(OfflineRegionDownloadState::Active, statusesAfterReactivate[1].downloadState); EXPECT_TRUE(statusesAfterReactivate[1].requiredResourceCountIsPrecise); - EXPECT_EQ(2, statusesAfterReactivate[1].requiredResourceCount); - EXPECT_EQ(1, statusesAfterReactivate[1].completedResourceCount); + EXPECT_EQ(2u, statusesAfterReactivate[1].requiredResourceCount); + EXPECT_EQ(1u, statusesAfterReactivate[1].completedResourceCount); EXPECT_EQ(OfflineRegionDownloadState::Active, statusesAfterReactivate[2].downloadState); EXPECT_TRUE(statusesAfterReactivate[2].requiredResourceCountIsPrecise); - EXPECT_EQ(2, statusesAfterReactivate[2].requiredResourceCount); - EXPECT_EQ(2, statusesAfterReactivate[2].completedResourceCount); + EXPECT_EQ(2u, statusesAfterReactivate[2].requiredResourceCount); + EXPECT_EQ(2u, statusesAfterReactivate[2].completedResourceCount); } TEST(OfflineDownload, Deactivate) { diff --git a/test/storage/resource.cpp b/test/storage/resource.cpp index 5d6c3bcbf2..02559f3e84 100644 --- a/test/storage/resource.cpp +++ b/test/storage/resource.cpp @@ -36,6 +36,62 @@ TEST(Resource, Tile) { EXPECT_EQ(1, vectorTile.tileData->x); EXPECT_EQ(2, vectorTile.tileData->y); EXPECT_EQ(3, vectorTile.tileData->z); + + Resource quadTile = Resource::tile("http://example.com/{quadkey}.png", 2.0, 0, 0, 1); + EXPECT_EQ(Resource::Kind::Tile, quadTile.kind); + EXPECT_EQ("http://example.com/0.png", quadTile.url); + EXPECT_EQ("http://example.com/{quadkey}.png", quadTile.tileData->urlTemplate); + EXPECT_EQ(1, quadTile.tileData->pixelRatio); + EXPECT_EQ(0, quadTile.tileData->x); + EXPECT_EQ(0, quadTile.tileData->y); + EXPECT_EQ(1, quadTile.tileData->z); + + quadTile = Resource::tile("http://example.com/{quadkey}.png", 2.0, 0, 0, 2); + EXPECT_EQ(Resource::Kind::Tile, quadTile.kind); + EXPECT_EQ("http://example.com/00.png", quadTile.url); + EXPECT_EQ("http://example.com/{quadkey}.png", quadTile.tileData->urlTemplate); + EXPECT_EQ(1, quadTile.tileData->pixelRatio); + EXPECT_EQ(0, quadTile.tileData->x); + EXPECT_EQ(0, quadTile.tileData->y); + EXPECT_EQ(2, quadTile.tileData->z); + + quadTile = Resource::tile("http://example.com/{quadkey}.png", 2.0, 1, 1, 2); + EXPECT_EQ(Resource::Kind::Tile, quadTile.kind); + EXPECT_EQ("http://example.com/03.png", quadTile.url); + EXPECT_EQ("http://example.com/{quadkey}.png", quadTile.tileData->urlTemplate); + EXPECT_EQ(1, quadTile.tileData->pixelRatio); + EXPECT_EQ(1, quadTile.tileData->x); + EXPECT_EQ(1, quadTile.tileData->y); + EXPECT_EQ(2, quadTile.tileData->z); + + quadTile = Resource::tile("http://example.com/{quadkey}.png", 2.0, 22914, 52870, 17); + EXPECT_EQ(Resource::Kind::Tile, quadTile.kind); + EXPECT_EQ("http://example.com/02301322130000230.png", quadTile.url); + EXPECT_EQ("http://example.com/{quadkey}.png", quadTile.tileData->urlTemplate); + EXPECT_EQ(1, quadTile.tileData->pixelRatio); + EXPECT_EQ(22914, quadTile.tileData->x); + EXPECT_EQ(52870, quadTile.tileData->y); + EXPECT_EQ(17, quadTile.tileData->z); + + // Test case confirmed by quadkeytools package + // https://bitbucket.org/steele/quadkeytools/src/master/test/quadkey.js?fileviewer=file-view-default#quadkey.js-57 + quadTile = Resource::tile("http://example.com/{quadkey}.png", 2.0, 29, 3, 6); + EXPECT_EQ(Resource::Kind::Tile, quadTile.kind); + EXPECT_EQ("http://example.com/011123.png", quadTile.url); + EXPECT_EQ("http://example.com/{quadkey}.png", quadTile.tileData->urlTemplate); + EXPECT_EQ(1, quadTile.tileData->pixelRatio); + EXPECT_EQ(29, quadTile.tileData->x); + EXPECT_EQ(3, quadTile.tileData->y); + EXPECT_EQ(6, quadTile.tileData->z); + + Resource wmsTile = Resource::tile("http://example.com/?bbox={bbox-epsg-3857}", 2.0, 0, 0, 1); + EXPECT_EQ(Resource::Kind::Tile, wmsTile.kind); + EXPECT_EQ("http://example.com/?bbox=-20037508.342789245,0,0,20037508.342789245", wmsTile.url); + EXPECT_EQ("http://example.com/?bbox={bbox-epsg-3857}", wmsTile.tileData->urlTemplate); + EXPECT_EQ(1, wmsTile.tileData->pixelRatio); + EXPECT_EQ(0, wmsTile.tileData->x); + EXPECT_EQ(0, wmsTile.tileData->y); + EXPECT_EQ(1, wmsTile.tileData->z); } TEST(Resource, Glyphs) { diff --git a/test/style/filter.cpp b/test/style/filter.cpp index 6e7f62db1b..b49f424a39 100644 --- a/test/style/filter.cpp +++ b/test/style/filter.cpp @@ -1,139 +1,125 @@ #include <mbgl/test/util.hpp> +#include <mbgl/util/feature.hpp> +#include <mbgl/util/geometry.hpp> #include <mbgl/style/filter.hpp> #include <mbgl/style/filter_evaluator.hpp> -#include <mbgl/style/parser.hpp> -#include <mbgl/tile/geometry_tile.hpp> +#include <mbgl/style/rapidjson_conversion.hpp> +#include <mbgl/style/conversion.hpp> +#include <mbgl/style/conversion/filter.hpp> #include <rapidjson/document.h> -#include <map> - using namespace mbgl; using namespace mbgl::style; -typedef std::multimap<std::string, mbgl::Value> Properties; - -class StubFeature : public GeometryTileFeature { -public: - inline StubFeature(const Properties& properties_, FeatureType type_) - : properties(properties_) - , type(type_) - {} - - optional<Value> getValue(const std::string &key) const override { - auto it = properties.find(key); - if (it == properties.end()) - return optional<Value>(); - return it->second; - } - - FeatureType getType() const override { - return type; - } - - GeometryCollection getGeometries() const override { - return GeometryCollection(); - } - -private: - const Properties properties; - FeatureType type; -}; - Filter parse(const char * expression) { rapidjson::GenericDocument<rapidjson::UTF8<>, rapidjson::CrtAllocator> doc; doc.Parse<0>(expression); - return parseFilter(doc); + return *conversion::convert<Filter>(doc); } -bool evaluate(const Filter& filter, const Properties& properties, FeatureType type = FeatureType::Unknown) { - StubFeature feature(properties, type); - FilterEvaluator evaluator(feature); - return Filter::visit(filter, evaluator); +Feature feature(const PropertyMap& properties, const Geometry<double>& geometry = Point<double>()) { + Feature result { geometry }; + result.properties = properties; + return result; } TEST(Filter, EqualsString) { Filter f = parse("[\"==\", \"foo\", \"bar\"]"); - ASSERT_TRUE(evaluate(f, {{ "foo", std::string("bar") }})); - ASSERT_FALSE(evaluate(f, {{ "foo", std::string("baz") }})); -}; + ASSERT_TRUE(f(feature({{ "foo", std::string("bar") }}))); + ASSERT_FALSE(f(feature({{ "foo", std::string("baz") }}))); +} TEST(Filter, EqualsNumber) { Filter f = parse("[\"==\", \"foo\", 0]"); - ASSERT_TRUE(evaluate(f, {{ "foo", int64_t(0) }})); - ASSERT_TRUE(evaluate(f, {{ "foo", uint64_t(0) }})); - ASSERT_TRUE(evaluate(f, {{ "foo", double(0) }})); - ASSERT_FALSE(evaluate(f, {{ "foo", int64_t(1) }})); - ASSERT_FALSE(evaluate(f, {{ "foo", uint64_t(1) }})); - ASSERT_FALSE(evaluate(f, {{ "foo", double(1) }})); - ASSERT_FALSE(evaluate(f, {{ "foo", std::string("0") }})); - ASSERT_FALSE(evaluate(f, {{ "foo", false }})); - ASSERT_FALSE(evaluate(f, {{ "foo", true }})); - ASSERT_FALSE(evaluate(f, {{}})); + ASSERT_TRUE(f(feature({{ "foo", int64_t(0) }}))); + ASSERT_TRUE(f(feature({{ "foo", uint64_t(0) }}))); + ASSERT_TRUE(f(feature({{ "foo", double(0) }}))); + ASSERT_FALSE(f(feature({{ "foo", int64_t(1) }}))); + ASSERT_FALSE(f(feature({{ "foo", uint64_t(1) }}))); + ASSERT_FALSE(f(feature({{ "foo", double(1) }}))); + ASSERT_FALSE(f(feature({{ "foo", std::string("0") }}))); + ASSERT_FALSE(f(feature({{ "foo", false }}))); + ASSERT_FALSE(f(feature({{ "foo", true }}))); + ASSERT_FALSE(f(feature({{ "foo", nullptr }}))); + ASSERT_FALSE(f(feature({{}}))); } TEST(Filter, EqualsType) { Filter f = parse("[\"==\", \"$type\", \"LineString\"]"); - ASSERT_FALSE(evaluate(f, {{}}, FeatureType::Point)); - ASSERT_TRUE(evaluate(f, {{}}, FeatureType::LineString)); + ASSERT_FALSE(f(feature({{}}, Point<double>()))); + ASSERT_TRUE(f(feature({{}}, LineString<double>()))); } TEST(Filter, InType) { Filter f = parse("[\"in\", \"$type\", \"LineString\", \"Polygon\"]"); - ASSERT_FALSE(evaluate(f, {{}}, FeatureType::Point)); - ASSERT_TRUE(evaluate(f, {{}}, FeatureType::LineString)); - ASSERT_TRUE(evaluate(f, {{}}, FeatureType::Polygon)); + ASSERT_FALSE(f(feature({{}}, Point<double>()))); + ASSERT_TRUE(f(feature({{}}, LineString<double>()))); + ASSERT_TRUE(f(feature({{}}, Polygon<double>()))); } TEST(Filter, Any) { - ASSERT_FALSE(evaluate(parse("[\"any\"]"), {{}})); - ASSERT_TRUE(evaluate(parse("[\"any\", [\"==\", \"foo\", 1]]"), - {{ std::string("foo"), int64_t(1) }})); - ASSERT_FALSE(evaluate(parse("[\"any\", [\"==\", \"foo\", 0]]"), - {{ std::string("foo"), int64_t(1) }})); - ASSERT_TRUE(evaluate(parse("[\"any\", [\"==\", \"foo\", 0], [\"==\", \"foo\", 1]]"), - {{ std::string("foo"), int64_t(1) }})); + ASSERT_FALSE(parse("[\"any\"]")(feature({{}}))); + ASSERT_TRUE(parse("[\"any\", [\"==\", \"foo\", 1]]")( + feature({{ std::string("foo"), int64_t(1) }}))); + ASSERT_FALSE(parse("[\"any\", [\"==\", \"foo\", 0]]")( + feature({{ std::string("foo"), int64_t(1) }}))); + ASSERT_TRUE(parse("[\"any\", [\"==\", \"foo\", 0], [\"==\", \"foo\", 1]]")( + feature({{ std::string("foo"), int64_t(1) }}))); } TEST(Filter, All) { - ASSERT_TRUE(evaluate(parse("[\"all\"]"), {{}})); - ASSERT_TRUE(evaluate(parse("[\"all\", [\"==\", \"foo\", 1]]"), - {{ std::string("foo"), int64_t(1) }})); - ASSERT_FALSE(evaluate(parse("[\"all\", [\"==\", \"foo\", 0]]"), - {{ std::string("foo"), int64_t(1) }})); - ASSERT_FALSE(evaluate(parse("[\"all\", [\"==\", \"foo\", 0], [\"==\", \"foo\", 1]]"), - {{ std::string("foo"), int64_t(1) }})); + ASSERT_TRUE(parse("[\"all\"]")(feature({{}}))); + ASSERT_TRUE(parse("[\"all\", [\"==\", \"foo\", 1]]")( + feature({{ std::string("foo"), int64_t(1) }}))); + ASSERT_FALSE(parse("[\"all\", [\"==\", \"foo\", 0]]")( + feature({{ std::string("foo"), int64_t(1) }}))); + ASSERT_FALSE(parse("[\"all\", [\"==\", \"foo\", 0], [\"==\", \"foo\", 1]]")( + feature({{ std::string("foo"), int64_t(1) }}))); } TEST(Filter, None) { - ASSERT_TRUE(evaluate(parse("[\"none\"]"), {{}})); - ASSERT_FALSE(evaluate(parse("[\"none\", [\"==\", \"foo\", 1]]"), - {{ std::string("foo"), int64_t(1) }})); - ASSERT_TRUE(evaluate(parse("[\"none\", [\"==\", \"foo\", 0]]"), - {{ std::string("foo"), int64_t(1) }})); - ASSERT_FALSE(evaluate(parse("[\"none\", [\"==\", \"foo\", 0], [\"==\", \"foo\", 1]]"), - {{ std::string("foo"), int64_t(1) }})); + ASSERT_TRUE(parse("[\"none\"]")(feature({{}}))); + ASSERT_FALSE(parse("[\"none\", [\"==\", \"foo\", 1]]")( + feature({{ std::string("foo"), int64_t(1) }}))); + ASSERT_TRUE(parse("[\"none\", [\"==\", \"foo\", 0]]")( + feature({{ std::string("foo"), int64_t(1) }}))); + ASSERT_FALSE(parse("[\"none\", [\"==\", \"foo\", 0], [\"==\", \"foo\", 1]]")( + feature({{ std::string("foo"), int64_t(1) }}))); } TEST(Filter, Has) { - ASSERT_TRUE(evaluate(parse("[\"has\", \"foo\"]"), - {{ std::string("foo"), int64_t(1) }})); - ASSERT_TRUE(evaluate(parse("[\"has\", \"foo\"]"), - {{ std::string("foo"), int64_t(0) }})); - ASSERT_TRUE(evaluate(parse("[\"has\", \"foo\"]"), - {{ std::string("foo"), false }})); - ASSERT_FALSE(evaluate(parse("[\"has\", \"foo\"]"), - {{}})); + ASSERT_TRUE(parse("[\"has\", \"foo\"]")( + feature({{ std::string("foo"), int64_t(1) }}))); + ASSERT_TRUE(parse("[\"has\", \"foo\"]")( + feature({{ std::string("foo"), int64_t(0) }}))); + ASSERT_TRUE(parse("[\"has\", \"foo\"]")( + feature({{ std::string("foo"), false }}))); + ASSERT_FALSE(parse("[\"has\", \"foo\"]")( + feature({{}}))); } TEST(Filter, NotHas) { - ASSERT_FALSE(evaluate(parse("[\"!has\", \"foo\"]"), - {{ std::string("foo"), int64_t(1) }})); - ASSERT_FALSE(evaluate(parse("[\"!has\", \"foo\"]"), - {{ std::string("foo"), int64_t(0) }})); - ASSERT_FALSE(evaluate(parse("[\"!has\", \"foo\"]"), - {{ std::string("foo"), false }})); - ASSERT_TRUE(evaluate(parse("[\"!has\", \"foo\"]"), - {{}})); + ASSERT_FALSE(parse("[\"!has\", \"foo\"]")( + feature({{ std::string("foo"), int64_t(1) }}))); + ASSERT_FALSE(parse("[\"!has\", \"foo\"]")( + feature({{ std::string("foo"), int64_t(0) }}))); + ASSERT_FALSE(parse("[\"!has\", \"foo\"]")( + feature({{ std::string("foo"), false }}))); + ASSERT_TRUE(parse("[\"!has\", \"foo\"]")( + feature({{}}))); +} + +TEST(Filter, ID) { + Feature feature1 { Point<double>() }; + feature1.id = { 1234 }; + + ASSERT_TRUE(parse("[\"==\", \"$id\", 1234]")(feature1)); + ASSERT_FALSE(parse("[\"==\", \"$id\", \"1234\"]")(feature1)); + + Feature feature2 { Point<double>() }; + feature2.properties["id"] = { 1234 }; + + ASSERT_FALSE(parse("[\"==\", \"$id\", 1234]")(feature2)); } diff --git a/test/style/source.cpp b/test/style/source.cpp index ae8fb54d2f..59b2524e17 100644 --- a/test/style/source.cpp +++ b/test/style/source.cpp @@ -2,15 +2,19 @@ #include <mbgl/test/stub_file_source.hpp> #include <mbgl/test/stub_style_observer.hpp> -#include <mbgl/style/source.hpp> +#include <mbgl/style/source_impl.hpp> +#include <mbgl/style/sources/raster_source.hpp> +#include <mbgl/style/sources/vector_source.hpp> +#include <mbgl/style/sources/geojson_source.hpp> + #include <mbgl/util/run_loop.hpp> #include <mbgl/util/string.hpp> #include <mbgl/util/io.hpp> +#include <mbgl/util/tileset.hpp> #include <mbgl/platform/log.hpp> #include <mbgl/map/transform.hpp> #include <mbgl/util/worker.hpp> -#include <mbgl/gl/texture_pool.hpp> #include <mbgl/style/style.hpp> #include <mbgl/style/update_parameters.hpp> #include <mbgl/style/layers/line_layer.hpp> @@ -28,7 +32,6 @@ public: Transform transform; TransformState transformState; Worker worker { 1 }; - gl::TexturePool texturePool; AnnotationManager annotationManager { 1.0 }; style::Style style { fileSource, 1.0 }; @@ -39,7 +42,6 @@ public: transformState, worker, fileSource, - texturePool, true, MapMode::Continuous, annotationManager, @@ -78,14 +80,14 @@ TEST(Source, LoadingFail) { }; test.observer.sourceError = [&] (Source& source, std::exception_ptr error) { - EXPECT_EQ("url", source.url); + EXPECT_EQ("source", source.getID()); EXPECT_EQ("Failed by the test case", util::toString(error)); test.end(); }; - Source source(SourceType::Vector, "source", "url", 512, nullptr, nullptr); - source.setObserver(&test.observer); - source.load(test.fileSource); + VectorSource source("source", "url"); + source.baseImpl->setObserver(&test.observer); + source.baseImpl->load(test.fileSource); test.run(); } @@ -101,14 +103,14 @@ TEST(Source, LoadingCorrupt) { }; test.observer.sourceError = [&] (Source& source, std::exception_ptr error) { - EXPECT_EQ("url", source.url); + EXPECT_EQ("source", source.getID()); EXPECT_EQ("0 - Invalid value.", util::toString(error)); test.end(); }; - Source source(SourceType::Vector, "source", "url", 512, nullptr, nullptr); - source.setObserver(&test.observer); - source.load(test.fileSource); + VectorSource source("source", "url"); + source.baseImpl->setObserver(&test.observer); + source.baseImpl->load(test.fileSource); test.run(); } @@ -123,7 +125,7 @@ TEST(Source, RasterTileEmpty) { }; test.observer.tileLoaded = [&] (Source& source, const OverscaledTileID&, bool) { - EXPECT_EQ("source", source.id); + EXPECT_EQ("source", source.getID()); test.end(); }; @@ -131,13 +133,13 @@ TEST(Source, RasterTileEmpty) { FAIL() << "Should never be called"; }; - auto tileset = std::make_unique<Tileset>(); - tileset->tiles = { "tiles" }; + Tileset tileset; + tileset.tiles = { "tiles" }; - Source source(SourceType::Raster, "source", "", 512, std::move(tileset), nullptr); - source.setObserver(&test.observer); - source.load(test.fileSource); - source.update(test.updateParameters); + RasterSource source("source", tileset, 512); + source.baseImpl->setObserver(&test.observer); + source.baseImpl->load(test.fileSource); + source.baseImpl->update(test.updateParameters); test.run(); } @@ -152,7 +154,7 @@ TEST(Source, VectorTileEmpty) { }; test.observer.tileLoaded = [&] (Source& source, const OverscaledTileID&, bool) { - EXPECT_EQ("source", source.id); + EXPECT_EQ("source", source.getID()); test.end(); }; @@ -160,13 +162,13 @@ TEST(Source, VectorTileEmpty) { FAIL() << "Should never be called"; }; - auto tileset = std::make_unique<Tileset>(); - tileset->tiles = { "tiles" }; + Tileset tileset; + tileset.tiles = { "tiles" }; - Source source(SourceType::Vector, "source", "", 512, std::move(tileset), nullptr); - source.setObserver(&test.observer); - source.load(test.fileSource); - source.update(test.updateParameters); + VectorSource source("source", tileset); + source.baseImpl->setObserver(&test.observer); + source.baseImpl->load(test.fileSource); + source.baseImpl->update(test.updateParameters); test.run(); } @@ -183,19 +185,19 @@ TEST(Source, RasterTileFail) { }; test.observer.tileError = [&] (Source& source, const OverscaledTileID& tileID, std::exception_ptr error) { - EXPECT_EQ(SourceType::Raster, source.type); + EXPECT_EQ(SourceType::Raster, source.baseImpl->type); EXPECT_EQ(OverscaledTileID(0, 0, 0), tileID); EXPECT_EQ("Failed by the test case", util::toString(error)); test.end(); }; - auto tileset = std::make_unique<Tileset>(); - tileset->tiles = { "tiles" }; + Tileset tileset; + tileset.tiles = { "tiles" }; - Source source(SourceType::Raster, "source", "", 512, std::move(tileset), nullptr); - source.setObserver(&test.observer); - source.load(test.fileSource); - source.update(test.updateParameters); + RasterSource source("source", tileset, 512); + source.baseImpl->setObserver(&test.observer); + source.baseImpl->load(test.fileSource); + source.baseImpl->update(test.updateParameters); test.run(); } @@ -212,19 +214,19 @@ TEST(Source, VectorTileFail) { }; test.observer.tileError = [&] (Source& source, const OverscaledTileID& tileID, std::exception_ptr error) { - EXPECT_EQ(SourceType::Vector, source.type); + EXPECT_EQ(SourceType::Vector, source.baseImpl->type); EXPECT_EQ(OverscaledTileID(0, 0, 0), tileID); EXPECT_EQ("Failed by the test case", util::toString(error)); test.end(); }; - auto tileset = std::make_unique<Tileset>(); - tileset->tiles = { "tiles" }; + Tileset tileset; + tileset.tiles = { "tiles" }; - Source source(SourceType::Vector, "source", "", 512, std::move(tileset), nullptr); - source.setObserver(&test.observer); - source.load(test.fileSource); - source.update(test.updateParameters); + VectorSource source("source", tileset); + source.baseImpl->setObserver(&test.observer); + source.baseImpl->load(test.fileSource); + source.baseImpl->update(test.updateParameters); test.run(); } @@ -239,20 +241,20 @@ TEST(Source, RasterTileCorrupt) { }; test.observer.tileError = [&] (Source& source, const OverscaledTileID& tileID, std::exception_ptr error) { - EXPECT_EQ(source.type, SourceType::Raster); + EXPECT_EQ(source.baseImpl->type, SourceType::Raster); EXPECT_EQ(OverscaledTileID(0, 0, 0), tileID); EXPECT_TRUE(bool(error)); // Not asserting on platform-specific error text. test.end(); }; - auto tileset = std::make_unique<Tileset>(); - tileset->tiles = { "tiles" }; + Tileset tileset; + tileset.tiles = { "tiles" }; - Source source(SourceType::Raster, "source", "", 512, std::move(tileset), nullptr); - source.setObserver(&test.observer); - source.load(test.fileSource); - source.update(test.updateParameters); + RasterSource source("source", tileset, 512); + source.baseImpl->setObserver(&test.observer); + source.baseImpl->load(test.fileSource); + source.baseImpl->update(test.updateParameters); test.run(); } @@ -267,24 +269,24 @@ TEST(Source, VectorTileCorrupt) { }; test.observer.tileError = [&] (Source& source, const OverscaledTileID& tileID, std::exception_ptr error) { - EXPECT_EQ(source.type, SourceType::Vector); + EXPECT_EQ(source.baseImpl->type, SourceType::Vector); EXPECT_EQ(OverscaledTileID(0, 0, 0), tileID); EXPECT_EQ(util::toString(error), "unknown pbf field type exception"); test.end(); }; // Need to have at least one layer that uses the source. - auto layer = std::make_unique<LineLayer>("id"); - layer->setSource("source", "water"); + auto layer = std::make_unique<LineLayer>("id", "source"); + layer->setSourceLayer("water"); test.style.addLayer(std::move(layer)); - auto tileset = std::make_unique<Tileset>(); - tileset->tiles = { "tiles" }; + Tileset tileset; + tileset.tiles = { "tiles" }; - Source source(SourceType::Vector, "source", "", 512, std::move(tileset), nullptr); - source.setObserver(&test.observer); - source.load(test.fileSource); - source.update(test.updateParameters); + VectorSource source("source", tileset); + source.baseImpl->setObserver(&test.observer); + source.baseImpl->load(test.fileSource); + source.baseImpl->update(test.updateParameters); test.run(); } @@ -305,13 +307,13 @@ TEST(Source, RasterTileCancel) { FAIL() << "Should never be called"; }; - auto tileset = std::make_unique<Tileset>(); - tileset->tiles = { "tiles" }; + Tileset tileset; + tileset.tiles = { "tiles" }; - Source source(SourceType::Raster, "source", "", 512, std::move(tileset), nullptr); - source.setObserver(&test.observer); - source.load(test.fileSource); - source.update(test.updateParameters); + RasterSource source("source", tileset, 512); + source.baseImpl->setObserver(&test.observer); + source.baseImpl->load(test.fileSource); + source.baseImpl->update(test.updateParameters); test.run(); } @@ -332,13 +334,13 @@ TEST(Source, VectorTileCancel) { FAIL() << "Should never be called"; }; - auto tileset = std::make_unique<Tileset>(); - tileset->tiles = { "tiles" }; + Tileset tileset; + tileset.tiles = { "tiles" }; - Source source(SourceType::Vector, "source", "", 512, std::move(tileset), nullptr); - source.setObserver(&test.observer); - source.load(test.fileSource); - source.update(test.updateParameters); + VectorSource source("source", tileset); + source.baseImpl->setObserver(&test.observer); + source.baseImpl->load(test.fileSource); + source.baseImpl->update(test.updateParameters); test.run(); } diff --git a/test/style/style.cpp b/test/style/style.cpp index d530d9cbdd..1681bac1c9 100644 --- a/test/style/style.cpp +++ b/test/style/style.cpp @@ -2,7 +2,7 @@ #include <mbgl/test/stub_file_source.hpp> #include <mbgl/style/style.hpp> -#include <mbgl/style/source.hpp> +#include <mbgl/style/source_impl.hpp> #include <mbgl/util/io.hpp> using namespace mbgl; @@ -22,11 +22,11 @@ TEST(Style, UnusedSource) { Source *usedSource = style.getSource("usedsource"); EXPECT_TRUE(usedSource); - EXPECT_TRUE(usedSource->isLoaded()); + EXPECT_TRUE(usedSource->baseImpl->isLoaded()); Source *unusedSource = style.getSource("unusedsource"); EXPECT_TRUE(unusedSource); - EXPECT_FALSE(unusedSource->isLoaded()); + EXPECT_FALSE(unusedSource->baseImpl->isLoaded()); } TEST(Style, UnusedSourceActiveViaClassUpdate) { @@ -46,7 +46,7 @@ TEST(Style, UnusedSourceActiveViaClassUpdate) { Source *unusedSource = style.getSource("unusedsource"); EXPECT_TRUE(unusedSource); - EXPECT_TRUE(unusedSource->isLoaded()); + EXPECT_TRUE(unusedSource->baseImpl->isLoaded()); // Style classes should be cleared upon new style load. style.setJSON(util::read_file("test/fixtures/resources/style-unused-sources.json")); @@ -59,5 +59,5 @@ TEST(Style, UnusedSourceActiveViaClassUpdate) { unusedSource = style.getSource("unusedsource"); EXPECT_TRUE(unusedSource); - EXPECT_FALSE(unusedSource->isLoaded()); + EXPECT_FALSE(unusedSource->baseImpl->isLoaded()); } diff --git a/test/style/style_layer.cpp b/test/style/style_layer.cpp index ed8904dabd..9c6a6e924a 100644 --- a/test/style/style_layer.cpp +++ b/test/style/style_layer.cpp @@ -1,19 +1,212 @@ #include <mbgl/test/util.hpp> #include <mbgl/style/layers/background_layer.hpp> #include <mbgl/style/layers/background_layer_impl.hpp> +#include <mbgl/style/layers/circle_layer.hpp> +#include <mbgl/style/layers/circle_layer_impl.hpp> +#include <mbgl/style/layers/custom_layer.hpp> +#include <mbgl/style/layers/custom_layer_impl.hpp> +#include <mbgl/style/layers/fill_layer.hpp> +#include <mbgl/style/layers/fill_layer_impl.hpp> +#include <mbgl/style/layers/line_layer.hpp> +#include <mbgl/style/layers/line_layer_impl.hpp> +#include <mbgl/style/layers/raster_layer.hpp> +#include <mbgl/style/layers/raster_layer_impl.hpp> +#include <mbgl/style/layers/symbol_layer.hpp> +#include <mbgl/style/layers/symbol_layer_impl.hpp> +#include <mbgl/util/color.hpp> using namespace mbgl; using namespace mbgl::style; -TEST(Layer, Clone) { - std::unique_ptr<Layer> layer = std::make_unique<BackgroundLayer>("id"); - std::unique_ptr<Layer> clone = layer->baseImpl->clone(); - EXPECT_NE(layer.get(), clone.get()); - EXPECT_TRUE(reinterpret_cast<BackgroundLayer::Impl*>(clone->baseImpl.get())); -} +namespace { -TEST(Layer, CloneCopiesBaseProperties) { - std::unique_ptr<BackgroundLayer> layer = std::make_unique<BackgroundLayer>("id"); +template <class T, class... Params> void testClone(Params... params) { + auto layer = std::make_unique<T>(std::forward<Params>(params)...); + auto clone = layer->baseImpl->clone(); + EXPECT_NE(layer.get(), clone.get()); + EXPECT_TRUE(reinterpret_cast<typename T::Impl*>(clone->baseImpl.get())); layer->impl->id = "test"; EXPECT_EQ("test", layer->baseImpl->clone()->getID()); } + +const auto color = PropertyValue<Color> {{ 1, 0, 0, 1 }}; +const auto opacity = PropertyValue<float> { 1.0f }; +const auto radius = PropertyValue<float> { 1.0f }; +const auto blur = PropertyValue<float> { 1.0f }; +const auto pattern = PropertyValue<std::string> { "foo" }; +const auto antialias = PropertyValue<bool> { false }; +const auto translate = PropertyValue<std::array<float, 2>> {{{ 0, 0 }}}; +const auto translateAnchor = PropertyValue<TranslateAnchorType> { TranslateAnchorType::Map }; +const auto lineCap = PropertyValue<LineCapType> { LineCapType::Round }; +const auto lineJoin = PropertyValue<LineJoinType> { LineJoinType::Miter }; +const auto miterLimit = PropertyValue<float> { 1.0f }; +const auto roundLimit = PropertyValue<float> { 1.0f }; +const auto width = PropertyValue<float> { 1.0f }; +const auto gapWidth = PropertyValue<float> { 1.0f }; +const auto offset = PropertyValue<float> { 1.0f }; +const auto dashArray = PropertyValue<std::vector<float>> {{}}; +const auto hueRotate = PropertyValue<float> { 1.0f }; +const auto brightness = PropertyValue<float> { 1.0f }; +const auto saturation = PropertyValue<float> { 1.0f }; +const auto contrast = PropertyValue<float> { 1.0f }; +const auto duration = PropertyValue<float> { 1.0f }; + +} // namespace + +TEST(Layer, Clone) { + testClone<BackgroundLayer>("background"); + testClone<CircleLayer>("circle", "source"); + testClone<CustomLayer>("custom", [](void*){}, [](void*, const CustomLayerRenderParameters&){}, [](void*){}, nullptr), + testClone<FillLayer>("fill", "source"); + testClone<LineLayer>("line", "source"); + testClone<RasterLayer>("raster", "source"); + testClone<SymbolLayer>("symbol", "source"); +} + +TEST(Layer, BackgroundProperties) { + auto layer = std::make_unique<BackgroundLayer>("background"); + EXPECT_TRUE(layer->is<BackgroundLayer>()); + + // Paint properties + + layer->setBackgroundColor(color); + EXPECT_EQ(layer->getBackgroundColor().asConstant(), color.asConstant()); + + layer->setBackgroundOpacity(opacity); + EXPECT_EQ(layer->getBackgroundOpacity().asConstant(), opacity.asConstant()); + + layer->setBackgroundPattern(pattern); + EXPECT_EQ(layer->getBackgroundPattern().asConstant(), pattern.asConstant()); +} + +TEST(Layer, CircleProperties) { + auto layer = std::make_unique<CircleLayer>("circle", "source"); + EXPECT_TRUE(layer->is<CircleLayer>()); + + // Paint properties + + layer->setCircleColor(color); + EXPECT_EQ(layer->getCircleColor().asConstant(), color.asConstant()); + + layer->setCircleOpacity(opacity); + EXPECT_EQ(layer->getCircleOpacity().asConstant(), opacity.asConstant()); + + layer->setCircleRadius(radius); + EXPECT_EQ(layer->getCircleRadius().asConstant(), radius.asConstant()); + + layer->setCircleBlur(blur); + EXPECT_EQ(layer->getCircleBlur().asConstant(), blur.asConstant()); + + layer->setCircleTranslate(translate); + EXPECT_EQ(layer->getCircleTranslate().asConstant(), translate.asConstant()); + + layer->setCircleTranslateAnchor(translateAnchor); + EXPECT_EQ(layer->getCircleTranslateAnchor().asConstant(), translateAnchor.asConstant()); +} + +TEST(Layer, FillProperties) { + auto layer = std::make_unique<FillLayer>("fill", "source"); + EXPECT_TRUE(layer->is<FillLayer>()); + + // Paint properties + + layer->setFillColor(color); + EXPECT_EQ(layer->getFillColor().asConstant(), color.asConstant()); + + layer->setFillOutlineColor(color); + EXPECT_EQ(layer->getFillOutlineColor().asConstant(), color.asConstant()); + + layer->setFillOpacity(opacity); + EXPECT_EQ(layer->getFillOpacity().asConstant(), opacity.asConstant()); + + layer->setFillPattern(pattern); + EXPECT_EQ(layer->getFillPattern().asConstant(), pattern.asConstant()); + + layer->setFillAntialias(antialias); + EXPECT_EQ(layer->getFillAntialias().asConstant(), antialias.asConstant()); + + layer->setFillTranslate(translate); + EXPECT_EQ(layer->getFillTranslate().asConstant(), translate.asConstant()); + + layer->setFillTranslateAnchor(translateAnchor); + EXPECT_EQ(layer->getFillTranslateAnchor().asConstant(), translateAnchor.asConstant()); +} + +TEST(Layer, LineProperties) { + auto layer = std::make_unique<LineLayer>("line", "source"); + EXPECT_TRUE(layer->is<LineLayer>()); + + // Layout properties + + layer->setLineCap(lineCap); + EXPECT_EQ(layer->getLineCap().asConstant(), lineCap.asConstant()); + + layer->setLineJoin(lineJoin); + EXPECT_EQ(layer->getLineJoin().asConstant(), lineJoin.asConstant()); + + layer->setLineMiterLimit(miterLimit); + EXPECT_EQ(layer->getLineMiterLimit().asConstant(), miterLimit.asConstant()); + + layer->setLineRoundLimit(roundLimit); + EXPECT_EQ(layer->getLineRoundLimit().asConstant(), roundLimit.asConstant()); + + // Paint properties + + layer->setLineColor(color); + EXPECT_EQ(layer->getLineColor().asConstant(), color.asConstant()); + + layer->setLineOpacity(opacity); + EXPECT_EQ(layer->getLineOpacity().asConstant(), opacity.asConstant()); + + layer->setLineTranslate(translate); + EXPECT_EQ(layer->getLineTranslate().asConstant(), translate.asConstant()); + + layer->setLineTranslateAnchor(translateAnchor); + EXPECT_EQ(layer->getLineTranslateAnchor().asConstant(), translateAnchor.asConstant()); + + layer->setLineWidth(width); + EXPECT_EQ(layer->getLineWidth().asConstant(), width.asConstant()); + + layer->setLineGapWidth(gapWidth); + EXPECT_EQ(layer->getLineGapWidth().asConstant(), gapWidth.asConstant()); + + layer->setLineOffset(offset); + EXPECT_EQ(layer->getLineOffset().asConstant(), offset.asConstant()); + + layer->setLineBlur(blur); + EXPECT_EQ(layer->getLineBlur().asConstant(), blur.asConstant()); + + layer->setLineDasharray(dashArray); + EXPECT_EQ(layer->getLineDasharray().asConstant(), dashArray.asConstant()); + + layer->setLinePattern(pattern); + EXPECT_EQ(layer->getLinePattern().asConstant(), pattern.asConstant()); +} + +TEST(Layer, RasterProperties) { + auto layer = std::make_unique<RasterLayer>("raster", "source"); + EXPECT_TRUE(layer->is<RasterLayer>()); + + // Paint properties + + layer->setRasterOpacity(opacity); + EXPECT_EQ(layer->getRasterOpacity().asConstant(), opacity.asConstant()); + + layer->setRasterHueRotate(hueRotate); + EXPECT_EQ(layer->getRasterHueRotate().asConstant(), hueRotate.asConstant()); + + layer->setRasterBrightnessMin(brightness); + EXPECT_EQ(layer->getRasterBrightnessMin().asConstant(), brightness.asConstant()); + + layer->setRasterBrightnessMax(brightness); + EXPECT_EQ(layer->getRasterBrightnessMax().asConstant(), brightness.asConstant()); + + layer->setRasterSaturation(saturation); + EXPECT_EQ(layer->getRasterSaturation().asConstant(), saturation.asConstant()); + + layer->setRasterContrast(contrast); + EXPECT_EQ(layer->getRasterContrast().asConstant(), contrast.asConstant()); + + layer->setRasterFadeDuration(duration); + EXPECT_EQ(layer->getRasterFadeDuration().asConstant(), duration.asConstant()); +} diff --git a/test/style/style_parser.cpp b/test/style/style_parser.cpp index 5f730a8373..b7806c11cc 100644 --- a/test/style/style_parser.cpp +++ b/test/style/style_parser.cpp @@ -3,6 +3,8 @@ #include <mbgl/style/parser.hpp> #include <mbgl/util/io.hpp> +#include <mbgl/util/enum.hpp> +#include <mbgl/util/tileset.hpp> #include <rapidjson/document.h> @@ -26,7 +28,7 @@ TEST_P(StyleParserTest, ParseStyle) { ASSERT_FALSE(infoDoc.HasParseError()); ASSERT_TRUE(infoDoc.IsObject()); - FixtureLogObserver* observer = new FixtureLogObserver(); + auto observer = new FixtureLogObserver(); Log::setObserver(std::unique_ptr<Log::Observer>(observer)); style::Parser parser; @@ -46,8 +48,8 @@ TEST_P(StyleParserTest, ParseStyle) { const uint32_t count = js_entry[rapidjson::SizeType(0)].GetUint(); const FixtureLogObserver::LogMessage message { - EventSeverityClass(js_entry[rapidjson::SizeType(1)].GetString()), - EventClass(js_entry[rapidjson::SizeType(2)].GetString()), + *Enum<EventSeverity>::toEnum(js_entry[rapidjson::SizeType(1)].GetString()), + *Enum<Event>::toEnum(js_entry[rapidjson::SizeType(2)].GetString()), int64_t(-1), js_entry[rapidjson::SizeType(3)].GetString() }; @@ -61,7 +63,7 @@ TEST_P(StyleParserTest, ParseStyle) { std::cerr << "Unchecked Log Messages (" << base << "/" << name << "): " << std::endl << unchecked; } - ASSERT_EQ(0ul, unchecked.size()); + ASSERT_EQ(0u, unchecked.size()); } } @@ -81,45 +83,15 @@ INSTANTIATE_TEST_CASE_P(StyleParser, StyleParserTest, ::testing::ValuesIn([] { closedir(dir); } - EXPECT_GT(names.size(), 0ul); + EXPECT_GT(names.size(), 0u); return names; }())); -TEST(StyleParser, ParseTileJSONRaster) { - auto result = style::parseTileJSON( - util::read_file("test/fixtures/style_parser/tilejson.raster.json"), - "mapbox://mapbox.satellite", - SourceType::Raster, - 256); - - EXPECT_EQ(0, result->minZoom); - EXPECT_EQ(15, result->maxZoom); - EXPECT_EQ("attribution", result->attribution); -#if !defined(__ANDROID__) && !defined(__APPLE__) - EXPECT_EQ("mapbox://tiles/mapbox.satellite/{z}/{x}/{y}{ratio}.webp", result->tiles[0]); -#else - EXPECT_EQ("mapbox://tiles/mapbox.satellite/{z}/{x}/{y}{ratio}.png", result->tiles[0]); -#endif -} - -TEST(StyleParser, ParseTileJSONVector) { - auto result = style::parseTileJSON( - util::read_file("test/fixtures/style_parser/tilejson.vector.json"), - "mapbox://mapbox.streets", - SourceType::Vector, - 256); - - EXPECT_EQ(0, result->minZoom); - EXPECT_EQ(15, result->maxZoom); - EXPECT_EQ("attribution", result->attribution); - EXPECT_EQ("mapbox://tiles/mapbox.streets/{z}/{x}/{y}.vector.pbf", result->tiles[0]); -} - TEST(StyleParser, FontStacks) { style::Parser parser; parser.parse(util::read_file("test/fixtures/style_parser/font_stacks.json")); auto result = parser.fontStacks(); - ASSERT_EQ(3, result.size()); + ASSERT_EQ(3u, result.size()); ASSERT_EQ(FontStack({"a"}), result[0]); ASSERT_EQ(FontStack({"a", "b"}), result[1]); ASSERT_EQ(FontStack({"a", "b", "c"}), result[2]); diff --git a/test/style/tile_source.cpp b/test/style/tile_source.cpp new file mode 100644 index 0000000000..35d037a049 --- /dev/null +++ b/test/style/tile_source.cpp @@ -0,0 +1,37 @@ +#include <mbgl/test/util.hpp> + +#include <mbgl/style/tile_source_impl.hpp> +#include <mbgl/util/io.hpp> + +using namespace mbgl; +using namespace mbgl::style; + +TEST(TileSourceImpl, ParseTileJSONRaster) { + auto result = TileSourceImpl::parseTileJSON( + util::read_file("test/fixtures/style_parser/tilejson.raster.json"), + "mapbox://mapbox.satellite", + SourceType::Raster, + 256); + + EXPECT_EQ(0, result.zoomRange.min); + EXPECT_EQ(15, result.zoomRange.max); + EXPECT_EQ("attribution", result.attribution); +#if !defined(__ANDROID__) && !defined(__APPLE__) + EXPECT_EQ("mapbox://tiles/mapbox.satellite/{z}/{x}/{y}{ratio}.webp", result.tiles[0]); +#else + EXPECT_EQ("mapbox://tiles/mapbox.satellite/{z}/{x}/{y}{ratio}.png", result.tiles[0]); +#endif +} + +TEST(TileSourceImpl, ParseTileJSONVector) { + auto result = TileSourceImpl::parseTileJSON( + util::read_file("test/fixtures/style_parser/tilejson.vector.json"), + "mapbox://mapbox.streets", + SourceType::Vector, + 256); + + EXPECT_EQ(0, result.zoomRange.min); + EXPECT_EQ(15, result.zoomRange.max); + EXPECT_EQ("attribution", result.attribution); + EXPECT_EQ("mapbox://tiles/mapbox.streets/{z}/{x}/{y}.vector.pbf", result.tiles[0]); +} diff --git a/test/test.gypi b/test/test.gypi index b7e7b5c32b..82bd02bd83 100644 --- a/test/test.gypi +++ b/test/test.gypi @@ -22,6 +22,7 @@ 'util/geo.cpp', 'util/image.cpp', 'util/mapbox.cpp', + 'util/memory.cpp', 'util/merge_lines.cpp', 'util/run_loop.cpp', 'util/number_conversions.cpp', @@ -32,6 +33,7 @@ 'util/timer.cpp', 'util/token.cpp', 'util/work_queue.cpp', + 'util/projection.cpp', 'algorithm/covered_by_children.cpp', 'algorithm/generate_clip_ids.cpp', @@ -55,7 +57,9 @@ 'math/minmax.cpp', 'math/clamp.cpp', - 'tile/geometry_tile.cpp', + 'text/quads.cpp', + + 'tile/geometry_tile_data.cpp', 'tile/tile_id.cpp', 'storage/offline.cpp', @@ -72,6 +76,7 @@ 'style/source.cpp', 'style/style.cpp', 'style/style_layer.cpp', + 'style/tile_source.cpp', 'style/filter.cpp', 'style/functions.cpp', 'style/style_parser.cpp', @@ -98,6 +103,8 @@ '<@(boost_cflags)', '<@(sqlite_cflags)', '<@(geojsonvt_cflags)', + '<@(supercluster_cflags)', + '<@(kdbush_cflags)', '<@(rapidjson_cflags)', '<@(pixelmatch_cflags)', '<@(earcut_cflags)', @@ -108,8 +115,7 @@ ], 'libraries': [ '<@(gtest_static_libs)', - '<@(sqlite_static_libs)', - '<@(geojsonvt_static_libs)', + '<@(sqlite_static_libs)' ], }, diff --git a/test/text/quads.cpp b/test/text/quads.cpp new file mode 100644 index 0000000000..2dd6a68cad --- /dev/null +++ b/test/text/quads.cpp @@ -0,0 +1,265 @@ +#include <mbgl/geometry/anchor.hpp> +#include <mbgl/sprite/sprite_atlas.hpp> +#include <mbgl/test/util.hpp> +#include <mbgl/text/quads.hpp> +#include <mbgl/text/shaping.hpp> +#include <mbgl/text/glyph.hpp> +#include <mbgl/style/layers/symbol_layer_properties.hpp> + +using namespace mbgl; +using namespace mbgl::style; + +TEST(getIconQuads, normal) { + SymbolLayoutProperties layout; + Anchor anchor(2.0, 3.0, 0.0, 0.5f, 0); + SpriteAtlasElement image = { + Rect<uint16_t>( 0, 0, 15, 11 ), + std::shared_ptr<const SpriteImage>(), + 1.0f + }; + PositionedIcon shapedIcon(image, -5.0, 6.0, -7.0, 8.0); + GeometryCoordinates line; + Shaping shapedText; + + SymbolQuads quads = getIconQuads(anchor, shapedIcon, line, layout, false, shapedText); + + ASSERT_EQ(quads.size(), 1u); + ASSERT_EQ(quads[0].anchorPoint.x, 2); + ASSERT_EQ(quads[0].anchorPoint.y, 3); + ASSERT_EQ(quads[0].tl.x, -8); + ASSERT_EQ(quads[0].tl.y, -6); + ASSERT_EQ(quads[0].tr.x, 7); + ASSERT_EQ(quads[0].tr.y, -6); + ASSERT_EQ(quads[0].bl.x, -8); + ASSERT_EQ(quads[0].bl.y, 5); + ASSERT_EQ(quads[0].br.x, 7); + ASSERT_EQ(quads[0].br.y, 5); + ASSERT_EQ(quads[0].anchorAngle, 0.0f); + ASSERT_EQ(quads[0].glyphAngle, 0.0f); + ASSERT_EQ(quads[0].minScale, 0.5f); +} + +TEST(getIconQuads, style) { + Anchor anchor(0.0, 0.0, 0.0, 0.5f, 0); + SpriteAtlasElement image = { + Rect<uint16_t>( 0, 0, 20, 20 ), + std::shared_ptr<const SpriteImage>(), + 1.0f + }; + PositionedIcon shapedIcon(image, -10.0, 10.0, -10.0, 10.0); + GeometryCoordinates line; + Shaping shapedText; + shapedText.top = -10.0f; + shapedText.bottom = 30.0f; + shapedText.left = -60.0f; + shapedText.right = 20.0f; + shapedText.positionedGlyphs.emplace_back(PositionedGlyph(32, 0.0f, 0.0f)); + + // none + { + SymbolLayoutProperties layout; + SymbolQuads quads = getIconQuads(anchor, shapedIcon, line, layout, false, shapedText); + + ASSERT_EQ(quads.size(), 1u); + ASSERT_EQ(quads[0].anchorPoint.x, 0); + ASSERT_EQ(quads[0].anchorPoint.y, 0); + ASSERT_EQ(quads[0].tl.x, -11); + ASSERT_EQ(quads[0].tl.y, -11); + ASSERT_EQ(quads[0].tr.x, 9); + ASSERT_EQ(quads[0].tr.y, -11); + ASSERT_EQ(quads[0].bl.x, -11); + ASSERT_EQ(quads[0].bl.y, 9); + ASSERT_EQ(quads[0].br.x, 9); + ASSERT_EQ(quads[0].br.y, 9); + ASSERT_EQ(quads[0].anchorAngle, 0.0f); + ASSERT_EQ(quads[0].glyphAngle, 0.0f); + ASSERT_EQ(quads[0].minScale, 0.5f); + } + + // width + { + SymbolLayoutProperties layout; + layout.textSize = LayoutProperty<float>(24.0f); + layout.iconTextFit = LayoutProperty<IconTextFitType>(IconTextFitType::Width); + SymbolQuads quads = getIconQuads(anchor, shapedIcon, line, layout, false, shapedText); + + ASSERT_EQ(quads[0].tl.x, -60); + ASSERT_EQ(quads[0].tl.y, 0); + ASSERT_EQ(quads[0].tr.x, 20); + ASSERT_EQ(quads[0].tr.y, 0); + ASSERT_EQ(quads[0].bl.x, -60); + ASSERT_EQ(quads[0].bl.y, 20); + ASSERT_EQ(quads[0].br.x, 20); + ASSERT_EQ(quads[0].br.y, 20); + } + + // width x textSize + { + SymbolLayoutProperties layout; + layout.textSize = LayoutProperty<float>(12.0f); + layout.iconTextFit = LayoutProperty<IconTextFitType>(IconTextFitType::Width); + SymbolQuads quads = getIconQuads(anchor, shapedIcon, line, layout, false, shapedText); + + ASSERT_EQ(quads[0].tl.x, -30); + ASSERT_EQ(quads[0].tl.y, -5); + ASSERT_EQ(quads[0].tr.x, 10); + ASSERT_EQ(quads[0].tr.y, -5); + ASSERT_EQ(quads[0].bl.x, -30); + ASSERT_EQ(quads[0].bl.y, 15); + ASSERT_EQ(quads[0].br.x, 10); + ASSERT_EQ(quads[0].br.y, 15); + } + + // width x textSize + padding + { + SymbolLayoutProperties layout; + layout.textSize = LayoutProperty<float>(12.0f); + layout.iconTextFit = LayoutProperty<IconTextFitType>(IconTextFitType::Width); + layout.iconTextFitPadding.value[0] = 5.0f; + layout.iconTextFitPadding.value[1] = 10.0f; + layout.iconTextFitPadding.value[2] = 5.0f; + layout.iconTextFitPadding.value[3] = 10.0f; + SymbolQuads quads = getIconQuads(anchor, shapedIcon, line, layout, false, shapedText); + + ASSERT_EQ(quads[0].tl.x, -40); + ASSERT_EQ(quads[0].tl.y, -10); + ASSERT_EQ(quads[0].tr.x, 20); + ASSERT_EQ(quads[0].tr.y, -10); + ASSERT_EQ(quads[0].bl.x, -40); + ASSERT_EQ(quads[0].bl.y, 20); + ASSERT_EQ(quads[0].br.x, 20); + ASSERT_EQ(quads[0].br.y, 20); + } + + // height + { + SymbolLayoutProperties layout; + layout.textSize = LayoutProperty<float>(24.0f); + layout.iconTextFit = LayoutProperty<IconTextFitType>(IconTextFitType::Height); + SymbolQuads quads = getIconQuads(anchor, shapedIcon, line, layout, false, shapedText); + + ASSERT_EQ(quads[0].tl.x, -30); + ASSERT_EQ(quads[0].tl.y, -10); + ASSERT_EQ(quads[0].tr.x, -10); + ASSERT_EQ(quads[0].tr.y, -10); + ASSERT_EQ(quads[0].bl.x, -30); + ASSERT_EQ(quads[0].bl.y, 30); + ASSERT_EQ(quads[0].br.x, -10); + ASSERT_EQ(quads[0].br.y, 30); + } + + // height x textSize + { + SymbolLayoutProperties layout; + layout.textSize = LayoutProperty<float>(12.0f); + layout.iconTextFit = LayoutProperty<IconTextFitType>(IconTextFitType::Height); + SymbolQuads quads = getIconQuads(anchor, shapedIcon, line, layout, false, shapedText); + + ASSERT_EQ(quads[0].tl.x, -20); + ASSERT_EQ(quads[0].tl.y, -5); + ASSERT_EQ(quads[0].tr.x, 0); + ASSERT_EQ(quads[0].tr.y, -5); + ASSERT_EQ(quads[0].bl.x, -20); + ASSERT_EQ(quads[0].bl.y, 15); + ASSERT_EQ(quads[0].br.x, 0); + ASSERT_EQ(quads[0].br.y, 15); + } + + // height x textSize + padding + { + SymbolLayoutProperties layout; + layout.textSize = LayoutProperty<float>(12.0f); + layout.iconTextFit = LayoutProperty<IconTextFitType>(IconTextFitType::Height); + layout.iconTextFitPadding.value[0] = 5.0f; + layout.iconTextFitPadding.value[1] = 10.0f; + layout.iconTextFitPadding.value[2] = 5.0f; + layout.iconTextFitPadding.value[3] = 10.0f; + SymbolQuads quads = getIconQuads(anchor, shapedIcon, line, layout, false, shapedText); + + ASSERT_EQ(quads[0].tl.x, -30); + ASSERT_EQ(quads[0].tl.y, -10); + ASSERT_EQ(quads[0].tr.x, 10); + ASSERT_EQ(quads[0].tr.y, -10); + ASSERT_EQ(quads[0].bl.x, -30); + ASSERT_EQ(quads[0].bl.y, 20); + ASSERT_EQ(quads[0].br.x, 10); + ASSERT_EQ(quads[0].br.y, 20); + } + + // both + { + SymbolLayoutProperties layout; + layout.textSize = LayoutProperty<float>(24.0f); + layout.iconTextFit = LayoutProperty<IconTextFitType>(IconTextFitType::Both); + SymbolQuads quads = getIconQuads(anchor, shapedIcon, line, layout, false, shapedText); + + ASSERT_EQ(quads[0].tl.x, -60); + ASSERT_EQ(quads[0].tl.y, -10); + ASSERT_EQ(quads[0].tr.x, 20); + ASSERT_EQ(quads[0].tr.y, -10); + ASSERT_EQ(quads[0].bl.x, -60); + ASSERT_EQ(quads[0].bl.y, 30); + ASSERT_EQ(quads[0].br.x, 20); + ASSERT_EQ(quads[0].br.y, 30); + } + + // both x textSize + { + SymbolLayoutProperties layout; + layout.textSize = LayoutProperty<float>(12.0f); + layout.iconTextFit = LayoutProperty<IconTextFitType>(IconTextFitType::Both); + SymbolQuads quads = getIconQuads(anchor, shapedIcon, line, layout, false, shapedText); + + ASSERT_EQ(quads[0].tl.x, -30); + ASSERT_EQ(quads[0].tl.y, -5); + ASSERT_EQ(quads[0].tr.x, 10); + ASSERT_EQ(quads[0].tr.y, -5); + ASSERT_EQ(quads[0].bl.x, -30); + ASSERT_EQ(quads[0].bl.y, 15); + ASSERT_EQ(quads[0].br.x, 10); + ASSERT_EQ(quads[0].br.y, 15); + } + + // both x textSize + padding + { + SymbolLayoutProperties layout; + layout.textSize = LayoutProperty<float>(12.0f); + layout.iconTextFit = LayoutProperty<IconTextFitType>(IconTextFitType::Both); + layout.iconTextFitPadding.value[0] = 5.0f; + layout.iconTextFitPadding.value[1] = 10.0f; + layout.iconTextFitPadding.value[2] = 5.0f; + layout.iconTextFitPadding.value[3] = 10.0f; + SymbolQuads quads = getIconQuads(anchor, shapedIcon, line, layout, false, shapedText); + + ASSERT_EQ(quads[0].tl.x, -40); + ASSERT_EQ(quads[0].tl.y, -10); + ASSERT_EQ(quads[0].tr.x, 20); + ASSERT_EQ(quads[0].tr.y, -10); + ASSERT_EQ(quads[0].bl.x, -40); + ASSERT_EQ(quads[0].bl.y, 20); + ASSERT_EQ(quads[0].br.x, 20); + ASSERT_EQ(quads[0].br.y, 20); + } + + // both x textSize + padding t/r/b/l + { + SymbolLayoutProperties layout; + layout.textSize = LayoutProperty<float>(12.0f); + layout.iconTextFit = LayoutProperty<IconTextFitType>(IconTextFitType::Both); + layout.iconTextFitPadding.value[0] = 0.0f; + layout.iconTextFitPadding.value[1] = 5.0f; + layout.iconTextFitPadding.value[2] = 10.0f; + layout.iconTextFitPadding.value[3] = 15.0f; + SymbolQuads quads = getIconQuads(anchor, shapedIcon, line, layout, false, shapedText); + + ASSERT_EQ(quads[0].tl.x, -45); + ASSERT_EQ(quads[0].tl.y, -5); + ASSERT_EQ(quads[0].tr.x, 15); + ASSERT_EQ(quads[0].tr.y, -5); + ASSERT_EQ(quads[0].bl.x, -45); + ASSERT_EQ(quads[0].bl.y, 25); + ASSERT_EQ(quads[0].br.x, 15); + ASSERT_EQ(quads[0].br.y, 25); + } +} + diff --git a/test/tile/geometry_tile.cpp b/test/tile/geometry_tile_data.cpp index c94b20cee6..6e118d6fd5 100644 --- a/test/tile/geometry_tile.cpp +++ b/test/tile/geometry_tile_data.cpp @@ -1,32 +1,32 @@ #include <mbgl/test/util.hpp> -#include <mbgl/tile/geometry_tile.hpp> +#include <mbgl/tile/geometry_tile_data.hpp> using namespace mbgl; -TEST(GeometryTile, classifyRings1) { +TEST(GeometryTileData, classifyRings1) { std::vector<GeometryCollection> polygons = classifyRings({ { {0, 0}, {0, 40}, {40, 40}, {40, 0}, {0, 0} } }); // output: 1 polygon - ASSERT_EQ(polygons.size(), 1); + ASSERT_EQ(polygons.size(), 1u); // output: polygon 1 has 1 exterior - ASSERT_EQ(polygons[0].size(), 1); + ASSERT_EQ(polygons[0].size(), 1u); } -TEST(GeometryTile, classifyRings2) { +TEST(GeometryTileData, classifyRings2) { std::vector<GeometryCollection> polygons = classifyRings({ { {0, 0}, {0, 40}, {40, 40}, {40, 0}, {0, 0} }, { {10, 10}, {20, 10}, {20, 20}, {10, 10} } }); // output: 1 polygon - ASSERT_EQ(polygons.size(), 1); + ASSERT_EQ(polygons.size(), 1u); // output: polygon 1 has 1 exterior, 1 interior - ASSERT_EQ(polygons[0].size(), 2); + ASSERT_EQ(polygons[0].size(), 2u); } -TEST(GeometryTile, limitHoles1) { +TEST(GeometryTileData, limitHoles1) { GeometryCollection polygon = { { {0, 0}, {0, 40}, {40, 40}, {40, 0}, {0, 0} }, { {30, 30}, {32, 30}, {32, 32}, {30, 30} }, @@ -36,14 +36,14 @@ TEST(GeometryTile, limitHoles1) { limitHoles(polygon, 1); // output: polygon 1 has 1 exterior, 1 interior - ASSERT_EQ(polygon.size(), 2); + ASSERT_EQ(polygon.size(), 2u); // ensure we've kept the right rings (ones with largest areas) ASSERT_EQ(polygon[0][0].x, 0); ASSERT_EQ(polygon[1][0].x, 10); } -TEST(GeometryTile, limitHoles2) { +TEST(GeometryTileData, limitHoles2) { GeometryCollection polygon = { { {0, 0}, {0, 40}, {40, 40}, {40, 0}, {0, 0} }, { {10, 10}, {20, 10}, {20, 20}, {10, 10} }, @@ -53,7 +53,7 @@ TEST(GeometryTile, limitHoles2) { limitHoles(polygon, 1); // output: polygon 1 has 1 exterior, 1 interior - ASSERT_EQ(polygon.size(), 2); + ASSERT_EQ(polygon.size(), 2u); // ensure we've kept the right rings (ones with largest areas) ASSERT_EQ(polygon[0][0].x, 0); diff --git a/test/tile/tile_id.cpp b/test/tile/tile_id.cpp index e5a1403d20..1ef19fea0e 100644 --- a/test/tile/tile_id.cpp +++ b/test/tile/tile_id.cpp @@ -6,9 +6,9 @@ using namespace mbgl; TEST(TileID, Canonical) { CanonicalTileID id_0_0_0(0, 0, 0); - EXPECT_EQ(0, id_0_0_0.z); - EXPECT_EQ(0, id_0_0_0.x); - EXPECT_EQ(0, id_0_0_0.y); + EXPECT_EQ(0u, id_0_0_0.z); + EXPECT_EQ(0u, id_0_0_0.x); + EXPECT_EQ(0u, id_0_0_0.y); EXPECT_TRUE(CanonicalTileID(4, 2, 3) == CanonicalTileID(4, 2, 3)); EXPECT_FALSE(CanonicalTileID(4, 2, 3) != CanonicalTileID(4, 2, 3)); @@ -157,11 +157,11 @@ TEST(TileID, Overscaled) { EXPECT_TRUE(OverscaledTileID(4, 2, 3) < OverscaledTileID(7, { 4, 2, 3 })); EXPECT_FALSE(OverscaledTileID(7, { 4, 2, 3 }) < OverscaledTileID(4, 2, 3)); - EXPECT_EQ(8, OverscaledTileID(7, { 4, 2, 3 }).overscaleFactor()); - EXPECT_EQ(4, OverscaledTileID(6, { 4, 2, 3 }).overscaleFactor()); - EXPECT_EQ(2, OverscaledTileID(5, { 4, 2, 3 }).overscaleFactor()); - EXPECT_EQ(1, OverscaledTileID(4, { 4, 2, 3 }).overscaleFactor()); - EXPECT_EQ(2147483648, OverscaledTileID(31, { 0, 0, 0 }).overscaleFactor()); + EXPECT_EQ(8u, OverscaledTileID(7, { 4, 2, 3 }).overscaleFactor()); + EXPECT_EQ(4u, OverscaledTileID(6, { 4, 2, 3 }).overscaleFactor()); + EXPECT_EQ(2u, OverscaledTileID(5, { 4, 2, 3 }).overscaleFactor()); + EXPECT_EQ(1u, OverscaledTileID(4, { 4, 2, 3 }).overscaleFactor()); + EXPECT_EQ(2147483648u, OverscaledTileID(31, { 0, 0, 0 }).overscaleFactor()); EXPECT_EQ(OverscaledTileID(0, { 0, 0, 0 }), OverscaledTileID(4, 2, 3).scaledTo(0)); EXPECT_EQ(OverscaledTileID(1, { 1, 0, 0 }), OverscaledTileID(4, 2, 3).scaledTo(1)); @@ -214,58 +214,58 @@ TEST(TileID, Overscaled) { TEST(TileID, Unwrapped) { UnwrappedTileID id_0_0_0(0, 0, 0); - EXPECT_EQ(0, id_0_0_0.canonical.z); - EXPECT_EQ(0, id_0_0_0.canonical.x); - EXPECT_EQ(0, id_0_0_0.canonical.y); + EXPECT_EQ(0u, id_0_0_0.canonical.z); + EXPECT_EQ(0u, id_0_0_0.canonical.x); + EXPECT_EQ(0u, id_0_0_0.canonical.y); EXPECT_EQ(0, id_0_0_0.wrap); UnwrappedTileID id_0_1_0(0, 1, 0); - EXPECT_EQ(0, id_0_1_0.canonical.z); - EXPECT_EQ(0, id_0_1_0.canonical.x); - EXPECT_EQ(0, id_0_1_0.canonical.y); + EXPECT_EQ(0u, id_0_1_0.canonical.z); + EXPECT_EQ(0u, id_0_1_0.canonical.x); + EXPECT_EQ(0u, id_0_1_0.canonical.y); EXPECT_EQ(1, id_0_1_0.wrap); UnwrappedTileID id_0_4_0(0, 4, 0); - EXPECT_EQ(0, id_0_4_0.canonical.z); - EXPECT_EQ(0, id_0_4_0.canonical.x); - EXPECT_EQ(0, id_0_4_0.canonical.y); + EXPECT_EQ(0u, id_0_4_0.canonical.z); + EXPECT_EQ(0u, id_0_4_0.canonical.x); + EXPECT_EQ(0u, id_0_4_0.canonical.y); EXPECT_EQ(4, id_0_4_0.wrap); UnwrappedTileID id_0_n1_0(0, -1, 0); - EXPECT_EQ(0, id_0_n1_0.canonical.z); - EXPECT_EQ(0, id_0_n1_0.canonical.x); - EXPECT_EQ(0, id_0_n1_0.canonical.y); + EXPECT_EQ(0u, id_0_n1_0.canonical.z); + EXPECT_EQ(0u, id_0_n1_0.canonical.x); + EXPECT_EQ(0u, id_0_n1_0.canonical.y); EXPECT_EQ(-1, id_0_n1_0.wrap); UnwrappedTileID id_0_0_1(0, 0, 1); - EXPECT_EQ(0, id_0_0_1.canonical.z); - EXPECT_EQ(0, id_0_0_1.canonical.x); - EXPECT_EQ(0, id_0_0_1.canonical.y); + EXPECT_EQ(0u, id_0_0_1.canonical.z); + EXPECT_EQ(0u, id_0_0_1.canonical.x); + EXPECT_EQ(0u, id_0_0_1.canonical.y); EXPECT_EQ(0, id_0_0_1.wrap); UnwrappedTileID id_0_0_n1(0, 0, -1); - EXPECT_EQ(0, id_0_0_n1.canonical.z); - EXPECT_EQ(0, id_0_0_n1.canonical.x); - EXPECT_EQ(0, id_0_0_n1.canonical.y); + EXPECT_EQ(0u, id_0_0_n1.canonical.z); + EXPECT_EQ(0u, id_0_0_n1.canonical.x); + EXPECT_EQ(0u, id_0_0_n1.canonical.y); EXPECT_EQ(0, id_0_0_n1.wrap); UnwrappedTileID id_18_262143_0(18, 262143, 0); - EXPECT_EQ(18, id_18_262143_0.canonical.z); - EXPECT_EQ(262143, id_18_262143_0.canonical.x); - EXPECT_EQ(0, id_18_262143_0.canonical.y); + EXPECT_EQ(18u, id_18_262143_0.canonical.z); + EXPECT_EQ(262143u, id_18_262143_0.canonical.x); + EXPECT_EQ(0u, id_18_262143_0.canonical.y); EXPECT_EQ(0, id_18_262143_0.wrap); UnwrappedTileID id_18_262144_0(18, 262144, 0); - EXPECT_EQ(18, id_18_262144_0.canonical.z); - EXPECT_EQ(0, id_18_262144_0.canonical.x); - EXPECT_EQ(0, id_18_262144_0.canonical.y); + EXPECT_EQ(18u, id_18_262144_0.canonical.z); + EXPECT_EQ(0u, id_18_262144_0.canonical.x); + EXPECT_EQ(0u, id_18_262144_0.canonical.y); EXPECT_EQ(1, id_18_262144_0.wrap); UnwrappedTileID a(2, 4, 3); UnwrappedTileID b(a); - EXPECT_EQ(2, b.canonical.z); - EXPECT_EQ(0, b.canonical.x); - EXPECT_EQ(3, b.canonical.y); + EXPECT_EQ(2u, b.canonical.z); + EXPECT_EQ(0u, b.canonical.x); + EXPECT_EQ(3u, b.canonical.y); EXPECT_EQ(1, b.wrap); EXPECT_TRUE(UnwrappedTileID(0, 0, 0) < UnwrappedTileID(1, 0, 0)); diff --git a/test/util/async_task.cpp b/test/util/async_task.cpp index ad65bfad78..78dc79dd19 100644 --- a/test/util/async_task.cpp +++ b/test/util/async_task.cpp @@ -49,7 +49,7 @@ TEST(AsyncTask, RequestCoalescing) { loop.runOnce(); - EXPECT_EQ(count, 1); + EXPECT_EQ(count, 1u); } TEST(AsyncTask, DestroyShouldNotRunQueue) { @@ -61,7 +61,7 @@ TEST(AsyncTask, DestroyShouldNotRunQueue) { async->send(); async.reset(); - EXPECT_EQ(count, 0); + EXPECT_EQ(count, 0u); } TEST(AsyncTask, DestroyAfterSignaling) { @@ -114,7 +114,7 @@ TEST(AsyncTask, RequestCoalescingMultithreaded) { loop.runOnce(); - EXPECT_EQ(count, 1); + EXPECT_EQ(count, 1u); } TEST(AsyncTask, ThreadSafety) { @@ -149,5 +149,5 @@ TEST(AsyncTask, ThreadSafety) { // We expect here more than 1 but 1 would also be // a valid result, although very unlikely (I hope). - EXPECT_GT(count, 0); + EXPECT_GT(count, 0u); } diff --git a/test/util/image.cpp b/test/util/image.cpp index 67a79cf9dd..b2814e66da 100644 --- a/test/util/image.cpp +++ b/test/util/image.cpp @@ -68,21 +68,21 @@ TEST(Image, PNGReadProfileAlpha) { TEST(Image, PNGTile) { PremultipliedImage image = decodeImage(util::read_file("test/fixtures/image/tile.png")); - EXPECT_EQ(256, image.width); - EXPECT_EQ(256, image.height); + EXPECT_EQ(256u, image.width); + EXPECT_EQ(256u, image.height); } TEST(Image, JPEGTile) { PremultipliedImage image = decodeImage(util::read_file("test/fixtures/image/tile.jpeg")); - EXPECT_EQ(256, image.width); - EXPECT_EQ(256, image.height); + EXPECT_EQ(256u, image.width); + EXPECT_EQ(256u, image.height); } #if !defined(__ANDROID__) && !defined(__APPLE__) && !defined(QT_IMAGE_DECODERS) TEST(Image, WebPTile) { PremultipliedImage image = decodeImage(util::read_file("test/fixtures/image/tile.webp")); - EXPECT_EQ(256, image.width); - EXPECT_EQ(256, image.height); + EXPECT_EQ(256u, image.width); + EXPECT_EQ(256u, image.height); } #endif // !defined(__ANDROID__) && !defined(__APPLE__) && !defined(QT_IMAGE_DECODERS) diff --git a/test/util/mapbox.cpp b/test/util/mapbox.cpp index 35c478287c..9341b695f3 100644 --- a/test/util/mapbox.cpp +++ b/test/util/mapbox.cpp @@ -7,7 +7,6 @@ using namespace mbgl; - TEST(Mapbox, SourceURL) { EXPECT_EQ( "https://api.mapbox.com/v4/user.map.json?access_token=key&secure", diff --git a/test/util/memory.cpp b/test/util/memory.cpp new file mode 100644 index 0000000000..bc20200916 --- /dev/null +++ b/test/util/memory.cpp @@ -0,0 +1,228 @@ +#include <mbgl/test/stub_file_source.hpp> +#include <mbgl/test/util.hpp> + +#include <mbgl/map/map.hpp> +#include <mbgl/platform/default/headless_display.hpp> +#include <mbgl/platform/default/headless_view.hpp> +#include <mbgl/util/io.hpp> +#include <mbgl/util/run_loop.hpp> + +#include <algorithm> +#include <iostream> +#include <iterator> +#include <string> +#include <unordered_map> +#include <utility> + +#include <stdlib.h> +#include <unistd.h> + +using namespace mbgl; +using namespace std::literals::string_literals; + +long getRSS() { + auto statm = util::read_file("/proc/self/statm"); + + std::vector<std::string> stats; + std::istringstream stream(statm); + + std::copy(std::istream_iterator<std::string>(stream), + std::istream_iterator<std::string>(), + std::back_inserter(stats)); + + return std::stol(stats[1]) * getpagesize(); +} + +bool isUsingJemalloc() { + const char* preload = getenv("LD_PRELOAD"); + + if (preload) { + return std::string(preload).find("libjemalloc.so") != std::string::npos; + } else { + return false; + } +} + +class MemoryTest { +public: + MemoryTest() { + fileSource.styleResponse = [&](const Resource& res) { return response("style_" + getType(res) + ".json");}; + fileSource.tileResponse = [&](const Resource& res) { return response(getType(res) + ".tile"); }; + fileSource.sourceResponse = [&](const Resource& res) { return response("source_" + getType(res) + ".json"); }; + fileSource.glyphsResponse = [&](const Resource&) { return response("glyphs.pbf"); }; + fileSource.spriteJSONResponse = [&](const Resource&) { return response("sprite.json"); }; + fileSource.spriteImageResponse = [&](const Resource&) { return response("sprite.png"); }; + } + + util::RunLoop runLoop; + std::shared_ptr<HeadlessDisplay> display { std::make_shared<mbgl::HeadlessDisplay>() }; + HeadlessView view { display, 2 }; + StubFileSource fileSource; + +private: + Response response(const std::string& path) { + Response result; + + auto it = cache.find(path); + if (it != cache.end()) { + result.data = it->second; + } else { + auto data = std::make_shared<std::string>( + util::read_file("test/fixtures/resources/"s + path)); + + cache.insert(it, std::make_pair(path, data)); + result.data = data; + } + + return result; + } + + std::string getType(const Resource& res) { + if (res.url.find("satellite") != std::string::npos) { + return "raster"; + } else { + return "vector"; + } + }; + + std::unordered_map<std::string, std::shared_ptr<std::string>> cache; +}; + +TEST(Memory, Vector) { + MemoryTest test; + + Map map(test.view, test.fileSource, MapMode::Still); + map.setZoom(16); // more map features + map.setStyleURL("mapbox://streets"); + + test::render(map); +} + +TEST(Memory, Raster) { + MemoryTest test; + + Map map(test.view, test.fileSource, MapMode::Still); + map.setStyleURL("mapbox://satellite"); + + test::render(map); +} + +// This test will render 3 map objects alternating +// between a raster and a vector style. Memory is +// expected to grow between the renderings due to +// fragmentation. A good allocator for Mapbox GL +// Native will keep memory growth within acceptable +// levels and stable in the long run. +TEST(Memory, Fragmentation) { + if (!isUsingJemalloc()) { + return; + } + + MemoryTest test; + + Map map1(test.view, test.fileSource, MapMode::Still); + Map map2(test.view, test.fileSource, MapMode::Still); + Map map3(test.view, test.fileSource, MapMode::Still); + + map1.setZoom(16); + map2.setZoom(16); + map3.setZoom(16); + + auto renderMap = [&] { + map1.setStyleURL("mapbox://satellite"); + test::render(map1); + + map2.setStyleURL("mapbox://satellite"); + test::render(map2); + + map3.setStyleURL("mapbox://satellite"); + test::render(map3); + + map1.setStyleURL("mapbox://streets"); + test::render(map1); + + map2.setStyleURL("mapbox://streets"); + test::render(map2); + + map3.setStyleURL("mapbox://streets"); + test::render(map3); + }; + + // Warm up buffers and cache. + for (unsigned i = 0; i < 5; ++i) { + renderMap(); + } + + long lastRSS = getRSS(); + long memoryFragments = 0; + + for (unsigned i = 0; i < 20; ++i) { + renderMap(); + + long currentRSS = getRSS(); + + memoryFragments += currentRSS - lastRSS; + lastRSS = currentRSS; + } + + ASSERT_LT(memoryFragments, 10 * 1024 * 1024) << "\ + Abnormal memory growth detected."; +} + +// This test will measure the size of a Map object +// after rendering a raster and a vector style. The +// idea is to try to keep the memory footprint within +// reasonable limits, so this test acts more like a +// safeguard. +TEST(Memory, Footprint) { + if (!isUsingJemalloc()) { + return; + } + + MemoryTest test; + + auto renderMap = [](Map* map, const char* style){ + map->setZoom(16); + + map->setStyleURL(style); + test::render(*map); + }; + + // Warm up buffers and cache. + for (unsigned i = 0; i < 10; ++i) { + Map map(test.view, test.fileSource, MapMode::Still); + renderMap(&map, "mapbox://streets"); + renderMap(&map, "mapbox://satellite"); + }; + + // Process close callbacks, mostly needed by + // libuv runloop. + test.runLoop.runOnce(); + + std::vector<std::unique_ptr<Map>> maps; + unsigned runs = 15; + + long vectorInitialRSS = getRSS(); + for (unsigned i = 0; i < runs; ++i) { + auto vector = std::make_unique<Map>(test.view, test.fileSource, MapMode::Still); + renderMap(vector.get(), "mapbox://streets"); + maps.push_back(std::move(vector)); + }; + + double vectorFootprint = (getRSS() - vectorInitialRSS) / double(runs); + + long rasterInitialRSS = getRSS(); + for (unsigned i = 0; i < runs; ++i) { + auto raster = std::make_unique<Map>(test.view, test.fileSource, MapMode::Still); + renderMap(raster.get(), "mapbox://satellite"); + maps.push_back(std::move(raster)); + }; + + double rasterFootprint = (getRSS() - rasterInitialRSS) / double(runs); + + ASSERT_LT(vectorFootprint, 65 * 1024 * 1024) << "\ + mbgl::Map footprint over 65MB for vector styles."; + + ASSERT_LT(rasterFootprint, 25 * 1024 * 1024) << "\ + mbgl::Map footprint over 25MB for raster styles."; +} diff --git a/test/util/projection.cpp b/test/util/projection.cpp new file mode 100644 index 0000000000..5efba380b3 --- /dev/null +++ b/test/util/projection.cpp @@ -0,0 +1,68 @@ +#include <mbgl/test/util.hpp> + +#include <mbgl/util/constants.hpp> +#include <mbgl/util/geo.hpp> +#include <mbgl/util/projection.hpp> + +#include <limits> + +using namespace mbgl; + +TEST(Projection, MetersPerPixelAtLatitude) { + double zoom = 0; + EXPECT_DOUBLE_EQ(Projection::getMetersPerPixelAtLatitude(0, zoom), 78271.516964020484); + EXPECT_DOUBLE_EQ(Projection::getMetersPerPixelAtLatitude(-util::LATITUDE_MAX, zoom), 6752.2284729446501); + EXPECT_DOUBLE_EQ(Projection::getMetersPerPixelAtLatitude(util::LATITUDE_MAX, zoom), + Projection::getMetersPerPixelAtLatitude(-util::LATITUDE_MAX, zoom)); + + zoom = 20; + EXPECT_DOUBLE_EQ(Projection::getMetersPerPixelAtLatitude(0, zoom), 0.074645535434742435); + EXPECT_DOUBLE_EQ(Projection::getMetersPerPixelAtLatitude(-util::LATITUDE_MAX, zoom), 0.0064394268731543065); + + EXPECT_DOUBLE_EQ(Projection::getMetersPerPixelAtLatitude(std::numeric_limits<double>::lowest(), zoom), + Projection::getMetersPerPixelAtLatitude(std::numeric_limits<double>::max(), zoom)); + + zoom = std::numeric_limits<double>::min(); + EXPECT_DOUBLE_EQ(Projection::getMetersPerPixelAtLatitude(0, zoom), + Projection::getMetersPerPixelAtLatitude(0, util::MIN_ZOOM)); + + zoom = std::numeric_limits<double>::lowest(); + EXPECT_DOUBLE_EQ(Projection::getMetersPerPixelAtLatitude(0, zoom), + Projection::getMetersPerPixelAtLatitude(0, util::MIN_ZOOM)); + + zoom = std::numeric_limits<double>::max(); + EXPECT_DOUBLE_EQ(Projection::getMetersPerPixelAtLatitude(0, zoom), + Projection::getMetersPerPixelAtLatitude(0, util::MAX_ZOOM)); +} + +TEST(Projection, ProjectedMeters) { + const auto southWest = LatLng { -util::LATITUDE_MAX, -util::LONGITUDE_MAX }; + const auto northEast = LatLng { util::LATITUDE_MAX, util::LONGITUDE_MAX }; + + auto latLng = LatLng {}; + auto projectedMeters = Projection::projectedMetersForLatLng(latLng); + EXPECT_EQ(projectedMeters.northing, projectedMeters.easting); + EXPECT_EQ(latLng, Projection::latLngForProjectedMeters(projectedMeters)); + + latLng = LatLng { std::numeric_limits<double>::lowest(), std::numeric_limits<double>::lowest() }; + projectedMeters = Projection::projectedMetersForLatLng(latLng); + EXPECT_EQ(projectedMeters, Projection::projectedMetersForLatLng(southWest)); + EXPECT_DOUBLE_EQ(projectedMeters.northing, -20037508.342789274); + EXPECT_DOUBLE_EQ(projectedMeters.easting, -20037508.342789244); + + latLng = LatLng { std::numeric_limits<double>::max(), std::numeric_limits<double>::max() }; + projectedMeters = Projection::projectedMetersForLatLng(latLng); + EXPECT_EQ(projectedMeters, Projection::projectedMetersForLatLng(northEast)); + EXPECT_DOUBLE_EQ(projectedMeters.northing, -Projection::projectedMetersForLatLng(southWest).northing); + EXPECT_DOUBLE_EQ(projectedMeters.easting, -Projection::projectedMetersForLatLng(southWest).easting); + + projectedMeters = ProjectedMeters { std::numeric_limits<double>::lowest(), std::numeric_limits<double>::lowest() }; + latLng = Projection::latLngForProjectedMeters(projectedMeters); + EXPECT_EQ(latLng.latitude, -util::LATITUDE_MAX); + EXPECT_EQ(latLng.longitude, -util::LONGITUDE_MAX); + + projectedMeters = ProjectedMeters { std::numeric_limits<double>::max(), std::numeric_limits<double>::max() }; + latLng = Projection::latLngForProjectedMeters(projectedMeters); + EXPECT_EQ(latLng.latitude, util::LATITUDE_MAX); + EXPECT_EQ(latLng.longitude, util::LONGITUDE_MAX); +} diff --git a/test/util/text_conversions.cpp b/test/util/text_conversions.cpp index 29f02e988a..19e30d9f3d 100644 --- a/test/util/text_conversions.cpp +++ b/test/util/text_conversions.cpp @@ -14,8 +14,8 @@ TEST(TextConversions, to_upper) { EXPECT_EQ(std::string("MASSE"), platform::uppercase("maße")); // DE EXPECT_EQ(std::string("WEISSKOPFSEEADLER"), platform::uppercase("weißkopfseeadler")); // DE + EXPECT_EQ(std::string("BÊNÇÃO"), platform::uppercase("bênção")); // PT EXPECT_EQ(std::string("AZƏRBAYCAN"), platform::uppercase("Azərbaycan")); // AZ - EXPECT_EQ(std::string("ὈΔΥΣΣΕΎΣ"), platform::uppercase("Ὀδυσσεύς")); // GR } @@ -29,7 +29,14 @@ TEST(TextConversions, to_lower) { EXPECT_EQ(std::string("masse"), platform::lowercase("MASSE")); // DE EXPECT_EQ(std::string("weisskopfseeadler"), platform::lowercase("weiSSkopfseeadler")); // DE + EXPECT_EQ(std::string("bênção"), platform::lowercase("BÊNÇÃO")); // PT EXPECT_EQ(std::string("azərbaycan"), platform::lowercase("AZƏRBAYCAN")); // AZ + +#if defined(__QT__) + // https://bugreports.qt.io/browse/QTBUG-17337 + EXPECT_NE(std::string("ὀδυσσεύς"), platform::lowercase("ὈΔΥΣΣΕΎΣ")); // GR +#else EXPECT_EQ(std::string("ὀδυσσεύς"), platform::lowercase("ὈΔΥΣΣΕΎΣ")); // GR +#endif } diff --git a/test/util/thread_local.cpp b/test/util/thread_local.cpp index 074af2c5d0..d2ec7f70a5 100644 --- a/test/util/thread_local.cpp +++ b/test/util/thread_local.cpp @@ -80,8 +80,8 @@ TEST(ThreadLocalStorage, AutoReclaim) { unsigned counter = 0; - DtorCounter* dtorCounter1 = new DtorCounter{ &counter }; - DtorCounter* dtorCounter2 = new DtorCounter{ &counter }; + auto dtorCounter1 = new DtorCounter{ &counter }; + auto dtorCounter2 = new DtorCounter{ &counter }; ThreadContext context = {"Test"}; @@ -91,5 +91,5 @@ TEST(ThreadLocalStorage, AutoReclaim) { thread1.reset(); thread2.reset(); - EXPECT_EQ(counter, 2); + EXPECT_EQ(counter, 2u); } |