Browse Source

Print value of invalid enums in debug output, test those cases.

pull/165/merge
Vladimír Vondruš 10 years ago
parent
commit
7d8b2ce9a6
  1. 26
      src/Magnum/Attribute.cpp
  2. 2
      src/Magnum/Audio/Buffer.cpp
  3. 2
      src/Magnum/Audio/Context.cpp
  4. 4
      src/Magnum/Audio/Renderer.cpp
  5. 2
      src/Magnum/Audio/Source.cpp
  6. 4
      src/Magnum/Audio/Test/BufferTest.cpp
  7. 13
      src/Magnum/Audio/Test/ContextTest.cpp
  8. 37
      src/Magnum/Audio/Test/RendererTest.cpp
  9. 19
      src/Magnum/Audio/Test/SourceTest.cpp
  10. 4
      src/Magnum/Buffer.cpp
  11. 2
      src/Magnum/Context.cpp
  12. 12
      src/Magnum/DebugOutput.cpp
  13. 2
      src/Magnum/DefaultFramebuffer.cpp
  14. 2
      src/Magnum/Framebuffer.cpp
  15. 4
      src/Magnum/Mesh.cpp
  16. 6
      src/Magnum/PixelFormat.cpp
  17. 6
      src/Magnum/Renderer.cpp
  18. 2
      src/Magnum/Resource.cpp
  19. 12
      src/Magnum/Sampler.cpp
  20. 2
      src/Magnum/SceneGraph/Animable.cpp
  21. 4
      src/Magnum/SceneGraph/Test/AnimableTest.cpp
  22. 2
      src/Magnum/Shader.cpp
  23. 8
      src/Magnum/Shapes/Test/ShapeImplementationTest.cpp
  24. 4
      src/Magnum/Shapes/shapeImplementation.cpp
  25. 215
      src/Magnum/Test/AttributeTest.cpp
  26. 67
      src/Magnum/Test/BufferTest.cpp
  27. 3
      src/Magnum/Test/CMakeLists.txt
  28. 4
      src/Magnum/Test/ContextTest.cpp
  29. 24
      src/Magnum/Test/DebugOutputTest.cpp
  30. 4
      src/Magnum/Test/DefaultFramebufferTest.cpp
  31. 12
      src/Magnum/Test/FormatTest.cpp
  32. 4
      src/Magnum/Test/FramebufferTest.cpp
  33. 8
      src/Magnum/Test/MeshTest.cpp
  34. 12
      src/Magnum/Test/RendererTest.cpp
  35. 4
      src/Magnum/Test/ResourceManagerTest.cpp
  36. 24
      src/Magnum/Test/SamplerTest.cpp
  37. 4
      src/Magnum/Test/ShaderTest.cpp
  38. 2
      src/Magnum/Trade/AbstractMaterialData.cpp
  39. 2
      src/Magnum/Trade/ObjectData2D.cpp
  40. 2
      src/Magnum/Trade/ObjectData3D.cpp
  41. 2
      src/Magnum/Trade/Test/CMakeLists.txt
  42. 20
      src/Magnum/Trade/Test/MaterialDataTest.cpp
  43. 4
      src/Magnum/Trade/Test/ObjectData2DTest.cpp
  44. 4
      src/Magnum/Trade/Test/ObjectData3DTest.cpp
  45. 4
      src/Magnum/Trade/Test/TextureDataTest.cpp
  46. 2
      src/Magnum/Trade/TextureData.cpp

26
src/Magnum/Attribute.cpp

@ -147,7 +147,7 @@ Debug& operator<<(Debug& debug, SizedAttribute<1, 1>::Components value) {
/* LCOV_EXCL_STOP */
}
return debug << "Attribute::Components::(invalid)";
return debug << "Attribute::Components(" << Debug::nospace << reinterpret_cast<void*>(GLint(value)) << Debug::nospace << ")";
}
Debug& operator<<(Debug& debug, SizedAttribute<1, 2>::Components value) {
@ -160,7 +160,7 @@ Debug& operator<<(Debug& debug, SizedAttribute<1, 2>::Components value) {
/* LCOV_EXCL_STOP */
}
return debug << "Attribute::Components::(invalid)";
return debug << "Attribute::Components(" << Debug::nospace << reinterpret_cast<void*>(GLint(value)) << Debug::nospace << ")";
}
Debug& operator<<(Debug& debug, SizedAttribute<1, 3>::Components value) {
@ -175,7 +175,7 @@ Debug& operator<<(Debug& debug, SizedAttribute<1, 3>::Components value) {
/* LCOV_EXCL_STOP */
}
return debug << "Attribute::Components::(invalid)";
return debug << "Attribute::Components(" << Debug::nospace << reinterpret_cast<void*>(GLint(value)) << Debug::nospace << ")";
}
Debug& operator<<(Debug& debug, SizedAttribute<1, 4>::Components value) {
@ -192,7 +192,7 @@ Debug& operator<<(Debug& debug, SizedAttribute<1, 4>::Components value) {
/* LCOV_EXCL_STOP */
}
return debug << "Attribute::Components::(invalid)";
return debug << "Attribute::Components(" << Debug::nospace << reinterpret_cast<void*>(GLint(value)) << Debug::nospace << ")";
}
Debug& operator<<(Debug& debug, SizedMatrixAttribute<2>::Components value) {
@ -203,7 +203,7 @@ Debug& operator<<(Debug& debug, SizedMatrixAttribute<2>::Components value) {
/* LCOV_EXCL_STOP */
}
return debug << "Attribute::Components::(invalid)";
return debug << "Attribute::Components(" << Debug::nospace << reinterpret_cast<void*>(GLint(value)) << Debug::nospace << ")";
}
Debug& operator<<(Debug& debug, SizedMatrixAttribute<3>::Components value) {
@ -214,7 +214,7 @@ Debug& operator<<(Debug& debug, SizedMatrixAttribute<3>::Components value) {
/* LCOV_EXCL_STOP */
}
return debug << "Attribute::Components::(invalid)";
return debug << "Attribute::Components(" << Debug::nospace << reinterpret_cast<void*>(GLint(value)) << Debug::nospace << ")";
}
Debug& operator<<(Debug& debug, SizedMatrixAttribute<4>::Components value) {
@ -225,7 +225,7 @@ Debug& operator<<(Debug& debug, SizedMatrixAttribute<4>::Components value) {
/* LCOV_EXCL_STOP */
}
return debug << "Attribute::Components::(invalid)";
return debug << "Attribute::Components(" << Debug::nospace << reinterpret_cast<void*>(GLint(value)) << Debug::nospace << ")";
}
Debug& operator<<(Debug& debug, Attribute<Math::Vector<4, Float>>::Components value) {
@ -246,7 +246,7 @@ Debug& operator<<(Debug& debug, Attribute<Math::Vector<4, Float>>::Components va
/* LCOV_EXCL_STOP */
}
return debug << "Attribute::Components::(invalid)";
return debug << "Attribute::Components(" << Debug::nospace << reinterpret_cast<void*>(GLint(value)) << Debug::nospace << ")";
}
Debug& operator<<(Debug& debug, FloatAttribute::DataType value) {
@ -268,7 +268,7 @@ Debug& operator<<(Debug& debug, FloatAttribute::DataType value) {
/* LCOV_EXCL_STOP */
}
return debug << "Attribute::DataType::(invalid)";
return debug << "Attribute::DataType(" << Debug::nospace << reinterpret_cast<void*>(GLenum(value)) << Debug::nospace << ")";
}
#ifndef MAGNUM_TARGET_GLES2
@ -286,7 +286,7 @@ Debug& operator<<(Debug& debug, IntAttribute::DataType value) {
/* LCOV_EXCL_STOP */
}
return debug << "Attribute::DataType::(invalid)";
return debug << "Attribute::DataType(" << Debug::nospace << reinterpret_cast<void*>(GLenum(value)) << Debug::nospace << ")";
}
#endif
@ -300,7 +300,7 @@ Debug& operator<<(Debug& debug, DoubleAttribute::DataType value) {
/* LCOV_EXCL_STOP */
}
return debug << "Attribute::DataType::(invalid)";
return debug << "Attribute::DataType(" << Debug::nospace << reinterpret_cast<void*>(GLenum(value)) << Debug::nospace << ")";
}
#endif
@ -324,7 +324,7 @@ Debug& operator<<(Debug& debug, Attribute<Math::Vector<3, Float>>::DataType valu
/* LCOV_EXCL_STOP */
}
return debug << "Attribute::DataType::(invalid)";
return debug << "Attribute::DataType(" << Debug::nospace << reinterpret_cast<void*>(GLenum(value)) << Debug::nospace << ")";
}
Debug& operator<<(Debug& debug, Attribute<Math::Vector<4, Float>>::DataType value) {
@ -350,7 +350,7 @@ Debug& operator<<(Debug& debug, Attribute<Math::Vector<4, Float>>::DataType valu
/* LCOV_EXCL_STOP */
}
return debug << "Attribute::DataType::(invalid)";
return debug << "Attribute::DataType(" << Debug::nospace << reinterpret_cast<void*>(GLenum(value)) << Debug::nospace << ")";
}
}}

