From 511a50d54d4866b2cdfc228a7582c4a811342256 Mon Sep 17 00:00:00 2001 From: Max Schwarz Date: Fri, 8 Feb 2019 11:46:28 +0100 Subject: [PATCH] AnyImageConverter: test case for uppercase extensions --- .../Test/AnyImageConverterTest.cpp | 19 ++++++++++++++++++- 1 file changed, 18 insertions(+), 1 deletion(-) diff --git a/src/MagnumPlugins/AnyImageConverter/Test/AnyImageConverterTest.cpp b/src/MagnumPlugins/AnyImageConverter/Test/AnyImageConverterTest.cpp index 565a411eb..585cd8688 100644 --- a/src/MagnumPlugins/AnyImageConverter/Test/AnyImageConverterTest.cpp +++ b/src/MagnumPlugins/AnyImageConverter/Test/AnyImageConverterTest.cpp @@ -41,6 +41,8 @@ struct AnyImageConverterTest: TestSuite::Tester { void tga(); + void uppercase(); + void unknown(); /* Explicitly forbid system-wide plugin dependencies */ @@ -49,7 +51,7 @@ struct AnyImageConverterTest: TestSuite::Tester { AnyImageConverterTest::AnyImageConverterTest() { addTests({&AnyImageConverterTest::tga, - + &AnyImageConverterTest::uppercase, &AnyImageConverterTest::unknown}); /* Load the plugin directly from the build tree. Otherwise it's static and @@ -89,6 +91,21 @@ void AnyImageConverterTest::tga() { CORRADE_VERIFY(Utility::Directory::fileExists(filename)); } +void AnyImageConverterTest::uppercase() { + if(!(_manager.loadState("TgaImageConverter") & PluginManager::LoadState::Loaded)) + CORRADE_SKIP("TgaImageConverter plugin not enabled, cannot test"); + + const std::string filename = Utility::Directory::join(ANYIMAGECONVERTER_TEST_DIR, "output.TGA"); + + if(Utility::Directory::fileExists(filename)) + CORRADE_VERIFY(Utility::Directory::rm(filename)); + + /* Just test that the exported file exists */ + Containers::Pointer converter = _manager.instantiate("AnyImageConverter"); + CORRADE_VERIFY(converter->exportToFile(Image, filename)); + CORRADE_VERIFY(Utility::Directory::fileExists(filename)); +} + void AnyImageConverterTest::unknown() { std::ostringstream output; Error redirectError{&output};