Browse Source

GL: test noexcept-movability of all GL classes.

Not sure why this wasn't done for ages already, all other
(non-GL) classes have it.
pull/483/head
Vladimír Vondruš 6 years ago
parent
commit
e8f13af4be
  1. 2
      src/Magnum/GL/Test/AbstractQueryGLTest.cpp
  2. 3
      src/Magnum/GL/Test/AbstractShaderProgramGLTest.cpp
  3. 3
      src/Magnum/GL/Test/BufferGLTest.cpp
  4. 6
      src/Magnum/GL/Test/BufferImageGLTest.cpp
  5. 11
      src/Magnum/GL/Test/BufferTextureGLTest.cpp
  6. 11
      src/Magnum/GL/Test/CubeMapTextureArrayGLTest.cpp
  7. 11
      src/Magnum/GL/Test/CubeMapTextureGLTest.cpp
  8. 3
      src/Magnum/GL/Test/FramebufferGLTest.cpp
  9. 3
      src/Magnum/GL/Test/MeshGLTest.cpp
  10. 12
      src/Magnum/GL/Test/MultisampleTextureGLTest.cpp
  11. 13
      src/Magnum/GL/Test/PipelineStatisticsQueryGLTest.cpp
  12. 19
      src/Magnum/GL/Test/PrimitiveQueryGLTest.cpp
  13. 11
      src/Magnum/GL/Test/RectangleTextureGLTest.cpp
  14. 3
      src/Magnum/GL/Test/RenderbufferGLTest.cpp
  15. 13
      src/Magnum/GL/Test/SampleQueryGLTest.cpp
  16. 3
      src/Magnum/GL/Test/ShaderGLTest.cpp
  17. 13
      src/Magnum/GL/Test/TextureArrayGLTest.cpp
  18. 13
      src/Magnum/GL/Test/TextureGLTest.cpp
  19. 13
      src/Magnum/GL/Test/TimeQueryGLTest.cpp
  20. 3
      src/Magnum/GL/Test/TransformFeedbackGLTest.cpp

2
src/Magnum/GL/Test/AbstractQueryGLTest.cpp

@ -106,6 +106,8 @@ void AbstractQueryGLTest::constructMove() {
CORRADE_VERIFY(cId > 0);
CORRADE_COMPARE(b.id(), cId);
CORRADE_COMPARE(c.id(), id);
/* nothrow move constructibility tested in subclasses */
}
#ifndef MAGNUM_TARGET_WEBGL

3
src/Magnum/GL/Test/AbstractShaderProgramGLTest.cpp

@ -165,6 +165,9 @@ void AbstractShaderProgramGLTest::constructMove() {
CORRADE_VERIFY(cId > 0);
CORRADE_COMPARE(b.id(), cId);
CORRADE_COMPARE(c.id(), id);
CORRADE_VERIFY(std::is_nothrow_move_constructible<DummyShader>::value);
CORRADE_VERIFY(std::is_nothrow_move_assignable<DummyShader>::value);
}
#ifndef MAGNUM_TARGET_WEBGL

3
src/Magnum/GL/Test/BufferGLTest.cpp