2
src/Magnum/Audio/Buffer.cpp

@ -46,7 +46,7 @@ Debug& operator<<(Debug& debug, const Buffer::Format value) {
/* LCOV_EXCL_STOP */
}
return debug << "Audio::Buffer::Format::(invalid)";
return debug << "Audio::Buffer::Format(" << Debug::nospace << reinterpret_cast<void*>(ALenum(value)) << Debug::nospace << ")";
}
}}

2
src/Magnum/Audio/Context.cpp

@ -67,7 +67,7 @@ Debug& operator<<(Debug& debug, const Context::HrtfStatus value) {
/* LCOV_EXCL_STOP */
}
return debug << "Audio::Context::HrtfStatus::(invalid)";
return debug << "Audio::Context::HrtfStatus(" << Debug::nospace << reinterpret_cast<void*>(ALenum(value)) << Debug::nospace << ")";
}
Context* Context::_current = nullptr;

4
src/Magnum/Audio/Renderer.cpp

@ -43,7 +43,7 @@ Debug& operator<<(Debug& debug, const Renderer::Error value) {
/* LCOV_EXCL_STOP */
}
return debug << "Audio::Renderer::Error::(invalid)";
return debug << "Audio::Renderer::Error(" << Debug::nospace << reinterpret_cast<void*>(ALenum(value)) << Debug::nospace << ")";
}
Debug& operator<<(Debug& debug, const Renderer::DistanceModel value) {
@ -61,7 +61,7 @@ Debug& operator<<(Debug& debug, const Renderer::DistanceModel value) {
/* LCOV_EXCL_STOP */
}
return debug << "Audio::Renderer::DistanceModel::(invalid)";
return debug << "Audio::Renderer::DistanceModel(" << Debug::nospace << reinterpret_cast<void*>(ALenum(value)) << Debug::nospace << ")";
}
}}

2
src/Magnum/Audio/Source.cpp

@ -108,7 +108,7 @@ Debug& operator<<(Debug& debug, const Source::State value) {
/* LCOV_EXCL_STOP */
}
return debug << "Audio::Source::State::(invalid)";
return debug << "Audio::Source::State(" << Debug::nospace << reinterpret_cast<void*>(ALint(value)) << Debug::nospace << ")";
}
}}

4
src/Magnum/Audio/Test/BufferTest.cpp

@ -52,8 +52,8 @@ void BufferTest::construct() {
void BufferTest::debugFormat() {
std::ostringstream out;
Debug(&out) << Buffer::Format::Stereo16;
CORRADE_COMPARE(out.str(), "Audio::Buffer::Format::Stereo16\n");
Debug(&out) << Buffer::Format::Stereo16 << Buffer::Format(0xdead);
CORRADE_COMPARE(out.str(), "Audio::Buffer::Format::Stereo16 Audio::Buffer::Format(0xdead)\n");
}
}}}

13
src/Magnum/Audio/Test/ContextTest.cpp

@ -37,8 +37,8 @@ struct ContextTest: TestSuite::Tester {
void extensionsString();
void isExtensionEnabled();
void hrtfStatus();
void hrtfs();
void debugHrtfStatus();
Context _context;
};
@ -46,7 +46,8 @@ struct ContextTest: TestSuite::Tester {
ContextTest::ContextTest() {
addTests({&ContextTest::extensionsString,
&ContextTest::isExtensionEnabled,
&ContextTest::hrtfStatus});
&ContextTest::debugHrtfStatus});
}
void ContextTest::extensionsString() {
@ -59,10 +60,10 @@ void ContextTest::isExtensionEnabled() {
CORRADE_VERIFY(Context::current().isExtensionSupported<Extensions::ALC::EXT::ENUMERATION>());
}
void ContextTest::hrtfStatus() {
void ContextTest::debugHrtfStatus() {
std::ostringstream out;
Debug(&out) << Context::HrtfStatus::Denied;
CORRADE_COMPARE(out.str(), "Audio::Context::HrtfStatus::Denied\n");
Debug(&out) << Context::HrtfStatus::Denied << Context::HrtfStatus(0xdead);
CORRADE_COMPARE(out.str(), "Audio::Context::HrtfStatus::Denied Audio::Context::HrtfStatus(0xdead)\n");
}
}}}

37
src/Magnum/Audio/Test/RendererTest.cpp

@ -34,9 +34,6 @@ namespace Magnum { namespace Audio { namespace Test {
struct RendererTest: TestSuite::Tester {
explicit RendererTest();
void debugError();
void debugDistanceModel();
void listenerOrientation();
void listenerPosition();
void listenerVelocity();
@ -45,31 +42,23 @@ struct RendererTest: TestSuite::Tester {
void dopplerFactor();
void distanceModel();
void debugError();
void debugDistanceModel();
Context _context;
};
RendererTest::RendererTest() {
addTests({&RendererTest::debugError,
&RendererTest::debugDistanceModel,
&RendererTest::listenerOrientation,
addTests({&RendererTest::listenerOrientation,
&RendererTest::listenerPosition,
&RendererTest::listenerVelocity,
&RendererTest::listenerGain,
&RendererTest::speedOfSound,
&RendererTest::dopplerFactor,
&RendererTest::distanceModel});
}
&RendererTest::distanceModel,
void RendererTest::debugError() {
std::ostringstream out;
Debug(&out) << Renderer::Error::InvalidOperation;
CORRADE_COMPARE(out.str(), "Audio::Renderer::Error::InvalidOperation\n");
}
void RendererTest::debugDistanceModel() {
std::ostringstream out;
Debug(&out) << Renderer::DistanceModel::Inverse;
CORRADE_COMPARE(out.str(), "Audio::Renderer::DistanceModel::Inverse\n");
&RendererTest::debugError,
&RendererTest::debugDistanceModel});
}
void RendererTest::listenerOrientation() {
@ -123,6 +112,18 @@ void RendererTest::distanceModel() {
CORRADE_COMPARE(Renderer::distanceModel(), model);
}
void RendererTest::debugError() {
std::ostringstream out;
Debug(&out) << Renderer::Error::InvalidOperation << Renderer::Error(0xdead);
CORRADE_COMPARE(out.str(), "Audio::Renderer::Error::InvalidOperation Audio::Renderer::Error(0xdead)\n");
}
void RendererTest::debugDistanceModel() {
std::ostringstream out;
Debug(&out) << Renderer::DistanceModel::Inverse << Renderer::DistanceModel(0xdead);
CORRADE_COMPARE(out.str(), "Audio::Renderer::DistanceModel::Inverse Audio::Renderer::DistanceModel(0xdead)\n");
}
}}}
CORRADE_TEST_MAIN(Magnum::Audio::Test::RendererTest)

19
src/Magnum/Audio/Test/SourceTest.cpp

@ -34,7 +34,6 @@ namespace Magnum { namespace Audio { namespace Test {
struct SourceTest: TestSuite::Tester {
explicit SourceTest();
void debugState();
void position();
void direction();
void velocity();
@ -47,12 +46,13 @@ struct SourceTest: TestSuite::Tester {
void coneAnglesAndGain();
void rolloffFactor();
void debugState();
Context _context;
};
SourceTest::SourceTest() {
addTests({&SourceTest::debugState,
&SourceTest::position,
addTests({&SourceTest::position,
&SourceTest::direction,
&SourceTest::velocity,
&SourceTest::gain,
@ -62,13 +62,9 @@ SourceTest::SourceTest() {
&SourceTest::maxGain,
&SourceTest::minGain,
&SourceTest::coneAnglesAndGain,
&SourceTest::rolloffFactor});
}
&SourceTest::rolloffFactor,
void SourceTest::debugState() {
std::ostringstream out;
Debug(&out) << Source::State::Playing;
CORRADE_COMPARE(out.str(), "Audio::Source::State::Playing\n");
&SourceTest::debugState});
}
void SourceTest::position() {
@ -168,6 +164,11 @@ void SourceTest::rolloffFactor() {
CORRADE_COMPARE(source.rolloffFactor(), fact);
}
void SourceTest::debugState() {
std::ostringstream out;
Debug(&out) << Source::State::Playing << Source::State(0xdead);
CORRADE_COMPARE(out.str(), "Audio::Source::State::Playing Audio::Source::State(0xdead)\n");
}
}}}

4
src/Magnum/Buffer.cpp

@ -657,7 +657,7 @@ Debug& operator<<(Debug& debug, Buffer::TargetHint value) {
/* LCOV_EXCL_STOP */
}
return debug << "Buffer::TargetHint::(invalid)";
return debug << "Buffer::TargetHint(" << Debug::nospace << reinterpret_cast<void*>(GLenum(value)) << Debug::nospace << ")";
}
#endif
@ -700,7 +700,7 @@ Debug& operator<<(Debug& debug, Buffer::Target value) {
#endif
}
return debug << "Buffer::Target::(invalid)";
return debug << "Buffer::Target(" << Debug::nospace << reinterpret_cast<void*>(GLenum(value)) << Debug::nospace << ")";
}
#endif
#endif

2
src/Magnum/Context.cpp

@ -841,7 +841,7 @@ Debug& operator<<(Debug& debug, const Context::Flag value) {
/* LCOV_EXCL_STOP */
}
return debug << "Context::Flag::(invalid)";
return debug << "Context::Flag(" << Debug::nospace << reinterpret_cast<void*>(GLint(value)) << Debug::nospace << ")";
}
#endif
#endif

12
src/Magnum/DebugOutput.cpp

@ -239,7 +239,7 @@ Debug& operator<<(Debug& debug, const DebugOutput::Source value) {
/* LCOV_EXCL_STOP */
}
return debug << "DebugOutput::Source::(invalid)";
return debug << "DebugOutput::Source(" << Debug::nospace << reinterpret_cast<void*>(GLenum(value)) << Debug::nospace << ")";
}
Debug& operator<<(Debug& debug, const DebugOutput::Type value) {
@ -259,7 +259,7 @@ Debug& operator<<(Debug& debug, const DebugOutput::Type value) {
/* LCOV_EXCL_STOP */
}
return debug << "DebugOutput::Type::(invalid)";
return debug << "DebugOutput::Type(" << Debug::nospace << reinterpret_cast<void*>(GLenum(value)) << Debug::nospace << ")";
}
Debug& operator<<(Debug& debug, const DebugOutput::Severity value) {
@ -272,7 +272,7 @@ Debug& operator<<(Debug& debug, const DebugOutput::Severity value) {
#undef _c
}
return debug << "DebugOutput::Severity::(invalid)";
return debug << "DebugOutput::Severity(" << Debug::nospace << reinterpret_cast<void*>(GLenum(value)) << Debug::nospace << ")";
}
#endif
@ -333,7 +333,7 @@ Debug& operator<<(Debug& debug, const DebugMessage::Source value) {
/* LCOV_EXCL_STOP */
}
return debug << "DebugMessage::Source::(invalid)";
return debug << "DebugMessage::Source(" << Debug::nospace << reinterpret_cast<void*>(GLenum(value)) << Debug::nospace << ")";
}
Debug& operator<<(Debug& debug, const DebugMessage::Type value) {
@ -349,7 +349,7 @@ Debug& operator<<(Debug& debug, const DebugMessage::Type value) {
#undef _c
}
return debug << "DebugMessage::Type::(invalid)";
return debug << "DebugMessage::Type(" << Debug::nospace << reinterpret_cast<void*>(GLenum(value)) << Debug::nospace << ")";
}
#endif
@ -440,7 +440,7 @@ Debug& operator<<(Debug& debug, const DebugGroup::Source value) {
/* LCOV_EXCL_STOP */
}
return debug << "DebugGroup::Source::(invalid)";
return debug << "DebugGroup::Source(" << Debug::nospace << reinterpret_cast<void*>(GLenum(value)) << Debug::nospace << ")";
}
#endif

