diff options
author | Jesse Crocker <jesse@gaiagps.com> | 2017-03-01 16:49:49 -0700 |
---|---|---|
committer | Jesse Crocker <jesse@gaiagps.com> | 2017-03-01 16:49:49 -0700 |
commit | f75b34d43f1b6aa97b3d5db201ea8ae23afe06c6 (patch) | |
tree | a694d10355507733233c13384f44dd3f63db6c13 | |
parent | f01e1f2bf53c09cf2f295c10677b93d15b00e56c (diff) | |
download | qtlocation-mapboxgl-f75b34d43f1b6aa97b3d5db201ea8ae23afe06c6.tar.gz |
A couple more tests
-rw-r--r-- | test/style/custom_vector_source.test.cpp | 31 |
1 files changed, 31 insertions, 0 deletions
diff --git a/test/style/custom_vector_source.test.cpp b/test/style/custom_vector_source.test.cpp index 2b69737c1f..2456a46fb3 100644 --- a/test/style/custom_vector_source.test.cpp +++ b/test/style/custom_vector_source.test.cpp @@ -1,6 +1,7 @@ #include <mbgl/test/util.hpp> #include <mbgl/style/sources/geojson_source.hpp> +#include <mbgl/util/geo.hpp> #include <mbgl/style/sources/custom_vector_source.hpp> @@ -20,3 +21,33 @@ TEST(CustomVectorSource, EmptyData) { mbgl::FeatureCollection featureCollection; testSource->setTileData(0, 0, 0, mbgl::GeoJSON{featureCollection}); } + +TEST(CustomVectorSource, Geometry) { + mbgl::style::GeoJSONOptions options; + +#pragma clang diagnostic push +#pragma clang diagnostic ignored "-Wunused-parameter" + const auto callback = ^void(uint8_t z, uint32_t x, uint32_t y) {}; +#pragma clang diagnostic pop + + auto testSource = std::make_unique<mbgl::style::CustomVectorSource>("source", options, callback); + + Polygon<double> polygon = {{ {{ { 0, 0 }, { 0, 45 }, { 45, 45 }, { 45, 0 } }} }}; + testSource->setTileData(0, 0, 0, mbgl::GeoJSON{polygon}); +} + +TEST(CustomVectorSource, ReloadWithNoTiles) { + mbgl::style::GeoJSONOptions options; + + __block bool called = false; +#pragma clang diagnostic push +#pragma clang diagnostic ignored "-Wunused-parameter" + const auto callback = ^void(uint8_t z, uint32_t x, uint32_t y) { + called = true; + }; +#pragma clang diagnostic pop + + auto testSource = std::make_unique<mbgl::style::CustomVectorSource>("source", options, callback); + testSource->reloadRegion(mbgl::LatLngBounds::world(), 0); + EXPECT_EQ(called, false); +} |