summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorKonstantin Käfer <mail@kkaefer.com>2019-04-02 14:11:37 +0200
committerKonstantin Käfer <mail@kkaefer.com>2019-05-28 16:11:05 +0200
commit7f9274035bad30980e03574c315904ab7a85fe83 (patch)
tree7b9cd0f2e2883d6da22611eaa68fae07bb7245b6 /test
parent33ee7e23de24bd3c076eafef819029cf45451d23 (diff)
downloadqtlocation-mapboxgl-7f9274035bad30980e03574c315904ab7a85fe83.tar.gz
[core] refactor program object creation
Diffstat (limited to 'test')
-rw-r--r--test/api/custom_layer.test.cpp4
-rw-r--r--test/gl/context.test.cpp4
-rw-r--r--test/map/map.test.cpp4
-rw-r--r--test/src/mbgl/test/test.cpp9
-rw-r--r--test/util/offscreen_texture.test.cpp8
5 files changed, 29 insertions, 0 deletions
diff --git a/test/api/custom_layer.test.cpp b/test/api/custom_layer.test.cpp
index 5afc4152ba..175d053f93 100644
--- a/test/api/custom_layer.test.cpp
+++ b/test/api/custom_layer.test.cpp
@@ -87,6 +87,10 @@ public:
};
TEST(CustomLayer, Basic) {
+ if (gfx::Backend::GetType() != gfx::Backend::Type::OpenGL) {
+ return;
+ }
+
util::RunLoop loop;
HeadlessFrontend frontend { 1 };
diff --git a/test/gl/context.test.cpp b/test/gl/context.test.cpp
index 54b0c01d95..4b6bad6f65 100644
--- a/test/gl/context.test.cpp
+++ b/test/gl/context.test.cpp
@@ -85,6 +85,10 @@ struct Buffer {
};
TEST(GLContextMode, Shared) {
+ if (gfx::Backend::GetType() != gfx::Backend::Type::OpenGL) {
+ return;
+ }
+
util::RunLoop loop;
HeadlessFrontend frontend { 1, {}, gfx::ContextMode::Shared };
diff --git a/test/map/map.test.cpp b/test/map/map.test.cpp
index 42edaedf22..fd831a05b7 100644
--- a/test/map/map.test.cpp
+++ b/test/map/map.test.cpp
@@ -610,6 +610,10 @@ TEST(Map, AddLayer) {
}
TEST(Map, WithoutVAOExtension) {
+ if (gfx::Backend::GetType() != gfx::Backend::Type::OpenGL) {
+ return;
+ }
+
MapTest<DefaultFileSource> test { ":memory:", "test/fixtures/api/assets" };
gfx::BackendScope scope { *test.frontend.getBackend() };
diff --git a/test/src/mbgl/test/test.cpp b/test/src/mbgl/test/test.cpp
index 1c77aae2a1..30df01c488 100644
--- a/test/src/mbgl/test/test.cpp
+++ b/test/src/mbgl/test/test.cpp
@@ -1,9 +1,12 @@
#include <mbgl/actor/scheduler.hpp>
+#include <mbgl/gfx/backend.hpp>
#include <mbgl/test.hpp>
#include <mbgl/test/util.hpp>
#include <gtest/gtest.h>
+#include <args.hxx>
+
namespace mbgl {
int runTests(int argc, char *argv[]) {
@@ -12,6 +15,12 @@ int runTests(int argc, char *argv[]) {
#endif
testing::InitGoogleTest(&argc, argv);
+
+ args::ArgumentParser argumentParser("Unit tests");
+ args::ValueFlag<std::string> backendValue(argumentParser, "Backend", "Rendering backend", {"backend"});
+
+ argumentParser.ParseCLI(argc, argv);
+
return RUN_ALL_TESTS();
}
diff --git a/test/util/offscreen_texture.test.cpp b/test/util/offscreen_texture.test.cpp
index ef10984364..ae56b347a4 100644
--- a/test/util/offscreen_texture.test.cpp
+++ b/test/util/offscreen_texture.test.cpp
@@ -14,6 +14,10 @@ using namespace mbgl;
using namespace mbgl::platform;
TEST(OffscreenTexture, EmptyRed) {
+ if (gfx::Backend::GetType() != gfx::Backend::Type::OpenGL) {
+ return;
+ }
+
gl::HeadlessBackend backend({ 512, 256 });
gfx::BackendScope scope { backend };
@@ -76,6 +80,10 @@ struct Buffer {
TEST(OffscreenTexture, RenderToTexture) {
+ if (gfx::Backend::GetType() != gfx::Backend::Type::OpenGL) {
+ return;
+ }
+
gl::HeadlessBackend backend({ 512, 256 });
gfx::BackendScope scope { backend };
auto& context = static_cast<gl::Context&>(backend.getContext());