Browse Source

Shaders: simplify the Phong construction test a bit.

Ugh.
pull/268/head
Vladimír Vondruš 8 years ago
parent
commit
bbebfa971f
  1. 113
      src/Magnum/Shaders/Test/PhongGLTest.cpp

113
src/Magnum/Shaders/Test/PhongGLTest.cpp

@ -32,109 +32,34 @@ struct PhongGLTest: GL::OpenGLTester {
explicit PhongGLTest(); explicit PhongGLTest();
void construct(); void construct();
void constructAmbientTexture();
void constructDiffuseTexture();
void constructSpecularTexture();
void constructAmbientDiffuseTexture();
void constructAmbientSpecularTexture();
void constructDiffuseSpecularTexture();
void constructAmbientDiffuseSpecularTexture();
void constructMove(); void constructMove();
}; };
PhongGLTest::PhongGLTest() { constexpr struct {
addTests({&PhongGLTest::construct, const char* name;
&PhongGLTest::constructAmbientTexture, Phong::Flags flags;
&PhongGLTest::constructDiffuseTexture, } ConstructData[]{
&PhongGLTest::constructSpecularTexture, {"", {}},
&PhongGLTest::constructAmbientDiffuseTexture, {"ambient texture", Phong::Flag::AmbientTexture},
&PhongGLTest::constructAmbientSpecularTexture, {"diffuse texture", Phong::Flag::DiffuseTexture},
&PhongGLTest::constructDiffuseSpecularTexture, {"specular texture", Phong::Flag::SpecularTexture},
&PhongGLTest::constructAmbientDiffuseSpecularTexture, {"ambient + diffuse texture", Phong::Flag::AmbientTexture|Phong::Flag::DiffuseTexture},
{"ambient + specular texture", Phong::Flag::AmbientTexture|Phong::Flag::SpecularTexture},
&PhongGLTest::constructMove}); {"diffuse + specular texture", Phong::Flag::DiffuseTexture|Phong::Flag::SpecularTexture},
} {"ambient + diffuse + specular texture", Phong::Flag::AmbientTexture|Phong::Flag::DiffuseTexture|Phong::Flag::SpecularTexture}};
void PhongGLTest::construct() {
Phong shader;
{
#ifdef CORRADE_TARGET_APPLE
CORRADE_EXPECT_FAIL("macOS drivers need insane amount of state to validate properly.");
#endif
CORRADE_VERIFY(shader.id());
CORRADE_VERIFY(shader.validate().first);
}
}
void PhongGLTest::constructAmbientTexture() {
Phong shader(Phong::Flag::AmbientTexture);
{
#ifdef CORRADE_TARGET_APPLE
CORRADE_EXPECT_FAIL("macOS drivers need insane amount of state to validate properly.");
#endif
CORRADE_VERIFY(shader.id());
CORRADE_VERIFY(shader.validate().first);
}
}
void PhongGLTest::constructDiffuseTexture() {
Phong shader(Phong::Flag::DiffuseTexture);
{
#ifdef CORRADE_TARGET_APPLE
CORRADE_EXPECT_FAIL("macOS drivers need insane amount of state to validate properly.");
#endif
CORRADE_VERIFY(shader.id());
CORRADE_VERIFY(shader.validate().first);
}
}
void PhongGLTest::constructSpecularTexture() {
Phong shader(Phong::Flag::SpecularTexture);
{
#ifdef CORRADE_TARGET_APPLE
CORRADE_EXPECT_FAIL("macOS drivers need insane amount of state to validate properly.");
#endif
CORRADE_VERIFY(shader.id());
CORRADE_VERIFY(shader.validate().first);
}
}
void PhongGLTest::constructAmbientDiffuseTexture() { PhongGLTest::PhongGLTest() {
Phong shader(Phong::Flag::AmbientTexture|Phong::Flag::DiffuseTexture); addInstancedTests({&PhongGLTest::construct}, Containers::arraySize(ConstructData));
{
#ifdef CORRADE_TARGET_APPLE
CORRADE_EXPECT_FAIL("macOS drivers need insane amount of state to validate properly.");
#endif
CORRADE_VERIFY(shader.id());
CORRADE_VERIFY(shader.validate().first);
}
}
void PhongGLTest::constructAmbientSpecularTexture() { addTests({&PhongGLTest::constructMove});
Phong shader(Phong::Flag::AmbientTexture|Phong::Flag::SpecularTexture);
{
#ifdef CORRADE_TARGET_APPLE
CORRADE_EXPECT_FAIL("macOS drivers need insane amount of state to validate properly.");
#endif
CORRADE_VERIFY(shader.id());
CORRADE_VERIFY(shader.validate().first);
}
} }
void PhongGLTest::constructDiffuseSpecularTexture() { void PhongGLTest::construct() {
Phong shader(Phong::Flag::DiffuseTexture|Phong::Flag::SpecularTexture); auto&& data = ConstructData[testCaseInstanceId()];
{ setTestCaseDescription(data.name);
#ifdef CORRADE_TARGET_APPLE
CORRADE_EXPECT_FAIL("macOS drivers need insane amount of state to validate properly.");
#endif
CORRADE_VERIFY(shader.id());
CORRADE_VERIFY(shader.validate().first);
}
}
void PhongGLTest::constructAmbientDiffuseSpecularTexture() { Phong shader{data.flags};
Phong shader(Phong::Flag::AmbientTexture|Phong::Flag::DiffuseTexture|Phong::Flag::SpecularTexture);
{ {
#ifdef CORRADE_TARGET_APPLE #ifdef CORRADE_TARGET_APPLE
CORRADE_EXPECT_FAIL("macOS drivers need insane amount of state to validate properly."); CORRADE_EXPECT_FAIL("macOS drivers need insane amount of state to validate properly.");

Loading…
Cancel
Save