Browse Source

Adapt tests to changes in Utility::Directory error reporting.

Now comparing just the message coming out of our code, ignoring the
system-specific message Directory prints.
pull/556/head
Vladimír Vondruš 4 years ago
parent
commit
97e45ea14d
  1. 37
      src/Magnum/ShaderTools/Test/AbstractConverterTest.cpp
  2. 14
      src/Magnum/Text/Test/AbstractFontConverterTest.cpp
  3. 73
      src/Magnum/Trade/Test/AbstractImageConverterTest.cpp
  4. 7
      src/Magnum/Trade/Test/AbstractSceneConverterTest.cpp

37
src/Magnum/ShaderTools/Test/AbstractConverterTest.cpp

@ -31,6 +31,7 @@
#include <Corrade/TestSuite/Tester.h> #include <Corrade/TestSuite/Tester.h>
#include <Corrade/TestSuite/Compare/Container.h> #include <Corrade/TestSuite/Compare/Container.h>
#include <Corrade/TestSuite/Compare/FileToString.h> #include <Corrade/TestSuite/Compare/FileToString.h>
#include <Corrade/TestSuite/Compare/String.h>
#include <Corrade/Utility/DebugStl.h> #include <Corrade/Utility/DebugStl.h>
#include <Corrade/Utility/Directory.h> #include <Corrade/Utility/Directory.h>
@ -1072,9 +1073,9 @@ void AbstractConverterTest::convertDataToFileThroughDataNotWritable() {
std::ostringstream out; std::ostringstream out;
Error redirectError{&out}; Error redirectError{&out};
CORRADE_VERIFY(!converter.convertDataToFile({}, nullptr, "/some/path/that/does/not/exist")); CORRADE_VERIFY(!converter.convertDataToFile({}, nullptr, "/some/path/that/does/not/exist"));
CORRADE_COMPARE(out.str(), CORRADE_COMPARE_AS(out.str(),
"Utility::Directory::write(): can't open /some/path/that/does/not/exist\n" "ShaderTools::AbstractConverter::convertDataToFile(): cannot write to file /some/path/that/does/not/exist\n",
"ShaderTools::AbstractConverter::convertDataToFile(): cannot write to file /some/path/that/does/not/exist\n"); TestSuite::Compare::StringHasSuffix);
} }
void AbstractConverterTest::convertDataToFileNotSupported() { void AbstractConverterTest::convertDataToFileNotSupported() {
@ -1228,9 +1229,9 @@ void AbstractConverterTest::convertFileToFileThroughDataNotWritable() {
std::ostringstream out; std::ostringstream out;
Error redirectError{&out}; Error redirectError{&out};
CORRADE_VERIFY(!converter.convertFileToFile({}, Utility::Directory::join(SHADERTOOLS_TEST_DIR, "file.dat"), "/some/path/that/does/not/exist")); CORRADE_VERIFY(!converter.convertFileToFile({}, Utility::Directory::join(SHADERTOOLS_TEST_DIR, "file.dat"), "/some/path/that/does/not/exist"));
CORRADE_COMPARE(out.str(), CORRADE_COMPARE_AS(out.str(),
"Utility::Directory::write(): can't open /some/path/that/does/not/exist\n" "ShaderTools::AbstractConverter::convertFileToFile(): cannot write to file /some/path/that/does/not/exist\n",
"ShaderTools::AbstractConverter::convertFileToFile(): cannot write to file /some/path/that/does/not/exist\n"); TestSuite::Compare::StringHasSuffix);
} }
void AbstractConverterTest::convertFileToFileNotSupported() { void AbstractConverterTest::convertFileToFileNotSupported() {
@ -1596,9 +1597,9 @@ void AbstractConverterTest::linkDataToFileThroughDataNotWritable() {
Error redirectError{&out}; Error redirectError{&out};
/* {{}} makes GCC 4.8 warn about zero as null pointer constant */ /* {{}} makes GCC 4.8 warn about zero as null pointer constant */
CORRADE_VERIFY(!converter.linkDataToFile({std::pair<Stage, Containers::ArrayView<const void>>{}}, "/some/path/that/does/not/exist")); CORRADE_VERIFY(!converter.linkDataToFile({std::pair<Stage, Containers::ArrayView<const void>>{}}, "/some/path/that/does/not/exist"));
CORRADE_COMPARE(out.str(), CORRADE_COMPARE_AS(out.str(),
"Utility::Directory::write(): can't open /some/path/that/does/not/exist\n" "ShaderTools::AbstractConverter::linkDataToFile(): cannot write to file /some/path/that/does/not/exist\n",
"ShaderTools::AbstractConverter::linkDataToFile(): cannot write to file /some/path/that/does/not/exist\n"); TestSuite::Compare::StringHasSuffix);
} }
void AbstractConverterTest::linkDataToFileNotSupported() { void AbstractConverterTest::linkDataToFileNotSupported() {
@ -1816,9 +1817,9 @@ void AbstractConverterTest::linkFilesToFileThroughDataNotWritable() {
CORRADE_VERIFY(!converter.linkFilesToFile({ CORRADE_VERIFY(!converter.linkFilesToFile({
{{}, Utility::Directory::join(SHADERTOOLS_TEST_DIR, "file.dat")} {{}, Utility::Directory::join(SHADERTOOLS_TEST_DIR, "file.dat")}
}, "/some/path/that/does/not/exist")); }, "/some/path/that/does/not/exist"));
CORRADE_COMPARE(out.str(), CORRADE_COMPARE_AS(out.str(),
"Utility::Directory::write(): can't open /some/path/that/does/not/exist\n" "ShaderTools::AbstractConverter::linkFilesToFile(): cannot write to file /some/path/that/does/not/exist\n",
"ShaderTools::AbstractConverter::linkFilesToFile(): cannot write to file /some/path/that/does/not/exist\n"); TestSuite::Compare::StringHasSuffix);
} }
void AbstractConverterTest::linkFilesToFileNotSupported() { void AbstractConverterTest::linkFilesToFileNotSupported() {
@ -2633,9 +2634,9 @@ void AbstractConverterTest::setInputFileCallbackConvertFileToFileAsDataNotWritab
CORRADE_VERIFY(!converter.convertFileToFile({}, "file.dat", "/some/path/that/does/not/exist")); CORRADE_VERIFY(!converter.convertFileToFile({}, "file.dat", "/some/path/that/does/not/exist"));
CORRADE_VERIFY(state.loaded); CORRADE_VERIFY(state.loaded);
CORRADE_VERIFY(state.closed); CORRADE_VERIFY(state.closed);
CORRADE_COMPARE(out.str(), CORRADE_COMPARE_AS(out.str(),
"Utility::Directory::write(): can't open /some/path/that/does/not/exist\n" "ShaderTools::AbstractConverter::convertFileToFile(): cannot write to file /some/path/that/does/not/exist\n",
"ShaderTools::AbstractConverter::convertFileToFile(): cannot write to file /some/path/that/does/not/exist\n"); TestSuite::Compare::StringHasSuffix);
} }
void AbstractConverterTest::setInputFileCallbackConvertFileToDataDirectly() { void AbstractConverterTest::setInputFileCallbackConvertFileToDataDirectly() {
@ -3147,9 +3148,9 @@ void AbstractConverterTest::setInputFileCallbackLinkFilesToFileAsDataNotWritable
"loaded file.dat\n" "loaded file.dat\n"
"closed another.dat\n" "closed another.dat\n"
"closed file.dat\n"); "closed file.dat\n");
CORRADE_COMPARE(out.str(), CORRADE_COMPARE_AS(out.str(),
"Utility::Directory::write(): can't open /some/path/that/does/not/exist\n" "ShaderTools::AbstractConverter::linkFilesToFile(): cannot write to file /some/path/that/does/not/exist\n",
"ShaderTools::AbstractConverter::linkFilesToFile(): cannot write to file /some/path/that/does/not/exist\n"); TestSuite::Compare::StringHasSuffix);
} }
void AbstractConverterTest::setInputFileCallbackLinkFilesToDataDirectly() { void AbstractConverterTest::setInputFileCallbackLinkFilesToDataDirectly() {

14
src/Magnum/Text/Test/AbstractFontConverterTest.cpp

@ -25,9 +25,11 @@
#include <sstream> #include <sstream>
#include <Corrade/Containers/Array.h> #include <Corrade/Containers/Array.h>
#include <Corrade/Containers/StringStl.h>
#include <Corrade/TestSuite/Tester.h> #include <Corrade/TestSuite/Tester.h>
#include <Corrade/TestSuite/Compare/FileToString.h> #include <Corrade/TestSuite/Compare/FileToString.h>
#include <Corrade/TestSuite/Compare/Container.h> #include <Corrade/TestSuite/Compare/Container.h>
#include <Corrade/TestSuite/Compare/String.h>
#include <Corrade/Utility/DebugStl.h> #include <Corrade/Utility/DebugStl.h>
#include <Corrade/Utility/Directory.h> #include <Corrade/Utility/Directory.h>
@ -491,9 +493,9 @@ void AbstractFontConverterTest::exportFontToFileThroughDataNotWritable() {
std::ostringstream out; std::ostringstream out;
Error redirectError{&out}; Error redirectError{&out};
CORRADE_VERIFY(!converter.exportFontToFile(dummyFont, dummyGlyphCache, "/some/path/that/does/not/exist", {})); CORRADE_VERIFY(!converter.exportFontToFile(dummyFont, dummyGlyphCache, "/some/path/that/does/not/exist", {}));
CORRADE_COMPARE(out.str(), CORRADE_COMPARE_AS(out.str(),
"Utility::Directory::write(): can't open /some/path/that/does/not/exist\n" "Text::AbstractFontConverter::exportFontToFile(): cannot write to file /some/path/that/does/not/exist\n",
"Text::AbstractFontConverter::exportFontToFile(): cannot write to file /some/path/that/does/not/exist\n"); TestSuite::Compare::StringHasSuffix);
} }
void AbstractFontConverterTest::exportGlyphCacheToSingleData() { void AbstractFontConverterTest::exportGlyphCacheToSingleData() {
@ -789,9 +791,9 @@ void AbstractFontConverterTest::exportGlyphCacheToFileThroughDataNotWritable() {
std::ostringstream out; std::ostringstream out;
Error redirectError{&out}; Error redirectError{&out};
CORRADE_VERIFY(!converter.exportGlyphCacheToFile(dummyGlyphCache, "/some/path/that/does/not/exist")); CORRADE_VERIFY(!converter.exportGlyphCacheToFile(dummyGlyphCache, "/some/path/that/does/not/exist"));
CORRADE_COMPARE(out.str(), CORRADE_COMPARE_AS(out.str(),
"Utility::Directory::write(): can't open /some/path/that/does/not/exist\n" "Text::AbstractFontConverter::exportGlyphCacheToFile(): cannot write to file /some/path/that/does/not/exist\n",
"Text::AbstractFontConverter::exportGlyphCacheToFile(): cannot write to file /some/path/that/does/not/exist\n"); TestSuite::Compare::StringHasSuffix);
} }
void AbstractFontConverterTest::importGlyphCacheFromSingleData() { void AbstractFontConverterTest::importGlyphCacheFromSingleData() {

73
src/Magnum/Trade/Test/AbstractImageConverterTest.cpp

@ -31,6 +31,7 @@
#include <Corrade/TestSuite/Tester.h> #include <Corrade/TestSuite/Tester.h>
#include <Corrade/TestSuite/Compare/Container.h> #include <Corrade/TestSuite/Compare/Container.h>
#include <Corrade/TestSuite/Compare/FileToString.h> #include <Corrade/TestSuite/Compare/FileToString.h>
#include <Corrade/TestSuite/Compare/String.h>
#include <Corrade/Utility/DebugStl.h> #include <Corrade/Utility/DebugStl.h>
#include <Corrade/Utility/Directory.h> #include <Corrade/Utility/Directory.h>
@ -2290,9 +2291,9 @@ void AbstractImageConverterTest::convert1DToFileThroughDataNotWritable() {
std::ostringstream out; std::ostringstream out;
Error redirectError{&out}; Error redirectError{&out};
CORRADE_VERIFY(!converter.convertToFile(ImageView1D{PixelFormat::RGBA8Unorm, 1, data}, "/some/path/that/does/not/exist")); CORRADE_VERIFY(!converter.convertToFile(ImageView1D{PixelFormat::RGBA8Unorm, 1, data}, "/some/path/that/does/not/exist"));
CORRADE_COMPARE(out.str(), CORRADE_COMPARE_AS(out.str(),
"Utility::Directory::write(): can't open /some/path/that/does/not/exist\n" "Trade::AbstractImageConverter::convertToFile(): cannot write to file /some/path/that/does/not/exist\n",
"Trade::AbstractImageConverter::convertToFile(): cannot write to file /some/path/that/does/not/exist\n"); TestSuite::Compare::StringHasSuffix);
} }
void AbstractImageConverterTest::convert2DToFileThroughDataNotWritable() { void AbstractImageConverterTest::convert2DToFileThroughDataNotWritable() {
@ -2308,9 +2309,9 @@ void AbstractImageConverterTest::convert2DToFileThroughDataNotWritable() {
std::ostringstream out; std::ostringstream out;
Error redirectError{&out}; Error redirectError{&out};
CORRADE_VERIFY(!converter.convertToFile(ImageView2D{PixelFormat::RGBA8Unorm, {1, 1}, data}, "/some/path/that/does/not/exist")); CORRADE_VERIFY(!converter.convertToFile(ImageView2D{PixelFormat::RGBA8Unorm, {1, 1}, data}, "/some/path/that/does/not/exist"));
CORRADE_COMPARE(out.str(), CORRADE_COMPARE_AS(out.str(),
"Utility::Directory::write(): can't open /some/path/that/does/not/exist\n" "Trade::AbstractImageConverter::convertToFile(): cannot write to file /some/path/that/does/not/exist\n",
"Trade::AbstractImageConverter::convertToFile(): cannot write to file /some/path/that/does/not/exist\n"); TestSuite::Compare::StringHasSuffix);
} }
void AbstractImageConverterTest::convert3DToFileThroughDataNotWritable() { void AbstractImageConverterTest::convert3DToFileThroughDataNotWritable() {
@ -2326,9 +2327,9 @@ void AbstractImageConverterTest::convert3DToFileThroughDataNotWritable() {
std::ostringstream out; std::ostringstream out;
Error redirectError{&out}; Error redirectError{&out};
CORRADE_VERIFY(!converter.convertToFile(ImageView3D{PixelFormat::RGBA8Unorm, {1, 1, 1}, data}, "/some/path/that/does/not/exist")); CORRADE_VERIFY(!converter.convertToFile(ImageView3D{PixelFormat::RGBA8Unorm, {1, 1, 1}, data}, "/some/path/that/does/not/exist"));
CORRADE_COMPARE(out.str(), CORRADE_COMPARE_AS(out.str(),
"Utility::Directory::write(): can't open /some/path/that/does/not/exist\n" "Trade::AbstractImageConverter::convertToFile(): cannot write to file /some/path/that/does/not/exist\n",
"Trade::AbstractImageConverter::convertToFile(): cannot write to file /some/path/that/does/not/exist\n"); TestSuite::Compare::StringHasSuffix);
} }
void AbstractImageConverterTest::convert1DToFileInvalidImage() { void AbstractImageConverterTest::convert1DToFileInvalidImage() {
@ -2635,9 +2636,9 @@ void AbstractImageConverterTest::convertCompressed1DToFileThroughDataNotWritable
std::ostringstream out; std::ostringstream out;
Error redirectError{&out}; Error redirectError{&out};
converter.convertToFile(CompressedImageView1D{CompressedPixelFormat::Bc1RGBAUnorm, 4, data}, "/some/path/that/does/not/exist"); converter.convertToFile(CompressedImageView1D{CompressedPixelFormat::Bc1RGBAUnorm, 4, data}, "/some/path/that/does/not/exist");
CORRADE_COMPARE(out.str(), CORRADE_COMPARE_AS(out.str(),
"Utility::Directory::write(): can't open /some/path/that/does/not/exist\n" "Trade::AbstractImageConverter::convertToFile(): cannot write to file /some/path/that/does/not/exist\n",
"Trade::AbstractImageConverter::convertToFile(): cannot write to file /some/path/that/does/not/exist\n"); TestSuite::Compare::StringHasSuffix);
} }
void AbstractImageConverterTest::convertCompressed2DToFileThroughDataNotWritable() { void AbstractImageConverterTest::convertCompressed2DToFileThroughDataNotWritable() {
@ -2653,9 +2654,9 @@ void AbstractImageConverterTest::convertCompressed2DToFileThroughDataNotWritable
std::ostringstream out; std::ostringstream out;
Error redirectError{&out}; Error redirectError{&out};
converter.convertToFile(CompressedImageView2D{CompressedPixelFormat::Bc1RGBAUnorm, {4, 4}, data}, "/some/path/that/does/not/exist"); converter.convertToFile(CompressedImageView2D{CompressedPixelFormat::Bc1RGBAUnorm, {4, 4}, data}, "/some/path/that/does/not/exist");
CORRADE_COMPARE(out.str(), CORRADE_COMPARE_AS(out.str(),
"Utility::Directory::write(): can't open /some/path/that/does/not/exist\n" "Trade::AbstractImageConverter::convertToFile(): cannot write to file /some/path/that/does/not/exist\n",
"Trade::AbstractImageConverter::convertToFile(): cannot write to file /some/path/that/does/not/exist\n"); TestSuite::Compare::StringHasSuffix);
} }
void AbstractImageConverterTest::convertCompressed3DToFileThroughDataNotWritable() { void AbstractImageConverterTest::convertCompressed3DToFileThroughDataNotWritable() {
@ -2671,9 +2672,9 @@ void AbstractImageConverterTest::convertCompressed3DToFileThroughDataNotWritable
std::ostringstream out; std::ostringstream out;
Error redirectError{&out}; Error redirectError{&out};
converter.convertToFile(CompressedImageView3D{CompressedPixelFormat::Bc1RGBAUnorm, {4, 4, 1}, data}, "/some/path/that/does/not/exist"); converter.convertToFile(CompressedImageView3D{CompressedPixelFormat::Bc1RGBAUnorm, {4, 4, 1}, data}, "/some/path/that/does/not/exist");
CORRADE_COMPARE(out.str(), CORRADE_COMPARE_AS(out.str(),
"Utility::Directory::write(): can't open /some/path/that/does/not/exist\n" "Trade::AbstractImageConverter::convertToFile(): cannot write to file /some/path/that/does/not/exist\n",
"Trade::AbstractImageConverter::convertToFile(): cannot write to file /some/path/that/does/not/exist\n"); TestSuite::Compare::StringHasSuffix);
} }
void AbstractImageConverterTest::convertCompressed1DToFileInvalidImage() { void AbstractImageConverterTest::convertCompressed1DToFileInvalidImage() {
@ -3049,9 +3050,9 @@ void AbstractImageConverterTest::convertLevels1DToFileThroughDataNotWritable() {
std::ostringstream out; std::ostringstream out;
Error redirectError{&out}; Error redirectError{&out};
CORRADE_VERIFY(!converter.convertToFile({ImageView1D{PixelFormat::RGBA8Unorm, 1, data}}, "/some/path/that/does/not/exist")); CORRADE_VERIFY(!converter.convertToFile({ImageView1D{PixelFormat::RGBA8Unorm, 1, data}}, "/some/path/that/does/not/exist"));
CORRADE_COMPARE(out.str(), CORRADE_COMPARE_AS(out.str(),
"Utility::Directory::write(): can't open /some/path/that/does/not/exist\n" "Trade::AbstractImageConverter::convertToFile(): cannot write to file /some/path/that/does/not/exist\n",
"Trade::AbstractImageConverter::convertToFile(): cannot write to file /some/path/that/does/not/exist\n"); TestSuite::Compare::StringHasSuffix);
} }
void AbstractImageConverterTest::convertLevels2DToFileThroughDataNotWritable() { void AbstractImageConverterTest::convertLevels2DToFileThroughDataNotWritable() {
@ -3067,9 +3068,9 @@ void AbstractImageConverterTest::convertLevels2DToFileThroughDataNotWritable() {
std::ostringstream out; std::ostringstream out;
Error redirectError{&out}; Error redirectError{&out};
CORRADE_VERIFY(!converter.convertToFile({ImageView2D{PixelFormat::RGBA8Unorm, {1, 1}, data}}, "/some/path/that/does/not/exist")); CORRADE_VERIFY(!converter.convertToFile({ImageView2D{PixelFormat::RGBA8Unorm, {1, 1}, data}}, "/some/path/that/does/not/exist"));
CORRADE_COMPARE(out.str(), CORRADE_COMPARE_AS(out.str(),
"Utility::Directory::write(): can't open /some/path/that/does/not/exist\n" "Trade::AbstractImageConverter::convertToFile(): cannot write to file /some/path/that/does/not/exist\n",
"Trade::AbstractImageConverter::convertToFile(): cannot write to file /some/path/that/does/not/exist\n"); TestSuite::Compare::StringHasSuffix);
} }
void AbstractImageConverterTest::convertLevels3DToFileThroughDataNotWritable() { void AbstractImageConverterTest::convertLevels3DToFileThroughDataNotWritable() {
@ -3085,9 +3086,9 @@ void AbstractImageConverterTest::convertLevels3DToFileThroughDataNotWritable() {
std::ostringstream out; std::ostringstream out;
Error redirectError{&out}; Error redirectError{&out};
CORRADE_VERIFY(!converter.convertToFile({ImageView3D{PixelFormat::RGBA8Unorm, {1, 1, 1}, data}}, "/some/path/that/does/not/exist")); CORRADE_VERIFY(!converter.convertToFile({ImageView3D{PixelFormat::RGBA8Unorm, {1, 1, 1}, data}}, "/some/path/that/does/not/exist"));
CORRADE_COMPARE(out.str(), CORRADE_COMPARE_AS(out.str(),
"Utility::Directory::write(): can't open /some/path/that/does/not/exist\n" "Trade::AbstractImageConverter::convertToFile(): cannot write to file /some/path/that/does/not/exist\n",
"Trade::AbstractImageConverter::convertToFile(): cannot write to file /some/path/that/does/not/exist\n"); TestSuite::Compare::StringHasSuffix);
} }
void AbstractImageConverterTest::convertLevels1DToFileInvalidImage() { void AbstractImageConverterTest::convertLevels1DToFileInvalidImage() {
@ -3418,9 +3419,9 @@ void AbstractImageConverterTest::convertCompressedLevels1DToFileThroughDataNotWr
std::ostringstream out; std::ostringstream out;
Error redirectError{&out}; Error redirectError{&out};
converter.convertToFile({CompressedImageView1D{CompressedPixelFormat::Bc1RGBAUnorm, 4, data}}, "/some/path/that/does/not/exist"); converter.convertToFile({CompressedImageView1D{CompressedPixelFormat::Bc1RGBAUnorm, 4, data}}, "/some/path/that/does/not/exist");
CORRADE_COMPARE(out.str(), CORRADE_COMPARE_AS(out.str(),
"Utility::Directory::write(): can't open /some/path/that/does/not/exist\n" "Trade::AbstractImageConverter::convertToFile(): cannot write to file /some/path/that/does/not/exist\n",
"Trade::AbstractImageConverter::convertToFile(): cannot write to file /some/path/that/does/not/exist\n"); TestSuite::Compare::StringHasSuffix);
} }
void AbstractImageConverterTest::convertCompressedLevels2DToFileThroughDataNotWritable() { void AbstractImageConverterTest::convertCompressedLevels2DToFileThroughDataNotWritable() {
@ -3436,9 +3437,9 @@ void AbstractImageConverterTest::convertCompressedLevels2DToFileThroughDataNotWr
std::ostringstream out; std::ostringstream out;
Error redirectError{&out}; Error redirectError{&out};
converter.convertToFile({CompressedImageView2D{CompressedPixelFormat::Bc1RGBAUnorm, {4, 4}, data}}, "/some/path/that/does/not/exist"); converter.convertToFile({CompressedImageView2D{CompressedPixelFormat::Bc1RGBAUnorm, {4, 4}, data}}, "/some/path/that/does/not/exist");
CORRADE_COMPARE(out.str(), CORRADE_COMPARE_AS(out.str(),
"Utility::Directory::write(): can't open /some/path/that/does/not/exist\n" "Trade::AbstractImageConverter::convertToFile(): cannot write to file /some/path/that/does/not/exist\n",
"Trade::AbstractImageConverter::convertToFile(): cannot write to file /some/path/that/does/not/exist\n"); TestSuite::Compare::StringHasSuffix);
} }
void AbstractImageConverterTest::convertCompressedLevels3DToFileThroughDataNotWritable() { void AbstractImageConverterTest::convertCompressedLevels3DToFileThroughDataNotWritable() {
@ -3454,9 +3455,9 @@ void AbstractImageConverterTest::convertCompressedLevels3DToFileThroughDataNotWr
std::ostringstream out; std::ostringstream out;
Error redirectError{&out}; Error redirectError{&out};
converter.convertToFile({CompressedImageView3D{CompressedPixelFormat::Bc1RGBAUnorm, {4, 4, 1}, data}}, "/some/path/that/does/not/exist"); converter.convertToFile({CompressedImageView3D{CompressedPixelFormat::Bc1RGBAUnorm, {4, 4, 1}, data}}, "/some/path/that/does/not/exist");
CORRADE_COMPARE(out.str(), CORRADE_COMPARE_AS(out.str(),
"Utility::Directory::write(): can't open /some/path/that/does/not/exist\n" "Trade::AbstractImageConverter::convertToFile(): cannot write to file /some/path/that/does/not/exist\n",
"Trade::AbstractImageConverter::convertToFile(): cannot write to file /some/path/that/does/not/exist\n"); TestSuite::Compare::StringHasSuffix);
} }
void AbstractImageConverterTest::convertCompressedLevels1DToFileInvalidImage() { void AbstractImageConverterTest::convertCompressedLevels1DToFileInvalidImage() {

7
src/Magnum/Trade/Test/AbstractSceneConverterTest.cpp

@ -30,6 +30,7 @@
#include <Corrade/TestSuite/Tester.h> #include <Corrade/TestSuite/Tester.h>
#include <Corrade/TestSuite/Compare/Container.h> #include <Corrade/TestSuite/Compare/Container.h>
#include <Corrade/TestSuite/Compare/FileToString.h> #include <Corrade/TestSuite/Compare/FileToString.h>
#include <Corrade/TestSuite/Compare/String.h>
#include <Corrade/Utility/DebugStl.h> #include <Corrade/Utility/DebugStl.h>
#include <Corrade/Utility/Directory.h> #include <Corrade/Utility/Directory.h>
@ -517,9 +518,9 @@ void AbstractSceneConverterTest::convertMeshToFileThroughDataNotWritable() {
std::ostringstream out; std::ostringstream out;
Error redirectError{&out}; Error redirectError{&out};
CORRADE_VERIFY(!converter.convertToFile(MeshData{MeshPrimitive::Triangles, 0xef}, "/some/path/that/does/not/exist")); CORRADE_VERIFY(!converter.convertToFile(MeshData{MeshPrimitive::Triangles, 0xef}, "/some/path/that/does/not/exist"));
CORRADE_COMPARE(out.str(), CORRADE_COMPARE_AS(out.str(),
"Utility::Directory::write(): can't open /some/path/that/does/not/exist\n" "Trade::AbstractSceneConverter::convertToFile(): cannot write to file /some/path/that/does/not/exist\n",
"Trade::AbstractSceneConverter::convertToFile(): cannot write to file /some/path/that/does/not/exist\n"); TestSuite::Compare::StringHasSuffix);
} }
void AbstractSceneConverterTest::convertMeshToFileNotImplemented() { void AbstractSceneConverterTest::convertMeshToFileNotImplemented() {

Loading…
Cancel
Save