Skip to content

Commit

Permalink
AnyImageConverter: minor cleanup in the test.
Browse files Browse the repository at this point in the history
  • Loading branch information
mosra committed Dec 12, 2021
1 parent 8d03168 commit fe8681d
Showing 1 changed file with 3 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -146,6 +146,7 @@ constexpr struct {
{"HDR", "file.hdr", "HdrImageConverter"},
{"JPEG", "file.jpg", "JpegImageConverter"},
{"JPEG weird extension", "file.jpe", "JpegImageConverter"},
/* Have at least one test case with uppercase */
{"JPEG uppercase", "output.JPG", "JpegImageConverter"},
{"KTX2", "foo.ktx2", "KtxImageConverter"},
{"PNG", "file.png", "PngImageConverter"}
Expand Down Expand Up @@ -333,7 +334,7 @@ void AnyImageConverterTest::convert2D() {
if(!(_manager.loadState("TgaImageConverter") & PluginManager::LoadState::Loaded))
CORRADE_SKIP("TgaImageConverter plugin not enabled, cannot test");

const std::string filename = Utility::Directory::join(ANYIMAGECONVERTER_TEST_OUTPUT_DIR, "output.tga");
const std::string filename = Utility::Directory::join(ANYIMAGECONVERTER_TEST_OUTPUT_DIR, "2d.tga");

if(Utility::Directory::exists(filename))
CORRADE_VERIFY(Utility::Directory::rm(filename));
Expand Down Expand Up @@ -905,13 +906,12 @@ void AnyImageConverterTest::propagateConfigurationUnknown2D() {
if(!(_manager.loadState("TgaImageConverter") & PluginManager::LoadState::Loaded))
CORRADE_SKIP("TgaImageConverter plugin not enabled, cannot test");

/* Just test that the exported file exists */
Containers::Pointer<AbstractImageConverter> converter = _manager.instantiate("AnyImageConverter");
converter->configuration().setValue("noSuchOption", "isHere");

std::ostringstream out;
Warning redirectWarning{&out};
CORRADE_VERIFY(converter->convertToFile(Image2D, Utility::Directory::join(ANYIMAGECONVERTER_TEST_OUTPUT_DIR, "output.tga")));
CORRADE_VERIFY(converter->convertToFile(Image2D, Utility::Directory::join(ANYIMAGECONVERTER_TEST_OUTPUT_DIR, "2d.tga")));
CORRADE_COMPARE(out.str(), "Trade::AnyImageConverter::convertToFile(): option noSuchOption not recognized by TgaImageConverter\n");
}

Expand All @@ -924,7 +924,6 @@ void AnyImageConverterTest::propagateConfigurationUnknown3D() {
if(manager.loadState("KtxImageConverter") < PluginManager::LoadState::Loaded)
CORRADE_SKIP("KtxImageConverter plugin can't be loaded.");

/* Just test that the exported file exists */
Containers::Pointer<AbstractImageConverter> converter = manager.instantiate("AnyImageConverter");
converter->configuration().setValue("noSuchOption", "isHere");

Expand Down

0 comments on commit fe8681d

Please sign in to comment.