2
src/Magnum/DefaultFramebuffer.cpp

@ -127,7 +127,7 @@ Debug& operator<<(Debug& debug, const DefaultFramebuffer::Status value) {
/* LCOV_EXCL_STOP */
}
return debug << "DefaultFramebuffer::Status::(invalid)";
return debug << "DefaultFramebuffer::Status(" << Debug::nospace << reinterpret_cast<void*>(GLenum(value)) << Debug::nospace << ")";
}
#endif

2
src/Magnum/Framebuffer.cpp

@ -428,7 +428,7 @@ Debug& operator<<(Debug& debug, const Framebuffer::Status value) {
/* LCOV_EXCL_STOP */
}
return debug << "Framebuffer::Status::(invalid)";
return debug << "Framebuffer::Status(" << Debug::nospace << reinterpret_cast<void*>(GLenum(value)) << Debug::nospace << ")";
}
#endif

4
src/Magnum/Mesh.cpp

@ -659,7 +659,7 @@ Debug& operator<<(Debug& debug, MeshPrimitive value) {
/* LCOV_EXCL_STOP */
}
return debug << "MeshPrimitive::(invalid)";
return debug << "MeshPrimitive(" << Debug::nospace << reinterpret_cast<void*>(GLenum(value)) << Debug::nospace << ")";
}
Debug& operator<<(Debug& debug, Mesh::IndexType value) {
@ -673,7 +673,7 @@ Debug& operator<<(Debug& debug, Mesh::IndexType value) {
/* LCOV_EXCL_STOP */
}
return debug << "Mesh::IndexType::(invalid)";
return debug << "Mesh::IndexType(" << Debug::nospace << reinterpret_cast<void*>(GLenum(value)) << Debug::nospace << ")";
}
#endif

6
src/Magnum/PixelFormat.cpp

@ -81,7 +81,7 @@ Debug& operator<<(Debug& debug, const PixelFormat value) {
/* LCOV_EXCL_STOP */
}
return debug << "PixelFormat::(invalid)";
return debug << "PixelFormat(" << Debug::nospace << reinterpret_cast<void*>(GLenum(value)) << Debug::nospace << ")";
}
Debug& operator<<(Debug& debug, const PixelType value) {
@ -138,7 +138,7 @@ Debug& operator<<(Debug& debug, const PixelType value) {
/* LCOV_EXCL_STOP */
}
return debug << "PixelType::(invalid)";
return debug << "PixelType(" << Debug::nospace << reinterpret_cast<void*>(GLenum(value)) << Debug::nospace << ")";
}
Debug& operator<<(Debug& debug, const CompressedPixelFormat value) {
@ -209,7 +209,7 @@ Debug& operator<<(Debug& debug, const CompressedPixelFormat value) {
/* LCOV_EXCL_STOP */
}
return debug << "CompressedPixelFormat::(invalid)";
return debug << "CompressedPixelFormat(" << Debug::nospace << reinterpret_cast<void*>(GLenum(value)) << Debug::nospace << ")";
}
#endif

6
src/Magnum/Renderer.cpp

@ -257,7 +257,7 @@ Debug& operator<<(Debug& debug, const Renderer::Error value) {
/* LCOV_EXCL_STOP */
}
return debug << "Renderer::Error::(invalid)";
return debug << "Renderer::Error(" << Debug::nospace << reinterpret_cast<void*>(GLenum(value)) << Debug::nospace << ")";
}
#ifndef MAGNUM_TARGET_WEBGL
@ -271,7 +271,7 @@ Debug& operator<<(Debug& debug, const Renderer::ResetNotificationStrategy value)
/* LCOV_EXCL_STOP */
}
return debug << "Renderer::ResetNotificationStrategy::(invalid)";
return debug << "Renderer::ResetNotificationStrategy(" << Debug::nospace << reinterpret_cast<void*>(GLenum(value)) << Debug::nospace << ")";
}
Debug& operator<<(Debug& debug, const Renderer::GraphicsResetStatus value) {
@ -286,7 +286,7 @@ Debug& operator<<(Debug& debug, const Renderer::GraphicsResetStatus value) {
/* LCOV_EXCL_STOP */
}
return debug << "Renderer::ResetNotificationStrategy::(invalid)";
return debug << "Renderer::GraphicsResetStatus(" << Debug::nospace << reinterpret_cast<void*>(GLenum(value)) << Debug::nospace << ")";
}
#endif
#endif

2
src/Magnum/Resource.cpp

@ -44,7 +44,7 @@ Debug& operator<<(Debug& debug, const ResourceState value) {
/* LCOV_EXCL_STOP */
}
return debug << "ResourceState::(invalid)";
return debug << "ResourceState(" << Debug::nospace << reinterpret_cast<void*>(UnsignedByte(value)) << Debug::nospace << ")";
}
#endif

12
src/Magnum/Sampler.cpp

