Browse Source

Clarify and verify that NoCreate constructors don't need GL context.

Tests for the NoCreate constructors were moved into non-GL test classes.
pull/196/head
Vladimír Vondruš 9 years ago
parent
commit
400b5fafcf
  1. 3
      src/Magnum/Buffer.h
  2. 3
      src/Magnum/BufferImage.h
  3. 3
      src/Magnum/BufferTexture.h
  4. 3
      src/Magnum/CubeMapTexture.h
  5. 3
      src/Magnum/CubeMapTextureArray.h
  6. 3
      src/Magnum/Framebuffer.h
  7. 3
      src/Magnum/Mesh.h
  8. 3
      src/Magnum/MultisampleTexture.h
  9. 3
      src/Magnum/PrimitiveQuery.h
  10. 3
      src/Magnum/RectangleTexture.h
  11. 3
      src/Magnum/Renderbuffer.h
  12. 3
      src/Magnum/SampleQuery.h
  13. 13
      src/Magnum/Test/BufferGLTest.cpp
  14. 26
      src/Magnum/Test/BufferImageGLTest.cpp
  15. 64
      src/Magnum/Test/BufferImageTest.cpp
  16. 15
      src/Magnum/Test/BufferTest.cpp
  17. 13
      src/Magnum/Test/BufferTextureGLTest.cpp
  18. 53
      src/Magnum/Test/BufferTextureTest.cpp
  19. 30
      src/Magnum/Test/CMakeLists.txt
  20. 13
      src/Magnum/Test/CubeMapTextureArrayGLTest.cpp
  21. 53
      src/Magnum/Test/CubeMapTextureArrayTest.cpp
  22. 13
      src/Magnum/Test/CubeMapTextureGLTest.cpp
  23. 53
      src/Magnum/Test/CubeMapTextureTest.cpp
  24. 13
      src/Magnum/Test/FramebufferGLTest.cpp
  25. 15
      src/Magnum/Test/FramebufferTest.cpp
  26. 13
      src/Magnum/Test/MeshGLTest.cpp
  27. 15
      src/Magnum/Test/MeshTest.cpp
  28. 28
      src/Magnum/Test/MultisampleTextureGLTest.cpp
  29. 64
      src/Magnum/Test/MultisampleTextureTest.cpp
  30. 15
      src/Magnum/Test/PrimitiveQueryGLTest.cpp
  31. 53
      src/Magnum/Test/PrimitiveQueryTest.cpp
  32. 13
      src/Magnum/Test/RectangleTextureGLTest.cpp
  33. 53
      src/Magnum/Test/RectangleTextureTest.cpp
  34. 13
      src/Magnum/Test/RenderbufferGLTest.cpp
  35. 53
      src/Magnum/Test/RenderbufferTest.cpp
  36. 15
      src/Magnum/Test/SampleQueryGLTest.cpp
  37. 53
      src/Magnum/Test/SampleQueryTest.cpp
  38. 26
      src/Magnum/Test/TextureArrayGLTest.cpp
  39. 71
      src/Magnum/Test/TextureArrayTest.cpp
  40. 39
      src/Magnum/Test/TextureGLTest.cpp
  41. 89
      src/Magnum/Test/TextureTest.cpp
  42. 15
      src/Magnum/Test/TimeQueryGLTest.cpp
  43. 53
      src/Magnum/Test/TimeQueryTest.cpp
  44. 13
      src/Magnum/Test/TransformFeedbackGLTest.cpp
  45. 53
      src/Magnum/Test/TransformFeedbackTest.cpp
  46. 3
      src/Magnum/Texture.h
  47. 3
      src/Magnum/TextureArray.h
  48. 3
      src/Magnum/TimeQuery.h
  49. 3
      src/Magnum/TransformFeedback.h

3
src/Magnum/Buffer.h

