Browse Source

DebugTools,TextureTools: better diagnostics for missing plugins in tests.

pull/331/head
Vladimír Vondruš 7 years ago
parent
commit
b97c27ba82
  1. 10
      src/Magnum/DebugTools/Test/ForceRendererGLTest.cpp
  2. 10
      src/Magnum/DebugTools/Test/ObjectRendererGLTest.cpp
  3. 25
      src/Magnum/DebugTools/Test/ScreenshotGLTest.cpp
  4. 4
      src/Magnum/TextureTools/Test/DistanceFieldGLTest.cpp

10
src/Magnum/DebugTools/Test/ForceRendererGLTest.cpp

@ -102,6 +102,11 @@ void ForceRendererGLTest::render2D() {
camera.draw(drawables); camera.draw(drawables);
MAGNUM_VERIFY_NO_GL_ERROR(); MAGNUM_VERIFY_NO_GL_ERROR();
if(!(_manager.loadState("AnyImageImporter") & PluginManager::LoadState::Loaded) ||
!(_manager.loadState("TgaImporter") & PluginManager::LoadState::Loaded))
CORRADE_SKIP("AnyImageImporter / TgaImageImporter plugins not found.");
CORRADE_COMPARE_WITH( CORRADE_COMPARE_WITH(
framebuffer.read({{}, {64, 64}}, {PixelFormat::RGBA8Unorm}), framebuffer.read({{}, {64, 64}}, {PixelFormat::RGBA8Unorm}),
Utility::Directory::join(DEBUGTOOLS_TEST_DIR, "ForceRenderer2D.tga"), Utility::Directory::join(DEBUGTOOLS_TEST_DIR, "ForceRenderer2D.tga"),
@ -143,6 +148,11 @@ void ForceRendererGLTest::render3D() {
camera.draw(drawables); camera.draw(drawables);
MAGNUM_VERIFY_NO_GL_ERROR(); MAGNUM_VERIFY_NO_GL_ERROR();
if(!(_manager.loadState("AnyImageImporter") & PluginManager::LoadState::Loaded) ||
!(_manager.loadState("TgaImporter") & PluginManager::LoadState::Loaded))
CORRADE_SKIP("AnyImageImporter / TgaImageImporter plugins not found.");
{ {
CORRADE_EXPECT_FAIL("I'm unable to convince it to orient the arrowhead correctly in 3D."); CORRADE_EXPECT_FAIL("I'm unable to convince it to orient the arrowhead correctly in 3D.");
CORRADE_COMPARE_WITH( CORRADE_COMPARE_WITH(

10
src/Magnum/DebugTools/Test/ObjectRendererGLTest.cpp

@ -103,6 +103,11 @@ void ObjectRendererGLTest::render2D() {
camera.draw(drawables); camera.draw(drawables);
MAGNUM_VERIFY_NO_GL_ERROR(); MAGNUM_VERIFY_NO_GL_ERROR();
if(!(_manager.loadState("AnyImageImporter") & PluginManager::LoadState::Loaded) ||
!(_manager.loadState("TgaImporter") & PluginManager::LoadState::Loaded))
CORRADE_SKIP("AnyImageImporter / TgaImporter plugins not found.");
CORRADE_COMPARE_WITH( CORRADE_COMPARE_WITH(
framebuffer.read({{}, {64, 64}}, {PixelFormat::RGBA8Unorm}), framebuffer.read({{}, {64, 64}}, {PixelFormat::RGBA8Unorm}),
Utility::Directory::join(DEBUGTOOLS_TEST_DIR, "ObjectRenderer2D.tga"), Utility::Directory::join(DEBUGTOOLS_TEST_DIR, "ObjectRenderer2D.tga"),
@ -143,6 +148,11 @@ void ObjectRendererGLTest::render3D() {
camera.draw(drawables); camera.draw(drawables);
MAGNUM_VERIFY_NO_GL_ERROR(); MAGNUM_VERIFY_NO_GL_ERROR();
if(!(_manager.loadState("AnyImageImporter") & PluginManager::LoadState::Loaded) ||
!(_manager.loadState("TgaImporter") & PluginManager::LoadState::Loaded))
CORRADE_SKIP("AnyImageImporter / TgaImporter plugins not found.");
CORRADE_COMPARE_WITH( CORRADE_COMPARE_WITH(
framebuffer.read({{}, {64, 64}}, {PixelFormat::RGBA8Unorm}), framebuffer.read({{}, {64, 64}}, {PixelFormat::RGBA8Unorm}),
Utility::Directory::join(DEBUGTOOLS_TEST_DIR, "ObjectRenderer3D.tga"), Utility::Directory::join(DEBUGTOOLS_TEST_DIR, "ObjectRenderer3D.tga"),

25
src/Magnum/DebugTools/Test/ScreenshotGLTest.cpp

@ -101,6 +101,10 @@ constexpr Color4ub DataRgba8[]{
}; };
void ScreenshotGLTest::rgba8() { void ScreenshotGLTest::rgba8() {
if(!(_converterManager.loadState("AnyImageConverter") & PluginManager::LoadState::Loaded) ||
!(_converterManager.loadState("TgaImageConverter") & PluginManager::LoadState::Loaded))
CORRADE_SKIP("AnyImageConverter / TgaImageConverter plugins not found.");
ImageView2D rgba{PixelFormat::RGBA8Unorm, {4, 3}, DataRgba8}; ImageView2D rgba{PixelFormat::RGBA8Unorm, {4, 3}, DataRgba8};
GL::Texture2D texture; GL::Texture2D texture;
@ -140,6 +144,11 @@ void ScreenshotGLTest::rgba8() {
CORRADE_VERIFY(succeeded); CORRADE_VERIFY(succeeded);
CORRADE_COMPARE(out.str(), CORRADE_COMPARE(out.str(),
Utility::formatString("DebugTools::screenshot(): saved a PixelFormat::RGBA8Unorm image of size Vector(4, 3) to {}\n", file)); Utility::formatString("DebugTools::screenshot(): saved a PixelFormat::RGBA8Unorm image of size Vector(4, 3) to {}\n", file));
if(!(_importerManager.loadState("AnyImageImporter") & PluginManager::LoadState::Loaded) ||
!(_importerManager.loadState("TgaImporter") & PluginManager::LoadState::Loaded))
CORRADE_SKIP("AnyImageImporter / TgaImporter plugins not found.");
CORRADE_COMPARE_WITH(file, rgba, CompareFileToImage{_importerManager}); CORRADE_COMPARE_WITH(file, rgba, CompareFileToImage{_importerManager});
} }
@ -155,6 +164,10 @@ void ScreenshotGLTest::r8() {
#ifdef MAGNUM_TARGET_GLES2 #ifdef MAGNUM_TARGET_GLES2
CORRADE_SKIP("Lumimance isn't renderable and the API doesn't support forcing a specific GL pixel format for EXT_texture_rg, can't test."); CORRADE_SKIP("Lumimance isn't renderable and the API doesn't support forcing a specific GL pixel format for EXT_texture_rg, can't test.");
#else #else
if(!(_converterManager.loadState("AnyImageConverter") & PluginManager::LoadState::Loaded) ||
!(_converterManager.loadState("TgaImageConverter") & PluginManager::LoadState::Loaded))
CORRADE_SKIP("AnyImageConverter / TgaImageConverter plugins not found.");
ImageView2D r{PixelFormat::R8Unorm, {4, 3}, DataR8}; ImageView2D r{PixelFormat::R8Unorm, {4, 3}, DataR8};
GL::Texture2D texture; GL::Texture2D texture;
@ -188,6 +201,11 @@ void ScreenshotGLTest::r8() {
CORRADE_VERIFY(succeeded); CORRADE_VERIFY(succeeded);
CORRADE_COMPARE(out.str(), CORRADE_COMPARE(out.str(),
Utility::formatString("DebugTools::screenshot(): saved a PixelFormat::R8Unorm image of size Vector(4, 3) to {}\n", file)); Utility::formatString("DebugTools::screenshot(): saved a PixelFormat::R8Unorm image of size Vector(4, 3) to {}\n", file));
if(!(_importerManager.loadState("AnyImageImporter") & PluginManager::LoadState::Loaded) ||
!(_importerManager.loadState("TgaImporter") & PluginManager::LoadState::Loaded))
CORRADE_SKIP("AnyImageImporter / TgaImporter plugins not found.");
CORRADE_COMPARE_WITH(file, r, CompareFileToImage{_importerManager}); CORRADE_COMPARE_WITH(file, r, CompareFileToImage{_importerManager});
#endif #endif
} }
@ -203,6 +221,10 @@ void ScreenshotGLTest::unknownFormat() {
CORRADE_COMPARE(framebuffer.checkStatus(GL::FramebufferTarget::Read), GL::Framebuffer::Status::Complete); CORRADE_COMPARE(framebuffer.checkStatus(GL::FramebufferTarget::Read), GL::Framebuffer::Status::Complete);
if(framebuffer.implementationColorReadFormat() == GL::PixelFormat::RGBA &&
framebuffer.implementationColorReadType() == GL::PixelType::UnsignedByte)
CORRADE_SKIP("The framebuffer read format is RGBA8, can't test.");
std::ostringstream out; std::ostringstream out;
bool succeeded; bool succeeded;
{ {
@ -254,6 +276,9 @@ void ScreenshotGLTest::pluginLoadFailed() {
} }
void ScreenshotGLTest::saveFailed() { void ScreenshotGLTest::saveFailed() {
if(!(_converterManager.loadState("AnyImageConverter") & PluginManager::LoadState::Loaded))
CORRADE_SKIP("AnyImageConverter plugin not found.");
ImageView2D rgba{PixelFormat::RGBA8Unorm, {4, 3}, DataRgba8}; ImageView2D rgba{PixelFormat::RGBA8Unorm, {4, 3}, DataRgba8};
GL::Texture2D texture; GL::Texture2D texture;

4
src/Magnum/TextureTools/Test/DistanceFieldGLTest.cpp

@ -72,8 +72,10 @@ DistanceFieldGLTest::DistanceFieldGLTest() {
/* Load the plugin directly from the build tree. Otherwise it's either /* Load the plugin directly from the build tree. Otherwise it's either
static and already loaded or not present in the build tree */ static and already loaded or not present in the build tree */
#if defined(ANYIMAGEIMPORTER_PLUGIN_FILENAME) && defined(TGAIMPORTER_PLUGIN_FILENAME) #ifdef ANYIMAGEIMPORTER_PLUGIN_FILENAME
CORRADE_INTERNAL_ASSERT(_manager.load(ANYIMAGEIMPORTER_PLUGIN_FILENAME) & PluginManager::LoadState::Loaded); CORRADE_INTERNAL_ASSERT(_manager.load(ANYIMAGEIMPORTER_PLUGIN_FILENAME) & PluginManager::LoadState::Loaded);
#endif
#ifdef TGAIMPORTER_PLUGIN_FILENAME
CORRADE_INTERNAL_ASSERT(_manager.load(TGAIMPORTER_PLUGIN_FILENAME) & PluginManager::LoadState::Loaded); CORRADE_INTERNAL_ASSERT(_manager.load(TGAIMPORTER_PLUGIN_FILENAME) & PluginManager::LoadState::Loaded);
#endif #endif

Loading…
Cancel
Save