Browse Source

Audio,ShaderTools,Text,Trade: packed debug printing for all Feature enums.

pull/589/head
Vladimír Vondruš 4 years ago
parent
commit
f0ad33f850
  1. 11
      src/Magnum/Audio/AbstractImporter.cpp
  2. 20
      src/Magnum/Audio/Test/AbstractImporterTest.cpp
  3. 11
      src/Magnum/ShaderTools/AbstractConverter.cpp
  4. 18
      src/Magnum/ShaderTools/Test/AbstractConverterTest.cpp
  5. 11
      src/Magnum/Text/AbstractFont.cpp
  6. 11
      src/Magnum/Text/AbstractFontConverter.cpp
  7. 20
      src/Magnum/Text/Test/AbstractFontConverterTest.cpp
  8. 20
      src/Magnum/Text/Test/AbstractFontTest.cpp
  9. 13
      src/Magnum/Trade/AbstractImageConverter.cpp
  10. 11
      src/Magnum/Trade/AbstractImporter.cpp
  11. 11
      src/Magnum/Trade/AbstractSceneConverter.cpp
  12. 30
      src/Magnum/Trade/Test/AbstractImageConverterTest.cpp
  13. 18
      src/Magnum/Trade/Test/AbstractImporterTest.cpp
  14. 18
      src/Magnum/Trade/Test/AbstractSceneConverterTest.cpp

11
src/Magnum/Audio/AbstractImporter.cpp

@ -145,21 +145,24 @@ Containers::Array<char> AbstractImporter::data() {
}
Debug& operator<<(Debug& debug, const ImporterFeature value) {
debug << "Audio::ImporterFeature" << Debug::nospace;
const bool packed = debug.immediateFlags() >= Debug::Flag::Packed;
if(!packed)
debug << "Audio::ImporterFeature" << Debug::nospace;
switch(value) {
/* LCOV_EXCL_START */
#define _c(v) case ImporterFeature::v: return debug << "::" #v;
#define _c(v) case ImporterFeature::v: return debug << (packed ? "" : "::") << Debug::nospace << #v;
_c(OpenData)
#undef _c
/* LCOV_EXCL_STOP */
}
return debug << "(" << Debug::nospace << reinterpret_cast<void*>(UnsignedByte(value)) << Debug::nospace << ")";
return debug << (packed ? "" : "(") << Debug::nospace << reinterpret_cast<void*>(UnsignedByte(value)) << Debug::nospace << (packed ? "" : ")");
}
Debug& operator<<(Debug& debug, const ImporterFeatures value) {
return Containers::enumSetDebugOutput(debug, value, "Audio::ImporterFeatures{}", {
return Containers::enumSetDebugOutput(debug, value, debug.immediateFlags() >= Debug::Flag::Packed ? "{}" : "Audio::ImporterFeatures{}", {
ImporterFeature::OpenData});
}

20
src/Magnum/Audio/Test/AbstractImporterTest.cpp

@ -67,7 +67,9 @@ struct AbstractImporterTest: TestSuite::Tester {
void dataCustomDeleter();
void debugFeature();
void debugFeaturePacked();
void debugFeatures();
void debugFeaturesPacked();
};
AbstractImporterTest::AbstractImporterTest() {
@ -92,7 +94,9 @@ AbstractImporterTest::AbstractImporterTest() {
&AbstractImporterTest::dataCustomDeleter,
&AbstractImporterTest::debugFeature,
&AbstractImporterTest::debugFeatures});
&AbstractImporterTest::debugFeaturePacked,
&AbstractImporterTest::debugFeatures,
&AbstractImporterTest::debugFeaturesPacked});
}
void AbstractImporterTest::construct() {
@ -388,6 +392,13 @@ void AbstractImporterTest::debugFeature() {
CORRADE_COMPARE(out.str(), "Audio::ImporterFeature::OpenData Audio::ImporterFeature(0xf0)\n");
}
void AbstractImporterTest::debugFeaturePacked() {
std::ostringstream out;
/* Last is not packed, ones before should not make any flags persistent */
Debug{&out} << Debug::packed << ImporterFeature::OpenData << Debug::packed << ImporterFeature(0xf0) << ImporterFeature::OpenData;
CORRADE_COMPARE(out.str(), "OpenData 0xf0 Audio::ImporterFeature::OpenData\n");
}
void AbstractImporterTest::debugFeatures() {
std::ostringstream out;
@ -395,6 +406,13 @@ void AbstractImporterTest::debugFeatures() {
CORRADE_COMPARE(out.str(), "Audio::ImporterFeature::OpenData|Audio::ImporterFeature(0xf0) Audio::ImporterFeatures{}\n");
}
void AbstractImporterTest::debugFeaturesPacked() {
std::ostringstream out;
/* Last is not packed, ones before should not make any flags persistent */
Debug{&out} << Debug::packed << (ImporterFeature::OpenData|ImporterFeature(0xf0)) << Debug::packed << ImporterFeatures{} << ImporterFeature::OpenData;
CORRADE_COMPARE(out.str(), "OpenData|0xf0 {} Audio::ImporterFeature::OpenData\n");
}
}}}}
CORRADE_TEST_MAIN(Magnum::Audio::Test::AbstractImporterTest)

