From 000833f86b08aeb8e141aae8dcaa17ed1914b4ab Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Vladim=C3=ADr=20Vondru=C5=A1?= Date: Thu, 8 Aug 2019 23:42:08 +0200 Subject: [PATCH] Shaders: these cheats for getting code coverage are not needed anymore. The testing is *real* now. --- src/Magnum/Shaders/Test/FlatGLTest.cpp | 40 ------------------------- src/Magnum/Shaders/Test/PhongGLTest.cpp | 39 ------------------------ 2 files changed, 79 deletions(-) diff --git a/src/Magnum/Shaders/Test/FlatGLTest.cpp b/src/Magnum/Shaders/Test/FlatGLTest.cpp index c00139add..d70997f36 100644 --- a/src/Magnum/Shaders/Test/FlatGLTest.cpp +++ b/src/Magnum/Shaders/Test/FlatGLTest.cpp @@ -60,13 +60,9 @@ struct FlatGLTest: GL::OpenGLTester { explicit FlatGLTest(); template void construct(); - template void constructMove(); - template void bindTexture(); template void bindTextureNotEnabled(); - - template void setAlphaMask(); template void setAlphaMaskNotEnabled(); void renderSetup(); @@ -148,13 +144,8 @@ FlatGLTest::FlatGLTest() { &FlatGLTest::constructMove<2>, &FlatGLTest::constructMove<3>, - &FlatGLTest::bindTexture<2>, - &FlatGLTest::bindTexture<3>, &FlatGLTest::bindTextureNotEnabled<2>, &FlatGLTest::bindTextureNotEnabled<3>, - - &FlatGLTest::setAlphaMask<2>, - &FlatGLTest::setAlphaMask<3>, &FlatGLTest::setAlphaMaskNotEnabled<2>, &FlatGLTest::setAlphaMaskNotEnabled<3>}); @@ -223,27 +214,6 @@ template void FlatGLTest::constructMove() { CORRADE_VERIFY(!b.id()); } -template void FlatGLTest::bindTexture() { - setTestCaseTemplateName(std::to_string(dimensions)); - - char data[4]; - - GL::Texture2D texture; - texture - .setMinificationFilter(SamplerFilter::Linear, SamplerMipmap::Linear) - .setMagnificationFilter(SamplerFilter::Linear) - .setWrapping(SamplerWrapping::ClampToEdge) - .setImage(0, GL::TextureFormat::RGBA, ImageView2D{PixelFormat::RGBA8Unorm, {1, 1}, data}); - - MAGNUM_VERIFY_NO_GL_ERROR(); - - /* Test just that no assertion is fired */ - Flat shader{Flat::Flag::Textured}; - shader.bindTexture(texture); - - MAGNUM_VERIFY_NO_GL_ERROR(); -} - template void FlatGLTest::bindTextureNotEnabled() { setTestCaseTemplateName(std::to_string(dimensions)); @@ -257,16 +227,6 @@ template void FlatGLTest::bindTextureNotEnabled() { CORRADE_COMPARE(out.str(), "Shaders::Flat::bindTexture(): the shader was not created with texturing enabled\n"); } -template void FlatGLTest::setAlphaMask() { - setTestCaseTemplateName(std::to_string(dimensions)); - - /* Test just that no assertion is fired */ - Flat shader{Flat::Flag::AlphaMask}; - shader.setAlphaMask(0.25f); - - MAGNUM_VERIFY_NO_GL_ERROR(); -} - template void FlatGLTest::setAlphaMaskNotEnabled() { setTestCaseTemplateName(std::to_string(dimensions)); diff --git a/src/Magnum/Shaders/Test/PhongGLTest.cpp b/src/Magnum/Shaders/Test/PhongGLTest.cpp index b692f5c8b..95e0791a8 100644 --- a/src/Magnum/Shaders/Test/PhongGLTest.cpp +++ b/src/Magnum/Shaders/Test/PhongGLTest.cpp @@ -63,12 +63,8 @@ struct PhongGLTest: GL::OpenGLTester { void constructMove(); - void bindTextures(); void bindTexturesNotEnabled(); - - void setAlphaMask(); void setAlphaMaskNotEnabled(); - void setWrongLightCount(); void setWrongLightId(); @@ -239,12 +235,8 @@ PhongGLTest::PhongGLTest() { addTests({&PhongGLTest::constructMove, - &PhongGLTest::bindTextures, &PhongGLTest::bindTexturesNotEnabled, - - &PhongGLTest::setAlphaMask, &PhongGLTest::setAlphaMaskNotEnabled, - &PhongGLTest::setWrongLightCount, &PhongGLTest::setWrongLightId}); @@ -329,29 +321,6 @@ void PhongGLTest::constructMove() { CORRADE_VERIFY(!b.id()); } -void PhongGLTest::bindTextures() { - char data[4]; - - GL::Texture2D texture; - texture - .setMinificationFilter(SamplerFilter::Linear, SamplerMipmap::Linear) - .setMagnificationFilter(SamplerFilter::Linear) - .setWrapping(SamplerWrapping::ClampToEdge) - .setImage(0, GL::TextureFormat::RGBA, ImageView2D{PixelFormat::RGBA8Unorm, {1, 1}, data}); - - MAGNUM_VERIFY_NO_GL_ERROR(); - - /* Test just that no assertion is fired */ - Phong shader{Phong::Flag::AmbientTexture|Phong::Flag::DiffuseTexture|Phong::Flag::SpecularTexture|Phong::Flag::NormalTexture}; - shader.bindAmbientTexture(texture) - .bindDiffuseTexture(texture) - .bindSpecularTexture(texture) - .bindNormalTexture(texture) - .bindTextures(&texture, &texture, &texture, &texture); - - MAGNUM_VERIFY_NO_GL_ERROR(); -} - void PhongGLTest::bindTexturesNotEnabled() { std::ostringstream out; Error redirectError{&out}; @@ -372,14 +341,6 @@ void PhongGLTest::bindTexturesNotEnabled() { "Shaders::Phong::bindTextures(): the shader was not created with any textures enabled\n"); } -void PhongGLTest::setAlphaMask() { - /* Test just that no assertion is fired */ - Phong shader{Phong::Flag::AlphaMask}; - shader.setAlphaMask(0.25f); - - MAGNUM_VERIFY_NO_GL_ERROR(); -} - void PhongGLTest::setAlphaMaskNotEnabled() { std::ostringstream out; Error redirectError{&out};