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/api | |
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/api')
-rw-r--r-- | test/api/annotations.test.cpp | 4 | ||||
-rw-r--r-- | test/api/api_misuse.test.cpp | 9 | ||||
-rw-r--r-- | test/api/custom_layer.test.cpp | 4 | ||||
-rw-r--r-- | test/api/query.test.cpp | 2 | ||||
-rw-r--r-- | test/api/render_missing.test.cpp | 4 | ||||
-rw-r--r-- | test/api/repeated_render.test.cpp | 8 |
6 files changed, 17 insertions, 14 deletions
diff --git a/test/api/annotations.test.cpp b/test/api/annotations.test.cpp index b143bd961c..ef70ee188c 100644 --- a/test/api/annotations.test.cpp +++ b/test/api/annotations.test.cpp @@ -23,8 +23,8 @@ std::shared_ptr<SpriteImage> namedMarker(const std::string &name) { class AnnotationTest { public: util::RunLoop loop; - HeadlessBackend backend; - OffscreenView view{ backend.getContext() }; + HeadlessBackend backend { test::sharedDisplay() }; + OffscreenView view { backend.getContext() }; StubFileSource fileSource; ThreadPool threadPool { 4 }; Map map { backend, view.size, 1, fileSource, threadPool, MapMode::Still }; diff --git a/test/api/api_misuse.test.cpp b/test/api/api_misuse.test.cpp index 50a8f38c33..f96bf78612 100644 --- a/test/api/api_misuse.test.cpp +++ b/test/api/api_misuse.test.cpp @@ -14,14 +14,15 @@ using namespace mbgl; + TEST(API, RenderWithoutCallback) { auto log = new FixtureLogObserver(); Log::setObserver(std::unique_ptr<Log::Observer>(log)); util::RunLoop loop; - HeadlessBackend backend; - OffscreenView view(backend.getContext(), { 128, 512 }); + HeadlessBackend backend { test::sharedDisplay() }; + OffscreenView view { backend.getContext(), { 128, 512 } }; StubFileSource fileSource; ThreadPool threadPool(4); @@ -45,8 +46,8 @@ TEST(API, RenderWithoutCallback) { TEST(API, RenderWithoutStyle) { util::RunLoop loop; - HeadlessBackend backend; - OffscreenView view(backend.getContext(), { 128, 512 }); + HeadlessBackend backend { test::sharedDisplay() }; + OffscreenView view { backend.getContext(), { 128, 512 } }; StubFileSource fileSource; ThreadPool threadPool(4); diff --git a/test/api/custom_layer.test.cpp b/test/api/custom_layer.test.cpp index 9d4ba04cee..9287f02189 100644 --- a/test/api/custom_layer.test.cpp +++ b/test/api/custom_layer.test.cpp @@ -85,8 +85,8 @@ public: TEST(CustomLayer, Basic) { util::RunLoop loop; - HeadlessBackend backend; - OffscreenView view(backend.getContext()); + HeadlessBackend backend { test::sharedDisplay() }; + OffscreenView view { backend.getContext() }; #ifdef MBGL_ASSET_ZIP // Regenerate with `cd test/fixtures/api/ && zip -r assets.zip assets/` diff --git a/test/api/query.test.cpp b/test/api/query.test.cpp index d3c233ad34..506464ea1a 100644 --- a/test/api/query.test.cpp +++ b/test/api/query.test.cpp @@ -26,7 +26,7 @@ public: } util::RunLoop loop; - HeadlessBackend backend; + HeadlessBackend backend { test::sharedDisplay() }; OffscreenView view { backend.getContext() }; StubFileSource fileSource; ThreadPool threadPool { 4 }; diff --git a/test/api/render_missing.test.cpp b/test/api/render_missing.test.cpp index b24d59ab21..8f7821205b 100644 --- a/test/api/render_missing.test.cpp +++ b/test/api/render_missing.test.cpp @@ -25,8 +25,8 @@ TEST(API, TEST_REQUIRES_SERVER(RenderMissingTile)) { const auto style = util::read_file("test/fixtures/api/water_missing_tiles.json"); - HeadlessBackend backend; - OffscreenView view(backend.getContext(), { 256, 512 }); + HeadlessBackend backend { test::sharedDisplay() }; + OffscreenView view { backend.getContext(), { 256, 512 } }; #ifdef MBGL_ASSET_ZIP // Regenerate with `cd test/fixtures/api/ && zip -r assets.zip assets/` DefaultFileSource fileSource(":memory:", "test/fixtures/api/assets.zip"); diff --git a/test/api/repeated_render.test.cpp b/test/api/repeated_render.test.cpp index 1bea05b1fb..67670916fc 100644 --- a/test/api/repeated_render.test.cpp +++ b/test/api/repeated_render.test.cpp @@ -12,15 +12,17 @@ #include <future> +using namespace mbgl; + + TEST(API, RepeatedRender) { - using namespace mbgl; util::RunLoop loop; const auto style = util::read_file("test/fixtures/api/water.json"); - HeadlessBackend backend; - OffscreenView view(backend.getContext(), { 256, 512 }); + HeadlessBackend backend { test::sharedDisplay() }; + OffscreenView view { backend.getContext(), { 256, 512 } }; #ifdef MBGL_ASSET_ZIP // Regenerate with `cd test/fixtures/api/ && zip -r assets.zip assets/` DefaultFileSource fileSource(":memory:", "test/fixtures/api/assets.zip"); |