diff options
author | Asheem Mamoowala <asheem.mamoowala@mapbox.com> | 2017-11-22 10:18:53 -0800 |
---|---|---|
committer | Asheem Mamoowala <asheem.mamoowala@mapbox.com> | 2017-11-22 13:56:38 -0800 |
commit | acae19386129056b9425b114b01f062feecd297e (patch) | |
tree | 8b0db927fe5a78de3393f735d9317aba1034ba7e /test/style | |
parent | e3f1d8e3a0beb648ec90ac4d9baa5f27c6cf3935 (diff) | |
download | qtlocation-mapboxgl-acae19386129056b9425b114b01f062feecd297e.tar.gz |
[core] Custom Geometry Sources
Diffstat (limited to 'test/style')
-rw-r--r-- | test/style/source.test.cpp | 37 |
1 files changed, 37 insertions, 0 deletions
diff --git a/test/style/source.test.cpp b/test/style/source.test.cpp index bee1b867b8..6a2122161d 100644 --- a/test/style/source.test.cpp +++ b/test/style/source.test.cpp @@ -9,6 +9,7 @@ #include <mbgl/style/sources/vector_source.hpp> #include <mbgl/style/sources/geojson_source.hpp> #include <mbgl/style/sources/image_source.hpp> +#include <mbgl/style/sources/custom_geometry_source.hpp> #include <mbgl/style/layers/raster_layer.cpp> #include <mbgl/style/layers/line_layer.hpp> @@ -548,3 +549,39 @@ TEST(Source, ImageSourceImageUpdate) { test.run(); } + +TEST(Source, CustomGeometrySourceSetTileData) { + SourceTest test; + + CustomGeometrySource source("source", CustomGeometrySource::Options()); + source.loadDescription(test.fileSource); + + LineLayer layer("id", "source"); + layer.setSourceLayer("water"); + std::vector<Immutable<Layer::Impl>> layers {{ layer.baseImpl }}; + + test.renderSourceObserver.tileChanged = [&] (RenderSource& source_, const OverscaledTileID&) { + EXPECT_EQ("source", source_.baseImpl->id); + test.end(); + }; + + test.renderSourceObserver.tileError = [&] (RenderSource&, const OverscaledTileID&, std::exception_ptr) { + FAIL() << "Should never be called"; + }; + + auto renderSource = RenderSource::create(source.baseImpl); + renderSource->setObserver(&test.renderSourceObserver); + renderSource->update(source.baseImpl, + layers, + true, + true, + test.tileParameters); + + test.loop.invoke([&] () { + // Set Tile Data + source.setTileData(CanonicalTileID(0, 0, 0), GeoJSON{ FeatureCollection{} }); + }); + + test.run(); +} + |