Browse Source

Shaders: simplified [DistanceField]Vector and VertexColor shader tests.

findsdl-include-root
Vladimír Vondruš 7 years ago
parent
commit
2d1d9f4b29
  1. 59
      src/Magnum/Shaders/Test/DistanceFieldVectorGLTest.cpp
  2. 59
      src/Magnum/Shaders/Test/VectorGLTest.cpp
  3. 59
      src/Magnum/Shaders/Test/VertexColorGLTest.cpp

59
src/Magnum/Shaders/Test/DistanceFieldVectorGLTest.cpp

@ -31,36 +31,22 @@ namespace Magnum { namespace Shaders { namespace Test { namespace {
struct DistanceFieldVectorGLTest: GL::OpenGLTester {
explicit DistanceFieldVectorGLTest();
void construct2D();
void construct3D();
void constructMove2D();
void constructMove3D();
template<UnsignedInt dimensions> void construct();
template<UnsignedInt dimensions> void constructMove();
};
DistanceFieldVectorGLTest::DistanceFieldVectorGLTest() {
addTests({&DistanceFieldVectorGLTest::construct2D,
&DistanceFieldVectorGLTest::construct3D,
&DistanceFieldVectorGLTest::constructMove2D,
&DistanceFieldVectorGLTest::constructMove3D});
addTests<DistanceFieldVectorGLTest>({
&DistanceFieldVectorGLTest::construct<2>,
&DistanceFieldVectorGLTest::construct<3>,
&DistanceFieldVectorGLTest::constructMove<2>,
&DistanceFieldVectorGLTest::constructMove<3>});
}
void DistanceFieldVectorGLTest::construct2D() {
DistanceFieldVector2D shader;
CORRADE_VERIFY(shader.id());
{
#ifdef CORRADE_TARGET_APPLE
CORRADE_EXPECT_FAIL("macOS drivers need insane amount of state to validate properly.");
#endif
CORRADE_VERIFY(shader.validate().first);
}
MAGNUM_VERIFY_NO_GL_ERROR();
}
template<UnsignedInt dimensions> void DistanceFieldVectorGLTest::construct() {
setTestCaseTemplateName(std::to_string(dimensions));
void DistanceFieldVectorGLTest::construct3D() {
DistanceFieldVector3D shader;
DistanceFieldVector<dimensions> shader;
CORRADE_VERIFY(shader.id());
{
#ifdef CORRADE_TARGET_APPLE
@ -72,35 +58,20 @@ void DistanceFieldVectorGLTest::construct3D() {
MAGNUM_VERIFY_NO_GL_ERROR();
}
void DistanceFieldVectorGLTest::constructMove2D() {
DistanceFieldVector2D a;
const GLuint id = a.id();
CORRADE_VERIFY(id);
MAGNUM_VERIFY_NO_GL_ERROR();
DistanceFieldVector2D b{std::move(a)};
CORRADE_COMPARE(b.id(), id);
CORRADE_VERIFY(!a.id());
DistanceFieldVector2D c{NoCreate};
c = std::move(b);
CORRADE_COMPARE(c.id(), id);
CORRADE_VERIFY(!b.id());
}
template<UnsignedInt dimensions> void DistanceFieldVectorGLTest::constructMove() {
setTestCaseTemplateName(std::to_string(dimensions));
void DistanceFieldVectorGLTest::constructMove3D() {
DistanceFieldVector3D a;
DistanceFieldVector<dimensions> a;
const GLuint id = a.id();
CORRADE_VERIFY(id);
MAGNUM_VERIFY_NO_GL_ERROR();
DistanceFieldVector3D b{std::move(a)};
DistanceFieldVector<dimensions> b{std::move(a)};
CORRADE_COMPARE(b.id(), id);
CORRADE_VERIFY(!a.id());
DistanceFieldVector3D c{NoCreate};
DistanceFieldVector<dimensions> c{NoCreate};
c = std::move(b);
CORRADE_COMPARE(c.id(), id);
CORRADE_VERIFY(!b.id());

59
src/Magnum/Shaders/Test/VectorGLTest.cpp

@ -31,36 +31,22 @@ namespace Magnum { namespace Shaders { namespace Test { namespace {
struct VectorGLTest: GL::OpenGLTester {
explicit VectorGLTest();
void construct2D();
void construct3D();
void constructMove2D();
void constructMove3D();
template<UnsignedInt dimensions> void construct();
template<UnsignedInt dimensions> void constructMove();
};
VectorGLTest::VectorGLTest() {
addTests({&VectorGLTest::construct2D,
&VectorGLTest::construct3D,
&VectorGLTest::constructMove2D,
&VectorGLTest::constructMove3D});
addTests<VectorGLTest>({
&VectorGLTest::construct<2>,
&VectorGLTest::construct<3>,
&VectorGLTest::constructMove<2>,
&VectorGLTest::constructMove<3>});
}
void VectorGLTest::construct2D() {
Vector2D shader;
CORRADE_VERIFY(shader.id());
{
#ifdef CORRADE_TARGET_APPLE
CORRADE_EXPECT_FAIL("macOS drivers need insane amount of state to validate properly.");
#endif
CORRADE_VERIFY(shader.validate().first);
}
MAGNUM_VERIFY_NO_GL_ERROR();
}
template<UnsignedInt dimensions> void VectorGLTest::construct() {
setTestCaseTemplateName(std::to_string(dimensions));
void VectorGLTest::construct3D() {
Vector3D shader;
Vector<dimensions> shader;
CORRADE_VERIFY(shader.id());
{
#ifdef CORRADE_TARGET_APPLE
@ -72,35 +58,20 @@ void VectorGLTest::construct3D() {
MAGNUM_VERIFY_NO_GL_ERROR();
}
void VectorGLTest::constructMove2D() {
Vector2D a;
const GLuint id = a.id();
CORRADE_VERIFY(id);
MAGNUM_VERIFY_NO_GL_ERROR();
Vector2D b{std::move(a)};
CORRADE_COMPARE(b.id(), id);
CORRADE_VERIFY(!a.id());
Vector2D c{NoCreate};
c = std::move(b);
CORRADE_COMPARE(c.id(), id);
CORRADE_VERIFY(!b.id());
}
template<UnsignedInt dimensions> void VectorGLTest::constructMove() {
setTestCaseTemplateName(std::to_string(dimensions));
void VectorGLTest::constructMove3D() {
Vector3D a;
Vector<dimensions> a;
const GLuint id = a.id();
CORRADE_VERIFY(id);
MAGNUM_VERIFY_NO_GL_ERROR();
Vector3D b{std::move(a)};
Vector<dimensions> b{std::move(a)};
CORRADE_COMPARE(b.id(), id);
CORRADE_VERIFY(!a.id());
Vector3D c{NoCreate};
Vector<dimensions> c{NoCreate};
c = std::move(b);
CORRADE_COMPARE(c.id(), id);
CORRADE_VERIFY(!b.id());

59
src/Magnum/Shaders/Test/VertexColorGLTest.cpp

@ -31,36 +31,22 @@ namespace Magnum { namespace Shaders { namespace Test { namespace {
struct VertexColorGLTest: GL::OpenGLTester {
explicit VertexColorGLTest();
void construct2D();
void construct3D();
void constructMove2D();
void constructMove3D();
template<UnsignedInt dimensions> void construct();
template<UnsignedInt dimensions> void constructMove();
};
VertexColorGLTest::VertexColorGLTest() {
addTests({&VertexColorGLTest::construct2D,
&VertexColorGLTest::construct3D,
&VertexColorGLTest::constructMove2D,
&VertexColorGLTest::constructMove3D});
addTests<VertexColorGLTest>({
&VertexColorGLTest::construct<2>,
&VertexColorGLTest::construct<3>,
&VertexColorGLTest::constructMove<2>,
&VertexColorGLTest::constructMove<3>});
}
void VertexColorGLTest::construct2D() {
VertexColor2D shader;
CORRADE_VERIFY(shader.id());
{
#ifdef CORRADE_TARGET_APPLE
CORRADE_EXPECT_FAIL("macOS drivers need insane amount of state to validate properly.");
#endif
CORRADE_VERIFY(shader.validate().first);
}
MAGNUM_VERIFY_NO_GL_ERROR();
}
template<UnsignedInt dimensions> void VertexColorGLTest::construct() {
setTestCaseTemplateName(std::to_string(dimensions));
void VertexColorGLTest::construct3D() {
VertexColor3D shader;
VertexColor<dimensions> shader;
CORRADE_VERIFY(shader.id());
{
#ifdef CORRADE_TARGET_APPLE
@ -72,35 +58,20 @@ void VertexColorGLTest::construct3D() {
MAGNUM_VERIFY_NO_GL_ERROR();
}
void VertexColorGLTest::constructMove2D() {
VertexColor2D a;
const GLuint id = a.id();
CORRADE_VERIFY(id);
MAGNUM_VERIFY_NO_GL_ERROR();
VertexColor2D b{std::move(a)};
CORRADE_COMPARE(b.id(), id);
CORRADE_VERIFY(!a.id());
VertexColor2D c{NoCreate};
c = std::move(b);
CORRADE_COMPARE(c.id(), id);
CORRADE_VERIFY(!b.id());
}
template<UnsignedInt dimensions> void VertexColorGLTest::constructMove() {
setTestCaseTemplateName(std::to_string(dimensions));
void VertexColorGLTest::constructMove3D() {
VertexColor3D a;
VertexColor<dimensions> a;
const GLuint id = a.id();
CORRADE_VERIFY(id);
MAGNUM_VERIFY_NO_GL_ERROR();
VertexColor3D b{std::move(a)};
VertexColor<dimensions> b{std::move(a)};
CORRADE_COMPARE(b.id(), id);
CORRADE_VERIFY(!a.id());
VertexColor3D c{NoCreate};
VertexColor<dimensions> c{NoCreate};
c = std::move(b);
CORRADE_COMPARE(c.id(), id);
CORRADE_VERIFY(!b.id());

Loading…
Cancel
Save