diff options
author | Konstantin Käfer <mail@kkaefer.com> | 2016-05-10 11:47:54 +0200 |
---|---|---|
committer | Konstantin Käfer <mail@kkaefer.com> | 2016-05-10 14:50:56 +0200 |
commit | ec70125e41e4e9db5f1d0941c0129d80f5792896 (patch) | |
tree | 639654a3dfda72cf0c1c1a2a0a353fe0b484e45e /test | |
parent | bdcbceff8002d6a0ec2ce6c1d2518b03c007ddf6 (diff) | |
download | qtlocation-mapboxgl-ec70125e41e4e9db5f1d0941c0129d80f5792896.tar.gz |
[core] move TileData and dependents to new *TileID classes
Diffstat (limited to 'test')
-rw-r--r-- | test/api/render_missing.cpp | 2 | ||||
-rw-r--r-- | test/src/mbgl/test/stub_style_observer.hpp | 9 | ||||
-rw-r--r-- | test/style/source.cpp | 32 | ||||
-rw-r--r-- | test/util/geo.cpp | 16 |
4 files changed, 30 insertions, 29 deletions
diff --git a/test/api/render_missing.cpp b/test/api/render_missing.cpp index c0447d189e..c1cc3fac35 100644 --- a/test/api/render_missing.cpp +++ b/test/api/render_missing.cpp @@ -58,7 +58,7 @@ TEST(API, TEST_REQUIRES_SERVER(RenderMissingTile)) { auto flo = dynamic_cast<FixtureLogObserver*>(observer.get()); EXPECT_EQ(1, flo->count(FixtureLog::Message( EventSeverity::Error, Event::Style, -1, - std::string("Failed to load tile 0/0/0 for source mapbox: " + message)))); + std::string("Failed to load tile 0/0/0=>0 for source mapbox: " + message)))); auto unchecked = flo->unchecked(); EXPECT_TRUE(unchecked.empty()) << unchecked; } diff --git a/test/src/mbgl/test/stub_style_observer.hpp b/test/src/mbgl/test/stub_style_observer.hpp index f428b4fda7..6b5eee189e 100644 --- a/test/src/mbgl/test/stub_style_observer.hpp +++ b/test/src/mbgl/test/stub_style_observer.hpp @@ -34,11 +34,12 @@ public: if (sourceError) sourceError(source, error); } - void onTileLoaded(Source& source, const TileID& tileID, bool isNewTile) override { + void onTileLoaded(Source& source, const OverscaledTileID& tileID, bool isNewTile) override { if (tileLoaded) tileLoaded(source, tileID, isNewTile); } - void onTileError(Source& source, const TileID& tileID, std::exception_ptr error) override { + void + onTileError(Source& source, const OverscaledTileID& tileID, std::exception_ptr error) override { if (tileError) tileError(source, tileID, error); } @@ -56,8 +57,8 @@ public: std::function<void (std::exception_ptr)> spriteError; std::function<void (Source&)> sourceLoaded; std::function<void (Source&, std::exception_ptr)> sourceError; - std::function<void (Source&, const TileID&, bool isNewTile)> tileLoaded; - std::function<void (Source&, const TileID&, std::exception_ptr)> tileError; + 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 (std::exception_ptr)> resourceError; }; diff --git a/test/style/source.cpp b/test/style/source.cpp index 7964a05814..b520fcb6fd 100644 --- a/test/style/source.cpp +++ b/test/style/source.cpp @@ -122,12 +122,12 @@ TEST(Source, RasterTileEmpty) { return response; }; - test.observer.tileLoaded = [&] (Source& source, const TileID&, bool) { + test.observer.tileLoaded = [&] (Source& source, const OverscaledTileID&, bool) { EXPECT_EQ("source", source.id); test.end(); }; - test.observer.tileError = [&] (Source&, const TileID&, std::exception_ptr) { + test.observer.tileError = [&] (Source&, const OverscaledTileID&, std::exception_ptr) { FAIL() << "Should never be called"; }; @@ -151,12 +151,12 @@ TEST(Source, VectorTileEmpty) { return response; }; - test.observer.tileLoaded = [&] (Source& source, const TileID&, bool) { + test.observer.tileLoaded = [&] (Source& source, const OverscaledTileID&, bool) { EXPECT_EQ("source", source.id); test.end(); }; - test.observer.tileError = [&] (Source&, const TileID&, std::exception_ptr) { + test.observer.tileError = [&] (Source&, const OverscaledTileID&, std::exception_ptr) { FAIL() << "Should never be called"; }; @@ -182,9 +182,9 @@ TEST(Source, RasterTileFail) { return response; }; - test.observer.tileError = [&] (Source& source, const TileID& tileID, std::exception_ptr error) { + test.observer.tileError = [&] (Source& source, const OverscaledTileID& tileID, std::exception_ptr error) { EXPECT_EQ(SourceType::Raster, source.type); - EXPECT_EQ("0/0/0", std::string(tileID)); + EXPECT_EQ(OverscaledTileID(0, 0, 0), tileID); EXPECT_EQ("Failed by the test case", util::toString(error)); test.end(); }; @@ -211,9 +211,9 @@ TEST(Source, VectorTileFail) { return response; }; - test.observer.tileError = [&] (Source& source, const TileID& tileID, std::exception_ptr error) { + test.observer.tileError = [&] (Source& source, const OverscaledTileID& tileID, std::exception_ptr error) { EXPECT_EQ(SourceType::Vector, source.type); - EXPECT_EQ("0/0/0", std::string(tileID)); + EXPECT_EQ(OverscaledTileID(0, 0, 0), tileID); EXPECT_EQ("Failed by the test case", util::toString(error)); test.end(); }; @@ -238,9 +238,9 @@ TEST(Source, RasterTileCorrupt) { return response; }; - test.observer.tileError = [&] (Source& source, const TileID& tileID, std::exception_ptr error) { + test.observer.tileError = [&] (Source& source, const OverscaledTileID& tileID, std::exception_ptr error) { EXPECT_EQ(source.type, SourceType::Raster); - EXPECT_EQ(std::string(tileID), "0/0/0"); + EXPECT_EQ(OverscaledTileID(0, 0, 0), tileID); EXPECT_TRUE(bool(error)); // Not asserting on platform-specific error text. test.end(); @@ -266,9 +266,9 @@ TEST(Source, VectorTileCorrupt) { return response; }; - test.observer.tileError = [&] (Source& source, const TileID& tileID, std::exception_ptr error) { + test.observer.tileError = [&] (Source& source, const OverscaledTileID& tileID, std::exception_ptr error) { EXPECT_EQ(source.type, SourceType::Vector); - EXPECT_EQ(std::string(tileID), "0/0/0"); + EXPECT_EQ(OverscaledTileID(0, 0, 0), tileID); EXPECT_EQ(util::toString(error), "unknown pbf field type exception"); test.end(); }; @@ -298,11 +298,11 @@ TEST(Source, RasterTileCancel) { return optional<Response>(); }; - test.observer.tileLoaded = [&] (Source&, const TileID&, bool) { + test.observer.tileLoaded = [&] (Source&, const OverscaledTileID&, bool) { FAIL() << "Should never be called"; }; - test.observer.tileError = [&] (Source&, const TileID&, std::exception_ptr) { + test.observer.tileError = [&] (Source&, const OverscaledTileID&, std::exception_ptr) { FAIL() << "Should never be called"; }; @@ -325,11 +325,11 @@ TEST(Source, VectorTileCancel) { return optional<Response>(); }; - test.observer.tileLoaded = [&] (Source&, const TileID&, bool) { + test.observer.tileLoaded = [&] (Source&, const OverscaledTileID&, bool) { FAIL() << "Should never be called"; }; - test.observer.tileError = [&] (Source&, const TileID&, std::exception_ptr) { + test.observer.tileError = [&] (Source&, const OverscaledTileID&, std::exception_ptr) { FAIL() << "Should never be called"; }; diff --git a/test/util/geo.cpp b/test/util/geo.cpp index 0e00fdc6a3..95e75a0e1b 100644 --- a/test/util/geo.cpp +++ b/test/util/geo.cpp @@ -2,7 +2,7 @@ #include <mbgl/util/constants.hpp> #include <mbgl/util/geo.hpp> -#include <mbgl/map/tile_id.hpp> +#include <mbgl/tile/tile_id.hpp> using namespace mbgl; @@ -87,19 +87,19 @@ TEST(LatLngBounds, Northwest) { TEST(LatLng, FromTileID) { for (int i = 0; i < 20; i++) { - const LatLng ll{ TileID(i, 0, 0, 0) }; + const LatLng ll{ CanonicalTileID(i, 0, 0) }; ASSERT_DOUBLE_EQ(-util::LONGITUDE_MAX, ll.longitude); ASSERT_DOUBLE_EQ(util::LATITUDE_MAX, ll.latitude); } { - const LatLng ll{ TileID(0, 1, 0, 0) }; + const LatLng ll{ UnwrappedTileID(0, 1, 0) }; ASSERT_DOUBLE_EQ(util::LONGITUDE_MAX, ll.longitude); ASSERT_DOUBLE_EQ(util::LATITUDE_MAX, ll.latitude); } { - const LatLng ll{ TileID(0, -1, 0, 0) }; + const LatLng ll{ UnwrappedTileID(0, -1, 0) }; ASSERT_DOUBLE_EQ(-540, ll.longitude); ASSERT_DOUBLE_EQ(util::LATITUDE_MAX, ll.latitude); } @@ -135,7 +135,7 @@ TEST(LatLng, Boundaries) { TEST(LatLngBounds, FromTileID) { { - const LatLngBounds bounds{ TileID(0, 0, 0, 0) }; + const LatLngBounds bounds{ CanonicalTileID(0, 0, 0) }; ASSERT_DOUBLE_EQ(-util::LONGITUDE_MAX, bounds.west()); ASSERT_DOUBLE_EQ(-util::LATITUDE_MAX, bounds.south()); ASSERT_DOUBLE_EQ(util::LONGITUDE_MAX, bounds.east()); @@ -143,7 +143,7 @@ TEST(LatLngBounds, FromTileID) { } { - const LatLngBounds bounds{ TileID(1, 0, 1, 0) }; + const LatLngBounds bounds{ CanonicalTileID(1, 0, 1) }; ASSERT_DOUBLE_EQ(-util::LONGITUDE_MAX, bounds.west()); ASSERT_DOUBLE_EQ(-util::LATITUDE_MAX, bounds.south()); ASSERT_DOUBLE_EQ(0, bounds.east()); @@ -151,7 +151,7 @@ TEST(LatLngBounds, FromTileID) { } { - const LatLngBounds bounds{ TileID(1, 1, 1, 0) }; + const LatLngBounds bounds{ CanonicalTileID(1, 1, 1) }; ASSERT_DOUBLE_EQ(0, bounds.west()); ASSERT_DOUBLE_EQ(-util::LATITUDE_MAX, bounds.south()); ASSERT_DOUBLE_EQ(util::LONGITUDE_MAX, bounds.east()); @@ -159,7 +159,7 @@ TEST(LatLngBounds, FromTileID) { } { - const LatLngBounds bounds{ TileID(1, 0, 0, 0) }; + const LatLngBounds bounds{ CanonicalTileID(1, 0, 0) }; ASSERT_DOUBLE_EQ(-util::LONGITUDE_MAX, bounds.west()); ASSERT_DOUBLE_EQ(0, bounds.south()); ASSERT_DOUBLE_EQ(0, bounds.east()); |