[core] Tiles that error on load are not renderable
This commit is contained in:
47
test/tile/vector_tile.test.cpp
Normal file
47
test/tile/vector_tile.test.cpp
Normal file
@@ -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());
|
||||
}
|
||||
Reference in New Issue
Block a user