diff options
author | Bruno de Oliveira Abinader <bruno@mapbox.com> | 2016-11-10 12:36:53 +0200 |
---|---|---|
committer | Bruno de Oliveira Abinader <bruno@mapbox.com> | 2016-11-17 01:01:15 +0100 |
commit | 50f0f919c38a905b8b169fcbd3e77c03bf48d17b (patch) | |
tree | e5b798dcca7afabf89f80c9c4810861c22db13e5 /test/src | |
parent | 5479b75c9fa971332aadfede6b380267eebbd566 (diff) | |
download | qtlocation-mapboxgl-50f0f919c38a905b8b169fcbd3e77c03bf48d17b.tar.gz |
[test] Use shared headless display
Prevents some OpenGL implementations from bailing out.
Diffstat (limited to 'test/src')
-rw-r--r-- | test/src/mbgl/test/util.cpp | 6 | ||||
-rw-r--r-- | test/src/mbgl/test/util.hpp | 4 |
2 files changed, 10 insertions, 0 deletions
diff --git a/test/src/mbgl/test/util.cpp b/test/src/mbgl/test/util.cpp index 2a82e0059f..a3b6117d02 100644 --- a/test/src/mbgl/test/util.cpp +++ b/test/src/mbgl/test/util.cpp @@ -2,6 +2,7 @@ #include <mbgl/map/map.hpp> #include <mbgl/platform/default/offscreen_view.hpp> +#include <mbgl/platform/default/headless_display.hpp> #include <mbgl/platform/log.hpp> #include <mbgl/util/image.hpp> #include <mbgl/util/io.hpp> @@ -98,6 +99,11 @@ 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(view, [&](std::exception_ptr) { diff --git a/test/src/mbgl/test/util.hpp b/test/src/mbgl/test/util.hpp index b8ecf175aa..8445822699 100644 --- a/test/src/mbgl/test/util.hpp +++ b/test/src/mbgl/test/util.hpp @@ -46,6 +46,7 @@ #include <mbgl/util/chrono.hpp> #include <cstdint> +#include <memory> #include <gtest/gtest.h> @@ -53,6 +54,7 @@ namespace mbgl { class Map; class OffscreenView; +class HeadlessDisplay; namespace test { @@ -65,6 +67,8 @@ private: int fd = -1; }; +std::shared_ptr<HeadlessDisplay> sharedDisplay(); + PremultipliedImage render(Map&, OffscreenView&); void checkImage(const std::string& base, |