@ -863,6 +863,9 @@ class MAGNUM_EXPORT Buffer: public AbstractObject {
* The constructed instance is equivalent to moved-from state. Useful
* in cases where you will overwrite the instance later anyway. Move
* another object over it to make it useful.
*
* This function can be safely used for constructing (and later
* destructing) objects even without any OpenGL context being active.
* @see @ref Buffer(TargetHint), @ref wrap()
*/
explicit Buffer(NoCreateT) noexcept;

3
src/Magnum/BufferImage.h

@ -135,6 +135,9 @@ template<UnsignedInt dimensions> class BufferImage {
* @ref PixelFormat::RGBA and @ref PixelType::UnsignedByte. Useful in
* cases where you will overwrite the instance later anyway. Move
* another object over it to make it useful.
*
* This function can be safely used for constructing (and later
* destructing) objects even without any OpenGL context being active.
* @see @ref BufferImage(), @ref Buffer::wrap()
*/
explicit BufferImage(NoCreateT) noexcept;

3
src/Magnum/BufferTexture.h

@ -148,6 +148,9 @@ class MAGNUM_EXPORT BufferTexture: public AbstractTexture {
* The constructed instance is equivalent to moved-from state. Useful
* in cases where you will overwrite the instance later anyway. Move
* another object over it to make it useful.
*
* This function can be safely used for constructing (and later
* destructing) objects even without any OpenGL context being active.
* @see @ref BufferTexture(), @ref wrap()
*/
explicit BufferTexture(NoCreateT) noexcept:

3
src/Magnum/CubeMapTexture.h

@ -174,6 +174,9 @@ class MAGNUM_EXPORT CubeMapTexture: public AbstractTexture {
* The constructed instance is equivalent to moved-from state. Useful
* in cases where you will overwrite the instance later anyway. Move
* another object over it to make it useful.
*
* This function can be safely used for constructing (and later
* destructing) objects even without any OpenGL context being active.
* @see @ref CubeMapTexture(), @ref wrap()
*/
explicit CubeMapTexture(NoCreateT) noexcept: AbstractTexture{NoCreate, GL_TEXTURE_CUBE_MAP} {}

3
src/Magnum/CubeMapTextureArray.h

@ -164,6 +164,9 @@ class MAGNUM_EXPORT CubeMapTextureArray: public AbstractTexture {
* The constructed instance is equivalent to moved-from state. Useful
* in cases where you will overwrite the instance later anyway. Move
* another object over it to make it useful.
*
* This function can be safely used for constructing (and later
* destructing) objects even without any OpenGL context being active.
* @see @ref CubeMapTextureArray(), @ref wrap()
*/
explicit CubeMapTextureArray(NoCreateT) noexcept:

3
src/Magnum/Framebuffer.h

@ -353,6 +353,9 @@ class MAGNUM_EXPORT Framebuffer: public AbstractFramebuffer, public AbstractObje
* The constructed instance is equivalent to moved-from state. Useful
* in cases where you will overwrite the instance later anyway. Move
* another object over it to make it useful.
*
* This function can be safely used for constructing (and later
* destructing) objects even without any OpenGL context being active.
* @see @ref Framebuffer(const Range2Di&), @ref wrap()
*/
explicit Framebuffer(NoCreateT) noexcept { _id = 0; }

3
src/Magnum/Mesh.h

@ -474,6 +474,9 @@ class MAGNUM_EXPORT Mesh: public AbstractObject {
* The constructed instance is equivalent to moved-from state. Useful
* in cases where you will overwrite the instance later anyway. Move
* another object over it to make it useful.
*
* This function can be safely used for constructing (and later
* destructing) objects even without any OpenGL context being active.
* @see @ref Mesh(MeshPrimitive), @ref wrap()
*/
explicit Mesh(NoCreateT) noexcept;

3
src/Magnum/MultisampleTexture.h

@ -156,6 +156,9 @@ template<UnsignedInt dimensions> class MultisampleTexture: public AbstractTextur
* The constructed instance is equivalent to moved-from state. Useful
* in cases where you will overwrite the instance later anyway. Move
* another object over it to make it useful.
*
* This function can be safely used for constructing (and later
* destructing) objects even without any OpenGL context being active.
* @see @ref MultisampleTexture(), @ref wrap()
*/
explicit MultisampleTexture(NoCreateT) noexcept: AbstractTexture{NoCreate, Implementation::multisampleTextureTarget<dimensions>()} {}

3
src/Magnum/PrimitiveQuery.h

@ -161,6 +161,9 @@ class MAGNUM_EXPORT PrimitiveQuery: public AbstractQuery {
* The constructed instance is equivalent to moved-from state. Useful
* in cases where you will overwrite the instance later anyway. Move
* another object over it to make it useful.
*
* This function can be safely used for constructing (and later
* destructing) objects even without any OpenGL context being active.
* @see @ref PrimitiveQuery(Target), @ref wrap()
*/
explicit PrimitiveQuery(NoCreateT) noexcept: AbstractQuery{NoCreate, GLenum(Target::TransformFeedbackPrimitivesWritten)} {}

3
src/Magnum/RectangleTexture.h

@ -135,6 +135,9 @@ class MAGNUM_EXPORT RectangleTexture: public AbstractTexture {
* The constructed instance is equivalent to moved-from state. Useful
* in cases where you will overwrite the instance later anyway. Move
* another object over it to make it useful.
*
* This function can be safely used for constructing (and later
* destructing) objects even without any OpenGL context being active.
* @see @ref RectangleTexture(), @ref wrap()
*/
explicit RectangleTexture(NoCreateT) noexcept: AbstractTexture{NoCreate, GL_TEXTURE_RECTANGLE} {}

3
src/Magnum/Renderbuffer.h

@ -121,6 +121,9 @@ class MAGNUM_EXPORT Renderbuffer: public AbstractObject {
* The constructed instance is equivalent to moved-from state. Useful
* in cases where you will overwrite the instance later anyway. Move
* another object over it to make it useful.
*
* This function can be safely used for constructing (and later
* destructing) objects even without any OpenGL context being active.
* @see @ref Renderbuffer(), @ref wrap()
*/
explicit Renderbuffer(NoCreateT) noexcept: _id{0}, _flags{ObjectFlag::DeleteOnDestruction} {}

3
src/Magnum/SampleQuery.h

@ -226,6 +226,9 @@ class SampleQuery: public AbstractQuery {
* The constructed instance is equivalent to moved-from state. Useful
* in cases where you will overwrite the instance later anyway. Move
* another object over it to make it useful.
*
* This function can be safely used for constructing (and later
* destructing) objects even without any OpenGL context being active.
* @see @ref SampleQuery(Target), @ref wrap()
*/
explicit SampleQuery(NoCreateT) noexcept: AbstractQuery{NoCreate, GLenum(Target::AnySamplesPassed)} {}

13
src/Magnum/Test/BufferGLTest.cpp

@ -39,7 +39,6 @@ struct BufferGLTest: OpenGLTester {
explicit BufferGLTest();
void construct();
void constructNoCreate();
void constructCopy();
void constructMove();
void wrap();
@ -66,7 +65,6 @@ struct BufferGLTest: OpenGLTester {
BufferGLTest::BufferGLTest() {
addTests({&BufferGLTest::construct,
&BufferGLTest::constructNoCreate,
&BufferGLTest::constructCopy,
&BufferGLTest::constructMove,
&BufferGLTest::wrap,
@ -104,17 +102,6 @@ void BufferGLTest::construct() {
MAGNUM_VERIFY_NO_ERROR();
}
void BufferGLTest::constructNoCreate() {
{
Buffer buffer{NoCreate};
MAGNUM_VERIFY_NO_ERROR();
CORRADE_COMPARE(buffer.id(), 0);
}
MAGNUM_VERIFY_NO_ERROR();
}
void BufferGLTest::constructCopy() {
CORRADE_VERIFY(!(std::is_constructible<Buffer, const Buffer&>{}));
CORRADE_VERIFY(!(std::is_assignable<Buffer, const Buffer&>{}));

26
src/Magnum/Test/BufferImageGLTest.cpp

@ -36,8 +36,6 @@ struct BufferImageGLTest: OpenGLTester {
void construct();
void constructCompressed();
void constructNoCreate();
void constructNoCreateCompressed();
void constructBuffer();
void constructBufferCompressed();
void constructCopy();
@ -55,8 +53,6 @@ struct BufferImageGLTest: OpenGLTester {
BufferImageGLTest::BufferImageGLTest() {
addTests({&BufferImageGLTest::construct,
&BufferImageGLTest::constructCompressed,
&BufferImageGLTest::constructNoCreate,
&BufferImageGLTest::constructNoCreateCompressed,
&BufferImageGLTest::constructBuffer,
&BufferImageGLTest::constructBufferCompressed,
&BufferImageGLTest::constructCopy,
@ -123,28 +119,6 @@ void BufferImageGLTest::constructCompressed() {
#endif
}
void BufferImageGLTest::constructNoCreate() {
{
BufferImage2D image{NoCreate};
MAGNUM_VERIFY_NO_ERROR();
CORRADE_COMPARE(image.buffer().id(), 0);
}
MAGNUM_VERIFY_NO_ERROR();
}
void BufferImageGLTest::constructNoCreateCompressed() {
{
CompressedBufferImage2D image{NoCreate};
MAGNUM_VERIFY_NO_ERROR();
CORRADE_COMPARE(image.buffer().id(), 0);
}
MAGNUM_VERIFY_NO_ERROR();
}
void BufferImageGLTest::constructBuffer() {
const char data[] = { 'a', 'b', 'c' };
Buffer buffer;

64
src/Magnum/Test/BufferImageTest.cpp

@ -0,0 +1,64 @@
/*
This file is part of Magnum.
Copyright © 2010, 2011, 2012, 2013, 2014, 2015, 2016
Vladimír Vondruš <mosra@centrum.cz>
Permission is hereby granted, free of charge, to any person obtaining a
copy of this software and associated documentation files (the "Software"),
to deal in the Software without restriction, including without limitation
the rights to use, copy, modify, merge, publish, distribute, sublicense,
and/or sell copies of the Software, and to permit persons to whom the
Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included
in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
DEALINGS IN THE SOFTWARE.
*/
#include <Corrade/TestSuite/Tester.h>
#include "Magnum/BufferImage.h"
namespace Magnum { namespace Test {
struct BufferImageTest: TestSuite::Tester {
explicit BufferImageTest();
void constructNoCreate();
void constructNoCreateCompressed();
};
BufferImageTest::BufferImageTest() {
addTests({&BufferImageTest::constructNoCreate,
&BufferImageTest::constructNoCreateCompressed});
}
void BufferImageTest::constructNoCreate() {
{
BufferImage2D image{NoCreate};
CORRADE_COMPARE(image.buffer().id(), 0);
}
CORRADE_VERIFY(true);
}
void BufferImageTest::constructNoCreateCompressed() {
{
CompressedBufferImage2D image{NoCreate};
CORRADE_COMPARE(image.buffer().id(), 0);
}
CORRADE_VERIFY(true);
}
}}
CORRADE_TEST_MAIN(Magnum::Test::BufferImageTest)

15
src/Magnum/Test/BufferTest.cpp

@ -34,6 +34,8 @@ namespace Magnum { namespace Test {
struct BufferTest: TestSuite::Tester {
explicit BufferTest();
void constructNoCreate();
void debugTargetHint();
#ifndef MAGNUM_TARGET_GLES2
void debugTarget();
@ -41,13 +43,24 @@ struct BufferTest: TestSuite::Tester {
};
BufferTest::BufferTest() {
addTests({&BufferTest::debugTargetHint,
addTests({&BufferTest::constructNoCreate,
&BufferTest::debugTargetHint,
#ifndef MAGNUM_TARGET_GLES2
&BufferTest::debugTarget
#endif
});
}
void BufferTest::constructNoCreate() {
{
Buffer buffer{NoCreate};
CORRADE_COMPARE(buffer.id(), 0);
}
CORRADE_VERIFY(true);
}
void BufferTest::debugTargetHint() {
std::ostringstream out;
Debug{&out} << Buffer::TargetHint::Array << Buffer::TargetHint(0xdead);

13
src/Magnum/Test/BufferTextureGLTest.cpp

@ -39,7 +39,6 @@ struct BufferTextureGLTest: OpenGLTester {
explicit BufferTextureGLTest();
void construct();
void constructNoCreate();
void wrap();
void bind();
@ -51,7 +50,6 @@ struct BufferTextureGLTest: OpenGLTester {
BufferTextureGLTest::BufferTextureGLTest() {
addTests({&BufferTextureGLTest::construct,
&BufferTextureGLTest::constructNoCreate,
&BufferTextureGLTest::wrap,
&BufferTextureGLTest::bind,
@ -80,17 +78,6 @@ void BufferTextureGLTest::construct() {
MAGNUM_VERIFY_NO_ERROR();
}
void BufferTextureGLTest::constructNoCreate() {
{
BufferTexture texture{NoCreate};
MAGNUM_VERIFY_NO_ERROR();
CORRADE_COMPARE(texture.id(), 0);
}
MAGNUM_VERIFY_NO_ERROR();
}
void BufferTextureGLTest::wrap() {
#ifndef MAGNUM_TARGET_GLES
if(!Context::current().isExtensionSupported<Extensions::GL::ARB::texture_buffer_object>())

53
src/Magnum/Test/BufferTextureTest.cpp

@ -0,0 +1,53 @@
/*
This file is part of Magnum.
Copyright © 2010, 2011, 2012, 2013, 2014, 2015, 2016
Vladimír Vondruš <mosra@centrum.cz>
Permission is hereby granted, free of charge, to any person obtaining a
copy of this software and associated documentation files (the "Software"),
to deal in the Software without restriction, including without limitation
the rights to use, copy, modify, merge, publish, distribute, sublicense,
and/or sell copies of the Software, and to permit persons to whom the
Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included
in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
DEALINGS IN THE SOFTWARE.
*/
#include <Corrade/TestSuite/Tester.h>
#include "Magnum/BufferTexture.h"
namespace Magnum { namespace Test {
struct BufferTextureTest: TestSuite::Tester {
explicit BufferTextureTest();
void constructNoCreate();
};
BufferTextureTest::BufferTextureTest() {
addTests({&BufferTextureTest::constructNoCreate});
}
void BufferTextureTest::constructNoCreate() {
{
BufferTexture texture{NoCreate};
CORRADE_COMPARE(texture.id(), 0);
}
CORRADE_VERIFY(true);
}
}}
CORRADE_TEST_MAIN(Magnum::Test::BufferTextureTest)

30
src/Magnum/Test/CMakeLists.txt

@ -28,6 +28,7 @@ corrade_add_test(AttributeTest AttributeTest.cpp LIBRARIES Magnum)
corrade_add_test(BufferTest BufferTest.cpp LIBRARIES Magnum)
corrade_add_test(FormatTest FormatTest.cpp LIBRARIES Magnum)
corrade_add_test(ContextTest ContextTest.cpp LIBRARIES Magnum)
corrade_add_test(CubeMapTextureTest CubeMapTextureTest.cpp LIBRARIES Magnum)
if(NOT MAGNUM_TARGET_WEBGL)
corrade_add_test(DebugOutputTest DebugOutputTest.cpp LIBRARIES Magnum)
endif()
@ -38,12 +39,39 @@ corrade_add_test(ImageViewTest ImageViewTest.cpp LIBRARIES Magnum)
corrade_add_test(MeshTest MeshTest.cpp LIBRARIES Magnum)
corrade_add_test(PixelStorageTest PixelStorageTest.cpp LIBRARIES Magnum)
corrade_add_test(RendererTest RendererTest.cpp LIBRARIES Magnum)
corrade_add_test(RenderbufferTest RenderbufferTest.cpp LIBRARIES Magnum)
corrade_add_test(ResourceManagerTest ResourceManagerTest.cpp LIBRARIES Magnum)
target_compile_definitions(ResourceManagerTest PRIVATE "CORRADE_GRACEFUL_ASSERT")
corrade_add_test(SamplerTest SamplerTest.cpp LIBRARIES Magnum)
corrade_add_test(ShaderTest ShaderTest.cpp LIBRARIES Magnum)
corrade_add_test(VersionTest VersionTest.cpp LIBRARIES Magnum)
corrade_add_test(TagsTest TagsTest.cpp LIBRARIES Magnum)
corrade_add_test(TextureTest TextureTest.cpp LIBRARIES Magnum)
corrade_add_test(VersionTest VersionTest.cpp LIBRARIES Magnum)
if(NOT MAGNUM_TARGET_GLES2)
corrade_add_test(BufferImageTest BufferImageTest.cpp LIBRARIES Magnum)
corrade_add_test(PrimitiveQueryTest PrimitiveQueryTest.cpp LIBRARIES Magnum)
corrade_add_test(TextureArrayTest TextureArrayTest.cpp LIBRARIES Magnum)
corrade_add_test(TransformFeedbackTest TransformFeedbackTest.cpp LIBRARIES Magnum)
endif()
if(NOT MAGNUM_TARGET_GLES2 AND NOT MAGNUM_TARGET_WEBGL)
corrade_add_test(BufferTextureTest BufferTextureTest.cpp LIBRARIES Magnum)
corrade_add_test(CubeMapTextureArrayTest CubeMapTextureArrayTest.cpp LIBRARIES Magnum)
corrade_add_test(MultisampleTextureTest MultisampleTextureTest.cpp LIBRARIES Magnum)
endif()
if(NOT (MAGNUM_TARGET_WEBGL AND MAGNUM_TARGET_GLES2))
corrade_add_test(SampleQueryTest SampleQueryTest.cpp LIBRARIES Magnum)
endif()
if(NOT MAGNUM_TARGET_WEBGL)
corrade_add_test(TimeQueryTest TimeQueryTest.cpp LIBRARIES Magnum)
endif()
if(NOT MAGNUM_TARGET_GLES)
corrade_add_test(RectangleTextureTest RectangleTextureTest.cpp LIBRARIES MagnumOpenGLTester)
endif()
add_library(ResourceManagerLocalInstanceTestLib ${SHARED_OR_STATIC} ResourceManagerLocalInstanceTestLib.cpp)
target_link_libraries(ResourceManagerLocalInstanceTestLib Magnum)

13
src/Magnum/Test/CubeMapTextureArrayGLTest.cpp

@ -43,7 +43,6 @@ struct CubeMapTextureArrayGLTest: OpenGLTester {
explicit CubeMapTextureArrayGLTest();
void construct();
void constructNoCreate();
void wrap();
void bind();
@ -89,7 +88,6 @@ private:
CubeMapTextureArrayGLTest::CubeMapTextureArrayGLTest() {
addTests({&CubeMapTextureArrayGLTest::construct,
&CubeMapTextureArrayGLTest::constructNoCreate,
&CubeMapTextureArrayGLTest::wrap,
&CubeMapTextureArrayGLTest::bind,
@ -170,17 +168,6 @@ void CubeMapTextureArrayGLTest::construct() {
MAGNUM_VERIFY_NO_ERROR();
}
void CubeMapTextureArrayGLTest::constructNoCreate() {
{
CubeMapTextureArray texture{NoCreate};
MAGNUM_VERIFY_NO_ERROR();
CORRADE_COMPARE(texture.id(), 0);
}
MAGNUM_VERIFY_NO_ERROR();
}
void CubeMapTextureArrayGLTest::wrap() {
#ifndef MAGNUM_TARGET_GLES
if(!Context::current().isExtensionSupported<Extensions::GL::ARB::texture_cube_map_array>())

53
src/Magnum/Test/CubeMapTextureArrayTest.cpp

@ -0,0 +1,53 @@
/*
This file is part of Magnum.
Copyright © 2010, 2011, 2012, 2013, 2014, 2015, 2016
Vladimír Vondruš <mosra@centrum.cz>
Permission is hereby granted, free of charge, to any person obtaining a
copy of this software and associated documentation files (the "Software"),
to deal in the Software without restriction, including without limitation
the rights to use, copy, modify, merge, publish, distribute, sublicense,
and/or sell copies of the Software, and to permit persons to whom the
Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included
in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
DEALINGS IN THE SOFTWARE.
*/
#include <Corrade/TestSuite/Tester.h>
#include "Magnum/CubeMapTextureArray.h"
namespace Magnum { namespace Test {
struct CubeMapTextureArrayTest: TestSuite::Tester {
explicit CubeMapTextureArrayTest();
void constructNoCreate();
};
CubeMapTextureArrayTest::CubeMapTextureArrayTest() {
addTests({&CubeMapTextureArrayTest::constructNoCreate});
}
void CubeMapTextureArrayTest::constructNoCreate() {
{
CubeMapTextureArray texture{NoCreate};
CORRADE_COMPARE(texture.id(), 0);
}
CORRADE_VERIFY(true);
}
}}
CORRADE_TEST_MAIN(Magnum::Test::CubeMapTextureArrayTest)

13
src/Magnum/Test/CubeMapTextureGLTest.cpp

@ -47,7 +47,6 @@ struct CubeMapTextureGLTest: OpenGLTester {
explicit CubeMapTextureGLTest();
void construct();
void constructNoCreate();
void wrap();
void bind();
@ -119,7 +118,6 @@ private:
CubeMapTextureGLTest::CubeMapTextureGLTest() {
addTests({&CubeMapTextureGLTest::construct,
&CubeMapTextureGLTest::constructNoCreate,
&CubeMapTextureGLTest::wrap,
&CubeMapTextureGLTest::bind,
@ -233,17 +231,6 @@ void CubeMapTextureGLTest::construct() {
MAGNUM_VERIFY_NO_ERROR();
}
void CubeMapTextureGLTest::constructNoCreate() {
{
CubeMapTexture texture{NoCreate};
MAGNUM_VERIFY_NO_ERROR();
CORRADE_COMPARE(texture.id(), 0);
}
MAGNUM_VERIFY_NO_ERROR();
}
void CubeMapTextureGLTest::wrap() {
GLuint id;
glGenTextures(1, &id);

53
src/Magnum/Test/CubeMapTextureTest.cpp

@ -0,0 +1,53 @@
/*
This file is part of Magnum.
Copyright © 2010, 2011, 2012, 2013, 2014, 2015, 2016
Vladimír Vondruš <mosra@centrum.cz>
Permission is hereby granted, free of charge, to any person obtaining a
copy of this software and associated documentation files (the "Software"),
to deal in the Software without restriction, including without limitation
the rights to use, copy, modify, merge, publish, distribute, sublicense,
and/or sell copies of the Software, and to permit persons to whom the
Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included
in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
DEALINGS IN THE SOFTWARE.
*/
#include <Corrade/TestSuite/Tester.h>
#include "Magnum/CubeMapTexture.h"
namespace Magnum { namespace Test {
struct CubeMapTextureTest: TestSuite::Tester {
explicit CubeMapTextureTest();
void constructNoCreate();
};
CubeMapTextureTest::CubeMapTextureTest() {
addTests({&CubeMapTextureTest::constructNoCreate});
}
void CubeMapTextureTest::constructNoCreate() {
{
CubeMapTexture texture{NoCreate};
CORRADE_COMPARE(texture.id(), 0);
}
CORRADE_VERIFY(true);
}
}}
CORRADE_TEST_MAIN(Magnum::Test::CubeMapTextureTest)

13
src/Magnum/Test/FramebufferGLTest.cpp

@ -56,7 +56,6 @@ struct FramebufferGLTest: OpenGLTester {
explicit FramebufferGLTest();
void construct();
void constructNoCreate();
void constructCopy();
void constructMove();
void wrap();
@ -150,7 +149,6 @@ struct FramebufferGLTest: OpenGLTester {
FramebufferGLTest::FramebufferGLTest() {
addTests({&FramebufferGLTest::construct,
&FramebufferGLTest::constructNoCreate,
&FramebufferGLTest::constructCopy,
&FramebufferGLTest::constructMove,
&FramebufferGLTest::wrap,
@ -264,17 +262,6 @@ void FramebufferGLTest::construct() {
MAGNUM_VERIFY_NO_ERROR();
}
void FramebufferGLTest::constructNoCreate() {
{
Framebuffer framebuffer{NoCreate};
MAGNUM_VERIFY_NO_ERROR();
CORRADE_COMPARE(framebuffer.id(), 0);
}
MAGNUM_VERIFY_NO_ERROR();
}
void FramebufferGLTest::constructCopy() {
CORRADE_VERIFY(!(std::is_constructible<Framebuffer, const Framebuffer&>{}));
CORRADE_VERIFY(!(std::is_assignable<Framebuffer, const Framebuffer&>{}));

15
src/Magnum/Test/FramebufferTest.cpp

@ -33,11 +33,24 @@ namespace Magnum { namespace Test {
struct FramebufferTest: TestSuite::Tester {
explicit FramebufferTest();
void constructNoCreate();
void debugStatus();
};
FramebufferTest::FramebufferTest() {
addTests({&FramebufferTest::debugStatus});
addTests({&FramebufferTest::constructNoCreate,
&FramebufferTest::debugStatus});
}
void FramebufferTest::constructNoCreate() {
{
Framebuffer framebuffer{NoCreate};
CORRADE_COMPARE(framebuffer.id(), 0);
}
CORRADE_VERIFY(true);
}
void FramebufferTest::debugStatus() {

13
src/Magnum/Test/MeshGLTest.cpp

@ -48,7 +48,6 @@ struct MeshGLTest: OpenGLTester {
explicit MeshGLTest();
void construct();
void constructNoCreate();
void constructCopy();
void constructMove();
void wrap();
@ -141,7 +140,6 @@ struct MeshGLTest: OpenGLTester {
MeshGLTest::MeshGLTest() {
addTests({&MeshGLTest::construct,
&MeshGLTest::constructNoCreate,
&MeshGLTest::constructCopy,
&MeshGLTest::constructMove,
&MeshGLTest::wrap,
@ -251,17 +249,6 @@ void MeshGLTest::construct() {
MAGNUM_VERIFY_NO_ERROR();
}
void MeshGLTest::constructNoCreate() {
{
Mesh mesh{NoCreate};
MAGNUM_VERIFY_NO_ERROR();
CORRADE_COMPARE(mesh.id(), 0);
}
MAGNUM_VERIFY_NO_ERROR();
}
void MeshGLTest::constructCopy() {
CORRADE_VERIFY(!(std::is_constructible<Mesh, const Mesh&>{}));
CORRADE_VERIFY(!(std::is_assignable<Mesh, const Mesh&>{}));

15
src/Magnum/Test/MeshTest.cpp

@ -34,6 +34,8 @@ namespace Magnum { namespace Test {
struct MeshTest: TestSuite::Tester {
explicit MeshTest();
void constructNoCreate();
void indexSize();
void debugPrimitive();
@ -43,7 +45,9 @@ struct MeshTest: TestSuite::Tester {
};
MeshTest::MeshTest() {
addTests({&MeshTest::indexSize,
addTests({&MeshTest::constructNoCreate,
&MeshTest::indexSize,
&MeshTest::debugPrimitive,
&MeshTest::debugIndexType,
@ -51,6 +55,15 @@ MeshTest::MeshTest() {
&MeshTest::configurationIndexType});
}
void MeshTest::constructNoCreate() {
{
Mesh mesh{NoCreate};
CORRADE_COMPARE(mesh.id(), 0);
}
CORRADE_VERIFY(true);
}
void MeshTest::indexSize() {
CORRADE_COMPARE(Mesh::indexSize(Mesh::IndexType::UnsignedByte), 1);
CORRADE_COMPARE(Mesh::indexSize(Mesh::IndexType::UnsignedShort), 2);

28
src/Magnum/Test/MultisampleTextureGLTest.cpp

@ -41,9 +41,6 @@ struct MultisampleTextureGLTest: OpenGLTester {
void construct2D();
void construct2DArray();
void construct2DNoCreate();
void construct2DArrayNoCreate();
void wrap2D();
void wrap2DArray();
@ -67,9 +64,6 @@ MultisampleTextureGLTest::MultisampleTextureGLTest() {
addTests({&MultisampleTextureGLTest::construct2D,
&MultisampleTextureGLTest::construct2DArray,
&MultisampleTextureGLTest::construct2DNoCreate,
&MultisampleTextureGLTest::construct2DArrayNoCreate,
&MultisampleTextureGLTest::wrap2D,
&MultisampleTextureGLTest::wrap2DArray,
@ -108,17 +102,6 @@ void MultisampleTextureGLTest::construct2D() {
MAGNUM_VERIFY_NO_ERROR();
}
void MultisampleTextureGLTest::construct2DNoCreate() {
{
MultisampleTexture2D texture{NoCreate};
MAGNUM_VERIFY_NO_ERROR();
CORRADE_COMPARE(texture.id(), 0);
}
MAGNUM_VERIFY_NO_ERROR();
}
void MultisampleTextureGLTest::construct2DArray() {
#ifndef MAGNUM_TARGET_GLES
if(!Context::current().isExtensionSupported<Extensions::GL::ARB::texture_multisample>())
@ -138,17 +121,6 @@ void MultisampleTextureGLTest::construct2DArray() {
MAGNUM_VERIFY_NO_ERROR();
}
void MultisampleTextureGLTest::construct2DArrayNoCreate() {
{
MultisampleTexture2DArray texture{NoCreate};
MAGNUM_VERIFY_NO_ERROR();
CORRADE_COMPARE(texture.id(), 0);
}
MAGNUM_VERIFY_NO_ERROR();
}
void MultisampleTextureGLTest::wrap2D() {
#ifndef MAGNUM_TARGET_GLES
if(!Context::current().isExtensionSupported<Extensions::GL::ARB::texture_multisample>())

64
src/Magnum/Test/MultisampleTextureTest.cpp

@ -0,0 +1,64 @@
/*
This file is part of Magnum.
Copyright © 2010, 2011, 2012, 2013, 2014, 2015, 2016
Vladimír Vondruš <mosra@centrum.cz>
Permission is hereby granted, free of charge, to any person obtaining a
copy of this software and associated documentation files (the "Software"),
to deal in the Software without restriction, including without limitation
the rights to use, copy, modify, merge, publish, distribute, sublicense,
and/or sell copies of the Software, and to permit persons to whom the
Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included
in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
DEALINGS IN THE SOFTWARE.
*/
#include <Corrade/TestSuite/Tester.h>
#include "Magnum/MultisampleTexture.h"
namespace Magnum { namespace Test {
struct MultisampleTextureTest: TestSuite::Tester {
explicit MultisampleTextureTest();
void construct2DNoCreate();
void construct2DArrayNoCreate();
};
MultisampleTextureTest::MultisampleTextureTest() {
addTests({&MultisampleTextureTest::construct2DNoCreate,
&MultisampleTextureTest::construct2DArrayNoCreate});
}
void MultisampleTextureTest::construct2DNoCreate() {
{
MultisampleTexture2D texture{NoCreate};
CORRADE_COMPARE(texture.id(), 0);
}
CORRADE_VERIFY(true);
}
void MultisampleTextureTest::construct2DArrayNoCreate() {
{
MultisampleTexture2DArray texture{NoCreate};
CORRADE_COMPARE(texture.id(), 0);
}
CORRADE_VERIFY(true);
}
}}
CORRADE_TEST_MAIN(Magnum::Test::MultisampleTextureTest)

15
src/Magnum/Test/PrimitiveQueryGLTest.cpp

@ -45,7 +45,6 @@ namespace Magnum { namespace Test {
struct PrimitiveQueryGLTest: OpenGLTester {
explicit PrimitiveQueryGLTest();
void constructNoCreate();
void wrap();
#ifndef MAGNUM_TARGET_GLES
@ -59,8 +58,7 @@ struct PrimitiveQueryGLTest: OpenGLTester {
};
PrimitiveQueryGLTest::PrimitiveQueryGLTest() {
addTests({&PrimitiveQueryGLTest::constructNoCreate,
&PrimitiveQueryGLTest::wrap,
addTests({&PrimitiveQueryGLTest::wrap,
#ifndef MAGNUM_TARGET_GLES
&PrimitiveQueryGLTest::primitivesGenerated,
@ -73,17 +71,6 @@ PrimitiveQueryGLTest::PrimitiveQueryGLTest() {
});
}
void PrimitiveQueryGLTest::constructNoCreate() {
{
PrimitiveQuery query{NoCreate};
MAGNUM_VERIFY_NO_ERROR();
CORRADE_COMPARE(query.id(), 0);
}
MAGNUM_VERIFY_NO_ERROR();
}
void PrimitiveQueryGLTest::wrap() {
#ifndef MAGNUM_TARGET_GLES
if(!Context::current().isExtensionSupported<Extensions::GL::ARB::transform_feedback2>())

53
src/Magnum/Test/PrimitiveQueryTest.cpp

@ -0,0 +1,53 @@
/*
This file is part of Magnum.
Copyright © 2010, 2011, 2012, 2013, 2014, 2015, 2016
Vladimír Vondruš <mosra@centrum.cz>
Permission is hereby granted, free of charge, to any person obtaining a
copy of this software and associated documentation files (the "Software"),
to deal in the Software without restriction, including without limitation
the rights to use, copy, modify, merge, publish, distribute, sublicense,
and/or sell copies of the Software, and to permit persons to whom the
Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included
in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
DEALINGS IN THE SOFTWARE.
*/
#include <Corrade/TestSuite/Tester.h>
#include "Magnum/PrimitiveQuery.h"
namespace Magnum { namespace Test {
struct PrimitiveQueryTest: TestSuite::Tester {
explicit PrimitiveQueryTest();
void constructNoCreate();
};
PrimitiveQueryTest::PrimitiveQueryTest() {
addTests({&PrimitiveQueryTest::constructNoCreate});
}
void PrimitiveQueryTest::constructNoCreate() {
{
PrimitiveQuery query{NoCreate};
CORRADE_COMPARE(query.id(), 0);
}
CORRADE_VERIFY(true);
}
}}
CORRADE_TEST_MAIN(Magnum::Test::PrimitiveQueryTest)

13
src/Magnum/Test/RectangleTextureGLTest.cpp

@ -45,7 +45,6 @@ struct RectangleTextureGLTest: OpenGLTester {
explicit RectangleTextureGLTest();
void construct();
void constructNoCreate();
void wrap();
void bind();
@ -78,7 +77,6 @@ struct RectangleTextureGLTest: OpenGLTester {
RectangleTextureGLTest::RectangleTextureGLTest() {
addTests({&RectangleTextureGLTest::construct,
&RectangleTextureGLTest::constructNoCreate,
&RectangleTextureGLTest::wrap,
&RectangleTextureGLTest::bind,
@ -131,17 +129,6 @@ void RectangleTextureGLTest::construct() {
MAGNUM_VERIFY_NO_ERROR();
}
void RectangleTextureGLTest::constructNoCreate() {
{
RectangleTexture texture{NoCreate};
MAGNUM_VERIFY_NO_ERROR();
CORRADE_COMPARE(texture.id(), 0);
}
MAGNUM_VERIFY_NO_ERROR();
}
void RectangleTextureGLTest::wrap() {
if(!Context::current().isExtensionSupported<Extensions::GL::ARB::texture_rectangle>())
CORRADE_SKIP(Extensions::GL::ARB::texture_rectangle::string() + std::string(" is not supported."));

53
src/Magnum/Test/RectangleTextureTest.cpp

@ -0,0 +1,53 @@
/*
This file is part of Magnum.
Copyright © 2010, 2011, 2012, 2013, 2014, 2015, 2016
Vladimír Vondruš <mosra@centrum.cz>
Permission is hereby granted, free of charge, to any person obtaining a
copy of this software and associated documentation files (the "Software"),
to deal in the Software without restriction, including without limitation
the rights to use, copy, modify, merge, publish, distribute, sublicense,
and/or sell copies of the Software, and to permit persons to whom the
Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included
in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
DEALINGS IN THE SOFTWARE.
*/
#include <Corrade/TestSuite/Tester.h>
#include "Magnum/RectangleTexture.h"
namespace Magnum { namespace Test {
struct RectangleTextureTest: TestSuite::Tester {
explicit RectangleTextureTest();
void constructNoCreate();
};
RectangleTextureTest::RectangleTextureTest() {
addTests({&RectangleTextureTest::constructNoCreate});
}
void RectangleTextureTest::constructNoCreate() {
{
RectangleTexture texture{NoCreate};
CORRADE_COMPARE(texture.id(), 0);
}
CORRADE_VERIFY(true);
}
}}
CORRADE_TEST_MAIN(Magnum::Test::RectangleTextureTest)

13
src/Magnum/Test/RenderbufferGLTest.cpp

@ -36,7 +36,6 @@ struct RenderbufferGLTest: OpenGLTester {
explicit RenderbufferGLTest();
void construct();
void constructNoCreate();
void constructCopy();
void constructMove();
void wrap();
@ -49,7 +48,6 @@ struct RenderbufferGLTest: OpenGLTester {
RenderbufferGLTest::RenderbufferGLTest() {
addTests({&RenderbufferGLTest::construct,
&RenderbufferGLTest::constructNoCreate,
&RenderbufferGLTest::constructCopy,
&RenderbufferGLTest::constructMove,
&RenderbufferGLTest::wrap,
@ -76,17 +74,6 @@ void RenderbufferGLTest::construct() {
MAGNUM_VERIFY_NO_ERROR();
}
void RenderbufferGLTest::constructNoCreate() {
{
Renderbuffer renderbuffer{NoCreate};
MAGNUM_VERIFY_NO_ERROR();
CORRADE_COMPARE(renderbuffer.id(), 0);
}
MAGNUM_VERIFY_NO_ERROR();
}
void RenderbufferGLTest::constructCopy() {
CORRADE_VERIFY(!(std::is_constructible<Renderbuffer, const Renderbuffer&>{}));
CORRADE_VERIFY(!(std::is_assignable<Renderbuffer, const Renderbuffer&>{}));

53
src/Magnum/Test/RenderbufferTest.cpp

@ -0,0 +1,53 @@
/*
This file is part of Magnum.
Copyright © 2010, 2011, 2012, 2013, 2014, 2015, 2016
Vladimír Vondruš <mosra@centrum.cz>
Permission is hereby granted, free of charge, to any person obtaining a
copy of this software and associated documentation files (the "Software"),
to deal in the Software without restriction, including without limitation
the rights to use, copy, modify, merge, publish, distribute, sublicense,
and/or sell copies of the Software, and to permit persons to whom the
Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included
in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
DEALINGS IN THE SOFTWARE.
*/
#include <Corrade/TestSuite/Tester.h>
#include "Magnum/Renderbuffer.h"
namespace Magnum { namespace Test {
struct RenderbufferTest: TestSuite::Tester {
explicit RenderbufferTest();
void constructNoCreate();
};
RenderbufferTest::RenderbufferTest() {
addTests({&RenderbufferTest::constructNoCreate});
}
void RenderbufferTest::constructNoCreate() {
{
Renderbuffer renderbuffer{NoCreate};
CORRADE_COMPARE(renderbuffer.id(), 0);
}
CORRADE_VERIFY(true);
}
}}
CORRADE_TEST_MAIN(Magnum::Test::RenderbufferTest)

15
src/Magnum/Test/SampleQueryGLTest.cpp

@ -43,7 +43,6 @@ namespace Magnum { namespace Test {
struct SampleQueryGLTest: OpenGLTester {
explicit SampleQueryGLTest();
void constructNoCreate();
void wrap();
void querySamplesPassed();
@ -53,8 +52,7 @@ struct SampleQueryGLTest: OpenGLTester {
};
SampleQueryGLTest::SampleQueryGLTest() {
addTests({&SampleQueryGLTest::constructNoCreate,
&SampleQueryGLTest::wrap,
addTests({&SampleQueryGLTest::wrap,
&SampleQueryGLTest::querySamplesPassed,
#ifndef MAGNUM_TARGET_GLES
@ -63,17 +61,6 @@ SampleQueryGLTest::SampleQueryGLTest() {
});
}
void SampleQueryGLTest::constructNoCreate() {
{
SampleQuery query{NoCreate};
MAGNUM_VERIFY_NO_ERROR();
CORRADE_COMPARE(query.id(), 0);
}
MAGNUM_VERIFY_NO_ERROR();
}
void SampleQueryGLTest::wrap() {
#ifdef MAGNUM_TARGET_GLES2
if(!Context::current().isExtensionSupported<Extensions::GL::EXT::occlusion_query_boolean>())

53
src/Magnum/Test/SampleQueryTest.cpp

@ -0,0 +1,53 @@
/*
This file is part of Magnum.
Copyright © 2010, 2011, 2012, 2013, 2014, 2015, 2016
Vladimír Vondruš <mosra@centrum.cz>
Permission is hereby granted, free of charge, to any person obtaining a
copy of this software and associated documentation files (the "Software"),
to deal in the Software without restriction, including without limitation
the rights to use, copy, modify, merge, publish, distribute, sublicense,
and/or sell copies of the Software, and to permit persons to whom the
Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included
in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
DEALINGS IN THE SOFTWARE.
*/
#include <Corrade/TestSuite/Tester.h>
#include "Magnum/SampleQuery.h"
namespace Magnum { namespace Test {
struct SampleQueryTest: TestSuite::Tester {
explicit SampleQueryTest();
void constructNoCreate();
};
SampleQueryTest::SampleQueryTest() {
addTests({&SampleQueryTest::constructNoCreate});
}
void SampleQueryTest::constructNoCreate() {
{
SampleQuery query{NoCreate};
CORRADE_COMPARE(query.id(), 0);
}
CORRADE_VERIFY(true);
}
}}
CORRADE_TEST_MAIN(Magnum::Test::SampleQueryTest)

26
src/Magnum/Test/TextureArrayGLTest.cpp

@ -44,10 +44,8 @@ struct TextureArrayGLTest: OpenGLTester {
#ifndef MAGNUM_TARGET_GLES
void construct1D();
void construct1DNoCreate();
#endif
void construct2D();
void construct2DNoCreate();
#ifndef MAGNUM_TARGET_GLES
void wrap1D();
@ -166,10 +164,8 @@ TextureArrayGLTest::TextureArrayGLTest() {
addTests({
#ifndef MAGNUM_TARGET_GLES
&TextureArrayGLTest::construct1D,
&TextureArrayGLTest::construct1DNoCreate,
#endif
&TextureArrayGLTest::construct2D,
&TextureArrayGLTest::construct2DNoCreate,
#ifndef MAGNUM_TARGET_GLES
&TextureArrayGLTest::wrap1D,
@ -315,17 +311,6 @@ void TextureArrayGLTest::construct1D() {
MAGNUM_VERIFY_NO_ERROR();
}
void TextureArrayGLTest::construct1DNoCreate() {
{
Texture1DArray texture{NoCreate};
MAGNUM_VERIFY_NO_ERROR();
CORRADE_COMPARE(texture.id(), 0);
}
MAGNUM_VERIFY_NO_ERROR();
}
#endif
void TextureArrayGLTest::construct2D() {
@ -344,17 +329,6 @@ void TextureArrayGLTest::construct2D() {
MAGNUM_VERIFY_NO_ERROR();
}
void TextureArrayGLTest::construct2DNoCreate() {
{
Texture2DArray texture{NoCreate};
MAGNUM_VERIFY_NO_ERROR();
CORRADE_COMPARE(texture.id(), 0);
}
MAGNUM_VERIFY_NO_ERROR();
}
#ifndef MAGNUM_TARGET_GLES
void TextureArrayGLTest::wrap1D() {
GLuint id;

71
src/Magnum/Test/TextureArrayTest.cpp

@ -0,0 +1,71 @@
/*
This file is part of Magnum.
Copyright © 2010, 2011, 2012, 2013, 2014, 2015, 2016
Vladimír Vondruš <mosra@centrum.cz>
Permission is hereby granted, free of charge, to any person obtaining a
copy of this software and associated documentation files (the "Software"),
to deal in the Software without restriction, including without limitation
the rights to use, copy, modify, merge, publish, distribute, sublicense,
and/or sell copies of the Software, and to permit persons to whom the
Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included
in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
DEALINGS IN THE SOFTWARE.
*/
#include <Corrade/TestSuite/Tester.h>
#include "Magnum/TextureArray.h"
namespace Magnum { namespace Test {
struct TextureArrayTest: TestSuite::Tester {
explicit TextureArrayTest();
#ifndef MAGNUM_TARGET_GLES
void construct1DNoCreate();
#endif
void construct2DNoCreate();
};
TextureArrayTest::TextureArrayTest() {
addTests({
#ifndef MAGNUM_TARGET_GLES
&TextureArrayTest::construct1DNoCreate,
#endif
&TextureArrayTest::construct2DNoCreate});
}
#ifndef MAGNUM_TARGET_GLES
void TextureArrayTest::construct1DNoCreate() {
{
Texture1DArray texture{NoCreate};
CORRADE_COMPARE(texture.id(), 0);
}
CORRADE_VERIFY(true);
}
#endif
void TextureArrayTest::construct2DNoCreate() {
{
Texture2DArray texture{NoCreate};
CORRADE_COMPARE(texture.id(), 0);
}
CORRADE_VERIFY(true);
}
}}
CORRADE_TEST_MAIN(Magnum::Test::TextureArrayTest)

39
src/Magnum/Test/TextureGLTest.cpp

@ -48,12 +48,9 @@ struct TextureGLTest: OpenGLTester {
#ifndef MAGNUM_TARGET_GLES
void construct1D();
void construct1DNoCreate();
#endif
void construct2D();
void construct2DNoCreate();
void construct3D();
void construct3DNoCreate();
#ifndef MAGNUM_TARGET_GLES
void wrap1D();
@ -211,12 +208,9 @@ TextureGLTest::TextureGLTest() {
addTests({
#ifndef MAGNUM_TARGET_GLES
&TextureGLTest::construct1D,
&TextureGLTest::construct1DNoCreate,
#endif
&TextureGLTest::construct2D,
&TextureGLTest::construct2DNoCreate,
&TextureGLTest::construct3D,
&TextureGLTest::construct3DNoCreate,
#ifndef MAGNUM_TARGET_GLES
&TextureGLTest::wrap1D,
@ -415,17 +409,6 @@ void TextureGLTest::construct1D() {
MAGNUM_VERIFY_NO_ERROR();
}
void TextureGLTest::construct1DNoCreate() {
{
Texture1D texture{NoCreate};
MAGNUM_VERIFY_NO_ERROR();
CORRADE_COMPARE(texture.id(), 0);
}
MAGNUM_VERIFY_NO_ERROR();
}
#endif
void TextureGLTest::construct2D() {
@ -439,17 +422,6 @@ void TextureGLTest::construct2D() {
MAGNUM_VERIFY_NO_ERROR();
}
void TextureGLTest::construct2DNoCreate() {
{
Texture2D texture{NoCreate};
MAGNUM_VERIFY_NO_ERROR();
CORRADE_COMPARE(texture.id(), 0);
}
MAGNUM_VERIFY_NO_ERROR();
}
void TextureGLTest::construct3D() {
#ifdef MAGNUM_TARGET_GLES2
if(!Context::current().isExtensionSupported<Extensions::GL::OES::texture_3D>())
@ -466,17 +438,6 @@ void TextureGLTest::construct3D() {
MAGNUM_VERIFY_NO_ERROR();
}
void TextureGLTest::construct3DNoCreate() {
{
Texture3D texture{NoCreate};
MAGNUM_VERIFY_NO_ERROR();
CORRADE_COMPARE(texture.id(), 0);
}
MAGNUM_VERIFY_NO_ERROR();
}
#ifndef MAGNUM_TARGET_GLES
void TextureGLTest::wrap1D() {
GLuint id;

89
src/Magnum/Test/TextureTest.cpp

@ -0,0 +1,89 @@
/*
This file is part of Magnum.
Copyright © 2010, 2011, 2012, 2013, 2014, 2015, 2016
Vladimír Vondruš <mosra@centrum.cz>
Permission is hereby granted, free of charge, to any person obtaining a
copy of this software and associated documentation files (the "Software"),
to deal in the Software without restriction, including without limitation
the rights to use, copy, modify, merge, publish, distribute, sublicense,
and/or sell copies of the Software, and to permit persons to whom the
Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included
in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
DEALINGS IN THE SOFTWARE.
*/
#include <Corrade/TestSuite/Tester.h>
#include "Magnum/Texture.h"
namespace Magnum { namespace Test {
struct TextureTest: TestSuite::Tester {
explicit TextureTest();
#ifndef MAGNUM_TARGET_GLES
void construct1DNoCreate();
#endif
void construct2DNoCreate();
#if !(defined(MAGNUM_TARGET_WEBGL) && defined(MAGNUM_TARGET_GLES2))
void construct3DNoCreate();
#endif
};
TextureTest::TextureTest() {
addTests({
#ifndef MAGNUM_TARGET_GLES
&TextureTest::construct1DNoCreate,
#endif
&TextureTest::construct2DNoCreate,
#if !(defined(MAGNUM_TARGET_WEBGL) && defined(MAGNUM_TARGET_GLES2))
&TextureTest::construct3DNoCreate
#endif
});
}
#ifndef MAGNUM_TARGET_GLES
void TextureTest::construct1DNoCreate() {
{
Texture1D texture{NoCreate};
CORRADE_COMPARE(texture.id(), 0);
}
CORRADE_VERIFY(true);
}
#endif
void TextureTest::construct2DNoCreate() {
{
Texture2D texture{NoCreate};
CORRADE_COMPARE(texture.id(), 0);
}
CORRADE_VERIFY(true);
}
#if !(defined(MAGNUM_TARGET_WEBGL) && defined(MAGNUM_TARGET_GLES2))
void TextureTest::construct3DNoCreate() {
{
Texture3D texture{NoCreate};
CORRADE_COMPARE(texture.id(), 0);
}
CORRADE_VERIFY(true);
}
#endif
}}
CORRADE_TEST_MAIN(Magnum::Test::TextureTest)

15
src/Magnum/Test/TimeQueryGLTest.cpp

@ -35,7 +35,6 @@ namespace Magnum { namespace Test {
struct TimeQueryGLTest: OpenGLTester {
explicit TimeQueryGLTest();
void constructNoCreate();
void wrap();
void queryTime();
@ -43,24 +42,12 @@ struct TimeQueryGLTest: OpenGLTester {
};
TimeQueryGLTest::TimeQueryGLTest() {
addTests({&TimeQueryGLTest::constructNoCreate,
&TimeQueryGLTest::wrap,
addTests({&TimeQueryGLTest::wrap,
&TimeQueryGLTest::queryTime,
&TimeQueryGLTest::queryTimestamp});
}
void TimeQueryGLTest::constructNoCreate() {
{
TimeQuery query{NoCreate};
MAGNUM_VERIFY_NO_ERROR();
CORRADE_COMPARE(query.id(), 0);
}
MAGNUM_VERIFY_NO_ERROR();
}
void TimeQueryGLTest::wrap() {
#ifndef MAGNUM_TARGET_GLES
if(!Context::current().isExtensionSupported<Extensions::GL::ARB::timer_query>())

53
src/Magnum/Test/TimeQueryTest.cpp

@ -0,0 +1,53 @@
/*
This file is part of Magnum.
Copyright © 2010, 2011, 2012, 2013, 2014, 2015, 2016
Vladimír Vondruš <mosra@centrum.cz>
Permission is hereby granted, free of charge, to any person obtaining a
copy of this software and associated documentation files (the "Software"),
to deal in the Software without restriction, including without limitation
the rights to use, copy, modify, merge, publish, distribute, sublicense,
and/or sell copies of the Software, and to permit persons to whom the
Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included
in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
DEALINGS IN THE SOFTWARE.
*/
#include <Corrade/TestSuite/Tester.h>
#include "Magnum/TimeQuery.h"
namespace Magnum { namespace Test {
struct TimeQueryTest: TestSuite::Tester {
explicit TimeQueryTest();
void constructNoCreate();
};
TimeQueryTest::TimeQueryTest() {
addTests({&TimeQueryTest::constructNoCreate});
}
void TimeQueryTest::constructNoCreate() {
{
TimeQuery query{NoCreate};
CORRADE_COMPARE(query.id(), 0);
}
CORRADE_VERIFY(true);
}
}}
CORRADE_TEST_MAIN(Magnum::Test::TimeQueryTest)

13
src/Magnum/Test/TransformFeedbackGLTest.cpp

@ -46,7 +46,6 @@ struct TransformFeedbackGLTest: OpenGLTester {
explicit TransformFeedbackGLTest();
void construct();
void constructNoCreate();
void constructCopy();
void constructMove();
void wrap();
@ -87,7 +86,6 @@ const struct {
TransformFeedbackGLTest::TransformFeedbackGLTest() {
addTests({&TransformFeedbackGLTest::construct,
&TransformFeedbackGLTest::constructNoCreate,
&TransformFeedbackGLTest::constructCopy,
&TransformFeedbackGLTest::constructMove,
&TransformFeedbackGLTest::wrap,
@ -125,17 +123,6 @@ void TransformFeedbackGLTest::construct() {
MAGNUM_VERIFY_NO_ERROR();
}
void TransformFeedbackGLTest::constructNoCreate() {
{
TransformFeedback feedback{NoCreate};
MAGNUM_VERIFY_NO_ERROR();
CORRADE_COMPARE(feedback.id(), 0);
}
MAGNUM_VERIFY_NO_ERROR();
}
void TransformFeedbackGLTest::constructCopy() {
CORRADE_VERIFY(!(std::is_constructible<TransformFeedback, const TransformFeedback&>{}));
CORRADE_VERIFY(!(std::is_assignable<TransformFeedback, const TransformFeedback&>{}));

53
src/Magnum/Test/TransformFeedbackTest.cpp

@ -0,0 +1,53 @@
/*
This file is part of Magnum.
Copyright © 2010, 2011, 2012, 2013, 2014, 2015, 2016
Vladimír Vondruš <mosra@centrum.cz>
Permission is hereby granted, free of charge, to any person obtaining a
copy of this software and associated documentation files (the "Software"),
to deal in the Software without restriction, including without limitation
the rights to use, copy, modify, merge, publish, distribute, sublicense,
and/or sell copies of the Software, and to permit persons to whom the
Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included
in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
DEALINGS IN THE SOFTWARE.
*/
#include <Corrade/TestSuite/Tester.h>
#include "Magnum/TransformFeedback.h"
namespace Magnum { namespace Test {
struct TransformFeedbackTest: TestSuite::Tester {
explicit TransformFeedbackTest();
void constructNoCreate();
};
TransformFeedbackTest::TransformFeedbackTest() {
addTests({&TransformFeedbackTest::constructNoCreate});
}
void TransformFeedbackTest::constructNoCreate() {
{
TransformFeedback xfb{NoCreate};
CORRADE_COMPARE(xfb.id(), 0);
}
CORRADE_VERIFY(true);
}
}}
CORRADE_TEST_MAIN(Magnum::Test::TransformFeedbackTest)

3
src/Magnum/Texture.h

@ -190,6 +190,9 @@ template<UnsignedInt dimensions> class Texture: public AbstractTexture {
* The constructed instance is equivalent to moved-from state. Useful
* in cases where you will overwrite the instance later anyway. Move
* another object over it to make it useful.
*
* This function can be safely used for constructing (and later
* destructing) objects even without any OpenGL context being active.
* @see @ref Texture(), @ref wrap()
*/
explicit Texture(NoCreateT) noexcept: AbstractTexture{NoCreate, Implementation::textureTarget<dimensions>()} {}

3
src/Magnum/TextureArray.h

@ -173,6 +173,9 @@ template<UnsignedInt dimensions> class TextureArray: public AbstractTexture {
* The constructed instance is equivalent to moved-from state. Useful
* in cases where you will overwrite the instance later anyway. Move
* another object over it to make it useful.
*
* This function can be safely used for constructing (and later
* destructing) objects even without any OpenGL context being active.
* @see @ref TextureArray(), @ref wrap()
*/
explicit TextureArray(NoCreateT) noexcept: AbstractTexture{NoCreate, Implementation::textureArrayTarget<dimensions>()} {}

3
src/Magnum/TimeQuery.h

@ -145,6 +145,9 @@ class TimeQuery: public AbstractQuery {
* The constructed instance is equivalent to moved-from state. Useful
* in cases where you will overwrite the instance later anyway. Move
* another object over it to make it useful.
*
* This function can be safely used for constructing (and later
* destructing) objects even without any OpenGL context being active.
* @see @ref TimeQuery(Target), @ref wrap()
*/
explicit TimeQuery(NoCreateT) noexcept: AbstractQuery{NoCreate, GLenum(Target::TimeElapsed)} {}

3
src/Magnum/TransformFeedback.h

@ -194,6 +194,9 @@ class MAGNUM_EXPORT TransformFeedback: public AbstractObject {
* The constructed instance is equivalent to moved-from state. Useful
* in cases where you will overwrite the instance later anyway. Move
* another object over it to make it useful.
*
* This function can be safely used for constructing (and later
* destructing) objects even without any OpenGL context being active.
* @see @ref TransformFeedback(), @ref wrap()
*/
explicit TransformFeedback(NoCreateT) noexcept: _id{0}, _flags{ObjectFlag::DeleteOnDestruction} {}

Loading…
Cancel
Save