diff --git a/src/Magnum/Shaders/Test/DistanceFieldVectorGLTest.cpp b/src/Magnum/Shaders/Test/DistanceFieldVectorGLTest.cpp index 38110a5ef..5e7af93f8 100644 --- a/src/Magnum/Shaders/Test/DistanceFieldVectorGLTest.cpp +++ b/src/Magnum/Shaders/Test/DistanceFieldVectorGLTest.cpp @@ -31,35 +31,77 @@ namespace Magnum { namespace Shaders { namespace Test { struct DistanceFieldVectorGLTest: GL::OpenGLTester { explicit DistanceFieldVectorGLTest(); - void compile2D(); - void compile3D(); + void construct2D(); + void construct3D(); + + void constructMove2D(); + void constructMove3D(); }; DistanceFieldVectorGLTest::DistanceFieldVectorGLTest() { - addTests({&DistanceFieldVectorGLTest::compile2D, - &DistanceFieldVectorGLTest::compile3D}); + addTests({&DistanceFieldVectorGLTest::construct2D, + &DistanceFieldVectorGLTest::construct3D, + + &DistanceFieldVectorGLTest::constructMove2D, + &DistanceFieldVectorGLTest::constructMove3D}); } -void DistanceFieldVectorGLTest::compile2D() { - Shaders::DistanceFieldVector2D shader; +void DistanceFieldVectorGLTest::construct2D() { + DistanceFieldVector2D 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 DistanceFieldVectorGLTest::compile3D() { - Shaders::DistanceFieldVector3D shader; +void DistanceFieldVectorGLTest::construct3D() { + DistanceFieldVector3D 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 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()); +} + +void DistanceFieldVectorGLTest::constructMove3D() { + DistanceFieldVector3D a; + const GLuint id = a.id(); + CORRADE_VERIFY(id); + + MAGNUM_VERIFY_NO_GL_ERROR(); + + DistanceFieldVector3D b{std::move(a)}; + CORRADE_COMPARE(b.id(), id); + CORRADE_VERIFY(!a.id()); + + DistanceFieldVector3D c{NoCreate}; + c = std::move(b); + CORRADE_COMPARE(c.id(), id); + CORRADE_VERIFY(!b.id()); +} + }}} CORRADE_TEST_MAIN(Magnum::Shaders::Test::DistanceFieldVectorGLTest) diff --git a/src/Magnum/Shaders/Test/DistanceFieldVectorTest.cpp b/src/Magnum/Shaders/Test/DistanceFieldVectorTest.cpp index 7f773a9e0..d1b16ded2 100644 --- a/src/Magnum/Shaders/Test/DistanceFieldVectorTest.cpp +++ b/src/Magnum/Shaders/Test/DistanceFieldVectorTest.cpp @@ -34,16 +34,22 @@ struct DistanceFieldVectorTest: TestSuite::Tester { void constructNoCreate2D(); void constructNoCreate3D(); + + void constructCopy2D(); + void constructCopy3D(); }; DistanceFieldVectorTest::DistanceFieldVectorTest() { addTests({&DistanceFieldVectorTest::constructNoCreate2D, - &DistanceFieldVectorTest::constructNoCreate3D}); + &DistanceFieldVectorTest::constructNoCreate3D, + + &DistanceFieldVectorTest::constructCopy2D, + &DistanceFieldVectorTest::constructCopy3D}); } void DistanceFieldVectorTest::constructNoCreate2D() { { - Shaders::DistanceFieldVector2D shader{NoCreate}; + DistanceFieldVector2D shader{NoCreate}; CORRADE_COMPARE(shader.id(), 0); } @@ -52,13 +58,23 @@ void DistanceFieldVectorTest::constructNoCreate2D() { void DistanceFieldVectorTest::constructNoCreate3D() { { - Shaders::DistanceFieldVector3D shader{NoCreate}; + DistanceFieldVector3D shader{NoCreate}; CORRADE_COMPARE(shader.id(), 0); } CORRADE_VERIFY(true); } +void DistanceFieldVectorTest::constructCopy2D() { + CORRADE_VERIFY(!(std::is_constructible{})); + CORRADE_VERIFY(!(std::is_assignable{})); +} + +void DistanceFieldVectorTest::constructCopy3D() { + CORRADE_VERIFY(!(std::is_constructible{})); + CORRADE_VERIFY(!(std::is_assignable{})); +} + }}} CORRADE_TEST_MAIN(Magnum::Shaders::Test::DistanceFieldVectorTest) diff --git a/src/Magnum/Shaders/Test/FlatGLTest.cpp b/src/Magnum/Shaders/Test/FlatGLTest.cpp index 65799b524..9de76d38b 100644 --- a/src/Magnum/Shaders/Test/FlatGLTest.cpp +++ b/src/Magnum/Shaders/Test/FlatGLTest.cpp @@ -31,59 +31,103 @@ namespace Magnum { namespace Shaders { namespace Test { struct FlatGLTest: GL::OpenGLTester { explicit FlatGLTest(); - void compile2D(); - void compile3D(); - void compile2DTextured(); - void compile3DTextured(); + void construct2D(); + void construct3D(); + void construct2DTextured(); + void construct3DTextured(); + + void constructMove2D(); + void constructMove3D(); }; FlatGLTest::FlatGLTest() { - addTests({&FlatGLTest::compile2D, - &FlatGLTest::compile3D, - &FlatGLTest::compile2DTextured, - &FlatGLTest::compile3DTextured}); + addTests({&FlatGLTest::construct2D, + &FlatGLTest::construct3D, + &FlatGLTest::construct2DTextured, + &FlatGLTest::construct3DTextured, + + &FlatGLTest::constructMove2D, + &FlatGLTest::constructMove3D}); } -void FlatGLTest::compile2D() { - Shaders::Flat2D shader; +void FlatGLTest::construct2D() { + Flat2D 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 FlatGLTest::compile3D() { - Shaders::Flat3D shader; +void FlatGLTest::construct3D() { + Flat3D 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 FlatGLTest::compile2DTextured() { - Shaders::Flat2D shader(Shaders::Flat2D::Flag::Textured); +void FlatGLTest::construct2DTextured() { + Flat2D shader(Flat2D::Flag::Textured); { #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 FlatGLTest::compile3DTextured() { - Shaders::Flat3D shader(Shaders::Flat3D::Flag::Textured); +void FlatGLTest::construct3DTextured() { + Flat3D shader(Flat3D::Flag::Textured); { #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 FlatGLTest::constructMove2D() { + Flat2D a; + const GLuint id = a.id(); + CORRADE_VERIFY(id); + + MAGNUM_VERIFY_NO_GL_ERROR(); + + Flat2D b{std::move(a)}; + CORRADE_COMPARE(b.id(), id); + CORRADE_VERIFY(!a.id()); + + Flat2D c{NoCreate}; + c = std::move(b); + CORRADE_COMPARE(c.id(), id); + CORRADE_VERIFY(!b.id()); +} + +void FlatGLTest::constructMove3D() { + Flat3D a; + const GLuint id = a.id(); + CORRADE_VERIFY(id); + + MAGNUM_VERIFY_NO_GL_ERROR(); + + Flat3D b{std::move(a)}; + CORRADE_COMPARE(b.id(), id); + CORRADE_VERIFY(!a.id()); + + Flat3D c{NoCreate}; + c = std::move(b); + CORRADE_COMPARE(c.id(), id); + CORRADE_VERIFY(!b.id()); +} + }}} CORRADE_TEST_MAIN(Magnum::Shaders::Test::FlatGLTest) diff --git a/src/Magnum/Shaders/Test/FlatTest.cpp b/src/Magnum/Shaders/Test/FlatTest.cpp index 2accdd08f..e7fc6590d 100644 --- a/src/Magnum/Shaders/Test/FlatTest.cpp +++ b/src/Magnum/Shaders/Test/FlatTest.cpp @@ -34,16 +34,22 @@ struct FlatTest: TestSuite::Tester { void constructNoCreate2D(); void constructNoCreate3D(); + + void constructCopy2D(); + void constructCopy3D(); }; FlatTest::FlatTest() { addTests({&FlatTest::constructNoCreate2D, - &FlatTest::constructNoCreate3D}); + &FlatTest::constructNoCreate3D, + + &FlatTest::constructCopy2D, + &FlatTest::constructCopy3D}); } void FlatTest::constructNoCreate2D() { { - Shaders::Flat2D shader{NoCreate}; + Flat2D shader{NoCreate}; CORRADE_COMPARE(shader.id(), 0); } @@ -52,13 +58,23 @@ void FlatTest::constructNoCreate2D() { void FlatTest::constructNoCreate3D() { { - Shaders::Flat3D shader{NoCreate}; + Flat3D shader{NoCreate}; CORRADE_COMPARE(shader.id(), 0); } CORRADE_VERIFY(true); } +void FlatTest::constructCopy2D() { + CORRADE_VERIFY(!(std::is_constructible{})); + CORRADE_VERIFY(!(std::is_assignable{})); +} + +void FlatTest::constructCopy3D() { + CORRADE_VERIFY(!(std::is_constructible{})); + CORRADE_VERIFY(!(std::is_assignable{})); +} + }}} CORRADE_TEST_MAIN(Magnum::Shaders::Test::FlatTest) diff --git a/src/Magnum/Shaders/Test/MeshVisualizerGLTest.cpp b/src/Magnum/Shaders/Test/MeshVisualizerGLTest.cpp index caced480e..09ea6eb51 100644 --- a/src/Magnum/Shaders/Test/MeshVisualizerGLTest.cpp +++ b/src/Magnum/Shaders/Test/MeshVisualizerGLTest.cpp @@ -33,33 +33,38 @@ namespace Magnum { namespace Shaders { namespace Test { struct MeshVisualizerGLTest: GL::OpenGLTester { explicit MeshVisualizerGLTest(); - void compile(); + void construct(); #if !defined(MAGNUM_TARGET_GLES2) && !defined(MAGNUM_TARGET_WEBGL) - void compileWireframeGeometryShader(); + void constructWireframeGeometryShader(); #endif - void compileWireframeNoGeometryShader(); + void constructWireframeNoGeometryShader(); + + void constructMove(); }; MeshVisualizerGLTest::MeshVisualizerGLTest() { - addTests({&MeshVisualizerGLTest::compile, + addTests({&MeshVisualizerGLTest::construct, #if !defined(MAGNUM_TARGET_GLES2) && !defined(MAGNUM_TARGET_WEBGL) - &MeshVisualizerGLTest::compileWireframeGeometryShader, + &MeshVisualizerGLTest::constructWireframeGeometryShader, #endif - &MeshVisualizerGLTest::compileWireframeNoGeometryShader}); + &MeshVisualizerGLTest::constructWireframeNoGeometryShader, + + &MeshVisualizerGLTest::constructMove}); } -void MeshVisualizerGLTest::compile() { - Shaders::MeshVisualizer shader; +void MeshVisualizerGLTest::construct() { + MeshVisualizer 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); } } #if !defined(MAGNUM_TARGET_GLES2) && !defined(MAGNUM_TARGET_WEBGL) -void MeshVisualizerGLTest::compileWireframeGeometryShader() { +void MeshVisualizerGLTest::constructWireframeGeometryShader() { #ifndef MAGNUM_TARGET_GLES if(!GL::Context::current().isExtensionSupported()) CORRADE_SKIP(GL::Extensions::ARB::geometry_shader4::string() + std::string(" is not supported")); @@ -73,26 +78,45 @@ void MeshVisualizerGLTest::compileWireframeGeometryShader() { Debug() << "Using" << GL::Extensions::NV::shader_noperspective_interpolation::string(); #endif - Shaders::MeshVisualizer shader(Shaders::MeshVisualizer::Flag::Wireframe); + MeshVisualizer shader(MeshVisualizer::Flag::Wireframe); { #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); } } #endif -void MeshVisualizerGLTest::compileWireframeNoGeometryShader() { - Shaders::MeshVisualizer shader(Shaders::MeshVisualizer::Flag::Wireframe|Shaders::MeshVisualizer::Flag::NoGeometryShader); +void MeshVisualizerGLTest::constructWireframeNoGeometryShader() { + MeshVisualizer shader(MeshVisualizer::Flag::Wireframe|MeshVisualizer::Flag::NoGeometryShader); { #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 MeshVisualizerGLTest::constructMove() { + MeshVisualizer a; + const GLuint id = a.id(); + CORRADE_VERIFY(id); + + MAGNUM_VERIFY_NO_GL_ERROR(); + + MeshVisualizer b{std::move(a)}; + CORRADE_COMPARE(b.id(), id); + CORRADE_VERIFY(!a.id()); + + MeshVisualizer c{NoCreate}; + c = std::move(b); + CORRADE_COMPARE(c.id(), id); + CORRADE_VERIFY(!b.id()); +} + }}} CORRADE_TEST_MAIN(Magnum::Shaders::Test::MeshVisualizerGLTest) diff --git a/src/Magnum/Shaders/Test/MeshVisualizerTest.cpp b/src/Magnum/Shaders/Test/MeshVisualizerTest.cpp index a0b987328..c71da64ca 100644 --- a/src/Magnum/Shaders/Test/MeshVisualizerTest.cpp +++ b/src/Magnum/Shaders/Test/MeshVisualizerTest.cpp @@ -33,21 +33,28 @@ struct MeshVisualizerTest: TestSuite::Tester { explicit MeshVisualizerTest(); void constructNoCreate(); + void constructCopy(); }; MeshVisualizerTest::MeshVisualizerTest() { - addTests({&MeshVisualizerTest::constructNoCreate}); + addTests({&MeshVisualizerTest::constructNoCreate, + &MeshVisualizerTest::constructCopy}); } void MeshVisualizerTest::constructNoCreate() { { - Shaders::MeshVisualizer shader{NoCreate}; + MeshVisualizer shader{NoCreate}; CORRADE_COMPARE(shader.id(), 0); } CORRADE_VERIFY(true); } +void MeshVisualizerTest::constructCopy() { + CORRADE_VERIFY(!(std::is_constructible{})); + CORRADE_VERIFY(!(std::is_assignable{})); +} + }}} CORRADE_TEST_MAIN(Magnum::Shaders::Test::MeshVisualizerTest) diff --git a/src/Magnum/Shaders/Test/PhongGLTest.cpp b/src/Magnum/Shaders/Test/PhongGLTest.cpp index 7836c95a1..52a85519c 100644 --- a/src/Magnum/Shaders/Test/PhongGLTest.cpp +++ b/src/Magnum/Shaders/Test/PhongGLTest.cpp @@ -31,107 +31,136 @@ namespace Magnum { namespace Shaders { namespace Test { struct PhongGLTest: GL::OpenGLTester { explicit PhongGLTest(); - void compile(); - void compileAmbientTexture(); - void compileDiffuseTexture(); - void compileSpecularTexture(); - void compileAmbientDiffuseTexture(); - void compileAmbientSpecularTexture(); - void compileDiffuseSpecularTexture(); - void compileAmbientDiffuseSpecularTexture(); + void construct(); + void constructAmbientTexture(); + void constructDiffuseTexture(); + void constructSpecularTexture(); + void constructAmbientDiffuseTexture(); + void constructAmbientSpecularTexture(); + void constructDiffuseSpecularTexture(); + void constructAmbientDiffuseSpecularTexture(); + + void constructMove(); }; PhongGLTest::PhongGLTest() { - addTests({&PhongGLTest::compile, - &PhongGLTest::compileAmbientTexture, - &PhongGLTest::compileDiffuseTexture, - &PhongGLTest::compileSpecularTexture, - &PhongGLTest::compileAmbientDiffuseTexture, - &PhongGLTest::compileAmbientSpecularTexture, - &PhongGLTest::compileDiffuseSpecularTexture, - &PhongGLTest::compileAmbientDiffuseSpecularTexture}); + addTests({&PhongGLTest::construct, + &PhongGLTest::constructAmbientTexture, + &PhongGLTest::constructDiffuseTexture, + &PhongGLTest::constructSpecularTexture, + &PhongGLTest::constructAmbientDiffuseTexture, + &PhongGLTest::constructAmbientSpecularTexture, + &PhongGLTest::constructDiffuseSpecularTexture, + &PhongGLTest::constructAmbientDiffuseSpecularTexture, + + &PhongGLTest::constructMove}); } -void PhongGLTest::compile() { - Shaders::Phong shader; +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::compileAmbientTexture() { - Shaders::Phong shader(Shaders::Phong::Flag::AmbientTexture); +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::compileDiffuseTexture() { - Shaders::Phong shader(Shaders::Phong::Flag::DiffuseTexture); +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::compileSpecularTexture() { - Shaders::Phong shader(Shaders::Phong::Flag::SpecularTexture); +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::compileAmbientDiffuseTexture() { - Shaders::Phong shader(Shaders::Phong::Flag::AmbientTexture|Shaders::Phong::Flag::DiffuseTexture); +void PhongGLTest::constructAmbientDiffuseTexture() { + Phong shader(Phong::Flag::AmbientTexture|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::compileAmbientSpecularTexture() { - Shaders::Phong shader(Shaders::Phong::Flag::AmbientTexture|Shaders::Phong::Flag::SpecularTexture); +void PhongGLTest::constructAmbientSpecularTexture() { + 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::compileDiffuseSpecularTexture() { - Shaders::Phong shader(Shaders::Phong::Flag::DiffuseTexture|Shaders::Phong::Flag::SpecularTexture); +void PhongGLTest::constructDiffuseSpecularTexture() { + Phong shader(Phong::Flag::DiffuseTexture|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::compileAmbientDiffuseSpecularTexture() { - Shaders::Phong shader(Shaders::Phong::Flag::AmbientTexture|Shaders::Phong::Flag::DiffuseTexture|Shaders::Phong::Flag::SpecularTexture); +void PhongGLTest::constructAmbientDiffuseSpecularTexture() { + Phong shader(Phong::Flag::AmbientTexture|Phong::Flag::DiffuseTexture|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::constructMove() { + Phong a; + const GLuint id = a.id(); + CORRADE_VERIFY(id); + + MAGNUM_VERIFY_NO_GL_ERROR(); + + Phong b{std::move(a)}; + CORRADE_COMPARE(b.id(), id); + CORRADE_VERIFY(!a.id()); + + Phong c{NoCreate}; + c = std::move(b); + CORRADE_COMPARE(c.id(), id); + CORRADE_VERIFY(!b.id()); +} + }}} CORRADE_TEST_MAIN(Magnum::Shaders::Test::PhongGLTest) diff --git a/src/Magnum/Shaders/Test/PhongTest.cpp b/src/Magnum/Shaders/Test/PhongTest.cpp index f493749e3..af0341ae0 100644 --- a/src/Magnum/Shaders/Test/PhongTest.cpp +++ b/src/Magnum/Shaders/Test/PhongTest.cpp @@ -33,21 +33,28 @@ struct PhongTest: TestSuite::Tester { explicit PhongTest(); void constructNoCreate(); + void constructCopy(); }; PhongTest::PhongTest() { - addTests({&PhongTest::constructNoCreate}); + addTests({&PhongTest::constructNoCreate, + &PhongTest::constructCopy}); } void PhongTest::constructNoCreate() { { - Shaders::Phong shader{NoCreate}; + Phong shader{NoCreate}; CORRADE_COMPARE(shader.id(), 0); } CORRADE_VERIFY(true); } +void PhongTest::constructCopy() { + CORRADE_VERIFY(!(std::is_constructible{})); + CORRADE_VERIFY(!(std::is_assignable{})); +} + }}} CORRADE_TEST_MAIN(Magnum::Shaders::Test::PhongTest) diff --git a/src/Magnum/Shaders/Test/VectorGLTest.cpp b/src/Magnum/Shaders/Test/VectorGLTest.cpp index 468bb0107..43c5a892c 100644 --- a/src/Magnum/Shaders/Test/VectorGLTest.cpp +++ b/src/Magnum/Shaders/Test/VectorGLTest.cpp @@ -31,35 +31,77 @@ namespace Magnum { namespace Shaders { namespace Test { struct VectorGLTest: GL::OpenGLTester { explicit VectorGLTest(); - void compile2D(); - void compile3D(); + void construct2D(); + void construct3D(); + + void constructMove2D(); + void constructMove3D(); }; VectorGLTest::VectorGLTest() { - addTests({&VectorGLTest::compile2D, - &VectorGLTest::compile3D}); + addTests({&VectorGLTest::construct2D, + &VectorGLTest::construct3D, + + &VectorGLTest::constructMove2D, + &VectorGLTest::constructMove3D}); } -void VectorGLTest::compile2D() { - Shaders::Vector2D shader; +void VectorGLTest::construct2D() { + Vector2D 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 VectorGLTest::compile3D() { - Shaders::Vector3D shader; +void VectorGLTest::construct3D() { + Vector3D 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 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()); +} + +void VectorGLTest::constructMove3D() { + Vector3D a; + const GLuint id = a.id(); + CORRADE_VERIFY(id); + + MAGNUM_VERIFY_NO_GL_ERROR(); + + Vector3D b{std::move(a)}; + CORRADE_COMPARE(b.id(), id); + CORRADE_VERIFY(!a.id()); + + Vector3D c{NoCreate}; + c = std::move(b); + CORRADE_COMPARE(c.id(), id); + CORRADE_VERIFY(!b.id()); +} + }}} CORRADE_TEST_MAIN(Magnum::Shaders::Test::VectorGLTest) diff --git a/src/Magnum/Shaders/Test/VectorTest.cpp b/src/Magnum/Shaders/Test/VectorTest.cpp index 3d75cff26..e77229e84 100644 --- a/src/Magnum/Shaders/Test/VectorTest.cpp +++ b/src/Magnum/Shaders/Test/VectorTest.cpp @@ -34,16 +34,22 @@ struct VectorTest: TestSuite::Tester { void constructNoCreate2D(); void constructNoCreate3D(); + + void constructCopy2D(); + void constructCopy3D(); }; VectorTest::VectorTest() { addTests({&VectorTest::constructNoCreate2D, - &VectorTest::constructNoCreate3D}); + &VectorTest::constructNoCreate3D, + + &VectorTest::constructCopy2D, + &VectorTest::constructCopy3D}); } void VectorTest::constructNoCreate2D() { { - Shaders::Vector2D shader{NoCreate}; + Vector2D shader{NoCreate}; CORRADE_COMPARE(shader.id(), 0); } @@ -52,13 +58,23 @@ void VectorTest::constructNoCreate2D() { void VectorTest::constructNoCreate3D() { { - Shaders::Vector3D shader{NoCreate}; + Vector3D shader{NoCreate}; CORRADE_COMPARE(shader.id(), 0); } CORRADE_VERIFY(true); } +void VectorTest::constructCopy2D() { + CORRADE_VERIFY(!(std::is_constructible{})); + CORRADE_VERIFY(!(std::is_assignable{})); +} + +void VectorTest::constructCopy3D() { + CORRADE_VERIFY(!(std::is_constructible{})); + CORRADE_VERIFY(!(std::is_assignable{})); +} + }}} CORRADE_TEST_MAIN(Magnum::Shaders::Test::VectorTest) diff --git a/src/Magnum/Shaders/Test/VertexColorGLTest.cpp b/src/Magnum/Shaders/Test/VertexColorGLTest.cpp index ef5a87585..499e42839 100644 --- a/src/Magnum/Shaders/Test/VertexColorGLTest.cpp +++ b/src/Magnum/Shaders/Test/VertexColorGLTest.cpp @@ -31,35 +31,77 @@ namespace Magnum { namespace Shaders { namespace Test { struct VertexColorGLTest: GL::OpenGLTester { explicit VertexColorGLTest(); - void compile2D(); - void compile3D(); + void construct2D(); + void construct3D(); + + void constructMove2D(); + void constructMove3D(); }; VertexColorGLTest::VertexColorGLTest() { - addTests({&VertexColorGLTest::compile2D, - &VertexColorGLTest::compile3D}); + addTests({&VertexColorGLTest::construct2D, + &VertexColorGLTest::construct3D, + + &VertexColorGLTest::constructMove2D, + &VertexColorGLTest::constructMove3D}); } -void VertexColorGLTest::compile2D() { - Shaders::VertexColor2D shader; +void VertexColorGLTest::construct2D() { + VertexColor2D 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 VertexColorGLTest::compile3D() { - Shaders::VertexColor3D shader; +void VertexColorGLTest::construct3D() { + VertexColor3D 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 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()); +} + +void VertexColorGLTest::constructMove3D() { + VertexColor3D a; + const GLuint id = a.id(); + CORRADE_VERIFY(id); + + MAGNUM_VERIFY_NO_GL_ERROR(); + + VertexColor3D b{std::move(a)}; + CORRADE_COMPARE(b.id(), id); + CORRADE_VERIFY(!a.id()); + + VertexColor3D c{NoCreate}; + c = std::move(b); + CORRADE_COMPARE(c.id(), id); + CORRADE_VERIFY(!b.id()); +} + }}} CORRADE_TEST_MAIN(Magnum::Shaders::Test::VertexColorGLTest) diff --git a/src/Magnum/Shaders/Test/VertexColorTest.cpp b/src/Magnum/Shaders/Test/VertexColorTest.cpp index 3fc47f6d2..2764a9648 100644 --- a/src/Magnum/Shaders/Test/VertexColorTest.cpp +++ b/src/Magnum/Shaders/Test/VertexColorTest.cpp @@ -34,16 +34,22 @@ struct VertexColorTest: TestSuite::Tester { void constructNoCreate2D(); void constructNoCreate3D(); + + void constructCopy2D(); + void constructCopy3D(); }; VertexColorTest::VertexColorTest() { addTests({&VertexColorTest::constructNoCreate2D, - &VertexColorTest::constructNoCreate3D}); + &VertexColorTest::constructNoCreate3D, + + &VertexColorTest::constructCopy2D, + &VertexColorTest::constructCopy3D}); } void VertexColorTest::constructNoCreate2D() { { - Shaders::VertexColor2D shader{NoCreate}; + VertexColor2D shader{NoCreate}; CORRADE_COMPARE(shader.id(), 0); } @@ -52,13 +58,23 @@ void VertexColorTest::constructNoCreate2D() { void VertexColorTest::constructNoCreate3D() { { - Shaders::VertexColor3D shader{NoCreate}; + VertexColor3D shader{NoCreate}; CORRADE_COMPARE(shader.id(), 0); } CORRADE_VERIFY(true); } +void VertexColorTest::constructCopy2D() { + CORRADE_VERIFY(!(std::is_constructible{})); + CORRADE_VERIFY(!(std::is_assignable{})); +} + +void VertexColorTest::constructCopy3D() { + CORRADE_VERIFY(!(std::is_constructible{})); + CORRADE_VERIFY(!(std::is_assignable{})); +} + }}} CORRADE_TEST_MAIN(Magnum::Shaders::Test::VertexColorTest)