11
src/Magnum/ShaderTools/AbstractConverter.cpp

@ -733,11 +733,14 @@ Containers::Optional<Containers::Array<char>> AbstractConverter::doLinkFilesToDa
}
Debug& operator<<(Debug& debug, const ConverterFeature value) {
debug << "ShaderTools::ConverterFeature" << Debug::nospace;
const bool packed = debug.immediateFlags() >= Debug::Flag::Packed;
if(!packed)
debug << "ShaderTools::ConverterFeature" << Debug::nospace;
switch(value) {
/* LCOV_EXCL_START */
#define _c(v) case ConverterFeature::v: return debug << "::" #v;
#define _c(v) case ConverterFeature::v: return debug << (packed ? "" : "::") << Debug::nospace << #v;
_c(ValidateData)
_c(ValidateFile)
_c(ConvertData)
@ -752,11 +755,11 @@ Debug& operator<<(Debug& debug, const ConverterFeature value) {
/* LCOV_EXCL_STOP */
}
return debug << "(" << Debug::nospace << reinterpret_cast<void*>(UnsignedByte(value)) << Debug::nospace << ")";
return debug << (packed ? "" : "(") << Debug::nospace << reinterpret_cast<void*>(UnsignedByte(value)) << Debug::nospace << (packed ? "" : ")");
}
Debug& operator<<(Debug& debug, const ConverterFeatures value) {
return Containers::enumSetDebugOutput(debug, value, "ShaderTools::ConverterFeatures{}", {
return Containers::enumSetDebugOutput(debug, value, debug.immediateFlags() >= Debug::Flag::Packed ? "{}" : "ShaderTools::ConverterFeatures{}", {
ConverterFeature::ValidateData,
/* Implied by ValidateData, has to be after */
ConverterFeature::ValidateFile,

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

@ -189,7 +189,9 @@ struct AbstractConverterTest: TestSuite::Tester {
void setInputFileCallbackLinkFilesToDataAsDataFailed();
void debugFeature();
void debugFeaturePacked();
void debugFeatures();
void debugFeaturesPacked();
void debugFeaturesSupersets();
void debugFlag();
void debugFlags();
@ -339,7 +341,9 @@ AbstractConverterTest::AbstractConverterTest() {
&AbstractConverterTest::setInputFileCallbackLinkFilesToDataAsDataFailed,
&AbstractConverterTest::debugFeature,
&AbstractConverterTest::debugFeaturePacked,
&AbstractConverterTest::debugFeatures,
&AbstractConverterTest::debugFeaturesPacked,
&AbstractConverterTest::debugFeaturesSupersets,
&AbstractConverterTest::debugFlag,
&AbstractConverterTest::debugFlags,
@ -3533,6 +3537,13 @@ void AbstractConverterTest::debugFeature() {
CORRADE_COMPARE(out.str(), "ShaderTools::ConverterFeature::ConvertData ShaderTools::ConverterFeature(0xf0)\n");
}
void AbstractConverterTest::debugFeaturePacked() {
std::ostringstream out;
/* Last is not packed, ones before should not make any flags persistent */
Debug{&out} << Debug::packed << ConverterFeature::ConvertData << Debug::packed << ConverterFeature(0xf0) << ConverterFeature::ValidateFile;
CORRADE_COMPARE(out.str(), "ConvertData 0xf0 ShaderTools::ConverterFeature::ValidateFile\n");
}
void AbstractConverterTest::debugFeatures() {
std::ostringstream out;
@ -3540,6 +3551,13 @@ void AbstractConverterTest::debugFeatures() {
CORRADE_COMPARE(out.str(), "ShaderTools::ConverterFeature::ValidateData|ShaderTools::ConverterFeature::ConvertFile ShaderTools::ConverterFeatures{}\n");
}
void AbstractConverterTest::debugFeaturesPacked() {
std::ostringstream out;
/* Last is not packed, ones before should not make any flags persistent */
Debug{&out} << Debug::packed << (ConverterFeature::ValidateData|ConverterFeature::ConvertFile) << Debug::packed << ConverterFeatures{} << ConverterFeature::InputFileCallback;
CORRADE_COMPARE(out.str(), "ValidateData|ConvertFile {} ShaderTools::ConverterFeature::InputFileCallback\n");
}
void AbstractConverterTest::debugFeaturesSupersets() {
/* ValidateData is a superset of ValidateFile, so only one should be
printed */

11
src/Magnum/Text/AbstractFont.cpp

@ -283,11 +283,14 @@ Containers::Pointer<AbstractLayouter> AbstractFont::layout(const AbstractGlyphCa
}
Debug& operator<<(Debug& debug, const FontFeature value) {
debug << "Text::FontFeature" << Debug::nospace;
const bool packed = debug.immediateFlags() >= Debug::Flag::Packed;
if(!packed)
debug << "Text::FontFeature" << Debug::nospace;
switch(value) {
/* LCOV_EXCL_START */
#define _c(v) case FontFeature::v: return debug << "::" #v;
#define _c(v) case FontFeature::v: return debug << (packed ? "" : "::") << Debug::nospace << #v;
_c(OpenData)
_c(FileCallback)
_c(PreparedGlyphCache)
@ -295,11 +298,11 @@ Debug& operator<<(Debug& debug, const FontFeature value) {
/* LCOV_EXCL_STOP */
}
return debug << "(" << Debug::nospace << reinterpret_cast<void*>(UnsignedByte(value)) << Debug::nospace << ")";
return debug << (packed ? "" : "(") << Debug::nospace << reinterpret_cast<void*>(UnsignedByte(value)) << Debug::nospace << (packed ? "" : ")");
}
Debug& operator<<(Debug& debug, const FontFeatures value) {
return Containers::enumSetDebugOutput(debug, value, "Text::FontFeatures{}", {
return Containers::enumSetDebugOutput(debug, value, debug.immediateFlags() >= Debug::Flag::Packed ? "{}" : "Text::FontFeatures{}", {
FontFeature::OpenData,
FontFeature::FileCallback,
FontFeature::PreparedGlyphCache});

11
src/Magnum/Text/AbstractFontConverter.cpp

@ -263,11 +263,14 @@ Containers::Pointer<AbstractGlyphCache> AbstractFontConverter::doImportGlyphCach
}
Debug& operator<<(Debug& debug, const FontConverterFeature value) {
debug << "Text::FontConverterFeature" << Debug::nospace;
const bool packed = debug.immediateFlags() >= Debug::Flag::Packed;
if(!packed)
debug << "Text::FontConverterFeature" << Debug::nospace;
switch(value) {
/* LCOV_EXCL_START */
#define _c(v) case FontConverterFeature::v: return debug << "::" #v;
#define _c(v) case FontConverterFeature::v: return debug << (packed ? "" : "::") << Debug::nospace << #v;
_c(ExportFont)
_c(ExportGlyphCache)
_c(ImportGlyphCache)
@ -277,11 +280,11 @@ Debug& operator<<(Debug& debug, const FontConverterFeature value) {
/* LCOV_EXCL_STOP */
}
return debug << "(" << Debug::nospace << reinterpret_cast<void*>(Containers::enumCastUnderlyingType(value)) << Debug::nospace << ")";
return debug << (packed ? "" : "(") << Debug::nospace << reinterpret_cast<void*>(Containers::enumCastUnderlyingType(value)) << Debug::nospace << (packed ? "" : ")");
}
Debug& operator<<(Debug& debug, const FontConverterFeatures value) {
return Containers::enumSetDebugOutput(debug, value, "Text::FontConverterFeatures{}", {
return Containers::enumSetDebugOutput(debug, value, debug.immediateFlags() >= Debug::Flag::Packed ? "{}" : "Text::FontConverterFeatures{}", {
FontConverterFeature::ExportFont,
FontConverterFeature::ExportGlyphCache,
FontConverterFeature::ImportGlyphCache,

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

@ -95,7 +95,9 @@ struct AbstractFontConverterTest: TestSuite::Tester {
void importGlyphCacheFromFileAsSingleDataNotFound();
void debugFeature();
void debugFeaturePacked();
void debugFeatures();
void debugFeaturesPacked();
};
AbstractFontConverterTest::AbstractFontConverterTest() {
@ -149,7 +151,9 @@ AbstractFontConverterTest::AbstractFontConverterTest() {
&AbstractFontConverterTest::importGlyphCacheFromFileAsSingleDataNotFound,
&AbstractFontConverterTest::debugFeature,
&AbstractFontConverterTest::debugFeatures});
&AbstractFontConverterTest::debugFeaturePacked,
&AbstractFontConverterTest::debugFeatures,
&AbstractFontConverterTest::debugFeaturesPacked});
/* Create testing dir */
Utility::Path::make(TEXT_TEST_OUTPUT_DIR);
@ -1019,6 +1023,13 @@ void AbstractFontConverterTest::debugFeature() {
CORRADE_COMPARE(out.str(), "Text::FontConverterFeature::ExportFont Text::FontConverterFeature(0xf0)\n");
}
void AbstractFontConverterTest::debugFeaturePacked() {
std::ostringstream out;
/* Last is not packed, ones before should not make any flags persistent */
Debug{&out} << Debug::packed << FontConverterFeature::ExportFont << Debug::packed << FontConverterFeature(0xf0) << FontConverterFeature::ImportGlyphCache;
CORRADE_COMPARE(out.str(), "ExportFont 0xf0 Text::FontConverterFeature::ImportGlyphCache\n");
}
void AbstractFontConverterTest::debugFeatures() {
std::ostringstream out;
@ -1026,6 +1037,13 @@ void AbstractFontConverterTest::debugFeatures() {
CORRADE_COMPARE(out.str(), "Text::FontConverterFeature::ExportFont|Text::FontConverterFeature::ImportGlyphCache Text::FontConverterFeatures{}\n");
}
void AbstractFontConverterTest::debugFeaturesPacked() {
std::ostringstream out;
/* Last is not packed, ones before should not make any flags persistent */
Debug{&out} << Debug::packed << (FontConverterFeature::ExportFont|FontConverterFeature::ImportGlyphCache) << Debug::packed << FontConverterFeatures{} << FontConverterFeature::ExportGlyphCache;
CORRADE_COMPARE(out.str(), "ExportFont|ImportGlyphCache {} Text::FontConverterFeature::ExportGlyphCache\n");
}
}}}}
CORRADE_TEST_MAIN(Magnum::Text::Test::AbstractFontConverterTest)

20
src/Magnum/Text/Test/AbstractFontTest.cpp

@ -95,7 +95,9 @@ struct AbstractFontTest: TestSuite::Tester {
void createGlyphCacheNoFont();
void debugFeature();
void debugFeaturePacked();
void debugFeatures();
void debugFeaturesPacked();
};
AbstractFontTest::AbstractFontTest() {
@ -150,7 +152,9 @@ AbstractFontTest::AbstractFontTest() {
&AbstractFontTest::createGlyphCacheNoFont,
&AbstractFontTest::debugFeature,
&AbstractFontTest::debugFeatures});
&AbstractFontTest::debugFeaturePacked,
&AbstractFontTest::debugFeatures,
&AbstractFontTest::debugFeaturesPacked});
}
void AbstractFontTest::construct() {
@ -1154,6 +1158,13 @@ void AbstractFontTest::debugFeature() {
CORRADE_COMPARE(out.str(), "Text::FontFeature::OpenData Text::FontFeature(0xf0)\n");
}
void AbstractFontTest::debugFeaturePacked() {
std::ostringstream out;
/* Last is not packed, ones before should not make any flags persistent */
Debug{&out} << Debug::packed << FontFeature::OpenData << Debug::packed << FontFeature(0xf0) << FontFeature::FileCallback;
CORRADE_COMPARE(out.str(), "OpenData 0xf0 Text::FontFeature::FileCallback\n");
}
void AbstractFontTest::debugFeatures() {
std::ostringstream out;
@ -1161,6 +1172,13 @@ void AbstractFontTest::debugFeatures() {
CORRADE_COMPARE(out.str(), "Text::FontFeature::OpenData|Text::FontFeature::PreparedGlyphCache Text::FontFeatures{}\n");
}
void AbstractFontTest::debugFeaturesPacked() {
std::ostringstream out;
/* Last is not packed, ones before should not make any flags persistent */
Debug{&out} << Debug::packed << (FontFeature::OpenData|FontFeature::PreparedGlyphCache) << Debug::packed << FontFeatures{} << FontFeature::FileCallback;
CORRADE_COMPARE(out.str(), "OpenData|PreparedGlyphCache {} Text::FontFeature::FileCallback\n");
}
}}}}
CORRADE_TEST_MAIN(Magnum::Text::Test::AbstractFontTest)

13
src/Magnum/Trade/AbstractImageConverter.cpp

@ -1278,18 +1278,21 @@ bool AbstractImageConverter::doConvertToFile(const Containers::ArrayView<const C
}
Debug& operator<<(Debug& debug, const ImageConverterFeature value) {
const bool packed = debug.immediateFlags() >= Debug::Flag::Packed;
#ifdef MAGNUM_BUILD_DEPRECATED
/* If printing a deprecated flag combination, make it look like the enum
set */
if((value & ImageConverterFeature::Levels) && (value & ~ImageConverterFeature::Levels))
return debug << (value & ~ImageConverterFeature::Levels) << Debug::nospace << "|Trade::ImageConverterFeature::Levels";
return debug << (value & ~ImageConverterFeature::Levels) << Debug::nospace << (packed ? "|Levels" : "|Trade::ImageConverterFeature::Levels");
#endif
debug << "Trade::ImageConverterFeature" << Debug::nospace;
if(!packed)
debug << "Trade::ImageConverterFeature" << Debug::nospace;
switch(value) {
/* LCOV_EXCL_START */
#define _c(v) case ImageConverterFeature::v: return debug << "::" #v;
#define _c(v) case ImageConverterFeature::v: return debug << (packed ? "" : "::") << Debug::nospace << #v;
_c(Convert1D)
_c(Convert2D)
_c(Convert3D)
@ -1333,11 +1336,11 @@ Debug& operator<<(Debug& debug, const ImageConverterFeature value) {
#endif
}
return debug << "(" << Debug::nospace << reinterpret_cast<void*>(UnsignedInt(value)) << Debug::nospace << ")";
return debug << (packed ? "" : "(") << Debug::nospace << reinterpret_cast<void*>(UnsignedInt(value)) << Debug::nospace << (packed ? "" : ")");
}
Debug& operator<<(Debug& debug, const ImageConverterFeatures value) {
return Containers::enumSetDebugOutput(debug, value, "Trade::ImageConverterFeatures{}", {
return Containers::enumSetDebugOutput(debug, value, debug.immediateFlags() >= Debug::Flag::Packed ? "{}" : "Trade::ImageConverterFeatures{}", {
ImageConverterFeature::Convert1D,
ImageConverterFeature::Convert2D,
ImageConverterFeature::Convert3D,

11
src/Magnum/Trade/AbstractImporter.cpp

@ -1598,11 +1598,14 @@ const void* AbstractImporter::importerState() const {
const void* AbstractImporter::doImporterState() const { return nullptr; }
Debug& operator<<(Debug& debug, const ImporterFeature value) {
debug << "Trade::ImporterFeature" << Debug::nospace;
const bool packed = debug.immediateFlags() >= Debug::Flag::Packed;
if(!packed)
debug << "Trade::ImporterFeature" << Debug::nospace;
switch(value) {
/* LCOV_EXCL_START */
#define _c(v) case ImporterFeature::v: return debug << "::" #v;
#define _c(v) case ImporterFeature::v: return debug << (packed ? "" : "::") << Debug::nospace << #v;
_c(OpenData)
_c(OpenState)
_c(FileCallback)
@ -1610,11 +1613,11 @@ Debug& operator<<(Debug& debug, const ImporterFeature value) {
/* LCOV_EXCL_STOP */
}
return debug << "(" << Debug::nospace << reinterpret_cast<void*>(UnsignedByte(value)) << Debug::nospace << ")";
return debug << (packed ? "" : "(") << Debug::nospace << reinterpret_cast<void*>(UnsignedByte(value)) << Debug::nospace << (packed ? "" : ")");
}
Debug& operator<<(Debug& debug, const ImporterFeatures value) {
return Containers::enumSetDebugOutput(debug, value, "Trade::ImporterFeatures{}", {
return Containers::enumSetDebugOutput(debug, value, debug.immediateFlags() >= Debug::Flag::Packed ? "{}" : "Trade::ImporterFeatures{}", {
ImporterFeature::OpenData,
ImporterFeature::OpenState,
ImporterFeature::FileCallback});

11
src/Magnum/Trade/AbstractSceneConverter.cpp

@ -1187,11 +1187,14 @@ Containers::Optional<UnsignedInt> AbstractSceneConverter::add(const Containers::
}
Debug& operator<<(Debug& debug, const SceneConverterFeature value) {
debug << "Trade::SceneConverterFeature" << Debug::nospace;
const bool packed = debug.immediateFlags() >= Debug::Flag::Packed;
if(!packed)
debug << "Trade::SceneConverterFeature" << Debug::nospace;
switch(value) {
/* LCOV_EXCL_START */
#define _c(v) case SceneConverterFeature::v: return debug << "::" #v;
#define _c(v) case SceneConverterFeature::v: return debug << (packed ? "" : "::") << Debug::nospace << #v;
_c(ConvertMesh)
_c(ConvertMeshInPlace)
_c(ConvertMeshToData)
@ -1220,11 +1223,11 @@ Debug& operator<<(Debug& debug, const SceneConverterFeature value) {
/* LCOV_EXCL_STOP */
}
return debug << "(" << Debug::nospace << reinterpret_cast<void*>(UnsignedInt(value)) << Debug::nospace << ")";
return debug << (packed ? "" : "(") << Debug::nospace << reinterpret_cast<void*>(UnsignedInt(value)) << Debug::nospace << (packed ? "" : ")");
}
Debug& operator<<(Debug& debug, const SceneConverterFeatures value) {
return Containers::enumSetDebugOutput(debug, value, "Trade::SceneConverterFeatures{}", {
return Containers::enumSetDebugOutput(debug, value, debug.immediateFlags() >= Debug::Flag::Packed ? "{}" : "Trade::SceneConverterFeatures{}", {
SceneConverterFeature::ConvertMesh,
SceneConverterFeature::ConvertMeshInPlace,
SceneConverterFeature::ConvertMeshToData,

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

@ -296,10 +296,13 @@ struct AbstractImageConverterTest: TestSuite::Tester {
void convertCompressed3DToFileThroughLevels();
void debugFeature();
void debugFeaturePacked();
#ifdef MAGNUM_BUILD_DEPRECATED
void debugFeatureDeprecated();
void debugFeatureDeprecatedPacked();
#endif
void debugFeatures();
void debugFeaturesPacked();
void debugFeaturesSupersets();
void debugFlag();
void debugFlags();
@ -535,10 +538,13 @@ AbstractImageConverterTest::AbstractImageConverterTest() {
&AbstractImageConverterTest::convertCompressed3DToFileThroughLevels,
&AbstractImageConverterTest::debugFeature,
&AbstractImageConverterTest::debugFeaturePacked,
#ifdef MAGNUM_BUILD_DEPRECATED
&AbstractImageConverterTest::debugFeatureDeprecated,
&AbstractImageConverterTest::debugFeatureDeprecatedPacked,
#endif
&AbstractImageConverterTest::debugFeatures,
&AbstractImageConverterTest::debugFeaturesPacked,
&AbstractImageConverterTest::debugFeaturesSupersets,
&AbstractImageConverterTest::debugFlag,
&AbstractImageConverterTest::debugFlags});
@ -4515,6 +4521,13 @@ void AbstractImageConverterTest::debugFeature() {
CORRADE_COMPARE(out.str(), "Trade::ImageConverterFeature::ConvertCompressed2D Trade::ImageConverterFeature(0xdeadbeef)\n");
}
void AbstractImageConverterTest::debugFeaturePacked() {
std::ostringstream out;
/* Last is not packed, ones before should not make any flags persistent */
Debug{&out} << Debug::packed << ImageConverterFeature::ConvertCompressed2D << Debug::packed << ImageConverterFeature(0xdeadbeef) << ImageConverterFeature::Convert3D;
CORRADE_COMPARE(out.str(), "ConvertCompressed2D 0xdeadbeef Trade::ImageConverterFeature::Convert3D\n");
}
#ifdef MAGNUM_BUILD_DEPRECATED
void AbstractImageConverterTest::debugFeatureDeprecated() {
std::ostringstream out;
@ -4524,6 +4537,16 @@ void AbstractImageConverterTest::debugFeatureDeprecated() {
CORRADE_IGNORE_DEPRECATED_POP
CORRADE_COMPARE(out.str(), "Trade::ImageConverterFeature::ConvertCompressed1DToData|Trade::ImageConverterFeature::Levels Trade::ImageConverterFeature::Convert3DToFile|Trade::ImageConverterFeature::Levels\n");
}
void AbstractImageConverterTest::debugFeatureDeprecatedPacked() {
std::ostringstream out;
CORRADE_IGNORE_DEPRECATED_PUSH
/* Last is not packed, ones before should not make any flags persistent */
Debug{&out} << Debug::packed << ImageConverterFeature::ConvertCompressedLevels1DToData << Debug::packed << ImageConverterFeature::ConvertLevels3DToFile << ImageConverterFeature::Convert1D;
CORRADE_IGNORE_DEPRECATED_POP
CORRADE_COMPARE(out.str(), "ConvertCompressed1DToData|Levels Convert3DToFile|Levels Trade::ImageConverterFeature::Convert1D\n");
}
#endif
void AbstractImageConverterTest::debugFeatures() {
@ -4533,6 +4556,13 @@ void AbstractImageConverterTest::debugFeatures() {
CORRADE_COMPARE(out.str(), "Trade::ImageConverterFeature::Convert2DToData|Trade::ImageConverterFeature::ConvertCompressed2DToFile Trade::ImageConverterFeatures{}\n");
}
void AbstractImageConverterTest::debugFeaturesPacked() {
std::ostringstream out;
/* Last is not packed, ones before should not make any flags persistent */
Debug{&out} << Debug::packed << (ImageConverterFeature::Convert2DToData|ImageConverterFeature::ConvertCompressed2DToFile) << Debug::packed << ImageConverterFeatures{} << ImageConverterFeature::Convert1D;
CORRADE_COMPARE(out.str(), "Convert2DToData|ConvertCompressed2DToFile {} Trade::ImageConverterFeature::Convert1D\n");
}
void AbstractImageConverterTest::debugFeaturesSupersets() {
/* Convert*DToData is a superset of Convert*DToFile, so only one should be
printed */

18
src/Magnum/Trade/Test/AbstractImporterTest.cpp

@ -373,7 +373,9 @@ struct AbstractImporterTest: TestSuite::Tester {
void importerStateNoFile();
void debugFeature();
void debugFeaturePacked();
void debugFeatures();
void debugFeaturesPacked();
void debugFlag();
void debugFlags();
};
@ -699,7 +701,9 @@ AbstractImporterTest::AbstractImporterTest() {
&AbstractImporterTest::importerStateNoFile,
&AbstractImporterTest::debugFeature,
&AbstractImporterTest::debugFeaturePacked,
&AbstractImporterTest::debugFeatures,
&AbstractImporterTest::debugFeaturesPacked,
&AbstractImporterTest::debugFlag,
&AbstractImporterTest::debugFlags});
}
@ -7695,6 +7699,13 @@ void AbstractImporterTest::debugFeature() {
CORRADE_COMPARE(out.str(), "Trade::ImporterFeature::OpenData Trade::ImporterFeature(0xf0)\n");
}
void AbstractImporterTest::debugFeaturePacked() {
std::ostringstream out;
/* Last is not packed, ones before should not make any flags persistent */
Debug{&out} << Debug::packed << ImporterFeature::OpenData << Debug::packed << ImporterFeature(0xf0) << ImporterFeature::FileCallback;
CORRADE_COMPARE(out.str(), "OpenData 0xf0 Trade::ImporterFeature::FileCallback\n");
}
void AbstractImporterTest::debugFeatures() {
std::ostringstream out;
@ -7702,6 +7713,13 @@ void AbstractImporterTest::debugFeatures() {
CORRADE_COMPARE(out.str(), "Trade::ImporterFeature::OpenData|Trade::ImporterFeature::OpenState Trade::ImporterFeatures{}\n");
}
void AbstractImporterTest::debugFeaturesPacked() {
std::ostringstream out;
/* Last is not packed, ones before should not make any flags persistent */
Debug{&out} << Debug::packed << (ImporterFeature::OpenData|ImporterFeature::OpenState) << Debug::packed << ImporterFeatures{} << ImporterFeature::FileCallback;
CORRADE_COMPARE(out.str(), "OpenData|OpenState {} Trade::ImporterFeature::FileCallback\n");
}
void AbstractImporterTest::debugFlag() {
std::ostringstream out;

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

@ -275,7 +275,9 @@ struct AbstractSceneConverterTest: TestSuite::Tester {
void addImage3DThroughLevels();
void debugFeature();
void debugFeaturePacked();
void debugFeatures();
void debugFeaturesPacked();
void debugFeaturesSupersets();
void debugFlag();
void debugFlags();
@ -488,7 +490,9 @@ AbstractSceneConverterTest::AbstractSceneConverterTest() {
&AbstractSceneConverterTest::addImage3DThroughLevels,
&AbstractSceneConverterTest::debugFeature,
&AbstractSceneConverterTest::debugFeaturePacked,
&AbstractSceneConverterTest::debugFeatures,
&AbstractSceneConverterTest::debugFeaturesPacked,
&AbstractSceneConverterTest::debugFeaturesSupersets,
&AbstractSceneConverterTest::debugFlag,
&AbstractSceneConverterTest::debugFlags});
@ -5358,6 +5362,13 @@ void AbstractSceneConverterTest::debugFeature() {
CORRADE_COMPARE(out.str(), "Trade::SceneConverterFeature::ConvertMeshInPlace Trade::SceneConverterFeature(0xdeaddead)\n");
}
void AbstractSceneConverterTest::debugFeaturePacked() {
std::ostringstream out;
/* Last is not packed, ones before should not make any flags persistent */
Debug{&out} << Debug::packed << SceneConverterFeature::ConvertMeshInPlace << Debug::packed << SceneConverterFeature(0xdeaddead) << SceneConverterFeature::AddCameras;
CORRADE_COMPARE(out.str(), "ConvertMeshInPlace 0xdeaddead Trade::SceneConverterFeature::AddCameras\n");
}
void AbstractSceneConverterTest::debugFeatures() {
std::ostringstream out;
@ -5365,6 +5376,13 @@ void AbstractSceneConverterTest::debugFeatures() {
CORRADE_COMPARE(out.str(), "Trade::SceneConverterFeature::ConvertMesh|Trade::SceneConverterFeature::ConvertMeshToFile Trade::SceneConverterFeatures{}\n");
}
void AbstractSceneConverterTest::debugFeaturesPacked() {
std::ostringstream out;
/* Last is not packed, ones before should not make any flags persistent */
Debug{&out} << Debug::packed << (SceneConverterFeature::ConvertMesh|SceneConverterFeature::ConvertMeshToFile) << Debug::packed << SceneConverterFeatures{} << SceneConverterFeature::AddLights;
CORRADE_COMPARE(out.str(), "ConvertMesh|ConvertMeshToFile {} Trade::SceneConverterFeature::AddLights\n");
}
void AbstractSceneConverterTest::debugFeaturesSupersets() {
/* ConvertMeshToData is a superset of ConvertMeshToFile, so only one should
be printed */

Loading…
Cancel
Save