@ -71,7 +71,7 @@ Debug& operator<<(Debug& debug, const Sampler::Filter value) {
/* LCOV_EXCL_STOP */
}
return debug << "Sampler::Filter::(invalid)";
return debug << "Sampler::Filter(" << Debug::nospace << reinterpret_cast<void*>(GLint(value)) << Debug::nospace << ")";
}
Debug& operator<<(Debug& debug, const Sampler::Mipmap value) {
@ -85,7 +85,7 @@ Debug& operator<<(Debug& debug, const Sampler::Mipmap value) {
/* LCOV_EXCL_STOP */
}
return debug << "Sampler::Mipmap::(invalid)";
return debug << "Sampler::Mipmap(" << Debug::nospace << reinterpret_cast<void*>(GLint(value)) << Debug::nospace << ")";
}
Debug& operator<<(Debug& debug, const Sampler::Wrapping value) {
@ -105,7 +105,7 @@ Debug& operator<<(Debug& debug, const Sampler::Wrapping value) {
/* LCOV_EXCL_STOP */
}
return debug << "Sampler::Wrapping::(invalid)";
return debug << "Sampler::Wrapping(" << Debug::nospace << reinterpret_cast<void*>(GLint(value)) << Debug::nospace << ")";
}
#if !(defined(MAGNUM_TARGET_WEBGL) && defined(MAGNUM_TARGET_GLES2))
@ -119,7 +119,7 @@ Debug& operator<<(Debug& debug, const Sampler::CompareMode value) {
/* LCOV_EXCL_STOP */
}
return debug << "Sampler::CompareFunction::(invalid)";
return debug << "Sampler::CompareMode(" << Debug::nospace << reinterpret_cast<void*>(GLenum(value)) << Debug::nospace << ")";
}
Debug& operator<<(Debug& debug, const Sampler::CompareFunction value) {
@ -138,7 +138,7 @@ Debug& operator<<(Debug& debug, const Sampler::CompareFunction value) {
/* LCOV_EXCL_STOP */
}
return debug << "Sampler::CompareFunction::(invalid)";
return debug << "Sampler::CompareFunction(" << Debug::nospace << reinterpret_cast<void*>(GLenum(value)) << Debug::nospace << ")";
}
#endif
@ -153,7 +153,7 @@ Debug& operator<<(Debug& debug, const Sampler::DepthStencilMode value) {
/* LCOV_EXCL_STOP */
}
return debug << "Sampler::DepthStencilMode::(invalid)";
return debug << "Sampler::DepthStencilMode(" << Debug::nospace << reinterpret_cast<void*>(GLenum(value)) << Debug::nospace << ")";
}
#endif
#endif

2
src/Magnum/SceneGraph/Animable.cpp

@ -40,7 +40,7 @@ Debug& operator<<(Debug& debug, AnimationState value) {
/* LCOV_EXCL_STOP */
}
return debug << "SceneGraph::AnimationState::(invalid)";
return debug << "SceneGraph::AnimationState(" << Debug::nospace << reinterpret_cast<void*>(UnsignedByte(value)) << Debug::nospace << ")";
}
}}

4
src/Magnum/SceneGraph/Test/AnimableTest.cpp

@ -353,8 +353,8 @@ void AnimableTest::pause() {
void AnimableTest::debug() {
std::ostringstream o;
Debug(&o) << AnimationState::Running;
CORRADE_COMPARE(o.str(), "SceneGraph::AnimationState::Running\n");
Debug(&o) << AnimationState::Running << AnimationState(0xbe);
CORRADE_COMPARE(o.str(), "SceneGraph::AnimationState::Running SceneGraph::AnimationState(0xbe)\n");
}
}}}

2
src/Magnum/Shader.cpp

@ -906,7 +906,7 @@ Debug& operator<<(Debug& debug, const Shader::Type value) {
/* LCOV_EXCL_STOP */
}
return debug << "Shader::Type::(invalid)";
return debug << "Shader::Type(" << Debug::nospace << reinterpret_cast<void*>(GLenum(value)) << Debug::nospace << ")";
}
#endif

8
src/Magnum/Shapes/Test/ShapeImplementationTest.cpp

@ -42,12 +42,12 @@ ShapeImplementationTest::ShapeImplementationTest() {
void ShapeImplementationTest::debug() {
std::ostringstream o;
Debug(&o) << Implementation::ShapeDimensionTraits<2>::Type::Composition;
CORRADE_COMPARE(o.str(), "Shapes::Shape2D::Type::Composition\n");
Debug(&o) << Implementation::ShapeDimensionTraits<2>::Type::Composition << Implementation::ShapeDimensionTraits<2>::Type(0xbe);
CORRADE_COMPARE(o.str(), "Shapes::Shape2D::Type::Composition Shapes::Shape2D::Type(0xbe)\n");
o.str({});
Debug(&o) << Implementation::ShapeDimensionTraits<3>::Type::Plane;
CORRADE_COMPARE(o.str(), "Shapes::Shape3D::Type::Plane\n");
Debug(&o) << Implementation::ShapeDimensionTraits<3>::Type::Plane << Implementation::ShapeDimensionTraits<3>::Type(0xbe);
CORRADE_COMPARE(o.str(), "Shapes::Shape3D::Type::Plane Shapes::Shape3D::Type(0xbe)\n");
}
}}}

4
src/Magnum/Shapes/shapeImplementation.cpp

@ -47,7 +47,7 @@ Debug& operator<<(Debug& debug, ShapeDimensionTraits<2>::Type value) {
/* LCOV_EXCL_STOP */
}
return debug << "Shapes::Shape2D::Type::(unknown)";
return debug << "Shapes::Shape2D::Type(" << Debug::nospace << reinterpret_cast<void*>(UnsignedByte(value)) << Debug::nospace << ")";
}
Debug& operator<<(Debug& debug, ShapeDimensionTraits<3>::Type value) {
@ -69,7 +69,7 @@ Debug& operator<<(Debug& debug, ShapeDimensionTraits<3>::Type value) {
/* LCOV_EXCL_STOP */
}
return debug << "Shapes::Shape3D::Type::(unknown)";
return debug << "Shapes::Shape3D::Type(" << Debug::nospace << reinterpret_cast<void*>(UnsignedByte(value)) << Debug::nospace << ")";
}
template<UnsignedInt dimensions> AbstractShape<dimensions>::~AbstractShape() = default;

215
src/Magnum/Test/AbstractShaderProgramTest.cpp → src/Magnum/Test/AttributeTest.cpp