@ -164,6 +164,9 @@ void BufferGLTest::constructMove() {
CORRADE_VERIFY(cId > 0);
CORRADE_COMPARE(b.id(), cId);
CORRADE_COMPARE(c.id(), id);
CORRADE_VERIFY(std::is_nothrow_move_constructible<Buffer>::value);
CORRADE_VERIFY(std::is_nothrow_move_assignable<Buffer>::value);
}
void BufferGLTest::wrap() {

6
src/Magnum/GL/Test/BufferImageGLTest.cpp

@ -399,6 +399,9 @@ void BufferImageGLTest::constructMove() {
CORRADE_COMPARE(c.size(), Vector2i(4, 1));
CORRADE_COMPARE(c.dataSize(), 4);
CORRADE_COMPARE(c.buffer().id(), id);
CORRADE_VERIFY(std::is_nothrow_move_constructible<BufferImage2D>::value);
CORRADE_VERIFY(std::is_nothrow_move_assignable<BufferImage2D>::value);
}
void BufferImageGLTest::constructMoveCompressed() {
@ -446,6 +449,9 @@ void BufferImageGLTest::constructMoveCompressed() {
CORRADE_COMPARE(c.size(), Vector2i(4, 4));
CORRADE_COMPARE(c.dataSize(), 8);
CORRADE_COMPARE(c.buffer().id(), id);
CORRADE_VERIFY(std::is_nothrow_move_constructible<CompressedBufferImage2D>::value);
CORRADE_VERIFY(std::is_nothrow_move_assignable<CompressedBufferImage2D>::value);
}
void BufferImageGLTest::dataProperties() {

11
src/Magnum/GL/Test/BufferTextureGLTest.cpp

@ -45,6 +45,7 @@ struct BufferTextureGLTest: OpenGLTester {
explicit BufferTextureGLTest();
void construct();
void constructMove();
void wrap();
void bind();
@ -68,6 +69,7 @@ struct BufferTextureGLTest: OpenGLTester {
BufferTextureGLTest::BufferTextureGLTest() {
addTests({&BufferTextureGLTest::construct,
&BufferTextureGLTest::constructMove,
&BufferTextureGLTest::wrap,
&BufferTextureGLTest::bind,
@ -109,6 +111,15 @@ void BufferTextureGLTest::construct() {
MAGNUM_VERIFY_NO_GL_ERROR();
}
void BufferTextureGLTest::constructMove() {
/* Move constructor tested in AbstractTexture, here we just verify there
are no extra members that would need to be taken care of */
CORRADE_COMPARE(sizeof(BufferTexture), sizeof(AbstractTexture));
CORRADE_VERIFY(std::is_nothrow_move_constructible<BufferTexture>::value);
CORRADE_VERIFY(std::is_nothrow_move_assignable<BufferTexture>::value);
}
void BufferTextureGLTest::wrap() {
#ifndef MAGNUM_TARGET_GLES
if(!Context::current().isExtensionSupported<Extensions::ARB::texture_buffer_object>())

11
src/Magnum/GL/Test/CubeMapTextureArrayGLTest.cpp

@ -44,6 +44,7 @@ struct CubeMapTextureArrayGLTest: OpenGLTester {
explicit CubeMapTextureArrayGLTest();
void construct();
void constructMove();
void wrap();
void bind();
@ -265,6 +266,7 @@ const struct {
CubeMapTextureArrayGLTest::CubeMapTextureArrayGLTest() {
addTests({&CubeMapTextureArrayGLTest::construct,
&CubeMapTextureArrayGLTest::constructMove,
&CubeMapTextureArrayGLTest::wrap,
&CubeMapTextureArrayGLTest::bind,
@ -343,6 +345,15 @@ void CubeMapTextureArrayGLTest::construct() {
MAGNUM_VERIFY_NO_GL_ERROR();
}
void CubeMapTextureArrayGLTest::constructMove() {
/* Move constructor tested in AbstractTexture, here we just verify there
are no extra members that would need to be taken care of */
CORRADE_COMPARE(sizeof(CubeMapTextureArray), sizeof(AbstractTexture));
CORRADE_VERIFY(std::is_nothrow_move_constructible<CubeMapTextureArray>::value);
CORRADE_VERIFY(std::is_nothrow_move_assignable<CubeMapTextureArray>::value);
}
void CubeMapTextureArrayGLTest::wrap() {
#ifndef MAGNUM_TARGET_GLES
if(!Context::current().isExtensionSupported<Extensions::ARB::texture_cube_map_array>())

11
src/Magnum/GL/Test/CubeMapTextureGLTest.cpp

@ -50,6 +50,7 @@ struct CubeMapTextureGLTest: OpenGLTester {
explicit CubeMapTextureGLTest();
void construct();
void constructMove();
void wrap();
void bind();
@ -302,6 +303,7 @@ const struct {
CubeMapTextureGLTest::CubeMapTextureGLTest() {
addTests({&CubeMapTextureGLTest::construct,
&CubeMapTextureGLTest::constructMove,
&CubeMapTextureGLTest::wrap,
&CubeMapTextureGLTest::bind,
@ -441,6 +443,15 @@ void CubeMapTextureGLTest::construct() {
MAGNUM_VERIFY_NO_GL_ERROR();
}
void CubeMapTextureGLTest::constructMove() {
/* Move constructor tested in AbstractTexture, here we just verify there
are no extra members that would need to be taken care of */
CORRADE_COMPARE(sizeof(CubeMapTexture), sizeof(AbstractTexture));
CORRADE_VERIFY(std::is_nothrow_move_constructible<CubeMapTexture>::value);
CORRADE_VERIFY(std::is_nothrow_move_assignable<CubeMapTexture>::value);
}
void CubeMapTextureGLTest::wrap() {
GLuint id;
glGenTextures(1, &id);

3
src/Magnum/GL/Test/FramebufferGLTest.cpp

@ -367,6 +367,9 @@ void FramebufferGLTest::constructMove() {
CORRADE_COMPARE(b.id(), cId);
CORRADE_COMPARE(c.id(), id);
CORRADE_COMPARE(c.viewport(), Range2Di({32, 16}, {128, 256}));
CORRADE_VERIFY(std::is_nothrow_move_constructible<Framebuffer>::value);
CORRADE_VERIFY(std::is_nothrow_move_assignable<Framebuffer>::value);
}
void FramebufferGLTest::wrap() {

3
src/Magnum/GL/Test/MeshGLTest.cpp

@ -408,6 +408,9 @@ void MeshGLTest::constructMove() {
CORRADE_COMPARE(Containers::arrayCast<UnsignedByte>(framebuffer.read({{}, Vector2i{1}}, {PixelFormat::RGBA, PixelType::UnsignedByte}).data())[0], 85);
#endif
}
CORRADE_VERIFY(std::is_nothrow_move_constructible<Mesh>::value);
CORRADE_VERIFY(std::is_nothrow_move_assignable<Mesh>::value);
}
void MeshGLTest::wrap() {

12
src/Magnum/GL/Test/MultisampleTextureGLTest.cpp

@ -41,6 +41,7 @@ struct MultisampleTextureGLTest: OpenGLTester {
void construct2D();
void construct2DArray();
void constructMove();
void wrap2D();
void wrap2DArray();
@ -65,6 +66,8 @@ MultisampleTextureGLTest::MultisampleTextureGLTest() {
addTests({&MultisampleTextureGLTest::construct2D,
&MultisampleTextureGLTest::construct2DArray,
&MultisampleTextureGLTest::constructMove,
&MultisampleTextureGLTest::wrap2D,
&MultisampleTextureGLTest::wrap2DArray,
@ -122,6 +125,15 @@ void MultisampleTextureGLTest::construct2DArray() {
MAGNUM_VERIFY_NO_GL_ERROR();
}
void MultisampleTextureGLTest::constructMove() {
/* Move constructor tested in AbstractTexture, here we just verify there
are no extra members that would need to be taken care of */
CORRADE_COMPARE(sizeof(MultisampleTexture2D), sizeof(AbstractTexture));
CORRADE_VERIFY(std::is_nothrow_move_constructible<MultisampleTexture2D>::value);
CORRADE_VERIFY(std::is_nothrow_move_assignable<MultisampleTexture2D>::value);
}
void MultisampleTextureGLTest::wrap2D() {
#ifndef MAGNUM_TARGET_GLES
if(!Context::current().isExtensionSupported<Extensions::ARB::texture_multisample>())

13
src/Magnum/GL/Test/PipelineStatisticsQueryGLTest.cpp

@ -42,17 +42,28 @@ namespace Magnum { namespace GL { namespace Test { namespace {
struct PipelineStatisticsQueryGLTest: OpenGLTester {
explicit PipelineStatisticsQueryGLTest();
void constructMove();
void wrap();
void queryVerticesSubmitted();
};
PipelineStatisticsQueryGLTest::PipelineStatisticsQueryGLTest() {
addTests({&PipelineStatisticsQueryGLTest::wrap,
addTests({&PipelineStatisticsQueryGLTest::constructMove,
&PipelineStatisticsQueryGLTest::wrap,
&PipelineStatisticsQueryGLTest::queryVerticesSubmitted});
}
void PipelineStatisticsQueryGLTest::constructMove() {
/* Move constructor tested in AbstractQuery, here we just verify there
are no extra members that would need to be taken care of */
CORRADE_COMPARE(sizeof(PipelineStatisticsQuery), sizeof(AbstractQuery));
CORRADE_VERIFY(std::is_nothrow_move_constructible<PipelineStatisticsQuery>::value);
CORRADE_VERIFY(std::is_nothrow_move_assignable<PipelineStatisticsQuery>::value);
}
void PipelineStatisticsQueryGLTest::wrap() {
if(!Context::current().isExtensionSupported<Extensions::ARB::pipeline_statistics_query>())
CORRADE_SKIP(Extensions::ARB::pipeline_statistics_query::string() + std::string(" is not available"));

19
src/Magnum/GL/Test/PrimitiveQueryGLTest.cpp

@ -46,6 +46,7 @@ namespace Magnum { namespace GL { namespace Test { namespace {
struct PrimitiveQueryGLTest: OpenGLTester {
explicit PrimitiveQueryGLTest();
void constructMove();
void wrap();
#if !defined(MAGNUM_TARGET_GLES2) && !defined(MAGNUM_TARGET_WEBGL)
@ -61,7 +62,8 @@ struct PrimitiveQueryGLTest: OpenGLTester {
};
PrimitiveQueryGLTest::PrimitiveQueryGLTest() {
addTests({&PrimitiveQueryGLTest::wrap,
addTests({&PrimitiveQueryGLTest::constructMove,
&PrimitiveQueryGLTest::wrap,
#if !defined(MAGNUM_TARGET_GLES2) && !defined(MAGNUM_TARGET_WEBGL)
&PrimitiveQueryGLTest::primitivesGenerated,
@ -76,6 +78,21 @@ PrimitiveQueryGLTest::PrimitiveQueryGLTest() {
});
}
void PrimitiveQueryGLTest::constructMove() {
/* Move constructor tested in AbstractQuery. Compared to other *Query
classes, PrimitiveQuery contains an additional layer ID, which is
trivial to move and the move is defaulted, so we HOPEFULLY don't need to
test. In case this bites me in the future, I'm stupid. */
#ifndef MAGNUM_TARGET_GLES
CORRADE_COMPARE(sizeof(PrimitiveQuery), sizeof(AbstractQuery) + sizeof(GLuint));
#else
CORRADE_COMPARE(sizeof(PrimitiveQuery), sizeof(AbstractQuery));
#endif
CORRADE_VERIFY(std::is_nothrow_move_constructible<PrimitiveQuery>::value);
CORRADE_VERIFY(std::is_nothrow_move_assignable<PrimitiveQuery>::value);
}
void PrimitiveQueryGLTest::wrap() {
#ifndef MAGNUM_TARGET_GLES
if(!Context::current().isExtensionSupported<Extensions::ARB::transform_feedback2>())

11
src/Magnum/GL/Test/RectangleTextureGLTest.cpp

@ -45,6 +45,7 @@ struct RectangleTextureGLTest: OpenGLTester {
explicit RectangleTextureGLTest();
void construct();
void constructMove();
void wrap();
void bind();
@ -115,6 +116,7 @@ const struct {
RectangleTextureGLTest::RectangleTextureGLTest() {
addTests({&RectangleTextureGLTest::construct,
&RectangleTextureGLTest::constructMove,
&RectangleTextureGLTest::wrap,
&RectangleTextureGLTest::bind,
@ -167,6 +169,15 @@ void RectangleTextureGLTest::construct() {
MAGNUM_VERIFY_NO_GL_ERROR();
}
void RectangleTextureGLTest::constructMove() {
/* Move constructor tested in AbstractTexture, here we just verify there
are no extra members that would need to be taken care of */
CORRADE_COMPARE(sizeof(RectangleTexture), sizeof(AbstractTexture));
CORRADE_VERIFY(std::is_nothrow_move_constructible<RectangleTexture>::value);
CORRADE_VERIFY(std::is_nothrow_move_assignable<RectangleTexture>::value);
}
void RectangleTextureGLTest::wrap() {
if(!Context::current().isExtensionSupported<Extensions::ARB::texture_rectangle>())
CORRADE_SKIP(Extensions::ARB::texture_rectangle::string() + std::string(" is not supported."));

3
src/Magnum/GL/Test/RenderbufferGLTest.cpp

@ -109,6 +109,9 @@ void RenderbufferGLTest::constructMove() {
CORRADE_VERIFY(cId > 0);
CORRADE_COMPARE(b.id(), cId);
CORRADE_COMPARE(c.id(), id);
CORRADE_VERIFY(std::is_nothrow_move_constructible<Renderbuffer>::value);
CORRADE_VERIFY(std::is_nothrow_move_assignable<Renderbuffer>::value);
}
void RenderbufferGLTest::wrap() {

13
src/Magnum/GL/Test/SampleQueryGLTest.cpp

@ -44,6 +44,7 @@ namespace Magnum { namespace GL { namespace Test { namespace {
struct SampleQueryGLTest: OpenGLTester {
explicit SampleQueryGLTest();
void constructMove();
void wrap();
void querySamplesPassed();
@ -53,7 +54,8 @@ struct SampleQueryGLTest: OpenGLTester {
};
SampleQueryGLTest::SampleQueryGLTest() {
addTests({&SampleQueryGLTest::wrap,
addTests({&SampleQueryGLTest::constructMove,
&SampleQueryGLTest::wrap,
&SampleQueryGLTest::querySamplesPassed,
#ifndef MAGNUM_TARGET_GLES
@ -62,6 +64,15 @@ SampleQueryGLTest::SampleQueryGLTest() {
});
}
void SampleQueryGLTest::constructMove() {
/* Move constructor tested in AbstractQuery, here we just verify there
are no extra members that would need to be taken care of */
CORRADE_COMPARE(sizeof(SampleQuery), sizeof(AbstractQuery));
CORRADE_VERIFY(std::is_nothrow_move_constructible<SampleQuery>::value);
CORRADE_VERIFY(std::is_nothrow_move_assignable<SampleQuery>::value);
}
void SampleQueryGLTest::wrap() {
#ifdef MAGNUM_TARGET_GLES2
if(!Context::current().isExtensionSupported<Extensions::EXT::occlusion_query_boolean>())

3
src/Magnum/GL/Test/ShaderGLTest.cpp

@ -137,6 +137,9 @@ void ShaderGLTest::constructMove() {
#else
CORRADE_COMPARE(c.sources(), std::vector<std::string>{"#version 300 es\n"});
#endif
CORRADE_VERIFY(std::is_nothrow_move_constructible<Shader>::value);
CORRADE_VERIFY(std::is_nothrow_move_assignable<Shader>::value);
}
#ifndef MAGNUM_TARGET_WEBGL

13
src/Magnum/GL/Test/TextureArrayGLTest.cpp

@ -51,6 +51,8 @@ struct TextureArrayGLTest: OpenGLTester {
#endif
void construct2D();
void constructMove();
#ifndef MAGNUM_TARGET_GLES
void wrap1D();
#endif
@ -273,6 +275,8 @@ TextureArrayGLTest::TextureArrayGLTest() {
#endif
&TextureArrayGLTest::construct2D,
&TextureArrayGLTest::constructMove,
#ifndef MAGNUM_TARGET_GLES
&TextureArrayGLTest::wrap1D,
#endif
@ -434,6 +438,15 @@ void TextureArrayGLTest::construct2D() {
MAGNUM_VERIFY_NO_GL_ERROR();
}
void TextureArrayGLTest::constructMove() {
/* Move constructor tested in AbstractTexture, here we just verify there
are no extra members that would need to be taken care of */
CORRADE_COMPARE(sizeof(Texture2DArray), sizeof(AbstractTexture));
CORRADE_VERIFY(std::is_nothrow_move_constructible<Texture2DArray>::value);
CORRADE_VERIFY(std::is_nothrow_move_assignable<Texture2DArray>::value);
}
#ifndef MAGNUM_TARGET_GLES
void TextureArrayGLTest::wrap1D() {
GLuint id;

13
src/Magnum/GL/Test/TextureGLTest.cpp

@ -55,6 +55,8 @@ struct TextureGLTest: OpenGLTester {
void construct3D();
#endif
void constructMove();
#ifndef MAGNUM_TARGET_GLES
void wrap1D();
#endif
@ -433,6 +435,8 @@ TextureGLTest::TextureGLTest() {
&TextureGLTest::construct3D,
#endif
&TextureGLTest::constructMove,
#ifndef MAGNUM_TARGET_GLES
&TextureGLTest::wrap1D,
#endif
@ -690,6 +694,15 @@ void TextureGLTest::construct3D() {
}
#endif
void TextureGLTest::constructMove() {
/* Move constructor tested in AbstractTexture, here we just verify there
are no extra members that would need to be taken care of */
CORRADE_COMPARE(sizeof(Texture2D), sizeof(AbstractTexture));
CORRADE_VERIFY(std::is_nothrow_move_constructible<Texture2D>::value);
CORRADE_VERIFY(std::is_nothrow_move_assignable<Texture2D>::value);
}
#ifndef MAGNUM_TARGET_GLES
void TextureGLTest::wrap1D() {
GLuint id;

13
src/Magnum/GL/Test/TimeQueryGLTest.cpp

@ -35,6 +35,7 @@ namespace Magnum { namespace GL { namespace Test { namespace {
struct TimeQueryGLTest: OpenGLTester {
explicit TimeQueryGLTest();
void constructMove();
void wrap();
void queryTime();
@ -42,12 +43,22 @@ struct TimeQueryGLTest: OpenGLTester {
};
TimeQueryGLTest::TimeQueryGLTest() {
addTests({&TimeQueryGLTest::wrap,
addTests({&TimeQueryGLTest::constructMove,
&TimeQueryGLTest::wrap,
&TimeQueryGLTest::queryTime,
&TimeQueryGLTest::queryTimestamp});
}
void TimeQueryGLTest::constructMove() {
/* Move constructor tested in AbstractQuery, here we just verify there
are no extra members that would need to be taken care of */
CORRADE_COMPARE(sizeof(TimeQuery), sizeof(AbstractQuery));
CORRADE_VERIFY(std::is_nothrow_move_constructible<TimeQuery>::value);
CORRADE_VERIFY(std::is_nothrow_move_assignable<TimeQuery>::value);
}
void TimeQueryGLTest::wrap() {
#ifndef MAGNUM_TARGET_GLES
if(!Context::current().isExtensionSupported<Extensions::ARB::timer_query>())

3
src/Magnum/GL/Test/TransformFeedbackGLTest.cpp

@ -152,6 +152,9 @@ void TransformFeedbackGLTest::constructMove() {
CORRADE_VERIFY(cId > 0);
CORRADE_COMPARE(b.id(), cId);
CORRADE_COMPARE(c.id(), id);
CORRADE_VERIFY(std::is_nothrow_move_constructible<TransformFeedback>::value);
CORRADE_VERIFY(std::is_nothrow_move_assignable<TransformFeedback>::value);
}
void TransformFeedbackGLTest::wrap() {

Loading…
Cancel
Save