diff options
Diffstat (limited to 'test/style/pending_resources.cpp')
-rw-r--r-- | test/style/pending_resources.cpp | 62 |
1 files changed, 0 insertions, 62 deletions
diff --git a/test/style/pending_resources.cpp b/test/style/pending_resources.cpp deleted file mode 100644 index 1115274227..0000000000 --- a/test/style/pending_resources.cpp +++ /dev/null @@ -1,62 +0,0 @@ -#include "../fixtures/fixture_log_observer.hpp" -#include "../fixtures/mock_file_source.hpp" -#include "../fixtures/util.hpp" - -#include <mbgl/map/map.hpp> -#include <mbgl/platform/default/headless_display.hpp> -#include <mbgl/platform/default/headless_view.hpp> -#include <mbgl/util/async_task.hpp> -#include <mbgl/util/io.hpp> -#include <mbgl/util/run_loop.hpp> - -using namespace mbgl; - -class PendingResources : public ::testing::TestWithParam<std::string> { -}; - -// This test will load a Style but one of the resources requested will not be -// replied immediately like the others. We get an notification by the -// MockFileSource when some resource is artificially delayed and we destroy -// the Map object after that. The idea here is to test if these pending requests -// are getting canceled correctly if on shutdown. -TEST_P(PendingResources, DeleteMapObjectWithPendingRequest) { - util::RunLoop loop; - - auto display = std::make_shared<mbgl::HeadlessDisplay>(); - HeadlessView view(display, 1, 1000, 1000); - MockFileSource fileSource(MockFileSource::Success, GetParam()); - - std::unique_ptr<Map> map = std::make_unique<Map>(view, fileSource, MapMode::Still); - - util::AsyncTask endTest([&map, &loop] { - map.reset(); - loop.stop(); - }); - - fileSource.requestEnqueuedCallback = [&endTest] { endTest.send(); }; - - const std::string style = util::read_file("test/fixtures/resources/style.json"); - map->setStyleJSON(style, "."); - - map->renderStill([](std::exception_ptr, PremultipliedImage&&) { - EXPECT_TRUE(false) << "Should never happen."; - }); - - loop.run(); -} - -// In the test data below, "sprite" will match both "sprite.json" and "sprite.png" and cause two -// requests to be canceled. "resources" will match everything but in practice will only test the -// cancellation of the sprites and "source_*.json" because we only load the rest after "source_*.json" -// gets parsed. -INSTANTIATE_TEST_CASE_P(Style, PendingResources, - ::testing::Values( - "source_raster.json", - "source_vector.json", - "sprite.json", - "sprite.png", - "sprite", - "raster.png", - "vector.pbf", - "glyphs.pbf", - "resources")); |