@ -23,14 +23,15 @@
DEALINGS IN THE SOFTWARE.
*/
#include <sstream>
#include <Corrade/TestSuite/Tester.h>
#include "Magnum/AbstractShaderProgram.h"
namespace Magnum { namespace Test {
struct AbstractShaderProgramTest: TestSuite::Tester {
explicit AbstractShaderProgramTest();
struct AttributeTest: TestSuite::Tester {
explicit AttributeTest();
void attributeScalar();
void attributeScalarInt();
@ -50,30 +51,70 @@ struct AbstractShaderProgramTest: TestSuite::Tester {
#endif
void attributeMatrixNxNd();
void attributeMatrixMxNd();
void debugComponents1();
void debugComponents2();
void debugComponents3();
#ifndef MAGNUM_TARGET_GLES2
void debugComponents4();
#endif
void debugComponentsMatrix2();
void debugComponentsMatrix3();
void debugComponentsMatrix4();
void debugComponentsVector4();
void debugDataTypeFloat();
#ifndef MAGNUM_TARGET_GLES2
void debugDataTypeInt();
#endif
#ifndef MAGNUM_TARGET_GLES
void debugDataTypeDouble();
#endif
void debugDataTypeVector3();
void debugDataTypeVector4();
};
AbstractShaderProgramTest::AbstractShaderProgramTest() {
addTests({&AbstractShaderProgramTest::attributeScalar,
&AbstractShaderProgramTest::attributeScalarInt,
&AbstractShaderProgramTest::attributeScalarUnsignedInt,
&AbstractShaderProgramTest::attributeScalarDouble,
AttributeTest::AttributeTest() {
addTests({&AttributeTest::attributeScalar,
&AttributeTest::attributeScalarInt,
&AttributeTest::attributeScalarUnsignedInt,
&AttributeTest::attributeScalarDouble,
&AbstractShaderProgramTest::attributeVector,
&AbstractShaderProgramTest::attributeVectorInt,
&AbstractShaderProgramTest::attributeVectorUnsignedInt,
&AbstractShaderProgramTest::attributeVectorDouble,
&AbstractShaderProgramTest::attributeVector4,
&AbstractShaderProgramTest::attributeVectorBGRA,
&AttributeTest::attributeVector,
&AttributeTest::attributeVectorInt,
&AttributeTest::attributeVectorUnsignedInt,
&AttributeTest::attributeVectorDouble,
&AttributeTest::attributeVector4,
&AttributeTest::attributeVectorBGRA,
&AbstractShaderProgramTest::attributeMatrixNxN,
&AttributeTest::attributeMatrixNxN,
#ifndef MAGNUM_TARGET_GLES2
&AbstractShaderProgramTest::attributeMatrixMxN,
&AttributeTest::attributeMatrixMxN,
#endif
&AbstractShaderProgramTest::attributeMatrixNxNd,
&AbstractShaderProgramTest::attributeMatrixMxNd});
&AttributeTest::attributeMatrixNxNd,
&AttributeTest::attributeMatrixMxNd,
&AttributeTest::debugComponents1,
&AttributeTest::debugComponents2,
&AttributeTest::debugComponents3,
#ifndef MAGNUM_TARGET_GLES2
&AttributeTest::debugComponents4,
#endif
&AttributeTest::debugComponentsMatrix2,
&AttributeTest::debugComponentsMatrix3,
&AttributeTest::debugComponentsMatrix4,
&AttributeTest::debugComponentsVector4,
&AttributeTest::debugDataTypeFloat,
#ifndef MAGNUM_TARGET_GLES
&AttributeTest::debugDataTypeInt,
#endif
#ifndef MAGNUM_TARGET_GLES
&AttributeTest::debugDataTypeDouble,
#endif
&AttributeTest::debugDataTypeVector3,
&AttributeTest::debugDataTypeVector4});
}
void AbstractShaderProgramTest::attributeScalar() {
void AttributeTest::attributeScalar() {
typedef Attribute<3, Float> Attribute;
CORRADE_VERIFY((std::is_same<Attribute::ScalarType, Float>{}));
CORRADE_COMPARE(Attribute::Location, 3);
@ -92,7 +133,7 @@ void AbstractShaderProgramTest::attributeScalar() {
CORRADE_VERIFY(b.dataOptions() <= Attribute::DataOption::Normalized);
}
void AbstractShaderProgramTest::attributeScalarInt() {
void AttributeTest::attributeScalarInt() {
#ifndef MAGNUM_TARGET_GLES2
typedef Attribute<3, Int> Attribute;
CORRADE_VERIFY((std::is_same<Attribute::ScalarType, Int>{}));
@ -110,7 +151,7 @@ void AbstractShaderProgramTest::attributeScalarInt() {
#endif
}
void AbstractShaderProgramTest::attributeScalarUnsignedInt() {
void AttributeTest::attributeScalarUnsignedInt() {
#ifndef MAGNUM_TARGET_GLES2
typedef Attribute<3, UnsignedInt> Attribute;
CORRADE_VERIFY((std::is_same<Attribute::ScalarType, UnsignedInt>{}));
@ -128,7 +169,7 @@ void AbstractShaderProgramTest::attributeScalarUnsignedInt() {
#endif
}
void AbstractShaderProgramTest::attributeScalarDouble() {
void AttributeTest::attributeScalarDouble() {
#ifndef MAGNUM_TARGET_GLES
typedef Attribute<3, Double> Attribute;
CORRADE_VERIFY((std::is_same<Attribute::ScalarType, Double>{}));
@ -142,7 +183,7 @@ void AbstractShaderProgramTest::attributeScalarDouble() {
#endif
}
void AbstractShaderProgramTest::attributeVector() {
void AttributeTest::attributeVector() {
typedef Attribute<3, Vector3> Attribute;
CORRADE_VERIFY((std::is_same<Attribute::ScalarType, Float>{}));
CORRADE_COMPARE(Attribute::VectorCount, 1);
@ -165,7 +206,7 @@ void AbstractShaderProgramTest::attributeVector() {
#endif
}
void AbstractShaderProgramTest::attributeVectorInt() {
void AttributeTest::attributeVectorInt() {
#ifndef MAGNUM_TARGET_GLES2
typedef Attribute<3, Vector2i> Attribute;
CORRADE_VERIFY((std::is_same<Attribute::ScalarType, Int>{}));
@ -185,7 +226,7 @@ void AbstractShaderProgramTest::attributeVectorInt() {
#endif
}
void AbstractShaderProgramTest::attributeVectorUnsignedInt() {
void AttributeTest::attributeVectorUnsignedInt() {
#ifndef MAGNUM_TARGET_GLES2
typedef Attribute<3, Vector4ui> Attribute;
CORRADE_VERIFY((std::is_same<Attribute::ScalarType, UnsignedInt>{}));
@ -205,7 +246,7 @@ void AbstractShaderProgramTest::attributeVectorUnsignedInt() {
#endif
}
void AbstractShaderProgramTest::attributeVectorDouble() {
void AttributeTest::attributeVectorDouble() {
#ifndef MAGNUM_TARGET_GLES
typedef Attribute<3, Vector2d> Attribute;
CORRADE_VERIFY((std::is_same<Attribute::ScalarType, Double>{}));
@ -225,7 +266,7 @@ void AbstractShaderProgramTest::attributeVectorDouble() {
#endif
}
void AbstractShaderProgramTest::attributeVector4() {
void AttributeTest::attributeVector4() {
typedef Attribute<3, Vector4> Attribute;
CORRADE_VERIFY((std::is_same<Attribute::ScalarType, Float>{}));
CORRADE_COMPARE(Attribute::VectorCount, 1);
@ -240,7 +281,7 @@ void AbstractShaderProgramTest::attributeVector4() {
#endif
}
void AbstractShaderProgramTest::attributeVectorBGRA() {
void AttributeTest::attributeVectorBGRA() {
#ifndef MAGNUM_TARGET_GLES
typedef Attribute<3, Vector4> Attribute;
CORRADE_VERIFY((std::is_same<Attribute::ScalarType, Float>{}));
@ -254,7 +295,7 @@ void AbstractShaderProgramTest::attributeVectorBGRA() {
#endif
}
void AbstractShaderProgramTest::attributeMatrixNxN() {
void AttributeTest::attributeMatrixNxN() {
typedef Attribute<3, Matrix3> Attribute;
CORRADE_VERIFY((std::is_same<Attribute::ScalarType, Float>{}));
CORRADE_COMPARE(Attribute::VectorCount, 3);
@ -267,7 +308,7 @@ void AbstractShaderProgramTest::attributeMatrixNxN() {
}
#ifndef MAGNUM_TARGET_GLES2
void AbstractShaderProgramTest::attributeMatrixMxN() {
void AttributeTest::attributeMatrixMxN() {
typedef Attribute<3, Matrix3x4> Attribute;
CORRADE_VERIFY((std::is_same<Attribute::ScalarType, Float>{}));
CORRADE_COMPARE(Attribute::VectorCount, 3);
@ -280,7 +321,7 @@ void AbstractShaderProgramTest::attributeMatrixMxN() {
}
#endif
void AbstractShaderProgramTest::attributeMatrixNxNd() {
void AttributeTest::attributeMatrixNxNd() {
#ifndef MAGNUM_TARGET_GLES
typedef Attribute<3, Matrix4d> Attribute;
CORRADE_VERIFY((std::is_same<Attribute::ScalarType, Double>{}));
@ -296,7 +337,7 @@ void AbstractShaderProgramTest::attributeMatrixNxNd() {
#endif
}
void AbstractShaderProgramTest::attributeMatrixMxNd() {
void AttributeTest::attributeMatrixMxNd() {
#ifndef MAGNUM_TARGET_GLES
typedef Attribute<3, Matrix4x2d> Attribute;
CORRADE_VERIFY((std::is_same<Attribute::ScalarType, Double>{}));
@ -312,6 +353,116 @@ void AbstractShaderProgramTest::attributeMatrixMxNd() {
#endif
}
void AttributeTest::debugComponents1() {
typedef Attribute<3, Float> Attribute;
std::ostringstream out;
Debug{&out} << Attribute::Components::One << Attribute::Components(0xdead);
CORRADE_COMPARE(out.str(), "Attribute::Components::One Attribute::Components(0xdead)\n");
}
void AttributeTest::debugComponents2() {
typedef Attribute<3, Vector2> Attribute;
std::ostringstream out;
Debug{&out} << Attribute::Components::Two << Attribute::Components(0xdead);
CORRADE_COMPARE(out.str(), "Attribute::Components::Two Attribute::Components(0xdead)\n");
}
void AttributeTest::debugComponents3() {
typedef Attribute<3, Vector3> Attribute;
std::ostringstream out;
Debug{&out} << Attribute::Components::Three << Attribute::Components(0xdead);
CORRADE_COMPARE(out.str(), "Attribute::Components::Three Attribute::Components(0xdead)\n");
}
#ifndef MAGNUM_TARGET_GLES2
void AttributeTest::debugComponents4() {
typedef Attribute<3, Vector4i> Attribute;
std::ostringstream out;
Debug{&out} << Attribute::Components::Four << Attribute::Components(0xdead);
CORRADE_COMPARE(out.str(), "Attribute::Components::Four Attribute::Components(0xdead)\n");
}
#endif
void AttributeTest::debugComponentsMatrix2() {
typedef Attribute<3, Matrix2x2> Attribute;
std::ostringstream out;
Debug{&out} << Attribute::Components::Two << Attribute::Components(0xdead);
CORRADE_COMPARE(out.str(), "Attribute::Components::Two Attribute::Components(0xdead)\n");
}
void AttributeTest::debugComponentsMatrix3() {
typedef Attribute<3, Matrix3> Attribute;
std::ostringstream out;
Debug{&out} << Attribute::Components::Three << Attribute::Components(0xdead);
CORRADE_COMPARE(out.str(), "Attribute::Components::Three Attribute::Components(0xdead)\n");
}
void AttributeTest::debugComponentsMatrix4() {
typedef Attribute<3, Matrix4> Attribute;
std::ostringstream out;
Debug{&out} << Attribute::Components::Four << Attribute::Components(0xdead);
CORRADE_COMPARE(out.str(), "Attribute::Components::Four Attribute::Components(0xdead)\n");
}
void AttributeTest::debugComponentsVector4() {
typedef Attribute<3, Vector4> Attribute;
std::ostringstream out;
Debug{&out} << Attribute::Components::Three << Attribute::Components(0xdead);
CORRADE_COMPARE(out.str(), "Attribute::Components::Three Attribute::Components(0xdead)\n");
}
void AttributeTest::debugDataTypeFloat() {
typedef Attribute<3, Float> Attribute;
std::ostringstream out;
Debug{&out} << Attribute::DataType::HalfFloat << Attribute::DataType(0xdead);
CORRADE_COMPARE(out.str(), "Attribute::DataType::HalfFloat Attribute::DataType(0xdead)\n");
}
#ifndef MAGNUM_TARGET_GLES2
void AttributeTest::debugDataTypeInt() {
typedef Attribute<3, Int> Attribute;
std::ostringstream out;
Debug{&out} << Attribute::DataType::Short << Attribute::DataType(0xdead);
CORRADE_COMPARE(out.str(), "Attribute::DataType::Short Attribute::DataType(0xdead)\n");
}
#endif
#ifndef MAGNUM_TARGET_GLES
void AttributeTest::debugDataTypeDouble() {
typedef Attribute<3, Double> Attribute;
std::ostringstream out;
Debug{&out} << Attribute::DataType::Double << Attribute::DataType(0xdead);
CORRADE_COMPARE(out.str(), "Attribute::DataType::Double Attribute::DataType(0xdead)\n");
}
#endif
void AttributeTest::debugDataTypeVector3() {
typedef Attribute<3, Vector3> Attribute;
std::ostringstream out;
Debug{&out} << Attribute::DataType::HalfFloat << Attribute::DataType(0xdead);
CORRADE_COMPARE(out.str(), "Attribute::DataType::HalfFloat Attribute::DataType(0xdead)\n");
}
void AttributeTest::debugDataTypeVector4() {
typedef Attribute<3, Vector4> Attribute;
std::ostringstream out;
Debug{&out} << Attribute::DataType::HalfFloat << Attribute::DataType(0xdead);
CORRADE_COMPARE(out.str(), "Attribute::DataType::HalfFloat Attribute::DataType(0xdead)\n");
}
}}
CORRADE_TEST_MAIN(Magnum::Test::AbstractShaderProgramTest)
CORRADE_TEST_MAIN(Magnum::Test::AttributeTest)

67
src/Magnum/Test/BufferTest.cpp

@ -0,0 +1,67 @@
/*
This file is part of Magnum.
Copyright © 2010, 2011, 2012, 2013, 2014, 2015, 2016
Vladimír Vondruš <mosra@centrum.cz>
Copyright © 2015 Jonathan Hale <squareys@googlemail.com>
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 <sstream>
#include <Corrade/TestSuite/Tester.h>
#include "Magnum/Buffer.h"
namespace Magnum { namespace Test {
struct BufferTest: TestSuite::Tester {
explicit BufferTest();
void debugTargetHint();
#ifndef MAGNUM_TARGET_GLES2
void debugTarget();
#endif
};
BufferTest::BufferTest() {
addTests({&BufferTest::debugTargetHint,
#ifndef MAGNUM_TARGET_GLES2
&BufferTest::debugTarget
#endif
});
}
void BufferTest::debugTargetHint() {
std::ostringstream out;
Debug{&out} << Buffer::TargetHint::Array << Buffer::TargetHint(0xdead);
CORRADE_COMPARE(out.str(), "Buffer::TargetHint::Array Buffer::TargetHint(0xdead)\n");
}
#ifndef MAGNUM_TARGET_GLES2
void BufferTest::debugTarget() {
std::ostringstream out;
Debug{&out} << Buffer::Target::Uniform << Buffer::Target(0xdead);
CORRADE_COMPARE(out.str(), "Buffer::Target::Uniform Buffer::Target(0xdead)\n");
}
#endif
}}
CORRADE_TEST_MAIN(Magnum::Test::BufferTest)

3
src/Magnum/Test/CMakeLists.txt

@ -23,8 +23,9 @@
# DEALINGS IN THE SOFTWARE.
#
corrade_add_test(AbstractShaderProgramTest AbstractShaderProgramTest.cpp LIBRARIES Magnum)
corrade_add_test(ArrayTest ArrayTest.cpp LIBRARIES Magnum)
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)
if(NOT MAGNUM_TARGET_WEBGL)

4
src/Magnum/Test/ContextTest.cpp

@ -45,8 +45,8 @@ void ContextTest::debugFlag() {
CORRADE_SKIP("No context flags on Emscripten yet.");
#else
std::ostringstream out;
Debug(&out) << Context::Flag::Debug;
CORRADE_COMPARE(out.str(), "Context::Flag::Debug\n");
Debug(&out) << Context::Flag::Debug << Context::Flag(0xdead);
CORRADE_COMPARE(out.str(), "Context::Flag::Debug Context::Flag(0xdead)\n");
#endif
}

24
src/Magnum/Test/DebugOutputTest.cpp

@ -56,38 +56,38 @@ DebugOutputTest::DebugOutputTest() {
void DebugOutputTest::debugSource() {
std::ostringstream o;
Debug(&o) << DebugOutput::Source::ShaderCompiler;
CORRADE_COMPARE(o.str(), "DebugOutput::Source::ShaderCompiler\n");
Debug(&o) << DebugOutput::Source::ShaderCompiler << DebugOutput::Source(0xdead);
CORRADE_COMPARE(o.str(), "DebugOutput::Source::ShaderCompiler DebugOutput::Source(0xdead)\n");
}
void DebugOutputTest::debugType() {
std::ostringstream o;
Debug(&o) << DebugOutput::Type::PushGroup;
CORRADE_COMPARE(o.str(), "DebugOutput::Type::PushGroup\n");
Debug(&o) << DebugOutput::Type::PushGroup << DebugOutput::Type(0xdead);
CORRADE_COMPARE(o.str(), "DebugOutput::Type::PushGroup DebugOutput::Type(0xdead)\n");
}
void DebugOutputTest::debugSeverity() {
std::ostringstream o;
Debug(&o) << DebugOutput::Severity::Notification;
CORRADE_COMPARE(o.str(), "DebugOutput::Severity::Notification\n");
Debug(&o) << DebugOutput::Severity::Notification << DebugOutput::Severity(0xdead);
CORRADE_COMPARE(o.str(), "DebugOutput::Severity::Notification DebugOutput::Severity(0xdead)\n");
}
void DebugOutputTest::debugMessageSource() {
std::ostringstream o;
Debug(&o) << DebugMessage::Source::Application;
CORRADE_COMPARE(o.str(), "DebugMessage::Source::Application\n");
Debug(&o) << DebugMessage::Source::Application << DebugMessage::Source(0xdead);
CORRADE_COMPARE(o.str(), "DebugMessage::Source::Application DebugMessage::Source(0xdead)\n");
}
void DebugOutputTest::debugMessageType() {
std::ostringstream o;
Debug(&o) << DebugMessage::Type::DeprecatedBehavior;
CORRADE_COMPARE(o.str(), "DebugMessage::Type::DeprecatedBehavior\n");
Debug(&o) << DebugMessage::Type::DeprecatedBehavior << DebugMessage::Type(0xdead);
CORRADE_COMPARE(o.str(), "DebugMessage::Type::DeprecatedBehavior DebugMessage::Type(0xdead)\n");
}
void DebugOutputTest::debugGroupSource() {
std::ostringstream o;
Debug(&o) << DebugGroup::Source::ThirdParty;
CORRADE_COMPARE(o.str(), "DebugGroup::Source::ThirdParty\n");
Debug(&o) << DebugGroup::Source::ThirdParty << DebugGroup::Source(0xdead);
CORRADE_COMPARE(o.str(), "DebugGroup::Source::ThirdParty DebugGroup::Source(0xdead)\n");
}
}}

4
src/Magnum/Test/DefaultFramebufferTest.cpp

@ -43,8 +43,8 @@ DefaultFramebufferTest::DefaultFramebufferTest() {
void DefaultFramebufferTest::debugStatus() {
std::ostringstream out;
Debug(&out) << DefaultFramebuffer::Status::Complete;
CORRADE_COMPARE(out.str(), "DefaultFramebuffer::Status::Complete\n");
Debug(&out) << DefaultFramebuffer::Status::Complete << DefaultFramebuffer::Status(0xdead);
CORRADE_COMPARE(out.str(), "DefaultFramebuffer::Status::Complete DefaultFramebuffer::Status(0xdead)\n");
}
}}

12
src/Magnum/Test/FormatTest.cpp

@ -47,15 +47,15 @@ FormatTest::FormatTest() {
void FormatTest::debugPixelFormat() {
std::ostringstream out;
Debug(&out) << PixelFormat::RGBA;
CORRADE_COMPARE(out.str(), "PixelFormat::RGBA\n");
Debug(&out) << PixelFormat::RGBA << PixelFormat(0xdead);
CORRADE_COMPARE(out.str(), "PixelFormat::RGBA PixelFormat(0xdead)\n");
}
void FormatTest::debugPixelType() {
std::ostringstream out;
Debug(&out) << PixelType::UnsignedByte;
CORRADE_COMPARE(out.str(), "PixelType::UnsignedByte\n");
Debug(&out) << PixelType::UnsignedByte << PixelType(0xdead);
CORRADE_COMPARE(out.str(), "PixelType::UnsignedByte PixelType(0xdead)\n");
}
void FormatTest::debugCompressedPixelFormat() {
@ -64,8 +64,8 @@ void FormatTest::debugCompressedPixelFormat() {
#else
std::ostringstream out;
Debug(&out) << CompressedPixelFormat::RGBBptcUnsignedFloat;
CORRADE_COMPARE(out.str(), "CompressedPixelFormat::RGBBptcUnsignedFloat\n");
Debug(&out) << CompressedPixelFormat::RGBBptcUnsignedFloat << CompressedPixelFormat(0xdead);
CORRADE_COMPARE(out.str(), "CompressedPixelFormat::RGBBptcUnsignedFloat CompressedPixelFormat(0xdead)\n");
#endif
}

4
src/Magnum/Test/FramebufferTest.cpp

@ -43,8 +43,8 @@ FramebufferTest::FramebufferTest() {
void FramebufferTest::debugStatus() {
std::ostringstream out;
Debug(&out) << Framebuffer::Status::IncompleteMissingAttachment;
CORRADE_COMPARE(out.str(), "Framebuffer::Status::IncompleteMissingAttachment\n");
Debug(&out) << Framebuffer::Status::IncompleteMissingAttachment << Framebuffer::Status(0xdead);
CORRADE_COMPARE(out.str(), "Framebuffer::Status::IncompleteMissingAttachment Framebuffer::Status(0xdead)\n");
}
}}

8
src/Magnum/Test/MeshTest.cpp

@ -59,14 +59,14 @@ void MeshTest::indexSize() {
void MeshTest::debugPrimitive() {
std::ostringstream o;
Debug(&o) << MeshPrimitive::TriangleFan;
CORRADE_COMPARE(o.str(), "MeshPrimitive::TriangleFan\n");
Debug(&o) << MeshPrimitive::TriangleFan << MeshPrimitive(0xdead);
CORRADE_COMPARE(o.str(), "MeshPrimitive::TriangleFan MeshPrimitive(0xdead)\n");
}
void MeshTest::debugIndexType() {
std::ostringstream o;
Debug(&o) << Mesh::IndexType::UnsignedShort;
CORRADE_COMPARE(o.str(), "Mesh::IndexType::UnsignedShort\n");
Debug(&o) << Mesh::IndexType::UnsignedShort << Mesh::IndexType(0xdead);
CORRADE_COMPARE(o.str(), "Mesh::IndexType::UnsignedShort Mesh::IndexType(0xdead)\n");
}
void MeshTest::configurationPrimitive() {

12
src/Magnum/Test/RendererTest.cpp

@ -52,23 +52,23 @@ RendererTest::RendererTest() {
void RendererTest::debugError() {
std::ostringstream out;
Debug(&out) << Renderer::Error::InvalidOperation;
CORRADE_COMPARE(out.str(), "Renderer::Error::InvalidOperation\n");
Debug(&out) << Renderer::Error::InvalidOperation << Renderer::Error(0xdead);
CORRADE_COMPARE(out.str(), "Renderer::Error::InvalidOperation Renderer::Error(0xdead)\n");
}
#ifndef MAGNUM_TARGET_WEBGL
void RendererTest::debugResetNotificationStrategy() {
std::ostringstream out;
Debug(&out) << Renderer::ResetNotificationStrategy::LoseContextOnReset;
CORRADE_COMPARE(out.str(), "Renderer::ResetNotificationStrategy::LoseContextOnReset\n");
Debug(&out) << Renderer::ResetNotificationStrategy::LoseContextOnReset << Renderer::ResetNotificationStrategy(0xdead);
CORRADE_COMPARE(out.str(), "Renderer::ResetNotificationStrategy::LoseContextOnReset Renderer::ResetNotificationStrategy(0xdead)\n");
}
void RendererTest::debugGraphicsResetStatus() {
std::ostringstream out;
Debug(&out) << Renderer::GraphicsResetStatus::GuiltyContextReset;
CORRADE_COMPARE(out.str(), "Renderer::GraphicsResetStatus::GuiltyContextReset\n");
Debug(&out) << Renderer::GraphicsResetStatus::GuiltyContextReset << Renderer::GraphicsResetStatus(0xdead);
CORRADE_COMPARE(out.str(), "Renderer::GraphicsResetStatus::GuiltyContextReset Renderer::GraphicsResetStatus(0xdead)\n");
}
#endif

4
src/Magnum/Test/ResourceManagerTest.cpp

@ -332,8 +332,8 @@ void ResourceManagerTest::loader() {
void ResourceManagerTest::debugResourceState() {
std::ostringstream out;
Debug{&out} << ResourceState::Loading;
CORRADE_COMPARE(out.str(), "ResourceState::Loading\n");
Debug{&out} << ResourceState::Loading << ResourceState(0xbe);
CORRADE_COMPARE(out.str(), "ResourceState::Loading ResourceState(0xbe)\n");
}
}}

24
src/Magnum/Test/SamplerTest.cpp

@ -62,37 +62,37 @@ SamplerTest::SamplerTest() {
void SamplerTest::debugFilter() {
std::ostringstream out;
Debug(&out) << Sampler::Filter::Linear;
CORRADE_COMPARE(out.str(), "Sampler::Filter::Linear\n");
Debug(&out) << Sampler::Filter::Linear << Sampler::Filter(0xdead);
CORRADE_COMPARE(out.str(), "Sampler::Filter::Linear Sampler::Filter(0xdead)\n");
}
void SamplerTest::debugMipmap() {
std::ostringstream out;
Debug(&out) << Sampler::Mipmap::Base;
CORRADE_COMPARE(out.str(), "Sampler::Mipmap::Base\n");
Debug(&out) << Sampler::Mipmap::Base << Sampler::Mipmap(0xdead);
CORRADE_COMPARE(out.str(), "Sampler::Mipmap::Base Sampler::Mipmap(0xdead)\n");
}
void SamplerTest::debugWrapping() {
std::ostringstream out;
Debug(&out) << Sampler::Wrapping::ClampToEdge;
CORRADE_COMPARE(out.str(), "Sampler::Wrapping::ClampToEdge\n");
Debug(&out) << Sampler::Wrapping::ClampToEdge << Sampler::Wrapping(0xdead);
CORRADE_COMPARE(out.str(), "Sampler::Wrapping::ClampToEdge Sampler::Wrapping(0xdead)\n");
}
#if !(defined(MAGNUM_TARGET_WEBGL) && defined(MAGNUM_TARGET_GLES2))
void SamplerTest::debugCompareMode() {
std::ostringstream out;
Debug(&out) << Sampler::CompareMode::CompareRefToTexture;
CORRADE_COMPARE(out.str(), "Sampler::CompareMode::CompareRefToTexture\n");
Debug(&out) << Sampler::CompareMode::CompareRefToTexture << Sampler::CompareMode(0xdead);
CORRADE_COMPARE(out.str(), "Sampler::CompareMode::CompareRefToTexture Sampler::CompareMode(0xdead)\n");
}
void SamplerTest::debugCompareFunction() {
std::ostringstream out;
Debug(&out) << Sampler::CompareFunction::GreaterOrEqual;
CORRADE_COMPARE(out.str(), "Sampler::CompareFunction::GreaterOrEqual\n");
Debug(&out) << Sampler::CompareFunction::GreaterOrEqual << Sampler::CompareFunction(0xdead);
CORRADE_COMPARE(out.str(), "Sampler::CompareFunction::GreaterOrEqual Sampler::CompareFunction(0xdead)\n");
}
#endif
@ -100,8 +100,8 @@ void SamplerTest::debugCompareFunction() {
void SamplerTest::debugDepthStencilMode() {
std::ostringstream out;
Debug(&out) << Sampler::DepthStencilMode::StencilIndex;
CORRADE_COMPARE(out.str(), "Sampler::DepthStencilMode::StencilIndex\n");
Debug(&out) << Sampler::DepthStencilMode::StencilIndex << Sampler::DepthStencilMode(0xdead);
CORRADE_COMPARE(out.str(), "Sampler::DepthStencilMode::StencilIndex Sampler::DepthStencilMode(0xdead)\n");
}
#endif

4
src/Magnum/Test/ShaderTest.cpp

@ -43,8 +43,8 @@ ShaderTest::ShaderTest() {
void ShaderTest::debugType() {
std::ostringstream out;
Debug(&out) << Shader::Type::Fragment;
CORRADE_COMPARE(out.str(), "Shader::Type::Fragment\n");
Debug(&out) << Shader::Type::Fragment << Shader::Type(0xdead);
CORRADE_COMPARE(out.str(), "Shader::Type::Fragment Shader::Type(0xdead)\n");
}
}}

2
src/Magnum/Trade/AbstractMaterialData.cpp

@ -42,7 +42,7 @@ Debug& operator<<(Debug& debug, const MaterialType value) {
/* LCOV_EXCL_STOP */
}
return debug << "Trade::MaterialType::(unknown)";
return debug << "Trade::MaterialType(" << Debug::nospace << reinterpret_cast<void*>(UnsignedByte(value)) << Debug::nospace << ")";
}
}}

2
src/Magnum/Trade/ObjectData2D.cpp

@ -49,7 +49,7 @@ Debug& operator<<(Debug& debug, ObjectInstanceType2D value) {
/* LCOV_EXCL_STOP */
}
return debug << "Trade::ObjectInstanceType2D::(invalid)";
return debug << "Trade::ObjectInstanceType2D(" << Debug::nospace << reinterpret_cast<void*>(UnsignedByte(value)) << Debug::nospace << ")";
}
#endif

2
src/Magnum/Trade/ObjectData3D.cpp

@ -50,7 +50,7 @@ Debug& operator<<(Debug& debug, ObjectInstanceType3D value) {
/* LCOV_EXCL_STOP */
}
return debug << "Trade::ObjectInstanceType3D::(invalid)";
return debug << "Trade::ObjectInstanceType3D(" << Debug::nospace << reinterpret_cast<void*>(UnsignedByte(value)) << Debug::nospace << ")";
}
#endif

2
src/Magnum/Trade/Test/CMakeLists.txt

@ -38,8 +38,8 @@ corrade_add_test(TradeAbstractImageConverterTest AbstractImageConverterTest.cpp
target_include_directories(TradeAbstractImageConverterTest PRIVATE ${CMAKE_CURRENT_BINARY_DIR})
corrade_add_test(TradeAbstractImporterTest AbstractImporterTest.cpp LIBRARIES Magnum)
target_include_directories(TradeAbstractImporterTest PRIVATE ${CMAKE_CURRENT_BINARY_DIR})
corrade_add_test(TradeAbstractMaterialDataTest AbstractMaterialDataTest.cpp LIBRARIES Magnum)
corrade_add_test(TradeImageDataTest ImageDataTest.cpp LIBRARIES Magnum)
corrade_add_test(TradeMaterialDataTest MaterialDataTest.cpp LIBRARIES Magnum)
corrade_add_test(TradeObjectData2DTest ObjectData2DTest.cpp LIBRARIES Magnum)
corrade_add_test(TradeObjectData3DTest ObjectData3DTest.cpp LIBRARIES Magnum)
corrade_add_test(TradeTextureDataTest TextureDataTest.cpp LIBRARIES Magnum)

20
src/Magnum/Trade/Test/AbstractMaterialDataTest.cpp → src/Magnum/Trade/Test/MaterialDataTest.cpp

@ -26,28 +26,28 @@
#include <sstream>
#include <Corrade/TestSuite/Tester.h>
#include "Magnum/Trade/AbstractMaterialData.h"
#include "Magnum/Trade/PhongMaterialData.h"
namespace Magnum { namespace Trade { namespace Test {
class AbstractMaterialDataTest: public TestSuite::Tester {
class MaterialDataTest: public TestSuite::Tester {
public:
explicit AbstractMaterialDataTest();
explicit MaterialDataTest();
void debug();
void debugType();
};
AbstractMaterialDataTest::AbstractMaterialDataTest() {
addTests({&AbstractMaterialDataTest::debug});
MaterialDataTest::MaterialDataTest() {
addTests({&MaterialDataTest::debugType});
}
void AbstractMaterialDataTest::debug() {
void MaterialDataTest::debugType() {
std::ostringstream out;
Debug(&out) << MaterialType::Phong;
CORRADE_COMPARE(out.str(), "Trade::MaterialType::Phong\n");
Debug(&out) << MaterialType::Phong << MaterialType(0xbe);
CORRADE_COMPARE(out.str(), "Trade::MaterialType::Phong Trade::MaterialType(0xbe)\n");
}
}}}
CORRADE_TEST_MAIN(Magnum::Trade::Test::AbstractMaterialDataTest)
CORRADE_TEST_MAIN(Magnum::Trade::Test::MaterialDataTest)

4
src/Magnum/Trade/Test/ObjectData2DTest.cpp

@ -43,8 +43,8 @@ ObjectData2DTest::ObjectData2DTest() {
void ObjectData2DTest::debug() {
std::ostringstream o;
Debug(&o) << ObjectInstanceType2D::Empty;
CORRADE_COMPARE(o.str(), "Trade::ObjectInstanceType2D::Empty\n");
Debug(&o) << ObjectInstanceType2D::Empty << ObjectInstanceType2D(0xbe);
CORRADE_COMPARE(o.str(), "Trade::ObjectInstanceType2D::Empty Trade::ObjectInstanceType2D(0xbe)\n");
}
}}}

4
src/Magnum/Trade/Test/ObjectData3DTest.cpp

@ -43,8 +43,8 @@ ObjectData3DTest::ObjectData3DTest() {
void ObjectData3DTest::debug() {
std::ostringstream o;
Debug(&o) << ObjectInstanceType3D::Light;
CORRADE_COMPARE(o.str(), "Trade::ObjectInstanceType3D::Light\n");
Debug(&o) << ObjectInstanceType3D::Light << ObjectInstanceType3D(0xbe);
CORRADE_COMPARE(o.str(), "Trade::ObjectInstanceType3D::Light Trade::ObjectInstanceType3D(0xbe)\n");
}
}}}

4
src/Magnum/Trade/Test/TextureDataTest.cpp

@ -44,8 +44,8 @@ TextureDataTest::TextureDataTest() {
void TextureDataTest::debug() {
std::ostringstream out;
Debug(&out) << TextureData::Type::Texture3D;
CORRADE_COMPARE(out.str(), "Trade::TextureData::Type::Texture3D\n");
Debug(&out) << TextureData::Type::Texture3D << TextureData::Type(0xbe);
CORRADE_COMPARE(out.str(), "Trade::TextureData::Type::Texture3D Trade::TextureData::Type(0xbe)\n");
}
}}}

2
src/Magnum/Trade/TextureData.cpp

@ -40,7 +40,7 @@ Debug& operator<<(Debug& debug, const TextureData::Type value) {
/* LCOV_EXCL_STOP */
}
return debug << "Trade::TextureData::Type::(unknown)";
return debug << "Trade::TextureData::Type(" << Debug::nospace << reinterpret_cast<void*>(UnsignedByte(value)) << Debug::nospace << ")";
}
#endif

Loading…
Cancel
Save