diff options
author | Konstantin Käfer <mail@kkaefer.com> | 2019-04-02 14:11:37 +0200 |
---|---|---|
committer | Konstantin Käfer <mail@kkaefer.com> | 2019-05-28 16:11:05 +0200 |
commit | 18c0590ddda44b7e9cf626c6d13e35136ef3897d (patch) | |
tree | 44b8ac42b09d770a6b579733a344ee2738e47fa1 /test | |
parent | 12d8948c2a94df752edfcd492a8c256f65908c5c (diff) | |
download | qtlocation-mapboxgl-18c0590ddda44b7e9cf626c6d13e35136ef3897d.tar.gz |
[test] add new OffscreenTexture test
Diffstat (limited to 'test')
-rw-r--r-- | test/fixtures/offscreen_texture/clear-render-pass-color/expected.png | bin | 0 -> 660 bytes | |||
-rw-r--r-- | test/util/offscreen_texture.test.cpp | 16 |
2 files changed, 16 insertions, 0 deletions
diff --git a/test/fixtures/offscreen_texture/clear-render-pass-color/expected.png b/test/fixtures/offscreen_texture/clear-render-pass-color/expected.png Binary files differnew file mode 100644 index 0000000000..89d7feace4 --- /dev/null +++ b/test/fixtures/offscreen_texture/clear-render-pass-color/expected.png diff --git a/test/util/offscreen_texture.test.cpp b/test/util/offscreen_texture.test.cpp index ae56b347a4..78cf7cef60 100644 --- a/test/util/offscreen_texture.test.cpp +++ b/test/util/offscreen_texture.test.cpp @@ -2,6 +2,7 @@ #include <mbgl/platform/gl_functions.hpp> #include <mbgl/gfx/backend_scope.hpp> +#include <mbgl/gfx/render_pass.hpp> #include <mbgl/gl/context.hpp> #include <mbgl/gl/texture.hpp> #include <mbgl/gl/defines.hpp> @@ -180,3 +181,18 @@ void main() { image = backend.readStillImage(); test::checkImage("test/fixtures/offscreen_texture/render-to-fbo-composited", image, 0, 0.1); } + +TEST(OffscreenTexture, ClearRenderPassColor) { + auto backend = gfx::HeadlessBackend::Create({ 128, 256 }); + gfx::BackendScope scope { *backend->getRendererBackend() }; + auto& context = backend->getRendererBackend()->getContext(); + auto encoder = context.createCommandEncoder(); + auto offscreenTexture = context.createOffscreenTexture({ 128, 256 }); + auto renderPass = encoder->createRenderPass( + "offscreen texture", { *offscreenTexture, Color{ 1.0f, 0.0f, 0.0f, 1.0f }, {}, {} }); + renderPass.reset(); + encoder.reset(); + + auto image = offscreenTexture->readStillImage(); + test::checkImage("test/fixtures/offscreen_texture/clear-render-pass-color", image, 0, 0); +} |