summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorIvo van Dongen <info@ivovandongen.nl>2017-07-05 18:04:15 +0300
committerIvo van Dongen <ivovandongen@users.noreply.github.com>2017-07-18 10:45:12 +0200
commita5a0558bde5d67617b6f305179063cd4e0ac329e (patch)
tree346e4a6831ff991c5e805b1ae0616839ac9c7b62 /test
parent815ffb253b555c9a99b7d63a343745db05802c76 (diff)
downloadqtlocation-mapboxgl-a5a0558bde5d67617b6f305179063cd4e0ac329e.tar.gz
[test] allow only a single shared display to avoid egl errors
Diffstat (limited to 'test')
-rw-r--r--test/api/annotations.test.cpp2
-rw-r--r--test/api/api_misuse.test.cpp2
-rw-r--r--test/api/custom_layer.test.cpp2
-rw-r--r--test/api/query.test.cpp2
-rw-r--r--test/api/render_missing.test.cpp2
-rw-r--r--test/api/repeated_render.test.cpp4
-rw-r--r--test/gl/object.test.cpp2
-rw-r--r--test/map/map.test.cpp5
-rw-r--r--test/map/prefetch.test.cpp2
-rw-r--r--test/src/mbgl/test/util.cpp6
-rw-r--r--test/src/mbgl/test/util.hpp2
-rw-r--r--test/tile/annotation_tile.test.cpp2
-rw-r--r--test/util/memory.test.cpp2
-rw-r--r--test/util/offscreen_texture.test.cpp4
14 files changed, 16 insertions, 23 deletions
diff --git a/test/api/annotations.test.cpp b/test/api/annotations.test.cpp
index bc1ad54129..878ef90831 100644
--- a/test/api/annotations.test.cpp
+++ b/test/api/annotations.test.cpp
@@ -30,7 +30,7 @@ std::unique_ptr<style::Image> namedMarker(const std::string& name) {
class AnnotationTest {
public:
util::RunLoop loop;
- HeadlessBackend backend { test::sharedDisplay() };
+ HeadlessBackend backend;
BackendScope scope { backend };
OffscreenView view { backend.getContext() };
StubFileSource fileSource;
diff --git a/test/api/api_misuse.test.cpp b/test/api/api_misuse.test.cpp
index ed5cc41a49..9f53b763be 100644
--- a/test/api/api_misuse.test.cpp
+++ b/test/api/api_misuse.test.cpp
@@ -24,7 +24,7 @@ TEST(API, RenderWithoutCallback) {
util::RunLoop loop;
- HeadlessBackend backend { test::sharedDisplay() };
+ HeadlessBackend backend;
BackendScope scope { backend };
OffscreenView view { backend.getContext(), { 128, 512 } };
StubFileSource fileSource;
diff --git a/test/api/custom_layer.test.cpp b/test/api/custom_layer.test.cpp
index da5b535a86..972485338f 100644
--- a/test/api/custom_layer.test.cpp
+++ b/test/api/custom_layer.test.cpp
@@ -89,7 +89,7 @@ public:
TEST(CustomLayer, Basic) {
util::RunLoop loop;
- HeadlessBackend backend { test::sharedDisplay() };
+ HeadlessBackend backend;
BackendScope scope { backend };
OffscreenView view { backend.getContext() };
DefaultFileSource fileSource(":memory:", "test/fixtures/api/assets");
diff --git a/test/api/query.test.cpp b/test/api/query.test.cpp
index 5135b51e8b..a5224222cb 100644
--- a/test/api/query.test.cpp
+++ b/test/api/query.test.cpp
@@ -30,7 +30,7 @@ public:
}
util::RunLoop loop;
- HeadlessBackend backend { test::sharedDisplay() };
+ HeadlessBackend backend;
BackendScope scope { backend };
OffscreenView view { backend.getContext() };
StubFileSource fileSource;
diff --git a/test/api/render_missing.test.cpp b/test/api/render_missing.test.cpp
index 01a0e9293b..02c19d359b 100644
--- a/test/api/render_missing.test.cpp
+++ b/test/api/render_missing.test.cpp
@@ -30,7 +30,7 @@ TEST(API, TEST_REQUIRES_SERVER(RenderMissingTile)) {
const auto style = util::read_file("test/fixtures/api/water_missing_tiles.json");
- HeadlessBackend backend { test::sharedDisplay() };
+ HeadlessBackend backend;
BackendScope scope { backend };
OffscreenView view { backend.getContext(), { 256, 512 } };
float pixelRatio { 1 };
diff --git a/test/api/repeated_render.test.cpp b/test/api/repeated_render.test.cpp
index 7d61992769..0e8a2715b7 100644
--- a/test/api/repeated_render.test.cpp
+++ b/test/api/repeated_render.test.cpp
@@ -27,7 +27,7 @@ TEST(API, RepeatedRender) {
const auto style = util::read_file("test/fixtures/api/water.json");
- HeadlessBackend backend { test::sharedDisplay() };
+ HeadlessBackend backend;
BackendScope scope { backend };
OffscreenView view { backend.getContext(), { 512, 512 } };
float pixelRatio { 1 };
@@ -84,7 +84,7 @@ TEST(API, ZoomHistory) {
const auto style = util::read_file("test/fixtures/api/empty.json");
- HeadlessBackend backend { test::sharedDisplay() };
+ HeadlessBackend backend;
BackendScope scope { backend };
OffscreenView view { backend.getContext(), { 512, 512 } };
DefaultFileSource fileSource(":memory:", ".");
diff --git a/test/gl/object.test.cpp b/test/gl/object.test.cpp
index cf887dab40..30699718b3 100644
--- a/test/gl/object.test.cpp
+++ b/test/gl/object.test.cpp
@@ -47,7 +47,7 @@ TEST(GLObject, Value) {
}
TEST(GLObject, Store) {
- HeadlessBackend backend { test::sharedDisplay() };
+ HeadlessBackend backend;
BackendScope scope { backend };
OffscreenView view(backend.getContext());
diff --git a/test/map/map.test.cpp b/test/map/map.test.cpp
index 93890aa9f3..3e8f8696e1 100644
--- a/test/map/map.test.cpp
+++ b/test/map/map.test.cpp
@@ -6,6 +6,7 @@
#include <mbgl/map/map.hpp>
#include <mbgl/renderer/backend_scope.hpp>
#include <mbgl/gl/headless_backend.hpp>
+#include <mbgl/gl/headless_display.hpp>
#include <mbgl/gl/offscreen_view.hpp>
#include <mbgl/gl/context.hpp>
#include <mbgl/util/default_thread_pool.hpp>
@@ -539,8 +540,8 @@ TEST(Map, DontLoadUnneededTiles) {
TEST(Map, TEST_DISABLED_ON_CI(ContinuousRendering)) {
util::RunLoop runLoop;
- HeadlessBackend backend { test::sharedDisplay() };
- BackendScope scope(backend);
+ HeadlessBackend backend;
+ BackendScope scope { backend };
OffscreenView view { backend.getContext() };
ThreadPool threadPool { 4 };
DefaultFileSource fileSource(":memory:", "test/fixtures/api/assets");
diff --git a/test/map/prefetch.test.cpp b/test/map/prefetch.test.cpp
index c3ff04acfc..436bdc3b63 100644
--- a/test/map/prefetch.test.cpp
+++ b/test/map/prefetch.test.cpp
@@ -24,7 +24,7 @@ using namespace std::literals::string_literals;
TEST(Map, PrefetchTiles) {
util::RunLoop runLoop;
- HeadlessBackend backend(test::sharedDisplay());
+ HeadlessBackend backend;
BackendScope scope(backend);
OffscreenView view(backend.getContext(), { 512, 512 });
ThreadPool threadPool(4);
diff --git a/test/src/mbgl/test/util.cpp b/test/src/mbgl/test/util.cpp
index f3b0bbc96f..0b1034e315 100644
--- a/test/src/mbgl/test/util.cpp
+++ b/test/src/mbgl/test/util.cpp
@@ -2,7 +2,6 @@
#include <mbgl/map/map.hpp>
#include <mbgl/gl/offscreen_view.hpp>
-#include <mbgl/gl/headless_display.hpp>
#include <mbgl/util/logging.hpp>
#include <mbgl/util/image.hpp>
#include <mbgl/util/io.hpp>
@@ -99,11 +98,6 @@ Server::~Server() {
}
}
-std::shared_ptr<HeadlessDisplay> sharedDisplay() {
- static auto display = std::make_shared<HeadlessDisplay>();
- return display;
-}
-
PremultipliedImage render(Map& map, OffscreenView& view) {
PremultipliedImage result;
map.renderStill([&](std::exception_ptr) {
diff --git a/test/src/mbgl/test/util.hpp b/test/src/mbgl/test/util.hpp
index 8673155fe4..9c015f1641 100644
--- a/test/src/mbgl/test/util.hpp
+++ b/test/src/mbgl/test/util.hpp
@@ -70,8 +70,6 @@ private:
int fd = -1;
};
-std::shared_ptr<HeadlessDisplay> sharedDisplay();
-
PremultipliedImage render(Map&, OffscreenView&);
void checkImage(const std::string& base,
diff --git a/test/tile/annotation_tile.test.cpp b/test/tile/annotation_tile.test.cpp
index 50f1facc10..c58b980ecd 100644
--- a/test/tile/annotation_tile.test.cpp
+++ b/test/tile/annotation_tile.test.cpp
@@ -29,7 +29,7 @@ public:
ThreadPool threadPool { 1 };
style::Style style { loop, fileSource, 1 };
AnnotationManager annotationManager { style };
- HeadlessBackend backend { test::sharedDisplay() };
+ HeadlessBackend backend;
BackendScope scope { backend };
RenderStyle renderStyle { threadPool, fileSource };
ImageManager imageManager;
diff --git a/test/util/memory.test.cpp b/test/util/memory.test.cpp
index cb333129d8..ad7982ce57 100644
--- a/test/util/memory.test.cpp
+++ b/test/util/memory.test.cpp
@@ -38,7 +38,7 @@ public:
}
util::RunLoop runLoop;
- HeadlessBackend backend { test::sharedDisplay() };
+ HeadlessBackend backend;
BackendScope scope { backend };
OffscreenView view { backend.getContext(), { 512, 512 } };
StubFileSource fileSource;
diff --git a/test/util/offscreen_texture.test.cpp b/test/util/offscreen_texture.test.cpp
index d8a409de36..d4efd75689 100644
--- a/test/util/offscreen_texture.test.cpp
+++ b/test/util/offscreen_texture.test.cpp
@@ -11,7 +11,7 @@
using namespace mbgl;
TEST(OffscreenTexture, EmptyRed) {
- HeadlessBackend backend { test::sharedDisplay() };
+ HeadlessBackend backend;
BackendScope scope { backend };
OffscreenView view(backend.getContext(), { 512, 256 });
@@ -74,7 +74,7 @@ struct Buffer {
TEST(OffscreenTexture, RenderToTexture) {
- HeadlessBackend backend { test::sharedDisplay() };
+ HeadlessBackend backend;
BackendScope scope { backend };
auto& context = backend.getContext();