From 18c0590ddda44b7e9cf626c6d13e35136ef3897d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Konstantin=20K=C3=A4fer?= Date: Tue, 2 Apr 2019 14:11:37 +0200 Subject: [test] add new OffscreenTexture test --- .../clear-render-pass-color/expected.png | Bin 0 -> 660 bytes test/util/offscreen_texture.test.cpp | 16 ++++++++++++++++ 2 files changed, 16 insertions(+) create mode 100644 test/fixtures/offscreen_texture/clear-render-pass-color/expected.png diff --git a/test/fixtures/offscreen_texture/clear-render-pass-color/expected.png b/test/fixtures/offscreen_texture/clear-render-pass-color/expected.png new file mode 100644 index 0000000000..89d7feace4 Binary files /dev/null and b/test/fixtures/offscreen_texture/clear-render-pass-color/expected.png differ 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 #include +#include #include #include #include @@ -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); +} -- cgit v1.2.1