From fa81ebc2bff3db41c1d12d0be16ea835a666c030 Mon Sep 17 00:00:00 2001 From: Asheem Mamoowala Date: Wed, 11 Oct 2017 15:16:48 -0700 Subject: [core] Tests for CustomVectorSource and CustomTile --- test/style/custom_vector_source.test.cpp | 12 ----------- test/style/source.test.cpp | 37 ++++++++++++++++++++++++++++++++ 2 files changed, 37 insertions(+), 12 deletions(-) delete mode 100644 test/style/custom_vector_source.test.cpp (limited to 'test/style') diff --git a/test/style/custom_vector_source.test.cpp b/test/style/custom_vector_source.test.cpp deleted file mode 100644 index 1d9be99a58..0000000000 --- a/test/style/custom_vector_source.test.cpp +++ /dev/null @@ -1,12 +0,0 @@ -#include - -#include -#include -#include -#include - -using namespace mbgl; - -//TODO: AHM: Add tests with real expectations -TEST(CustomVectorSource, EmptyTest) { -} diff --git a/test/style/source.test.cpp b/test/style/source.test.cpp index 919260ffe9..c9a6c13992 100644 --- a/test/style/source.test.cpp +++ b/test/style/source.test.cpp @@ -9,6 +9,7 @@ #include #include #include +#include #include #include @@ -547,3 +548,39 @@ TEST(Source, ImageSourceImageUpdate) { test.run(); } + +TEST(Source, CustomVectorSourceSetTileData) { + SourceTest test; + + CustomVectorSource source("source", CustomVectorSource::Options()); + source.loadDescription(test.fileSource); + + LineLayer layer("id", "source"); + layer.setSourceLayer("water"); + std::vector> 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(); +} + -- cgit v1.2.1