summaryrefslogtreecommitdiff
path: root/test/tile
diff options
context:
space:
mode:
authorJohn Firebaugh <john.firebaugh@gmail.com>2016-10-04 13:48:59 -0700
committerJohn Firebaugh <john.firebaugh@gmail.com>2016-10-05 10:26:04 -0700
commit31be5d3c3a51976ed5db51fc7b59fd994b09b611 (patch)
treea82eea517c3debf873ab5ca4a3bf3fce889f6f34 /test/tile
parent3b72c288adbb9aa689047fbb277b98ab7be6ec75 (diff)
downloadqtlocation-mapboxgl-31be5d3c3a51976ed5db51fc7b59fd994b09b611.tar.gz
[core] Tiles that error on load are not renderable
Diffstat (limited to 'test/tile')
-rw-r--r--test/tile/raster_tile.test.cpp47
-rw-r--r--test/tile/vector_tile.test.cpp47
2 files changed, 94 insertions, 0 deletions
diff --git a/test/tile/raster_tile.test.cpp b/test/tile/raster_tile.test.cpp
new file mode 100644
index 0000000000..a5a7e65b35
--- /dev/null
+++ b/test/tile/raster_tile.test.cpp
@@ -0,0 +1,47 @@
+#include <mbgl/test/util.hpp>
+#include <mbgl/test/fake_file_source.hpp>
+#include <mbgl/tile/raster_tile.hpp>
+#include <mbgl/tile/tile_loader_impl.hpp>
+
+#include <mbgl/actor/thread_pool.hpp>
+#include <mbgl/map/transform.hpp>
+#include <mbgl/style/style.hpp>
+#include <mbgl/style/update_parameters.hpp>
+#include <mbgl/annotation/annotation_manager.hpp>
+
+using namespace mbgl;
+
+class RasterTileTest {
+public:
+ FakeFileSource fileSource;
+ TransformState transformState;
+ ThreadPool threadPool { 1 };
+ AnnotationManager annotationManager { 1.0 };
+ style::Style style { fileSource, 1.0 };
+ Tileset tileset { { "https://example.com" }, { 0, 22 }, "none" };
+
+ style::UpdateParameters updateParameters {
+ 1.0,
+ MapDebugOptions(),
+ transformState,
+ threadPool,
+ fileSource,
+ MapMode::Continuous,
+ annotationManager,
+ style
+ };
+};
+
+TEST(RasterTile, setError) {
+ RasterTileTest test;
+ RasterTile tile(OverscaledTileID(0, 0, 0), test.updateParameters, test.tileset);
+ tile.setError(std::make_exception_ptr(std::runtime_error("test")));
+ EXPECT_FALSE(tile.isRenderable());
+}
+
+TEST(RasterTile, onError) {
+ RasterTileTest test;
+ RasterTile tile(OverscaledTileID(0, 0, 0), test.updateParameters, test.tileset);
+ tile.onError(std::make_exception_ptr(std::runtime_error("test")));
+ EXPECT_TRUE(tile.isRenderable());
+}
diff --git a/test/tile/vector_tile.test.cpp b/test/tile/vector_tile.test.cpp
new file mode 100644
index 0000000000..e22b88a61d
--- /dev/null
+++ b/test/tile/vector_tile.test.cpp
@@ -0,0 +1,47 @@
+#include <mbgl/test/util.hpp>
+#include <mbgl/test/fake_file_source.hpp>
+#include <mbgl/tile/vector_tile.hpp>
+#include <mbgl/tile/tile_loader_impl.hpp>
+
+#include <mbgl/actor/thread_pool.hpp>
+#include <mbgl/map/transform.hpp>
+#include <mbgl/style/style.hpp>
+#include <mbgl/style/update_parameters.hpp>
+#include <mbgl/annotation/annotation_manager.hpp>
+
+using namespace mbgl;
+
+class VectorTileTest {
+public:
+ FakeFileSource fileSource;
+ TransformState transformState;
+ ThreadPool threadPool { 1 };
+ AnnotationManager annotationManager { 1.0 };
+ style::Style style { fileSource, 1.0 };
+ Tileset tileset { { "https://example.com" }, { 0, 22 }, "none" };
+
+ style::UpdateParameters updateParameters {
+ 1.0,
+ MapDebugOptions(),
+ transformState,
+ threadPool,
+ fileSource,
+ MapMode::Continuous,
+ annotationManager,
+ style
+ };
+};
+
+TEST(VectorTile, setError) {
+ VectorTileTest test;
+ VectorTile tile(OverscaledTileID(0, 0, 0), "source", test.updateParameters, test.tileset);
+ tile.setError(std::make_exception_ptr(std::runtime_error("test")));
+ EXPECT_FALSE(tile.isRenderable());
+}
+
+TEST(VectorTile, onError) {
+ VectorTileTest test;
+ VectorTile tile(OverscaledTileID(0, 0, 0), "source", test.updateParameters, test.tileset);
+ tile.onError(std::make_exception_ptr(std::runtime_error("test")));
+ EXPECT_TRUE(tile.isRenderable());
+}