summaryrefslogtreecommitdiff
path: root/test/map/map.test.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'test/map/map.test.cpp')
-rw-r--r--test/map/map.test.cpp36
1 files changed, 19 insertions, 17 deletions
diff --git a/test/map/map.test.cpp b/test/map/map.test.cpp
index 5b66d9b753..c03a038dc0 100644
--- a/test/map/map.test.cpp
+++ b/test/map/map.test.cpp
@@ -4,8 +4,9 @@
#include <mbgl/test/fixture_log_observer.hpp>
#include <mbgl/map/map.hpp>
-#include <mbgl/platform/default/headless_view.hpp>
#include <mbgl/platform/default/headless_display.hpp>
+#include <mbgl/platform/default/headless_view.hpp>
+#include <mbgl/platform/default/thread_pool.hpp>
#include <mbgl/sprite/sprite_image.hpp>
#include <mbgl/storage/network_status.hpp>
#include <mbgl/storage/default_file_source.hpp>
@@ -24,11 +25,12 @@ struct MapTest {
std::shared_ptr<HeadlessDisplay> display { std::make_shared<mbgl::HeadlessDisplay>() };
HeadlessView view { display, 1 };
StubFileSource fileSource;
+ ThreadPool threadPool { 4 };
};
TEST(Map, LatLngBehavior) {
MapTest test;
- Map map(test.view, test.fileSource, MapMode::Still);
+ Map map(test.view, test.fileSource, test.threadPool, MapMode::Still);
map.setStyleJSON(util::read_file("test/fixtures/api/empty.json"));
@@ -62,7 +64,7 @@ TEST(Map, Offline) {
fileSource.put(Resource::glyphs(prefix + "{fontstack}/{range}.pbf", {{"Helvetica"}}, {0, 255}), expiredItem("glyph.pbf"));
NetworkStatus::Set(NetworkStatus::Status::Offline);
- Map map(test.view, fileSource, MapMode::Still);
+ Map map(test.view, fileSource, test.threadPool, MapMode::Still);
map.setStyleURL(prefix + "style.json");
test::checkImage("test/fixtures/map/offline",
@@ -86,7 +88,7 @@ TEST(Map, SetStyleInvalidJSON) {
});
{
- Map map(test.view, test.fileSource, MapMode::Still);
+ Map map(test.view, test.fileSource, test.threadPool, MapMode::Still);
map.setStyleJSON("invalid");
}
@@ -117,7 +119,7 @@ TEST(Map, SetStyleInvalidURL) {
}
});
- Map map(test.view, test.fileSource, MapMode::Still);
+ Map map(test.view, test.fileSource, test.threadPool, MapMode::Still);
map.setStyleURL("mapbox://bar");
test.runLoop.run();
@@ -126,7 +128,7 @@ TEST(Map, SetStyleInvalidURL) {
TEST(Map, DoubleStyleLoad) {
MapTest test;
- Map map(test.view, test.fileSource, MapMode::Still);
+ Map map(test.view, test.fileSource, test.threadPool, MapMode::Still);
map.setStyleJSON("");
map.setStyleJSON("");
}
@@ -137,7 +139,7 @@ TEST(Map, StyleFresh) {
MapTest test;
FakeFileSource fileSource;
- Map map(test.view, fileSource, MapMode::Still);
+ Map map(test.view, fileSource, test.threadPool, MapMode::Still);
map.setStyleURL("mapbox://styles/test");
EXPECT_EQ(1u, fileSource.requests.size());
@@ -157,7 +159,7 @@ TEST(Map, StyleExpired) {
MapTest test;
FakeFileSource fileSource;
- Map map(test.view, fileSource, MapMode::Still);
+ Map map(test.view, fileSource, test.threadPool, MapMode::Still);
map.setStyleURL("mapbox://styles/test");
EXPECT_EQ(1u, fileSource.requests.size());
@@ -184,7 +186,7 @@ TEST(Map, StyleExpiredWithAnnotations) {
MapTest test;
FakeFileSource fileSource;
- Map map(test.view, fileSource, MapMode::Still);
+ Map map(test.view, fileSource, test.threadPool, MapMode::Still);
map.setStyleURL("mapbox://styles/test");
EXPECT_EQ(1u, fileSource.requests.size());
@@ -208,7 +210,7 @@ TEST(Map, StyleEarlyMutation) {
MapTest test;
FakeFileSource fileSource;
- Map map(test.view, fileSource, MapMode::Still);
+ Map map(test.view, fileSource, test.threadPool, MapMode::Still);
map.setStyleURL("mapbox://styles/test");
map.addLayer(std::make_unique<style::BackgroundLayer>("bg"));
@@ -222,7 +224,7 @@ TEST(Map, StyleEarlyMutation) {
TEST(Map, StyleLoadedSignal) {
MapTest test;
- Map map(test.view, test.fileSource, MapMode::Still);
+ Map map(test.view, test.fileSource, test.threadPool, MapMode::Still);
// The map should emit a signal on style loaded
bool emitted = false;
@@ -243,7 +245,7 @@ TEST(Map, StyleLoadedSignal) {
TEST(Map, AddLayer) {
MapTest test;
- Map map(test.view, test.fileSource, MapMode::Still);
+ Map map(test.view, test.fileSource, test.threadPool, MapMode::Still);
map.setStyleJSON(util::read_file("test/fixtures/api/empty.json"));
auto layer = std::make_unique<BackgroundLayer>("background");
@@ -256,7 +258,7 @@ TEST(Map, AddLayer) {
TEST(Map, RemoveLayer) {
MapTest test;
- Map map(test.view, test.fileSource, MapMode::Still);
+ Map map(test.view, test.fileSource, test.threadPool, MapMode::Still);
map.setStyleJSON(util::read_file("test/fixtures/api/empty.json"));
auto layer = std::make_unique<BackgroundLayer>("background");
@@ -281,7 +283,7 @@ TEST(Map, DisabledSources) {
return {};
};
- Map map(test.view, test.fileSource, MapMode::Still);
+ Map map(test.view, test.fileSource, test.threadPool, MapMode::Still);
map.setZoom(1);
// This stylesheet has two raster layers, one that starts at zoom 1, the other at zoom 0.
@@ -331,7 +333,7 @@ TEST(Map, DisabledSources) {
TEST(Map, Classes) {
MapTest test;
- Map map(test.view, test.fileSource, MapMode::Still);
+ Map map(test.view, test.fileSource, test.threadPool, MapMode::Still);
map.setStyleJSON(util::read_file("test/fixtures/api/empty.json"));
EXPECT_FALSE(map.getTransitionOptions().duration);
@@ -365,7 +367,7 @@ TEST(Map, Classes) {
TEST(Map, AddImage) {
MapTest test;
- Map map(test.view, test.fileSource, MapMode::Still);
+ Map map(test.view, test.fileSource, test.threadPool, MapMode::Still);
auto decoded1 = decodeImage(util::read_file("test/fixtures/sprites/default_marker.png"));
auto decoded2 = decodeImage(util::read_file("test/fixtures/sprites/default_marker.png"));
auto image1 = std::make_unique<SpriteImage>(std::move(decoded1), 1.0);
@@ -382,7 +384,7 @@ TEST(Map, AddImage) {
TEST(Map, RemoveImage) {
MapTest test;
- Map map(test.view, test.fileSource, MapMode::Still);
+ Map map(test.view, test.fileSource, test.threadPool, MapMode::Still);
auto decoded = decodeImage(util::read_file("test/fixtures/sprites/default_marker.png"));
auto image = std::make_unique<SpriteImage>(std::move(decoded), 1.0);