diff --git a/src/Magnum/Animation/Test/InterpolationTest.cpp b/src/Magnum/Animation/Test/InterpolationTest.cpp index 12721e45c..98d6b4096 100644 --- a/src/Magnum/Animation/Test/InterpolationTest.cpp +++ b/src/Magnum/Animation/Test/InterpolationTest.cpp @@ -24,9 +24,8 @@ DEALINGS IN THE SOFTWARE. */ -#include +#include #include -#include #include "Magnum/Animation/Easing.h" #include "Magnum/Animation/Interpolation.h" @@ -225,12 +224,12 @@ void InterpolationTest::interpolatorFor() { void InterpolationTest::interpolatorForInvalid() { CORRADE_SKIP_IF_NO_ASSERT(); - std::ostringstream out; + Containers::String out; Error redirectError{&out}; Animation::interpolatorFor(Interpolation::Spline); Animation::interpolatorFor(Interpolation(0xde)); - CORRADE_COMPARE(out.str(), + CORRADE_COMPARE(out, "Animation::interpolatorFor(): can't deduce interpolator function for Animation::Interpolation::Spline\n" "Animation::interpolatorFor(): can't deduce interpolator function for Animation::Interpolation(0xde)\n"); } @@ -245,12 +244,12 @@ void InterpolationTest::interpolatorForBool() { void InterpolationTest::interpolatorForBoolInvalid() { CORRADE_SKIP_IF_NO_ASSERT(); - std::ostringstream out; + Containers::String out; Error redirectError{&out}; Animation::interpolatorFor(Interpolation::Custom); Animation::interpolatorFor(Interpolation(0xde)); - CORRADE_COMPARE(out.str(), + CORRADE_COMPARE(out, "Animation::interpolatorFor(): can't deduce interpolator function for Animation::Interpolation::Custom\n" "Animation::interpolatorFor(): can't deduce interpolator function for Animation::Interpolation(0xde)\n"); } @@ -265,12 +264,12 @@ void InterpolationTest::interpolatorForBitVector() { void InterpolationTest::interpolatorForBitVectorInvalid() { CORRADE_SKIP_IF_NO_ASSERT(); - std::ostringstream out; + Containers::String out; Error redirectError{&out}; Animation::interpolatorFor>(Interpolation::Custom); Animation::interpolatorFor>(Interpolation(0xde)); - CORRADE_COMPARE(out.str(), + CORRADE_COMPARE(out, "Animation::interpolatorFor(): can't deduce interpolator function for Animation::Interpolation::Custom\n" "Animation::interpolatorFor(): can't deduce interpolator function for Animation::Interpolation(0xde)\n"); } @@ -289,12 +288,12 @@ void InterpolationTest::interpolatorForComplex() { void InterpolationTest::interpolatorForComplexInvalid() { CORRADE_SKIP_IF_NO_ASSERT(); - std::ostringstream out; + Containers::String out; Error redirectError{&out}; Animation::interpolatorFor(Interpolation::Custom); Animation::interpolatorFor(Interpolation(0xde)); - CORRADE_COMPARE(out.str(), + CORRADE_COMPARE(out, "Animation::interpolatorFor(): can't deduce interpolator function for Animation::Interpolation::Custom\n" "Animation::interpolatorFor(): can't deduce interpolator function for Animation::Interpolation(0xde)\n"); } @@ -313,12 +312,12 @@ void InterpolationTest::interpolatorForQuaternion() { void InterpolationTest::interpolatorForQuaternionInvalid() { CORRADE_SKIP_IF_NO_ASSERT(); - std::ostringstream out; + Containers::String out; Error redirectError{&out}; Animation::interpolatorFor(Interpolation::Spline); Animation::interpolatorFor(Interpolation(0xde)); - CORRADE_COMPARE(out.str(), + CORRADE_COMPARE(out, "Animation::interpolatorFor(): can't deduce interpolator function for Animation::Interpolation::Spline\n" "Animation::interpolatorFor(): can't deduce interpolator function for Animation::Interpolation(0xde)\n"); } @@ -337,12 +336,12 @@ void InterpolationTest::interpolatorForDualQuaternion() { void InterpolationTest::interpolatorForDualQuaternionInvalid() { CORRADE_SKIP_IF_NO_ASSERT(); - std::ostringstream out; + Containers::String out; Error redirectError{&out}; Animation::interpolatorFor(Interpolation::Custom); Animation::interpolatorFor(Interpolation(0xde)); - CORRADE_COMPARE(out.str(), + CORRADE_COMPARE(out, "Animation::interpolatorFor(): can't deduce interpolator function for Animation::Interpolation::Custom\n" "Animation::interpolatorFor(): can't deduce interpolator function for Animation::Interpolation(0xde)\n"); } @@ -358,12 +357,12 @@ void InterpolationTest::interpolatorForCubicHermiteScalar() { void InterpolationTest::interpolatorForCubicHermiteScalarInvalid() { CORRADE_SKIP_IF_NO_ASSERT(); - std::ostringstream out; + Containers::String out; Error redirectError{&out}; Animation::interpolatorFor(Interpolation::Custom); Animation::interpolatorFor(Interpolation(0xde)); - CORRADE_COMPARE(out.str(), + CORRADE_COMPARE(out, "Animation::interpolatorFor(): can't deduce interpolator function for Animation::Interpolation::Custom\n" "Animation::interpolatorFor(): can't deduce interpolator function for Animation::Interpolation(0xde)\n"); } @@ -379,12 +378,12 @@ void InterpolationTest::interpolatorForCubicHermiteVector() { void InterpolationTest::interpolatorForCubicHermiteVectorInvalid() { CORRADE_SKIP_IF_NO_ASSERT(); - std::ostringstream out; + Containers::String out; Error redirectError{&out}; Animation::interpolatorFor(Interpolation::Custom); Animation::interpolatorFor(Interpolation(0xde)); - CORRADE_COMPARE(out.str(), + CORRADE_COMPARE(out, "Animation::interpolatorFor(): can't deduce interpolator function for Animation::Interpolation::Custom\n" "Animation::interpolatorFor(): can't deduce interpolator function for Animation::Interpolation(0xde)\n"); } @@ -400,12 +399,12 @@ void InterpolationTest::interpolatorForCubicHermiteComplex() { void InterpolationTest::interpolatorForCubicHermiteComplexInvalid() { CORRADE_SKIP_IF_NO_ASSERT(); - std::ostringstream out; + Containers::String out; Error redirectError{&out}; Animation::interpolatorFor(Interpolation::Custom); Animation::interpolatorFor(Interpolation(0xde)); - CORRADE_COMPARE(out.str(), + CORRADE_COMPARE(out, "Animation::interpolatorFor(): can't deduce interpolator function for Animation::Interpolation::Custom\n" "Animation::interpolatorFor(): can't deduce interpolator function for Animation::Interpolation(0xde)\n"); } @@ -427,12 +426,12 @@ void InterpolationTest::interpolatorForCubicHermiteQuaternion() { void InterpolationTest::interpolatorForCubicHermiteQuaternionInvalid() { CORRADE_SKIP_IF_NO_ASSERT(); - std::ostringstream out; + Containers::String out; Error redirectError{&out}; Animation::interpolatorFor(Interpolation::Custom); Animation::interpolatorFor(Interpolation(0xde)); - CORRADE_COMPARE(out.str(), + CORRADE_COMPARE(out, "Animation::interpolatorFor(): can't deduce interpolator function for Animation::Interpolation::Custom\n" "Animation::interpolatorFor(): can't deduce interpolator function for Animation::Interpolation(0xde)\n"); } @@ -544,7 +543,7 @@ void InterpolationTest::interpolateStrictIntegerKey() { void InterpolationTest::interpolateError() { CORRADE_SKIP_IF_NO_ASSERT(); - std::ostringstream out; + Containers::String out; Error redirectError{&out}; { @@ -552,14 +551,14 @@ void InterpolationTest::interpolateError() { Animation::interpolate(Keys, nullptr, Extrapolation::Extrapolated, Extrapolation::Extrapolated, Math::lerp, 0.0f, hint); } - CORRADE_COMPARE(out.str(), + CORRADE_COMPARE(out, "Animation::interpolate(): keys and values don't have the same size\n"); } void InterpolationTest::interpolateStrictError() { CORRADE_SKIP_IF_NO_ASSERT(); - std::ostringstream out; + Containers::String out; Error redirectError{&out}; { @@ -575,7 +574,7 @@ void InterpolationTest::interpolateStrictError() { Math::lerp, 0.0f, hint); } - CORRADE_COMPARE(out.str(), + CORRADE_COMPARE(out, "Animation::interpolateStrict(): at least two keyframes required\n" "Animation::interpolateStrict(): keys and values don't have the same size\n"); } @@ -629,31 +628,31 @@ void InterpolationTest::unpackEaseClamped() { } void InterpolationTest::debugInterpolation() { - std::ostringstream out; + Containers::String out; Debug{&out} << Interpolation::Custom << Interpolation(0xde); - CORRADE_COMPARE(out.str(), "Animation::Interpolation::Custom Animation::Interpolation(0xde)\n"); + CORRADE_COMPARE(out, "Animation::Interpolation::Custom Animation::Interpolation(0xde)\n"); } void InterpolationTest::debugInterpolationPacked() { - std::ostringstream out; + Containers::String out; /* Last is not packed, ones before should not make any flags persistent */ Debug{&out} << Debug::packed << Interpolation::Custom << Debug::packed << Interpolation(0xde) << Interpolation::Constant; - CORRADE_COMPARE(out.str(), "Custom 0xde Animation::Interpolation::Constant\n"); + CORRADE_COMPARE(out, "Custom 0xde Animation::Interpolation::Constant\n"); } void InterpolationTest::debugExtrapolation() { - std::ostringstream out; + Containers::String out; Debug{&out} << Extrapolation::DefaultConstructed << Extrapolation(0xde); - CORRADE_COMPARE(out.str(), "Animation::Extrapolation::DefaultConstructed Animation::Extrapolation(0xde)\n"); + CORRADE_COMPARE(out, "Animation::Extrapolation::DefaultConstructed Animation::Extrapolation(0xde)\n"); } void InterpolationTest::debugExtrapolationPacked() { - std::ostringstream out; + Containers::String out; /* Last is not packed, ones before should not make any flags persistent */ Debug{&out} << Debug::packed << Extrapolation::DefaultConstructed << Debug::packed << Extrapolation(0xde) << Extrapolation::Constant; - CORRADE_COMPARE(out.str(), "DefaultConstructed 0xde Animation::Extrapolation::Constant\n"); + CORRADE_COMPARE(out, "DefaultConstructed 0xde Animation::Extrapolation::Constant\n"); } diff --git a/src/Magnum/Animation/Test/PlayerTest.cpp b/src/Magnum/Animation/Test/PlayerTest.cpp index c5699542c..30cc982df 100644 --- a/src/Magnum/Animation/Test/PlayerTest.cpp +++ b/src/Magnum/Animation/Test/PlayerTest.cpp @@ -24,13 +24,13 @@ DEALINGS IN THE SOFTWARE. */ -#include #include #include +#include #include #include #include -#include +#include /** @todo remove once Player is std::pair-free */ #include "Magnum/Animation/Player.h" @@ -329,7 +329,7 @@ void PlayerTest::setDurationReplace() { void PlayerTest::trackInvalidIndex() { CORRADE_SKIP_IF_NO_ASSERT(); - std::ostringstream out; + Containers::String out; Error redirectError{&out}; Float value; @@ -340,7 +340,7 @@ void PlayerTest::trackInvalidIndex() { player.track(1); - CORRADE_COMPARE(out.str(), "Animation::Player::track(): index out of range\n"); + CORRADE_COMPARE(out, "Animation::Player::track(): index out of range\n"); } void PlayerTest::advanceNotRunning() { @@ -1400,10 +1400,10 @@ void PlayerTest::runFor100YearsChrono() { } void PlayerTest::debugState() { - std::ostringstream out; + Containers::String out; Debug{&out} << State::Playing << State(0xde); - CORRADE_COMPARE(out.str(), "Animation::State::Playing Animation::State(0xde)\n"); + CORRADE_COMPARE(out, "Animation::State::Playing Animation::State(0xde)\n"); } }}}} diff --git a/src/Magnum/Animation/Test/TrackViewTest.cpp b/src/Magnum/Animation/Test/TrackViewTest.cpp index a61971dd8..9d622d882 100644 --- a/src/Magnum/Animation/Test/TrackViewTest.cpp +++ b/src/Magnum/Animation/Test/TrackViewTest.cpp @@ -24,9 +24,9 @@ DEALINGS IN THE SOFTWARE. */ -#include +#include #include -#include /** @todo remove once Debug is stream-free */ +#include /** @todo remove once TrackView is std::pair-free */ #include "Magnum/Animation/Track.h" #include "Magnum/Math/Half.h" @@ -571,10 +571,10 @@ void TrackViewTest::constructInconsistentViewSize() { Float keys[2]{}; Vector3 values[3]{}; - std::ostringstream out; + Containers::String out; Error redirectError{&out}; TrackView{keys, values, Math::select}; - CORRADE_COMPARE(out.str(), "Animation::TrackView: expected key and value view to have the same size but got 2 and 3\n"); + CORRADE_COMPARE(out, "Animation::TrackView: expected key and value view to have the same size but got 2 and 3\n"); } void TrackViewTest::constructCopyStorage() { diff --git a/src/Magnum/Audio/Test/AbstractImporterTest.cpp b/src/Magnum/Audio/Test/AbstractImporterTest.cpp index bdc08cfed..eb1c7c469 100644 --- a/src/Magnum/Audio/Test/AbstractImporterTest.cpp +++ b/src/Magnum/Audio/Test/AbstractImporterTest.cpp @@ -24,14 +24,13 @@ DEALINGS IN THE SOFTWARE. */ -#include +#include /** @todo remove once AbstractImporter is -free */ #include #include #include /** @todo remove once AbstractImporter is -free */ #include #include #include -#include #include #include "Magnum/Audio/AbstractImporter.h" @@ -187,13 +186,13 @@ void AbstractImporterTest::openFileAsDataNotFound() { bool _opened = false; } importer; - std::ostringstream out; + Containers::String out; Error redirectError{&out}; CORRADE_VERIFY(!importer.openFile("nonexistent.bin")); CORRADE_VERIFY(!importer.isOpened()); /* There's an error from Path::read() before */ - CORRADE_COMPARE_AS(out.str(), + CORRADE_COMPARE_AS(out, "\nAudio::AbstractImporter::openFile(): cannot open file nonexistent.bin\n", TestSuite::Compare::StringHasSuffix); } @@ -211,11 +210,11 @@ void AbstractImporterTest::openFileNotImplemented() { Containers::Array doData() override { return nullptr; } } importer; - std::ostringstream out; + Containers::String out; Error redirectError{&out}; CORRADE_VERIFY(!importer.openFile("file.dat")); - CORRADE_COMPARE(out.str(), "Audio::AbstractImporter::openFile(): not implemented\n"); + CORRADE_COMPARE(out, "Audio::AbstractImporter::openFile(): not implemented\n"); } void AbstractImporterTest::openDataNotSupported() { @@ -231,11 +230,11 @@ void AbstractImporterTest::openDataNotSupported() { Containers::Array doData() override { return nullptr; } } importer; - std::ostringstream out; + Containers::String out; Error redirectError{&out}; CORRADE_VERIFY(!importer.openData(nullptr)); - CORRADE_COMPARE(out.str(), "Audio::AbstractImporter::openData(): feature not supported\n"); + CORRADE_COMPARE(out, "Audio::AbstractImporter::openData(): feature not supported\n"); } void AbstractImporterTest::openDataNotImplemented() { @@ -251,11 +250,11 @@ void AbstractImporterTest::openDataNotImplemented() { Containers::Array doData() override { return nullptr; } } importer; - std::ostringstream out; + Containers::String out; Error redirectError{&out}; CORRADE_VERIFY(!importer.openData(nullptr)); - CORRADE_COMPARE(out.str(), "Audio::AbstractImporter::openData(): feature advertised but not implemented\n"); + CORRADE_COMPARE(out, "Audio::AbstractImporter::openData(): feature advertised but not implemented\n"); } void AbstractImporterTest::format() { @@ -285,11 +284,11 @@ void AbstractImporterTest::formatNoFile() { Containers::Array doData() override { return nullptr; } } importer; - std::ostringstream out; + Containers::String out; Error redirectError{&out}; importer.format(); - CORRADE_COMPARE(out.str(), "Audio::AbstractImporter::format(): no file opened\n"); + CORRADE_COMPARE(out, "Audio::AbstractImporter::format(): no file opened\n"); } void AbstractImporterTest::frequency() { @@ -319,11 +318,11 @@ void AbstractImporterTest::frequencyNoFile() { Containers::Array doData() override { return nullptr; } } importer; - std::ostringstream out; + Containers::String out; Error redirectError{&out}; importer.frequency(); - CORRADE_COMPARE(out.str(), "Audio::AbstractImporter::frequency(): no file opened\n"); + CORRADE_COMPARE(out, "Audio::AbstractImporter::frequency(): no file opened\n"); } void AbstractImporterTest::data() { @@ -357,11 +356,11 @@ void AbstractImporterTest::dataNoFile() { Containers::Array doData() override { return nullptr; } } importer; - std::ostringstream out; + Containers::String out; Error redirectError{&out}; importer.data(); - CORRADE_COMPARE(out.str(), "Audio::AbstractImporter::data(): no file opened\n"); + CORRADE_COMPARE(out, "Audio::AbstractImporter::data(): no file opened\n"); } void AbstractImporterTest::dataCustomDeleter() { @@ -379,39 +378,39 @@ void AbstractImporterTest::dataCustomDeleter() { } } importer; - std::ostringstream out; + Containers::String out; Error redirectError{&out}; importer.data(); - CORRADE_COMPARE(out.str(), "Audio::AbstractImporter::data(): implementation is not allowed to use a custom Array deleter\n"); + CORRADE_COMPARE(out, "Audio::AbstractImporter::data(): implementation is not allowed to use a custom Array deleter\n"); } void AbstractImporterTest::debugFeature() { - std::ostringstream out; + Containers::String out; Debug{&out} << ImporterFeature::OpenData << ImporterFeature(0xf0); - CORRADE_COMPARE(out.str(), "Audio::ImporterFeature::OpenData Audio::ImporterFeature(0xf0)\n"); + CORRADE_COMPARE(out, "Audio::ImporterFeature::OpenData Audio::ImporterFeature(0xf0)\n"); } void AbstractImporterTest::debugFeaturePacked() { - std::ostringstream out; + Containers::String 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"); + CORRADE_COMPARE(out, "OpenData 0xf0 Audio::ImporterFeature::OpenData\n"); } void AbstractImporterTest::debugFeatures() { - std::ostringstream out; + Containers::String out; Debug{&out} << (ImporterFeature::OpenData|ImporterFeature(0xf0)) << ImporterFeatures{}; - CORRADE_COMPARE(out.str(), "Audio::ImporterFeature::OpenData|Audio::ImporterFeature(0xf0) Audio::ImporterFeatures{}\n"); + CORRADE_COMPARE(out, "Audio::ImporterFeature::OpenData|Audio::ImporterFeature(0xf0) Audio::ImporterFeatures{}\n"); } void AbstractImporterTest::debugFeaturesPacked() { - std::ostringstream out; + Containers::String 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_COMPARE(out, "OpenData|0xf0 {} Audio::ImporterFeature::OpenData\n"); } }}}} diff --git a/src/Magnum/Audio/Test/BufferFormatTest.cpp b/src/Magnum/Audio/Test/BufferFormatTest.cpp index 793638275..99e12b0f6 100644 --- a/src/Magnum/Audio/Test/BufferFormatTest.cpp +++ b/src/Magnum/Audio/Test/BufferFormatTest.cpp @@ -24,9 +24,8 @@ DEALINGS IN THE SOFTWARE. */ -#include +#include #include -#include #include "Magnum/Audio/BufferFormat.h" @@ -43,9 +42,9 @@ BufferFormatTest::BufferFormatTest() { } void BufferFormatTest::debugFormat() { - std::ostringstream out; + Containers::String out; Debug(&out) << BufferFormat::Stereo16 << BufferFormat(0xdead); - CORRADE_COMPARE(out.str(), "Audio::BufferFormat::Stereo16 Audio::BufferFormat(0xdead)\n"); + CORRADE_COMPARE(out, "Audio::BufferFormat::Stereo16 Audio::BufferFormat(0xdead)\n"); } }}}} diff --git a/src/Magnum/Audio/Test/ContextALTest.cpp b/src/Magnum/Audio/Test/ContextALTest.cpp index b577095d5..71a0f5e7d 100644 --- a/src/Magnum/Audio/Test/ContextALTest.cpp +++ b/src/Magnum/Audio/Test/ContextALTest.cpp @@ -25,10 +25,10 @@ DEALINGS IN THE SOFTWARE. */ -#include #include #include #include +#include #include #include @@ -194,11 +194,11 @@ void ContextALTest::quietLog() { const char* argv[] = { "", "--magnum-log", testCaseInstanceId() ? "quiet" : "default" }; - std::ostringstream out; + Containers::String out; Debug redirectOutput{&out}; /* MSVC 2015 and 2017 needs the int cast otherwise C2398 */ Context context{int(Containers::arraySize(argv)), argv}; - CORRADE_COMPARE(out.str().empty(), bool(testCaseInstanceId())); + CORRADE_COMPARE(!out, bool(testCaseInstanceId())); } void ContextALTest::ignoreUnrelatedOptions() { diff --git a/src/Magnum/Audio/Test/ContextTest.cpp b/src/Magnum/Audio/Test/ContextTest.cpp index a83b3b4cd..3797441fb 100644 --- a/src/Magnum/Audio/Test/ContextTest.cpp +++ b/src/Magnum/Audio/Test/ContextTest.cpp @@ -26,11 +26,9 @@ */ #include -#include #include -#include +#include #include -#include #include "Magnum/Audio/Context.h" @@ -103,9 +101,9 @@ void ContextTest::extensions() { } void ContextTest::debugHrtfStatus() { - std::ostringstream out; + Containers::String out; Debug(&out) << Context::HrtfStatus::Denied << Context::HrtfStatus(0xdead); - CORRADE_COMPARE(out.str(), "Audio::Context::HrtfStatus::Denied Audio::Context::HrtfStatus(0xdead)\n"); + CORRADE_COMPARE(out, "Audio::Context::HrtfStatus::Denied Audio::Context::HrtfStatus(0xdead)\n"); } }}}} diff --git a/src/Magnum/Audio/Test/RendererTest.cpp b/src/Magnum/Audio/Test/RendererTest.cpp index 7b4a0dca4..90d9d8352 100644 --- a/src/Magnum/Audio/Test/RendererTest.cpp +++ b/src/Magnum/Audio/Test/RendererTest.cpp @@ -24,9 +24,8 @@ DEALINGS IN THE SOFTWARE. */ -#include +#include #include -#include #include "Magnum/Magnum.h" #include "Magnum/Audio/Renderer.h" @@ -46,15 +45,15 @@ RendererTest::RendererTest() { } void RendererTest::debugError() { - std::ostringstream out; + Containers::String out; Debug(&out) << Renderer::Error::InvalidOperation << Renderer::Error(0xdead); - CORRADE_COMPARE(out.str(), "Audio::Renderer::Error::InvalidOperation Audio::Renderer::Error(0xdead)\n"); + CORRADE_COMPARE(out, "Audio::Renderer::Error::InvalidOperation Audio::Renderer::Error(0xdead)\n"); } void RendererTest::debugDistanceModel() { - std::ostringstream out; + Containers::String out; Debug(&out) << Renderer::DistanceModel::Inverse << Renderer::DistanceModel(0xdead); - CORRADE_COMPARE(out.str(), "Audio::Renderer::DistanceModel::Inverse Audio::Renderer::DistanceModel(0xdead)\n"); + CORRADE_COMPARE(out, "Audio::Renderer::DistanceModel::Inverse Audio::Renderer::DistanceModel(0xdead)\n"); } }}}} diff --git a/src/Magnum/Audio/Test/SourceTest.cpp b/src/Magnum/Audio/Test/SourceTest.cpp index bee4bd3d4..06c3762cb 100644 --- a/src/Magnum/Audio/Test/SourceTest.cpp +++ b/src/Magnum/Audio/Test/SourceTest.cpp @@ -24,9 +24,8 @@ DEALINGS IN THE SOFTWARE. */ -#include +#include #include -#include #include "Magnum/Audio/Source.h" @@ -45,15 +44,15 @@ SourceTest::SourceTest() { } void SourceTest::debugState() { - std::ostringstream out; + Containers::String out; Debug(&out) << Source::State::Playing << Source::State(0xdead); - CORRADE_COMPARE(out.str(), "Audio::Source::State::Playing Audio::Source::State(0xdead)\n"); + CORRADE_COMPARE(out, "Audio::Source::State::Playing Audio::Source::State(0xdead)\n"); } void SourceTest::debugType() { - std::ostringstream out; + Containers::String out; Debug(&out) << Source::Type::Streaming << Source::Type(0xdead); - CORRADE_COMPARE(out.str(), "Audio::Source::Type::Streaming Audio::Source::Type(0xdead)\n"); + CORRADE_COMPARE(out, "Audio::Source::Type::Streaming Audio::Source::Type(0xdead)\n"); } }}}} diff --git a/src/Magnum/DebugTools/Test/CompareImageTest.cpp b/src/Magnum/DebugTools/Test/CompareImageTest.cpp index b533a3837..9d1edbdb9 100644 --- a/src/Magnum/DebugTools/Test/CompareImageTest.cpp +++ b/src/Magnum/DebugTools/Test/CompareImageTest.cpp @@ -24,19 +24,16 @@ DEALINGS IN THE SOFTWARE. */ -#include #include #include #include #include -#include /** @todo drop once Debug is stream-free */ #include #include #include #include #include -#include -#include +#include #include #include /* replaceFirst() */ @@ -294,37 +291,37 @@ const ImageView2D ExpectedRed{PixelFormat::R32F, {3, 3}, ExpectedRedData}; void CompareImageTest::formatUnknown() { CORRADE_SKIP_IF_NO_ASSERT(); - std::ostringstream out; + Containers::String out; Error redirectError{&out}; ImageView2D image{PixelStorage{}, PixelFormat(0xdead), 0, 0, {}}; Implementation::calculateImageDelta(image.format(), image.pixels(), image); - CORRADE_COMPARE(out.str(), "DebugTools::CompareImage: unknown format PixelFormat(0xdead)\n"); + CORRADE_COMPARE(out, "DebugTools::CompareImage: unknown format PixelFormat(0xdead)\n"); } void CompareImageTest::formatPackedDepthStencil() { CORRADE_SKIP_IF_NO_ASSERT(); - std::ostringstream out; + Containers::String out; Error redirectError{&out}; ImageView2D image{PixelFormat::Depth24UnormStencil8UI, {}}; Implementation::calculateImageDelta(image.format(), image.pixels(), image); - CORRADE_COMPARE(out.str(), "DebugTools::CompareImage: packed depth/stencil formats are not supported yet\n"); + CORRADE_COMPARE(out, "DebugTools::CompareImage: packed depth/stencil formats are not supported yet\n"); } void CompareImageTest::formatImplementationSpecific() { CORRADE_SKIP_IF_NO_ASSERT(); - std::ostringstream out; + Containers::String out; Error redirectError{&out}; ImageView2D image{PixelStorage{}, pixelFormatWrap(0xdead), 0, 0, {}}; Implementation::calculateImageDelta(image.format(), image.pixels(), image); - CORRADE_COMPARE(out.str(), "DebugTools::CompareImage: can't compare implementation-specific pixel formats\n"); + CORRADE_COMPARE(out, "DebugTools::CompareImage: can't compare implementation-specific pixel formats\n"); } void CompareImageTest::calculateDelta() { @@ -459,17 +456,20 @@ void CompareImageTest::calculateDeltaSpecials3() { } void CompareImageTest::deltaImage() { - std::ostringstream out; - Debug d{&out, Debug::Flag::DisableColors}; - Containers::Array delta{32*32}; for(std::int_fast32_t x = 0; x != 32; ++x) for(std::int_fast32_t y = 0; y != 32; ++y) delta[y*32 + x] = Vector2{Float(x), Float(y)}.length()/Vector2{32.0f}.length(); - Implementation::printDeltaImage(d, delta, {32, 32}, 1.0f, 0.0f, 0.0f); - CORRADE_COMPARE(out.str(), + /* The string gets fully written only on destruction or with a newline at + the end */ + Containers::String out; + { + Debug d{&out, Debug::Flag::DisableColors|Debug::Flag::NoNewlineAtTheEnd}; + Implementation::printDeltaImage(d, delta, {32, 32}, 1.0f, 0.0f, 0.0f); + } + CORRADE_COMPARE(out, " |$$$$$$$$$$0000000888888DDDDNNNNM|\n" " |ZZZZZZZ$$$$$$$$0000008888DDDDNNN|\n" " |ZZZZZZZZZZZZZ$$$$$$00008888DDDDN|\n" @@ -489,16 +489,19 @@ void CompareImageTest::deltaImage() { } void CompareImageTest::deltaImageScaling() { - std::ostringstream out; - Debug d{&out, Debug::Flag::DisableColors}; - Containers::Array delta{65*40}; for(std::int_fast32_t x = 0; x != 65; ++x) for(std::int_fast32_t y = 0; y != 40; ++y) delta[y*65 + x] = Vector2{Float(x), Float(y)}.length()/Vector2{65.0f, 40.0f}.length(); - Implementation::printDeltaImage(d, delta, {65, 40}, 1.0f, 0.0f, 0.0f); - CORRADE_COMPARE(out.str(), + /* The string gets fully written only on destruction or with a newline at + the end */ + Containers::String out; + { + Debug d{&out, Debug::Flag::DisableColors|Debug::Flag::NoNewlineAtTheEnd}; + Implementation::printDeltaImage(d, delta, {65, 40}, 1.0f, 0.0f, 0.0f); + } + CORRADE_COMPARE(out, " |777777IIIIIIZZZZ$$$0000888DDDNNMM|\n" " |????777777IIIIZZZZ$$$000888DDDNNN|\n" " |?????????7777IIIIZZZ$$$00888DDDNN|\n" @@ -520,12 +523,16 @@ void CompareImageTest::deltaImageColors() { Implementation::printDeltaImage(out, DeltaRed, {3, 3}, 2.0f, 0.5f, 0.2f); } - std::ostringstream out; - Debug dc{&out, Debug::Flag::DisableColors}; - Implementation::printDeltaImage(dc, DeltaRed, {3, 3}, 2.0f, 0.5f, 0.2f); + /* The string gets fully written only on destruction or with a newline at + the end */ + Containers::String out; + { + Debug dc{&out, Debug::Flag::DisableColors|Debug::Flag::NoNewlineAtTheEnd}; + Implementation::printDeltaImage(dc, DeltaRed, {3, 3}, 2.0f, 0.5f, 0.2f); + } /* Yes, there is half of the rows (2 instead of 3) in order to roughly preserve image ratio */ - CORRADE_COMPARE(out.str(), + CORRADE_COMPARE(out, " |.7 |\n" " |: ,|"); } @@ -539,12 +546,16 @@ void CompareImageTest::deltaImageSpecials() { nan, inf, 0.0f, nan, inf, 0.0f}; - std::ostringstream out; - Debug dc{&out, Debug::Flag::DisableColors}; - Implementation::printDeltaImage(dc, delta, {3, 4}, 3.0f, 0.0f, 0.0f); + /* The string gets fully written only on destruction or with a newline at + the end */ + Containers::String out; + { + Debug dc{&out, Debug::Flag::DisableColors|Debug::Flag::NoNewlineAtTheEnd}; + Implementation::printDeltaImage(dc, delta, {3, 4}, 3.0f, 0.0f, 0.0f); + } /* Should show the max value for NaN and infs and the usual things otherwise */ - CORRADE_COMPARE(out.str(), + CORRADE_COMPARE(out, " |MM |\n" " |~M8|"); } @@ -556,11 +567,14 @@ void CompareImageTest::pixelDelta() { Implementation::printPixelDeltas(out, DeltaRed, ActualRed.format(), ActualRed.pixels(), ExpectedRed.pixels(), 0.5f, 0.1f, 10); } - std::ostringstream out; - Debug d{&out, Debug::Flag::DisableColors}; - Implementation::printPixelDeltas(d, DeltaRed, ActualRed.format(), ActualRed.pixels(), ExpectedRed.pixels(), 0.5f, 0.1f, 10); - - CORRADE_COMPARE(out.str(), "\n" + /* The string gets fully written only on destruction or with a newline at + the end */ + Containers::String out; + { + Debug d{&out, Debug::Flag::DisableColors|Debug::Flag::NoNewlineAtTheEnd}; + Implementation::printPixelDeltas(d, DeltaRed, ActualRed.format(), ActualRed.pixels(), ExpectedRed.pixels(), 0.5f, 0.1f, 10); + } + CORRADE_COMPARE(out, "\n" " Pixels above max/mean threshold:\n" " [1,2] Vector(1), expected Vector(0) (Δ = 1)\n" " [0,0] Vector(0.3), expected Vector(0.65) (Δ = 0.35)\n" @@ -569,19 +583,25 @@ void CompareImageTest::pixelDelta() { } void CompareImageTest::pixelDeltaEmpty() { - std::ostringstream out; - Debug d{&out, Debug::Flag::DisableColors}; - Implementation::printPixelDeltas(d, DeltaRed, ActualRed.format(), ActualRed.pixels(), ExpectedRed.pixels(), 1.0f, 1.0f, 10); - - CORRADE_COMPARE(out.str(), ""); + /* The string gets fully written only on destruction or with a newline at + the end */ + Containers::String out; + { + Debug d{&out, Debug::Flag::DisableColors|Debug::Flag::NoNewlineAtTheEnd}; + Implementation::printPixelDeltas(d, DeltaRed, ActualRed.format(), ActualRed.pixels(), ExpectedRed.pixels(), 1.0f, 1.0f, 10); + } + CORRADE_COMPARE(out, ""); } void CompareImageTest::pixelDeltaOverflow() { - std::ostringstream out; - Debug d{&out, Debug::Flag::DisableColors}; - Implementation::printPixelDeltas(d, DeltaRed, ActualRed.format(), ActualRed.pixels(), ExpectedRed.pixels(), 0.5f, 0.1f, 3); - - CORRADE_COMPARE(out.str(), "\n" + /* The string gets fully written only on destruction or with a newline at + the end */ + Containers::String out; + { + Debug d{&out, Debug::Flag::DisableColors|Debug::Flag::NoNewlineAtTheEnd}; + Implementation::printPixelDeltas(d, DeltaRed, ActualRed.format(), ActualRed.pixels(), ExpectedRed.pixels(), 0.5f, 0.1f, 3); + } + CORRADE_COMPARE(out, "\n" " Top 3 out of 4 pixels above max/mean threshold:\n" " [1,2] Vector(1), expected Vector(0) (Δ = 1)\n" " [0,0] Vector(0.3), expected Vector(0.65) (Δ = 0.35)\n" @@ -607,11 +627,14 @@ const ImageView2D ActualHalf{PixelFormat::RG16F, {2, 2}, ActualHalfData}; const ImageView2D ExpectedHalf{PixelFormat::RG16F, {2, 2}, ExpectedHalfData}; void CompareImageTest::pixelDeltaHalf() { - std::ostringstream out; - Debug d{&out, Debug::Flag::DisableColors}; - Implementation::printPixelDeltas(d, DeltaHalf, ActualHalf.format(), ActualHalf.pixels(), ExpectedHalf.pixels(), 0.5f, 0.1f, 10); - - CORRADE_COMPARE(out.str(), "\n" + /* The string gets fully written only on destruction or with a newline at + the end */ + Containers::String out; + { + Debug d{&out, Debug::Flag::DisableColors|Debug::Flag::NoNewlineAtTheEnd}; + Implementation::printPixelDeltas(d, DeltaHalf, ActualHalf.format(), ActualHalf.pixels(), ExpectedHalf.pixels(), 0.5f, 0.1f, 10); + } + CORRADE_COMPARE(out, "\n" " Pixels above max/mean threshold:\n" " [0,0] Vector(0.3, 1), expected Vector(0.6499, 1) (Δ = 0.175)\n" " [1,0] Vector(0.8999, 0.8999), expected Vector(0.6001, 0.9102) (Δ = 0.155)\n" @@ -619,14 +642,17 @@ void CompareImageTest::pixelDeltaHalf() { } void CompareImageTest::pixelDeltaSpecials() { - std::ostringstream out; - Debug d{&out, Debug::Flag::DisableColors}; - Implementation::printPixelDeltas(d, DeltaSpecials, ActualSpecials.format(), ActualSpecials.pixels(), ExpectedSpecials.pixels(), 1.5f, 0.5f, 10); - + /* The string gets fully written only on destruction or with a newline at + the end */ + Containers::String out; + { + Debug d{&out, Debug::Flag::DisableColors|Debug::Flag::NoNewlineAtTheEnd}; + Implementation::printPixelDeltas(d, DeltaSpecials, ActualSpecials.format(), ActualSpecials.pixels(), ExpectedSpecials.pixels(), 1.5f, 0.5f, 10); + } /* MSVC before version 2019 16.10(11?) prints -nan(ind) instead of ±nan. But only sometimes. */ #if defined(CORRADE_TARGET_MSVC) && _MSC_VER < 1929 && !defined(CORRADE_TARGET_CLANG_CL) - CORRADE_COMPARE(out.str(), "\n" + CORRADE_COMPARE(out, "\n" " Pixels above max/mean threshold:\n" " [5,0] Vector(-inf), expected Vector(inf) (Δ = inf)\n" " [3,0] Vector(0.3), expected Vector(-nan(ind)) (Δ = -nan(ind))\n" @@ -635,7 +661,7 @@ void CompareImageTest::pixelDeltaSpecials() { " [0,0] Vector(inf), expected Vector(1) (Δ = inf)\n" " [8,0] Vector(3), expected Vector(-0.1) (Δ = 3.1)"); #else - CORRADE_COMPARE(out.str(), "\n" + CORRADE_COMPARE(out, "\n" " Pixels above max/mean threshold:\n" " [5,0] Vector(-inf), expected Vector(inf) (Δ = inf)\n" " [3,0] Vector(0.3), expected Vector(nan) (Δ = nan)\n" @@ -647,7 +673,7 @@ void CompareImageTest::pixelDeltaSpecials() { } void CompareImageTest::compareDifferentSize() { - std::stringstream out; + Containers::String out; char data[8*5]; ImageView2D a{PixelFormat::RG8UI, {3, 4}, data}; @@ -662,11 +688,11 @@ void CompareImageTest::compareDifferentSize() { compare.printMessage(flags, d, "a", "b"); } - CORRADE_COMPARE(out.str(), "Images a and b have different size, actual Vector(3, 4) but Vector(3, 5) expected.\n"); + CORRADE_COMPARE(out, "Images a and b have different size, actual Vector(3, 4) but Vector(3, 5) expected.\n"); } void CompareImageTest::compareDifferentFormat() { - std::stringstream out; + Containers::String out; char data[16*12]; ImageView2D a{PixelFormat::RGBA32F, {3, 4}, data}; @@ -681,7 +707,7 @@ void CompareImageTest::compareDifferentFormat() { compare.printMessage(flags, d, "a", "b"); } - CORRADE_COMPARE(out.str(), "Images a and b have different format, actual PixelFormat::RGBA32F but PixelFormat::RGB32F expected.\n"); + CORRADE_COMPARE(out, "Images a and b have different format, actual PixelFormat::RGBA32F but PixelFormat::RGB32F expected.\n"); } void CompareImageTest::compareSameZeroThreshold() { @@ -697,7 +723,7 @@ void CompareImageTest::compareSameZeroThreshold() { } void CompareImageTest::compareAboveThresholds() { - std::stringstream out; + Containers::String out; { TestSuite::Comparator compare{20.0f, 10.0f}; @@ -708,7 +734,7 @@ void CompareImageTest::compareAboveThresholds() { compare.printMessage(flags, d, "a", "b"); } - CORRADE_COMPARE(out.str(), + CORRADE_COMPARE(out, "Images a and b have both max and mean delta above threshold, actual 39/18.5 but at most 20/10 expected. Delta image:\n" " |?M|\n" " Pixels above max/mean threshold:\n" @@ -718,7 +744,7 @@ void CompareImageTest::compareAboveThresholds() { } void CompareImageTest::compareAboveMaxThreshold() { - std::stringstream out; + Containers::String out; { TestSuite::Comparator compare{30.0f, 20.0f}; @@ -729,7 +755,7 @@ void CompareImageTest::compareAboveMaxThreshold() { compare.printMessage(flags, d, "a", "b"); } - CORRADE_COMPARE(out.str(), + CORRADE_COMPARE(out, "Images a and b have max delta above threshold, actual 39 but at most 30 expected. Mean delta 18.5 is within threshold 20. Delta image:\n" " |?M|\n" " Pixels above max/mean threshold:\n" @@ -737,7 +763,7 @@ void CompareImageTest::compareAboveMaxThreshold() { } void CompareImageTest::compareAboveMeanThreshold() { - std::stringstream out; + Containers::String out; { TestSuite::Comparator compare{50.0f, 18.0f}; @@ -748,7 +774,7 @@ void CompareImageTest::compareAboveMeanThreshold() { compare.printMessage(flags, d, "a", "b"); } - CORRADE_COMPARE(out.str(), + CORRADE_COMPARE(out, "Images a and b have mean delta above threshold, actual 18.5 but at most 18 expected. Max delta 39 is within threshold 50. Delta image:\n" " |?M|\n" " Pixels above max/mean threshold:\n" @@ -757,7 +783,7 @@ void CompareImageTest::compareAboveMeanThreshold() { } void CompareImageTest::compareNonZeroThreshold() { - std::stringstream out; + Containers::String out; { TestSuite::Comparator compare{40.0f, 20.0f}; @@ -768,7 +794,7 @@ void CompareImageTest::compareNonZeroThreshold() { compare.printMessage(flags, d, "a", "b"); } - CORRADE_COMPARE(out.str(), + CORRADE_COMPARE(out, "Images a and b have deltas 39/18.5 below threshold 40/20. Delta image:\n" " |?M|\n" " Pixels above max/mean threshold:\n" @@ -776,7 +802,7 @@ void CompareImageTest::compareNonZeroThreshold() { } void CompareImageTest::compareSpecials() { - std::stringstream out; + Containers::String out; { TestSuite::Comparator compare{1.5f, 0.5f}; @@ -789,7 +815,7 @@ void CompareImageTest::compareSpecials() { /* clang-cl prints -nan(ind) instead of ±nan, but differently than MSVC */ #ifdef CORRADE_TARGET_CLANG_CL - CORRADE_COMPARE(out.str(), + CORRADE_COMPARE(out, "Images a and b have both max and mean delta above threshold, actual 3.1/-nan(ind) but at most 1.5/0.5 expected. Delta image:\n" " |MMMM M ,M|\n" " Pixels above max/mean threshold:\n" @@ -806,7 +832,7 @@ void CompareImageTest::compareSpecials() { #elif defined(CORRADE_TARGET_MSVC) #if _MSC_VER < 1929 #ifdef _M_X64 - CORRADE_COMPARE(out.str(), + CORRADE_COMPARE(out, "Images a and b have both max and mean delta above threshold, actual 3.1/-nan(ind) but at most 1.5/0.5 expected. Delta image:\n" " |MMMM M ,M|\n" " Pixels above max/mean threshold:\n" @@ -817,7 +843,7 @@ void CompareImageTest::compareSpecials() { " [0,0] Vector(inf), expected Vector(1) (Δ = inf)\n" " [8,0] Vector(3), expected Vector(-0.1) (Δ = 3.1)\n"); #else - CORRADE_COMPARE(out.str(), + CORRADE_COMPARE(out, "Images a and b have both max and mean delta above threshold, actual 3.1/nan but at most 1.5/0.5 expected. Delta image:\n" " |MMMM M ,M|\n" " Pixels above max/mean threshold:\n" @@ -829,7 +855,7 @@ void CompareImageTest::compareSpecials() { " [8,0] Vector(3), expected Vector(-0.1) (Δ = 3.1)\n"); #endif #else - CORRADE_COMPARE(out.str(), + CORRADE_COMPARE(out, "Images a and b have both max and mean delta above threshold, actual 3.1/-nan(ind) but at most 1.5/0.5 expected. Delta image:\n" " |MMMM M ,M|\n" " Pixels above max/mean threshold:\n" @@ -857,9 +883,9 @@ void CompareImageTest::compareSpecials() { " [1,0] Vector(0.3), expected Vector(-inf) (Δ = inf)\n" " [0,0] Vector(inf), expected Vector(1) (Δ = inf)\n" " [8,0] Vector(3), expected Vector(-0.1) (Δ = 3.1)\n"; - if(out.str() == expectedPositive) - CORRADE_COMPARE(out.str(), expectedPositive); - else CORRADE_COMPARE(out.str(), + if(out == expectedPositive) + CORRADE_COMPARE(out, expectedPositive); + else CORRADE_COMPARE(out, "Images a and b have both max and mean delta above threshold, actual 3.1/-nan but at most 1.5/0.5 expected. Delta image:\n" " |MMMM M ,M|\n" " Pixels above max/mean threshold:\n" @@ -873,7 +899,7 @@ void CompareImageTest::compareSpecials() { } void CompareImageTest::compareSpecialsMeanOnly() { - std::stringstream out; + Containers::String out; { TestSuite::Comparator compare{15.0f, 0.5f}; @@ -886,7 +912,7 @@ void CompareImageTest::compareSpecialsMeanOnly() { /* clang-cl prints -nan(ind) instead of ±nan, but differently than MSVC */ #ifdef CORRADE_TARGET_CLANG_CL - CORRADE_COMPARE(out.str(), + CORRADE_COMPARE(out, "Images a and b have mean delta above threshold, actual -nan(ind) but at most 0.5 expected. Max delta 3.1 is within threshold 15. Delta image:\n" " |MMMM M ,M|\n" " Pixels above max/mean threshold:\n" @@ -903,7 +929,7 @@ void CompareImageTest::compareSpecialsMeanOnly() { #elif defined(CORRADE_TARGET_MSVC) #if _MSC_VER < 1929 #ifdef _M_X64 - CORRADE_COMPARE(out.str(), + CORRADE_COMPARE(out, "Images a and b have mean delta above threshold, actual -nan(ind) but at most 0.5 expected. Max delta 3.1 is within threshold 15. Delta image:\n" " |MMMM M ,M|\n" " Pixels above max/mean threshold:\n" @@ -914,7 +940,7 @@ void CompareImageTest::compareSpecialsMeanOnly() { " [0,0] Vector(inf), expected Vector(1) (Δ = inf)\n" " [8,0] Vector(3), expected Vector(-0.1) (Δ = 3.1)\n"); #else - CORRADE_COMPARE(out.str(), + CORRADE_COMPARE(out, "Images a and b have mean delta above threshold, actual nan but at most 0.5 expected. Max delta 3.1 is within threshold 15. Delta image:\n" " |MMMM M ,M|\n" " Pixels above max/mean threshold:\n" @@ -926,7 +952,7 @@ void CompareImageTest::compareSpecialsMeanOnly() { " [8,0] Vector(3), expected Vector(-0.1) (Δ = 3.1)\n"); #endif #else - CORRADE_COMPARE(out.str(), + CORRADE_COMPARE(out, "Images a and b have mean delta above threshold, actual -nan(ind) but at most 0.5 expected. Max delta 3.1 is within threshold 15. Delta image:\n" " |MMMM M ,M|\n" " Pixels above max/mean threshold:\n" @@ -954,9 +980,9 @@ void CompareImageTest::compareSpecialsMeanOnly() { " [1,0] Vector(0.3), expected Vector(-inf) (Δ = inf)\n" " [0,0] Vector(inf), expected Vector(1) (Δ = inf)\n" " [8,0] Vector(3), expected Vector(-0.1) (Δ = 3.1)\n"; - if(out.str() == expectedPositive) - CORRADE_COMPARE(out.str(), expectedPositive); - else CORRADE_COMPARE(out.str(), + if(out == expectedPositive) + CORRADE_COMPARE(out, expectedPositive); + else CORRADE_COMPARE(out, "Images a and b have mean delta above threshold, actual -nan but at most 0.5 expected. Max delta 3.1 is within threshold 15. Delta image:\n" " |MMMM M ,M|\n" " Pixels above max/mean threshold:\n" @@ -972,7 +998,7 @@ void CompareImageTest::compareSpecialsMeanOnly() { void CompareImageTest::compareSpecialsDisallowedThreshold() { CORRADE_SKIP_IF_NO_ASSERT(); - std::stringstream out; + Containers::String out; { Error redirectError{&out}; @@ -980,7 +1006,7 @@ void CompareImageTest::compareSpecialsDisallowedThreshold() { TestSuite::Comparator b{0.3f, Constants::nan()}; } - CORRADE_COMPARE(out.str(), + CORRADE_COMPARE(out, "DebugTools::CompareImage: thresholds can't be NaN or infinity\n" "DebugTools::CompareImage: thresholds can't be NaN or infinity\n"); } @@ -1035,7 +1061,7 @@ void CompareImageTest::imageNonZeroDelta() { /* This will produce output if --verbose is specified */ CORRADE_COMPARE_WITH(ActualRgb, ExpectedRgb, (CompareImage{40.0f, 20.0f})); - std::ostringstream out; + Containers::String out; { TestSuite::Comparator compare{40.0f, 20.0f}; @@ -1046,14 +1072,14 @@ void CompareImageTest::imageNonZeroDelta() { compare.printMessage(flags, d, "a", "b"); } - CORRADE_COMPARE(out.str(), ImageCompareVerbose); + CORRADE_COMPARE(out, ImageCompareVerbose); } void CompareImageTest::imageNonZeroDeltaNoPixels() { /* This will produce output if --verbose is specified */ CORRADE_COMPARE_WITH(ActualRgb, ExpectedRgb, (CompareImage{40.0f, 40.0f})); - std::ostringstream out; + Containers::String out; { TestSuite::Comparator compare{40.0f, 40.0f}; @@ -1066,13 +1092,13 @@ void CompareImageTest::imageNonZeroDeltaNoPixels() { /* No pixel list written as there are no outliers. Testing this just once since all other combinations (image/file/pixels) use the same codepath. */ - CORRADE_COMPARE(out.str(), + CORRADE_COMPARE(out, "Images a and b have deltas 39/18.5 below threshold 40/40. Delta image:\n" " |?M|\n"); } void CompareImageTest::imageError() { - std::stringstream out; + Containers::String out; { TestSuite::Comparator compare{20.0f, 10.0f}; @@ -1083,7 +1109,7 @@ void CompareImageTest::imageError() { compare.printMessage(flags, d, "a", "b"); } - CORRADE_COMPARE(out.str(), ImageCompareError); + CORRADE_COMPARE(out, ImageCompareError); } void CompareImageTest::imageFileZeroDelta() { @@ -1120,7 +1146,7 @@ void CompareImageTest::imageFileNonZeroDelta() { CORRADE_COMPARE_WITH(actualFilename, expectedFilename, (CompareImageFile{*_importerManager, 40.0f, 20.0f})); - std::ostringstream out; + Containers::String out; { TestSuite::Comparator compare{&*_importerManager, nullptr, 40.0f, 20.0f}; @@ -1131,7 +1157,7 @@ void CompareImageTest::imageFileNonZeroDelta() { compare.printMessage(flags, d, "a", "b"); } - CORRADE_COMPARE(out.str(), ImageCompareVerbose); + CORRADE_COMPARE(out, ImageCompareVerbose); } void CompareImageTest::imageFileError() { @@ -1139,7 +1165,7 @@ void CompareImageTest::imageFileError() { !(_importerManager->loadState("TgaImporter") & PluginManager::LoadState::Loaded)) CORRADE_SKIP("AnyImageImporter / TgaImporter plugins not found."); - std::stringstream out; + Containers::String out; TestSuite::Comparator compare{&*_importerManager, &*_converterManager, 20.0f, 10.0f}; /* The filenames are referenced as string views as the assumption is that @@ -1158,7 +1184,7 @@ void CompareImageTest::imageFileError() { compare.printMessage(flags, d, "a", "b"); } - CORRADE_COMPARE(out.str(), ImageCompareError); + CORRADE_COMPARE(out, ImageCompareError); /* Create the output dir if it doesn't exist, but avoid stale files making false positives */ @@ -1172,7 +1198,7 @@ void CompareImageTest::imageFileError() { CORRADE_SKIP("AnyImageConverter / TgaImageConverter plugins not found."); { - out.str({}); + out = {}; Debug redirectOutput(&out); compare.saveDiagnostic(flags, redirectOutput, COMPAREIMAGETEST_SAVE_DIR); } @@ -1180,7 +1206,7 @@ void CompareImageTest::imageFileError() { /* We expect the *actual* contents, but under the *expected* filename. Comparing file contents, expecting the converter makes exactly the same file. */ - CORRADE_COMPARE(out.str(), Utility::formatString("-> {}\n", filename)); + CORRADE_COMPARE(out, Utility::format("-> {}\n", filename)); CORRADE_COMPARE_AS(filename, Utility::Path::join(DEBUGTOOLS_TEST_DIR, "CompareImageActual.tga"), TestSuite::Compare::File); } @@ -1190,7 +1216,7 @@ void CompareImageTest::imageFilePluginLoadFailed() { if(manager.loadState("AnyImageImporter") != PluginManager::LoadState::NotFound) CORRADE_SKIP("AnyImageImporter plugin found, can't test."); - std::stringstream out; + Containers::String out; { TestSuite::Comparator compare{&manager, nullptr, 20.0f, 10.0f}; @@ -1208,7 +1234,7 @@ void CompareImageTest::imageFilePluginLoadFailed() { compare.printMessage(flags, d, "a", "b"); } - CORRADE_COMPARE(out.str(), "AnyImageImporter plugin could not be loaded.\n"); + CORRADE_COMPARE(out, "AnyImageImporter plugin could not be loaded.\n"); } void CompareImageTest::imageFileActualLoadFailed() { @@ -1216,7 +1242,7 @@ void CompareImageTest::imageFileActualLoadFailed() { !(_importerManager->loadState("TgaImporter") & PluginManager::LoadState::Loaded)) CORRADE_SKIP("AnyImageImporter / TgaImporter plugins not found."); - std::stringstream out; + Containers::String out; { TestSuite::Comparator compare{&*_importerManager, nullptr, 20.0f, 10.0f}; @@ -1233,7 +1259,7 @@ void CompareImageTest::imageFileActualLoadFailed() { compare.printMessage(flags, d, "a", "b"); } - CORRADE_COMPARE(out.str(), "Actual image a (nonexistent.tga) could not be loaded.\n"); + CORRADE_COMPARE(out, "Actual image a (nonexistent.tga) could not be loaded.\n"); } void CompareImageTest::imageFileExpectedLoadFailed() { @@ -1241,7 +1267,7 @@ void CompareImageTest::imageFileExpectedLoadFailed() { !(_importerManager->loadState("TgaImporter") & PluginManager::LoadState::Loaded)) CORRADE_SKIP("AnyImageImporter / TgaImporter plugins not found."); - std::stringstream out; + Containers::String out; TestSuite::Comparator compare{&*_importerManager, &*_converterManager, 20.0f, 10.0f}; /* The filenames are referenced as string views as the assumption is that @@ -1258,7 +1284,7 @@ void CompareImageTest::imageFileExpectedLoadFailed() { compare.printMessage(flags, d, "a", "b"); } - CORRADE_COMPARE(out.str(), "Expected image b (nonexistent.tga) could not be loaded.\n"); + CORRADE_COMPARE(out, "Expected image b (nonexistent.tga) could not be loaded.\n"); /* Create the output dir if it doesn't exist, but avoid stale files making false positives */ @@ -1272,7 +1298,7 @@ void CompareImageTest::imageFileExpectedLoadFailed() { CORRADE_SKIP("AnyImageConverter / TgaImageConverter plugins not found."); { - out.str({}); + out = {}; Debug redirectOutput(&out); compare.saveDiagnostic(flags, redirectOutput, COMPAREIMAGETEST_SAVE_DIR); } @@ -1280,7 +1306,7 @@ void CompareImageTest::imageFileExpectedLoadFailed() { /* We expect the *actual* contents, but under the *expected* filename. Comparing file contents, expecting the converter makes exactly the same file. */ - CORRADE_COMPARE(out.str(), Utility::formatString("-> {}\n", filename)); + CORRADE_COMPARE(out, Utility::format("-> {}\n", filename)); CORRADE_COMPARE_AS(filename, Utility::Path::join(DEBUGTOOLS_TEST_DIR, "CompareImageActual.tga"), TestSuite::Compare::File); } @@ -1291,7 +1317,7 @@ void CompareImageTest::imageFileActualIsCompressed() { manager.load("DdsImporter") < PluginManager::LoadState::Loaded) CORRADE_SKIP("AnyImageImporter or DdsImporter plugins can't be loaded."); - std::stringstream out; + Containers::String out; { TestSuite::Comparator compare{&manager, nullptr, 20.0f, 10.0f}; @@ -1309,7 +1335,7 @@ void CompareImageTest::imageFileActualIsCompressed() { compare.printMessage(flags, d, "a", "b"); } - CORRADE_COMPARE(Utility::String::replaceFirst(out.str(), DEBUGTOOLS_TEST_DIR, "..."), "Actual image a (.../CompareImageCompressed.dds) is compressed, comparison not possible.\n"); + CORRADE_COMPARE(Utility::String::replaceFirst(out, DEBUGTOOLS_TEST_DIR, "..."), "Actual image a (.../CompareImageCompressed.dds) is compressed, comparison not possible.\n"); } void CompareImageTest::imageFileExpectedIsCompressed() { @@ -1318,7 +1344,7 @@ void CompareImageTest::imageFileExpectedIsCompressed() { manager.load("DdsImporter") < PluginManager::LoadState::Loaded) CORRADE_SKIP("AnyImageImporter or DdsImporter plugins can't be loaded."); - std::stringstream out; + Containers::String out; TestSuite::Comparator compare{&manager, nullptr, 20.0f, 10.0f}; /* The filenames are referenced as string views as the assumption is that @@ -1385,7 +1411,7 @@ void CompareImageTest::imageToFileNonZeroDelta() { CORRADE_COMPARE_WITH(ActualRgb, expectedFilename, (CompareImageToFile{*_importerManager, 40.0f, 20.0f})); - std::ostringstream out; + Containers::String out; { TestSuite::Comparator compare{&*_importerManager, nullptr, 40.0f, 20.0f}; @@ -1396,7 +1422,7 @@ void CompareImageTest::imageToFileNonZeroDelta() { compare.printMessage(flags, d, "a", "b"); } - CORRADE_COMPARE(out.str(), ImageCompareVerbose); + CORRADE_COMPARE(out, ImageCompareVerbose); } void CompareImageTest::imageToFileError() { @@ -1404,7 +1430,7 @@ void CompareImageTest::imageToFileError() { !(_importerManager->loadState("TgaImporter") & PluginManager::LoadState::Loaded)) CORRADE_SKIP("AnyImageImporter / TgaImporter plugins not found."); - std::stringstream out; + Containers::String out; TestSuite::Comparator compare{&*_importerManager, &*_converterManager, 20.0f, 10.0f}; /* The filenames are referenced as string views as the assumption is that @@ -1422,7 +1448,7 @@ void CompareImageTest::imageToFileError() { compare.printMessage(flags, d, "a", "b"); } - CORRADE_COMPARE(out.str(), ImageCompareError); + CORRADE_COMPARE(out, ImageCompareError); /* Create the output dir if it doesn't exist, but avoid stale files making false positives */ @@ -1436,7 +1462,7 @@ void CompareImageTest::imageToFileError() { CORRADE_SKIP("AnyImageConverter / TgaImageConverter plugins not found."); { - out.str({}); + out = {}; Debug redirectOutput(&out); compare.saveDiagnostic(flags, redirectOutput, COMPAREIMAGETEST_SAVE_DIR); } @@ -1444,7 +1470,7 @@ void CompareImageTest::imageToFileError() { /* We expect the *actual* contents, but under the *expected* filename. Comparing file contents, expecting the converter makes exactly the same file. */ - CORRADE_COMPARE(out.str(), Utility::formatString("-> {}\n", filename)); + CORRADE_COMPARE(out, Utility::format("-> {}\n", filename)); CORRADE_COMPARE_AS(filename, Utility::Path::join(DEBUGTOOLS_TEST_DIR, "CompareImageActual.tga"), TestSuite::Compare::File); } @@ -1454,7 +1480,7 @@ void CompareImageTest::imageToFilePluginLoadFailed() { if(manager.loadState("AnyImageImporter") != PluginManager::LoadState::NotFound) CORRADE_SKIP("AnyImageImporter plugin found, can't test."); - std::stringstream out; + Containers::String out; { TestSuite::Comparator compare{&manager, nullptr, 20.0f, 10.0f}; @@ -1471,7 +1497,7 @@ void CompareImageTest::imageToFilePluginLoadFailed() { compare.printMessage(flags, d, "a", "b"); } - CORRADE_COMPARE(out.str(), "AnyImageImporter plugin could not be loaded.\n"); + CORRADE_COMPARE(out, "AnyImageImporter plugin could not be loaded.\n"); } void CompareImageTest::imageToFileExpectedLoadFailed() { @@ -1479,7 +1505,7 @@ void CompareImageTest::imageToFileExpectedLoadFailed() { !(_importerManager->loadState("TgaImporter") & PluginManager::LoadState::Loaded)) CORRADE_SKIP("AnyImageImporter / TgaImporter plugins not found."); - std::stringstream out; + Containers::String out; TestSuite::Comparator compare{&*_importerManager, &*_converterManager, 20.0f, 10.0f}; TestSuite::ComparisonStatusFlags flags = compare(ActualRgb, "nonexistent.tga"); @@ -1491,7 +1517,7 @@ void CompareImageTest::imageToFileExpectedLoadFailed() { compare.printMessage(flags, d, "a", "b"); } - CORRADE_COMPARE(out.str(), "Expected image b (nonexistent.tga) could not be loaded.\n"); + CORRADE_COMPARE(out, "Expected image b (nonexistent.tga) could not be loaded.\n"); /* Create the output dir if it doesn't exist, but avoid stale files making false positives */ @@ -1505,7 +1531,7 @@ void CompareImageTest::imageToFileExpectedLoadFailed() { CORRADE_SKIP("AnyImageConverter / TgaImageConverter plugins not found."); { - out.str({}); + out = {}; Debug redirectOutput(&out); compare.saveDiagnostic(flags, redirectOutput, COMPAREIMAGETEST_SAVE_DIR); } @@ -1513,7 +1539,7 @@ void CompareImageTest::imageToFileExpectedLoadFailed() { /* We expect the *actual* contents, but under the *expected* filename. Comparing file contents, expecting the converter makes exactly the same file. */ - CORRADE_COMPARE(out.str(), Utility::formatString("-> {}\n", filename)); + CORRADE_COMPARE(out, Utility::format("-> {}\n", filename)); CORRADE_COMPARE_AS(filename, Utility::Path::join(DEBUGTOOLS_TEST_DIR, "CompareImageActual.tga"), TestSuite::Compare::File); } @@ -1524,7 +1550,7 @@ void CompareImageTest::imageToFileExpectedIsCompressed() { manager.load("DdsImporter") < PluginManager::LoadState::Loaded) CORRADE_SKIP("AnyImageImporter or DdsImporter plugins can't be loaded."); - std::stringstream out; + Containers::String out; TestSuite::Comparator compare{&manager, nullptr, 20.0f, 10.0f}; /* The filenames are referenced as string views as the assumption is that @@ -1541,7 +1567,7 @@ void CompareImageTest::imageToFileExpectedIsCompressed() { compare.printMessage(flags, d, "a", "b"); } - CORRADE_COMPARE(Utility::String::replaceFirst(out.str(), DEBUGTOOLS_TEST_DIR, "..."), + CORRADE_COMPARE(Utility::String::replaceFirst(out, DEBUGTOOLS_TEST_DIR, "..."), "Expected image b (.../CompareImageCompressed.dds) is compressed, comparison not possible.\n"); /* Create the output dir if it doesn't exist, but avoid stale files making @@ -1592,7 +1618,7 @@ void CompareImageTest::fileToImageNonZeroDelta() { CORRADE_COMPARE_WITH(actualFilename, ExpectedRgb, (CompareFileToImage{*_importerManager, 40.0f, 20.0f})); - std::ostringstream out; + Containers::String out; { TestSuite::Comparator compare{&*_importerManager, 40.0f, 20.0f}; @@ -1603,7 +1629,7 @@ void CompareImageTest::fileToImageNonZeroDelta() { compare.printMessage(flags, d, "a", "b"); } - CORRADE_COMPARE(out.str(), ImageCompareVerbose); + CORRADE_COMPARE(out, ImageCompareVerbose); } void CompareImageTest::fileToImageError() { @@ -1611,7 +1637,7 @@ void CompareImageTest::fileToImageError() { !(_importerManager->loadState("TgaImporter") & PluginManager::LoadState::Loaded)) CORRADE_SKIP("AnyImageImporter / TgaImporter plugins not found."); - std::stringstream out; + Containers::String out; { TestSuite::Comparator compare{&*_importerManager, 20.0f, 10.0f}; @@ -1627,7 +1653,7 @@ void CompareImageTest::fileToImageError() { compare.printMessage(flags, d, "a", "b"); } - CORRADE_COMPARE(out.str(), ImageCompareError); + CORRADE_COMPARE(out, ImageCompareError); } void CompareImageTest::fileToImagePluginLoadFailed() { @@ -1635,7 +1661,7 @@ void CompareImageTest::fileToImagePluginLoadFailed() { if(manager.loadState("AnyImageImporter") != PluginManager::LoadState::NotFound) CORRADE_SKIP("AnyImageImporter plugin found, can't test."); - std::stringstream out; + Containers::String out; { TestSuite::Comparator compare{&manager, 20.0f, 10.0f}; @@ -1651,7 +1677,7 @@ void CompareImageTest::fileToImagePluginLoadFailed() { compare.printMessage(flags, d, "a", "b"); } - CORRADE_COMPARE(out.str(), "AnyImageImporter plugin could not be loaded.\n"); + CORRADE_COMPARE(out, "AnyImageImporter plugin could not be loaded.\n"); } void CompareImageTest::fileToImageActualLoadFailed() { @@ -1659,7 +1685,7 @@ void CompareImageTest::fileToImageActualLoadFailed() { !(_importerManager->loadState("TgaImporter") & PluginManager::LoadState::Loaded)) CORRADE_SKIP("AnyImageImporter / TgaImporter plugins not found."); - std::stringstream out; + Containers::String out; { TestSuite::Comparator compare{&*_importerManager, 20.0f, 10.0f}; @@ -1670,7 +1696,7 @@ void CompareImageTest::fileToImageActualLoadFailed() { compare.printMessage(flags, d, "a", "b"); } - CORRADE_COMPARE(out.str(), "Actual image a (nonexistent.tga) could not be loaded.\n"); + CORRADE_COMPARE(out, "Actual image a (nonexistent.tga) could not be loaded.\n"); } void CompareImageTest::fileToImageActualIsCompressed() { @@ -1679,7 +1705,7 @@ void CompareImageTest::fileToImageActualIsCompressed() { manager.load("DdsImporter") < PluginManager::LoadState::Loaded) CORRADE_SKIP("AnyImageImporter or DdsImporter plugins can't be loaded."); - std::stringstream out; + Containers::String out; { TestSuite::Comparator compare{&manager, 20.0f, 10.0f}; @@ -1695,7 +1721,7 @@ void CompareImageTest::fileToImageActualIsCompressed() { compare.printMessage(flags, d, "a", "b"); } - CORRADE_COMPARE(Utility::String::replaceFirst(out.str(), DEBUGTOOLS_TEST_DIR, "..."), + CORRADE_COMPARE(Utility::String::replaceFirst(out, DEBUGTOOLS_TEST_DIR, "..."), "Actual image a (.../CompareImageCompressed.dds) is compressed, comparison not possible.\n"); } @@ -1906,7 +1932,7 @@ void CompareImageTest::pixelsToImageNonZeroDelta() { CORRADE_COMPARE_WITH(ActualRgb.pixels(), ExpectedRgb, (CompareImage{40.0f, 20.0f})); - std::ostringstream out; + Containers::String out; { TestSuite::Comparator compare{40.0f, 20.0f}; @@ -1917,11 +1943,11 @@ void CompareImageTest::pixelsToImageNonZeroDelta() { compare.printMessage(flags, d, "a", "b"); } - CORRADE_COMPARE(out.str(), ImageCompareVerbose); + CORRADE_COMPARE(out, ImageCompareVerbose); } void CompareImageTest::pixelsToImageDifferentFormat() { - std::stringstream out; + Containers::String out; { TestSuite::Comparator compare{{}, {}}; @@ -1933,13 +1959,13 @@ void CompareImageTest::pixelsToImageDifferentFormat() { compare.printMessage(flags, d, "a", "b"); } - CORRADE_COMPARE(out.str(), "Images a and b have different format, actual PixelFormat::RGB8I but PixelFormat::RGB8Unorm expected.\n"); + CORRADE_COMPARE(out, "Images a and b have different format, actual PixelFormat::RGB8I but PixelFormat::RGB8Unorm expected.\n"); } void CompareImageTest::pixelsToImageError() { /* Same as imageError(), but taking pixels instead */ - std::stringstream out; + Containers::String out; { TestSuite::Comparator compare{20.0f, 10.0f}; @@ -1951,7 +1977,7 @@ void CompareImageTest::pixelsToImageError() { compare.printMessage(flags, d, "a", "b"); } - CORRADE_COMPARE(out.str(), ImageCompareError); + CORRADE_COMPARE(out, ImageCompareError); } template void CompareImageTest::pixelsToFileZeroDelta() { @@ -2006,7 +2032,7 @@ void CompareImageTest::pixelsToFileNonZeroDelta() { expectedFilename, (CompareImageToFile{*_importerManager, 40.0f, 20.0f})); - std::ostringstream out; + Containers::String out; { TestSuite::Comparator compare{&*_importerManager, nullptr, 40.0f, 20.0f}; @@ -2017,7 +2043,7 @@ void CompareImageTest::pixelsToFileNonZeroDelta() { compare.printMessage(flags, d, "a", "b"); } - CORRADE_COMPARE(out.str(), ImageCompareVerbose); + CORRADE_COMPARE(out, ImageCompareVerbose); } void CompareImageTest::pixelsToFileDifferentFormat() { @@ -2031,7 +2057,7 @@ void CompareImageTest::pixelsToFileDifferentFormat() { views. */ Containers::String expectedFilename = Utility::Path::join(DEBUGTOOLS_TEST_DIR, "CompareImageExpected.tga"); - std::stringstream out; + Containers::String out; { TestSuite::Comparator compare{&*_importerManager, nullptr, {}, {}}; @@ -2044,7 +2070,7 @@ void CompareImageTest::pixelsToFileDifferentFormat() { compare.printMessage(flags, d, "a", "b"); } - CORRADE_COMPARE(out.str(), "Images a and b have different format, actual PixelFormat::RGB8Snorm but PixelFormat::RGB8Unorm expected.\n"); + CORRADE_COMPARE(out, "Images a and b have different format, actual PixelFormat::RGB8Snorm but PixelFormat::RGB8Unorm expected.\n"); } void CompareImageTest::pixelsToFileError() { @@ -2060,7 +2086,7 @@ void CompareImageTest::pixelsToFileError() { views. */ Containers::String expectedFilename = Utility::Path::join(DEBUGTOOLS_TEST_DIR, "CompareImageExpected.tga"); - std::stringstream out; + Containers::String out; TestSuite::Comparator compare{&*_importerManager, &*_converterManager, 20.0f, 10.0f}; /* Vector3ub gets matched to PixelFormat::R8UI initially, but once the @@ -2076,7 +2102,7 @@ void CompareImageTest::pixelsToFileError() { compare.printMessage(flags, d, "a", "b"); } - CORRADE_COMPARE(out.str(), ImageCompareError); + CORRADE_COMPARE(out, ImageCompareError); /* Create the output dir if it doesn't exist, but avoid stale files making false positives */ @@ -2090,7 +2116,7 @@ void CompareImageTest::pixelsToFileError() { CORRADE_SKIP("AnyImageConverter / TgaImageConverter plugins not found."); { - out.str({}); + out = {}; Debug redirectOutput(&out); compare.saveDiagnostic(flags, redirectOutput, COMPAREIMAGETEST_SAVE_DIR); } @@ -2098,7 +2124,7 @@ void CompareImageTest::pixelsToFileError() { /* We expect the *actual* contents, but under the *expected* filename. Comparing file contents, expecting the converter makes exactly the same file. */ - CORRADE_COMPARE(out.str(), Utility::formatString("-> {}\n", filename)); + CORRADE_COMPARE(out, Utility::format("-> {}\n", filename)); CORRADE_COMPARE_AS(filename, Utility::Path::join(DEBUGTOOLS_TEST_DIR, "CompareImageActual.tga"), TestSuite::Compare::File); } @@ -2110,7 +2136,7 @@ void CompareImageTest::pixelsToFileExpectedLoadFailed() { !(_importerManager->loadState("TgaImporter") & PluginManager::LoadState::Loaded)) CORRADE_SKIP("AnyImageImporter / TgaImporter plugins not found."); - std::stringstream out; + Containers::String out; TestSuite::Comparator compare{&*_importerManager, &*_converterManager, 20.0f, 10.0f}; TestSuite::ComparisonStatusFlags flags = compare(ActualRgb.pixels(), "nonexistent.tga"); @@ -2122,7 +2148,7 @@ void CompareImageTest::pixelsToFileExpectedLoadFailed() { compare.printMessage(flags, d, "a", "b"); } - CORRADE_COMPARE(out.str(), "Expected image b (nonexistent.tga) could not be loaded.\n"); + CORRADE_COMPARE(out, "Expected image b (nonexistent.tga) could not be loaded.\n"); /* Create the output dir if it doesn't exist, but avoid stale files making false positives */ @@ -2136,7 +2162,7 @@ void CompareImageTest::pixelsToFileExpectedLoadFailed() { CORRADE_SKIP("AnyImageConverter / TgaImageConverter plugins not found."); { - out.str({}); + out = {}; Debug redirectOutput(&out); compare.saveDiagnostic(flags, redirectOutput, COMPAREIMAGETEST_SAVE_DIR); } @@ -2144,7 +2170,7 @@ void CompareImageTest::pixelsToFileExpectedLoadFailed() { /* We expect the *actual* contents, but under the *expected* filename. Comparing file contents, expecting the converter makes exactly the same file. */ - CORRADE_COMPARE(out.str(), Utility::formatString("-> {}\n", filename)); + CORRADE_COMPARE(out, Utility::format("-> {}\n", filename)); CORRADE_COMPARE_AS(filename, Utility::Path::join(DEBUGTOOLS_TEST_DIR, "CompareImageActual.tga"), TestSuite::Compare::File); } diff --git a/src/Magnum/DebugTools/Test/CompareMaterialTest.cpp b/src/Magnum/DebugTools/Test/CompareMaterialTest.cpp index 21a589a17..32715470c 100644 --- a/src/Magnum/DebugTools/Test/CompareMaterialTest.cpp +++ b/src/Magnum/DebugTools/Test/CompareMaterialTest.cpp @@ -24,10 +24,9 @@ DEALINGS IN THE SOFTWARE. */ -#include #include +#include #include -#include #include "Magnum/DebugTools/CompareMaterial.h" #include "Magnum/Math/Color.h" @@ -353,12 +352,12 @@ void CompareMaterialTest::different() { compare.printMessage(flags, out, "a", "b"); } - std::ostringstream out; + Containers::String out; { Debug dc{&out, Debug::Flag::DisableColors}; compare.printMessage(flags, dc, "a", "b"); } - CORRADE_COMPARE(out.str(), data.message); + CORRADE_COMPARE(out, data.message); } void CompareMaterialTest::differentReverse() { @@ -375,12 +374,12 @@ void CompareMaterialTest::differentReverse() { compare.printMessage(flags, out, "b", "a"); } - std::ostringstream out; + Containers::String out; { Debug dc{&out, Debug::Flag::DisableColors}; compare.printMessage(flags, dc, "b", "a"); } - CORRADE_COMPARE(out.str(), data.messageReverse); + CORRADE_COMPARE(out, data.messageReverse); } }}}} diff --git a/src/Magnum/DebugTools/Test/FrameProfilerTest.cpp b/src/Magnum/DebugTools/Test/FrameProfilerTest.cpp index 334bdf6a3..cc7f6e1c4 100644 --- a/src/Magnum/DebugTools/Test/FrameProfilerTest.cpp +++ b/src/Magnum/DebugTools/Test/FrameProfilerTest.cpp @@ -24,12 +24,11 @@ DEALINGS IN THE SOFTWARE. */ -#include #include #include #include -#include #include +#include /** @todo remove once Configuration is std::string-free */ #include #include "Magnum/DebugTools/FrameProfiler.h" @@ -781,32 +780,32 @@ void FrameProfilerTest::move() { void FrameProfilerTest::delayZero() { CORRADE_SKIP_IF_NO_ASSERT(); - std::ostringstream out; + Containers::String out; Error redirectError{&out}; FrameProfiler::Measurement{"", FrameProfiler::Units::Count, 0, nullptr, nullptr, nullptr, nullptr}; - CORRADE_COMPARE(out.str(), "DebugTools::FrameProfiler::Measurement: delay can't be zero\n"); + CORRADE_COMPARE(out, "DebugTools::FrameProfiler::Measurement: delay can't be zero\n"); } void FrameProfilerTest::frameCountZero() { CORRADE_SKIP_IF_NO_ASSERT(); - std::ostringstream out; + Containers::String out; Error redirectError{&out}; FrameProfiler{{}, 0}; - CORRADE_COMPARE(out.str(), "DebugTools::FrameProfiler::setup(): max frame count can't be zero\n"); + CORRADE_COMPARE(out, "DebugTools::FrameProfiler::setup(): max frame count can't be zero\n"); } void FrameProfilerTest::delayTooLittleFrames() { CORRADE_SKIP_IF_NO_ASSERT(); - std::ostringstream out; + Containers::String out; Error redirectError{&out}; FrameProfiler profiler{{ FrameProfiler::Measurement{"", FrameProfiler::Units::Count, 3, nullptr, nullptr, nullptr, nullptr} }, 2}; - CORRADE_COMPARE(out.str(), "DebugTools::FrameProfiler::setup(): max delay 3 is larger than max frame count 2\n"); + CORRADE_COMPARE(out, "DebugTools::FrameProfiler::setup(): max delay 3 is larger than max frame count 2\n"); } void FrameProfilerTest::startStopFrameUnexpected() { @@ -814,7 +813,7 @@ void FrameProfilerTest::startStopFrameUnexpected() { FrameProfiler profiler; - std::ostringstream out; + Containers::String out; { Error redirectError{&out}; profiler.endFrame(); @@ -824,7 +823,7 @@ void FrameProfilerTest::startStopFrameUnexpected() { Error redirectError{&out}; profiler.beginFrame(); } - CORRADE_COMPARE(out.str(), + CORRADE_COMPARE(out, "DebugTools::FrameProfiler::endFrame(): expected begin of frame\n" "DebugTools::FrameProfiler::beginFrame(): expected end of frame\n"); } @@ -839,14 +838,14 @@ void FrameProfilerTest::measurementOutOfRange() { nullptr, nullptr, nullptr} }, 1}; - std::ostringstream out; + Containers::String out; Error redirectError{&out}; profiler.measurementName(2); profiler.measurementUnits(2); profiler.measurementDelay(2); profiler.measurementData(2, 0); profiler.measurementMean(2); - CORRADE_COMPARE(out.str(), + CORRADE_COMPARE(out, "DebugTools::FrameProfiler::measurementName(): index 2 out of range for 2 measurements\n" "DebugTools::FrameProfiler::measurementUnits(): index 2 out of range for 2 measurements\n" "DebugTools::FrameProfiler::measurementDelay(): index 2 out of range for 2 measurements\n" @@ -870,10 +869,10 @@ void FrameProfilerTest::frameOutOfRange() { profiler.beginFrame(); profiler.endFrame(); - std::ostringstream out; + Containers::String out; Error redirectError{&out}; profiler.measurementData(0, 3); - CORRADE_COMPARE(out.str(), + CORRADE_COMPARE(out, "DebugTools::FrameProfiler::measurementData(): frame 3 out of range for max 3 frames\n"); } @@ -889,10 +888,10 @@ void FrameProfilerTest::dataNotAvailableYet() { /* Empty state */ { - std::ostringstream out; + Containers::String out; Error redirectError{&out}; profiler.measurementData(0, 0); - CORRADE_COMPARE(out.str(), + CORRADE_COMPARE(out, "DebugTools::FrameProfiler::measurementData(): frame 0 of measurement 0 not available yet (delay 3, 0 frames measured so far)\n"); } @@ -910,12 +909,12 @@ void FrameProfilerTest::dataNotAvailableYet() { profiler.measurementData(0, 0); profiler.measurementData(0, 1); - std::ostringstream out; + Containers::String out; Error redirectError{&out}; profiler.measurementData(0, 2); profiler.measurementData(0, 3); profiler.measurementData(0, 4); - CORRADE_COMPARE(out.str(), + CORRADE_COMPARE(out, "DebugTools::FrameProfiler::measurementData(): frame 2 of measurement 0 not available yet (delay 3, 4 frames measured so far)\n" "DebugTools::FrameProfiler::measurementData(): frame 3 of measurement 0 not available yet (delay 3, 4 frames measured so far)\n" "DebugTools::FrameProfiler::measurementData(): frame 4 of measurement 0 not available yet (delay 3, 4 frames measured so far)\n"); @@ -933,10 +932,10 @@ void FrameProfilerTest::dataNotAvailableYet() { profiler.measurementData(0, 2); profiler.measurementData(0, 3); - std::ostringstream out; + Containers::String out; Error redirectError{&out}; profiler.measurementData(0, 4); - CORRADE_COMPARE(out.str(), + CORRADE_COMPARE(out, "DebugTools::FrameProfiler::measurementData(): frame 4 of measurement 0 not available yet (delay 3, 6 frames measured so far)\n"); } } @@ -957,10 +956,10 @@ void FrameProfilerTest::meanNotAvailableYet() { CORRADE_COMPARE(profiler.measuredFrameCount(), 1); CORRADE_VERIFY(!profiler.isMeasurementAvailable(0)); - std::ostringstream out; + Containers::String out; Error redirectError{&out}; profiler.measurementMean(0); - CORRADE_COMPARE(out.str(), + CORRADE_COMPARE(out, "DebugTools::FrameProfiler::measurementMean(): measurement data available after 2 more frames\n"); } @@ -1160,13 +1159,13 @@ void FrameProfilerTest::glNotEnabled() { FrameProfilerGL profiler{{}, 5}; - std::ostringstream out; + Containers::String out; Error redirectError{&out}; profiler.isMeasurementAvailable(FrameProfilerGL::Value::CpuDuration); profiler.frameTimeMean(); profiler.cpuDurationMean(); profiler.gpuDurationMean(); - CORRADE_COMPARE(out.str(), + CORRADE_COMPARE(out, "DebugTools::FrameProfilerGL::isMeasurementAvailable(): DebugTools::FrameProfilerGL::Value::CpuDuration not enabled\n" "DebugTools::FrameProfilerGL::frameTimeMean(): not enabled\n" "DebugTools::FrameProfilerGL::cpuDurationMean(): not enabled\n" @@ -1175,25 +1174,25 @@ void FrameProfilerTest::glNotEnabled() { #endif void FrameProfilerTest::debugUnits() { - std::ostringstream out; + Containers::String out; Debug{&out} << FrameProfiler::Units::Nanoseconds << FrameProfiler::Units(0xf0); - CORRADE_COMPARE(out.str(), "DebugTools::FrameProfiler::Units::Nanoseconds DebugTools::FrameProfiler::Units(0xf0)\n"); + CORRADE_COMPARE(out, "DebugTools::FrameProfiler::Units::Nanoseconds DebugTools::FrameProfiler::Units(0xf0)\n"); } #ifdef MAGNUM_TARGET_GL void FrameProfilerTest::debugGLValue() { - std::ostringstream out; + Containers::String out; Debug{&out} << FrameProfilerGL::Value::GpuDuration << FrameProfilerGL::Value(0xfff0); - CORRADE_COMPARE(out.str(), "DebugTools::FrameProfilerGL::Value::GpuDuration DebugTools::FrameProfilerGL::Value(0xfff0)\n"); + CORRADE_COMPARE(out, "DebugTools::FrameProfilerGL::Value::GpuDuration DebugTools::FrameProfilerGL::Value(0xfff0)\n"); } void FrameProfilerTest::debugGLValues() { - std::ostringstream out; + Containers::String out; Debug{&out} << (FrameProfilerGL::Value::CpuDuration|FrameProfilerGL::Value::FrameTime) << FrameProfilerGL::Values{}; - CORRADE_COMPARE(out.str(), "DebugTools::FrameProfilerGL::Value::FrameTime|DebugTools::FrameProfilerGL::Value::CpuDuration DebugTools::FrameProfilerGL::Values{}\n"); + CORRADE_COMPARE(out, "DebugTools::FrameProfilerGL::Value::FrameTime|DebugTools::FrameProfilerGL::Value::CpuDuration DebugTools::FrameProfilerGL::Values{}\n"); } void FrameProfilerTest::configurationGLValue() { diff --git a/src/Magnum/DebugTools/Test/ScreenshotGLTest.cpp b/src/Magnum/DebugTools/Test/ScreenshotGLTest.cpp index e928a46f9..6232445b5 100644 --- a/src/Magnum/DebugTools/Test/ScreenshotGLTest.cpp +++ b/src/Magnum/DebugTools/Test/ScreenshotGLTest.cpp @@ -24,12 +24,10 @@ DEALINGS IN THE SOFTWARE. */ -#include #include #include #include -#include -#include +#include #include #include "Magnum/ImageView.h" @@ -130,7 +128,7 @@ void ScreenshotGLTest::rgba8() { else CORRADE_VERIFY(Utility::Path::make(SCREENSHOTTEST_SAVE_DIR)); - std::ostringstream out; + Containers::String out; bool succeeded; { #ifndef MAGNUM_TARGET_WEBGL @@ -145,8 +143,8 @@ void ScreenshotGLTest::rgba8() { MAGNUM_VERIFY_NO_GL_ERROR(); CORRADE_VERIFY(succeeded); - CORRADE_COMPARE(out.str(), - Utility::formatString("DebugTools::screenshot(): saved a PixelFormat::RGBA8Unorm image of size Vector(4, 3) to {}\n", file)); + CORRADE_COMPARE(out, + Utility::format("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)) @@ -187,7 +185,7 @@ void ScreenshotGLTest::r8() { else CORRADE_VERIFY(Utility::Path::make(SCREENSHOTTEST_SAVE_DIR)); - std::ostringstream out; + Containers::String out; bool succeeded; { #ifndef MAGNUM_TARGET_WEBGL @@ -207,8 +205,8 @@ void ScreenshotGLTest::r8() { CORRADE_EXPECT_FAIL_IF(framebuffer.implementationColorReadFormat() != GL::PixelFormat::Red, "Implementation-defined color read format is not single-channel."); - CORRADE_COMPARE(out.str(), - Utility::formatString("DebugTools::screenshot(): saved a PixelFormat::R8Unorm image of size Vector(4, 3) to {}\n", file)); + CORRADE_COMPARE(out, + Utility::format("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)) @@ -234,7 +232,7 @@ void ScreenshotGLTest::unknownFormat() { framebuffer.implementationColorReadType() == GL::PixelType::UnsignedByte) CORRADE_SKIP("The framebuffer read format is RGBA8, can't test."); - std::ostringstream out; + Containers::String out; bool succeeded; { Error redirectOutput{&out}; @@ -245,9 +243,9 @@ void ScreenshotGLTest::unknownFormat() { CORRADE_VERIFY(!succeeded); if(framebuffer.implementationColorReadFormat() == GL::PixelFormat::RGBA) - CORRADE_COMPARE(out.str(), "DebugTools::screenshot(): can't map {GL::PixelFormat::RGBA, GL::PixelType::UnsignedShort565} to a generic pixel format\n"); + CORRADE_COMPARE(out, "DebugTools::screenshot(): can't map {GL::PixelFormat::RGBA, GL::PixelType::UnsignedShort565} to a generic pixel format\n"); else - CORRADE_COMPARE(out.str(), "DebugTools::screenshot(): can't map {GL::PixelFormat::RGB, GL::PixelType::UnsignedShort565} to a generic pixel format\n"); + CORRADE_COMPARE(out, "DebugTools::screenshot(): can't map {GL::PixelFormat::RGB, GL::PixelType::UnsignedShort565} to a generic pixel format\n"); } void ScreenshotGLTest::pluginLoadFailed() { @@ -271,7 +269,7 @@ void ScreenshotGLTest::pluginLoadFailed() { CORRADE_COMPARE(framebuffer.checkStatus(GL::FramebufferTarget::Read), GL::Framebuffer::Status::Complete); - std::ostringstream out; + Containers::String out; bool succeeded; { Error redirectOutput{&out}; @@ -281,9 +279,9 @@ void ScreenshotGLTest::pluginLoadFailed() { MAGNUM_VERIFY_NO_GL_ERROR(); CORRADE_VERIFY(!succeeded); #ifndef CORRADE_PLUGINMANAGER_NO_DYNAMIC_PLUGIN_SUPPORT - CORRADE_COMPARE(out.str(), "PluginManager::Manager::load(): plugin AnyImageConverter is not static and was not found in nowhere\n"); + CORRADE_COMPARE(out, "PluginManager::Manager::load(): plugin AnyImageConverter is not static and was not found in nowhere\n"); #else - CORRADE_COMPARE(out.str(), "PluginManager::Manager::load(): plugin AnyImageConverter was not found\n"); + CORRADE_COMPARE(out, "PluginManager::Manager::load(): plugin AnyImageConverter was not found\n"); #endif } @@ -307,7 +305,7 @@ void ScreenshotGLTest::saveFailed() { CORRADE_COMPARE(framebuffer.checkStatus(GL::FramebufferTarget::Read), GL::Framebuffer::Status::Complete); - std::ostringstream out; + Containers::String out; bool succeeded; { Error redirectOutput{&out}; @@ -316,7 +314,7 @@ void ScreenshotGLTest::saveFailed() { MAGNUM_VERIFY_NO_GL_ERROR(); CORRADE_VERIFY(!succeeded); - CORRADE_COMPARE(out.str(), "Trade::AnyImageConverter::convertToFile(): cannot determine the format of image.poo for a 2D image\n"); + CORRADE_COMPARE(out, "Trade::AnyImageConverter::convertToFile(): cannot determine the format of image.poo for a 2D image\n"); } }}}} diff --git a/src/Magnum/DebugTools/Test/TextureImageGLTest.cpp b/src/Magnum/DebugTools/Test/TextureImageGLTest.cpp index fecce3f96..d91728ea6 100644 --- a/src/Magnum/DebugTools/Test/TextureImageGLTest.cpp +++ b/src/Magnum/DebugTools/Test/TextureImageGLTest.cpp @@ -24,9 +24,8 @@ DEALINGS IN THE SOFTWARE. */ -#include +#include #include -#include #include "Magnum/Image.h" #include "Magnum/ImageView.h" @@ -143,15 +142,15 @@ void TextureImageGLTest::subImage2DNotReadable() { texture.setImage(0, GL::TextureFormat::RGB9E5, ImageView2D{GL::PixelFormat::RGB, GL::PixelType::UnsignedInt5999Rev, Vector2i{2}, Data2D}); #endif - std::ostringstream out; + Containers::String out; Error redirectError{&out}; /* The read type doesn't have to match, it doesn't get that far */ textureSubImage(texture, 0, {{}, Vector2i{2}}, {GL::PixelFormat::RGBA, GL::PixelType::UnsignedByte}); MAGNUM_VERIFY_NO_GL_ERROR(); #ifndef MAGNUM_TARGET_GLES - CORRADE_COMPARE(out.str(), "DebugTools::textureSubImage(): texture format not framebuffer-readable: GL::Framebuffer::Status::Unsupported\n"); + CORRADE_COMPARE(out, "DebugTools::textureSubImage(): texture format not framebuffer-readable: GL::Framebuffer::Status::Unsupported\n"); #else - CORRADE_COMPARE(out.str(), "DebugTools::textureSubImage(): texture format not framebuffer-readable: GL::Framebuffer::Status::IncompleteAttachment\n"); + CORRADE_COMPARE(out, "DebugTools::textureSubImage(): texture format not framebuffer-readable: GL::Framebuffer::Status::IncompleteAttachment\n"); #endif } @@ -186,15 +185,15 @@ void TextureImageGLTest::subImage2DBufferNotReadable() { GL::Texture2D texture; texture.setImage(0, GL::TextureFormat::RGB9E5, ImageView2D{GL::PixelFormat::RGB, GL::PixelType::UnsignedInt5999Rev, Vector2i{2}, Data2D}); - std::ostringstream out; + Containers::String out; Error redirectError{&out}; /* The read type doesn't have to match, it doesn't get that far */ textureSubImage(texture, 0, {{}, Vector2i{2}}, {GL::PixelFormat::RGBA, GL::PixelType::UnsignedByte}, GL::BufferUsage::StaticRead); MAGNUM_VERIFY_NO_GL_ERROR(); #ifndef MAGNUM_TARGET_GLES - CORRADE_COMPARE(out.str(), "DebugTools::textureSubImage(): texture format not framebuffer-readable: GL::Framebuffer::Status::Unsupported\n"); + CORRADE_COMPARE(out, "DebugTools::textureSubImage(): texture format not framebuffer-readable: GL::Framebuffer::Status::Unsupported\n"); #else - CORRADE_COMPARE(out.str(), "DebugTools::textureSubImage(): texture format not framebuffer-readable: GL::Framebuffer::Status::IncompleteAttachment\n"); + CORRADE_COMPARE(out, "DebugTools::textureSubImage(): texture format not framebuffer-readable: GL::Framebuffer::Status::IncompleteAttachment\n"); #endif } #endif @@ -272,15 +271,15 @@ void TextureImageGLTest::subImageCubeNotReadable() { .setImage(GL::CubeMapCoordinate::PositiveZ, 0, format, view) .setImage(GL::CubeMapCoordinate::NegativeZ, 0, format, view); - std::ostringstream out; + Containers::String out; Error redirectError{&out}; /* The read type doesn't have to match, it doesn't get that far */ textureSubImage(texture, GL::CubeMapCoordinate::PositiveX, 0, {{}, Vector2i{2}}, {GL::PixelFormat::RGBA, GL::PixelType::UnsignedByte}); MAGNUM_VERIFY_NO_GL_ERROR(); #ifndef MAGNUM_TARGET_GLES - CORRADE_COMPARE(out.str(), "DebugTools::textureSubImage(): texture format not framebuffer-readable: GL::Framebuffer::Status::Unsupported\n"); + CORRADE_COMPARE(out, "DebugTools::textureSubImage(): texture format not framebuffer-readable: GL::Framebuffer::Status::Unsupported\n"); #else - CORRADE_COMPARE(out.str(), "DebugTools::textureSubImage(): texture format not framebuffer-readable: GL::Framebuffer::Status::IncompleteAttachment\n"); + CORRADE_COMPARE(out, "DebugTools::textureSubImage(): texture format not framebuffer-readable: GL::Framebuffer::Status::IncompleteAttachment\n"); #endif } @@ -330,15 +329,15 @@ void TextureImageGLTest::subImageCubeBufferNotReadable() { .setImage(GL::CubeMapCoordinate::PositiveZ, 0, format, view) .setImage(GL::CubeMapCoordinate::NegativeZ, 0, format, view); - std::ostringstream out; + Containers::String out; Error redirectError{&out}; /* The read type doesn't have to match, it doesn't get that far */ textureSubImage(texture, GL::CubeMapCoordinate::PositiveX, 0, {{}, Vector2i{2}}, {GL::PixelFormat::RGBA, GL::PixelType::UnsignedByte}, GL::BufferUsage::StaticRead); MAGNUM_VERIFY_NO_GL_ERROR(); #ifndef MAGNUM_TARGET_GLES - CORRADE_COMPARE(out.str(), "DebugTools::textureSubImage(): texture format not framebuffer-readable: GL::Framebuffer::Status::Unsupported\n"); + CORRADE_COMPARE(out, "DebugTools::textureSubImage(): texture format not framebuffer-readable: GL::Framebuffer::Status::Unsupported\n"); #else - CORRADE_COMPARE(out.str(), "DebugTools::textureSubImage(): texture format not framebuffer-readable: GL::Framebuffer::Status::IncompleteAttachment\n"); + CORRADE_COMPARE(out, "DebugTools::textureSubImage(): texture format not framebuffer-readable: GL::Framebuffer::Status::IncompleteAttachment\n"); #endif } #endif diff --git a/src/Magnum/GL/Test/AbstractShaderProgramGLTest.cpp b/src/Magnum/GL/Test/AbstractShaderProgramGLTest.cpp index acc6b5ccf..610767f6c 100644 --- a/src/Magnum/GL/Test/AbstractShaderProgramGLTest.cpp +++ b/src/Magnum/GL/Test/AbstractShaderProgramGLTest.cpp @@ -25,16 +25,13 @@ DEALINGS IN THE SOFTWARE. */ -#include #include #include #include #include -#include /* StringHasPrefix / StringHasSuffix */ #include #include #include -#include #include #include @@ -630,7 +627,7 @@ void AbstractShaderProgramGLTest::linkFailure() { /* And thus linking as well, saying something like "error: linking with uncompiled/unspecialized shader" */ - std::ostringstream out; + Containers::String out; { Error redirectError{&out}; CORRADE_VERIFY(!program.link()); @@ -640,12 +637,12 @@ void AbstractShaderProgramGLTest::linkFailure() { CORRADE_VERIFY(program.isLinkFinished()); /* There's a driver-specific message after */ - CORRADE_COMPARE_AS(out.str(), "GL::AbstractShaderProgram::link(): linking failed with the following message:", + CORRADE_COMPARE_AS(out, "GL::AbstractShaderProgram::link(): linking failed with the following message:", TestSuite::Compare::StringHasPrefix); /* No stray \0 should be anywhere */ - CORRADE_COMPARE_AS(out.str(), "\0"_s, TestSuite::Compare::StringNotContains); + CORRADE_COMPARE_AS(out, "\0"_s, TestSuite::Compare::StringNotContains); /* The message should end with a newline */ - CORRADE_COMPARE_AS(out.str(), "\n"_s, TestSuite::Compare::StringHasSuffix); + CORRADE_COMPARE_AS(out, "\n"_s, TestSuite::Compare::StringHasSuffix); } void AbstractShaderProgramGLTest::linkFailureAsync() { @@ -672,7 +669,7 @@ void AbstractShaderProgramGLTest::linkFailureAsync() { program.attachShaders({shader}); /* The link submission should not print anything ... */ - std::ostringstream out; + Containers::String out; { Error redirectError{&out}; program.submitLink(); @@ -681,7 +678,7 @@ void AbstractShaderProgramGLTest::linkFailureAsync() { while(!program.isLinkFinished()) Utility::System::sleep(100); - CORRADE_VERIFY(out.str().empty()); + CORRADE_COMPARE(out, ""); /* ... only the final check should. In this case it's "error: linking with uncompiled/unspecialized shader" as well, but if the shaders would be @@ -692,7 +689,7 @@ void AbstractShaderProgramGLTest::linkFailureAsync() { CORRADE_VERIFY(!program.checkLink({})); } CORRADE_VERIFY(program.isLinkFinished()); - CORRADE_COMPARE_AS(out.str(), "GL::AbstractShaderProgram::link(): linking failed with the following message:", + CORRADE_COMPARE_AS(out, "GL::AbstractShaderProgram::link(): linking failed with the following message:", TestSuite::Compare::StringHasPrefix); /* Not testing presence of \0 etc., as that's tested well enough in @@ -735,26 +732,26 @@ void AbstractShaderProgramGLTest::linkFailureAsyncShaderList() { /* The link submission should not print anything ... */ { - std::ostringstream out; + Containers::String out; Error redirectError{&out}; program.submitLink(); - CORRADE_VERIFY(out.str().empty()); + CORRADE_COMPARE(out, ""); } /* ... only the final check should. Vertex shader should be fine, but fragment should fail. */ - std::ostringstream out; + Containers::String out; { Error redirectError{&out}; CORRADE_VERIFY(!program.checkLink({vert, frag})); } - CORRADE_COMPARE_AS(out.str(), "GL::Shader::compile(): compilation of fragment shader failed with the following message:", + CORRADE_COMPARE_AS(out, "GL::Shader::compile(): compilation of fragment shader failed with the following message:", TestSuite::Compare::StringHasPrefix); /* The linker error (which would most probably say something like "error: linking with uncompiled/unspecialized shader") should not be even printed */ - CORRADE_COMPARE_AS(out.str(), "GL::AbstractShaderProgram::link(): linking failed with the following message:", + CORRADE_COMPARE_AS(out, "GL::AbstractShaderProgram::link(): linking failed with the following message:", TestSuite::Compare::StringNotContains); } @@ -876,10 +873,10 @@ void AbstractShaderProgramGLTest::uniformNotFound() { program.attachShaders({vert, frag}); CORRADE_VERIFY(program.link()); - std::ostringstream out; + Containers::String out; Warning redirectWarning{&out}; program.uniformLocation("nonexistent"); - CORRADE_COMPARE(out.str(), + CORRADE_COMPARE(out, "GL::AbstractShaderProgram: location of uniform 'nonexistent' cannot be retrieved\n"); } @@ -1174,10 +1171,10 @@ void AbstractShaderProgramGLTest::uniformBlockIndexNotFound() { program.attachShaders({vert, frag}); CORRADE_VERIFY(program.link()); - std::ostringstream out; + Containers::String out; Warning redirectWarning{&out}; program.uniformBlockIndex("nonexistent"); - CORRADE_COMPARE(out.str(), + CORRADE_COMPARE(out, "GL::AbstractShaderProgram: index of uniform block 'nonexistent' cannot be retrieved\n"); } diff --git a/src/Magnum/GL/Test/AbstractTextureGLTest.cpp b/src/Magnum/GL/Test/AbstractTextureGLTest.cpp index 237314e79..14465346b 100644 --- a/src/Magnum/GL/Test/AbstractTextureGLTest.cpp +++ b/src/Magnum/GL/Test/AbstractTextureGLTest.cpp @@ -24,8 +24,7 @@ DEALINGS IN THE SOFTWARE. */ -#include -#include +#include #include "Magnum/ImageView.h" #include "Magnum/GL/Context.h" @@ -132,10 +131,10 @@ void AbstractTextureGLTest::imageQueryViewNullptr() { MutableImageView2D image{PixelFormat::RGBA, PixelType::UnsignedByte, Vector2i{2}, {nullptr, 2*2*4}}; - std::ostringstream out; + Containers::String out; Error redirectError{&out}; texture.image(0, image); - CORRADE_COMPARE(out.str(), "GL::AbstractTexture::image(): image view is nullptr\n"); + CORRADE_COMPARE(out, "GL::AbstractTexture::image(): image view is nullptr\n"); } void AbstractTextureGLTest::imageQueryViewBadSize() { @@ -149,10 +148,10 @@ void AbstractTextureGLTest::imageQueryViewBadSize() { char data[2*4]; MutableImageView2D image{PixelFormat::RGBA, PixelType::UnsignedByte, Vector2i{2, 1}, data}; - std::ostringstream out; + Containers::String out; Error redirectError{&out}; texture.image(0, image); - CORRADE_COMPARE(out.str(), "GL::AbstractTexture::image(): expected image view size Vector(2, 2) but got Vector(2, 1)\n"); + CORRADE_COMPARE(out, "GL::AbstractTexture::image(): expected image view size Vector(2, 2) but got Vector(2, 1)\n"); } void AbstractTextureGLTest::subImageQueryViewNullptr() { @@ -165,10 +164,10 @@ void AbstractTextureGLTest::subImageQueryViewNullptr() { MutableImageView2D image{PixelFormat::RGBA, PixelType::UnsignedByte, Vector2i{2}, {nullptr, 2*2*4}}; - std::ostringstream out; + Containers::String out; Error redirectError{&out}; texture.subImage(0, {{}, Vector2i{2}}, image); - CORRADE_COMPARE(out.str(), "GL::AbstractTexture::subImage(): image view is nullptr\n"); + CORRADE_COMPARE(out, "GL::AbstractTexture::subImage(): image view is nullptr\n"); } void AbstractTextureGLTest::subImageQueryViewBadSize() { @@ -185,10 +184,10 @@ void AbstractTextureGLTest::subImageQueryViewBadSize() { char data[2*4]; MutableImageView2D image{PixelFormat::RGBA, PixelType::UnsignedByte, Vector2i{2, 1}, data}; - std::ostringstream out; + Containers::String out; Error redirectError{&out}; texture.subImage(0, {{}, Vector2i{2}}, image); - CORRADE_COMPARE(out.str(), "GL::AbstractTexture::subImage(): expected image view size Vector(2, 2) but got Vector(2, 1)\n"); + CORRADE_COMPARE(out, "GL::AbstractTexture::subImage(): expected image view size Vector(2, 2) but got Vector(2, 1)\n"); } void AbstractTextureGLTest::compressedImageQueryViewNullptr() { @@ -204,10 +203,10 @@ void AbstractTextureGLTest::compressedImageQueryViewNullptr() { MutableCompressedImageView2D image{CompressedPixelFormat::RGBAS3tcDxt3, Vector2i{4}, {nullptr, 16}}; - std::ostringstream out; + Containers::String out; Error redirectError{&out}; texture.compressedImage(0, image); - CORRADE_COMPARE(out.str(), "GL::AbstractTexture::compressedImage(): image view is nullptr\n"); + CORRADE_COMPARE(out, "GL::AbstractTexture::compressedImage(): image view is nullptr\n"); } void AbstractTextureGLTest::compressedImageQueryViewBadSize() { @@ -224,10 +223,10 @@ void AbstractTextureGLTest::compressedImageQueryViewBadSize() { char data[2*16]; MutableCompressedImageView2D image{CompressedPixelFormat::RGBAS3tcDxt3, Vector2i{4, 8}, data}; - std::ostringstream out; + Containers::String out; Error redirectError{&out}; texture.compressedImage(0, image); - CORRADE_COMPARE(out.str(), "GL::AbstractTexture::compressedImage(): expected image view size Vector(4, 4) but got Vector(4, 8)\n"); + CORRADE_COMPARE(out, "GL::AbstractTexture::compressedImage(): expected image view size Vector(4, 4) but got Vector(4, 8)\n"); } void AbstractTextureGLTest::compressedImageQueryViewBadDataSize() { @@ -244,10 +243,10 @@ void AbstractTextureGLTest::compressedImageQueryViewBadDataSize() { char data[16 - 1]; MutableCompressedImageView2D image{CompressedPixelFormat::RGBAS3tcDxt3, Vector2i{4}, data}; - std::ostringstream out; + Containers::String out; Error redirectError{&out}; texture.compressedImage(0, image); - CORRADE_COMPARE(out.str(), "GL::AbstractTexture::compressedImage(): expected image view data size 16 bytes but got 15\n"); + CORRADE_COMPARE(out, "GL::AbstractTexture::compressedImage(): expected image view data size 16 bytes but got 15\n"); } void AbstractTextureGLTest::compressedImageQueryViewBadFormat() { @@ -264,10 +263,10 @@ void AbstractTextureGLTest::compressedImageQueryViewBadFormat() { char data[16]; MutableCompressedImageView2D image{CompressedPixelFormat::RGBAS3tcDxt1, Vector2i{4}, data}; - std::ostringstream out; + Containers::String out; Error redirectError{&out}; texture.compressedImage(0, image); - CORRADE_COMPARE(out.str(), "GL::AbstractTexture::compressedImage(): expected image view format GL::CompressedPixelFormat::RGBAS3tcDxt3 but got GL::CompressedPixelFormat::RGBAS3tcDxt1\n"); + CORRADE_COMPARE(out, "GL::AbstractTexture::compressedImage(): expected image view format GL::CompressedPixelFormat::RGBAS3tcDxt3 but got GL::CompressedPixelFormat::RGBAS3tcDxt1\n"); } void AbstractTextureGLTest::compressedSubImageQueryViewNullptr() { @@ -287,10 +286,10 @@ void AbstractTextureGLTest::compressedSubImageQueryViewNullptr() { MutableCompressedImageView2D image{CompressedPixelFormat::RGBAS3tcDxt3, Vector2i{4}, {nullptr, 16}}; - std::ostringstream out; + Containers::String out; Error redirectError{&out}; texture.compressedSubImage(0, {{}, Vector2i{4}}, image); - CORRADE_COMPARE(out.str(), "GL::AbstractTexture::compressedSubImage(): image view is nullptr\n"); + CORRADE_COMPARE(out, "GL::AbstractTexture::compressedSubImage(): image view is nullptr\n"); } void AbstractTextureGLTest::compressedSubImageQueryViewBadSize() { @@ -311,10 +310,10 @@ void AbstractTextureGLTest::compressedSubImageQueryViewBadSize() { char data[2*16]; MutableCompressedImageView2D image{CompressedPixelFormat::RGBAS3tcDxt3, Vector2i{4, 8}, data}; - std::ostringstream out; + Containers::String out; Error redirectError{&out}; texture.compressedSubImage(0, {{}, Vector2i{4}}, image); - CORRADE_COMPARE(out.str(), "GL::AbstractTexture::compressedSubImage(): expected image view size Vector(4, 4) but got Vector(4, 8)\n"); + CORRADE_COMPARE(out, "GL::AbstractTexture::compressedSubImage(): expected image view size Vector(4, 4) but got Vector(4, 8)\n"); } void AbstractTextureGLTest::compressedSubImageQueryViewBadDataSize() { @@ -335,10 +334,10 @@ void AbstractTextureGLTest::compressedSubImageQueryViewBadDataSize() { char data[16 - 1]; MutableCompressedImageView2D image{CompressedPixelFormat::RGBAS3tcDxt3, Vector2i{4}, data}; - std::ostringstream out; + Containers::String out; Error redirectError{&out}; texture.compressedSubImage(0, {{}, Vector2i{4}}, image); - CORRADE_COMPARE(out.str(), "GL::AbstractTexture::compressedSubImage(): expected image view data size 16 bytes but got 15\n"); + CORRADE_COMPARE(out, "GL::AbstractTexture::compressedSubImage(): expected image view data size 16 bytes but got 15\n"); } void AbstractTextureGLTest::compressedSubImageQueryViewBadFormat() { @@ -359,10 +358,10 @@ void AbstractTextureGLTest::compressedSubImageQueryViewBadFormat() { char data[16]; MutableCompressedImageView2D image{CompressedPixelFormat::RGBAS3tcDxt1, Vector2i{4}, data}; - std::ostringstream out; + Containers::String out; Error redirectError{&out}; texture.compressedSubImage(0, {{}, Vector2i{4}}, image); - CORRADE_COMPARE(out.str(), "GL::AbstractTexture::compressedSubImage(): expected image view format GL::CompressedPixelFormat::RGBAS3tcDxt3 but got GL::CompressedPixelFormat::RGBAS3tcDxt1\n"); + CORRADE_COMPARE(out, "GL::AbstractTexture::compressedSubImage(): expected image view format GL::CompressedPixelFormat::RGBAS3tcDxt3 but got GL::CompressedPixelFormat::RGBAS3tcDxt1\n"); } #endif diff --git a/src/Magnum/GL/Test/AttributeTest.cpp b/src/Magnum/GL/Test/AttributeTest.cpp index 875314ee2..6707e7991 100644 --- a/src/Magnum/GL/Test/AttributeTest.cpp +++ b/src/Magnum/GL/Test/AttributeTest.cpp @@ -24,9 +24,8 @@ DEALINGS IN THE SOFTWARE. */ -#include +#include #include -#include #include "Magnum/VertexFormat.h" #include "Magnum/GL/Attribute.h" @@ -1109,11 +1108,11 @@ void AttributeTest::attributeFromGenericFormatEnableNormalized() { void AttributeTest::attributeFromGenericFormatUnexpectedForNormalizedKind() { CORRADE_SKIP_IF_NO_ASSERT(); - std::ostringstream out; + Containers::String out; Error redirectError{&out}; DynamicAttribute{DynamicAttribute::Kind::GenericNormalized, 3, VertexFormat::Int}; - CORRADE_COMPARE(out.str(), + CORRADE_COMPARE(out, "GL::DynamicAttribute: can't use VertexFormat::Int for a normalized attribute\n"); } @@ -1121,13 +1120,13 @@ void AttributeTest::attributeFromGenericFormatUnexpectedForNormalizedKind() { void AttributeTest::attributeFromGenericFormatUnexpectedForIntegralKind() { CORRADE_SKIP_IF_NO_ASSERT(); - std::ostringstream out; + Containers::String out; Error redirectError{&out}; DynamicAttribute{DynamicAttribute::Kind::Integral, 3, VertexFormat::Vector2bNormalized}; DynamicAttribute{DynamicAttribute::Kind::Integral, 3, VertexFormat::Vector3}; - CORRADE_COMPARE(out.str(), + CORRADE_COMPARE(out, "GL::DynamicAttribute: can't use VertexFormat::Vector2bNormalized for a GL::DynamicAttribute::Kind::Integral attribute\n" "GL::DynamicAttribute: can't use VertexFormat::Vector3 for an integral attribute\n"); } @@ -1137,11 +1136,11 @@ void AttributeTest::attributeFromGenericFormatUnexpectedForIntegralKind() { void AttributeTest::attributeFromGenericFormatUnexpectedForLongKind() { CORRADE_SKIP_IF_NO_ASSERT(); - std::ostringstream out; + Containers::String out; Error redirectError{&out}; DynamicAttribute{DynamicAttribute::Kind::Long, 3, VertexFormat::UnsignedShortNormalized}; - CORRADE_COMPARE(out.str(), + CORRADE_COMPARE(out, "GL::DynamicAttribute: can't use VertexFormat::UnsignedShortNormalized for a GL::DynamicAttribute::Kind::Long attribute\n"); } #endif @@ -1149,20 +1148,20 @@ void AttributeTest::attributeFromGenericFormatUnexpectedForLongKind() { void AttributeTest::attributeFromGenericFormatTooManyVectors() { CORRADE_SKIP_IF_NO_ASSERT(); - std::ostringstream out; + Containers::String out; Error redirectError{&out}; DynamicAttribute{Attribute<7, Vector2>{}, VertexFormat::Matrix2x2}; - CORRADE_COMPARE(out.str(), + CORRADE_COMPARE(out, "GL::DynamicAttribute: can't use VertexFormat::Matrix2x2 for a 1-vector attribute\n"); } void AttributeTest::attributeFromGenericFormatTooManyComponents() { CORRADE_SKIP_IF_NO_ASSERT(); - std::ostringstream out; + Containers::String out; Error redirectError{&out}; DynamicAttribute{Attribute<7, Vector2>{}, VertexFormat::Vector3}; - CORRADE_COMPARE(out.str(), + CORRADE_COMPARE(out, "GL::DynamicAttribute: can't use VertexFormat::Vector3 for a 2-component attribute\n"); } @@ -1170,10 +1169,10 @@ void AttributeTest::attributeFromGenericFormatNotAvailable() { #ifndef MAGNUM_TARGET_GLES CORRADE_SKIP("All attribute formats available on desktop GL."); #else - std::ostringstream out; + Containers::String out; Error redirectError{&out}; DynamicAttribute{Attribute<7, Vector2>{}, VertexFormat::Vector3d}; - CORRADE_COMPARE(out.str(), + CORRADE_COMPARE(out, "GL::DynamicAttribute: VertexFormat::Vector3d isn't available on this target\n"); #endif } @@ -1219,79 +1218,79 @@ void AttributeTest::hasVertexFormat() { void AttributeTest::debugComponents1() { typedef Attribute<3, Float> Attribute; - std::ostringstream out; + Containers::String out; Debug{&out} << Attribute::Components::One << Attribute::Components(0xdead); - CORRADE_COMPARE(out.str(), "GL::Attribute::Components::One GL::Attribute::Components(0xdead)\n"); + CORRADE_COMPARE(out, "GL::Attribute::Components::One GL::Attribute::Components(0xdead)\n"); } void AttributeTest::debugComponents2() { typedef Attribute<3, Vector2> Attribute; - std::ostringstream out; + Containers::String out; Debug{&out} << Attribute::Components::Two << Attribute::Components(0xdead); - CORRADE_COMPARE(out.str(), "GL::Attribute::Components::Two GL::Attribute::Components(0xdead)\n"); + CORRADE_COMPARE(out, "GL::Attribute::Components::Two GL::Attribute::Components(0xdead)\n"); } void AttributeTest::debugComponents3() { typedef Attribute<3, Vector3> Attribute; - std::ostringstream out; + Containers::String out; Debug{&out} << Attribute::Components::Three << Attribute::Components(0xdead); - CORRADE_COMPARE(out.str(), "GL::Attribute::Components::Three GL::Attribute::Components(0xdead)\n"); + CORRADE_COMPARE(out, "GL::Attribute::Components::Three GL::Attribute::Components(0xdead)\n"); } #ifndef MAGNUM_TARGET_GLES2 void AttributeTest::debugComponents4() { typedef Attribute<3, Vector4i> Attribute; - std::ostringstream out; + Containers::String out; Debug{&out} << Attribute::Components::Four << Attribute::Components(0xdead); - CORRADE_COMPARE(out.str(), "GL::Attribute::Components::Four GL::Attribute::Components(0xdead)\n"); + CORRADE_COMPARE(out, "GL::Attribute::Components::Four GL::Attribute::Components(0xdead)\n"); } #endif void AttributeTest::debugComponentsMatrix2() { typedef Attribute<3, Matrix2x2> Attribute; - std::ostringstream out; + Containers::String out; Debug{&out} << Attribute::Components::Two << Attribute::Components(0xdead); - CORRADE_COMPARE(out.str(), "GL::Attribute::Components::Two GL::Attribute::Components(0xdead)\n"); + CORRADE_COMPARE(out, "GL::Attribute::Components::Two GL::Attribute::Components(0xdead)\n"); } void AttributeTest::debugComponentsMatrix3() { typedef Attribute<3, Matrix3> Attribute; - std::ostringstream out; + Containers::String out; Debug{&out} << Attribute::Components::Three << Attribute::Components(0xdead); - CORRADE_COMPARE(out.str(), "GL::Attribute::Components::Three GL::Attribute::Components(0xdead)\n"); + CORRADE_COMPARE(out, "GL::Attribute::Components::Three GL::Attribute::Components(0xdead)\n"); } void AttributeTest::debugComponentsMatrix4() { typedef Attribute<3, Matrix4> Attribute; - std::ostringstream out; + Containers::String out; Debug{&out} << Attribute::Components::Four << Attribute::Components(0xdead); - CORRADE_COMPARE(out.str(), "GL::Attribute::Components::Four GL::Attribute::Components(0xdead)\n"); + CORRADE_COMPARE(out, "GL::Attribute::Components::Four GL::Attribute::Components(0xdead)\n"); } void AttributeTest::debugComponentsVector4() { typedef Attribute<3, Vector4> Attribute; - std::ostringstream out; + Containers::String out; Debug{&out} << Attribute::Components::Three << Attribute::Components(0xdead); - CORRADE_COMPARE(out.str(), "GL::Attribute::Components::Three GL::Attribute::Components(0xdead)\n"); + CORRADE_COMPARE(out, "GL::Attribute::Components::Three GL::Attribute::Components(0xdead)\n"); } void AttributeTest::debugDataTypeFloat() { typedef Attribute<3, Float> Attribute; - std::ostringstream out; + Containers::String out; #if !(defined(MAGNUM_TARGET_WEBGL) && defined(MAGNUM_TARGET_GLES2)) Debug{&out} << Attribute::DataType::Half << Attribute::DataType(0xdead); - CORRADE_COMPARE(out.str(), "GL::Attribute::DataType::Half GL::Attribute::DataType(0xdead)\n"); + CORRADE_COMPARE(out, "GL::Attribute::DataType::Half GL::Attribute::DataType(0xdead)\n"); #else Debug{&out} << Attribute::DataType::Float << Attribute::DataType(0xdead); - CORRADE_COMPARE(out.str(), "GL::Attribute::DataType::Float GL::Attribute::DataType(0xdead)\n"); + CORRADE_COMPARE(out, "GL::Attribute::DataType::Float GL::Attribute::DataType(0xdead)\n"); #endif } @@ -1299,9 +1298,9 @@ void AttributeTest::debugDataTypeFloat() { void AttributeTest::debugDataTypeInt() { typedef Attribute<3, Int> Attribute; - std::ostringstream out; + Containers::String out; Debug{&out} << Attribute::DataType::Short << Attribute::DataType(0xdead); - CORRADE_COMPARE(out.str(), "GL::Attribute::DataType::Short GL::Attribute::DataType(0xdead)\n"); + CORRADE_COMPARE(out, "GL::Attribute::DataType::Short GL::Attribute::DataType(0xdead)\n"); } #endif @@ -1309,44 +1308,44 @@ void AttributeTest::debugDataTypeInt() { void AttributeTest::debugDataTypeDouble() { typedef Attribute<3, Double> Attribute; - std::ostringstream out; + Containers::String out; Debug{&out} << Attribute::DataType::Double << Attribute::DataType(0xdead); - CORRADE_COMPARE(out.str(), "GL::Attribute::DataType::Double GL::Attribute::DataType(0xdead)\n"); + CORRADE_COMPARE(out, "GL::Attribute::DataType::Double GL::Attribute::DataType(0xdead)\n"); } #endif void AttributeTest::debugDataTypeVector3() { typedef Attribute<3, Vector3> Attribute; - std::ostringstream out; + Containers::String out; Debug{&out} << Attribute::DataType::Float << Attribute::DataType(0xdead); - CORRADE_COMPARE(out.str(), "GL::Attribute::DataType::Float GL::Attribute::DataType(0xdead)\n"); + CORRADE_COMPARE(out, "GL::Attribute::DataType::Float GL::Attribute::DataType(0xdead)\n"); } void AttributeTest::debugDataTypeVector4() { typedef Attribute<3, Vector4> Attribute; - std::ostringstream out; + Containers::String out; Debug{&out} << Attribute::DataType::Float << Attribute::DataType(0xdead); - CORRADE_COMPARE(out.str(), "GL::Attribute::DataType::Float GL::Attribute::DataType(0xdead)\n"); + CORRADE_COMPARE(out, "GL::Attribute::DataType::Float GL::Attribute::DataType(0xdead)\n"); } void AttributeTest::debugDynamicKind() { - std::ostringstream out; + Containers::String out; Debug{&out} << DynamicAttribute::Kind::GenericNormalized << DynamicAttribute::Kind(0xfe); - CORRADE_COMPARE(out.str(), "GL::DynamicAttribute::Kind::GenericNormalized GL::DynamicAttribute::Kind(0xfe)\n"); + CORRADE_COMPARE(out, "GL::DynamicAttribute::Kind::GenericNormalized GL::DynamicAttribute::Kind(0xfe)\n"); } void AttributeTest::debugDynamicComponents() { - std::ostringstream out; + Containers::String out; Debug{&out} << DynamicAttribute::Components::Three << DynamicAttribute::Components(0xdead); - CORRADE_COMPARE(out.str(), "GL::DynamicAttribute::Components::Three GL::DynamicAttribute::Components(0xdead)\n"); + CORRADE_COMPARE(out, "GL::DynamicAttribute::Components::Three GL::DynamicAttribute::Components(0xdead)\n"); } void AttributeTest::debugDynamicDataType() { - std::ostringstream out; + Containers::String out; Debug{&out} << DynamicAttribute::DataType::Float << DynamicAttribute::DataType(0xdead); - CORRADE_COMPARE(out.str(), "GL::DynamicAttribute::DataType::Float GL::DynamicAttribute::DataType(0xdead)\n"); + CORRADE_COMPARE(out, "GL::DynamicAttribute::DataType::Float GL::DynamicAttribute::DataType(0xdead)\n"); } }}}} diff --git a/src/Magnum/GL/Test/BufferImageGLTest.cpp b/src/Magnum/GL/Test/BufferImageGLTest.cpp index a3d91d498..6bae3894a 100644 --- a/src/Magnum/GL/Test/BufferImageGLTest.cpp +++ b/src/Magnum/GL/Test/BufferImageGLTest.cpp @@ -24,10 +24,10 @@ DEALINGS IN THE SOFTWARE. */ -#include #include +#include #include -#include +#include /** @todo remove once dataProperties() std::pair is gone */ #include "Magnum/PixelFormat.h" #include "Magnum/GL/BufferImage.h" @@ -333,12 +333,12 @@ void BufferImageGLTest::constructBufferCompressedGeneric() { void BufferImageGLTest::constructInvalidSize() { CORRADE_SKIP_IF_NO_ASSERT(); - std::ostringstream out; + Containers::String out; Error redirectError{&out}; /* Doesn't consider alignment */ BufferImage2D{Magnum::PixelFormat::RGB8Unorm, {1, 3}, Containers::Array{3*3}, BufferUsage::StaticDraw}; - CORRADE_COMPARE(out.str(), "GL::BufferImage::BufferImage(): data too small, got 9 but expected at least 12 bytes\n"); + CORRADE_COMPARE(out, "GL::BufferImage::BufferImage(): data too small, got 9 but expected at least 12 bytes\n"); } void BufferImageGLTest::constructCompressedInvalidSize() { @@ -346,17 +346,17 @@ void BufferImageGLTest::constructCompressedInvalidSize() { /* Too small for given format */ { - std::ostringstream out; + Containers::String out; Error redirectError{&out}; CompressedBufferImage2D{Magnum::CompressedPixelFormat::Bc2RGBAUnorm, {4, 4}, Containers::Array{2}, BufferUsage::StaticDraw}; - CORRADE_COMPARE(out.str(), "GL::CompressedBufferImage::CompressedBufferImage(): data too small, got 2 but expected at least 4 bytes\n"); + CORRADE_COMPARE(out, "GL::CompressedBufferImage::CompressedBufferImage(): data too small, got 2 but expected at least 4 bytes\n"); /* Size should be rounded up even if the image size is not full block */ } { - std::ostringstream out; + Containers::String out; Error redirectError{&out}; CompressedBufferImage2D{Magnum::CompressedPixelFormat::Bc2RGBAUnorm, {2, 2}, Containers::Array{2}, BufferUsage::StaticDraw}; - CORRADE_COMPARE(out.str(), "GL::CompressedBufferImage::CompressedBufferImage(): data too small, got 2 but expected at least 4 bytes\n"); + CORRADE_COMPARE(out, "GL::CompressedBufferImage::CompressedBufferImage(): data too small, got 2 but expected at least 4 bytes\n"); } } diff --git a/src/Magnum/GL/Test/BufferTest.cpp b/src/Magnum/GL/Test/BufferTest.cpp index 8d6c87bc2..8be3463e8 100644 --- a/src/Magnum/GL/Test/BufferTest.cpp +++ b/src/Magnum/GL/Test/BufferTest.cpp @@ -25,9 +25,8 @@ DEALINGS IN THE SOFTWARE. */ -#include +#include #include -#include #include "Magnum/GL/Buffer.h" @@ -72,16 +71,16 @@ void BufferTest::constructCopy() { } void BufferTest::debugTargetHint() { - std::ostringstream out; + Containers::String out; Debug{&out} << Buffer::TargetHint::Array << Buffer::TargetHint(0xdead); - CORRADE_COMPARE(out.str(), "GL::Buffer::TargetHint::Array GL::Buffer::TargetHint(0xdead)\n"); + CORRADE_COMPARE(out, "GL::Buffer::TargetHint::Array GL::Buffer::TargetHint(0xdead)\n"); } #ifndef MAGNUM_TARGET_GLES2 void BufferTest::debugTarget() { - std::ostringstream out; + Containers::String out; Debug{&out} << Buffer::Target::Uniform << Buffer::Target(0xdead); - CORRADE_COMPARE(out.str(), "GL::Buffer::Target::Uniform GL::Buffer::Target(0xdead)\n"); + CORRADE_COMPARE(out, "GL::Buffer::Target::Uniform GL::Buffer::Target(0xdead)\n"); } #endif diff --git a/src/Magnum/GL/Test/ContextGLTest.cpp b/src/Magnum/GL/Test/ContextGLTest.cpp index 316f9e89d..2fc2c45cf 100644 --- a/src/Magnum/GL/Test/ContextGLTest.cpp +++ b/src/Magnum/GL/Test/ContextGLTest.cpp @@ -25,7 +25,6 @@ */ #include /* std::find() */ -#include #include #include #include /** @todo remove once Debug is stream-free */ @@ -267,7 +266,7 @@ void ContextGLTest::constructConfiguration() { if(data.needsExtensionMissing && Context::current().isExtensionSupported(*data.needsExtensionMissing)) CORRADE_SKIP(data.needsExtensionMissing->string() << "is supported."); - std::ostringstream out; + Containers::String out; { Context* current = &Context::current(); Context::makeCurrent(nullptr); @@ -282,11 +281,11 @@ void ContextGLTest::constructConfiguration() { } if(!data.logShouldContain.isEmpty()) - CORRADE_COMPARE_AS(out.str(), + CORRADE_COMPARE_AS(out, data.logShouldContain, TestSuite::Compare::StringContains); if(!data.logShouldNotContain.isEmpty()) - CORRADE_COMPARE_AS(out.str(), + CORRADE_COMPARE_AS(out, data.logShouldNotContain, TestSuite::Compare::StringNotContains); } @@ -329,7 +328,7 @@ void ContextGLTest::constructMove() { /* The context is still not created here either */ CORRADE_VERIFY(!Context::hasCurrent()); - std::ostringstream out; + Containers::String out; { Debug redirectOut{&out}; b.create(Context::Configuration{} @@ -340,11 +339,11 @@ void ContextGLTest::constructMove() { .addDisabledExtensions(data.disabledExtensions)); } if(!data.logShouldContain.isEmpty()) - CORRADE_COMPARE_AS(out.str(), + CORRADE_COMPARE_AS(out, data.logShouldContain, TestSuite::Compare::StringContains); if(!data.logShouldNotContain.isEmpty()) - CORRADE_COMPARE_AS(out.str(), + CORRADE_COMPARE_AS(out, data.logShouldNotContain, TestSuite::Compare::StringNotContains); diff --git a/src/Magnum/GL/Test/ContextTest.cpp b/src/Magnum/GL/Test/ContextTest.cpp index b611ed05a..cadc6f65b 100644 --- a/src/Magnum/GL/Test/ContextTest.cpp +++ b/src/Magnum/GL/Test/ContextTest.cpp @@ -25,12 +25,10 @@ */ #include -#include +#include #include -#include #include #include -#include #include "Magnum/GL/Context.h" #include "Magnum/GL/Extensions.h" @@ -233,11 +231,11 @@ void ContextTest::configurationConstructUnknownWorkaround() { /* Unknown workarounds should get ignored -- we're storing views on internally known workaround strings to avoid allocations so there's no other way */ - std::ostringstream out; + Containers::String out; Warning redirectWarning{&out}; configuration.addDisabledWorkarounds({"all-drivers-are-shit"}); CORRADE_VERIFY(configuration.disabledWorkarounds().isEmpty()); - CORRADE_COMPARE(out.str(), "GL::Context::Configuration::addDisabledWorkarounds(): unknown workaround all-drivers-are-shit\n"); + CORRADE_COMPARE(out, "GL::Context::Configuration::addDisabledWorkarounds(): unknown workaround all-drivers-are-shit\n"); } void ContextTest::configurationConstructCopy() { @@ -457,9 +455,9 @@ void ContextTest::debugFlag() { #ifdef MAGNUM_TARGET_WEBGL CORRADE_SKIP("No context flags on Emscripten yet."); #else - std::ostringstream out; + Containers::String out; Debug(&out) << Context::Flag::Debug << Context::Flag(0xdead); - CORRADE_COMPARE(out.str(), "GL::Context::Flag::Debug GL::Context::Flag(0xdead)\n"); + CORRADE_COMPARE(out, "GL::Context::Flag::Debug GL::Context::Flag(0xdead)\n"); #endif } @@ -467,10 +465,10 @@ void ContextTest::debugFlagPacked() { #ifdef MAGNUM_TARGET_WEBGL CORRADE_SKIP("No context flags on Emscripten yet."); #else - std::ostringstream out; + Containers::String out; /* Last is not packed, ones before should not make any flags persistent */ Debug{&out} << Debug::packed << Context::Flag::Debug << Debug::packed << Context::Flag(0xdead) << Context::Flag::NoError; - CORRADE_COMPARE(out.str(), "Debug 0xdead GL::Context::Flag::NoError\n"); + CORRADE_COMPARE(out, "Debug 0xdead GL::Context::Flag::NoError\n"); #endif } @@ -478,9 +476,9 @@ void ContextTest::debugFlags() { #ifdef MAGNUM_TARGET_WEBGL CORRADE_SKIP("No context flags on Emscripten yet."); #else - std::ostringstream out; + Containers::String out; Debug{&out} << (Context::Flag::Debug|Context::Flag::NoError|Context::Flag(0xded0)) << Context::Flags{}; - CORRADE_COMPARE(out.str(), "GL::Context::Flag::Debug|GL::Context::Flag::NoError|GL::Context::Flag(0xded0) GL::Context::Flags{}\n"); + CORRADE_COMPARE(out, "GL::Context::Flag::Debug|GL::Context::Flag::NoError|GL::Context::Flag(0xded0) GL::Context::Flags{}\n"); #endif } @@ -488,56 +486,56 @@ void ContextTest::debugFlagsPacked() { #ifdef MAGNUM_TARGET_WEBGL CORRADE_SKIP("No context flags on Emscripten yet."); #else - std::ostringstream out; + Containers::String out; /* Last is not packed, ones before should not make any flags persistent */ Debug{&out} << Debug::packed << (Context::Flag::Debug|Context::Flag::NoError|Context::Flag(0xded0)) << Debug::packed << Context::Flags{} << (Context::Flag::Debug|Context::Flag::NoError); - CORRADE_COMPARE(out.str(), "Debug|NoError|0xded0 {} GL::Context::Flag::Debug|GL::Context::Flag::NoError\n"); + CORRADE_COMPARE(out, "Debug|NoError|0xded0 {} GL::Context::Flag::Debug|GL::Context::Flag::NoError\n"); #endif } void ContextTest::debugDetectedDriver() { - std::ostringstream out; + Containers::String out; #ifndef MAGNUM_TARGET_WEBGL Debug{&out} << Context::DetectedDriver::Amd << Context::DetectedDriver(0xdead); - CORRADE_COMPARE(out.str(), "GL::Context::DetectedDriver::Amd GL::Context::DetectedDriver(0xdead)\n"); + CORRADE_COMPARE(out, "GL::Context::DetectedDriver::Amd GL::Context::DetectedDriver(0xdead)\n"); #else Debug{&out} << Context::DetectedDriver::Angle << Context::DetectedDriver(0xdead); - CORRADE_COMPARE(out.str(), "GL::Context::DetectedDriver::Angle GL::Context::DetectedDriver(0xdead)\n"); + CORRADE_COMPARE(out, "GL::Context::DetectedDriver::Angle GL::Context::DetectedDriver(0xdead)\n"); #endif } void ContextTest::debugDetectedDriverPacked() { - std::ostringstream out; + Containers::String out; /* Last is not packed, ones before should not make any flags persistent */ #ifndef MAGNUM_TARGET_WEBGL Debug{&out} << Debug::packed << Context::DetectedDriver::Amd << Debug::packed << Context::DetectedDriver(0xdead) << Context::DetectedDriver::NVidia; - CORRADE_COMPARE(out.str(), "Amd 0xdead GL::Context::DetectedDriver::NVidia\n"); + CORRADE_COMPARE(out, "Amd 0xdead GL::Context::DetectedDriver::NVidia\n"); #else Debug{&out} << Debug::packed << Context::DetectedDriver::Angle << Debug::packed << Context::DetectedDriver(0xdead) << Context::DetectedDriver::Angle; - CORRADE_COMPARE(out.str(), "Angle 0xdead GL::Context::DetectedDriver::Angle\n"); + CORRADE_COMPARE(out, "Angle 0xdead GL::Context::DetectedDriver::Angle\n"); #endif } void ContextTest::debugDetectedDrivers() { - std::ostringstream out; + Containers::String out; #ifndef MAGNUM_TARGET_WEBGL Debug{&out} << (Context::DetectedDriver::Amd|Context::DetectedDriver::Mesa|Context::DetectedDriver(0xde00)) << Context::DetectedDrivers{}; - CORRADE_COMPARE(out.str(), "GL::Context::DetectedDriver::Amd|GL::Context::DetectedDriver::Mesa|GL::Context::DetectedDriver(0xde00) GL::Context::DetectedDrivers{}\n"); + CORRADE_COMPARE(out, "GL::Context::DetectedDriver::Amd|GL::Context::DetectedDriver::Mesa|GL::Context::DetectedDriver(0xde00) GL::Context::DetectedDrivers{}\n"); #else Debug{&out} << (Context::DetectedDriver::Angle|Context::DetectedDriver(0xde00)) << Context::DetectedDrivers{}; - CORRADE_COMPARE(out.str(), "GL::Context::DetectedDriver::Angle|GL::Context::DetectedDriver(0xde00) GL::Context::DetectedDrivers{}\n"); + CORRADE_COMPARE(out, "GL::Context::DetectedDriver::Angle|GL::Context::DetectedDriver(0xde00) GL::Context::DetectedDrivers{}\n"); #endif } void ContextTest::debugDetectedDriversPacked() { - std::ostringstream out; + Containers::String out; /* Last is not packed, ones before should not make any flags persistent */ #ifndef MAGNUM_TARGET_WEBGL Debug{&out} << Debug::packed << (Context::DetectedDriver::Amd|Context::DetectedDriver::Mesa|Context::DetectedDriver(0xde00)) << Debug::packed << Context::DetectedDrivers{} << (Context::DetectedDriver::Amd|Context::DetectedDriver::Mesa); - CORRADE_COMPARE(out.str(), "Amd|Mesa|0xde00 {} GL::Context::DetectedDriver::Amd|GL::Context::DetectedDriver::Mesa\n"); + CORRADE_COMPARE(out, "Amd|Mesa|0xde00 {} GL::Context::DetectedDriver::Amd|GL::Context::DetectedDriver::Mesa\n"); #else Debug{&out} << Debug::packed << (Context::DetectedDriver::Angle|Context::DetectedDriver(0xde00)) << Debug::packed << Context::DetectedDrivers{} << (Context::DetectedDriver::Angle|Context::DetectedDriver(0xde00)); - CORRADE_COMPARE(out.str(), "Angle|0xde00 {} GL::Context::DetectedDriver::Angle|GL::Context::DetectedDriver(0xde00)\n"); + CORRADE_COMPARE(out, "Angle|0xde00 {} GL::Context::DetectedDriver::Angle|GL::Context::DetectedDriver(0xde00)\n"); #endif } diff --git a/src/Magnum/GL/Test/CubeMapTextureGLTest.cpp b/src/Magnum/GL/Test/CubeMapTextureGLTest.cpp index 3fe7baf18..40e09a8b3 100644 --- a/src/Magnum/GL/Test/CubeMapTextureGLTest.cpp +++ b/src/Magnum/GL/Test/CubeMapTextureGLTest.cpp @@ -24,9 +24,7 @@ DEALINGS IN THE SOFTWARE. */ -#include #include -#include #include "Magnum/Image.h" #include "Magnum/ImageView.h" @@ -1051,10 +1049,10 @@ void CubeMapTextureGLTest::imageQueryViewNullptr() { MutableImageView2D image{PixelFormat::RGBA, PixelType::UnsignedByte, Vector2i{2}, {nullptr, 2*2*4}}; - std::ostringstream out; + Containers::String out; Error redirectError{&out}; texture.image(CubeMapCoordinate::PositiveY, 0, image); - CORRADE_COMPARE(out.str(), "GL::CubeMapTexture::image(): image view is nullptr\n"); + CORRADE_COMPARE(out, "GL::CubeMapTexture::image(): image view is nullptr\n"); } void CubeMapTextureGLTest::imageQueryViewBadSize() { @@ -1069,10 +1067,10 @@ void CubeMapTextureGLTest::imageQueryViewBadSize() { MutableImageView2D image{PixelFormat::RGBA, PixelType::UnsignedByte, {2, 1}, data}; - std::ostringstream out; + Containers::String out; Error redirectError{&out}; texture.image(CubeMapCoordinate::PositiveY, 0, image); - CORRADE_COMPARE(out.str(), "GL::CubeMapTexture::image(): expected image view size Vector(2, 2) but got Vector(2, 1)\n"); + CORRADE_COMPARE(out, "GL::CubeMapTexture::image(): expected image view size Vector(2, 2) but got Vector(2, 1)\n"); } #endif @@ -1413,10 +1411,10 @@ void CubeMapTextureGLTest::compressedImageQueryViewNullptr() { MutableCompressedImageView2D image{CompressedPixelFormat::RGBAS3tcDxt3, Vector2i{4}, {nullptr, 16}}; - std::ostringstream out; + Containers::String out; Error redirectError{&out}; texture.compressedImage(CubeMapCoordinate::PositiveX, 0, image); - CORRADE_COMPARE(out.str(), "GL::CubeMapTexture::compressedImage(): image view is nullptr\n"); + CORRADE_COMPARE(out, "GL::CubeMapTexture::compressedImage(): image view is nullptr\n"); } void CubeMapTextureGLTest::compressedImageQueryViewBadSize() { @@ -1433,10 +1431,10 @@ void CubeMapTextureGLTest::compressedImageQueryViewBadSize() { char data[2*16]; MutableCompressedImageView2D image{CompressedPixelFormat::RGBAS3tcDxt3, Vector2i{4, 8}, data}; - std::ostringstream out; + Containers::String out; Error redirectError{&out}; texture.compressedImage(CubeMapCoordinate::PositiveX, 0, image); - CORRADE_COMPARE(out.str(), "GL::CubeMapTexture::compressedImage(): expected image view size Vector(4, 4) but got Vector(4, 8)\n"); + CORRADE_COMPARE(out, "GL::CubeMapTexture::compressedImage(): expected image view size Vector(4, 4) but got Vector(4, 8)\n"); } void CubeMapTextureGLTest::compressedImageQueryViewBadDataSize() { @@ -1453,10 +1451,10 @@ void CubeMapTextureGLTest::compressedImageQueryViewBadDataSize() { char data[16 - 1]; MutableCompressedImageView2D image{CompressedPixelFormat::RGBAS3tcDxt3, Vector2i{4}, data}; - std::ostringstream out; + Containers::String out; Error redirectError{&out}; texture.compressedImage(CubeMapCoordinate::PositiveX, 0, image); - CORRADE_COMPARE(out.str(), "GL::CubeMapTexture::compressedImage(): expected image view data size 16 bytes but got 15\n"); + CORRADE_COMPARE(out, "GL::CubeMapTexture::compressedImage(): expected image view data size 16 bytes but got 15\n"); } void CubeMapTextureGLTest::compressedImageQueryViewBadFormat() { @@ -1473,10 +1471,10 @@ void CubeMapTextureGLTest::compressedImageQueryViewBadFormat() { char data[16]; MutableCompressedImageView2D image{CompressedPixelFormat::RGBAS3tcDxt1, Vector2i{4}, data}; - std::ostringstream out; + Containers::String out; Error redirectError{&out}; texture.compressedImage(CubeMapCoordinate::PositiveX, 0, image); - CORRADE_COMPARE(out.str(), "GL::CubeMapTexture::compressedImage(): expected image view format GL::CompressedPixelFormat::RGBAS3tcDxt3 but got GL::CompressedPixelFormat::RGBAS3tcDxt1\n"); + CORRADE_COMPARE(out, "GL::CubeMapTexture::compressedImage(): expected image view format GL::CompressedPixelFormat::RGBAS3tcDxt3 but got GL::CompressedPixelFormat::RGBAS3tcDxt1\n"); } #endif @@ -1770,10 +1768,10 @@ void CubeMapTextureGLTest::compressedSubImageQueryViewNullptr() { MutableCompressedImageView3D image{CompressedPixelFormat::RGBAS3tcDxt3, Vector3i{4, 4, 1}, {nullptr, 16}}; - std::ostringstream out; + Containers::String out; Error redirectError{&out}; texture.compressedSubImage(0, Range3Di::fromSize({4, 4, 0}, {4, 4, 1}), image); - CORRADE_COMPARE(out.str(), "GL::CubeMapTexture::compressedSubImage(): image view is nullptr\n"); + CORRADE_COMPARE(out, "GL::CubeMapTexture::compressedSubImage(): image view is nullptr\n"); } void CubeMapTextureGLTest::compressedSubImageQueryViewBadSize() { @@ -1790,10 +1788,10 @@ void CubeMapTextureGLTest::compressedSubImageQueryViewBadSize() { char data[2*16]; MutableCompressedImageView3D image{CompressedPixelFormat::RGBAS3tcDxt3, Vector3i{4, 4, 2}, data}; - std::ostringstream out; + Containers::String out; Error redirectError{&out}; texture.compressedSubImage(0, Range3Di::fromSize({4, 4, 0}, {4, 4, 1}), image); - CORRADE_COMPARE(out.str(), "GL::CubeMapTexture::compressedSubImage(): expected image view size Vector(4, 4, 1) but got Vector(4, 4, 2)\n"); + CORRADE_COMPARE(out, "GL::CubeMapTexture::compressedSubImage(): expected image view size Vector(4, 4, 1) but got Vector(4, 4, 2)\n"); } void CubeMapTextureGLTest::compressedSubImageQueryViewBadDataSize() { @@ -1810,10 +1808,10 @@ void CubeMapTextureGLTest::compressedSubImageQueryViewBadDataSize() { char data[16 - 1]; MutableCompressedImageView3D image{CompressedPixelFormat::RGBAS3tcDxt3, Vector3i{4, 4, 1}, data}; - std::ostringstream out; + Containers::String out; Error redirectError{&out}; texture.compressedSubImage(0, Range3Di::fromSize({4, 4, 0}, {4, 4, 1}), image); - CORRADE_COMPARE(out.str(), "GL::CubeMapTexture::compressedSubImage(): expected image view data size 16 bytes but got 15\n"); + CORRADE_COMPARE(out, "GL::CubeMapTexture::compressedSubImage(): expected image view data size 16 bytes but got 15\n"); } void CubeMapTextureGLTest::compressedSubImageQueryViewBadFormat() { @@ -1830,10 +1828,10 @@ void CubeMapTextureGLTest::compressedSubImageQueryViewBadFormat() { char data[16]; MutableCompressedImageView3D image{CompressedPixelFormat::RGBAS3tcDxt1, Vector3i{4, 4, 1}, data}; - std::ostringstream out; + Containers::String out; Error redirectError{&out}; texture.compressedSubImage(0, Range3Di::fromSize({4, 4, 0}, {4, 4, 1}), image); - CORRADE_COMPARE(out.str(), "GL::CubeMapTexture::compressedSubImage(): expected image view format GL::CompressedPixelFormat::RGBAS3tcDxt3 but got GL::CompressedPixelFormat::RGBAS3tcDxt1\n"); + CORRADE_COMPARE(out, "GL::CubeMapTexture::compressedSubImage(): expected image view format GL::CompressedPixelFormat::RGBAS3tcDxt3 but got GL::CompressedPixelFormat::RGBAS3tcDxt1\n"); } void CubeMapTextureGLTest::compressedSubImageQueryBuffer() { @@ -1979,10 +1977,10 @@ void CubeMapTextureGLTest::image3DQueryViewNullptr() { MutableImageView3D image{PixelFormat::RGBA, PixelType::UnsignedByte, {2, 2, 6}, {nullptr, 2*2*6*4}}; - std::ostringstream out; + Containers::String out; Error redirectError{&out}; texture.image(0, image); - CORRADE_COMPARE(out.str(), "GL::CubeMapTexture::image(): image view is nullptr\n"); + CORRADE_COMPARE(out, "GL::CubeMapTexture::image(): image view is nullptr\n"); } void CubeMapTextureGLTest::image3DQueryViewBadSize() { @@ -1997,10 +1995,10 @@ void CubeMapTextureGLTest::image3DQueryViewBadSize() { MutableImageView3D image{PixelFormat::RGBA, PixelType::UnsignedByte, {2, 1, 6}, data}; - std::ostringstream out; + Containers::String out; Error redirectError{&out}; texture.image(0, image); - CORRADE_COMPARE(out.str(), "GL::CubeMapTexture::image(): expected image view size Vector(2, 2, 6) but got Vector(2, 1, 6)\n"); + CORRADE_COMPARE(out, "GL::CubeMapTexture::image(): expected image view size Vector(2, 2, 6) but got Vector(2, 1, 6)\n"); } #endif @@ -2178,10 +2176,10 @@ void CubeMapTextureGLTest::compressedImage3DQueryViewNullptr() { MutableCompressedImageView3D image{CompressedPixelFormat::RGBAS3tcDxt3, Vector3i{4, 4, 6}, {nullptr, 16*6}}; - std::ostringstream out; + Containers::String out; Error redirectError{&out}; texture.compressedImage(0, image); - CORRADE_COMPARE(out.str(), "GL::CubeMapTexture::compressedImage(): image view is nullptr\n"); + CORRADE_COMPARE(out, "GL::CubeMapTexture::compressedImage(): image view is nullptr\n"); } void CubeMapTextureGLTest::compressedImage3DQueryViewBadSize() { @@ -2198,10 +2196,10 @@ void CubeMapTextureGLTest::compressedImage3DQueryViewBadSize() { char data[2*6*16]; MutableCompressedImageView3D image{CompressedPixelFormat::RGBAS3tcDxt3, Vector3i{4, 8, 6}, data}; - std::ostringstream out; + Containers::String out; Error redirectError{&out}; texture.compressedImage(0, image); - CORRADE_COMPARE(out.str(), "GL::CubeMapTexture::compressedImage(): expected image view size Vector(4, 4, 6) but got Vector(4, 8, 6)\n"); + CORRADE_COMPARE(out, "GL::CubeMapTexture::compressedImage(): expected image view size Vector(4, 4, 6) but got Vector(4, 8, 6)\n"); } void CubeMapTextureGLTest::compressedImage3DQueryViewBadDataSize() { @@ -2218,10 +2216,10 @@ void CubeMapTextureGLTest::compressedImage3DQueryViewBadDataSize() { char data[16*6 - 1]; MutableCompressedImageView3D image{CompressedPixelFormat::RGBAS3tcDxt3, Vector3i{4, 4, 6}, data}; - std::ostringstream out; + Containers::String out; Error redirectError{&out}; texture.compressedImage(0, image); - CORRADE_COMPARE(out.str(), "GL::CubeMapTexture::compressedImage(): expected image view data size 96 bytes but got 95\n"); + CORRADE_COMPARE(out, "GL::CubeMapTexture::compressedImage(): expected image view data size 96 bytes but got 95\n"); } void CubeMapTextureGLTest::compressedImage3DQueryViewBadFormat() { @@ -2238,10 +2236,10 @@ void CubeMapTextureGLTest::compressedImage3DQueryViewBadFormat() { char data[6*16]; MutableCompressedImageView3D image{CompressedPixelFormat::RGBAS3tcDxt1, Vector3i{4, 4, 6}, data}; - std::ostringstream out; + Containers::String out; Error redirectError{&out}; texture.compressedImage(0, image); - CORRADE_COMPARE(out.str(), "GL::CubeMapTexture::compressedImage(): expected image view format GL::CompressedPixelFormat::RGBAS3tcDxt3 but got GL::CompressedPixelFormat::RGBAS3tcDxt1\n"); + CORRADE_COMPARE(out, "GL::CubeMapTexture::compressedImage(): expected image view format GL::CompressedPixelFormat::RGBAS3tcDxt3 but got GL::CompressedPixelFormat::RGBAS3tcDxt1\n"); } #endif diff --git a/src/Magnum/GL/Test/DebugOutputGLTest.cpp b/src/Magnum/GL/Test/DebugOutputGLTest.cpp index 560db407a..55ce7c698 100644 --- a/src/Magnum/GL/Test/DebugOutputGLTest.cpp +++ b/src/Magnum/GL/Test/DebugOutputGLTest.cpp @@ -24,10 +24,10 @@ DEALINGS IN THE SOFTWARE. */ -#include +#include /** @todo remove once the DebugOutput internals are stream-free */ #include #include -#include /** @todo remove once Debug is stream-free */ +#include /** @todo remove once the DebugOutput internals are stream-free */ #include "Magnum/GL/Context.h" #include "Magnum/GL/DebugOutput.h" @@ -137,7 +137,7 @@ void DebugOutputGLTest::setCallbackDeprecated() { DebugOutput::setDefaultCallback(); }}; - std::ostringstream out; + Containers::String out; CORRADE_IGNORE_DEPRECATED_PUSH DebugOutput::setCallback([](DebugOutput::Source source, DebugOutput::Type type, UnsignedInt id, DebugOutput::Severity severity, const std::string& string, const void* userPtr) { Implementation::defaultDebugCallback(source, type, id, severity, string, static_cast(const_cast(userPtr))); @@ -148,7 +148,7 @@ void DebugOutputGLTest::setCallbackDeprecated() { 1337, DebugOutput::Severity::High, "Hello from OpenGL command stream!"); MAGNUM_VERIFY_NO_GL_ERROR(); - CORRADE_COMPARE(out.str(), + CORRADE_COMPARE(out, "Debug output: high severity application marker (1337): Hello from OpenGL command stream!\n"); } #endif diff --git a/src/Magnum/GL/Test/DebugOutputTest.cpp b/src/Magnum/GL/Test/DebugOutputTest.cpp index 98f4868bd..c6dcb2996 100644 --- a/src/Magnum/GL/Test/DebugOutputTest.cpp +++ b/src/Magnum/GL/Test/DebugOutputTest.cpp @@ -24,9 +24,8 @@ DEALINGS IN THE SOFTWARE. */ -#include +#include #include -#include #include "Magnum/GL/DebugOutput.h" @@ -57,39 +56,39 @@ DebugOutputTest::DebugOutputTest() { } void DebugOutputTest::debugSource() { - std::ostringstream o; - Debug(&o) << DebugOutput::Source::ShaderCompiler << DebugOutput::Source(0xdead); - CORRADE_COMPARE(o.str(), "GL::DebugOutput::Source::ShaderCompiler GL::DebugOutput::Source(0xdead)\n"); + Containers::String out; + Debug{&out} << DebugOutput::Source::ShaderCompiler << DebugOutput::Source(0xdead); + CORRADE_COMPARE(out, "GL::DebugOutput::Source::ShaderCompiler GL::DebugOutput::Source(0xdead)\n"); } void DebugOutputTest::debugType() { - std::ostringstream o; - Debug(&o) << DebugOutput::Type::PushGroup << DebugOutput::Type(0xdead); - CORRADE_COMPARE(o.str(), "GL::DebugOutput::Type::PushGroup GL::DebugOutput::Type(0xdead)\n"); + Containers::String out; + Debug{&out} << DebugOutput::Type::PushGroup << DebugOutput::Type(0xdead); + CORRADE_COMPARE(out, "GL::DebugOutput::Type::PushGroup GL::DebugOutput::Type(0xdead)\n"); } void DebugOutputTest::debugSeverity() { - std::ostringstream o; - Debug(&o) << DebugOutput::Severity::Notification << DebugOutput::Severity(0xdead); - CORRADE_COMPARE(o.str(), "GL::DebugOutput::Severity::Notification GL::DebugOutput::Severity(0xdead)\n"); + Containers::String out; + Debug{&out} << DebugOutput::Severity::Notification << DebugOutput::Severity(0xdead); + CORRADE_COMPARE(out, "GL::DebugOutput::Severity::Notification GL::DebugOutput::Severity(0xdead)\n"); } void DebugOutputTest::debugMessageSource() { - std::ostringstream o; - Debug(&o) << DebugMessage::Source::Application << DebugMessage::Source(0xdead); - CORRADE_COMPARE(o.str(), "GL::DebugMessage::Source::Application GL::DebugMessage::Source(0xdead)\n"); + Containers::String out; + Debug{&out} << DebugMessage::Source::Application << DebugMessage::Source(0xdead); + CORRADE_COMPARE(out, "GL::DebugMessage::Source::Application GL::DebugMessage::Source(0xdead)\n"); } void DebugOutputTest::debugMessageType() { - std::ostringstream o; - Debug(&o) << DebugMessage::Type::DeprecatedBehavior << DebugMessage::Type(0xdead); - CORRADE_COMPARE(o.str(), "GL::DebugMessage::Type::DeprecatedBehavior GL::DebugMessage::Type(0xdead)\n"); + Containers::String out; + Debug{&out} << DebugMessage::Type::DeprecatedBehavior << DebugMessage::Type(0xdead); + CORRADE_COMPARE(out, "GL::DebugMessage::Type::DeprecatedBehavior GL::DebugMessage::Type(0xdead)\n"); } void DebugOutputTest::debugGroupSource() { - std::ostringstream o; - Debug(&o) << DebugGroup::Source::ThirdParty << DebugGroup::Source(0xdead); - CORRADE_COMPARE(o.str(), "GL::DebugGroup::Source::ThirdParty GL::DebugGroup::Source(0xdead)\n"); + Containers::String out; + Debug{&out} << DebugGroup::Source::ThirdParty << DebugGroup::Source(0xdead); + CORRADE_COMPARE(out, "GL::DebugGroup::Source::ThirdParty GL::DebugGroup::Source(0xdead)\n"); } }}}} diff --git a/src/Magnum/GL/Test/DefaultFramebufferTest.cpp b/src/Magnum/GL/Test/DefaultFramebufferTest.cpp index c9cdfc431..3bdcc12fe 100644 --- a/src/Magnum/GL/Test/DefaultFramebufferTest.cpp +++ b/src/Magnum/GL/Test/DefaultFramebufferTest.cpp @@ -24,9 +24,8 @@ DEALINGS IN THE SOFTWARE. */ -#include +#include #include -#include #include "Magnum/GL/DefaultFramebuffer.h" @@ -43,10 +42,10 @@ DefaultFramebufferTest::DefaultFramebufferTest() { } void DefaultFramebufferTest::debugStatus() { - std::ostringstream out; + Containers::String out; Debug(&out) << DefaultFramebuffer::Status::Complete << DefaultFramebuffer::Status(0xdead); - CORRADE_COMPARE(out.str(), "GL::DefaultFramebuffer::Status::Complete GL::DefaultFramebuffer::Status(0xdead)\n"); + CORRADE_COMPARE(out, "GL::DefaultFramebuffer::Status::Complete GL::DefaultFramebuffer::Status(0xdead)\n"); } }}}} diff --git a/src/Magnum/GL/Test/FramebufferGLTest.cpp b/src/Magnum/GL/Test/FramebufferGLTest.cpp index ae4b199aa..8f046e772 100644 --- a/src/Magnum/GL/Test/FramebufferGLTest.cpp +++ b/src/Magnum/GL/Test/FramebufferGLTest.cpp @@ -25,9 +25,7 @@ DEALINGS IN THE SOFTWARE. */ -#include #include -#include #include "Magnum/Image.h" #include "Magnum/ImageView.h" @@ -1715,10 +1713,10 @@ void FramebufferGLTest::readViewNullptr() { MutableImageView2D view{DataStorage, PixelFormat::RGBA, PixelType::UnsignedByte, {8, 16}}; - std::ostringstream out; + Containers::String out; Error redirectError{&out}; framebuffer.read({{}, {8, 16}}, view); - CORRADE_COMPARE(out.str(), "GL::AbstractFramebuffer::read(): image view is nullptr\n"); + CORRADE_COMPARE(out, "GL::AbstractFramebuffer::read(): image view is nullptr\n"); } void FramebufferGLTest::readViewBadSize() { @@ -1742,10 +1740,10 @@ void FramebufferGLTest::readViewBadSize() { char data[(DataOffset + 8*15)*sizeof(Color4ub)]{}; MutableImageView2D view{DataStorage, PixelFormat::RGBA, PixelType::UnsignedByte, {8, 15}, data}; - std::ostringstream out; + Containers::String out; Error redirectError{&out}; framebuffer.read({{}, {8, 16}}, view); - CORRADE_COMPARE(out.str(), "GL::AbstractFramebuffer::read(): expected image view size Vector(8, 16) but got Vector(8, 15)\n"); + CORRADE_COMPARE(out, "GL::AbstractFramebuffer::read(): expected image view size Vector(8, 16) but got Vector(8, 15)\n"); } #ifndef MAGNUM_TARGET_GLES2 diff --git a/src/Magnum/GL/Test/FramebufferTest.cpp b/src/Magnum/GL/Test/FramebufferTest.cpp index 42fae27b5..5db74cbbd 100644 --- a/src/Magnum/GL/Test/FramebufferTest.cpp +++ b/src/Magnum/GL/Test/FramebufferTest.cpp @@ -24,9 +24,8 @@ DEALINGS IN THE SOFTWARE. */ -#include +#include #include -#include #include "Magnum/GL/Framebuffer.h" @@ -64,10 +63,10 @@ void FramebufferTest::constructCopy() { } void FramebufferTest::debugStatus() { - std::ostringstream out; + Containers::String out; Debug(&out) << Framebuffer::Status::IncompleteMissingAttachment << Framebuffer::Status(0xdead); - CORRADE_COMPARE(out.str(), "GL::Framebuffer::Status::IncompleteMissingAttachment GL::Framebuffer::Status(0xdead)\n"); + CORRADE_COMPARE(out, "GL::Framebuffer::Status::IncompleteMissingAttachment GL::Framebuffer::Status(0xdead)\n"); } }}}} diff --git a/src/Magnum/GL/Test/MeshGLTest.cpp b/src/Magnum/GL/Test/MeshGLTest.cpp index 5b0756e52..11b97ca78 100644 --- a/src/Magnum/GL/Test/MeshGLTest.cpp +++ b/src/Magnum/GL/Test/MeshGLTest.cpp @@ -25,14 +25,12 @@ DEALINGS IN THE SOFTWARE. */ -#include #include #include #include #include #include -#include -#include +#include #include "Magnum/Image.h" #include "Magnum/Mesh.h" @@ -2278,12 +2276,12 @@ void MeshGLTest::addVertexBufferMovedOutInstance() { Buffer buffer{NoCreate}; Mesh mesh; - std::ostringstream out; + Containers::String out; Error redirectError{&out}; mesh.addVertexBuffer(buffer, 0, Attribute<0, Float>{}); - CORRADE_COMPARE(out.str(), "GL::Mesh::addVertexBuffer(): empty or moved-out Buffer instance was passed\n"); + CORRADE_COMPARE(out, "GL::Mesh::addVertexBuffer(): empty or moved-out Buffer instance was passed\n"); } void MeshGLTest::addVertexBufferTransferOwnwership() { @@ -2599,12 +2597,12 @@ void MeshGLTest::setIndexBufferMovedOutInstance() { Buffer buffer{NoCreate}; Mesh mesh; - std::ostringstream out; + Containers::String out; Error redirectError{&out}; mesh.setIndexBuffer(buffer, 0, MeshIndexType::UnsignedByte); - CORRADE_COMPARE(out.str(), "GL::Mesh::setIndexBuffer(): empty or moved-out Buffer instance was passed\n"); + CORRADE_COMPARE(out, "GL::Mesh::setIndexBuffer(): empty or moved-out Buffer instance was passed\n"); } template void MeshGLTest::setIndexBufferTransferOwnership() { @@ -2721,12 +2719,12 @@ void MeshGLTest::indexTypeSetIndexOffsetNotIndexed() { Mesh mesh; MeshView view{mesh}; - std::ostringstream out; + Containers::String out; Error redirectError{&out}; mesh.indexType(); mesh.setIndexOffset(3); view.setIndexOffset(3); - CORRADE_COMPARE(out.str(), + CORRADE_COMPARE(out, "GL::Mesh::indexType(): mesh is not indexed\n" "GL::Mesh::setIndexOffset(): mesh is not indexed\n" "GL::MeshView::setIndexOffset(): mesh is not indexed\n"); @@ -3086,13 +3084,13 @@ void MeshGLTest::setBaseVertexNoExtensionAvailable() { .setBaseVertex(1) .setIndexBuffer(indices, 0, MeshIndexType::UnsignedShort); - std::ostringstream out; + Containers::String out; Error redirectError{&out}; MultipleShader{}.draw(mesh); #if !(defined(MAGNUM_TARGET_WEBGL) && defined(MAGNUM_TARGET_GLES2)) - CORRADE_COMPARE(out.str(), "GL::AbstractShaderProgram::draw(): no extension available for indexed mesh draw with base vertex specification\n"); + CORRADE_COMPARE(out, "GL::AbstractShaderProgram::draw(): no extension available for indexed mesh draw with base vertex specification\n"); #else - CORRADE_COMPARE(out.str(), "GL::AbstractShaderProgram::draw(): indexed mesh draw with base vertex specification possible only since WebGL 2.0\n"); + CORRADE_COMPARE(out, "GL::AbstractShaderProgram::draw(): indexed mesh draw with base vertex specification possible only since WebGL 2.0\n"); #endif } @@ -3122,13 +3120,13 @@ void MeshGLTest::setBaseVertexRangeNoExtensionAvailable() { .setBaseVertex(1) .setIndexBuffer(indices, 0, MeshIndexType::UnsignedShort, 0, 2); - std::ostringstream out; + Containers::String out; Error redirectError{&out}; MultipleShader{}.draw(mesh); #if !(defined(MAGNUM_TARGET_WEBGL) && defined(MAGNUM_TARGET_GLES2)) - CORRADE_COMPARE(out.str(), "GL::AbstractShaderProgram::draw(): no extension available for indexed mesh draw with base vertex specification\n"); + CORRADE_COMPARE(out, "GL::AbstractShaderProgram::draw(): no extension available for indexed mesh draw with base vertex specification\n"); #else - CORRADE_COMPARE(out.str(), "GL::AbstractShaderProgram::draw(): indexed mesh draw with base vertex specification possible only since WebGL 2.0\n"); + CORRADE_COMPARE(out, "GL::AbstractShaderProgram::draw(): indexed mesh draw with base vertex specification possible only since WebGL 2.0\n"); #endif } #endif @@ -3242,10 +3240,10 @@ void MeshGLTest::setInstanceCountBaseInstanceNoExtensionAvailable() { .setInstanceCount(2) .setBaseInstance(1); - std::ostringstream out; + Containers::String out; Error redirectError{&out}; MultipleShader{}.draw(mesh); - CORRADE_COMPARE(out.str(), "GL::AbstractShaderProgram::draw(): no extension available for instanced mesh draw with base instance specification\n"); + CORRADE_COMPARE(out, "GL::AbstractShaderProgram::draw(): no extension available for instanced mesh draw with base instance specification\n"); } #endif #endif @@ -3367,10 +3365,10 @@ void MeshGLTest::setInstanceCountIndexedBaseInstanceNoExtensionAvailable() { .setBaseInstance(1) .setIndexBuffer(indices, 0, MeshIndexType::UnsignedShort); - std::ostringstream out; + Containers::String out; Error redirectError{&out}; MultipleShader{}.draw(mesh); - CORRADE_COMPARE(out.str(), "GL::AbstractShaderProgram::draw(): no extension available for instanced indexed mesh draw with base instance specification\n"); + CORRADE_COMPARE(out, "GL::AbstractShaderProgram::draw(): no extension available for instanced indexed mesh draw with base instance specification\n"); } #endif #endif @@ -3457,13 +3455,13 @@ void MeshGLTest::setInstanceCountIndexedBaseVertexNoExtensionAvailable() { .setBaseVertex(1) .setIndexBuffer(indices, 0, MeshIndexType::UnsignedShort); - std::ostringstream out; + Containers::String out; Error redirectError{&out}; MultipleShader{}.draw(mesh); #ifndef MAGNUM_TARGET_GLES2 - CORRADE_COMPARE(out.str(), "GL::AbstractShaderProgram::draw(): no extension available for instanced indexed mesh draw with base vertex specification\n"); + CORRADE_COMPARE(out, "GL::AbstractShaderProgram::draw(): no extension available for instanced indexed mesh draw with base vertex specification\n"); #else - CORRADE_COMPARE(out.str(), "GL::AbstractShaderProgram::draw(): instanced indexed mesh draw with base vertex specification possible only since OpenGL ES 3.0\n"); + CORRADE_COMPARE(out, "GL::AbstractShaderProgram::draw(): instanced indexed mesh draw with base vertex specification possible only since OpenGL ES 3.0\n"); #endif } #endif @@ -3535,13 +3533,13 @@ void MeshGLTest::setInstanceCountIndexedBaseVertexBaseInstanceNoExtensionAvailab .setBaseInstance(1) .setIndexBuffer(indices, 0, MeshIndexType::UnsignedShort); - std::ostringstream out; + Containers::String out; Error redirectError{&out}; MultipleShader{}.draw(mesh); #ifndef MAGNUM_TARGET_GLES2 - CORRADE_COMPARE(out.str(), "GL::AbstractShaderProgram::draw(): no extension available for instanced indexed mesh draw with base vertex and base instance specification\n"); + CORRADE_COMPARE(out, "GL::AbstractShaderProgram::draw(): no extension available for instanced indexed mesh draw with base vertex and base instance specification\n"); #else - CORRADE_COMPARE(out.str(), "GL::AbstractShaderProgram::draw(): instanced indexed mesh draw with base vertex specification possible only since OpenGL 3.0\n"); + CORRADE_COMPARE(out, "GL::AbstractShaderProgram::draw(): instanced indexed mesh draw with base vertex specification possible only since OpenGL 3.0\n"); #endif } #endif @@ -4474,11 +4472,11 @@ void MeshGLTest::multiDrawWrongVertexOffsetSize() { UnsignedInt counts[3]{}; UnsignedInt vertexOffsets[2]{}; - std::ostringstream out; + Containers::String out; Error redirectError{&out}; shader.draw(mesh, counts, vertexOffsets, nullptr); shader.draw(mesh, counts, nullptr, nullptr); - CORRADE_COMPARE(out.str(), + CORRADE_COMPARE(out, "GL::AbstractShaderProgram::draw(): expected 3 vertex offset items but got 2\n" "GL::AbstractShaderProgram::draw(): expected 3 vertex offset items but got 0\n"); } @@ -4493,11 +4491,11 @@ void MeshGLTest::multiDrawIndexedWrongVertexOffsetSize() { UnsignedInt vertexOffsets[2]{}; UnsignedInt indexOffsets[3]{}; - std::ostringstream out; + Containers::String out; Error redirectError{&out}; shader.draw(mesh, counts, vertexOffsets, indexOffsets); /* Omitting vertex offsets altogether is okay */ - CORRADE_COMPARE(out.str(), + CORRADE_COMPARE(out, "GL::AbstractShaderProgram::draw(): expected 3 vertex offset items but got 2\n"); } @@ -4510,11 +4508,11 @@ void MeshGLTest::multiDrawIndexedWrongIndexOffsetSize() { UnsignedInt counts[3]{}; UnsignedInt indexOffsets[2]{}; - std::ostringstream out; + Containers::String out; Error redirectError{&out}; shader.draw(mesh, counts, nullptr, indexOffsets); shader.draw(mesh, counts, nullptr, nullptr); - CORRADE_COMPARE(out.str(), + CORRADE_COMPARE(out, "GL::AbstractShaderProgram::draw(): expected 3 index offset items but got 2\n" "GL::AbstractShaderProgram::draw(): expected 3 index offset items but got 0\n"); } @@ -4555,13 +4553,13 @@ void MeshGLTest::multiDrawIndexedBaseVertexNoExtensionAvailable() { UnsignedInt vertexOffsets[]{0}; UnsignedInt indexOffsets[]{0}; - std::ostringstream out; + Containers::String out; Error redirectError{&out}; MultiDrawShader{}.draw(mesh, counts, vertexOffsets, indexOffsets); #if !(defined(MAGNUM_TARGET_WEBGL) && defined(MAGNUM_TARGET_GLES2)) - CORRADE_COMPARE(out.str(), "GL::AbstractShaderProgram::draw(): no extension available for indexed mesh multi-draw with base vertex specification\n"); + CORRADE_COMPARE(out, "GL::AbstractShaderProgram::draw(): no extension available for indexed mesh multi-draw with base vertex specification\n"); #else - CORRADE_COMPARE(out.str(), "GL::AbstractShaderProgram::draw(): indexed mesh multi-draw with base vertex specification possible only since WebGL 2.0\n"); + CORRADE_COMPARE(out, "GL::AbstractShaderProgram::draw(): indexed mesh multi-draw with base vertex specification possible only since WebGL 2.0\n"); #endif } @@ -4600,13 +4598,13 @@ void MeshGLTest::multiDrawIndexedViewsBaseVertexNoExtensionAvailable() { UnsignedInt vertexOffsets[]{1}; UnsignedInt indexOffsets[]{0}; - std::ostringstream out; + Containers::String out; Error redirectError{&out}; MultiDrawShader{}.draw(mesh, counts, vertexOffsets, indexOffsets); #if !(defined(MAGNUM_TARGET_WEBGL) && defined(MAGNUM_TARGET_GLES2)) - CORRADE_COMPARE(out.str(), "GL::AbstractShaderProgram::draw(): no extension available for indexed mesh multi-draw with base vertex specification\n"); + CORRADE_COMPARE(out, "GL::AbstractShaderProgram::draw(): no extension available for indexed mesh multi-draw with base vertex specification\n"); #else - CORRADE_COMPARE(out.str(), "GL::AbstractShaderProgram::draw(): indexed mesh multi-draw with base vertex specification possible only since WebGL 2.0\n"); + CORRADE_COMPARE(out, "GL::AbstractShaderProgram::draw(): indexed mesh multi-draw with base vertex specification possible only since WebGL 2.0\n"); #endif } #endif @@ -4619,10 +4617,10 @@ void MeshGLTest::multiDrawViewsInstanced() { view.setCount(3) .setInstanceCount(2); - std::ostringstream out; + Containers::String out; Error redirectError{&out}; MultiDrawShader{}.draw({view, view}); - CORRADE_COMPARE(out.str(), "GL::AbstractShaderProgram::draw(): cannot multi-draw instanced meshes\n"); + CORRADE_COMPARE(out, "GL::AbstractShaderProgram::draw(): cannot multi-draw instanced meshes\n"); } void MeshGLTest::multiDrawViewsDifferentMeshes() { @@ -4631,10 +4629,10 @@ void MeshGLTest::multiDrawViewsDifferentMeshes() { Mesh a, b; MeshView viewA{a}, viewB{b}; - std::ostringstream out; + Containers::String out; Error redirectError{&out}; MultiDrawShader{}.draw({viewA, viewB}); - CORRADE_COMPARE(out.str(), Utility::formatString("GL::AbstractShaderProgram::draw(): all meshes must be views of the same original mesh, expected 0x{:x} but got 0x{:x} at index 1\n", reinterpret_cast(&a), reinterpret_cast(&b))); + CORRADE_COMPARE(out, Utility::format("GL::AbstractShaderProgram::draw(): all meshes must be views of the same original mesh, expected 0x{:x} but got 0x{:x} at index 1\n", reinterpret_cast(&a), reinterpret_cast(&b))); } #ifdef MAGNUM_TARGET_GLES @@ -5125,11 +5123,11 @@ void MeshGLTest::multiDrawInstancedWrongInstanceCountSize() { UnsignedInt counts[3]{}; UnsignedInt instanceCounts[2]{}; - std::ostringstream out; + Containers::String out; Error redirectError{&out}; shader.draw(mesh, counts, instanceCounts, nullptr, nullptr); shader.draw(mesh, counts, nullptr, nullptr, nullptr); - CORRADE_COMPARE(out.str(), + CORRADE_COMPARE(out, "GL::AbstractShaderProgram::draw(): expected 3 instance count items but got 2\n" "GL::AbstractShaderProgram::draw(): expected 3 instance count items but got 0\n"); } @@ -5143,11 +5141,11 @@ void MeshGLTest::multiDrawInstancedWrongVertexOffsetSize() { UnsignedInt instanceCounts[3]{}; UnsignedInt vertexOffsets[2]{}; - std::ostringstream out; + Containers::String out; Error redirectError{&out}; shader.draw(mesh, counts, instanceCounts, vertexOffsets, nullptr); shader.draw(mesh, counts, instanceCounts, nullptr, nullptr); - CORRADE_COMPARE(out.str(), + CORRADE_COMPARE(out, "GL::AbstractShaderProgram::draw(): expected 3 vertex offset items but got 2\n" "GL::AbstractShaderProgram::draw(): expected 3 vertex offset items but got 0\n"); } @@ -5163,11 +5161,11 @@ void MeshGLTest::multiDrawInstancedWrongInstanceOffsetSize() { UnsignedInt vertexOffsets[3]{}; UnsignedInt instanceOffsets[2]{}; - std::ostringstream out; + Containers::String out; Error redirectError{&out}; shader.draw(mesh, counts, instanceCounts, vertexOffsets, nullptr, instanceOffsets); /* Omitting vertex offsets altogether is okay */ - CORRADE_COMPARE(out.str(), "GL::AbstractShaderProgram::draw(): expected 3 instance offset items but got 2\n"); + CORRADE_COMPARE(out, "GL::AbstractShaderProgram::draw(): expected 3 instance offset items but got 2\n"); } #endif @@ -5180,11 +5178,11 @@ void MeshGLTest::multiDrawInstancedIndexedWrongInstanceCountSize() { UnsignedInt counts[3]{}; UnsignedInt instanceCounts[2]{}; - std::ostringstream out; + Containers::String out; Error redirectError{&out}; shader.draw(mesh, counts, instanceCounts, nullptr, nullptr); shader.draw(mesh, counts, nullptr, nullptr, nullptr); - CORRADE_COMPARE(out.str(), + CORRADE_COMPARE(out, "GL::AbstractShaderProgram::draw(): expected 3 instance count items but got 2\n" "GL::AbstractShaderProgram::draw(): expected 3 instance count items but got 0\n"); } @@ -5200,11 +5198,11 @@ void MeshGLTest::multiDrawInstancedIndexedWrongVertexOffsetSize() { UnsignedInt vertexOffsets[2]{}; UnsignedInt indexOffsets[3]{}; - std::ostringstream out; + Containers::String out; Error redirectError{&out}; shader.draw(mesh, counts, instanceCounts, vertexOffsets, indexOffsets); /* Omitting vertex offsets altogether is okay */ - CORRADE_COMPARE(out.str(), + CORRADE_COMPARE(out, "GL::AbstractShaderProgram::draw(): expected 3 vertex offset items but got 2\n"); } @@ -5218,11 +5216,11 @@ void MeshGLTest::multiDrawInstancedIndexedWrongIndexOffsetSize() { UnsignedInt instanceCounts[3]{}; UnsignedInt indexOffsets[2]{}; - std::ostringstream out; + Containers::String out; Error redirectError{&out}; shader.draw(mesh, counts, instanceCounts, nullptr, indexOffsets); shader.draw(mesh, counts, instanceCounts, nullptr, nullptr); - CORRADE_COMPARE(out.str(), + CORRADE_COMPARE(out, "GL::AbstractShaderProgram::draw(): expected 3 index offset items but got 2\n" "GL::AbstractShaderProgram::draw(): expected 3 index offset items but got 0\n"); } @@ -5239,11 +5237,11 @@ void MeshGLTest::multiDrawInstancedIndexedWrongInstanceOffsetSize() { UnsignedInt indexOffsets[3]{}; UnsignedInt instanceOffsets[2]{}; - std::ostringstream out; + Containers::String out; Error redirectError{&out}; shader.draw(mesh, counts, instanceCounts, nullptr, indexOffsets, instanceOffsets); /* Omitting instance offsets altogether is okay */ - CORRADE_COMPARE(out.str(), "GL::AbstractShaderProgram::draw(): expected 3 instance offset items but got 2\n"); + CORRADE_COMPARE(out, "GL::AbstractShaderProgram::draw(): expected 3 instance offset items but got 2\n"); } void MeshGLTest::multiDrawInstancedBaseVertexNoExtensionAvailable() { @@ -5269,13 +5267,13 @@ void MeshGLTest::multiDrawInstancedBaseVertexNoExtensionAvailable() { UnsignedInt vertexOffsets[]{0}; UnsignedInt indexOffsets[]{0}; - std::ostringstream out; + Containers::String out; Error redirectError{&out}; MultiDrawInstancedShader{}.draw(mesh, counts, instanceCounts, vertexOffsets, indexOffsets); #ifndef MAGNUM_TARGET_GLES2 - CORRADE_COMPARE(out.str(), "GL::AbstractShaderProgram::draw(): no extension available for instanced indexed mesh multi-draw with base vertex and base instance specification\n"); + CORRADE_COMPARE(out, "GL::AbstractShaderProgram::draw(): no extension available for instanced indexed mesh multi-draw with base vertex and base instance specification\n"); #else - CORRADE_COMPARE(out.str(), "GL::AbstractShaderProgram::draw(): instanced indexed mesh multi-draw with base vertex specification possible only since OpenGL ES 3.0 and WebGL 2.0\n"); + CORRADE_COMPARE(out, "GL::AbstractShaderProgram::draw(): instanced indexed mesh multi-draw with base vertex specification possible only since OpenGL ES 3.0 and WebGL 2.0\n"); #endif } @@ -5304,11 +5302,11 @@ void MeshGLTest::multiDrawInstancedBaseInstanceNoExtensionAvailable() { UnsignedInt indexOffsets[]{0}; UnsignedInt instanceOffsets[]{0}; - std::ostringstream out; + Containers::String out; Error redirectError{&out}; MultiDrawInstancedShader{}.draw(nonIndexed, counts, instanceCounts, vertexOffsets, nullptr, instanceOffsets); MultiDrawInstancedShader{}.draw(indexed, counts, instanceCounts, nullptr, indexOffsets, instanceOffsets); - CORRADE_COMPARE(out.str(), + CORRADE_COMPARE(out, "GL::AbstractShaderProgram::draw(): no extension available for instanced mesh multi-draw with base instance specification\n" "GL::AbstractShaderProgram::draw(): no extension available for instanced indexed mesh multi-draw with base vertex and base instance specification\n"); } diff --git a/src/Magnum/GL/Test/MeshTest.cpp b/src/Magnum/GL/Test/MeshTest.cpp index bbd6ca7e3..000111ecb 100644 --- a/src/Magnum/GL/Test/MeshTest.cpp +++ b/src/Magnum/GL/Test/MeshTest.cpp @@ -24,9 +24,8 @@ DEALINGS IN THE SOFTWARE. */ -#include +#include #include -#include #include "Magnum/Mesh.h" #include "Magnum/GL/AbstractShaderProgram.h" @@ -142,25 +141,25 @@ struct Shader: AbstractShaderProgram { void MeshTest::drawCountNotSet() { CORRADE_SKIP_IF_NO_ASSERT(); - std::ostringstream out; + Containers::String out; Error redirectError{&out}; Shader{NoCreate}.draw(Mesh{NoCreate}); - CORRADE_COMPARE(out.str(), + CORRADE_COMPARE(out, "GL::AbstractShaderProgram::draw(): Mesh::setCount() was never called, probably a mistake?\n"); } void MeshTest::drawViewCountNotSet() { CORRADE_SKIP_IF_NO_ASSERT(); - std::ostringstream out; + Containers::String out; Error redirectError{&out}; Mesh mesh{NoCreate}; Shader{NoCreate}.draw(MeshView{mesh}); - CORRADE_COMPARE(out.str(), + CORRADE_COMPARE(out, "GL::AbstractShaderProgram::draw(): MeshView::setCount() was never called, probably a mistake?\n"); } @@ -206,21 +205,21 @@ void MeshTest::mapPrimitiveImplementationSpecific() { void MeshTest::mapPrimitiveUnsupported() { CORRADE_SKIP_IF_NO_ASSERT(); - std::ostringstream out; + Containers::String out; Error redirectError{&out}; meshPrimitive(Magnum::MeshPrimitive::Instances); - CORRADE_COMPARE(out.str(), "GL::meshPrimitive(): unsupported primitive MeshPrimitive::Instances\n"); + CORRADE_COMPARE(out, "GL::meshPrimitive(): unsupported primitive MeshPrimitive::Instances\n"); } void MeshTest::mapPrimitiveInvalid() { CORRADE_SKIP_IF_NO_ASSERT(); - std::ostringstream out; + Containers::String out; Error redirectError{&out}; meshPrimitive(Magnum::MeshPrimitive{}); meshPrimitive(Magnum::MeshPrimitive(0x12)); - CORRADE_COMPARE(out.str(), + CORRADE_COMPARE(out, "GL::meshPrimitive(): invalid primitive MeshPrimitive(0x0)\n" "GL::meshPrimitive(): invalid primitive MeshPrimitive(0x12)\n"); } @@ -261,12 +260,12 @@ void MeshTest::mapIndexTypeImplementationSpecific() { void MeshTest::mapIndexTypeInvalid() { CORRADE_SKIP_IF_NO_ASSERT(); - std::ostringstream out; + Containers::String out; Error redirectError{&out}; meshIndexType(Magnum::MeshIndexType(0x0)); meshIndexType(Magnum::MeshIndexType(0x12)); - CORRADE_COMPARE(out.str(), + CORRADE_COMPARE(out, "GL::meshIndexType(): invalid type MeshIndexType(0x0)\n" "GL::meshIndexType(): invalid type MeshIndexType(0x12)\n"); } @@ -280,25 +279,25 @@ void MeshTest::indexTypeSize() { void MeshTest::indexTypeSizeInvalid() { CORRADE_SKIP_IF_NO_ASSERT(); - std::ostringstream out; + Containers::String out; Error redirectError{&out}; meshIndexTypeSize(MeshIndexType{}); meshIndexTypeSize(MeshIndexType(0xbadcafe)); - CORRADE_COMPARE(out.str(), + CORRADE_COMPARE(out, "GL::meshIndexTypeSize(): invalid type GL::MeshIndexType(0x0)\n" "GL::meshIndexTypeSize(): invalid type GL::MeshIndexType(0xbadcafe)\n"); } void MeshTest::debugPrimitive() { - std::ostringstream o; - Debug(&o) << MeshPrimitive::TriangleFan << MeshPrimitive(0xdead); - CORRADE_COMPARE(o.str(), "GL::MeshPrimitive::TriangleFan GL::MeshPrimitive(0xdead)\n"); + Containers::String out; + Debug{&out} << MeshPrimitive::TriangleFan << MeshPrimitive(0xdead); + CORRADE_COMPARE(out, "GL::MeshPrimitive::TriangleFan GL::MeshPrimitive(0xdead)\n"); } void MeshTest::debugIndexType() { - std::ostringstream o; - Debug(&o) << MeshIndexType::UnsignedShort << MeshIndexType(0xdead); - CORRADE_COMPARE(o.str(), "GL::MeshIndexType::UnsignedShort GL::MeshIndexType(0xdead)\n"); + Containers::String out; + Debug{&out} << MeshIndexType::UnsignedShort << MeshIndexType(0xdead); + CORRADE_COMPARE(out, "GL::MeshIndexType::UnsignedShort GL::MeshIndexType(0xdead)\n"); } }}}} diff --git a/src/Magnum/GL/Test/PixelFormatTest.cpp b/src/Magnum/GL/Test/PixelFormatTest.cpp index 32d4136e3..0c799fed2 100644 --- a/src/Magnum/GL/Test/PixelFormatTest.cpp +++ b/src/Magnum/GL/Test/PixelFormatTest.cpp @@ -24,10 +24,9 @@ DEALINGS IN THE SOFTWARE. */ -#include #include +#include #include -#include #include "Magnum/PixelFormat.h" #include "Magnum/GL/PixelFormat.h" @@ -217,12 +216,12 @@ void PixelFormatTest::mapFormatTypeTextureFormat() { CORRADE_COMPARE(pixelType(Magnum::PixelFormat::format), Magnum::GL::PixelType::expectedType); \ CORRADE_COMPARE(genericPixelFormat(Magnum::GL::PixelFormat::expectedFormat, Magnum::GL::PixelType::expectedType), Magnum::PixelFormat::format); \ CORRADE_VERIFY(!hasTextureFormat(Magnum::PixelFormat::format)); \ - std::ostringstream out; \ + Containers::String out; \ { /* Redirected otherwise graceful assert would abort */ \ Error redirectError{&out}; \ textureFormat(Magnum::PixelFormat::format); \ } \ - Debug{Debug::Flag::NoNewlineAtTheEnd} << out.str(); \ + Debug{Debug::Flag::NoNewlineAtTheEnd} << out; \ ++nextHandled; \ continue; \ } @@ -238,12 +237,12 @@ void PixelFormatTest::mapFormatTypeTextureFormat() { CORRADE_COMPARE(pixelFormat(Magnum::PixelFormat::format), Magnum::GL::PixelFormat::expectedFormat); \ CORRADE_COMPARE(pixelType(Magnum::PixelFormat::format), Magnum::GL::PixelType::expectedType); \ CORRADE_VERIFY(!hasTextureFormat(Magnum::PixelFormat::format)); \ - std::ostringstream out; \ + Containers::String out; \ { /* Redirected otherwise graceful assert would abort */ \ Error redirectError{&out}; \ textureFormat(Magnum::PixelFormat::format); \ } \ - Debug{Debug::Flag::NoNewlineAtTheEnd} << out.str(); \ + Debug{Debug::Flag::NoNewlineAtTheEnd} << out; \ ++nextHandled; \ continue; \ } @@ -253,14 +252,14 @@ void PixelFormatTest::mapFormatTypeTextureFormat() { CORRADE_COMPARE(firstUnhandled, 0xffff); \ CORRADE_VERIFY(!hasPixelFormat(Magnum::PixelFormat::format)); \ CORRADE_VERIFY(!hasTextureFormat(Magnum::PixelFormat::format)); \ - std::ostringstream out; \ + Containers::String out; \ { /* Redirected otherwise graceful assert would abort */ \ Error redirectError{&out}; \ pixelFormat(Magnum::PixelFormat::format); \ pixelType(Magnum::PixelFormat::format); \ textureFormat(Magnum::PixelFormat::format); \ } \ - Debug{Debug::Flag::NoNewlineAtTheEnd} << out.str(); \ + Debug{Debug::Flag::NoNewlineAtTheEnd} << out; \ ++nextHandled; \ continue; \ } @@ -295,26 +294,26 @@ void PixelFormatTest::mapFormatUnsupported() { #ifndef MAGNUM_TARGET_GLES2 CORRADE_SKIP("All pixel formats are supported on ES3+."); #else - std::ostringstream out; + Containers::String out; Error redirectError{&out}; CORRADE_VERIFY(!hasPixelFormat(Magnum::PixelFormat::RGB16UI)); pixelFormat(Magnum::PixelFormat::RGB16UI); - CORRADE_COMPARE(out.str(), "GL::pixelFormat(): format PixelFormat::RGB16UI is not supported on this target\n"); + CORRADE_COMPARE(out, "GL::pixelFormat(): format PixelFormat::RGB16UI is not supported on this target\n"); #endif } void PixelFormatTest::mapFormatInvalid() { CORRADE_SKIP_IF_NO_ASSERT(); - std::ostringstream out; + Containers::String out; Error redirectError{&out}; hasPixelFormat(Magnum::PixelFormat{}); hasPixelFormat(Magnum::PixelFormat(0x123)); pixelFormat(Magnum::PixelFormat{}); pixelFormat(Magnum::PixelFormat(0x123)); - CORRADE_COMPARE(out.str(), + CORRADE_COMPARE(out, "GL::hasPixelFormat(): invalid format PixelFormat(0x0)\n" "GL::hasPixelFormat(): invalid format PixelFormat(0x123)\n" "GL::pixelFormat(): invalid format PixelFormat(0x0)\n" @@ -329,11 +328,11 @@ void PixelFormatTest::mapTypeImplementationSpecific() { void PixelFormatTest::mapTypeImplementationSpecificZero() { CORRADE_SKIP_IF_NO_ASSERT(); - std::ostringstream out; + Containers::String out; Error redirectError{&out}; pixelType(Magnum::pixelFormatWrap(PixelFormat::RGBA)); - CORRADE_COMPARE(out.str(), "GL::pixelType(): format is implementation-specific, but no additional type specifier was passed\n"); + CORRADE_COMPARE(out, "GL::pixelType(): format is implementation-specific, but no additional type specifier was passed\n"); } void PixelFormatTest::mapTypeUnsupported() { @@ -344,21 +343,21 @@ void PixelFormatTest::mapTypeUnsupported() { #else CORRADE_VERIFY(!hasPixelFormat(Magnum::PixelFormat::RGBA16UI)); - std::ostringstream out; + Containers::String out; Error redirectError{&out}; pixelType(Magnum::PixelFormat::RGB16UI); - CORRADE_COMPARE(out.str(), "GL::pixelType(): format PixelFormat::RGB16UI is not supported on this target\n"); + CORRADE_COMPARE(out, "GL::pixelType(): format PixelFormat::RGB16UI is not supported on this target\n"); #endif } void PixelFormatTest::mapTypeInvalid() { CORRADE_SKIP_IF_NO_ASSERT(); - std::ostringstream out; + Containers::String out; Error redirectError{&out}; pixelType(Magnum::PixelFormat{}); pixelType(Magnum::PixelFormat(0x123)); - CORRADE_COMPARE(out.str(), + CORRADE_COMPARE(out, "GL::pixelType(): invalid format PixelFormat(0x0)\n" "GL::pixelType(): invalid format PixelFormat(0x123)\n"); } @@ -366,11 +365,11 @@ void PixelFormatTest::mapTypeInvalid() { void PixelFormatTest::mapTextureFormatImplementationSpecific() { CORRADE_SKIP_IF_NO_ASSERT(); - std::ostringstream out; + Containers::String out; Error redirectError{&out}; hasTextureFormat(Magnum::pixelFormatWrap(PixelFormat::RGBA)); textureFormat(Magnum::pixelFormatWrap(PixelFormat::RGBA)); - CORRADE_COMPARE(out.str(), + CORRADE_COMPARE(out, "GL::hasTextureFormat(): cannot map an implementation-specific pixel format to an OpenGL texture format\n" "GL::textureFormat(): cannot map an implementation-specific pixel format to an OpenGL texture format\n"); } @@ -381,31 +380,31 @@ void PixelFormatTest::mapTextureFormatUnsupported() { #if defined(MAGNUM_TARGET_GLES) && !defined(MAGNUM_TARGET_GLES2) CORRADE_SKIP("All pixel formats are supported on ES3+."); #elif defined(MAGNUM_TARGET_GLES2) - std::ostringstream out; + Containers::String out; Error redirectError{&out}; textureFormat(Magnum::PixelFormat::Depth32F); - CORRADE_COMPARE(out.str(), "GL::textureFormat(): format PixelFormat::Depth32F is not supported on this target\n"); + CORRADE_COMPARE(out, "GL::textureFormat(): format PixelFormat::Depth32F is not supported on this target\n"); #else - std::ostringstream out; + Containers::String out; Error redirectError{&out}; textureFormat(Magnum::PixelFormat::Depth16UnormStencil8UI); - CORRADE_COMPARE(out.str(), "GL::textureFormat(): format PixelFormat::Depth16UnormStencil8UI is not supported on this target\n"); + CORRADE_COMPARE(out, "GL::textureFormat(): format PixelFormat::Depth16UnormStencil8UI is not supported on this target\n"); #endif } void PixelFormatTest::mapTextureFormatInvalid() { CORRADE_SKIP_IF_NO_ASSERT(); - std::ostringstream out; + Containers::String out; Error redirectError{&out}; hasTextureFormat(Magnum::PixelFormat{}); hasTextureFormat(Magnum::PixelFormat(0x123)); textureFormat(Magnum::PixelFormat{}); textureFormat(Magnum::PixelFormat(0x123)); - CORRADE_COMPARE(out.str(), + CORRADE_COMPARE(out, "GL::hasTextureFormat(): invalid format PixelFormat(0x0)\n" "GL::hasTextureFormat(): invalid format PixelFormat(0x123)\n" "GL::textureFormat(): invalid format PixelFormat(0x0)\n" @@ -443,10 +442,10 @@ void PixelFormatTest::size() { void PixelFormatTest::sizeInvalid() { CORRADE_SKIP_IF_NO_ASSERT(); - std::ostringstream out; + Containers::String out; Error redirectError{&out}; pixelFormatSize(PixelFormat::DepthStencil, PixelType::Float); - CORRADE_COMPARE(out.str(), "GL::pixelFormatSize(): invalid GL::PixelType::Float specified for GL::PixelFormat::DepthStencil\n"); + CORRADE_COMPARE(out, "GL::pixelFormatSize(): invalid GL::PixelType::Float specified for GL::PixelFormat::DepthStencil\n"); } void PixelFormatTest::mapCompressedFormatTextureFormat() { @@ -507,13 +506,13 @@ void PixelFormatTest::mapCompressedFormatTextureFormat() { CORRADE_COMPARE(firstUnhandled, 0xffff); \ CORRADE_VERIFY(!hasCompressedPixelFormat(Magnum::CompressedPixelFormat::format)); \ CORRADE_VERIFY(!hasTextureFormat(Magnum::CompressedPixelFormat::format)); \ - std::ostringstream out; \ + Containers::String out; \ { /* Redirected otherwise graceful assert would abort */ \ Error redirectError{&out}; \ compressedPixelFormat(Magnum::CompressedPixelFormat::format); \ textureFormat(Magnum::CompressedPixelFormat::format); \ } \ - Debug{Debug::Flag::NoNewlineAtTheEnd} << out.str(); \ + Debug{Debug::Flag::NoNewlineAtTheEnd} << out; \ ++nextHandled; \ continue; \ } @@ -547,17 +546,17 @@ void PixelFormatTest::mapCompressedFormatUnsupported() { #ifdef MAGNUM_TARGET_GLES2 CORRADE_VERIFY(!hasCompressedPixelFormat(Magnum::CompressedPixelFormat::Astc3x3x3RGBAUnorm)); - std::ostringstream out; + Containers::String out; Error redirectError{&out}; compressedPixelFormat(Magnum::CompressedPixelFormat::Astc3x3x3RGBAUnorm); - CORRADE_COMPARE(out.str(), "GL::compressedPixelFormat(): format CompressedPixelFormat::Astc3x3x3RGBAUnorm is not supported on this target\n"); + CORRADE_COMPARE(out, "GL::compressedPixelFormat(): format CompressedPixelFormat::Astc3x3x3RGBAUnorm is not supported on this target\n"); #elif !defined(MAGNUM_TARGET_GLES) CORRADE_VERIFY(!hasCompressedPixelFormat(Magnum::CompressedPixelFormat::PvrtcRGB2bppUnorm)); - std::ostringstream out; + Containers::String out; Error redirectError{&out}; compressedPixelFormat(Magnum::CompressedPixelFormat::PvrtcRGB2bppUnorm); - CORRADE_COMPARE(out.str(), "GL::compressedPixelFormat(): format CompressedPixelFormat::PvrtcRGB2bppUnorm is not supported on this target\n"); + CORRADE_COMPARE(out, "GL::compressedPixelFormat(): format CompressedPixelFormat::PvrtcRGB2bppUnorm is not supported on this target\n"); #else CORRADE_SKIP("All compressed pixel formats are supported on ES3."); #endif @@ -566,14 +565,14 @@ void PixelFormatTest::mapCompressedFormatUnsupported() { void PixelFormatTest::mapCompressedFormatInvalid() { CORRADE_SKIP_IF_NO_ASSERT(); - std::ostringstream out; + Containers::String out; Error redirectError{&out}; hasCompressedPixelFormat(Magnum::CompressedPixelFormat{}); hasCompressedPixelFormat(Magnum::CompressedPixelFormat(0x123)); compressedPixelFormat(Magnum::CompressedPixelFormat{}); compressedPixelFormat(Magnum::CompressedPixelFormat(0x123)); - CORRADE_COMPARE(out.str(), + CORRADE_COMPARE(out, "GL::hasCompressedPixelFormat(): invalid format CompressedPixelFormat(0x0)\n" "GL::hasCompressedPixelFormat(): invalid format CompressedPixelFormat(0x123)\n" "GL::compressedPixelFormat(): invalid format CompressedPixelFormat(0x0)\n" @@ -592,17 +591,17 @@ void PixelFormatTest::mapCompressedTextureFormatUnsupported() { #ifdef MAGNUM_TARGET_GLES2 CORRADE_VERIFY(!hasTextureFormat(Magnum::CompressedPixelFormat::Astc3x3x3RGBAUnorm)); - std::ostringstream out; + Containers::String out; Error redirectError{&out}; textureFormat(Magnum::CompressedPixelFormat::Astc3x3x3RGBAUnorm); - CORRADE_COMPARE(out.str(), "GL::textureFormat(): format CompressedPixelFormat::Astc3x3x3RGBAUnorm is not supported on this target\n"); + CORRADE_COMPARE(out, "GL::textureFormat(): format CompressedPixelFormat::Astc3x3x3RGBAUnorm is not supported on this target\n"); #elif !defined(MAGNUM_TARGET_GLES) CORRADE_VERIFY(!hasTextureFormat(Magnum::CompressedPixelFormat::PvrtcRGB2bppUnorm)); - std::ostringstream out; + Containers::String out; Error redirectError{&out}; textureFormat(Magnum::CompressedPixelFormat::PvrtcRGB2bppUnorm); - CORRADE_COMPARE(out.str(), "GL::textureFormat(): format CompressedPixelFormat::PvrtcRGB2bppUnorm is not supported on this target\n"); + CORRADE_COMPARE(out, "GL::textureFormat(): format CompressedPixelFormat::PvrtcRGB2bppUnorm is not supported on this target\n"); #else CORRADE_SKIP("All compressed pixel formats are supported on ES3."); #endif @@ -611,14 +610,14 @@ void PixelFormatTest::mapCompressedTextureFormatUnsupported() { void PixelFormatTest::mapCompressedTextureFormatInvalid() { CORRADE_SKIP_IF_NO_ASSERT(); - std::ostringstream out; + Containers::String out; Error redirectError{&out}; hasTextureFormat(Magnum::CompressedPixelFormat{}); hasTextureFormat(Magnum::CompressedPixelFormat(0x123)); textureFormat(Magnum::CompressedPixelFormat{}); textureFormat(Magnum::CompressedPixelFormat(0x123)); - CORRADE_COMPARE(out.str(), + CORRADE_COMPARE(out, "GL::hasTextureFormat(): invalid format CompressedPixelFormat(0x0)\n" "GL::hasTextureFormat(): invalid format CompressedPixelFormat(0x123)\n" "GL::textureFormat(): invalid format CompressedPixelFormat(0x0)\n" @@ -637,31 +636,31 @@ void PixelFormatTest::mapGenericCompressedFormatUnsupported() { } void PixelFormatTest::debugPixelFormat() { - std::ostringstream out; + Containers::String out; Debug(&out) << PixelFormat::RGBA << PixelFormat(0xdead); - CORRADE_COMPARE(out.str(), "GL::PixelFormat::RGBA GL::PixelFormat(0xdead)\n"); + CORRADE_COMPARE(out, "GL::PixelFormat::RGBA GL::PixelFormat(0xdead)\n"); } void PixelFormatTest::debugPixelType() { - std::ostringstream out; + Containers::String out; Debug(&out) << PixelType::UnsignedByte << PixelType(0xdead); - CORRADE_COMPARE(out.str(), "GL::PixelType::UnsignedByte GL::PixelType(0xdead)\n"); + CORRADE_COMPARE(out, "GL::PixelType::UnsignedByte GL::PixelType(0xdead)\n"); } void PixelFormatTest::debugCompressedPixelFormat() { - std::ostringstream out; + Containers::String out; Debug{&out} << CompressedPixelFormat::RGBS3tcDxt1 << CompressedPixelFormat(0xdead); - CORRADE_COMPARE(out.str(), "GL::CompressedPixelFormat::RGBS3tcDxt1 GL::CompressedPixelFormat(0xdead)\n"); + CORRADE_COMPARE(out, "GL::CompressedPixelFormat::RGBS3tcDxt1 GL::CompressedPixelFormat(0xdead)\n"); } void PixelFormatTest::debugTextureFormat() { - std::ostringstream out; + Containers::String out; Debug(&out) << TextureFormat::DepthComponent << TextureFormat(0xdead); - CORRADE_COMPARE(out.str(), "GL::TextureFormat::DepthComponent GL::TextureFormat(0xdead)\n"); + CORRADE_COMPARE(out, "GL::TextureFormat::DepthComponent GL::TextureFormat(0xdead)\n"); } }}}} diff --git a/src/Magnum/GL/Test/RendererTest.cpp b/src/Magnum/GL/Test/RendererTest.cpp index 7fa5a1bc2..46feeefeb 100644 --- a/src/Magnum/GL/Test/RendererTest.cpp +++ b/src/Magnum/GL/Test/RendererTest.cpp @@ -24,9 +24,8 @@ DEALINGS IN THE SOFTWARE. */ -#include +#include #include -#include #include "Magnum/GL/Renderer.h" @@ -52,25 +51,25 @@ RendererTest::RendererTest() { } void RendererTest::debugError() { - std::ostringstream out; + Containers::String out; Debug(&out) << Renderer::Error::InvalidOperation << Renderer::Error(0xdead); - CORRADE_COMPARE(out.str(), "GL::Renderer::Error::InvalidOperation GL::Renderer::Error(0xdead)\n"); + CORRADE_COMPARE(out, "GL::Renderer::Error::InvalidOperation GL::Renderer::Error(0xdead)\n"); } #ifndef MAGNUM_TARGET_WEBGL void RendererTest::debugResetNotificationStrategy() { - std::ostringstream out; + Containers::String out; Debug(&out) << Renderer::ResetNotificationStrategy::LoseContextOnReset << Renderer::ResetNotificationStrategy(0xdead); - CORRADE_COMPARE(out.str(), "GL::Renderer::ResetNotificationStrategy::LoseContextOnReset GL::Renderer::ResetNotificationStrategy(0xdead)\n"); + CORRADE_COMPARE(out, "GL::Renderer::ResetNotificationStrategy::LoseContextOnReset GL::Renderer::ResetNotificationStrategy(0xdead)\n"); } void RendererTest::debugGraphicsResetStatus() { - std::ostringstream out; + Containers::String out; Debug(&out) << Renderer::GraphicsResetStatus::GuiltyContextReset << Renderer::GraphicsResetStatus(0xdead); - CORRADE_COMPARE(out.str(), "GL::Renderer::GraphicsResetStatus::GuiltyContextReset GL::Renderer::GraphicsResetStatus(0xdead)\n"); + CORRADE_COMPARE(out, "GL::Renderer::GraphicsResetStatus::GuiltyContextReset GL::Renderer::GraphicsResetStatus(0xdead)\n"); } #endif diff --git a/src/Magnum/GL/Test/SamplerTest.cpp b/src/Magnum/GL/Test/SamplerTest.cpp index ea682f230..ff0669ee8 100644 --- a/src/Magnum/GL/Test/SamplerTest.cpp +++ b/src/Magnum/GL/Test/SamplerTest.cpp @@ -24,9 +24,8 @@ DEALINGS IN THE SOFTWARE. */ -#include +#include #include -#include #include "Magnum/Sampler.h" #include "Magnum/GL/Sampler.h" @@ -88,11 +87,11 @@ void SamplerTest::mapFilter() { void SamplerTest::mapFilterInvalid() { CORRADE_SKIP_IF_NO_ASSERT(); - std::ostringstream out; + Containers::String out; Error redirectError{&out}; samplerFilter(Magnum::SamplerFilter(0x123)); - CORRADE_COMPARE(out.str(), + CORRADE_COMPARE(out, "GL::samplerFilter(): invalid filter SamplerFilter(0x123)\n"); } @@ -105,11 +104,11 @@ void SamplerTest::mapMipmap() { void SamplerTest::mapMipmapInvalid() { CORRADE_SKIP_IF_NO_ASSERT(); - std::ostringstream out; + Containers::String out; Error redirectError{&out}; samplerMipmap(Magnum::SamplerMipmap(0x123)); - CORRADE_COMPARE(out.str(), + CORRADE_COMPARE(out, "GL::samplerMipmap(): invalid mode SamplerMipmap(0x123)\n"); } @@ -141,12 +140,12 @@ void SamplerTest::mapWrappingVector() { void SamplerTest::mapWrappingInvalid() { CORRADE_SKIP_IF_NO_ASSERT(); - std::ostringstream out; + Containers::String out; Error redirectError{&out}; hasSamplerWrapping(Magnum::SamplerWrapping(0x123)); samplerWrapping(Magnum::SamplerWrapping(0x123)); - CORRADE_COMPARE(out.str(), + CORRADE_COMPARE(out, "GL::hasSamplerWrapping(): invalid wrapping SamplerWrapping(0x123)\n" "GL::samplerWrapping(): invalid wrapping SamplerWrapping(0x123)\n"); } @@ -157,59 +156,59 @@ void SamplerTest::mapWrappingUnsupported() { #else CORRADE_VERIFY(!hasSamplerWrapping(Magnum::SamplerWrapping::MirrorClampToEdge)); - std::ostringstream out; + Containers::String out; { Error redirectError{&out}; samplerWrapping(Magnum::SamplerWrapping::MirrorClampToEdge); } - CORRADE_COMPARE(out.str(), + CORRADE_COMPARE(out, "GL::samplerWrapping(): wrapping SamplerWrapping::MirrorClampToEdge is not supported on this target\n"); #endif } void SamplerTest::debugFilter() { - std::ostringstream out; + Containers::String out; Debug(&out) << SamplerFilter::Linear << SamplerFilter(0xdead); - CORRADE_COMPARE(out.str(), "GL::SamplerFilter::Linear GL::SamplerFilter(0xdead)\n"); + CORRADE_COMPARE(out, "GL::SamplerFilter::Linear GL::SamplerFilter(0xdead)\n"); } void SamplerTest::debugMipmap() { - std::ostringstream out; + Containers::String out; Debug(&out) << SamplerMipmap::Base << SamplerMipmap(0xdead); - CORRADE_COMPARE(out.str(), "GL::SamplerMipmap::Base GL::SamplerMipmap(0xdead)\n"); + CORRADE_COMPARE(out, "GL::SamplerMipmap::Base GL::SamplerMipmap(0xdead)\n"); } void SamplerTest::debugWrapping() { - std::ostringstream out; + Containers::String out; Debug(&out) << SamplerWrapping::ClampToEdge << SamplerWrapping(0xdead); - CORRADE_COMPARE(out.str(), "GL::SamplerWrapping::ClampToEdge GL::SamplerWrapping(0xdead)\n"); + CORRADE_COMPARE(out, "GL::SamplerWrapping::ClampToEdge GL::SamplerWrapping(0xdead)\n"); } #if !(defined(MAGNUM_TARGET_WEBGL) && defined(MAGNUM_TARGET_GLES2)) void SamplerTest::debugCompareMode() { - std::ostringstream out; + Containers::String out; Debug(&out) << SamplerCompareMode::CompareRefToTexture << SamplerCompareMode(0xdead); - CORRADE_COMPARE(out.str(), "GL::SamplerCompareMode::CompareRefToTexture GL::SamplerCompareMode(0xdead)\n"); + CORRADE_COMPARE(out, "GL::SamplerCompareMode::CompareRefToTexture GL::SamplerCompareMode(0xdead)\n"); } void SamplerTest::debugCompareFunction() { - std::ostringstream out; + Containers::String out; Debug(&out) << SamplerCompareFunction::GreaterOrEqual << SamplerCompareFunction(0xdead); - CORRADE_COMPARE(out.str(), "GL::SamplerCompareFunction::GreaterOrEqual GL::SamplerCompareFunction(0xdead)\n"); + CORRADE_COMPARE(out, "GL::SamplerCompareFunction::GreaterOrEqual GL::SamplerCompareFunction(0xdead)\n"); } #endif #ifndef MAGNUM_TARGET_GLES void SamplerTest::debugDepthStencilMode() { - std::ostringstream out; + Containers::String out; Debug(&out) << SamplerDepthStencilMode::StencilIndex << SamplerDepthStencilMode(0xdead); - CORRADE_COMPARE(out.str(), "GL::SamplerDepthStencilMode::StencilIndex GL::SamplerDepthStencilMode(0xdead)\n"); + CORRADE_COMPARE(out, "GL::SamplerDepthStencilMode::StencilIndex GL::SamplerDepthStencilMode(0xdead)\n"); } #endif diff --git a/src/Magnum/GL/Test/ShaderGLTest.cpp b/src/Magnum/GL/Test/ShaderGLTest.cpp index eac31fa81..14be62d41 100644 --- a/src/Magnum/GL/Test/ShaderGLTest.cpp +++ b/src/Magnum/GL/Test/ShaderGLTest.cpp @@ -25,14 +25,11 @@ DEALINGS IN THE SOFTWARE. */ -#include #include #include #include -#include /* StringHasPrefix / StringHasSuffix */ #include #include -#include #include #include @@ -399,11 +396,11 @@ void ShaderGLTest::addFileNonexistent() { Shader shader(Version::GLES200, Shader::Type::Fragment); #endif - std::ostringstream out; + Containers::String out; Error redirectError{&out}; shader.addFile("nonexistent"); /* There's an error message from Path::read() before */ - CORRADE_COMPARE_AS(out.str(), + CORRADE_COMPARE_AS(out, "\nGL::Shader::addFile(): can't read nonexistent\n", TestSuite::Compare::StringHasSuffix); } @@ -467,7 +464,7 @@ void ShaderGLTest::compileFailure() { /* First line is 1, so 175 newlines means the error is on line 176 */ shader.addSource("void main() {" + "\n"_s*175 + "someOutputVariable = ERROR_ERROR();\n}\n"); - std::ostringstream out; + Containers::String out; { Error redirectError{&out}; CORRADE_VERIFY(!shader.compile()); @@ -475,33 +472,33 @@ void ShaderGLTest::compileFailure() { CORRADE_VERIFY(shader.isCompileFinished()); /* There's a driver-specific message after */ - CORRADE_COMPARE_AS(out.str(), "GL::Shader::compile(): compilation of vertex shader failed with the following message:", + CORRADE_COMPARE_AS(out, "GL::Shader::compile(): compilation of vertex shader failed with the following message:", TestSuite::Compare::StringHasPrefix); /* The error message should contain the correct source number */ - CORRADE_COMPARE_AS(out.str(), "11", TestSuite::Compare::StringNotContains); + CORRADE_COMPARE_AS(out, "11", TestSuite::Compare::StringNotContains); { #ifndef MAGNUM_TARGET_WEBGL /* Fixed in 23.1.4, https://gitlab.freedesktop.org/mesa/mesa/-/commit/d5ff432d7d08c8bb644594ccf28b83be4b521ffe Since I don't have any builtin way to compare version strings yet, XFAILing only optionally, if it actually doesn't contain the string. */ - CORRADE_EXPECT_FAIL_IF(Context::current().detectedDriver() & Context::DetectedDriver::Mesa && !Containers::StringView{out.str()}.contains("12"), + CORRADE_EXPECT_FAIL_IF(Context::current().detectedDriver() & Context::DetectedDriver::Mesa && !out.contains("12"), "Mesa reports source number only in some cases."); #endif - CORRADE_COMPARE_AS(out.str(), "12", TestSuite::Compare::StringContains); + CORRADE_COMPARE_AS(out, "12", TestSuite::Compare::StringContains); } - CORRADE_COMPARE_AS(out.str(), "13", TestSuite::Compare::StringNotContains); + CORRADE_COMPARE_AS(out, "13", TestSuite::Compare::StringNotContains); /* The error message should contain the correct line number */ - CORRADE_COMPARE_AS(out.str(), "175", TestSuite::Compare::StringNotContains); - CORRADE_COMPARE_AS(out.str(), "176", TestSuite::Compare::StringContains); - CORRADE_COMPARE_AS(out.str(), "177", TestSuite::Compare::StringNotContains); + CORRADE_COMPARE_AS(out, "175", TestSuite::Compare::StringNotContains); + CORRADE_COMPARE_AS(out, "176", TestSuite::Compare::StringContains); + CORRADE_COMPARE_AS(out, "177", TestSuite::Compare::StringNotContains); /* No stray \0 should be anywhere */ - CORRADE_COMPARE_AS(out.str(), "\0"_s, TestSuite::Compare::StringNotContains); + CORRADE_COMPARE_AS(out, "\0"_s, TestSuite::Compare::StringNotContains); /* The message should end with a newline */ - CORRADE_COMPARE_AS(out.str(), "\n"_s, TestSuite::Compare::StringHasSuffix); + CORRADE_COMPARE_AS(out, "\n"_s, TestSuite::Compare::StringHasSuffix); } void ShaderGLTest::compileFailureAsync() { @@ -521,7 +518,7 @@ void ShaderGLTest::compileFailureAsync() { shader.addSource("[fu] bleh error #:! stuff\n"); /* The compile submission should not print anything ... */ - std::ostringstream out; + Containers::String out; { Error redirectError{&out}; shader.submitCompile(); @@ -530,7 +527,7 @@ void ShaderGLTest::compileFailureAsync() { while(!shader.isCompileFinished()) Utility::System::sleep(100); - CORRADE_VERIFY(out.str().empty()); + CORRADE_COMPARE(out, ""); /* ... only the final check should */ { @@ -538,7 +535,7 @@ void ShaderGLTest::compileFailureAsync() { CORRADE_VERIFY(!shader.checkCompile()); } CORRADE_VERIFY(shader.isCompileFinished()); - CORRADE_COMPARE_AS(out.str(), "GL::Shader::compile(): compilation of fragment shader failed with the following message:", + CORRADE_COMPARE_AS(out, "GL::Shader::compile(): compilation of fragment shader failed with the following message:", TestSuite::Compare::StringHasPrefix); /* Not testing presence of \0 etc., as that's tested well enough in diff --git a/src/Magnum/GL/Test/ShaderTest.cpp b/src/Magnum/GL/Test/ShaderTest.cpp index ac2a92385..998262368 100644 --- a/src/Magnum/GL/Test/ShaderTest.cpp +++ b/src/Magnum/GL/Test/ShaderTest.cpp @@ -24,9 +24,8 @@ DEALINGS IN THE SOFTWARE. */ -#include +#include #include -#include #include "Magnum/GL/Shader.h" @@ -62,10 +61,10 @@ void ShaderTest::constructCopy() { } void ShaderTest::debugType() { - std::ostringstream out; + Containers::String out; Debug(&out) << Shader::Type::Fragment << Shader::Type(0xdead); - CORRADE_COMPARE(out.str(), "GL::Shader::Type::Fragment GL::Shader::Type(0xdead)\n"); + CORRADE_COMPARE(out, "GL::Shader::Type::Fragment GL::Shader::Type(0xdead)\n"); } }}}} diff --git a/src/Magnum/GL/Test/VersionTest.cpp b/src/Magnum/GL/Test/VersionTest.cpp index 81281dc06..dcbf6bc0a 100644 --- a/src/Magnum/GL/Test/VersionTest.cpp +++ b/src/Magnum/GL/Test/VersionTest.cpp @@ -24,10 +24,9 @@ DEALINGS IN THE SOFTWARE. */ -#include #include +#include #include -#include #include "Magnum/GL/Version.h" @@ -103,7 +102,7 @@ void VersionTest::compare() { } void VersionTest::debug() { - std::ostringstream out; + Containers::String out; #ifndef MAGNUM_TARGET_GLES Debug(&out) << Version::GL210 << Version(0xdead); @@ -112,20 +111,20 @@ void VersionTest::debug() { #endif #ifdef MAGNUM_TARGET_WEBGL - CORRADE_COMPARE(out.str(), "WebGL 1.0 Invalid(0xdead)\n"); + CORRADE_COMPARE(out, "WebGL 1.0 Invalid(0xdead)\n"); #elif defined(MAGNUM_TARGET_GLES) - CORRADE_COMPARE(out.str(), "OpenGL ES 2.0 Invalid(0xdead)\n"); + CORRADE_COMPARE(out, "OpenGL ES 2.0 Invalid(0xdead)\n"); #else - CORRADE_COMPARE(out.str(), "OpenGL 2.1 Invalid(0xdead)\n"); + CORRADE_COMPARE(out, "OpenGL 2.1 Invalid(0xdead)\n"); #endif } #ifndef MAGNUM_TARGET_GLES void VersionTest::debugES() { - std::ostringstream out; + Containers::String out; Debug{&out} << Version::GLES310; - CORRADE_COMPARE(out.str(), "OpenGL ES 3.1\n"); + CORRADE_COMPARE(out, "OpenGL ES 3.1\n"); } #endif diff --git a/src/Magnum/MaterialTools/Test/FilterTest.cpp b/src/Magnum/MaterialTools/Test/FilterTest.cpp index 1bc39b6b9..a8496b6c0 100644 --- a/src/Magnum/MaterialTools/Test/FilterTest.cpp +++ b/src/Magnum/MaterialTools/Test/FilterTest.cpp @@ -24,11 +24,10 @@ DEALINGS IN THE SOFTWARE. */ -#include #include #include +#include #include -#include #include "Magnum/DebugTools/CompareMaterial.h" #include "Magnum/MaterialTools/Filter.h" @@ -162,10 +161,10 @@ void FilterTest::attributesWrongBitCount() { }, {2, 4}}; Containers::BitArrayView attributesToKeep{nullptr, 0, 5}; - std::ostringstream out; + Containers::String out; Error redirectError{&out}; filterAttributes(material, attributesToKeep); - CORRADE_COMPARE(out.str(), "MaterialTools::filterAttributes(): expected 4 bits but got 5\n"); + CORRADE_COMPARE(out, "MaterialTools::filterAttributes(): expected 4 bits but got 5\n"); } void FilterTest::layers() { @@ -253,10 +252,10 @@ void FilterTest::layersWrongBitCount() { }, {2, 4}}; Containers::BitArrayView layersToKeep{nullptr, 0, 3}; - std::ostringstream out; + Containers::String out; Error redirectError{&out}; filterLayers(material, layersToKeep); - CORRADE_COMPARE(out.str(), "MaterialTools::filterLayers(): expected 2 bits but got 3\n"); + CORRADE_COMPARE(out, "MaterialTools::filterLayers(): expected 2 bits but got 3\n"); } void FilterTest::attributesLayers() { @@ -356,11 +355,11 @@ void FilterTest::attributesLayersWrongBitCount() { Containers::BitArrayView attributesToKeep{nullptr, 0, 5}; Containers::BitArrayView layersToKeep{nullptr, 0, 3}; - std::ostringstream out; + Containers::String out; Error redirectError{&out}; filterAttributesLayers(material, attributesToKeep, layersToKeep.prefix(2)); filterAttributesLayers(material, attributesToKeep.prefix(4), layersToKeep); - CORRADE_COMPARE(out.str(), + CORRADE_COMPARE(out, "MaterialTools::filterAttributesLayers(): expected 4 attribute bits but got 5\n" "MaterialTools::filterAttributesLayers(): expected 2 layer bits but got 3\n"); } diff --git a/src/Magnum/MaterialTools/Test/MergeTest.cpp b/src/Magnum/MaterialTools/Test/MergeTest.cpp index 8bbda920e..82ee242b9 100644 --- a/src/Magnum/MaterialTools/Test/MergeTest.cpp +++ b/src/Magnum/MaterialTools/Test/MergeTest.cpp @@ -24,9 +24,8 @@ DEALINGS IN THE SOFTWARE. */ -#include +#include #include -#include #include "Magnum/DebugTools/CompareMaterial.h" #include "Magnum/Math/Color.h" @@ -306,13 +305,13 @@ void MergeTest::conflictsFail() { }, {2, 3}}; /* Verify that it fails in all variants */ - std::ostringstream out; + Containers::String out; Error redirectError{&out}; CORRADE_VERIFY(!merge(a, b)); CORRADE_VERIFY(!merge(b, a)); CORRADE_VERIFY(!merge(a, c, MergeConflicts::KeepFirstIfSameType)); CORRADE_VERIFY(!merge(c, a, MergeConflicts::KeepFirstIfSameType)); - CORRADE_COMPARE(out.str(), + CORRADE_COMPARE(out, "MaterialTools::merge(): conflicting attribute RoughnessTexture in layer 0\n" "MaterialTools::merge(): conflicting attribute RoughnessTexture in layer 0\n" "MaterialTools::merge(): conflicting type Trade::MaterialAttributeType::Float vs String of attribute customAttribute in layer 1\n" diff --git a/src/Magnum/MaterialTools/Test/PhongToPbrMetallicRoughnessTest.cpp b/src/Magnum/MaterialTools/Test/PhongToPbrMetallicRoughnessTest.cpp index 0c426f878..cec8cf0fe 100644 --- a/src/Magnum/MaterialTools/Test/PhongToPbrMetallicRoughnessTest.cpp +++ b/src/Magnum/MaterialTools/Test/PhongToPbrMetallicRoughnessTest.cpp @@ -24,9 +24,8 @@ DEALINGS IN THE SOFTWARE. */ -#include +#include #include -#include /** @todo remove once Debug is stream-free */ #include "Magnum/DebugTools/CompareMaterial.h" #include "Magnum/MaterialTools/PhongToPbrMetallicRoughness.h" @@ -278,35 +277,35 @@ void PhongToPbrMetallicRoughnessTest::convert() { auto&& data = ConvertData[testCaseInstanceId()]; setTestCaseDescription(data.name); - std::ostringstream out; + Containers::String out; Error redirectError{&out}; Warning redirectWarning{&out}; Containers::Optional actual = phongToPbrMetallicRoughness(data.material, data.flags); CORRADE_VERIFY(actual); CORRADE_COMPARE_AS(*actual, data.expected, DebugTools::CompareMaterial); - CORRADE_COMPARE(out.str(), ""); + CORRADE_COMPARE(out, ""); } void PhongToPbrMetallicRoughnessTest::warning() { auto&& data = WarningData[testCaseInstanceId()]; setTestCaseDescription(data.name); - std::ostringstream out; + Containers::String out; Warning redirectWarning{&out}; Containers::Optional actual = phongToPbrMetallicRoughness(data.material, data.flags); CORRADE_VERIFY(actual); CORRADE_COMPARE_AS(*actual, data.expected, DebugTools::CompareMaterial); - CORRADE_COMPARE(out.str(), data.message); + CORRADE_COMPARE(out, data.message); } void PhongToPbrMetallicRoughnessTest::fail() { auto&& data = FailData[testCaseInstanceId()]; setTestCaseDescription(data.name); - std::ostringstream out; + Containers::String out; Error redirectError{&out}; CORRADE_VERIFY(!phongToPbrMetallicRoughness(data.material, data.flags)); - CORRADE_COMPARE(out.str(), data.message); + CORRADE_COMPARE(out, data.message); } }}}} diff --git a/src/Magnum/MaterialTools/Test/RemoveDuplicatesTest.cpp b/src/Magnum/MaterialTools/Test/RemoveDuplicatesTest.cpp index 2cc4138ff..507f4692e 100644 --- a/src/Magnum/MaterialTools/Test/RemoveDuplicatesTest.cpp +++ b/src/Magnum/MaterialTools/Test/RemoveDuplicatesTest.cpp @@ -24,12 +24,11 @@ DEALINGS IN THE SOFTWARE. */ -#include /** @todo remove once Debug is stream-free */ #include #include +#include #include #include -#include /** @todo remove once Debug is stream-free */ #include "Magnum/DebugTools/CompareMaterial.h" #include "Magnum/Math/Color.h" @@ -648,11 +647,11 @@ void RemoveDuplicatesTest::invalidSize() { }; UnsignedInt mapping[3]; - std::ostringstream out; + Containers::String out; Error redirectError{&out}; removeDuplicatesInto(data, mapping); removeDuplicatesInPlaceInto(data, mapping); - CORRADE_COMPARE(out.str(), + CORRADE_COMPARE(out, "MaterialTools::removeDuplicatesInto(): bad output size, expected 2 but got 3\n" "MaterialTools::removeDuplicatesInPlaceInto(): bad output size, expected 2 but got 3\n"); } diff --git a/src/Magnum/Math/Test/AngleTest.cpp b/src/Magnum/Math/Test/AngleTest.cpp index b7d590a03..65432e172 100644 --- a/src/Magnum/Math/Test/AngleTest.cpp +++ b/src/Magnum/Math/Test/AngleTest.cpp @@ -24,14 +24,13 @@ DEALINGS IN THE SOFTWARE. */ -#include +#include #include #include +#include #include -#include #if defined(CORRADE_TARGET_UNIX) || (defined(CORRADE_TARGET_WINDOWS) && !defined(CORRADE_TARGET_WINDOWS_RT)) || defined(CORRADE_TARGET_EMSCRIPTEN) -#include -#include +#include #include #endif @@ -341,43 +340,43 @@ void AngleTest::conversion() { } void AngleTest::debugDeg() { - std::ostringstream o; + Containers::String out; - Debug(&o) << 90.0_degf; - CORRADE_COMPARE(o.str(), "Deg(90)\n"); + Debug{&out} << 90.0_degf; + CORRADE_COMPARE(out, "Deg(90)\n"); /* Verify that this compiles */ - o.str({}); - Debug(&o) << 56.0_degf - 34.0_degf; - CORRADE_COMPARE(o.str(), "Deg(22)\n"); + out = {}; + Debug{&out} << 56.0_degf - 34.0_degf; + CORRADE_COMPARE(out, "Deg(22)\n"); } void AngleTest::debugDegPacked() { - std::ostringstream out; + Containers::String out; /* Second is not packed, the first should not make any flags persistent */ Debug{&out} << Debug::packed << 90.0_degf << 45.0_degf; - CORRADE_COMPARE(out.str(), "90 Deg(45)\n"); + CORRADE_COMPARE(out, "90 Deg(45)\n"); } void AngleTest::debugRad() { - std::ostringstream o; + Containers::String out; - Debug(&o) << 1.5708_radf; - CORRADE_COMPARE(o.str(), "Rad(1.5708)\n"); + Debug{&out} << 1.5708_radf; + CORRADE_COMPARE(out, "Rad(1.5708)\n"); /* Verify that this compiles */ - o.str({}); - Debug(&o) << 1.5708_radf - 3.1416_radf; - CORRADE_COMPARE(o.str(), "Rad(-1.5708)\n"); + out = {}; + Debug{&out} << 1.5708_radf - 3.1416_radf; + CORRADE_COMPARE(out, "Rad(-1.5708)\n"); } void AngleTest::debugRadPacked() { - std::ostringstream out; + Containers::String out; /* Second is not packed, the first should not make any flags persistent */ Debug{&out} << Debug::packed << 1.5708_radf << 3.1416_radf; - CORRADE_COMPARE(out.str(), "1.5708 Rad(3.1416)\n"); + CORRADE_COMPARE(out, "1.5708 Rad(3.1416)\n"); } #if defined(CORRADE_TARGET_UNIX) || (defined(CORRADE_TARGET_WINDOWS) && !defined(CORRADE_TARGET_WINDOWS_RT)) || defined(CORRADE_TARGET_EMSCRIPTEN) @@ -395,11 +394,11 @@ template void AngleTest::tweakableError() { setTestCaseTemplateName(TweakableTraits::name()); setTestCaseDescription(data.name); - std::ostringstream out; + Containers::String out; Warning redirectWarning{&out}; Error redirectError{&out}; Utility::TweakableState state = Utility::TweakableParser::parse(Utility::format(data.data, TweakableTraits::literal())).first(); - CORRADE_COMPARE(out.str(), Utility::formatString(data.error, TweakableTraits::literal())); + CORRADE_COMPARE(out, Utility::format(data.error, TweakableTraits::literal())); CORRADE_COMPARE(state, data.state); } #endif diff --git a/src/Magnum/Math/Test/BezierTest.cpp b/src/Magnum/Math/Test/BezierTest.cpp index d9d61fda5..cb0371d6c 100644 --- a/src/Magnum/Math/Test/BezierTest.cpp +++ b/src/Magnum/Math/Test/BezierTest.cpp @@ -25,9 +25,10 @@ DEALINGS IN THE SOFTWARE. */ -#include +#include +#include /* arraySize() */ +#include #include -#include #include "Magnum/Math/Bezier.h" #include "Magnum/Math/CubicHermite.h" @@ -337,9 +338,9 @@ void BezierTest::strictWeakOrdering() { } void BezierTest::debug() { - std::ostringstream out; + Containers::String out; Debug(&out) << CubicBezier2D{Vector2{0.0f, 1.0f}, Vector2{1.5f, -0.3f}, Vector2{2.1f, 0.5f}, Vector2{0.0f, 2.0f}}; - CORRADE_COMPARE(out.str(), "Bezier({0, 1}, {1.5, -0.3}, {2.1, 0.5}, {0, 2})\n"); + CORRADE_COMPARE(out, "Bezier({0, 1}, {1.5, -0.3}, {2.1, 0.5}, {0, 2})\n"); } }}}} diff --git a/src/Magnum/Math/Test/BitVectorTest.cpp b/src/Magnum/Math/Test/BitVectorTest.cpp index fa363bc00..a842a7d3b 100644 --- a/src/Magnum/Math/Test/BitVectorTest.cpp +++ b/src/Magnum/Math/Test/BitVectorTest.cpp @@ -24,9 +24,10 @@ DEALINGS IN THE SOFTWARE. */ -#include +#include +#include /* arraySize() */ +#include #include -#include #include "Magnum/Math/BitVector.h" #include "Magnum/Math/StrictWeakOrdering.h" @@ -373,12 +374,12 @@ void BitVectorTest::strictWeakOrdering() { } void BitVectorTest::debug() { - std::ostringstream o; + Containers::String out; /* 0b00100101 0b01010011 0b010 */ - Debug(&o) << BitVector19(0x25, 0x53, 0x02); + Debug{&out} << BitVector19(0x25, 0x53, 0x02); - CORRADE_COMPARE(o.str(), "BitVector(0b00100101, 0b01010011, 0b010)\n"); + CORRADE_COMPARE(out, "BitVector(0b00100101, 0b01010011, 0b010)\n"); } }}}} diff --git a/src/Magnum/Math/Test/ColorBatchTest.cpp b/src/Magnum/Math/Test/ColorBatchTest.cpp index 6e9ea12ad..2f639cdf6 100644 --- a/src/Magnum/Math/Test/ColorBatchTest.cpp +++ b/src/Magnum/Math/Test/ColorBatchTest.cpp @@ -24,7 +24,6 @@ DEALINGS IN THE SOFTWARE. */ -#include #include #include #include @@ -32,7 +31,6 @@ #include #include #include -#include /** @todo remove once Debug is stram-free */ #include #include "Magnum/ImageView.h" @@ -369,11 +367,11 @@ void ColorBatchTest::yFlipInvalidLastDimension() { it's enough to test just some */ char data[32]; - std::ostringstream out; + Containers::String out; Error redirectError{&out}; yFlipBc3InPlace(Containers::stridedArrayView(data).expanded<0>(Containers::Size3D{1, 4, 8})); yFlipBc1InPlace(Containers::stridedArrayView(data).expanded<0>(Containers::Size3D{1, 2, 16}).every({1, 1, 2})); - CORRADE_COMPARE(out.str(), + CORRADE_COMPARE(out, "Math::yFlipBc3InPlace(): expected last dimension to be 16 bytes but got 8\n" "Math::yFlipBc1InPlace(): last dimension is not contiguous\n"); } diff --git a/src/Magnum/Math/Test/ColorTest.cpp b/src/Magnum/Math/Test/ColorTest.cpp index c7b83f137..ef0431648 100644 --- a/src/Magnum/Math/Test/ColorTest.cpp +++ b/src/Magnum/Math/Test/ColorTest.cpp @@ -24,13 +24,12 @@ DEALINGS IN THE SOFTWARE. */ -#include +#include #include #include -#include #if defined(CORRADE_TARGET_UNIX) || (defined(CORRADE_TARGET_WINDOWS) && !defined(CORRADE_TARGET_WINDOWS_RT)) || defined(CORRADE_TARGET_EMSCRIPTEN) #include -#include +#include #include #endif @@ -1246,28 +1245,28 @@ void ColorTest::swizzleType() { } void ColorTest::debug() { - std::ostringstream o; - Debug(&o) << Color3(0.5f, 0.75f, 1.0f); - CORRADE_COMPARE(o.str(), "Vector(0.5, 0.75, 1)\n"); + Containers::String out; + Debug{&out} << Color3(0.5f, 0.75f, 1.0f); + CORRADE_COMPARE(out, "Vector(0.5, 0.75, 1)\n"); - o.str({}); - Debug(&o) << Color4(0.5f, 0.75f, 0.0f, 1.0f); - CORRADE_COMPARE(o.str(), "Vector(0.5, 0.75, 0, 1)\n"); + out = {}; + Debug{&out} << Color4(0.5f, 0.75f, 0.0f, 1.0f); + CORRADE_COMPARE(out, "Vector(0.5, 0.75, 0, 1)\n"); } void ColorTest::debugUb() { - std::ostringstream o; - Debug(&o) << 0x123456_rgb << 0x789abc_rgb; - CORRADE_COMPARE(o.str(), "#123456 #789abc\n"); + Containers::String out; + Debug{&out} << 0x123456_rgb << 0x789abc_rgb; + CORRADE_COMPARE(out, "#123456 #789abc\n"); - o.str({}); - Debug(&o) << 0x12345678_rgba << 0x90abcdef_rgba; - CORRADE_COMPARE(o.str(), "#12345678 #90abcdef\n"); + out = {}; + Debug{&out} << 0x12345678_rgba << 0x90abcdef_rgba; + CORRADE_COMPARE(out, "#12345678 #90abcdef\n"); /* The Hex flag shouldn't affect this at all */ - o.str({}); - Debug{&o, Debug::Flag::Hex} << 0x789abc_rgb << 0x12345678_rgba; - CORRADE_COMPARE(o.str(), "#789abc #12345678\n"); + out = {}; + Debug{&out, Debug::Flag::Hex} << 0x789abc_rgb << 0x12345678_rgba; + CORRADE_COMPARE(out, "#789abc #12345678\n"); } void ColorTest::debugUbColor() { @@ -1284,12 +1283,12 @@ void ColorTest::debugUbColor() { << 0x3bd26799_rgba << 0x3bd267cc_rgba << 0x3bd267ff_rgba; /* It should work just for the immediately following value */ - std::ostringstream out; + Containers::String out; Debug{&out} << Debug::color << 0x3bd267_rgb << Debug::color << 0x2f83cc99_rgba << 0x3bd267_rgb << 0x2f83cc99_rgba; - CORRADE_COMPARE(out.str(), + CORRADE_COMPARE(out, "\033[38;2;59;210;103m\033[48;2;59;210;103m██\033[0m " "\033[38;2;47;131;204m▒▒\033[0m #3bd267 #2f83cc99\n"); } @@ -1308,18 +1307,18 @@ void ColorTest::debugUbColorColorsDisabled() { << 0x3bd26799_rgba << 0x3bd267cc_rgba << 0x3bd267ff_rgba; /* It should work just for the immediately following value */ - std::ostringstream out; + Containers::String out; Debug{&out, Debug::Flag::DisableColors} << Debug::color << 0x2f83cc_rgb << Debug::color << 0x2f83cc99_rgba << 0x2f83cc_rgb << 0x2f83cc99_rgba; - CORRADE_COMPARE(out.str(), "▓▓ ▒▒ #2f83cc #2f83cc99\n"); + CORRADE_COMPARE(out, "▓▓ ▒▒ #2f83cc #2f83cc99\n"); } void ColorTest::debugHsv() { - std::ostringstream out; + Containers::String out; Debug{&out} << ColorHsv(135.0_degf, 0.75f, 0.3f); - CORRADE_COMPARE(out.str(), "ColorHsv(Deg(135), 0.75, 0.3)\n"); + CORRADE_COMPARE(out, "ColorHsv(Deg(135), 0.75, 0.3)\n"); } #if defined(CORRADE_TARGET_UNIX) || (defined(CORRADE_TARGET_WINDOWS) && !defined(CORRADE_TARGET_WINDOWS_RT)) || defined(CORRADE_TARGET_EMSCRIPTEN) @@ -1399,11 +1398,11 @@ void ColorTest::tweakableErrorRgb() { auto&& data = TweakableErrorData[testCaseInstanceId()]; setTestCaseDescription(data.name); - std::ostringstream out; + Containers::String out; Warning redirectWarning{&out}; Error redirectError{&out}; Utility::TweakableState state = Utility::TweakableParser::parse(Utility::format(data.data, "ff3366", "rgb")).first(); - CORRADE_COMPARE(out.str(), Utility::formatString(data.error, "ff3366", "rgb", "")); + CORRADE_COMPARE(out, Utility::format(data.error, "ff3366", "rgb", "")); CORRADE_COMPARE(state, data.state); } @@ -1411,11 +1410,11 @@ void ColorTest::tweakableErrorSrgb() { auto&& data = TweakableErrorData[testCaseInstanceId()]; setTestCaseDescription(data.name); - std::ostringstream out; + Containers::String out; Warning redirectWarning{&out}; Error redirectError{&out}; Utility::TweakableState state = Utility::TweakableParser::parse(Utility::format(data.data, "ff3366", "srgb")).first(); - CORRADE_COMPARE(out.str(), Utility::formatString(data.error, "ff3366", "rgb", "s")); + CORRADE_COMPARE(out, Utility::format(data.error, "ff3366", "rgb", "s")); CORRADE_COMPARE(state, data.state); } @@ -1423,11 +1422,11 @@ void ColorTest::tweakableErrorRgba() { auto&& data = TweakableErrorData[testCaseInstanceId()]; setTestCaseDescription(data.name); - std::ostringstream out; + Containers::String out; Warning redirectWarning{&out}; Error redirectError{&out}; Utility::TweakableState state = Utility::TweakableParser::parse(Utility::format(data.data, "ff3366aa", "rgba")).first(); - CORRADE_COMPARE(out.str(), Utility::formatString(data.error, "ff3366aa", "rgba", "")); + CORRADE_COMPARE(out, Utility::format(data.error, "ff3366aa", "rgba", "")); CORRADE_COMPARE(state, data.state); } @@ -1435,11 +1434,11 @@ void ColorTest::tweakableErrorSrgba() { auto&& data = TweakableErrorData[testCaseInstanceId()]; setTestCaseDescription(data.name); - std::ostringstream out; + Containers::String out; Warning redirectWarning{&out}; Error redirectError{&out}; Utility::TweakableState state = Utility::TweakableParser::parse(Utility::format(data.data, "ff3366aa", "srgba")).first(); - CORRADE_COMPARE(out.str(), Utility::formatString(data.error, "ff3366aa", "rgba", "s")); + CORRADE_COMPARE(out, Utility::format(data.error, "ff3366aa", "rgba", "s")); CORRADE_COMPARE(state, data.state); } @@ -1447,11 +1446,11 @@ void ColorTest::tweakableErrorRgbf() { auto&& data = TweakableErrorData[testCaseInstanceId()]; setTestCaseDescription(data.name); - std::ostringstream out; + Containers::String out; Warning redirectWarning{&out}; Error redirectError{&out}; Utility::TweakableState state = Utility::TweakableParser::parse(Utility::format(data.data, "ff3366", "rgbf")).first(); - CORRADE_COMPARE(out.str(), Utility::formatString(data.error, "ff3366", "rgbf", "")); + CORRADE_COMPARE(out, Utility::format(data.error, "ff3366", "rgbf", "")); CORRADE_COMPARE(state, data.state); } @@ -1459,11 +1458,11 @@ void ColorTest::tweakableErrorSrgbf() { auto&& data = TweakableErrorData[testCaseInstanceId()]; setTestCaseDescription(data.name); - std::ostringstream out; + Containers::String out; Warning redirectWarning{&out}; Error redirectError{&out}; Utility::TweakableState state = Utility::TweakableParser::parse(Utility::format(data.data, "ff3366", "srgbf")).first(); - CORRADE_COMPARE(out.str(), Utility::formatString(data.error, "ff3366", "rgbf", "s")); + CORRADE_COMPARE(out, Utility::format(data.error, "ff3366", "rgbf", "s")); CORRADE_COMPARE(state, data.state); } @@ -1471,11 +1470,11 @@ void ColorTest::tweakableErrorRgbaf() { auto&& data = TweakableErrorData[testCaseInstanceId()]; setTestCaseDescription(data.name); - std::ostringstream out; + Containers::String out; Warning redirectWarning{&out}; Error redirectError{&out}; Utility::TweakableState state = Utility::TweakableParser::parse(Utility::format(data.data, "ff3366aa", "rgbaf")).first(); - CORRADE_COMPARE(out.str(), Utility::formatString(data.error, "ff3366aa", "rgbaf", "")); + CORRADE_COMPARE(out, Utility::format(data.error, "ff3366aa", "rgbaf", "")); CORRADE_COMPARE(state, data.state); } @@ -1483,11 +1482,11 @@ void ColorTest::tweakableErrorSrgbaf() { auto&& data = TweakableErrorData[testCaseInstanceId()]; setTestCaseDescription(data.name); - std::ostringstream out; + Containers::String out; Warning redirectWarning{&out}; Error redirectError{&out}; Utility::TweakableState state = Utility::TweakableParser::parse(Utility::format(data.data, "ff3366aa", "srgbaf")).first(); - CORRADE_COMPARE(out.str(), Utility::formatString(data.error, "ff3366aa", "rgbaf", "s")); + CORRADE_COMPARE(out, Utility::format(data.error, "ff3366aa", "rgbaf", "s")); CORRADE_COMPARE(state, data.state); } #endif diff --git a/src/Magnum/Math/Test/ComplexTest.cpp b/src/Magnum/Math/Test/ComplexTest.cpp index d86b05f83..3078c0b08 100644 --- a/src/Magnum/Math/Test/ComplexTest.cpp +++ b/src/Magnum/Math/Test/ComplexTest.cpp @@ -24,9 +24,10 @@ DEALINGS IN THE SOFTWARE. */ -#include +#include +#include /* arraySize() */ +#include #include -#include #include "Magnum/Math/Complex.h" #include "Magnum/Math/Matrix3.h" @@ -439,11 +440,11 @@ void ComplexTest::invertedNormalized() { void ComplexTest::invertedNormalizedNotNormalized() { CORRADE_SKIP_IF_NO_DEBUG_ASSERT(); - std::ostringstream out; + Containers::String out; Error redirectError{&out}; (Complex(-0.6f, 0.8f)*2).invertedNormalized(); - CORRADE_COMPARE(out.str(), "Math::Complex::invertedNormalized(): Complex(-1.2, 1.6) is not normalized\n"); + CORRADE_COMPARE(out, "Math::Complex::invertedNormalized(): Complex(-1.2, 1.6) is not normalized\n"); } void ComplexTest::angle() { @@ -478,11 +479,11 @@ void ComplexTest::angleNormalizedButOver1() { void ComplexTest::angleNotNormalized() { CORRADE_SKIP_IF_NO_DEBUG_ASSERT(); - std::ostringstream out; + Containers::String out; Error redirectError{&out}; Math::angle(Complex(1.5f, -2.0f).normalized(), {-4.0f, 3.5f}); Math::angle({1.5f, -2.0f}, Complex(-4.0f, 3.5f).normalized()); - CORRADE_COMPARE(out.str(), + CORRADE_COMPARE(out, "Math::angle(): complex numbers Complex(0.6, -0.8) and Complex(-4, 3.5) are not normalized\n" "Math::angle(): complex numbers Complex(1.5, -2) and Complex(-0.752577, 0.658505) are not normalized\n"); } @@ -518,7 +519,7 @@ void ComplexTest::matrix() { void ComplexTest::matrixNotRotation() { CORRADE_SKIP_IF_NO_DEBUG_ASSERT(); - std::ostringstream out; + Containers::String out; Error redirectError{&out}; /* Shear, using rotationShear() instead of rotationScaling() as that isn't supposed to "fix" the shear */ @@ -528,7 +529,7 @@ void ComplexTest::matrixNotRotation() { supposed to "fix" the reflection either */ Complex::fromMatrix((Matrix3::scaling({-1.0f, 1.0f})* Matrix3::rotation(45.0_degf)).rotation()); - CORRADE_COMPARE(out.str(), + CORRADE_COMPARE(out, "Math::Complex::fromMatrix(): the matrix is not a rotation:\n" "Matrix(0.894427, -0.894427,\n" " 0.447214, 0.447214)\n" @@ -553,13 +554,13 @@ void ComplexTest::lerp() { void ComplexTest::lerpNotNormalized() { CORRADE_SKIP_IF_NO_DEBUG_ASSERT(); - std::ostringstream out; + Containers::String out; Error redirectError{&out}; Complex a; Math::lerp(a*3.0f, a, 0.35f); Math::lerp(a, a*-3.0f, 0.35f); - CORRADE_COMPARE(out.str(), + CORRADE_COMPARE(out, "Math::lerp(): complex numbers Complex(3, 0) and Complex(1, 0) are not normalized\n" "Math::lerp(): complex numbers Complex(1, 0) and Complex(-3, -0) are not normalized\n"); } @@ -581,13 +582,13 @@ void ComplexTest::slerp() { void ComplexTest::slerpNotNormalized() { CORRADE_SKIP_IF_NO_DEBUG_ASSERT(); - std::ostringstream out; + Containers::String out; Error redirectError{&out}; Complex a; Math::slerp(a*3.0f, a, 0.35f); Math::slerp(a, a*-3.0f, 0.35f); - CORRADE_COMPARE(out.str(), + CORRADE_COMPARE(out, "Math::slerp(): complex numbers Complex(3, 0) and Complex(1, 0) are not normalized\n" "Math::slerp(): complex numbers Complex(1, 0) and Complex(-3, -0) are not normalized\n"); } @@ -618,10 +619,10 @@ void ComplexTest::strictWeakOrdering() { } void ComplexTest::debug() { - std::ostringstream o; + Containers::String out; - Debug(&o) << Complex(2.5f, -7.5f); - CORRADE_COMPARE(o.str(), "Complex(2.5, -7.5)\n"); + Debug{&out} << Complex(2.5f, -7.5f); + CORRADE_COMPARE(out, "Complex(2.5, -7.5)\n"); } }}}} diff --git a/src/Magnum/Math/Test/ConfigurationValueTest.cpp b/src/Magnum/Math/Test/ConfigurationValueTest.cpp index f92384c5a..9b05b2829 100644 --- a/src/Magnum/Math/Test/ConfigurationValueTest.cpp +++ b/src/Magnum/Math/Test/ConfigurationValueTest.cpp @@ -26,7 +26,7 @@ #include #include -#include +#include /** @todo remove once Configuration is std::string-free */ #include "Magnum/Math/ConfigurationValue.h" diff --git a/src/Magnum/Math/Test/CubicHermiteTest.cpp b/src/Magnum/Math/Test/CubicHermiteTest.cpp index 92d22a5d5..f98d41156 100644 --- a/src/Magnum/Math/Test/CubicHermiteTest.cpp +++ b/src/Magnum/Math/Test/CubicHermiteTest.cpp @@ -24,9 +24,10 @@ DEALINGS IN THE SOFTWARE. */ -#include +#include +#include /* arraySize() */ +#include #include -#include #include "Magnum/Math/Bezier.h" #include "Magnum/Math/CubicHermite.h" @@ -892,7 +893,7 @@ void CubicHermiteTest::lerpComplex() { void CubicHermiteTest::lerpComplexNotNormalized() { CORRADE_SKIP_IF_NO_DEBUG_ASSERT(); - std::ostringstream out; + Containers::String out; Error redirectError{&out}; /* This one should not assert as the default constructor should create @@ -903,7 +904,7 @@ void CubicHermiteTest::lerpComplexNotNormalized() { CubicHermiteComplex a{{}, Complex{}*2.0f, {}}; Math::lerp({}, a, 0.3f); Math::lerp(a, {}, 0.3f); - CORRADE_COMPARE(out.str(), + CORRADE_COMPARE(out, "Math::lerp(): complex numbers Complex(1, 0) and Complex(2, 0) are not normalized\n" "Math::lerp(): complex numbers Complex(2, 0) and Complex(1, 0) are not normalized\n"); } @@ -935,7 +936,7 @@ void CubicHermiteTest::lerpQuaternion() { void CubicHermiteTest::lerpQuaternionNotNormalized() { CORRADE_SKIP_IF_NO_DEBUG_ASSERT(); - std::ostringstream out; + Containers::String out; Error redirectError{&out}; /* This one should not assert as the default constructor should create @@ -946,7 +947,7 @@ void CubicHermiteTest::lerpQuaternionNotNormalized() { CubicHermiteQuaternion a{{}, Quaternion{}*2.0f, {}}; Math::lerp({}, a, 0.3f); Math::lerp(a, {}, 0.3f); - CORRADE_COMPARE(out.str(), + CORRADE_COMPARE(out, "Math::lerp(): quaternions Quaternion({0, 0, 0}, 1) and Quaternion({0, 0, 0}, 2) are not normalized\n" "Math::lerp(): quaternions Quaternion({0, 0, 0}, 2) and Quaternion({0, 0, 0}, 1) are not normalized\n"); } @@ -977,7 +978,7 @@ void CubicHermiteTest::lerpQuaternionShortestPath() { void CubicHermiteTest::lerpQuaternionShortestPathNotNormalized() { CORRADE_SKIP_IF_NO_DEBUG_ASSERT(); - std::ostringstream out; + Containers::String out; Error redirectError{&out}; /* This one should not assert as the default constructor should create @@ -989,7 +990,7 @@ void CubicHermiteTest::lerpQuaternionShortestPathNotNormalized() { Math::lerpShortestPath({}, a, 0.3f); Math::lerpShortestPath(a, {}, 0.3f); /* lerpShortestPath() is calling lerp(), so the message is from there */ - CORRADE_COMPARE(out.str(), + CORRADE_COMPARE(out, "Math::lerp(): quaternions Quaternion({0, 0, 0}, 1) and Quaternion({0, 0, 0}, 2) are not normalized\n" "Math::lerp(): quaternions Quaternion({0, 0, 0}, 2) and Quaternion({0, 0, 0}, 1) are not normalized\n"); } @@ -1015,7 +1016,7 @@ void CubicHermiteTest::slerpComplex() { void CubicHermiteTest::slerpComplexNotNormalized() { CORRADE_SKIP_IF_NO_DEBUG_ASSERT(); - std::ostringstream out; + Containers::String out; Error redirectError{&out}; /* This one should not assert as the default constructor should create @@ -1026,7 +1027,7 @@ void CubicHermiteTest::slerpComplexNotNormalized() { CubicHermiteComplex a{{}, Complex{}*2.0f, {}}; Math::slerp({}, a, 0.3f); Math::slerp(a, {}, 0.3f); - CORRADE_COMPARE(out.str(), + CORRADE_COMPARE(out, "Math::slerp(): complex numbers Complex(1, 0) and Complex(2, 0) are not normalized\n" "Math::slerp(): complex numbers Complex(2, 0) and Complex(1, 0) are not normalized\n"); } @@ -1058,7 +1059,7 @@ void CubicHermiteTest::slerpQuaternion() { void CubicHermiteTest::slerpQuaternionNotNormalized() { CORRADE_SKIP_IF_NO_DEBUG_ASSERT(); - std::ostringstream out; + Containers::String out; Error redirectError{&out}; /* This one should not assert as the default constructor should create @@ -1069,7 +1070,7 @@ void CubicHermiteTest::slerpQuaternionNotNormalized() { CubicHermiteQuaternion a{{}, Quaternion{}*2.0f, {}}; Math::slerp({}, a, 0.3f); Math::slerp(a, {}, 0.3f); - CORRADE_COMPARE(out.str(), + CORRADE_COMPARE(out, "Math::slerp(): quaternions Quaternion({0, 0, 0}, 1) and Quaternion({0, 0, 0}, 2) are not normalized\n" "Math::slerp(): quaternions Quaternion({0, 0, 0}, 2) and Quaternion({0, 0, 0}, 1) are not normalized\n"); } @@ -1101,7 +1102,7 @@ void CubicHermiteTest::slerpQuaternionShortestPath() { void CubicHermiteTest::slerpQuaternionShortestPathNotNormalized() { CORRADE_SKIP_IF_NO_DEBUG_ASSERT(); - std::ostringstream out; + Containers::String out; Error redirectError{&out}; /* This one should not assert as the default constructor should create @@ -1112,7 +1113,7 @@ void CubicHermiteTest::slerpQuaternionShortestPathNotNormalized() { CubicHermiteQuaternion a{{}, Quaternion{}*2.0f, {}}; Math::slerpShortestPath({}, a, 0.3f); Math::slerpShortestPath(a, {}, 0.3f); - CORRADE_COMPARE(out.str(), + CORRADE_COMPARE(out, "Math::slerpShortestPath(): quaternions Quaternion({0, 0, 0}, 1) and Quaternion({0, 0, 0}, 2) are not normalized\n" "Math::slerpShortestPath(): quaternions Quaternion({0, 0, 0}, 2) and Quaternion({0, 0, 0}, 1) are not normalized\n"); } @@ -1175,7 +1176,7 @@ void CubicHermiteTest::splerpComplex() { void CubicHermiteTest::splerpComplexNotNormalized() { CORRADE_SKIP_IF_NO_DEBUG_ASSERT(); - std::ostringstream out; + Containers::String out; Error redirectError{&out}; /* This one should not assert as the default constructor should create @@ -1186,7 +1187,7 @@ void CubicHermiteTest::splerpComplexNotNormalized() { CubicHermiteComplex a{{}, Complex{}*2.0f, {}}; Math::splerp({}, a, 0.3f); Math::splerp(a, {}, 0.3f); - CORRADE_COMPARE(out.str(), + CORRADE_COMPARE(out, "Math::splerp(): complex spline points Complex(1, 0) and Complex(2, 0) are not normalized\n" "Math::splerp(): complex spline points Complex(2, 0) and Complex(1, 0) are not normalized\n"); } @@ -1214,7 +1215,7 @@ void CubicHermiteTest::splerpQuaternion() { void CubicHermiteTest::splerpQuaternionNotNormalized() { CORRADE_SKIP_IF_NO_DEBUG_ASSERT(); - std::ostringstream out; + Containers::String out; Error redirectError{&out}; /* This one should not assert as the default constructor should create @@ -1225,7 +1226,7 @@ void CubicHermiteTest::splerpQuaternionNotNormalized() { CubicHermiteQuaternion a{{}, Quaternion{}*2.0f, {}}; Math::splerp({}, a, 0.3f); Math::splerp(a, {}, 0.3f); - CORRADE_COMPARE(out.str(), + CORRADE_COMPARE(out, "Math::splerp(): quaternion spline points Quaternion({0, 0, 0}, 1) and Quaternion({0, 0, 0}, 2) are not normalized\n" "Math::splerp(): quaternion spline points Quaternion({0, 0, 0}, 2) and Quaternion({0, 0, 0}, 1) are not normalized\n"); } @@ -1250,30 +1251,30 @@ void CubicHermiteTest::strictWeakOrdering() { } void CubicHermiteTest::debugScalar() { - std::ostringstream out; + Containers::String out; Debug{&out} << CubicHermite1D{2.0f, 3.0f, -1.0f}; - CORRADE_COMPARE(out.str(), "CubicHermite(2, 3, -1)\n"); + CORRADE_COMPARE(out, "CubicHermite(2, 3, -1)\n"); } void CubicHermiteTest::debugVector() { - std::ostringstream out; + Containers::String out; Debug{&out} << CubicHermite2D{{2.0f, 1.5f}, {3.0f, 0.1f}, {-1.0f, 0.0f}}; - CORRADE_COMPARE(out.str(), "CubicHermite(Vector(2, 1.5), Vector(3, 0.1), Vector(-1, 0))\n"); + CORRADE_COMPARE(out, "CubicHermite(Vector(2, 1.5), Vector(3, 0.1), Vector(-1, 0))\n"); } void CubicHermiteTest::debugComplex() { - std::ostringstream out; + Containers::String out; Debug{&out} << CubicHermiteComplex{{2.0f, 1.5f}, {3.0f, 0.1f}, {-1.0f, 0.0f}}; - CORRADE_COMPARE(out.str(), "CubicHermite(Complex(2, 1.5), Complex(3, 0.1), Complex(-1, 0))\n"); + CORRADE_COMPARE(out, "CubicHermite(Complex(2, 1.5), Complex(3, 0.1), Complex(-1, 0))\n"); } void CubicHermiteTest::debugQuaternion() { - std::ostringstream out; + Containers::String out; Debug{&out} << CubicHermiteQuaternion{ {{2.0f, 1.5f, 0.3f}, 1.1f}, {{3.0f, 0.1f, 2.3f}, 0.7f}, {{-1.0f, 0.0f, 0.3f}, 0.4f}}; - CORRADE_COMPARE(out.str(), "CubicHermite(Quaternion({2, 1.5, 0.3}, 1.1), Quaternion({3, 0.1, 2.3}, 0.7), Quaternion({-1, 0, 0.3}, 0.4))\n"); + CORRADE_COMPARE(out, "CubicHermite(Quaternion({2, 1.5, 0.3}, 1.1), Quaternion({3, 0.1, 2.3}, 0.7), Quaternion({-1, 0, 0.3}, 0.4))\n"); } }}}} diff --git a/src/Magnum/Math/Test/DistanceTest.cpp b/src/Magnum/Math/Test/DistanceTest.cpp index 9aea45555..e98f2b95a 100644 --- a/src/Magnum/Math/Test/DistanceTest.cpp +++ b/src/Magnum/Math/Test/DistanceTest.cpp @@ -25,9 +25,8 @@ DEALINGS IN THE SOFTWARE. */ -#include +#include #include -#include #include "Magnum/Math/Constants.h" #include "Magnum/Math/Distance.h" @@ -237,12 +236,12 @@ void DistanceTest::pointPlaneNormalized() { void DistanceTest::pointPlaneNormalizedNotNormalized() { CORRADE_SKIP_IF_NO_DEBUG_ASSERT(); - std::ostringstream out; + Containers::String out; Error redirectError{&out}; Vector4 invalidPlane{2.0f, 2.0f, 2.0f, 0.0f}; Distance::pointPlaneNormalized({}, invalidPlane); - CORRADE_COMPARE(out.str(), "Math::Distance::pointPlaneNormalized(): plane normal Vector(2, 2, 2) is not normalized\n"); + CORRADE_COMPARE(out, "Math::Distance::pointPlaneNormalized(): plane normal Vector(2, 2, 2) is not normalized\n"); } }}}} diff --git a/src/Magnum/Math/Test/DualComplexTest.cpp b/src/Magnum/Math/Test/DualComplexTest.cpp index 892bd1474..acc01617b 100644 --- a/src/Magnum/Math/Test/DualComplexTest.cpp +++ b/src/Magnum/Math/Test/DualComplexTest.cpp @@ -25,9 +25,10 @@ DEALINGS IN THE SOFTWARE. */ -#include +#include +#include /* arraySize() */ +#include #include -#include #include "Magnum/Math/DualComplex.h" #include "Magnum/Math/DualQuaternion.h" @@ -406,11 +407,11 @@ void DualComplexTest::invertedNormalized() { void DualComplexTest::invertedNormalizedNotNormalized() { CORRADE_SKIP_IF_NO_DEBUG_ASSERT(); - std::ostringstream out; + Containers::String out; Error redirectError{&out}; DualComplex({-1.0f, -2.5f}, {}).invertedNormalized(); - CORRADE_COMPARE(out.str(), "Math::Complex::invertedNormalized(): Complex(-1, -2.5) is not normalized\n"); + CORRADE_COMPARE(out, "Math::Complex::invertedNormalized(): Complex(-1, -2.5) is not normalized\n"); } void DualComplexTest::rotation() { @@ -468,11 +469,11 @@ void DualComplexTest::matrix() { void DualComplexTest::matrixNotOrthogonal() { CORRADE_SKIP_IF_NO_DEBUG_ASSERT(); - std::ostringstream o; - Error redirectError{&o}; + Containers::String out; + Error redirectError{&out}; DualComplex::fromMatrix(Matrix3::rotation(23.0_degf)*Matrix3::translation({2.0f, 3.0f})*2); - CORRADE_COMPARE(o.str(), + CORRADE_COMPARE(out, "Math::DualComplex::fromMatrix(): the matrix doesn't represent rigid transformation:\n" "Matrix(1.84101, -0.781462, 1.33763,\n" " 0.781462, 1.84101, 7.08595,\n" @@ -522,10 +523,10 @@ void DualComplexTest::strictWeakOrdering() { } void DualComplexTest::debug() { - std::ostringstream o; + Containers::String out; - Debug(&o) << DualComplex({-1.0f, -2.5f}, {-3.0f, -7.5f}); - CORRADE_COMPARE(o.str(), "DualComplex({-1, -2.5}, {-3, -7.5})\n"); + Debug{&out} << DualComplex({-1.0f, -2.5f}, {-3.0f, -7.5f}); + CORRADE_COMPARE(out, "DualComplex({-1, -2.5}, {-3, -7.5})\n"); } }}}} diff --git a/src/Magnum/Math/Test/DualQuaternionTest.cpp b/src/Magnum/Math/Test/DualQuaternionTest.cpp index 4eea6dd07..73119825e 100644 --- a/src/Magnum/Math/Test/DualQuaternionTest.cpp +++ b/src/Magnum/Math/Test/DualQuaternionTest.cpp @@ -25,9 +25,10 @@ DEALINGS IN THE SOFTWARE. */ -#include +#include +#include /* arraySize() */ +#include #include -#include #include "Magnum/Math/DualQuaternion.h" #include "Magnum/Math/StrictWeakOrdering.h" @@ -443,11 +444,11 @@ void DualQuaternionTest::invertedNormalized() { void DualQuaternionTest::invertedNormalizedNotNormalized() { CORRADE_SKIP_IF_NO_DEBUG_ASSERT(); - std::ostringstream out; + Containers::String out; Error redirectError{&out}; DualQuaternion({{ 1.0f, 2.0f, 3.0f}, -4.0f}, {{ 2.5f, -3.1f, 3.3f}, 2.0f}).invertedNormalized(); - CORRADE_COMPARE(out.str(), "Math::DualQuaternion::invertedNormalized(): DualQuaternion({{1, 2, 3}, -4}, {{2.5, -3.1, 3.3}, 2}) is not normalized\n"); + CORRADE_COMPARE(out, "Math::DualQuaternion::invertedNormalized(): DualQuaternion({{1, 2, 3}, -4}, {{2.5, -3.1, 3.3}, 2}) is not normalized\n"); } void DualQuaternionTest::rotation() { @@ -471,11 +472,11 @@ void DualQuaternionTest::rotation() { void DualQuaternionTest::rotationNotNormalized() { CORRADE_SKIP_IF_NO_DEBUG_ASSERT(); - std::ostringstream out; + Containers::String out; Error redirectError{&out}; DualQuaternion::rotation(120.0_degf, Vector3(2.0f)); - CORRADE_COMPARE(out.str(), "Math::Quaternion::rotation(): axis Vector(2, 2, 2) is not normalized\n"); + CORRADE_COMPARE(out, "Math::Quaternion::rotation(): axis Vector(2, 2, 2) is not normalized\n"); } void DualQuaternionTest::translation() { @@ -525,11 +526,11 @@ void DualQuaternionTest::matrix() { void DualQuaternionTest::matrixNotOrthogonal() { CORRADE_SKIP_IF_NO_DEBUG_ASSERT(); - std::ostringstream out; + Containers::String out; Error redirectError{&out}; DualQuaternion::fromMatrix(Matrix4::rotationX(23.0_degf)*Matrix4::translation({-1.0f, 2.0f, 3.0f})*2); - CORRADE_COMPARE(out.str(), + CORRADE_COMPARE(out, "Math::DualQuaternion::fromMatrix(): the matrix doesn't represent a rigid transformation:\n" "Matrix(2, 0, 0, -2,\n" " 0, 1.84101, -0.781462, 1.33763,\n" @@ -562,13 +563,13 @@ void DualQuaternionTest::transformVectorNormalized() { void DualQuaternionTest::transformVectorNormalizedNotNormalized() { CORRADE_SKIP_IF_NO_DEBUG_ASSERT(); - std::ostringstream out; + Containers::String out; Error redirectError{&out}; Quaternion a = Quaternion::rotation(23.0_degf, Vector3::xAxis()); (a*2).transformVectorNormalized({}); /* Delegates to quaternion, so the assert prints Quaternion */ - CORRADE_COMPARE(out.str(), "Math::Quaternion::transformVectorNormalized(): Quaternion({0.398736, 0, 0}, 1.95985) is not normalized\n"); + CORRADE_COMPARE(out, "Math::Quaternion::transformVectorNormalized(): Quaternion({0.398736, 0, 0}, 1.95985) is not normalized\n"); } void DualQuaternionTest::transformPoint() { @@ -606,12 +607,12 @@ void DualQuaternionTest::transformPointNormalized() { void DualQuaternionTest::transformPointNormalizedNotNormalized() { CORRADE_SKIP_IF_NO_DEBUG_ASSERT(); - std::ostringstream out; + Containers::String out; Error redirectError{&out}; DualQuaternion a = DualQuaternion::translation({-1.0f, 2.0f, 3.0f})*DualQuaternion::rotation(23.0_degf, Vector3::xAxis()); (a*Dual(2)).transformPointNormalized({}); - CORRADE_COMPARE(out.str(), "Math::DualQuaternion::transformPointNormalized(): DualQuaternion({{0.398736, 0, 0}, 1.95985}, {{-0.979925, 2.55795, 2.54104}, 0.199368}) is not normalized\n"); + CORRADE_COMPARE(out, "Math::DualQuaternion::transformPointNormalized(): DualQuaternion({{0.398736, 0, 0}, 1.95985}, {{-0.979925, 2.55795, 2.54104}, 0.199368}) is not normalized\n"); } void DualQuaternionTest::sclerp() { @@ -726,10 +727,10 @@ void DualQuaternionTest::strictWeakOrdering() { } void DualQuaternionTest::debug() { - std::ostringstream o; + Containers::String out; - Debug(&o) << DualQuaternion({{1.0f, 2.0f, 3.0f}, -4.0f}, {{0.5f, -3.1f, 3.3f}, 2.0f}); - CORRADE_COMPARE(o.str(), "DualQuaternion({{1, 2, 3}, -4}, {{0.5, -3.1, 3.3}, 2})\n"); + Debug{&out} << DualQuaternion({{1.0f, 2.0f, 3.0f}, -4.0f}, {{0.5f, -3.1f, 3.3f}, 2.0f}); + CORRADE_COMPARE(out, "DualQuaternion({{1, 2, 3}, -4}, {{0.5, -3.1, 3.3}, 2})\n"); } }}}} diff --git a/src/Magnum/Math/Test/DualTest.cpp b/src/Magnum/Math/Test/DualTest.cpp index 2ebfab6f3..409e06000 100644 --- a/src/Magnum/Math/Test/DualTest.cpp +++ b/src/Magnum/Math/Test/DualTest.cpp @@ -24,9 +24,10 @@ DEALINGS IN THE SOFTWARE. */ -#include +#include +#include /* arraySize() */ +#include #include -#include #include "Magnum/Math/Dual.h" #include "Magnum/Math/Quaternion.h" @@ -385,10 +386,10 @@ void DualTest::subclass() { } void DualTest::debug() { - std::ostringstream o; + Containers::String out; - Debug(&o) << Dual(2.5f, -0.3f); - CORRADE_COMPARE(o.str(), "Dual(2.5, -0.3)\n"); + Debug{&out} << Dual(2.5f, -0.3f); + CORRADE_COMPARE(out, "Dual(2.5, -0.3)\n"); } }}}} diff --git a/src/Magnum/Math/Test/FrustumTest.cpp b/src/Magnum/Math/Test/FrustumTest.cpp index 605d984c7..a303d70f8 100644 --- a/src/Magnum/Math/Test/FrustumTest.cpp +++ b/src/Magnum/Math/Test/FrustumTest.cpp @@ -25,11 +25,11 @@ DEALINGS IN THE SOFTWARE. */ -#include +#include #include +#include #include #include -#include #include "Magnum/Math/Frustum.h" #include "Magnum/Math/StrictWeakOrdering.h" @@ -358,11 +358,11 @@ void FrustumTest::dataOutOfRange() { Frustum a; constexpr Frustum ca; - std::ostringstream out; + Containers::String out; Error redirectError{&out}; a[6]; ca[6]; - CORRADE_COMPARE(out.str(), + CORRADE_COMPARE(out, "Math::Frustum::operator[](): index 6 out of range\n" "Math::Frustum::operator[](): index 6 out of range\n"); } @@ -452,9 +452,9 @@ void FrustumTest::debug() { {-7.0f, 8.0f, -9.0f, 0.5f}, { 7.0f, -8.0f, 9.0f, 0.6f}}; - std::ostringstream out; + Containers::String out; Debug{&out} << frustum; - CORRADE_COMPARE(out.str(), "Frustum({-1, 2, -3, 0.1},\n" + CORRADE_COMPARE(out, "Frustum({-1, 2, -3, 0.1},\n" " {1, -2, 3, 0.2},\n" " {-4, 5, -6, 0.3},\n" " {4, -5, 6, 0.4},\n" diff --git a/src/Magnum/Math/Test/FunctionsTest.cpp b/src/Magnum/Math/Test/FunctionsTest.cpp index 5abba4f20..393bbb588 100644 --- a/src/Magnum/Math/Test/FunctionsTest.cpp +++ b/src/Magnum/Math/Test/FunctionsTest.cpp @@ -25,9 +25,8 @@ DEALINGS IN THE SOFTWARE. */ -#include +#include #include -#include #include "Magnum/Math/Functions.h" #include "Magnum/Math/Time.h" @@ -345,19 +344,19 @@ void FunctionsTest::binomialCoefficient() { void FunctionsTest::binomialCoefficientInvalidInput() { CORRADE_SKIP_IF_NO_DEBUG_ASSERT(); - std::ostringstream out; + Containers::String out; Error redirectError{&out}; Math::binomialCoefficient(15, 16); - CORRADE_COMPARE(out.str(), "Math::binomialCoefficient(): k can't be greater than n in (15 choose 16)\n"); + CORRADE_COMPARE(out, "Math::binomialCoefficient(): k can't be greater than n in (15 choose 16)\n"); } void FunctionsTest::binomialCoefficientOverflow() { CORRADE_SKIP_IF_NO_DEBUG_ASSERT(); - std::ostringstream out; + Containers::String out; Error redirectError{&out}; Math::binomialCoefficient(63, 31); - CORRADE_COMPARE(out.str(), "Math::binomialCoefficient(): overflow for (63 choose 31)\n"); + CORRADE_COMPARE(out, "Math::binomialCoefficient(): overflow for (63 choose 31)\n"); } void FunctionsTest::fmod() { @@ -590,10 +589,10 @@ void FunctionsTest::reflect() { void FunctionsTest::reflectNotNormalized() { CORRADE_SKIP_IF_NO_DEBUG_ASSERT(); - std::ostringstream out; + Containers::String out; Error redirectError{&out}; Math::reflect(Vector3{}, Vector3{1.0f}); - CORRADE_COMPARE(out.str(), + CORRADE_COMPARE(out, "Math::reflect(): normal Vector(1, 1, 1) is not normalized\n"); } @@ -617,10 +616,10 @@ void FunctionsTest::refract() { void FunctionsTest::refractNotNormalized() { CORRADE_SKIP_IF_NO_DEBUG_ASSERT(); - std::ostringstream out; + Containers::String out; Error redirectError{&out}; Math::refract(Vector3{}, Vector3{1.0f}, 0.0f); - CORRADE_COMPARE(out.str(), + CORRADE_COMPARE(out, "Math::refract(): vectors Vector(0, 0, 0) and Vector(1, 1, 1) are not normalized\n"); } diff --git a/src/Magnum/Math/Test/HalfTest.cpp b/src/Magnum/Math/Test/HalfTest.cpp index ed0200377..54b2103ab 100644 --- a/src/Magnum/Math/Test/HalfTest.cpp +++ b/src/Magnum/Math/Test/HalfTest.cpp @@ -24,11 +24,10 @@ DEALINGS IN THE SOFTWARE. */ -#include -#include +#include #include +#include #include -#include #if defined(CORRADE_TARGET_UNIX) || (defined(CORRADE_TARGET_WINDOWS) && !defined(CORRADE_TARGET_WINDOWS_RT)) || defined(CORRADE_TARGET_EMSCRIPTEN) #include #endif @@ -624,14 +623,14 @@ void HalfTest::literal() { } void HalfTest::debug() { - std::ostringstream out; + Containers::String out; Debug{&out} << -36.41_h << Half{Constants::inf()} << Math::Vector3{3.14159_h, -1.4142_h, 1.618_h}; #ifdef CORRADE_TARGET_MSVC - CORRADE_COMPARE(out.str(), "-36.41 inf Vector(3.141, -1.414, 1.618)\n"); + CORRADE_COMPARE(out, "-36.41 inf Vector(3.141, -1.414, 1.618)\n"); #else - CORRADE_COMPARE(out.str(), "-36.41 inf Vector(3.141, -1.414, 1.618)\n"); + CORRADE_COMPARE(out, "-36.41 inf Vector(3.141, -1.414, 1.618)\n"); #endif } @@ -648,11 +647,11 @@ void HalfTest::tweakableError() { auto&& data = TweakableErrorData[testCaseInstanceId()]; setTestCaseDescription(data.name); - std::ostringstream out; + Containers::String out; Warning redirectWarning{&out}; Error redirectError{&out}; Utility::TweakableState state = Utility::TweakableParser::parse(data.data).first(); - CORRADE_COMPARE(out.str(), data.error); + CORRADE_COMPARE(out, data.error); CORRADE_COMPARE(state, data.state); } #endif diff --git a/src/Magnum/Math/Test/IntersectionTest.cpp b/src/Magnum/Math/Test/IntersectionTest.cpp index f20862ee0..327deec0a 100644 --- a/src/Magnum/Math/Test/IntersectionTest.cpp +++ b/src/Magnum/Math/Test/IntersectionTest.cpp @@ -26,9 +26,8 @@ DEALINGS IN THE SOFTWARE. */ -#include +#include #include -#include #include "Magnum/Math/Intersection.h" @@ -460,11 +459,11 @@ void IntersectionTest::sphereConeView() { void IntersectionTest::sphereConeViewNotRigid() { CORRADE_SKIP_IF_NO_DEBUG_ASSERT(); - std::ostringstream out; + Containers::String out; Error redirectError{&out}; CORRADE_VERIFY(!Intersection::sphereConeView({}, 1.0f, Matrix4{ZeroInit}, {})); - CORRADE_COMPARE(out.str(), + CORRADE_COMPARE(out, "Math::Intersection::sphereConeView(): coneView does not represent a rigid transformation:\n" "Matrix(0, 0, 0, 0,\n" " 0, 0, 0, 0,\n" diff --git a/src/Magnum/Math/Test/Matrix3Test.cpp b/src/Magnum/Math/Test/Matrix3Test.cpp index a5d9f0e93..ca1f7ace1 100644 --- a/src/Magnum/Math/Test/Matrix3Test.cpp +++ b/src/Magnum/Math/Test/Matrix3Test.cpp @@ -24,9 +24,9 @@ DEALINGS IN THE SOFTWARE. */ -#include +#include +#include #include -#include #include "Magnum/Math/Matrix3.h" #include "Magnum/Math/StrictWeakOrdering.h" @@ -483,11 +483,11 @@ void Matrix3Test::reflection() { void Matrix3Test::reflectionNotNormalized() { CORRADE_SKIP_IF_NO_DEBUG_ASSERT(); - std::ostringstream out; + Containers::String out; Error redirectError{&out}; Matrix3::reflection({-1.0f, 2.0f}); - CORRADE_COMPARE(out.str(), "Math::Matrix3::reflection(): normal Vector(-1, 2) is not normalized\n"); + CORRADE_COMPARE(out, "Math::Matrix3::reflection(): normal Vector(-1, 2) is not normalized\n"); } void Matrix3Test::reflectionIsScaling() { @@ -611,7 +611,7 @@ void Matrix3Test::rotationPart() { void Matrix3Test::rotationPartNotOrthogonal() { CORRADE_SKIP_IF_NO_DEBUG_ASSERT(); - std::ostringstream out; + Containers::String out; Error redirectError{&out}; /* Test both non-orthogonality and "unnormalizable" scaling */ @@ -619,7 +619,7 @@ void Matrix3Test::rotationPartNotOrthogonal() { Matrix3::scaling(Vector2::yScale(0.0f)).rotation(); #ifdef CORRADE_TARGET_MSVC - CORRADE_COMPARE(out.str(), + CORRADE_COMPARE(out, "Math::Matrix3::rotation(): the normalized rotation part is not orthogonal:\n" "Matrix(1, 0.83205,\n" " 0, 0.5547)\n" @@ -639,9 +639,9 @@ void Matrix3Test::rotationPartNotOrthogonal() { "Math::Matrix3::rotation(): the normalized rotation part is not orthogonal:\n" "Matrix(1, nan,\n" " 0, nan)\n"; - if(out.str() == expectedPositive) - CORRADE_COMPARE(out.str(), expectedPositive); - else CORRADE_COMPARE(out.str(), + if(out == expectedPositive) + CORRADE_COMPARE(out, expectedPositive); + else CORRADE_COMPARE(out, "Math::Matrix3::rotation(): the normalized rotation part is not orthogonal:\n" "Matrix(1, 0.83205,\n" " 0, 0.5547)\n" @@ -663,7 +663,7 @@ void Matrix3Test::rotationNormalizedPart() { void Matrix3Test::rotationNormalizedPartNotOrthogonal() { CORRADE_SKIP_IF_NO_DEBUG_ASSERT(); - std::ostringstream out; + Containers::String out; Error redirectError{&out}; Matrix3 a({1.0f, 0.0f, 8.0f}, @@ -671,7 +671,7 @@ void Matrix3Test::rotationNormalizedPartNotOrthogonal() { {7.0f, -1.0f, 8.0f}); a.rotationNormalized(); - CORRADE_COMPARE(out.str(), + CORRADE_COMPARE(out, "Math::Matrix3::rotationNormalized(): the rotation part is not orthogonal:\n" "Matrix(1, 1,\n" " 0, 0.1)\n"); @@ -725,10 +725,10 @@ void Matrix3Test::uniformScalingPart() { void Matrix3Test::uniformScalingPartNotUniform() { CORRADE_SKIP_IF_NO_DEBUG_ASSERT(); - std::ostringstream out; + Containers::String out; Error redirectError{&out}; Matrix3::scaling(Vector2::yScale(3.0f)).uniformScaling(); - CORRADE_COMPARE(out.str(), + CORRADE_COMPARE(out, "Math::Matrix3::uniformScaling(): the matrix doesn't have uniform scaling:\n" "Matrix(1, 0,\n" " 0, 3)\n"); @@ -771,11 +771,11 @@ void Matrix3Test::invertedRigid() { void Matrix3Test::invertedRigidNotRigid() { CORRADE_SKIP_IF_NO_DEBUG_ASSERT(); - std::ostringstream out; + Containers::String out; Error redirectError{&out}; (Matrix3::rotation(60.0_degf)*2.0f).invertedRigid(); - CORRADE_COMPARE(out.str(), + CORRADE_COMPARE(out, "Math::Matrix3::invertedRigid(): the matrix doesn't represent a rigid transformation:\n" "Matrix(1, -1.73205, 0,\n" " 1.73205, 1, 0,\n" @@ -811,9 +811,9 @@ void Matrix3Test::debug() { {4.0f, 4.0f, 7.0f}, {7.0f, -1.0f, 8.0f}); - std::ostringstream o; - Debug(&o) << m; - CORRADE_COMPARE(o.str(), "Matrix(3, 4, 7,\n" + Containers::String out; + Debug{&out} << m; + CORRADE_COMPARE(out, "Matrix(3, 4, 7,\n" " 5, 4, -1,\n" " 8, 7, 8)\n"); } diff --git a/src/Magnum/Math/Test/Matrix4Test.cpp b/src/Magnum/Math/Test/Matrix4Test.cpp index e06208367..73229ae0d 100644 --- a/src/Magnum/Math/Test/Matrix4Test.cpp +++ b/src/Magnum/Math/Test/Matrix4Test.cpp @@ -24,10 +24,10 @@ DEALINGS IN THE SOFTWARE. */ -#include +#include +#include #include #include -#include #include "Magnum/Math/Matrix4.h" #include "Magnum/Math/StrictWeakOrdering.h" @@ -552,11 +552,11 @@ void Matrix4Test::rotation() { void Matrix4Test::rotationNotNormalized() { CORRADE_SKIP_IF_NO_DEBUG_ASSERT(); - std::ostringstream out; + Containers::String out; Error redirectError{&out}; Matrix4::rotation(-74.0_degf, {-1.0f, 2.0f, 2.0f}); - CORRADE_COMPARE(out.str(), "Math::Matrix4::rotation(): axis Vector(-1, 2, 2) is not normalized\n"); + CORRADE_COMPARE(out, "Math::Matrix4::rotation(): axis Vector(-1, 2, 2) is not normalized\n"); } void Matrix4Test::rotationX() { @@ -602,11 +602,11 @@ void Matrix4Test::reflection() { void Matrix4Test::reflectionNotNormalized() { CORRADE_SKIP_IF_NO_DEBUG_ASSERT(); - std::ostringstream out; + Containers::String out; Error redirectError{&out}; Matrix4::reflection({-1.0f, 2.0f, 2.0f}); - CORRADE_COMPARE(out.str(), "Math::Matrix4::reflection(): normal Vector(-1, 2, 2) is not normalized\n"); + CORRADE_COMPARE(out, "Math::Matrix4::reflection(): normal Vector(-1, 2, 2) is not normalized\n"); } void Matrix4Test::reflectionIsScaling() { @@ -864,7 +864,7 @@ void Matrix4Test::rotationPart() { void Matrix4Test::rotationPartNotOrthogonal() { CORRADE_SKIP_IF_NO_DEBUG_ASSERT(); - std::ostringstream out; + Containers::String out; Error redirectError{&out}; /* Test both non-orthogonality and "unnormalizable" scaling */ @@ -872,7 +872,7 @@ void Matrix4Test::rotationPartNotOrthogonal() { Matrix4::scaling(Vector3::yScale(0.0f)).rotation(); #ifdef CORRADE_TARGET_MSVC - CORRADE_COMPARE(out.str(), + CORRADE_COMPARE(out, "Math::Matrix4::rotation(): the normalized rotation part is not orthogonal:\n" "Matrix(1, 0, 0.83205,\n" " 0, 1, 0,\n" @@ -896,9 +896,9 @@ void Matrix4Test::rotationPartNotOrthogonal() { "Matrix(1, nan, 0,\n" " 0, nan, 0,\n" " 0, nan, 1)\n"; - if(out.str() == expectedPositive) - CORRADE_COMPARE(out.str(), expectedPositive); - else CORRADE_COMPARE(out.str(), + if(out == expectedPositive) + CORRADE_COMPARE(out, expectedPositive); + else CORRADE_COMPARE(out, "Math::Matrix4::rotation(): the normalized rotation part is not orthogonal:\n" "Matrix(1, 0, 0.83205,\n" " 0, 1, 0,\n" @@ -924,7 +924,7 @@ void Matrix4Test::rotationNormalizedPart() { void Matrix4Test::rotationNormalizedPartNotOrthogonal() { CORRADE_SKIP_IF_NO_DEBUG_ASSERT(); - std::ostringstream out; + Containers::String out; Error redirectError{&out}; Matrix4 a({0.0f, 0.0f, 1.0f, 4.0f}, @@ -932,7 +932,7 @@ void Matrix4Test::rotationNormalizedPartNotOrthogonal() { {0.0f, -1.0f, 0.1f, 0.0f}, {9.0f, 4.0f, 5.0f, 9.0f}); a.rotationNormalized(); - CORRADE_COMPARE(out.str(), + CORRADE_COMPARE(out, "Math::Matrix4::rotationNormalized(): the rotation part is not orthogonal:\n" "Matrix(0, 1, 0,\n" " 0, 0, -1,\n" @@ -987,9 +987,9 @@ void Matrix4Test::uniformScalingPart() { void Matrix4Test::uniformScalingPartNotUniform() { CORRADE_SKIP_IF_NO_DEBUG_ASSERT(); - std::ostringstream out; + Containers::String out; Error redirectError{&out}; Matrix4::scaling(Vector3::yScale(3.0f)).uniformScaling(); - CORRADE_COMPARE(out.str(), "Math::Matrix4::uniformScaling(): the matrix doesn't have uniform scaling:\n" + CORRADE_COMPARE(out, "Math::Matrix4::uniformScaling(): the matrix doesn't have uniform scaling:\n" "Matrix(1, 0, 0,\n" " 0, 3, 0,\n" " 0, 0, 1)\n"); @@ -1176,11 +1176,11 @@ void Matrix4Test::invertedRigid() { void Matrix4Test::invertedRigidNotRigid() { CORRADE_SKIP_IF_NO_DEBUG_ASSERT(); - std::ostringstream out; + Containers::String out; Error redirectError{&out}; (Matrix4::rotationX(-60.0_degf)*2.0f).invertedRigid(); - CORRADE_COMPARE(out.str(), + CORRADE_COMPARE(out, "Math::Matrix4::invertedRigid(): the matrix doesn't represent a rigid transformation:\n" "Matrix(2, 0, 0, 0,\n" " 0, 1, 1.73205, 0,\n" @@ -1225,9 +1225,9 @@ void Matrix4Test::debug() { {7.0f, -1.0f, 8.0f, 0.0f}, {9.0f, 4.0f, 5.0f, 9.0f}); - std::ostringstream o; - Debug(&o) << m; - CORRADE_COMPARE(o.str(), "Matrix(3, 4, 7, 9,\n" + Containers::String out; + Debug{&out} << m; + CORRADE_COMPARE(out, "Matrix(3, 4, 7, 9,\n" " 5, 4, -1, 4,\n" " 8, 7, 8, 5,\n" " 4, 3, 0, 9)\n"); diff --git a/src/Magnum/Math/Test/MatrixTest.cpp b/src/Magnum/Math/Test/MatrixTest.cpp index 8eb2e9634..f2889b1d7 100644 --- a/src/Magnum/Math/Test/MatrixTest.cpp +++ b/src/Magnum/Math/Test/MatrixTest.cpp @@ -24,9 +24,9 @@ DEALINGS IN THE SOFTWARE. */ -#include +#include +#include #include -#include #include "Magnum/Math/Matrix.h" #include "Magnum/Math/StrictWeakOrdering.h" @@ -536,14 +536,14 @@ void MatrixTest::invertedOrthogonal() { void MatrixTest::invertedOrthogonalNotOrthogonal() { CORRADE_SKIP_IF_NO_DEBUG_ASSERT(); - std::ostringstream o; - Error redirectError{&o}; + Containers::String out; + Error redirectError{&out}; Matrix3x3 a(Vector3(Constants::sqrt3()/2.0f, 0.5f, 0.0f), Vector3(-0.5f, Constants::sqrt3()/2.0f, 0.0f), Vector3(0.0f, 0.0f, 1.0f)); (a*2).invertedOrthogonal(); - CORRADE_COMPARE(o.str(), + CORRADE_COMPARE(out, "Math::Matrix::invertedOrthogonal(): the matrix is not orthogonal:\n" "Matrix(1.73205, -1, 0,\n" " 1, 1.73205, 0,\n" @@ -631,16 +631,16 @@ void MatrixTest::debug() { Vector4(7.0f, -1.0f, 8.0f, 0.0f), Vector4(9.0f, 4.0f, 5.0f, 9.0f)); - std::ostringstream o; - Debug(&o) << m; - CORRADE_COMPARE(o.str(), "Matrix(3, 4, 7, 9,\n" + Containers::String out; + Debug{&out} << m; + CORRADE_COMPARE(out, "Matrix(3, 4, 7, 9,\n" " 5, 4, -1, 4,\n" " 8, 7, 8, 5,\n" " 4, 3, 0, 9)\n"); - o.str({}); - Debug(&o) << "a" << Matrix4x4() << "b" << Matrix4x4(); - CORRADE_COMPARE(o.str(), "a Matrix(1, 0, 0, 0,\n" + out = {}; + Debug{&out} << "a" << Matrix4x4() << "b" << Matrix4x4(); + CORRADE_COMPARE(out, "a Matrix(1, 0, 0, 0,\n" " 0, 1, 0, 0,\n" " 0, 0, 1, 0,\n" " 0, 0, 0, 1) b Matrix(1, 0, 0, 0,\n" diff --git a/src/Magnum/Math/Test/PackingBatchTest.cpp b/src/Magnum/Math/Test/PackingBatchTest.cpp index f16214292..eb3b76838 100644 --- a/src/Magnum/Math/Test/PackingBatchTest.cpp +++ b/src/Magnum/Math/Test/PackingBatchTest.cpp @@ -24,11 +24,10 @@ DEALINGS IN THE SOFTWARE. */ -#include #include +#include #include #include -#include #include "Magnum/Math/Color.h" #include "Magnum/Math/Packing.h" @@ -674,7 +673,7 @@ template void PackingBatchTest::assertionsPackUnpack() { auto dstNotContiguous = Containers::arrayCast<2, Float>( Containers::arrayView(resultNonContiguous)).every({1, 2}); - std::ostringstream out; + Containers::String out; Error redirectError{&out}; unpackInto(src, dstWrongCount); unpackInto(src, dstWrongVectorSize); @@ -684,7 +683,7 @@ template void PackingBatchTest::assertionsPackUnpack() { packInto(dstWrongVectorSize, src); packInto(dstNotContiguous, src); packInto(dst, srcNonContiguous); - CORRADE_COMPARE(out.str(), + CORRADE_COMPARE(out, "Math::unpackInto(): wrong destination size, got {1, 2} but expected {2, 2}\n" "Math::unpackInto(): wrong destination size, got {2, 3} but expected {2, 2}\n" "Math::unpackInto(): second destination view dimension is not contiguous\n" @@ -718,7 +717,7 @@ void PackingBatchTest::assertionsPackUnpackHalf() { auto dstNotContiguous = Containers::arrayCast<2, Float>( Containers::arrayView(resultNonContiguous)).every({1, 2}); - std::ostringstream out; + Containers::String out; Error redirectError{&out}; unpackHalfInto(src, dstWrongCount); unpackHalfInto(src, dstWrongVectorSize); @@ -728,7 +727,7 @@ void PackingBatchTest::assertionsPackUnpackHalf() { packHalfInto(dstWrongVectorSize, src); packHalfInto(dstNotContiguous, src); packHalfInto(dst, srcNonContiguous); - CORRADE_COMPARE(out.str(), + CORRADE_COMPARE(out, "Math::unpackHalfInto(): wrong destination size, got {1, 2} but expected {2, 2}\n" "Math::unpackHalfInto(): wrong destination size, got {2, 3} but expected {2, 2}\n" "Math::unpackHalfInto(): second destination view dimension is not contiguous\n" @@ -758,7 +757,7 @@ template void PackingBatchTest::assertionsCast() { auto dstNotContiguous = Containers::arrayCast<2, U>( Containers::arrayView(resultNonContiguous)).every({1, 2}); - std::ostringstream out; + Containers::String out; Error redirectError{&out}; castInto(src, dstWrongCount); castInto(src, dstWrongVectorSize); @@ -766,7 +765,7 @@ template void PackingBatchTest::assertionsCast() { castInto(dstWrongCount, src); castInto(dstWrongVectorSize, src); castInto(dstNotContiguous, src); - CORRADE_COMPARE(out.str(), + CORRADE_COMPARE(out, "Math::castInto(): wrong destination size, got {1, 2} but expected {2, 2}\n" "Math::castInto(): wrong destination size, got {2, 3} but expected {2, 2}\n" "Math::castInto(): second destination view dimension is not contiguous\n" diff --git a/src/Magnum/Math/Test/QuaternionTest.cpp b/src/Magnum/Math/Test/QuaternionTest.cpp index e92a20705..704a882b9 100644 --- a/src/Magnum/Math/Test/QuaternionTest.cpp +++ b/src/Magnum/Math/Test/QuaternionTest.cpp @@ -24,10 +24,11 @@ DEALINGS IN THE SOFTWARE. */ -#include +#include +#include /* arraySize() */ +#include #include #include -#include #include "Magnum/Math/Functions.h" #include "Magnum/Math/Matrix4.h" @@ -395,13 +396,13 @@ void QuaternionTest::axisAngle() { void QuaternionTest::axisAngleNotNormalized() { CORRADE_SKIP_IF_NO_DEBUG_ASSERT(); - std::ostringstream out; + Containers::String out; Error redirectError{&out}; Quaternion a = Quaternion::rotation(23.0_degf, {0.6f, -0.8f, 0.0f})*2; a.angle(); a.axis(); - CORRADE_COMPARE(out.str(), + CORRADE_COMPARE(out, "Math::Quaternion::angle(): Quaternion({0.239242, -0.318989, 0}, 1.95985) is not normalized\n" "Math::Quaternion::axis(): Quaternion({0.239242, -0.318989, 0}, 1.95985) is not normalized\n"); } @@ -498,11 +499,11 @@ void QuaternionTest::invertedNormalized() { void QuaternionTest::invertedNormalizedNotNormalized() { CORRADE_SKIP_IF_NO_DEBUG_ASSERT(); - std::ostringstream out; + Containers::String out; Error redirectError{&out}; Quaternion{{1.0f, 3.0f, -2.0f}, -4.0f}.invertedNormalized(); - CORRADE_COMPARE(out.str(), "Math::Quaternion::invertedNormalized(): Quaternion({1, 3, -2}, -4) is not normalized\n"); + CORRADE_COMPARE(out, "Math::Quaternion::invertedNormalized(): Quaternion({1, 3, -2}, -4) is not normalized\n"); } void QuaternionTest::rotation() { @@ -528,11 +529,11 @@ void QuaternionTest::rotation() { void QuaternionTest::rotationNotNormalized() { CORRADE_SKIP_IF_NO_DEBUG_ASSERT(); - std::ostringstream out; + Containers::String out; Error redirectError{&out}; Quaternion::rotation(-74.0_degf, {-1.0f, 2.0f, 2.0f}); - CORRADE_COMPARE(out.str(), "Math::Quaternion::rotation(): axis Vector(-1, 2, 2) is not normalized\n"); + CORRADE_COMPARE(out, "Math::Quaternion::rotation(): axis Vector(-1, 2, 2) is not normalized\n"); } void QuaternionTest::rotationFromTwoVectors() { @@ -599,12 +600,12 @@ void QuaternionTest::rotationFromTwoVectors() { void QuaternionTest::rotationFromTwoVectorsNotNormalized() { CORRADE_SKIP_IF_NO_DEBUG_ASSERT(); - std::ostringstream out; + Containers::String out; Error redirectError{&out}; Quaternion::rotation({2.0f, 0.0f, 0.0f}, {0.0f, 1.0f, 0.0f}); Quaternion::rotation({1.0f, 0.0f, 0.0f}, {0.0f, 2.0f, 0.0f}); - CORRADE_COMPARE(out.str(), + CORRADE_COMPARE(out, "Math::Quaternion::rotation(): vectors Vector(2, 0, 0) and Vector(0, 1, 0) are not normalized\n" "Math::Quaternion::rotation(): vectors Vector(1, 0, 0) and Vector(0, 2, 0) are not normalized\n"); } @@ -619,10 +620,10 @@ void QuaternionTest::reflection() { void QuaternionTest::reflectionNotNormalized() { CORRADE_SKIP_IF_NO_DEBUG_ASSERT(); - std::ostringstream out; + Containers::String out; Error redirectError{&out}; Quaternion::reflection({-1.0f, 2.0f, 2.0f}); - CORRADE_COMPARE(out.str(), "Math::Quaternion::reflection(): normal Vector(-1, 2, 2) is not normalized\n"); + CORRADE_COMPARE(out, "Math::Quaternion::reflection(): normal Vector(-1, 2, 2) is not normalized\n"); } void QuaternionTest::angle() { @@ -666,13 +667,13 @@ void QuaternionTest::angleNormalizedButOver1() { void QuaternionTest::angleNotNormalized() { CORRADE_SKIP_IF_NO_DEBUG_ASSERT(); - std::ostringstream out; + Containers::String out; Error redirectError{&out}; Math::halfAngle(Quaternion{{1.0f, 2.0f, -3.0f}, -4.0f}.normalized(), {{4.0f, -3.0f, 2.0f}, -1.0f}); Math::halfAngle({{1.0f, 2.0f, -3.0f}, -4.0f}, Quaternion{{4.0f, -3.0f, 2.0f}, -1.0f}.normalized()); - CORRADE_COMPARE(out.str(), + CORRADE_COMPARE(out, "Math::halfAngle(): quaternions Quaternion({0.182574, 0.365148, -0.547723}, -0.730297) and Quaternion({4, -3, 2}, -1) are not normalized\n" "Math::halfAngle(): quaternions Quaternion({1, 2, -3}, -4) and Quaternion({0.730297, -0.547723, 0.365148}, -0.182574) are not normalized\n"); } @@ -729,7 +730,7 @@ void QuaternionTest::matrix() { void QuaternionTest::matrixNotRotation() { CORRADE_SKIP_IF_NO_DEBUG_ASSERT(); - std::ostringstream out; + Containers::String out; Error redirectError{&out}; /* Shear, using rotationShear() instead of rotationScaling() as that isn't supposed to "fix" the shear */ @@ -739,7 +740,7 @@ void QuaternionTest::matrixNotRotation() { supposed to "fix" the reflection either */ Quaternion::fromMatrix((Matrix4::scaling({-1.0f, 1.0f, 1.0f})* Matrix4::rotationZ(45.0_degf)).rotation()); - CORRADE_COMPARE(out.str(), + CORRADE_COMPARE(out, "Math::Quaternion::fromMatrix(): the matrix is not a rotation:\n" "Matrix(0.894427, -0.894427, 0,\n" " 0.447214, 0.447214, 0,\n" @@ -773,11 +774,11 @@ void QuaternionTest::euler() { void QuaternionTest::eulerNotNormalized() { CORRADE_SKIP_IF_NO_DEBUG_ASSERT(); - std::ostringstream out; + Containers::String out; Error redirectError{&out}; Quaternion{{1.0f, 3.0f, -2.0f}, -4.0f}.toEuler(); - CORRADE_COMPARE(out.str(), + CORRADE_COMPARE(out, "Math::Quaternion::toEuler(): Quaternion({1, 3, -2}, -4) is not normalized\n"); } @@ -810,13 +811,13 @@ void QuaternionTest::lerp2D() { void QuaternionTest::lerpNotNormalized() { CORRADE_SKIP_IF_NO_DEBUG_ASSERT(); - std::ostringstream out; + Containers::String out; Error redirectError{&out}; Quaternion a; Math::lerp(a*3.0f, a, 0.35f); Math::lerp(a, a*-3.0f, 0.35f); - CORRADE_COMPARE(out.str(), + CORRADE_COMPARE(out, "Math::lerp(): quaternions Quaternion({0, 0, 0}, 3) and Quaternion({0, 0, 0}, 1) are not normalized\n" "Math::lerp(): quaternions Quaternion({0, 0, 0}, 1) and Quaternion({-0, -0, -0}, -3) are not normalized\n"); } @@ -842,14 +843,14 @@ void QuaternionTest::lerpShortestPath() { void QuaternionTest::lerpShortestPathNotNormalized() { CORRADE_SKIP_IF_NO_DEBUG_ASSERT(); - std::ostringstream out; + Containers::String out; Error redirectError{&out}; Quaternion a; Math::lerpShortestPath(a*3.0f, a, 0.35f); Math::lerpShortestPath(a, a*-3.0f, 0.35f); /* lerpShortestPath() is calling lerp(), so the message is from there */ - CORRADE_COMPARE(out.str(), + CORRADE_COMPARE(out, "Math::lerp(): quaternions Quaternion({0, 0, 0}, 3) and Quaternion({0, 0, 0}, 1) are not normalized\n" "Math::lerp(): quaternions Quaternion({-0, -0, -0}, -1) and Quaternion({-0, -0, -0}, -3) are not normalized\n"); } @@ -927,13 +928,13 @@ void QuaternionTest::slerpNormalizedButOver1() { void QuaternionTest::slerpNotNormalized() { CORRADE_SKIP_IF_NO_DEBUG_ASSERT(); - std::ostringstream out; + Containers::String out; Error redirectError{&out}; Quaternion a; Math::slerp(a*3.0f, a, 0.35f); Math::slerp(a, a*-3.0f, 0.35f); - CORRADE_COMPARE(out.str(), + CORRADE_COMPARE(out, "Math::slerp(): quaternions Quaternion({0, 0, 0}, 3) and Quaternion({0, 0, 0}, 1) are not normalized\n" "Math::slerp(): quaternions Quaternion({0, 0, 0}, 1) and Quaternion({-0, -0, -0}, -3) are not normalized\n"); } @@ -988,13 +989,13 @@ template void QuaternionTest::slerpShortestPathLinearFallbackIsNormaliz void QuaternionTest::slerpShortestPathNotNormalized() { CORRADE_SKIP_IF_NO_DEBUG_ASSERT(); - std::ostringstream out; + Containers::String out; Error redirectError{&out}; Quaternion a; Math::slerpShortestPath(a*3.0f, a, 0.35f); Math::slerpShortestPath(a, a*-3.0f, 0.35f); - CORRADE_COMPARE(out.str(), + CORRADE_COMPARE(out, "Math::slerpShortestPath(): quaternions Quaternion({0, 0, 0}, 3) and Quaternion({0, 0, 0}, 1) are not normalized\n" "Math::slerpShortestPath(): quaternions Quaternion({0, 0, 0}, 1) and Quaternion({-0, -0, -0}, -3) are not normalized\n"); } @@ -1022,12 +1023,12 @@ void QuaternionTest::transformVectorNormalized() { void QuaternionTest::transformVectorNormalizedNotNormalized() { CORRADE_SKIP_IF_NO_DEBUG_ASSERT(); - std::ostringstream out; + Containers::String out; Error redirectError{&out}; Quaternion a = Quaternion::rotation(23.0_degf, Vector3::xAxis()); (a*2).transformVectorNormalized({}); - CORRADE_COMPARE(out.str(), "Math::Quaternion::transformVectorNormalized(): Quaternion({0.398736, 0, 0}, 1.95985) is not normalized\n"); + CORRADE_COMPARE(out, "Math::Quaternion::transformVectorNormalized(): Quaternion({0.398736, 0, 0}, 1.95985) is not normalized\n"); } void QuaternionTest::reflectVector() { @@ -1066,10 +1067,10 @@ void QuaternionTest::strictWeakOrdering() { } void QuaternionTest::debug() { - std::ostringstream o; + Containers::String out; - Debug(&o) << Quaternion({1.0f, 2.0f, 3.0f}, -4.0f); - CORRADE_COMPARE(o.str(), "Quaternion({1, 2, 3}, -4)\n"); + Debug{&out} << Quaternion({1.0f, 2.0f, 3.0f}, -4.0f); + CORRADE_COMPARE(out, "Quaternion({1, 2, 3}, -4)\n"); } }}}} diff --git a/src/Magnum/Math/Test/RangeTest.cpp b/src/Magnum/Math/Test/RangeTest.cpp index 366a71a85..25da51002 100644 --- a/src/Magnum/Math/Test/RangeTest.cpp +++ b/src/Magnum/Math/Test/RangeTest.cpp @@ -24,9 +24,9 @@ DEALINGS IN THE SOFTWARE. */ -#include +#include +#include #include -#include #include "Magnum/Math/FunctionsBatch.h" #include "Magnum/Math/Range.h" @@ -1009,17 +1009,17 @@ void RangeTest::subclass() { } void RangeTest::debug() { - std::ostringstream o; - Debug(&o) << Range2Di({34, 23}, {47, 30}); + Containers::String out; + Debug{&out} << Range2Di({34, 23}, {47, 30}); - CORRADE_COMPARE(o.str(), "Range({34, 23}, {47, 30})\n"); + CORRADE_COMPARE(out, "Range({34, 23}, {47, 30})\n"); } void RangeTest::debugPacked() { - std::ostringstream out; + Containers::String out; /* Second is not packed, the first should not make any flags persistent */ Debug{&out} << Debug::packed << Range2Di{{34, 23}, {47, 30}} << Range2Di{}; - CORRADE_COMPARE(out.str(), "{{34, 23}, {47, 30}} Range({0, 0}, {0, 0})\n"); + CORRADE_COMPARE(out, "{{34, 23}, {47, 30}} Range({0, 0}, {0, 0})\n"); } }}}} diff --git a/src/Magnum/Math/Test/RectangularMatrixTest.cpp b/src/Magnum/Math/Test/RectangularMatrixTest.cpp index 051cc5c56..6783be8a1 100644 --- a/src/Magnum/Math/Test/RectangularMatrixTest.cpp +++ b/src/Magnum/Math/Test/RectangularMatrixTest.cpp @@ -24,9 +24,10 @@ DEALINGS IN THE SOFTWARE. */ -#include +#include +#include /* arraySize() */ +#include #include -#include #include "Magnum/Math/RectangularMatrix.h" #include "Magnum/Math/StrictWeakOrdering.h" @@ -988,16 +989,16 @@ void RectangularMatrixTest::debug() { Vector4(4.0f, 4.0f, 7.0f, 3.0f), Vector4(7.0f, -1.0f, 8.0f, 0.0f)); - std::ostringstream o; - Debug(&o) << m; - CORRADE_COMPARE(o.str(), "Matrix(3, 4, 7,\n" + Containers::String out; + Debug{&out} << m; + CORRADE_COMPARE(out, "Matrix(3, 4, 7,\n" " 5, 4, -1,\n" " 8, 7, 8,\n" " 4, 3, 0)\n"); - o.str({}); - Debug(&o) << "a" << Matrix3x4() << "b" << RectangularMatrix<4, 3, Byte>(); - CORRADE_COMPARE(o.str(), "a Matrix(0, 0, 0,\n" + out = {}; + Debug{&out} << "a" << Matrix3x4() << "b" << RectangularMatrix<4, 3, Byte>(); + CORRADE_COMPARE(out, "a Matrix(0, 0, 0,\n" " 0, 0, 0,\n" " 0, 0, 0,\n" " 0, 0, 0) b Matrix(0, 0, 0, 0,\n" @@ -1010,10 +1011,10 @@ void RectangularMatrixTest::debugPacked() { Vector4(4.0f, 4.0f, 7.0f, 3.0f), Vector4(7.0f, -1.0f, 8.0f, 0.0f)); - std::ostringstream out; + Containers::String out; /* Second is not packed, the first should not make any flags persistent */ Debug{&out} << Debug::packed << m << Matrix2x2{}; - CORRADE_COMPARE(out.str(), + CORRADE_COMPARE(out, "{3, 4, 7,\n" " 5, 4, -1,\n" " 8, 7, 8,\n" diff --git a/src/Magnum/Math/Test/TimeTest.cpp b/src/Magnum/Math/Test/TimeTest.cpp index 0fb3a584d..86c150ed0 100644 --- a/src/Magnum/Math/Test/TimeTest.cpp +++ b/src/Magnum/Math/Test/TimeTest.cpp @@ -25,9 +25,8 @@ */ #include -#include /** @todo remove once Debug is STL-free */ +#include #include -#include /** @todo remove once Debug is STL-free */ #include "Magnum/Math/Time.h" @@ -405,37 +404,37 @@ void TimeTest::nanosecondFloatScaling() { } void TimeTest::debugNanoseconds() { - std::ostringstream out; + Containers::String out; /* Also verify that the second expression compiles (it's the Unit type, not Nanoseconds) */ Debug{&out} << 987654321987654321_nsec << 15.0_sec - 7.5_sec; - CORRADE_COMPARE(out.str(), "Nanoseconds(987654321987654321) Nanoseconds(7500000000)\n"); + CORRADE_COMPARE(out, "Nanoseconds(987654321987654321) Nanoseconds(7500000000)\n"); } void TimeTest::debugNanosecondsPacked() { - std::ostringstream out; + Containers::String out; /* Second is not packed, the first should not make any flags persistent */ Debug{&out} << Debug::packed << 15.0_sec << 45.0_sec; - CORRADE_COMPARE(out.str(), "15000000000 Nanoseconds(45000000000)\n"); + CORRADE_COMPARE(out, "15000000000 Nanoseconds(45000000000)\n"); } void TimeTest::debugSeconds() { - std::ostringstream out; + Containers::String out; /* Also verify that the second expression compiles (it's the Unit type, not Nanoseconds) */ Debug{&out} << Seconds{123.45_sec} << Seconds{15.0_sec} - Seconds{7.5_sec}; - CORRADE_COMPARE(out.str(), "Seconds(123.45) Seconds(7.5)\n"); + CORRADE_COMPARE(out, "Seconds(123.45) Seconds(7.5)\n"); } void TimeTest::debugSecondsPacked() { - std::ostringstream out; + Containers::String out; /* Second is not packed, the first should not make any flags persistent */ Debug{&out} << Debug::packed << Seconds{123.45_sec} << Seconds{45.0_sec}; - CORRADE_COMPARE(out.str(), "123.45 Seconds(45)\n"); + CORRADE_COMPARE(out, "123.45 Seconds(45)\n"); } }}}} diff --git a/src/Magnum/Math/Test/Vector2Test.cpp b/src/Magnum/Math/Test/Vector2Test.cpp index f21e66ede..1e7bf486a 100644 --- a/src/Magnum/Math/Test/Vector2Test.cpp +++ b/src/Magnum/Math/Test/Vector2Test.cpp @@ -24,9 +24,9 @@ DEALINGS IN THE SOFTWARE. */ -#include +#include +#include #include -#include #include "Magnum/Math/Vector3.h" /* Vector3 used in Vector2Test::cross() */ #include "Magnum/Math/StrictWeakOrdering.h" @@ -363,9 +363,9 @@ void Vector2Test::swizzleType() { } void Vector2Test::debug() { - std::ostringstream o; - Debug(&o) << Vector2(0.5f, 15.0f); - CORRADE_COMPARE(o.str(), "Vector(0.5, 15)\n"); + Containers::String out; + Debug{&out} << Vector2(0.5f, 15.0f); + CORRADE_COMPARE(out, "Vector(0.5, 15)\n"); } }}}} diff --git a/src/Magnum/Math/Test/Vector3Test.cpp b/src/Magnum/Math/Test/Vector3Test.cpp index 00f4f3199..11d00e48d 100644 --- a/src/Magnum/Math/Test/Vector3Test.cpp +++ b/src/Magnum/Math/Test/Vector3Test.cpp @@ -24,9 +24,9 @@ DEALINGS IN THE SOFTWARE. */ -#include +#include +#include #include -#include #include "Magnum/Math/Vector3.h" #include "Magnum/Math/StrictWeakOrdering.h" @@ -388,9 +388,9 @@ void Vector3Test::swizzleType() { } void Vector3Test::debug() { - std::ostringstream o; - Debug(&o) << Vector3(0.5f, 15.0f, 1.0f); - CORRADE_COMPARE(o.str(), "Vector(0.5, 15, 1)\n"); + Containers::String out; + Debug{&out} << Vector3(0.5f, 15.0f, 1.0f); + CORRADE_COMPARE(out, "Vector(0.5, 15, 1)\n"); } }}}} diff --git a/src/Magnum/Math/Test/Vector4Test.cpp b/src/Magnum/Math/Test/Vector4Test.cpp index 182408ec1..cd0156544 100644 --- a/src/Magnum/Math/Test/Vector4Test.cpp +++ b/src/Magnum/Math/Test/Vector4Test.cpp @@ -24,9 +24,9 @@ DEALINGS IN THE SOFTWARE. */ -#include +#include +#include #include -#include #include "Magnum/Math/Vector4.h" #include "Magnum/Math/StrictWeakOrdering.h" @@ -430,9 +430,9 @@ void Vector4Test::swizzleType() { } void Vector4Test::debug() { - std::ostringstream o; - Debug(&o) << Vector4(0.5f, 15.0f, 1.0f, 1.0f); - CORRADE_COMPARE(o.str(), "Vector(0.5, 15, 1, 1)\n"); + Containers::String out; + Debug{&out} << Vector4(0.5f, 15.0f, 1.0f, 1.0f); + CORRADE_COMPARE(out, "Vector(0.5, 15, 1, 1)\n"); } }}}} diff --git a/src/Magnum/Math/Test/VectorTest.cpp b/src/Magnum/Math/Test/VectorTest.cpp index 310992e86..257794ed7 100644 --- a/src/Magnum/Math/Test/VectorTest.cpp +++ b/src/Magnum/Math/Test/VectorTest.cpp @@ -24,10 +24,11 @@ DEALINGS IN THE SOFTWARE. */ -#include +#include +#include /* arraySize() */ +#include #include #include -#include #include "Magnum/Math/Half.h" #include "Magnum/Math/Vector.h" @@ -839,10 +840,10 @@ void VectorTest::projectedOntoNormalizedNotNormalized() { Vector3 vector(1.0f, 2.0f, 3.0f); Vector3 line(1.0f, -1.0f, 0.5f); - std::ostringstream out; + Containers::String out; Error redirectError{&out}; vector.projectedOntoNormalized(line); - CORRADE_COMPARE(out.str(), "Math::Vector::projectedOntoNormalized(): line Vector(1, -1, 0.5) is not normalized\n"); + CORRADE_COMPARE(out, "Math::Vector::projectedOntoNormalized(): line Vector(1, -1, 0.5) is not normalized\n"); } void VectorTest::flipped() { @@ -881,12 +882,12 @@ void VectorTest::angleNormalizedButOver1() { void VectorTest::angleNotNormalized() { CORRADE_SKIP_IF_NO_DEBUG_ASSERT(); - std::ostringstream out; + Containers::String out; Error redirectError{&out}; Math::angle(Vector3(2.0f, 3.0f, 4.0f).normalized(), {1.0f, -2.0f, 3.0f}); Math::angle({2.0f, 3.0f, 4.0f}, Vector3(1.0f, -2.0f, 3.0f).normalized()); - CORRADE_COMPARE(out.str(), + CORRADE_COMPARE(out, "Math::angle(): vectors Vector(0.371391, 0.557086, 0.742781) and Vector(1, -2, 3) are not normalized\n" "Math::angle(): vectors Vector(2, 3, 4) and Vector(0.267261, -0.534522, 0.801784) are not normalized\n"); } @@ -1382,28 +1383,28 @@ void VectorTest::strictWeakOrdering() { } void VectorTest::debug() { - std::ostringstream o; - Debug(&o) << Vector4(0.5f, 15.0f, 1.0f, 1.0f); - CORRADE_COMPARE(o.str(), "Vector(0.5, 15, 1, 1)\n"); + Containers::String out; + Debug{&out} << Vector4(0.5f, 15.0f, 1.0f, 1.0f); + CORRADE_COMPARE(out, "Vector(0.5, 15, 1, 1)\n"); - o.str({}); - Debug(&o) << "a" << Vector4() << "b" << Vector4(); - CORRADE_COMPARE(o.str(), "a Vector(0, 0, 0, 0) b Vector(0, 0, 0, 0)\n"); + out = {}; + Debug{&out} << "a" << Vector4() << "b" << Vector4(); + CORRADE_COMPARE(out, "a Vector(0, 0, 0, 0) b Vector(0, 0, 0, 0)\n"); } void VectorTest::debugPacked() { - std::ostringstream out; + Containers::String out; /* Second is not packed, the first should not make any flags persistent */ Debug{&out} << Debug::packed << Vector4(0.5f, 15.0f, 1.0f, 1.0f) << Vector4(); - CORRADE_COMPARE(out.str(), "{0.5, 15, 1, 1} Vector(0, 0, 0, 0)\n"); + CORRADE_COMPARE(out, "{0.5, 15, 1, 1} Vector(0, 0, 0, 0)\n"); } void VectorTest::debugPropagateFlags() { - std::ostringstream out; + Containers::String out; /* The modifier shouldn't become persistent for values after. The nospace modifier shouldn't get propagated. */ Debug{&out} << ">" << Debug::nospace << Debug::hex << Vector2i(0xab, 0xcd) << Vector2i(12, 13); - CORRADE_COMPARE(out.str(), ">Vector(0xab, 0xcd) Vector(12, 13)\n"); + CORRADE_COMPARE(out, ">Vector(0xab, 0xcd) Vector(12, 13)\n"); } }}}} diff --git a/src/Magnum/MeshTools/Test/CombineIndexedArraysTest.cpp b/src/Magnum/MeshTools/Test/CombineIndexedArraysTest.cpp index d512ef448..201317095 100644 --- a/src/Magnum/MeshTools/Test/CombineIndexedArraysTest.cpp +++ b/src/Magnum/MeshTools/Test/CombineIndexedArraysTest.cpp @@ -25,9 +25,8 @@ */ #include -#include +#include #include -#include #define _MAGNUM_NO_DEPRECATED_COMBINEINDEXEDARRAYS @@ -54,13 +53,13 @@ CORRADE_IGNORE_DEPRECATED_PUSH void CombineIndexedArraysTest::wrongIndexCount() { CORRADE_SKIP_IF_NO_ASSERT(); - std::stringstream ss; - Error redirectError{&ss}; + Containers::String out; + Error redirectError{&out}; std::vector a{0, 1, 0}; std::vector b{3, 4}; std::vector result = combineIndexArrays({a, b}); - CORRADE_COMPARE(ss.str(), "MeshTools::combineIndexArrays(): the arrays don't have the same size\n"); + CORRADE_COMPARE(out, "MeshTools::combineIndexArrays(): the arrays don't have the same size\n"); } void CombineIndexedArraysTest::indexArrays() { diff --git a/src/Magnum/MeshTools/Test/CombineTest.cpp b/src/Magnum/MeshTools/Test/CombineTest.cpp index b4ae938f3..bea22f922 100644 --- a/src/Magnum/MeshTools/Test/CombineTest.cpp +++ b/src/Magnum/MeshTools/Test/CombineTest.cpp @@ -24,12 +24,11 @@ DEALINGS IN THE SOFTWARE. */ -#include #include #include +#include #include #include -#include #include "Magnum/Math/Color.h" #include "Magnum/MeshTools/Combine.h" @@ -191,10 +190,10 @@ void CombineTest::indexedAttributesSingleMesh() { void CombineTest::indexedAttributesNoMeshes() { CORRADE_SKIP_IF_NO_ASSERT(); - std::ostringstream out; + Containers::String out; Error redirectError{&out}; combineIndexedAttributes({}); - CORRADE_COMPARE(out.str(), "MeshTools::combineIndexedAttributes(): no meshes passed\n"); + CORRADE_COMPARE(out, "MeshTools::combineIndexedAttributes(): no meshes passed\n"); } void CombineTest::indexedAttributesNotIndexed() { @@ -207,10 +206,10 @@ void CombineTest::indexedAttributesNotIndexed() { {}, indices, Trade::MeshIndexData{indices}, 1}; Trade::MeshData c{MeshPrimitive::Lines, 1}; - std::ostringstream out; + Containers::String out; Error redirectError{&out}; combineIndexedAttributes({a, b, c}); - CORRADE_COMPARE(out.str(), "MeshTools::combineIndexedAttributes(): data 2 is not indexed\n"); + CORRADE_COMPARE(out, "MeshTools::combineIndexedAttributes(): data 2 is not indexed\n"); } void CombineTest::indexedAttributesDifferentPrimitive() { @@ -222,10 +221,10 @@ void CombineTest::indexedAttributesDifferentPrimitive() { Trade::MeshData b{MeshPrimitive::Points, {}, indices, Trade::MeshIndexData{indices}, 1}; - std::ostringstream out; + Containers::String out; Error redirectError{&out}; combineIndexedAttributes({a, b}); - CORRADE_COMPARE(out.str(), "MeshTools::combineIndexedAttributes(): data 1 is MeshPrimitive::Points but expected MeshPrimitive::Lines\n"); + CORRADE_COMPARE(out, "MeshTools::combineIndexedAttributes(): data 1 is MeshPrimitive::Points but expected MeshPrimitive::Lines\n"); } void CombineTest::indexedAttributesDifferentIndexCount() { @@ -240,10 +239,10 @@ void CombineTest::indexedAttributesDifferentIndexCount() { {}, indices, Trade::MeshIndexData{Containers::arrayView(indices).prefix(4)}, 1}; - std::ostringstream out; + Containers::String out; Error redirectError{&out}; combineIndexedAttributes({a, b, c}); - CORRADE_COMPARE(out.str(), "MeshTools::combineIndexedAttributes(): data 2 has 4 indices but expected 5\n"); + CORRADE_COMPARE(out, "MeshTools::combineIndexedAttributes(): data 2 has 4 indices but expected 5\n"); } void CombineTest::indexedAttributesImplementationSpecificIndexType() { @@ -260,10 +259,10 @@ void CombineTest::indexedAttributesImplementationSpecificIndexType() { Trade::MeshAttributeData{Trade::MeshAttribute::TextureCoordinates, VertexFormat::Vector2, nullptr}, }}; - std::ostringstream out; + Containers::String out; Error redirectError{&out}; combineIndexedAttributes({a, b}); - CORRADE_COMPARE(out.str(), "MeshTools::combineIndexedAttributes(): data 1 has an implementation-specific index type 0xcaca\n"); + CORRADE_COMPARE(out, "MeshTools::combineIndexedAttributes(): data 1 has an implementation-specific index type 0xcaca\n"); } void CombineTest::indexedAttributesImplementationSpecificVertexFormat() { @@ -283,10 +282,10 @@ void CombineTest::indexedAttributesImplementationSpecificVertexFormat() { Trade::MeshAttributeData{Trade::meshAttributeCustom(3), vertexFormatWrap(0xcaca), nullptr} }}; - std::ostringstream out; + Containers::String out; Error redirectError{&out}; combineIndexedAttributes({a, b}); - CORRADE_COMPARE(out.str(), "MeshTools::combineIndexedAttributes(): attribute 2 of mesh 1 has an implementation-specific format 0xcaca\n"); + CORRADE_COMPARE(out, "MeshTools::combineIndexedAttributes(): attribute 2 of mesh 1 has an implementation-specific format 0xcaca\n"); } void CombineTest::faceAttributes() { @@ -416,10 +415,10 @@ void CombineTest::faceAttributesMeshNotIndexed() { const Trade::MeshData mesh{MeshPrimitive::Triangles, 3}; const Trade::MeshData faceAttributes{MeshPrimitive::Faces, 0}; - std::ostringstream out; + Containers::String out; Error redirectError{&out}; combineFaceAttributes(mesh, faceAttributes); - CORRADE_COMPARE(out.str(), + CORRADE_COMPARE(out, "MeshTools::combineFaceAttributes(): vertex mesh is not indexed\n"); } @@ -434,11 +433,11 @@ void CombineTest::faceAttributesUnexpectedPrimitive() { const Trade::MeshData faceA{MeshPrimitive::Instances, 0}; const Trade::MeshData faceB{MeshPrimitive::Faces, 0}; - std::ostringstream out; + Containers::String out; Error redirectError{&out}; combineFaceAttributes(a, faceA); combineFaceAttributes(b, faceB); - CORRADE_COMPARE(out.str(), + CORRADE_COMPARE(out, "MeshTools::combineFaceAttributes(): expected a MeshPrimitive::Triangles mesh and a MeshPrimitive::Faces mesh but got MeshPrimitive::Triangles and MeshPrimitive::Instances\n" "MeshTools::combineFaceAttributes(): expected a MeshPrimitive::Triangles mesh and a MeshPrimitive::Faces mesh but got MeshPrimitive::Lines and MeshPrimitive::Faces\n"); } @@ -451,10 +450,10 @@ void CombineTest::faceAttributesUnexpectedFaceCount() { {}, indices, Trade::MeshIndexData{indices}, 1}; const Trade::MeshData faceAttributes{MeshPrimitive::Faces, 2}; - std::ostringstream out; + Containers::String out; Error redirectError{&out}; combineFaceAttributes(mesh, faceAttributes); - CORRADE_COMPARE(out.str(), + CORRADE_COMPARE(out, "MeshTools::combineFaceAttributes(): expected 1 face entries for 3 indices but got 2\n"); } @@ -483,11 +482,11 @@ void CombineTest::faceAttributesImplementationSpecificIndexType() { Trade::MeshAttributeData{Trade::MeshAttribute::TextureCoordinates, VertexFormat::Vector2, nullptr}, }}; - std::ostringstream out; + Containers::String out; Error redirectError{&out}; combineFaceAttributes(triangles, facesImplementationSpecific); combineFaceAttributes(trianglesImplementationSpecific, faces); - CORRADE_COMPARE(out.str(), + CORRADE_COMPARE(out, "MeshTools::combineFaceAttributes(): face mesh has an implementation-specific index type 0xcaca\n" "MeshTools::combineFaceAttributes(): vertex mesh has an implementation-specific index type 0xcaca\n"); } @@ -523,11 +522,11 @@ void CombineTest::faceAttributesImplementationSpecificVertexFormat() { Trade::MeshAttributeData{Trade::MeshAttribute::Tangent, vertexFormatWrap(0xcaca), nullptr} }}; - std::ostringstream out; + Containers::String out; Error redirectError{&out}; combineFaceAttributes(triangles, facesImplementationSpecific); combineFaceAttributes(trianglesImplementationSpecific, faces); - CORRADE_COMPARE(out.str(), + CORRADE_COMPARE(out, "MeshTools::combineFaceAttributes(): attribute 2 of mesh 1 has an implementation-specific format 0xcaca\n" "MeshTools::combineFaceAttributes(): attribute 2 of mesh 0 has an implementation-specific format 0xcaca\n"); } @@ -555,17 +554,17 @@ void CombineTest::faceAttributesFacesNotInterleaved() { Containers::arrayView(faceData[0].id)} }}; - std::ostringstream out; + Containers::String out; Error redirectError{&out}; combineFaceAttributes(mesh, faceAttributes); - CORRADE_COMPARE(out.str(), + CORRADE_COMPARE(out, "MeshTools::combineFaceAttributes(): face attributes are not interleaved\n"); } void CombineTest::faceAttributesFaceAttributeOffsetOnly() { CORRADE_SKIP_IF_NO_ASSERT(); - std::ostringstream out; + Containers::String out; Error redirectError{&out}; combineFaceAttributes(Trade::MeshData{MeshPrimitive::Triangles, 0}, { Trade::MeshAttributeData{Trade::MeshAttribute::ObjectId, @@ -573,7 +572,7 @@ void CombineTest::faceAttributesFaceAttributeOffsetOnly() { Trade::MeshAttributeData{Trade::MeshAttribute::Color, VertexFormat::Vector4, 0, 5, 16} }); - CORRADE_COMPARE(out.str(), + CORRADE_COMPARE(out, "MeshTools::combineFaceAttributes(): face attribute 1 is offset-only\n"); } diff --git a/src/Magnum/MeshTools/Test/CompileGLTest.cpp b/src/Magnum/MeshTools/Test/CompileGLTest.cpp index 92a0d7868..545200ef2 100644 --- a/src/Magnum/MeshTools/Test/CompileGLTest.cpp +++ b/src/Magnum/MeshTools/Test/CompileGLTest.cpp @@ -25,15 +25,13 @@ DEALINGS IN THE SOFTWARE. */ -#include #include #include #include #include #include #include -#include -#include +#include #include #include "Magnum/Image.h" @@ -1355,12 +1353,12 @@ void CompileGLTest::skinning() { CORRADE_COMPARE(jointCount.second(), data.expectedSecondaryJointCount); GL::Mesh mesh{NoCreate}; - std::ostringstream out; + Containers::String out; { Warning redirectWarning{&out}; mesh = compile(meshData); } - CORRADE_COMPARE(out.str(), data.expectedMessage); + CORRADE_COMPARE(out, data.expectedMessage); MAGNUM_VERIFY_NO_GL_ERROR(); @@ -1499,13 +1497,13 @@ void CompileGLTest::conflictingAttributes() { GL::Mesh mesh{NoCreate}; - std::ostringstream out; + Containers::String out; { Warning redirectWarning{&out}; mesh = compile(meshData); } MAGNUM_VERIFY_NO_GL_ERROR(); - CORRADE_COMPARE(out.str(), Utility::formatString("MeshTools::compile(): {}\n", data.expectedMessage)); + CORRADE_COMPARE(out, Utility::format("MeshTools::compile(): {}\n", data.expectedMessage)); if(!(_manager.loadState("AnyImageImporter") & PluginManager::LoadState::Loaded) || !(_manager.loadState("TgaImporter") & PluginManager::LoadState::Loaded)) @@ -1562,10 +1560,10 @@ void CompileGLTest::unsupportedIndexStride() { {}, indices, Trade::MeshIndexData{Containers::stridedArrayView(indices).every(2)}, 1}; - std::ostringstream out; + Containers::String out; Error redirectError{&out}; compile(data); - CORRADE_COMPARE(out.str(), + CORRADE_COMPARE(out, "MeshTools::compile(): MeshIndexType::UnsignedShort with stride of 4 bytes isn't supported by OpenGL\n"); } @@ -1583,13 +1581,13 @@ void CompileGLTest::morphTargetAttributes() { Containers::arrayView(vertexData), 26}, }}; - std::ostringstream out; + Containers::String out; Warning redirectError{&out}; if(instanceData.flags) compile(data, instanceData.flags); else compile(data); - CORRADE_COMPARE(out.str(), instanceData.flags ? "" : + CORRADE_COMPARE(out, instanceData.flags ? "" : "MeshTools::compile(): ignoring 2 morph target attributes\n"); } @@ -1602,13 +1600,13 @@ void CompileGLTest::customAttribute() { VertexFormat::Short, nullptr} }}; - std::ostringstream out; + Containers::String out; Warning redirectError{&out}; if(instanceData.flags) compile(data, instanceData.flags); else compile(data); - CORRADE_COMPARE(out.str(), instanceData.flags ? "" : + CORRADE_COMPARE(out, instanceData.flags ? "" : "MeshTools::compile(): ignoring unknown/unsupported attribute Trade::MeshAttribute::Custom(115)\n"); } @@ -1624,14 +1622,14 @@ void CompileGLTest::unsupportedAttribute() { VertexFormat::UnsignedByte, nullptr} }}; - std::ostringstream out; + Containers::String out; Warning redirectError{&out}; if(instanceData.flags) compile(data, instanceData.flags); else compile(data); /* Warns always, regardless of the flag */ - CORRADE_COMPARE(out.str(), "MeshTools::compile(): ignoring unknown/unsupported attribute Trade::MeshAttribute::ObjectId\n"); + CORRADE_COMPARE(out, "MeshTools::compile(): ignoring unknown/unsupported attribute Trade::MeshAttribute::ObjectId\n"); #endif } @@ -1648,11 +1646,11 @@ void CompileGLTest::unsupportedAttributeStride() { Containers::stridedArrayView(data).flipped<0>()} }}; - std::ostringstream out; + Containers::String out; Error redirectError{&out}; compile(zero); compile(negative); - CORRADE_COMPARE(out.str(), + CORRADE_COMPARE(out, "MeshTools::compile(): Trade::MeshAttribute::Position stride of 0 bytes isn't supported by OpenGL\n" "MeshTools::compile(): Trade::MeshAttribute::Normal stride of -12 bytes isn't supported by OpenGL\n"); } @@ -1666,13 +1664,13 @@ void CompileGLTest::implementationSpecificAttributeFormat() { vertexFormatWrap(0xdead), nullptr} }}; - std::ostringstream out; + Containers::String out; Warning redirectError{&out}; if(instanceData.flags) compile(data, instanceData.flags); else compile(data); - CORRADE_COMPARE(out.str(), instanceData.flags ? "" : + CORRADE_COMPARE(out, instanceData.flags ? "" : "MeshTools::compile(): ignoring attribute Trade::MeshAttribute::Position with an implementation-specific format 0xdead\n"); } @@ -1681,10 +1679,10 @@ void CompileGLTest::generateNormalsNoPosition() { Trade::MeshData data{MeshPrimitive::Triangles, 1}; - std::ostringstream out; + Containers::String out; Error redirectError{&out}; compile(data, CompileFlag::GenerateFlatNormals); - CORRADE_COMPARE(out.str(), + CORRADE_COMPARE(out, "MeshTools::compile(): the mesh has no positions, can't generate normals\n"); } @@ -1696,10 +1694,10 @@ void CompileGLTest::generateNormals2DPosition() { VertexFormat::Vector2, nullptr} }}; - std::ostringstream out; + Containers::String out; Error redirectError{&out}; compile(data, CompileFlag::GenerateFlatNormals); - CORRADE_COMPARE(out.str(), + CORRADE_COMPARE(out, "MeshTools::compile(): can't generate normals for VertexFormat::Vector2 positions\n"); } @@ -1713,10 +1711,10 @@ void CompileGLTest::generateNormalsNoFloats() { VertexFormat::Vector3h, nullptr}, }}; - std::ostringstream out; + Containers::String out; Error redirectError{&out}; compile(data, CompileFlag::GenerateFlatNormals); - CORRADE_COMPARE(out.str(), + CORRADE_COMPARE(out, "MeshTools::compile(): can't generate normals into VertexFormat::Vector3h\n"); } @@ -1815,11 +1813,11 @@ void CompileGLTest::externalBuffersInvalid() { compile(data, GL::Buffer{NoCreate}, GL::Buffer{}); /* this is okay */ - std::ostringstream out; + Containers::String out; Error redirectError{&out}; compile(data, GL::Buffer{NoCreate}, GL::Buffer{NoCreate}); compile(indexedData, GL::Buffer{NoCreate}, GL::Buffer{}); - CORRADE_COMPARE(out.str(), + CORRADE_COMPARE(out, "MeshTools::compile(): invalid external buffer(s)\n" "MeshTools::compile(): invalid external buffer(s)\n"); } diff --git a/src/Magnum/MeshTools/Test/CompileLinesGLTest.cpp b/src/Magnum/MeshTools/Test/CompileLinesGLTest.cpp index b7f50cb43..e8e7d9d0a 100644 --- a/src/Magnum/MeshTools/Test/CompileLinesGLTest.cpp +++ b/src/Magnum/MeshTools/Test/CompileLinesGLTest.cpp @@ -24,12 +24,10 @@ DEALINGS IN THE SOFTWARE. */ -#include #include #include #include #include -#include #include #include "Magnum/Image.h" @@ -301,7 +299,7 @@ void CompileLinesGLTest::conflictingAttributes() { Trade::MeshAttributeData{data.attribute, data.format, vertices.slice(&Vertex::extra)}, }}); - std::ostringstream out; + Containers::String out; GL::Mesh mesh{NoCreate}; { Warning redirectWarning{&out}; @@ -319,7 +317,7 @@ void CompileLinesGLTest::conflictingAttributes() { _framebuffer.read({{}, {32, 32}}, {PixelFormat::RGBA8Unorm}), Utility::Path::join(MESHTOOLS_TEST_DIR, "CompileLinesTestFiles/miter.tga"), (DebugTools::CompareImageToFile{_manager})); - CORRADE_COMPARE(out.str(), data.expected); + CORRADE_COMPARE(out, data.expected); } void CompileLinesGLTest::emptyMesh() { @@ -337,7 +335,7 @@ void CompileLinesGLTest::notGeneratedLineMesh() { Vector3 positions[3]{}; - std::ostringstream out; + Containers::String out; Error redirectError{&out}; compileLines(Trade::MeshData{MeshPrimitive::Lines, {}, positions, { Trade::MeshAttributeData{Trade::MeshAttribute::Position, Containers::stridedArrayView(positions)} @@ -345,7 +343,7 @@ void CompileLinesGLTest::notGeneratedLineMesh() { compileLines(Trade::MeshData{MeshPrimitive::Triangles, {}, positions, { Trade::MeshAttributeData{Trade::MeshAttribute::Position, Containers::stridedArrayView(positions)} }}); - CORRADE_COMPARE(out.str(), + CORRADE_COMPARE(out, "MeshTools::compileLines(): the mesh wasn't produced with generateLines()\n" "MeshTools::compileLines(): the mesh wasn't produced with generateLines()\n"); } diff --git a/src/Magnum/MeshTools/Test/CompressIndicesTest.cpp b/src/Magnum/MeshTools/Test/CompressIndicesTest.cpp index f69b9e55a..f01822d25 100644 --- a/src/Magnum/MeshTools/Test/CompressIndicesTest.cpp +++ b/src/Magnum/MeshTools/Test/CompressIndicesTest.cpp @@ -24,13 +24,12 @@ DEALINGS IN THE SOFTWARE. */ -#include #include #include #include +#include #include #include -#include #include #include "Magnum/Math/Vector3.h" @@ -38,6 +37,7 @@ #include "Magnum/Trade/MeshData.h" #ifdef MAGNUM_BUILD_DEPRECATED +#include #include #endif @@ -218,10 +218,10 @@ void CompressIndicesTest::compressErasedNonContiguous() { const char indices[6*4]{}; - std::stringstream out; + Containers::String out; Error redirectError{&out}; compressIndices(Containers::StridedArrayView2D{indices, {6, 2}, {4, 2}}); - CORRADE_COMPARE(out.str(), + CORRADE_COMPARE(out, "MeshTools::compressIndices(): second view dimension is not contiguous\n"); } @@ -230,10 +230,10 @@ void CompressIndicesTest::compressErasedWrongIndexSize() { const char indices[6*3]{}; - std::stringstream out; + Containers::String out; Error redirectError{&out}; compressIndices(Containers::StridedArrayView2D{indices, {6, 3}}); - CORRADE_COMPARE(out.str(), + CORRADE_COMPARE(out, "MeshTools::compressIndices(): expected index type size 1, 2 or 4 but got 3\n"); } @@ -346,11 +346,11 @@ void CompressIndicesTest::compressMeshDataNonIndexed() { Trade::MeshData mesh{MeshPrimitive::TriangleFan, 5}; /* Test both r-value and l-value overload */ - std::ostringstream out; + Containers::String out; Error redirectError{&out}; compressIndices(mesh); compressIndices(Utility::move(mesh)); - CORRADE_COMPARE(out.str(), + CORRADE_COMPARE(out, "MeshTools::compressIndices(): mesh data not indexed\n" "MeshTools::compressIndices(): mesh data not indexed\n"); } @@ -362,11 +362,11 @@ void CompressIndicesTest::compressMeshDataImplementationSpecificIndexType() { nullptr, Trade::MeshIndexData{meshIndexTypeWrap(0xcaca), Containers::StridedArrayView1D{}}, 1}; /* Test both r-value and l-value overload */ - std::ostringstream out; + Containers::String out; Error redirectError{&out}; compressIndices(mesh); compressIndices(Utility::move(mesh)); - CORRADE_COMPARE(out.str(), + CORRADE_COMPARE(out, "MeshTools::compressIndices(): mesh has an implementation-specific index type 0xcaca\n" "MeshTools::compressIndices(): mesh has an implementation-specific index type 0xcaca\n"); } @@ -378,10 +378,10 @@ void CompressIndicesTest::compressMeshDataImplementationSpecificAtLeastIndexType Trade::MeshData mesh{MeshPrimitive::Points, {}, indices, Trade::MeshIndexData{indices}, 1}; - std::ostringstream out; + Containers::String out; Error redirectError{&out}; compressIndices(mesh, meshIndexTypeWrap(0xcaca)); - CORRADE_COMPARE(out.str(), + CORRADE_COMPARE(out, "MeshTools::compressIndices(): can't compress to an implementation-specific index type 0xcaca\n"); } @@ -394,10 +394,10 @@ void CompressIndicesTest::compressAsShort() { Containers::arrayView({123, 456}), TestSuite::Compare::Container); - std::ostringstream out; + Containers::String out; Error redirectError{&out}; compressIndicesAs({65536}); - CORRADE_COMPARE(out.str(), "MeshTools::compressIndicesAs(): type too small to represent value 65536\n"); + CORRADE_COMPARE(out, "MeshTools::compressIndicesAs(): type too small to represent value 65536\n"); CORRADE_IGNORE_DEPRECATED_POP } #endif diff --git a/src/Magnum/MeshTools/Test/ConcatenateTest.cpp b/src/Magnum/MeshTools/Test/ConcatenateTest.cpp index 9e4ffcf71..a2c70177f 100644 --- a/src/Magnum/MeshTools/Test/ConcatenateTest.cpp +++ b/src/Magnum/MeshTools/Test/ConcatenateTest.cpp @@ -24,13 +24,11 @@ DEALINGS IN THE SOFTWARE. */ -#include #include -#include /** @todo remove when Debug is stream-free */ +#include #include #include #include -#include #include "Magnum/Math/Color.h" #include "Magnum/MeshTools/Concatenate.h" @@ -462,10 +460,10 @@ void ConcatenateTest::concatenateOne() { void ConcatenateTest::concatenateNone() { CORRADE_SKIP_IF_NO_ASSERT(); - std::ostringstream out; + Containers::String out; Error redirectError{&out}; MeshTools::concatenate({}); - CORRADE_COMPARE(out.str(), "MeshTools::concatenate(): expected at least one mesh\n"); + CORRADE_COMPARE(out, "MeshTools::concatenate(): expected at least one mesh\n"); } void ConcatenateTest::concatenateInto() { @@ -641,11 +639,11 @@ void ConcatenateTest::concatenateUnsupportedPrimitive() { Trade::MeshData a{MeshPrimitive::TriangleStrip, 0}; - std::ostringstream out; + Containers::String out; Error redirectError{&out}; MeshTools::concatenate({a}); MeshTools::concatenateInto(a, {a}); - CORRADE_COMPARE(out.str(), + CORRADE_COMPARE(out, "MeshTools::concatenate(): MeshPrimitive::TriangleStrip is not supported, turn it into a plain indexed mesh first\n" "MeshTools::concatenateInto(): MeshPrimitive::TriangleStrip is not supported, turn it into a plain indexed mesh first\n"); } @@ -657,11 +655,11 @@ void ConcatenateTest::concatenateInconsistentPrimitive() { Trade::MeshData a{MeshPrimitive::Triangles, 0}; Trade::MeshData b{MeshPrimitive::Lines, 0}; - std::ostringstream out; + Containers::String out; Error redirectError{&out}; MeshTools::concatenate({a, a, b}); MeshTools::concatenateInto(a, {a, b}); - CORRADE_COMPARE(out.str(), + CORRADE_COMPARE(out, "MeshTools::concatenate(): expected MeshPrimitive::Triangles but got MeshPrimitive::Lines in mesh 2\n" "MeshTools::concatenateInto(): expected MeshPrimitive::Triangles but got MeshPrimitive::Lines in mesh 1\n"); } @@ -685,11 +683,11 @@ void ConcatenateTest::concatenateInconsistentAttributeFormat() { VertexFormat::Vector3usNormalized, nullptr} }}; - std::ostringstream out; + Containers::String out; Error redirectError{&out}; MeshTools::concatenate({a, a, a, a, b}); MeshTools::concatenateInto(a, {a, a, a, b}); - CORRADE_COMPARE(out.str(), + CORRADE_COMPARE(out, "MeshTools::concatenate(): expected VertexFormat::Vector3ubNormalized for attribute 2 (Trade::MeshAttribute::Color) but got VertexFormat::Vector3usNormalized in mesh 4 attribute 1\n" "MeshTools::concatenateInto(): expected VertexFormat::Vector3ubNormalized for attribute 2 (Trade::MeshAttribute::Color) but got VertexFormat::Vector3usNormalized in mesh 3 attribute 1\n"); } @@ -723,13 +721,13 @@ void ConcatenateTest::concatenateInconsistentArrayAttribute() { VertexFormat::ByteNormalized, nullptr} }}; - std::ostringstream out; + Containers::String out; Error redirectError{&out}; MeshTools::concatenate({a, a, a, a, b}); MeshTools::concatenate({b, b, b, b, a}); MeshTools::concatenateInto(a2, {a, a, a, b}); MeshTools::concatenateInto(b, {b, b, b, a}); - CORRADE_COMPARE_AS(out.str(), + CORRADE_COMPARE_AS(out, "MeshTools::concatenate(): attribute 2 (Trade::MeshAttribute::Custom(42)) is an array but attribute 1 in mesh 4 isn't\n" "MeshTools::concatenate(): attribute 1 (Trade::MeshAttribute::Custom(42)) isn't an array but attribute 2 in mesh 4 is\n" "MeshTools::concatenateInto(): attribute 2 (Trade::MeshAttribute::Custom(42)) is an array but attribute 1 in mesh 3 isn't\n" @@ -760,11 +758,11 @@ void ConcatenateTest::concatenateTooLargeAttributeArraySize() { concatenate() above) */ MeshTools::concatenate({b, a}); - std::ostringstream out; + Containers::String out; Error redirectError{&out}; MeshTools::concatenate({a, a, a, a, b}); MeshTools::concatenateInto(a, {a, a, a, b}); - CORRADE_COMPARE_AS(out.str(), + CORRADE_COMPARE_AS(out, "MeshTools::concatenate(): expected array size 4 or less for attribute 2 (Trade::MeshAttribute::Custom(42)) but got 5 in mesh 4 attribute 1\n" "MeshTools::concatenateInto(): expected array size 4 or less for attribute 2 (Trade::MeshAttribute::Custom(42)) but got 5 in mesh 3 attribute 1\n", TestSuite::Compare::String); @@ -795,11 +793,11 @@ void ConcatenateTest::concatenateImplementationSpecificIndexType() { a tightly-packed 32bit buffer */ MeshTools::concatenateInto(bDestination, {a}); - std::ostringstream out; + Containers::String out; Error redirectError{&out}; MeshTools::concatenate({a, b}); MeshTools::concatenateInto(a, {b}); - CORRADE_COMPARE(out.str(), + CORRADE_COMPARE(out, "MeshTools::concatenate(): mesh 1 has an implementation-specific index type 0xcaca\n" "MeshTools::concatenateInto(): mesh 0 has an implementation-specific index type 0xcaca\n"); } @@ -823,11 +821,11 @@ void ConcatenateTest::concatenateImplementationSpecificVertexFormat() { VertexFormat::Vector3, nullptr} }}; - std::ostringstream out; + Containers::String out; Error redirectError{&out}; MeshTools::concatenate({a, b}); MeshTools::concatenateInto(a, {b}); - CORRADE_COMPARE(out.str(), + CORRADE_COMPARE(out, "MeshTools::concatenate(): attribute 2 of the first mesh has an implementation-specific format 0xcaca\n" "MeshTools::concatenateInto(): attribute 2 of the destination mesh has an implementation-specific format 0xcaca\n"); } @@ -837,10 +835,10 @@ void ConcatenateTest::concatenateIntoNoMeshes() { Trade::MeshData destination{MeshPrimitive::Triangles, 0}; - std::ostringstream out; + Containers::String out; Error redirectError{&out}; MeshTools::concatenateInto(destination, {}); - CORRADE_COMPARE(out.str(), "MeshTools::concatenateInto(): no meshes passed\n"); + CORRADE_COMPARE(out, "MeshTools::concatenateInto(): no meshes passed\n"); } }}}} diff --git a/src/Magnum/MeshTools/Test/CopyTest.cpp b/src/Magnum/MeshTools/Test/CopyTest.cpp index 0c418f43a..f594998eb 100644 --- a/src/Magnum/MeshTools/Test/CopyTest.cpp +++ b/src/Magnum/MeshTools/Test/CopyTest.cpp @@ -24,11 +24,10 @@ DEALINGS IN THE SOFTWARE. */ -#include +#include #include #include #include -#include #include "Magnum/Math/Color.h" #include "Magnum/MeshTools/Copy.h" @@ -497,10 +496,10 @@ void CopyTest::mutableReferenceNotMutable() { CORRADE_COMPARE(cube.indexDataFlags(), Trade::DataFlag::Global); CORRADE_COMPARE(cube.vertexDataFlags(), Trade::DataFlag::Global); - std::ostringstream out; + Containers::String out; Error redirectError{&out}; MeshTools::mutableReference(cube); - CORRADE_COMPARE(out.str(), "MeshTools::mutableReference(): data not mutable\n"); + CORRADE_COMPARE(out, "MeshTools::mutableReference(): data not mutable\n"); } }}}} diff --git a/src/Magnum/MeshTools/Test/DuplicateTest.cpp b/src/Magnum/MeshTools/Test/DuplicateTest.cpp index d6bd4c458..c7b621813 100644 --- a/src/Magnum/MeshTools/Test/DuplicateTest.cpp +++ b/src/Magnum/MeshTools/Test/DuplicateTest.cpp @@ -24,10 +24,9 @@ DEALINGS IN THE SOFTWARE. */ -#include +#include #include #include -#include #include #include "Magnum/Magnum.h" @@ -121,11 +120,11 @@ void DuplicateTest::duplicateOutOfRange() { constexpr UnsignedByte indices[]{1, 1, 0, 4, 2, 2}; constexpr Int data[]{-7, 35, 12, -18}; - std::ostringstream out; + Containers::String out; Error redirectError{&out}; MeshTools::duplicate(indices, data); - CORRADE_COMPARE(out.str(), + CORRADE_COMPARE(out, "MeshTools::duplicateInto(): index 4 out of range for 4 elements\n"); } @@ -156,11 +155,11 @@ void DuplicateTest::duplicateIntoWrongSize() { constexpr Int data[]{-7, 35, 12, -18}; Int output[5]; - std::ostringstream out; + Containers::String out; Error redirectError{&out}; MeshTools::duplicateInto(indices, data, output); - CORRADE_COMPARE(out.str(), + CORRADE_COMPARE(out, "MeshTools::duplicateInto(): index array and output size don't match, expected 6 but got 5\n"); } @@ -187,14 +186,14 @@ void DuplicateTest::duplicateIntoErasedWrongTypeSize() { constexpr Int data[]{-7, 35, 12, -18}; Short output[6]; - std::ostringstream out; + Containers::String out; Error redirectError{&out}; MeshTools::duplicateInto( Containers::stridedArrayView(indices), Containers::arrayCast<2, const char>(Containers::stridedArrayView(data)), Containers::arrayCast<2, char>(Containers::stridedArrayView(output))); - CORRADE_COMPARE(out.str(), + CORRADE_COMPARE(out, "MeshTools::duplicateInto(): input and output type size doesn't match, expected 4 but got 2\n"); } @@ -205,7 +204,7 @@ void DuplicateTest::duplicateIntoErasedNonContiguous() { constexpr Int data[]{-7, 35, 12, -18}; Short output[6]; - std::ostringstream out; + Containers::String out; Error redirectError{&out}; MeshTools::duplicateInto( @@ -216,7 +215,7 @@ void DuplicateTest::duplicateIntoErasedNonContiguous() { Containers::stridedArrayView(indices), Containers::arrayCast<2, const char>(Containers::stridedArrayView(data)), Containers::arrayCast<2, char>(Containers::stridedArrayView(output)).every({1, 2})); - CORRADE_COMPARE(out.str(), + CORRADE_COMPARE(out, "MeshTools::duplicateInto(): second data view dimension is not contiguous\n" "MeshTools::duplicateInto(): second output view dimension is not contiguous\n"); } @@ -244,14 +243,14 @@ void DuplicateTest::duplicateErasedIndicesIntoErasedWrongTypeSize() { constexpr Int data[]{-7, 35, 12, -18}; Short output[6]; - std::ostringstream out; + Containers::String out; Error redirectError{&out}; MeshTools::duplicateInto( Containers::StridedArrayView2D{indices, {6, 3}}.every(2), Containers::arrayCast<2, const char>(Containers::stridedArrayView(data)), Containers::arrayCast<2, char>(Containers::stridedArrayView(output))); - CORRADE_COMPARE(out.str(), + CORRADE_COMPARE(out, "MeshTools::duplicateInto(): expected index type size 1, 2 or 4 but got 3\n"); } @@ -262,14 +261,14 @@ void DuplicateTest::duplicateErasedIndicesIntoErasedNonContiguous() { constexpr Int data[]{-7, 35, 12, -18}; Short output[6]; - std::ostringstream out; + Containers::String out; Error redirectError{&out}; MeshTools::duplicateInto( Containers::StridedArrayView2D{indices, {3, 3}, {6, 2}}, Containers::arrayCast<2, const char>(Containers::stridedArrayView(data)).every({1, 2}), Containers::arrayCast<2, char>(Containers::stridedArrayView(output))); - CORRADE_COMPARE(out.str(), + CORRADE_COMPARE(out, "MeshTools::duplicateInto(): second index view dimension is not contiguous\n"); } @@ -318,10 +317,10 @@ template void DuplicateTest::duplicateMeshData() { void DuplicateTest::duplicateMeshDataNotIndexed() { CORRADE_SKIP_IF_NO_ASSERT(); - std::ostringstream out; + Containers::String out; Error redirectError{&out}; MeshTools::duplicate(Trade::MeshData{MeshPrimitive::Points, 0}); - CORRADE_COMPARE(out.str(), "MeshTools::duplicate(): mesh data not indexed\n"); + CORRADE_COMPARE(out, "MeshTools::duplicate(): mesh data not indexed\n"); } void DuplicateTest::duplicateMeshDataImplementationSpecificIndexType() { @@ -334,10 +333,10 @@ void DuplicateTest::duplicateMeshDataImplementationSpecificIndexType() { VertexFormat::Vector3, nullptr}, }}; - std::ostringstream out; + Containers::String out; Error redirectError{&out}; MeshTools::duplicate(a); - CORRADE_COMPARE(out.str(), "MeshTools::duplicate(): mesh has an implementation-specific index type 0xcaca\n"); + CORRADE_COMPARE(out, "MeshTools::duplicate(): mesh has an implementation-specific index type 0xcaca\n"); } void DuplicateTest::duplicateMeshDataImplementationSpecificVertexFormat() { @@ -354,10 +353,10 @@ void DuplicateTest::duplicateMeshDataImplementationSpecificVertexFormat() { vertexFormatWrap(0xcaca), nullptr} }}; - std::ostringstream out; + Containers::String out; Error redirectError{&out}; MeshTools::duplicate(a); - CORRADE_COMPARE(out.str(), "MeshTools::duplicate(): attribute 2 has an implementation-specific format 0xcaca\n"); + CORRADE_COMPARE(out, "MeshTools::duplicate(): attribute 2 has an implementation-specific format 0xcaca\n"); } void DuplicateTest::duplicateMeshDataExtra() { @@ -436,13 +435,13 @@ void DuplicateTest::duplicateMeshDataExtraWrongCount() { }}; const Vector3 normals[]{Vector3::xAxis(), Vector3::yAxis()}; - std::ostringstream out; + Containers::String out; Error redirectError{&out}; MeshTools::duplicate(data, { Trade::MeshAttributeData{10}, Trade::MeshAttributeData{Trade::MeshAttribute::Normal, Containers::arrayView(normals)} }); - CORRADE_COMPARE(out.str(), "MeshTools::duplicate(): extra attribute 1 expected to have 3 items but got 2\n"); + CORRADE_COMPARE(out, "MeshTools::duplicate(): extra attribute 1 expected to have 3 items but got 2\n"); } void DuplicateTest::duplicateMeshDataExtraOffsetOnly() { @@ -452,13 +451,13 @@ void DuplicateTest::duplicateMeshDataExtraOffsetOnly() { Trade::MeshData data{MeshPrimitive::TriangleFan, {}, indices, Trade::MeshIndexData{indices}, 3}; - std::ostringstream out; + Containers::String out; Error redirectError{&out}; MeshTools::duplicate(data, { Trade::MeshAttributeData{10}, Trade::MeshAttributeData{Trade::MeshAttribute::Normal, VertexFormat::Vector3, 3, 5, 14} }); - CORRADE_COMPARE(out.str(), "MeshTools::duplicate(): extra attribute 1 is offset-only\n"); + CORRADE_COMPARE(out, "MeshTools::duplicate(): extra attribute 1 is offset-only\n"); } void DuplicateTest::duplicateMeshDataExtraImplementationSpecificVertexFormat() { @@ -471,7 +470,7 @@ void DuplicateTest::duplicateMeshDataExtraImplementationSpecificVertexFormat() { VertexFormat::Vector3, nullptr}, }}; - std::ostringstream out; + Containers::String out; Error redirectError{&out}; MeshTools::duplicate(a, { Trade::MeshAttributeData{Trade::MeshAttribute::Position, @@ -479,7 +478,7 @@ void DuplicateTest::duplicateMeshDataExtraImplementationSpecificVertexFormat() { Trade::MeshAttributeData{Trade::MeshAttribute::Color, vertexFormatWrap(0xcaca), nullptr} }); - CORRADE_COMPARE(out.str(), "MeshTools::duplicate(): extra attribute 1 has an implementation-specific format 0xcaca\n"); + CORRADE_COMPARE(out, "MeshTools::duplicate(): extra attribute 1 has an implementation-specific format 0xcaca\n"); } void DuplicateTest::duplicateMeshDataNoAttributes() { diff --git a/src/Magnum/MeshTools/Test/FilterTest.cpp b/src/Magnum/MeshTools/Test/FilterTest.cpp index fa8e29d88..181ff8c4c 100644 --- a/src/Magnum/MeshTools/Test/FilterTest.cpp +++ b/src/Magnum/MeshTools/Test/FilterTest.cpp @@ -24,12 +24,11 @@ DEALINGS IN THE SOFTWARE. */ -#include #include #include #include +#include #include -#include #include "Magnum/Math/Vector4.h" #include "Magnum/MeshTools/Filter.h" @@ -305,10 +304,10 @@ void FilterTest::attributesWrongBitCount() { Trade::MeshAttributeData{Trade::MeshAttribute::TextureCoordinates, Containers::stridedArrayView(vertices).slice(&Vertex::textureCoordinates1)} }}; - std::ostringstream out; + Containers::String out; Error redirectError{&out}; filterAttributes(mesh, Containers::BitArray{ValueInit, 3}); - CORRADE_COMPARE(out.str(), "MeshTools::filterAttributes(): expected 2 bits but got 3\n"); + CORRADE_COMPARE(out, "MeshTools::filterAttributes(): expected 2 bits but got 3\n"); } void FilterTest::onlyAttributes() { @@ -526,12 +525,12 @@ void FilterTest::onlyAttributeIdsOutOfRange() { Trade::MeshAttributeData{Trade::MeshAttribute::TextureCoordinates, Containers::stridedArrayView(vertices).slice(&Vertex::textureCoordinates1)} }}; - std::ostringstream out; + Containers::String out; Error redirectError{&out}; CORRADE_IGNORE_DEPRECATED_PUSH filterOnlyAttributes(mesh, {0, 0, 2}); CORRADE_IGNORE_DEPRECATED_POP - CORRADE_COMPARE(out.str(), "MeshTools::filterOnlyAttributes(): index 2 out of range for 2 attributes\n"); + CORRADE_COMPARE(out, "MeshTools::filterOnlyAttributes(): index 2 out of range for 2 attributes\n"); } void FilterTest::onlyAttributeIdsNoIndexData() { @@ -810,12 +809,12 @@ void FilterTest::exceptAttributeIdsOutOfRange() { Trade::MeshAttributeData{Trade::MeshAttribute::TextureCoordinates, Containers::stridedArrayView(vertices).slice(&Vertex::textureCoordinates1)} }}; - std::ostringstream out; + Containers::String out; Error redirectError{&out}; CORRADE_IGNORE_DEPRECATED_PUSH filterExceptAttributes(mesh, {0, 0, 2}); CORRADE_IGNORE_DEPRECATED_POP - CORRADE_COMPARE(out.str(), "MeshTools::filterExceptAttributes(): index 2 out of range for 2 attributes\n"); + CORRADE_COMPARE(out, "MeshTools::filterExceptAttributes(): index 2 out of range for 2 attributes\n"); } void FilterTest::exceptAttributeIdsNoIndexData() { diff --git a/src/Magnum/MeshTools/Test/FlipNormalsTest.cpp b/src/Magnum/MeshTools/Test/FlipNormalsTest.cpp index 295dd0389..89fe6d8b4 100644 --- a/src/Magnum/MeshTools/Test/FlipNormalsTest.cpp +++ b/src/Magnum/MeshTools/Test/FlipNormalsTest.cpp @@ -24,11 +24,10 @@ DEALINGS IN THE SOFTWARE. */ -#include #include +#include #include #include -#include #include "Magnum/Math/Vector3.h" #include "Magnum/MeshTools/FlipNormals.h" @@ -74,13 +73,13 @@ FlipNormalsTest::FlipNormalsTest() { void FlipNormalsTest::wrongIndexCount() { CORRADE_SKIP_IF_NO_ASSERT(); - std::stringstream ss; - Error redirectError{&ss}; + Containers::String out; + Error redirectError{&out}; UnsignedByte indices[2]; flipFaceWindingInPlace(Containers::stridedArrayView(indices)); - CORRADE_COMPARE(ss.str(), "MeshTools::flipNormals(): index count is not divisible by 3!\n"); + CORRADE_COMPARE(out, "MeshTools::flipNormals(): index count is not divisible by 3!\n"); } template void FlipNormalsTest::flipFaceWinding() { @@ -110,10 +109,10 @@ void FlipNormalsTest::flipFaceWindingErasedNonContiguous() { char indices[6*4]{}; - std::stringstream out; + Containers::String out; Error redirectError{&out}; flipFaceWindingInPlace(Containers::StridedArrayView2D{indices, {6, 2}, {4, 2}}); - CORRADE_COMPARE(out.str(), + CORRADE_COMPARE(out, "MeshTools::flipFaceWindingInPlace(): second index view dimension is not contiguous\n"); } @@ -122,10 +121,10 @@ void FlipNormalsTest::flipFaceWindingErasedWrongIndexSize() { char indices[6*3]{}; - std::stringstream out; + Containers::String out; Error redirectError{&out}; flipFaceWindingInPlace(Containers::StridedArrayView2D{indices, {6, 3}}); - CORRADE_COMPARE(out.str(), + CORRADE_COMPARE(out, "MeshTools::flipFaceWindingInPlace(): expected index type size 1, 2 or 4 but got 3\n"); } diff --git a/src/Magnum/MeshTools/Test/GenerateIndicesTest.cpp b/src/Magnum/MeshTools/Test/GenerateIndicesTest.cpp index e3a88151e..3ed718b2b 100644 --- a/src/Magnum/MeshTools/Test/GenerateIndicesTest.cpp +++ b/src/Magnum/MeshTools/Test/GenerateIndicesTest.cpp @@ -24,15 +24,13 @@ DEALINGS IN THE SOFTWARE. */ -#include #include -#include /** @todo remove once Debug is stream-free */ #include +#include #include #include #include -#include -#include +#include #include "Magnum/Math/Matrix4.h" #include "Magnum/MeshTools/GenerateIndices.h" @@ -338,14 +336,14 @@ void GenerateIndicesTest::primitiveCount() { void GenerateIndicesTest::primitiveCountInvalidVertexCount() { CORRADE_SKIP_IF_NO_ASSERT(); - std::ostringstream out; + Containers::String out; Error redirectError{&out}; MeshTools::primitiveCount(MeshPrimitive::LineLoop, 1); MeshTools::primitiveCount(MeshPrimitive::TriangleStrip, 1); MeshTools::primitiveCount(MeshPrimitive::TriangleFan, 2); MeshTools::primitiveCount(MeshPrimitive::Lines, 7); MeshTools::primitiveCount(MeshPrimitive::Triangles, 14); - CORRADE_COMPARE(out.str(), + CORRADE_COMPARE(out, "MeshTools::primitiveCount(): expected either zero or at least 2 elements for MeshPrimitive::LineLoop, got 1\n" "MeshTools::primitiveCount(): expected either zero or at least 3 elements for MeshPrimitive::TriangleStrip, got 1\n" "MeshTools::primitiveCount(): expected either zero or at least 3 elements for MeshPrimitive::TriangleFan, got 2\n" @@ -356,10 +354,10 @@ void GenerateIndicesTest::primitiveCountInvalidVertexCount() { void GenerateIndicesTest::primitiveCountInvalidPrimitive() { CORRADE_SKIP_IF_NO_ASSERT(); - std::ostringstream out; + Containers::String out; Error redirectError{&out}; MeshTools::primitiveCount(MeshPrimitive(0xdead), 2); - CORRADE_COMPARE(out.str(), + CORRADE_COMPARE(out, "MeshTools::primitiveCount(): invalid primitive MeshPrimitive(0xdead)\n"); } @@ -509,11 +507,11 @@ void GenerateIndicesTest::generateLineStripIndicesWrongVertexCount() { UnsignedShort indices[1]; - std::ostringstream out; + Containers::String out; Error redirectError{&out}; MeshTools::generateLineStripIndices(1); MeshTools::generateLineStripIndices(indices); - CORRADE_COMPARE(out.str(), + CORRADE_COMPARE(out, "MeshTools::generateLineStripIndicesInto(): expected either zero or at least two vertices, got 1\n" "MeshTools::generateLineStripIndicesInto(): expected either zero or at least two indices, got 1\n"); } @@ -524,13 +522,13 @@ void GenerateIndicesTest::generateLineStripIndicesIntoWrongSize() { UnsignedByte indices[5]; UnsignedInt output[7]; - std::ostringstream out; + Containers::String out; Error redirectError{&out}; MeshTools::generateLineStripIndicesInto(0, output); MeshTools::generateLineStripIndicesInto(Containers::arrayView(indices).prefix(0), output); MeshTools::generateLineStripIndicesInto(5, output); MeshTools::generateLineStripIndicesInto(indices, output); - CORRADE_COMPARE(out.str(), + CORRADE_COMPARE(out, "MeshTools::generateLineStripIndicesInto(): bad output size, expected 0 but got 7\n" "MeshTools::generateLineStripIndicesInto(): bad output size, expected 0 but got 7\n" "MeshTools::generateLineStripIndicesInto(): bad output size, expected 8 but got 7\n" @@ -542,11 +540,11 @@ void GenerateIndicesTest::generateLineStripIndicesIndexed2DInvalid() { char indices[3*4]; - std::ostringstream out; + Containers::String out; Error redirectError{&out}; MeshTools::generateLineStripIndices(Containers::StridedArrayView2D{indices, {3, 4}}.every({1, 2})); MeshTools::generateLineStripIndices(Containers::StridedArrayView2D{indices, {4, 3}}); - CORRADE_COMPARE(out.str(), + CORRADE_COMPARE(out, "MeshTools::generateLineStripIndicesInto(): second index view dimension is not contiguous\n" "MeshTools::generateLineStripIndicesInto(): expected index type size 1, 2 or 4 but got 3\n"); } @@ -688,11 +686,11 @@ void GenerateIndicesTest::generateLineLoopIndicesWrongVertexCount() { UnsignedInt indices[1]; - std::ostringstream out; + Containers::String out; Error redirectError{&out}; MeshTools::generateLineLoopIndices(1); MeshTools::generateLineLoopIndices(indices); - CORRADE_COMPARE(out.str(), + CORRADE_COMPARE(out, "MeshTools::generateLineLoopIndicesInto(): expected either zero or at least two vertices, got 1\n" "MeshTools::generateLineLoopIndicesInto(): expected either zero or at least two indices, got 1\n"); } @@ -703,13 +701,13 @@ void GenerateIndicesTest::generateLineLoopIndicesIntoWrongSize() { UnsignedShort indices[5]; UnsignedInt output[9]; - std::ostringstream out; + Containers::String out; Error redirectError{&out}; MeshTools::generateLineLoopIndicesInto(0, output); MeshTools::generateLineLoopIndicesInto(Containers::arrayView(indices).prefix(0), output); MeshTools::generateLineLoopIndicesInto(5, output); MeshTools::generateLineLoopIndicesInto(indices, output); - CORRADE_COMPARE(out.str(), + CORRADE_COMPARE(out, "MeshTools::generateLineLoopIndicesInto(): bad output size, expected 0 but got 9\n" "MeshTools::generateLineLoopIndicesInto(): bad output size, expected 0 but got 9\n" "MeshTools::generateLineLoopIndicesInto(): bad output size, expected 10 but got 9\n" @@ -721,11 +719,11 @@ void GenerateIndicesTest::generateLineLoopIndicesIndexed2DInvalid() { char indices[3*4]; - std::ostringstream out; + Containers::String out; Error redirectError{&out}; MeshTools::generateLineLoopIndices(Containers::StridedArrayView2D{indices, {3, 4}}.every({1, 2})); MeshTools::generateLineLoopIndices(Containers::StridedArrayView2D{indices, {4, 3}}); - CORRADE_COMPARE(out.str(), + CORRADE_COMPARE(out, "MeshTools::generateLineLoopIndicesInto(): second index view dimension is not contiguous\n" "MeshTools::generateLineLoopIndicesInto(): expected index type size 1, 2 or 4 but got 3\n"); } @@ -864,11 +862,11 @@ void GenerateIndicesTest::generateTriangleStripIndicesWrongVertexCount() { UnsignedByte indices[2]; - std::ostringstream out; + Containers::String out; Error redirectError{&out}; MeshTools::generateTriangleStripIndices(2); MeshTools::generateTriangleStripIndices(indices); - CORRADE_COMPARE(out.str(), + CORRADE_COMPARE(out, "MeshTools::generateTriangleStripIndicesInto(): expected either zero or at least three vertices, got 2\n" "MeshTools::generateTriangleStripIndicesInto(): expected either zero or at least three indices, got 2\n"); } @@ -879,13 +877,13 @@ void GenerateIndicesTest::generateTriangleStripIndicesIntoWrongSize() { UnsignedInt indices[5]; UnsignedInt output[8]; - std::ostringstream out; + Containers::String out; Error redirectError{&out}; MeshTools::generateTriangleStripIndicesInto(0, output); MeshTools::generateTriangleStripIndicesInto(Containers::arrayView(indices).prefix(0), output); MeshTools::generateTriangleStripIndicesInto(5, output); MeshTools::generateTriangleStripIndicesInto(indices, output); - CORRADE_COMPARE(out.str(), + CORRADE_COMPARE(out, "MeshTools::generateTriangleStripIndicesInto(): bad output size, expected 0 but got 8\n" "MeshTools::generateTriangleStripIndicesInto(): bad output size, expected 0 but got 8\n" "MeshTools::generateTriangleStripIndicesInto(): bad output size, expected 9 but got 8\n" @@ -897,11 +895,11 @@ void GenerateIndicesTest::generateTriangleStripIndicesIndexed2DInvalid() { char indices[3*4]; - std::ostringstream out; + Containers::String out; Error redirectError{&out}; MeshTools::generateTriangleStripIndices(Containers::StridedArrayView2D{indices, {3, 4}}.every({1, 2})); MeshTools::generateTriangleStripIndices(Containers::StridedArrayView2D{indices, {4, 3}}); - CORRADE_COMPARE(out.str(), + CORRADE_COMPARE(out, "MeshTools::generateTriangleStripIndicesInto(): second index view dimension is not contiguous\n" "MeshTools::generateTriangleStripIndicesInto(): expected index type size 1, 2 or 4 but got 3\n"); } @@ -1041,11 +1039,11 @@ void GenerateIndicesTest::generateTriangleFanIndicesWrongVertexCount() { UnsignedInt indices[2]; - std::ostringstream out; + Containers::String out; Error redirectError{&out}; MeshTools::generateTriangleFanIndices(2); MeshTools::generateTriangleFanIndices(indices); - CORRADE_COMPARE(out.str(), + CORRADE_COMPARE(out, "MeshTools::generateTriangleFanIndicesInto(): expected either zero or at least three vertices, got 2\n" "MeshTools::generateTriangleFanIndicesInto(): expected either zero or at least three indices, got 2\n"); } @@ -1056,13 +1054,13 @@ void GenerateIndicesTest::generateTriangleFanIndicesIntoWrongSize() { UnsignedInt indices[5]; UnsignedInt output[8]; - std::ostringstream out; + Containers::String out; Error redirectError{&out}; MeshTools::generateTriangleFanIndicesInto(0, output); MeshTools::generateTriangleFanIndicesInto(Containers::arrayView(indices).prefix(0), output); MeshTools::generateTriangleFanIndicesInto(5, output); MeshTools::generateTriangleFanIndicesInto(indices, output); - CORRADE_COMPARE(out.str(), + CORRADE_COMPARE(out, "MeshTools::generateTriangleFanIndicesInto(): bad output size, expected 0 but got 8\n" "MeshTools::generateTriangleFanIndicesInto(): bad output size, expected 0 but got 8\n" "MeshTools::generateTriangleFanIndicesInto(): bad output size, expected 9 but got 8\n" @@ -1074,11 +1072,11 @@ void GenerateIndicesTest::generateTriangleFanIndicesIndexed2DInvalid() { char indices[3*4]; - std::ostringstream out; + Containers::String out; Error redirectError{&out}; MeshTools::generateTriangleFanIndices(Containers::StridedArrayView2D{indices, {3, 4}}.every({1, 2})); MeshTools::generateTriangleFanIndices(Containers::StridedArrayView2D{indices, {4, 3}}); - CORRADE_COMPARE(out.str(), + CORRADE_COMPARE(out, "MeshTools::generateTriangleFanIndicesInto(): second index view dimension is not contiguous\n" "MeshTools::generateTriangleFanIndicesInto(): expected index type size 1, 2 or 4 but got 3\n"); } @@ -1207,10 +1205,10 @@ void GenerateIndicesTest::generateQuadIndicesWrongIndexCount() { UnsignedInt quads[13]; - std::ostringstream out; + Containers::String out; Error redirectError{&out}; MeshTools::generateQuadIndices({}, quads); - CORRADE_COMPARE(out.str(), + CORRADE_COMPARE(out, "MeshTools::generateQuadIndicesInto(): quad index count 13 not divisible by 4\n"); } @@ -1220,10 +1218,10 @@ void GenerateIndicesTest::generateQuadIndicesIndexOutOfRange() { UnsignedInt quads[]{5, 4, 6, 7}; Vector3 positions[7]; - std::ostringstream out; + Containers::String out; Error redirectError{&out}; MeshTools::generateQuadIndices(positions, quads); - CORRADE_COMPARE(out.str(), + CORRADE_COMPARE(out, "MeshTools::generateQuadIndicesInto(): index 7 out of range for 7 elements\n"); } @@ -1233,19 +1231,19 @@ void GenerateIndicesTest::generateQuadIndicesIntoWrongSize() { UnsignedInt quads[12]; UnsignedInt output[19]; - std::ostringstream out; + Containers::String out; Error redirectError{&out}; MeshTools::generateQuadIndicesInto({}, quads, output); - CORRADE_COMPARE(out.str(), + CORRADE_COMPARE(out, "MeshTools::generateQuadIndicesInto(): bad output size, expected 18 but got 19\n"); } void GenerateIndicesTest::generateIndicesMeshData() { auto&& data = MeshDataData[testCaseInstanceId()]; { - std::ostringstream out; + Containers::String out; Debug{&out, Debug::Flag::NoNewlineAtTheEnd} << data.primitive; - setTestCaseDescription(out.str()); + setTestCaseDescription(out); } const struct Vertex { @@ -1302,9 +1300,9 @@ template void GenerateIndicesTest::generateIndicesMeshDataIndexed() { auto&& data = MeshDataData[testCaseInstanceId()]; setTestCaseTemplateName(Math::TypeTraits::name()); { - std::ostringstream out; + Containers::String out; Debug{&out, Debug::Flag::NoNewlineAtTheEnd} << data.primitive; - setTestCaseDescription(out.str()); + setTestCaseDescription(out); } const struct Vertex { @@ -1364,9 +1362,9 @@ template void GenerateIndicesTest::generateIndicesMeshDataIndexed() { void GenerateIndicesTest::generateIndicesMeshDataEmpty() { auto&& data = MeshDataData[testCaseInstanceId()]; { - std::ostringstream out; + Containers::String out; Debug{&out, Debug::Flag::NoNewlineAtTheEnd} << data.primitive; - setTestCaseDescription(out.str()); + setTestCaseDescription(out); } /* Similar to generateIndicesMeshData(), just with 0 vertices. Verifying it @@ -1604,19 +1602,19 @@ void GenerateIndicesTest::generateIndicesMeshDataTrivialIndexedMoveDifferentInde void GenerateIndicesTest::generateIndicesMeshDataInvalidVertexCount() { auto&& data = MeshDataInvalidVertexCountData[testCaseInstanceId()]; - std::ostringstream primitiveName; + Containers::String primitiveName; Debug{&primitiveName, Debug::Flag::NoNewlineAtTheEnd} << data.primitive; - setTestCaseDescription(primitiveName.str()); + setTestCaseDescription(primitiveName); CORRADE_SKIP_IF_NO_ASSERT(); Trade::MeshData mesh{data.primitive, data.invalidVertexCount}; - std::ostringstream out; + Containers::String out; Error redirectError{&out}; generateIndices(mesh); - CORRADE_COMPARE(out.str(), Utility::formatString( - "MeshTools::generateIndices(): expected either zero or at least {} vertices for {}, got {}\n", data.expectedVertexCount, primitiveName.str(), data.invalidVertexCount)); + CORRADE_COMPARE(out, Utility::format( + "MeshTools::generateIndices(): expected either zero or at least {} vertices for {}, got {}\n", data.expectedVertexCount, primitiveName, data.invalidVertexCount)); } void GenerateIndicesTest::generateIndicesMeshDataImplementationSpecificIndexType() { @@ -1626,10 +1624,10 @@ void GenerateIndicesTest::generateIndicesMeshDataImplementationSpecificIndexType nullptr, Trade::MeshIndexData{meshIndexTypeWrap(0xcaca), Containers::StridedArrayView1D{}}, nullptr, {}, 3}; - std::ostringstream out; + Containers::String out; Error redirectError{&out}; generateIndices(a); - CORRADE_COMPARE(out.str(), "MeshTools::generateIndices(): mesh has an implementation-specific index type 0xcaca\n"); + CORRADE_COMPARE(out, "MeshTools::generateIndices(): mesh has an implementation-specific index type 0xcaca\n"); } }}}} diff --git a/src/Magnum/MeshTools/Test/GenerateLinesTest.cpp b/src/Magnum/MeshTools/Test/GenerateLinesTest.cpp index dc6fadb26..8ca1fd37d 100644 --- a/src/Magnum/MeshTools/Test/GenerateLinesTest.cpp +++ b/src/Magnum/MeshTools/Test/GenerateLinesTest.cpp @@ -24,10 +24,9 @@ DEALINGS IN THE SOFTWARE. */ -#include +#include #include #include -#include #include "Magnum/Math/Color.h" #include "Magnum/Math/PackingBatch.h" @@ -636,21 +635,21 @@ void GenerateLinesTest::notLines() { Vector3 positions[3]{}; - std::ostringstream out; + Containers::String out; Error redirectError{&out}; generateLines(Trade::MeshData{MeshPrimitive::TriangleFan, {}, positions, { Trade::MeshAttributeData{Trade::MeshAttribute::Position, Containers::stridedArrayView(positions)} }}); - CORRADE_COMPARE(out.str(), "MeshTools::generateLines(): expected a line primitive, got MeshPrimitive::TriangleFan\n"); + CORRADE_COMPARE(out, "MeshTools::generateLines(): expected a line primitive, got MeshPrimitive::TriangleFan\n"); } void GenerateLinesTest::noAttributes() { CORRADE_SKIP_IF_NO_ASSERT(); - std::ostringstream out; + Containers::String out; Error redirectError{&out}; generateLines(Trade::MeshData{MeshPrimitive::Lines, 12}); - CORRADE_COMPARE(out.str(), "MeshTools::generateLines(): the mesh has no positions\n"); + CORRADE_COMPARE(out, "MeshTools::generateLines(): the mesh has no positions\n"); } void GenerateLinesTest::noPositionAttribute() { @@ -658,12 +657,12 @@ void GenerateLinesTest::noPositionAttribute() { Vector3 colors[2]{}; - std::ostringstream out; + Containers::String out; Error redirectError{&out}; generateLines(Trade::MeshData{MeshPrimitive::Lines, {}, colors, { Trade::MeshAttributeData{Trade::MeshAttribute::Color, Containers::stridedArrayView(colors)} }}); - CORRADE_COMPARE(out.str(), "MeshTools::generateLines(): the mesh has no positions\n"); + CORRADE_COMPARE(out, "MeshTools::generateLines(): the mesh has no positions\n"); } }}}} diff --git a/src/Magnum/MeshTools/Test/GenerateNormalsTest.cpp b/src/Magnum/MeshTools/Test/GenerateNormalsTest.cpp index b430e2875..f5cff7d28 100644 --- a/src/Magnum/MeshTools/Test/GenerateNormalsTest.cpp +++ b/src/Magnum/MeshTools/Test/GenerateNormalsTest.cpp @@ -24,13 +24,12 @@ DEALINGS IN THE SOFTWARE. */ -#include #include #include #include +#include #include #include -#include #include "Magnum/Math/FunctionsBatch.h" #include "Magnum/Math/Vector3.h" @@ -40,6 +39,7 @@ #include "Magnum/Trade/MeshData.h" #ifdef MAGNUM_BUILD_DEPRECATED +#include #include #endif @@ -157,24 +157,24 @@ void GenerateNormalsTest::flatDeprecated() { void GenerateNormalsTest::flatWrongCount() { CORRADE_SKIP_IF_NO_ASSERT(); - std::stringstream out; + Containers::String out; Error redirectError{&out}; const Vector3 positions[7]; generateFlatNormals(positions); - CORRADE_COMPARE(out.str(), "MeshTools::generateFlatNormalsInto(): position count not divisible by 3\n"); + CORRADE_COMPARE(out, "MeshTools::generateFlatNormalsInto(): position count not divisible by 3\n"); } void GenerateNormalsTest::flatIntoWrongSize() { CORRADE_SKIP_IF_NO_ASSERT(); - std::stringstream out; + Containers::String out; Error redirectError{&out}; const Vector3 positions[6]; Vector3 normals[7]; generateFlatNormalsInto(positions, normals); - CORRADE_COMPARE(out.str(), "MeshTools::generateFlatNormalsInto(): bad output size, expected 6 but got 7\n"); + CORRADE_COMPARE(out, "MeshTools::generateFlatNormalsInto(): bad output size, expected 6 but got 7\n"); } template void GenerateNormalsTest::smoothTwoTriangles() { @@ -394,38 +394,38 @@ void GenerateNormalsTest::smoothNanPosition() { void GenerateNormalsTest::smoothWrongCount() { CORRADE_SKIP_IF_NO_ASSERT(); - std::stringstream out; + Containers::String out; Error redirectError{&out}; const UnsignedByte indices[7]{}; const Vector3 positions[1]; generateSmoothNormals(indices, positions); - CORRADE_COMPARE(out.str(), "MeshTools::generateSmoothNormalsInto(): index count not divisible by 3\n"); + CORRADE_COMPARE(out, "MeshTools::generateSmoothNormalsInto(): index count not divisible by 3\n"); } void GenerateNormalsTest::smoothOutOfRange() { CORRADE_SKIP_IF_NO_ASSERT(); - std::stringstream out; + Containers::String out; Error redirectError{&out}; const Vector3 positions[2]; const UnsignedInt indices[] { 0, 1, 2 }; generateSmoothNormals(indices, positions); - CORRADE_COMPARE(out.str(), "MeshTools::generateSmoothNormalsInto(): index 2 out of range for 2 elements\n"); + CORRADE_COMPARE(out, "MeshTools::generateSmoothNormalsInto(): index 2 out of range for 2 elements\n"); } void GenerateNormalsTest::smoothIntoWrongSize() { CORRADE_SKIP_IF_NO_ASSERT(); - std::stringstream out; + Containers::String out; Error redirectError{&out}; const UnsignedByte indices[6]{}; const Vector3 positions[3]; Vector3 normals[4]; generateSmoothNormalsInto(indices, positions, normals); - CORRADE_COMPARE(out.str(), "MeshTools::generateSmoothNormalsInto(): bad output size, expected 3 but got 4\n"); + CORRADE_COMPARE(out, "MeshTools::generateSmoothNormalsInto(): bad output size, expected 3 but got 4\n"); } void GenerateNormalsTest::benchmarkFlat() { @@ -473,10 +473,10 @@ void GenerateNormalsTest::smoothErasedNonContiguous() { const char indices[6*4]{}; const Vector3 positions[3]; - std::stringstream out; + Containers::String out; Error redirectError{&out}; generateSmoothNormals(Containers::StridedArrayView2D{indices, {6, 2}, {4, 2}}, positions); - CORRADE_COMPARE(out.str(), + CORRADE_COMPARE(out, "MeshTools::generateSmoothNormalsInto(): second index view dimension is not contiguous\n"); } @@ -486,10 +486,10 @@ void GenerateNormalsTest::smoothErasedWrongIndexSize() { const char indices[6*3]{}; const Vector3 positions[3]; - std::stringstream out; + Containers::String out; Error redirectError{&out}; generateSmoothNormals(Containers::StridedArrayView2D{indices, {6, 3}}.every(2), positions); - CORRADE_COMPARE(out.str(), + CORRADE_COMPARE(out, "MeshTools::generateSmoothNormalsInto(): expected index type size 1, 2 or 4 but got 3\n"); } diff --git a/src/Magnum/MeshTools/Test/InterleaveTest.cpp b/src/Magnum/MeshTools/Test/InterleaveTest.cpp index 53417a216..7677ccc04 100644 --- a/src/Magnum/MeshTools/Test/InterleaveTest.cpp +++ b/src/Magnum/MeshTools/Test/InterleaveTest.cpp @@ -24,16 +24,14 @@ DEALINGS IN THE SOFTWARE. */ -#include #include -#include /** @todo remove once Debug is stream-free */ +#include #include #include #include #include #include #include -#include /** @todo remove once Debug is stream-free */ #include "Magnum/Math/Vector3.h" #include "Magnum/MeshTools/Interleave.h" @@ -227,13 +225,13 @@ void InterleaveTest::attributeCountGaps() { void InterleaveTest::attributeCountInvalid() { CORRADE_SKIP_IF_NO_ASSERT(); - std::stringstream ss; - Error redirectError{&ss}; + Containers::String out; + Error redirectError{&out}; CORRADE_COMPARE(Implementation::AttributeCount{}( Containers::arrayView({0, 1, 2}), Containers::arrayView({0, 1, 2, 3, 4, 5}) ), std::size_t(0)); - CORRADE_COMPARE(ss.str(), "MeshTools::interleave(): attribute arrays don't have the same length, expected 3 but got 6\n"); + CORRADE_COMPARE(out, "MeshTools::interleave(): attribute arrays don't have the same length, expected 3 but got 6\n"); } void InterleaveTest::stride() { @@ -370,10 +368,10 @@ void InterleaveTest::interleaveIntoInvalid() { Containers::Array data{NoInit, 23}; - std::ostringstream out; + Containers::String out; Error redirectError{&out}; MeshTools::interleaveInto(data, 2, Containers::arrayView({1, 2, 3, 4})); - CORRADE_COMPARE(out.str(), "MeshTools::interleaveInto(): expected a buffer of at least 24 bytes but got 23\n"); + CORRADE_COMPARE(out, "MeshTools::interleaveInto(): expected a buffer of at least 24 bytes but got 23\n"); } void InterleaveTest::interleavedData() { @@ -614,10 +612,10 @@ void InterleaveTest::interleavedDataNotInterleaved() { }}; CORRADE_VERIFY(!MeshTools::isInterleaved(data)); - std::ostringstream out; + Containers::String out; Error redirectError{&out}; MeshTools::interleavedData(data); - CORRADE_COMPARE(out.str(), "MeshTools::interleavedData(): the mesh is not interleaved\n"); + CORRADE_COMPARE(out, "MeshTools::interleavedData(): the mesh is not interleaved\n"); } void InterleaveTest::interleavedDataAttributeAcrossStride() { @@ -697,10 +695,10 @@ void InterleaveTest::interleavedMutableDataNotMutable() { Trade::MeshData data{MeshPrimitive::Lines, {}, a, {}, 15}; CORRADE_VERIFY(MeshTools::isInterleaved(data)); - std::ostringstream out; + Containers::String out; Error redirectError{&out}; MeshTools::interleavedMutableData(data); - CORRADE_COMPARE(out.str(), "MeshTools::interleavedMutableData(): vertex data is not mutable\n"); + CORRADE_COMPARE(out, "MeshTools::interleavedMutableData(): vertex data is not mutable\n"); } void InterleaveTest::interleavedDataImplementationSpecificVertexFormat() { @@ -870,10 +868,10 @@ void InterleaveTest::interleavedLayoutImplementationSpecificVertexFormat() { Trade::MeshAttributeData{Trade::MeshAttribute::Normal, vertexFormatWrap(0xcaca), nullptr}, }}; - std::ostringstream out; + Containers::String out; Error redirectError{&out}; MeshTools::interleavedLayout(data, 5); - CORRADE_COMPARE(out.str(), "MeshTools::interleavedLayout(): attribute 1 has an implementation-specific format 0xcaca\n"); + CORRADE_COMPARE(out, "MeshTools::interleavedLayout(): attribute 1 has an implementation-specific format 0xcaca\n"); } void InterleaveTest::interleavedLayoutExtra() { @@ -972,14 +970,14 @@ void InterleaveTest::interleavedLayoutExtraTooNegativePadding() { Trade::MeshData data{MeshPrimitive::Triangles, Utility::move(vertexData), {positions}}; - std::ostringstream out; + Containers::String out; Error redirectError{&out}; MeshTools::interleavedLayout(data, 100, { Trade::MeshAttributeData{Trade::MeshAttribute::Normal, VertexFormat::Vector3, positions.data()}, Trade::MeshAttributeData{-25} }); - CORRADE_COMPARE(out.str(), "MeshTools::interleavedLayout(): negative padding -25 in extra attribute 1 too large for stride 24\n"); + CORRADE_COMPARE(out, "MeshTools::interleavedLayout(): negative padding -25 in extra attribute 1 too large for stride 24\n"); } void InterleaveTest::interleavedLayoutExtraOnly() { @@ -1013,13 +1011,13 @@ void InterleaveTest::interleavedLayoutExtraImplementationSpecificVertexFormat() Trade::MeshAttributeData{Trade::MeshAttribute::Position, VertexFormat::Vector2, nullptr}, }}; - std::ostringstream out; + Containers::String out; Error redirectError{&out}; MeshTools::interleavedLayout(data, 5, { Trade::MeshAttributeData{Trade::MeshAttribute::TextureCoordinates, VertexFormat::Vector2, nullptr}, Trade::MeshAttributeData{Trade::MeshAttribute::Normal, vertexFormatWrap(0xcaca), nullptr}, }); - CORRADE_COMPARE(out.str(), "MeshTools::interleavedLayout(): extra attribute 1 has an implementation-specific format 0xcaca\n"); + CORRADE_COMPARE(out, "MeshTools::interleavedLayout(): extra attribute 1 has an implementation-specific format 0xcaca\n"); } void InterleaveTest::interleavedLayoutAlreadyInterleaved() { @@ -1329,10 +1327,10 @@ void InterleaveTest::interleaveMeshDataImplementationSpecificIndexType() { Trade::MeshAttributeData{Trade::MeshAttribute::Position, VertexFormat::Vector2, nullptr} }}; - std::ostringstream out; + Containers::String out; Error redirectError{&out}; MeshTools::interleave(data); - CORRADE_COMPARE(out.str(), "MeshTools::interleave(): mesh has an implementation-specific index type 0xcaca, enable MeshTools::InterleaveFlag::PreserveStridedIndices to pass the array through unchanged\n"); + CORRADE_COMPARE(out, "MeshTools::interleave(): mesh has an implementation-specific index type 0xcaca, enable MeshTools::InterleaveFlag::PreserveStridedIndices to pass the array through unchanged\n"); } void InterleaveTest::interleaveMeshDataImplementationSpecificVertexFormat() { @@ -1343,11 +1341,11 @@ void InterleaveTest::interleaveMeshDataImplementationSpecificVertexFormat() { Trade::MeshAttributeData{Trade::MeshAttribute::Normal, vertexFormatWrap(0xcaca), nullptr}, }}; - std::ostringstream out; + Containers::String out; Error redirectError{&out}; MeshTools::interleave(data); /* Assert is coming from interleavedLayout() because... that's easier */ - CORRADE_COMPARE(out.str(), "MeshTools::interleavedLayout(): attribute 1 has an implementation-specific format 0xcaca\n"); + CORRADE_COMPARE(out, "MeshTools::interleavedLayout(): attribute 1 has an implementation-specific format 0xcaca\n"); } void InterleaveTest::interleaveMeshDataExtra() { @@ -1432,13 +1430,13 @@ void InterleaveTest::interleaveMeshDataExtraWrongCount() { }}; const Vector3 normals[]{Vector3::xAxis(), Vector3::yAxis()}; - std::ostringstream out; + Containers::String out; Error redirectError{&out}; MeshTools::interleave(data, { Trade::MeshAttributeData{10}, Trade::MeshAttributeData{Trade::MeshAttribute::Normal, VertexFormat::Vector3, Containers::arrayView(normals)} }); - CORRADE_COMPARE(out.str(), "MeshTools::interleave(): extra attribute 1 expected to have 3 items but got 2\n"); + CORRADE_COMPARE(out, "MeshTools::interleave(): extra attribute 1 expected to have 3 items but got 2\n"); } void InterleaveTest::interleaveMeshDataExtraOffsetOnly() { @@ -1446,13 +1444,13 @@ void InterleaveTest::interleaveMeshDataExtraOffsetOnly() { Trade::MeshData data{MeshPrimitive::TriangleFan, 5}; - std::ostringstream out; + Containers::String out; Error redirectError{&out}; MeshTools::interleave(data, { Trade::MeshAttributeData{10}, Trade::MeshAttributeData{Trade::MeshAttribute::Normal, VertexFormat::Vector3, 3, 5, 14} }); - CORRADE_COMPARE(out.str(), "MeshTools::interleave(): extra attribute 1 is offset-only\n"); + CORRADE_COMPARE(out, "MeshTools::interleave(): extra attribute 1 is offset-only\n"); } void InterleaveTest::interleaveMeshDataExtraImplementationSpecificVertexFormat() { @@ -1462,14 +1460,14 @@ void InterleaveTest::interleaveMeshDataExtraImplementationSpecificVertexFormat() Trade::MeshAttributeData{Trade::MeshAttribute::Position, VertexFormat::Vector2, nullptr}, }}; - std::ostringstream out; + Containers::String out; Error redirectError{&out}; MeshTools::interleave(data, { Trade::MeshAttributeData{Trade::MeshAttribute::TextureCoordinates, VertexFormat::Vector2, nullptr}, Trade::MeshAttributeData{Trade::MeshAttribute::Normal, vertexFormatWrap(0xcaca), nullptr}, }); /* Assert is coming from interleavedLayout() because... that's easier */ - CORRADE_COMPARE(out.str(), "MeshTools::interleavedLayout(): extra attribute 1 has an implementation-specific format 0xcaca\n"); + CORRADE_COMPARE(out, "MeshTools::interleavedLayout(): extra attribute 1 has an implementation-specific format 0xcaca\n"); } void InterleaveTest::interleaveMeshDataAlreadyInterleavedMove() { @@ -1687,7 +1685,7 @@ void InterleaveTest::interleaveMeshDataLooseAttributesInvalid() { Trade::MeshAttributeData{Trade::MeshAttribute::Position, Containers::ArrayView{nullptr, 0}} }).vertexCount(), 0); - std::ostringstream out; + Containers::String out; Error redirectError{&out}; MeshTools::interleave(MeshPrimitive::Triangles, Trade::MeshIndexData{indices}, { @@ -1701,7 +1699,7 @@ void InterleaveTest::interleaveMeshDataLooseAttributesInvalid() { Trade::MeshIndexData{meshIndexTypeWrap(0xcece), Containers::stridedArrayView(indices)}, { Trade::MeshAttributeData{Trade::MeshAttribute::Position, Containers::ArrayView{nullptr, 3}} }); - CORRADE_COMPARE_AS(out.str(), + CORRADE_COMPARE_AS(out, "MeshTools::interleave(): only padding found among 1 attributes, can't infer vertex count\n" "MeshTools::interleave(): only padding found among 2 attributes, can't infer vertex count\n" "MeshTools::interleave(): implementation-specific index type 0xcece\n", diff --git a/src/Magnum/MeshTools/Test/RemoveDuplicatesTest.cpp b/src/Magnum/MeshTools/Test/RemoveDuplicatesTest.cpp index 598c9d081..0892e6ef0 100644 --- a/src/Magnum/MeshTools/Test/RemoveDuplicatesTest.cpp +++ b/src/Magnum/MeshTools/Test/RemoveDuplicatesTest.cpp @@ -26,12 +26,11 @@ #include /* std::shuffle() */ #include /* random device for std::shuffle() */ -#include #include #include +#include #include #include -#include #include "Magnum/Math/Vector3.h" #include "Magnum/MeshTools/RemoveDuplicates.h" @@ -290,11 +289,11 @@ void RemoveDuplicatesTest::removeDuplicatesNonContiguous() { Int data[8]{}; - std::ostringstream out; + Containers::String out; Error redirectError{&out}; MeshTools::removeDuplicates(Containers::arrayCast<2, const char>(Containers::arrayView(data)).every({1, 2})); MeshTools::removeDuplicatesInPlace(Containers::arrayCast<2, char>(Containers::arrayView(data)).every({1, 2})); - CORRADE_COMPARE(out.str(), + CORRADE_COMPARE(out, "MeshTools::removeDuplicatesInto(): second data view dimension is not contiguous\n" "MeshTools::removeDuplicatesInPlaceInto(): second data view dimension is not contiguous\n"); } @@ -305,7 +304,7 @@ void RemoveDuplicatesTest::removeDuplicatesIntoWrongOutputSize() { Int data[8]{}; UnsignedInt output[7]; - std::ostringstream out; + Containers::String out; Error redirectError{&out}; MeshTools::removeDuplicatesInto( Containers::arrayCast<2, const char>(Containers::arrayView(data)), @@ -313,7 +312,7 @@ void RemoveDuplicatesTest::removeDuplicatesIntoWrongOutputSize() { MeshTools::removeDuplicatesInPlaceInto( Containers::arrayCast<2, char>(Containers::arrayView(data)), output); - CORRADE_COMPARE(out.str(), + CORRADE_COMPARE(out, "MeshTools::removeDuplicatesInto(): output index array has 7 elements but expected 8\n" "MeshTools::removeDuplicatesInPlaceInto(): output index array has 7 elements but expected 8\n"); } @@ -337,7 +336,7 @@ template void RemoveDuplicatesTest::removeDuplicatesIndexedInPlace() { void RemoveDuplicatesTest::removeDuplicatesIndexedInPlaceSmallType() { CORRADE_SKIP_IF_NO_ASSERT(); - std::stringstream out; + Containers::String out; Error redirectError{&out}; UnsignedByte indices[1]; @@ -345,7 +344,7 @@ void RemoveDuplicatesTest::removeDuplicatesIndexedInPlaceSmallType() { MeshTools::removeDuplicatesIndexedInPlace( Containers::stridedArrayView(indices), Containers::arrayCast<2, char>(Containers::arrayView(data))); - CORRADE_COMPARE(out.str(), "MeshTools::removeDuplicatesIndexedInPlace(): a 1-byte index type is too small for 256 vertices\n"); + CORRADE_COMPARE(out, "MeshTools::removeDuplicatesIndexedInPlace(): a 1-byte index type is too small for 256 vertices\n"); } void RemoveDuplicatesTest::removeDuplicatesIndexedInPlaceEmptyIndices() { @@ -387,12 +386,12 @@ void RemoveDuplicatesTest::removeDuplicatesIndexedInPlaceErasedNonContiguous() { char indices[6*4]{}; Int data[1]{}; - std::stringstream out; + Containers::String out; Error redirectError{&out}; MeshTools::removeDuplicatesIndexedInPlace( Containers::StridedArrayView2D{indices, {6, 2}, {4, 2}}, Containers::arrayCast<2, char>(Containers::arrayView(data))); - CORRADE_COMPARE(out.str(), + CORRADE_COMPARE(out, "MeshTools::removeDuplicatesIndexedInPlace(): second index view dimension is not contiguous\n"); } @@ -402,12 +401,12 @@ void RemoveDuplicatesTest::removeDuplicatesIndexedInPlaceErasedWrongIndexSize() char indices[6*3]{}; Int data[1]{}; - std::stringstream out; + Containers::String out; Error redirectError{&out}; MeshTools::removeDuplicatesIndexedInPlace( Containers::StridedArrayView2D{indices, {6, 3}}, Containers::arrayCast<2, char>(Containers::arrayView(data))); - CORRADE_COMPARE(out.str(), + CORRADE_COMPARE(out, "MeshTools::removeDuplicatesIndexedInPlace(): expected index type size 1, 2 or 4 but got 3\n"); } @@ -490,12 +489,12 @@ void RemoveDuplicatesTest::removeDuplicatesFuzzyInPlaceIntoWrongOutputSize() { Vector2 data[8]{}; UnsignedInt output[7]; - std::ostringstream out; + Containers::String out; Error redirectError{&out}; MeshTools::removeDuplicatesFuzzyInPlaceInto( Containers::arrayCast<2, Float>(Containers::stridedArrayView(data)), output); - CORRADE_COMPARE(out.str(), + CORRADE_COMPARE(out, "MeshTools::removeDuplicatesFuzzyInPlaceInto(): output index array has 7 elements but expected 8\n"); } @@ -547,7 +546,7 @@ template void RemoveDuplicatesTest::removeDuplicatesFu void RemoveDuplicatesTest::removeDuplicatesFuzzyIndexedInPlaceSmallType() { CORRADE_SKIP_IF_NO_ASSERT(); - std::stringstream out; + Containers::String out; Error redirectError{&out}; UnsignedByte indices[1]; @@ -555,7 +554,7 @@ void RemoveDuplicatesTest::removeDuplicatesFuzzyIndexedInPlaceSmallType() { MeshTools::removeDuplicatesFuzzyIndexedInPlace( Containers::stridedArrayView(indices), Containers::arrayCast<2, Float>(Containers::stridedArrayView(data))); - CORRADE_COMPARE(out.str(), "MeshTools::removeDuplicatesFuzzyIndexedInPlace(): a 1-byte index type is too small for 256 vertices\n"); + CORRADE_COMPARE(out, "MeshTools::removeDuplicatesFuzzyIndexedInPlace(): a 1-byte index type is too small for 256 vertices\n"); } void RemoveDuplicatesTest::removeDuplicatesFuzzyIndexedInPlaceEmptyIndices() { @@ -609,12 +608,12 @@ void RemoveDuplicatesTest::removeDuplicatesFuzzyIndexedInPlaceErasedNonContiguou char indices[6*4]{}; Vector2 data[1]; - std::stringstream out; + Containers::String out; Error redirectError{&out}; MeshTools::removeDuplicatesFuzzyIndexedInPlace( Containers::StridedArrayView2D{indices, {6, 2}, {4, 2}}, Containers::arrayCast<2, Float>(Containers::stridedArrayView(data))); - CORRADE_COMPARE(out.str(), + CORRADE_COMPARE(out, "MeshTools::removeDuplicatesFuzzyIndexedInPlace(): second index view dimension is not contiguous\n"); } @@ -624,12 +623,12 @@ void RemoveDuplicatesTest::removeDuplicatesFuzzyIndexedInPlaceErasedWrongIndexSi char indices[6*3]{}; Vector2 data[1]; - std::stringstream out; + Containers::String out; Error redirectError{&out}; MeshTools::removeDuplicatesFuzzyIndexedInPlace( Containers::StridedArrayView2D{indices, {6, 3}}, Containers::arrayCast<2, Float>(Containers::stridedArrayView(data))); - CORRADE_COMPARE(out.str(), + CORRADE_COMPARE(out, "MeshTools::removeDuplicatesFuzzyIndexedInPlace(): expected index type size 1, 2 or 4 but got 3\n"); } @@ -831,37 +830,37 @@ void RemoveDuplicatesTest::removeDuplicatesMeshDataPaddedAttributes() { void RemoveDuplicatesTest::removeDuplicatesMeshDataAttributeless() { CORRADE_SKIP_IF_NO_ASSERT(); - std::ostringstream out; + Containers::String out; Error redirectError{&out}; MeshTools::removeDuplicates(Trade::MeshData{MeshPrimitive::Points, 10}); - CORRADE_COMPARE(out.str(), + CORRADE_COMPARE(out, "MeshTools::removeDuplicates(): can't remove duplicates in an attributeless mesh\n"); } void RemoveDuplicatesTest::removeDuplicatesMeshDataImplementationSpecificIndexType() { CORRADE_SKIP_IF_NO_ASSERT(); - std::ostringstream out; + Containers::String out; Error redirectError{&out}; MeshTools::removeDuplicates(Trade::MeshData{MeshPrimitive::Points, nullptr, Trade::MeshIndexData{meshIndexTypeWrap(0xcaca), Containers::StridedArrayView1D{}}, nullptr, { Trade::MeshAttributeData{Trade::MeshAttribute::Position, VertexFormat::Vector3, nullptr} }}); - CORRADE_COMPARE(out.str(), + CORRADE_COMPARE(out, "MeshTools::removeDuplicates(): mesh has an implementation-specific index type 0xcaca\n"); } void RemoveDuplicatesTest::removeDuplicatesMeshDataImplementationSpecificVertexFormat() { CORRADE_SKIP_IF_NO_ASSERT(); - std::ostringstream out; + Containers::String out; Error redirectError{&out}; MeshTools::removeDuplicates(Trade::MeshData{MeshPrimitive::Points, nullptr, { Trade::MeshAttributeData{Trade::MeshAttribute::Position, VertexFormat::Vector3, nullptr}, Trade::MeshAttributeData{Trade::MeshAttribute::Normal, vertexFormatWrap(0xcaca), nullptr} }}); - CORRADE_COMPARE(out.str(), + CORRADE_COMPARE(out, "MeshTools::removeDuplicates(): attribute 1 has an implementation-specific format 0xcaca\n"); } @@ -1174,37 +1173,37 @@ void RemoveDuplicatesTest::removeDuplicatesMeshDataFuzzyDouble() { void RemoveDuplicatesTest::removeDuplicatesMeshDataFuzzyAttributeless() { CORRADE_SKIP_IF_NO_ASSERT(); - std::ostringstream out; + Containers::String out; Error redirectError{&out}; MeshTools::removeDuplicatesFuzzy(Trade::MeshData{MeshPrimitive::Points, 10}); - CORRADE_COMPARE(out.str(), + CORRADE_COMPARE(out, "MeshTools::removeDuplicatesFuzzy(): can't remove duplicates in an attributeless mesh\n"); } void RemoveDuplicatesTest::removeDuplicatesMeshDataFuzzyImplementationSpecificIndexType() { CORRADE_SKIP_IF_NO_ASSERT(); - std::ostringstream out; + Containers::String out; Error redirectError{&out}; MeshTools::removeDuplicatesFuzzy(Trade::MeshData{MeshPrimitive::Points, nullptr, Trade::MeshIndexData{meshIndexTypeWrap(0xcaca), Containers::StridedArrayView1D{}}, nullptr, { Trade::MeshAttributeData{Trade::MeshAttribute::Position, VertexFormat::Vector3, nullptr} }}); - CORRADE_COMPARE(out.str(), + CORRADE_COMPARE(out, "MeshTools::removeDuplicatesFuzzy(): mesh has an implementation-specific index type 0xcaca\n"); } void RemoveDuplicatesTest::removeDuplicatesMeshDataFuzzyImplementationSpecificVertexFormat() { CORRADE_SKIP_IF_NO_ASSERT(); - std::ostringstream out; + Containers::String out; Error redirectError{&out}; MeshTools::removeDuplicatesFuzzy(Trade::MeshData{MeshPrimitive::Points, nullptr, { Trade::MeshAttributeData{Trade::MeshAttribute::Position, VertexFormat::Vector3, nullptr}, Trade::MeshAttributeData{Trade::MeshAttribute::Normal, vertexFormatWrap(0xcaca), nullptr} }}); - CORRADE_COMPARE(out.str(), + CORRADE_COMPARE(out, "MeshTools::removeDuplicatesFuzzy(): attribute 1 has an implementation-specific format 0xcaca\n"); } diff --git a/src/Magnum/MeshTools/Test/SubdivideTest.cpp b/src/Magnum/MeshTools/Test/SubdivideTest.cpp index fb223f9cd..ea13419bc 100644 --- a/src/Magnum/MeshTools/Test/SubdivideTest.cpp +++ b/src/Magnum/MeshTools/Test/SubdivideTest.cpp @@ -24,12 +24,11 @@ DEALINGS IN THE SOFTWARE. */ -#include #include +#include #include #include #include -#include #include "Magnum/Math/Vector3.h" #include "Magnum/MeshTools/RemoveDuplicates.h" @@ -112,13 +111,13 @@ void SubdivideTest::subdivideStl() { void SubdivideTest::subdivideWrongIndexCount() { CORRADE_SKIP_IF_NO_ASSERT(); - std::stringstream out; + Containers::String out; Error redirectError{&out}; Containers::Array positions; Containers::Array indices{2}; MeshTools::subdivide(indices, positions, interpolator1); - CORRADE_COMPARE(out.str(), "MeshTools::subdivide(): index count is not divisible by 3\n"); + CORRADE_COMPARE(out, "MeshTools::subdivide(): index count is not divisible by 3\n"); } template void SubdivideTest::subdivideInPlace() { @@ -140,27 +139,27 @@ template void SubdivideTest::subdivideInPlace() { void SubdivideTest::subdivideInPlaceWrongIndexCount() { CORRADE_SKIP_IF_NO_ASSERT(); - std::stringstream out; + Containers::String out; Error redirectError{&out}; UnsignedInt indices[6*4 + 1]{0, 1, 2, 1, 2, 3, /* and 18+1 more */}; Vector1 positions[]{0}; MeshTools::subdivideInPlace(Containers::stridedArrayView(indices), Containers::stridedArrayView(positions), interpolator1); - CORRADE_COMPARE(out.str(), "MeshTools::subdivideInPlace(): can't divide 25 indices to four parts with each having triangle faces\n"); + CORRADE_COMPARE(out, "MeshTools::subdivideInPlace(): can't divide 25 indices to four parts with each having triangle faces\n"); } void SubdivideTest::subdivideInPlaceSmallIndexType() { CORRADE_SKIP_IF_NO_ASSERT(); - std::stringstream out; + Containers::String out; Error redirectError{&out}; UnsignedByte indices[6*4]{0, 1, 2, 1, 2, 3, /* and 18 more */}; Vector1 positions[256]{}; MeshTools::subdivideInPlace(Containers::stridedArrayView(indices), Containers::stridedArrayView(positions), interpolator1); - CORRADE_COMPARE(out.str(), "MeshTools::subdivideInPlace(): a 1-byte index type is too small for 256 vertices\n"); + CORRADE_COMPARE(out, "MeshTools::subdivideInPlace(): a 1-byte index type is too small for 256 vertices\n"); } void SubdivideTest::benchmark() { diff --git a/src/Magnum/MeshTools/Test/TransformTest.cpp b/src/Magnum/MeshTools/Test/TransformTest.cpp index 3de7137c6..0c93566fa 100644 --- a/src/Magnum/MeshTools/Test/TransformTest.cpp +++ b/src/Magnum/MeshTools/Test/TransformTest.cpp @@ -24,15 +24,14 @@ DEALINGS IN THE SOFTWARE. */ -#include #include #include #include +#include #include #include #include -#include -#include +#include #include "Magnum/Math/Half.h" #include "Magnum/Math/Matrix3.h" @@ -552,13 +551,13 @@ void TransformTest::meshData2DNoPosition() { Trade::MeshAttributeData{Trade::MeshAttribute::Position, VertexFormat::Vector2, nullptr}, }}; - std::ostringstream out; + Containers::String out; Error redirectError{&out}; transform2D(mesh, {}, data.id, data.morphTargetId); if(data.morphTargetId == -1) - CORRADE_COMPARE(out.str(), "MeshTools::transform2D(): the mesh has no positions with index 1\n"); + CORRADE_COMPARE(out, "MeshTools::transform2D(): the mesh has no positions with index 1\n"); else - CORRADE_COMPARE(out.str(), "MeshTools::transform2D(): the mesh has no positions with index 0 in morph target 37\n"); + CORRADE_COMPARE(out, "MeshTools::transform2D(): the mesh has no positions with index 0 in morph target 37\n"); } void TransformTest::meshData2DNot2D() { @@ -568,10 +567,10 @@ void TransformTest::meshData2DNot2D() { Trade::MeshAttributeData{Trade::MeshAttribute::Position, VertexFormat::Vector3, nullptr} }}; - std::ostringstream out; + Containers::String out; Error redirectError{&out}; transform2D(mesh, {}); - CORRADE_COMPARE(out.str(), "MeshTools::transform2D(): expected 2D positions but got VertexFormat::Vector3\n"); + CORRADE_COMPARE(out, "MeshTools::transform2D(): expected 2D positions but got VertexFormat::Vector3\n"); } void TransformTest::meshData2DImplementationSpecificIndexType() { @@ -605,10 +604,10 @@ void TransformTest::meshData2DImplementationSpecificVertexFormat() { Trade::MeshAttributeData{Trade::MeshAttribute::Position, vertexFormatWrap(0xcaca), nullptr}, }}; - std::ostringstream out; + Containers::String out; Error redirectError{&out}; transform2D(mesh, {}, 1); - CORRADE_COMPARE(out.str(), "MeshTools::transform2D(): positions have an implementation-specific format 0xcaca\n"); + CORRADE_COMPARE(out, "MeshTools::transform2D(): positions have an implementation-specific format 0xcaca\n"); } void TransformTest::meshData2DRvaluePassthrough() { @@ -774,15 +773,15 @@ void TransformTest::meshData2DRvaluePassthroughNoPosition() { /* Mainly to verify there's no other accidental assertion from checking vertex format and that the ID + morph target ID gets correctly passed through, this message comes from the l-value overload */ - std::ostringstream out; + Containers::String out; Error redirectError{&out}; transform2D(Trade::MeshData{MeshPrimitive::Points, nullptr, { Trade::MeshAttributeData{Trade::MeshAttribute::Position, VertexFormat::Vector2, nullptr}, }}, {}, data.id, data.morphTargetId); if(data.morphTargetId == -1) - CORRADE_COMPARE(out.str(), "MeshTools::transform2D(): the mesh has no positions with index 1\n"); + CORRADE_COMPARE(out, "MeshTools::transform2D(): the mesh has no positions with index 1\n"); else - CORRADE_COMPARE(out.str(), "MeshTools::transform2D(): the mesh has no positions with index 0 in morph target 37\n"); + CORRADE_COMPARE(out, "MeshTools::transform2D(): the mesh has no positions with index 0 in morph target 37\n"); } void TransformTest::meshData2DRvaluePassthroughWrongFormat() { @@ -824,10 +823,10 @@ void TransformTest::meshData2DInPlaceNotMutable() { Trade::MeshAttributeData{Trade::MeshAttribute::Position, VertexFormat::Vector2, nullptr}, }}; - std::ostringstream out; + Containers::String out; Error redirectError{&out}; transform2DInPlace(mesh, {}); - CORRADE_COMPARE(out.str(), "MeshTools::transform2DInPlace(): vertex data not mutable\n"); + CORRADE_COMPARE(out, "MeshTools::transform2DInPlace(): vertex data not mutable\n"); } void TransformTest::meshData2DInPlaceNoPosition() { @@ -840,13 +839,13 @@ void TransformTest::meshData2DInPlaceNoPosition() { Trade::MeshAttributeData{Trade::MeshAttribute::Position, VertexFormat::Vector2, nullptr}, }}; - std::ostringstream out; + Containers::String out; Error redirectError{&out}; transform2DInPlace(mesh, {}, data.id, data.morphTargetId); if(data.morphTargetId == -1) - CORRADE_COMPARE(out.str(), "MeshTools::transform2DInPlace(): the mesh has no positions with index 1\n"); + CORRADE_COMPARE(out, "MeshTools::transform2DInPlace(): the mesh has no positions with index 1\n"); else - CORRADE_COMPARE(out.str(), "MeshTools::transform2DInPlace(): the mesh has no positions with index 0 in morph target 37\n"); + CORRADE_COMPARE(out, "MeshTools::transform2DInPlace(): the mesh has no positions with index 0 in morph target 37\n"); } void TransformTest::meshData2DInPlaceWrongFormat() { @@ -857,10 +856,10 @@ void TransformTest::meshData2DInPlaceWrongFormat() { Trade::MeshAttributeData{Trade::MeshAttribute::Position, VertexFormat::Vector2us, nullptr} }}; - std::ostringstream out; + Containers::String out; Error redirectError{&out}; transform2DInPlace(mesh, {}, 1); - CORRADE_COMPARE(out.str(), "MeshTools::transform2DInPlace(): expected VertexFormat::Vector2 positions but got VertexFormat::Vector2us\n"); + CORRADE_COMPARE(out, "MeshTools::transform2DInPlace(): expected VertexFormat::Vector2 positions but got VertexFormat::Vector2us\n"); } template void TransformTest::meshData3D() { @@ -1002,13 +1001,13 @@ void TransformTest::meshData3DNoPosition() { Trade::MeshAttributeData{Trade::MeshAttribute::Position, VertexFormat::Vector3, nullptr}, }}; - std::ostringstream out; + Containers::String out; Error redirectError{&out}; transform3D(mesh, {}, data.id, data.morphTargetId); if(data.morphTargetId == -1) - CORRADE_COMPARE(out.str(), "MeshTools::transform3D(): the mesh has no positions with index 1\n"); + CORRADE_COMPARE(out, "MeshTools::transform3D(): the mesh has no positions with index 1\n"); else - CORRADE_COMPARE(out.str(), "MeshTools::transform3D(): the mesh has no positions with index 0 in morph target 37\n"); + CORRADE_COMPARE(out, "MeshTools::transform3D(): the mesh has no positions with index 0 in morph target 37\n"); } void TransformTest::meshData3DNot3D() { @@ -1018,10 +1017,10 @@ void TransformTest::meshData3DNot3D() { Trade::MeshAttributeData{Trade::MeshAttribute::Position, VertexFormat::Vector2, nullptr} }}; - std::ostringstream out; + Containers::String out; Error redirectError{&out}; transform3D(mesh, {}); - CORRADE_COMPARE(out.str(), "MeshTools::transform3D(): expected 3D positions but got VertexFormat::Vector2\n"); + CORRADE_COMPARE(out, "MeshTools::transform3D(): expected 3D positions but got VertexFormat::Vector2\n"); } void TransformTest::meshData3DImplementationSpecificIndexType() { @@ -1060,10 +1059,10 @@ void TransformTest::meshData3DImplementationSpecificVertexFormat() { Trade::MeshAttributeData{data.otherAttribute, data.otherAttributeFormat, nullptr}, }}; - std::ostringstream out; + Containers::String out; Error redirectError{&out}; transform3D(mesh, {}, 1); - CORRADE_COMPARE(out.str(), Utility::formatString("MeshTools::transform3D(): {} have an implementation-specific format 0xcaca\n", data.name)); + CORRADE_COMPARE(out, Utility::format("MeshTools::transform3D(): {} have an implementation-specific format 0xcaca\n", data.name)); } void TransformTest::meshData3DRvaluePassthrough() { @@ -1287,15 +1286,15 @@ void TransformTest::meshData3DRvaluePassthroughNoPosition() { /* Mainly to verify there's no other accidental assertion from checking vertex format and that the ID + morph target ID gets correctly passed through, this message comes from the l-value overload */ - std::ostringstream out; + Containers::String out; Error redirectError{&out}; transform3D(Trade::MeshData{MeshPrimitive::Points, nullptr, { Trade::MeshAttributeData{Trade::MeshAttribute::Position, VertexFormat::Vector3, nullptr}, }}, {}, data.id, data.morphTargetId); if(data.morphTargetId == -1) - CORRADE_COMPARE(out.str(), "MeshTools::transform3D(): the mesh has no positions with index 1\n"); + CORRADE_COMPARE(out, "MeshTools::transform3D(): the mesh has no positions with index 1\n"); else - CORRADE_COMPARE(out.str(), "MeshTools::transform3D(): the mesh has no positions with index 0 in morph target 37\n"); + CORRADE_COMPARE(out, "MeshTools::transform3D(): the mesh has no positions with index 0 in morph target 37\n"); } void TransformTest::meshData3DRvaluePassthroughWrongFormat() { @@ -1392,10 +1391,10 @@ void TransformTest::meshData3DInPlaceNotMutable() { Trade::MeshAttributeData{Trade::MeshAttribute::Position, VertexFormat::Vector3, nullptr}, }}; - std::ostringstream out; + Containers::String out; Error redirectError{&out}; transform3DInPlace(mesh, {}); - CORRADE_COMPARE(out.str(), "MeshTools::transform3DInPlace(): vertex data not mutable\n"); + CORRADE_COMPARE(out, "MeshTools::transform3DInPlace(): vertex data not mutable\n"); } void TransformTest::meshData3DInPlaceNoPosition() { @@ -1408,13 +1407,13 @@ void TransformTest::meshData3DInPlaceNoPosition() { Trade::MeshAttributeData{Trade::MeshAttribute::Position, VertexFormat::Vector3, nullptr}, }}; - std::ostringstream out; + Containers::String out; Error redirectError{&out}; transform3DInPlace(mesh, {}, data.id, data.morphTargetId); if(data.morphTargetId == -1) - CORRADE_COMPARE(out.str(), "MeshTools::transform3DInPlace(): the mesh has no positions with index 1\n"); + CORRADE_COMPARE(out, "MeshTools::transform3DInPlace(): the mesh has no positions with index 1\n"); else - CORRADE_COMPARE(out.str(), "MeshTools::transform3DInPlace(): the mesh has no positions with index 0 in morph target 37\n"); + CORRADE_COMPARE(out, "MeshTools::transform3DInPlace(): the mesh has no positions with index 0 in morph target 37\n"); } void TransformTest::meshData3DInPlaceWrongFormat() { @@ -1439,10 +1438,10 @@ void TransformTest::meshData3DInPlaceWrongFormat() { Trade::MeshData mesh{MeshPrimitive::Points, nullptr, Utility::move(attributes)}; - std::ostringstream out; + Containers::String out; Error redirectError{&out}; transform3DInPlace(mesh, {}, 1); - CORRADE_COMPARE(out.str(), data.message); + CORRADE_COMPARE(out, data.message); } template void TransformTest::meshDataTextureCoordinates2D() { @@ -1518,13 +1517,13 @@ void TransformTest::meshDataTextureCoordinates2DNoCoordinates() { Trade::MeshAttributeData{Trade::MeshAttribute::TextureCoordinates, VertexFormat::Vector2, nullptr}, }}; - std::ostringstream out; + Containers::String out; Error redirectError{&out}; transformTextureCoordinates2D(mesh, {}, data.id, data.morphTargetId); if(data.morphTargetId == -1) - CORRADE_COMPARE(out.str(), "MeshTools::transformTextureCoordinates2D(): the mesh has no texture coordinates with index 1\n"); + CORRADE_COMPARE(out, "MeshTools::transformTextureCoordinates2D(): the mesh has no texture coordinates with index 1\n"); else - CORRADE_COMPARE(out.str(), "MeshTools::transformTextureCoordinates2D(): the mesh has no texture coordinates with index 0 in morph target 37\n"); + CORRADE_COMPARE(out, "MeshTools::transformTextureCoordinates2D(): the mesh has no texture coordinates with index 0 in morph target 37\n"); } void TransformTest::meshDataTextureCoordinates2DImplementationSpecificIndexType() { @@ -1558,10 +1557,10 @@ void TransformTest::meshDataTextureCoordinates2DImplementationSpecificVertexForm Trade::MeshAttributeData{Trade::MeshAttribute::TextureCoordinates, vertexFormatWrap(0xcaca), nullptr}, }}; - std::ostringstream out; + Containers::String out; Error redirectError{&out}; transformTextureCoordinates2D(mesh, {}, 1); - CORRADE_COMPARE(out.str(), "MeshTools::transformTextureCoordinates2D(): texture coordinates have an implementation-specific format 0xcaca\n"); + CORRADE_COMPARE(out, "MeshTools::transformTextureCoordinates2D(): texture coordinates have an implementation-specific format 0xcaca\n"); } void TransformTest::meshDataTextureCoordinates2DRvaluePassthrough() { @@ -1727,15 +1726,15 @@ void TransformTest::meshDataTextureCoordinates2DRvaluePassthroughNoCoordinates() /* Mainly to verify there's no other accidental assertion from checking vertex format and that the ID + morph target ID gets correctly passed through, this message comes from the l-value overload */ - std::ostringstream out; + Containers::String out; Error redirectError{&out}; transformTextureCoordinates2D(Trade::MeshData{MeshPrimitive::Points, nullptr, { Trade::MeshAttributeData{Trade::MeshAttribute::TextureCoordinates, VertexFormat::Vector2, nullptr}, }}, {}, data.id, data.morphTargetId); if(data.morphTargetId == -1) - CORRADE_COMPARE(out.str(), "MeshTools::transformTextureCoordinates2D(): the mesh has no texture coordinates with index 1\n"); + CORRADE_COMPARE(out, "MeshTools::transformTextureCoordinates2D(): the mesh has no texture coordinates with index 1\n"); else - CORRADE_COMPARE(out.str(), "MeshTools::transformTextureCoordinates2D(): the mesh has no texture coordinates with index 0 in morph target 37\n"); + CORRADE_COMPARE(out, "MeshTools::transformTextureCoordinates2D(): the mesh has no texture coordinates with index 0 in morph target 37\n"); } void TransformTest::meshDataTextureCoordinates2DRvaluePassthroughWrongFormat() { @@ -1777,10 +1776,10 @@ void TransformTest::meshDataTextureCoordinates2DInPlaceNotMutable() { Trade::MeshAttributeData{Trade::MeshAttribute::TextureCoordinates, VertexFormat::Vector2, nullptr}, }}; - std::ostringstream out; + Containers::String out; Error redirectError{&out}; transformTextureCoordinates2DInPlace(mesh, {}); - CORRADE_COMPARE(out.str(), "MeshTools::transformTextureCoordinates2DInPlace(): vertex data not mutable\n"); + CORRADE_COMPARE(out, "MeshTools::transformTextureCoordinates2DInPlace(): vertex data not mutable\n"); } void TransformTest::meshDataTextureCoordinates2DInPlaceNoCoordinates() { @@ -1793,13 +1792,13 @@ void TransformTest::meshDataTextureCoordinates2DInPlaceNoCoordinates() { Trade::MeshAttributeData{Trade::MeshAttribute::TextureCoordinates, VertexFormat::Vector2, nullptr}, }}; - std::ostringstream out; + Containers::String out; Error redirectError{&out}; transformTextureCoordinates2DInPlace(mesh, {}, data.id, data.morphTargetId); if(data.morphTargetId == -1) - CORRADE_COMPARE(out.str(), "MeshTools::transformTextureCoordinates2DInPlace(): the mesh has no texture coordinates with index 1\n"); + CORRADE_COMPARE(out, "MeshTools::transformTextureCoordinates2DInPlace(): the mesh has no texture coordinates with index 1\n"); else - CORRADE_COMPARE(out.str(), "MeshTools::transformTextureCoordinates2DInPlace(): the mesh has no texture coordinates with index 0 in morph target 37\n"); + CORRADE_COMPARE(out, "MeshTools::transformTextureCoordinates2DInPlace(): the mesh has no texture coordinates with index 0 in morph target 37\n"); } void TransformTest::meshDataTextureCoordinates2DInPlaceWrongFormat() { @@ -1810,10 +1809,10 @@ void TransformTest::meshDataTextureCoordinates2DInPlaceWrongFormat() { Trade::MeshAttributeData{Trade::MeshAttribute::TextureCoordinates, VertexFormat::Vector2us, nullptr} }}; - std::ostringstream out; + Containers::String out; Error redirectError{&out}; transformTextureCoordinates2DInPlace(mesh, {}, 1); - CORRADE_COMPARE(out.str(), "MeshTools::transformTextureCoordinates2DInPlace(): expected VertexFormat::Vector2 texture coordinates but got VertexFormat::Vector2us\n"); + CORRADE_COMPARE(out, "MeshTools::transformTextureCoordinates2DInPlace(): expected VertexFormat::Vector2 texture coordinates but got VertexFormat::Vector2us\n"); } }}}} diff --git a/src/Magnum/SceneGraph/Test/AnimableTest.cpp b/src/Magnum/SceneGraph/Test/AnimableTest.cpp index c1ee6c542..2e54d543b 100644 --- a/src/Magnum/SceneGraph/Test/AnimableTest.cpp +++ b/src/Magnum/SceneGraph/Test/AnimableTest.cpp @@ -24,9 +24,8 @@ DEALINGS IN THE SOFTWARE. */ -#include +#include #include -#include #include "Magnum/SceneGraph/AbstractFeature.hpp" #include "Magnum/SceneGraph/Animable.hpp" @@ -82,15 +81,15 @@ template void AnimableTest::state() { this->setDuration(1.0f); } - std::string trackedState; + Containers::String trackedState; protected: void animationStep(Float, Float) override {} - void animationStarted() override { trackedState += "started"; } - void animationPaused() override { trackedState += "paused"; } - void animationResumed() override { trackedState += "resumed"; } - void animationStopped() override { trackedState += "stopped"; } + void animationStarted() override { trackedState = trackedState + "started"; } + void animationPaused() override { trackedState = trackedState + "paused"; } + void animationResumed() override { trackedState = trackedState + "resumed"; } + void animationStopped() override { trackedState = trackedState + "stopped"; } }; Object3D object; @@ -100,9 +99,9 @@ template void AnimableTest::state() { /* Verify initial state */ StateTrackingAnimable animable(object, &group); CORRADE_COMPARE(animable.state(), AnimationState::Stopped); - CORRADE_VERIFY(animable.trackedState.empty()); + CORRADE_COMPARE(animable.trackedState, ""); group.step(1.0f, 1.0f); - CORRADE_VERIFY(animable.trackedState.empty()); + CORRADE_COMPARE(animable.trackedState, ""); CORRADE_COMPARE(group.runningCount(), 0); /* Stopped -> paused is not supported */ @@ -112,36 +111,36 @@ template void AnimableTest::state() { /* Stopped -> running */ CORRADE_COMPARE(animable.state(), AnimationState::Stopped); - animable.trackedState.clear(); + animable.trackedState = {}; animable.setState(AnimationState::Running); - CORRADE_VERIFY(animable.trackedState.empty()); + CORRADE_COMPARE(animable.trackedState, ""); group.step(1.0f, 1.0f); CORRADE_COMPARE(animable.trackedState, "started"); CORRADE_COMPARE(group.runningCount(), 1); /* Running -> paused */ CORRADE_COMPARE(animable.state(), AnimationState::Running); - animable.trackedState.clear(); + animable.trackedState = {}; animable.setState(AnimationState::Paused); - CORRADE_VERIFY(animable.trackedState.empty()); + CORRADE_COMPARE(animable.trackedState, ""); group.step(1.0f, 1.0f); CORRADE_COMPARE(animable.trackedState, "paused"); CORRADE_COMPARE(group.runningCount(), 0); /* Paused -> running */ CORRADE_COMPARE(animable.state(), AnimationState::Paused); - animable.trackedState.clear(); + animable.trackedState = {}; animable.setState(AnimationState::Running); - CORRADE_VERIFY(animable.trackedState.empty()); + CORRADE_COMPARE(animable.trackedState, ""); group.step(1.0f, 1.0f); CORRADE_COMPARE(animable.trackedState, "resumed"); CORRADE_COMPARE(group.runningCount(), 1); /* Running -> stopped */ CORRADE_COMPARE(animable.state(), AnimationState::Running); - animable.trackedState.clear(); + animable.trackedState = {}; animable.setState(AnimationState::Stopped); - CORRADE_VERIFY(animable.trackedState.empty()); + CORRADE_COMPARE(animable.trackedState, ""); group.step(1.0f, 1.0f); CORRADE_COMPARE(animable.trackedState, "stopped"); CORRADE_COMPARE(group.runningCount(), 0); @@ -152,9 +151,9 @@ template void AnimableTest::state() { /* Paused -> stopped */ CORRADE_COMPARE(animable.state(), AnimationState::Paused); - animable.trackedState.clear(); + animable.trackedState = {}; animable.setState(AnimationState::Stopped); - CORRADE_VERIFY(animable.trackedState.empty()); + CORRADE_COMPARE(animable.trackedState, ""); group.step(1.0f, 1.0f); CORRADE_COMPARE(animable.trackedState, "stopped"); CORRADE_COMPARE(group.runningCount(), 0); @@ -177,7 +176,7 @@ template class OneShotAnimable: public SceneGraph::BasicAnimable3D { } Float time; - std::string stateChanges; + Containers::String stateChanges; protected: void animationStep(Float t, Float) override { @@ -185,11 +184,11 @@ template class OneShotAnimable: public SceneGraph::BasicAnimable3D { } void animationStarted() override { - stateChanges += "started;"; + stateChanges = stateChanges + "started;"; } void animationStopped() override { - stateChanges += "stopped;"; + stateChanges = stateChanges + "stopped;"; } }; @@ -401,9 +400,9 @@ void AnimableTest::deleteWhileRunning() { } void AnimableTest::debug() { - std::ostringstream o; - Debug(&o) << AnimationState::Running << AnimationState(0xbe); - CORRADE_COMPARE(o.str(), "SceneGraph::AnimationState::Running SceneGraph::AnimationState(0xbe)\n"); + Containers::String out; + Debug{&out} << AnimationState::Running << AnimationState(0xbe); + CORRADE_COMPARE(out, "SceneGraph::AnimationState::Running SceneGraph::AnimationState(0xbe)\n"); } }}}} diff --git a/src/Magnum/SceneGraph/Test/DualComplexTransformationTest.cpp b/src/Magnum/SceneGraph/Test/DualComplexTransformationTest.cpp index 02ee12fb4..31056c029 100644 --- a/src/Magnum/SceneGraph/Test/DualComplexTransformationTest.cpp +++ b/src/Magnum/SceneGraph/Test/DualComplexTransformationTest.cpp @@ -24,9 +24,8 @@ DEALINGS IN THE SOFTWARE. */ -#include +#include #include -#include #include "Magnum/SceneGraph/DualComplexTransformation.h" #include "Magnum/SceneGraph/Object.hpp" @@ -145,10 +144,10 @@ template void DualComplexTransformationTest::setTransformationInvalid() Object2D o; /* Can't transform with non-rigid transformation */ - std::ostringstream out; + Containers::String out; Error redirectError{&out}; o.setTransformation(Math::DualComplex({T(1.0), T(2.0)}, {})); - CORRADE_COMPARE(out.str(), "SceneGraph::DualComplexTransformation::setTransformation(): the dual complex number is not normalized\n"); + CORRADE_COMPARE(out, "SceneGraph::DualComplexTransformation::setTransformation(): the dual complex number is not normalized\n"); } template void DualComplexTransformationTest::resetTransformation() { @@ -184,10 +183,10 @@ template void DualComplexTransformationTest::transformInvalid() { /* Can't transform with non-rigid transformation */ Object2D o; - std::ostringstream out; + Containers::String out; Error redirectError{&out}; o.transform(Math::DualComplex{{T(1.0), T(2.0)}, {}}); - CORRADE_COMPARE(out.str(), "SceneGraph::DualComplexTransformation::transform(): the dual complex number is not normalized\n"); + CORRADE_COMPARE(out, "SceneGraph::DualComplexTransformation::transform(): the dual complex number is not normalized\n"); } template void DualComplexTransformationTest::translate() { diff --git a/src/Magnum/SceneGraph/Test/DualQuaternionTransformationTest.cpp b/src/Magnum/SceneGraph/Test/DualQuaternionTransformationTest.cpp index b9064959a..d55351cfa 100644 --- a/src/Magnum/SceneGraph/Test/DualQuaternionTransformationTest.cpp +++ b/src/Magnum/SceneGraph/Test/DualQuaternionTransformationTest.cpp @@ -24,9 +24,8 @@ DEALINGS IN THE SOFTWARE. */ -#include +#include #include -#include #include "Magnum/SceneGraph/DualQuaternionTransformation.h" #include "Magnum/SceneGraph/Object.hpp" @@ -102,10 +101,10 @@ template void DualQuaternionTransformationTest::fromMatrixInvalid() { CORRADE_SKIP_IF_NO_ASSERT(); - std::ostringstream out; + Containers::String out; Error redirectError{&out}; Implementation::Transformation>::fromMatrix(Math::Matrix4::scaling(Math::Vector3{T(4.0)})); - CORRADE_COMPARE(out.str(), "SceneGraph::DualQuaternionTransformation: the matrix doesn't represent rigid transformation\n"); + CORRADE_COMPARE(out, "SceneGraph::DualQuaternionTransformation: the matrix doesn't represent rigid transformation\n"); } template void DualQuaternionTransformationTest::toMatrix() { @@ -160,10 +159,10 @@ template void DualQuaternionTransformationTest::setTransformationInvali Object3D o; /* Can't transform with non-rigid transformation */ - std::ostringstream out; + Containers::String out; Error redirectError{&out}; o.setTransformation(Math::DualQuaternion({{T(1.0), T(2.0), T(3.0)}, T(4.0)}, {})); - CORRADE_COMPARE(out.str(), "SceneGraph::DualQuaternionTransformation::setTransformation(): the dual quaternion is not normalized\n"); + CORRADE_COMPARE(out, "SceneGraph::DualQuaternionTransformation::setTransformation(): the dual quaternion is not normalized\n"); } template void DualQuaternionTransformationTest::resetTransformation() { @@ -199,10 +198,10 @@ template void DualQuaternionTransformationTest::transformInvalid() { /* Can't transform with non-rigid transformation */ Object3D o; - std::ostringstream out; + Containers::String out; Error redirectError{&out}; o.transform(Math::DualQuaternion({{T(1.0), T(2.0), T(3.0)}, T(4.0)}, {})); - CORRADE_COMPARE(out.str(), "SceneGraph::DualQuaternionTransformation::transform(): the dual quaternion is not normalized\n"); + CORRADE_COMPARE(out, "SceneGraph::DualQuaternionTransformation::transform(): the dual quaternion is not normalized\n"); } template void DualQuaternionTransformationTest::translate() { diff --git a/src/Magnum/SceneGraph/Test/ObjectTest.cpp b/src/Magnum/SceneGraph/Test/ObjectTest.cpp index cce8678af..11255e966 100644 --- a/src/Magnum/SceneGraph/Test/ObjectTest.cpp +++ b/src/Magnum/SceneGraph/Test/ObjectTest.cpp @@ -24,11 +24,10 @@ DEALINGS IN THE SOFTWARE. */ -#include #include +#include #include -#include -#include +#include #include "Magnum/SceneGraph/AbstractFeature.hpp" #include "Magnum/SceneGraph/MatrixTransformation3D.hpp" @@ -280,11 +279,11 @@ template void ObjectTest::setParentKeepTransformationInvalid() { Object3D* child = new Object3D(&root); /* Old parent and new parent must share the same scene */ - std::ostringstream o; - Error redirectError{&o}; + Containers::String out; + Error redirectError{&out}; Scene3D scene; child->setParentKeepTransformation(&scene); - CORRADE_COMPARE(o.str(), "SceneGraph::Object::setParentKeepTransformation(): both parents must be in the same scene\n"); + CORRADE_COMPARE(out, "SceneGraph::Object::setParentKeepTransformation(): both parents must be in the same scene\n"); } template void ObjectTest::absoluteTransformation() { @@ -389,14 +388,14 @@ template void ObjectTest::transformationsOrphan() { CORRADE_SKIP_IF_NO_ASSERT(); - std::ostringstream o; - Error redirectError{&o}; + Containers::String out; + Error redirectError{&out}; /* Transformation of objects not part of the same scene */ Scene3D s; Object3D orphan; CORRADE_COMPARE(s.transformations({orphan}), std::vector>{}); - CORRADE_COMPARE(o.str(), "SceneGraph::Object::transformations(): the objects are not part of the same tree\n"); + CORRADE_COMPARE(out, "SceneGraph::Object::transformations(): the objects are not part of the same tree\n"); } template void ObjectTest::transformationsDuplicate() { @@ -662,7 +661,7 @@ void ObjectTest::treeDestructionOrder() { int id; }; - std::stringstream out; + Containers::String out; Debug redirectOutput{&out}; { struct Scene: Scene3D { @@ -689,7 +688,7 @@ void ObjectTest::treeDestructionOrder() { AccessingParent{5, nullptr}; AccessingObject{b, 4}; - CORRADE_COMPARE(out.str(), + CORRADE_COMPARE(out, "Destructing an object 5 with 0 parents and no scene\n" "Destructing a feature 4 attached to an object 1\n"); } @@ -701,7 +700,7 @@ void ObjectTest::treeDestructionOrder() { "a scene" /* See below. */ #endif ; - CORRADE_COMPARE(out.str(), Utility::formatString( + CORRADE_COMPARE(out, Utility::format( "Destructing an object 5 with 0 parents and no scene\n" "Destructing a feature 4 attached to an object 1\n" diff --git a/src/Magnum/SceneGraph/Test/RigidMatrixTransformation2DTest.cpp b/src/Magnum/SceneGraph/Test/RigidMatrixTransformation2DTest.cpp index ba7c4d5c3..8eaed4928 100644 --- a/src/Magnum/SceneGraph/Test/RigidMatrixTransformation2DTest.cpp +++ b/src/Magnum/SceneGraph/Test/RigidMatrixTransformation2DTest.cpp @@ -24,9 +24,8 @@ DEALINGS IN THE SOFTWARE. */ -#include +#include #include -#include #include "Magnum/Math/Complex.h" #include "Magnum/SceneGraph/Object.hpp" @@ -105,10 +104,10 @@ template void RigidMatrixTransformation2DTest::fromMatrixInvalid() { CORRADE_SKIP_IF_NO_ASSERT(); - std::ostringstream out; + Containers::String out; Error redirectError{&out}; Implementation::Transformation>::fromMatrix(Math::Matrix3::scaling(Math::Vector2{T(4.0)})); - CORRADE_COMPARE(out.str(), "SceneGraph::RigidMatrixTransformation2D: the matrix doesn't represent rigid transformation\n"); + CORRADE_COMPARE(out, "SceneGraph::RigidMatrixTransformation2D: the matrix doesn't represent rigid transformation\n"); } template void RigidMatrixTransformation2DTest::toMatrix() { @@ -161,10 +160,10 @@ template void RigidMatrixTransformation2DTest::setTransformationInvalid Object2D o; /* Can't transform with non-rigid transformation */ - std::ostringstream out; + Containers::String out; Error redirectError{&out}; o.setTransformation(Math::Matrix3::scaling(Math::Vector2{T(3.0)})); - CORRADE_COMPARE(out.str(), "SceneGraph::RigidMatrixTransformation2D::setTransformation(): the matrix doesn't represent rigid transformation\n"); + CORRADE_COMPARE(out, "SceneGraph::RigidMatrixTransformation2D::setTransformation(): the matrix doesn't represent rigid transformation\n"); } template void RigidMatrixTransformation2DTest::resetTransformation() { @@ -200,10 +199,10 @@ template void RigidMatrixTransformation2DTest::transformInvalid() { /* Can't transform with non-rigid transformation */ Object2D o; - std::ostringstream out; + Containers::String out; Error redirectError{&out}; o.transform(Math::Matrix3::scaling(Math::Vector2{T(3.0)})); - CORRADE_COMPARE(out.str(), "SceneGraph::RigidMatrixTransformation2D::transform(): the matrix doesn't represent rigid transformation\n"); + CORRADE_COMPARE(out, "SceneGraph::RigidMatrixTransformation2D::transform(): the matrix doesn't represent rigid transformation\n"); } template void RigidMatrixTransformation2DTest::translate() { diff --git a/src/Magnum/SceneGraph/Test/RigidMatrixTransformation3DTest.cpp b/src/Magnum/SceneGraph/Test/RigidMatrixTransformation3DTest.cpp index 6bc49fb45..a8f250503 100644 --- a/src/Magnum/SceneGraph/Test/RigidMatrixTransformation3DTest.cpp +++ b/src/Magnum/SceneGraph/Test/RigidMatrixTransformation3DTest.cpp @@ -24,9 +24,8 @@ DEALINGS IN THE SOFTWARE. */ -#include +#include #include -#include #include "Magnum/Math/Quaternion.h" #include "Magnum/SceneGraph/Object.hpp" @@ -105,10 +104,10 @@ template void RigidMatrixTransformation3DTest::fromMatrixInvalid() { CORRADE_SKIP_IF_NO_ASSERT(); - std::ostringstream o; - Error redirectError{&o}; + Containers::String out; + Error redirectError{&out}; Implementation::Transformation>::fromMatrix(Math::Matrix4::scaling(Math::Vector3(T(4.0)))); - CORRADE_COMPARE(o.str(), "SceneGraph::RigidMatrixTransformation3D: the matrix doesn't represent rigid transformation\n"); + CORRADE_COMPARE(out, "SceneGraph::RigidMatrixTransformation3D: the matrix doesn't represent rigid transformation\n"); } template void RigidMatrixTransformation3DTest::toMatrix() { @@ -162,10 +161,10 @@ template void RigidMatrixTransformation3DTest::setTransformationInvalid Object3D o; /* Can't transform with non-rigid transformation */ - std::ostringstream out; + Containers::String out; Error redirectError{&out}; o.setTransformation(Math::Matrix4::scaling(Math::Vector3(T(3.0)))); - CORRADE_COMPARE(out.str(), "SceneGraph::RigidMatrixTransformation3D::setTransformation(): the matrix doesn't represent rigid transformation\n"); + CORRADE_COMPARE(out, "SceneGraph::RigidMatrixTransformation3D::setTransformation(): the matrix doesn't represent rigid transformation\n"); } template void RigidMatrixTransformation3DTest::resetTransformation() { @@ -201,10 +200,10 @@ template void RigidMatrixTransformation3DTest::transformInvalid() { /* Can't transform with non-rigid transformation */ Object3D o; - std::ostringstream out; + Containers::String out; Error redirectError{&out}; o.transform(Math::Matrix4::scaling(Math::Vector3(T(3.0)))); - CORRADE_COMPARE(out.str(), "SceneGraph::RigidMatrixTransformation3D::transform(): the matrix doesn't represent rigid transformation\n"); + CORRADE_COMPARE(out, "SceneGraph::RigidMatrixTransformation3D::transform(): the matrix doesn't represent rigid transformation\n"); } template void RigidMatrixTransformation3DTest::translate() { diff --git a/src/Magnum/SceneGraph/Test/TranslationTransformationTest.cpp b/src/Magnum/SceneGraph/Test/TranslationTransformationTest.cpp index b4af8a9c1..83f44700f 100644 --- a/src/Magnum/SceneGraph/Test/TranslationTransformationTest.cpp +++ b/src/Magnum/SceneGraph/Test/TranslationTransformationTest.cpp @@ -24,9 +24,8 @@ DEALINGS IN THE SOFTWARE. */ -#include +#include #include -#include #include "Magnum/SceneGraph/Object.hpp" #include "Magnum/SceneGraph/TranslationTransformation.h" @@ -92,10 +91,10 @@ template void TranslationTransformationTest::fromMatrixInvalid() { CORRADE_SKIP_IF_NO_ASSERT(); - std::ostringstream o; - Error redirectError{&o}; + Containers::String out; + Error redirectError{&out}; Implementation::Transformation>::fromMatrix(Math::Matrix3::scaling(Math::Vector2{T(4.0)})); - CORRADE_COMPARE(o.str(), "SceneGraph::TranslationTransformation: the matrix doesn't represent pure translation\n"); + CORRADE_COMPARE(out, "SceneGraph::TranslationTransformation: the matrix doesn't represent pure translation\n"); } template void TranslationTransformationTest::toMatrix() { diff --git a/src/Magnum/SceneTools/Test/CombineTest.cpp b/src/Magnum/SceneTools/Test/CombineTest.cpp index cf5d9cccf..bdb07f56f 100644 --- a/src/Magnum/SceneTools/Test/CombineTest.cpp +++ b/src/Magnum/SceneTools/Test/CombineTest.cpp @@ -24,17 +24,15 @@ DEALINGS IN THE SOFTWARE. */ -#include #include #include #include #include -#include +#include #include #include #include #include -#include #include "Magnum/Math/Complex.h" #include "Magnum/Math/Vector2.h" @@ -996,7 +994,7 @@ void CombineTest::fieldsSharedMappingExpected() { UnsignedInt meshes[3]{}; Int materials[3]{}; - std::ostringstream out; + Containers::String out; Error redirectError{&out}; combineFields(Trade::SceneMappingType::UnsignedInt, 3, { Trade::SceneFieldData{Trade::SceneField::Mesh, @@ -1014,7 +1012,7 @@ void CombineTest::fieldsSharedMappingExpected() { Containers::ArrayView{nullptr, 3}, Containers::arrayView(materials)}, }); - CORRADE_COMPARE(out.str(), + CORRADE_COMPARE(out, "SceneTools::combineFields(): Trade::SceneField::MeshMaterial mapping data {0xbeef, 2, 4} is different from Trade::SceneField::Mesh mapping data {0xdead, 3, 4}\n" /* Placeholder mapping is also disallowed right now -- it has to be either all placeholders or none */ @@ -1030,7 +1028,7 @@ void CombineTest::fieldsStringPlaceholder() { } data[3]{}; auto view = Containers::stridedArrayView(data); - std::ostringstream out; + Containers::String out; Error redirectError{&out}; /* A null string data pointer could work in this case (because it doesn't need to be accessed), but disallowing it always for consistency */ @@ -1060,7 +1058,7 @@ void CombineTest::fieldsStringPlaceholder() { reinterpret_cast(0xfece5), Trade::SceneFieldType::StringRangeNullTerminated16, Containers::StridedArrayView1D{{nullptr, 6}, 3}}, }); - CORRADE_COMPARE(out.str(), + CORRADE_COMPARE(out, "SceneTools::combineFields(): string field 1 has a placeholder string data\n" "SceneTools::combineFields(): string field 0 has a placeholder data\n"); } @@ -1078,7 +1076,7 @@ void CombineTest::fieldsOffsetOnly() { }; auto view = Containers::stridedArrayView(data); - std::ostringstream out; + Containers::String out; Error redirectError{&out}; combineFields(Trade::SceneMappingType::UnsignedInt, 173, { Trade::SceneFieldData{Trade::SceneField::Mesh, @@ -1088,7 +1086,7 @@ void CombineTest::fieldsOffsetOnly() { Trade::SceneMappingType::UnsignedInt, offsetof(Field, mapping), sizeof(Field), Trade::SceneFieldType::UnsignedShort, offsetof(Field, light), sizeof(Field)} }); - CORRADE_COMPARE(out.str(), "SceneTools::combineFields(): field 1 is offset-only\n"); + CORRADE_COMPARE(out, "SceneTools::combineFields(): field 1 is offset-only\n"); } void CombineTest::fieldsFromDataOffsetOnly() { diff --git a/src/Magnum/SceneTools/Test/CopyTest.cpp b/src/Magnum/SceneTools/Test/CopyTest.cpp index 662dcc5e2..70c0b6710 100644 --- a/src/Magnum/SceneTools/Test/CopyTest.cpp +++ b/src/Magnum/SceneTools/Test/CopyTest.cpp @@ -24,14 +24,12 @@ DEALINGS IN THE SOFTWARE. */ -#include /** @todo remove once Debug is stream-free */ #include +#include #include -#include #include #include #include -#include /** @todo remove once Debug is stream-free */ #include "Magnum/SceneTools/Copy.h" #include "Magnum/Trade/SceneData.h" @@ -424,10 +422,10 @@ void CopyTest::mutableReferenceNotMutable() { }}; CORRADE_COMPARE(scene.dataFlags(), Trade::DataFlag::Global); - std::ostringstream out; + Containers::String out; Error redirectError{&out}; SceneTools::mutableReference(scene); - CORRADE_COMPARE(out.str(), "SceneTools::mutableReference(): data not mutable\n"); + CORRADE_COMPARE(out, "SceneTools::mutableReference(): data not mutable\n"); } }}}} diff --git a/src/Magnum/SceneTools/Test/FilterTest.cpp b/src/Magnum/SceneTools/Test/FilterTest.cpp index d6feea996..eb30c40e6 100644 --- a/src/Magnum/SceneTools/Test/FilterTest.cpp +++ b/src/Magnum/SceneTools/Test/FilterTest.cpp @@ -24,14 +24,13 @@ DEALINGS IN THE SOFTWARE. */ -#include #include #include #include #include +#include #include #include -#include #include "Magnum/Math/Complex.h" #include "Magnum/Math/Vector2.h" @@ -259,10 +258,10 @@ void FilterTest::fieldsWrongBitCount() { Containers::arrayView(data)}, }}; - std::ostringstream out; + Containers::String out; Error redirectError{&out}; filterFields(scene, Containers::BitArray{ValueInit, 3}); - CORRADE_COMPARE(out.str(), "SceneTools::filterFields(): expected 2 bits but got 3\n"); + CORRADE_COMPARE(out, "SceneTools::filterFields(): expected 2 bits but got 3\n"); } void FilterTest::onlyFields() { @@ -632,7 +631,7 @@ void FilterTest::fieldEntriesFieldNotFound() { Containers::arrayView(data->light)}, }}; - std::ostringstream out; + Containers::String out; Error redirectError{&out}; filterFieldEntries(scene, { {Trade::SceneField::Light, Containers::BitArray{ValueInit, 4}}, @@ -642,7 +641,7 @@ void FilterTest::fieldEntriesFieldNotFound() { {1, Containers::BitArray{ValueInit, 4}}, {2, {}} }); - CORRADE_COMPARE(out.str(), + CORRADE_COMPARE(out, "SceneTools::filterFieldEntries(): field Trade::SceneField::Parent not found\n" "SceneTools::filterFieldEntries(): index 2 out of range for 2 fields\n"); } @@ -666,7 +665,7 @@ void FilterTest::fieldEntriesDuplicated() { Containers::arrayView(data->light)}, }}; - std::ostringstream out; + Containers::String out; Error redirectError{&out}; /* The name-based variant just delegates to this one, no need to test it as well */ @@ -675,7 +674,7 @@ void FilterTest::fieldEntriesDuplicated() { {0, Containers::BitArray{ValueInit, 5}}, {1, Containers::BitArray{ValueInit, 4}}, }); - CORRADE_COMPARE(out.str(), "SceneTools::filterFieldEntries(): field Trade::SceneField::Light listed more than once\n"); + CORRADE_COMPARE(out, "SceneTools::filterFieldEntries(): field Trade::SceneField::Light listed more than once\n"); } void FilterTest::fieldEntriesWrongBitCount() { @@ -697,7 +696,7 @@ void FilterTest::fieldEntriesWrongBitCount() { Containers::arrayView(data->light)}, }}; - std::ostringstream out; + Containers::String out; Error redirectError{&out}; /* The name-based variant just delegates to this one, no need to test it as well */ @@ -705,7 +704,7 @@ void FilterTest::fieldEntriesWrongBitCount() { {1, Containers::BitArray{ValueInit, 4}}, {0, Containers::BitArray{ValueInit, 6}} }); - CORRADE_COMPARE(out.str(), "SceneTools::filterFieldEntries(): expected 5 bits for Trade::SceneField::Mesh but got 6\n"); + CORRADE_COMPARE(out, "SceneTools::filterFieldEntries(): expected 5 bits for Trade::SceneField::Mesh but got 6\n"); } void FilterTest::fieldEntriesBitField() { @@ -727,7 +726,7 @@ void FilterTest::fieldEntriesBitField() { Containers::stridedArrayView(data->visible).sliceBit(0)}, }}; - std::ostringstream out; + Containers::String out; Error redirectError{&out}; /* The name-based variant just delegates to this one, no need to test it as well */ @@ -735,7 +734,7 @@ void FilterTest::fieldEntriesBitField() { {0, Containers::BitArray{ValueInit, 5}}, {1, Containers::BitArray{ValueInit, 2}} }); - CORRADE_COMPARE(out.str(), "SceneTools::filterFieldEntries(): filtering bit fields is not implemented yet, sorry\n"); + CORRADE_COMPARE(out, "SceneTools::filterFieldEntries(): filtering bit fields is not implemented yet, sorry\n"); } void FilterTest::fieldEntriesStringField() { @@ -759,7 +758,7 @@ void FilterTest::fieldEntriesStringField() { Containers::arrayView(data->nameRangeNullTerminated)}, }}; - std::ostringstream out; + Containers::String out; Error redirectError{&out}; /* The name-based variant just delegates to this one, no need to test it as well */ @@ -767,7 +766,7 @@ void FilterTest::fieldEntriesStringField() { {0, Containers::BitArray{ValueInit, 5}}, {1, Containers::BitArray{ValueInit, 2}} }); - CORRADE_COMPARE(out.str(), "SceneTools::filterFieldEntries(): filtering string fields is not implemented yet, sorry\n"); + CORRADE_COMPARE(out, "SceneTools::filterFieldEntries(): filtering string fields is not implemented yet, sorry\n"); } void FilterTest::fieldEntriesSharedMapping() { @@ -936,7 +935,7 @@ void FilterTest::fieldEntriesSharedMappingInvalid() { Containers::BitArray meshesToKeep{ValueInit, 5}; Containers::BitArray meshesToKeepDifferent{DirectInit, 5, true}; - std::ostringstream out; + Containers::String out; Error redirectError{&out}; filterFieldEntries(scene, { {Trade::SceneField::MeshMaterial, meshesToKeep}, @@ -951,7 +950,7 @@ void FilterTest::fieldEntriesSharedMappingInvalid() { {Trade::sceneFieldCustom(1), meshesToKeep}, {Trade::SceneField::MeshMaterial, meshesToKeep}, }); - CORRADE_COMPARE(out.str(), + CORRADE_COMPARE(out, "SceneTools::filterFieldEntries(): field Trade::SceneField::Custom(1) shares mapping with Trade::SceneField::MeshMaterial but was passed a different mask view\n" "SceneTools::filterFieldEntries(): field Trade::SceneField::Mesh shares mapping with 3 fields but only 2 are filtered\n" "SceneTools::filterFieldEntries(): field Trade::SceneField::Custom(1) shares mapping with 3 fields but only 2 are filtered\n"); @@ -1258,10 +1257,10 @@ void FilterTest::objectsWrongBitCount() { Trade::SceneData scene{Trade::SceneMappingType::UnsignedShort, 176, nullptr, {}}; - std::ostringstream out; + Containers::String out; Error redirectError{&out}; filterObjects(scene, Containers::BitArray{ValueInit, 177}); - CORRADE_COMPARE(out.str(), "SceneTools::filterObjects(): expected 176 bits but got 177\n"); + CORRADE_COMPARE(out, "SceneTools::filterObjects(): expected 176 bits but got 177\n"); } }}}} diff --git a/src/Magnum/SceneTools/Test/FlattenMeshHierarchyTest.cpp b/src/Magnum/SceneTools/Test/FlattenMeshHierarchyTest.cpp index 5808f3555..635acd117 100644 --- a/src/Magnum/SceneTools/Test/FlattenMeshHierarchyTest.cpp +++ b/src/Magnum/SceneTools/Test/FlattenMeshHierarchyTest.cpp @@ -24,11 +24,10 @@ DEALINGS IN THE SOFTWARE. */ -#include +#include #include #include #include -#include /* There's no better way to disable file deprecation warnings */ #define _MAGNUM_NO_DEPRECATED_FLATTENMESHHIERARCHY @@ -318,13 +317,13 @@ void FlattenMeshHierarchyTest::not2DNot3D() { Trade::SceneFieldData{Trade::SceneField::Mesh, Trade::SceneMappingType::UnsignedInt, nullptr, Trade::SceneFieldType::UnsignedInt, nullptr}, }}; - std::ostringstream out; + Containers::String out; Error redirectError{&out}; CORRADE_IGNORE_DEPRECATED_PUSH flattenMeshHierarchy2D(scene); flattenMeshHierarchy3D(scene); CORRADE_IGNORE_DEPRECATED_POP - CORRADE_COMPARE(out.str(), + CORRADE_COMPARE(out, "SceneTools::absoluteFieldTransformations(): the scene is not 2D\n" "SceneTools::absoluteFieldTransformations(): the scene is not 3D\n"); } @@ -340,12 +339,12 @@ void FlattenMeshHierarchyTest::noParentField() { Trade::SceneFieldData{Trade::SceneField::Transformation, Trade::SceneMappingType::UnsignedInt, nullptr, Trade::SceneFieldType::Matrix3x3, nullptr} }}; - std::ostringstream out; + Containers::String out; Error redirectError{&out}; CORRADE_IGNORE_DEPRECATED_PUSH flattenMeshHierarchy2D(scene); CORRADE_IGNORE_DEPRECATED_POP - CORRADE_COMPARE(out.str(), + CORRADE_COMPARE(out, "SceneTools::absoluteFieldTransformations(): the scene has no hierarchy\n"); } @@ -493,13 +492,13 @@ void FlattenMeshHierarchyTest::intoInvalidSize() { Matrix3 transformations2D[6]; Matrix4 transformations3D[4]; - std::ostringstream out; + Containers::String out; Error redirectError{&out}; CORRADE_IGNORE_DEPRECATED_PUSH flattenMeshHierarchy2DInto(scene2D, transformations2D); flattenMeshHierarchy3DInto(scene3D, transformations3D); CORRADE_IGNORE_DEPRECATED_POP - CORRADE_COMPARE(out.str(), + CORRADE_COMPARE(out, "SceneTools::absoluteFieldTransformationsInto(): bad output size, expected 5 but got 6\n" "SceneTools::absoluteFieldTransformationsInto(): bad output size, expected 5 but got 4\n"); } diff --git a/src/Magnum/SceneTools/Test/HierarchyTest.cpp b/src/Magnum/SceneTools/Test/HierarchyTest.cpp index fb69acad7..2730fb686 100644 --- a/src/Magnum/SceneTools/Test/HierarchyTest.cpp +++ b/src/Magnum/SceneTools/Test/HierarchyTest.cpp @@ -24,12 +24,11 @@ DEALINGS IN THE SOFTWARE. */ -#include #include +#include #include #include #include -#include #include "Magnum/Math/Matrix3.h" #include "Magnum/Math/Matrix4.h" @@ -268,11 +267,11 @@ void HierarchyTest::parentsBreadthFirstChildrenDepthFirstNoParentField() { Trade::SceneData scene{Trade::SceneMappingType::UnsignedByte, 0, nullptr, {}}; - std::ostringstream out; + Containers::String out; Error redirectError{&out}; SceneTools::parentsBreadthFirst(scene); SceneTools::childrenDepthFirst(scene); - CORRADE_COMPARE(out.str(), + CORRADE_COMPARE(out, "SceneTools::parentsBreadthFirst(): the scene has no hierarchy\n" "SceneTools::childrenDepthFirst(): the scene has no hierarchy\n"); } @@ -295,11 +294,11 @@ void HierarchyTest::parentsBreadthFirstChildrenDepthFirstIntoNoParentField() { Trade::SceneData scene{Trade::SceneMappingType::UnsignedByte, 0, nullptr, {}}; - std::ostringstream out; + Containers::String out; Error redirectError{&out}; parentsBreadthFirstInto(scene, nullptr, nullptr); childrenDepthFirstInto(scene, nullptr, nullptr); - CORRADE_COMPARE(out.str(), + CORRADE_COMPARE(out, "SceneTools::parentsBreadthFirstInto(): the scene has no hierarchy\n" "SceneTools::childrenDepthFirstInto(): the scene has no hierarchy\n"); } @@ -340,13 +339,13 @@ void HierarchyTest::parentsBreadthFirstChildrenDepthFirstIntoWrongDestinationSiz UnsignedInt childCountCorrect[3]; UnsignedInt childCount[2]; - std::ostringstream out; + Containers::String out; Error redirectError{&out}; parentsBreadthFirstInto(scene, mappingCorrect, parentOffset); parentsBreadthFirstInto(scene, mapping, parentOffsetCorrect); childrenDepthFirstInto(scene, mappingCorrect, childCount); childrenDepthFirstInto(scene, mapping, childCountCorrect); - CORRADE_COMPARE(out.str(), + CORRADE_COMPARE(out, "SceneTools::parentsBreadthFirstInto(): expected parent destination view with 3 elements but got 2\n" "SceneTools::parentsBreadthFirstInto(): expected mapping destination view with 3 elements but got 2\n" "SceneTools::childrenDepthFirstInto(): expected child count destination view with 3 elements but got 2\n" @@ -376,11 +375,11 @@ void HierarchyTest::parentsBreadthFirstChildrenDepthFirstSparse() { view.slice(&Field::parent)} }}; - std::ostringstream out; + Containers::String out; Error redirectError{&out}; SceneTools::parentsBreadthFirst(scene); SceneTools::childrenDepthFirst(scene); - CORRADE_COMPARE(out.str(), + CORRADE_COMPARE(out, "SceneTools::parentsBreadthFirst(): hierarchy is sparse\n" "SceneTools::childrenDepthFirst(): hierarchy is sparse\n"); } @@ -406,11 +405,11 @@ void HierarchyTest::parentsBreadthFirstChildrenDepthFirstCyclic() { view.slice(&Field::parent)} }}; - std::ostringstream out; + Containers::String out; Error redirectError{&out}; SceneTools::parentsBreadthFirst(scene); SceneTools::childrenDepthFirst(scene); - CORRADE_COMPARE(out.str(), + CORRADE_COMPARE(out, "SceneTools::parentsBreadthFirst(): hierarchy is sparse\n" "SceneTools::childrenDepthFirst(): hierarchy is sparse\n"); } @@ -438,11 +437,11 @@ void HierarchyTest::parentsBreadthFirstChildrenDepthFirstCyclicDeep() { view.slice(&Field::parent)} }}; - std::ostringstream out; + Containers::String out; Error redirectError{&out}; SceneTools::parentsBreadthFirst(scene); SceneTools::childrenDepthFirst(scene); - CORRADE_COMPARE(out.str(), + CORRADE_COMPARE(out, "SceneTools::parentsBreadthFirst(): hierarchy is cyclic\n" "SceneTools::childrenDepthFirst(): hierarchy is cyclic\n"); } @@ -472,12 +471,12 @@ void HierarchyTest::parentsBreadthFirstChildrenDepthFirstSparseAndCyclic() { view.slice(&Field::parent)} }}; - std::ostringstream out; + Containers::String out; Error redirectError{&out}; SceneTools::parentsBreadthFirst(scene); SceneTools::childrenDepthFirst(scene); CORRADE_EXPECT_FAIL("The implementation needs to track already visited objects with a BitArray to detect this, it'd also provide a much better diagnostic."); - CORRADE_COMPARE(out.str(), + CORRADE_COMPARE(out, "SceneTools::parentsBreadthFirst(): hierarchy is cyclic\n" "SceneTools::childrenDepthFirst(): hierarchy is cyclic\n"); } @@ -688,13 +687,13 @@ void HierarchyTest::absoluteFieldTransformationsFieldNotFound() { Trade::SceneFieldData{Trade::SceneField::Transformation, Trade::SceneMappingType::UnsignedInt, nullptr, Trade::SceneFieldType::Matrix3x3, nullptr} }}; - std::ostringstream out; + Containers::String out; Error redirectError{&out}; SceneTools::absoluteFieldTransformations2D(scene, Trade::SceneField::Mesh); SceneTools::absoluteFieldTransformations3D(scene, Trade::SceneField::Mesh); SceneTools::absoluteFieldTransformations2D(scene, 2); SceneTools::absoluteFieldTransformations3D(scene, 2); - CORRADE_COMPARE(out.str(), + CORRADE_COMPARE(out, "SceneTools::absoluteFieldTransformations(): field Trade::SceneField::Mesh not found\n" "SceneTools::absoluteFieldTransformations(): field Trade::SceneField::Mesh not found\n" "SceneTools::absoluteFieldTransformations(): index 2 out of range for 2 fields\n" @@ -708,13 +707,13 @@ void HierarchyTest::absoluteFieldTransformationsNot2DNot3D() { Trade::SceneFieldData{Trade::SceneField::Parent, Trade::SceneMappingType::UnsignedInt, nullptr, Trade::SceneFieldType::Int, nullptr} }}; - std::ostringstream out; + Containers::String out; Error redirectError{&out}; SceneTools::absoluteFieldTransformations2D(scene, Trade::SceneField::Parent); SceneTools::absoluteFieldTransformations2D(scene, 0); SceneTools::absoluteFieldTransformations3D(scene, Trade::SceneField::Parent); SceneTools::absoluteFieldTransformations3D(scene, 0); - CORRADE_COMPARE(out.str(), + CORRADE_COMPARE(out, "SceneTools::absoluteFieldTransformations(): the scene is not 2D\n" "SceneTools::absoluteFieldTransformations(): the scene is not 2D\n" "SceneTools::absoluteFieldTransformations(): the scene is not 3D\n" @@ -728,11 +727,11 @@ void HierarchyTest::absoluteFieldTransformationsNoParentField() { Trade::SceneFieldData{Trade::SceneField::Transformation, Trade::SceneMappingType::UnsignedInt, nullptr, Trade::SceneFieldType::Matrix3x3, nullptr} }}; - std::ostringstream out; + Containers::String out; Error redirectError{&out}; SceneTools::absoluteFieldTransformations2D(scene, Trade::SceneField::Transformation); SceneTools::absoluteFieldTransformations2D(scene, 0); - CORRADE_COMPARE(out.str(), + CORRADE_COMPARE(out, "SceneTools::absoluteFieldTransformations(): the scene has no hierarchy\n" "SceneTools::absoluteFieldTransformations(): the scene has no hierarchy\n"); } @@ -877,13 +876,13 @@ void HierarchyTest::absoluteFieldTransformationsIntoInvalidSize() { Matrix3 transformations2D[6]; Matrix4 transformations3D[4]; - std::ostringstream out; + Containers::String out; Error redirectError{&out}; absoluteFieldTransformations2DInto(scene2D, Trade::SceneField::Mesh, transformations2D); absoluteFieldTransformations2DInto(scene2D, 1, transformations2D); absoluteFieldTransformations3DInto(scene3D, Trade::SceneField::Mesh, transformations3D); absoluteFieldTransformations3DInto(scene3D, 1, transformations3D); - CORRADE_COMPARE(out.str(), + CORRADE_COMPARE(out, "SceneTools::absoluteFieldTransformationsInto(): bad output size, expected 5 but got 6\n" "SceneTools::absoluteFieldTransformationsInto(): bad output size, expected 5 but got 6\n" "SceneTools::absoluteFieldTransformationsInto(): bad output size, expected 5 but got 4\n" diff --git a/src/Magnum/SceneTools/Test/MapTest.cpp b/src/Magnum/SceneTools/Test/MapTest.cpp index 8bde67f4b..ca9a5706c 100644 --- a/src/Magnum/SceneTools/Test/MapTest.cpp +++ b/src/Magnum/SceneTools/Test/MapTest.cpp @@ -24,16 +24,13 @@ DEALINGS IN THE SOFTWARE. */ -#include /** @todo remove once Debug is stream-free */ #include +#include #include -#include -#include /** @todo remove once Debug is stream-free */ #include #include #include #include -#include /** @todo remove once Debug is stream-free */ #include "Magnum/Math/TypeTraits.h" #include "Magnum/SceneTools/Map.h" @@ -362,13 +359,13 @@ void MapTest::indexFieldFieldNotFound() { UnsignedInt mapping[5]{}; - std::ostringstream out; + Containers::String out; Error redirectError{&out}; mapIndexField(scene, 2, mapping); mapIndexFieldInPlace(scene, 2, mapping); mapIndexField(scene, Trade::SceneField::MeshMaterial, mapping); mapIndexFieldInPlace(scene, Trade::SceneField::MeshMaterial, mapping); - CORRADE_COMPARE_AS(out.str(), + CORRADE_COMPARE_AS(out, "SceneTools::mapIndexField(): index 2 out of range for 2 fields\n" "SceneTools::mapIndexFieldInPlace(): index 2 out of range for 2 fields\n" "SceneTools::mapIndexField(): field Trade::SceneField::MeshMaterial not found\n" @@ -390,11 +387,11 @@ void MapTest::indexFieldInvalidType() { UnsignedInt mapping[5]{}; - std::ostringstream out; + Containers::String out; Error redirectError{&out}; mapIndexField(scene, 1, mapping); mapIndexFieldInPlace(scene, 1, mapping); - CORRADE_COMPARE_AS(out.str(), + CORRADE_COMPARE_AS(out, "SceneTools::mapIndexField(): unsupported field type Trade::SceneFieldType::Long\n" "SceneTools::mapIndexFieldInPlace(): unsupported field type Trade::SceneFieldType::Long\n", TestSuite::Compare::String); @@ -414,11 +411,11 @@ void MapTest::indexFieldArrayField() { UnsignedInt mapping[5]{}; - std::ostringstream out; + Containers::String out; Error redirectError{&out}; mapIndexField(scene, 1, mapping); mapIndexFieldInPlace(scene, 1, mapping); - CORRADE_COMPARE_AS(out.str(), + CORRADE_COMPARE_AS(out, "SceneTools::mapIndexField(): array field mapping isn't supported\n" "SceneTools::mapIndexFieldInPlace(): array field mapping isn't supported\n", TestSuite::Compare::String); @@ -448,12 +445,12 @@ void MapTest::indexFieldIndexOutOfBounds() { const UnsignedInt mapping9[9]{}; const UnsignedInt mapping10[10]{}; - std::ostringstream out; + Containers::String out; Error redirectError{&out}; mapIndexField(scene, Trade::SceneField::MeshMaterial, mapping10); mapIndexField(scene, Trade::SceneField::MeshMaterial, mapping9); mapIndexField(scene, Trade::SceneField::Mesh, mapping10); - CORRADE_COMPARE_AS(out.str(), + CORRADE_COMPARE_AS(out, "SceneTools::mapIndexFieldInPlace(): index -2 out of range for 10 mapping values\n" "SceneTools::mapIndexFieldInPlace(): index 9 out of range for 9 mapping values\n" "SceneTools::mapIndexFieldInPlace(): index 10 out of range for 10 mapping values\n", @@ -513,7 +510,7 @@ void MapTest::indexFieldMappingNotRepresentable() { mapIndexField(scene, Trade::sceneFieldCustom(2), mappingSigned); mapIndexField(scene, Trade::SceneField::MeshMaterial, mappingSigned); - std::ostringstream out; + Containers::String out; Error redirectError{&out}; mapIndexFieldInPlace(scene, Trade::SceneField::Mesh, mappingUnsigned); mapIndexFieldInPlace(scene, Trade::SceneField::Light, mappingUnsigned); @@ -522,7 +519,7 @@ void MapTest::indexFieldMappingNotRepresentable() { mapIndexFieldInPlace(scene, Trade::sceneFieldCustom(1), mappingSigned); mapIndexFieldInPlace(scene, Trade::sceneFieldCustom(2), mappingSigned); mapIndexFieldInPlace(scene, Trade::SceneField::MeshMaterial, mappingSigned); - CORRADE_COMPARE_AS(out.str(), + CORRADE_COMPARE_AS(out, "SceneTools::mapIndexFieldInPlace(): mapping value 65536 not representable in Trade::SceneFieldType::UnsignedShort\n" "SceneTools::mapIndexFieldInPlace(): mapping value 65536 not representable in Trade::SceneFieldType::UnsignedByte\n" "SceneTools::mapIndexFieldInPlace(): mapping value 2147483648 not representable in Trade::SceneFieldType::Int\n" diff --git a/src/Magnum/SceneTools/Test/SceneConverterImplementationTest.cpp b/src/Magnum/SceneTools/Test/SceneConverterImplementationTest.cpp index c4eef4e23..08dfcde57 100644 --- a/src/Magnum/SceneTools/Test/SceneConverterImplementationTest.cpp +++ b/src/Magnum/SceneTools/Test/SceneConverterImplementationTest.cpp @@ -24,12 +24,10 @@ DEALINGS IN THE SOFTWARE. */ -#include #include #include #include #include -#include #include #include "Magnum/Math/CubicHermite.h" @@ -207,10 +205,10 @@ void SceneConverterImplementationTest::converterInfo() { Debug{} << "======================== visual color verification end ========================="; } - std::ostringstream out; + Containers::String out; Debug redirectOutput{&out}; Implementation::printSceneConverterInfo(Debug::Flag::DisableColors, *converter); - CORRADE_COMPARE(out.str(), + CORRADE_COMPARE(out, "Plugin name: AnySceneConverter\n" "Features:\n" " ConvertMeshToFile\n" @@ -231,10 +229,10 @@ void SceneConverterImplementationTest::infoEmpty() { std::chrono::high_resolution_clock::duration time; - std::ostringstream out; + Containers::String out; Debug redirectOutput{&out}; CORRADE_VERIFY(Implementation::printInfo(Debug::Flag::DisableColors, {}, _infoArgs, importer, time) == false); - CORRADE_COMPARE(out.str(), ""); + CORRADE_COMPARE(out, ""); } void SceneConverterImplementationTest::infoScenesObjects() { @@ -332,10 +330,10 @@ void SceneConverterImplementationTest::infoScenesObjects() { Debug{} << "======================== visual color verification end ========================="; } - std::ostringstream out; + Containers::String out; Debug redirectOutput{&out}; CORRADE_VERIFY(Implementation::printInfo(Debug::Flag::DisableColors, {}, _infoArgs, importer, time) == false); - CORRADE_COMPARE_AS(out.str(), + CORRADE_COMPARE_AS(out, Utility::Path::join({SCENETOOLS_TEST_DIR, "SceneConverterImplementationTestFiles", data.expected}), TestSuite::Compare::StringToFile); } @@ -413,10 +411,10 @@ void SceneConverterImplementationTest::infoAnimations() { Debug{} << "======================== visual color verification end ========================="; } - std::ostringstream out; + Containers::String out; Debug redirectOutput{&out}; CORRADE_VERIFY(Implementation::printInfo(Debug::Flag::DisableColors, {}, _infoArgs, importer, time) == false); - CORRADE_COMPARE_AS(out.str(), + CORRADE_COMPARE_AS(out, Utility::Path::join(SCENETOOLS_TEST_DIR, "SceneConverterImplementationTestFiles/info-animations.txt"), TestSuite::Compare::StringToFile); } @@ -486,10 +484,10 @@ void SceneConverterImplementationTest::infoSkins() { Debug{} << "======================== visual color verification end ========================="; } - std::ostringstream out; + Containers::String out; Debug redirectOutput{&out}; CORRADE_VERIFY(Implementation::printInfo(Debug::Flag::DisableColors, {}, _infoArgs, importer, time) == false); - CORRADE_COMPARE_AS(out.str(), + CORRADE_COMPARE_AS(out, Utility::Path::join(SCENETOOLS_TEST_DIR, "SceneConverterImplementationTestFiles/info-skins.txt"), TestSuite::Compare::StringToFile); } @@ -542,10 +540,10 @@ void SceneConverterImplementationTest::infoLights() { Debug{} << "======================== visual color verification end ========================="; } - std::ostringstream out; + Containers::String out; Debug redirectOutput{&out}; CORRADE_VERIFY(Implementation::printInfo(Debug::Flag::DisableColors, false, _infoArgs, importer, time) == false); - CORRADE_COMPARE_AS(out.str(), + CORRADE_COMPARE_AS(out, Utility::Path::join(SCENETOOLS_TEST_DIR, "SceneConverterImplementationTestFiles/info-lights.txt"), TestSuite::Compare::StringToFile); } @@ -601,10 +599,10 @@ void SceneConverterImplementationTest::infoCameras() { Debug{} << "======================== visual color verification end ========================="; } - std::ostringstream out; + Containers::String out; Debug redirectOutput{&out}; CORRADE_VERIFY(Implementation::printInfo(Debug::Flag::DisableColors, false, _infoArgs, importer, time) == false); - CORRADE_COMPARE_AS(out.str(), + CORRADE_COMPARE_AS(out, Utility::Path::join(SCENETOOLS_TEST_DIR, "SceneConverterImplementationTestFiles/info-cameras.txt"), TestSuite::Compare::StringToFile); } @@ -668,10 +666,10 @@ void SceneConverterImplementationTest::infoMaterials() { Debug{} << "======================== visual color verification end ========================="; } - std::ostringstream out; + Containers::String out; Debug redirectOutput{&out}; CORRADE_VERIFY(Implementation::printInfo(Debug::Flag::DisableColors, false, _infoArgs, importer, time) == false); - CORRADE_COMPARE_AS(out.str(), + CORRADE_COMPARE_AS(out, Utility::Path::join(SCENETOOLS_TEST_DIR, "SceneConverterImplementationTestFiles/info-materials.txt"), TestSuite::Compare::StringToFile); } @@ -768,10 +766,10 @@ void SceneConverterImplementationTest::infoMeshes() { Debug{} << "======================== visual color verification end ========================="; } - std::ostringstream out; + Containers::String out; Debug redirectOutput{&out}; CORRADE_VERIFY(Implementation::printInfo(Debug::Flag::DisableColors, false, _infoArgs, importer, time) == false); - CORRADE_COMPARE_AS(out.str(), + CORRADE_COMPARE_AS(out, Utility::Path::join(SCENETOOLS_TEST_DIR, "SceneConverterImplementationTestFiles/info-meshes.txt"), TestSuite::Compare::StringToFile); } @@ -850,10 +848,10 @@ void SceneConverterImplementationTest::infoMeshesBounds() { Debug{} << "======================== visual color verification end ========================="; } - std::ostringstream out; + Containers::String out; Debug redirectOutput{&out}; CORRADE_VERIFY(Implementation::printInfo(Debug::Flag::DisableColors, false, _infoArgs, importer, time) == false); - CORRADE_COMPARE_AS(out.str(), + CORRADE_COMPARE_AS(out, Utility::Path::join(SCENETOOLS_TEST_DIR, "SceneConverterImplementationTestFiles/info-meshes-bounds.txt"), TestSuite::Compare::StringToFile); } @@ -908,10 +906,10 @@ void SceneConverterImplementationTest::infoTextures() { Debug{} << "======================== visual color verification end ========================="; } - std::ostringstream out; + Containers::String out; Debug redirectOutput{&out}; CORRADE_VERIFY(Implementation::printInfo(Debug::Flag::DisableColors, false, _infoArgs, importer, time) == false); - CORRADE_COMPARE_AS(out.str(), + CORRADE_COMPARE_AS(out, Utility::Path::join(SCENETOOLS_TEST_DIR, "SceneConverterImplementationTestFiles/info-textures.txt"), TestSuite::Compare::StringToFile); } @@ -945,10 +943,10 @@ void SceneConverterImplementationTest::infoImages() { Debug{} << "======================== visual color verification end ========================="; } - std::ostringstream out; + Containers::String out; Debug redirectOutput{&out}; CORRADE_VERIFY(Implementation::printInfo(Debug::Flag::DisableColors, false, _infoArgs, importer, time) == false); - CORRADE_COMPARE_AS(out.str(), + CORRADE_COMPARE_AS(out, Utility::Path::join(SCENETOOLS_TEST_DIR, "SceneConverterImplementationTestFiles/info-images.txt"), TestSuite::Compare::StringToFile); } @@ -1242,10 +1240,10 @@ void SceneConverterImplementationTest::infoReferenceCount() { Debug{} << "======================== visual color verification end ========================="; } - std::ostringstream out; + Containers::String out; Debug redirectOutput{&out}; CORRADE_VERIFY(Implementation::printInfo(Debug::Flag::DisableColors, false, _infoArgs, importer, time) == false); - CORRADE_COMPARE_AS(out.str(), + CORRADE_COMPARE_AS(out, Utility::Path::join(SCENETOOLS_TEST_DIR, "SceneConverterImplementationTestFiles/info-references.txt"), TestSuite::Compare::StringToFile); } @@ -1330,12 +1328,12 @@ void SceneConverterImplementationTest::infoError() { std::chrono::high_resolution_clock::duration time; - std::ostringstream out; + Containers::String out; Debug redirectOutput{&out}; Error redirectError{&out}; /* It should return a failure */ CORRADE_VERIFY(Implementation::printInfo(Debug::Flag::DisableColors, {}, _infoArgs, importer, time) == true); - CORRADE_COMPARE(out.str(), + CORRADE_COMPARE(out, /* It should not exit after first error... */ "Scene 0 error!\n" "Can't import scene 0\n" diff --git a/src/Magnum/ShaderTools/Test/AbstractConverterTest.cpp b/src/Magnum/ShaderTools/Test/AbstractConverterTest.cpp index 88fbb0818..196ad40a1 100644 --- a/src/Magnum/ShaderTools/Test/AbstractConverterTest.cpp +++ b/src/Magnum/ShaderTools/Test/AbstractConverterTest.cpp @@ -24,17 +24,16 @@ DEALINGS IN THE SOFTWARE. */ -#include +#include /** @todo remove once file callbacks are std::string-free */ #include #include #include #include -#include /** @todo remove once Debug is stream-free */ #include #include #include #include -#include +#include /** @todo remove once file callbacks are std::string-free */ #include #include "Magnum/FileCallback.h" @@ -366,10 +365,10 @@ void AbstractConverterTest::featuresNone() { void doSetOutputFormat(Format, Containers::StringView) override {} } converter; - std::ostringstream out; + Containers::String out; Error redirectError{&out}; converter.features(); - CORRADE_COMPARE(out.str(), "ShaderTools::AbstractConverter::features(): implementation reported no features\n"); + CORRADE_COMPARE(out, "ShaderTools::AbstractConverter::features(): implementation reported no features\n"); } void AbstractConverterTest::setFlags() { @@ -414,10 +413,10 @@ void AbstractConverterTest::setFlagsBothQuietAndVerbose() { void doSetOutputFormat(Format, Containers::StringView) override {} } converter; - std::ostringstream out; + Containers::String out; Error redirectError{&out}; converter.setFlags(ConverterFlag::Quiet|ConverterFlag::Verbose); - CORRADE_COMPARE(out.str(), "ShaderTools::AbstractConverter::setFlags(): can't have both Quiet and Verbose set\n"); + CORRADE_COMPARE(out, "ShaderTools::AbstractConverter::setFlags(): can't have both Quiet and Verbose set\n"); } void AbstractConverterTest::setFlagsPreprocessNotSupported() { @@ -431,10 +430,10 @@ void AbstractConverterTest::setFlagsPreprocessNotSupported() { void doSetOutputFormat(Format, Containers::StringView) override {} } converter; - std::ostringstream out; + Containers::String out; Error redirectError{&out}; converter.setFlags(ConverterFlag::PreprocessOnly); - CORRADE_COMPARE(out.str(), "ShaderTools::AbstractConverter::setFlags(): PreprocessOnly not supported by the implementation\n"); + CORRADE_COMPARE(out, "ShaderTools::AbstractConverter::setFlags(): PreprocessOnly not supported by the implementation\n"); } void AbstractConverterTest::setFlagsPreprocessOnlyNotAllowed() { @@ -452,13 +451,13 @@ void AbstractConverterTest::setFlagsPreprocessOnlyNotAllowed() { converter.setFlags(ConverterFlag::PreprocessOnly); - std::ostringstream out; + Containers::String out; Error redirectError{&out}; converter.linkDataToData({}); converter.linkDataToFile({}, {}); converter.linkFilesToFile({}, {}); converter.linkFilesToData({}); - CORRADE_COMPARE(out.str(), + CORRADE_COMPARE(out, "ShaderTools::AbstractConverter::linkDataToData(): PreprocessOnly is not allowed in combination with linking\n" "ShaderTools::AbstractConverter::linkDataToFile(): PreprocessOnly is not allowed in combination with linking\n" "ShaderTools::AbstractConverter::linkFilesToFile(): PreprocessOnly is not allowed in combination with linking\n" @@ -548,10 +547,10 @@ void AbstractConverterTest::setDefinitionsNotSupported() { void doSetOutputFormat(Format, Containers::StringView) override {} } converter; - std::ostringstream out; + Containers::String out; Error redirectError{&out}; converter.setDefinitions({}); - CORRADE_COMPARE(out.str(), "ShaderTools::AbstractConverter::setDefinitions(): feature not supported\n"); + CORRADE_COMPARE(out, "ShaderTools::AbstractConverter::setDefinitions(): feature not supported\n"); } void AbstractConverterTest::setDefinitionsNotImplemented() { @@ -565,10 +564,10 @@ void AbstractConverterTest::setDefinitionsNotImplemented() { void doSetOutputFormat(Format, Containers::StringView) override {} } converter; - std::ostringstream out; + Containers::String out; Error redirectError{&out}; converter.setDefinitions({}); - CORRADE_COMPARE(out.str(), "ShaderTools::AbstractConverter::setDefinitions(): feature advertised but not implemented\n"); + CORRADE_COMPARE(out, "ShaderTools::AbstractConverter::setDefinitions(): feature advertised but not implemented\n"); } void AbstractConverterTest::setOptimizationLevel() { @@ -601,10 +600,10 @@ void AbstractConverterTest::setOptimizationLevelNotSupported() { void doSetOutputFormat(Format, Containers::StringView) override {} } converter; - std::ostringstream out; + Containers::String out; Error redirectError{&out}; converter.setOptimizationLevel({}); - CORRADE_COMPARE(out.str(), "ShaderTools::AbstractConverter::setOptimizationLevel(): feature not supported\n"); + CORRADE_COMPARE(out, "ShaderTools::AbstractConverter::setOptimizationLevel(): feature not supported\n"); } void AbstractConverterTest::setOptimizationLevelNotImplemented() { @@ -618,10 +617,10 @@ void AbstractConverterTest::setOptimizationLevelNotImplemented() { void doSetOutputFormat(Format, Containers::StringView) override {} } converter; - std::ostringstream out; + Containers::String out; Error redirectError{&out}; converter.setOptimizationLevel({}); - CORRADE_COMPARE(out.str(), "ShaderTools::AbstractConverter::setOptimizationLevel(): feature advertised but not implemented\n"); + CORRADE_COMPARE(out, "ShaderTools::AbstractConverter::setOptimizationLevel(): feature advertised but not implemented\n"); } void AbstractConverterTest::setDebugInfoLevel() { @@ -654,10 +653,10 @@ void AbstractConverterTest::setDebugInfoLevelNotSupported() { void doSetOutputFormat(Format, Containers::StringView) override {} } converter; - std::ostringstream out; + Containers::String out; Error redirectError{&out}; converter.setDebugInfoLevel({}); - CORRADE_COMPARE(out.str(), "ShaderTools::AbstractConverter::setDebugInfoLevel(): feature not supported\n"); + CORRADE_COMPARE(out, "ShaderTools::AbstractConverter::setDebugInfoLevel(): feature not supported\n"); } void AbstractConverterTest::setDebugInfoLevelNotImplemented() { @@ -671,10 +670,10 @@ void AbstractConverterTest::setDebugInfoLevelNotImplemented() { void doSetOutputFormat(Format, Containers::StringView) override {} } converter; - std::ostringstream out; + Containers::String out; Error redirectError{&out}; converter.setDebugInfoLevel({}); - CORRADE_COMPARE(out.str(), "ShaderTools::AbstractConverter::setDebugInfoLevel(): feature advertised but not implemented\n"); + CORRADE_COMPARE(out, "ShaderTools::AbstractConverter::setDebugInfoLevel(): feature advertised but not implemented\n"); } void AbstractConverterTest::validateData() { @@ -709,10 +708,10 @@ void AbstractConverterTest::validateDataFailed() { } converter; /* The implementation is expected to print an error message on its own */ - std::ostringstream out; + Containers::String out; Error redirectError{&out}; CORRADE_VERIFY(!converter.validateData(Stage::MeshTask, nullptr).first()); - CORRADE_COMPARE(out.str(), ""); + CORRADE_COMPARE(out, ""); } void AbstractConverterTest::validateDataNotSupported() { @@ -726,10 +725,10 @@ void AbstractConverterTest::validateDataNotSupported() { void doSetOutputFormat(Format, Containers::StringView) override {} } converter; - std::ostringstream out; + Containers::String out; Error redirectError{&out}; converter.validateData({}, {}); - CORRADE_COMPARE(out.str(), "ShaderTools::AbstractConverter::validateData(): feature not supported\n"); + CORRADE_COMPARE(out, "ShaderTools::AbstractConverter::validateData(): feature not supported\n"); } void AbstractConverterTest::validateDataNotImplemented() { @@ -743,10 +742,10 @@ void AbstractConverterTest::validateDataNotImplemented() { void doSetOutputFormat(Format, Containers::StringView) override {} } converter; - std::ostringstream out; + Containers::String out; Error redirectError{&out}; converter.validateData({}, {}); - CORRADE_COMPARE(out.str(), "ShaderTools::AbstractConverter::validateData(): feature advertised but not implemented\n"); + CORRADE_COMPARE(out, "ShaderTools::AbstractConverter::validateData(): feature advertised but not implemented\n"); } void AbstractConverterTest::validateDataPreprocessOnly() { @@ -760,11 +759,11 @@ void AbstractConverterTest::validateDataPreprocessOnly() { void doSetOutputFormat(Format, Containers::StringView) override {} } converter; - std::ostringstream out; + Containers::String out; Error redirectError{&out}; converter.setFlags(ConverterFlag::PreprocessOnly); converter.validateData({}, {}); - CORRADE_COMPARE(out.str(), "ShaderTools::AbstractConverter::validateData(): PreprocessOnly is not allowed in combination with validation\n"); + CORRADE_COMPARE(out, "ShaderTools::AbstractConverter::validateData(): PreprocessOnly is not allowed in combination with validation\n"); } void AbstractConverterTest::validateDataCustomStringDeleter() { @@ -782,10 +781,10 @@ void AbstractConverterTest::validateDataCustomStringDeleter() { } } converter; - std::ostringstream out; + Containers::String out; Error redirectError{&out}; converter.validateData({}, {}); - CORRADE_COMPARE(out.str(), "ShaderTools::AbstractConverter::validateData(): implementation is not allowed to use a custom String deleter\n"); + CORRADE_COMPARE(out, "ShaderTools::AbstractConverter::validateData(): implementation is not allowed to use a custom String deleter\n"); } void AbstractConverterTest::validateFile() { @@ -820,10 +819,10 @@ void AbstractConverterTest::validateFileFailed() { } converter; /* The implementation is expected to print an error message on its own */ - std::ostringstream out; + Containers::String out; Error redirectError{&out}; CORRADE_VERIFY(!converter.validateFile(Stage::MeshTask, {}).first()); - CORRADE_COMPARE(out.str(), ""); + CORRADE_COMPARE(out, ""); } void AbstractConverterTest::validateFileAsData() { @@ -858,13 +857,13 @@ void AbstractConverterTest::validateFileAsDataNotFound() { } } converter; - std::ostringstream out; + Containers::String out; Error redirectError{&out}; Containers::Pair out2 = converter.validateFile({}, "nonexistent.bin"); CORRADE_VERIFY(!out2.first()); CORRADE_COMPARE(out2.second(), ""); /* There's an error message from Path::read() before */ - CORRADE_COMPARE_AS(out.str(), + CORRADE_COMPARE_AS(out, "\nShaderTools::AbstractConverter::validateFile(): cannot open file nonexistent.bin\n", TestSuite::Compare::StringHasSuffix); } @@ -880,10 +879,10 @@ void AbstractConverterTest::validateFileNotSupported() { void doSetOutputFormat(Format, Containers::StringView) override {} } converter; - std::ostringstream out; + Containers::String out; Error redirectError{&out}; converter.validateFile({}, {}); - CORRADE_COMPARE(out.str(), "ShaderTools::AbstractConverter::validateFile(): feature not supported\n"); + CORRADE_COMPARE(out, "ShaderTools::AbstractConverter::validateFile(): feature not supported\n"); } void AbstractConverterTest::validateFileNotImplemented() { @@ -897,10 +896,10 @@ void AbstractConverterTest::validateFileNotImplemented() { void doSetOutputFormat(Format, Containers::StringView) override {} } converter; - std::ostringstream out; + Containers::String out; Error redirectError{&out}; converter.validateFile({}, {}); - CORRADE_COMPARE(out.str(), "ShaderTools::AbstractConverter::validateFile(): feature advertised but not implemented\n"); + CORRADE_COMPARE(out, "ShaderTools::AbstractConverter::validateFile(): feature advertised but not implemented\n"); } void AbstractConverterTest::validateFilePreprocessOnly() { @@ -914,11 +913,11 @@ void AbstractConverterTest::validateFilePreprocessOnly() { void doSetOutputFormat(Format, Containers::StringView) override {} } converter; - std::ostringstream out; + Containers::String out; Error redirectError{&out}; converter.setFlags(ConverterFlag::PreprocessOnly); converter.validateFile({}, {}); - CORRADE_COMPARE(out.str(), "ShaderTools::AbstractConverter::validateFile(): PreprocessOnly is not allowed in combination with validation\n"); + CORRADE_COMPARE(out, "ShaderTools::AbstractConverter::validateFile(): PreprocessOnly is not allowed in combination with validation\n"); } void AbstractConverterTest::validateFileCustomStringDeleter() { @@ -936,10 +935,10 @@ void AbstractConverterTest::validateFileCustomStringDeleter() { } } converter; - std::ostringstream out; + Containers::String out; Error redirectError{&out}; converter.validateFile({}, {}); - CORRADE_COMPARE(out.str(), "ShaderTools::AbstractConverter::validateFile(): implementation is not allowed to use a custom String deleter\n"); + CORRADE_COMPARE(out, "ShaderTools::AbstractConverter::validateFile(): implementation is not allowed to use a custom String deleter\n"); } void AbstractConverterTest::convertDataToData() { @@ -976,10 +975,10 @@ void AbstractConverterTest::convertDataToDataFailed() { } converter; /* The implementation is expected to print an error message on its own */ - std::ostringstream out; + Containers::String out; Error redirectError{&out}; CORRADE_VERIFY(!converter.convertDataToData({}, nullptr)); - CORRADE_COMPARE(out.str(), ""); + CORRADE_COMPARE(out, ""); } void AbstractConverterTest::convertDataToDataNotSupported() { @@ -993,10 +992,10 @@ void AbstractConverterTest::convertDataToDataNotSupported() { void doSetOutputFormat(Format, Containers::StringView) override {} } converter; - std::ostringstream out; + Containers::String out; Error redirectError{&out}; converter.convertDataToData({}, {}); - CORRADE_COMPARE(out.str(), "ShaderTools::AbstractConverter::convertDataToData(): feature not supported\n"); + CORRADE_COMPARE(out, "ShaderTools::AbstractConverter::convertDataToData(): feature not supported\n"); } void AbstractConverterTest::convertDataToDataNotImplemented() { @@ -1011,10 +1010,10 @@ void AbstractConverterTest::convertDataToDataNotImplemented() { } converter; - std::ostringstream out; + Containers::String out; Error redirectError{&out}; converter.convertDataToData({}, {}); - CORRADE_COMPARE(out.str(), "ShaderTools::AbstractConverter::convertDataToData(): feature advertised but not implemented\n"); + CORRADE_COMPARE(out, "ShaderTools::AbstractConverter::convertDataToData(): feature advertised but not implemented\n"); } void AbstractConverterTest::convertDataToDataCustomDeleter() { @@ -1032,10 +1031,10 @@ void AbstractConverterTest::convertDataToDataCustomDeleter() { } } converter; - std::ostringstream out; + Containers::String out; Error redirectError{&out}; converter.convertDataToData({}, {}); - CORRADE_COMPARE(out.str(), "ShaderTools::AbstractConverter::convertDataToData(): implementation is not allowed to use a custom Array deleter\n"); + CORRADE_COMPARE(out, "ShaderTools::AbstractConverter::convertDataToData(): implementation is not allowed to use a custom Array deleter\n"); } void AbstractConverterTest::convertDataToFileThroughData() { @@ -1082,11 +1081,11 @@ void AbstractConverterTest::convertDataToFileThroughDataFailed() { /* Function should fail, no file should get written and no error output should be printed (the base implementation assumes the plugin does it) */ - std::ostringstream out; + Containers::String out; Error redirectError{&out}; CORRADE_VERIFY(!converter.convertDataToFile({}, {}, filename)); CORRADE_VERIFY(!Utility::Path::exists(filename)); - CORRADE_COMPARE(out.str(), ""); + CORRADE_COMPARE(out, ""); } void AbstractConverterTest::convertDataToFileThroughDataNotWritable() { @@ -1102,10 +1101,10 @@ void AbstractConverterTest::convertDataToFileThroughDataNotWritable() { } } converter; - std::ostringstream out; + Containers::String out; Error redirectError{&out}; CORRADE_VERIFY(!converter.convertDataToFile({}, nullptr, "/some/path/that/does/not/exist")); - CORRADE_COMPARE_AS(out.str(), + CORRADE_COMPARE_AS(out, "ShaderTools::AbstractConverter::convertDataToFile(): cannot write to file /some/path/that/does/not/exist\n", TestSuite::Compare::StringHasSuffix); } @@ -1121,10 +1120,10 @@ void AbstractConverterTest::convertDataToFileNotSupported() { void doSetOutputFormat(Format, Containers::StringView) override {} } converter; - std::ostringstream out; + Containers::String out; Error redirectError{&out}; converter.convertDataToFile({}, {}, {}); - CORRADE_COMPARE(out.str(), "ShaderTools::AbstractConverter::convertDataToFile(): feature not supported\n"); + CORRADE_COMPARE(out, "ShaderTools::AbstractConverter::convertDataToFile(): feature not supported\n"); } void AbstractConverterTest::convertDataToFileNotImplemented() { @@ -1138,10 +1137,10 @@ void AbstractConverterTest::convertDataToFileNotImplemented() { void doSetOutputFormat(Format, Containers::StringView) override {} } converter; - std::ostringstream out; + Containers::String out; Error redirectError{&out}; converter.convertDataToFile({}, {}, {}); - CORRADE_COMPARE(out.str(), "ShaderTools::AbstractConverter::convertDataToData(): feature advertised but not implemented\n"); + CORRADE_COMPARE(out, "ShaderTools::AbstractConverter::convertDataToData(): feature advertised but not implemented\n"); } void AbstractConverterTest::convertFileToFile() { @@ -1185,10 +1184,10 @@ void AbstractConverterTest::convertFileToFileFailed() { } converter; /* The implementation is expected to print an error message on its own */ - std::ostringstream out; + Containers::String out; Error redirectError{&out}; CORRADE_VERIFY(!converter.convertFileToFile({}, Utility::Path::join(SHADERTOOLS_TEST_DIR, "file.dat"), Utility::Path::join(SHADERTOOLS_TEST_OUTPUT_DIR, "file.dat"))); - CORRADE_COMPARE(out.str(), ""); + CORRADE_COMPARE(out, ""); } void AbstractConverterTest::convertFileToFileThroughData() { @@ -1228,11 +1227,11 @@ void AbstractConverterTest::convertFileToFileThroughDataNotFound() { } } converter; - std::ostringstream out; + Containers::String out; Error redirectError{&out}; CORRADE_VERIFY(!converter.convertFileToFile({}, "nonexistent.bin", "file.dat")); /* There's an error message from Path::read() before */ - CORRADE_COMPARE_AS(out.str(), + CORRADE_COMPARE_AS(out, "\nShaderTools::AbstractConverter::convertFileToFile(): cannot open file nonexistent.bin\n", TestSuite::Compare::StringHasSuffix); } @@ -1257,11 +1256,11 @@ void AbstractConverterTest::convertFileToFileThroughDataFailed() { /* Function should fail, no file should get written and no error output should be printed (the base implementation assumes the plugin does it) */ - std::ostringstream out; + Containers::String out; Error redirectError{&out}; CORRADE_VERIFY(!converter.convertFileToFile({}, Utility::Path::join(SHADERTOOLS_TEST_DIR, "file.dat"), filename)); CORRADE_VERIFY(!Utility::Path::exists(filename)); - CORRADE_COMPARE(out.str(), ""); + CORRADE_COMPARE(out, ""); } void AbstractConverterTest::convertFileToFileThroughDataNotWritable() { @@ -1277,10 +1276,10 @@ void AbstractConverterTest::convertFileToFileThroughDataNotWritable() { } } converter; - std::ostringstream out; + Containers::String out; Error redirectError{&out}; CORRADE_VERIFY(!converter.convertFileToFile({}, Utility::Path::join(SHADERTOOLS_TEST_DIR, "file.dat"), "/some/path/that/does/not/exist")); - CORRADE_COMPARE_AS(out.str(), + CORRADE_COMPARE_AS(out, "ShaderTools::AbstractConverter::convertFileToFile(): cannot write to file /some/path/that/does/not/exist\n", TestSuite::Compare::StringHasSuffix); } @@ -1296,10 +1295,10 @@ void AbstractConverterTest::convertFileToFileNotSupported() { void doSetOutputFormat(Format, Containers::StringView) override {} } converter; - std::ostringstream out; + Containers::String out; Error redirectError{&out}; converter.convertFileToFile({}, {}, {}); - CORRADE_COMPARE(out.str(), "ShaderTools::AbstractConverter::convertFileToFile(): feature not supported\n"); + CORRADE_COMPARE(out, "ShaderTools::AbstractConverter::convertFileToFile(): feature not supported\n"); } void AbstractConverterTest::convertFileToFileNotImplemented() { @@ -1313,10 +1312,10 @@ void AbstractConverterTest::convertFileToFileNotImplemented() { void doSetOutputFormat(Format, Containers::StringView) override {} } converter; - std::ostringstream out; + Containers::String out; Error redirectError{&out}; converter.convertFileToFile({}, {}, {}); - CORRADE_COMPARE(out.str(), "ShaderTools::AbstractConverter::convertFileToFile(): feature advertised but not implemented\n"); + CORRADE_COMPARE(out, "ShaderTools::AbstractConverter::convertFileToFile(): feature advertised but not implemented\n"); } void AbstractConverterTest::convertFileToData() { @@ -1356,10 +1355,10 @@ void AbstractConverterTest::convertFileToDataFailed() { } converter; /* The implementation is expected to print an error message on its own */ - std::ostringstream out; + Containers::String out; Error redirectError{&out}; CORRADE_VERIFY(!converter.convertFileToData({}, Utility::Path::join(SHADERTOOLS_TEST_DIR, "file.dat"))); - CORRADE_COMPARE(out.str(), ""); + CORRADE_COMPARE(out, ""); } void AbstractConverterTest::convertFileToDataAsData() { @@ -1395,11 +1394,11 @@ void AbstractConverterTest::convertFileToDataAsDataNotFound() { } } converter; - std::ostringstream out; + Containers::String out; Error redirectError{&out}; CORRADE_VERIFY(!converter.convertFileToData({}, "nonexistent.bin")); /* There's an error message from Path::read() before */ - CORRADE_COMPARE_AS(out.str(), + CORRADE_COMPARE_AS(out, "\nShaderTools::AbstractConverter::convertFileToData(): cannot open file nonexistent.bin\n", TestSuite::Compare::StringHasSuffix); } @@ -1416,10 +1415,10 @@ void AbstractConverterTest::convertFileToDataNotSupported() { } converter; - std::ostringstream out; + Containers::String out; Error redirectError{&out}; converter.convertFileToData({}, {}); - CORRADE_COMPARE(out.str(), "ShaderTools::AbstractConverter::convertFileToData(): feature not supported\n"); + CORRADE_COMPARE(out, "ShaderTools::AbstractConverter::convertFileToData(): feature not supported\n"); } void AbstractConverterTest::convertFileToDataNotImplemented() { @@ -1433,10 +1432,10 @@ void AbstractConverterTest::convertFileToDataNotImplemented() { void doSetOutputFormat(Format, Containers::StringView) override {} } converter; - std::ostringstream out; + Containers::String out; Error redirectError{&out}; converter.convertFileToData({}, Utility::Path::join(SHADERTOOLS_TEST_DIR, "file.dat")); - CORRADE_COMPARE(out.str(), "ShaderTools::AbstractConverter::convertDataToData(): feature advertised but not implemented\n"); + CORRADE_COMPARE(out, "ShaderTools::AbstractConverter::convertDataToData(): feature advertised but not implemented\n"); } void AbstractConverterTest::convertFileToDataCustomDeleter() { @@ -1454,10 +1453,10 @@ void AbstractConverterTest::convertFileToDataCustomDeleter() { } } converter; - std::ostringstream out; + Containers::String out; Error redirectError{&out}; converter.convertFileToData({}, {}); - CORRADE_COMPARE(out.str(), "ShaderTools::AbstractConverter::convertFileToData(): implementation is not allowed to use a custom Array deleter\n"); + CORRADE_COMPARE(out, "ShaderTools::AbstractConverter::convertFileToData(): implementation is not allowed to use a custom Array deleter\n"); } void AbstractConverterTest::linkDataToData() { @@ -1502,11 +1501,11 @@ void AbstractConverterTest::linkDataToDataFailed() { } converter; /* The implementation is expected to print an error message on its own */ - std::ostringstream out; + Containers::String out; Error redirectError{&out}; /* {{}} makes GCC 4.8 warn about zero as null pointer constant */ converter.linkDataToData({Containers::Pair>{}}); - CORRADE_COMPARE(out.str(), ""); + CORRADE_COMPARE(out, ""); } void AbstractConverterTest::linkDataToDataNotSupported() { @@ -1520,10 +1519,10 @@ void AbstractConverterTest::linkDataToDataNotSupported() { void doSetOutputFormat(Format, Containers::StringView) override {} } converter; - std::ostringstream out; + Containers::String out; Error redirectError{&out}; converter.linkDataToData({}); - CORRADE_COMPARE(out.str(), "ShaderTools::AbstractConverter::linkDataToData(): feature not supported\n"); + CORRADE_COMPARE(out, "ShaderTools::AbstractConverter::linkDataToData(): feature not supported\n"); } void AbstractConverterTest::linkDataToDataNotImplemented() { @@ -1537,11 +1536,11 @@ void AbstractConverterTest::linkDataToDataNotImplemented() { void doSetOutputFormat(Format, Containers::StringView) override {} } converter; - std::ostringstream out; + Containers::String out; Error redirectError{&out}; /* {{}} makes GCC 4.8 warn about zero as null pointer constant */ converter.linkDataToData({Containers::Pair>{}}); - CORRADE_COMPARE(out.str(), "ShaderTools::AbstractConverter::linkDataToData(): feature advertised but not implemented\n"); + CORRADE_COMPARE(out, "ShaderTools::AbstractConverter::linkDataToData(): feature advertised but not implemented\n"); } void AbstractConverterTest::linkDataToDataPreprocessOnly() { @@ -1555,11 +1554,11 @@ void AbstractConverterTest::linkDataToDataPreprocessOnly() { void doSetOutputFormat(Format, Containers::StringView) override {} } converter; - std::ostringstream out; + Containers::String out; Error redirectError{&out}; converter.setFlags(ConverterFlag::PreprocessOnly); converter.linkDataToData({}); - CORRADE_COMPARE(out.str(), "ShaderTools::AbstractConverter::linkDataToData(): PreprocessOnly is not allowed in combination with linking\n"); + CORRADE_COMPARE(out, "ShaderTools::AbstractConverter::linkDataToData(): PreprocessOnly is not allowed in combination with linking\n"); } void AbstractConverterTest::linkDataToDataNoData() { @@ -1573,10 +1572,10 @@ void AbstractConverterTest::linkDataToDataNoData() { void doSetOutputFormat(Format, Containers::StringView) override {} } converter; - std::ostringstream out; + Containers::String out; Error redirectError{&out}; converter.linkDataToData({}); - CORRADE_COMPARE(out.str(), "ShaderTools::AbstractConverter::linkDataToData(): no data passed\n"); + CORRADE_COMPARE(out, "ShaderTools::AbstractConverter::linkDataToData(): no data passed\n"); } void AbstractConverterTest::linkDataToDataCustomDeleter() { @@ -1594,11 +1593,11 @@ void AbstractConverterTest::linkDataToDataCustomDeleter() { } } converter; - std::ostringstream out; + Containers::String out; Error redirectError{&out}; /* {{}} makes GCC 4.8 warn about zero as null pointer constant */ converter.linkDataToData({Containers::Pair>{}}); - CORRADE_COMPARE(out.str(), "ShaderTools::AbstractConverter::linkDataToData(): implementation is not allowed to use a custom Array deleter\n"); + CORRADE_COMPARE(out, "ShaderTools::AbstractConverter::linkDataToData(): implementation is not allowed to use a custom Array deleter\n"); } void AbstractConverterTest::linkDataToFileThroughData() { @@ -1651,12 +1650,12 @@ void AbstractConverterTest::linkDataToFileThroughDataFailed() { /* Function should fail, no file should get written and no error output should be printed (the base implementation assumes the plugin does it) */ - std::ostringstream out; + Containers::String out; Error redirectError{&out}; /* {{}} makes GCC 4.8 warn about zero as null pointer constant */ CORRADE_VERIFY(!converter.linkDataToFile({Containers::Pair>{}}, filename)); CORRADE_VERIFY(!Utility::Path::exists(filename)); - CORRADE_COMPARE(out.str(), ""); + CORRADE_COMPARE(out, ""); } void AbstractConverterTest::linkDataToFileThroughDataNotWritable() { @@ -1672,11 +1671,11 @@ void AbstractConverterTest::linkDataToFileThroughDataNotWritable() { } } converter; - std::ostringstream out; + Containers::String out; Error redirectError{&out}; /* {{}} makes GCC 4.8 warn about zero as null pointer constant */ CORRADE_VERIFY(!converter.linkDataToFile({Containers::Pair>{}}, "/some/path/that/does/not/exist")); - CORRADE_COMPARE_AS(out.str(), + CORRADE_COMPARE_AS(out, "ShaderTools::AbstractConverter::linkDataToFile(): cannot write to file /some/path/that/does/not/exist\n", TestSuite::Compare::StringHasSuffix); } @@ -1692,10 +1691,10 @@ void AbstractConverterTest::linkDataToFileNotSupported() { void doSetOutputFormat(Format, Containers::StringView) override {} } converter; - std::ostringstream out; + Containers::String out; Error redirectError{&out}; converter.linkDataToFile({}, "file.dat"); - CORRADE_COMPARE(out.str(), "ShaderTools::AbstractConverter::linkDataToFile(): feature not supported\n"); + CORRADE_COMPARE(out, "ShaderTools::AbstractConverter::linkDataToFile(): feature not supported\n"); } void AbstractConverterTest::linkDataToFileNotImplemented() { @@ -1709,11 +1708,11 @@ void AbstractConverterTest::linkDataToFileNotImplemented() { void doSetOutputFormat(Format, Containers::StringView) override {} } converter; - std::ostringstream out; + Containers::String out; Error redirectError{&out}; /* {{}} makes GCC 4.8 warn about zero as null pointer constant */ converter.linkDataToFile({Containers::Pair>{}}, "file.dat"); - CORRADE_COMPARE(out.str(), "ShaderTools::AbstractConverter::linkDataToData(): feature advertised but not implemented\n"); + CORRADE_COMPARE(out, "ShaderTools::AbstractConverter::linkDataToData(): feature advertised but not implemented\n"); } void AbstractConverterTest::linkDataToFilePreprocessOnly() { @@ -1727,11 +1726,11 @@ void AbstractConverterTest::linkDataToFilePreprocessOnly() { void doSetOutputFormat(Format, Containers::StringView) override {} } converter; - std::ostringstream out; + Containers::String out; Error redirectError{&out}; converter.setFlags(ConverterFlag::PreprocessOnly); converter.linkDataToFile({}, {}); - CORRADE_COMPARE(out.str(), "ShaderTools::AbstractConverter::linkDataToFile(): PreprocessOnly is not allowed in combination with linking\n"); + CORRADE_COMPARE(out, "ShaderTools::AbstractConverter::linkDataToFile(): PreprocessOnly is not allowed in combination with linking\n"); } void AbstractConverterTest::linkDataToFileNoData() { @@ -1745,10 +1744,10 @@ void AbstractConverterTest::linkDataToFileNoData() { void doSetOutputFormat(Format, Containers::StringView) override {} } converter; - std::ostringstream out; + Containers::String out; Error redirectError{&out}; converter.linkDataToFile({}, {}); - CORRADE_COMPARE(out.str(), "ShaderTools::AbstractConverter::linkDataToFile(): no data passed\n"); + CORRADE_COMPARE(out, "ShaderTools::AbstractConverter::linkDataToFile(): no data passed\n"); } void AbstractConverterTest::linkFilesToFile() { @@ -1801,12 +1800,12 @@ void AbstractConverterTest::linkFilesToFileFailed() { } converter; /* The implementation is expected to print an error message on its own */ - std::ostringstream out; + Containers::String out; Error redirectError{&out}; CORRADE_VERIFY(!converter.linkFilesToFile({ {Stage::Vertex, Utility::Path::join(SHADERTOOLS_TEST_DIR, "another.dat")} }, Utility::Path::join(SHADERTOOLS_TEST_OUTPUT_DIR, "file.dat"))); - CORRADE_COMPARE(out.str(), ""); + CORRADE_COMPARE(out, ""); } void AbstractConverterTest::linkFilesToFileThroughData() { @@ -1853,14 +1852,14 @@ void AbstractConverterTest::linkFilesToFileThroughDataNotFound() { } } converter; - std::ostringstream out; + Containers::String out; Error redirectError{&out}; CORRADE_VERIFY(!converter.linkFilesToFile({ {{}, Utility::Path::join(SHADERTOOLS_TEST_DIR, "another.dat")}, {{}, "nonexistent.bin"} }, "file.dat")); /* There's an error message from Path::read() before */ - CORRADE_COMPARE_AS(out.str(), + CORRADE_COMPARE_AS(out, "\nShaderTools::AbstractConverter::linkFilesToFile(): cannot open file nonexistent.bin\n", TestSuite::Compare::StringHasSuffix); } @@ -1885,13 +1884,13 @@ void AbstractConverterTest::linkFilesToFileThroughDataFailed() { /* Function should fail, no file should get written and no error output should be printed (the base implementation assumes the plugin does it) */ - std::ostringstream out; + Containers::String out; Error redirectError{&out}; CORRADE_VERIFY(!converter.linkFilesToFile({ {{}, Utility::Path::join(SHADERTOOLS_TEST_DIR, "file.dat")} }, filename)); CORRADE_VERIFY(!Utility::Path::exists(filename)); - CORRADE_COMPARE(out.str(), ""); + CORRADE_COMPARE(out, ""); } void AbstractConverterTest::linkFilesToFileThroughDataNotWritable() { @@ -1907,12 +1906,12 @@ void AbstractConverterTest::linkFilesToFileThroughDataNotWritable() { } } converter; - std::ostringstream out; + Containers::String out; Error redirectError{&out}; CORRADE_VERIFY(!converter.linkFilesToFile({ {{}, Utility::Path::join(SHADERTOOLS_TEST_DIR, "file.dat")} }, "/some/path/that/does/not/exist")); - CORRADE_COMPARE_AS(out.str(), + CORRADE_COMPARE_AS(out, "ShaderTools::AbstractConverter::linkFilesToFile(): cannot write to file /some/path/that/does/not/exist\n", TestSuite::Compare::StringHasSuffix); } @@ -1928,10 +1927,10 @@ void AbstractConverterTest::linkFilesToFileNotSupported() { void doSetOutputFormat(Format, Containers::StringView) override {} } converter; - std::ostringstream out; + Containers::String out; Error redirectError{&out}; converter.linkFilesToFile({}, {}); - CORRADE_COMPARE(out.str(), "ShaderTools::AbstractConverter::linkFilesToFile(): feature not supported\n"); + CORRADE_COMPARE(out, "ShaderTools::AbstractConverter::linkFilesToFile(): feature not supported\n"); } void AbstractConverterTest::linkFilesToFileNotImplemented() { @@ -1945,11 +1944,11 @@ void AbstractConverterTest::linkFilesToFileNotImplemented() { void doSetOutputFormat(Format, Containers::StringView) override {} } converter; - std::ostringstream out; + Containers::String out; Error redirectError{&out}; /* {{}} makes GCC 4.8 warn about zero as null pointer constant */ converter.linkFilesToFile({Containers::Pair{}}, {}); - CORRADE_COMPARE(out.str(), "ShaderTools::AbstractConverter::linkFilesToFile(): feature advertised but not implemented\n"); + CORRADE_COMPARE(out, "ShaderTools::AbstractConverter::linkFilesToFile(): feature advertised but not implemented\n"); } void AbstractConverterTest::linkFilesToFilePreprocessOnly() { @@ -1963,11 +1962,11 @@ void AbstractConverterTest::linkFilesToFilePreprocessOnly() { void doSetOutputFormat(Format, Containers::StringView) override {} } converter; - std::ostringstream out; + Containers::String out; Error redirectError{&out}; converter.setFlags(ConverterFlag::PreprocessOnly); converter.linkFilesToFile({}, {}); - CORRADE_COMPARE(out.str(), "ShaderTools::AbstractConverter::linkFilesToFile(): PreprocessOnly is not allowed in combination with linking\n"); + CORRADE_COMPARE(out, "ShaderTools::AbstractConverter::linkFilesToFile(): PreprocessOnly is not allowed in combination with linking\n"); } void AbstractConverterTest::linkFilesToFileNoFile() { @@ -1981,10 +1980,10 @@ void AbstractConverterTest::linkFilesToFileNoFile() { void doSetOutputFormat(Format, Containers::StringView) override {} } converter; - std::ostringstream out; + Containers::String out; Error redirectError{&out}; converter.linkFilesToFile({}, {}); - CORRADE_COMPARE(out.str(), "ShaderTools::AbstractConverter::linkFilesToFile(): no files passed\n"); + CORRADE_COMPARE(out, "ShaderTools::AbstractConverter::linkFilesToFile(): no files passed\n"); } void AbstractConverterTest::linkFilesToData() { @@ -2033,12 +2032,12 @@ void AbstractConverterTest::linkFilesToDataFailed() { } converter; /* The implementation is expected to print an error message on its own */ - std::ostringstream out; + Containers::String out; Error redirectError{&out}; CORRADE_VERIFY(!converter.linkFilesToData({ {Stage::Vertex, Utility::Path::join(SHADERTOOLS_TEST_DIR, "another.dat")} })); - CORRADE_COMPARE(out.str(), ""); + CORRADE_COMPARE(out, ""); } void AbstractConverterTest::linkFilesToDataAsData() { @@ -2085,13 +2084,13 @@ void AbstractConverterTest::linkFilesToDataAsDataNotFound() { CORRADE_VERIFY(true); /* Capture correct function name first */ - std::ostringstream out; + Containers::String out; Error redirectError{&out}; CORRADE_VERIFY(!converter.linkFilesToData({ {{}, "nonexistent.bin"} })); /* There's an error message from Path::read() before */ - CORRADE_COMPARE_AS(out.str(), + CORRADE_COMPARE_AS(out, "\nShaderTools::AbstractConverter::linkFilesToData(): cannot open file nonexistent.bin\n", TestSuite::Compare::StringHasSuffix); } @@ -2107,10 +2106,10 @@ void AbstractConverterTest::linkFilesToDataNotSupported() { void doSetOutputFormat(Format, Containers::StringView) override {} } converter; - std::ostringstream out; + Containers::String out; Error redirectError{&out}; converter.linkFilesToData({}); - CORRADE_COMPARE(out.str(), "ShaderTools::AbstractConverter::linkFilesToData(): feature not supported\n"); + CORRADE_COMPARE(out, "ShaderTools::AbstractConverter::linkFilesToData(): feature not supported\n"); } void AbstractConverterTest::linkFilesToDataNotImplemented() { @@ -2124,12 +2123,12 @@ void AbstractConverterTest::linkFilesToDataNotImplemented() { void doSetOutputFormat(Format, Containers::StringView) override {} } converter; - std::ostringstream out; + Containers::String out; Error redirectError{&out}; converter.linkFilesToData({ {{}, Utility::Path::join(SHADERTOOLS_TEST_DIR, "file.dat")} }); - CORRADE_COMPARE(out.str(), "ShaderTools::AbstractConverter::linkDataToData(): feature advertised but not implemented\n"); + CORRADE_COMPARE(out, "ShaderTools::AbstractConverter::linkDataToData(): feature advertised but not implemented\n"); } void AbstractConverterTest::linkFilesToDataPreprocessOnly() { @@ -2143,11 +2142,11 @@ void AbstractConverterTest::linkFilesToDataPreprocessOnly() { void doSetOutputFormat(Format, Containers::StringView) override {} } converter; - std::ostringstream out; + Containers::String out; Error redirectError{&out}; converter.setFlags(ConverterFlag::PreprocessOnly); converter.linkFilesToData({}); - CORRADE_COMPARE(out.str(), "ShaderTools::AbstractConverter::linkFilesToData(): PreprocessOnly is not allowed in combination with linking\n"); + CORRADE_COMPARE(out, "ShaderTools::AbstractConverter::linkFilesToData(): PreprocessOnly is not allowed in combination with linking\n"); } void AbstractConverterTest::linkFilesToDataNoFile() { @@ -2161,10 +2160,10 @@ void AbstractConverterTest::linkFilesToDataNoFile() { void doSetOutputFormat(Format, Containers::StringView) override {} } converter; - std::ostringstream out; + Containers::String out; Error redirectError{&out}; converter.linkFilesToData({}); - CORRADE_COMPARE(out.str(), "ShaderTools::AbstractConverter::linkFilesToData(): no files passed\n"); + CORRADE_COMPARE(out, "ShaderTools::AbstractConverter::linkFilesToData(): no files passed\n"); } void AbstractConverterTest::linkFilesToDataCustomDeleter() { @@ -2182,12 +2181,12 @@ void AbstractConverterTest::linkFilesToDataCustomDeleter() { } } converter; - std::ostringstream out; + Containers::String out; Error redirectError{&out}; converter.linkFilesToData({ {{}, "file.dat"} }); - CORRADE_COMPARE(out.str(), "ShaderTools::AbstractConverter::linkFilesToData(): implementation is not allowed to use a custom Array deleter\n"); + CORRADE_COMPARE(out, "ShaderTools::AbstractConverter::linkFilesToData(): implementation is not allowed to use a custom Array deleter\n"); } void AbstractConverterTest::setInputFileCallback() { @@ -2320,14 +2319,14 @@ void AbstractConverterTest::setInputFileCallbackNotSupported() { void doSetOutputFormat(Format, Containers::StringView) override {} } converter; - std::ostringstream out; + Containers::String out; Error redirectError{&out}; int a; converter.setInputFileCallback([](const std::string&, InputFileCallbackPolicy, void*) { return Containers::Optional>{}; }, &a); - CORRADE_COMPARE(out.str(), "ShaderTools::AbstractConverter::setInputFileCallback(): converter supports neither loading from data nor via callbacks, callbacks can't be used\n"); + CORRADE_COMPARE(out, "ShaderTools::AbstractConverter::setInputFileCallback(): converter supports neither loading from data nor via callbacks, callbacks can't be used\n"); } void AbstractConverterTest::setInputFileCallbackValidateFileDirectly() { @@ -2428,12 +2427,12 @@ void AbstractConverterTest::setInputFileCallbackValidateFileThroughBaseImplement return Containers::Optional>{}; }); - std::ostringstream out; + Containers::String out; Error redirectError{&out}; CORRADE_COMPARE(converter.validateFile({}, "file.dat"), Containers::pair(false, Containers::String{})); CORRADE_VERIFY(converter.validateFileCalled); - CORRADE_COMPARE(out.str(), "ShaderTools::AbstractConverter::validateFile(): cannot open file file.dat\n"); + CORRADE_COMPARE(out, "ShaderTools::AbstractConverter::validateFile(): cannot open file file.dat\n"); } void AbstractConverterTest::setInputFileCallbackValidateFileAsData() { @@ -2498,11 +2497,11 @@ void AbstractConverterTest::setInputFileCallbackValidateFileAsDataFailed() { return Containers::Optional>{}; }); - std::ostringstream out; + Containers::String out; Error redirectError{&out}; CORRADE_COMPARE(converter.validateFile({}, "file.dat"), Containers::pair(false, Containers::String{})); - CORRADE_COMPARE(out.str(), "ShaderTools::AbstractConverter::validateFile(): cannot open file file.dat\n"); + CORRADE_COMPARE(out, "ShaderTools::AbstractConverter::validateFile(): cannot open file file.dat\n"); } void AbstractConverterTest::setInputFileCallbackConvertFileToFileDirectly() { @@ -2611,12 +2610,12 @@ void AbstractConverterTest::setInputFileCallbackConvertFileToFileThroughBaseImpl return Containers::Optional>{}; }); - std::ostringstream out; + Containers::String out; Error redirectError{&out}; CORRADE_VERIFY(!converter.convertFileToFile({}, "file.dat", "/some/path/that/does/not/exist")); CORRADE_VERIFY(converter.convertFileToFileCalled); - CORRADE_COMPARE(out.str(), "ShaderTools::AbstractConverter::convertFileToFile(): cannot open file file.dat\n"); + CORRADE_COMPARE(out, "ShaderTools::AbstractConverter::convertFileToFile(): cannot open file file.dat\n"); } void AbstractConverterTest::setInputFileCallbackConvertFileToFileAsData() { @@ -2689,11 +2688,11 @@ void AbstractConverterTest::setInputFileCallbackConvertFileToFileAsDataFailed() return Containers::Optional>{}; }); - std::ostringstream out; + Containers::String out; Error redirectError{&out}; CORRADE_VERIFY(!converter.convertFileToFile({}, "file.dat", "/some/path/that/does/not/exist")); - CORRADE_COMPARE(out.str(), "ShaderTools::AbstractConverter::convertFileToFile(): cannot open file file.dat\n"); + CORRADE_COMPARE(out, "ShaderTools::AbstractConverter::convertFileToFile(): cannot open file file.dat\n"); } void AbstractConverterTest::setInputFileCallbackConvertFileToFileAsDataNotWritable() { @@ -2735,12 +2734,12 @@ void AbstractConverterTest::setInputFileCallbackConvertFileToFileAsDataNotWritab return {}; }, state); - std::ostringstream out; + Containers::String out; Error redirectError{&out}; CORRADE_VERIFY(!converter.convertFileToFile({}, "file.dat", "/some/path/that/does/not/exist")); CORRADE_VERIFY(state.loaded); CORRADE_VERIFY(state.closed); - CORRADE_COMPARE_AS(out.str(), + CORRADE_COMPARE_AS(out, "ShaderTools::AbstractConverter::convertFileToFile(): cannot write to file /some/path/that/does/not/exist\n", TestSuite::Compare::StringHasSuffix); } @@ -2855,12 +2854,12 @@ void AbstractConverterTest::setInputFileCallbackConvertFileToDataThroughBaseImpl return Containers::Optional>{}; }); - std::ostringstream out; + Containers::String out; Error redirectError{&out}; CORRADE_VERIFY(!converter.convertFileToData({}, "file.dat")); CORRADE_VERIFY(converter.convertFileToDataCalled); - CORRADE_COMPARE(out.str(), "ShaderTools::AbstractConverter::convertFileToData(): cannot open file file.dat\n"); + CORRADE_COMPARE(out, "ShaderTools::AbstractConverter::convertFileToData(): cannot open file file.dat\n"); } void AbstractConverterTest::setInputFileCallbackConvertFileToDataAsData() { @@ -2931,11 +2930,11 @@ void AbstractConverterTest::setInputFileCallbackConvertFileToDataAsDataFailed() return Containers::Optional>{}; }); - std::ostringstream out; + Containers::String out; Error redirectError{&out}; CORRADE_VERIFY(!converter.convertFileToData({}, "file.dat")); - CORRADE_COMPARE(out.str(), "ShaderTools::AbstractConverter::convertFileToData(): cannot open file file.dat\n"); + CORRADE_COMPARE(out, "ShaderTools::AbstractConverter::convertFileToData(): cannot open file file.dat\n"); } void AbstractConverterTest::setInputFileCallbackLinkFilesToFileDirectly() { @@ -3082,7 +3081,7 @@ void AbstractConverterTest::setInputFileCallbackLinkFilesToFileThroughBaseImplem return {}; }, state); - std::ostringstream out; + Containers::String out; Error redirectError{&out}; CORRADE_VERIFY(!converter.linkFilesToFile({ @@ -3094,7 +3093,7 @@ void AbstractConverterTest::setInputFileCallbackLinkFilesToFileThroughBaseImplem "loaded another.dat\n" "loaded file.dat\n" /* this fails */ "closed another.dat\n"); - CORRADE_COMPARE(out.str(), "ShaderTools::AbstractConverter::linkFilesToFile(): cannot open file file.dat\n"); + CORRADE_COMPARE(out, "ShaderTools::AbstractConverter::linkFilesToFile(): cannot open file file.dat\n"); } void AbstractConverterTest::setInputFileCallbackLinkFilesToFileAsData() { @@ -3197,14 +3196,14 @@ void AbstractConverterTest::setInputFileCallbackLinkFilesToFileAsDataFailed() { return {}; }, state); - std::ostringstream out; + Containers::String out; Error redirectError{&out}; CORRADE_VERIFY(!converter.linkFilesToFile({ {Stage::Vertex, "another.dat"}, {Stage::Fragment, "file.dat"} }, "/some/path/that/does/not/exist")); - CORRADE_COMPARE(out.str(), "ShaderTools::AbstractConverter::linkFilesToFile(): cannot open file file.dat\n"); + CORRADE_COMPARE(out, "ShaderTools::AbstractConverter::linkFilesToFile(): cannot open file file.dat\n"); } void AbstractConverterTest::setInputFileCallbackLinkFilesToFileAsDataNotWritable() { @@ -3249,7 +3248,7 @@ void AbstractConverterTest::setInputFileCallbackLinkFilesToFileAsDataNotWritable return {}; }, state); - std::ostringstream out; + Containers::String out; Error redirectError{&out}; CORRADE_VERIFY(!converter.linkFilesToFile({ {Stage::Vertex, "another.dat"}, @@ -3260,7 +3259,7 @@ void AbstractConverterTest::setInputFileCallbackLinkFilesToFileAsDataNotWritable "loaded file.dat\n" "closed another.dat\n" "closed file.dat\n"); - CORRADE_COMPARE_AS(out.str(), + CORRADE_COMPARE_AS(out, "ShaderTools::AbstractConverter::linkFilesToFile(): cannot write to file /some/path/that/does/not/exist\n", TestSuite::Compare::StringHasSuffix); } @@ -3408,7 +3407,7 @@ void AbstractConverterTest::setInputFileCallbackLinkFilesToDataThroughBaseImplem return {}; }, state); - std::ostringstream out; + Containers::String out; Error redirectError{&out}; CORRADE_VERIFY(!converter.linkFilesToData({ @@ -3420,7 +3419,7 @@ void AbstractConverterTest::setInputFileCallbackLinkFilesToDataThroughBaseImplem "loaded another.dat\n" "loaded file.dat\n" /* this fails */ "closed another.dat\n"); - CORRADE_COMPARE(out.str(), "ShaderTools::AbstractConverter::linkFilesToData(): cannot open file file.dat\n"); + CORRADE_COMPARE(out, "ShaderTools::AbstractConverter::linkFilesToData(): cannot open file file.dat\n"); } void AbstractConverterTest::setInputFileCallbackLinkFilesToDataAsData() { @@ -3521,86 +3520,86 @@ void AbstractConverterTest::setInputFileCallbackLinkFilesToDataAsDataFailed() { return {}; }, state); - std::ostringstream out; + Containers::String out; Error redirectError{&out}; CORRADE_VERIFY(!converter.linkFilesToData({ {Stage::Vertex, "another.dat"}, {Stage::Fragment, "file.dat"} })); - CORRADE_COMPARE(out.str(), "ShaderTools::AbstractConverter::linkFilesToData(): cannot open file file.dat\n"); + CORRADE_COMPARE(out, "ShaderTools::AbstractConverter::linkFilesToData(): cannot open file file.dat\n"); } void AbstractConverterTest::debugFeature() { - std::ostringstream out; + Containers::String out; Debug{&out} << ConverterFeature::ConvertData << ConverterFeature(0xf0); - CORRADE_COMPARE(out.str(), "ShaderTools::ConverterFeature::ConvertData ShaderTools::ConverterFeature(0xf0)\n"); + CORRADE_COMPARE(out, "ShaderTools::ConverterFeature::ConvertData ShaderTools::ConverterFeature(0xf0)\n"); } void AbstractConverterTest::debugFeaturePacked() { - std::ostringstream out; + Containers::String 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"); + CORRADE_COMPARE(out, "ConvertData 0xf0 ShaderTools::ConverterFeature::ValidateFile\n"); } void AbstractConverterTest::debugFeatures() { - std::ostringstream out; + Containers::String out; Debug{&out} << (ConverterFeature::ValidateData|ConverterFeature::ConvertFile) << ConverterFeatures{}; - CORRADE_COMPARE(out.str(), "ShaderTools::ConverterFeature::ValidateData|ShaderTools::ConverterFeature::ConvertFile ShaderTools::ConverterFeatures{}\n"); + CORRADE_COMPARE(out, "ShaderTools::ConverterFeature::ValidateData|ShaderTools::ConverterFeature::ConvertFile ShaderTools::ConverterFeatures{}\n"); } void AbstractConverterTest::debugFeaturesPacked() { - std::ostringstream out; + Containers::String 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"); + CORRADE_COMPARE(out, "ValidateData|ConvertFile {} ShaderTools::ConverterFeature::InputFileCallback\n"); } void AbstractConverterTest::debugFeaturesSupersets() { /* ValidateData is a superset of ValidateFile, so only one should be printed */ { - std::ostringstream out; + Containers::String out; Debug{&out} << (ConverterFeature::ValidateData|ConverterFeature::ValidateFile); - CORRADE_COMPARE(out.str(), "ShaderTools::ConverterFeature::ValidateData\n"); + CORRADE_COMPARE(out, "ShaderTools::ConverterFeature::ValidateData\n"); /* ConvertData is a superset of ConvertFile, so only one should be printed */ } { - std::ostringstream out; + Containers::String out; Debug{&out} << (ConverterFeature::ConvertData|ConverterFeature::ConvertFile); - CORRADE_COMPARE(out.str(), "ShaderTools::ConverterFeature::ConvertData\n"); + CORRADE_COMPARE(out, "ShaderTools::ConverterFeature::ConvertData\n"); /* LinkData is a superset of LinkFile, so only one should be printed */ } { - std::ostringstream out; + Containers::String out; Debug{&out} << (ConverterFeature::LinkData|ConverterFeature::LinkFile); - CORRADE_COMPARE(out.str(), "ShaderTools::ConverterFeature::LinkData\n"); + CORRADE_COMPARE(out, "ShaderTools::ConverterFeature::LinkData\n"); } } void AbstractConverterTest::debugFlag() { - std::ostringstream out; + Containers::String out; Debug{&out} << ConverterFlag::Verbose << ConverterFlag(0xf0); - CORRADE_COMPARE(out.str(), "ShaderTools::ConverterFlag::Verbose ShaderTools::ConverterFlag(0xf0)\n"); + CORRADE_COMPARE(out, "ShaderTools::ConverterFlag::Verbose ShaderTools::ConverterFlag(0xf0)\n"); } void AbstractConverterTest::debugFlags() { - std::ostringstream out; + Containers::String out; Debug{&out} << (ConverterFlag::Verbose|ConverterFlag(0xf0)) << ConverterFlags{}; - CORRADE_COMPARE(out.str(), "ShaderTools::ConverterFlag::Verbose|ShaderTools::ConverterFlag(0xf0) ShaderTools::ConverterFlags{}\n"); + CORRADE_COMPARE(out, "ShaderTools::ConverterFlag::Verbose|ShaderTools::ConverterFlag(0xf0) ShaderTools::ConverterFlags{}\n"); } void AbstractConverterTest::debugFormat() { - std::ostringstream out; + Containers::String out; Debug{&out} << Format::Glsl << Format(0xf0); - CORRADE_COMPARE(out.str(), "ShaderTools::Format::Glsl ShaderTools::Format(0xf0)\n"); + CORRADE_COMPARE(out, "ShaderTools::Format::Glsl ShaderTools::Format(0xf0)\n"); } }}}} diff --git a/src/Magnum/ShaderTools/Test/StageTest.cpp b/src/Magnum/ShaderTools/Test/StageTest.cpp index d86b50c02..1d608b085 100644 --- a/src/Magnum/ShaderTools/Test/StageTest.cpp +++ b/src/Magnum/ShaderTools/Test/StageTest.cpp @@ -24,9 +24,8 @@ DEALINGS IN THE SOFTWARE. */ -#include +#include #include -#include #include "Magnum/ShaderTools/Stage.h" @@ -43,10 +42,10 @@ StageTest::StageTest() { } void StageTest::debug() { - std::ostringstream out; + Containers::String out; Debug{&out} << Stage::RayMiss << Stage(0xf0); - CORRADE_COMPARE(out.str(), "ShaderTools::Stage::RayMiss ShaderTools::Stage(0xf0)\n"); + CORRADE_COMPARE(out, "ShaderTools::Stage::RayMiss ShaderTools::Stage(0xf0)\n"); } }}}} diff --git a/src/Magnum/Shaders/Test/DistanceFieldVectorGLTest.cpp b/src/Magnum/Shaders/Test/DistanceFieldVectorGLTest.cpp index 96f269640..a743ee179 100644 --- a/src/Magnum/Shaders/Test/DistanceFieldVectorGLTest.cpp +++ b/src/Magnum/Shaders/Test/DistanceFieldVectorGLTest.cpp @@ -25,14 +25,12 @@ DEALINGS IN THE SOFTWARE. */ -#include #include #include #include #include #include #include -#include #include #include #include @@ -66,7 +64,7 @@ #include "Magnum/Trade/MeshData.h" #ifndef MAGNUM_TARGET_GLES2 -#include +#include #include "Magnum/GL/Extensions.h" #include "Magnum/GL/MeshView.h" @@ -611,13 +609,13 @@ template void DistanceFieldVectorGLTest::constructUnifor CORRADE_SKIP(GL::Extensions::ARB::uniform_buffer_object::string() << "is not supported."); #endif - std::ostringstream out; + Containers::String out; Error redirectError{&out}; DistanceFieldVectorGL{typename DistanceFieldVectorGL::Configuration{} .setFlags(data.flags) .setMaterialCount(data.materialCount) .setDrawCount(data.drawCount)}; - CORRADE_COMPARE(out.str(), Utility::formatString( + CORRADE_COMPARE(out, Utility::format( "Shaders::DistanceFieldVectorGL: {}\n", data.message)); } #endif @@ -636,7 +634,7 @@ template void DistanceFieldVectorGLTest::setUniformUnifo DistanceFieldVectorGL shader{typename DistanceFieldVectorGL::Configuration{} .setFlags(DistanceFieldVectorGL::Flag::UniformBuffers)}; - std::ostringstream out; + Containers::String out; Error redirectError{&out}; shader.setTransformationProjectionMatrix({}) .setTextureMatrix({}) @@ -644,7 +642,7 @@ template void DistanceFieldVectorGLTest::setUniformUnifo .setOutlineColor({}) .setOutlineRange({}, {}) .setSmoothness({}); - CORRADE_COMPARE(out.str(), + CORRADE_COMPARE(out, "Shaders::DistanceFieldVectorGL::setTransformationProjectionMatrix(): the shader was created with uniform buffers enabled\n" "Shaders::DistanceFieldVectorGL::setTextureMatrix(): the shader was created with uniform buffers enabled\n" "Shaders::DistanceFieldVectorGL::setColor(): the shader was created with uniform buffers enabled\n" @@ -661,7 +659,7 @@ template void DistanceFieldVectorGLTest::bindBufferUnifo GL::Buffer buffer; DistanceFieldVectorGL shader; - std::ostringstream out; + Containers::String out; Error redirectError{&out}; shader.bindTransformationProjectionBuffer(buffer) .bindTransformationProjectionBuffer(buffer, 0, 16) @@ -672,7 +670,7 @@ template void DistanceFieldVectorGLTest::bindBufferUnifo .bindMaterialBuffer(buffer) .bindMaterialBuffer(buffer, 0, 16) .setDrawOffset(0); - CORRADE_COMPARE(out.str(), + CORRADE_COMPARE(out, "Shaders::DistanceFieldVectorGL::bindTransformationProjectionBuffer(): the shader was not created with uniform buffers enabled\n" "Shaders::DistanceFieldVectorGL::bindTransformationProjectionBuffer(): the shader was not created with uniform buffers enabled\n" "Shaders::DistanceFieldVectorGL::bindDrawBuffer(): the shader was not created with uniform buffers enabled\n" @@ -692,10 +690,10 @@ template void DistanceFieldVectorGLTest::setTextureMatri DistanceFieldVectorGL shader; - std::ostringstream out; + Containers::String out; Error redirectError{&out}; shader.setTextureMatrix({}); - CORRADE_COMPARE(out.str(), + CORRADE_COMPARE(out, "Shaders::DistanceFieldVectorGL::setTextureMatrix(): the shader was not created with texture transformation enabled\n"); } @@ -714,11 +712,11 @@ template void DistanceFieldVectorGLTest::bindTextureTran DistanceFieldVectorGL shader{typename DistanceFieldVectorGL::Configuration{} .setFlags(DistanceFieldVectorGL::Flag::UniformBuffers)}; - std::ostringstream out; + Containers::String out; Error redirectError{&out}; shader.bindTextureTransformationBuffer(buffer) .bindTextureTransformationBuffer(buffer, 0, 16); - CORRADE_COMPARE(out.str(), + CORRADE_COMPARE(out, "Shaders::DistanceFieldVectorGL::bindTextureTransformationBuffer(): the shader was not created with texture transformation enabled\n" "Shaders::DistanceFieldVectorGL::bindTextureTransformationBuffer(): the shader was not created with texture transformation enabled\n"); } @@ -740,10 +738,10 @@ template void DistanceFieldVectorGLTest::setWrongDrawOff .setMaterialCount(2) .setDrawCount(5)}; - std::ostringstream out; + Containers::String out; Error redirectError{&out}; shader.setDrawOffset(5); - CORRADE_COMPARE(out.str(), + CORRADE_COMPARE(out, "Shaders::DistanceFieldVectorGL::setDrawOffset(): draw offset 5 is out of range for 5 draws\n"); } #endif diff --git a/src/Magnum/Shaders/Test/DistanceFieldVectorGL_Test.cpp b/src/Magnum/Shaders/Test/DistanceFieldVectorGL_Test.cpp index 76a2106a0..0a981299d 100644 --- a/src/Magnum/Shaders/Test/DistanceFieldVectorGL_Test.cpp +++ b/src/Magnum/Shaders/Test/DistanceFieldVectorGL_Test.cpp @@ -24,10 +24,8 @@ DEALINGS IN THE SOFTWARE. */ -#include #include #include -#include #include #include "Magnum/Shaders/DistanceFieldVectorGL.h" @@ -85,17 +83,17 @@ template void DistanceFieldVectorGL_Test::constructCopy( } void DistanceFieldVectorGL_Test::debugFlag() { - std::ostringstream out; + Containers::String out; Debug{&out} << DistanceFieldVectorGL2D::Flag::TextureTransformation << DistanceFieldVectorGL2D::Flag(0xf0); - CORRADE_COMPARE(out.str(), "Shaders::DistanceFieldVectorGL::Flag::TextureTransformation Shaders::DistanceFieldVectorGL::Flag(0xf0)\n"); + CORRADE_COMPARE(out, "Shaders::DistanceFieldVectorGL::Flag::TextureTransformation Shaders::DistanceFieldVectorGL::Flag(0xf0)\n"); } void DistanceFieldVectorGL_Test::debugFlags() { - std::ostringstream out; + Containers::String out; Debug{&out} << DistanceFieldVectorGL3D::Flags{DistanceFieldVectorGL3D::Flag::TextureTransformation|DistanceFieldVectorGL3D::Flag(0xf0)} << DistanceFieldVectorGL3D::Flags{}; - CORRADE_COMPARE(out.str(), "Shaders::DistanceFieldVectorGL::Flag::TextureTransformation|Shaders::DistanceFieldVectorGL::Flag(0xf0) Shaders::DistanceFieldVectorGL::Flags{}\n"); + CORRADE_COMPARE(out, "Shaders::DistanceFieldVectorGL::Flag::TextureTransformation|Shaders::DistanceFieldVectorGL::Flag(0xf0) Shaders::DistanceFieldVectorGL::Flags{}\n"); } #ifndef MAGNUM_TARGET_GLES2 @@ -103,19 +101,19 @@ void DistanceFieldVectorGL_Test::debugFlagsSupersets() { /* MultiDraw and ShaderStorageBuffers are a superset of UniformBuffers so only one should be printed, but if there are both then both should be */ { - std::ostringstream out; + Containers::String out; Debug{&out} << (DistanceFieldVectorGL3D::Flag::MultiDraw|DistanceFieldVectorGL3D::Flag::UniformBuffers); - CORRADE_COMPARE(out.str(), "Shaders::DistanceFieldVectorGL::Flag::MultiDraw\n"); + CORRADE_COMPARE(out, "Shaders::DistanceFieldVectorGL::Flag::MultiDraw\n"); } #ifndef MAGNUM_TARGET_WEBGL { - std::ostringstream out; + Containers::String out; Debug{&out} << (DistanceFieldVectorGL2D::Flag::ShaderStorageBuffers|DistanceFieldVectorGL2D::Flag::UniformBuffers); - CORRADE_COMPARE(out.str(), "Shaders::DistanceFieldVectorGL::Flag::ShaderStorageBuffers\n"); + CORRADE_COMPARE(out, "Shaders::DistanceFieldVectorGL::Flag::ShaderStorageBuffers\n"); } { - std::ostringstream out; + Containers::String out; Debug{&out} << (DistanceFieldVectorGL3D::Flag::MultiDraw|DistanceFieldVectorGL3D::Flag::ShaderStorageBuffers|DistanceFieldVectorGL3D::Flag::UniformBuffers); - CORRADE_COMPARE(out.str(), "Shaders::DistanceFieldVectorGL::Flag::MultiDraw|Shaders::DistanceFieldVectorGL::Flag::ShaderStorageBuffers\n"); + CORRADE_COMPARE(out, "Shaders::DistanceFieldVectorGL::Flag::MultiDraw|Shaders::DistanceFieldVectorGL::Flag::ShaderStorageBuffers\n"); } #endif } diff --git a/src/Magnum/Shaders/Test/FlatGLTest.cpp b/src/Magnum/Shaders/Test/FlatGLTest.cpp index dd812e3c1..3806237f1 100644 --- a/src/Magnum/Shaders/Test/FlatGLTest.cpp +++ b/src/Magnum/Shaders/Test/FlatGLTest.cpp @@ -25,7 +25,6 @@ DEALINGS IN THE SOFTWARE. */ -#include #include #include #include @@ -33,8 +32,7 @@ #include #include #include -#include -#include +#include #include #include @@ -1451,7 +1449,7 @@ template void FlatGLTest::constructInvalid() { CORRADE_SKIP_IF_NO_ASSERT(); - std::ostringstream out; + Containers::String out; Error redirectError{&out}; FlatGL{typename FlatGL::Configuration{} .setFlags(data.flags) @@ -1459,7 +1457,7 @@ template void FlatGLTest::constructInvalid() { .setJointCount(data.jointCount, data.perVertexJointCount, data.secondaryPerVertexJointCount) #endif }; - CORRADE_COMPARE(out.str(), Utility::formatString( + CORRADE_COMPARE(out, Utility::format( "Shaders::FlatGL: {}\n", data.message)); } @@ -1476,14 +1474,14 @@ template void FlatGLTest::constructUniformBuffersInvalid CORRADE_SKIP(GL::Extensions::ARB::uniform_buffer_object::string() << "is not supported."); #endif - std::ostringstream out; + Containers::String out; Error redirectError{&out}; FlatGL{typename FlatGL::Configuration{} .setFlags(data.flags) .setJointCount(data.jointCount, data.perVertexJointCount, data.secondaryPerVertexJointCount) .setMaterialCount(data.materialCount) .setDrawCount(data.drawCount)}; - CORRADE_COMPARE(out.str(), Utility::formatString( + CORRADE_COMPARE(out, Utility::format( "Shaders::FlatGL: {}\n", data.message)); } #endif @@ -1504,12 +1502,12 @@ template void FlatGLTest::setPerVertexJointCountInvalid( .setFlags(FlatGL::Flag::DynamicPerVertexJointCount) .setJointCount(16, 3, 2)}; - std::ostringstream out; + Containers::String out; Error redirectError{&out}; a.setPerVertexJointCount(3, 2); b.setPerVertexJointCount(4); b.setPerVertexJointCount(3, 3); - CORRADE_COMPARE(out.str(), + CORRADE_COMPARE(out, "Shaders::FlatGL::setPerVertexJointCount(): the shader was not created with dynamic per-vertex joint count enabled\n" "Shaders::FlatGL::setPerVertexJointCount(): expected at most 3 per-vertex joints, got 4\n" "Shaders::FlatGL::setPerVertexJointCount(): expected at most 2 secondary per-vertex joints, got 3\n"); @@ -1530,7 +1528,7 @@ template void FlatGLTest::setUniformUniformBuffersEnable FlatGL shader{typename FlatGL::Configuration{} .setFlags(FlatGL::Flag::UniformBuffers)}; - std::ostringstream out; + Containers::String out; Error redirectError{&out}; shader /* setPerVertexJointCount() works on both UBOs and classic */ @@ -1543,7 +1541,7 @@ template void FlatGLTest::setUniformUniformBuffersEnable .setJointMatrices({}) .setJointMatrix(0, {}) .setPerInstanceJointCount(0); - CORRADE_COMPARE(out.str(), + CORRADE_COMPARE(out, "Shaders::FlatGL::setTransformationProjectionMatrix(): the shader was created with uniform buffers enabled\n" "Shaders::FlatGL::setTextureMatrix(): the shader was created with uniform buffers enabled\n" "Shaders::FlatGL::setTextureLayer(): the shader was created with uniform buffers enabled\n" @@ -1563,7 +1561,7 @@ template void FlatGLTest::bindBufferUniformBuffersNotEna GL::Buffer buffer; FlatGL shader; - std::ostringstream out; + Containers::String out; Error redirectError{&out}; shader.bindTransformationProjectionBuffer(buffer) .bindTransformationProjectionBuffer(buffer, 0, 16) @@ -1576,7 +1574,7 @@ template void FlatGLTest::bindBufferUniformBuffersNotEna .bindJointBuffer(buffer) .bindJointBuffer(buffer, 0, 16) .setDrawOffset(0); - CORRADE_COMPARE(out.str(), + CORRADE_COMPARE(out, "Shaders::FlatGL::bindTransformationProjectionBuffer(): the shader was not created with uniform buffers enabled\n" "Shaders::FlatGL::bindTransformationProjectionBuffer(): the shader was not created with uniform buffers enabled\n" "Shaders::FlatGL::bindDrawBuffer(): the shader was not created with uniform buffers enabled\n" @@ -1607,13 +1605,13 @@ template void FlatGLTest::bindTexturesInvalid() { FlatGL shader{typename FlatGL::Configuration{} .setFlags(data.flags)}; - std::ostringstream out; + Containers::String out; Error redirectError{&out}; shader.bindTexture(texture); #ifndef MAGNUM_TARGET_GLES2 shader.bindObjectIdTexture(texture); #endif - CORRADE_COMPARE(out.str(), data.message); + CORRADE_COMPARE(out, data.message); } #ifndef MAGNUM_TARGET_GLES2 @@ -1633,11 +1631,11 @@ template void FlatGLTest::bindTextureArraysInvalid() { FlatGL shader{typename FlatGL::Configuration{} .setFlags(data.flags)}; - std::ostringstream out; + Containers::String out; Error redirectError{&out}; shader.bindTexture(textureArray); shader.bindObjectIdTexture(textureArray); - CORRADE_COMPARE(out.str(), data.message); + CORRADE_COMPARE(out, data.message); } #endif @@ -1648,10 +1646,10 @@ template void FlatGLTest::setAlphaMaskNotEnabled() { FlatGL shader; - std::ostringstream out; + Containers::String out; Error redirectError{&out}; shader.setAlphaMask(0.75f); - CORRADE_COMPARE(out.str(), + CORRADE_COMPARE(out, "Shaders::FlatGL::setAlphaMask(): the shader was not created with alpha mask enabled\n"); } @@ -1662,10 +1660,10 @@ template void FlatGLTest::setTextureMatrixNotEnabled() { FlatGL shader; - std::ostringstream out; + Containers::String out; Error redirectError{&out}; shader.setTextureMatrix({}); - CORRADE_COMPARE(out.str(), + CORRADE_COMPARE(out, "Shaders::FlatGL::setTextureMatrix(): the shader was not created with texture transformation enabled\n"); } @@ -1677,10 +1675,10 @@ template void FlatGLTest::setTextureLayerNotArray() { FlatGL shader; - std::ostringstream out; + Containers::String out; Error redirectError{&out}; shader.setTextureLayer(37); - CORRADE_COMPARE(out.str(), + CORRADE_COMPARE(out, "Shaders::FlatGL::setTextureLayer(): the shader was not created with texture arrays enabled\n"); } #endif @@ -1700,11 +1698,11 @@ template void FlatGLTest::bindTextureTransformBufferNotE FlatGL shader{typename FlatGL::Configuration{} .setFlags(FlatGL::Flag::UniformBuffers)}; - std::ostringstream out; + Containers::String out; Error redirectError{&out}; shader.bindTextureTransformationBuffer(buffer) .bindTextureTransformationBuffer(buffer, 0, 16); - CORRADE_COMPARE(out.str(), + CORRADE_COMPARE(out, "Shaders::FlatGL::bindTextureTransformationBuffer(): the shader was not created with texture transformation enabled\n" "Shaders::FlatGL::bindTextureTransformationBuffer(): the shader was not created with texture transformation enabled\n"); } @@ -1718,10 +1716,10 @@ template void FlatGLTest::setObjectIdNotEnabled() { FlatGL shader; - std::ostringstream out; + Containers::String out; Error redirectError{&out}; shader.setObjectId(33376); - CORRADE_COMPARE(out.str(), + CORRADE_COMPARE(out, "Shaders::FlatGL::setObjectId(): the shader was not created with object ID enabled\n"); } #endif @@ -1740,13 +1738,13 @@ template void FlatGLTest::setWrongJointCountOrId() { FlatGL shader{typename FlatGL::Configuration{} .setJointCount(5, 1)}; - std::ostringstream out; + Containers::String out; Error redirectError{&out}; /* Calling setJointMatrices() with less items is fine, tested in renderSkinning*D() */ shader.setJointMatrices({{}, {}, {}, {}, {}, {}}) .setJointMatrix(5, MatrixTypeFor{}); - CORRADE_COMPARE(out.str(), + CORRADE_COMPARE(out, "Shaders::FlatGL::setJointMatrices(): expected at most 5 items but got 6\n" "Shaders::FlatGL::setJointMatrix(): joint ID 5 is out of range for 5 joints\n"); } @@ -1768,10 +1766,10 @@ template void FlatGLTest::setWrongDrawOffset() { .setMaterialCount(2) .setDrawCount(5)}; - std::ostringstream out; + Containers::String out; Error redirectError{&out}; shader.setDrawOffset(5); - CORRADE_COMPARE(out.str(), + CORRADE_COMPARE(out, "Shaders::FlatGL::setDrawOffset(): draw offset 5 is out of range for 5 draws\n"); } #endif diff --git a/src/Magnum/Shaders/Test/FlatGL_Test.cpp b/src/Magnum/Shaders/Test/FlatGL_Test.cpp index cd67fbac3..76ebf20e4 100644 --- a/src/Magnum/Shaders/Test/FlatGL_Test.cpp +++ b/src/Magnum/Shaders/Test/FlatGL_Test.cpp @@ -24,11 +24,10 @@ DEALINGS IN THE SOFTWARE. */ -#include +#include /* arraySize() */ #include #include -#include -#include +#include #include "Magnum/Shaders/FlatGL.h" @@ -101,10 +100,10 @@ template void FlatGL_Test::configurationSetJointCountInv typename FlatGL::Configuration configuration; - std::ostringstream out; + Containers::String out; Error redirectError{&out}; configuration.setJointCount(data.jointCount, data.perVertexJointCount, data.secondaryPerVertexJointCount); - CORRADE_COMPARE(out.str(), Utility::formatString("Shaders::FlatGL::Configuration::setJointCount(): {}\n", data.message)); + CORRADE_COMPARE(out, Utility::format("Shaders::FlatGL::Configuration::setJointCount(): {}\n", data.message)); } #endif @@ -128,17 +127,17 @@ template void FlatGL_Test::constructCopy() { } void FlatGL_Test::debugFlag() { - std::ostringstream out; + Containers::String out; Debug{&out} << FlatGL3D::Flag::Textured << FlatGL3D::Flag(0xf00d); - CORRADE_COMPARE(out.str(), "Shaders::FlatGL::Flag::Textured Shaders::FlatGL::Flag(0xf00d)\n"); + CORRADE_COMPARE(out, "Shaders::FlatGL::Flag::Textured Shaders::FlatGL::Flag(0xf00d)\n"); } void FlatGL_Test::debugFlags() { - std::ostringstream out; + Containers::String out; Debug{&out} << (FlatGL3D::Flag::Textured|FlatGL3D::Flag::AlphaMask) << FlatGL3D::Flags{}; - CORRADE_COMPARE(out.str(), "Shaders::FlatGL::Flag::Textured|Shaders::FlatGL::Flag::AlphaMask Shaders::FlatGL::Flags{}\n"); + CORRADE_COMPARE(out, "Shaders::FlatGL::Flag::Textured|Shaders::FlatGL::Flag::AlphaMask Shaders::FlatGL::Flags{}\n"); } void FlatGL_Test::debugFlagsSupersets() { @@ -146,45 +145,45 @@ void FlatGL_Test::debugFlagsSupersets() { /* InstancedObjectId and ObjectIdTexture are a superset of ObjectId so only one should be printed, but if there are both then both should be */ { - std::ostringstream out; + Containers::String out; Debug{&out} << (FlatGL3D::Flag::ObjectId|FlatGL3D::Flag::InstancedObjectId); - CORRADE_COMPARE(out.str(), "Shaders::FlatGL::Flag::InstancedObjectId\n"); + CORRADE_COMPARE(out, "Shaders::FlatGL::Flag::InstancedObjectId\n"); } { - std::ostringstream out; + Containers::String out; Debug{&out} << (FlatGL3D::Flag::ObjectId|FlatGL3D::Flag::ObjectIdTexture); - CORRADE_COMPARE(out.str(), "Shaders::FlatGL::Flag::ObjectIdTexture\n"); + CORRADE_COMPARE(out, "Shaders::FlatGL::Flag::ObjectIdTexture\n"); } { - std::ostringstream out; + Containers::String out; Debug{&out} << (FlatGL3D::Flag::ObjectId|FlatGL3D::Flag::InstancedObjectId|FlatGL3D::Flag::ObjectIdTexture); - CORRADE_COMPARE(out.str(), "Shaders::FlatGL::Flag::InstancedObjectId|Shaders::FlatGL::Flag::ObjectIdTexture\n"); + CORRADE_COMPARE(out, "Shaders::FlatGL::Flag::InstancedObjectId|Shaders::FlatGL::Flag::ObjectIdTexture\n"); } #endif /* InstancedTextureOffset is a superset of TextureTransformation so only one should be printed */ { - std::ostringstream out; + Containers::String out; Debug{&out} << (FlatGL3D::Flag::InstancedTextureOffset|FlatGL3D::Flag::TextureTransformation); - CORRADE_COMPARE(out.str(), "Shaders::FlatGL::Flag::InstancedTextureOffset\n"); + CORRADE_COMPARE(out, "Shaders::FlatGL::Flag::InstancedTextureOffset\n"); } #ifndef MAGNUM_TARGET_GLES2 /* MultiDraw and ShaderStorageBuffers are a superset of UniformBuffers so only one should be printed, but if there are both then both should be */ { - std::ostringstream out; + Containers::String out; Debug{&out} << (FlatGL3D::Flag::MultiDraw|FlatGL3D::Flag::UniformBuffers); - CORRADE_COMPARE(out.str(), "Shaders::FlatGL::Flag::MultiDraw\n"); + CORRADE_COMPARE(out, "Shaders::FlatGL::Flag::MultiDraw\n"); } #ifndef MAGNUM_TARGET_WEBGL { - std::ostringstream out; + Containers::String out; Debug{&out} << (FlatGL2D::Flag::ShaderStorageBuffers|FlatGL2D::Flag::UniformBuffers); - CORRADE_COMPARE(out.str(), "Shaders::FlatGL::Flag::ShaderStorageBuffers\n"); + CORRADE_COMPARE(out, "Shaders::FlatGL::Flag::ShaderStorageBuffers\n"); } { - std::ostringstream out; + Containers::String out; Debug{&out} << (FlatGL3D::Flag::MultiDraw|FlatGL3D::Flag::ShaderStorageBuffers|FlatGL3D::Flag::UniformBuffers); - CORRADE_COMPARE(out.str(), "Shaders::FlatGL::Flag::MultiDraw|Shaders::FlatGL::Flag::ShaderStorageBuffers\n"); + CORRADE_COMPARE(out, "Shaders::FlatGL::Flag::MultiDraw|Shaders::FlatGL::Flag::ShaderStorageBuffers\n"); } #endif #endif diff --git a/src/Magnum/Shaders/Test/LineGLTest.cpp b/src/Magnum/Shaders/Test/LineGLTest.cpp index 997b702a6..500bb4ff3 100644 --- a/src/Magnum/Shaders/Test/LineGLTest.cpp +++ b/src/Magnum/Shaders/Test/LineGLTest.cpp @@ -24,15 +24,13 @@ DEALINGS IN THE SOFTWARE. */ -#include #include #include #include #include #include #include -#include -#include +#include #include #include @@ -798,13 +796,13 @@ template void LineGLTest::constructUniformBuffersInvalid CORRADE_SKIP(GL::Extensions::ARB::uniform_buffer_object::string() << "is not supported."); #endif - std::ostringstream out; + Containers::String out; Error redirectError{&out}; LineGL{typename LineGL::Configuration{} .setFlags(data.flags) .setMaterialCount(data.materialCount) .setDrawCount(data.drawCount)}; - CORRADE_COMPARE(out.str(), Utility::formatString( + CORRADE_COMPARE(out, Utility::format( "Shaders::LineGL: {}\n", data.message)); } @@ -826,7 +824,7 @@ template void LineGLTest::setUniformUniformBuffersEnable /* This should work fine */ shader.setViewportSize({}); - std::ostringstream out; + Containers::String out; Error redirectError{&out}; shader.setTransformationProjectionMatrix({}) .setBackgroundColor({}) @@ -836,7 +834,7 @@ template void LineGLTest::setUniformUniformBuffersEnable .setMiterLengthLimit({}) .setMiterAngleLimit({}) .setObjectId({}); - CORRADE_COMPARE(out.str(), + CORRADE_COMPARE(out, "Shaders::LineGL::setTransformationProjectionMatrix(): the shader was created with uniform buffers enabled\n" "Shaders::LineGL::setBackgroundColor(): the shader was created with uniform buffers enabled\n" "Shaders::LineGL::setColor(): the shader was created with uniform buffers enabled\n" @@ -860,7 +858,7 @@ template void LineGLTest::bindBufferUniformBuffersNotEna GL::Buffer buffer; LineGL shader; - std::ostringstream out; + Containers::String out; Error redirectError{&out}; shader.bindTransformationProjectionBuffer(buffer) .bindTransformationProjectionBuffer(buffer, 0, 16) @@ -869,7 +867,7 @@ template void LineGLTest::bindBufferUniformBuffersNotEna .bindMaterialBuffer(buffer) .bindMaterialBuffer(buffer, 0, 16) .setDrawOffset(0); - CORRADE_COMPARE(out.str(), + CORRADE_COMPARE(out, "Shaders::LineGL::bindTransformationProjectionBuffer(): the shader was not created with uniform buffers enabled\n" "Shaders::LineGL::bindTransformationProjectionBuffer(): the shader was not created with uniform buffers enabled\n" "Shaders::LineGL::bindDrawBuffer(): the shader was not created with uniform buffers enabled\n" @@ -896,10 +894,10 @@ template void LineGLTest::setMiterLengthLimitInvalid() { .setJoinStyle(data.joinStyle) }; - std::ostringstream out; + Containers::String out; Error redirectError{&out}; shader.setMiterLengthLimit(data.limit); - CORRADE_COMPARE(out.str(), Utility::formatString( + CORRADE_COMPARE(out, Utility::format( "Shaders::LineGL::setMiterLengthLimit(): {}\n", data.message)); } @@ -920,10 +918,10 @@ template void LineGLTest::setMiterAngleLimitInvalid() { .setJoinStyle(data.joinStyle) }; - std::ostringstream out; + Containers::String out; Error redirectError{&out}; shader.setMiterAngleLimit(data.limit); - CORRADE_COMPARE(out.str(), Utility::formatString( + CORRADE_COMPARE(out, Utility::format( "Shaders::LineGL::setMiterAngleLimit(): {}\n", data.message)); } @@ -939,10 +937,10 @@ template void LineGLTest::setObjectIdNotEnabled() { LineGL shader; - std::ostringstream out; + Containers::String out; Error redirectError{&out}; shader.setObjectId(33376); - CORRADE_COMPARE(out.str(), + CORRADE_COMPARE(out, "Shaders::LineGL::setObjectId(): the shader was not created with object ID enabled\n"); } @@ -963,10 +961,10 @@ template void LineGLTest::setWrongDrawOffset() { .setMaterialCount(2) .setDrawCount(5)}; - std::ostringstream out; + Containers::String out; Error redirectError{&out}; shader.setDrawOffset(5); - CORRADE_COMPARE(out.str(), + CORRADE_COMPARE(out, "Shaders::LineGL::setDrawOffset(): draw offset 5 is out of range for 5 draws\n"); } diff --git a/src/Magnum/Shaders/Test/LineGL_Test.cpp b/src/Magnum/Shaders/Test/LineGL_Test.cpp index 3b55c5ec3..cab746a2f 100644 --- a/src/Magnum/Shaders/Test/LineGL_Test.cpp +++ b/src/Magnum/Shaders/Test/LineGL_Test.cpp @@ -24,10 +24,8 @@ DEALINGS IN THE SOFTWARE. */ -#include #include #include -#include #include #include "Magnum/Shaders/LineGL.h" @@ -126,42 +124,42 @@ template void LineGL_Test::constructCopy() { } void LineGL_Test::debugFlag() { - std::ostringstream out; + Containers::String out; Debug{&out} << LineGL3D::Flag::VertexColor << LineGL3D::Flag(0xf00d); - CORRADE_COMPARE(out.str(), "Shaders::LineGL::Flag::VertexColor Shaders::LineGL::Flag(0xf00d)\n"); + CORRADE_COMPARE(out, "Shaders::LineGL::Flag::VertexColor Shaders::LineGL::Flag(0xf00d)\n"); } void LineGL_Test::debugFlags() { - std::ostringstream out; + Containers::String out; Debug{&out} << (LineGL3D::Flag::VertexColor|LineGL3D::Flag::InstancedTransformation) << LineGL3D::Flags{}; - CORRADE_COMPARE(out.str(), "Shaders::LineGL::Flag::VertexColor|Shaders::LineGL::Flag::InstancedTransformation Shaders::LineGL::Flags{}\n"); + CORRADE_COMPARE(out, "Shaders::LineGL::Flag::VertexColor|Shaders::LineGL::Flag::InstancedTransformation Shaders::LineGL::Flags{}\n"); } void LineGL_Test::debugFlagsSupersets() { /* InstancedObjectId is a superset of ObjectId so only one should be printed */ { - std::ostringstream out; + Containers::String out; Debug{&out} << (LineGL3D::Flag::ObjectId|LineGL3D::Flag::InstancedObjectId); - CORRADE_COMPARE(out.str(), "Shaders::LineGL::Flag::InstancedObjectId\n"); + CORRADE_COMPARE(out, "Shaders::LineGL::Flag::InstancedObjectId\n"); } /* MultiDraw and ShaderStorageBuffers are a superset of UniformBuffers so only one should be printed, but if there are both then both should be */ { - std::ostringstream out; + Containers::String out; Debug{&out} << (LineGL3D::Flag::MultiDraw|LineGL3D::Flag::UniformBuffers); - CORRADE_COMPARE(out.str(), "Shaders::LineGL::Flag::MultiDraw\n"); + CORRADE_COMPARE(out, "Shaders::LineGL::Flag::MultiDraw\n"); } #ifndef MAGNUM_TARGET_WEBGL { - std::ostringstream out; + Containers::String out; Debug{&out} << (LineGL2D::Flag::ShaderStorageBuffers|LineGL2D::Flag::UniformBuffers); - CORRADE_COMPARE(out.str(), "Shaders::LineGL::Flag::ShaderStorageBuffers\n"); + CORRADE_COMPARE(out, "Shaders::LineGL::Flag::ShaderStorageBuffers\n"); } { - std::ostringstream out; + Containers::String out; Debug{&out} << (LineGL2D::Flag::MultiDraw|LineGL2D::Flag::ShaderStorageBuffers|LineGL2D::Flag::UniformBuffers); - CORRADE_COMPARE(out.str(), "Shaders::LineGL::Flag::MultiDraw|Shaders::LineGL::Flag::ShaderStorageBuffers\n"); + CORRADE_COMPARE(out, "Shaders::LineGL::Flag::MultiDraw|Shaders::LineGL::Flag::ShaderStorageBuffers\n"); } #endif } diff --git a/src/Magnum/Shaders/Test/LineTest.cpp b/src/Magnum/Shaders/Test/LineTest.cpp index 486de7d6d..13dedbf13 100644 --- a/src/Magnum/Shaders/Test/LineTest.cpp +++ b/src/Magnum/Shaders/Test/LineTest.cpp @@ -25,10 +25,10 @@ */ #include -#include +#include /* arraySize() */ +#include #include -#include -#include +#include #include "Magnum/Shaders/Line.h" #include "Magnum/Shaders/Implementation/lineMiterLimit.h" @@ -278,10 +278,10 @@ void LineTest::materialUniformSetMiterLengthLimitInvalid() { LineMaterialUniform a; - std::ostringstream out; + Containers::String out; Error redirectError{&out}; a.setMiterLengthLimit(data.limit); - CORRADE_COMPARE(out.str(), Utility::formatString("Shaders::LineMaterialUniform::setMiterLengthLimit(): {}\n", data.message)); + CORRADE_COMPARE(out, Utility::format("Shaders::LineMaterialUniform::setMiterLengthLimit(): {}\n", data.message)); } void LineTest::materialUniformSetMiterAngleLimitInvalid() { @@ -292,22 +292,22 @@ void LineTest::materialUniformSetMiterAngleLimitInvalid() { LineMaterialUniform a; - std::ostringstream out; + Containers::String out; Error redirectError{&out}; a.setMiterAngleLimit(data.limit); - CORRADE_COMPARE(out.str(), Utility::formatString("Shaders::LineMaterialUniform::setMiterAngleLimit(): {}\n", data.message)); + CORRADE_COMPARE(out, Utility::format("Shaders::LineMaterialUniform::setMiterAngleLimit(): {}\n", data.message)); } void LineTest::debugCapStyle() { - std::ostringstream out; + Containers::String out; Debug{&out} << LineCapStyle::Square << LineCapStyle(0xb0); - CORRADE_COMPARE(out.str(), "Shaders::LineCapStyle::Square Shaders::LineCapStyle(0xb0)\n"); + CORRADE_COMPARE(out, "Shaders::LineCapStyle::Square Shaders::LineCapStyle(0xb0)\n"); } void LineTest::debugJoinStyle() { - std::ostringstream out; + Containers::String out; Debug{&out} << LineJoinStyle::Bevel << LineJoinStyle(0xb0); - CORRADE_COMPARE(out.str(), "Shaders::LineJoinStyle::Bevel Shaders::LineJoinStyle(0xb0)\n"); + CORRADE_COMPARE(out, "Shaders::LineJoinStyle::Bevel Shaders::LineJoinStyle(0xb0)\n"); } void LineTest::debugVertexAnnotation() { @@ -315,29 +315,29 @@ void LineTest::debugVertexAnnotation() { 32bit to avoid surprises when passing it to the default-constructed LineGL::Annotation attribute (which defaults to 32bit), so it should also print the whole 32bit value. */ - std::ostringstream out; + Containers::String out; Debug{&out} << LineVertexAnnotation::Join << LineVertexAnnotation(0xcafecafe); - CORRADE_COMPARE(out.str(), "Shaders::LineVertexAnnotation::Join Shaders::LineVertexAnnotation(0xcafecafe)\n"); + CORRADE_COMPARE(out, "Shaders::LineVertexAnnotation::Join Shaders::LineVertexAnnotation(0xcafecafe)\n"); } void LineTest::debugVertexAnnotationPacked() { - std::ostringstream out; + Containers::String out; /* Last is not packed, ones before should not make any flags persistent */ Debug{&out} << Debug::packed << LineVertexAnnotation::Join << Debug::packed << LineVertexAnnotation(0xcafecafe) << LineVertexAnnotation::Begin; - CORRADE_COMPARE(out.str(), "Join 0xcafecafe Shaders::LineVertexAnnotation::Begin\n"); + CORRADE_COMPARE(out, "Join 0xcafecafe Shaders::LineVertexAnnotation::Begin\n"); } void LineTest::debugVertexAnnotations() { - std::ostringstream out; + Containers::String out; Debug{&out} << (LineVertexAnnotation::Up|LineVertexAnnotation::Join|LineVertexAnnotation(0xb00)) << LineVertexAnnotations{}; - CORRADE_COMPARE(out.str(), "Shaders::LineVertexAnnotation::Up|Shaders::LineVertexAnnotation::Join|Shaders::LineVertexAnnotation(0xb00) Shaders::LineVertexAnnotations{}\n"); + CORRADE_COMPARE(out, "Shaders::LineVertexAnnotation::Up|Shaders::LineVertexAnnotation::Join|Shaders::LineVertexAnnotation(0xb00) Shaders::LineVertexAnnotations{}\n"); } void LineTest::debugVertexAnnotationsPacked() { - std::ostringstream out; + Containers::String out; /* Last is not packed, ones before should not make any flags persistent */ Debug{&out} << Debug::packed << (LineVertexAnnotation::Up|LineVertexAnnotation::Join|LineVertexAnnotation(0xb00)) << Debug::packed << LineVertexAnnotations{} << LineVertexAnnotation::Begin; - CORRADE_COMPARE(out.str(), "Up|Join|0xb00 {} Shaders::LineVertexAnnotation::Begin\n"); + CORRADE_COMPARE(out, "Up|Join|0xb00 {} Shaders::LineVertexAnnotation::Begin\n"); } }}}} diff --git a/src/Magnum/Shaders/Test/MeshVisualizerGLTest.cpp b/src/Magnum/Shaders/Test/MeshVisualizerGLTest.cpp index 9fc7b8d39..27bbe38ca 100644 --- a/src/Magnum/Shaders/Test/MeshVisualizerGLTest.cpp +++ b/src/Magnum/Shaders/Test/MeshVisualizerGLTest.cpp @@ -26,7 +26,6 @@ */ #include /* std::iota() */ -#include #include #include #include @@ -34,8 +33,7 @@ #include #include #include -#include -#include +#include #include #include @@ -2431,7 +2429,7 @@ void MeshVisualizerGLTest::constructInvalid2D() { CORRADE_SKIP_IF_NO_ASSERT(); - std::ostringstream out; + Containers::String out; Error redirectError{&out}; MeshVisualizerGL2D{MeshVisualizerGL2D::Configuration{} .setFlags(data.flags) @@ -2439,7 +2437,7 @@ void MeshVisualizerGLTest::constructInvalid2D() { .setJointCount(data.jointCount, data.perVertexJointCount, data.secondaryPerVertexJointCount) #endif }; - CORRADE_COMPARE(out.str(), Utility::formatString("Shaders::MeshVisualizerGL{}\n", data.message)); + CORRADE_COMPARE(out, Utility::format("Shaders::MeshVisualizerGL{}\n", data.message)); } void MeshVisualizerGLTest::constructInvalid3D() { @@ -2448,7 +2446,7 @@ void MeshVisualizerGLTest::constructInvalid3D() { CORRADE_SKIP_IF_NO_ASSERT(); - std::ostringstream out; + Containers::String out; Error redirectError{&out}; MeshVisualizerGL3D{MeshVisualizerGL3D::Configuration{} .setFlags(data.flags) @@ -2456,7 +2454,7 @@ void MeshVisualizerGLTest::constructInvalid3D() { .setJointCount(data.jointCount, data.perVertexJointCount, data.secondaryPerVertexJointCount) #endif }; - CORRADE_COMPARE(out.str(), Utility::formatString("Shaders::MeshVisualizerGL{}\n", data.message)); + CORRADE_COMPARE(out, Utility::format("Shaders::MeshVisualizerGL{}\n", data.message)); } #ifndef MAGNUM_TARGET_GLES2 @@ -2471,14 +2469,14 @@ void MeshVisualizerGLTest::constructUniformBuffersInvalid2D() { CORRADE_SKIP(GL::Extensions::ARB::uniform_buffer_object::string() << "is not supported."); #endif - std::ostringstream out; + Containers::String out; Error redirectError{&out}; MeshVisualizerGL2D{MeshVisualizerGL2D::Configuration{} .setFlags(data.flags) .setJointCount(data.jointCount, data.perVertexJointCount, data.secondaryPerVertexJointCount) .setMaterialCount(data.materialCount) .setDrawCount(data.drawCount)}; - CORRADE_COMPARE(out.str(), Utility::formatString("Shaders::MeshVisualizerGL2D: {}\n", data.message)); + CORRADE_COMPARE(out, Utility::format("Shaders::MeshVisualizerGL2D: {}\n", data.message)); } void MeshVisualizerGLTest::constructUniformBuffersInvalid3D() { @@ -2492,14 +2490,14 @@ void MeshVisualizerGLTest::constructUniformBuffersInvalid3D() { CORRADE_SKIP(GL::Extensions::ARB::uniform_buffer_object::string() << "is not supported."); #endif - std::ostringstream out; + Containers::String out; Error redirectError{&out}; MeshVisualizerGL3D{MeshVisualizerGL3D::Configuration{} .setFlags(data.flags) .setJointCount(data.jointCount, data.perVertexJointCount, data.secondaryPerVertexJointCount) .setMaterialCount(data.materialCount) .setDrawCount(data.drawCount)}; - CORRADE_COMPARE(out.str(), Utility::formatString("Shaders::MeshVisualizerGL3D: {}\n", data.message)); + CORRADE_COMPARE(out, Utility::format("Shaders::MeshVisualizerGL3D: {}\n", data.message)); } #endif @@ -2520,12 +2518,12 @@ void MeshVisualizerGLTest::setPerVertexJointCountInvalid2D() { .setFlags(MeshVisualizerGL2D::Flag::DynamicPerVertexJointCount|MeshVisualizerGL2D::Flag::Wireframe|MeshVisualizerGL2D::Flag::NoGeometryShader) .setJointCount(16, 3, 2)}; - std::ostringstream out; + Containers::String out; Error redirectError{&out}; a.setPerVertexJointCount(3, 2); b.setPerVertexJointCount(4); b.setPerVertexJointCount(3, 3); - CORRADE_COMPARE(out.str(), + CORRADE_COMPARE(out, "Shaders::MeshVisualizerGL::setPerVertexJointCount(): the shader was not created with dynamic per-vertex joint count enabled\n" "Shaders::MeshVisualizerGL::setPerVertexJointCount(): expected at most 3 per-vertex joints, got 4\n" "Shaders::MeshVisualizerGL::setPerVertexJointCount(): expected at most 2 secondary per-vertex joints, got 3\n"); @@ -2547,12 +2545,12 @@ void MeshVisualizerGLTest::setPerVertexJointCountInvalid3D() { .setFlags(MeshVisualizerGL3D::Flag::DynamicPerVertexJointCount|MeshVisualizerGL3D::Flag::Wireframe|MeshVisualizerGL3D::Flag::NoGeometryShader) .setJointCount(16, 3, 2)}; - std::ostringstream out; + Containers::String out; Error redirectError{&out}; a.setPerVertexJointCount(3, 2); b.setPerVertexJointCount(4); b.setPerVertexJointCount(3, 3); - CORRADE_COMPARE(out.str(), + CORRADE_COMPARE(out, "Shaders::MeshVisualizerGL::setPerVertexJointCount(): the shader was not created with dynamic per-vertex joint count enabled\n" "Shaders::MeshVisualizerGL::setPerVertexJointCount(): expected at most 3 per-vertex joints, got 4\n" "Shaders::MeshVisualizerGL::setPerVertexJointCount(): expected at most 2 secondary per-vertex joints, got 3\n"); @@ -2574,7 +2572,7 @@ void MeshVisualizerGLTest::setUniformUniformBuffersEnabled2D() { /* This should work fine */ shader.setViewportSize({}); - std::ostringstream out; + Containers::String out; Error redirectError{&out}; shader /* setPerVertexJointCount() works on both UBOs and classic */ @@ -2590,7 +2588,7 @@ void MeshVisualizerGLTest::setUniformUniformBuffersEnabled2D() { .setJointMatrices({}) .setJointMatrix(0, {}) .setPerInstanceJointCount(0); - CORRADE_COMPARE(out.str(), + CORRADE_COMPARE(out, "Shaders::MeshVisualizerGL2D::setTransformationProjectionMatrix(): the shader was created with uniform buffers enabled\n" "Shaders::MeshVisualizerGL::setTextureMatrix(): the shader was created with uniform buffers enabled\n" "Shaders::MeshVisualizerGL::setTextureLayer(): the shader was created with uniform buffers enabled\n" @@ -2619,7 +2617,7 @@ void MeshVisualizerGLTest::setUniformUniformBuffersEnabled3D() { /* This should work fine */ shader.setViewportSize({}); - std::ostringstream out; + Containers::String out; Error redirectError{&out}; shader /* setPerVertexJointCount() works on both UBOs and classic */ @@ -2636,7 +2634,7 @@ void MeshVisualizerGLTest::setUniformUniformBuffersEnabled3D() { .setJointMatrices({}) .setJointMatrix(0, {}) .setPerInstanceJointCount(0); - CORRADE_COMPARE(out.str(), + CORRADE_COMPARE(out, "Shaders::MeshVisualizerGL3D::setProjectionMatrix(): the shader was created with uniform buffers enabled\n" "Shaders::MeshVisualizerGL3D::setTransformationMatrix(): the shader was created with uniform buffers enabled\n" "Shaders::MeshVisualizerGL::setTextureMatrix(): the shader was created with uniform buffers enabled\n" @@ -2651,14 +2649,14 @@ void MeshVisualizerGLTest::setUniformUniformBuffersEnabled3D() { "Shaders::MeshVisualizerGL3D::setJointMatrix(): the shader was created with uniform buffers enabled\n" "Shaders::MeshVisualizerGL::setPerInstanceJointCount(): the shader was created with uniform buffers enabled\n"); - out.str({}); + out = {}; #ifndef MAGNUM_TARGET_WEBGL shader .setNormalMatrix({}) .setLineWidth({}) .setLineLength({}); - CORRADE_COMPARE(out.str(), + CORRADE_COMPARE(out, "Shaders::MeshVisualizerGL3D::setNormalMatrix(): the shader was created with uniform buffers enabled\n" "Shaders::MeshVisualizerGL3D::setLineWidth(): the shader was created with uniform buffers enabled\n" "Shaders::MeshVisualizerGL3D::setLineLength(): the shader was created with uniform buffers enabled\n"); @@ -2672,7 +2670,7 @@ void MeshVisualizerGLTest::bindBufferUniformBuffersNotEnabled2D() { MeshVisualizerGL2D shader{MeshVisualizerGL2D::Configuration{} .setFlags(MeshVisualizerGL2D::Flag::Wireframe|MeshVisualizerGL2D::Flag::NoGeometryShader)}; - std::ostringstream out; + Containers::String out; Error redirectError{&out}; shader.bindTransformationProjectionBuffer(buffer) .bindTransformationProjectionBuffer(buffer, 0, 16) @@ -2685,7 +2683,7 @@ void MeshVisualizerGLTest::bindBufferUniformBuffersNotEnabled2D() { .bindJointBuffer(buffer) .bindJointBuffer(buffer, 0, 16) .setDrawOffset(0); - CORRADE_COMPARE(out.str(), + CORRADE_COMPARE(out, "Shaders::MeshVisualizerGL2D::bindTransformationProjectionBuffer(): the shader was not created with uniform buffers enabled\n" "Shaders::MeshVisualizerGL2D::bindTransformationProjectionBuffer(): the shader was not created with uniform buffers enabled\n" "Shaders::MeshVisualizerGL2D::bindDrawBuffer(): the shader was not created with uniform buffers enabled\n" @@ -2706,7 +2704,7 @@ void MeshVisualizerGLTest::bindBufferUniformBuffersNotEnabled3D() { MeshVisualizerGL3D shader{MeshVisualizerGL3D::Configuration{} .setFlags(MeshVisualizerGL3D::Flag::Wireframe|MeshVisualizerGL3D::Flag::NoGeometryShader)}; - std::ostringstream out; + Containers::String out; Error redirectError{&out}; shader.bindProjectionBuffer(buffer) .bindProjectionBuffer(buffer, 0, 16) @@ -2721,7 +2719,7 @@ void MeshVisualizerGLTest::bindBufferUniformBuffersNotEnabled3D() { .bindJointBuffer(buffer) .bindJointBuffer(buffer, 0, 16) .setDrawOffset(0); - CORRADE_COMPARE(out.str(), + CORRADE_COMPARE(out, "Shaders::MeshVisualizerGL3D::bindProjectionBuffer(): the shader was not created with uniform buffers enabled\n" "Shaders::MeshVisualizerGL3D::bindProjectionBuffer(): the shader was not created with uniform buffers enabled\n" "Shaders::MeshVisualizerGL3D::bindTransformationBuffer(): the shader was not created with uniform buffers enabled\n" @@ -2754,10 +2752,10 @@ void MeshVisualizerGLTest::bindObjectIdTextureInvalid2D() { MeshVisualizerGL2D shader{MeshVisualizerGL2D::Configuration{} .setFlags(data.flags2D)}; - std::ostringstream out; + Containers::String out; Error redirectError{&out}; shader.bindObjectIdTexture(texture); - CORRADE_COMPARE(out.str(), data.message); + CORRADE_COMPARE(out, data.message); } void MeshVisualizerGLTest::bindObjectIdTextureInvalid3D() { @@ -2775,10 +2773,10 @@ void MeshVisualizerGLTest::bindObjectIdTextureInvalid3D() { MeshVisualizerGL3D shader{MeshVisualizerGL3D::Configuration{} .setFlags(data.flags3D)}; - std::ostringstream out; + Containers::String out; Error redirectError{&out}; shader.bindObjectIdTexture(texture); - CORRADE_COMPARE(out.str(), data.message); + CORRADE_COMPARE(out, data.message); } void MeshVisualizerGLTest::bindObjectIdTextureArrayInvalid2D() { @@ -2796,10 +2794,10 @@ void MeshVisualizerGLTest::bindObjectIdTextureArrayInvalid2D() { MeshVisualizerGL2D shader{MeshVisualizerGL2D::Configuration{} .setFlags(data.flags2D)}; - std::ostringstream out; + Containers::String out; Error redirectError{&out}; shader.bindObjectIdTexture(textureArray); - CORRADE_COMPARE(out.str(), data.message); + CORRADE_COMPARE(out, data.message); } void MeshVisualizerGLTest::bindObjectIdTextureArrayInvalid3D() { @@ -2817,17 +2815,17 @@ void MeshVisualizerGLTest::bindObjectIdTextureArrayInvalid3D() { MeshVisualizerGL3D shader{MeshVisualizerGL3D::Configuration{} .setFlags(data.flags3D)}; - std::ostringstream out; + Containers::String out; Error redirectError{&out}; shader.bindObjectIdTexture(textureArray); - CORRADE_COMPARE(out.str(), data.message); + CORRADE_COMPARE(out, data.message); } #endif void MeshVisualizerGLTest::setWireframeNotEnabled2D() { CORRADE_SKIP_IF_NO_ASSERT(); - std::ostringstream out; + Containers::String out; Error redirectError{&out}; /* The constructor asserts for at least some feature being enabled (which @@ -2837,20 +2835,20 @@ void MeshVisualizerGLTest::setWireframeNotEnabled2D() { .setColor({}); #ifndef MAGNUM_TARGET_GLES2 - CORRADE_COMPARE(out.str(), + CORRADE_COMPARE(out, "Shaders::MeshVisualizerGL::setColor(): the shader was not created with wireframe or object/vertex/primitive ID enabled\n"); #else - CORRADE_COMPARE(out.str(), + CORRADE_COMPARE(out, "Shaders::MeshVisualizerGL::setColor(): the shader was not created with wireframe enabled\n"); #endif - out.str({}); + out = {}; shader .setWireframeColor({}) .setWireframeWidth({}) .setSmoothness({}); - CORRADE_COMPARE(out.str(), + CORRADE_COMPARE(out, "Shaders::MeshVisualizerGL::setWireframeColor(): the shader was not created with wireframe enabled\n" "Shaders::MeshVisualizerGL::setWireframeWidth(): the shader was not created with wireframe enabled\n" "Shaders::MeshVisualizerGL2D::setSmoothness(): the shader was not created with wireframe enabled\n"); @@ -2859,7 +2857,7 @@ void MeshVisualizerGLTest::setWireframeNotEnabled2D() { void MeshVisualizerGLTest::setWireframeNotEnabled3D() { CORRADE_SKIP_IF_NO_ASSERT(); - std::ostringstream out; + Containers::String out; Error redirectError{&out}; /* The constructor asserts for at least some feature being enabled (which @@ -2870,20 +2868,20 @@ void MeshVisualizerGLTest::setWireframeNotEnabled3D() { .setColor({}); #ifndef MAGNUM_TARGET_GLES2 - CORRADE_COMPARE(out.str(), + CORRADE_COMPARE(out, "Shaders::MeshVisualizerGL::setColor(): the shader was not created with wireframe or object/vertex/primitive ID enabled\n"); #else - CORRADE_COMPARE(out.str(), + CORRADE_COMPARE(out, "Shaders::MeshVisualizerGL::setColor(): the shader was not created with wireframe enabled\n"); #endif - out.str({}); + out = {}; shader .setWireframeColor({}) .setWireframeWidth({}) .setSmoothness({}); - CORRADE_COMPARE(out.str(), + CORRADE_COMPARE(out, "Shaders::MeshVisualizerGL::setWireframeColor(): the shader was not created with wireframe enabled\n" "Shaders::MeshVisualizerGL::setWireframeWidth(): the shader was not created with wireframe enabled\n" "Shaders::MeshVisualizerGL3D::setSmoothness(): the shader was not created with wireframe or TBN direction enabled\n"); @@ -2896,10 +2894,10 @@ void MeshVisualizerGLTest::setTextureMatrixNotEnabled2D() { MeshVisualizerGL2D shader{MeshVisualizerGL2D::Configuration{} .setFlags(MeshVisualizerGL2D::Flag::ObjectIdTexture)}; - std::ostringstream out; + Containers::String out; Error redirectError{&out}; shader.setTextureMatrix({}); - CORRADE_COMPARE(out.str(), + CORRADE_COMPARE(out, "Shaders::MeshVisualizerGL::setTextureMatrix(): the shader was not created with texture transformation enabled\n"); } @@ -2909,10 +2907,10 @@ void MeshVisualizerGLTest::setTextureMatrixNotEnabled3D() { MeshVisualizerGL3D shader{MeshVisualizerGL3D::Configuration{} .setFlags(MeshVisualizerGL3D::Flag::ObjectIdTexture)}; - std::ostringstream out; + Containers::String out; Error redirectError{&out}; shader.setTextureMatrix({}); - CORRADE_COMPARE(out.str(), + CORRADE_COMPARE(out, "Shaders::MeshVisualizerGL::setTextureMatrix(): the shader was not created with texture transformation enabled\n"); } @@ -2922,10 +2920,10 @@ void MeshVisualizerGLTest::setTextureLayerNotArray2D() { MeshVisualizerGL2D shader{MeshVisualizerGL2D::Configuration{} .setFlags(MeshVisualizerGL2D::Flag::ObjectIdTexture)}; - std::ostringstream out; + Containers::String out; Error redirectError{&out}; shader.setTextureLayer(37); - CORRADE_COMPARE(out.str(), + CORRADE_COMPARE(out, "Shaders::MeshVisualizerGL::setTextureLayer(): the shader was not created with texture arrays enabled\n"); } @@ -2935,10 +2933,10 @@ void MeshVisualizerGLTest::setTextureLayerNotArray3D() { MeshVisualizerGL3D shader{MeshVisualizerGL3D::Configuration{} .setFlags(MeshVisualizerGL3D::Flag::ObjectIdTexture)}; - std::ostringstream out; + Containers::String out; Error redirectError{&out}; shader.setTextureLayer(37); - CORRADE_COMPARE(out.str(), + CORRADE_COMPARE(out, "Shaders::MeshVisualizerGL::setTextureLayer(): the shader was not created with texture arrays enabled\n"); } @@ -2954,11 +2952,11 @@ void MeshVisualizerGLTest::bindTextureTransformBufferNotEnabled2D() { MeshVisualizerGL2D shader{MeshVisualizerGL2D::Configuration{} .setFlags(MeshVisualizerGL2D::Flag::UniformBuffers|MeshVisualizerGL2D::Flag::ObjectIdTexture)}; - std::ostringstream out; + Containers::String out; Error redirectError{&out}; shader.bindTextureTransformationBuffer(buffer) .bindTextureTransformationBuffer(buffer, 0, 16); - CORRADE_COMPARE(out.str(), + CORRADE_COMPARE(out, "Shaders::MeshVisualizerGL::bindTextureTransformationBuffer(): the shader was not created with texture transformation enabled\n" "Shaders::MeshVisualizerGL::bindTextureTransformationBuffer(): the shader was not created with texture transformation enabled\n"); } @@ -2975,11 +2973,11 @@ void MeshVisualizerGLTest::bindTextureTransformBufferNotEnabled3D() { MeshVisualizerGL2D shader{MeshVisualizerGL2D::Configuration{} .setFlags(MeshVisualizerGL2D::Flag::UniformBuffers|MeshVisualizerGL2D::Flag::ObjectIdTexture)}; - std::ostringstream out; + Containers::String out; Error redirectError{&out}; shader.bindTextureTransformationBuffer(buffer) .bindTextureTransformationBuffer(buffer, 0, 16); - CORRADE_COMPARE(out.str(), + CORRADE_COMPARE(out, "Shaders::MeshVisualizerGL::bindTextureTransformationBuffer(): the shader was not created with texture transformation enabled\n" "Shaders::MeshVisualizerGL::bindTextureTransformationBuffer(): the shader was not created with texture transformation enabled\n"); } @@ -2991,10 +2989,10 @@ void MeshVisualizerGLTest::setObjectIdNotEnabled2D() { MeshVisualizerGL2D shader{NoCreate}; - std::ostringstream out; + Containers::String out; Error redirectError{&out}; shader.setObjectId({}); - CORRADE_COMPARE(out.str(), "Shaders::MeshVisualizerGL::setObjectId(): the shader was not created with object ID enabled\n"); + CORRADE_COMPARE(out, "Shaders::MeshVisualizerGL::setObjectId(): the shader was not created with object ID enabled\n"); } void MeshVisualizerGLTest::setObjectIdNotEnabled3D() { @@ -3002,10 +3000,10 @@ void MeshVisualizerGLTest::setObjectIdNotEnabled3D() { MeshVisualizerGL3D shader{NoCreate}; - std::ostringstream out; + Containers::String out; Error redirectError{&out}; shader.setObjectId({}); - CORRADE_COMPARE(out.str(), "Shaders::MeshVisualizerGL::setObjectId(): the shader was not created with object ID enabled\n"); + CORRADE_COMPARE(out, "Shaders::MeshVisualizerGL::setObjectId(): the shader was not created with object ID enabled\n"); } void MeshVisualizerGLTest::setColorMapNotEnabled2D() { @@ -3014,11 +3012,11 @@ void MeshVisualizerGLTest::setColorMapNotEnabled2D() { GL::Texture2D texture; MeshVisualizerGL2D shader{NoCreate}; - std::ostringstream out; + Containers::String out; Error redirectError{&out}; shader.setColorMapTransformation({}, {}) .bindColorMapTexture(texture); - CORRADE_COMPARE(out.str(), + CORRADE_COMPARE(out, "Shaders::MeshVisualizerGL::setColorMapTransformation(): the shader was not created with object/vertex/primitive ID enabled\n" "Shaders::MeshVisualizerGL::bindColorMapTexture(): the shader was not created with object/vertex/primitive ID enabled\n"); } @@ -3029,11 +3027,11 @@ void MeshVisualizerGLTest::setColorMapNotEnabled3D() { GL::Texture2D texture; MeshVisualizerGL3D shader{NoCreate}; - std::ostringstream out; + Containers::String out; Error redirectError{&out}; shader.setColorMapTransformation({}, {}) .bindColorMapTexture(texture); - CORRADE_COMPARE(out.str(), + CORRADE_COMPARE(out, "Shaders::MeshVisualizerGL::setColorMapTransformation(): the shader was not created with object/vertex/primitive ID enabled\n" "Shaders::MeshVisualizerGL::bindColorMapTexture(): the shader was not created with object/vertex/primitive ID enabled\n"); } @@ -3054,12 +3052,12 @@ void MeshVisualizerGLTest::setTangentBitangentNormalNotEnabled3D() { MeshVisualizerGL3D shader{MeshVisualizerGL3D::Configuration{} .setFlags(MeshVisualizerGL3D::Flag::Wireframe)}; - std::ostringstream out; + Containers::String out; Error redirectError{&out}; shader.setNormalMatrix({}) .setLineWidth({}) .setLineLength({}); - CORRADE_COMPARE(out.str(), + CORRADE_COMPARE(out, "Shaders::MeshVisualizerGL3D::setNormalMatrix(): the shader was not created with TBN direction enabled\n" "Shaders::MeshVisualizerGL3D::setLineWidth(): the shader was not created with TBN direction enabled\n" "Shaders::MeshVisualizerGL3D::setLineLength(): the shader was not created with TBN direction enabled\n"); @@ -3081,13 +3079,13 @@ void MeshVisualizerGLTest::setWrongJointCountOrId2D() { .setFlags(MeshVisualizerGL2D::Flag::Wireframe|MeshVisualizerGL2D::Flag::NoGeometryShader) .setJointCount(5, 1)}; - std::ostringstream out; + Containers::String out; Error redirectError{&out}; /* Calling setJointMatrices() with less items is fine, tested in renderSkinningWireframe2D() */ shader.setJointMatrices({{}, {}, {}, {}, {}, {}}) .setJointMatrix(5, Matrix3{}); - CORRADE_COMPARE(out.str(), + CORRADE_COMPARE(out, "Shaders::MeshVisualizerGL2D::setJointMatrices(): expected at most 5 items but got 6\n" "Shaders::MeshVisualizerGL2D::setJointMatrix(): joint ID 5 is out of range for 5 joints\n"); } @@ -3106,13 +3104,13 @@ void MeshVisualizerGLTest::setWrongJointCountOrId3D() { .setFlags(MeshVisualizerGL3D::Flag::Wireframe|MeshVisualizerGL3D::Flag::NoGeometryShader) .setJointCount(5, 1)}; - std::ostringstream out; + Containers::String out; Error redirectError{&out}; /* Calling setJointMatrices() with less items is fine, tested in renderSkinningWireframe3D() */ shader.setJointMatrices({{}, {}, {}, {}, {}, {}}) .setJointMatrix(5, Matrix4{}); - CORRADE_COMPARE(out.str(), + CORRADE_COMPARE(out, "Shaders::MeshVisualizerGL3D::setJointMatrices(): expected at most 5 items but got 6\n" "Shaders::MeshVisualizerGL3D::setJointMatrix(): joint ID 5 is out of range for 5 joints\n"); } @@ -3132,10 +3130,10 @@ void MeshVisualizerGLTest::setWrongDrawOffset2D() { .setMaterialCount(2) .setDrawCount(5)}; - std::ostringstream out; + Containers::String out; Error redirectError{&out}; shader.setDrawOffset(5); - CORRADE_COMPARE(out.str(), + CORRADE_COMPARE(out, "Shaders::MeshVisualizerGL::setDrawOffset(): draw offset 5 is out of range for 5 draws\n"); } @@ -3152,10 +3150,10 @@ void MeshVisualizerGLTest::setWrongDrawOffset3D() { .setMaterialCount(2) .setDrawCount(5)}; - std::ostringstream out; + Containers::String out; Error redirectError{&out}; shader.setDrawOffset(5); - CORRADE_COMPARE(out.str(), + CORRADE_COMPARE(out, "Shaders::MeshVisualizerGL::setDrawOffset(): draw offset 5 is out of range for 5 draws\n"); } #endif diff --git a/src/Magnum/Shaders/Test/MeshVisualizerGL_Test.cpp b/src/Magnum/Shaders/Test/MeshVisualizerGL_Test.cpp index 37d454fcb..9a9cd2fcf 100644 --- a/src/Magnum/Shaders/Test/MeshVisualizerGL_Test.cpp +++ b/src/Magnum/Shaders/Test/MeshVisualizerGL_Test.cpp @@ -24,10 +24,10 @@ DEALINGS IN THE SOFTWARE. */ -#include +#include /* arraySize() */ +#include #include -#include -#include +#include #include "Magnum/Shaders/MeshVisualizerGL.h" @@ -119,10 +119,10 @@ void MeshVisualizerGL_Test::configurationSetJointCountInvalid2D() { MeshVisualizerGL2D::Configuration configuration; - std::ostringstream out; + Containers::String out; Error redirectError{&out}; configuration.setJointCount(data.jointCount, data.perVertexJointCount, data.secondaryPerVertexJointCount); - CORRADE_COMPARE(out.str(), Utility::formatString("Shaders::MeshVisualizerGL2D::Configuration::setJointCount(): {}\n", data.message)); + CORRADE_COMPARE(out, Utility::format("Shaders::MeshVisualizerGL2D::Configuration::setJointCount(): {}\n", data.message)); } void MeshVisualizerGL_Test::configurationSetJointCountInvalid3D() { @@ -133,10 +133,10 @@ void MeshVisualizerGL_Test::configurationSetJointCountInvalid3D() { MeshVisualizerGL3D::Configuration configuration; - std::ostringstream out; + Containers::String out; Error redirectError{&out}; configuration.setJointCount(data.jointCount, data.perVertexJointCount, data.secondaryPerVertexJointCount); - CORRADE_COMPARE(out.str(), Utility::formatString("Shaders::MeshVisualizerGL3D::Configuration::setJointCount(): {}\n", data.message)); + CORRADE_COMPARE(out, Utility::format("Shaders::MeshVisualizerGL3D::Configuration::setJointCount(): {}\n", data.message)); } #endif @@ -180,38 +180,38 @@ void MeshVisualizerGL_Test::vertexIndexSameAsObjectId() { } void MeshVisualizerGL_Test::debugFlag2D() { - std::ostringstream out; + Containers::String out; Debug{&out} << MeshVisualizerGL2D::Flag::Wireframe << MeshVisualizerGL2D::Flag(0xbad00000); - CORRADE_COMPARE(out.str(), "Shaders::MeshVisualizerGL2D::Flag::Wireframe Shaders::MeshVisualizerGL2D::Flag(0xbad00000)\n"); + CORRADE_COMPARE(out, "Shaders::MeshVisualizerGL2D::Flag::Wireframe Shaders::MeshVisualizerGL2D::Flag(0xbad00000)\n"); } void MeshVisualizerGL_Test::debugFlag3D() { - std::ostringstream out; + Containers::String out; Debug{&out} << MeshVisualizerGL3D::Flag::Wireframe << MeshVisualizerGL3D::Flag(0xbad00000); - CORRADE_COMPARE(out.str(), "Shaders::MeshVisualizerGL3D::Flag::Wireframe Shaders::MeshVisualizerGL3D::Flag(0xbad00000)\n"); + CORRADE_COMPARE(out, "Shaders::MeshVisualizerGL3D::Flag::Wireframe Shaders::MeshVisualizerGL3D::Flag(0xbad00000)\n"); } void MeshVisualizerGL_Test::debugFlags2D() { - std::ostringstream out; + Containers::String out; Debug{&out} << (MeshVisualizerGL2D::Flag::Wireframe|MeshVisualizerGL2D::Flag::NoGeometryShader) << MeshVisualizerGL2D::Flags{}; #if !defined(MAGNUM_TARGET_GLES2) && !defined(MAGNUM_TARGET_WEBGL) - CORRADE_COMPARE(out.str(), "Shaders::MeshVisualizerGL2D::Flag::Wireframe|Shaders::MeshVisualizerGL2D::Flag::NoGeometryShader Shaders::MeshVisualizerGL2D::Flags{}\n"); + CORRADE_COMPARE(out, "Shaders::MeshVisualizerGL2D::Flag::Wireframe|Shaders::MeshVisualizerGL2D::Flag::NoGeometryShader Shaders::MeshVisualizerGL2D::Flags{}\n"); #else - CORRADE_COMPARE(out.str(), "Shaders::MeshVisualizerGL2D::Flag::Wireframe Shaders::MeshVisualizerGL2D::Flags{}\n"); + CORRADE_COMPARE(out, "Shaders::MeshVisualizerGL2D::Flag::Wireframe Shaders::MeshVisualizerGL2D::Flags{}\n"); #endif } void MeshVisualizerGL_Test::debugFlags3D() { - std::ostringstream out; + Containers::String out; Debug{&out} << (MeshVisualizerGL3D::Flag::Wireframe|MeshVisualizerGL3D::Flag::NoGeometryShader) << MeshVisualizerGL3D::Flags{}; #if !defined(MAGNUM_TARGET_GLES2) && !defined(MAGNUM_TARGET_WEBGL) - CORRADE_COMPARE(out.str(), "Shaders::MeshVisualizerGL3D::Flag::Wireframe|Shaders::MeshVisualizerGL3D::Flag::NoGeometryShader Shaders::MeshVisualizerGL3D::Flags{}\n"); + CORRADE_COMPARE(out, "Shaders::MeshVisualizerGL3D::Flag::Wireframe|Shaders::MeshVisualizerGL3D::Flag::NoGeometryShader Shaders::MeshVisualizerGL3D::Flags{}\n"); #else - CORRADE_COMPARE(out.str(), "Shaders::MeshVisualizerGL3D::Flag::Wireframe Shaders::MeshVisualizerGL3D::Flags{}\n"); + CORRADE_COMPARE(out, "Shaders::MeshVisualizerGL3D::Flag::Wireframe Shaders::MeshVisualizerGL3D::Flags{}\n"); #endif } @@ -220,43 +220,43 @@ void MeshVisualizerGL_Test::debugFlagsSupersets2D() { /* InstancedObjectId and ObjectIdTexture are a superset of ObjectId so only one should be printed, but if there are both then both should be */ { - std::ostringstream out; + Containers::String out; Debug{&out} << (MeshVisualizerGL2D::Flag::ObjectId|MeshVisualizerGL2D::Flag::InstancedObjectId); - CORRADE_COMPARE(out.str(), "Shaders::MeshVisualizerGL2D::Flag::InstancedObjectId\n"); + CORRADE_COMPARE(out, "Shaders::MeshVisualizerGL2D::Flag::InstancedObjectId\n"); } { - std::ostringstream out; + Containers::String out; Debug{&out} << (MeshVisualizerGL2D::Flag::ObjectId|MeshVisualizerGL2D::Flag::ObjectIdTexture); - CORRADE_COMPARE(out.str(), "Shaders::MeshVisualizerGL2D::Flag::ObjectIdTexture\n"); + CORRADE_COMPARE(out, "Shaders::MeshVisualizerGL2D::Flag::ObjectIdTexture\n"); } { - std::ostringstream out; + Containers::String out; Debug{&out} << (MeshVisualizerGL2D::Flag::ObjectId|MeshVisualizerGL2D::Flag::InstancedObjectId|MeshVisualizerGL2D::Flag::ObjectIdTexture); - CORRADE_COMPARE(out.str(), "Shaders::MeshVisualizerGL2D::Flag::InstancedObjectId|Shaders::MeshVisualizerGL2D::Flag::ObjectIdTexture\n"); + CORRADE_COMPARE(out, "Shaders::MeshVisualizerGL2D::Flag::InstancedObjectId|Shaders::MeshVisualizerGL2D::Flag::ObjectIdTexture\n"); } /* InstancedTextureOffset is a superset of TextureTransformation so only one should be printed */ { - std::ostringstream out; + Containers::String out; Debug{&out} << (MeshVisualizerGL2D::Flag::InstancedTextureOffset|MeshVisualizerGL2D::Flag::TextureTransformation); - CORRADE_COMPARE(out.str(), "Shaders::MeshVisualizerGL2D::Flag::InstancedTextureOffset\n"); + CORRADE_COMPARE(out, "Shaders::MeshVisualizerGL2D::Flag::InstancedTextureOffset\n"); } /* MultiDraw and ShaderStorageBuffers are a superset of UniformBuffers so only one should be printed, but if there are both then both should be */ { - std::ostringstream out; + Containers::String out; Debug{&out} << (MeshVisualizerGL2D::Flag::MultiDraw|MeshVisualizerGL2D::Flag::UniformBuffers); - CORRADE_COMPARE(out.str(), "Shaders::MeshVisualizerGL2D::Flag::MultiDraw\n"); + CORRADE_COMPARE(out, "Shaders::MeshVisualizerGL2D::Flag::MultiDraw\n"); } #ifndef MAGNUM_TARGET_WEBGL { - std::ostringstream out; + Containers::String out; Debug{&out} << (MeshVisualizerGL2D::Flag::ShaderStorageBuffers|MeshVisualizerGL2D::Flag::UniformBuffers); - CORRADE_COMPARE(out.str(), "Shaders::MeshVisualizerGL2D::Flag::ShaderStorageBuffers\n"); + CORRADE_COMPARE(out, "Shaders::MeshVisualizerGL2D::Flag::ShaderStorageBuffers\n"); } { - std::ostringstream out; + Containers::String out; Debug{&out} << (MeshVisualizerGL2D::Flag::MultiDraw|MeshVisualizerGL2D::Flag::ShaderStorageBuffers|MeshVisualizerGL2D::Flag::UniformBuffers); - CORRADE_COMPARE(out.str(), "Shaders::MeshVisualizerGL2D::Flag::MultiDraw|Shaders::MeshVisualizerGL2D::Flag::ShaderStorageBuffers\n"); + CORRADE_COMPARE(out, "Shaders::MeshVisualizerGL2D::Flag::MultiDraw|Shaders::MeshVisualizerGL2D::Flag::ShaderStorageBuffers\n"); } #endif } @@ -265,43 +265,43 @@ void MeshVisualizerGL_Test::debugFlagsSupersets3D() { /* InstancedObjectId and ObjectIdTexture are a superset of ObjectId so only one should be printed, but if there are both then both should be */ { - std::ostringstream out; + Containers::String out; Debug{&out} << (MeshVisualizerGL3D::Flag::ObjectId|MeshVisualizerGL3D::Flag::InstancedObjectId); - CORRADE_COMPARE(out.str(), "Shaders::MeshVisualizerGL3D::Flag::InstancedObjectId\n"); + CORRADE_COMPARE(out, "Shaders::MeshVisualizerGL3D::Flag::InstancedObjectId\n"); } { - std::ostringstream out; + Containers::String out; Debug{&out} << (MeshVisualizerGL3D::Flag::ObjectId|MeshVisualizerGL3D::Flag::ObjectIdTexture); - CORRADE_COMPARE(out.str(), "Shaders::MeshVisualizerGL3D::Flag::ObjectIdTexture\n"); + CORRADE_COMPARE(out, "Shaders::MeshVisualizerGL3D::Flag::ObjectIdTexture\n"); } { - std::ostringstream out; + Containers::String out; Debug{&out} << (MeshVisualizerGL3D::Flag::ObjectId|MeshVisualizerGL3D::Flag::InstancedObjectId|MeshVisualizerGL3D::Flag::ObjectIdTexture); - CORRADE_COMPARE(out.str(), "Shaders::MeshVisualizerGL3D::Flag::InstancedObjectId|Shaders::MeshVisualizerGL3D::Flag::ObjectIdTexture\n"); + CORRADE_COMPARE(out, "Shaders::MeshVisualizerGL3D::Flag::InstancedObjectId|Shaders::MeshVisualizerGL3D::Flag::ObjectIdTexture\n"); } /* InstancedTextureOffset is a superset of TextureTransformation so only one should be printed */ { - std::ostringstream out; + Containers::String out; Debug{&out} << (MeshVisualizerGL3D::Flag::InstancedTextureOffset|MeshVisualizerGL3D::Flag::TextureTransformation); - CORRADE_COMPARE(out.str(), "Shaders::MeshVisualizerGL3D::Flag::InstancedTextureOffset\n"); + CORRADE_COMPARE(out, "Shaders::MeshVisualizerGL3D::Flag::InstancedTextureOffset\n"); } /* MultiDraw and ShaderStorageBuffers are a superset of UniformBuffers so only one should be printed, but if there are both then both should be */ { - std::ostringstream out; + Containers::String out; Debug{&out} << (MeshVisualizerGL3D::Flag::MultiDraw|MeshVisualizerGL3D::Flag::UniformBuffers); - CORRADE_COMPARE(out.str(), "Shaders::MeshVisualizerGL3D::Flag::MultiDraw\n"); + CORRADE_COMPARE(out, "Shaders::MeshVisualizerGL3D::Flag::MultiDraw\n"); } #ifndef MAGNUM_TARGET_WEBGL { - std::ostringstream out; + Containers::String out; Debug{&out} << (MeshVisualizerGL3D::Flag::ShaderStorageBuffers|MeshVisualizerGL3D::Flag::UniformBuffers); - CORRADE_COMPARE(out.str(), "Shaders::MeshVisualizerGL3D::Flag::ShaderStorageBuffers\n"); + CORRADE_COMPARE(out, "Shaders::MeshVisualizerGL3D::Flag::ShaderStorageBuffers\n"); } { - std::ostringstream out; + Containers::String out; Debug{&out} << (MeshVisualizerGL3D::Flag::MultiDraw|MeshVisualizerGL3D::Flag::ShaderStorageBuffers|MeshVisualizerGL3D::Flag::UniformBuffers); - CORRADE_COMPARE(out.str(), "Shaders::MeshVisualizerGL3D::Flag::MultiDraw|Shaders::MeshVisualizerGL3D::Flag::ShaderStorageBuffers\n"); + CORRADE_COMPARE(out, "Shaders::MeshVisualizerGL3D::Flag::MultiDraw|Shaders::MeshVisualizerGL3D::Flag::ShaderStorageBuffers\n"); } #endif } diff --git a/src/Magnum/Shaders/Test/PhongGLTest.cpp b/src/Magnum/Shaders/Test/PhongGLTest.cpp index 7d10b8724..dadb8a254 100644 --- a/src/Magnum/Shaders/Test/PhongGLTest.cpp +++ b/src/Magnum/Shaders/Test/PhongGLTest.cpp @@ -25,7 +25,6 @@ DEALINGS IN THE SOFTWARE. */ -#include #include #include #include @@ -34,8 +33,7 @@ #include #include #include -#include -#include +#include #include #include @@ -1849,7 +1847,7 @@ void PhongGLTest::constructInvalid() { CORRADE_SKIP_IF_NO_ASSERT(); - std::ostringstream out; + Containers::String out; Error redirectError{&out}; PhongGL{PhongGL::Configuration{} .setFlags(data.flags) @@ -1858,7 +1856,7 @@ void PhongGLTest::constructInvalid() { .setJointCount(data.jointCount, data.perVertexJointCount, data.secondaryPerVertexJointCount) #endif }; - CORRADE_COMPARE(out.str(), Utility::formatString( + CORRADE_COMPARE(out, Utility::format( "Shaders::PhongGL: {}\n", data.message)); } @@ -1874,7 +1872,7 @@ void PhongGLTest::constructUniformBuffersInvalid() { CORRADE_SKIP(GL::Extensions::ARB::uniform_buffer_object::string() << "is not supported."); #endif - std::ostringstream out; + Containers::String out; Error redirectError{&out}; PhongGL{PhongGL::Configuration{} .setFlags(data.flags) @@ -1882,7 +1880,7 @@ void PhongGLTest::constructUniformBuffersInvalid() { .setJointCount(data.jointCount, data.perVertexJointCount, data.secondaryPerVertexJointCount) .setMaterialCount(data.materialCount) .setDrawCount(data.drawCount)}; - CORRADE_COMPARE(out.str(), Utility::formatString( + CORRADE_COMPARE(out, Utility::format( "Shaders::PhongGL: {}\n", data.message)); } #endif @@ -1901,12 +1899,12 @@ void PhongGLTest::setPerVertexJointCountInvalid() { .setFlags(PhongGL::Flag::DynamicPerVertexJointCount) .setJointCount(16, 3, 2)}; - std::ostringstream out; + Containers::String out; Error redirectError{&out}; a.setPerVertexJointCount(3, 2); b.setPerVertexJointCount(4); b.setPerVertexJointCount(3, 3); - CORRADE_COMPARE(out.str(), + CORRADE_COMPARE(out, "Shaders::PhongGL::setPerVertexJointCount(): the shader was not created with dynamic per-vertex joint count enabled\n" "Shaders::PhongGL::setPerVertexJointCount(): expected at most 3 per-vertex joints, got 4\n" "Shaders::PhongGL::setPerVertexJointCount(): expected at most 2 secondary per-vertex joints, got 3\n"); @@ -1925,7 +1923,7 @@ void PhongGLTest::setUniformUniformBuffersEnabled() { PhongGL shader{PhongGL::Configuration{} .setFlags(PhongGL::Flag::UniformBuffers)}; - std::ostringstream out; + Containers::String out; Error redirectError{&out}; shader /* setPerVertexJointCount() works on both UBOs and classic */ @@ -1952,7 +1950,7 @@ void PhongGLTest::setUniformUniformBuffersEnabled() { .setJointMatrices({}) .setJointMatrix(0, {}) .setPerInstanceJointCount(0); - CORRADE_COMPARE(out.str(), + CORRADE_COMPARE(out, "Shaders::PhongGL::setAmbientColor(): the shader was created with uniform buffers enabled\n" "Shaders::PhongGL::setDiffuseColor(): the shader was created with uniform buffers enabled\n" "Shaders::PhongGL::setNormalTextureScale(): the shader was created with uniform buffers enabled\n" @@ -1984,7 +1982,7 @@ void PhongGLTest::bindBufferUniformBuffersNotEnabled() { GL::Buffer buffer; PhongGL shader; - std::ostringstream out; + Containers::String out; Error redirectError{&out}; shader.bindProjectionBuffer(buffer) .bindProjectionBuffer(buffer, 0, 16) @@ -2001,7 +1999,7 @@ void PhongGLTest::bindBufferUniformBuffersNotEnabled() { .bindJointBuffer(buffer) .bindJointBuffer(buffer, 0, 16) .setDrawOffset(0); - CORRADE_COMPARE(out.str(), + CORRADE_COMPARE(out, "Shaders::PhongGL::bindProjectionBuffer(): the shader was not created with uniform buffers enabled\n" "Shaders::PhongGL::bindProjectionBuffer(): the shader was not created with uniform buffers enabled\n" "Shaders::PhongGL::bindTransformationBuffer(): the shader was not created with uniform buffers enabled\n" @@ -2035,7 +2033,7 @@ void PhongGLTest::bindTexturesInvalid() { PhongGL shader{PhongGL::Configuration{} .setFlags(data.flags)}; - std::ostringstream out; + Containers::String out; Error redirectError{&out}; shader.bindAmbientTexture(texture) .bindDiffuseTexture(texture) @@ -2046,7 +2044,7 @@ void PhongGLTest::bindTexturesInvalid() { #endif .bindTextures(&texture, &texture, &texture, &texture); - CORRADE_COMPARE(out.str(), data.message); + CORRADE_COMPARE(out, data.message); } #ifndef MAGNUM_TARGET_GLES2 @@ -2065,14 +2063,14 @@ void PhongGLTest::bindTextureArraysInvalid() { PhongGL shader{PhongGL::Configuration{} .setFlags(data.flags)}; - std::ostringstream out; + Containers::String out; Error redirectError{&out}; shader.bindAmbientTexture(textureArray) .bindDiffuseTexture(textureArray) .bindSpecularTexture(textureArray) .bindNormalTexture(textureArray) .bindObjectIdTexture(textureArray); - CORRADE_COMPARE(out.str(), data.message); + CORRADE_COMPARE(out, data.message); } #endif @@ -2081,10 +2079,10 @@ void PhongGLTest::setAlphaMaskNotEnabled() { PhongGL shader; - std::ostringstream out; + Containers::String out; Error redirectError{&out}; shader.setAlphaMask(0.75f); - CORRADE_COMPARE(out.str(), + CORRADE_COMPARE(out, "Shaders::PhongGL::setAlphaMask(): the shader was not created with alpha mask enabled\n"); } @@ -2095,14 +2093,14 @@ void PhongGLTest::setSpecularDisabled() { PhongGL shader{PhongGL::Configuration{} .setFlags(PhongGL::Flag::NoSpecular)}; - std::ostringstream out; + Containers::String out; Error redirectError{&out}; shader.setSpecularColor({}) .setShininess({}) /* {{}} makes GCC 4.8 warn about zero as null pointer constant */ .setLightSpecularColors({Color3{}}) .setLightSpecularColor(0, {}); - CORRADE_COMPARE(out.str(), + CORRADE_COMPARE(out, "Shaders::PhongGL::setSpecularColor(): the shader was created with specular disabled\n" "Shaders::PhongGL::setShininess(): the shader was created with specular disabled\n" "Shaders::PhongGL::setLightSpecularColors(): the shader was created with specular disabled\n" @@ -2114,10 +2112,10 @@ void PhongGLTest::setTextureMatrixNotEnabled() { PhongGL shader; - std::ostringstream out; + Containers::String out; Error redirectError{&out}; shader.setTextureMatrix({}); - CORRADE_COMPARE(out.str(), + CORRADE_COMPARE(out, "Shaders::PhongGL::setTextureMatrix(): the shader was not created with texture transformation enabled\n"); } @@ -2126,10 +2124,10 @@ void PhongGLTest::setNormalTextureScaleNotEnabled() { PhongGL shader; - std::ostringstream out; + Containers::String out; Error redirectError{&out}; shader.setNormalTextureScale({}); - CORRADE_COMPARE(out.str(), + CORRADE_COMPARE(out, "Shaders::PhongGL::setNormalTextureScale(): the shader was not created with normal texture enabled\n"); } @@ -2139,10 +2137,10 @@ void PhongGLTest::setTextureLayerNotArray() { PhongGL shader; - std::ostringstream out; + Containers::String out; Error redirectError{&out}; shader.setTextureLayer(37); - CORRADE_COMPARE(out.str(), + CORRADE_COMPARE(out, "Shaders::PhongGL::setTextureLayer(): the shader was not created with texture arrays enabled\n"); } #endif @@ -2160,11 +2158,11 @@ void PhongGLTest::bindTextureTransformBufferNotEnabled() { PhongGL shader{PhongGL::Configuration{} .setFlags(PhongGL::Flag::UniformBuffers)}; - std::ostringstream out; + Containers::String out; Error redirectError{&out}; shader.bindTextureTransformationBuffer(buffer) .bindTextureTransformationBuffer(buffer, 0, 16); - CORRADE_COMPARE(out.str(), + CORRADE_COMPARE(out, "Shaders::PhongGL::bindTextureTransformationBuffer(): the shader was not created with texture transformation enabled\n" "Shaders::PhongGL::bindTextureTransformationBuffer(): the shader was not created with texture transformation enabled\n"); } @@ -2176,10 +2174,10 @@ void PhongGLTest::setObjectIdNotEnabled() { PhongGL shader; - std::ostringstream out; + Containers::String out; Error redirectError{&out}; shader.setObjectId(33376); - CORRADE_COMPARE(out.str(), + CORRADE_COMPARE(out, "Shaders::PhongGL::setObjectId(): the shader was not created with object ID enabled\n"); } #endif @@ -2190,7 +2188,7 @@ void PhongGLTest::setWrongLightCountOrId() { PhongGL shader{PhongGL::Configuration{} .setLightCount(5)}; - std::ostringstream out; + Containers::String out; Error redirectError{&out}; shader .setLightColors({Color3{}}) @@ -2199,7 +2197,7 @@ void PhongGLTest::setWrongLightCountOrId() { .setLightColor(5, Color3{}) .setLightPosition(5, Vector4{}) .setLightRange(5, 0.0f); - CORRADE_COMPARE(out.str(), + CORRADE_COMPARE(out, "Shaders::PhongGL::setLightColors(): expected 5 items but got 1\n" "Shaders::PhongGL::setLightPositions(): expected 5 items but got 1\n" "Shaders::PhongGL::setLightRanges(): expected 5 items but got 1\n" @@ -2215,13 +2213,13 @@ void PhongGLTest::setWrongJointCountOrId() { PhongGL shader{PhongGL::Configuration{} .setJointCount(5, 1)}; - std::ostringstream out; + Containers::String out; Error redirectError{&out}; /* Calling setJointMatrices() with less items is fine, tested in renderSkinning() */ shader.setJointMatrices({{}, {}, {}, {}, {}, {}}) .setJointMatrix(5, Matrix4{}); - CORRADE_COMPARE(out.str(), + CORRADE_COMPARE(out, "Shaders::PhongGL::setJointMatrices(): expected at most 5 items but got 6\n" "Shaders::PhongGL::setJointMatrix(): joint ID 5 is out of range for 5 joints\n"); } @@ -2242,10 +2240,10 @@ void PhongGLTest::setWrongDrawOffset() { .setMaterialCount(2) .setDrawCount(5)}; - std::ostringstream out; + Containers::String out; Error redirectError{&out}; shader.setDrawOffset(5); - CORRADE_COMPARE(out.str(), + CORRADE_COMPARE(out, "Shaders::PhongGL::setDrawOffset(): draw offset 5 is out of range for 5 draws\n"); } #endif diff --git a/src/Magnum/Shaders/Test/PhongGL_Test.cpp b/src/Magnum/Shaders/Test/PhongGL_Test.cpp index e99235894..c9ad9f2cb 100644 --- a/src/Magnum/Shaders/Test/PhongGL_Test.cpp +++ b/src/Magnum/Shaders/Test/PhongGL_Test.cpp @@ -24,10 +24,10 @@ DEALINGS IN THE SOFTWARE. */ -#include +#include /* arraySize() */ +#include #include -#include -#include +#include #include "Magnum/Shaders/PhongGL.h" @@ -110,10 +110,10 @@ void PhongGL_Test::configurationSetLightCountInvalid() { PhongGL::Configuration configuration; - std::ostringstream out; + Containers::String out; Error redirectError{&out}; configuration.setLightCount(data.count, data.perDrawCount); - CORRADE_COMPARE(out.str(), Utility::formatString("Shaders::PhongGL::Configuration::setLightCount(): {}\n", data.message)); + CORRADE_COMPARE(out, Utility::format("Shaders::PhongGL::Configuration::setLightCount(): {}\n", data.message)); } #ifndef MAGNUM_TARGET_GLES2 @@ -125,10 +125,10 @@ void PhongGL_Test::configurationSetJointCountInvalid() { PhongGL::Configuration configuration; - std::ostringstream out; + Containers::String out; Error redirectError{&out}; configuration.setJointCount(data.jointCount, data.perVertexJointCount, data.secondaryPerVertexJointCount); - CORRADE_COMPARE(out.str(), Utility::formatString("Shaders::PhongGL::Configuration::setJointCount(): {}\n", data.message)); + CORRADE_COMPARE(out, Utility::format("Shaders::PhongGL::Configuration::setJointCount(): {}\n", data.message)); } #endif @@ -149,17 +149,17 @@ void PhongGL_Test::constructCopy() { } void PhongGL_Test::debugFlag() { - std::ostringstream out; + Containers::String out; Debug{&out} << PhongGL::Flag::AmbientTexture << PhongGL::Flag(0xcafedead); - CORRADE_COMPARE(out.str(), "Shaders::PhongGL::Flag::AmbientTexture Shaders::PhongGL::Flag(0xcafedead)\n"); + CORRADE_COMPARE(out, "Shaders::PhongGL::Flag::AmbientTexture Shaders::PhongGL::Flag(0xcafedead)\n"); } void PhongGL_Test::debugFlags() { - std::ostringstream out; + Containers::String out; Debug{&out} << (PhongGL::Flag::DiffuseTexture|PhongGL::Flag::SpecularTexture) << PhongGL::Flags{}; - CORRADE_COMPARE(out.str(), "Shaders::PhongGL::Flag::DiffuseTexture|Shaders::PhongGL::Flag::SpecularTexture Shaders::PhongGL::Flags{}\n"); + CORRADE_COMPARE(out, "Shaders::PhongGL::Flag::DiffuseTexture|Shaders::PhongGL::Flag::SpecularTexture Shaders::PhongGL::Flags{}\n"); } void PhongGL_Test::debugFlagsSupersets() { @@ -167,45 +167,45 @@ void PhongGL_Test::debugFlagsSupersets() { /* InstancedObjectId and ObjectIdTexture are a superset of ObjectId so only one should be printed, but if there are both then both should be */ { - std::ostringstream out; + Containers::String out; Debug{&out} << (PhongGL::Flag::ObjectId|PhongGL::Flag::InstancedObjectId); - CORRADE_COMPARE(out.str(), "Shaders::PhongGL::Flag::InstancedObjectId\n"); + CORRADE_COMPARE(out, "Shaders::PhongGL::Flag::InstancedObjectId\n"); } { - std::ostringstream out; + Containers::String out; Debug{&out} << (PhongGL::Flag::ObjectId|PhongGL::Flag::ObjectIdTexture); - CORRADE_COMPARE(out.str(), "Shaders::PhongGL::Flag::ObjectIdTexture\n"); + CORRADE_COMPARE(out, "Shaders::PhongGL::Flag::ObjectIdTexture\n"); } { - std::ostringstream out; + Containers::String out; Debug{&out} << (PhongGL::Flag::ObjectId|PhongGL::Flag::InstancedObjectId|PhongGL::Flag::ObjectIdTexture); - CORRADE_COMPARE(out.str(), "Shaders::PhongGL::Flag::InstancedObjectId|Shaders::PhongGL::Flag::ObjectIdTexture\n"); + CORRADE_COMPARE(out, "Shaders::PhongGL::Flag::InstancedObjectId|Shaders::PhongGL::Flag::ObjectIdTexture\n"); } #endif /* InstancedTextureOffset is a superset of TextureTransformation so only one should be printed */ { - std::ostringstream out; + Containers::String out; Debug{&out} << (PhongGL::Flag::InstancedTextureOffset|PhongGL::Flag::TextureTransformation); - CORRADE_COMPARE(out.str(), "Shaders::PhongGL::Flag::InstancedTextureOffset\n"); + CORRADE_COMPARE(out, "Shaders::PhongGL::Flag::InstancedTextureOffset\n"); } #ifndef MAGNUM_TARGET_GLES2 /* MultiDraw and ShaderStorageBuffers are a superset of UniformBuffers so only one should be printed, but if there are both then both should be */ { - std::ostringstream out; + Containers::String out; Debug{&out} << (PhongGL::Flag::MultiDraw|PhongGL::Flag::UniformBuffers); - CORRADE_COMPARE(out.str(), "Shaders::PhongGL::Flag::MultiDraw\n"); + CORRADE_COMPARE(out, "Shaders::PhongGL::Flag::MultiDraw\n"); } #ifndef MAGNUM_TARGET_WEBGL { - std::ostringstream out; + Containers::String out; Debug{&out} << (PhongGL::Flag::ShaderStorageBuffers|PhongGL::Flag::UniformBuffers); - CORRADE_COMPARE(out.str(), "Shaders::PhongGL::Flag::ShaderStorageBuffers\n"); + CORRADE_COMPARE(out, "Shaders::PhongGL::Flag::ShaderStorageBuffers\n"); } { - std::ostringstream out; + Containers::String out; Debug{&out} << (PhongGL::Flag::MultiDraw|PhongGL::Flag::ShaderStorageBuffers|PhongGL::Flag::UniformBuffers); - CORRADE_COMPARE(out.str(), "Shaders::PhongGL::Flag::MultiDraw|Shaders::PhongGL::Flag::ShaderStorageBuffers\n"); + CORRADE_COMPARE(out, "Shaders::PhongGL::Flag::MultiDraw|Shaders::PhongGL::Flag::ShaderStorageBuffers\n"); } #endif #endif diff --git a/src/Magnum/Shaders/Test/VectorGLTest.cpp b/src/Magnum/Shaders/Test/VectorGLTest.cpp index e4147b79a..3969d9683 100644 --- a/src/Magnum/Shaders/Test/VectorGLTest.cpp +++ b/src/Magnum/Shaders/Test/VectorGLTest.cpp @@ -25,15 +25,13 @@ DEALINGS IN THE SOFTWARE. */ -#include #include #include #include #include #include #include -#include -#include +#include #include #include @@ -606,13 +604,13 @@ template void VectorGLTest::constructUniformBuffersInval CORRADE_SKIP(GL::Extensions::ARB::uniform_buffer_object::string() << "is not supported."); #endif - std::ostringstream out; + Containers::String out; Error redirectError{&out}; VectorGL{typename VectorGL::Configuration{} .setFlags(data.flags) .setMaterialCount(data.materialCount) .setDrawCount(data.drawCount)}; - CORRADE_COMPARE(out.str(), Utility::formatString( + CORRADE_COMPARE(out, Utility::format( "Shaders::VectorGL: {}\n", data.message)); } #endif @@ -631,13 +629,13 @@ template void VectorGLTest::setUniformUniformBuffersEnab VectorGL shader{typename VectorGL::Configuration{} .setFlags(VectorGL::Flag::UniformBuffers)}; - std::ostringstream out; + Containers::String out; Error redirectError{&out}; shader.setTransformationProjectionMatrix({}) .setTextureMatrix({}) .setBackgroundColor({}) .setColor({}); - CORRADE_COMPARE(out.str(), + CORRADE_COMPARE(out, "Shaders::VectorGL::setTransformationProjectionMatrix(): the shader was created with uniform buffers enabled\n" "Shaders::VectorGL::setTextureMatrix(): the shader was created with uniform buffers enabled\n" "Shaders::VectorGL::setBackgroundColor(): the shader was created with uniform buffers enabled\n" @@ -652,7 +650,7 @@ template void VectorGLTest::bindBufferUniformBuffersNotE GL::Buffer buffer; VectorGL shader; - std::ostringstream out; + Containers::String out; Error redirectError{&out}; shader.bindTransformationProjectionBuffer(buffer) .bindTransformationProjectionBuffer(buffer, 0, 16) @@ -663,7 +661,7 @@ template void VectorGLTest::bindBufferUniformBuffersNotE .bindMaterialBuffer(buffer) .bindMaterialBuffer(buffer, 0, 16) .setDrawOffset(0); - CORRADE_COMPARE(out.str(), + CORRADE_COMPARE(out, "Shaders::VectorGL::bindTransformationProjectionBuffer(): the shader was not created with uniform buffers enabled\n" "Shaders::VectorGL::bindTransformationProjectionBuffer(): the shader was not created with uniform buffers enabled\n" "Shaders::VectorGL::bindDrawBuffer(): the shader was not created with uniform buffers enabled\n" @@ -683,10 +681,10 @@ template void VectorGLTest::setTextureMatrixNotEnabled() VectorGL shader; - std::ostringstream out; + Containers::String out; Error redirectError{&out}; shader.setTextureMatrix({}); - CORRADE_COMPARE(out.str(), + CORRADE_COMPARE(out, "Shaders::VectorGL::setTextureMatrix(): the shader was not created with texture transformation enabled\n"); } @@ -705,11 +703,11 @@ template void VectorGLTest::bindTextureTransformBufferNo VectorGL shader{typename VectorGL::Configuration{} .setFlags(VectorGL::Flag::UniformBuffers)}; - std::ostringstream out; + Containers::String out; Error redirectError{&out}; shader.bindTextureTransformationBuffer(buffer) .bindTextureTransformationBuffer(buffer, 0, 16); - CORRADE_COMPARE(out.str(), + CORRADE_COMPARE(out, "Shaders::VectorGL::bindTextureTransformationBuffer(): the shader was not created with texture transformation enabled\n" "Shaders::VectorGL::bindTextureTransformationBuffer(): the shader was not created with texture transformation enabled\n"); } @@ -731,10 +729,10 @@ template void VectorGLTest::setWrongDrawOffset() { .setMaterialCount(2) .setDrawCount(5)}; - std::ostringstream out; + Containers::String out; Error redirectError{&out}; shader.setDrawOffset(5); - CORRADE_COMPARE(out.str(), + CORRADE_COMPARE(out, "Shaders::VectorGL::setDrawOffset(): draw offset 5 is out of range for 5 draws\n"); } #endif diff --git a/src/Magnum/Shaders/Test/VectorGL_Test.cpp b/src/Magnum/Shaders/Test/VectorGL_Test.cpp index e3d1b8887..3c2176a93 100644 --- a/src/Magnum/Shaders/Test/VectorGL_Test.cpp +++ b/src/Magnum/Shaders/Test/VectorGL_Test.cpp @@ -24,10 +24,8 @@ DEALINGS IN THE SOFTWARE. */ -#include #include #include -#include #include #include "Magnum/Shaders/VectorGL.h" @@ -85,17 +83,17 @@ template void VectorGL_Test::constructCopy() { } void VectorGL_Test::debugFlag() { - std::ostringstream out; + Containers::String out; Debug{&out} << VectorGL2D::Flag::TextureTransformation << VectorGL2D::Flag(0xf0); - CORRADE_COMPARE(out.str(), "Shaders::VectorGL::Flag::TextureTransformation Shaders::VectorGL::Flag(0xf0)\n"); + CORRADE_COMPARE(out, "Shaders::VectorGL::Flag::TextureTransformation Shaders::VectorGL::Flag(0xf0)\n"); } void VectorGL_Test::debugFlags() { - std::ostringstream out; + Containers::String out; Debug{&out} << VectorGL3D::Flags{VectorGL3D::Flag::TextureTransformation|VectorGL3D::Flag(0xf0)} << VectorGL3D::Flags{}; - CORRADE_COMPARE(out.str(), "Shaders::VectorGL::Flag::TextureTransformation|Shaders::VectorGL::Flag(0xf0) Shaders::VectorGL::Flags{}\n"); + CORRADE_COMPARE(out, "Shaders::VectorGL::Flag::TextureTransformation|Shaders::VectorGL::Flag(0xf0) Shaders::VectorGL::Flags{}\n"); } #ifndef MAGNUM_TARGET_GLES2 @@ -103,19 +101,19 @@ void VectorGL_Test::debugFlagsSupersets() { /* MultiDraw and ShaderStorageBuffers are a superset of UniformBuffers so only one should be printed, but if there are both then both should be */ { - std::ostringstream out; + Containers::String out; Debug{&out} << (VectorGL3D::Flag::MultiDraw|VectorGL3D::Flag::UniformBuffers); - CORRADE_COMPARE(out.str(), "Shaders::VectorGL::Flag::MultiDraw\n"); + CORRADE_COMPARE(out, "Shaders::VectorGL::Flag::MultiDraw\n"); } #ifndef MAGNUM_TARGET_WEBGL { - std::ostringstream out; + Containers::String out; Debug{&out} << (VectorGL2D::Flag::ShaderStorageBuffers|VectorGL2D::Flag::UniformBuffers); - CORRADE_COMPARE(out.str(), "Shaders::VectorGL::Flag::ShaderStorageBuffers\n"); + CORRADE_COMPARE(out, "Shaders::VectorGL::Flag::ShaderStorageBuffers\n"); } { - std::ostringstream out; + Containers::String out; Debug{&out} << (VectorGL3D::Flag::MultiDraw|VectorGL3D::Flag::ShaderStorageBuffers|VectorGL3D::Flag::UniformBuffers); - CORRADE_COMPARE(out.str(), "Shaders::VectorGL::Flag::MultiDraw|Shaders::VectorGL::Flag::ShaderStorageBuffers\n"); + CORRADE_COMPARE(out, "Shaders::VectorGL::Flag::MultiDraw|Shaders::VectorGL::Flag::ShaderStorageBuffers\n"); } #endif } diff --git a/src/Magnum/Shaders/Test/VertexColorGLTest.cpp b/src/Magnum/Shaders/Test/VertexColorGLTest.cpp index be476b8a1..7b9cd195a 100644 --- a/src/Magnum/Shaders/Test/VertexColorGLTest.cpp +++ b/src/Magnum/Shaders/Test/VertexColorGLTest.cpp @@ -25,13 +25,11 @@ DEALINGS IN THE SOFTWARE. */ -#include #include #include #include #include #include -#include #include #include #include @@ -540,12 +538,12 @@ template void VertexColorGLTest::constructUniformBuffers #endif /* This fails for UBOs but not SSBOs */ - std::ostringstream out; + Containers::String out; Error redirectError{&out}; VertexColorGL{typename VertexColorGL::Configuration{} .setFlags(VertexColorGL::Flag::UniformBuffers) .setDrawCount(0)}; - CORRADE_COMPARE(out.str(), + CORRADE_COMPARE(out, "Shaders::VertexColorGL: draw count can't be zero\n"); } #endif @@ -564,10 +562,10 @@ template void VertexColorGLTest::setUniformUniformBuffer VertexColorGL shader{typename VertexColorGL::Configuration{} .setFlags(VertexColorGL::Flag::UniformBuffers)}; - std::ostringstream out; + Containers::String out; Error redirectError{&out}; shader.setTransformationProjectionMatrix({}); - CORRADE_COMPARE(out.str(), + CORRADE_COMPARE(out, "Shaders::VertexColorGL::setTransformationProjectionMatrix(): the shader was created with uniform buffers enabled\n"); } @@ -579,12 +577,12 @@ template void VertexColorGLTest::bindBufferUniformBuffer GL::Buffer buffer; VertexColorGL shader; - std::ostringstream out; + Containers::String out; Error redirectError{&out}; shader.bindTransformationProjectionBuffer(buffer) .bindTransformationProjectionBuffer(buffer, 0, 16) .setDrawOffset(0); - CORRADE_COMPARE(out.str(), + CORRADE_COMPARE(out, "Shaders::VertexColorGL::bindTransformationProjectionBuffer(): the shader was not created with uniform buffers enabled\n" "Shaders::VertexColorGL::bindTransformationProjectionBuffer(): the shader was not created with uniform buffers enabled\n" "Shaders::VertexColorGL::setDrawOffset(): the shader was not created with uniform buffers enabled\n"); @@ -604,10 +602,10 @@ template void VertexColorGLTest::setWrongDrawOffset() { .setFlags(VertexColorGL::Flag::UniformBuffers) .setDrawCount(5)}; - std::ostringstream out; + Containers::String out; Error redirectError{&out}; shader.setDrawOffset(5); - CORRADE_COMPARE(out.str(), + CORRADE_COMPARE(out, "Shaders::VertexColorGL::setDrawOffset(): draw offset 5 is out of range for 5 draws\n"); } #endif diff --git a/src/Magnum/Shaders/Test/VertexColorGL_Test.cpp b/src/Magnum/Shaders/Test/VertexColorGL_Test.cpp index 7fd1c8058..3dd9c32d1 100644 --- a/src/Magnum/Shaders/Test/VertexColorGL_Test.cpp +++ b/src/Magnum/Shaders/Test/VertexColorGL_Test.cpp @@ -24,10 +24,8 @@ DEALINGS IN THE SOFTWARE. */ -#include #include #include -#include #include #include "Magnum/Shaders/VertexColorGL.h" @@ -84,26 +82,26 @@ template void VertexColorGL_Test::constructCopy() { } void VertexColorGL_Test::debugFlag() { - std::ostringstream out; + Containers::String out; #ifndef MAGNUM_TARGET_GLES2 Debug{&out} << VertexColorGL3D::Flag::UniformBuffers << VertexColorGL3D::Flag(0xf0); - CORRADE_COMPARE(out.str(), "Shaders::VertexColorGL::Flag::UniformBuffers Shaders::VertexColorGL::Flag(0xf0)\n"); + CORRADE_COMPARE(out, "Shaders::VertexColorGL::Flag::UniformBuffers Shaders::VertexColorGL::Flag(0xf0)\n"); #else Debug{&out} << VertexColorGL3D::Flag(0xf0); - CORRADE_COMPARE(out.str(), "Shaders::VertexColorGL::Flag(0xf0)\n"); + CORRADE_COMPARE(out, "Shaders::VertexColorGL::Flag(0xf0)\n"); #endif } void VertexColorGL_Test::debugFlags() { - std::ostringstream out; + Containers::String out; #ifndef MAGNUM_TARGET_GLES2 Debug{&out} << (VertexColorGL3D::Flag::UniformBuffers|VertexColorGL3D::Flag(0xf0)) << VertexColorGL3D::Flags{}; - CORRADE_COMPARE(out.str(), "Shaders::VertexColorGL::Flag::UniformBuffers|Shaders::VertexColorGL::Flag(0xf0) Shaders::VertexColorGL::Flags{}\n"); + CORRADE_COMPARE(out, "Shaders::VertexColorGL::Flag::UniformBuffers|Shaders::VertexColorGL::Flag(0xf0) Shaders::VertexColorGL::Flags{}\n"); #else Debug{&out} << VertexColorGL3D::Flag(0xf0) << VertexColorGL3D::Flags{}; - CORRADE_COMPARE(out.str(), "Shaders::VertexColorGL::Flag(0xf0) Shaders::VertexColorGL::Flags{}\n"); + CORRADE_COMPARE(out, "Shaders::VertexColorGL::Flag(0xf0) Shaders::VertexColorGL::Flags{}\n"); #endif } @@ -112,19 +110,19 @@ void VertexColorGL_Test::debugFlagsSupersets() { /* MultiDraw and ShaderStorageBuffers are a superset of UniformBuffers so only one should be printed, but if there are both then both should be */ { - std::ostringstream out; + Containers::String out; Debug{&out} << (VertexColorGL3D::Flag::MultiDraw|VertexColorGL3D::Flag::UniformBuffers); - CORRADE_COMPARE(out.str(), "Shaders::VertexColorGL::Flag::MultiDraw\n"); + CORRADE_COMPARE(out, "Shaders::VertexColorGL::Flag::MultiDraw\n"); } #ifndef MAGNUM_TARGET_WEBGL { - std::ostringstream out; + Containers::String out; Debug{&out} << (VertexColorGL2D::Flag::ShaderStorageBuffers|VertexColorGL2D::Flag::UniformBuffers); - CORRADE_COMPARE(out.str(), "Shaders::VertexColorGL::Flag::ShaderStorageBuffers\n"); + CORRADE_COMPARE(out, "Shaders::VertexColorGL::Flag::ShaderStorageBuffers\n"); } { - std::ostringstream out; + Containers::String out; Debug{&out} << (VertexColorGL3D::Flag::MultiDraw|VertexColorGL3D::Flag::ShaderStorageBuffers|VertexColorGL3D::Flag::UniformBuffers); - CORRADE_COMPARE(out.str(), "Shaders::VertexColorGL::Flag::MultiDraw|Shaders::VertexColorGL::Flag::ShaderStorageBuffers\n"); + CORRADE_COMPARE(out, "Shaders::VertexColorGL::Flag::MultiDraw|Shaders::VertexColorGL::Flag::ShaderStorageBuffers\n"); } #endif } diff --git a/src/Magnum/Test/ArrayTest.cpp b/src/Magnum/Test/ArrayTest.cpp index b02223107..62276a140 100644 --- a/src/Magnum/Test/ArrayTest.cpp +++ b/src/Magnum/Test/ArrayTest.cpp @@ -24,9 +24,8 @@ DEALINGS IN THE SOFTWARE. */ -#include +#include #include -#include #include "Magnum/Array.h" @@ -118,10 +117,10 @@ void ArrayTest::access() { } void ArrayTest::debug() { - std::ostringstream out; + Containers::String out; Debug{&out} << Array<4, Int>{5, 6, 7, 8} << Array1D{13} << Array2D{71, 2} << Array3D{1, 2, 3}; - CORRADE_COMPARE(out.str(), "Array(5, 6, 7, 8) Array(13) Array(71, 2) Array(1, 2, 3)\n"); + CORRADE_COMPARE(out, "Array(5, 6, 7, 8) Array(13) Array(71, 2) Array(1, 2, 3)\n"); } CORRADE_IGNORE_DEPRECATED_POP diff --git a/src/Magnum/Test/ConverterUtilitiesTest.cpp b/src/Magnum/Test/ConverterUtilitiesTest.cpp index 0e8bce6c8..ad5f660b9 100644 --- a/src/Magnum/Test/ConverterUtilitiesTest.cpp +++ b/src/Magnum/Test/ConverterUtilitiesTest.cpp @@ -24,11 +24,11 @@ DEALINGS IN THE SOFTWARE. */ -#include +#include /** @todo remove once Configuration is stream-free */ #include #include #include -#include +#include /** @todo remove once Configuration is stream-free */ #include "Magnum/Implementation/converterUtilities.h" @@ -264,20 +264,20 @@ void ConverterUtilitiesTest::setOptions() { plugin.configuration() = Utility::ConfigurationGroup{*Utility::Configuration{in}.group("configuration")}; { - std::ostringstream out; + Containers::String out; Warning redirectWarning{&out}; Implementation::setOptions(plugin, data.anyPluginName, data.options); if(data.expectedWarning) - CORRADE_COMPARE(out.str(), data.expectedWarning); + CORRADE_COMPARE(out, data.expectedWarning); else - CORRADE_COMPARE(out.str(), ""); + CORRADE_COMPARE(out, ""); } Utility::Configuration conf; /** @todo ugh, is there no better way to serialize a ConfigurationGroup? */ conf.addGroup("configuration", new Utility::ConfigurationGroup{plugin.configuration()}); CORRADE_COMPARE(conf.group("configuration")->configuration(), &conf); - std::ostringstream out; + std::stringstream out; conf.save(out); CORRADE_COMPARE_AS(out.str(), data.expectedConfig, diff --git a/src/Magnum/Test/FileCallbackTest.cpp b/src/Magnum/Test/FileCallbackTest.cpp index 4fca7077c..b89a3c713 100644 --- a/src/Magnum/Test/FileCallbackTest.cpp +++ b/src/Magnum/Test/FileCallbackTest.cpp @@ -24,9 +24,8 @@ DEALINGS IN THE SOFTWARE. */ -#include +#include #include -#include #include "Magnum/FileCallback.h" @@ -43,10 +42,10 @@ FileCallbackTest::FileCallbackTest() { } void FileCallbackTest::debugInputFileCallbackPolicy() { - std::ostringstream out; + Containers::String out; Debug{&out} << InputFileCallbackPolicy::Close << InputFileCallbackPolicy(0xf0); - CORRADE_COMPARE(out.str(), "InputFileCallbackPolicy::Close InputFileCallbackPolicy(0xf0)\n"); + CORRADE_COMPARE(out, "InputFileCallbackPolicy::Close InputFileCallbackPolicy(0xf0)\n"); } }}} diff --git a/src/Magnum/Test/ImageFlagsTest.cpp b/src/Magnum/Test/ImageFlagsTest.cpp index aa7e9a082..75b498251 100644 --- a/src/Magnum/Test/ImageFlagsTest.cpp +++ b/src/Magnum/Test/ImageFlagsTest.cpp @@ -24,9 +24,8 @@ DEALINGS IN THE SOFTWARE. */ -#include +#include #include -#include #include "Magnum/ImageFlags.h" @@ -75,85 +74,85 @@ void ImageFlagsTest::matchingValues() { } void ImageFlagsTest::debugFlag1D() { - std::ostringstream out; + Containers::String out; /** @todo use a real flag once it exists */ Debug{&out} << ImageFlag1D(0xcafe); - CORRADE_COMPARE(out.str(), "ImageFlag1D(0xcafe)\n"); + CORRADE_COMPARE(out, "ImageFlag1D(0xcafe)\n"); } void ImageFlagsTest::debugFlag2D() { - std::ostringstream out; + Containers::String out; Debug{&out} << ImageFlag2D::Array << ImageFlag2D(0xcafe); - CORRADE_COMPARE(out.str(), "ImageFlag2D::Array ImageFlag2D(0xcafe)\n"); + CORRADE_COMPARE(out, "ImageFlag2D::Array ImageFlag2D(0xcafe)\n"); } void ImageFlagsTest::debugFlag3D() { - std::ostringstream out; + Containers::String out; Debug{&out} << ImageFlag3D::CubeMap << ImageFlag3D(0xcafe); - CORRADE_COMPARE(out.str(), "ImageFlag3D::CubeMap ImageFlag3D(0xcafe)\n"); + CORRADE_COMPARE(out, "ImageFlag3D::CubeMap ImageFlag3D(0xcafe)\n"); } void ImageFlagsTest::debugFlag1DPacked() { - std::ostringstream out; + Containers::String out; /* Last is not packed, ones before should not make any flags persistent */ /** @todo use real flags once they exist */ Debug{&out} << Debug::packed << ImageFlag1D(0xcafe) << ImageFlag1D(0xbeef); - CORRADE_COMPARE(out.str(), "0xcafe ImageFlag1D(0xbeef)\n"); + CORRADE_COMPARE(out, "0xcafe ImageFlag1D(0xbeef)\n"); } void ImageFlagsTest::debugFlag2DPacked() { - std::ostringstream out; + Containers::String out; /* Last is not packed, ones before should not make any flags persistent */ Debug{&out} << Debug::packed << ImageFlag2D::Array << Debug::packed << ImageFlag2D(0xcafe) << ImageFlag2D::Array; - CORRADE_COMPARE(out.str(), "Array 0xcafe ImageFlag2D::Array\n"); + CORRADE_COMPARE(out, "Array 0xcafe ImageFlag2D::Array\n"); } void ImageFlagsTest::debugFlag3DPacked() { - std::ostringstream out; + Containers::String out; /* Last is not packed, ones before should not make any flags persistent */ Debug{&out} << Debug::packed << ImageFlag3D::CubeMap << Debug::packed << ImageFlag3D(0xcafe) << ImageFlag3D::Array; - CORRADE_COMPARE(out.str(), "CubeMap 0xcafe ImageFlag3D::Array\n"); + CORRADE_COMPARE(out, "CubeMap 0xcafe ImageFlag3D::Array\n"); } void ImageFlagsTest::debugFlags1D() { - std::ostringstream out; + Containers::String out; /** @todo use real flags once they exist */ Debug{&out} << (ImageFlag1D{}|ImageFlag1D(0xcafe)) << ImageFlags1D{}; - CORRADE_COMPARE(out.str(), "ImageFlag1D(0xcafe) ImageFlags1D{}\n"); + CORRADE_COMPARE(out, "ImageFlag1D(0xcafe) ImageFlags1D{}\n"); } void ImageFlagsTest::debugFlags2D() { - std::ostringstream out; + Containers::String out; Debug{&out} << (ImageFlag2D::Array|ImageFlag2D(0xcafe)) << ImageFlags2D{}; - CORRADE_COMPARE(out.str(), "ImageFlag2D::Array|ImageFlag2D(0xcafe) ImageFlags2D{}\n"); + CORRADE_COMPARE(out, "ImageFlag2D::Array|ImageFlag2D(0xcafe) ImageFlags2D{}\n"); } void ImageFlagsTest::debugFlags3D() { - std::ostringstream out; + Containers::String out; Debug{&out} << (ImageFlag3D::Array|ImageFlag3D::CubeMap|ImageFlag3D(0xcaf0)) << ImageFlags3D{}; - CORRADE_COMPARE(out.str(), "ImageFlag3D::Array|ImageFlag3D::CubeMap|ImageFlag3D(0xcaf0) ImageFlags3D{}\n"); + CORRADE_COMPARE(out, "ImageFlag3D::Array|ImageFlag3D::CubeMap|ImageFlag3D(0xcaf0) ImageFlags3D{}\n"); } void ImageFlagsTest::debugFlags1DPacked() { - std::ostringstream out; + Containers::String out; /* Last is not packed, ones before should not make any flags persistent */ /** @todo use real flags once they exist */ Debug{&out} << Debug::packed << (ImageFlag1D{}|ImageFlag1D(0xcafe)) << Debug::packed << ImageFlags1D{} << ImageFlag1D(0xbeef); - CORRADE_COMPARE(out.str(), "0xcafe {} ImageFlag1D(0xbeef)\n"); + CORRADE_COMPARE(out, "0xcafe {} ImageFlag1D(0xbeef)\n"); } void ImageFlagsTest::debugFlags2DPacked() { - std::ostringstream out; + Containers::String out; /* Last is not packed, ones before should not make any flags persistent */ Debug{&out} << Debug::packed << (ImageFlag2D::Array|ImageFlag2D(0xcaf0)) << Debug::packed << ImageFlags2D{} << ImageFlag2D::Array; - CORRADE_COMPARE(out.str(), "Array|0xcaf0 {} ImageFlag2D::Array\n"); + CORRADE_COMPARE(out, "Array|0xcaf0 {} ImageFlag2D::Array\n"); } void ImageFlagsTest::debugFlags3DPacked() { - std::ostringstream out; + Containers::String out; /* Last is not packed, ones before should not make any flags persistent */ Debug{&out} << Debug::packed << (ImageFlag3D::Array|ImageFlag3D::CubeMap |ImageFlag3D(0xcaf0)) << Debug::packed << ImageFlags3D{} << ImageFlag3D::Array; - CORRADE_COMPARE(out.str(), "Array|CubeMap|0xcaf0 {} ImageFlag3D::Array\n"); + CORRADE_COMPARE(out, "Array|CubeMap|0xcaf0 {} ImageFlag3D::Array\n"); } }}} diff --git a/src/Magnum/Test/ImageTest.cpp b/src/Magnum/Test/ImageTest.cpp index b7d425086..96a3cf0d1 100644 --- a/src/Magnum/Test/ImageTest.cpp +++ b/src/Magnum/Test/ImageTest.cpp @@ -29,10 +29,10 @@ arrayCast() template, which is forward-declared. */ #include "Magnum/Image.h" -#include #include +#include #include -#include +#include /** @todo remove once dataProperties() std::pair is gone */ #include "Magnum/ImageView.h" #include "Magnum/PixelFormat.h" @@ -449,24 +449,24 @@ void ImageTest::constructCompressedImplementationSpecific() { void ImageTest::constructInvalidSize() { CORRADE_SKIP_IF_NO_ASSERT(); - std::ostringstream out; + Containers::String out; Error redirectError{&out}; /* Doesn't consider alignment */ Image2D{PixelFormat::RGB8Unorm, {1, 3}, Containers::Array{3*3}}; - CORRADE_COMPARE(out.str(), "Image: data too small, got 9 but expected at least 12 bytes\n"); + CORRADE_COMPARE(out, "Image: data too small, got 9 but expected at least 12 bytes\n"); } void ImageTest::constructInvalidCubeMap() { CORRADE_SKIP_IF_NO_ASSERT(); - std::ostringstream out; + Containers::String out; Error redirectError{&out}; Image3D{PixelFormat::RGBA8Unorm, {3, 3, 5}, Containers::Array{3*3*5*4}, ImageFlag3D::CubeMap}; Image3D{PixelFormat::RGBA8Unorm, {3, 4, 6}, Containers::Array{3*4*6*4}, ImageFlag3D::CubeMap}; Image3D{PixelFormat::RGBA8Unorm, {3, 3, 17}, Containers::Array{3*3*17*4}, ImageFlag3D::CubeMap |ImageFlag3D::Array}; Image3D{PixelFormat::RGBA8Unorm, {4, 3, 18}, Containers::Array{4*3*18*4}, ImageFlag3D::CubeMap |ImageFlag3D::Array}; - CORRADE_COMPARE(out.str(), + CORRADE_COMPARE(out, "Image: expected exactly 6 faces for a cube map, got 5\n" "Image: expected square faces for a cube map, got {3, 4}\n" "Image: expected a multiple of 6 faces for a cube map array, got 17\n" @@ -478,30 +478,30 @@ void ImageTest::constructCompressedInvalidSize() { /* Too small for given format */ { - std::ostringstream out; + Containers::String out; Error redirectError{&out}; CompressedImage2D{CompressedPixelFormat::Bc2RGBAUnorm, {4, 4}, Containers::Array{2}}; - CORRADE_COMPARE(out.str(), "CompressedImage: data too small, got 2 but expected at least 4 bytes\n"); + CORRADE_COMPARE(out, "CompressedImage: data too small, got 2 but expected at least 4 bytes\n"); /* Size should be rounded up even if the image size is not full block */ } { - std::ostringstream out; + Containers::String out; Error redirectError{&out}; CompressedImage2D{CompressedPixelFormat::Bc2RGBAUnorm, {2, 2}, Containers::Array{2}}; - CORRADE_COMPARE(out.str(), "CompressedImage: data too small, got 2 but expected at least 4 bytes\n"); + CORRADE_COMPARE(out, "CompressedImage: data too small, got 2 but expected at least 4 bytes\n"); } } void ImageTest::constructCompressedInvalidCubeMap() { CORRADE_SKIP_IF_NO_ASSERT(); - std::ostringstream out; + Containers::String out; Error redirectError{&out}; CompressedImage3D{CompressedPixelFormat::Bc1RGBAUnorm, {3, 3, 5}, Containers::Array{8*5}, ImageFlag3D::CubeMap}; CompressedImage3D{CompressedPixelFormat::Bc1RGBAUnorm, {3, 4, 6}, Containers::Array{8*6}, ImageFlag3D::CubeMap}; CompressedImage3D{CompressedPixelFormat::Bc1RGBAUnorm, {3, 3, 17}, Containers::Array{8*17}, ImageFlag3D::CubeMap |ImageFlag3D::Array}; CompressedImage3D{CompressedPixelFormat::Bc1RGBAUnorm, {4, 3, 18}, Containers::Array{8*18}, ImageFlag3D::CubeMap |ImageFlag3D::Array}; - CORRADE_COMPARE(out.str(), + CORRADE_COMPARE(out, "CompressedImage: expected exactly 6 faces for a cube map, got 5\n" "CompressedImage: expected square faces for a cube map, got {3, 4}\n" "CompressedImage: expected a multiple of 6 faces for a cube map array, got 17\n" diff --git a/src/Magnum/Test/ImageViewTest.cpp b/src/Magnum/Test/ImageViewTest.cpp index c8bbf9fe5..03621bc6c 100644 --- a/src/Magnum/Test/ImageViewTest.cpp +++ b/src/Magnum/Test/ImageViewTest.cpp @@ -29,10 +29,10 @@ arrayCast() template, which is forward-declared. */ #include "Magnum/ImageView.h" -#include #include +#include #include -#include +#include /** @todo remove once dataProperties() std::pair is gone */ #include "Magnum/PixelFormat.h" #include "Magnum/Math/Color.h" @@ -662,23 +662,23 @@ void ImageViewTest::constructNullptr() { #elif defined(CORRADE_NO_ASSERT) CORRADE_SKIP("CORRADE_NO_ASSERT defined, can't test assertions"); #else - std::ostringstream out; + Containers::String out; Error redirectError{&out}; ImageView2D{PixelFormat::RGB8Unorm, {1, 3}, nullptr}; - CORRADE_COMPARE(out.str(), "ImageView: data too small, got 0 but expected at least 12 bytes\n"); + CORRADE_COMPARE(out, "ImageView: data too small, got 0 but expected at least 12 bytes\n"); #endif } void ImageViewTest::constructInvalidSize() { CORRADE_SKIP_IF_NO_ASSERT(); - std::ostringstream out; + Containers::String out; Error redirectError{&out}; /* Doesn't consider alignment */ const char data[3*3]{}; ImageView2D{PixelFormat::RGB8Unorm, {1, 3}, data}; - CORRADE_COMPARE(out.str(), "ImageView: data too small, got 9 but expected at least 12 bytes\n"); + CORRADE_COMPARE(out, "ImageView: data too small, got 9 but expected at least 12 bytes\n"); } void ImageViewTest::constructInvalidCubeMap() { @@ -686,7 +686,7 @@ void ImageViewTest::constructInvalidCubeMap() { const char data[4*3*18*4]{}; - std::ostringstream out; + Containers::String out; Error redirectError{&out}; ImageView3D{PixelFormat::RGBA8Unorm, {3, 3, 5}, data, ImageFlag3D::CubeMap}; ImageView3D{PixelFormat::RGBA8Unorm, {3, 4, 6}, data, ImageFlag3D::CubeMap}; @@ -694,7 +694,7 @@ void ImageViewTest::constructInvalidCubeMap() { ImageView3D{PixelFormat::RGBA8Unorm, {4, 3, 18}, data, ImageFlag3D::CubeMap |ImageFlag3D::Array}; /* The data-less variant should call into the same assertion helper */ ImageView3D{PixelFormat::RGBA8Unorm, {3, 3, 5}, ImageFlag3D::CubeMap}; - CORRADE_COMPARE(out.str(), + CORRADE_COMPARE(out, "ImageView: expected exactly 6 faces for a cube map, got 5\n" "ImageView: expected square faces for a cube map, got {3, 4}\n" "ImageView: expected a multiple of 6 faces for a cube map array, got 17\n" @@ -709,17 +709,17 @@ void ImageViewTest::constructCompressedInvalidSize() { /* Too small for given format */ { - std::ostringstream out; + Containers::String out; Error redirectError{&out}; CompressedImageView2D{CompressedPixelFormat::Bc2RGBAUnorm, {4, 4}, data}; - CORRADE_COMPARE(out.str(), "CompressedImageView: data too small, got 2 but expected at least 4 bytes\n"); + CORRADE_COMPARE(out, "CompressedImageView: data too small, got 2 but expected at least 4 bytes\n"); /* Size should be rounded up even if the image size is not full block */ } { - std::ostringstream out; + Containers::String out; Error redirectError{&out}; CompressedImageView2D{CompressedPixelFormat::Bc2RGBAUnorm, {2, 2}, data}; - CORRADE_COMPARE(out.str(), "CompressedImageView: data too small, got 2 but expected at least 4 bytes\n"); + CORRADE_COMPARE(out, "CompressedImageView: data too small, got 2 but expected at least 4 bytes\n"); } } @@ -728,7 +728,7 @@ void ImageViewTest::constructCompressedInvalidCubeMap() { const char data[8*18]{}; - std::ostringstream out; + Containers::String out; Error redirectError{&out}; CompressedImageView3D{CompressedPixelFormat::Bc1RGBAUnorm, {3, 3, 5}, data, ImageFlag3D::CubeMap}; CompressedImageView3D{CompressedPixelFormat::Bc1RGBAUnorm, {3, 4, 6}, data, ImageFlag3D::CubeMap}; @@ -736,7 +736,7 @@ void ImageViewTest::constructCompressedInvalidCubeMap() { CompressedImageView3D{CompressedPixelFormat::Bc1RGBAUnorm, {4, 3, 18}, data, ImageFlag3D::CubeMap |ImageFlag3D::Array}; /* The data-less variant should call into the same assertion helper */ CompressedImageView3D{CompressedPixelFormat::Bc1RGBAUnorm, {3, 3, 5}, ImageFlag3D::CubeMap}; - CORRADE_COMPARE(out.str(), + CORRADE_COMPARE(out, "CompressedImageView: expected exactly 6 faces for a cube map, got 5\n" "CompressedImageView: expected square faces for a cube map, got {3, 4}\n" "CompressedImageView: expected a multiple of 6 faces for a cube map array, got 17\n" @@ -804,7 +804,7 @@ template void ImageViewTest::setDataCompressed() { void ImageViewTest::setDataInvalidSize() { CORRADE_SKIP_IF_NO_ASSERT(); - std::ostringstream out; + Containers::String out; Error redirectError{&out}; ImageView2D image{PixelFormat::RGB8Unorm, {1, 3}}; @@ -812,7 +812,7 @@ void ImageViewTest::setDataInvalidSize() { /* Doesn't consider alignment */ image.setData(data); - CORRADE_COMPARE(out.str(), "ImageView::setData(): data too small, got 9 but expected at least 12 bytes\n"); + CORRADE_COMPARE(out, "ImageView::setData(): data too small, got 9 but expected at least 12 bytes\n"); } void ImageViewTest::setDataCompressedInvalidSize() { @@ -822,17 +822,17 @@ void ImageViewTest::setDataCompressedInvalidSize() { /* Too small for given format */ { - std::ostringstream out; + Containers::String out; Error redirectError{&out}; CompressedImageView2D{CompressedPixelFormat::Bc2RGBAUnorm, {4, 4}, data}; - CORRADE_COMPARE(out.str(), "CompressedImageView::setData(): data too small, got 2 but expected at least 4 bytes\n"); + CORRADE_COMPARE(out, "CompressedImageView::setData(): data too small, got 2 but expected at least 4 bytes\n"); /* Size should be rounded up even if the image size is not that big */ } { - std::ostringstream out; + Containers::String out; Error redirectError{&out}; CompressedImageView2D{CompressedPixelFormat::Bc2RGBAUnorm, {2, 2}, data}; - CORRADE_COMPARE(out.str(), "CompressedImageView::setData(): data too small, got 2 but expected at least 4 bytes\n"); + CORRADE_COMPARE(out, "CompressedImageView::setData(): data too small, got 2 but expected at least 4 bytes\n"); } } diff --git a/src/Magnum/Test/MeshTest.cpp b/src/Magnum/Test/MeshTest.cpp index 08aa7111d..2bc96e154 100644 --- a/src/Magnum/Test/MeshTest.cpp +++ b/src/Magnum/Test/MeshTest.cpp @@ -24,10 +24,9 @@ DEALINGS IN THE SOFTWARE. */ -#include #include #include -#include +#include /** @todo remove once Configuration is std::string-free */ #include "Magnum/Mesh.h" #include "Magnum/Math/Vector4.h" @@ -151,12 +150,12 @@ void MeshTest::primitiveWrap() { void MeshTest::primitiveWrapInvalid() { CORRADE_SKIP_IF_NO_ASSERT(); - std::ostringstream out; + Containers::String out; Error redirectError{&out}; meshPrimitiveWrap(0xdeadbeef); - CORRADE_COMPARE(out.str(), "meshPrimitiveWrap(): implementation-specific value 0xdeadbeef already wrapped or too large\n"); + CORRADE_COMPARE(out, "meshPrimitiveWrap(): implementation-specific value 0xdeadbeef already wrapped or too large\n"); } void MeshTest::primitiveUnwrap() { @@ -167,12 +166,12 @@ void MeshTest::primitiveUnwrap() { void MeshTest::primitiveUnwrapInvalid() { CORRADE_SKIP_IF_NO_ASSERT(); - std::ostringstream out; + Containers::String out; Error redirectError{&out}; meshPrimitiveUnwrap(MeshPrimitive::Triangles); - CORRADE_COMPARE(out.str(), "meshPrimitiveUnwrap(): MeshPrimitive::Triangles isn't a wrapped implementation-specific value\n"); + CORRADE_COMPARE(out, "meshPrimitiveUnwrap(): MeshPrimitive::Triangles isn't a wrapped implementation-specific value\n"); } void MeshTest::indexTypeMapping() { @@ -228,10 +227,10 @@ void MeshTest::indexTypeWrap() { void MeshTest::indexTypeWrapInvalid() { CORRADE_SKIP_IF_NO_ASSERT(); - std::ostringstream out; + Containers::String out; Error redirectError{&out}; meshIndexTypeWrap(0xdeadbeef); - CORRADE_COMPARE(out.str(), "meshIndexTypeWrap(): implementation-specific value 0xdeadbeef already wrapped or too large\n"); + CORRADE_COMPARE(out, "meshIndexTypeWrap(): implementation-specific value 0xdeadbeef already wrapped or too large\n"); } void MeshTest::indexTypeUnwrap() { @@ -242,12 +241,12 @@ void MeshTest::indexTypeUnwrap() { void MeshTest::indexTypeUnwrapInvalid() { CORRADE_SKIP_IF_NO_ASSERT(); - std::ostringstream out; + Containers::String out; Error redirectError{&out}; meshIndexTypeUnwrap(MeshIndexType::UnsignedInt); - CORRADE_COMPARE(out.str(), "meshIndexTypeUnwrap(): MeshIndexType::UnsignedInt isn't a wrapped implementation-specific value\n"); + CORRADE_COMPARE(out, "meshIndexTypeUnwrap(): MeshIndexType::UnsignedInt isn't a wrapped implementation-specific value\n"); } void MeshTest::indexTypeSize() { @@ -259,13 +258,13 @@ void MeshTest::indexTypeSize() { void MeshTest::indexTypeSizeInvalid() { CORRADE_SKIP_IF_NO_ASSERT(); - std::ostringstream out; + Containers::String out; Error redirectError{&out}; meshIndexTypeSize(MeshIndexType{}); meshIndexTypeSize(MeshIndexType(0xbadcafe)); - CORRADE_COMPARE(out.str(), + CORRADE_COMPARE(out, "meshIndexTypeSize(): invalid type MeshIndexType(0x0)\n" "meshIndexTypeSize(): invalid type MeshIndexType(0xbadcafe)\n"); } @@ -273,64 +272,64 @@ void MeshTest::indexTypeSizeInvalid() { void MeshTest::indexTypeSizeImplementationSpecific() { CORRADE_SKIP_IF_NO_ASSERT(); - std::ostringstream out; + Containers::String out; Error redirectError{&out}; meshIndexTypeSize(meshIndexTypeWrap(0xdead)); - CORRADE_COMPARE(out.str(), "meshIndexTypeSize(): can't determine size of an implementation-specific type 0xdead\n"); + CORRADE_COMPARE(out, "meshIndexTypeSize(): can't determine size of an implementation-specific type 0xdead\n"); } void MeshTest::debugPrimitive() { - std::ostringstream o; - Debug(&o) << MeshPrimitive::TriangleFan << MeshPrimitive(0x70fe); - CORRADE_COMPARE(o.str(), "MeshPrimitive::TriangleFan MeshPrimitive(0x70fe)\n"); + Containers::String out; + Debug{&out} << MeshPrimitive::TriangleFan << MeshPrimitive(0x70fe); + CORRADE_COMPARE(out, "MeshPrimitive::TriangleFan MeshPrimitive(0x70fe)\n"); } void MeshTest::debugPrimitivePacked() { - std::ostringstream out; + Containers::String out; /* Last is not packed, ones before should not make any flags persistent */ Debug{&out} << Debug::packed << MeshPrimitive::TriangleFan << Debug::packed << MeshPrimitive(0x70fe) << MeshPrimitive::Triangles; - CORRADE_COMPARE(out.str(), "TriangleFan 0x70fe MeshPrimitive::Triangles\n"); + CORRADE_COMPARE(out, "TriangleFan 0x70fe MeshPrimitive::Triangles\n"); } void MeshTest::debugPrimitiveImplementationSpecific() { - std::ostringstream out; + Containers::String out; Debug{&out} << meshPrimitiveWrap(0xdead); - CORRADE_COMPARE(out.str(), "MeshPrimitive::ImplementationSpecific(0xdead)\n"); + CORRADE_COMPARE(out, "MeshPrimitive::ImplementationSpecific(0xdead)\n"); } void MeshTest::debugPrimitiveImplementationSpecificPacked() { - std::ostringstream out; + Containers::String out; /* Second is not packed, the first should not make any flags persistent */ Debug{&out} << Debug::packed << meshPrimitiveWrap(0xdead) << MeshPrimitive::Triangles; - CORRADE_COMPARE(out.str(), "ImplementationSpecific(0xdead) MeshPrimitive::Triangles\n"); + CORRADE_COMPARE(out, "ImplementationSpecific(0xdead) MeshPrimitive::Triangles\n"); } void MeshTest::debugIndexType() { - std::ostringstream o; - Debug(&o) << MeshIndexType::UnsignedShort << MeshIndexType(0x70fe); - CORRADE_COMPARE(o.str(), "MeshIndexType::UnsignedShort MeshIndexType(0x70fe)\n"); + Containers::String out; + Debug{&out} << MeshIndexType::UnsignedShort << MeshIndexType(0x70fe); + CORRADE_COMPARE(out, "MeshIndexType::UnsignedShort MeshIndexType(0x70fe)\n"); } void MeshTest::debugIndexTypePacked() { - std::ostringstream out; + Containers::String out; /* Last is not packed, ones before should not make any flags persistent */ Debug(&out) << Debug::packed << MeshIndexType::UnsignedShort << Debug::packed << MeshIndexType(0x70fe) << MeshIndexType::UnsignedInt; - CORRADE_COMPARE(out.str(), "UnsignedShort 0x70fe MeshIndexType::UnsignedInt\n"); + CORRADE_COMPARE(out, "UnsignedShort 0x70fe MeshIndexType::UnsignedInt\n"); } void MeshTest::debugIndexTypeImplementationSpecific() { - std::ostringstream out; + Containers::String out; Debug{&out} << meshIndexTypeWrap(0xdead); - CORRADE_COMPARE(out.str(), "MeshIndexType::ImplementationSpecific(0xdead)\n"); + CORRADE_COMPARE(out, "MeshIndexType::ImplementationSpecific(0xdead)\n"); } void MeshTest::debugIndexTypeImplementationSpecificPacked() { - std::ostringstream out; + Containers::String out; /* Second is not packed, the first should not make any flags persistent */ Debug{&out} << Debug::packed << meshIndexTypeWrap(0xdead) << MeshIndexType::UnsignedInt; - CORRADE_COMPARE(out.str(), "ImplementationSpecific(0xdead) MeshIndexType::UnsignedInt\n"); + CORRADE_COMPARE(out, "ImplementationSpecific(0xdead) MeshIndexType::UnsignedInt\n"); } void MeshTest::configurationPrimitive() { diff --git a/src/Magnum/Test/PixelFormatTest.cpp b/src/Magnum/Test/PixelFormatTest.cpp index 9395c070d..7f2240a50 100644 --- a/src/Magnum/Test/PixelFormatTest.cpp +++ b/src/Magnum/Test/PixelFormatTest.cpp @@ -24,12 +24,12 @@ DEALINGS IN THE SOFTWARE. */ -#include +#include /* arraySize() */ #include #include #include -#include #include +#include /** @todo remove once Configuration is std::string-free */ #include "Magnum/PixelFormat.h" #include "Magnum/Math/Vector3.h" @@ -307,13 +307,13 @@ void PixelFormatTest::size() { void PixelFormatTest::sizeInvalid() { CORRADE_SKIP_IF_NO_ASSERT(); - std::ostringstream out; + Containers::String out; Error redirectError{&out}; pixelFormatSize(PixelFormat{}); pixelFormatSize(PixelFormat(0xdead)); - CORRADE_COMPARE(out.str(), + CORRADE_COMPARE(out, "pixelFormatSize(): invalid format PixelFormat(0x0)\n" "pixelFormatSize(): invalid format PixelFormat(0xdead)\n"); } @@ -321,12 +321,12 @@ void PixelFormatTest::sizeInvalid() { void PixelFormatTest::sizeImplementationSpecific() { CORRADE_SKIP_IF_NO_ASSERT(); - std::ostringstream out; + Containers::String out; Error redirectError{&out}; pixelFormatSize(pixelFormatWrap(0xdead)); - CORRADE_COMPARE(out.str(), "pixelFormatSize(): can't determine size of an implementation-specific format 0xdead\n"); + CORRADE_COMPARE(out, "pixelFormatSize(): can't determine size of an implementation-specific format 0xdead\n"); } void PixelFormatTest::channelFormatCount() { @@ -353,13 +353,13 @@ void PixelFormatTest::channelFormatCount() { void PixelFormatTest::channelFormatCountInvalid() { CORRADE_SKIP_IF_NO_ASSERT(); - std::ostringstream out; + Containers::String out; Error redirectError{&out}; pixelFormatChannelFormat(PixelFormat{}); pixelFormatChannelFormat(PixelFormat(0xdead)); pixelFormatChannelCount(PixelFormat{}); pixelFormatChannelCount(PixelFormat(0xdead)); - CORRADE_COMPARE(out.str(), + CORRADE_COMPARE(out, "pixelFormatChannelFormat(): invalid format PixelFormat(0x0)\n" "pixelFormatChannelFormat(): invalid format PixelFormat(0xdead)\n" "pixelFormatChannelCount(): invalid format PixelFormat(0x0)\n" @@ -369,13 +369,13 @@ void PixelFormatTest::channelFormatCountInvalid() { void PixelFormatTest::channelFormatCountDepthStencilImplementationSpecific() { CORRADE_SKIP_IF_NO_ASSERT(); - std::ostringstream out; + Containers::String out; Error redirectError{&out}; pixelFormatChannelFormat(pixelFormatWrap(0xdead)); pixelFormatChannelFormat(PixelFormat::Depth16Unorm); pixelFormatChannelCount(pixelFormatWrap(0xdead)); pixelFormatChannelCount(PixelFormat::Depth16Unorm); - CORRADE_COMPARE(out.str(), + CORRADE_COMPARE(out, "pixelFormatChannelFormat(): can't determine channel format of an implementation-specific format 0xdead\n" "pixelFormatChannelFormat(): can't determine channel format of PixelFormat::Depth16Unorm\n" "pixelFormatChannelCount(): can't determine channel count of an implementation-specific format 0xdead\n" @@ -406,7 +406,7 @@ void PixelFormatTest::isNormalizedIntegralFloatingPoint() { void PixelFormatTest::isNormalizedIntegralFloatingPointInvalid() { CORRADE_SKIP_IF_NO_ASSERT(); - std::ostringstream out; + Containers::String out; Error redirectError{&out}; isPixelFormatNormalized(PixelFormat{}); isPixelFormatNormalized(PixelFormat(0xdead)); @@ -414,7 +414,7 @@ void PixelFormatTest::isNormalizedIntegralFloatingPointInvalid() { isPixelFormatIntegral(PixelFormat(0xdead)); isPixelFormatFloatingPoint(PixelFormat{}); isPixelFormatFloatingPoint(PixelFormat(0xdead)); - CORRADE_COMPARE(out.str(), + CORRADE_COMPARE(out, "isPixelFormatNormalized(): invalid format PixelFormat(0x0)\n" "isPixelFormatNormalized(): invalid format PixelFormat(0xdead)\n" "isPixelFormatIntegral(): invalid format PixelFormat(0x0)\n" @@ -426,7 +426,7 @@ void PixelFormatTest::isNormalizedIntegralFloatingPointInvalid() { void PixelFormatTest::isNormalizedIntegralFloatingPointDepthStencilImplementationSpecific() { CORRADE_SKIP_IF_NO_ASSERT(); - std::ostringstream out; + Containers::String out; Error redirectError{&out}; isPixelFormatNormalized(pixelFormatWrap(0xdead)); isPixelFormatNormalized(PixelFormat::Depth24UnormStencil8UI); @@ -434,7 +434,7 @@ void PixelFormatTest::isNormalizedIntegralFloatingPointDepthStencilImplementatio isPixelFormatIntegral(PixelFormat::Stencil8UI); isPixelFormatFloatingPoint(pixelFormatWrap(0xdead)); isPixelFormatFloatingPoint(PixelFormat::Depth16UnormStencil8UI); - CORRADE_COMPARE_AS(out.str(), + CORRADE_COMPARE_AS(out, "isPixelFormatNormalized(): can't determine type of an implementation-specific format 0xdead\n" "isPixelFormatNormalized(): can't determine type of PixelFormat::Depth24UnormStencil8UI\n" "isPixelFormatIntegral(): can't determine type of an implementation-specific format 0xdead\n" @@ -456,11 +456,11 @@ void PixelFormatTest::isSrgb() { void PixelFormatTest::isSrgbInvalid() { CORRADE_SKIP_IF_NO_ASSERT(); - std::ostringstream out; + Containers::String out; Error redirectError{&out}; isPixelFormatSrgb(PixelFormat{}); isPixelFormatSrgb(PixelFormat(0xdead)); - CORRADE_COMPARE(out.str(), + CORRADE_COMPARE(out, "isPixelFormatSrgb(): invalid format PixelFormat(0x0)\n" "isPixelFormatSrgb(): invalid format PixelFormat(0xdead)\n"); } @@ -468,11 +468,11 @@ void PixelFormatTest::isSrgbInvalid() { void PixelFormatTest::isSrgbDepthStencilImplementationSpecific() { CORRADE_SKIP_IF_NO_ASSERT(); - std::ostringstream out; + Containers::String out; Error redirectError{&out}; isPixelFormatSrgb(pixelFormatWrap(0xdead)); isPixelFormatSrgb(PixelFormat::Depth16Unorm); - CORRADE_COMPARE(out.str(), + CORRADE_COMPARE(out, "isPixelFormatSrgb(): can't determine colorspace of an implementation-specific format 0xdead\n" "isPixelFormatSrgb(): can't determine colorspace of PixelFormat::Depth16Unorm\n"); } @@ -486,11 +486,11 @@ void PixelFormatTest::isDepthOrStencil() { void PixelFormatTest::isDepthOrStencilInvalid() { CORRADE_SKIP_IF_NO_ASSERT(); - std::ostringstream out; + Containers::String out; Error redirectError{&out}; isPixelFormatDepthOrStencil(PixelFormat{}); isPixelFormatDepthOrStencil(PixelFormat(0xdead)); - CORRADE_COMPARE(out.str(), + CORRADE_COMPARE(out, "isPixelFormatDepthOrStencil(): invalid format PixelFormat(0x0)\n" "isPixelFormatDepthOrStencil(): invalid format PixelFormat(0xdead)\n"); } @@ -498,10 +498,10 @@ void PixelFormatTest::isDepthOrStencilInvalid() { void PixelFormatTest::isDepthOrStencilImplementationSpecific() { CORRADE_SKIP_IF_NO_ASSERT(); - std::ostringstream out; + Containers::String out; Error redirectError{&out}; isPixelFormatDepthOrStencil(pixelFormatWrap(0xdead)); - CORRADE_COMPARE(out.str(), + CORRADE_COMPARE(out, "isPixelFormatDepthOrStencil(): can't determine type of an implementation-specific format 0xdead\n"); } @@ -522,13 +522,13 @@ void PixelFormatTest::assemble() { void PixelFormatTest::assembleRoundtrip() { auto&& data = AssembleRoundtripData[testCaseInstanceId()]; - std::ostringstream out; + Containers::String out; { Debug d{&out, Debug::Flag::NoNewlineAtTheEnd}; d << data.channelType; if(data.srgb) d << Debug::nospace << ", srgb"; } - setTestCaseDescription(out.str()); + setTestCaseDescription(out); PixelFormat result = pixelFormat(data.channelType, testCaseRepeatId() + 1, data.srgb); CORRADE_COMPARE(pixelFormat(result, testCaseRepeatId() + 1, data.srgb), result); @@ -540,12 +540,12 @@ void PixelFormatTest::assembleRoundtrip() { void PixelFormatTest::assembleInvalidSrgb() { CORRADE_SKIP_IF_NO_ASSERT(); - std::ostringstream out; + Containers::String out; Error redirectError{&out}; pixelFormat(PixelFormat::R8Snorm, 1, true); pixelFormat(PixelFormat::RGB16Unorm, 4, true); pixelFormat(PixelFormat::RGBA16F, 3, true); - CORRADE_COMPARE(out.str(), + CORRADE_COMPARE(out, "pixelFormat(): PixelFormat::R8Snorm can't be made sRGB\n" "pixelFormat(): PixelFormat::RGB16Unorm can't be made sRGB\n" "pixelFormat(): PixelFormat::RGBA16F can't be made sRGB\n"); @@ -554,11 +554,11 @@ void PixelFormatTest::assembleInvalidSrgb() { void PixelFormatTest::assembleInvalidComponentCount() { CORRADE_SKIP_IF_NO_ASSERT(); - std::ostringstream out; + Containers::String out; Error redirectError{&out}; pixelFormat(PixelFormat::RGB8Unorm, 0, false); pixelFormat(PixelFormat::RGB8Unorm, 5, false); - CORRADE_COMPARE(out.str(), + CORRADE_COMPARE(out, "pixelFormat(): invalid component count 0\n" "pixelFormat(): invalid component count 5\n"); } @@ -566,11 +566,11 @@ void PixelFormatTest::assembleInvalidComponentCount() { void PixelFormatTest::assembleDepthStencilImplementationSpecific() { CORRADE_SKIP_IF_NO_ASSERT(); - std::ostringstream out; + Containers::String out; Error redirectError{&out}; pixelFormat(pixelFormatWrap(0xdead), 1, true); pixelFormat(PixelFormat::Depth32F, 1, true); - CORRADE_COMPARE(out.str(), + CORRADE_COMPARE(out, "pixelFormat(): can't assemble a format out of an implementation-specific format 0xdead\n" "pixelFormat(): can't assemble a format out of PixelFormat::Depth32F\n"); } @@ -591,7 +591,7 @@ void PixelFormatTest::compressedBlockSize() { void PixelFormatTest::compressedBlockSizeInvalid() { CORRADE_SKIP_IF_NO_ASSERT(); - std::ostringstream out; + Containers::String out; Error redirectError{&out}; compressedPixelFormatBlockSize(CompressedPixelFormat{}); @@ -599,7 +599,7 @@ void PixelFormatTest::compressedBlockSizeInvalid() { compressedPixelFormatBlockDataSize(CompressedPixelFormat{}); compressedPixelFormatBlockDataSize(CompressedPixelFormat(0xdead)); - CORRADE_COMPARE(out.str(), + CORRADE_COMPARE(out, "compressedPixelFormatBlockSize(): invalid format CompressedPixelFormat(0x0)\n" "compressedPixelFormatBlockSize(): invalid format CompressedPixelFormat(0xdead)\n" "compressedPixelFormatBlockDataSize(): invalid format CompressedPixelFormat(0x0)\n" @@ -609,13 +609,13 @@ void PixelFormatTest::compressedBlockSizeInvalid() { void PixelFormatTest::compressedBlockSizeImplementationSpecific() { CORRADE_SKIP_IF_NO_ASSERT(); - std::ostringstream out; + Containers::String out; Error redirectError{&out}; compressedPixelFormatBlockSize(compressedPixelFormatWrap(0xdead)); compressedPixelFormatBlockDataSize(compressedPixelFormatWrap(0xdead)); - CORRADE_COMPARE(out.str(), + CORRADE_COMPARE(out, "compressedPixelFormatBlockSize(): can't determine size of an implementation-specific format 0xdead\n" "compressedPixelFormatBlockDataSize(): can't determine size of an implementation-specific format 0xdead\n"); } @@ -644,13 +644,13 @@ void PixelFormatTest::compressedIsNormalizedFloatingPoint() { void PixelFormatTest::compressedIsNormalizedFloatingPointInvalid() { CORRADE_SKIP_IF_NO_ASSERT(); - std::ostringstream out; + Containers::String out; Error redirectError{&out}; isCompressedPixelFormatNormalized(CompressedPixelFormat{}); isCompressedPixelFormatNormalized(CompressedPixelFormat(0xdead)); isCompressedPixelFormatFloatingPoint(CompressedPixelFormat{}); isCompressedPixelFormatFloatingPoint(CompressedPixelFormat(0xdead)); - CORRADE_COMPARE(out.str(), + CORRADE_COMPARE(out, "isCompressedPixelFormatNormalized(): invalid format CompressedPixelFormat(0x0)\n" "isCompressedPixelFormatNormalized(): invalid format CompressedPixelFormat(0xdead)\n" "isCompressedPixelFormatFloatingPoint(): invalid format CompressedPixelFormat(0x0)\n" @@ -660,11 +660,11 @@ void PixelFormatTest::compressedIsNormalizedFloatingPointInvalid() { void PixelFormatTest::compressedIsNormalizedFloatingPointImplementationSpecific() { CORRADE_SKIP_IF_NO_ASSERT(); - std::ostringstream out; + Containers::String out; Error redirectError{&out}; isCompressedPixelFormatNormalized(compressedPixelFormatWrap(0xdead)); isCompressedPixelFormatFloatingPoint(compressedPixelFormatWrap(0xdead)); - CORRADE_COMPARE_AS(out.str(), + CORRADE_COMPARE_AS(out, "isCompressedPixelFormatNormalized(): can't determine type of an implementation-specific format 0xdead\n" "isCompressedPixelFormatFloatingPoint(): can't determine type of an implementation-specific format 0xdead\n", TestSuite::Compare::String); @@ -682,11 +682,11 @@ void PixelFormatTest::compressedIsSrgb() { void PixelFormatTest::compressedIsSrgbInvalid() { CORRADE_SKIP_IF_NO_ASSERT(); - std::ostringstream out; + Containers::String out; Error redirectError{&out}; isCompressedPixelFormatSrgb(CompressedPixelFormat{}); isCompressedPixelFormatSrgb(CompressedPixelFormat(0xdead)); - CORRADE_COMPARE(out.str(), + CORRADE_COMPARE(out, "isCompressedPixelFormatSrgb(): invalid format CompressedPixelFormat(0x0)\n" "isCompressedPixelFormatSrgb(): invalid format CompressedPixelFormat(0xdead)\n"); } @@ -694,10 +694,10 @@ void PixelFormatTest::compressedIsSrgbInvalid() { void PixelFormatTest::compressedIsSrgbImplementationSpecific() { CORRADE_SKIP_IF_NO_ASSERT(); - std::ostringstream out; + Containers::String out; Error redirectError{&out}; isCompressedPixelFormatSrgb(compressedPixelFormatWrap(0xdead)); - CORRADE_COMPARE(out.str(), + CORRADE_COMPARE(out, "isCompressedPixelFormatSrgb(): can't determine colorspace of an implementation-specific format 0xdead\n"); } @@ -716,12 +716,12 @@ void PixelFormatTest::wrap() { void PixelFormatTest::wrapInvalid() { CORRADE_SKIP_IF_NO_ASSERT(); - std::ostringstream out; + Containers::String out; Error redirectError{&out}; pixelFormatWrap(0xdeadbeef); - CORRADE_COMPARE(out.str(), "pixelFormatWrap(): implementation-specific value 0xdeadbeef already wrapped or too large\n"); + CORRADE_COMPARE(out, "pixelFormatWrap(): implementation-specific value 0xdeadbeef already wrapped or too large\n"); } void PixelFormatTest::unwrap() { @@ -732,12 +732,12 @@ void PixelFormatTest::unwrap() { void PixelFormatTest::unwrapInvalid() { CORRADE_SKIP_IF_NO_ASSERT(); - std::ostringstream out; + Containers::String out; Error redirectError{&out}; pixelFormatUnwrap(PixelFormat::R8Snorm); - CORRADE_COMPARE(out.str(), "pixelFormatUnwrap(): PixelFormat::R8Snorm isn't a wrapped implementation-specific value\n"); + CORRADE_COMPARE(out, "pixelFormatUnwrap(): PixelFormat::R8Snorm isn't a wrapped implementation-specific value\n"); } void PixelFormatTest::compressedIsImplementationSpecific() { @@ -752,12 +752,12 @@ void PixelFormatTest::compressedWrap() { void PixelFormatTest::compressedWrapInvalid() { CORRADE_SKIP_IF_NO_ASSERT(); - std::ostringstream out; + Containers::String out; Error redirectError{&out}; compressedPixelFormatWrap(0xdeadbeef); - CORRADE_COMPARE(out.str(), "compressedPixelFormatWrap(): implementation-specific value 0xdeadbeef already wrapped or too large\n"); + CORRADE_COMPARE(out, "compressedPixelFormatWrap(): implementation-specific value 0xdeadbeef already wrapped or too large\n"); } void PixelFormatTest::compressedUnwrap() { @@ -767,72 +767,72 @@ void PixelFormatTest::compressedUnwrap() { void PixelFormatTest::compressedUnwrapInvalid() { CORRADE_SKIP_IF_NO_ASSERT(); - std::ostringstream out; + Containers::String out; Error redirectError{&out}; compressedPixelFormatUnwrap(CompressedPixelFormat::EacR11Snorm); - CORRADE_COMPARE(out.str(), "compressedPixelFormatUnwrap(): CompressedPixelFormat::EacR11Snorm isn't a wrapped implementation-specific value\n"); + CORRADE_COMPARE(out, "compressedPixelFormatUnwrap(): CompressedPixelFormat::EacR11Snorm isn't a wrapped implementation-specific value\n"); } void PixelFormatTest::debug() { - std::ostringstream out; + Containers::String out; Debug{&out} << PixelFormat::RG16Snorm << PixelFormat(0xdead); - CORRADE_COMPARE(out.str(), "PixelFormat::RG16Snorm PixelFormat(0xdead)\n"); + CORRADE_COMPARE(out, "PixelFormat::RG16Snorm PixelFormat(0xdead)\n"); } void PixelFormatTest::debugPacked() { - std::ostringstream out; + Containers::String out; /* Last is not packed, ones before should not make any flags persistent */ Debug{&out} << Debug::packed << PixelFormat::RG16Snorm << Debug::packed << PixelFormat(0xdead) << PixelFormat::RGBA8Unorm; - CORRADE_COMPARE(out.str(), "RG16Snorm 0xdead PixelFormat::RGBA8Unorm\n"); + CORRADE_COMPARE(out, "RG16Snorm 0xdead PixelFormat::RGBA8Unorm\n"); } void PixelFormatTest::debugImplementationSpecific() { - std::ostringstream out; + Containers::String out; Debug{&out} << pixelFormatWrap(0xdead); - CORRADE_COMPARE(out.str(), "PixelFormat::ImplementationSpecific(0xdead)\n"); + CORRADE_COMPARE(out, "PixelFormat::ImplementationSpecific(0xdead)\n"); } void PixelFormatTest::debugImplementationSpecificPacked() { - std::ostringstream out; + Containers::String out; /* Second is not packed, the first should not make any flags persistent */ Debug{&out} << Debug::packed << pixelFormatWrap(0xdead) << PixelFormat::RGBA8Unorm; - CORRADE_COMPARE(out.str(), "ImplementationSpecific(0xdead) PixelFormat::RGBA8Unorm\n"); + CORRADE_COMPARE(out, "ImplementationSpecific(0xdead) PixelFormat::RGBA8Unorm\n"); } void PixelFormatTest::compressedDebug() { - std::ostringstream out; + Containers::String out; Debug{&out} << CompressedPixelFormat::Bc3RGBAUnorm << CompressedPixelFormat(0xdead); - CORRADE_COMPARE(out.str(), "CompressedPixelFormat::Bc3RGBAUnorm CompressedPixelFormat(0xdead)\n"); + CORRADE_COMPARE(out, "CompressedPixelFormat::Bc3RGBAUnorm CompressedPixelFormat(0xdead)\n"); } void PixelFormatTest::compressedDebugPacked() { - std::ostringstream out; + Containers::String out; /* Last is not packed, ones before should not make any flags persistent */ Debug{&out} << Debug::packed << CompressedPixelFormat::Bc3RGBAUnorm << Debug::packed << CompressedPixelFormat(0xdead) << CompressedPixelFormat::Astc10x10RGBAF; - CORRADE_COMPARE(out.str(), "Bc3RGBAUnorm 0xdead CompressedPixelFormat::Astc10x10RGBAF\n"); + CORRADE_COMPARE(out, "Bc3RGBAUnorm 0xdead CompressedPixelFormat::Astc10x10RGBAF\n"); } void PixelFormatTest::compressedDebugImplementationSpecific() { - std::ostringstream out; + Containers::String out; Debug{&out} << compressedPixelFormatWrap(0xdead); - CORRADE_COMPARE(out.str(), "CompressedPixelFormat::ImplementationSpecific(0xdead)\n"); + CORRADE_COMPARE(out, "CompressedPixelFormat::ImplementationSpecific(0xdead)\n"); } void PixelFormatTest::compressedDebugImplementationSpecificPacked() { - std::ostringstream out; + Containers::String out; /* Second is not packed, the first should not make any flags persistent */ Debug{&out} << compressedPixelFormatWrap(0xdead) << CompressedPixelFormat::Astc10x10RGBAF; - CORRADE_COMPARE(out.str(), "CompressedPixelFormat::ImplementationSpecific(0xdead) CompressedPixelFormat::Astc10x10RGBAF\n"); + CORRADE_COMPARE(out, "CompressedPixelFormat::ImplementationSpecific(0xdead) CompressedPixelFormat::Astc10x10RGBAF\n"); } void PixelFormatTest::configuration() { diff --git a/src/Magnum/Test/ResourceManagerTest.cpp b/src/Magnum/Test/ResourceManagerTest.cpp index 39bc44979..dfeb10c42 100644 --- a/src/Magnum/Test/ResourceManagerTest.cpp +++ b/src/Magnum/Test/ResourceManagerTest.cpp @@ -25,9 +25,10 @@ DEALINGS IN THE SOFTWARE. */ -#include +#include #include -#include +#include +#include /** @todo remove once HashDigest is std::string-free */ #include "Magnum/AbstractResourceLoader.h" #include "Magnum/ResourceManager.h" @@ -266,16 +267,16 @@ void ResourceManagerTest::stateDisallowed() { ResourceManager rm; - std::ostringstream out; + Containers::String out; Error redirectError{&out}; Data d; /* Done this way to prevent memory leak on assertion (yes, the code is bad) */ rm.set("data", &d, ResourceDataState::Loading, ResourcePolicy::Resident); - CORRADE_COMPARE(out.str(), "ResourceManager::set(): data should be null if and only if state is NotFound or Loading\n"); + CORRADE_COMPARE(out, "ResourceManager::set(): data should be null if and only if state is NotFound or Loading\n"); - out.str({}); + out = {}; rm.set("data", nullptr, ResourceDataState::Final, ResourcePolicy::Resident); - CORRADE_COMPARE(out.str(), "ResourceManager::set(): data should be null if and only if state is NotFound or Loading\n"); + CORRADE_COMPARE(out, "ResourceManager::set(): data should be null if and only if state is NotFound or Loading\n"); } void ResourceManagerTest::basic() { @@ -315,12 +316,12 @@ void ResourceManagerTest::changeFinalResource() { CORRADE_COMPARE(rm.count(), 1); /* Final can not be changed */ - std::ostringstream out; + Containers::String out; Error redirectError{&out}; int a = 43; /* Done this way to prevent a memory leak on assert (yes, the code is bad) */ rm.set(answerKey, &a, ResourceDataState::Mutable, ResourcePolicy::Resident); CORRADE_COMPARE(*theAnswer, 42); - CORRADE_COMPARE(out.str(), Utility::formatString("ResourceManager::set(): cannot change already final resource ResourceKey(0x{})\n", answerKey.hexString())); + CORRADE_COMPARE(out, Utility::format("ResourceManager::set(): cannot change already final resource ResourceKey(0x{})\n", answerKey.hexString())); } void ResourceManagerTest::residentPolicy() { @@ -413,7 +414,7 @@ void ResourceManagerTest::clearWhileReferenced() { /* Should cover also the destruction case */ - std::ostringstream out; + Containers::String out; Error redirectError{&out}; ResourceManager rm; @@ -424,7 +425,7 @@ void ResourceManagerTest::clearWhileReferenced() { new Resource(rm.get("blah")); rm.clear(); - CORRADE_COMPARE(out.str(), "ResourceManager: cleared/destroyed while data are still referenced\n"); + CORRADE_COMPARE(out, "ResourceManager: cleared/destroyed while data are still referenced\n"); } void ResourceManagerTest::loader() { @@ -532,16 +533,16 @@ void ResourceManagerTest::loaderSetNullptr() { } void ResourceManagerTest::debugResourceState() { - std::ostringstream out; + Containers::String out; Debug{&out} << ResourceState::Loading << ResourceState(0xbe); - CORRADE_COMPARE(out.str(), "ResourceState::Loading ResourceState(0xbe)\n"); + CORRADE_COMPARE(out, "ResourceState::Loading ResourceState(0xbe)\n"); } void ResourceManagerTest::debugResourceKey() { - std::ostringstream out; + Containers::String out; ResourceKey hello = "hello"; Debug{&out} << hello; - CORRADE_COMPARE(out.str(), Utility::formatString("ResourceKey(0x{})\n", hello.hexString())); + CORRADE_COMPARE(out, Utility::format("ResourceKey(0x{})\n", hello.hexString())); } }}} diff --git a/src/Magnum/Test/SamplerTest.cpp b/src/Magnum/Test/SamplerTest.cpp index b7464c878..1ab838999 100644 --- a/src/Magnum/Test/SamplerTest.cpp +++ b/src/Magnum/Test/SamplerTest.cpp @@ -24,9 +24,8 @@ DEALINGS IN THE SOFTWARE. */ -#include +#include #include -#include #include "Magnum/Sampler.h" @@ -53,45 +52,45 @@ SamplerTest::SamplerTest() { } void SamplerTest::debugFilter() { - std::ostringstream out; + Containers::String out; Debug(&out) << SamplerFilter::Linear << SamplerFilter(0xdead); - CORRADE_COMPARE(out.str(), "SamplerFilter::Linear SamplerFilter(0xdead)\n"); + CORRADE_COMPARE(out, "SamplerFilter::Linear SamplerFilter(0xdead)\n"); } void SamplerTest::debugFilterPacked() { - std::ostringstream out; + Containers::String out; /* Last is not packed, ones before should not make any flags persistent */ Debug(&out) << Debug::packed << SamplerFilter::Linear << Debug::packed << SamplerFilter(0xdead) << SamplerFilter::Nearest; - CORRADE_COMPARE(out.str(), "Linear 0xdead SamplerFilter::Nearest\n"); + CORRADE_COMPARE(out, "Linear 0xdead SamplerFilter::Nearest\n"); } void SamplerTest::debugMipmap() { - std::ostringstream out; + Containers::String out; Debug(&out) << SamplerMipmap::Base << SamplerMipmap(0xdead); - CORRADE_COMPARE(out.str(), "SamplerMipmap::Base SamplerMipmap(0xdead)\n"); + CORRADE_COMPARE(out, "SamplerMipmap::Base SamplerMipmap(0xdead)\n"); } void SamplerTest::debugMipmapPacked() { - std::ostringstream out; + Containers::String out; /* Last is not packed, ones before should not make any flags persistent */ Debug(&out) << Debug::packed << SamplerMipmap::Base << Debug::packed << SamplerMipmap(0xdead) << SamplerMipmap::Nearest; - CORRADE_COMPARE(out.str(), "Base 0xdead SamplerMipmap::Nearest\n"); + CORRADE_COMPARE(out, "Base 0xdead SamplerMipmap::Nearest\n"); } void SamplerTest::debugWrapping() { - std::ostringstream out; + Containers::String out; Debug(&out) << SamplerWrapping::ClampToEdge << SamplerWrapping(0xdead); - CORRADE_COMPARE(out.str(), "SamplerWrapping::ClampToEdge SamplerWrapping(0xdead)\n"); + CORRADE_COMPARE(out, "SamplerWrapping::ClampToEdge SamplerWrapping(0xdead)\n"); } void SamplerTest::debugWrappingPacked() { - std::ostringstream out; + Containers::String out; /* Last is not packed, ones before should not make any flags persistent */ Debug(&out) << Debug::packed << SamplerWrapping::ClampToEdge << Debug::packed << SamplerWrapping(0xdead) << SamplerWrapping::Repeat; - CORRADE_COMPARE(out.str(), "ClampToEdge 0xdead SamplerWrapping::Repeat\n"); + CORRADE_COMPARE(out, "ClampToEdge 0xdead SamplerWrapping::Repeat\n"); } }}} diff --git a/src/Magnum/Test/VertexFormatTest.cpp b/src/Magnum/Test/VertexFormatTest.cpp index 1d7f471b2..2f50956f1 100644 --- a/src/Magnum/Test/VertexFormatTest.cpp +++ b/src/Magnum/Test/VertexFormatTest.cpp @@ -24,11 +24,10 @@ DEALINGS IN THE SOFTWARE. */ -#include #include #include #include -#include +#include /** @todo remove once Configuration is std::string-free */ #include "Magnum/VertexFormat.h" #include "Magnum/Math/Half.h" @@ -234,12 +233,12 @@ void VertexFormatTest::wrap() { void VertexFormatTest::wrapInvalid() { CORRADE_SKIP_IF_NO_ASSERT(); - std::ostringstream out; + Containers::String out; Error redirectError{&out}; vertexFormatWrap(0xdeadbeef); - CORRADE_COMPARE(out.str(), "vertexFormatWrap(): implementation-specific value 0xdeadbeef already wrapped or too large\n"); + CORRADE_COMPARE(out, "vertexFormatWrap(): implementation-specific value 0xdeadbeef already wrapped or too large\n"); } void VertexFormatTest::unwrap() { @@ -250,12 +249,12 @@ void VertexFormatTest::unwrap() { void VertexFormatTest::unwrapInvalid() { CORRADE_SKIP_IF_NO_ASSERT(); - std::ostringstream out; + Containers::String out; Error redirectError{&out}; vertexFormatUnwrap(VertexFormat::Float); - CORRADE_COMPARE(out.str(), "vertexFormatUnwrap(): VertexFormat::Float isn't a wrapped implementation-specific value\n"); + CORRADE_COMPARE(out, "vertexFormatUnwrap(): VertexFormat::Float isn't a wrapped implementation-specific value\n"); } void VertexFormatTest::size() { @@ -274,13 +273,13 @@ void VertexFormatTest::size() { void VertexFormatTest::sizeInvalid() { CORRADE_SKIP_IF_NO_ASSERT(); - std::ostringstream out; + Containers::String out; Error redirectError{&out}; vertexFormatSize(VertexFormat{}); vertexFormatSize(VertexFormat(0xdead)); - CORRADE_COMPARE(out.str(), + CORRADE_COMPARE(out, "vertexFormatSize(): invalid format VertexFormat(0x0)\n" "vertexFormatSize(): invalid format VertexFormat(0xdead)\n"); } @@ -288,10 +287,10 @@ void VertexFormatTest::sizeInvalid() { void VertexFormatTest::sizeImplementationSpecific() { CORRADE_SKIP_IF_NO_ASSERT(); - std::ostringstream out; + Containers::String out; Error redirectError{&out}; vertexFormatSize(vertexFormatWrap(0xdead)); - CORRADE_COMPARE(out.str(), "vertexFormatSize(): can't determine size of an implementation-specific format 0xdead\n"); + CORRADE_COMPARE(out, "vertexFormatSize(): can't determine size of an implementation-specific format 0xdead\n"); } void VertexFormatTest::componentCount() { @@ -311,13 +310,13 @@ void VertexFormatTest::componentCount() { void VertexFormatTest::componentCountInvalid() { CORRADE_SKIP_IF_NO_ASSERT(); - std::ostringstream out; + Containers::String out; Error redirectError{&out}; vertexFormatComponentCount(VertexFormat{}); vertexFormatComponentCount(VertexFormat(0xdead)); - CORRADE_COMPARE(out.str(), + CORRADE_COMPARE(out, "vertexFormatComponentCount(): invalid format VertexFormat(0x0)\n" "vertexFormatComponentCount(): invalid format VertexFormat(0xdead)\n"); } @@ -325,10 +324,10 @@ void VertexFormatTest::componentCountInvalid() { void VertexFormatTest::componentCountImplementationSpecific() { CORRADE_SKIP_IF_NO_ASSERT(); - std::ostringstream out; + Containers::String out; Error redirectError{&out}; vertexFormatComponentCount(vertexFormatWrap(0xdead)); - CORRADE_COMPARE(out.str(), + CORRADE_COMPARE(out, "vertexFormatComponentCount(): can't determine component count of an implementation-specific format 0xdead\n"); } @@ -356,13 +355,13 @@ void VertexFormatTest::componentFormat() { void VertexFormatTest::componentFormatInvalid() { CORRADE_SKIP_IF_NO_ASSERT(); - std::ostringstream out; + Containers::String out; Error redirectError{&out}; vertexFormatComponentFormat(VertexFormat{}); vertexFormatComponentFormat(VertexFormat(0xdead)); - CORRADE_COMPARE(out.str(), + CORRADE_COMPARE(out, "vertexFormatComponentType(): invalid format VertexFormat(0x0)\n" "vertexFormatComponentType(): invalid format VertexFormat(0xdead)\n"); } @@ -370,10 +369,10 @@ void VertexFormatTest::componentFormatInvalid() { void VertexFormatTest::componentFormatImplementationSpecific() { CORRADE_SKIP_IF_NO_ASSERT(); - std::ostringstream out; + Containers::String out; Error redirectError{&out}; vertexFormatComponentFormat(vertexFormatWrap(0xdead)); - CORRADE_COMPARE(out.str(), + CORRADE_COMPARE(out, "vertexFormatComponentFormat(): can't determine component format of an implementation-specific format 0xdead\n"); } @@ -392,13 +391,13 @@ void VertexFormatTest::vectorCount() { void VertexFormatTest::vectorCountInvalid() { CORRADE_SKIP_IF_NO_ASSERT(); - std::ostringstream out; + Containers::String out; Error redirectError{&out}; vertexFormatVectorCount(VertexFormat{}); vertexFormatVectorCount(VertexFormat(0xdead)); - CORRADE_COMPARE(out.str(), + CORRADE_COMPARE(out, "vertexFormatVectorCount(): invalid format VertexFormat(0x0)\n" "vertexFormatVectorCount(): invalid format VertexFormat(0xdead)\n"); } @@ -406,10 +405,10 @@ void VertexFormatTest::vectorCountInvalid() { void VertexFormatTest::vectorCountImplementationSpecific() { CORRADE_SKIP_IF_NO_ASSERT(); - std::ostringstream out; + Containers::String out; Error redirectError{&out}; vertexFormatVectorCount(vertexFormatWrap(0xdead)); - CORRADE_COMPARE(out.str(), + CORRADE_COMPARE(out, "vertexFormatVectorCount(): can't determine vector count of an implementation-specific format 0xdead\n"); } @@ -430,13 +429,13 @@ void VertexFormatTest::vectorStride() { void VertexFormatTest::vectorStrideInvalid() { CORRADE_SKIP_IF_NO_ASSERT(); - std::ostringstream out; + Containers::String out; Error redirectError{&out}; vertexFormatVectorStride(VertexFormat{}); vertexFormatVectorStride(VertexFormat(0xdead)); - CORRADE_COMPARE(out.str(), + CORRADE_COMPARE(out, "vertexFormatVectorStride(): invalid format VertexFormat(0x0)\n" "vertexFormatVectorStride(): invalid format VertexFormat(0xdead)\n"); } @@ -444,10 +443,10 @@ void VertexFormatTest::vectorStrideInvalid() { void VertexFormatTest::vectorStrideImplementationSpecific() { CORRADE_SKIP_IF_NO_ASSERT(); - std::ostringstream out; + Containers::String out; Error redirectError{&out}; vertexFormatVectorStride(vertexFormatWrap(0xdead)); - CORRADE_COMPARE(out.str(), + CORRADE_COMPARE(out, "vertexFormatVectorStride(): can't determine vector count of an implementation-specific format 0xdead\n"); } @@ -464,13 +463,13 @@ void VertexFormatTest::isNormalized() { void VertexFormatTest::isNormalizedInvalid() { CORRADE_SKIP_IF_NO_ASSERT(); - std::ostringstream out; + Containers::String out; Error redirectError{&out}; isVertexFormatNormalized(VertexFormat{}); isVertexFormatNormalized(VertexFormat(0xdead)); - CORRADE_COMPARE(out.str(), + CORRADE_COMPARE(out, "isVertexFormatNormalized(): invalid format VertexFormat(0x0)\n" "isVertexFormatNormalized(): invalid format VertexFormat(0xdead)\n"); } @@ -478,10 +477,10 @@ void VertexFormatTest::isNormalizedInvalid() { void VertexFormatTest::isNormalizedImplementationSpecific() { CORRADE_SKIP_IF_NO_ASSERT(); - std::ostringstream out; + Containers::String out; Error redirectError{&out}; isVertexFormatNormalized(vertexFormatWrap(0xdead)); - CORRADE_COMPARE(out.str(), + CORRADE_COMPARE(out, "isVertexFormatNormalized(): can't determine normalization of an implementation-specific format 0xdead\n"); } @@ -506,13 +505,13 @@ void VertexFormatTest::assemble() { void VertexFormatTest::assembleRoundtrip() { auto&& data = AssembleRoundtripData[testCaseInstanceId()]; - std::ostringstream out; + Containers::String out; { Debug d{&out, Debug::Flag::NoNewlineAtTheEnd}; d << data.componentType; if(data.normalized) d << Debug::nospace << ", normalized"; } - setTestCaseDescription(out.str()); + setTestCaseDescription(out); VertexFormat result = vertexFormat(data.componentType, testCaseRepeatId() + 1, data.normalized); CORRADE_COMPARE(vertexFormat(result, testCaseRepeatId() + 1, data.normalized), result); @@ -526,21 +525,21 @@ void VertexFormatTest::assembleRoundtrip() { void VertexFormatTest::assembleCantNormalize() { CORRADE_SKIP_IF_NO_ASSERT(); - std::ostringstream out; + Containers::String out; Error redirectError{&out}; vertexFormat(VertexFormat::Vector2, 1, true); - CORRADE_COMPARE(out.str(), + CORRADE_COMPARE(out, "vertexFormat(): VertexFormat::Vector2 can't be made normalized\n"); } void VertexFormatTest::assembleInvalidComponentCount() { CORRADE_SKIP_IF_NO_ASSERT(); - std::ostringstream out; + Containers::String out; Error redirectError{&out}; vertexFormat(VertexFormat::Vector3, 0, false); vertexFormat(VertexFormat::Vector3, 5, false); - CORRADE_COMPARE(out.str(), + CORRADE_COMPARE(out, "vertexFormat(): invalid component count 0\n" "vertexFormat(): invalid component count 5\n"); } @@ -548,10 +547,10 @@ void VertexFormatTest::assembleInvalidComponentCount() { void VertexFormatTest::assembleImplementationSpecific() { CORRADE_SKIP_IF_NO_ASSERT(); - std::ostringstream out; + Containers::String out; Error redirectError{&out}; vertexFormat(vertexFormatWrap(0xdead), 1, true); - CORRADE_COMPARE(out.str(), + CORRADE_COMPARE(out, "vertexFormat(): can't assemble a format out of an implementation-specific format 0xdead\n"); } @@ -578,13 +577,13 @@ void VertexFormatTest::assembleMatrix() { void VertexFormatTest::assembleMatrixRoundtrip() { auto&& data = AssembleMatrixRoundtripData[testCaseInstanceId()]; - std::ostringstream out; + Containers::String out; { Debug d{&out, Debug::Flag::NoNewlineAtTheEnd}; d << data.componentType << Debug::nospace << "," << data.componentCount; if(data.aligned) d << Debug::nospace << ", aligned"; } - setTestCaseDescription(out.str()); + setTestCaseDescription(out); VertexFormat result = vertexFormat(data.componentType, testCaseRepeatId() + 2, data.componentCount, data.aligned); CORRADE_COMPARE(vertexFormat(result, testCaseRepeatId() + 2, data.componentCount, data.aligned), result); @@ -599,13 +598,13 @@ void VertexFormatTest::assembleMatrixRoundtrip() { void VertexFormatTest::assembleMatrixInvalidType() { CORRADE_SKIP_IF_NO_ASSERT(); - std::ostringstream out; + Containers::String out; Error redirectError{&out}; vertexFormat(VertexFormat::UnsignedByte, 3, 2, false); vertexFormat(VertexFormat::UnsignedShort, 3, 2, false); vertexFormat(VertexFormat::UnsignedInt, 2, 3, false); vertexFormat(VertexFormat::Int, 2, 3, false); - CORRADE_COMPARE(out.str(), + CORRADE_COMPARE(out, "vertexFormat(): invalid matrix component type VertexFormat::UnsignedByte, only floating-point or 8-/16-bit signed integer types are supported\n" "vertexFormat(): invalid matrix component type VertexFormat::UnsignedShort, only floating-point or 8-/16-bit signed integer types are supported\n" "vertexFormat(): invalid matrix component type VertexFormat::UnsignedInt, only floating-point or 8-/16-bit signed integer types are supported\n" @@ -615,13 +614,13 @@ void VertexFormatTest::assembleMatrixInvalidType() { void VertexFormatTest::assembleMatrixInvalidCount() { CORRADE_SKIP_IF_NO_ASSERT(); - std::ostringstream out; + Containers::String out; Error redirectError{&out}; vertexFormat(VertexFormat::Vector3, 2, 1, false); vertexFormat(VertexFormat::Vector3, 2, 5, false); vertexFormat(VertexFormat::Vector3, 5, 2, false); vertexFormat(VertexFormat::Vector3, 1, 2, false); - CORRADE_COMPARE(out.str(), + CORRADE_COMPARE(out, "vertexFormat(): invalid component count 1\n" "vertexFormat(): invalid component count 5\n" "vertexFormat(): invalid vector count 5\n" @@ -631,37 +630,37 @@ void VertexFormatTest::assembleMatrixInvalidCount() { void VertexFormatTest::assembleMatrixImplementationSpecific() { CORRADE_SKIP_IF_NO_ASSERT(); - std::ostringstream out; + Containers::String out; Error redirectError{&out}; vertexFormat(vertexFormatWrap(0xdead), 2, 2, true); - CORRADE_COMPARE(out.str(), + CORRADE_COMPARE(out, "vertexFormat(): can't assemble a format out of an implementation-specific format 0xdead\n"); } void VertexFormatTest::debug() { - std::ostringstream o; - Debug(&o) << VertexFormat::Vector4 << VertexFormat(0xdead); - CORRADE_COMPARE(o.str(), "VertexFormat::Vector4 VertexFormat(0xdead)\n"); + Containers::String out; + Debug{&out} << VertexFormat::Vector4 << VertexFormat(0xdead); + CORRADE_COMPARE(out, "VertexFormat::Vector4 VertexFormat(0xdead)\n"); } void VertexFormatTest::debugPacked() { - std::ostringstream out; + Containers::String out; /* Last is not packed, ones before should not make any flags persistent */ Debug{&out} << Debug::packed << VertexFormat::Vector4 << Debug::packed << VertexFormat(0xdead) << VertexFormat::Float; - CORRADE_COMPARE(out.str(), "Vector4 0xdead VertexFormat::Float\n"); + CORRADE_COMPARE(out, "Vector4 0xdead VertexFormat::Float\n"); } void VertexFormatTest::debugImplementationSpecific() { - std::ostringstream o; - Debug(&o) << Magnum::vertexFormatWrap(0xdead); - CORRADE_COMPARE(o.str(), "VertexFormat::ImplementationSpecific(0xdead)\n"); + Containers::String out; + Debug{&out} << Magnum::vertexFormatWrap(0xdead); + CORRADE_COMPARE(out, "VertexFormat::ImplementationSpecific(0xdead)\n"); } void VertexFormatTest::debugImplementationSpecificPacked() { - std::ostringstream out; + Containers::String out; /* Second is not packed, the first should not make any flags persistent */ Debug{&out} << Debug::packed << Magnum::vertexFormatWrap(0xdead) << VertexFormat::Float; - CORRADE_COMPARE(out.str(), "ImplementationSpecific(0xdead) VertexFormat::Float\n"); + CORRADE_COMPARE(out, "ImplementationSpecific(0xdead) VertexFormat::Float\n"); } void VertexFormatTest::configuration() { diff --git a/src/Magnum/Text/Test/AbstractFontConverterTest.cpp b/src/Magnum/Text/Test/AbstractFontConverterTest.cpp index 4ff6af515..2e712da6b 100644 --- a/src/Magnum/Text/Test/AbstractFontConverterTest.cpp +++ b/src/Magnum/Text/Test/AbstractFontConverterTest.cpp @@ -24,7 +24,6 @@ DEALINGS IN THE SOFTWARE. */ -#include #include #include #include /** @todo remove when AbstractFontConverter is -free */ @@ -32,8 +31,8 @@ #include #include #include -#include #include +#include /** @todo remove when AbstractFontConverter is -free */ #include "Magnum/PixelFormat.h" #include "Magnum/Math/Vector3.h" @@ -204,7 +203,7 @@ void AbstractFontConverterTest::thingNotSupported() { FontConverterFeatures doFeatures() const override { return {}; } } converter; - std::ostringstream out; + Containers::String out; Error redirectError{&out}; converter.exportFontToSingleData(dummyFont, dummyGlyphCache, {}); converter.exportFontToData(dummyFont, dummyGlyphCache, "font.out", {}); @@ -215,7 +214,7 @@ void AbstractFontConverterTest::thingNotSupported() { converter.importGlyphCacheFromSingleData({}); converter.importGlyphCacheFromData({{}}); converter.importGlyphCacheFromFile({}); - CORRADE_COMPARE_AS(out.str(), + CORRADE_COMPARE_AS(out, "Text::AbstractFontConverter::exportFontToSingleData(): feature not supported\n" "Text::AbstractFontConverter::exportFontToData(): feature not supported\n" "Text::AbstractFontConverter::exportFontToFile(): feature not supported\n" @@ -253,10 +252,10 @@ void AbstractFontConverterTest::exportFontToSingleDataNotImplemented() { } } converter; - std::ostringstream out; + Containers::String out; Error redirectError{&out}; converter.exportFontToSingleData(dummyFont, dummyGlyphCache, {}); - CORRADE_COMPARE(out.str(), "Text::AbstractFontConverter::exportFontToSingleData(): feature advertised but not implemented\n"); + CORRADE_COMPARE(out, "Text::AbstractFontConverter::exportFontToSingleData(): feature advertised but not implemented\n"); } void AbstractFontConverterTest::exportFontToSingleDataCustomDeleter() { @@ -272,10 +271,10 @@ void AbstractFontConverterTest::exportFontToSingleDataCustomDeleter() { } } converter; - std::ostringstream out; + Containers::String out; Error redirectError{&out}; converter.exportFontToSingleData(dummyFont, dummyGlyphCache, {}); - CORRADE_COMPARE(out.str(), "Text::AbstractFontConverter::exportFontToSingleData(): implementation is not allowed to use a custom Array deleter\n"); + CORRADE_COMPARE(out, "Text::AbstractFontConverter::exportFontToSingleData(): implementation is not allowed to use a custom Array deleter\n"); } void AbstractFontConverterTest::exportFontToSingleDataNotSingleFile() { @@ -287,10 +286,10 @@ void AbstractFontConverterTest::exportFontToSingleDataNotSingleFile() { } } converter; - std::ostringstream out; + Containers::String out; Error redirectError{&out}; converter.exportFontToSingleData(dummyFont, dummyGlyphCache, {}); - CORRADE_COMPARE(out.str(), "Text::AbstractFontConverter::exportFontToSingleData(): the format is not single-file\n"); + CORRADE_COMPARE(out, "Text::AbstractFontConverter::exportFontToSingleData(): the format is not single-file\n"); } void AbstractFontConverterTest::exportFontToData() { @@ -331,10 +330,10 @@ void AbstractFontConverterTest::exportFontToDataNotImplemented() { } } converter; - std::ostringstream out; + Containers::String out; Error redirectError{&out}; converter.exportFontToData(dummyFont, dummyGlyphCache, "font.out", {}); - CORRADE_COMPARE(out.str(), "Text::AbstractFontConverter::exportFontToData(): feature advertised but not implemented\n"); + CORRADE_COMPARE(out, "Text::AbstractFontConverter::exportFontToData(): feature advertised but not implemented\n"); } void AbstractFontConverterTest::exportFontToDataCustomDeleter() { @@ -353,10 +352,10 @@ void AbstractFontConverterTest::exportFontToDataCustomDeleter() { } } converter; - std::ostringstream out; + Containers::String out; Error redirectError{&out}; converter.exportFontToData(dummyFont, dummyGlyphCache, "font.out", {}); - CORRADE_COMPARE(out.str(), "Text::AbstractFontConverter::exportFontToData(): implementation is not allowed to use a custom Array deleter\n"); + CORRADE_COMPARE(out, "Text::AbstractFontConverter::exportFontToData(): implementation is not allowed to use a custom Array deleter\n"); } void AbstractFontConverterTest::exportFontToDataThroughSingleData() { @@ -433,10 +432,10 @@ void AbstractFontConverterTest::exportFontToFileNotImplemented() { } } converter; - std::ostringstream out; + Containers::String out; Error redirectError{&out}; converter.exportFontToFile(dummyFont, dummyGlyphCache, "file.out", {}); - CORRADE_COMPARE(out.str(), "Text::AbstractFontConverter::exportFontToFile(): feature advertised but not implemented\n"); + CORRADE_COMPARE(out, "Text::AbstractFontConverter::exportFontToFile(): feature advertised but not implemented\n"); } void AbstractFontConverterTest::exportFontToFileThroughData() { @@ -487,11 +486,11 @@ void AbstractFontConverterTest::exportFontToFileThroughDataFailed() { /* Function should fail, no file should get written and no error output should be printed (the base implementation assumes the plugin does it) */ - std::ostringstream out; + Containers::String out; Error redirectError{&out}; CORRADE_VERIFY(!converter.exportFontToFile(dummyFont, dummyGlyphCache, filename, {})); CORRADE_VERIFY(!Utility::Path::exists(filename)); - CORRADE_COMPARE(out.str(), ""); + CORRADE_COMPARE(out, ""); } void AbstractFontConverterTest::exportFontToFileThroughDataNotWritable() { @@ -507,10 +506,10 @@ void AbstractFontConverterTest::exportFontToFileThroughDataNotWritable() { } } converter; - std::ostringstream out; + Containers::String out; Error redirectError{&out}; CORRADE_VERIFY(!converter.exportFontToFile(dummyFont, dummyGlyphCache, "/some/path/that/does/not/exist", {})); - CORRADE_COMPARE_AS(out.str(), + CORRADE_COMPARE_AS(out, "Text::AbstractFontConverter::exportFontToFile(): cannot write to file /some/path/that/does/not/exist\n", TestSuite::Compare::StringHasSuffix); } @@ -539,10 +538,10 @@ void AbstractFontConverterTest::exportGlyphCacheToSingleDataNotImplemented() { } } converter; - std::ostringstream out; + Containers::String out; Error redirectError{&out}; converter.exportGlyphCacheToSingleData(dummyGlyphCache); - CORRADE_COMPARE(out.str(), "Text::AbstractFontConverter::exportGlyphCacheToSingleData(): feature advertised but not implemented\n"); + CORRADE_COMPARE(out, "Text::AbstractFontConverter::exportGlyphCacheToSingleData(): feature advertised but not implemented\n"); } void AbstractFontConverterTest::exportGlyphCacheToSingleDataCustomDeleter() { @@ -558,10 +557,10 @@ void AbstractFontConverterTest::exportGlyphCacheToSingleDataCustomDeleter() { } } converter; - std::ostringstream out; + Containers::String out; Error redirectError{&out}; converter.exportGlyphCacheToSingleData(dummyGlyphCache); - CORRADE_COMPARE(out.str(), "Text::AbstractFontConverter::exportGlyphCacheToSingleData(): implementation is not allowed to use a custom Array deleter\n"); + CORRADE_COMPARE(out, "Text::AbstractFontConverter::exportGlyphCacheToSingleData(): implementation is not allowed to use a custom Array deleter\n"); } void AbstractFontConverterTest::exportGlyphCacheToSingleDataNotSingleFile() { @@ -573,10 +572,10 @@ void AbstractFontConverterTest::exportGlyphCacheToSingleDataNotSingleFile() { } } converter; - std::ostringstream out; + Containers::String out; Error redirectError{&out}; converter.exportGlyphCacheToSingleData(dummyGlyphCache); - CORRADE_COMPARE(out.str(), "Text::AbstractFontConverter::exportGlyphCacheToSingleData(): the format is not single-file\n"); + CORRADE_COMPARE(out, "Text::AbstractFontConverter::exportGlyphCacheToSingleData(): the format is not single-file\n"); } void AbstractFontConverterTest::exportGlyphCacheToData() { @@ -616,10 +615,10 @@ void AbstractFontConverterTest::exportGlyphCacheToDataNotImplemented() { } } converter; - std::ostringstream out; + Containers::String out; Error redirectError{&out}; converter.exportGlyphCacheToData(dummyGlyphCache, "cache.out"); - CORRADE_COMPARE(out.str(), "Text::AbstractFontConverter::exportGlyphCacheToData(): feature advertised but not implemented\n"); + CORRADE_COMPARE(out, "Text::AbstractFontConverter::exportGlyphCacheToData(): feature advertised but not implemented\n"); } void AbstractFontConverterTest::exportGlyphCacheToDataCustomDeleter() { @@ -638,10 +637,10 @@ void AbstractFontConverterTest::exportGlyphCacheToDataCustomDeleter() { } } converter; - std::ostringstream out; + Containers::String out; Error redirectError{&out}; converter.exportGlyphCacheToData(dummyGlyphCache, "cache.out"); - CORRADE_COMPARE(out.str(), "Text::AbstractFontConverter::exportGlyphCacheToData(): implementation is not allowed to use a custom Array deleter\n"); + CORRADE_COMPARE(out, "Text::AbstractFontConverter::exportGlyphCacheToData(): implementation is not allowed to use a custom Array deleter\n"); } void AbstractFontConverterTest::exportGlyphCacheToDataThroughSingleData() { @@ -719,10 +718,10 @@ void AbstractFontConverterTest::exportGlyphCacheToFileNotImplemented() { } } converter; - std::ostringstream out; + Containers::String out; Error redirectError{&out}; converter.exportGlyphCacheToFile(dummyGlyphCache, "cache.out"); - CORRADE_COMPARE(out.str(), "Text::AbstractFontConverter::exportGlyphCacheToFile(): feature advertised but not implemented\n"); + CORRADE_COMPARE(out, "Text::AbstractFontConverter::exportGlyphCacheToFile(): feature advertised but not implemented\n"); } void AbstractFontConverterTest::exportGlyphCacheToFileThroughData() { @@ -770,11 +769,11 @@ void AbstractFontConverterTest::exportGlyphCacheToFileThroughDataFailed() { /* Function should fail, no file should get written and no error output should be printed (the base implementation assumes the plugin does it) */ - std::ostringstream out; + Containers::String out; Error redirectError{&out}; CORRADE_VERIFY(!converter.exportGlyphCacheToFile(dummyGlyphCache, filename)); CORRADE_VERIFY(!Utility::Path::exists(filename)); - CORRADE_COMPARE(out.str(), ""); + CORRADE_COMPARE(out, ""); } void AbstractFontConverterTest::exportGlyphCacheToFileThroughDataNotWritable() { @@ -788,10 +787,10 @@ void AbstractFontConverterTest::exportGlyphCacheToFileThroughDataNotWritable() { } } converter; - std::ostringstream out; + Containers::String out; Error redirectError{&out}; CORRADE_VERIFY(!converter.exportGlyphCacheToFile(dummyGlyphCache, "/some/path/that/does/not/exist")); - CORRADE_COMPARE_AS(out.str(), + CORRADE_COMPARE_AS(out, "Text::AbstractFontConverter::exportGlyphCacheToFile(): cannot write to file /some/path/that/does/not/exist\n", TestSuite::Compare::StringHasSuffix); } @@ -824,10 +823,10 @@ void AbstractFontConverterTest::importGlyphCacheFromSingleDataNotImplemented() { } } converter; - std::ostringstream out; + Containers::String out; Error redirectError{&out}; converter.importGlyphCacheFromSingleData({}); - CORRADE_COMPARE(out.str(), "Text::AbstractFontConverter::importGlyphCacheFromSingleData(): feature advertised but not implemented\n"); + CORRADE_COMPARE(out, "Text::AbstractFontConverter::importGlyphCacheFromSingleData(): feature advertised but not implemented\n"); } void AbstractFontConverterTest::importGlyphCacheFromSingleDataNotSingleFile() { @@ -839,10 +838,10 @@ void AbstractFontConverterTest::importGlyphCacheFromSingleDataNotSingleFile() { } } converter; - std::ostringstream out; + Containers::String out; Error redirectError{&out}; converter.importGlyphCacheFromSingleData({}); - CORRADE_COMPARE(out.str(), "Text::AbstractFontConverter::importGlyphCacheFromSingleData(): the format is not single-file\n"); + CORRADE_COMPARE(out, "Text::AbstractFontConverter::importGlyphCacheFromSingleData(): the format is not single-file\n"); } void AbstractFontConverterTest::importGlyphCacheFromData() { @@ -873,10 +872,10 @@ void AbstractFontConverterTest::importGlyphCacheFromDataNoData() { } } converter; - std::ostringstream out; + Containers::String out; Error redirectError{&out}; converter.importGlyphCacheFromData({}); - CORRADE_COMPARE(out.str(), "Text::AbstractFontConverter::importGlyphCacheFromData(): no data passed\n"); + CORRADE_COMPARE(out, "Text::AbstractFontConverter::importGlyphCacheFromData(): no data passed\n"); } void AbstractFontConverterTest::importGlyphCacheFromDataNotImplemented() { @@ -890,10 +889,10 @@ void AbstractFontConverterTest::importGlyphCacheFromDataNotImplemented() { } } converter; - std::ostringstream out; + Containers::String out; Error redirectError{&out}; converter.importGlyphCacheFromData({{}}); - CORRADE_COMPARE(out.str(), "Text::AbstractFontConverter::importGlyphCacheFromData(): feature advertised but not implemented\n"); + CORRADE_COMPARE(out, "Text::AbstractFontConverter::importGlyphCacheFromData(): feature advertised but not implemented\n"); } void AbstractFontConverterTest::importGlyphCacheFromDataAsSingleData() { @@ -945,10 +944,10 @@ void AbstractFontConverterTest::importGlyphCacheFromFileNotImplemented() { } } converter; - std::ostringstream out; + Containers::String out; Error redirectError{&out}; converter.importGlyphCacheFromFile({}); - CORRADE_COMPARE(out.str(), "Text::AbstractFontConverter::importGlyphCacheFromFile(): feature advertised but not implemented\n"); + CORRADE_COMPARE(out, "Text::AbstractFontConverter::importGlyphCacheFromFile(): feature advertised but not implemented\n"); } void AbstractFontConverterTest::importGlyphCacheFromFileAsSingleData() { @@ -982,41 +981,41 @@ void AbstractFontConverterTest::importGlyphCacheFromFileAsSingleDataNotFound() { } } converter; - std::ostringstream out; + Containers::String out; Error redirectError{&out}; CORRADE_VERIFY(!converter.importGlyphCacheFromFile("nonexistent.bin")); /* There's an error message from Path::read() before */ - CORRADE_COMPARE_AS(out.str(), + CORRADE_COMPARE_AS(out, "\nText::AbstractFontConverter::importGlyphCacheFromFile(): cannot open file nonexistent.bin\n", TestSuite::Compare::StringHasSuffix); } void AbstractFontConverterTest::debugFeature() { - std::ostringstream out; + Containers::String out; Debug{&out} << FontConverterFeature::ExportFont << FontConverterFeature(0xf0); - CORRADE_COMPARE(out.str(), "Text::FontConverterFeature::ExportFont Text::FontConverterFeature(0xf0)\n"); + CORRADE_COMPARE(out, "Text::FontConverterFeature::ExportFont Text::FontConverterFeature(0xf0)\n"); } void AbstractFontConverterTest::debugFeaturePacked() { - std::ostringstream out; + Containers::String 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"); + CORRADE_COMPARE(out, "ExportFont 0xf0 Text::FontConverterFeature::ImportGlyphCache\n"); } void AbstractFontConverterTest::debugFeatures() { - std::ostringstream out; + Containers::String out; Debug{&out} << (FontConverterFeature::ExportFont|FontConverterFeature::ImportGlyphCache) << FontConverterFeatures{}; - CORRADE_COMPARE(out.str(), "Text::FontConverterFeature::ExportFont|Text::FontConverterFeature::ImportGlyphCache Text::FontConverterFeatures{}\n"); + CORRADE_COMPARE(out, "Text::FontConverterFeature::ExportFont|Text::FontConverterFeature::ImportGlyphCache Text::FontConverterFeatures{}\n"); } void AbstractFontConverterTest::debugFeaturesPacked() { - std::ostringstream out; + Containers::String 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_COMPARE(out, "ExportFont|ImportGlyphCache {} Text::FontConverterFeature::ExportGlyphCache\n"); } }}}} diff --git a/src/Magnum/Text/Test/AbstractFontTest.cpp b/src/Magnum/Text/Test/AbstractFontTest.cpp index 9458931c8..94b87153e 100644 --- a/src/Magnum/Text/Test/AbstractFontTest.cpp +++ b/src/Magnum/Text/Test/AbstractFontTest.cpp @@ -24,17 +24,15 @@ DEALINGS IN THE SOFTWARE. */ -#include +#include /** @todo remove once file callbacks are std::string-free */ #include #include #include #include -#include /** @todo remove once Debug is stream-free */ #include #include #include #include -#include /** @todo remove once Debug is stream-free */ #include #include "Magnum/FileCallback.h" @@ -296,11 +294,11 @@ void AbstractFontTest::openFileAsDataNotFound() { Containers::Pointer doCreateShaper() override { return {}; } } font; - std::ostringstream out; + Containers::String out; Error redirectError{&out}; CORRADE_VERIFY(!font.openFile("nonexistent.foo", 12.0f)); /* There's an error message from Path::read() before */ - CORRADE_COMPARE_AS(out.str(), + CORRADE_COMPARE_AS(out, "\nText::AbstractFont::openFile(): cannot open file nonexistent.foo\n", TestSuite::Compare::StringHasSuffix); } @@ -320,10 +318,10 @@ void AbstractFontTest::openFileNotImplemented() { Containers::Pointer doCreateShaper() override { return {}; } } font; - std::ostringstream out; + Containers::String out; Error redirectError{&out}; font.openFile("file.foo", 34.0f); - CORRADE_COMPARE(out.str(), "Text::AbstractFont::openFile(): not implemented\n"); + CORRADE_COMPARE(out, "Text::AbstractFont::openFile(): not implemented\n"); } void AbstractFontTest::openDataNotSupported() { @@ -341,10 +339,10 @@ void AbstractFontTest::openDataNotSupported() { Containers::Pointer doCreateShaper() override { return {}; } } font; - std::ostringstream out; + Containers::String out; Error redirectError{&out}; font.openData(nullptr, 34.0f); - CORRADE_COMPARE(out.str(), "Text::AbstractFont::openData(): feature not supported\n"); + CORRADE_COMPARE(out, "Text::AbstractFont::openData(): feature not supported\n"); } void AbstractFontTest::openDataNotImplemented() { @@ -361,10 +359,10 @@ void AbstractFontTest::openDataNotImplemented() { Containers::Pointer doCreateShaper() override { return {}; } } font; - std::ostringstream out; + Containers::String out; Error redirectError{&out}; font.openData(nullptr, 34.0f); - CORRADE_COMPARE(out.str(), "Text::AbstractFont::openData(): feature advertised but not implemented\n"); + CORRADE_COMPARE(out, "Text::AbstractFont::openData(): feature advertised but not implemented\n"); } void AbstractFontTest::setFileCallback() { @@ -488,13 +486,13 @@ void AbstractFontTest::setFileCallbackFileOpened() { Containers::Pointer doCreateShaper() override { return {}; } } font; - std::ostringstream out; + Containers::String out; Error redirectError{&out}; font.setFileCallback([](const std::string&, InputFileCallbackPolicy, void*) { return Containers::Optional>{}; }); - CORRADE_COMPARE(out.str(), "Text::AbstractFont::setFileCallback(): can't be set while a font is opened\n"); + CORRADE_COMPARE(out, "Text::AbstractFont::setFileCallback(): can't be set while a font is opened\n"); } void AbstractFontTest::setFileCallbackNotImplemented() { @@ -533,14 +531,14 @@ void AbstractFontTest::setFileCallbackNotSupported() { Containers::Pointer doCreateShaper() override { return {}; } } font; - std::ostringstream out; + Containers::String out; Error redirectError{&out}; int a; font.setFileCallback([](const std::string&, InputFileCallbackPolicy, void*) { return Containers::Optional>{}; }, &a); - CORRADE_COMPARE(out.str(), "Text::AbstractFont::setFileCallback(): font plugin supports neither loading from data nor via callbacks, callbacks can't be used\n"); + CORRADE_COMPARE(out, "Text::AbstractFont::setFileCallback(): font plugin supports neither loading from data nor via callbacks, callbacks can't be used\n"); } void AbstractFontTest::setFileCallbackOpenFileDirectly() { @@ -667,12 +665,12 @@ void AbstractFontTest::setFileCallbackOpenFileThroughBaseImplementationFailed() return {}; }); - std::ostringstream out; + Containers::String out; Error redirectError{&out}; CORRADE_VERIFY(!font.openFile("file.dat", 42.0f)); CORRADE_VERIFY(font.openFileCalled); - CORRADE_COMPARE(out.str(), "Text::AbstractFont::openFile(): cannot open file file.dat\n"); + CORRADE_COMPARE(out, "Text::AbstractFont::openFile(): cannot open file file.dat\n"); } void AbstractFontTest::setFileCallbackOpenFileAsData() { @@ -757,12 +755,12 @@ void AbstractFontTest::setFileCallbackOpenFileAsDataFailed() { return Containers::Optional>{}; }); - std::ostringstream out; + Containers::String out; Error redirectError{&out}; CORRADE_VERIFY(!font.openFile("file.dat", 132.0f)); CORRADE_VERIFY(!font.openFileCalled); - CORRADE_COMPARE(out.str(), "Text::AbstractFont::openFile(): cannot open file file.dat\n"); + CORRADE_COMPARE(out, "Text::AbstractFont::openFile(): cannot open file file.dat\n"); } void AbstractFontTest::properties() { @@ -806,14 +804,14 @@ void AbstractFontTest::propertiesNoFont() { Containers::Pointer doCreateShaper() override { return {}; } } font; - std::ostringstream out; + Containers::String out; Error redirectError{&out}; font.size(); font.ascent(); font.descent(); font.lineHeight(); font.glyphCount(); - CORRADE_COMPARE(out.str(), + CORRADE_COMPARE(out, "Text::AbstractFont::size(): no font opened\n" "Text::AbstractFont::ascent(): no font opened\n" "Text::AbstractFont::descent(): no font opened\n" @@ -875,11 +873,11 @@ void AbstractFontTest::glyphIdNoFont() { Containers::Pointer doCreateShaper() override { return {}; } } font; - std::ostringstream out; + Containers::String out; Error redirectError{&out}; font.glyphIdsInto({}, {}); font.glyphId('a'); - CORRADE_COMPARE(out.str(), + CORRADE_COMPARE(out, "Text::AbstractFont::glyphIdsInto(): no font opened\n" /* Both delegate to the same function so the assert is the same */ "Text::AbstractFont::glyphIdsInto(): no font opened\n"); @@ -902,10 +900,10 @@ void AbstractFontTest::glyphIdInvalidSize() { char32_t characters[3]; UnsignedInt glyphs[4]; - std::ostringstream out; + Containers::String out; Error redirectError{&out}; font.glyphIdsInto(characters, glyphs); - CORRADE_COMPARE(out.str(), "Text::AbstractFont::glyphIdsInto(): expected the characters and glyphs views to have the same size but got 3 and 4\n"); + CORRADE_COMPARE(out, "Text::AbstractFont::glyphIdsInto(): expected the characters and glyphs views to have the same size but got 3 and 4\n"); } void AbstractFontTest::glyphIdOutOfRange() { @@ -943,10 +941,10 @@ void AbstractFontTest::glyphIdOutOfRange() { /* Have to explicitly open in order to make glyphCount() non-zero */ CORRADE_VERIFY(font.openData(nullptr, 0.0f)); - std::ostringstream out; + Containers::String out; Error redirectError{&out}; font.glyphIdsInto(characters, glyphs); - CORRADE_COMPARE(out.str(), "Text::AbstractFont::glyphIdsInto(): implementation-returned index 4 for character U+2345 out of range for 4 glyphs\n"); + CORRADE_COMPARE(out, "Text::AbstractFont::glyphIdsInto(): implementation-returned index 4 for character U+2345 out of range for 4 glyphs\n"); } void AbstractFontTest::glyphName() { @@ -1027,11 +1025,11 @@ void AbstractFontTest::glyphNameNoFont() { Containers::Pointer doCreateShaper() override { return {}; } } font; - std::ostringstream out; + Containers::String out; Error redirectError{&out}; font.glyphName(0); font.glyphForName(""); - CORRADE_COMPARE(out.str(), + CORRADE_COMPARE(out, "Text::AbstractFont::glyphName(): no font opened\n" "Text::AbstractFont::glyphForName(): no font opened\n"); } @@ -1064,11 +1062,11 @@ void AbstractFontTest::glyphNameOutOfRange() { /* Have to explicitly open in order to make glyphCount() non-zero */ CORRADE_VERIFY(font.openData(nullptr, 0.0f)); - std::ostringstream out; + Containers::String out; Error redirectError{&out}; font.glyphName(4); font.glyphForName(""); - CORRADE_COMPARE(out.str(), + CORRADE_COMPARE(out, "Text::AbstractFont::glyphName(): index 4 out of range for 4 glyphs\n" "Text::AbstractFont::glyphForName(): implementation-returned index 4 out of range for 4 glyphs\n"); } @@ -1111,11 +1109,11 @@ void AbstractFontTest::glyphSizeAdvanceNoFont() { Containers::Pointer doCreateShaper() override { return {}; } } font; - std::ostringstream out; + Containers::String out; Error redirectError{&out}; font.glyphSize(33); font.glyphAdvance(97); - CORRADE_COMPARE(out.str(), + CORRADE_COMPARE(out, "Text::AbstractFont::glyphSize(): no font opened\n" "Text::AbstractFont::glyphAdvance(): no font opened\n"); } @@ -1143,11 +1141,11 @@ void AbstractFontTest::glyphSizeAdvanceOutOfRange() { /* Have to explicitly open in order to make glyphCount() non-zero */ CORRADE_VERIFY(font.openData(nullptr, 0.0f)); - std::ostringstream out; + Containers::String out; Error redirectError{&out}; font.glyphSize(3); font.glyphAdvance(3); - CORRADE_COMPARE(out.str(), + CORRADE_COMPARE(out, "Text::AbstractFont::glyphSize(): index 3 out of range for 3 glyphs\n" "Text::AbstractFont::glyphAdvance(): index 3 out of range for 3 glyphs\n"); } @@ -1232,11 +1230,11 @@ void AbstractFontTest::fillGlyphCacheOutOfRange() { /* Have to explicitly open in order to make glyphCount() non-zero */ CORRADE_VERIFY(font.openData(nullptr, 0.0f)); - std::ostringstream out; + Containers::String out; Error redirectError{&out}; DummyGlyphCache cache{PixelFormat::R8Unorm, {100, 100}}; font.fillGlyphCache(cache, Containers::arrayView({0u, 15u, 3u, 16u, 80u})); - CORRADE_COMPARE(out.str(), + CORRADE_COMPARE(out, "Text::AbstractFont::fillGlyphCache(): index 16 out of range for 16 glyphs\n"); } @@ -1267,11 +1265,11 @@ void AbstractFontTest::fillGlyphCacheNotUnique() { /* Have to explicitly open in order to make glyphCount() non-zero */ CORRADE_VERIFY(font.openData(nullptr, 0.0f)); - std::ostringstream out; + Containers::String out; Error redirectError{&out}; DummyGlyphCache cache{PixelFormat::R8Unorm, {100, 100}}; font.fillGlyphCache(cache, Containers::arrayView({0u, 15u, 3u, 15u, 80u})); - CORRADE_COMPARE(out.str(), + CORRADE_COMPARE(out, "Text::AbstractFont::fillGlyphCache(): duplicate glyph 15\n"); } @@ -1402,12 +1400,12 @@ void AbstractFontTest::fillGlyphCacheNotSupported() { Containers::Pointer doCreateShaper() override { return {}; } } font; - std::ostringstream out; + Containers::String out; Error redirectError{&out}; DummyGlyphCache cache{PixelFormat::R8Unorm, {100, 100}}; font.fillGlyphCache(cache, Containers::arrayView({0u, 15u})); font.fillGlyphCache(cache, "hello"); - CORRADE_COMPARE(out.str(), + CORRADE_COMPARE(out, "Text::AbstractFont::fillGlyphCache(): feature not supported\n" "Text::AbstractFont::fillGlyphCache(): feature not supported\n"); } @@ -1439,12 +1437,12 @@ void AbstractFontTest::fillGlyphCacheNotImplemented() { /* Have to explicitly open in order to make glyphCount() non-zero */ CORRADE_VERIFY(font.openData(nullptr, 0.0f)); - std::ostringstream out; + Containers::String out; Error redirectError{&out}; DummyGlyphCache cache{PixelFormat::R8Unorm, {100, 100}}; font.fillGlyphCache(cache, Containers::arrayView({0u})); font.fillGlyphCache(cache, "hello"); - CORRADE_COMPARE(out.str(), + CORRADE_COMPARE(out, "Text::AbstractFont::fillGlyphCache(): feature advertised but not implemented\n" "Text::AbstractFont::fillGlyphCache(): feature advertised but not implemented\n"); } @@ -1463,12 +1461,12 @@ void AbstractFontTest::fillGlyphCacheNoFont() { Containers::Pointer doCreateShaper() override { return {}; } } font; - std::ostringstream out; + Containers::String out; Error redirectError{&out}; DummyGlyphCache cache{PixelFormat::R8Unorm, {100, 100}}; font.fillGlyphCache(cache, Containers::arrayView({0u, 15u})); font.fillGlyphCache(cache, "hello"); - CORRADE_COMPARE(out.str(), + CORRADE_COMPARE(out, "Text::AbstractFont::fillGlyphCache(): no font opened\n" "Text::AbstractFont::fillGlyphCache(): no font opened\n"); } @@ -1487,11 +1485,11 @@ void AbstractFontTest::fillGlyphCacheInvalidUtf8() { Containers::Pointer doCreateShaper() override { return {}; } } font; - std::ostringstream out; + Containers::String out; Error redirectError{&out}; DummyGlyphCache cache{PixelFormat::R8Unorm, {100, 100}}; font.fillGlyphCache(cache, "he\xffo"); - CORRADE_COMPARE(out.str(), "Text::AbstractFont::fillGlyphCache(): not a valid UTF-8 string: he\xffo\n"); + CORRADE_COMPARE(out, "Text::AbstractFont::fillGlyphCache(): not a valid UTF-8 string: he\xffo\n"); } void AbstractFontTest::createGlyphCache() { @@ -1530,10 +1528,10 @@ void AbstractFontTest::createGlyphCacheNotSupported() { Containers::Pointer doCreateShaper() override { return {}; } } font; - std::ostringstream out; + Containers::String out; Error redirectError{&out}; font.createGlyphCache(); - CORRADE_COMPARE(out.str(), "Text::AbstractFont::createGlyphCache(): feature not supported\n"); + CORRADE_COMPARE(out, "Text::AbstractFont::createGlyphCache(): feature not supported\n"); } void AbstractFontTest::createGlyphCacheNotImplemented() { @@ -1550,10 +1548,10 @@ void AbstractFontTest::createGlyphCacheNotImplemented() { Containers::Pointer doCreateShaper() override { return {}; } } font; - std::ostringstream out; + Containers::String out; Error redirectError{&out}; font.createGlyphCache(); - CORRADE_COMPARE(out.str(), "Text::AbstractFont::createGlyphCache(): feature advertised but not implemented\n"); + CORRADE_COMPARE(out, "Text::AbstractFont::createGlyphCache(): feature advertised but not implemented\n"); } void AbstractFontTest::createGlyphCacheNoFont() { @@ -1570,10 +1568,10 @@ void AbstractFontTest::createGlyphCacheNoFont() { Containers::Pointer doCreateShaper() override { return {}; } } font; - std::ostringstream out; + Containers::String out; Error redirectError{&out}; font.createGlyphCache(); - CORRADE_COMPARE(out.str(), "Text::AbstractFont::createGlyphCache(): no font opened\n"); + CORRADE_COMPARE(out, "Text::AbstractFont::createGlyphCache(): no font opened\n"); } void AbstractFontTest::createShaper() { @@ -1618,10 +1616,10 @@ void AbstractFontTest::createShaperNoFont() { Containers::Pointer doCreateShaper() override { return {}; } } font; - std::ostringstream out; + Containers::String out; Error redirectError{&out}; font.createShaper(); - CORRADE_COMPARE(out.str(), "Text::AbstractFont::createShaper(): no font opened\n"); + CORRADE_COMPARE(out, "Text::AbstractFont::createShaper(): no font opened\n"); } void AbstractFontTest::createShaperNullptr() { @@ -1638,10 +1636,10 @@ void AbstractFontTest::createShaperNullptr() { Containers::Pointer doCreateShaper() override { return nullptr; } } font; - std::ostringstream out; + Containers::String out; Error redirectError{&out}; font.createShaper(); - CORRADE_COMPARE(out.str(), "Text::AbstractFont::createShaper(): implementation returned nullptr\n"); + CORRADE_COMPARE(out, "Text::AbstractFont::createShaper(): implementation returned nullptr\n"); } #ifdef MAGNUM_BUILD_DEPRECATED @@ -1768,12 +1766,12 @@ void AbstractFontTest::layoutArrayGlyphCache() { DummyGlyphCache cache{PixelFormat::R8Unorm, {1, 2, 3}}; - std::ostringstream out; + Containers::String out; Error redirectError{&out}; CORRADE_IGNORE_DEPRECATED_PUSH font.layout(cache, 0.25f, "hello"); CORRADE_IGNORE_DEPRECATED_POP - CORRADE_COMPARE(out.str(), "Text::AbstractFont::layout(): array glyph caches are not supported\n"); + CORRADE_COMPARE(out, "Text::AbstractFont::layout(): array glyph caches are not supported\n"); } void AbstractFontTest::layoutGlyphCacheFontNotFound() { @@ -1793,13 +1791,13 @@ void AbstractFontTest::layoutGlyphCacheFontNotFound() { cache.addFont(3); cache.addFont(17); - std::ostringstream out; + Containers::String out; Error redirectError{&out}; CORRADE_IGNORE_DEPRECATED_PUSH Containers::Pointer layouter = font.layout(cache, 0.25f, "hello"); CORRADE_IGNORE_DEPRECATED_POP CORRADE_VERIFY(!layouter); - CORRADE_COMPARE(out.str(), "Text::AbstractFont::layout(): font not found among 2 fonts in passed glyph cache\n"); + CORRADE_COMPARE(out, "Text::AbstractFont::layout(): font not found among 2 fonts in passed glyph cache\n"); } void AbstractFontTest::layoutGlyphOutOfRange() { @@ -1849,12 +1847,12 @@ void AbstractFontTest::layoutGlyphOutOfRange() { Range2D rectangle; Vector2 cursorPosition; - std::ostringstream out; + Containers::String out; Error redirectError{&out}; CORRADE_IGNORE_DEPRECATED_PUSH /* MSVC warns here too */ layouter->renderGlyph(3, cursorPosition, rectangle); CORRADE_IGNORE_DEPRECATED_POP - CORRADE_COMPARE(out.str(), "Text::AbstractLayouter::renderGlyph(): index 3 out of range for 3 glyphs\n"); + CORRADE_COMPARE(out, "Text::AbstractLayouter::renderGlyph(): index 3 out of range for 3 glyphs\n"); } void AbstractFontTest::layoutNoFont() { @@ -1871,42 +1869,42 @@ void AbstractFontTest::layoutNoFont() { Containers::Pointer doCreateShaper() override { return {}; } } font; - std::ostringstream out; + Containers::String out; Error redirectError{&out}; DummyGlyphCache cache{PixelFormat::R8Unorm, {100, 200}}; CORRADE_IGNORE_DEPRECATED_PUSH font.layout(cache, 0.25f, "hello"); CORRADE_IGNORE_DEPRECATED_POP - CORRADE_COMPARE(out.str(), "Text::AbstractFont::layout(): no font opened\n"); + CORRADE_COMPARE(out, "Text::AbstractFont::layout(): no font opened\n"); } #endif void AbstractFontTest::debugFeature() { - std::ostringstream out; + Containers::String out; Debug{&out} << FontFeature::OpenData << FontFeature(0xf0); - CORRADE_COMPARE(out.str(), "Text::FontFeature::OpenData Text::FontFeature(0xf0)\n"); + CORRADE_COMPARE(out, "Text::FontFeature::OpenData Text::FontFeature(0xf0)\n"); } void AbstractFontTest::debugFeaturePacked() { - std::ostringstream out; + Containers::String 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"); + CORRADE_COMPARE(out, "OpenData 0xf0 Text::FontFeature::FileCallback\n"); } void AbstractFontTest::debugFeatures() { - std::ostringstream out; + Containers::String out; Debug{&out} << (FontFeature::OpenData|FontFeature::PreparedGlyphCache) << FontFeatures{}; - CORRADE_COMPARE(out.str(), "Text::FontFeature::OpenData|Text::FontFeature::PreparedGlyphCache Text::FontFeatures{}\n"); + CORRADE_COMPARE(out, "Text::FontFeature::OpenData|Text::FontFeature::PreparedGlyphCache Text::FontFeatures{}\n"); } void AbstractFontTest::debugFeaturesPacked() { - std::ostringstream out; + Containers::String 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_COMPARE(out, "OpenData|PreparedGlyphCache {} Text::FontFeature::FileCallback\n"); } }}}} diff --git a/src/Magnum/Text/Test/AbstractGlyphCacheTest.cpp b/src/Magnum/Text/Test/AbstractGlyphCacheTest.cpp index 6c5901a1c..0f5ff0fd6 100644 --- a/src/Magnum/Text/Test/AbstractGlyphCacheTest.cpp +++ b/src/Magnum/Text/Test/AbstractGlyphCacheTest.cpp @@ -24,16 +24,14 @@ DEALINGS IN THE SOFTWARE. */ -#include #include #include -#include /**< @todo drop once Debug is stream-free */ +#include #include #include #include #include #include -#include /**< @todo drop once Debug is stream-free */ #include "Magnum/Image.h" #include "Magnum/ImageView.h" @@ -46,6 +44,7 @@ #ifdef MAGNUM_BUILD_DEPRECATED #include #include +#include /* std::pair */ #endif namespace Magnum { namespace Text { namespace Test { namespace { @@ -299,23 +298,23 @@ AbstractGlyphCacheTest::AbstractGlyphCacheTest() { } void AbstractGlyphCacheTest::debugFeature() { - std::ostringstream out; + Containers::String out; Debug{&out} << GlyphCacheFeature::ImageProcessing << GlyphCacheFeature(0xca); - CORRADE_COMPARE(out.str(), "Text::GlyphCacheFeature::ImageProcessing Text::GlyphCacheFeature(0xca)\n"); + CORRADE_COMPARE(out, "Text::GlyphCacheFeature::ImageProcessing Text::GlyphCacheFeature(0xca)\n"); } void AbstractGlyphCacheTest::debugFeatures() { - std::ostringstream out; + Containers::String out; Debug{&out} << (GlyphCacheFeature::ImageProcessing|GlyphCacheFeature(0xf0)) << GlyphCacheFeatures{}; - CORRADE_COMPARE(out.str(), "Text::GlyphCacheFeature::ImageProcessing|Text::GlyphCacheFeature(0xf0) Text::GlyphCacheFeatures{}\n"); + CORRADE_COMPARE(out, "Text::GlyphCacheFeature::ImageProcessing|Text::GlyphCacheFeature(0xf0) Text::GlyphCacheFeatures{}\n"); } void AbstractGlyphCacheTest::debugFeaturesSupersets() { /* ProcessedImageDownload is a superset of ImageProcessing, only one should be printed */ - std::ostringstream out; + Containers::String out; Debug{&out} << (GlyphCacheFeature::ImageProcessing|GlyphCacheFeature::ProcessedImageDownload); - CORRADE_COMPARE(out.str(), "Text::GlyphCacheFeature::ProcessedImageDownload\n"); + CORRADE_COMPARE(out, "Text::GlyphCacheFeature::ProcessedImageDownload\n"); } struct DummyGlyphCache: AbstractGlyphCache { @@ -589,14 +588,14 @@ void AbstractGlyphCacheTest::constructImageRowPadding() { void AbstractGlyphCacheTest::constructZeroSize() { CORRADE_SKIP_IF_NO_ASSERT(); - std::ostringstream out; + Containers::String out; Error redirectError{&out}; DummyGlyphCache{PixelFormat::R8Unorm, {2, 0, 1}}; DummyGlyphCache{PixelFormat::R8Unorm, {0, 2, 1}}; DummyGlyphCache{PixelFormat::R8Unorm, {2, 2, 0}}; DummyGlyphCache{PixelFormat::R8Unorm, {2, 2}, PixelFormat::R8Unorm, {2, 0}}; DummyGlyphCache{PixelFormat::R8Unorm, {2, 2}, PixelFormat::R8Unorm, {0, 2}}; - CORRADE_COMPARE(out.str(), + CORRADE_COMPARE(out, "Text::AbstractGlyphCache: expected non-zero size, got {2, 0, 1}\n" "Text::AbstractGlyphCache: expected non-zero size, got {0, 2, 1}\n" "Text::AbstractGlyphCache: expected non-zero size, got {2, 2, 0}\n" @@ -650,12 +649,12 @@ void AbstractGlyphCacheTest::textureSizeNot2D() { DummyGlyphCache cache{PixelFormat::R32F, {1024, 512, 3}}; - std::ostringstream out; + Containers::String out; Error redirectError{&out}; CORRADE_IGNORE_DEPRECATED_PUSH cache.textureSize(); CORRADE_IGNORE_DEPRECATED_POP - CORRADE_COMPARE(out.str(), "Text::AbstractGlyphCache::textureSize(): can't be used on an array glyph cache\n"); + CORRADE_COMPARE(out, "Text::AbstractGlyphCache::textureSize(): can't be used on an array glyph cache\n"); } #endif @@ -697,7 +696,7 @@ void AbstractGlyphCacheTest::setInvalidGlyphOutOfRange() { /* Default padding is 1, test that it works for zero as well */ DummyGlyphCache cache{PixelFormat::R32F, {1024, 512, 3}, {}}; - std::ostringstream out; + Containers::String out; Error redirectError{&out}; cache.setInvalidGlyph({}, -1, {{15, 30}, {45, 35}}); cache.setInvalidGlyph({}, 3, {{15, 30}, {45, 35}}); @@ -708,7 +707,7 @@ void AbstractGlyphCacheTest::setInvalidGlyphOutOfRange() { /* Negative rect size */ cache.setInvalidGlyph({}, 0, {{45, 30}, {15, 35}}); cache.setInvalidGlyph({}, 0, {{15, 35}, {45, 30}}); - CORRADE_COMPARE_AS(out.str(), + CORRADE_COMPARE_AS(out, "Text::AbstractGlyphCache::setInvalidGlyph(): layer -1 and rectangle {{15, 30}, {45, 35}} out of range for size {1024, 512, 3} and padding {0, 0}\n" "Text::AbstractGlyphCache::setInvalidGlyph(): layer 3 and rectangle {{15, 30}, {45, 35}} out of range for size {1024, 512, 3} and padding {0, 0}\n" @@ -727,7 +726,7 @@ void AbstractGlyphCacheTest::setInvalidGlyphOutOfRangePadded() { DummyGlyphCache cache{PixelFormat::R32F, {1024, 512, 3}, {2, 3}}; - std::ostringstream out; + Containers::String out; Error redirectError{&out}; /* Padding has no effect on layers */ cache.setInvalidGlyph({}, -1, {{15, 30}, {45, 35}}); @@ -741,7 +740,7 @@ void AbstractGlyphCacheTest::setInvalidGlyphOutOfRangePadded() { padding included. */ cache.setInvalidGlyph({}, 0, {{45, 30}, {15, 35}}); cache.setInvalidGlyph({}, 0, {{15, 35}, {45, 30}}); - CORRADE_COMPARE_AS(out.str(), + CORRADE_COMPARE_AS(out, "Text::AbstractGlyphCache::setInvalidGlyph(): layer -1 and rectangle {{15, 30}, {45, 35}} out of range for size {1024, 512, 3} and padding {2, 3}\n" "Text::AbstractGlyphCache::setInvalidGlyph(): layer 3 and rectangle {{15, 30}, {45, 35}} out of range for size {1024, 512, 3} and padding {2, 3}\n" @@ -760,10 +759,10 @@ void AbstractGlyphCacheTest::setInvalidGlyph2DNot2D() { DummyGlyphCache cache{PixelFormat::R32F, {1024, 512, 3}}; - std::ostringstream out; + Containers::String out; Error redirectError{&out}; cache.setInvalidGlyph({}, {}); - CORRADE_COMPARE(out.str(), "Text::AbstractGlyphCache::setInvalidGlyph(): use the layer overload for an array glyph cache\n"); + CORRADE_COMPARE(out, "Text::AbstractGlyphCache::setInvalidGlyph(): use the layer overload for an array glyph cache\n"); } void AbstractGlyphCacheTest::addFont() { @@ -796,10 +795,10 @@ void AbstractGlyphCacheTest::addFontDuplicatePointer() { const AbstractFont* font = reinterpret_cast(std::size_t{0xdeadbeef}); cache.addFont(35, font); - std::ostringstream out; + Containers::String out; Error redirectError{&out}; cache.addFont(12, font); - CORRADE_COMPARE(out.str(), "Text::AbstractGlyphCache::addFont(): pointer 0xdeadbeef already used for font 1\n"); + CORRADE_COMPARE(out, "Text::AbstractGlyphCache::addFont(): pointer 0xdeadbeef already used for font 1\n"); } void AbstractGlyphCacheTest::fontOutOfRange() { @@ -811,11 +810,11 @@ void AbstractGlyphCacheTest::fontOutOfRange() { cache.addFont(12, font); CORRADE_COMPARE(cache.fontCount(), 2); - std::ostringstream out; + Containers::String out; Error redirectError{&out}; cache.fontGlyphCount(2); cache.fontPointer(2); - CORRADE_COMPARE(out.str(), + CORRADE_COMPARE(out, "Text::AbstractGlyphCache::fontGlyphCount(): index 2 out of range for 2 fonts\n" "Text::AbstractGlyphCache::fontPointer(): index 2 out of range for 2 fonts\n"); } @@ -855,23 +854,23 @@ void AbstractGlyphCacheTest::reserveIncremental() { cache.insert(34, {3, 5}, {{10, 10}, {23, 10}}); CORRADE_IGNORE_DEPRECATED_POP - std::ostringstream out; + Containers::String out; Error redirectError{&out}; CORRADE_IGNORE_DEPRECATED_PUSH cache.reserve({{12, 6}}); CORRADE_IGNORE_DEPRECATED_POP - CORRADE_COMPARE(out.str(), "Text::AbstractGlyphCache::reserve(): reserving space in non-empty cache is not yet implemented\n"); + CORRADE_COMPARE(out, "Text::AbstractGlyphCache::reserve(): reserving space in non-empty cache is not yet implemented\n"); } void AbstractGlyphCacheTest::reserveTooSmall() { DummyGlyphCache cache{PixelFormat::R8Unorm, {24, 18}, {1, 2}}; - std::ostringstream out; + Containers::String out; Error redirectError{&out}; CORRADE_IGNORE_DEPRECATED_PUSH CORRADE_VERIFY(cache.reserve({{5, 3}, {12, 6}, {10, 5}}).empty()); CORRADE_IGNORE_DEPRECATED_POP - CORRADE_COMPARE(out.str(), "Text::AbstractGlyphCache::reserve(): requested atlas size Vector(24, 18) is too small to fit 3 textures. Generated atlas will be empty.\n"); + CORRADE_COMPARE(out, "Text::AbstractGlyphCache::reserve(): requested atlas size Vector(24, 18) is too small to fit 3 textures. Generated atlas will be empty.\n"); } void AbstractGlyphCacheTest::reserveNot2D() { @@ -879,12 +878,12 @@ void AbstractGlyphCacheTest::reserveNot2D() { DummyGlyphCache cache{PixelFormat::R32F, {1024, 512, 3}}; - std::ostringstream out; + Containers::String out; Error redirectError{&out}; CORRADE_IGNORE_DEPRECATED_PUSH cache.reserve({}); CORRADE_IGNORE_DEPRECATED_POP - CORRADE_COMPARE(out.str(), "Text::AbstractGlyphCache::reserve(): can't be used on an array glyph cache\n"); + CORRADE_COMPARE(out, "Text::AbstractGlyphCache::reserve(): can't be used on an array glyph cache\n"); } #endif @@ -949,11 +948,11 @@ void AbstractGlyphCacheTest::addGlyphIndexOutOfRange() { cache.addFont(9); UnsignedInt fontId = cache.addFont(3); - std::ostringstream out; + Containers::String out; Error redirectError{&out}; cache.addGlyph(cache.fontCount(), 0, {}, 2, {}); cache.addGlyph(fontId, cache.fontGlyphCount(fontId), {}, 2, {}); - CORRADE_COMPARE(out.str(), + CORRADE_COMPARE(out, "Text::AbstractGlyphCache::addGlyph(): index 2 out of range for 2 fonts\n" "Text::AbstractGlyphCache::addGlyph(): index 3 out of range for 3 glyphs in font 1\n"); } @@ -972,10 +971,10 @@ void AbstractGlyphCacheTest::addGlyphAlreadyAdded() { cache.addGlyph(fontId, 1, {}, 2, {}); cache.addGlyph(fontId, 2, {}, 2, {}); - std::ostringstream out; + Containers::String out; Error redirectError{&out}; cache.addGlyph(fontId, 2, {}, 2, {}); - CORRADE_COMPARE(out.str(), + CORRADE_COMPARE(out, "Text::AbstractGlyphCache::addGlyph(): glyph 2 in font 1 already added at index 3\n"); } @@ -987,7 +986,7 @@ void AbstractGlyphCacheTest::addGlyphOutOfRange() { UnsignedInt fontId = cache.addFont(9); - std::ostringstream out; + Containers::String out; Error redirectError{&out}; cache.addGlyph(fontId, 1, {}, -1, {{15, 30}, {45, 35}}); cache.addGlyph(fontId, 2, {}, 3, {{15, 30}, {45, 35}}); @@ -998,7 +997,7 @@ void AbstractGlyphCacheTest::addGlyphOutOfRange() { /* Negative rect size */ cache.addGlyph(fontId, 8, {}, 0, {{45, 30}, {15, 35}}); cache.addGlyph(fontId, 7, {}, 0, {{15, 35}, {45, 30}}); - CORRADE_COMPARE_AS(out.str(), + CORRADE_COMPARE_AS(out, "Text::AbstractGlyphCache::addGlyph(): layer -1 and rectangle {{15, 30}, {45, 35}} out of range for size {1024, 512, 3} and padding {0, 0}\n" "Text::AbstractGlyphCache::addGlyph(): layer 3 and rectangle {{15, 30}, {45, 35}} out of range for size {1024, 512, 3} and padding {0, 0}\n" @@ -1019,7 +1018,7 @@ void AbstractGlyphCacheTest::addGlyphOutOfRangePadded() { UnsignedInt fontId = cache.addFont(9); - std::ostringstream out; + Containers::String out; Error redirectError{&out}; /* Padding has no effect on layers */ cache.addGlyph(fontId, 1, {}, -1, {{15, 30}, {45, 35}}); @@ -1033,7 +1032,7 @@ void AbstractGlyphCacheTest::addGlyphOutOfRangePadded() { padding included. */ cache.addGlyph(fontId, 8, {}, 0, {{45, 30}, {15, 35}}); cache.addGlyph(fontId, 7, {}, 0, {{15, 35}, {45, 30}}); - CORRADE_COMPARE_AS(out.str(), + CORRADE_COMPARE_AS(out, "Text::AbstractGlyphCache::addGlyph(): layer -1 and rectangle {{15, 30}, {45, 35}} out of range for size {1024, 512, 3} and padding {2, 3}\n" "Text::AbstractGlyphCache::addGlyph(): layer 3 and rectangle {{15, 30}, {45, 35}} out of range for size {1024, 512, 3} and padding {2, 3}\n" @@ -1064,10 +1063,10 @@ void AbstractGlyphCacheTest::addGlyphTooMany() { CORRADE_COMPARE(cache.glyphCount(), 65536); /* But adding 65k actual glyphs isn't */ - std::ostringstream out; + Containers::String out; Error redirectError{&out}; cache.addGlyph(fontId, 65536, {}, {}); - CORRADE_COMPARE(out.str(), "Text::AbstractGlyphCache::addGlyph(): only at most 65536 glyphs can be added\n"); + CORRADE_COMPARE(out, "Text::AbstractGlyphCache::addGlyph(): only at most 65536 glyphs can be added\n"); } void AbstractGlyphCacheTest::addGlyph2DNot2D() { @@ -1075,10 +1074,10 @@ void AbstractGlyphCacheTest::addGlyph2DNot2D() { DummyGlyphCache cache{PixelFormat::R32F, {1024, 512, 3}}; - std::ostringstream out; + Containers::String out; Error redirectError{&out}; cache.addGlyph(0, 0, {}, {}); - CORRADE_COMPARE(out.str(), "Text::AbstractGlyphCache::addGlyph(): use the layer overload for an array glyph cache\n"); + CORRADE_COMPARE(out, "Text::AbstractGlyphCache::addGlyph(): use the layer overload for an array glyph cache\n"); } #ifdef MAGNUM_BUILD_DEPRECATED @@ -1141,12 +1140,12 @@ void AbstractGlyphCacheTest::insertNot2D() { DummyGlyphCache cache{PixelFormat::R32F, {1024, 512, 3}}; - std::ostringstream out; + Containers::String out; Error redirectError{&out}; CORRADE_IGNORE_DEPRECATED_PUSH cache.insert(0, {}, {}); CORRADE_IGNORE_DEPRECATED_POP - CORRADE_COMPARE(out.str(), "Text::AbstractGlyphCache::insert(): can't be used on an array glyph cache\n"); + CORRADE_COMPARE(out, "Text::AbstractGlyphCache::insert(): can't be used on an array glyph cache\n"); } void AbstractGlyphCacheTest::insertMultiFont() { @@ -1157,12 +1156,12 @@ void AbstractGlyphCacheTest::insertMultiFont() { cache.addFont(15); cache.addFont(35); - std::ostringstream out; + Containers::String out; Error redirectError{&out}; CORRADE_IGNORE_DEPRECATED_PUSH cache.insert(0, {}, {}); CORRADE_IGNORE_DEPRECATED_POP - CORRADE_COMPARE(out.str(), "Text::AbstractGlyphCache::insert(): can't be used on a multi-font glyph cache\n"); + CORRADE_COMPARE(out, "Text::AbstractGlyphCache::insert(): can't be used on a multi-font glyph cache\n"); } #endif @@ -1516,10 +1515,10 @@ void AbstractGlyphCacheTest::flushImageNotImplemented() { } } cache{PixelFormat::R32F, {1024, 512, 8}}; - std::ostringstream out; + Containers::String out; Error redirectError{&out}; cache.flushImage(0, {}); - CORRADE_COMPARE(out.str(), "Text::AbstractGlyphCache::image(): not implemented by derived class\n"); + CORRADE_COMPARE(out, "Text::AbstractGlyphCache::image(): not implemented by derived class\n"); } void AbstractGlyphCacheTest::flushImagePassthrough2DNotImplemented() { @@ -1534,10 +1533,10 @@ void AbstractGlyphCacheTest::flushImagePassthrough2DNotImplemented() { it'd assert */ } cache{PixelFormat::R32F, {1024, 512}}; - std::ostringstream out; + Containers::String out; Error redirectError{&out}; cache.flushImage(0, {}); - CORRADE_COMPARE(out.str(), "Text::AbstractGlyphCache::image(): not implemented by derived class\n"); + CORRADE_COMPARE(out, "Text::AbstractGlyphCache::image(): not implemented by derived class\n"); } void AbstractGlyphCacheTest::flushImageOutOfRange() { @@ -1555,7 +1554,7 @@ void AbstractGlyphCacheTest::flushImageOutOfRange() { else cache = DummyGlyphCache{PixelFormat::R32F, {1024, 512, 8}, data.padding}; - std::ostringstream out; + Containers::String out; Error redirectError{&out}; /* Negative min X, Y, layer */ cache.flushImage({{-1, 30, 4}, {45, 35, 6}}); @@ -1571,7 +1570,7 @@ void AbstractGlyphCacheTest::flushImageOutOfRange() { cache.flushImage({{45, 30, 4}, {15, 35, 6}}); cache.flushImage({{15, 35, 4}, {45, 30, 6}}); cache.flushImage({{15, 30, 6}, {45, 35, 4}}); - CORRADE_COMPARE_AS(out.str(), + CORRADE_COMPARE_AS(out, "Text::AbstractGlyphCache::flushImage(): {{-1, 30, 4}, {45, 35, 6}} out of range for size {1024, 512, 8}\n" "Text::AbstractGlyphCache::flushImage(): {{15, -1, 4}, {45, 35, 6}} out of range for size {1024, 512, 8}\n" "Text::AbstractGlyphCache::flushImage(): {{15, 30, -1}, {45, 35, 6}} out of range for size {1024, 512, 8}\n" @@ -1593,10 +1592,10 @@ void AbstractGlyphCacheTest::flushImage2DNot2D() { DummyGlyphCache cache{PixelFormat::R32F, {1024, 512, 3}}; - std::ostringstream out; + Containers::String out; Error redirectError{&out}; cache.flushImage(Range2Di{}); - CORRADE_COMPARE(out.str(), "Text::AbstractGlyphCache::flushImage(): use the 3D or layer overload for an array glyph cache\n"); + CORRADE_COMPARE(out, "Text::AbstractGlyphCache::flushImage(): use the 3D or layer overload for an array glyph cache\n"); } #ifdef MAGNUM_BUILD_DEPRECATED @@ -1681,7 +1680,7 @@ void AbstractGlyphCacheTest::setImageOutOfRange() { cache.setImage({80, 175}, ImageView2D{PixelFormat::R8Unorm, {20, 25}}); CORRADE_IGNORE_DEPRECATED_POP - std::ostringstream out; + Containers::String out; Error redirectError{&out}; CORRADE_IGNORE_DEPRECATED_PUSH cache.setImage({81, 175}, ImageView2D{PixelFormat::R8Unorm, {20, 25}}); @@ -1689,7 +1688,7 @@ void AbstractGlyphCacheTest::setImageOutOfRange() { cache.setImage({-1, 175}, ImageView2D{PixelFormat::R8Unorm, {20, 25}}); cache.setImage({80, -1}, ImageView2D{PixelFormat::R8Unorm, {20, 25}}); CORRADE_IGNORE_DEPRECATED_POP - CORRADE_COMPARE_AS(out.str(), + CORRADE_COMPARE_AS(out, "Text::AbstractGlyphCache::setImage(): Range({81, 175}, {101, 200}) out of range for glyph cache of size Vector(100, 200)\n" "Text::AbstractGlyphCache::setImage(): Range({80, 176}, {100, 201}) out of range for glyph cache of size Vector(100, 200)\n" "Text::AbstractGlyphCache::setImage(): Range({-1, 175}, {19, 200}) out of range for glyph cache of size Vector(100, 200)\n" @@ -1702,12 +1701,12 @@ void AbstractGlyphCacheTest::setImageInvalidFormat() { DummyGlyphCache cache{PixelFormat::R32F, {1024, 512}}; - std::ostringstream out; + Containers::String out; Error redirectError{&out}; CORRADE_IGNORE_DEPRECATED_PUSH cache.setImage({15, 30}, ImageView2D{PixelFormat::R8Unorm, {45, 35}}); CORRADE_IGNORE_DEPRECATED_POP - CORRADE_COMPARE(out.str(), "Text::AbstractGlyphCache::setImage(): expected PixelFormat::R32F but got PixelFormat::R8Unorm\n"); + CORRADE_COMPARE(out, "Text::AbstractGlyphCache::setImage(): expected PixelFormat::R32F but got PixelFormat::R8Unorm\n"); } void AbstractGlyphCacheTest::setImageNot2D() { @@ -1715,12 +1714,12 @@ void AbstractGlyphCacheTest::setImageNot2D() { DummyGlyphCache cache{PixelFormat::R32F, {1024, 512, 3}}; - std::ostringstream out; + Containers::String out; Error redirectError{&out}; CORRADE_IGNORE_DEPRECATED_PUSH cache.setImage({}, ImageView2D{PixelFormat::R32F, {}, nullptr}); CORRADE_IGNORE_DEPRECATED_POP - CORRADE_COMPARE(out.str(), "Text::AbstractGlyphCache::setImage(): can't be used on an array glyph cache\n"); + CORRADE_COMPARE(out, "Text::AbstractGlyphCache::setImage(): can't be used on an array glyph cache\n"); } #endif @@ -1758,10 +1757,10 @@ void AbstractGlyphCacheTest::processedImageNotSupported() { GlyphCacheFeatures _features; } cache{{200, 300}, data.features}; - std::ostringstream out; + Containers::String out; Error redirectError{&out}; cache.processedImage(); - CORRADE_COMPARE(out.str(), "Text::AbstractGlyphCache::processedImage(): feature not supported\n"); + CORRADE_COMPARE(out, "Text::AbstractGlyphCache::processedImage(): feature not supported\n"); } void AbstractGlyphCacheTest::processedImageNotImplemented() { @@ -1776,10 +1775,10 @@ void AbstractGlyphCacheTest::processedImageNotImplemented() { void doSetImage(const Vector2i&, const ImageView2D&) override {} } cache{PixelFormat::R8Unorm, {200, 300}}; - std::ostringstream out; + Containers::String out; Error redirectError{&out}; cache.processedImage(); - CORRADE_COMPARE(out.str(), "Text::AbstractGlyphCache::processedImage(): feature advertised but not implemented\n"); + CORRADE_COMPARE(out, "Text::AbstractGlyphCache::processedImage(): feature advertised but not implemented\n"); } void AbstractGlyphCacheTest::setProcessedImage() { @@ -1919,10 +1918,10 @@ void AbstractGlyphCacheTest::setProcessedImageNotImplemented() { } } cache{PixelFormat::R32F, {1024, 512, 8}}; - std::ostringstream out; + Containers::String out; Error redirectError{&out}; cache.setProcessedImage({}, ImageView3D{PixelFormat::R32F, {}}); - CORRADE_COMPARE(out.str(), "Text::AbstractGlyphCache::setProcessedImage(): feature advertised but not implemented\n"); + CORRADE_COMPARE(out, "Text::AbstractGlyphCache::setProcessedImage(): feature advertised but not implemented\n"); } void AbstractGlyphCacheTest::setProcessedImagePassthrough2DNotImplemented() { @@ -1941,10 +1940,10 @@ void AbstractGlyphCacheTest::setProcessedImagePassthrough2DNotImplemented() { } } cache{PixelFormat::R32F, {1024, 512, 8}}; - std::ostringstream out; + Containers::String out; Error redirectError{&out}; cache.setProcessedImage({}, ImageView3D{PixelFormat::R32F, {}}); - CORRADE_COMPARE(out.str(), "Text::AbstractGlyphCache::setProcessedImage(): feature advertised but not implemented\n"); + CORRADE_COMPARE(out, "Text::AbstractGlyphCache::setProcessedImage(): feature advertised but not implemented\n"); } void AbstractGlyphCacheTest::setProcessedImageOutOfRange() { @@ -1967,7 +1966,7 @@ void AbstractGlyphCacheTest::setProcessedImageOutOfRange() { /* Large enough data to fit in all cases below, 4-byte aligned rows */ Containers::Array image{NoInit, 1012*5*2}; - std::ostringstream out; + Containers::String out; Error redirectError{&out}; /* Negative min X, Y, layer */ cache.setProcessedImage({-1, 30, 4}, @@ -1983,7 +1982,7 @@ void AbstractGlyphCacheTest::setProcessedImageOutOfRange() { ImageView3D{PixelFormat::R8Snorm, {30, 483, 2}}); cache.setProcessedImage({15, 30, 4}, ImageView3D{PixelFormat::R8Snorm, {30, 5, 5}}); - CORRADE_COMPARE_AS(out.str(), + CORRADE_COMPARE_AS(out, "Text::AbstractGlyphCache::setProcessedImage(): {{-1, 30, 4}, {45, 35, 6}} out of range for size {1024, 512, 8}\n" "Text::AbstractGlyphCache::setProcessedImage(): {{15, -1, 4}, {45, 35, 6}} out of range for size {1024, 512, 8}\n" "Text::AbstractGlyphCache::setProcessedImage(): {{15, 30, -1}, {45, 35, 6}} out of range for size {1024, 512, 8}\n" @@ -2006,10 +2005,10 @@ void AbstractGlyphCacheTest::setProcessedImageInvalidFormat() { /* The source format should not have any effect on the check */ } cache{PixelFormat::RGBA32F, {1024, 512, 8}, PixelFormat::R8Snorm, {3, 2}}; - std::ostringstream out; + Containers::String out; Error redirectError{&out}; cache.setProcessedImage({}, ImageView3D{PixelFormat::R8Unorm, {3, 2, 1}, "abcdefgh"}); - CORRADE_COMPARE(out.str(), "Text::AbstractGlyphCache::setProcessedImage(): expected PixelFormat::R8Snorm but got PixelFormat::R8Unorm\n"); + CORRADE_COMPARE(out, "Text::AbstractGlyphCache::setProcessedImage(): expected PixelFormat::R8Snorm but got PixelFormat::R8Unorm\n"); } void AbstractGlyphCacheTest::setProcessedImage2DNot2D() { @@ -2023,10 +2022,10 @@ void AbstractGlyphCacheTest::setProcessedImage2DNot2D() { } } cache{PixelFormat::R8Unorm, {3, 2, 8}}; - std::ostringstream out; + Containers::String out; Error redirectError{&out}; cache.setProcessedImage({}, ImageView2D{PixelFormat::R8Unorm, {3, 2}, "abcdefgh"}); - CORRADE_COMPARE(out.str(), "Text::AbstractGlyphCache::setProcessedImage(): use the 3D overload for an array glyph cache\n"); + CORRADE_COMPARE(out, "Text::AbstractGlyphCache::setProcessedImage(): use the 3D overload for an array glyph cache\n"); } void AbstractGlyphCacheTest::access() { @@ -2168,7 +2167,7 @@ void AbstractGlyphCacheTest::accessInvalid() { }; UnsignedInt glyphIds[4]; - std::ostringstream out; + Containers::String out; Error redirectError{&out}; cache.glyph(cache.fontCount(), 0); cache.glyphId(cache.fontCount(), 0); @@ -2176,7 +2175,7 @@ void AbstractGlyphCacheTest::accessInvalid() { cache.glyphId(fontId, cache.fontGlyphCount(fontId)); cache.glyphIdsInto(fontId, fontGlyphIds, glyphIds); cache.glyph(cache.glyphCount()); - CORRADE_COMPARE_AS(out.str(), + CORRADE_COMPARE_AS(out, "Text::AbstractGlyphCache::glyph(): index 2 out of range for 2 fonts\n" "Text::AbstractGlyphCache::glyphId(): index 2 out of range for 2 fonts\n" "Text::AbstractGlyphCache::glyph(): index 3 out of range for 3 glyphs in font 1\n" @@ -2203,11 +2202,11 @@ void AbstractGlyphCacheTest::accessBatchInvalid() { UnsignedInt glyphIds[4]; UnsignedInt glyphIdsInvalid[3]; - std::ostringstream out; + Containers::String out; Error redirectError{&out}; cache.glyphIdsInto(cache.fontCount(), fontGlyphIds, glyphIds); cache.glyphIdsInto(fontId, fontGlyphIds, glyphIdsInvalid); - CORRADE_COMPARE(out.str(), + CORRADE_COMPARE(out, "Text::AbstractGlyphCache::glyphIdsInto(): index 2 out of range for 2 fonts\n" "Text::AbstractGlyphCache::glyphIdsInto(): expected fontGlyphIds and glyphIds views to have the same size but got 4 and 3\n"); } @@ -2249,12 +2248,12 @@ void AbstractGlyphCacheTest::accessDeprecatedNot2D() { DummyGlyphCache cache{PixelFormat::R32F, {1024, 512, 3}}; - std::ostringstream out; + Containers::String out; Error redirectError{&out}; CORRADE_IGNORE_DEPRECATED_PUSH cache[5]; CORRADE_IGNORE_DEPRECATED_POP - CORRADE_COMPARE(out.str(), "Text::AbstractGlyphCache::operator[](): can't be used on an array glyph cache\n"); + CORRADE_COMPARE(out, "Text::AbstractGlyphCache::operator[](): can't be used on an array glyph cache\n"); } #endif diff --git a/src/Magnum/Text/Test/AbstractShaperTest.cpp b/src/Magnum/Text/Test/AbstractShaperTest.cpp index a30ce685d..22daaf449 100644 --- a/src/Magnum/Text/Test/AbstractShaperTest.cpp +++ b/src/Magnum/Text/Test/AbstractShaperTest.cpp @@ -24,13 +24,10 @@ DEALINGS IN THE SOFTWARE. */ -#include -#include -#include /** @todo remove once Debug is stream-free */ #include +#include #include #include -#include /** @todo remove once Debug is stream-free */ #include "Magnum/Math/Vector2.h" #include "Magnum/Text/AbstractShaper.h" @@ -491,7 +488,7 @@ void AbstractShaperTest::shapeBeginEndOutOfRange() { /* Capture correct function name */ CORRADE_VERIFY(true); - std::ostringstream out; + Containers::String out; Error redirectError{&out}; /* Begin out of range, end unbounded */ shaper.shape("hello", 6, ~UnsignedInt{}); @@ -517,7 +514,7 @@ void AbstractShaperTest::shapeBeginEndOutOfRange() { Feature::AccessAllAlternates, {Feature::Kerning, 4, 3}, }); - CORRADE_COMPARE_AS(out.str(), + CORRADE_COMPARE_AS(out, "Text::AbstractShaper::shape(): begin 6 and end 4294967295 out of range for a text of 5 bytes\n" "Text::AbstractShaper::shape(): feature 1 begin 6 and end 4294967295 out of range for a text of 5 bytes\n" "Text::AbstractShaper::shape(): begin 6 and end 7 out of range for a text of 5 bytes\n" @@ -587,13 +584,13 @@ void AbstractShaperTest::glyphsIntoInvalidViewSizes() { Vector2 advancesWrong[6]; UnsignedInt clustersWrong[6]; - std::ostringstream out; + Containers::String out; Error redirectError{&out}; shaper.glyphIdsInto(idsWrong); shaper.glyphOffsetsAdvancesInto(offsetsWrong, advances); shaper.glyphOffsetsAdvancesInto(offsets, advancesWrong); shaper.glyphClustersInto(clustersWrong); - CORRADE_COMPARE(out.str(), + CORRADE_COMPARE(out, "Text::AbstractShaper::glyphIdsInto(): expected the ids view to have a size of 5 but got 6\n" "Text::AbstractShaper::glyphOffsetsAdvancesInto(): expected the offsets and advanced views to have a size of 5 but got 6 and 5\n" "Text::AbstractShaper::glyphOffsetsAdvancesInto(): expected the offsets and advanced views to have a size of 5 but got 5 and 6\n" diff --git a/src/Magnum/Text/Test/AlignmentTest.cpp b/src/Magnum/Text/Test/AlignmentTest.cpp index a26676985..2e1bc6115 100644 --- a/src/Magnum/Text/Test/AlignmentTest.cpp +++ b/src/Magnum/Text/Test/AlignmentTest.cpp @@ -24,11 +24,9 @@ DEALINGS IN THE SOFTWARE. */ -#include -#include /** @todo remove once Debug is stream-free */ +#include #include #include -#include /** @todo remove once Debug is stream-free */ #include "Magnum/Text/Alignment.h" #include "Magnum/Text/Direction.h" @@ -52,9 +50,9 @@ AlignmentTest::AlignmentTest() { } void AlignmentTest::debug() { - std::ostringstream out; + Containers::String out; Debug{&out} << Alignment::MiddleRightGlyphBounds << Alignment(0xab); - CORRADE_COMPARE(out.str(), "Text::Alignment::MiddleRightGlyphBounds Text::Alignment(0xab)\n"); + CORRADE_COMPARE(out, "Text::Alignment::MiddleRightGlyphBounds Text::Alignment(0xab)\n"); } void AlignmentTest::forDirection() { @@ -114,14 +112,14 @@ void AlignmentTest::forDirection() { void AlignmentTest::forDirectionInvalid() { CORRADE_SKIP_IF_NO_ASSERT(); - std::ostringstream out; + Containers::String out; Error redirectError{&out}; /* It should blow up also for alignments that don't use Start or End, for consistency */ alignmentForDirection(Alignment::BottomCenter, LayoutDirection::VerticalRightToLeft, ShapeDirection::Unspecified); alignmentForDirection(Alignment::MiddleCenterIntegral, LayoutDirection::HorizontalTopToBottom, ShapeDirection::TopToBottom); alignmentForDirection(Alignment::MiddleCenterIntegral, LayoutDirection::HorizontalTopToBottom, ShapeDirection::BottomToTop); - CORRADE_COMPARE_AS(out.str(), + CORRADE_COMPARE_AS(out, "Text::alignmentForDirection(): only Text::LayoutDirection::HorizontalTopToBottom is supported right now, got Text::LayoutDirection::VerticalRightToLeft\n" "Text::alignmentForDirection(): Text::ShapeDirection::TopToBottom is not supported yet, sorry\n" "Text::alignmentForDirection(): Text::ShapeDirection::BottomToTop is not supported yet, sorry\n", diff --git a/src/Magnum/Text/Test/DirectionTest.cpp b/src/Magnum/Text/Test/DirectionTest.cpp index 73650f1a4..9ed7f6d94 100644 --- a/src/Magnum/Text/Test/DirectionTest.cpp +++ b/src/Magnum/Text/Test/DirectionTest.cpp @@ -24,9 +24,8 @@ DEALINGS IN THE SOFTWARE. */ -#include +#include #include -#include /** @todo remove once Debug is stream-free */ #include "Magnum/Text/Direction.h" @@ -45,15 +44,15 @@ DirectionTest::DirectionTest() { } void DirectionTest::debugShape() { - std::ostringstream out; + Containers::String out; Debug{&out} << ShapeDirection::RightToLeft << ShapeDirection(0xab); - CORRADE_COMPARE(out.str(), "Text::ShapeDirection::RightToLeft Text::ShapeDirection(0xab)\n"); + CORRADE_COMPARE(out, "Text::ShapeDirection::RightToLeft Text::ShapeDirection(0xab)\n"); } void DirectionTest::debugLayout() { - std::ostringstream out; + Containers::String out; Debug{&out} << LayoutDirection::VerticalRightToLeft << LayoutDirection(0xab); - CORRADE_COMPARE(out.str(), "Text::LayoutDirection::VerticalRightToLeft Text::LayoutDirection(0xab)\n"); + CORRADE_COMPARE(out, "Text::LayoutDirection::VerticalRightToLeft Text::LayoutDirection(0xab)\n"); } }}}} diff --git a/src/Magnum/Text/Test/DistanceFieldGlyphCacheGLTest.cpp b/src/Magnum/Text/Test/DistanceFieldGlyphCacheGLTest.cpp index 59713573e..d69cbc7ea 100644 --- a/src/Magnum/Text/Test/DistanceFieldGlyphCacheGLTest.cpp +++ b/src/Magnum/Text/Test/DistanceFieldGlyphCacheGLTest.cpp @@ -24,14 +24,12 @@ DEALINGS IN THE SOFTWARE. */ -#include #include -#include /**< @todo remove once Debug is stream-free */ +#include #include #include #include -#include /**< @todo remove once Debug is stream-free */ -#include /**< @todo remove once Debug is stream-free */ +#include #include #include "Magnum/Image.h" @@ -179,7 +177,7 @@ void DistanceFieldGlyphCacheGLTest::constructSizeRatioNotMultipleOfTwo() { DistanceFieldGlyphCacheGL{Vector2i{23*14}, Vector2i{23}, 4}; /* It's the same assert as in TextureTools::DistanceFieldGL */ - std::ostringstream out; + Containers::String out; Error redirectError{&out}; DistanceFieldGlyphCacheGL{Vector2i{23*14}, Vector2i{23*2}, 4}; /* Verify also just one axis wrong */ @@ -188,7 +186,7 @@ void DistanceFieldGlyphCacheGLTest::constructSizeRatioNotMultipleOfTwo() { /* Almost correct except that it's not an integer multiply */ DistanceFieldGlyphCacheGL{Vector2i{23*14}, {22, 23}, 4}; DistanceFieldGlyphCacheGL{Vector2i{23*14}, {23, 22}, 4}; - CORRADE_COMPARE_AS(out.str(), + CORRADE_COMPARE_AS(out, "Text::DistanceFieldGlyphCacheGL: expected source and processed size ratio to be a multiple of 2, got {322, 322} and {46, 46}\n" "Text::DistanceFieldGlyphCacheGL: expected source and processed size ratio to be a multiple of 2, got {322, 322} and {46, 23}\n" "Text::DistanceFieldGlyphCacheGL: expected source and processed size ratio to be a multiple of 2, got {322, 322} and {23, 46}\n" @@ -371,7 +369,7 @@ void DistanceFieldGlyphCacheGLTest::setDistanceFieldImageUnsupportedGLFormat() { DistanceFieldGlyphCacheGL cache{{4, 4}, {1, 1}, 4}; - std::ostringstream out; + Containers::String out; Error redirectError{&out}; CORRADE_IGNORE_DEPRECATED_PUSH /* Format that is convertible back to the generic format but isn't @@ -380,7 +378,7 @@ void DistanceFieldGlyphCacheGLTest::setDistanceFieldImageUnsupportedGLFormat() { /* Format that doesn't have a generic equivalent gets passed as-is */ cache.setDistanceFieldImage({}, ImageView2D{GL::PixelFormat::RGBA, GL::PixelType::UnsignedShort5551, {1, 1}, "hello!!"}); CORRADE_IGNORE_DEPRECATED_POP - CORRADE_COMPARE_AS(out.str(), Utility::formatString( + CORRADE_COMPARE_AS(out, Utility::format( "Text::AbstractGlyphCache::setProcessedImage(): expected PixelFormat::{0} but got PixelFormat::RGBA32F\n" "Text::AbstractGlyphCache::setProcessedImage(): expected PixelFormat::{0} but got PixelFormat::ImplementationSpecific(0x1908)\n", cache.processedFormat() == PixelFormat::RGBA8Unorm ? "RGBA8Unorm" : "R8Unorm"), diff --git a/src/Magnum/Text/Test/FeatureTest.cpp b/src/Magnum/Text/Test/FeatureTest.cpp index ef89f2c3e..fd1862812 100644 --- a/src/Magnum/Text/Test/FeatureTest.cpp +++ b/src/Magnum/Text/Test/FeatureTest.cpp @@ -24,10 +24,8 @@ DEALINGS IN THE SOFTWARE. */ -#include -#include +#include #include -#include #include "Magnum/Text/Feature.h" @@ -134,9 +132,9 @@ void FeatureTest::rangeConstructBeginEnd() { } void FeatureTest::debug() { - std::ostringstream out; + Containers::String out; Debug{&out} << Feature::StandardLigatures << Text::feature('m', 'a', '\xab', 'g'); - CORRADE_COMPARE(out.str(), "Text::Feature::StandardLigatures Text::Feature('m', 'a', 0xab, 'g')\n"); + CORRADE_COMPARE(out, "Text::Feature::StandardLigatures Text::Feature('m', 'a', 0xab, 'g')\n"); } void FeatureTest::fromFourCC() { @@ -155,13 +153,13 @@ void FeatureTest::fromString() { void FeatureTest::fromStringInvalid() { CORRADE_SKIP_IF_NO_ASSERT(); - std::ostringstream out; + Containers::String out; Error redirectError{&out}; Text::feature(""); Text::feature("hahah"); /* Non-ASCII values are allowed, as the constexpr feature() allows them too */ - CORRADE_COMPARE(out.str(), + CORRADE_COMPARE(out, "Text::feature(): expected a four-character code, got \n" "Text::feature(): expected a four-character code, got hahah\n"); } diff --git a/src/Magnum/Text/Test/GlyphCacheGLTest.cpp b/src/Magnum/Text/Test/GlyphCacheGLTest.cpp index 26f9b88ee..6d4c272ab 100644 --- a/src/Magnum/Text/Test/GlyphCacheGLTest.cpp +++ b/src/Magnum/Text/Test/GlyphCacheGLTest.cpp @@ -24,10 +24,8 @@ DEALINGS IN THE SOFTWARE. */ -#include -#include +#include #include -#include /**< @todo remove once Debug is stream-free */ #include #include @@ -383,11 +381,11 @@ void GlyphCacheGLTest::flushImageSubclassProcessedFormatSize() { Cache differentFormat{PixelFormat::R8Unorm, {32, 32}, PixelFormat::RGBA8Unorm, {32, 32}}; Cache differentSize{PixelFormat::R8Unorm, {32, 32}, PixelFormat::R8Unorm, {16, 32}}; - std::ostringstream out; + Containers::String out; Error redirectError{&out}; differentFormat.flushImage({{}, {32, 32}}); differentSize.flushImage({{}, {32, 32}}); - CORRADE_COMPARE_AS(out.str(), + CORRADE_COMPARE_AS(out, "Text::GlyphCacheGL::flushImage(): subclass expected to provide a doSetImage() implementation to handle different processed format or size\n" "Text::GlyphCacheGL::flushImage(): subclass expected to provide a doSetImage() implementation to handle different processed format or size\n", TestSuite::Compare::String); diff --git a/src/Magnum/Text/Test/RendererGLTest.cpp b/src/Magnum/Text/Test/RendererGLTest.cpp index 0e51be315..5f39405c8 100644 --- a/src/Magnum/Text/Test/RendererGLTest.cpp +++ b/src/Magnum/Text/Test/RendererGLTest.cpp @@ -24,12 +24,10 @@ DEALINGS IN THE SOFTWARE. */ -#include #include #include #include #include -#include /** @todo drop once Debug is stream-free */ #include "Magnum/PixelFormat.h" #include "Magnum/GL/Context.h" diff --git a/src/Magnum/Text/Test/RendererTest.cpp b/src/Magnum/Text/Test/RendererTest.cpp index 7699deb30..b92f83c5e 100644 --- a/src/Magnum/Text/Test/RendererTest.cpp +++ b/src/Magnum/Text/Test/RendererTest.cpp @@ -24,16 +24,13 @@ DEALINGS IN THE SOFTWARE. */ -#include #include #include -#include -#include /** @todo drop once Debug is stream-free */ +#include #include #include #include #include -#include /** @todo drop once Debug is stream-free */ #include "Magnum/PixelFormat.h" #include "Magnum/Text/AbstractFont.h" @@ -553,12 +550,12 @@ void RendererTest::lineGlyphPositionsInvalidViewSizes() { Vector2 dataInvalid[4]; Vector2 cursor; - std::ostringstream out; + Containers::String out; Error redirectError{&out}; renderLineGlyphPositionsInto(font, 10.0f, LayoutDirection::HorizontalTopToBottom, data, data, cursor, dataInvalid); renderLineGlyphPositionsInto(font, 10.0f, LayoutDirection::HorizontalTopToBottom, data, dataInvalid, cursor, data); renderLineGlyphPositionsInto(font, 10.0f, LayoutDirection::HorizontalTopToBottom, dataInvalid, data, cursor, data); - CORRADE_COMPARE(out.str(), + CORRADE_COMPARE(out, "Text::renderLineGlyphPositionsInto(): expected glyphOffsets, glyphAdvances and output views to have the same size, got 5, 5 and 4\n" "Text::renderLineGlyphPositionsInto(): expected glyphOffsets, glyphAdvances and output views to have the same size, got 5, 4 and 5\n" "Text::renderLineGlyphPositionsInto(): expected glyphOffsets, glyphAdvances and output views to have the same size, got 4, 5 and 5\n"); @@ -570,10 +567,10 @@ void RendererTest::lineGlyphPositionsInvalidDirection() { TestFont font; Vector2 cursor; - std::ostringstream out; + Containers::String out; Error redirectError{&out}; renderLineGlyphPositionsInto(font, 10.0f, LayoutDirection::VerticalLeftToRight, {}, {}, cursor, {}); - CORRADE_COMPARE(out.str(), "Text::renderLineGlyphPositionsInto(): only Text::LayoutDirection::HorizontalTopToBottom is supported right now, got Text::LayoutDirection::VerticalLeftToRight\n"); + CORRADE_COMPARE(out, "Text::renderLineGlyphPositionsInto(): only Text::LayoutDirection::HorizontalTopToBottom is supported right now, got Text::LayoutDirection::VerticalLeftToRight\n"); } void RendererTest::lineGlyphPositionsNoFontOpened() { @@ -582,10 +579,10 @@ void RendererTest::lineGlyphPositionsNoFontOpened() { TestFont font; Vector2 cursor; - std::ostringstream out; + Containers::String out; Error redirectError{&out}; renderLineGlyphPositionsInto(font, 10.0f, LayoutDirection::HorizontalTopToBottom, {}, {}, cursor, {}); - CORRADE_COMPARE(out.str(), "Text::renderLineGlyphPositionsInto(): no font opened\n"); + CORRADE_COMPARE(out, "Text::renderLineGlyphPositionsInto(): no font opened\n"); } void RendererTest::glyphQuads() { @@ -747,7 +744,7 @@ void RendererTest::glyphQuadsInvalidViewSizes() { Vector3 textureCoordinates[16]; Vector3 textureCoordinatesInvalid[17]; - std::ostringstream out; + Containers::String out; Error redirectError{&out}; renderGlyphQuadsInto(font, 10.0f, cache, glyphPositions, glyphIdsInvalid, positions, textureCoordinates); renderGlyphQuadsInto(cache, 2.0f, glyphPositions, glyphIdsInvalid, positions, textureCoordinates); @@ -757,7 +754,7 @@ void RendererTest::glyphQuadsInvalidViewSizes() { renderGlyphQuadsInto(cache, 2.0f, glyphPositions, glyphIds, positions, textureCoordinatesInvalid); renderGlyphQuadsInto(font, 10.0f, cache, glyphPositions, glyphIds, positionsInvalid, textureCoordinates); renderGlyphQuadsInto(cache, 10.0f, glyphPositions, glyphIds, positionsInvalid, textureCoordinates); - CORRADE_COMPARE_AS(out.str(), + CORRADE_COMPARE_AS(out, "Text::renderGlyphQuadsInto(): expected fontGlyphIds and glyphPositions views to have the same size, got 3 and 4\n" "Text::renderGlyphQuadsInto(): expected glyphIds and glyphPositions views to have the same size, got 3 and 4\n" "Text::renderGlyphQuadsInto(): expected fontGlyphIds and glyphPositions views to have the same size, got 4 and 5\n" @@ -775,10 +772,10 @@ void RendererTest::glyphQuadsNoFontOpened() { TestFont font; DummyGlyphCache cache{PixelFormat::R8Unorm, {20, 20}}; - std::ostringstream out; + Containers::String out; Error redirectError{&out}; renderGlyphQuadsInto(font, 10.0f, cache, nullptr, nullptr, nullptr, Containers::StridedArrayView1D{}); - CORRADE_COMPARE(out.str(), "Text::renderGlyphQuadsInto(): no font opened\n"); + CORRADE_COMPARE(out, "Text::renderGlyphQuadsInto(): no font opened\n"); } void RendererTest::glyphQuadsFontNotFoundInCache() { @@ -790,10 +787,10 @@ void RendererTest::glyphQuadsFontNotFoundInCache() { cache.addFont(56); cache.addFont(13); - std::ostringstream out; + Containers::String out; Error redirectError{&out}; renderGlyphQuadsInto(font, 10.0f, cache, nullptr, nullptr, nullptr, Containers::StridedArrayView1D{}); - CORRADE_COMPARE(out.str(), "Text::renderGlyphQuadsInto(): font not found among 2 fonts in passed glyph cache\n"); + CORRADE_COMPARE(out, "Text::renderGlyphQuadsInto(): font not found among 2 fonts in passed glyph cache\n"); } void RendererTest::glyphQuads2D() { @@ -871,10 +868,10 @@ void RendererTest::glyphQuads2DArrayGlyphCache() { GlyphCacheFeatures doFeatures() const override { return {}; } } cache{PixelFormat::R8Unorm, {20, 20, 2}}; - std::ostringstream out; + Containers::String out; Error redirectError{&out}; renderGlyphQuadsInto(font, 10.0f, cache, nullptr, nullptr, nullptr, Containers::StridedArrayView1D{}); - CORRADE_COMPARE(out.str(), "Text::renderGlyphQuadsInto(): can't use this overload with an array glyph cache\n"); + CORRADE_COMPARE(out, "Text::renderGlyphQuadsInto(): can't use this overload with an array glyph cache\n"); } void RendererTest::alignLine() { @@ -901,11 +898,11 @@ void RendererTest::alignLine() { void RendererTest::alignLineInvalidDirection() { CORRADE_SKIP_IF_NO_ASSERT(); - std::ostringstream out; + Containers::String out; Error redirectError{&out}; alignRenderedLine({}, LayoutDirection::VerticalRightToLeft, Alignment::LineLeft, nullptr); alignRenderedLine({}, LayoutDirection::HorizontalTopToBottom, Alignment::BottomEnd, nullptr); - CORRADE_COMPARE_AS(out.str(), + CORRADE_COMPARE_AS(out, "Text::alignRenderedLine(): only Text::LayoutDirection::HorizontalTopToBottom is supported right now, got Text::LayoutDirection::VerticalRightToLeft\n" "Text::alignRenderedLine(): Text::Alignment::BottomEnd has to be resolved to *Left / *Right before being passed to this function\n", TestSuite::Compare::String); @@ -935,11 +932,11 @@ void RendererTest::alignBlock() { void RendererTest::alignBlockInvalidDirection() { CORRADE_SKIP_IF_NO_ASSERT(); - std::ostringstream out; + Containers::String out; Error redirectError{&out}; alignRenderedBlock({}, LayoutDirection::VerticalRightToLeft, Alignment::LineLeft, nullptr); alignRenderedBlock({}, LayoutDirection::HorizontalTopToBottom, Alignment::LineStartGlyphBounds, nullptr); - CORRADE_COMPARE_AS(out.str(), + CORRADE_COMPARE_AS(out, "Text::alignRenderedBlock(): only Text::LayoutDirection::HorizontalTopToBottom is supported right now, got Text::LayoutDirection::VerticalRightToLeft\n" "Text::alignRenderedBlock(): Text::Alignment::LineStartGlyphBounds has to be resolved to *Left / *Right before being passed to this function\n", TestSuite::Compare::String); @@ -981,7 +978,7 @@ void RendererTest::glyphQuadIndicesTypeTooSmall() { renderGlyphQuadIndicesInto(65536/4, Containers::ArrayView{}); renderGlyphQuadIndicesInto(4294967296u/4, Containers::ArrayView{}); - std::ostringstream out; + Containers::String out; Error redirectError{&out}; renderGlyphQuadIndicesInto(256/4 - 3 + 1, indices8); renderGlyphQuadIndicesInto(65536/4 - 3 + 1, indices16); @@ -990,7 +987,7 @@ void RendererTest::glyphQuadIndicesTypeTooSmall() { renderGlyphQuadIndicesInto(256/4 + 1, Containers::ArrayView{}); renderGlyphQuadIndicesInto(65536/4 + 1, Containers::ArrayView{}); renderGlyphQuadIndicesInto(4294967296u/4 + 1, Containers::ArrayView{}); - CORRADE_COMPARE(out.str(), + CORRADE_COMPARE(out, "Text::renderGlyphQuadIndicesInto(): max index value of 259 cannot fit into a 8-bit type\n" "Text::renderGlyphQuadIndicesInto(): max index value of 65539 cannot fit into a 16-bit type\n" "Text::renderGlyphQuadIndicesInto(): max index value of 4294967299 cannot fit into a 32-bit type\n" @@ -1436,10 +1433,10 @@ void RendererTest::arrayGlyphCache() { GlyphCacheFeatures doFeatures() const override { return {}; } } cache{PixelFormat::R8Unorm, {100, 100, 3}}; - std::ostringstream out; + Containers::String out; Error redirectError{&out}; AbstractRenderer::render(font, cache, 0.25f, "abc"); - CORRADE_COMPARE(out.str(), "Text::Renderer: array glyph caches are not supported\n"); + CORRADE_COMPARE(out, "Text::Renderer: array glyph caches are not supported\n"); } void RendererTest::fontNotFoundInCache() { @@ -1452,10 +1449,10 @@ void RendererTest::fontNotFoundInCache() { cache.addFont(34); cache.addFont(25); - std::ostringstream out; + Containers::String out; Error redirectError{&out}; AbstractRenderer::render(font, cache, 0.25f, "abc"); - CORRADE_COMPARE(out.str(), "Text::Renderer: font not found among 2 fonts in passed glyph cache\n"); + CORRADE_COMPARE(out, "Text::Renderer: font not found among 2 fonts in passed glyph cache\n"); } #endif diff --git a/src/Magnum/Text/Test/ScriptTest.cpp b/src/Magnum/Text/Test/ScriptTest.cpp index db943e485..4e6965428 100644 --- a/src/Magnum/Text/Test/ScriptTest.cpp +++ b/src/Magnum/Text/Test/ScriptTest.cpp @@ -24,10 +24,8 @@ DEALINGS IN THE SOFTWARE. */ -#include -#include +#include #include -#include #include "Magnum/Text/Script.h" @@ -52,9 +50,9 @@ ScriptTest::ScriptTest() { } void ScriptTest::debug() { - std::ostringstream out; + Containers::String out; Debug{&out} << Script::Latin << Text::script('M', 'a', '\xab', 'g'); - CORRADE_COMPARE(out.str(), "Text::Script::Latin Text::Script('M', 'a', 0xab, 'g')\n"); + CORRADE_COMPARE(out, "Text::Script::Latin Text::Script('M', 'a', 0xab, 'g')\n"); } void ScriptTest::fromFourCC() { @@ -73,13 +71,13 @@ void ScriptTest::fromString() { void ScriptTest::fromStringInvalid() { CORRADE_SKIP_IF_NO_ASSERT(); - std::ostringstream out; + Containers::String out; Error redirectError{&out}; Text::script(""); Text::script("hahah"); /* Non-ASCII values are allowed, as the constexpr script() allows them too */ - CORRADE_COMPARE(out.str(), + CORRADE_COMPARE(out, "Text::script(): expected a four-character code, got \n" "Text::script(): expected a four-character code, got hahah\n"); } diff --git a/src/Magnum/TextureTools/Test/AtlasTest.cpp b/src/Magnum/TextureTools/Test/AtlasTest.cpp index ad889a49b..23f3563a6 100644 --- a/src/Magnum/TextureTools/Test/AtlasTest.cpp +++ b/src/Magnum/TextureTools/Test/AtlasTest.cpp @@ -24,17 +24,15 @@ DEALINGS IN THE SOFTWARE. */ -#include #include +#include #include #include -#include -#include /** @todo remove once Debug is stream-free */ +#include #include #include #include -#include -#include +#include #include "Magnum/Math/Matrix3.h" #include "Magnum/TextureTools/Atlas.h" @@ -561,15 +559,15 @@ AtlasTest::AtlasTest() { } void AtlasTest::debugLandfillFlag() { - std::ostringstream out; + Containers::String out; Debug{&out} << AtlasLandfillFlag::RotatePortrait << AtlasLandfillFlag(0xcafedead); - CORRADE_COMPARE(out.str(), "TextureTools::AtlasLandfillFlag::RotatePortrait TextureTools::AtlasLandfillFlag(0xcafedead)\n"); + CORRADE_COMPARE(out, "TextureTools::AtlasLandfillFlag::RotatePortrait TextureTools::AtlasLandfillFlag(0xcafedead)\n"); } void AtlasTest::debugLandfillFlags() { - std::ostringstream out; + Containers::String out; Debug{&out} << (AtlasLandfillFlag::RotateLandscape|AtlasLandfillFlag::NarrowestFirst|AtlasLandfillFlag(0xdead0000)) << AtlasLandfillFlags{}; - CORRADE_COMPARE(out.str(), "TextureTools::AtlasLandfillFlag::RotateLandscape|TextureTools::AtlasLandfillFlag::NarrowestFirst|TextureTools::AtlasLandfillFlag(0xdead0000) TextureTools::AtlasLandfillFlags{}\n"); + CORRADE_COMPARE(out, "TextureTools::AtlasLandfillFlag::RotateLandscape|TextureTools::AtlasLandfillFlag::NarrowestFirst|TextureTools::AtlasLandfillFlag(0xdead0000) TextureTools::AtlasLandfillFlags{}\n"); } void AtlasTest::landfillFullFit() { @@ -1026,14 +1024,14 @@ void AtlasTest::landfillInvalidSize() { AtlasLandfill{{16, 16, 0}}; AtlasLandfill{{16, 65536, 16}}; - std::ostringstream out; + Containers::String out; Error redirectError{&out}; AtlasLandfill{{0, 16}}; AtlasLandfill{{16, 65537}}; AtlasLandfill{{0, 16, 16}}; AtlasLandfill{{16, 0, 16}}; AtlasLandfill{{16, 65537, 16}}; - CORRADE_COMPARE_AS(out.str(), + CORRADE_COMPARE_AS(out, "TextureTools::AtlasLandfill: expected non-zero width, got {0, 16, 1}\n" "TextureTools::AtlasLandfill: expected height to fit into 16 bits, got {16, 65537, 1}\n" "TextureTools::AtlasLandfill: expected non-zero width, got {0, 16, 16}\n" @@ -1047,11 +1045,11 @@ void AtlasTest::landfillSetFlagsInvalid() { AtlasLandfill atlas{{16, 16}}; - std::ostringstream out; + Containers::String out; Error redirectError{&out}; atlas.setFlags(AtlasLandfillFlag::RotatePortrait|AtlasLandfillFlag::RotateLandscape); atlas.setFlags(AtlasLandfillFlag::WidestFirst|AtlasLandfillFlag::NarrowestFirst); - CORRADE_COMPARE_AS(out.str(), + CORRADE_COMPARE_AS(out, "TextureTools::AtlasLandfill::setFlags(): only one of RotatePortrait and RotateLandscape can be set\n" "TextureTools::AtlasLandfill::setFlags(): only one of WidestFirst and NarrowestFirst can be set\n", TestSuite::Compare::String); @@ -1068,14 +1066,14 @@ void AtlasTest::landfillAddMissingRotations() { Vector2i offsets[2]; Vector3i offsets3[2]; - std::ostringstream out; + Containers::String out; Error redirectError{&out}; portrait.add(sizes, offsets); portrait.add(sizes, offsets3); /* "Testing" the rotation-less init list variants too */ landscape.add({{}, {}}, offsets); landscape.add({{}, {}}, offsets3); - CORRADE_COMPARE(out.str(), + CORRADE_COMPARE(out, "TextureTools::AtlasLandfill::add(): TextureTools::AtlasLandfillFlag::RotatePortrait set, expected a rotations view\n" "TextureTools::AtlasLandfill::add(): TextureTools::AtlasLandfillFlag::RotatePortrait set, expected a rotations view\n" "TextureTools::AtlasLandfill::add(): TextureTools::AtlasLandfillFlag::RotateLandscape set, expected a rotations view\n" @@ -1093,11 +1091,11 @@ void AtlasTest::landfillAddInvalidViewSizes() { Containers::MutableBitArrayView rotations{rotationsData, 0, 2}; Containers::MutableBitArrayView rotationsInvalid{rotationsData, 0, 3}; - std::ostringstream out; + Containers::String out; Error redirectError{&out}; atlas.add(sizes, offsetsInvalid, rotations); atlas.add(sizes, offsets, rotationsInvalid); - CORRADE_COMPARE(out.str(), + CORRADE_COMPARE(out, "TextureTools::AtlasLandfill::add(): expected sizes and offsets views to have the same size, got 2 and 3\n" "TextureTools::AtlasLandfill::add(): expected sizes and rotations views to have the same size, got 2 and 3\n"); } @@ -1112,13 +1110,13 @@ void AtlasTest::landfillAddTwoComponentForArray() { UnsignedByte rotationsData[1]; Containers::MutableBitArrayView rotations{rotationsData, 0, 2}; - std::ostringstream out; + Containers::String out; Error redirectError{&out}; atlas.add(sizes, offsets, rotations); atlas.add(sizes, offsets); atlas.add({}, offsets, rotations); atlas.add({}, offsets); - CORRADE_COMPARE(out.str(), + CORRADE_COMPARE(out, "TextureTools::AtlasLandfill::add(): use the three-component overload for an array atlas\n" "TextureTools::AtlasLandfill::add(): use the three-component overload for an array atlas\n" "TextureTools::AtlasLandfill::add(): use the three-component overload for an array atlas\n" @@ -1139,7 +1137,7 @@ void AtlasTest::landfillAddTooLargeElement() { UnsignedByte rotationsData[1]; Containers::MutableBitArrayView rotations{rotationsData, 0, 2}; - std::ostringstream out; + Containers::String out; Error redirectError{&out}; /* Zero-size elements should still be checked against bounds in the other dimension */ @@ -1150,7 +1148,7 @@ void AtlasTest::landfillAddTooLargeElement() { /* Sizes that fit but don't after a flip */ portrait2.add({{13, 13}, {15, 13}}, offsets, rotations); landscape2.add({{13, 13}, {13, 15}}, offsets3, rotations); - CORRADE_COMPARE_AS(out.str(), + CORRADE_COMPARE_AS(out, "TextureTools::AtlasLandfill::add(): expected size 1 to be not larger than {16, 23} but got {0, 24}\n" "TextureTools::AtlasLandfill::add(): expected size 1 to be not larger than {23, 16} but got {24, 0}\n" "TextureTools::AtlasLandfill::add(): expected size 1 to be not larger than {16, 23} but got {17, 23}\n" @@ -1180,7 +1178,7 @@ void AtlasTest::landfillAddTooLargeElementPadded() { UnsignedByte rotationsData[1]; Containers::MutableBitArrayView rotations{rotationsData, 0, 2}; - std::ostringstream out; + Containers::String out; Error redirectError{&out}; /* Zero-size elements should still be checked against bounds in the other dimension */ @@ -1191,7 +1189,7 @@ void AtlasTest::landfillAddTooLargeElementPadded() { /* Sizes that fit but don't after a flip */ portrait2.add({{9, 11}, {12, 11}}, offsets, rotations); landscape2.add({{11, 9}, {11, 12}}, offsets3, rotations); - CORRADE_COMPARE_AS(out.str(), + CORRADE_COMPARE_AS(out, "TextureTools::AtlasLandfill::add(): expected size 1 to be not larger than {16, 23} but got {0, 22} and padding {2, 1}\n" "TextureTools::AtlasLandfill::add(): expected size 1 to be not larger than {23, 16} but got {22, 0} and padding {1, 2}\n" "TextureTools::AtlasLandfill::add(): expected size 1 to be not larger than {16, 23} but got {13, 21} and padding {2, 1}\n" @@ -1242,8 +1240,8 @@ void AtlasTest::deprecatedEmpty() { } void AtlasTest::deprecatedTooSmall() { - std::ostringstream o; - Error redirectError{&o}; + Containers::String out; + Error redirectError{&out}; CORRADE_IGNORE_DEPRECATED_PUSH std::vector atlas = TextureTools::atlas({64, 32}, { @@ -1253,7 +1251,7 @@ void AtlasTest::deprecatedTooSmall() { }, {2, 1}); CORRADE_IGNORE_DEPRECATED_POP CORRADE_VERIFY(atlas.empty()); - CORRADE_COMPARE(o.str(), "TextureTools::atlas(): requested atlas size Vector(64, 32) is too small to fit 3 Vector(25, 31) textures. Generated atlas will be empty.\n"); + CORRADE_COMPARE(out, "TextureTools::atlas(): requested atlas size Vector(64, 32) is too small to fit 3 Vector(25, 31) textures. Generated atlas will be empty.\n"); } #endif @@ -1388,10 +1386,10 @@ void AtlasTest::arrayPowerOfTwoInvalidViewSizes() { Vector2i sizes[2]; Vector3i offsetsInvalid[3]; - std::ostringstream out; + Containers::String out; Error redirectError{&out}; atlasArrayPowerOfTwo({}, sizes, offsetsInvalid); - CORRADE_COMPARE(out.str(), + CORRADE_COMPARE(out, "TextureTools::atlasArrayPowerOfTwo(): expected sizes and offsets views to have the same size, got 2 and 3\n"); } @@ -1401,10 +1399,10 @@ void AtlasTest::arrayPowerOfTwoWrongLayerSize() { CORRADE_SKIP_IF_NO_ASSERT(); - std::ostringstream out; + Containers::String out; Error redirectError{&out}; atlasArrayPowerOfTwo(data.size, {}, {}); - CORRADE_COMPARE(out.str(), Utility::formatString("TextureTools::atlasArrayPowerOfTwo(): expected layer size to be a non-zero power-of-two square, got {}\n", data.message)); + CORRADE_COMPARE(out, Utility::format("TextureTools::atlasArrayPowerOfTwo(): expected layer size to be a non-zero power-of-two square, got {}\n", data.message)); } void AtlasTest::arrayPowerOfTwoWrongSize() { @@ -1415,14 +1413,14 @@ void AtlasTest::arrayPowerOfTwoWrongSize() { Vector3i offsets[3]; - std::ostringstream out; + Containers::String out; Error redirectError{&out}; atlasArrayPowerOfTwo({256, 256}, { {64, 64}, {128, 128}, data.size }, offsets); - CORRADE_COMPARE(out.str(), Utility::formatString("TextureTools::atlasArrayPowerOfTwo(): expected size 2 to be a non-zero power-of-two square not larger than {{256, 256}} but got {}\n", data.message)); + CORRADE_COMPARE(out, Utility::format("TextureTools::atlasArrayPowerOfTwo(): expected size 2 to be a non-zero power-of-two square not larger than {{256, 256}} but got {}\n", data.message)); } #ifdef MAGNUM_BUILD_DEPRECATED @@ -1572,7 +1570,7 @@ void AtlasTest::textureCoordinateTransformationOutOfBounds() { atlasTextureCoordinateTransformationRotatedCounterClockwise({5, 4}, {1, 3}, {2, 3}); atlasTextureCoordinateTransformationRotatedClockwise({5, 4}, {1, 3}, {2, 3}); - std::ostringstream out; + Containers::String out; Error redirectError{&out}; /* Size too large in either dimension */ atlasTextureCoordinateTransformation({5, 4}, {3, 5}, {}); @@ -1588,7 +1586,7 @@ void AtlasTest::textureCoordinateTransformationOutOfBounds() { atlasTextureCoordinateTransformationRotatedCounterClockwise({4, 5}, {1, 2}, {3, 2}); atlasTextureCoordinateTransformationRotatedClockwise({5, 4}, {2, 1}, {2, 3}); atlasTextureCoordinateTransformationRotatedClockwise({4, 5}, {1, 2}, {3, 2}); - CORRADE_COMPARE_AS(out.str(), + CORRADE_COMPARE_AS(out, "TextureTools::atlasTextureCoordinateTransformation(): size {3, 5} and offset {0, 0} doesn't fit into {5, 4}\n" "TextureTools::atlasTextureCoordinateTransformation(): size {5, 3} and offset {0, 0} doesn't fit into {4, 5}\n" "TextureTools::atlasTextureCoordinateTransformationRotatedCounterClockwise(): (rotated) size {3, 5} and offset {0, 0} doesn't fit into {5, 4}\n" diff --git a/src/Magnum/TextureTools/Test/DistanceFieldGLTest.cpp b/src/Magnum/TextureTools/Test/DistanceFieldGLTest.cpp index 0c1044bad..6072f4e91 100644 --- a/src/Magnum/TextureTools/Test/DistanceFieldGLTest.cpp +++ b/src/Magnum/TextureTools/Test/DistanceFieldGLTest.cpp @@ -24,13 +24,11 @@ DEALINGS IN THE SOFTWARE. */ -#include #include #include #include #include #include -#include #ifdef CORRADE_TARGET_APPLE #include @@ -498,7 +496,7 @@ void DistanceFieldGLTest::formatNotDrawable() { DistanceFieldGL distanceField{4}; - std::ostringstream out; + Containers::String out; Error redirectError{&out}; distanceField(input, output, {{}, Vector2i{4}} #ifdef MAGNUM_TARGET_GLES @@ -509,11 +507,11 @@ void DistanceFieldGLTest::formatNotDrawable() { #ifndef MAGNUM_TARGET_GLES /* NV drivers print the same error on both desktop and ES */ if(GL::Context::current().detectedDriver() & GL::Context::DetectedDriver::NVidia) - CORRADE_COMPARE(out.str(), "TextureTools::DistanceFieldGL: output texture format not framebuffer-drawable: GL::Framebuffer::Status::IncompleteAttachment\n"); + CORRADE_COMPARE(out, "TextureTools::DistanceFieldGL: output texture format not framebuffer-drawable: GL::Framebuffer::Status::IncompleteAttachment\n"); else - CORRADE_COMPARE(out.str(), "TextureTools::DistanceFieldGL: output texture format not framebuffer-drawable: GL::Framebuffer::Status::Unsupported\n"); + CORRADE_COMPARE(out, "TextureTools::DistanceFieldGL: output texture format not framebuffer-drawable: GL::Framebuffer::Status::Unsupported\n"); #else - CORRADE_COMPARE(out.str(), "TextureTools::DistanceFieldGL: output texture format not framebuffer-drawable: GL::Framebuffer::Status::IncompleteAttachment\n"); + CORRADE_COMPARE(out, "TextureTools::DistanceFieldGL: output texture format not framebuffer-drawable: GL::Framebuffer::Status::IncompleteAttachment\n"); #endif } @@ -556,7 +554,7 @@ void DistanceFieldGLTest::sizeRatioNotMultipleOfTwo() { #endif ); - std::ostringstream out; + Containers::String out; Error redirectError{&out}; distanceField(input, output, {{}, Vector2i{23*2}} #ifdef MAGNUM_TARGET_GLES @@ -586,7 +584,7 @@ void DistanceFieldGLTest::sizeRatioNotMultipleOfTwo() { #endif ); MAGNUM_VERIFY_NO_GL_ERROR(); - CORRADE_COMPARE(out.str(), + CORRADE_COMPARE(out, "TextureTools::DistanceFieldGL: expected input and output size ratio to be a multiple of 2, got {322, 322} and {46, 46}\n" "TextureTools::DistanceFieldGL: expected input and output size ratio to be a multiple of 2, got {322, 322} and {46, 23}\n" "TextureTools::DistanceFieldGL: expected input and output size ratio to be a multiple of 2, got {322, 322} and {23, 46}\n" diff --git a/src/Magnum/Trade/Test/AbstractImageConverterTest.cpp b/src/Magnum/Trade/Test/AbstractImageConverterTest.cpp index 5c648a097..21a42b076 100644 --- a/src/Magnum/Trade/Test/AbstractImageConverterTest.cpp +++ b/src/Magnum/Trade/Test/AbstractImageConverterTest.cpp @@ -24,16 +24,13 @@ DEALINGS IN THE SOFTWARE. */ -#include #include #include -#include -#include /** @todo remove once Debug is stream-free */ +#include #include #include #include #include -#include #include #include "Magnum/Image.h" @@ -618,7 +615,7 @@ void AbstractImageConverterTest::thingNotSupported() { ImageConverterFeatures doFeatures() const override { return {}; } } converter; - std::ostringstream out; + Containers::String out; Error redirectError{&out}; converter.extension(); converter.mimeType(); @@ -652,7 +649,7 @@ void AbstractImageConverterTest::thingNotSupported() { converter.convertToFile({CompressedImageView1D{CompressedPixelFormat::Bc1RGBAUnorm, 0, nullptr}}, Utility::Path::join(TRADE_TEST_OUTPUT_DIR, "image.out")); converter.convertToFile({CompressedImageView2D{CompressedPixelFormat::Bc1RGBAUnorm, {}, nullptr}}, Utility::Path::join(TRADE_TEST_OUTPUT_DIR, "image.out")); converter.convertToFile({CompressedImageView3D{CompressedPixelFormat::Bc1RGBAUnorm, {}, nullptr}}, Utility::Path::join(TRADE_TEST_OUTPUT_DIR, "image.out")); - CORRADE_COMPARE(out.str(), + CORRADE_COMPARE(out, "Trade::AbstractImageConverter::extension(): file conversion not supported\n" "Trade::AbstractImageConverter::mimeType(): file conversion not supported\n" "Trade::AbstractImageConverter::convert(): 1D image conversion not supported\n" @@ -726,11 +723,11 @@ void AbstractImageConverterTest::extensionMimeTypeCustomDeleter() { } } converter; - std::ostringstream out; + Containers::String out; Error redirectError{&out}; converter.extension(); converter.mimeType(); - CORRADE_COMPARE(out.str(), + CORRADE_COMPARE(out, "Trade::AbstractImageConverter::extension(): implementation is not allowed to use a custom String deleter\n" "Trade::AbstractImageConverter::mimeType(): implementation is not allowed to use a custom String deleter\n"); } @@ -791,10 +788,10 @@ void AbstractImageConverterTest::convert1DFailed() { } converter; /* The implementation is expected to print an error message on its own */ - std::ostringstream out; + Containers::String out; Error redirectError{&out}; CORRADE_VERIFY(!converter.convert(ImageView1D{PixelFormat::RGBA8Unorm, 1, {nullptr, 4}})); - CORRADE_COMPARE(out.str(), ""); + CORRADE_COMPARE(out, ""); } void AbstractImageConverterTest::convert2DFailed() { @@ -808,10 +805,10 @@ void AbstractImageConverterTest::convert2DFailed() { } converter; /* The implementation is expected to print an error message on its own */ - std::ostringstream out; + Containers::String out; Error redirectError{&out}; CORRADE_VERIFY(!converter.convert(ImageView2D{PixelFormat::RGBA8Unorm, {1, 1}, {nullptr, 4}})); - CORRADE_COMPARE(out.str(), ""); + CORRADE_COMPARE(out, ""); } void AbstractImageConverterTest::convert3DFailed() { @@ -825,10 +822,10 @@ void AbstractImageConverterTest::convert3DFailed() { } converter; /* The implementation is expected to print an error message on its own */ - std::ostringstream out; + Containers::String out; Error redirectError{&out}; CORRADE_VERIFY(!converter.convert(ImageView3D{PixelFormat::RGBA8Unorm, {1, 1, 1}, {nullptr, 4}})); - CORRADE_COMPARE(out.str(), ""); + CORRADE_COMPARE(out, ""); } void AbstractImageConverterTest::convert1DNotImplemented() { @@ -838,10 +835,10 @@ void AbstractImageConverterTest::convert1DNotImplemented() { ImageConverterFeatures doFeatures() const override { return ImageConverterFeature::Convert1D; } } converter; - std::ostringstream out; + Containers::String out; Error redirectError{&out}; converter.convert(ImageView1D{PixelFormat::R8Unorm, 0, nullptr}); - CORRADE_COMPARE(out.str(), "Trade::AbstractImageConverter::convert(): 1D image conversion advertised but not implemented\n"); + CORRADE_COMPARE(out, "Trade::AbstractImageConverter::convert(): 1D image conversion advertised but not implemented\n"); } void AbstractImageConverterTest::convert2DNotImplemented() { @@ -851,10 +848,10 @@ void AbstractImageConverterTest::convert2DNotImplemented() { ImageConverterFeatures doFeatures() const override { return ImageConverterFeature::Convert2D; } } converter; - std::ostringstream out; + Containers::String out; Error redirectError{&out}; converter.convert(ImageView2D{PixelFormat::R8Unorm, {}, nullptr}); - CORRADE_COMPARE(out.str(), "Trade::AbstractImageConverter::convert(): 2D image conversion advertised but not implemented\n"); + CORRADE_COMPARE(out, "Trade::AbstractImageConverter::convert(): 2D image conversion advertised but not implemented\n"); } void AbstractImageConverterTest::convert3DNotImplemented() { @@ -864,10 +861,10 @@ void AbstractImageConverterTest::convert3DNotImplemented() { ImageConverterFeatures doFeatures() const override { return ImageConverterFeature::Convert3D; } } converter; - std::ostringstream out; + Containers::String out; Error redirectError{&out}; converter.convert(ImageView3D{PixelFormat::R8Unorm, {}, nullptr}); - CORRADE_COMPARE(out.str(), "Trade::AbstractImageConverter::convert(): 3D image conversion advertised but not implemented\n"); + CORRADE_COMPARE(out, "Trade::AbstractImageConverter::convert(): 3D image conversion advertised but not implemented\n"); } void AbstractImageConverterTest::convert1DCustomDeleter() { @@ -880,10 +877,10 @@ void AbstractImageConverterTest::convert1DCustomDeleter() { } } converter; - std::ostringstream out; + Containers::String out; Error redirectError{&out}; converter.convert(ImageView1D{PixelFormat::R8Unorm, {}, nullptr}); - CORRADE_COMPARE(out.str(), "Trade::AbstractImageConverter::convert(): implementation is not allowed to use a custom Array deleter\n"); + CORRADE_COMPARE(out, "Trade::AbstractImageConverter::convert(): implementation is not allowed to use a custom Array deleter\n"); } void AbstractImageConverterTest::convert2DCustomDeleter() { @@ -896,10 +893,10 @@ void AbstractImageConverterTest::convert2DCustomDeleter() { } } converter; - std::ostringstream out; + Containers::String out; Error redirectError{&out}; converter.convert(ImageView2D{PixelFormat::R8Unorm, {}, nullptr}); - CORRADE_COMPARE(out.str(), "Trade::AbstractImageConverter::convert(): implementation is not allowed to use a custom Array deleter\n"); + CORRADE_COMPARE(out, "Trade::AbstractImageConverter::convert(): implementation is not allowed to use a custom Array deleter\n"); } void AbstractImageConverterTest::convert3DCustomDeleter() { @@ -912,10 +909,10 @@ void AbstractImageConverterTest::convert3DCustomDeleter() { } } converter; - std::ostringstream out; + Containers::String out; Error redirectError{&out}; converter.convert(ImageView3D{PixelFormat::R8Unorm, {}, nullptr}); - CORRADE_COMPARE(out.str(), "Trade::AbstractImageConverter::convert(): implementation is not allowed to use a custom Array deleter\n"); + CORRADE_COMPARE(out, "Trade::AbstractImageConverter::convert(): implementation is not allowed to use a custom Array deleter\n"); } void AbstractImageConverterTest::convertCompressed1D() { @@ -974,10 +971,10 @@ void AbstractImageConverterTest::convertCompressed1DFailed() { } converter; /* The implementation is expected to print an error message on its own */ - std::ostringstream out; + Containers::String out; Error redirectError{&out}; CORRADE_VERIFY(!converter.convert(CompressedImageView1D{CompressedPixelFormat::Bc1RGBAUnorm, 1, {nullptr, 4*4}})); - CORRADE_COMPARE(out.str(), ""); + CORRADE_COMPARE(out, ""); } void AbstractImageConverterTest::convertCompressed2DFailed() { @@ -991,10 +988,10 @@ void AbstractImageConverterTest::convertCompressed2DFailed() { } converter; /* The implementation is expected to print an error message on its own */ - std::ostringstream out; + Containers::String out; Error redirectError{&out}; CORRADE_VERIFY(!converter.convert(CompressedImageView2D{CompressedPixelFormat::Bc1RGBAUnorm, {1, 1}, {nullptr, 4*4}})); - CORRADE_COMPARE(out.str(), ""); + CORRADE_COMPARE(out, ""); } void AbstractImageConverterTest::convertCompressed3DFailed() { @@ -1008,10 +1005,10 @@ void AbstractImageConverterTest::convertCompressed3DFailed() { } converter; /* The implementation is expected to print an error message on its own */ - std::ostringstream out; + Containers::String out; Error redirectError{&out}; CORRADE_VERIFY(!converter.convert(CompressedImageView3D{CompressedPixelFormat::Bc1RGBAUnorm, {1, 1, 1}, {nullptr, 4*4}})); - CORRADE_COMPARE(out.str(), ""); + CORRADE_COMPARE(out, ""); } void AbstractImageConverterTest::convertCompressed1DNotImplemented() { @@ -1021,10 +1018,10 @@ void AbstractImageConverterTest::convertCompressed1DNotImplemented() { ImageConverterFeatures doFeatures() const override { return ImageConverterFeature::ConvertCompressed1D; } } converter; - std::ostringstream out; + Containers::String out; Error redirectError{&out}; converter.convert(CompressedImageView1D{CompressedPixelFormat::Bc1RGBAUnorm, 0, nullptr}); - CORRADE_COMPARE(out.str(), "Trade::AbstractImageConverter::convert(): compressed 1D image conversion advertised but not implemented\n"); + CORRADE_COMPARE(out, "Trade::AbstractImageConverter::convert(): compressed 1D image conversion advertised but not implemented\n"); } void AbstractImageConverterTest::convertCompressed2DNotImplemented() { @@ -1034,10 +1031,10 @@ void AbstractImageConverterTest::convertCompressed2DNotImplemented() { ImageConverterFeatures doFeatures() const override { return ImageConverterFeature::ConvertCompressed2D; } } converter; - std::ostringstream out; + Containers::String out; Error redirectError{&out}; converter.convert(CompressedImageView2D{CompressedPixelFormat::Bc1RGBAUnorm, {}, nullptr}); - CORRADE_COMPARE(out.str(), "Trade::AbstractImageConverter::convert(): compressed 2D image conversion advertised but not implemented\n"); + CORRADE_COMPARE(out, "Trade::AbstractImageConverter::convert(): compressed 2D image conversion advertised but not implemented\n"); } void AbstractImageConverterTest::convertCompressed3DNotImplemented() { @@ -1047,10 +1044,10 @@ void AbstractImageConverterTest::convertCompressed3DNotImplemented() { ImageConverterFeatures doFeatures() const override { return ImageConverterFeature::ConvertCompressed3D; } } converter; - std::ostringstream out; + Containers::String out; Error redirectError{&out}; converter.convert(CompressedImageView3D{CompressedPixelFormat::Bc1RGBAUnorm, {}, nullptr}); - CORRADE_COMPARE(out.str(), "Trade::AbstractImageConverter::convert(): compressed 3D image conversion advertised but not implemented\n"); + CORRADE_COMPARE(out, "Trade::AbstractImageConverter::convert(): compressed 3D image conversion advertised but not implemented\n"); } void AbstractImageConverterTest::convertCompressed1DCustomDeleter() { @@ -1063,10 +1060,10 @@ void AbstractImageConverterTest::convertCompressed1DCustomDeleter() { } } converter; - std::ostringstream out; + Containers::String out; Error redirectError{&out}; converter.convert(CompressedImageView1D{CompressedPixelFormat::Bc1RGBAUnorm, {}, nullptr}); - CORRADE_COMPARE(out.str(), "Trade::AbstractImageConverter::convert(): implementation is not allowed to use a custom Array deleter\n"); + CORRADE_COMPARE(out, "Trade::AbstractImageConverter::convert(): implementation is not allowed to use a custom Array deleter\n"); } void AbstractImageConverterTest::convertCompressed2DCustomDeleter() { @@ -1079,10 +1076,10 @@ void AbstractImageConverterTest::convertCompressed2DCustomDeleter() { } } converter; - std::ostringstream out; + Containers::String out; Error redirectError{&out}; converter.convert(CompressedImageView2D{CompressedPixelFormat::Bc1RGBAUnorm, {}, nullptr}); - CORRADE_COMPARE(out.str(), "Trade::AbstractImageConverter::convert(): implementation is not allowed to use a custom Array deleter\n"); + CORRADE_COMPARE(out, "Trade::AbstractImageConverter::convert(): implementation is not allowed to use a custom Array deleter\n"); } void AbstractImageConverterTest::convertCompressed3DCustomDeleter() { @@ -1095,10 +1092,10 @@ void AbstractImageConverterTest::convertCompressed3DCustomDeleter() { } } converter; - std::ostringstream out; + Containers::String out; Error redirectError{&out}; converter.convert(CompressedImageView3D{CompressedPixelFormat::Bc1RGBAUnorm, {}, nullptr}); - CORRADE_COMPARE(out.str(), "Trade::AbstractImageConverter::convert(): implementation is not allowed to use a custom Array deleter\n"); + CORRADE_COMPARE(out, "Trade::AbstractImageConverter::convert(): implementation is not allowed to use a custom Array deleter\n"); } void AbstractImageConverterTest::convertImageData1D() { @@ -1252,10 +1249,10 @@ void AbstractImageConverterTest::convert1DToDataFailed() { const char imageData[4]{}; /* The implementation is expected to print an error message on its own */ - std::ostringstream out; + Containers::String out; Error redirectError{&out}; CORRADE_VERIFY(!converter.convertToData(ImageView1D{PixelFormat::RGBA8Unorm, 1, imageData})); - CORRADE_COMPARE(out.str(), ""); + CORRADE_COMPARE(out, ""); } void AbstractImageConverterTest::convert2DToDataFailed() { @@ -1271,10 +1268,10 @@ void AbstractImageConverterTest::convert2DToDataFailed() { const char imageData[4]{}; /* The implementation is expected to print an error message on its own */ - std::ostringstream out; + Containers::String out; Error redirectError{&out}; CORRADE_VERIFY(!converter.convertToData(ImageView2D{PixelFormat::RGBA8Unorm, {1, 1}, imageData})); - CORRADE_COMPARE(out.str(), ""); + CORRADE_COMPARE(out, ""); } void AbstractImageConverterTest::convert3DToDataFailed() { @@ -1290,10 +1287,10 @@ void AbstractImageConverterTest::convert3DToDataFailed() { const char imageData[4]{}; /* The implementation is expected to print an error message on its own */ - std::ostringstream out; + Containers::String out; Error redirectError{&out}; CORRADE_VERIFY(!converter.convertToData(ImageView3D{PixelFormat::RGBA8Unorm, {1, 1, 1}, imageData})); - CORRADE_COMPARE(out.str(), ""); + CORRADE_COMPARE(out, ""); } void AbstractImageConverterTest::convert1DToDataInvalidImage() { @@ -1303,10 +1300,10 @@ void AbstractImageConverterTest::convert1DToDataInvalidImage() { ImageConverterFeatures doFeatures() const override { return ImageConverterFeature::Convert1DToData; } } converter; - std::ostringstream out; + Containers::String out; Error redirectError{&out}; converter.convertToData(ImageView1D{PixelFormat::RGBA8Unorm, 0, nullptr}); - CORRADE_COMPARE(out.str(), "Trade::AbstractImageConverter::convertToData(): can't convert image with a zero size: Vector(0)\n"); + CORRADE_COMPARE(out, "Trade::AbstractImageConverter::convertToData(): can't convert image with a zero size: Vector(0)\n"); } void AbstractImageConverterTest::convert2DToDataZeroSize() { @@ -1317,10 +1314,10 @@ void AbstractImageConverterTest::convert2DToDataZeroSize() { } converter; const char data[16]{}; - std::ostringstream out; + Containers::String out; Error redirectError{&out}; converter.convertToData(ImageView2D{PixelFormat::RGBA8Unorm, {4, 0}, data}); - CORRADE_COMPARE(out.str(), "Trade::AbstractImageConverter::convertToData(): can't convert image with a zero size: Vector(4, 0)\n"); + CORRADE_COMPARE(out, "Trade::AbstractImageConverter::convertToData(): can't convert image with a zero size: Vector(4, 0)\n"); } void AbstractImageConverterTest::convert2DToDataNullptr() { @@ -1330,10 +1327,10 @@ void AbstractImageConverterTest::convert2DToDataNullptr() { ImageConverterFeatures doFeatures() const override { return ImageConverterFeature::Convert2DToData; } } converter; - std::ostringstream out; + Containers::String out; Error redirectError{&out}; converter.convertToData(ImageView2D{PixelFormat::RGBA8Unorm, {1, 1}, {nullptr, 4}}); - CORRADE_COMPARE(out.str(), "Trade::AbstractImageConverter::convertToData(): can't convert image with a nullptr view\n"); + CORRADE_COMPARE(out, "Trade::AbstractImageConverter::convertToData(): can't convert image with a nullptr view\n"); } void AbstractImageConverterTest::convert3DToDataInvalidImage() { @@ -1343,10 +1340,10 @@ void AbstractImageConverterTest::convert3DToDataInvalidImage() { ImageConverterFeatures doFeatures() const override { return ImageConverterFeature::Convert3DToData; } } converter; - std::ostringstream out; + Containers::String out; Error redirectError{&out}; converter.convertToData(ImageView3D{PixelFormat::RGBA8Unorm, {}, nullptr}); - CORRADE_COMPARE(out.str(), "Trade::AbstractImageConverter::convertToData(): can't convert image with a zero size: Vector(0, 0, 0)\n"); + CORRADE_COMPARE(out, "Trade::AbstractImageConverter::convertToData(): can't convert image with a zero size: Vector(0, 0, 0)\n"); } void AbstractImageConverterTest::convert1DToDataNotImplemented() { @@ -1357,10 +1354,10 @@ void AbstractImageConverterTest::convert1DToDataNotImplemented() { } converter; const char data[4]{}; - std::ostringstream out; + Containers::String out; Error redirectError{&out}; converter.convertToData(ImageView1D{PixelFormat::RGBA8Unorm, 1, data}); - CORRADE_COMPARE(out.str(), "Trade::AbstractImageConverter::convertToData(): 1D image conversion advertised but not implemented\n"); + CORRADE_COMPARE(out, "Trade::AbstractImageConverter::convertToData(): 1D image conversion advertised but not implemented\n"); } void AbstractImageConverterTest::convert2DToDataNotImplemented() { @@ -1371,10 +1368,10 @@ void AbstractImageConverterTest::convert2DToDataNotImplemented() { } converter; const char data[4]{}; - std::ostringstream out; + Containers::String out; Error redirectError{&out}; converter.convertToData(ImageView2D{PixelFormat::RGBA8Unorm, {1, 1}, data}); - CORRADE_COMPARE(out.str(), "Trade::AbstractImageConverter::convertToData(): 2D image conversion advertised but not implemented\n"); + CORRADE_COMPARE(out, "Trade::AbstractImageConverter::convertToData(): 2D image conversion advertised but not implemented\n"); } void AbstractImageConverterTest::convert3DToDataNotImplemented() { @@ -1385,10 +1382,10 @@ void AbstractImageConverterTest::convert3DToDataNotImplemented() { } converter; const char data[4]{}; - std::ostringstream out; + Containers::String out; Error redirectError{&out}; converter.convertToData(ImageView3D{PixelFormat::RGBA8Unorm, {1, 1, 1}, data}); - CORRADE_COMPARE(out.str(), "Trade::AbstractImageConverter::convertToData(): 3D image conversion advertised but not implemented\n"); + CORRADE_COMPARE(out, "Trade::AbstractImageConverter::convertToData(): 3D image conversion advertised but not implemented\n"); } void AbstractImageConverterTest::convert1DToDataCustomDeleter() { @@ -1402,10 +1399,10 @@ void AbstractImageConverterTest::convert1DToDataCustomDeleter() { } converter; const char data[4]{}; - std::ostringstream out; + Containers::String out; Error redirectError{&out}; converter.convertToData(ImageView1D{PixelFormat::RGBA8Unorm, 1, data}); - CORRADE_COMPARE(out.str(), "Trade::AbstractImageConverter::convertToData(): implementation is not allowed to use a custom Array deleter\n"); + CORRADE_COMPARE(out, "Trade::AbstractImageConverter::convertToData(): implementation is not allowed to use a custom Array deleter\n"); } void AbstractImageConverterTest::convert2DToDataCustomDeleter() { @@ -1419,10 +1416,10 @@ void AbstractImageConverterTest::convert2DToDataCustomDeleter() { } converter; const char data[4]{}; - std::ostringstream out; + Containers::String out; Error redirectError{&out}; converter.convertToData(ImageView2D{PixelFormat::RGBA8Unorm, {1, 1}, data}); - CORRADE_COMPARE(out.str(), "Trade::AbstractImageConverter::convertToData(): implementation is not allowed to use a custom Array deleter\n"); + CORRADE_COMPARE(out, "Trade::AbstractImageConverter::convertToData(): implementation is not allowed to use a custom Array deleter\n"); } void AbstractImageConverterTest::convert3DToDataCustomDeleter() { @@ -1436,10 +1433,10 @@ void AbstractImageConverterTest::convert3DToDataCustomDeleter() { } converter; const char data[4]{}; - std::ostringstream out; + Containers::String out; Error redirectError{&out}; converter.convertToData(ImageView3D{PixelFormat::RGBA8Unorm, {1, 1, 1}, data}); - CORRADE_COMPARE(out.str(), "Trade::AbstractImageConverter::convertToData(): implementation is not allowed to use a custom Array deleter\n"); + CORRADE_COMPARE(out, "Trade::AbstractImageConverter::convertToData(): implementation is not allowed to use a custom Array deleter\n"); } void AbstractImageConverterTest::convertCompressed1DToData() { @@ -1497,10 +1494,10 @@ void AbstractImageConverterTest::convertCompressed1DToDataFailed() { const char imageData[4*4]{}; /* The implementation is expected to print an error message on its own */ - std::ostringstream out; + Containers::String out; Error redirectError{&out}; CORRADE_VERIFY(!converter.convertToData(CompressedImageView1D{CompressedPixelFormat::Bc1RGBAUnorm, 1, imageData})); - CORRADE_COMPARE(out.str(), ""); + CORRADE_COMPARE(out, ""); } void AbstractImageConverterTest::convertCompressed2DToDataFailed() { @@ -1516,10 +1513,10 @@ void AbstractImageConverterTest::convertCompressed2DToDataFailed() { const char imageData[4*4]{}; /* The implementation is expected to print an error message on its own */ - std::ostringstream out; + Containers::String out; Error redirectError{&out}; CORRADE_VERIFY(!converter.convertToData(CompressedImageView2D{CompressedPixelFormat::Bc1RGBAUnorm, {1, 1}, imageData})); - CORRADE_COMPARE(out.str(), ""); + CORRADE_COMPARE(out, ""); } void AbstractImageConverterTest::convertCompressed3DToDataFailed() { @@ -1535,10 +1532,10 @@ void AbstractImageConverterTest::convertCompressed3DToDataFailed() { const char imageData[4*4]{}; /* The implementation is expected to print an error message on its own */ - std::ostringstream out; + Containers::String out; Error redirectError{&out}; CORRADE_VERIFY(!converter.convertToData(CompressedImageView3D{CompressedPixelFormat::Bc1RGBAUnorm, {1, 1, 1}, imageData})); - CORRADE_COMPARE(out.str(), ""); + CORRADE_COMPARE(out, ""); } void AbstractImageConverterTest::convertCompressed1DToDataInvalidImage() { @@ -1548,10 +1545,10 @@ void AbstractImageConverterTest::convertCompressed1DToDataInvalidImage() { ImageConverterFeatures doFeatures() const override { return ImageConverterFeature::ConvertCompressed1DToData; } } converter; - std::ostringstream out; + Containers::String out; Error redirectError{&out}; converter.convertToData(CompressedImageView1D{CompressedPixelFormat::Bc1RGBAUnorm, 0, nullptr}); - CORRADE_COMPARE(out.str(), "Trade::AbstractImageConverter::convertToData(): can't convert image with a zero size: Vector(0)\n"); + CORRADE_COMPARE(out, "Trade::AbstractImageConverter::convertToData(): can't convert image with a zero size: Vector(0)\n"); } void AbstractImageConverterTest::convertCompressed2DToDataInvalidImage() { @@ -1561,10 +1558,10 @@ void AbstractImageConverterTest::convertCompressed2DToDataInvalidImage() { ImageConverterFeatures doFeatures() const override { return ImageConverterFeature::ConvertCompressed2DToData; } } converter; - std::ostringstream out; + Containers::String out; Error redirectError{&out}; converter.convertToData(CompressedImageView2D{CompressedPixelFormat::Bc1RGBAUnorm, {}, nullptr}); - CORRADE_COMPARE(out.str(), "Trade::AbstractImageConverter::convertToData(): can't convert image with a zero size: Vector(0, 0)\n"); + CORRADE_COMPARE(out, "Trade::AbstractImageConverter::convertToData(): can't convert image with a zero size: Vector(0, 0)\n"); } void AbstractImageConverterTest::convertCompressed3DToDataInvalidImage() { @@ -1574,10 +1571,10 @@ void AbstractImageConverterTest::convertCompressed3DToDataInvalidImage() { ImageConverterFeatures doFeatures() const override { return ImageConverterFeature::ConvertCompressed3DToData; } } converter; - std::ostringstream out; + Containers::String out; Error redirectError{&out}; converter.convertToData(CompressedImageView3D{CompressedPixelFormat::Bc1RGBAUnorm, {}, nullptr}); - CORRADE_COMPARE(out.str(), "Trade::AbstractImageConverter::convertToData(): can't convert image with a zero size: Vector(0, 0, 0)\n"); + CORRADE_COMPARE(out, "Trade::AbstractImageConverter::convertToData(): can't convert image with a zero size: Vector(0, 0, 0)\n"); } void AbstractImageConverterTest::convertCompressed1DToDataNotImplemented() { @@ -1588,10 +1585,10 @@ void AbstractImageConverterTest::convertCompressed1DToDataNotImplemented() { } converter; const char data[8]{}; - std::ostringstream out; + Containers::String out; Error redirectError{&out}; converter.convertToData(CompressedImageView1D{CompressedPixelFormat::Bc1RGBAUnorm, 4, data}); - CORRADE_COMPARE(out.str(), "Trade::AbstractImageConverter::convertToData(): compressed 1D image conversion advertised but not implemented\n"); + CORRADE_COMPARE(out, "Trade::AbstractImageConverter::convertToData(): compressed 1D image conversion advertised but not implemented\n"); } void AbstractImageConverterTest::convertCompressed2DToDataNotImplemented() { @@ -1602,10 +1599,10 @@ void AbstractImageConverterTest::convertCompressed2DToDataNotImplemented() { } converter; const char data[8]{}; - std::ostringstream out; + Containers::String out; Error redirectError{&out}; converter.convertToData(CompressedImageView2D{CompressedPixelFormat::Bc1RGBAUnorm, {4, 4}, data}); - CORRADE_COMPARE(out.str(), "Trade::AbstractImageConverter::convertToData(): compressed 2D image conversion advertised but not implemented\n"); + CORRADE_COMPARE(out, "Trade::AbstractImageConverter::convertToData(): compressed 2D image conversion advertised but not implemented\n"); } void AbstractImageConverterTest::convertCompressed3DToDataNotImplemented() { @@ -1616,10 +1613,10 @@ void AbstractImageConverterTest::convertCompressed3DToDataNotImplemented() { } converter; const char data[8]{}; - std::ostringstream out; + Containers::String out; Error redirectError{&out}; converter.convertToData(CompressedImageView3D{CompressedPixelFormat::Bc1RGBAUnorm, {4, 4, 1}, data}); - CORRADE_COMPARE(out.str(), "Trade::AbstractImageConverter::convertToData(): compressed 3D image conversion advertised but not implemented\n"); + CORRADE_COMPARE(out, "Trade::AbstractImageConverter::convertToData(): compressed 3D image conversion advertised but not implemented\n"); } void AbstractImageConverterTest::convertCompressed1DToDataCustomDeleter() { @@ -1633,10 +1630,10 @@ void AbstractImageConverterTest::convertCompressed1DToDataCustomDeleter() { } converter; const char data[8]{}; - std::ostringstream out; + Containers::String out; Error redirectError{&out}; converter.convertToData(CompressedImageView1D{CompressedPixelFormat::Bc1RGBAUnorm, 4, data}); - CORRADE_COMPARE(out.str(), "Trade::AbstractImageConverter::convertToData(): implementation is not allowed to use a custom Array deleter\n"); + CORRADE_COMPARE(out, "Trade::AbstractImageConverter::convertToData(): implementation is not allowed to use a custom Array deleter\n"); } void AbstractImageConverterTest::convertCompressed2DToDataCustomDeleter() { @@ -1650,10 +1647,10 @@ void AbstractImageConverterTest::convertCompressed2DToDataCustomDeleter() { } converter; const char data[8]{}; - std::ostringstream out; + Containers::String out; Error redirectError{&out}; converter.convertToData(CompressedImageView2D{CompressedPixelFormat::Bc1RGBAUnorm, {4, 4}, data}); - CORRADE_COMPARE(out.str(), "Trade::AbstractImageConverter::convertToData(): implementation is not allowed to use a custom Array deleter\n"); + CORRADE_COMPARE(out, "Trade::AbstractImageConverter::convertToData(): implementation is not allowed to use a custom Array deleter\n"); } void AbstractImageConverterTest::convertCompressed3DToDataCustomDeleter() { @@ -1667,10 +1664,10 @@ void AbstractImageConverterTest::convertCompressed3DToDataCustomDeleter() { } converter; const char data[8]{}; - std::ostringstream out; + Containers::String out; Error redirectError{&out}; converter.convertToData(CompressedImageView3D{CompressedPixelFormat::Bc1RGBAUnorm, {4, 4, 1}, data}); - CORRADE_COMPARE(out.str(), "Trade::AbstractImageConverter::convertToData(): implementation is not allowed to use a custom Array deleter\n"); + CORRADE_COMPARE(out, "Trade::AbstractImageConverter::convertToData(): implementation is not allowed to use a custom Array deleter\n"); } /* Used by convertImageDataToData() and convertImageDataToFile() */ @@ -1857,10 +1854,10 @@ void AbstractImageConverterTest::convertLevels1DToDataFailed() { const char imageData[4]{}; /* The implementation is expected to print an error message on its own */ - std::ostringstream out; + Containers::String out; Error redirectError{&out}; CORRADE_VERIFY(!converter.convertToData({ImageView1D{PixelFormat::RGBA8Unorm, 1, imageData}})); - CORRADE_COMPARE(out.str(), ""); + CORRADE_COMPARE(out, ""); } void AbstractImageConverterTest::convertLevels2DToDataFailed() { @@ -1877,10 +1874,10 @@ void AbstractImageConverterTest::convertLevels2DToDataFailed() { const char imageData[4]{}; /* The implementation is expected to print an error message on its own */ - std::ostringstream out; + Containers::String out; Error redirectError{&out}; CORRADE_VERIFY(!converter.convertToData({ImageView2D{PixelFormat::RGBA8Unorm, {1, 1}, imageData}})); - CORRADE_COMPARE(out.str(), ""); + CORRADE_COMPARE(out, ""); } void AbstractImageConverterTest::convertLevels3DToDataFailed() { @@ -1897,10 +1894,10 @@ void AbstractImageConverterTest::convertLevels3DToDataFailed() { const char imageData[4]{}; /* The implementation is expected to print an error message on its own */ - std::ostringstream out; + Containers::String out; Error redirectError{&out}; CORRADE_VERIFY(!converter.convertToData({ImageView3D{PixelFormat::RGBA8Unorm, {1, 1, 1}, imageData}})); - CORRADE_COMPARE(out.str(), ""); + CORRADE_COMPARE(out, ""); } void AbstractImageConverterTest::convertLevels1DToDataInvalidImage() { @@ -1913,10 +1910,10 @@ void AbstractImageConverterTest::convertLevels1DToDataInvalidImage() { } } converter; - std::ostringstream out; + Containers::String out; Error redirectError{&out}; converter.convertToData(std::initializer_list{}); - CORRADE_COMPARE(out.str(), "Trade::AbstractImageConverter::convertToData(): at least one image has to be specified\n"); + CORRADE_COMPARE(out, "Trade::AbstractImageConverter::convertToData(): at least one image has to be specified\n"); } void AbstractImageConverterTest::convertLevels2DToDataNoLevels() { @@ -1929,10 +1926,10 @@ void AbstractImageConverterTest::convertLevels2DToDataNoLevels() { } } converter; - std::ostringstream out; + Containers::String out; Error redirectError{&out}; converter.convertToData(std::initializer_list{}); - CORRADE_COMPARE(out.str(), "Trade::AbstractImageConverter::convertToData(): at least one image has to be specified\n"); + CORRADE_COMPARE(out, "Trade::AbstractImageConverter::convertToData(): at least one image has to be specified\n"); } void AbstractImageConverterTest::convertLevels2DToDataZeroSize() { @@ -1946,13 +1943,13 @@ void AbstractImageConverterTest::convertLevels2DToDataZeroSize() { } converter; const char data[16]{}; - std::ostringstream out; + Containers::String out; Error redirectError{&out}; converter.convertToData({ ImageView2D{PixelFormat::RGBA8Unorm, {2, 2}, data}, ImageView2D{PixelFormat::RGBA8Unorm, {4, 0}, data} }); - CORRADE_COMPARE(out.str(), "Trade::AbstractImageConverter::convertToData(): can't convert image 1 with a zero size: Vector(4, 0)\n"); + CORRADE_COMPARE(out, "Trade::AbstractImageConverter::convertToData(): can't convert image 1 with a zero size: Vector(4, 0)\n"); } void AbstractImageConverterTest::convertLevels2DToDataNullptr() { @@ -1966,13 +1963,13 @@ void AbstractImageConverterTest::convertLevels2DToDataNullptr() { } converter; const char data[16]{}; - std::ostringstream out; + Containers::String out; Error redirectError{&out}; converter.convertToData({ ImageView2D{PixelFormat::RGBA8Unorm, {2, 2}, data}, ImageView2D{PixelFormat::RGBA8Unorm, {1, 1}, {nullptr, 4}} }); - CORRADE_COMPARE(out.str(), "Trade::AbstractImageConverter::convertToData(): can't convert image 1 with a nullptr view\n"); + CORRADE_COMPARE(out, "Trade::AbstractImageConverter::convertToData(): can't convert image 1 with a nullptr view\n"); } void AbstractImageConverterTest::convertLevels2DToDataInconsistentFormat() { @@ -1986,14 +1983,14 @@ void AbstractImageConverterTest::convertLevels2DToDataInconsistentFormat() { } converter; const char data[16]{}; - std::ostringstream out; + Containers::String out; Error redirectError{&out}; converter.convertToData({ ImageView2D{PixelFormat::RGBA8Unorm, {2, 2}, data}, ImageView2D{PixelFormat::RGBA8Unorm, {1, 1}, data}, ImageView2D{PixelFormat::RGBA8Srgb, {4, 1}, data} }); - CORRADE_COMPARE(out.str(), "Trade::AbstractImageConverter::convertToData(): levels don't have the same format, expected PixelFormat::RGBA8Unorm but got PixelFormat::RGBA8Srgb for image 2\n"); + CORRADE_COMPARE(out, "Trade::AbstractImageConverter::convertToData(): levels don't have the same format, expected PixelFormat::RGBA8Unorm but got PixelFormat::RGBA8Srgb for image 2\n"); } void AbstractImageConverterTest::convertLevels2DToDataInconsistentFormatExtra() { @@ -2007,14 +2004,14 @@ void AbstractImageConverterTest::convertLevels2DToDataInconsistentFormatExtra() } converter; const char data[16]{}; - std::ostringstream out; + Containers::String out; Error redirectError{&out}; converter.convertToData({ ImageView2D{PixelStorage{}, 252, 1037, 4, {2, 2}, data}, ImageView2D{PixelStorage{}, 252, 1037, 4, {1, 1}, data}, ImageView2D{PixelStorage{}, 252, 4467, 4, {4, 1}, data} }); - CORRADE_COMPARE(out.str(), "Trade::AbstractImageConverter::convertToData(): levels don't have the same extra format field, expected 1037 but got 4467 for image 2\n"); + CORRADE_COMPARE(out, "Trade::AbstractImageConverter::convertToData(): levels don't have the same extra format field, expected 1037 but got 4467 for image 2\n"); } void AbstractImageConverterTest::convertLevels2DToDataInconsistentFlags() { @@ -2028,14 +2025,14 @@ void AbstractImageConverterTest::convertLevels2DToDataInconsistentFlags() { } converter; const char data[16]{}; - std::ostringstream out; + Containers::String out; Error redirectError{&out}; converter.convertToData({ ImageView2D{PixelFormat::RGBA8Unorm, {2, 2}, data, ImageFlag2D::Array}, ImageView2D{PixelFormat::RGBA8Unorm, {1, 1}, data, ImageFlag2D::Array}, ImageView2D{PixelFormat::RGBA8Unorm, {4, 1}, data} }); - CORRADE_COMPARE(out.str(), "Trade::AbstractImageConverter::convertToData(): levels don't have the same flags, expected ImageFlag2D::Array but got ImageFlags2D{} for image 2\n"); + CORRADE_COMPARE(out, "Trade::AbstractImageConverter::convertToData(): levels don't have the same flags, expected ImageFlag2D::Array but got ImageFlags2D{} for image 2\n"); } void AbstractImageConverterTest::convertLevels3DToDataInvalidImage() { @@ -2048,10 +2045,10 @@ void AbstractImageConverterTest::convertLevels3DToDataInvalidImage() { } } converter; - std::ostringstream out; + Containers::String out; Error redirectError{&out}; converter.convertToData(std::initializer_list{}); - CORRADE_COMPARE(out.str(), "Trade::AbstractImageConverter::convertToData(): at least one image has to be specified\n"); + CORRADE_COMPARE(out, "Trade::AbstractImageConverter::convertToData(): at least one image has to be specified\n"); } void AbstractImageConverterTest::convertLevels1DToDataNotImplemented() { @@ -2065,10 +2062,10 @@ void AbstractImageConverterTest::convertLevels1DToDataNotImplemented() { } converter; const char data[4]{}; - std::ostringstream out; + Containers::String out; Error redirectError{&out}; converter.convertToData({ImageView1D{PixelFormat::RGBA8Unorm, 1, data}}); - CORRADE_COMPARE(out.str(), "Trade::AbstractImageConverter::convertToData(): multi-level 1D image conversion advertised but not implemented\n"); + CORRADE_COMPARE(out, "Trade::AbstractImageConverter::convertToData(): multi-level 1D image conversion advertised but not implemented\n"); } void AbstractImageConverterTest::convertLevels2DToDataNotImplemented() { @@ -2082,10 +2079,10 @@ void AbstractImageConverterTest::convertLevels2DToDataNotImplemented() { } converter; const char data[4]{}; - std::ostringstream out; + Containers::String out; Error redirectError{&out}; converter.convertToData({ImageView2D{PixelFormat::RGBA8Unorm, {1, 1}, data}}); - CORRADE_COMPARE(out.str(), "Trade::AbstractImageConverter::convertToData(): multi-level 2D image conversion advertised but not implemented\n"); + CORRADE_COMPARE(out, "Trade::AbstractImageConverter::convertToData(): multi-level 2D image conversion advertised but not implemented\n"); } void AbstractImageConverterTest::convertLevels3DToDataNotImplemented() { @@ -2099,10 +2096,10 @@ void AbstractImageConverterTest::convertLevels3DToDataNotImplemented() { } converter; const char data[4]{}; - std::ostringstream out; + Containers::String out; Error redirectError{&out}; converter.convertToData({ImageView3D{PixelFormat::RGBA8Unorm, {1, 1, 1}, data}}); - CORRADE_COMPARE(out.str(), "Trade::AbstractImageConverter::convertToData(): multi-level 3D image conversion advertised but not implemented\n"); + CORRADE_COMPARE(out, "Trade::AbstractImageConverter::convertToData(): multi-level 3D image conversion advertised but not implemented\n"); } void AbstractImageConverterTest::convertLevels1DToDataCustomDeleter() { @@ -2119,10 +2116,10 @@ void AbstractImageConverterTest::convertLevels1DToDataCustomDeleter() { } converter; const char data[4]{}; - std::ostringstream out; + Containers::String out; Error redirectError{&out}; converter.convertToData({ImageView1D{PixelFormat::RGBA8Unorm, 1, data}}); - CORRADE_COMPARE(out.str(), "Trade::AbstractImageConverter::convertToData(): implementation is not allowed to use a custom Array deleter\n"); + CORRADE_COMPARE(out, "Trade::AbstractImageConverter::convertToData(): implementation is not allowed to use a custom Array deleter\n"); } void AbstractImageConverterTest::convertLevels2DToDataCustomDeleter() { @@ -2139,10 +2136,10 @@ void AbstractImageConverterTest::convertLevels2DToDataCustomDeleter() { } converter; const char data[4]{}; - std::ostringstream out; + Containers::String out; Error redirectError{&out}; converter.convertToData({ImageView2D{PixelFormat::RGBA8Unorm, {1, 1}, data}}); - CORRADE_COMPARE(out.str(), "Trade::AbstractImageConverter::convertToData(): implementation is not allowed to use a custom Array deleter\n"); + CORRADE_COMPARE(out, "Trade::AbstractImageConverter::convertToData(): implementation is not allowed to use a custom Array deleter\n"); } void AbstractImageConverterTest::convertLevels3DToDataCustomDeleter() { @@ -2159,10 +2156,10 @@ void AbstractImageConverterTest::convertLevels3DToDataCustomDeleter() { } converter; const char data[4]{}; - std::ostringstream out; + Containers::String out; Error redirectError{&out}; converter.convertToData({ImageView3D{PixelFormat::RGBA8Unorm, {1, 1, 1}, data}}); - CORRADE_COMPARE(out.str(), "Trade::AbstractImageConverter::convertToData(): implementation is not allowed to use a custom Array deleter\n"); + CORRADE_COMPARE(out, "Trade::AbstractImageConverter::convertToData(): implementation is not allowed to use a custom Array deleter\n"); } void AbstractImageConverterTest::convertCompressedLevels1DToData() { @@ -2245,10 +2242,10 @@ void AbstractImageConverterTest::convertCompressedLevels1DToDataFailed() { const char imageData[4*4]{}; /* The implementation is expected to print an error message on its own */ - std::ostringstream out; + Containers::String out; Error redirectError{&out}; CORRADE_VERIFY(!converter.convertToData({CompressedImageView1D{CompressedPixelFormat::Bc1RGBAUnorm, 1, imageData}})); - CORRADE_COMPARE(out.str(), ""); + CORRADE_COMPARE(out, ""); } void AbstractImageConverterTest::convertCompressedLevels2DToDataFailed() { @@ -2265,10 +2262,10 @@ void AbstractImageConverterTest::convertCompressedLevels2DToDataFailed() { const char imageData[4*4]{}; /* The implementation is expected to print an error message on its own */ - std::ostringstream out; + Containers::String out; Error redirectError{&out}; CORRADE_VERIFY(!converter.convertToData({CompressedImageView2D{CompressedPixelFormat::Bc1RGBAUnorm, {1, 1}, imageData}})); - CORRADE_COMPARE(out.str(), ""); + CORRADE_COMPARE(out, ""); } void AbstractImageConverterTest::convertCompressedLevels3DToDataFailed() { @@ -2285,10 +2282,10 @@ void AbstractImageConverterTest::convertCompressedLevels3DToDataFailed() { const char imageData[4*4]{}; /* The implementation is expected to print an error message on its own */ - std::ostringstream out; + Containers::String out; Error redirectError{&out}; CORRADE_VERIFY(!converter.convertToData({CompressedImageView3D{CompressedPixelFormat::Bc1RGBAUnorm, {1, 1, 1}, imageData}})); - CORRADE_COMPARE(out.str(), ""); + CORRADE_COMPARE(out, ""); } void AbstractImageConverterTest::convertCompressedLevels1DToDataInvalidImage() { @@ -2301,10 +2298,10 @@ void AbstractImageConverterTest::convertCompressedLevels1DToDataInvalidImage() { } } converter; - std::ostringstream out; + Containers::String out; Error redirectError{&out}; converter.convertToData(std::initializer_list{}); - CORRADE_COMPARE(out.str(), "Trade::AbstractImageConverter::convertToData(): at least one image has to be specified\n"); + CORRADE_COMPARE(out, "Trade::AbstractImageConverter::convertToData(): at least one image has to be specified\n"); } void AbstractImageConverterTest::convertCompressedLevels2DToDataNoLevels() { @@ -2317,10 +2314,10 @@ void AbstractImageConverterTest::convertCompressedLevels2DToDataNoLevels() { } } converter; - std::ostringstream out; + Containers::String out; Error redirectError{&out}; converter.convertToData(std::initializer_list{}); - CORRADE_COMPARE(out.str(), "Trade::AbstractImageConverter::convertToData(): at least one image has to be specified\n"); + CORRADE_COMPARE(out, "Trade::AbstractImageConverter::convertToData(): at least one image has to be specified\n"); } void AbstractImageConverterTest::convertCompressedLevels2DToDataZeroSize() { @@ -2334,13 +2331,13 @@ void AbstractImageConverterTest::convertCompressedLevels2DToDataZeroSize() { } converter; const char data[16]{}; - std::ostringstream out; + Containers::String out; Error redirectError{&out}; converter.convertToData({ CompressedImageView2D{CompressedPixelFormat::Bc1RGBAUnorm, {4, 8}, data}, CompressedImageView2D{CompressedPixelFormat::Bc1RGBAUnorm, {4, 0}, data}, }); - CORRADE_COMPARE(out.str(), "Trade::AbstractImageConverter::convertToData(): can't convert image 1 with a zero size: Vector(4, 0)\n"); + CORRADE_COMPARE(out, "Trade::AbstractImageConverter::convertToData(): can't convert image 1 with a zero size: Vector(4, 0)\n"); } void AbstractImageConverterTest::convertCompressedLevels2DToDataNullptr() { @@ -2354,13 +2351,13 @@ void AbstractImageConverterTest::convertCompressedLevels2DToDataNullptr() { } converter; const char data[16]{}; - std::ostringstream out; + Containers::String out; Error redirectError{&out}; converter.convertToData({ CompressedImageView2D{CompressedPixelFormat::Bc1RGBAUnorm, {4, 8}, data}, CompressedImageView2D{CompressedPixelFormat::Bc1RGBAUnorm, {1, 1}, {nullptr, 8}}, }); - CORRADE_COMPARE(out.str(), "Trade::AbstractImageConverter::convertToData(): can't convert image 1 with a nullptr view\n"); + CORRADE_COMPARE(out, "Trade::AbstractImageConverter::convertToData(): can't convert image 1 with a nullptr view\n"); } void AbstractImageConverterTest::convertCompressedLevels2DToDataInconsistentFormat() { @@ -2374,14 +2371,14 @@ void AbstractImageConverterTest::convertCompressedLevels2DToDataInconsistentForm } converter; const char data[16]{}; - std::ostringstream out; + Containers::String out; Error redirectError{&out}; converter.convertToData({ CompressedImageView2D{CompressedPixelFormat::Bc1RGBAUnorm, {8, 4}, data}, CompressedImageView2D{CompressedPixelFormat::Bc1RGBAUnorm, {4, 4}, data}, CompressedImageView2D{CompressedPixelFormat::Bc1RGBASrgb, {4, 4}, data}, }); - CORRADE_COMPARE(out.str(), "Trade::AbstractImageConverter::convertToData(): levels don't have the same format, expected CompressedPixelFormat::Bc1RGBAUnorm but got CompressedPixelFormat::Bc1RGBASrgb for image 2\n"); + CORRADE_COMPARE(out, "Trade::AbstractImageConverter::convertToData(): levels don't have the same format, expected CompressedPixelFormat::Bc1RGBAUnorm but got CompressedPixelFormat::Bc1RGBASrgb for image 2\n"); } void AbstractImageConverterTest::convertCompressedLevels2DToDataInconsistentFlags() { @@ -2395,14 +2392,14 @@ void AbstractImageConverterTest::convertCompressedLevels2DToDataInconsistentFlag } converter; const char data[16]{}; - std::ostringstream out; + Containers::String out; Error redirectError{&out}; converter.convertToData({ CompressedImageView2D{CompressedPixelFormat::Bc1RGBAUnorm, {8, 4}, data, ImageFlag2D::Array}, CompressedImageView2D{CompressedPixelFormat::Bc1RGBAUnorm, {4, 4}, data, ImageFlag2D::Array}, CompressedImageView2D{CompressedPixelFormat::Bc1RGBAUnorm, {4, 4}, data}, }); - CORRADE_COMPARE(out.str(), "Trade::AbstractImageConverter::convertToData(): levels don't have the same flags, expected ImageFlag2D::Array but got ImageFlags2D{} for image 2\n"); + CORRADE_COMPARE(out, "Trade::AbstractImageConverter::convertToData(): levels don't have the same flags, expected ImageFlag2D::Array but got ImageFlags2D{} for image 2\n"); } void AbstractImageConverterTest::convertCompressedLevels3DToDataInvalidImage() { @@ -2415,10 +2412,10 @@ void AbstractImageConverterTest::convertCompressedLevels3DToDataInvalidImage() { } } converter; - std::ostringstream out; + Containers::String out; Error redirectError{&out}; converter.convertToData(std::initializer_list{}); - CORRADE_COMPARE(out.str(), "Trade::AbstractImageConverter::convertToData(): at least one image has to be specified\n"); + CORRADE_COMPARE(out, "Trade::AbstractImageConverter::convertToData(): at least one image has to be specified\n"); } void AbstractImageConverterTest::convertCompressedLevels1DToDataNotImplemented() { @@ -2432,10 +2429,10 @@ void AbstractImageConverterTest::convertCompressedLevels1DToDataNotImplemented() } converter; const char data[8]{}; - std::ostringstream out; + Containers::String out; Error redirectError{&out}; converter.convertToData({CompressedImageView1D{CompressedPixelFormat::Bc1RGBAUnorm, 4, data}}); - CORRADE_COMPARE(out.str(), "Trade::AbstractImageConverter::convertToData(): multi-level compressed 1D image conversion advertised but not implemented\n"); + CORRADE_COMPARE(out, "Trade::AbstractImageConverter::convertToData(): multi-level compressed 1D image conversion advertised but not implemented\n"); } void AbstractImageConverterTest::convertCompressedLevels2DToDataNotImplemented() { @@ -2449,10 +2446,10 @@ void AbstractImageConverterTest::convertCompressedLevels2DToDataNotImplemented() } converter; const char data[8]{}; - std::ostringstream out; + Containers::String out; Error redirectError{&out}; converter.convertToData({CompressedImageView2D{CompressedPixelFormat::Bc1RGBAUnorm, {4, 4}, data}}); - CORRADE_COMPARE(out.str(), "Trade::AbstractImageConverter::convertToData(): multi-level compressed 2D image conversion advertised but not implemented\n"); + CORRADE_COMPARE(out, "Trade::AbstractImageConverter::convertToData(): multi-level compressed 2D image conversion advertised but not implemented\n"); } void AbstractImageConverterTest::convertCompressedLevels3DToDataNotImplemented() { @@ -2466,10 +2463,10 @@ void AbstractImageConverterTest::convertCompressedLevels3DToDataNotImplemented() } converter; const char data[8]{}; - std::ostringstream out; + Containers::String out; Error redirectError{&out}; converter.convertToData({CompressedImageView3D{CompressedPixelFormat::Bc1RGBAUnorm, {4, 4, 1}, data}}); - CORRADE_COMPARE(out.str(), "Trade::AbstractImageConverter::convertToData(): multi-level compressed 3D image conversion advertised but not implemented\n"); + CORRADE_COMPARE(out, "Trade::AbstractImageConverter::convertToData(): multi-level compressed 3D image conversion advertised but not implemented\n"); } void AbstractImageConverterTest::convertCompressedLevels1DToDataCustomDeleter() { @@ -2486,10 +2483,10 @@ void AbstractImageConverterTest::convertCompressedLevels1DToDataCustomDeleter() } converter; const char data[8]{}; - std::ostringstream out; + Containers::String out; Error redirectError{&out}; converter.convertToData({CompressedImageView1D{CompressedPixelFormat::Bc1RGBAUnorm, 4, data}}); - CORRADE_COMPARE(out.str(), "Trade::AbstractImageConverter::convertToData(): implementation is not allowed to use a custom Array deleter\n"); + CORRADE_COMPARE(out, "Trade::AbstractImageConverter::convertToData(): implementation is not allowed to use a custom Array deleter\n"); } void AbstractImageConverterTest::convertCompressedLevels2DToDataCustomDeleter() { @@ -2506,10 +2503,10 @@ void AbstractImageConverterTest::convertCompressedLevels2DToDataCustomDeleter() } converter; const char data[8]{}; - std::ostringstream out; + Containers::String out; Error redirectError{&out}; converter.convertToData({CompressedImageView2D{CompressedPixelFormat::Bc1RGBAUnorm, {4, 4}, data}}); - CORRADE_COMPARE(out.str(), "Trade::AbstractImageConverter::convertToData(): implementation is not allowed to use a custom Array deleter\n"); + CORRADE_COMPARE(out, "Trade::AbstractImageConverter::convertToData(): implementation is not allowed to use a custom Array deleter\n"); } void AbstractImageConverterTest::convertCompressedLevels3DToDataCustomDeleter() { @@ -2526,10 +2523,10 @@ void AbstractImageConverterTest::convertCompressedLevels3DToDataCustomDeleter() } converter; const char data[8]{}; - std::ostringstream out; + Containers::String out; Error redirectError{&out}; converter.convertToData({CompressedImageView3D{CompressedPixelFormat::Bc1RGBAUnorm, {4, 4, 1}, data}}); - CORRADE_COMPARE(out.str(), "Trade::AbstractImageConverter::convertToData(): implementation is not allowed to use a custom Array deleter\n"); + CORRADE_COMPARE(out, "Trade::AbstractImageConverter::convertToData(): implementation is not allowed to use a custom Array deleter\n"); } void AbstractImageConverterTest::convert1DToDataThroughLevels() { @@ -2704,10 +2701,10 @@ void AbstractImageConverterTest::convert1DToFileFailed() { const char imageData[4]{}; /* The implementation is expected to print an error message on its own */ - std::ostringstream out; + Containers::String out; Error redirectError{&out}; CORRADE_VERIFY(!converter.convertToFile(ImageView1D{PixelFormat::RGBA8Unorm, 1, imageData}, Utility::Path::join(TRADE_TEST_OUTPUT_DIR, "image.out"))); - CORRADE_COMPARE(out.str(), ""); + CORRADE_COMPARE(out, ""); } void AbstractImageConverterTest::convert2DToFileFailed() { @@ -2723,10 +2720,10 @@ void AbstractImageConverterTest::convert2DToFileFailed() { const char imageData[4]{}; /* The implementation is expected to print an error message on its own */ - std::ostringstream out; + Containers::String out; Error redirectError{&out}; CORRADE_VERIFY(!converter.convertToFile(ImageView2D{PixelFormat::RGBA8Unorm, {1, 1}, imageData}, Utility::Path::join(TRADE_TEST_OUTPUT_DIR, "image.out"))); - CORRADE_COMPARE(out.str(), ""); + CORRADE_COMPARE(out, ""); } void AbstractImageConverterTest::convert3DToFileFailed() { @@ -2742,10 +2739,10 @@ void AbstractImageConverterTest::convert3DToFileFailed() { const char imageData[4]{}; /* The implementation is expected to print an error message on its own */ - std::ostringstream out; + Containers::String out; Error redirectError{&out}; CORRADE_VERIFY(!converter.convertToFile(ImageView3D{PixelFormat::RGBA8Unorm, {1, 1, 1}, imageData}, Utility::Path::join(TRADE_TEST_OUTPUT_DIR, "image.out"))); - CORRADE_COMPARE(out.str(), ""); + CORRADE_COMPARE(out, ""); } void AbstractImageConverterTest::convert1DToFileThroughData() { @@ -2826,11 +2823,11 @@ void AbstractImageConverterTest::convert1DToFileThroughDataFailed() { /* Function should fail, no file should get written and no error output should be printed (the base implementation assumes the plugin does it) */ - std::ostringstream out; + Containers::String out; Error redirectError{&out}; CORRADE_VERIFY(!converter.convertToFile(ImageView1D{PixelFormat::RGBA8Unorm, 1, data}, filename)); CORRADE_VERIFY(!Utility::Path::exists(filename)); - CORRADE_COMPARE(out.str(), ""); + CORRADE_COMPARE(out, ""); } void AbstractImageConverterTest::convert2DToFileThroughDataFailed() { @@ -2851,11 +2848,11 @@ void AbstractImageConverterTest::convert2DToFileThroughDataFailed() { /* Function should fail, no file should get written and no error output should be printed (the base implementation assumes the plugin does it) */ - std::ostringstream out; + Containers::String out; Error redirectError{&out}; CORRADE_VERIFY(!converter.convertToFile(ImageView2D{PixelFormat::RGBA8Unorm, {1, 1}, data}, filename)); CORRADE_VERIFY(!Utility::Path::exists(filename)); - CORRADE_COMPARE(out.str(), ""); + CORRADE_COMPARE(out, ""); } void AbstractImageConverterTest::convert3DToFileThroughDataFailed() { @@ -2876,11 +2873,11 @@ void AbstractImageConverterTest::convert3DToFileThroughDataFailed() { /* Function should fail, no file should get written and no error output should be printed (the base implementation assumes the plugin does it) */ - std::ostringstream out; + Containers::String out; Error redirectError{&out}; CORRADE_VERIFY(!converter.convertToFile(ImageView3D{PixelFormat::RGBA8Unorm, {1, 1, 1}, data}, filename)); CORRADE_VERIFY(!Utility::Path::exists(filename)); - CORRADE_COMPARE(out.str(), ""); + CORRADE_COMPARE(out, ""); } void AbstractImageConverterTest::convert1DToFileThroughDataNotWritable() { @@ -2893,10 +2890,10 @@ void AbstractImageConverterTest::convert1DToFileThroughDataNotWritable() { } converter; const char data[4]{}; - std::ostringstream out; + Containers::String out; Error redirectError{&out}; CORRADE_VERIFY(!converter.convertToFile(ImageView1D{PixelFormat::RGBA8Unorm, 1, data}, "/some/path/that/does/not/exist")); - CORRADE_COMPARE_AS(out.str(), + CORRADE_COMPARE_AS(out, "Trade::AbstractImageConverter::convertToFile(): cannot write to file /some/path/that/does/not/exist\n", TestSuite::Compare::StringHasSuffix); } @@ -2911,10 +2908,10 @@ void AbstractImageConverterTest::convert2DToFileThroughDataNotWritable() { } converter; const char data[4]{}; - std::ostringstream out; + Containers::String out; Error redirectError{&out}; CORRADE_VERIFY(!converter.convertToFile(ImageView2D{PixelFormat::RGBA8Unorm, {1, 1}, data}, "/some/path/that/does/not/exist")); - CORRADE_COMPARE_AS(out.str(), + CORRADE_COMPARE_AS(out, "Trade::AbstractImageConverter::convertToFile(): cannot write to file /some/path/that/does/not/exist\n", TestSuite::Compare::StringHasSuffix); } @@ -2929,10 +2926,10 @@ void AbstractImageConverterTest::convert3DToFileThroughDataNotWritable() { } converter; const char data[4]{}; - std::ostringstream out; + Containers::String out; Error redirectError{&out}; CORRADE_VERIFY(!converter.convertToFile(ImageView3D{PixelFormat::RGBA8Unorm, {1, 1, 1}, data}, "/some/path/that/does/not/exist")); - CORRADE_COMPARE_AS(out.str(), + CORRADE_COMPARE_AS(out, "Trade::AbstractImageConverter::convertToFile(): cannot write to file /some/path/that/does/not/exist\n", TestSuite::Compare::StringHasSuffix); } @@ -2944,10 +2941,10 @@ void AbstractImageConverterTest::convert1DToFileInvalidImage() { ImageConverterFeatures doFeatures() const override { return ImageConverterFeature::Convert1DToFile; } } converter; - std::ostringstream out; + Containers::String out; Error redirectError{&out}; converter.convertToFile(ImageView1D{PixelFormat::RGBA8Unorm, 0, nullptr}, Utility::Path::join(TRADE_TEST_OUTPUT_DIR, "image.out")); - CORRADE_COMPARE(out.str(), "Trade::AbstractImageConverter::convertToFile(): can't convert image with a zero size: Vector(0)\n"); + CORRADE_COMPARE(out, "Trade::AbstractImageConverter::convertToFile(): can't convert image with a zero size: Vector(0)\n"); } void AbstractImageConverterTest::convert2DToFileInvalidImage() { @@ -2957,10 +2954,10 @@ void AbstractImageConverterTest::convert2DToFileInvalidImage() { ImageConverterFeatures doFeatures() const override { return ImageConverterFeature::Convert2DToFile; } } converter; - std::ostringstream out; + Containers::String out; Error redirectError{&out}; converter.convertToFile(ImageView2D{PixelFormat::RGBA8Unorm, {}, nullptr}, Utility::Path::join(TRADE_TEST_OUTPUT_DIR, "image.out")); - CORRADE_COMPARE(out.str(), "Trade::AbstractImageConverter::convertToFile(): can't convert image with a zero size: Vector(0, 0)\n"); + CORRADE_COMPARE(out, "Trade::AbstractImageConverter::convertToFile(): can't convert image with a zero size: Vector(0, 0)\n"); } void AbstractImageConverterTest::convert3DToFileInvalidImage() { @@ -2970,10 +2967,10 @@ void AbstractImageConverterTest::convert3DToFileInvalidImage() { ImageConverterFeatures doFeatures() const override { return ImageConverterFeature::Convert3DToFile; } } converter; - std::ostringstream out; + Containers::String out; Error redirectError{&out}; converter.convertToFile(ImageView3D{PixelFormat::RGBA8Unorm, {}, nullptr}, Utility::Path::join(TRADE_TEST_OUTPUT_DIR, "image.out")); - CORRADE_COMPARE(out.str(), "Trade::AbstractImageConverter::convertToFile(): can't convert image with a zero size: Vector(0, 0, 0)\n"); + CORRADE_COMPARE(out, "Trade::AbstractImageConverter::convertToFile(): can't convert image with a zero size: Vector(0, 0, 0)\n"); } void AbstractImageConverterTest::convert1DToFileNotImplemented() { @@ -2984,10 +2981,10 @@ void AbstractImageConverterTest::convert1DToFileNotImplemented() { } converter; const char data[4]{}; - std::ostringstream out; + Containers::String out; Error redirectError{&out}; converter.convertToFile(ImageView1D{PixelFormat::RGBA8Unorm, 1, data}, Utility::Path::join(TRADE_TEST_OUTPUT_DIR, "image.out")); - CORRADE_COMPARE(out.str(), "Trade::AbstractImageConverter::convertToFile(): 1D image conversion advertised but not implemented\n"); + CORRADE_COMPARE(out, "Trade::AbstractImageConverter::convertToFile(): 1D image conversion advertised but not implemented\n"); } void AbstractImageConverterTest::convert2DToFileNotImplemented() { @@ -2998,10 +2995,10 @@ void AbstractImageConverterTest::convert2DToFileNotImplemented() { } converter; const char data[4]{}; - std::ostringstream out; + Containers::String out; Error redirectError{&out}; converter.convertToFile(ImageView2D{PixelFormat::RGBA8Unorm, {1, 1}, data}, Utility::Path::join(TRADE_TEST_OUTPUT_DIR, "image.out")); - CORRADE_COMPARE(out.str(), "Trade::AbstractImageConverter::convertToFile(): 2D image conversion advertised but not implemented\n"); + CORRADE_COMPARE(out, "Trade::AbstractImageConverter::convertToFile(): 2D image conversion advertised but not implemented\n"); } void AbstractImageConverterTest::convert3DToFileNotImplemented() { @@ -3012,10 +3009,10 @@ void AbstractImageConverterTest::convert3DToFileNotImplemented() { } converter; const char data[4]{}; - std::ostringstream out; + Containers::String out; Error redirectError{&out}; converter.convertToFile(ImageView3D{PixelFormat::RGBA8Unorm, {1, 1, 1}, data}, Utility::Path::join(TRADE_TEST_OUTPUT_DIR, "image.out")); - CORRADE_COMPARE(out.str(), "Trade::AbstractImageConverter::convertToFile(): 3D image conversion advertised but not implemented\n"); + CORRADE_COMPARE(out, "Trade::AbstractImageConverter::convertToFile(): 3D image conversion advertised but not implemented\n"); } void AbstractImageConverterTest::convertCompressed1DToFile() { @@ -3088,10 +3085,10 @@ void AbstractImageConverterTest::convertCompressed1DToFileFailed() { const char imageData[4*4]{}; /* The implementation is expected to print an error message on its own */ - std::ostringstream out; + Containers::String out; Error redirectError{&out}; CORRADE_VERIFY(!converter.convertToFile(CompressedImageView1D{CompressedPixelFormat::Bc1RGBAUnorm, 1, imageData}, Utility::Path::join(TRADE_TEST_OUTPUT_DIR, "image.out"))); - CORRADE_COMPARE(out.str(), ""); + CORRADE_COMPARE(out, ""); } void AbstractImageConverterTest::convertCompressed2DToFileFailed() { @@ -3107,10 +3104,10 @@ void AbstractImageConverterTest::convertCompressed2DToFileFailed() { const char imageData[4*4]{}; /* The implementation is expected to print an error message on its own */ - std::ostringstream out; + Containers::String out; Error redirectError{&out}; CORRADE_VERIFY(!converter.convertToFile(CompressedImageView2D{CompressedPixelFormat::Bc1RGBAUnorm, {1, 1}, imageData}, Utility::Path::join(TRADE_TEST_OUTPUT_DIR, "image.out"))); - CORRADE_COMPARE(out.str(), ""); + CORRADE_COMPARE(out, ""); } void AbstractImageConverterTest::convertCompressed3DToFileFailed() { @@ -3126,10 +3123,10 @@ void AbstractImageConverterTest::convertCompressed3DToFileFailed() { const char imageData[4*4]{}; /* The implementation is expected to print an error message on its own */ - std::ostringstream out; + Containers::String out; Error redirectError{&out}; CORRADE_VERIFY(!converter.convertToFile(CompressedImageView3D{CompressedPixelFormat::Bc1RGBAUnorm, {1, 1, 1}, imageData}, Utility::Path::join(TRADE_TEST_OUTPUT_DIR, "image.out"))); - CORRADE_COMPARE(out.str(), ""); + CORRADE_COMPARE(out, ""); } void AbstractImageConverterTest::convertCompressed1DToFileThroughData() { @@ -3210,11 +3207,11 @@ void AbstractImageConverterTest::convertCompressed1DToFileThroughDataFailed() { /* Function should fail, no file should get written and no error output should be printed (the base implementation assumes the plugin does it) */ - std::ostringstream out; + Containers::String out; Error redirectError{&out}; CORRADE_VERIFY(!converter.convertToFile(CompressedImageView1D{CompressedPixelFormat::Bc1RGBAUnorm, 4, data}, filename)); CORRADE_VERIFY(!Utility::Path::exists(filename)); - CORRADE_COMPARE(out.str(), ""); + CORRADE_COMPARE(out, ""); } void AbstractImageConverterTest::convertCompressed2DToFileThroughDataFailed() { @@ -3235,11 +3232,11 @@ void AbstractImageConverterTest::convertCompressed2DToFileThroughDataFailed() { /* Function should fail, no file should get written and no error output should be printed (the base implementation assumes the plugin does it) */ - std::ostringstream out; + Containers::String out; Error redirectError{&out}; CORRADE_VERIFY(!converter.convertToFile(CompressedImageView2D{CompressedPixelFormat::Bc1RGBAUnorm, {4, 4}, data}, filename)); CORRADE_VERIFY(!Utility::Path::exists(filename)); - CORRADE_COMPARE(out.str(), ""); + CORRADE_COMPARE(out, ""); } void AbstractImageConverterTest::convertCompressed3DToFileThroughDataFailed() { @@ -3260,11 +3257,11 @@ void AbstractImageConverterTest::convertCompressed3DToFileThroughDataFailed() { /* Function should fail, no file should get written and no error output should be printed (the base implementation assumes the plugin does it) */ - std::ostringstream out; + Containers::String out; Error redirectError{&out}; CORRADE_VERIFY(!converter.convertToFile(CompressedImageView3D{CompressedPixelFormat::Bc1RGBAUnorm, {4, 4, 1}, data}, filename)); CORRADE_VERIFY(!Utility::Path::exists(filename)); - CORRADE_COMPARE(out.str(), ""); + CORRADE_COMPARE(out, ""); } void AbstractImageConverterTest::convertCompressed1DToFileThroughDataNotWritable() { @@ -3277,10 +3274,10 @@ void AbstractImageConverterTest::convertCompressed1DToFileThroughDataNotWritable } converter; const char data[8]{}; - std::ostringstream out; + Containers::String out; Error redirectError{&out}; converter.convertToFile(CompressedImageView1D{CompressedPixelFormat::Bc1RGBAUnorm, 4, data}, "/some/path/that/does/not/exist"); - CORRADE_COMPARE_AS(out.str(), + CORRADE_COMPARE_AS(out, "Trade::AbstractImageConverter::convertToFile(): cannot write to file /some/path/that/does/not/exist\n", TestSuite::Compare::StringHasSuffix); } @@ -3295,10 +3292,10 @@ void AbstractImageConverterTest::convertCompressed2DToFileThroughDataNotWritable } converter; const char data[8]{}; - std::ostringstream out; + Containers::String out; Error redirectError{&out}; converter.convertToFile(CompressedImageView2D{CompressedPixelFormat::Bc1RGBAUnorm, {4, 4}, data}, "/some/path/that/does/not/exist"); - CORRADE_COMPARE_AS(out.str(), + CORRADE_COMPARE_AS(out, "Trade::AbstractImageConverter::convertToFile(): cannot write to file /some/path/that/does/not/exist\n", TestSuite::Compare::StringHasSuffix); } @@ -3313,10 +3310,10 @@ void AbstractImageConverterTest::convertCompressed3DToFileThroughDataNotWritable } converter; const char data[8]{}; - std::ostringstream out; + Containers::String out; Error redirectError{&out}; converter.convertToFile(CompressedImageView3D{CompressedPixelFormat::Bc1RGBAUnorm, {4, 4, 1}, data}, "/some/path/that/does/not/exist"); - CORRADE_COMPARE_AS(out.str(), + CORRADE_COMPARE_AS(out, "Trade::AbstractImageConverter::convertToFile(): cannot write to file /some/path/that/does/not/exist\n", TestSuite::Compare::StringHasSuffix); } @@ -3328,10 +3325,10 @@ void AbstractImageConverterTest::convertCompressed1DToFileInvalidImage() { ImageConverterFeatures doFeatures() const override { return ImageConverterFeature::ConvertCompressed1DToFile; } } converter; - std::ostringstream out; + Containers::String out; Error redirectError{&out}; converter.convertToFile(CompressedImageView1D{CompressedPixelFormat::Bc1RGBAUnorm, 0, nullptr}, Utility::Path::join(TRADE_TEST_OUTPUT_DIR, "image.out")); - CORRADE_COMPARE(out.str(), "Trade::AbstractImageConverter::convertToFile(): can't convert image with a zero size: Vector(0)\n"); + CORRADE_COMPARE(out, "Trade::AbstractImageConverter::convertToFile(): can't convert image with a zero size: Vector(0)\n"); } void AbstractImageConverterTest::convertCompressed2DToFileInvalidImage() { @@ -3341,10 +3338,10 @@ void AbstractImageConverterTest::convertCompressed2DToFileInvalidImage() { ImageConverterFeatures doFeatures() const override { return ImageConverterFeature::ConvertCompressed2DToFile; } } converter; - std::ostringstream out; + Containers::String out; Error redirectError{&out}; converter.convertToFile(CompressedImageView2D{CompressedPixelFormat::Bc1RGBAUnorm, {}, nullptr}, Utility::Path::join(TRADE_TEST_OUTPUT_DIR, "image.out")); - CORRADE_COMPARE(out.str(), "Trade::AbstractImageConverter::convertToFile(): can't convert image with a zero size: Vector(0, 0)\n"); + CORRADE_COMPARE(out, "Trade::AbstractImageConverter::convertToFile(): can't convert image with a zero size: Vector(0, 0)\n"); } void AbstractImageConverterTest::convertCompressed3DToFileInvalidImage() { @@ -3354,10 +3351,10 @@ void AbstractImageConverterTest::convertCompressed3DToFileInvalidImage() { ImageConverterFeatures doFeatures() const override { return ImageConverterFeature::ConvertCompressed3DToFile; } } converter; - std::ostringstream out; + Containers::String out; Error redirectError{&out}; converter.convertToFile(CompressedImageView3D{CompressedPixelFormat::Bc1RGBAUnorm, {}, nullptr}, Utility::Path::join(TRADE_TEST_OUTPUT_DIR, "image.out")); - CORRADE_COMPARE(out.str(), "Trade::AbstractImageConverter::convertToFile(): can't convert image with a zero size: Vector(0, 0, 0)\n"); + CORRADE_COMPARE(out, "Trade::AbstractImageConverter::convertToFile(): can't convert image with a zero size: Vector(0, 0, 0)\n"); } void AbstractImageConverterTest::convertCompressed1DToFileNotImplemented() { @@ -3368,10 +3365,10 @@ void AbstractImageConverterTest::convertCompressed1DToFileNotImplemented() { } converter; const char data[8]{}; - std::ostringstream out; + Containers::String out; Error redirectError{&out}; converter.convertToFile(CompressedImageView1D{CompressedPixelFormat::Bc1RGBAUnorm, 4, data}, Utility::Path::join(TRADE_TEST_OUTPUT_DIR, "image.out")); - CORRADE_COMPARE(out.str(), "Trade::AbstractImageConverter::convertToFile(): compressed 1D image conversion advertised but not implemented\n"); + CORRADE_COMPARE(out, "Trade::AbstractImageConverter::convertToFile(): compressed 1D image conversion advertised but not implemented\n"); } void AbstractImageConverterTest::convertCompressed2DToFileNotImplemented() { @@ -3382,10 +3379,10 @@ void AbstractImageConverterTest::convertCompressed2DToFileNotImplemented() { } converter; const char data[8]{}; - std::ostringstream out; + Containers::String out; Error redirectError{&out}; converter.convertToFile(CompressedImageView2D{CompressedPixelFormat::Bc1RGBAUnorm, {4, 4}, data}, Utility::Path::join(TRADE_TEST_OUTPUT_DIR, "image.out")); - CORRADE_COMPARE(out.str(), "Trade::AbstractImageConverter::convertToFile(): compressed 2D image conversion advertised but not implemented\n"); + CORRADE_COMPARE(out, "Trade::AbstractImageConverter::convertToFile(): compressed 2D image conversion advertised but not implemented\n"); } void AbstractImageConverterTest::convertCompressed3DToFileNotImplemented() { @@ -3396,10 +3393,10 @@ void AbstractImageConverterTest::convertCompressed3DToFileNotImplemented() { } converter; const char data[8]{}; - std::ostringstream out; + Containers::String out; Error redirectError{&out}; converter.convertToFile(CompressedImageView3D{CompressedPixelFormat::Bc1RGBAUnorm, {4, 4, 1}, data}, Utility::Path::join(TRADE_TEST_OUTPUT_DIR, "image.out")); - CORRADE_COMPARE(out.str(), "Trade::AbstractImageConverter::convertToFile(): compressed 3D image conversion advertised but not implemented\n"); + CORRADE_COMPARE(out, "Trade::AbstractImageConverter::convertToFile(): compressed 3D image conversion advertised but not implemented\n"); } void AbstractImageConverterTest::convertImageData1DToFile() { @@ -3539,10 +3536,10 @@ void AbstractImageConverterTest::convertLevels1DToFileFailed() { const char imageData[4]{}; /* The implementation is expected to print an error message on its own */ - std::ostringstream out; + Containers::String out; Error redirectError{&out}; CORRADE_VERIFY(!converter.convertToFile({ImageView1D{PixelFormat::RGBA8Unorm, 1, imageData}}, Utility::Path::join(TRADE_TEST_OUTPUT_DIR, "image.out"))); - CORRADE_COMPARE(out.str(), ""); + CORRADE_COMPARE(out, ""); } void AbstractImageConverterTest::convertLevels2DToFileFailed() { @@ -3559,10 +3556,10 @@ void AbstractImageConverterTest::convertLevels2DToFileFailed() { const char imageData[4]{}; /* The implementation is expected to print an error message on its own */ - std::ostringstream out; + Containers::String out; Error redirectError{&out}; CORRADE_VERIFY(!converter.convertToFile({ImageView2D{PixelFormat::RGBA8Unorm, {1, 1}, imageData}}, Utility::Path::join(TRADE_TEST_OUTPUT_DIR, "image.out"))); - CORRADE_COMPARE(out.str(), ""); + CORRADE_COMPARE(out, ""); } void AbstractImageConverterTest::convertLevels3DToFileFailed() { @@ -3579,10 +3576,10 @@ void AbstractImageConverterTest::convertLevels3DToFileFailed() { const char imageData[4]{}; /* The implementation is expected to print an error message on its own */ - std::ostringstream out; + Containers::String out; Error redirectError{&out}; CORRADE_VERIFY(!converter.convertToFile({ImageView3D{PixelFormat::RGBA8Unorm, {1, 1, 1}, imageData}}, Utility::Path::join(TRADE_TEST_OUTPUT_DIR, "image.out"))); - CORRADE_COMPARE(out.str(), ""); + CORRADE_COMPARE(out, ""); } void AbstractImageConverterTest::convertLevels1DToFileThroughData() { @@ -3691,11 +3688,11 @@ void AbstractImageConverterTest::convertLevels1DToFileThroughDataFailed() { /* Function should fail, no file should get written and no error output should be printed (the base implementation assumes the plugin does it) */ - std::ostringstream out; + Containers::String out; Error redirectError{&out}; CORRADE_VERIFY(!converter.convertToFile({ImageView1D{PixelFormat::RGBA8Unorm, 1, data}}, filename)); CORRADE_VERIFY(!Utility::Path::exists(filename)); - CORRADE_COMPARE(out.str(), ""); + CORRADE_COMPARE(out, ""); } void AbstractImageConverterTest::convertLevels2DToFileThroughDataFailed() { @@ -3719,11 +3716,11 @@ void AbstractImageConverterTest::convertLevels2DToFileThroughDataFailed() { /* Function should fail, no file should get written and no error output should be printed (the base implementation assumes the plugin does it) */ - std::ostringstream out; + Containers::String out; Error redirectError{&out}; CORRADE_VERIFY(!converter.convertToFile({ImageView2D{PixelFormat::RGBA8Unorm, {1, 1}, data}}, filename)); CORRADE_VERIFY(!Utility::Path::exists(filename)); - CORRADE_COMPARE(out.str(), ""); + CORRADE_COMPARE(out, ""); } void AbstractImageConverterTest::convertLevels3DToFileThroughDataFailed() { @@ -3747,11 +3744,11 @@ void AbstractImageConverterTest::convertLevels3DToFileThroughDataFailed() { /* Function should fail, no file should get written and no error output should be printed (the base implementation assumes the plugin does it) */ - std::ostringstream out; + Containers::String out; Error redirectError{&out}; CORRADE_VERIFY(!converter.convertToFile({ImageView3D{PixelFormat::RGBA8Unorm, {1, 1, 1}, data}}, filename)); CORRADE_VERIFY(!Utility::Path::exists(filename)); - CORRADE_COMPARE(out.str(), ""); + CORRADE_COMPARE(out, ""); } void AbstractImageConverterTest::convertLevels1DToFileThroughDataNotWritable() { @@ -3766,10 +3763,10 @@ void AbstractImageConverterTest::convertLevels1DToFileThroughDataNotWritable() { } converter; const char data[4]{}; - std::ostringstream out; + Containers::String out; Error redirectError{&out}; CORRADE_VERIFY(!converter.convertToFile({ImageView1D{PixelFormat::RGBA8Unorm, 1, data}}, "/some/path/that/does/not/exist")); - CORRADE_COMPARE_AS(out.str(), + CORRADE_COMPARE_AS(out, "Trade::AbstractImageConverter::convertToFile(): cannot write to file /some/path/that/does/not/exist\n", TestSuite::Compare::StringHasSuffix); } @@ -3787,10 +3784,10 @@ void AbstractImageConverterTest::convertLevels2DToFileThroughDataNotWritable() { } converter; const char data[4]{}; - std::ostringstream out; + Containers::String out; Error redirectError{&out}; CORRADE_VERIFY(!converter.convertToFile({ImageView2D{PixelFormat::RGBA8Unorm, {1, 1}, data}}, "/some/path/that/does/not/exist")); - CORRADE_COMPARE_AS(out.str(), + CORRADE_COMPARE_AS(out, "Trade::AbstractImageConverter::convertToFile(): cannot write to file /some/path/that/does/not/exist\n", TestSuite::Compare::StringHasSuffix); } @@ -3808,10 +3805,10 @@ void AbstractImageConverterTest::convertLevels3DToFileThroughDataNotWritable() { } converter; const char data[4]{}; - std::ostringstream out; + Containers::String out; Error redirectError{&out}; CORRADE_VERIFY(!converter.convertToFile({ImageView3D{PixelFormat::RGBA8Unorm, {1, 1, 1}, data}}, "/some/path/that/does/not/exist")); - CORRADE_COMPARE_AS(out.str(), + CORRADE_COMPARE_AS(out, "Trade::AbstractImageConverter::convertToFile(): cannot write to file /some/path/that/does/not/exist\n", TestSuite::Compare::StringHasSuffix); } @@ -3826,10 +3823,10 @@ void AbstractImageConverterTest::convertLevels1DToFileInvalidImage() { } } converter; - std::ostringstream out; + Containers::String out; Error redirectError{&out}; converter.convertToFile(std::initializer_list{}, Utility::Path::join(TRADE_TEST_OUTPUT_DIR, "image.out")); - CORRADE_COMPARE(out.str(), "Trade::AbstractImageConverter::convertToFile(): at least one image has to be specified\n"); + CORRADE_COMPARE(out, "Trade::AbstractImageConverter::convertToFile(): at least one image has to be specified\n"); } void AbstractImageConverterTest::convertLevels2DToFileInvalidImage() { @@ -3842,10 +3839,10 @@ void AbstractImageConverterTest::convertLevels2DToFileInvalidImage() { } } converter; - std::ostringstream out; + Containers::String out; Error redirectError{&out}; converter.convertToFile(std::initializer_list{}, Utility::Path::join(TRADE_TEST_OUTPUT_DIR, "image.out")); - CORRADE_COMPARE(out.str(), "Trade::AbstractImageConverter::convertToFile(): at least one image has to be specified\n"); + CORRADE_COMPARE(out, "Trade::AbstractImageConverter::convertToFile(): at least one image has to be specified\n"); } void AbstractImageConverterTest::convertLevels3DToFileInvalidImage() { @@ -3858,10 +3855,10 @@ void AbstractImageConverterTest::convertLevels3DToFileInvalidImage() { } } converter; - std::ostringstream out; + Containers::String out; Error redirectError{&out}; converter.convertToFile(std::initializer_list{}, Utility::Path::join(TRADE_TEST_OUTPUT_DIR, "image.out")); - CORRADE_COMPARE(out.str(), "Trade::AbstractImageConverter::convertToFile(): at least one image has to be specified\n"); + CORRADE_COMPARE(out, "Trade::AbstractImageConverter::convertToFile(): at least one image has to be specified\n"); } void AbstractImageConverterTest::convertLevels1DToFileNotImplemented() { @@ -3875,10 +3872,10 @@ void AbstractImageConverterTest::convertLevels1DToFileNotImplemented() { } converter; const char data[4]{}; - std::ostringstream out; + Containers::String out; Error redirectError{&out}; converter.convertToFile({ImageView1D{PixelFormat::RGBA8Unorm, 1, data}}, Utility::Path::join(TRADE_TEST_OUTPUT_DIR, "image.out")); - CORRADE_COMPARE(out.str(), "Trade::AbstractImageConverter::convertToFile(): multi-level 1D image conversion advertised but not implemented\n"); + CORRADE_COMPARE(out, "Trade::AbstractImageConverter::convertToFile(): multi-level 1D image conversion advertised but not implemented\n"); } void AbstractImageConverterTest::convertLevels2DToFileNotImplemented() { @@ -3892,10 +3889,10 @@ void AbstractImageConverterTest::convertLevels2DToFileNotImplemented() { } converter; const char data[4]{}; - std::ostringstream out; + Containers::String out; Error redirectError{&out}; converter.convertToFile({ImageView2D{PixelFormat::RGBA8Unorm, {1, 1}, data}}, Utility::Path::join(TRADE_TEST_OUTPUT_DIR, "image.out")); - CORRADE_COMPARE(out.str(), "Trade::AbstractImageConverter::convertToFile(): multi-level 2D image conversion advertised but not implemented\n"); + CORRADE_COMPARE(out, "Trade::AbstractImageConverter::convertToFile(): multi-level 2D image conversion advertised but not implemented\n"); } void AbstractImageConverterTest::convertLevels3DToFileNotImplemented() { @@ -3909,10 +3906,10 @@ void AbstractImageConverterTest::convertLevels3DToFileNotImplemented() { } converter; const char data[4]{}; - std::ostringstream out; + Containers::String out; Error redirectError{&out}; converter.convertToFile({ImageView3D{PixelFormat::RGBA8Unorm, {1, 1, 1}, data}}, Utility::Path::join(TRADE_TEST_OUTPUT_DIR, "image.out")); - CORRADE_COMPARE(out.str(), "Trade::AbstractImageConverter::convertToFile(): multi-level 3D image conversion advertised but not implemented\n"); + CORRADE_COMPARE(out, "Trade::AbstractImageConverter::convertToFile(): multi-level 3D image conversion advertised but not implemented\n"); } void AbstractImageConverterTest::convertCompressedLevels1DToFile() { @@ -4007,10 +4004,10 @@ void AbstractImageConverterTest::convertCompressedLevels1DToFileFailed() { const char imageData[4*4]{}; /* The implementation is expected to print an error message on its own */ - std::ostringstream out; + Containers::String out; Error redirectError{&out}; CORRADE_VERIFY(!converter.convertToFile({CompressedImageView1D{CompressedPixelFormat::Bc1RGBAUnorm, 1, imageData}}, Utility::Path::join(TRADE_TEST_OUTPUT_DIR, "image.out"))); - CORRADE_COMPARE(out.str(), ""); + CORRADE_COMPARE(out, ""); } void AbstractImageConverterTest::convertCompressedLevels2DToFileFailed() { @@ -4027,10 +4024,10 @@ void AbstractImageConverterTest::convertCompressedLevels2DToFileFailed() { const char imageData[4*4]{}; /* The implementation is expected to print an error message on its own */ - std::ostringstream out; + Containers::String out; Error redirectError{&out}; CORRADE_VERIFY(!converter.convertToFile({CompressedImageView2D{CompressedPixelFormat::Bc1RGBAUnorm, {1, 1}, imageData}}, Utility::Path::join(TRADE_TEST_OUTPUT_DIR, "image.out"))); - CORRADE_COMPARE(out.str(), ""); + CORRADE_COMPARE(out, ""); } void AbstractImageConverterTest::convertCompressedLevels3DToFileFailed() { @@ -4047,10 +4044,10 @@ void AbstractImageConverterTest::convertCompressedLevels3DToFileFailed() { const char imageData[4]{}; /* The implementation is expected to print an error message on its own */ - std::ostringstream out; + Containers::String out; Error redirectError{&out}; CORRADE_VERIFY(!converter.convertToFile({CompressedImageView3D{CompressedPixelFormat::Bc1RGBAUnorm, {1, 1, 1}, imageData}}, Utility::Path::join(TRADE_TEST_OUTPUT_DIR, "image.out"))); - CORRADE_COMPARE(out.str(), ""); + CORRADE_COMPARE(out, ""); } void AbstractImageConverterTest::convertCompressedLevels1DToFileThroughData() { @@ -4158,11 +4155,11 @@ void AbstractImageConverterTest::convertCompressedLevels1DToFileThroughDataFaile /* Function should fail, no file should get written and no error output should be printed (the base implementation assumes the plugin does it) */ - std::ostringstream out; + Containers::String out; Error redirectError{&out}; CORRADE_VERIFY(!converter.convertToFile({CompressedImageView1D{CompressedPixelFormat::Bc1RGBAUnorm, 4, data}}, filename)); CORRADE_VERIFY(!Utility::Path::exists(filename)); - CORRADE_COMPARE(out.str(), ""); + CORRADE_COMPARE(out, ""); } void AbstractImageConverterTest::convertCompressedLevels2DToFileThroughDataFailed() { @@ -4186,11 +4183,11 @@ void AbstractImageConverterTest::convertCompressedLevels2DToFileThroughDataFaile /* Function should fail, no file should get written and no error output should be printed (the base implementation assumes the plugin does it) */ - std::ostringstream out; + Containers::String out; Error redirectError{&out}; CORRADE_VERIFY(!converter.convertToFile({CompressedImageView2D{CompressedPixelFormat::Bc1RGBAUnorm, {4, 4}, data}}, filename)); CORRADE_VERIFY(!Utility::Path::exists(filename)); - CORRADE_COMPARE(out.str(), ""); + CORRADE_COMPARE(out, ""); } void AbstractImageConverterTest::convertCompressedLevels3DToFileThroughDataFailed() { @@ -4214,11 +4211,11 @@ void AbstractImageConverterTest::convertCompressedLevels3DToFileThroughDataFaile /* Function should fail, no file should get written and no error output should be printed (the base implementation assumes the plugin does it) */ - std::ostringstream out; + Containers::String out; Error redirectError{&out}; CORRADE_VERIFY(!converter.convertToFile({CompressedImageView3D{CompressedPixelFormat::Bc1RGBAUnorm, {4, 4, 4}, data}}, filename)); CORRADE_VERIFY(!Utility::Path::exists(filename)); - CORRADE_COMPARE(out.str(), ""); + CORRADE_COMPARE(out, ""); } void AbstractImageConverterTest::convertCompressedLevels1DToFileThroughDataNotWritable() { @@ -4234,10 +4231,10 @@ void AbstractImageConverterTest::convertCompressedLevels1DToFileThroughDataNotWr } converter; const char data[8]{}; - std::ostringstream out; + Containers::String out; Error redirectError{&out}; converter.convertToFile({CompressedImageView1D{CompressedPixelFormat::Bc1RGBAUnorm, 4, data}}, "/some/path/that/does/not/exist"); - CORRADE_COMPARE_AS(out.str(), + CORRADE_COMPARE_AS(out, "Trade::AbstractImageConverter::convertToFile(): cannot write to file /some/path/that/does/not/exist\n", TestSuite::Compare::StringHasSuffix); } @@ -4255,10 +4252,10 @@ void AbstractImageConverterTest::convertCompressedLevels2DToFileThroughDataNotWr } converter; const char data[8]{}; - std::ostringstream out; + Containers::String out; Error redirectError{&out}; converter.convertToFile({CompressedImageView2D{CompressedPixelFormat::Bc1RGBAUnorm, {4, 4}, data}}, "/some/path/that/does/not/exist"); - CORRADE_COMPARE_AS(out.str(), + CORRADE_COMPARE_AS(out, "Trade::AbstractImageConverter::convertToFile(): cannot write to file /some/path/that/does/not/exist\n", TestSuite::Compare::StringHasSuffix); } @@ -4276,10 +4273,10 @@ void AbstractImageConverterTest::convertCompressedLevels3DToFileThroughDataNotWr } converter; const char data[8]{}; - std::ostringstream out; + Containers::String out; Error redirectError{&out}; converter.convertToFile({CompressedImageView3D{CompressedPixelFormat::Bc1RGBAUnorm, {4, 4, 1}, data}}, "/some/path/that/does/not/exist"); - CORRADE_COMPARE_AS(out.str(), + CORRADE_COMPARE_AS(out, "Trade::AbstractImageConverter::convertToFile(): cannot write to file /some/path/that/does/not/exist\n", TestSuite::Compare::StringHasSuffix); } @@ -4294,10 +4291,10 @@ void AbstractImageConverterTest::convertCompressedLevels1DToFileInvalidImage() { } } converter; - std::ostringstream out; + Containers::String out; Error redirectError{&out}; converter.convertToFile(std::initializer_list{}, Utility::Path::join(TRADE_TEST_OUTPUT_DIR, "image.out")); - CORRADE_COMPARE(out.str(), "Trade::AbstractImageConverter::convertToFile(): at least one image has to be specified\n"); + CORRADE_COMPARE(out, "Trade::AbstractImageConverter::convertToFile(): at least one image has to be specified\n"); } void AbstractImageConverterTest::convertCompressedLevels2DToFileInvalidImage() { @@ -4310,10 +4307,10 @@ void AbstractImageConverterTest::convertCompressedLevels2DToFileInvalidImage() { } } converter; - std::ostringstream out; + Containers::String out; Error redirectError{&out}; converter.convertToFile(std::initializer_list{}, Utility::Path::join(TRADE_TEST_OUTPUT_DIR, "image.out")); - CORRADE_COMPARE(out.str(), "Trade::AbstractImageConverter::convertToFile(): at least one image has to be specified\n"); + CORRADE_COMPARE(out, "Trade::AbstractImageConverter::convertToFile(): at least one image has to be specified\n"); } void AbstractImageConverterTest::convertCompressedLevels3DToFileInvalidImage() { @@ -4326,10 +4323,10 @@ void AbstractImageConverterTest::convertCompressedLevels3DToFileInvalidImage() { } } converter; - std::ostringstream out; + Containers::String out; Error redirectError{&out}; converter.convertToFile(std::initializer_list{}, Utility::Path::join(TRADE_TEST_OUTPUT_DIR, "image.out")); - CORRADE_COMPARE(out.str(), "Trade::AbstractImageConverter::convertToFile(): at least one image has to be specified\n"); + CORRADE_COMPARE(out, "Trade::AbstractImageConverter::convertToFile(): at least one image has to be specified\n"); } void AbstractImageConverterTest::convertCompressedLevels1DToFileNotImplemented() { @@ -4343,10 +4340,10 @@ void AbstractImageConverterTest::convertCompressedLevels1DToFileNotImplemented() } converter; const char data[8]{}; - std::ostringstream out; + Containers::String out; Error redirectError{&out}; converter.convertToFile({CompressedImageView1D{CompressedPixelFormat::Bc1RGBAUnorm, 4, data}}, Utility::Path::join(TRADE_TEST_OUTPUT_DIR, "image.out")); - CORRADE_COMPARE(out.str(), "Trade::AbstractImageConverter::convertToFile(): multi-level compressed 1D image conversion advertised but not implemented\n"); + CORRADE_COMPARE(out, "Trade::AbstractImageConverter::convertToFile(): multi-level compressed 1D image conversion advertised but not implemented\n"); } void AbstractImageConverterTest::convertCompressedLevels2DToFileNotImplemented() { @@ -4360,10 +4357,10 @@ void AbstractImageConverterTest::convertCompressedLevels2DToFileNotImplemented() } converter; const char data[8]{}; - std::ostringstream out; + Containers::String out; Error redirectError{&out}; converter.convertToFile({CompressedImageView2D{CompressedPixelFormat::Bc1RGBAUnorm, {4, 4}, data}}, Utility::Path::join(TRADE_TEST_OUTPUT_DIR, "image.out")); - CORRADE_COMPARE(out.str(), "Trade::AbstractImageConverter::convertToFile(): multi-level compressed 2D image conversion advertised but not implemented\n"); + CORRADE_COMPARE(out, "Trade::AbstractImageConverter::convertToFile(): multi-level compressed 2D image conversion advertised but not implemented\n"); } void AbstractImageConverterTest::convertCompressedLevels3DToFileNotImplemented() { @@ -4377,10 +4374,10 @@ void AbstractImageConverterTest::convertCompressedLevels3DToFileNotImplemented() } converter; const char data[8]{}; - std::ostringstream out; + Containers::String out; Error redirectError{&out}; converter.convertToFile({CompressedImageView3D{CompressedPixelFormat::Bc1RGBAUnorm, {4, 4, 4}, data}}, Utility::Path::join(TRADE_TEST_OUTPUT_DIR, "image.out")); - CORRADE_COMPARE(out.str(), "Trade::AbstractImageConverter::convertToFile(): multi-level compressed 3D image conversion advertised but not implemented\n"); + CORRADE_COMPARE(out, "Trade::AbstractImageConverter::convertToFile(): multi-level compressed 3D image conversion advertised but not implemented\n"); } void AbstractImageConverterTest::convert1DToFileThroughLevels() { @@ -4516,83 +4513,83 @@ void AbstractImageConverterTest::convertCompressed3DToFileThroughLevels() { } void AbstractImageConverterTest::debugFeature() { - std::ostringstream out; + Containers::String out; Debug{&out} << ImageConverterFeature::ConvertCompressed2D << ImageConverterFeature(0xdeadbeef); - CORRADE_COMPARE(out.str(), "Trade::ImageConverterFeature::ConvertCompressed2D Trade::ImageConverterFeature(0xdeadbeef)\n"); + CORRADE_COMPARE(out, "Trade::ImageConverterFeature::ConvertCompressed2D Trade::ImageConverterFeature(0xdeadbeef)\n"); } void AbstractImageConverterTest::debugFeaturePacked() { - std::ostringstream out; + Containers::String 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"); + CORRADE_COMPARE(out, "ConvertCompressed2D 0xdeadbeef Trade::ImageConverterFeature::Convert3D\n"); } #ifdef MAGNUM_BUILD_DEPRECATED void AbstractImageConverterTest::debugFeatureDeprecated() { - std::ostringstream out; + Containers::String out; CORRADE_IGNORE_DEPRECATED_PUSH Debug{&out} << ImageConverterFeature::ConvertCompressedLevels1DToData << ImageConverterFeature::ConvertLevels3DToFile; CORRADE_IGNORE_DEPRECATED_POP - CORRADE_COMPARE(out.str(), "Trade::ImageConverterFeature::ConvertCompressed1DToData|Trade::ImageConverterFeature::Levels Trade::ImageConverterFeature::Convert3DToFile|Trade::ImageConverterFeature::Levels\n"); + CORRADE_COMPARE(out, "Trade::ImageConverterFeature::ConvertCompressed1DToData|Trade::ImageConverterFeature::Levels Trade::ImageConverterFeature::Convert3DToFile|Trade::ImageConverterFeature::Levels\n"); } void AbstractImageConverterTest::debugFeatureDeprecatedPacked() { - std::ostringstream out; + Containers::String 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"); + CORRADE_COMPARE(out, "ConvertCompressed1DToData|Levels Convert3DToFile|Levels Trade::ImageConverterFeature::Convert1D\n"); } #endif void AbstractImageConverterTest::debugFeatures() { - std::ostringstream out; + Containers::String out; Debug{&out} << (ImageConverterFeature::Convert2DToData|ImageConverterFeature::ConvertCompressed2DToFile) << ImageConverterFeatures{}; - CORRADE_COMPARE(out.str(), "Trade::ImageConverterFeature::Convert2DToData|Trade::ImageConverterFeature::ConvertCompressed2DToFile Trade::ImageConverterFeatures{}\n"); + CORRADE_COMPARE(out, "Trade::ImageConverterFeature::Convert2DToData|Trade::ImageConverterFeature::ConvertCompressed2DToFile Trade::ImageConverterFeatures{}\n"); } void AbstractImageConverterTest::debugFeaturesPacked() { - std::ostringstream out; + Containers::String 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"); + CORRADE_COMPARE(out, "Convert2DToData|ConvertCompressed2DToFile {} Trade::ImageConverterFeature::Convert1D\n"); } void AbstractImageConverterTest::debugFeaturesSupersets() { /* Convert*DToData is a superset of Convert*DToFile, so only one should be printed */ { - std::ostringstream out; + Containers::String out; Debug{&out} << (ImageConverterFeature::Convert2DToData|ImageConverterFeature::Convert2DToFile); - CORRADE_COMPARE(out.str(), "Trade::ImageConverterFeature::Convert2DToData\n"); + CORRADE_COMPARE(out, "Trade::ImageConverterFeature::Convert2DToData\n"); /* ConvertCompressed*DToData is a superset of ConvertCompressed*DToFile, so only one should be printed */ } { - std::ostringstream out; + Containers::String out; Debug{&out} << (ImageConverterFeature::ConvertCompressed1DToData|ImageConverterFeature::ConvertCompressed1DToFile); - CORRADE_COMPARE(out.str(), "Trade::ImageConverterFeature::ConvertCompressed1DToData\n"); + CORRADE_COMPARE(out, "Trade::ImageConverterFeature::ConvertCompressed1DToData\n"); } } void AbstractImageConverterTest::debugFlag() { - std::ostringstream out; + Containers::String out; Debug{&out} << ImageConverterFlag::Verbose << ImageConverterFlag(0xf0); - CORRADE_COMPARE(out.str(), "Trade::ImageConverterFlag::Verbose Trade::ImageConverterFlag(0xf0)\n"); + CORRADE_COMPARE(out, "Trade::ImageConverterFlag::Verbose Trade::ImageConverterFlag(0xf0)\n"); } void AbstractImageConverterTest::debugFlags() { - std::ostringstream out; + Containers::String out; Debug{&out} << (ImageConverterFlag::Verbose|ImageConverterFlag(0xf0)) << ImageConverterFlags{}; - CORRADE_COMPARE(out.str(), "Trade::ImageConverterFlag::Verbose|Trade::ImageConverterFlag(0xf0) Trade::ImageConverterFlags{}\n"); + CORRADE_COMPARE(out, "Trade::ImageConverterFlag::Verbose|Trade::ImageConverterFlag(0xf0) Trade::ImageConverterFlags{}\n"); } }}}} diff --git a/src/Magnum/Trade/Test/AbstractImporterTest.cpp b/src/Magnum/Trade/Test/AbstractImporterTest.cpp index c81641e05..002031e34 100644 --- a/src/Magnum/Trade/Test/AbstractImporterTest.cpp +++ b/src/Magnum/Trade/Test/AbstractImporterTest.cpp @@ -24,16 +24,14 @@ DEALINGS IN THE SOFTWARE. */ -#include +#include /** @todo remove once file callbacks are std::string-free */ #include #include #include -#include /** @todo remove once Debug is stream-free */ #include #include #include #include -#include #include #include "Magnum/PixelFormat.h" @@ -56,6 +54,7 @@ #include #include #include +#include #define _MAGNUM_NO_DEPRECATED_MESHDATA /* So it doesn't yell here */ #define _MAGNUM_NO_DEPRECATED_OBJECTDATA /* So it doesn't yell here */ @@ -784,12 +783,12 @@ void AbstractImporterTest::setFlagsFileOpened() { void doClose() override {} } importer; - std::ostringstream out; + Containers::String out; Error redirectError{&out}; importer.setFlags(ImporterFlag::Verbose); importer.addFlags(ImporterFlag::Verbose); importer.clearFlags(ImporterFlag::Verbose); - CORRADE_COMPARE(out.str(), + CORRADE_COMPARE(out, "Trade::AbstractImporter::setFlags(): can't be set while a file is opened\n" /* These all call into setFlags(), so the same assert is reused */ "Trade::AbstractImporter::setFlags(): can't be set while a file is opened\n" @@ -849,10 +848,10 @@ void AbstractImporterTest::openDataFailed() { } importer; /* The implementation is expected to print an error message on its own */ - std::ostringstream out; + Containers::String out; Error redirectError{&out}; CORRADE_VERIFY(!importer.openData(nullptr)); - CORRADE_COMPARE(out.str(), ""); + CORRADE_COMPARE(out, ""); } #ifdef MAGNUM_BUILD_DEPRECATED @@ -922,10 +921,10 @@ void AbstractImporterTest::openMemoryFailed() { } importer; /* The implementation is expected to print an error message on its own */ - std::ostringstream out; + Containers::String out; Error redirectError{&out}; CORRADE_VERIFY(!importer.openMemory(nullptr)); - CORRADE_COMPARE(out.str(), ""); + CORRADE_COMPARE(out, ""); } void AbstractImporterTest::openFile() { @@ -960,10 +959,10 @@ void AbstractImporterTest::openFileFailed() { } importer; /* The implementation is expected to print an error message on its own */ - std::ostringstream out; + Containers::String out; Error redirectError{&out}; CORRADE_VERIFY(!importer.openFile({})); - CORRADE_COMPARE(out.str(), ""); + CORRADE_COMPARE(out, ""); } void AbstractImporterTest::openFileAsData() { @@ -1007,13 +1006,13 @@ void AbstractImporterTest::openFileAsDataNotFound() { bool _opened = false; } importer; - std::ostringstream out; + Containers::String out; Error redirectError{&out}; CORRADE_VERIFY(!importer.openFile("nonexistent.bin")); CORRADE_VERIFY(!importer.isOpened()); /* There's an error message from Path::read() before */ - CORRADE_COMPARE_AS(out.str(), + CORRADE_COMPARE_AS(out, "\nTrade::AbstractImporter::openFile(): cannot open file nonexistent.bin\n", TestSuite::Compare::StringHasSuffix); } @@ -1055,10 +1054,10 @@ void AbstractImporterTest::openStateFailed() { } importer; /* The implementation is expected to print an error message on its own */ - std::ostringstream out; + Containers::String out; Error redirectError{&out}; CORRADE_VERIFY(!importer.openState({})); - CORRADE_COMPARE(out.str(), ""); + CORRADE_COMPARE(out, ""); } void AbstractImporterTest::openFileNotImplemented() { @@ -1070,11 +1069,11 @@ void AbstractImporterTest::openFileNotImplemented() { void doClose() override {} } importer; - std::ostringstream out; + Containers::String out; Error redirectError{&out}; CORRADE_VERIFY(!importer.openFile("file.dat")); - CORRADE_COMPARE(out.str(), "Trade::AbstractImporter::openFile(): not implemented\n"); + CORRADE_COMPARE(out, "Trade::AbstractImporter::openFile(): not implemented\n"); } void AbstractImporterTest::openDataNotSupported() { @@ -1086,11 +1085,11 @@ void AbstractImporterTest::openDataNotSupported() { void doClose() override {} } importer; - std::ostringstream out; + Containers::String out; Error redirectError{&out}; CORRADE_VERIFY(!importer.openData(nullptr)); - CORRADE_COMPARE(out.str(), "Trade::AbstractImporter::openData(): feature not supported\n"); + CORRADE_COMPARE(out, "Trade::AbstractImporter::openData(): feature not supported\n"); } void AbstractImporterTest::openDataNotImplemented() { @@ -1102,11 +1101,11 @@ void AbstractImporterTest::openDataNotImplemented() { void doClose() override {} } importer; - std::ostringstream out; + Containers::String out; Error redirectError{&out}; CORRADE_VERIFY(!importer.openData(nullptr)); - CORRADE_COMPARE(out.str(), "Trade::AbstractImporter::openData(): feature advertised but not implemented\n"); + CORRADE_COMPARE(out, "Trade::AbstractImporter::openData(): feature advertised but not implemented\n"); } void AbstractImporterTest::openStateNotSupported() { @@ -1118,11 +1117,11 @@ void AbstractImporterTest::openStateNotSupported() { void doClose() override {} } importer; - std::ostringstream out; + Containers::String out; Error redirectError{&out}; CORRADE_VERIFY(!importer.openState(nullptr)); - CORRADE_COMPARE(out.str(), "Trade::AbstractImporter::openState(): feature not supported\n"); + CORRADE_COMPARE(out, "Trade::AbstractImporter::openState(): feature not supported\n"); } void AbstractImporterTest::openStateNotImplemented() { @@ -1134,11 +1133,11 @@ void AbstractImporterTest::openStateNotImplemented() { void doClose() override {} } importer; - std::ostringstream out; + Containers::String out; Error redirectError{&out}; CORRADE_VERIFY(!importer.openState(nullptr)); - CORRADE_COMPARE(out.str(), "Trade::AbstractImporter::openState(): feature advertised but not implemented\n"); + CORRADE_COMPARE(out, "Trade::AbstractImporter::openState(): feature advertised but not implemented\n"); } void AbstractImporterTest::setFileCallback() { @@ -1242,12 +1241,12 @@ void AbstractImporterTest::setFileCallbackFileOpened() { void doClose() override {} } importer; - std::ostringstream out; + Containers::String out; Error redirectError{&out}; importer.setFileCallback([](const std::string&, InputFileCallbackPolicy, void*) { return Containers::Optional>{}; }); - CORRADE_COMPARE(out.str(), "Trade::AbstractImporter::setFileCallback(): can't be set while a file is opened\n"); + CORRADE_COMPARE(out, "Trade::AbstractImporter::setFileCallback(): can't be set while a file is opened\n"); } void AbstractImporterTest::setFileCallbackNotImplemented() { @@ -1276,14 +1275,14 @@ void AbstractImporterTest::setFileCallbackNotSupported() { void doClose() override {} } importer; - std::ostringstream out; + Containers::String out; Error redirectError{&out}; int a; importer.setFileCallback([](const std::string&, InputFileCallbackPolicy, void*) { return Containers::Optional>{}; }, &a); - CORRADE_COMPARE(out.str(), "Trade::AbstractImporter::setFileCallback(): importer supports neither loading from data nor via callbacks, callbacks can't be used\n"); + CORRADE_COMPARE(out, "Trade::AbstractImporter::setFileCallback(): importer supports neither loading from data nor via callbacks, callbacks can't be used\n"); } void AbstractImporterTest::setFileCallbackOpenFileDirectly() { @@ -1393,12 +1392,12 @@ void AbstractImporterTest::setFileCallbackOpenFileThroughBaseImplementationFaile return {}; }); - std::ostringstream out; + Containers::String out; Error redirectError{&out}; CORRADE_VERIFY(!importer.openFile("file.dat")); CORRADE_VERIFY(importer.openFileCalled); - CORRADE_COMPARE(out.str(), "Trade::AbstractImporter::openFile(): cannot open file file.dat\n"); + CORRADE_COMPARE(out, "Trade::AbstractImporter::openFile(): cannot open file file.dat\n"); } void AbstractImporterTest::setFileCallbackOpenFileAsData() { @@ -1469,12 +1468,12 @@ void AbstractImporterTest::setFileCallbackOpenFileAsDataFailed() { return Containers::Optional>{}; }); - std::ostringstream out; + Containers::String out; Error redirectError{&out}; CORRADE_VERIFY(!importer.openFile("file.dat")); CORRADE_VERIFY(!importer.openFileCalled); - CORRADE_COMPARE(out.str(), "Trade::AbstractImporter::openFile(): cannot open file file.dat\n"); + CORRADE_COMPARE(out, "Trade::AbstractImporter::openFile(): cannot open file file.dat\n"); } void AbstractImporterTest::thingCountNotImplemented() { @@ -1511,7 +1510,7 @@ void AbstractImporterTest::thingCountNoFile() { void doClose() override {} } importer; - std::ostringstream out; + Containers::String out; Error redirectError{&out}; importer.sceneCount(); @@ -1535,7 +1534,7 @@ void AbstractImporterTest::thingCountNoFile() { importer.image3DCount(); importer.image3DLevelCount(7); - CORRADE_COMPARE(out.str(), + CORRADE_COMPARE(out, "Trade::AbstractImporter::sceneCount(): no file opened\n" "Trade::AbstractImporter::objectCount(): no file opened\n" "Trade::AbstractImporter::animationCount(): no file opened\n" @@ -1592,7 +1591,7 @@ void AbstractImporterTest::thingForNameNoFile() { void doClose() override {} } importer; - std::ostringstream out; + Containers::String out; Error redirectError{&out}; importer.sceneForName(""); @@ -1612,7 +1611,7 @@ void AbstractImporterTest::thingForNameNoFile() { importer.image2DForName(""); importer.image3DForName(""); - CORRADE_COMPARE(out.str(), + CORRADE_COMPARE(out, "Trade::AbstractImporter::sceneForName(): no file opened\n" "Trade::AbstractImporter::objectForName(): no file opened\n" "Trade::AbstractImporter::animationForName(): no file opened\n" @@ -1657,7 +1656,7 @@ void AbstractImporterTest::thingByNameNotFound() { UnsignedInt doImage3DCount() const override { return 12; } } importer; - std::ostringstream out; + Containers::String out; { Containers::Optional redirectError; if(data.checkMessage) redirectError.emplace(&out); @@ -1680,7 +1679,7 @@ void AbstractImporterTest::thingByNameNotFound() { } if(data.checkMessage) { - CORRADE_COMPARE(out.str(), + CORRADE_COMPARE(out, "Trade::AbstractImporter::scene(): scene foobar not found among 1 entries\n" "Trade::AbstractImporter::animation(): animation foobar not found among 2 entries\n" "Trade::AbstractImporter::light(): light foobar not found among 3 entries\n" @@ -1708,7 +1707,7 @@ void AbstractImporterTest::thingNameNoFile() { void doClose() override {} } importer; - std::ostringstream out; + Containers::String out; Error redirectError{&out}; importer.sceneName(42); @@ -1727,7 +1726,7 @@ void AbstractImporterTest::thingNameNoFile() { importer.image2DName(42); importer.image3DName(42); - CORRADE_COMPARE(out.str(), + CORRADE_COMPARE(out, "Trade::AbstractImporter::sceneName(): no file opened\n" "Trade::AbstractImporter::animationName(): no file opened\n" "Trade::AbstractImporter::lightName(): no file opened\n" @@ -1754,7 +1753,7 @@ void AbstractImporterTest::thingNoFile() { void doClose() override {} } importer; - std::ostringstream out; + Containers::String out; Error redirectError{&out}; importer.defaultScene(); @@ -1788,7 +1787,7 @@ void AbstractImporterTest::thingNoFile() { importer.importerState(); - CORRADE_COMPARE(out.str(), + CORRADE_COMPARE(out, "Trade::AbstractImporter::defaultScene(): no file opened\n" "Trade::AbstractImporter::scene(): no file opened\n" "Trade::AbstractImporter::scene(): no file opened\n" @@ -1856,10 +1855,10 @@ void AbstractImporterTest::defaultSceneOutOfRange() { Int doDefaultScene() const override { return 8; } } importer; - std::ostringstream out; + Containers::String out; Error redirectError{&out}; importer.defaultScene(); - CORRADE_COMPARE(out.str(), "Trade::AbstractImporter::defaultScene(): implementation-returned index 8 out of range for 8 entries\n"); + CORRADE_COMPARE(out, "Trade::AbstractImporter::defaultScene(): implementation-returned index 8 out of range for 8 entries\n"); } int state; @@ -1914,10 +1913,10 @@ void AbstractImporterTest::sceneFailed() { } importer; /* The implementation is expected to print an error message on its own */ - std::ostringstream out; + Containers::String out; Error redirectError{&out}; CORRADE_VERIFY(!importer.scene(0)); - CORRADE_COMPARE(out.str(), ""); + CORRADE_COMPARE(out, ""); } void AbstractImporterTest::object() { @@ -1954,10 +1953,10 @@ void AbstractImporterTest::sceneForNameOutOfRange() { Int doSceneForName(Containers::StringView) override { return 8; } } importer; - std::ostringstream out; + Containers::String out; Error redirectError{&out}; importer.sceneForName(""); - CORRADE_COMPARE(out.str(), "Trade::AbstractImporter::sceneForName(): implementation-returned index 8 out of range for 8 entries\n"); + CORRADE_COMPARE(out, "Trade::AbstractImporter::sceneForName(): implementation-returned index 8 out of range for 8 entries\n"); } void AbstractImporterTest::objectForNameOutOfRange() { @@ -1972,10 +1971,10 @@ void AbstractImporterTest::objectForNameOutOfRange() { Long doObjectForName(Containers::StringView) override { return 8; } } importer; - std::ostringstream out; + Containers::String out; Error redirectError{&out}; importer.objectForName(""); - CORRADE_COMPARE(out.str(), "Trade::AbstractImporter::objectForName(): implementation-returned index 8 out of range for 8 entries\n"); + CORRADE_COMPARE(out, "Trade::AbstractImporter::objectForName(): implementation-returned index 8 out of range for 8 entries\n"); } #ifdef MAGNUM_BUILD_DEPRECATED @@ -2239,10 +2238,10 @@ void AbstractImporterTest::sceneDeprecatedFallback2D() { } { /* This one is not contained in any parent hierarchy, so it fails to import */ - std::ostringstream out; + Containers::String out; Error redirectError{&out}; CORRADE_VERIFY(!importer.object2D(6)); - CORRADE_COMPARE(out.str(), "Trade::AbstractImporter::object2D(): object 6 not found in any 2D scene hierarchy\n"); + CORRADE_COMPARE(out, "Trade::AbstractImporter::object2D(): object 6 not found in any 2D scene hierarchy\n"); } CORRADE_IGNORE_DEPRECATED_POP } @@ -2514,10 +2513,10 @@ void AbstractImporterTest::sceneDeprecatedFallback3D() { } { /* This one is not contained in any parent hierarchy, so it fails to import */ - std::ostringstream out; + Containers::String out; Error redirectError{&out}; CORRADE_VERIFY(!importer.object3D(6)); - CORRADE_COMPARE(out.str(), "Trade::AbstractImporter::object3D(): object 6 not found in any 3D scene hierarchy\n"); + CORRADE_COMPARE(out, "Trade::AbstractImporter::object3D(): object 6 not found in any 3D scene hierarchy\n"); } CORRADE_IGNORE_DEPRECATED_POP } @@ -2578,7 +2577,7 @@ void AbstractImporterTest::sceneDeprecatedFallbackParentless2D() { TestSuite::Compare::Container); CORRADE_IGNORE_DEPRECATED_POP - std::ostringstream out; + Containers::String out; Error redirectError{&out}; CORRADE_IGNORE_DEPRECATED_PUSH CORRADE_VERIFY(!importer.object2D(0)); @@ -2588,7 +2587,7 @@ void AbstractImporterTest::sceneDeprecatedFallbackParentless2D() { CORRADE_VERIFY(!importer.object2D(4)); CORRADE_VERIFY(!importer.object2D(5)); CORRADE_IGNORE_DEPRECATED_POP - CORRADE_COMPARE(out.str(), + CORRADE_COMPARE(out, "Trade::AbstractImporter::object2D(): object 0 not found in any 2D scene hierarchy\n" "Trade::AbstractImporter::object2D(): object 1 not found in any 2D scene hierarchy\n" "Trade::AbstractImporter::object2D(): object 2 not found in any 2D scene hierarchy\n" @@ -2653,7 +2652,7 @@ void AbstractImporterTest::sceneDeprecatedFallbackParentless3D() { TestSuite::Compare::Container); CORRADE_IGNORE_DEPRECATED_POP - std::ostringstream out; + Containers::String out; Error redirectError{&out}; CORRADE_IGNORE_DEPRECATED_PUSH CORRADE_VERIFY(!importer.object3D(0)); @@ -2663,7 +2662,7 @@ void AbstractImporterTest::sceneDeprecatedFallbackParentless3D() { CORRADE_VERIFY(!importer.object3D(4)); CORRADE_VERIFY(!importer.object3D(5)); CORRADE_IGNORE_DEPRECATED_POP - CORRADE_COMPARE(out.str(), + CORRADE_COMPARE(out, "Trade::AbstractImporter::object3D(): object 0 not found in any 3D scene hierarchy\n" "Trade::AbstractImporter::object3D(): object 1 not found in any 3D scene hierarchy\n" "Trade::AbstractImporter::object3D(): object 2 not found in any 3D scene hierarchy\n" @@ -3578,11 +3577,11 @@ void AbstractImporterTest::sceneNameOutOfRange() { UnsignedInt doSceneCount() const override { return 8; } } importer; - std::ostringstream out; + Containers::String out; Error redirectError{&out}; importer.sceneName(8); - CORRADE_COMPARE(out.str(), "Trade::AbstractImporter::sceneName(): index 8 out of range for 8 entries\n"); + CORRADE_COMPARE(out, "Trade::AbstractImporter::sceneName(): index 8 out of range for 8 entries\n"); } void AbstractImporterTest::objectNameOutOfRange() { @@ -3596,11 +3595,11 @@ void AbstractImporterTest::objectNameOutOfRange() { UnsignedLong doObjectCount() const override { return 8; } } importer; - std::ostringstream out; + Containers::String out; Error redirectError{&out}; importer.objectName(8); - CORRADE_COMPARE(out.str(), "Trade::AbstractImporter::objectName(): index 8 out of range for 8 entries\n"); + CORRADE_COMPARE(out, "Trade::AbstractImporter::objectName(): index 8 out of range for 8 entries\n"); } void AbstractImporterTest::sceneNameCustomDeleter() { @@ -3617,10 +3616,10 @@ void AbstractImporterTest::sceneNameCustomDeleter() { } } importer; - std::ostringstream out; + Containers::String out; Error redirectError{&out}; importer.sceneName(0); - CORRADE_COMPARE(out.str(), "Trade::AbstractImporter::sceneName(): implementation is not allowed to use a custom String deleter\n"); + CORRADE_COMPARE(out, "Trade::AbstractImporter::sceneName(): implementation is not allowed to use a custom String deleter\n"); } void AbstractImporterTest::objectNameCustomDeleter() { @@ -3637,10 +3636,10 @@ void AbstractImporterTest::objectNameCustomDeleter() { } } importer; - std::ostringstream out; + Containers::String out; Error redirectError{&out}; importer.objectName(0); - CORRADE_COMPARE(out.str(), "Trade::AbstractImporter::objectName(): implementation is not allowed to use a custom String deleter\n"); + CORRADE_COMPARE(out, "Trade::AbstractImporter::objectName(): implementation is not allowed to use a custom String deleter\n"); } void AbstractImporterTest::sceneNotImplemented() { @@ -3654,11 +3653,11 @@ void AbstractImporterTest::sceneNotImplemented() { UnsignedInt doSceneCount() const override { return 8; } } importer; - std::ostringstream out; + Containers::String out; Error redirectError{&out}; importer.scene(7); - CORRADE_COMPARE(out.str(), "Trade::AbstractImporter::scene(): not implemented\n"); + CORRADE_COMPARE(out, "Trade::AbstractImporter::scene(): not implemented\n"); } void AbstractImporterTest::sceneOutOfRange() { @@ -3672,11 +3671,11 @@ void AbstractImporterTest::sceneOutOfRange() { UnsignedInt doSceneCount() const override { return 8; } } importer; - std::ostringstream out; + Containers::String out; Error redirectError{&out}; importer.scene(8); - CORRADE_COMPARE(out.str(), "Trade::AbstractImporter::scene(): index 8 out of range for 8 entries\n"); + CORRADE_COMPARE(out, "Trade::AbstractImporter::scene(): index 8 out of range for 8 entries\n"); } void AbstractImporterTest::sceneNonOwningDeleters() { @@ -3723,12 +3722,12 @@ void AbstractImporterTest::sceneCustomDataDeleter() { char data[1]; } importer; - std::ostringstream out; + Containers::String out; Error redirectError{&out}; importer.scene(0); importer.scene(""); - CORRADE_COMPARE(out.str(), + CORRADE_COMPARE(out, "Trade::AbstractImporter::scene(): implementation is not allowed to use a custom Array deleter\n" "Trade::AbstractImporter::scene(): implementation is not allowed to use a custom Array deleter\n"); } @@ -3750,12 +3749,12 @@ void AbstractImporterTest::sceneCustomFieldDataDeleter() { SceneFieldData parents{SceneField::Parent, SceneMappingType::UnsignedInt, nullptr, SceneFieldType::Int, nullptr}; } importer; - std::ostringstream out; + Containers::String out; Error redirectError{&out}; importer.scene(0); importer.scene(""); - CORRADE_COMPARE(out.str(), + CORRADE_COMPARE(out, "Trade::AbstractImporter::scene(): implementation is not allowed to use a custom Array deleter\n" "Trade::AbstractImporter::scene(): implementation is not allowed to use a custom Array deleter\n" ); @@ -3806,11 +3805,11 @@ void AbstractImporterTest::sceneFieldNameNotCustom() { } } importer; - std::ostringstream out; + Containers::String out; Error redirectError{&out}; importer.sceneFieldForName("OctreeCell"); importer.sceneFieldName(SceneField::Translation); - CORRADE_COMPARE(out.str(), + CORRADE_COMPARE(out, "Trade::AbstractImporter::sceneFieldForName(): implementation-returned Trade::SceneField::Translation is neither custom nor invalid\n" "Trade::AbstractImporter::sceneFieldName(): Trade::SceneField::Translation is not custom\n"); } @@ -3828,10 +3827,10 @@ void AbstractImporterTest::sceneFieldNameCustomDeleter() { } } importer; - std::ostringstream out; + Containers::String out; Error redirectError{&out}; importer.sceneFieldName(sceneFieldCustom(0)); - CORRADE_COMPARE(out.str(), "Trade::AbstractImporter::sceneFieldName(): implementation is not allowed to use a custom String deleter\n"); + CORRADE_COMPARE(out, "Trade::AbstractImporter::sceneFieldName(): implementation is not allowed to use a custom String deleter\n"); } void AbstractImporterTest::animation() { @@ -3887,10 +3886,10 @@ void AbstractImporterTest::animationFailed() { } importer; /* The implementation is expected to print an error message on its own */ - std::ostringstream out; + Containers::String out; Error redirectError{&out}; CORRADE_VERIFY(!importer.animation(0)); - CORRADE_COMPARE(out.str(), ""); + CORRADE_COMPARE(out, ""); } void AbstractImporterTest::animationForNameOutOfRange() { @@ -3905,10 +3904,10 @@ void AbstractImporterTest::animationForNameOutOfRange() { Int doAnimationForName(Containers::StringView) override { return 8; } } importer; - std::ostringstream out; + Containers::String out; Error redirectError{&out}; importer.animationForName(""); - CORRADE_COMPARE(out.str(), "Trade::AbstractImporter::animationForName(): implementation-returned index 8 out of range for 8 entries\n"); + CORRADE_COMPARE(out, "Trade::AbstractImporter::animationForName(): implementation-returned index 8 out of range for 8 entries\n"); } void AbstractImporterTest::animationNameNotImplemented() { @@ -3934,11 +3933,11 @@ void AbstractImporterTest::animationNameOutOfRange() { UnsignedInt doAnimationCount() const override { return 8; } } importer; - std::ostringstream out; + Containers::String out; Error redirectError{&out}; importer.animationName(8); - CORRADE_COMPARE(out.str(), "Trade::AbstractImporter::animationName(): index 8 out of range for 8 entries\n"); + CORRADE_COMPARE(out, "Trade::AbstractImporter::animationName(): index 8 out of range for 8 entries\n"); } void AbstractImporterTest::animationNameCustomDeleter() { @@ -3955,10 +3954,10 @@ void AbstractImporterTest::animationNameCustomDeleter() { } } importer; - std::ostringstream out; + Containers::String out; Error redirectError{&out}; importer.animationName(0); - CORRADE_COMPARE(out.str(), "Trade::AbstractImporter::animationName(): implementation is not allowed to use a custom String deleter\n"); + CORRADE_COMPARE(out, "Trade::AbstractImporter::animationName(): implementation is not allowed to use a custom String deleter\n"); } void AbstractImporterTest::animationNotImplemented() { @@ -3972,11 +3971,11 @@ void AbstractImporterTest::animationNotImplemented() { UnsignedInt doAnimationCount() const override { return 8; } } importer; - std::ostringstream out; + Containers::String out; Error redirectError{&out}; importer.animation(7); - CORRADE_COMPARE(out.str(), "Trade::AbstractImporter::animation(): not implemented\n"); + CORRADE_COMPARE(out, "Trade::AbstractImporter::animation(): not implemented\n"); } void AbstractImporterTest::animationOutOfRange() { @@ -3990,11 +3989,11 @@ void AbstractImporterTest::animationOutOfRange() { UnsignedInt doAnimationCount() const override { return 8; } } importer; - std::ostringstream out; + Containers::String out; Error redirectError{&out}; importer.animation(8); - CORRADE_COMPARE(out.str(), "Trade::AbstractImporter::animation(): index 8 out of range for 8 entries\n"); + CORRADE_COMPARE(out, "Trade::AbstractImporter::animation(): index 8 out of range for 8 entries\n"); } void AbstractImporterTest::animationNonOwningDeleters() { @@ -4053,12 +4052,12 @@ void AbstractImporterTest::animationCustomDataDeleter() { } } importer; - std::ostringstream out; + Containers::String out; Error redirectError{&out}; importer.animation(0); importer.animation(""); - CORRADE_COMPARE(out.str(), + CORRADE_COMPARE(out, "Trade::AbstractImporter::animation(): implementation is not allowed to use a custom Array deleter\n" "Trade::AbstractImporter::animation(): implementation is not allowed to use a custom Array deleter\n"); } @@ -4078,12 +4077,12 @@ void AbstractImporterTest::animationCustomTrackDeleter() { } } importer; - std::ostringstream out; + Containers::String out; Error redirectError{&out}; importer.animation(0); importer.animation(""); - CORRADE_COMPARE(out.str(), + CORRADE_COMPARE(out, "Trade::AbstractImporter::animation(): implementation is not allowed to use a custom Array deleter\n" "Trade::AbstractImporter::animation(): implementation is not allowed to use a custom Array deleter\n"); } @@ -4133,11 +4132,11 @@ void AbstractImporterTest::animationTrackTargetNameNotCustom() { } } importer; - std::ostringstream out; + Containers::String out; Error redirectError{&out}; importer.animationTrackTargetForName("visibility"); importer.animationTrackTargetName(AnimationTrackTarget::Rotation2D); - CORRADE_COMPARE(out.str(), + CORRADE_COMPARE(out, "Trade::AbstractImporter::animationTrackTargetForName(): implementation-returned Trade::AnimationTrackTarget::Rotation2D is neither custom nor invalid\n" "Trade::AbstractImporter::animationTrackTargetName(): Trade::AnimationTrackTarget::Rotation2D is not custom\n"); } @@ -4155,10 +4154,10 @@ void AbstractImporterTest::animationTrackTargetNameCustomDeleter() { } } importer; - std::ostringstream out; + Containers::String out; Error redirectError{&out}; importer.animationTrackTargetName(animationTrackTargetCustom(0)); - CORRADE_COMPARE(out.str(), "Trade::AbstractImporter::animationTrackTargetName(): implementation is not allowed to use a custom String deleter\n"); + CORRADE_COMPARE(out, "Trade::AbstractImporter::animationTrackTargetName(): implementation is not allowed to use a custom String deleter\n"); } void AbstractImporterTest::light() { @@ -4210,10 +4209,10 @@ void AbstractImporterTest::lightFailed() { } importer; /* The implementation is expected to print an error message on its own */ - std::ostringstream out; + Containers::String out; Error redirectError{&out}; CORRADE_VERIFY(!importer.light(0)); - CORRADE_COMPARE(out.str(), ""); + CORRADE_COMPARE(out, ""); } void AbstractImporterTest::lightForNameOutOfRange() { @@ -4228,10 +4227,10 @@ void AbstractImporterTest::lightForNameOutOfRange() { Int doLightForName(Containers::StringView) override { return 8; } } importer; - std::ostringstream out; + Containers::String out; Error redirectError{&out}; importer.lightForName(""); - CORRADE_COMPARE(out.str(), "Trade::AbstractImporter::lightForName(): implementation-returned index 8 out of range for 8 entries\n"); + CORRADE_COMPARE(out, "Trade::AbstractImporter::lightForName(): implementation-returned index 8 out of range for 8 entries\n"); } void AbstractImporterTest::lightNameNotImplemented() { @@ -4257,11 +4256,11 @@ void AbstractImporterTest::lightNameOutOfRange() { UnsignedInt doLightCount() const override { return 8; } } importer; - std::ostringstream out; + Containers::String out; Error redirectError{&out}; importer.lightName(8); - CORRADE_COMPARE(out.str(), "Trade::AbstractImporter::lightName(): index 8 out of range for 8 entries\n"); + CORRADE_COMPARE(out, "Trade::AbstractImporter::lightName(): index 8 out of range for 8 entries\n"); } void AbstractImporterTest::lightNameCustomDeleter() { @@ -4278,10 +4277,10 @@ void AbstractImporterTest::lightNameCustomDeleter() { } } importer; - std::ostringstream out; + Containers::String out; Error redirectError{&out}; importer.lightName(0); - CORRADE_COMPARE(out.str(), "Trade::AbstractImporter::lightName(): implementation is not allowed to use a custom String deleter\n"); + CORRADE_COMPARE(out, "Trade::AbstractImporter::lightName(): implementation is not allowed to use a custom String deleter\n"); } void AbstractImporterTest::lightNotImplemented() { @@ -4295,11 +4294,11 @@ void AbstractImporterTest::lightNotImplemented() { UnsignedInt doLightCount() const override { return 8; } } importer; - std::ostringstream out; + Containers::String out; Error redirectError{&out}; importer.light(7); - CORRADE_COMPARE(out.str(), "Trade::AbstractImporter::light(): not implemented\n"); + CORRADE_COMPARE(out, "Trade::AbstractImporter::light(): not implemented\n"); } void AbstractImporterTest::lightOutOfRange() { @@ -4313,11 +4312,11 @@ void AbstractImporterTest::lightOutOfRange() { UnsignedInt doLightCount() const override { return 8; } } importer; - std::ostringstream out; + Containers::String out; Error redirectError{&out}; importer.light(8); - CORRADE_COMPARE(out.str(), "Trade::AbstractImporter::light(): index 8 out of range for 8 entries\n"); + CORRADE_COMPARE(out, "Trade::AbstractImporter::light(): index 8 out of range for 8 entries\n"); } void AbstractImporterTest::camera() { @@ -4369,10 +4368,10 @@ void AbstractImporterTest::cameraFailed() { } importer; /* The implementation is expected to print an error message on its own */ - std::ostringstream out; + Containers::String out; Error redirectError{&out}; CORRADE_VERIFY(!importer.camera(0)); - CORRADE_COMPARE(out.str(), ""); + CORRADE_COMPARE(out, ""); } void AbstractImporterTest::cameraForNameOutOfRange() { @@ -4387,10 +4386,10 @@ void AbstractImporterTest::cameraForNameOutOfRange() { Int doCameraForName(Containers::StringView) override { return 8; } } importer; - std::ostringstream out; + Containers::String out; Error redirectError{&out}; importer.cameraForName(""); - CORRADE_COMPARE(out.str(), "Trade::AbstractImporter::cameraForName(): implementation-returned index 8 out of range for 8 entries\n"); + CORRADE_COMPARE(out, "Trade::AbstractImporter::cameraForName(): implementation-returned index 8 out of range for 8 entries\n"); } void AbstractImporterTest::cameraNameNotImplemented() { @@ -4416,11 +4415,11 @@ void AbstractImporterTest::cameraNameOutOfRange() { UnsignedInt doCameraCount() const override { return 8; } } importer; - std::ostringstream out; + Containers::String out; Error redirectError{&out}; importer.cameraName(8); - CORRADE_COMPARE(out.str(), "Trade::AbstractImporter::cameraName(): index 8 out of range for 8 entries\n"); + CORRADE_COMPARE(out, "Trade::AbstractImporter::cameraName(): index 8 out of range for 8 entries\n"); } void AbstractImporterTest::cameraNameCustomDeleter() { @@ -4437,10 +4436,10 @@ void AbstractImporterTest::cameraNameCustomDeleter() { } } importer; - std::ostringstream out; + Containers::String out; Error redirectError{&out}; importer.cameraName(0); - CORRADE_COMPARE(out.str(), "Trade::AbstractImporter::cameraName(): implementation is not allowed to use a custom String deleter\n"); + CORRADE_COMPARE(out, "Trade::AbstractImporter::cameraName(): implementation is not allowed to use a custom String deleter\n"); } void AbstractImporterTest::cameraNotImplemented() { @@ -4454,11 +4453,11 @@ void AbstractImporterTest::cameraNotImplemented() { UnsignedInt doCameraCount() const override { return 8; } } importer; - std::ostringstream out; + Containers::String out; Error redirectError{&out}; importer.camera(7); - CORRADE_COMPARE(out.str(), "Trade::AbstractImporter::camera(): not implemented\n"); + CORRADE_COMPARE(out, "Trade::AbstractImporter::camera(): not implemented\n"); } void AbstractImporterTest::cameraOutOfRange() { @@ -4472,11 +4471,11 @@ void AbstractImporterTest::cameraOutOfRange() { UnsignedInt doCameraCount() const override { return 8; } } importer; - std::ostringstream out; + Containers::String out; Error redirectError{&out}; importer.camera(8); - CORRADE_COMPARE(out.str(), "Trade::AbstractImporter::camera(): index 8 out of range for 8 entries\n"); + CORRADE_COMPARE(out, "Trade::AbstractImporter::camera(): index 8 out of range for 8 entries\n"); } #ifdef MAGNUM_BUILD_DEPRECATED @@ -4541,13 +4540,13 @@ void AbstractImporterTest::object2DCountNoFile() { void doClose() override {} } importer; - std::ostringstream out; + Containers::String out; Error redirectError{&out}; CORRADE_IGNORE_DEPRECATED_PUSH importer.object2DCount(); CORRADE_IGNORE_DEPRECATED_POP - CORRADE_COMPARE(out.str(), "Trade::AbstractImporter::object2DCount(): no file opened\n"); + CORRADE_COMPARE(out, "Trade::AbstractImporter::object2DCount(): no file opened\n"); } void AbstractImporterTest::object2DForNameNotImplemented() { @@ -4571,13 +4570,13 @@ void AbstractImporterTest::object2DForNameNoFile() { void doClose() override {} } importer; - std::ostringstream out; + Containers::String out; Error redirectError{&out}; CORRADE_IGNORE_DEPRECATED_PUSH importer.object2DForName(""); CORRADE_IGNORE_DEPRECATED_POP - CORRADE_COMPARE(out.str(), "Trade::AbstractImporter::object2DForName(): no file opened\n"); + CORRADE_COMPARE(out, "Trade::AbstractImporter::object2DForName(): no file opened\n"); } void AbstractImporterTest::object2DByNameNotFound() { @@ -4592,7 +4591,7 @@ void AbstractImporterTest::object2DByNameNotFound() { UnsignedInt doObject2DCount() const override { return 5; } } importer; - std::ostringstream out; + Containers::String out; { Containers::Optional redirectError; if(data.checkMessage) redirectError.emplace(&out); @@ -4602,7 +4601,7 @@ void AbstractImporterTest::object2DByNameNotFound() { CORRADE_IGNORE_DEPRECATED_POP } - if(data.checkMessage) CORRADE_COMPARE(out.str(), + if(data.checkMessage) CORRADE_COMPARE(out, "Trade::AbstractImporter::object2D(): object foobar not found among 5 entries\n"); } @@ -4618,12 +4617,12 @@ void AbstractImporterTest::object2DForNameOutOfRange() { Int doObject2DForName(const std::string&) override { return 8; } } importer; - std::ostringstream out; + Containers::String out; Error redirectError{&out}; CORRADE_IGNORE_DEPRECATED_PUSH importer.object2DForName(""); CORRADE_IGNORE_DEPRECATED_POP - CORRADE_COMPARE(out.str(), "Trade::AbstractImporter::object2DForName(): implementation-returned index 8 out of range for 8 entries\n"); + CORRADE_COMPARE(out, "Trade::AbstractImporter::object2DForName(): implementation-returned index 8 out of range for 8 entries\n"); } void AbstractImporterTest::object2DNameNotImplemented() { @@ -4649,13 +4648,13 @@ void AbstractImporterTest::object2DNameNoFile() { void doClose() override {} } importer; - std::ostringstream out; + Containers::String out; Error redirectError{&out}; CORRADE_IGNORE_DEPRECATED_PUSH importer.object2DName(42); CORRADE_IGNORE_DEPRECATED_POP - CORRADE_COMPARE(out.str(), "Trade::AbstractImporter::object2DName(): no file opened\n"); + CORRADE_COMPARE(out, "Trade::AbstractImporter::object2DName(): no file opened\n"); } void AbstractImporterTest::object2DNameOutOfRange() { @@ -4669,13 +4668,13 @@ void AbstractImporterTest::object2DNameOutOfRange() { UnsignedInt doObject2DCount() const override { return 8; } } importer; - std::ostringstream out; + Containers::String out; Error redirectError{&out}; CORRADE_IGNORE_DEPRECATED_PUSH importer.object2DName(8); CORRADE_IGNORE_DEPRECATED_POP - CORRADE_COMPARE(out.str(), "Trade::AbstractImporter::object2DName(): index 8 out of range for 8 entries\n"); + CORRADE_COMPARE(out, "Trade::AbstractImporter::object2DName(): index 8 out of range for 8 entries\n"); } void AbstractImporterTest::object2DNotImplemented() { @@ -4690,7 +4689,7 @@ void AbstractImporterTest::object2DNotImplemented() { UnsignedInt doObject2DCount() const override { return 8; } } importer; - std::ostringstream out; + Containers::String out; Error redirectError{&out}; CORRADE_IGNORE_DEPRECATED_PUSH @@ -4698,7 +4697,7 @@ void AbstractImporterTest::object2DNotImplemented() { CORRADE_IGNORE_DEPRECATED_POP /* It delegates to scene(), but since the assert is graceful and returns a null optional, it errors out immediately after */ - CORRADE_COMPARE(out.str(), + CORRADE_COMPARE(out, "Trade::AbstractImporter::scene(): not implemented\n" "Trade::AbstractImporter::object2D(): object 7 not found in any 2D scene hierarchy\n"); } @@ -4712,14 +4711,14 @@ void AbstractImporterTest::object2DNoFile() { void doClose() override {} } importer; - std::ostringstream out; + Containers::String out; Error redirectError{&out}; CORRADE_IGNORE_DEPRECATED_PUSH importer.object2D(42); importer.object2D("foo"); CORRADE_IGNORE_DEPRECATED_POP - CORRADE_COMPARE(out.str(), + CORRADE_COMPARE(out, "Trade::AbstractImporter::object2D(): no file opened\n" "Trade::AbstractImporter::object2D(): no file opened\n"); } @@ -4735,13 +4734,13 @@ void AbstractImporterTest::object2DOutOfRange() { UnsignedInt doObject2DCount() const override { return 8; } } importer; - std::ostringstream out; + Containers::String out; Error redirectError{&out}; CORRADE_IGNORE_DEPRECATED_PUSH importer.object2D(8); CORRADE_IGNORE_DEPRECATED_POP - CORRADE_COMPARE(out.str(), "Trade::AbstractImporter::object2D(): index 8 out of range for 8 entries\n"); + CORRADE_COMPARE(out, "Trade::AbstractImporter::object2D(): index 8 out of range for 8 entries\n"); } void AbstractImporterTest::object3D() { @@ -4805,13 +4804,13 @@ void AbstractImporterTest::object3DCountNoFile() { void doClose() override {} } importer; - std::ostringstream out; + Containers::String out; Error redirectError{&out}; CORRADE_IGNORE_DEPRECATED_PUSH importer.object3DCount(); CORRADE_IGNORE_DEPRECATED_POP - CORRADE_COMPARE(out.str(), "Trade::AbstractImporter::object3DCount(): no file opened\n"); + CORRADE_COMPARE(out, "Trade::AbstractImporter::object3DCount(): no file opened\n"); } void AbstractImporterTest::object3DForNameNotImplemented() { @@ -4835,13 +4834,13 @@ void AbstractImporterTest::object3DForNameNoFile() { void doClose() override {} } importer; - std::ostringstream out; + Containers::String out; Error redirectError{&out}; CORRADE_IGNORE_DEPRECATED_PUSH importer.object2DForName(""); CORRADE_IGNORE_DEPRECATED_POP - CORRADE_COMPARE(out.str(), "Trade::AbstractImporter::object2DForName(): no file opened\n"); + CORRADE_COMPARE(out, "Trade::AbstractImporter::object2DForName(): no file opened\n"); } void AbstractImporterTest::object3DByNameNotFound() { @@ -4856,7 +4855,7 @@ void AbstractImporterTest::object3DByNameNotFound() { UnsignedInt doObject3DCount() const override { return 6; } } importer; - std::ostringstream out; + Containers::String out; { Containers::Optional redirectError; if(data.checkMessage) redirectError.emplace(&out); @@ -4866,7 +4865,7 @@ void AbstractImporterTest::object3DByNameNotFound() { CORRADE_IGNORE_DEPRECATED_POP } - if(data.checkMessage) CORRADE_COMPARE(out.str(), + if(data.checkMessage) CORRADE_COMPARE(out, "Trade::AbstractImporter::object3D(): object foobar not found among 6 entries\n"); } @@ -4882,12 +4881,12 @@ void AbstractImporterTest::object3DForNameOutOfRange() { Int doObject3DForName(const std::string&) override { return 8; } } importer; - std::ostringstream out; + Containers::String out; Error redirectError{&out}; CORRADE_IGNORE_DEPRECATED_PUSH importer.object3DForName(""); CORRADE_IGNORE_DEPRECATED_POP - CORRADE_COMPARE(out.str(), "Trade::AbstractImporter::object3DForName(): implementation-returned index 8 out of range for 8 entries\n"); + CORRADE_COMPARE(out, "Trade::AbstractImporter::object3DForName(): implementation-returned index 8 out of range for 8 entries\n"); } void AbstractImporterTest::object3DNameNotImplemented() { @@ -4913,13 +4912,13 @@ void AbstractImporterTest::object3DNameNoFile() { void doClose() override {} } importer; - std::ostringstream out; + Containers::String out; Error redirectError{&out}; CORRADE_IGNORE_DEPRECATED_PUSH importer.object3DName(42); CORRADE_IGNORE_DEPRECATED_POP - CORRADE_COMPARE(out.str(), "Trade::AbstractImporter::object3DName(): no file opened\n"); + CORRADE_COMPARE(out, "Trade::AbstractImporter::object3DName(): no file opened\n"); } void AbstractImporterTest::object3DNameOutOfRange() { @@ -4933,13 +4932,13 @@ void AbstractImporterTest::object3DNameOutOfRange() { UnsignedInt doObject3DCount() const override { return 8; } } importer; - std::ostringstream out; + Containers::String out; Error redirectError{&out}; CORRADE_IGNORE_DEPRECATED_PUSH importer.object3DName(8); CORRADE_IGNORE_DEPRECATED_POP - CORRADE_COMPARE(out.str(), "Trade::AbstractImporter::object3DName(): index 8 out of range for 8 entries\n"); + CORRADE_COMPARE(out, "Trade::AbstractImporter::object3DName(): index 8 out of range for 8 entries\n"); } void AbstractImporterTest::object3DNotImplemented() { @@ -4954,7 +4953,7 @@ void AbstractImporterTest::object3DNotImplemented() { UnsignedInt doObject3DCount() const override { return 8; } } importer; - std::ostringstream out; + Containers::String out; Error redirectError{&out}; CORRADE_IGNORE_DEPRECATED_PUSH @@ -4962,7 +4961,7 @@ void AbstractImporterTest::object3DNotImplemented() { CORRADE_IGNORE_DEPRECATED_POP /* It delegates to scene(), but since the assert is graceful and returns a null optional, it errors out immediately after */ - CORRADE_COMPARE(out.str(), + CORRADE_COMPARE(out, "Trade::AbstractImporter::scene(): not implemented\n" "Trade::AbstractImporter::object3D(): object 7 not found in any 3D scene hierarchy\n"); } @@ -4976,14 +4975,14 @@ void AbstractImporterTest::object3DNoFile() { void doClose() override {} } importer; - std::ostringstream out; + Containers::String out; Error redirectError{&out}; CORRADE_IGNORE_DEPRECATED_PUSH importer.object3D(42); importer.object3D("foo"); CORRADE_IGNORE_DEPRECATED_POP - CORRADE_COMPARE(out.str(), + CORRADE_COMPARE(out, "Trade::AbstractImporter::object3D(): no file opened\n" "Trade::AbstractImporter::object3D(): no file opened\n"); } @@ -4999,13 +4998,13 @@ void AbstractImporterTest::object3DOutOfRange() { UnsignedInt doObject3DCount() const override { return 8; } } importer; - std::ostringstream out; + Containers::String out; Error redirectError{&out}; CORRADE_IGNORE_DEPRECATED_PUSH importer.object3D(8); CORRADE_IGNORE_DEPRECATED_POP - CORRADE_COMPARE(out.str(), "Trade::AbstractImporter::object3D(): index 8 out of range for 8 entries\n"); + CORRADE_COMPARE(out, "Trade::AbstractImporter::object3D(): index 8 out of range for 8 entries\n"); } #endif @@ -5060,10 +5059,10 @@ void AbstractImporterTest::skin2DFailed() { } importer; /* The implementation is expected to print an error message on its own */ - std::ostringstream out; + Containers::String out; Error redirectError{&out}; CORRADE_VERIFY(!importer.skin2D(0)); - CORRADE_COMPARE(out.str(), ""); + CORRADE_COMPARE(out, ""); } void AbstractImporterTest::skin2DForNameOutOfRange() { @@ -5078,10 +5077,10 @@ void AbstractImporterTest::skin2DForNameOutOfRange() { Int doSkin2DForName(Containers::StringView) override { return 8; } } importer; - std::ostringstream out; + Containers::String out; Error redirectError{&out}; importer.skin2DForName(""); - CORRADE_COMPARE(out.str(), "Trade::AbstractImporter::skin2DForName(): implementation-returned index 8 out of range for 8 entries\n"); + CORRADE_COMPARE(out, "Trade::AbstractImporter::skin2DForName(): implementation-returned index 8 out of range for 8 entries\n"); } void AbstractImporterTest::skin2DNameNotImplemented() { @@ -5107,11 +5106,11 @@ void AbstractImporterTest::skin2DNameOutOfRange() { UnsignedInt doSkin2DCount() const override { return 8; } } importer; - std::ostringstream out; + Containers::String out; Error redirectError{&out}; importer.skin2DName(8); - CORRADE_COMPARE(out.str(), "Trade::AbstractImporter::skin2DName(): index 8 out of range for 8 entries\n"); + CORRADE_COMPARE(out, "Trade::AbstractImporter::skin2DName(): index 8 out of range for 8 entries\n"); } void AbstractImporterTest::skin2DNameCustomDeleter() { @@ -5128,10 +5127,10 @@ void AbstractImporterTest::skin2DNameCustomDeleter() { } } importer; - std::ostringstream out; + Containers::String out; Error redirectError{&out}; importer.skin2DName(0); - CORRADE_COMPARE(out.str(), "Trade::AbstractImporter::skin2DName(): implementation is not allowed to use a custom String deleter\n"); + CORRADE_COMPARE(out, "Trade::AbstractImporter::skin2DName(): implementation is not allowed to use a custom String deleter\n"); } void AbstractImporterTest::skin2DNotImplemented() { @@ -5145,11 +5144,11 @@ void AbstractImporterTest::skin2DNotImplemented() { UnsignedInt doSkin2DCount() const override { return 8; } } importer; - std::ostringstream out; + Containers::String out; Error redirectError{&out}; importer.skin2D(7); - CORRADE_COMPARE(out.str(), "Trade::AbstractImporter::skin2D(): not implemented\n"); + CORRADE_COMPARE(out, "Trade::AbstractImporter::skin2D(): not implemented\n"); } void AbstractImporterTest::skin2DOutOfRange() { @@ -5163,11 +5162,11 @@ void AbstractImporterTest::skin2DOutOfRange() { UnsignedInt doSkin2DCount() const override { return 8; } } importer; - std::ostringstream out; + Containers::String out; Error redirectError{&out}; importer.skin2D(8); - CORRADE_COMPARE(out.str(), "Trade::AbstractImporter::skin2D(): index 8 out of range for 8 entries\n"); + CORRADE_COMPARE(out, "Trade::AbstractImporter::skin2D(): index 8 out of range for 8 entries\n"); } void AbstractImporterTest::skin2DNonOwningDeleters() { @@ -5186,7 +5185,7 @@ void AbstractImporterTest::skin2DNonOwningDeleters() { Matrix3 inverseBindMatrixData[1]{}; } importer; - std::ostringstream out; + Containers::String out; Error redirectError{&out}; auto data = importer.skin2D(0); @@ -5211,12 +5210,12 @@ void AbstractImporterTest::skin2DCustomJointDataDeleter() { UnsignedInt jointData[1]{}; } importer; - std::ostringstream out; + Containers::String out; Error redirectError{&out}; importer.skin2D(0); importer.skin2D(""); - CORRADE_COMPARE(out.str(), + CORRADE_COMPARE(out, "Trade::AbstractImporter::skin2D(): implementation is not allowed to use a custom Array deleter\n" "Trade::AbstractImporter::skin2D(): implementation is not allowed to use a custom Array deleter\n"); } @@ -5238,12 +5237,12 @@ void AbstractImporterTest::skin2DCustomInverseBindMatrixDataDeleter() { Matrix3 inverseBindMatrixData[1]{}; } importer; - std::ostringstream out; + Containers::String out; Error redirectError{&out}; importer.skin2D(0); importer.skin2D(""); - CORRADE_COMPARE(out.str(), + CORRADE_COMPARE(out, "Trade::AbstractImporter::skin2D(): implementation is not allowed to use a custom Array deleter\n" "Trade::AbstractImporter::skin2D(): implementation is not allowed to use a custom Array deleter\n"); } @@ -5299,10 +5298,10 @@ void AbstractImporterTest::skin3DFailed() { } importer; /* The implementation is expected to print an error message on its own */ - std::ostringstream out; + Containers::String out; Error redirectError{&out}; CORRADE_VERIFY(!importer.skin3D(0)); - CORRADE_COMPARE(out.str(), ""); + CORRADE_COMPARE(out, ""); } void AbstractImporterTest::skin3DForNameOutOfRange() { @@ -5317,11 +5316,11 @@ void AbstractImporterTest::skin3DForNameOutOfRange() { Int doSkin3DForName(Containers::StringView) override { return 8; } } importer; - std::ostringstream out; + Containers::String out; Error redirectError{&out}; importer.skin3DForName(""); - CORRADE_COMPARE(out.str(), "Trade::AbstractImporter::skin3DForName(): implementation-returned index 8 out of range for 8 entries\n"); + CORRADE_COMPARE(out, "Trade::AbstractImporter::skin3DForName(): implementation-returned index 8 out of range for 8 entries\n"); } void AbstractImporterTest::skin3DNameNotImplemented() { @@ -5347,11 +5346,11 @@ void AbstractImporterTest::skin3DNameOutOfRange() { UnsignedInt doSkin3DCount() const override { return 8; } } importer; - std::ostringstream out; + Containers::String out; Error redirectError{&out}; importer.skin3DName(8); - CORRADE_COMPARE(out.str(), "Trade::AbstractImporter::skin3DName(): index 8 out of range for 8 entries\n"); + CORRADE_COMPARE(out, "Trade::AbstractImporter::skin3DName(): index 8 out of range for 8 entries\n"); } void AbstractImporterTest::skin3DNameCustomDeleter() { @@ -5368,10 +5367,10 @@ void AbstractImporterTest::skin3DNameCustomDeleter() { } } importer; - std::ostringstream out; + Containers::String out; Error redirectError{&out}; importer.skin3DName(0); - CORRADE_COMPARE(out.str(), "Trade::AbstractImporter::skin3DName(): implementation is not allowed to use a custom String deleter\n"); + CORRADE_COMPARE(out, "Trade::AbstractImporter::skin3DName(): implementation is not allowed to use a custom String deleter\n"); } void AbstractImporterTest::skin3DNotImplemented() { @@ -5385,11 +5384,11 @@ void AbstractImporterTest::skin3DNotImplemented() { UnsignedInt doSkin3DCount() const override { return 8; } } importer; - std::ostringstream out; + Containers::String out; Error redirectError{&out}; importer.skin3D(7); - CORRADE_COMPARE(out.str(), "Trade::AbstractImporter::skin3D(): not implemented\n"); + CORRADE_COMPARE(out, "Trade::AbstractImporter::skin3D(): not implemented\n"); } void AbstractImporterTest::skin3DOutOfRange() { @@ -5403,11 +5402,11 @@ void AbstractImporterTest::skin3DOutOfRange() { UnsignedInt doSkin3DCount() const override { return 8; } } importer; - std::ostringstream out; + Containers::String out; Error redirectError{&out}; importer.skin3D(8); - CORRADE_COMPARE(out.str(), "Trade::AbstractImporter::skin3D(): index 8 out of range for 8 entries\n"); + CORRADE_COMPARE(out, "Trade::AbstractImporter::skin3D(): index 8 out of range for 8 entries\n"); } void AbstractImporterTest::skin3DNonOwningDeleters() { @@ -5426,7 +5425,7 @@ void AbstractImporterTest::skin3DNonOwningDeleters() { Matrix4 inverseBindMatrixData[1]{}; } importer; - std::ostringstream out; + Containers::String out; Error redirectError{&out}; auto data = importer.skin3D(0); @@ -5451,12 +5450,12 @@ void AbstractImporterTest::skin3DCustomJointDataDeleter() { UnsignedInt jointData[1]{}; } importer; - std::ostringstream out; + Containers::String out; Error redirectError{&out}; importer.skin3D(0); importer.skin3D(""); - CORRADE_COMPARE(out.str(), + CORRADE_COMPARE(out, "Trade::AbstractImporter::skin3D(): implementation is not allowed to use a custom Array deleter\n" "Trade::AbstractImporter::skin3D(): implementation is not allowed to use a custom Array deleter\n"); } @@ -5478,12 +5477,12 @@ void AbstractImporterTest::skin3DCustomInverseBindMatrixDataDeleter() { Matrix4 inverseBindMatrixData[1]{}; } importer; - std::ostringstream out; + Containers::String out; Error redirectError{&out}; importer.skin3D(0); importer.skin3D(""); - CORRADE_COMPARE(out.str(), + CORRADE_COMPARE(out, "Trade::AbstractImporter::skin3D(): implementation is not allowed to use a custom Array deleter\n" "Trade::AbstractImporter::skin3D(): implementation is not allowed to use a custom Array deleter\n"); } @@ -5543,10 +5542,10 @@ void AbstractImporterTest::meshFailed() { } importer; /* The implementation is expected to print an error message on its own */ - std::ostringstream out; + Containers::String out; Error redirectError{&out}; CORRADE_VERIFY(!importer.mesh(0)); - CORRADE_COMPARE(out.str(), ""); + CORRADE_COMPARE(out, ""); } #ifdef MAGNUM_BUILD_DEPRECATED @@ -5611,10 +5610,10 @@ void AbstractImporterTest::meshLevelCountOutOfRange() { UnsignedInt doMeshCount() const override { return 8; } } importer; - std::ostringstream out; + Containers::String out; Error redirectError{&out}; importer.meshLevelCount(8); - CORRADE_COMPARE(out.str(), "Trade::AbstractImporter::meshLevelCount(): index 8 out of range for 8 entries\n"); + CORRADE_COMPARE(out, "Trade::AbstractImporter::meshLevelCount(): index 8 out of range for 8 entries\n"); } void AbstractImporterTest::meshLevelCountZero() { @@ -5630,14 +5629,14 @@ void AbstractImporterTest::meshLevelCountZero() { UnsignedInt doMeshLevelCount(UnsignedInt) override { return 0; } } importer; - std::ostringstream out; + Containers::String out; Error redirectError{&out}; importer.meshLevelCount(7); /* This should print a similar message instead of a confusing "level 1 out of range for 0 entries" */ importer.mesh(7, 1); importer.mesh("", 1); - CORRADE_COMPARE(out.str(), + CORRADE_COMPARE(out, "Trade::AbstractImporter::meshLevelCount(): implementation reported zero levels\n" "Trade::AbstractImporter::mesh(): implementation reported zero levels\n" "Trade::AbstractImporter::mesh(): implementation reported zero levels\n"); @@ -5655,10 +5654,10 @@ void AbstractImporterTest::meshForNameOutOfRange() { Int doMeshForName(Containers::StringView) override { return 8; } } importer; - std::ostringstream out; + Containers::String out; Error redirectError{&out}; importer.meshForName(""); - CORRADE_COMPARE(out.str(), "Trade::AbstractImporter::meshForName(): implementation-returned index 8 out of range for 8 entries\n"); + CORRADE_COMPARE(out, "Trade::AbstractImporter::meshForName(): implementation-returned index 8 out of range for 8 entries\n"); } void AbstractImporterTest::meshNameNotImplemented() { @@ -5684,11 +5683,11 @@ void AbstractImporterTest::meshNameOutOfRange() { UnsignedInt doMeshCount() const override { return 8; } } importer; - std::ostringstream out; + Containers::String out; Error redirectError{&out}; importer.meshName(8); - CORRADE_COMPARE(out.str(), "Trade::AbstractImporter::meshName(): index 8 out of range for 8 entries\n"); + CORRADE_COMPARE(out, "Trade::AbstractImporter::meshName(): index 8 out of range for 8 entries\n"); } void AbstractImporterTest::meshNameCustomDeleter() { @@ -5705,10 +5704,10 @@ void AbstractImporterTest::meshNameCustomDeleter() { } } importer; - std::ostringstream out; + Containers::String out; Error redirectError{&out}; importer.meshName(0); - CORRADE_COMPARE(out.str(), "Trade::AbstractImporter::meshName(): implementation is not allowed to use a custom String deleter\n"); + CORRADE_COMPARE(out, "Trade::AbstractImporter::meshName(): implementation is not allowed to use a custom String deleter\n"); } void AbstractImporterTest::meshNotImplemented() { @@ -5722,11 +5721,11 @@ void AbstractImporterTest::meshNotImplemented() { UnsignedInt doMeshCount() const override { return 8; } } importer; - std::ostringstream out; + Containers::String out; Error redirectError{&out}; importer.mesh(7); - CORRADE_COMPARE(out.str(), "Trade::AbstractImporter::mesh(): not implemented\n"); + CORRADE_COMPARE(out, "Trade::AbstractImporter::mesh(): not implemented\n"); } void AbstractImporterTest::meshOutOfRange() { @@ -5740,11 +5739,11 @@ void AbstractImporterTest::meshOutOfRange() { UnsignedInt doMeshCount() const override { return 8; } } importer; - std::ostringstream out; + Containers::String out; Error redirectError{&out}; importer.mesh(8); - CORRADE_COMPARE(out.str(), "Trade::AbstractImporter::mesh(): index 8 out of range for 8 entries\n"); + CORRADE_COMPARE(out, "Trade::AbstractImporter::mesh(): index 8 out of range for 8 entries\n"); } void AbstractImporterTest::meshLevelOutOfRange() { @@ -5760,11 +5759,11 @@ void AbstractImporterTest::meshLevelOutOfRange() { UnsignedInt doMeshLevelCount(UnsignedInt) override { return 3; } } importer; - std::ostringstream out; + Containers::String out; Error redirectError{&out}; importer.mesh(7, 3); importer.mesh("", 3); - CORRADE_COMPARE(out.str(), + CORRADE_COMPARE(out, "Trade::AbstractImporter::mesh(): level 3 out of range for 3 entries\n" "Trade::AbstractImporter::mesh(): level 3 out of range for 3 entries\n"); } @@ -5838,12 +5837,12 @@ void AbstractImporterTest::meshCustomIndexDataDeleter() { char data[1]; } importer; - std::ostringstream out; + Containers::String out; Error redirectError{&out}; importer.mesh(0); importer.mesh(""); - CORRADE_COMPARE(out.str(), + CORRADE_COMPARE(out, "Trade::AbstractImporter::mesh(): implementation is not allowed to use a custom Array deleter\n" "Trade::AbstractImporter::mesh(): implementation is not allowed to use a custom Array deleter\n"); } @@ -5863,12 +5862,12 @@ void AbstractImporterTest::meshCustomVertexDataDeleter() { } } importer; - std::ostringstream out; + Containers::String out; Error redirectError{&out}; importer.mesh(0); importer.mesh(""); - CORRADE_COMPARE(out.str(), + CORRADE_COMPARE(out, "Trade::AbstractImporter::mesh(): implementation is not allowed to use a custom Array deleter\n" "Trade::AbstractImporter::mesh(): implementation is not allowed to use a custom Array deleter\n"); } @@ -5890,12 +5889,12 @@ void AbstractImporterTest::meshCustomAttributesDeleter() { MeshAttributeData positions{MeshAttribute::Position, VertexFormat::Vector3, nullptr}; } importer; - std::ostringstream out; + Containers::String out; Error redirectError{&out}; importer.mesh(0); importer.mesh(""); - CORRADE_COMPARE(out.str(), + CORRADE_COMPARE(out, "Trade::AbstractImporter::mesh(): implementation is not allowed to use a custom Array deleter\n" "Trade::AbstractImporter::mesh(): implementation is not allowed to use a custom Array deleter\n" ); @@ -5946,11 +5945,11 @@ void AbstractImporterTest::meshAttributeNameNotCustom() { } } importer; - std::ostringstream out; + Containers::String out; Error redirectError{&out}; importer.meshAttributeForName("SMOOTH_GROUP_ID"); importer.meshAttributeName(MeshAttribute::Position); - CORRADE_COMPARE(out.str(), + CORRADE_COMPARE(out, "Trade::AbstractImporter::meshAttributeForName(): implementation-returned Trade::MeshAttribute::Position is neither custom nor invalid\n" "Trade::AbstractImporter::meshAttributeName(): Trade::MeshAttribute::Position is not custom\n"); } @@ -5968,10 +5967,10 @@ void AbstractImporterTest::meshAttributeNameCustomDeleter() { } } importer; - std::ostringstream out; + Containers::String out; Error redirectError{&out}; importer.meshAttributeName(meshAttributeCustom(0)); - CORRADE_COMPARE(out.str(), "Trade::AbstractImporter::meshAttributeName(): implementation is not allowed to use a custom String deleter\n"); + CORRADE_COMPARE(out, "Trade::AbstractImporter::meshAttributeName(): implementation is not allowed to use a custom String deleter\n"); } #ifdef MAGNUM_BUILD_DEPRECATED @@ -6030,13 +6029,13 @@ void AbstractImporterTest::mesh2DCountNoFile() { void doClose() override {} } importer; - std::ostringstream out; + Containers::String out; Error redirectError{&out}; CORRADE_IGNORE_DEPRECATED_PUSH importer.mesh2DCount(); CORRADE_IGNORE_DEPRECATED_POP - CORRADE_COMPARE(out.str(), "Trade::AbstractImporter::mesh2DCount(): no file opened\n"); + CORRADE_COMPARE(out, "Trade::AbstractImporter::mesh2DCount(): no file opened\n"); } void AbstractImporterTest::mesh2DForNameNotImplemented() { @@ -6060,13 +6059,13 @@ void AbstractImporterTest::mesh2DForNameNoFile() { void doClose() override {} } importer; - std::ostringstream out; + Containers::String out; Error redirectError{&out}; CORRADE_IGNORE_DEPRECATED_PUSH importer.mesh2DForName(""); CORRADE_IGNORE_DEPRECATED_POP - CORRADE_COMPARE(out.str(), "Trade::AbstractImporter::mesh2DForName(): no file opened\n"); + CORRADE_COMPARE(out, "Trade::AbstractImporter::mesh2DForName(): no file opened\n"); } void AbstractImporterTest::mesh2DNameNotImplemented() { @@ -6092,13 +6091,13 @@ void AbstractImporterTest::mesh2DNameNoFile() { void doClose() override {} } importer; - std::ostringstream out; + Containers::String out; Error redirectError{&out}; CORRADE_IGNORE_DEPRECATED_PUSH importer.mesh2DName(42); CORRADE_IGNORE_DEPRECATED_POP - CORRADE_COMPARE(out.str(), "Trade::AbstractImporter::mesh2DName(): no file opened\n"); + CORRADE_COMPARE(out, "Trade::AbstractImporter::mesh2DName(): no file opened\n"); } void AbstractImporterTest::mesh2DNameOutOfRange() { @@ -6112,13 +6111,13 @@ void AbstractImporterTest::mesh2DNameOutOfRange() { UnsignedInt doMesh2DCount() const override { return 8; } } importer; - std::ostringstream out; + Containers::String out; Error redirectError{&out}; CORRADE_IGNORE_DEPRECATED_PUSH importer.mesh2DName(8); CORRADE_IGNORE_DEPRECATED_POP - CORRADE_COMPARE(out.str(), "Trade::AbstractImporter::mesh2DName(): index 8 out of range for 8 entries\n"); + CORRADE_COMPARE(out, "Trade::AbstractImporter::mesh2DName(): index 8 out of range for 8 entries\n"); } void AbstractImporterTest::mesh2DNotImplemented() { @@ -6132,13 +6131,13 @@ void AbstractImporterTest::mesh2DNotImplemented() { UnsignedInt doMesh2DCount() const override { return 8; } } importer; - std::ostringstream out; + Containers::String out; Error redirectError{&out}; CORRADE_IGNORE_DEPRECATED_PUSH importer.mesh2D(7); CORRADE_IGNORE_DEPRECATED_POP - CORRADE_COMPARE(out.str(), "Trade::AbstractImporter::mesh2D(): not implemented\n"); + CORRADE_COMPARE(out, "Trade::AbstractImporter::mesh2D(): not implemented\n"); } void AbstractImporterTest::mesh2DNoFile() { @@ -6150,13 +6149,13 @@ void AbstractImporterTest::mesh2DNoFile() { void doClose() override {} } importer; - std::ostringstream out; + Containers::String out; Error redirectError{&out}; CORRADE_IGNORE_DEPRECATED_PUSH importer.mesh2D(42); CORRADE_IGNORE_DEPRECATED_POP - CORRADE_COMPARE(out.str(), "Trade::AbstractImporter::mesh2D(): no file opened\n"); + CORRADE_COMPARE(out, "Trade::AbstractImporter::mesh2D(): no file opened\n"); } void AbstractImporterTest::mesh2DOutOfRange() { @@ -6170,13 +6169,13 @@ void AbstractImporterTest::mesh2DOutOfRange() { UnsignedInt doMesh2DCount() const override { return 8; } } importer; - std::ostringstream out; + Containers::String out; Error redirectError{&out}; CORRADE_IGNORE_DEPRECATED_PUSH importer.mesh2D(8); CORRADE_IGNORE_DEPRECATED_POP - CORRADE_COMPARE(out.str(), "Trade::AbstractImporter::mesh2D(): index 8 out of range for 8 entries\n"); + CORRADE_COMPARE(out, "Trade::AbstractImporter::mesh2D(): index 8 out of range for 8 entries\n"); } void AbstractImporterTest::mesh3D() { @@ -6234,13 +6233,13 @@ void AbstractImporterTest::mesh3DCountNoFile() { void doClose() override {} } importer; - std::ostringstream out; + Containers::String out; Error redirectError{&out}; CORRADE_IGNORE_DEPRECATED_PUSH importer.mesh3DCount(); CORRADE_IGNORE_DEPRECATED_POP - CORRADE_COMPARE(out.str(), "Trade::AbstractImporter::mesh3DCount(): no file opened\n"); + CORRADE_COMPARE(out, "Trade::AbstractImporter::mesh3DCount(): no file opened\n"); } void AbstractImporterTest::mesh3DForNameNotImplemented() { @@ -6264,13 +6263,13 @@ void AbstractImporterTest::mesh3DForNameNoFile() { void doClose() override {} } importer; - std::ostringstream out; + Containers::String out; Error redirectError{&out}; CORRADE_IGNORE_DEPRECATED_PUSH importer.mesh3DForName(""); CORRADE_IGNORE_DEPRECATED_POP - CORRADE_COMPARE(out.str(), "Trade::AbstractImporter::mesh3DForName(): no file opened\n"); + CORRADE_COMPARE(out, "Trade::AbstractImporter::mesh3DForName(): no file opened\n"); } void AbstractImporterTest::mesh3DNameNotImplemented() { @@ -6296,13 +6295,13 @@ void AbstractImporterTest::mesh3DNameNoFile() { void doClose() override {} } importer; - std::ostringstream out; + Containers::String out; Error redirectError{&out}; CORRADE_IGNORE_DEPRECATED_PUSH importer.mesh3DName(42); CORRADE_IGNORE_DEPRECATED_POP - CORRADE_COMPARE(out.str(), "Trade::AbstractImporter::mesh3DName(): no file opened\n"); + CORRADE_COMPARE(out, "Trade::AbstractImporter::mesh3DName(): no file opened\n"); } void AbstractImporterTest::mesh3DNameOutOfRange() { @@ -6316,13 +6315,13 @@ void AbstractImporterTest::mesh3DNameOutOfRange() { UnsignedInt doMesh3DCount() const override { return 8; } } importer; - std::ostringstream out; + Containers::String out; Error redirectError{&out}; CORRADE_IGNORE_DEPRECATED_PUSH importer.mesh3DName(8); CORRADE_IGNORE_DEPRECATED_POP - CORRADE_COMPARE(out.str(), "Trade::AbstractImporter::mesh3DName(): index 8 out of range for 8 entries\n"); + CORRADE_COMPARE(out, "Trade::AbstractImporter::mesh3DName(): index 8 out of range for 8 entries\n"); } void AbstractImporterTest::mesh3DNotImplemented() { @@ -6336,7 +6335,7 @@ void AbstractImporterTest::mesh3DNotImplemented() { UnsignedInt doMesh3DCount() const override { return 8; } } importer; - std::ostringstream out; + Containers::String out; Error redirectError{&out}; CORRADE_IGNORE_DEPRECATED_PUSH @@ -6344,7 +6343,7 @@ void AbstractImporterTest::mesh3DNotImplemented() { CORRADE_IGNORE_DEPRECATED_POP /* Not mesh3D() because this one delegates into mesh() for backwards compatibility */ - CORRADE_COMPARE(out.str(), "Trade::AbstractImporter::mesh(): not implemented\n"); + CORRADE_COMPARE(out, "Trade::AbstractImporter::mesh(): not implemented\n"); } void AbstractImporterTest::mesh3DNoFile() { @@ -6356,13 +6355,13 @@ void AbstractImporterTest::mesh3DNoFile() { void doClose() override {} } importer; - std::ostringstream out; + Containers::String out; Error redirectError{&out}; CORRADE_IGNORE_DEPRECATED_PUSH importer.mesh3D(42); CORRADE_IGNORE_DEPRECATED_POP - CORRADE_COMPARE(out.str(), "Trade::AbstractImporter::mesh3D(): no file opened\n"); + CORRADE_COMPARE(out, "Trade::AbstractImporter::mesh3D(): no file opened\n"); } void AbstractImporterTest::mesh3DOutOfRange() { @@ -6376,13 +6375,13 @@ void AbstractImporterTest::mesh3DOutOfRange() { UnsignedInt doMesh3DCount() const override { return 8; } } importer; - std::ostringstream out; + Containers::String out; Error redirectError{&out}; CORRADE_IGNORE_DEPRECATED_PUSH importer.mesh3D(8); CORRADE_IGNORE_DEPRECATED_POP - CORRADE_COMPARE(out.str(), "Trade::AbstractImporter::mesh3D(): index 8 out of range for 8 entries\n"); + CORRADE_COMPARE(out, "Trade::AbstractImporter::mesh3D(): index 8 out of range for 8 entries\n"); } #endif @@ -6435,10 +6434,10 @@ void AbstractImporterTest::materialFailed() { } importer; /* The implementation is expected to print an error message on its own */ - std::ostringstream out; + Containers::String out; Error redirectError{&out}; CORRADE_VERIFY(!importer.material(0)); - CORRADE_COMPARE(out.str(), ""); + CORRADE_COMPARE(out, ""); } #ifdef MAGNUM_BUILD_DEPRECATED @@ -6495,10 +6494,10 @@ void AbstractImporterTest::materialForNameOutOfRange() { Int doMaterialForName(Containers::StringView) override { return 8; } } importer; - std::ostringstream out; + Containers::String out; Error redirectError{&out}; importer.materialForName(""); - CORRADE_COMPARE(out.str(), "Trade::AbstractImporter::materialForName(): implementation-returned index 8 out of range for 8 entries\n"); + CORRADE_COMPARE(out, "Trade::AbstractImporter::materialForName(): implementation-returned index 8 out of range for 8 entries\n"); } void AbstractImporterTest::materialNameNotImplemented() { @@ -6524,11 +6523,11 @@ void AbstractImporterTest::materialNameOutOfRange() { UnsignedInt doMaterialCount() const override { return 8; } } importer; - std::ostringstream out; + Containers::String out; Error redirectError{&out}; importer.materialName(8); - CORRADE_COMPARE(out.str(), "Trade::AbstractImporter::materialName(): index 8 out of range for 8 entries\n"); + CORRADE_COMPARE(out, "Trade::AbstractImporter::materialName(): index 8 out of range for 8 entries\n"); } void AbstractImporterTest::materialNameCustomDeleter() { @@ -6545,10 +6544,10 @@ void AbstractImporterTest::materialNameCustomDeleter() { } } importer; - std::ostringstream out; + Containers::String out; Error redirectError{&out}; importer.materialName(0); - CORRADE_COMPARE(out.str(), "Trade::AbstractImporter::materialName(): implementation is not allowed to use a custom String deleter\n"); + CORRADE_COMPARE(out, "Trade::AbstractImporter::materialName(): implementation is not allowed to use a custom String deleter\n"); } void AbstractImporterTest::materialNotImplemented() { @@ -6562,11 +6561,11 @@ void AbstractImporterTest::materialNotImplemented() { UnsignedInt doMaterialCount() const override { return 8; } } importer; - std::ostringstream out; + Containers::String out; Error redirectError{&out}; importer.material(7); - CORRADE_COMPARE(out.str(), "Trade::AbstractImporter::material(): not implemented\n"); + CORRADE_COMPARE(out, "Trade::AbstractImporter::material(): not implemented\n"); } void AbstractImporterTest::materialOutOfRange() { @@ -6580,11 +6579,11 @@ void AbstractImporterTest::materialOutOfRange() { UnsignedInt doMaterialCount() const override { return 8; } } importer; - std::ostringstream out; + Containers::String out; Error redirectError{&out}; importer.material(8); - CORRADE_COMPARE(out.str(), "Trade::AbstractImporter::material(): index 8 out of range for 8 entries\n"); + CORRADE_COMPARE(out, "Trade::AbstractImporter::material(): index 8 out of range for 8 entries\n"); } void AbstractImporterTest::materialNonOwningDeleters() { @@ -6629,12 +6628,12 @@ void AbstractImporterTest::materialCustomAttributeDataDeleter() { }; } importer; - std::ostringstream out; + Containers::String out; Error redirectError{&out}; importer.material(0); importer.material(""); - CORRADE_COMPARE(out.str(), + CORRADE_COMPARE(out, "Trade::AbstractImporter::material(): implementation is not allowed to use a custom Array deleter\n" "Trade::AbstractImporter::material(): implementation is not allowed to use a custom Array deleter\n"); } @@ -6656,12 +6655,12 @@ void AbstractImporterTest::materialCustomLayerDataDeleter() { UnsignedInt layerData[1]{}; } importer; - std::ostringstream out; + Containers::String out; Error redirectError{&out}; importer.material(0); importer.material(""); - CORRADE_COMPARE(out.str(), + CORRADE_COMPARE(out, "Trade::AbstractImporter::material(): implementation is not allowed to use a custom Array deleter\n" "Trade::AbstractImporter::material(): implementation is not allowed to use a custom Array deleter\n"); } @@ -6715,10 +6714,10 @@ void AbstractImporterTest::textureFailed() { } importer; /* The implementation is expected to print an error message on its own */ - std::ostringstream out; + Containers::String out; Error redirectError{&out}; CORRADE_VERIFY(!importer.texture(0)); - CORRADE_COMPARE(out.str(), ""); + CORRADE_COMPARE(out, ""); } void AbstractImporterTest::textureForNameOutOfRange() { @@ -6733,10 +6732,10 @@ void AbstractImporterTest::textureForNameOutOfRange() { Int doTextureForName(Containers::StringView) override { return 8; } } importer; - std::ostringstream out; + Containers::String out; Error redirectError{&out}; importer.textureForName(""); - CORRADE_COMPARE(out.str(), "Trade::AbstractImporter::textureForName(): implementation-returned index 8 out of range for 8 entries\n"); + CORRADE_COMPARE(out, "Trade::AbstractImporter::textureForName(): implementation-returned index 8 out of range for 8 entries\n"); } void AbstractImporterTest::textureNameNotImplemented() { @@ -6762,11 +6761,11 @@ void AbstractImporterTest::textureNameOutOfRange() { UnsignedInt doTextureCount() const override { return 8; } } importer; - std::ostringstream out; + Containers::String out; Error redirectError{&out}; importer.textureName(8); - CORRADE_COMPARE(out.str(), "Trade::AbstractImporter::textureName(): index 8 out of range for 8 entries\n"); + CORRADE_COMPARE(out, "Trade::AbstractImporter::textureName(): index 8 out of range for 8 entries\n"); } void AbstractImporterTest::textureNameCustomDeleter() { @@ -6783,10 +6782,10 @@ void AbstractImporterTest::textureNameCustomDeleter() { } } importer; - std::ostringstream out; + Containers::String out; Error redirectError{&out}; importer.textureName(0); - CORRADE_COMPARE(out.str(), "Trade::AbstractImporter::textureName(): implementation is not allowed to use a custom String deleter\n"); + CORRADE_COMPARE(out, "Trade::AbstractImporter::textureName(): implementation is not allowed to use a custom String deleter\n"); } void AbstractImporterTest::textureNotImplemented() { @@ -6800,11 +6799,11 @@ void AbstractImporterTest::textureNotImplemented() { UnsignedInt doTextureCount() const override { return 8; } } importer; - std::ostringstream out; + Containers::String out; Error redirectError{&out}; importer.texture(7); - CORRADE_COMPARE(out.str(), "Trade::AbstractImporter::texture(): not implemented\n"); + CORRADE_COMPARE(out, "Trade::AbstractImporter::texture(): not implemented\n"); } void AbstractImporterTest::textureOutOfRange() { @@ -6818,11 +6817,11 @@ void AbstractImporterTest::textureOutOfRange() { UnsignedInt doTextureCount() const override { return 8; } } importer; - std::ostringstream out; + Containers::String out; Error redirectError{&out}; importer.texture(8); - CORRADE_COMPARE(out.str(), "Trade::AbstractImporter::texture(): index 8 out of range for 8 entries\n"); + CORRADE_COMPARE(out, "Trade::AbstractImporter::texture(): index 8 out of range for 8 entries\n"); } void AbstractImporterTest::image1D() { @@ -6879,10 +6878,10 @@ void AbstractImporterTest::image1DFailed() { } importer; /* The implementation is expected to print an error message on its own */ - std::ostringstream out; + Containers::String out; Error redirectError{&out}; CORRADE_VERIFY(!importer.image1D(0)); - CORRADE_COMPARE(out.str(), ""); + CORRADE_COMPARE(out, ""); } void AbstractImporterTest::image1DLevelCountNotImplemented() { @@ -6908,10 +6907,10 @@ void AbstractImporterTest::image1DLevelCountOutOfRange() { UnsignedInt doImage1DCount() const override { return 8; } } importer; - std::ostringstream out; + Containers::String out; Error redirectError{&out}; importer.image1DLevelCount(8); - CORRADE_COMPARE(out.str(), "Trade::AbstractImporter::image1DLevelCount(): index 8 out of range for 8 entries\n"); + CORRADE_COMPARE(out, "Trade::AbstractImporter::image1DLevelCount(): index 8 out of range for 8 entries\n"); } void AbstractImporterTest::image1DLevelCountZero() { @@ -6927,14 +6926,14 @@ void AbstractImporterTest::image1DLevelCountZero() { UnsignedInt doImage1DLevelCount(UnsignedInt) override { return 0; } } importer; - std::ostringstream out; + Containers::String out; Error redirectError{&out}; importer.image1DLevelCount(7); /* This should print a similar message instead of a confusing "level 1 out of range for 0 entries" */ importer.image1D(7, 1); importer.image1D("", 1); - CORRADE_COMPARE(out.str(), + CORRADE_COMPARE(out, "Trade::AbstractImporter::image1DLevelCount(): implementation reported zero levels\n" "Trade::AbstractImporter::image1D(): implementation reported zero levels\n" "Trade::AbstractImporter::image1D(): implementation reported zero levels\n"); @@ -6952,10 +6951,10 @@ void AbstractImporterTest::image1DForNameOutOfRange() { Int doImage1DForName(Containers::StringView) override { return 8; } } importer; - std::ostringstream out; + Containers::String out; Error redirectError{&out}; importer.image1DForName(""); - CORRADE_COMPARE(out.str(), "Trade::AbstractImporter::image1DForName(): implementation-returned index 8 out of range for 8 entries\n"); + CORRADE_COMPARE(out, "Trade::AbstractImporter::image1DForName(): implementation-returned index 8 out of range for 8 entries\n"); } void AbstractImporterTest::image1DNameNotImplemented() { @@ -6981,11 +6980,11 @@ void AbstractImporterTest::image1DNameOutOfRange() { UnsignedInt doImage1DCount() const override { return 8; } } importer; - std::ostringstream out; + Containers::String out; Error redirectError{&out}; importer.image1DName(8); - CORRADE_COMPARE(out.str(), "Trade::AbstractImporter::image1DName(): index 8 out of range for 8 entries\n"); + CORRADE_COMPARE(out, "Trade::AbstractImporter::image1DName(): index 8 out of range for 8 entries\n"); } void AbstractImporterTest::image1DNameCustomDeleter() { @@ -7002,10 +7001,10 @@ void AbstractImporterTest::image1DNameCustomDeleter() { } } importer; - std::ostringstream out; + Containers::String out; Error redirectError{&out}; importer.image1DName(0); - CORRADE_COMPARE(out.str(), "Trade::AbstractImporter::image1DName(): implementation is not allowed to use a custom String deleter\n"); + CORRADE_COMPARE(out, "Trade::AbstractImporter::image1DName(): implementation is not allowed to use a custom String deleter\n"); } void AbstractImporterTest::image1DNotImplemented() { @@ -7019,11 +7018,11 @@ void AbstractImporterTest::image1DNotImplemented() { UnsignedInt doImage1DCount() const override { return 8; } } importer; - std::ostringstream out; + Containers::String out; Error redirectError{&out}; importer.image1D(7); - CORRADE_COMPARE(out.str(), "Trade::AbstractImporter::image1D(): not implemented\n"); + CORRADE_COMPARE(out, "Trade::AbstractImporter::image1D(): not implemented\n"); } void AbstractImporterTest::image1DOutOfRange() { @@ -7037,11 +7036,11 @@ void AbstractImporterTest::image1DOutOfRange() { UnsignedInt doImage1DCount() const override { return 8; } } importer; - std::ostringstream out; + Containers::String out; Error redirectError{&out}; importer.image1D(8); - CORRADE_COMPARE(out.str(), "Trade::AbstractImporter::image1D(): index 8 out of range for 8 entries\n"); + CORRADE_COMPARE(out, "Trade::AbstractImporter::image1D(): index 8 out of range for 8 entries\n"); } void AbstractImporterTest::image1DLevelOutOfRange() { @@ -7057,11 +7056,11 @@ void AbstractImporterTest::image1DLevelOutOfRange() { UnsignedInt doImage1DLevelCount(UnsignedInt) override { return 3; } } importer; - std::ostringstream out; + Containers::String out; Error redirectError{&out}; importer.image1D(7, 3); importer.image1D("", 3); - CORRADE_COMPARE(out.str(), + CORRADE_COMPARE(out, "Trade::AbstractImporter::image1D(): level 3 out of range for 3 entries\n" "Trade::AbstractImporter::image1D(): level 3 out of range for 3 entries\n"); } @@ -7119,12 +7118,12 @@ void AbstractImporterTest::image1DCustomDeleter() { } } importer; - std::ostringstream out; + Containers::String out; Error redirectError{&out}; importer.image1D(0); importer.image1D(""); - CORRADE_COMPARE(out.str(), + CORRADE_COMPARE(out, "Trade::AbstractImporter::image1D(): implementation is not allowed to use a custom Array deleter\n" "Trade::AbstractImporter::image1D(): implementation is not allowed to use a custom Array deleter\n"); } @@ -7183,10 +7182,10 @@ void AbstractImporterTest::image2DFailed() { } importer; /* The implementation is expected to print an error message on its own */ - std::ostringstream out; + Containers::String out; Error redirectError{&out}; CORRADE_VERIFY(!importer.image2D(0)); - CORRADE_COMPARE(out.str(), ""); + CORRADE_COMPARE(out, ""); } void AbstractImporterTest::image2DLevelCountNotImplemented() { @@ -7212,10 +7211,10 @@ void AbstractImporterTest::image2DLevelCountOutOfRange() { UnsignedInt doImage2DCount() const override { return 8; } } importer; - std::ostringstream out; + Containers::String out; Error redirectError{&out}; importer.image2DLevelCount(8); - CORRADE_COMPARE(out.str(), "Trade::AbstractImporter::image2DLevelCount(): index 8 out of range for 8 entries\n"); + CORRADE_COMPARE(out, "Trade::AbstractImporter::image2DLevelCount(): index 8 out of range for 8 entries\n"); } void AbstractImporterTest::image2DLevelCountZero() { @@ -7231,14 +7230,14 @@ void AbstractImporterTest::image2DLevelCountZero() { UnsignedInt doImage2DLevelCount(UnsignedInt) override { return 0; } } importer; - std::ostringstream out; + Containers::String out; Error redirectError{&out}; importer.image2DLevelCount(7); /* This should print a similar message instead of a confusing "level 1 out of range for 0 entries" */ importer.image2D(7, 1); importer.image2D(7, 1); - CORRADE_COMPARE(out.str(), + CORRADE_COMPARE(out, "Trade::AbstractImporter::image2DLevelCount(): implementation reported zero levels\n" "Trade::AbstractImporter::image2D(): implementation reported zero levels\n" "Trade::AbstractImporter::image2D(): implementation reported zero levels\n"); @@ -7256,10 +7255,10 @@ void AbstractImporterTest::image2DForNameOutOfRange() { Int doImage2DForName(Containers::StringView) override { return 8; } } importer; - std::ostringstream out; + Containers::String out; Error redirectError{&out}; importer.image2DForName(""); - CORRADE_COMPARE(out.str(), "Trade::AbstractImporter::image2DForName(): implementation-returned index 8 out of range for 8 entries\n"); + CORRADE_COMPARE(out, "Trade::AbstractImporter::image2DForName(): implementation-returned index 8 out of range for 8 entries\n"); } void AbstractImporterTest::image2DNameNotImplemented() { @@ -7285,11 +7284,11 @@ void AbstractImporterTest::image2DNameOutOfRange() { UnsignedInt doImage2DCount() const override { return 8; } } importer; - std::ostringstream out; + Containers::String out; Error redirectError{&out}; importer.image2DName(8); - CORRADE_COMPARE(out.str(), "Trade::AbstractImporter::image2DName(): index 8 out of range for 8 entries\n"); + CORRADE_COMPARE(out, "Trade::AbstractImporter::image2DName(): index 8 out of range for 8 entries\n"); } void AbstractImporterTest::image2DNameCustomDeleter() { @@ -7306,10 +7305,10 @@ void AbstractImporterTest::image2DNameCustomDeleter() { } } importer; - std::ostringstream out; + Containers::String out; Error redirectError{&out}; importer.image2DName(0); - CORRADE_COMPARE(out.str(), "Trade::AbstractImporter::image2DName(): implementation is not allowed to use a custom String deleter\n"); + CORRADE_COMPARE(out, "Trade::AbstractImporter::image2DName(): implementation is not allowed to use a custom String deleter\n"); } void AbstractImporterTest::image2DNotImplemented() { @@ -7323,11 +7322,11 @@ void AbstractImporterTest::image2DNotImplemented() { UnsignedInt doImage2DCount() const override { return 8; } } importer; - std::ostringstream out; + Containers::String out; Error redirectError{&out}; importer.image2D(7); - CORRADE_COMPARE(out.str(), "Trade::AbstractImporter::image2D(): not implemented\n"); + CORRADE_COMPARE(out, "Trade::AbstractImporter::image2D(): not implemented\n"); } void AbstractImporterTest::image2DOutOfRange() { @@ -7341,11 +7340,11 @@ void AbstractImporterTest::image2DOutOfRange() { UnsignedInt doImage2DCount() const override { return 8; } } importer; - std::ostringstream out; + Containers::String out; Error redirectError{&out}; importer.image2D(8); - CORRADE_COMPARE(out.str(), "Trade::AbstractImporter::image2D(): index 8 out of range for 8 entries\n"); + CORRADE_COMPARE(out, "Trade::AbstractImporter::image2D(): index 8 out of range for 8 entries\n"); } void AbstractImporterTest::image2DLevelOutOfRange() { @@ -7361,11 +7360,11 @@ void AbstractImporterTest::image2DLevelOutOfRange() { UnsignedInt doImage2DLevelCount(UnsignedInt) override { return 3; } } importer; - std::ostringstream out; + Containers::String out; Error redirectError{&out}; importer.image2D(7, 3); importer.image2D("", 3); - CORRADE_COMPARE(out.str(), + CORRADE_COMPARE(out, "Trade::AbstractImporter::image2D(): level 3 out of range for 3 entries\n" "Trade::AbstractImporter::image2D(): level 3 out of range for 3 entries\n"); } @@ -7423,12 +7422,12 @@ void AbstractImporterTest::image2DCustomDeleter() { } } importer; - std::ostringstream out; + Containers::String out; Error redirectError{&out}; importer.image2D(0); importer.image2D(""); - CORRADE_COMPARE(out.str(), + CORRADE_COMPARE(out, "Trade::AbstractImporter::image2D(): implementation is not allowed to use a custom Array deleter\n" "Trade::AbstractImporter::image2D(): implementation is not allowed to use a custom Array deleter\n"); } @@ -7487,10 +7486,10 @@ void AbstractImporterTest::image3DFailed() { } importer; /* The implementation is expected to print an error message on its own */ - std::ostringstream out; + Containers::String out; Error redirectError{&out}; CORRADE_VERIFY(!importer.image3D(0)); - CORRADE_COMPARE(out.str(), ""); + CORRADE_COMPARE(out, ""); } void AbstractImporterTest::image3DForNameOutOfRange() { @@ -7505,10 +7504,10 @@ void AbstractImporterTest::image3DForNameOutOfRange() { Int doImage3DForName(Containers::StringView) override { return 8; } } importer; - std::ostringstream out; + Containers::String out; Error redirectError{&out}; importer.image3DForName(""); - CORRADE_COMPARE(out.str(), "Trade::AbstractImporter::image3DForName(): implementation-returned index 8 out of range for 8 entries\n"); + CORRADE_COMPARE(out, "Trade::AbstractImporter::image3DForName(): implementation-returned index 8 out of range for 8 entries\n"); } void AbstractImporterTest::image3DLevelCountNotImplemented() { @@ -7534,10 +7533,10 @@ void AbstractImporterTest::image3DLevelCountOutOfRange() { UnsignedInt doImage3DCount() const override { return 8; } } importer; - std::ostringstream out; + Containers::String out; Error redirectError{&out}; importer.image3DLevelCount(8); - CORRADE_COMPARE(out.str(), "Trade::AbstractImporter::image3DLevelCount(): index 8 out of range for 8 entries\n"); + CORRADE_COMPARE(out, "Trade::AbstractImporter::image3DLevelCount(): index 8 out of range for 8 entries\n"); } void AbstractImporterTest::image3DLevelCountZero() { @@ -7553,14 +7552,14 @@ void AbstractImporterTest::image3DLevelCountZero() { UnsignedInt doImage3DLevelCount(UnsignedInt) override { return 0; } } importer; - std::ostringstream out; + Containers::String out; Error redirectError{&out}; importer.image3DLevelCount(7); /* This should print a similar message instead of a confusing "level 1 out of range for 0 entries" */ importer.image3D(7, 1); importer.image3D("", 1); - CORRADE_COMPARE(out.str(), + CORRADE_COMPARE(out, "Trade::AbstractImporter::image3DLevelCount(): implementation reported zero levels\n" "Trade::AbstractImporter::image3D(): implementation reported zero levels\n" "Trade::AbstractImporter::image3D(): implementation reported zero levels\n"); @@ -7589,11 +7588,11 @@ void AbstractImporterTest::image3DNameOutOfRange() { UnsignedInt doImage3DCount() const override { return 8; } } importer; - std::ostringstream out; + Containers::String out; Error redirectError{&out}; importer.image3DName(8); - CORRADE_COMPARE(out.str(), "Trade::AbstractImporter::image3DName(): index 8 out of range for 8 entries\n"); + CORRADE_COMPARE(out, "Trade::AbstractImporter::image3DName(): index 8 out of range for 8 entries\n"); } void AbstractImporterTest::image3DNameCustomDeleter() { @@ -7610,10 +7609,10 @@ void AbstractImporterTest::image3DNameCustomDeleter() { } } importer; - std::ostringstream out; + Containers::String out; Error redirectError{&out}; importer.image3DName(0); - CORRADE_COMPARE(out.str(), "Trade::AbstractImporter::image3DName(): implementation is not allowed to use a custom String deleter\n"); + CORRADE_COMPARE(out, "Trade::AbstractImporter::image3DName(): implementation is not allowed to use a custom String deleter\n"); } void AbstractImporterTest::image3DNotImplemented() { @@ -7627,11 +7626,11 @@ void AbstractImporterTest::image3DNotImplemented() { UnsignedInt doImage3DCount() const override { return 8; } } importer; - std::ostringstream out; + Containers::String out; Error redirectError{&out}; importer.image3D(7); - CORRADE_COMPARE(out.str(), "Trade::AbstractImporter::image3D(): not implemented\n"); + CORRADE_COMPARE(out, "Trade::AbstractImporter::image3D(): not implemented\n"); } void AbstractImporterTest::image3DOutOfRange() { @@ -7645,11 +7644,11 @@ void AbstractImporterTest::image3DOutOfRange() { UnsignedInt doImage3DCount() const override { return 8; } } importer; - std::ostringstream out; + Containers::String out; Error redirectError{&out}; importer.image3D(8); - CORRADE_COMPARE(out.str(), "Trade::AbstractImporter::image3D(): index 8 out of range for 8 entries\n"); + CORRADE_COMPARE(out, "Trade::AbstractImporter::image3D(): index 8 out of range for 8 entries\n"); } void AbstractImporterTest::image3DLevelOutOfRange() { @@ -7665,11 +7664,11 @@ void AbstractImporterTest::image3DLevelOutOfRange() { UnsignedInt doImage3DLevelCount(UnsignedInt) override { return 3; } } importer; - std::ostringstream out; + Containers::String out; Error redirectError{&out}; importer.image3D(7, 3); importer.image3D("", 3); - CORRADE_COMPARE(out.str(), + CORRADE_COMPARE(out, "Trade::AbstractImporter::image3D(): level 3 out of range for 3 entries\n" "Trade::AbstractImporter::image3D(): level 3 out of range for 3 entries\n"); } @@ -7727,12 +7726,12 @@ void AbstractImporterTest::image3DCustomDeleter() { } } importer; - std::ostringstream out; + Containers::String out; Error redirectError{&out}; importer.image3D(0); importer.image3D(""); - CORRADE_COMPARE(out.str(), + CORRADE_COMPARE(out, "Trade::AbstractImporter::image3D(): implementation is not allowed to use a custom Array deleter\n" "Trade::AbstractImporter::image3D(): implementation is not allowed to use a custom Array deleter\n"); } @@ -7768,53 +7767,53 @@ void AbstractImporterTest::importerStateNoFile() { void doClose() override {} } importer; - std::ostringstream out; + Containers::String out; Error redirectError{&out}; importer.importerState(); - CORRADE_COMPARE(out.str(), "Trade::AbstractImporter::importerState(): no file opened\n"); + CORRADE_COMPARE(out, "Trade::AbstractImporter::importerState(): no file opened\n"); } void AbstractImporterTest::debugFeature() { - std::ostringstream out; + Containers::String out; Debug{&out} << ImporterFeature::OpenData << ImporterFeature(0xf0); - CORRADE_COMPARE(out.str(), "Trade::ImporterFeature::OpenData Trade::ImporterFeature(0xf0)\n"); + CORRADE_COMPARE(out, "Trade::ImporterFeature::OpenData Trade::ImporterFeature(0xf0)\n"); } void AbstractImporterTest::debugFeaturePacked() { - std::ostringstream out; + Containers::String 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"); + CORRADE_COMPARE(out, "OpenData 0xf0 Trade::ImporterFeature::FileCallback\n"); } void AbstractImporterTest::debugFeatures() { - std::ostringstream out; + Containers::String out; Debug{&out} << (ImporterFeature::OpenData|ImporterFeature::OpenState) << ImporterFeatures{}; - CORRADE_COMPARE(out.str(), "Trade::ImporterFeature::OpenData|Trade::ImporterFeature::OpenState Trade::ImporterFeatures{}\n"); + CORRADE_COMPARE(out, "Trade::ImporterFeature::OpenData|Trade::ImporterFeature::OpenState Trade::ImporterFeatures{}\n"); } void AbstractImporterTest::debugFeaturesPacked() { - std::ostringstream out; + Containers::String 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"); + CORRADE_COMPARE(out, "OpenData|OpenState {} Trade::ImporterFeature::FileCallback\n"); } void AbstractImporterTest::debugFlag() { - std::ostringstream out; + Containers::String out; Debug{&out} << ImporterFlag::Verbose << ImporterFlag(0xf0); - CORRADE_COMPARE(out.str(), "Trade::ImporterFlag::Verbose Trade::ImporterFlag(0xf0)\n"); + CORRADE_COMPARE(out, "Trade::ImporterFlag::Verbose Trade::ImporterFlag(0xf0)\n"); } void AbstractImporterTest::debugFlags() { - std::ostringstream out; + Containers::String out; Debug{&out} << (ImporterFlag::Verbose|ImporterFlag(0xf0)) << ImporterFlags{}; - CORRADE_COMPARE(out.str(), "Trade::ImporterFlag::Verbose|Trade::ImporterFlag(0xf0) Trade::ImporterFlags{}\n"); + CORRADE_COMPARE(out, "Trade::ImporterFlag::Verbose|Trade::ImporterFlag(0xf0) Trade::ImporterFlags{}\n"); } }}}} diff --git a/src/Magnum/Trade/Test/AbstractSceneConverterTest.cpp b/src/Magnum/Trade/Test/AbstractSceneConverterTest.cpp index 565e6b8da..c47aa444e 100644 --- a/src/Magnum/Trade/Test/AbstractSceneConverterTest.cpp +++ b/src/Magnum/Trade/Test/AbstractSceneConverterTest.cpp @@ -24,18 +24,14 @@ DEALINGS IN THE SOFTWARE. */ -#include #include -#include -#include /** @todo remove once Debug is stream-free */ #include +#include #include #include #include #include -#include #include -#include /** @todo remove once Debug is stream-free */ #include #include "Magnum/ImageView.h" @@ -945,10 +941,10 @@ void AbstractSceneConverterTest::sceneContentsForImporterNotOpened() { void doClose() override {} } importer; - std::ostringstream out; + Containers::String out; Error redirectError{&out}; sceneContentsFor(importer); - CORRADE_COMPARE(out.str(), "Trade::sceneContentsFor(): the importer is not opened\n"); + CORRADE_COMPARE(out, "Trade::sceneContentsFor(): the importer is not opened\n"); } void AbstractSceneConverterTest::sceneContentsForConverterNone() { @@ -1017,10 +1013,10 @@ void AbstractSceneConverterTest::featuresNone() { SceneConverterFeatures doFeatures() const override { return {}; } } converter; - std::ostringstream out; + Containers::String out; Error redirectError{&out}; converter.features(); - CORRADE_COMPARE(out.str(), "Trade::AbstractSceneConverter::features(): implementation reported no features\n"); + CORRADE_COMPARE(out, "Trade::AbstractSceneConverter::features(): implementation reported no features\n"); } void AbstractSceneConverterTest::setFlags() { @@ -1086,7 +1082,7 @@ void AbstractSceneConverterTest::thingNotSupported() { ImageData3D image3D{PixelFormat::RGBA8Unorm, {1, 1, 1}, DataFlags{}, imageData}; ImageData3D compressedImage3D{CompressedPixelFormat::Astc4x4RGBAF, {1, 1, 1}, DataFlags{}, imageData}; - std::ostringstream out; + Containers::String out; Error redirectError{&out}; converter.convert(mesh); converter.convertInPlace(mesh); @@ -1132,7 +1128,7 @@ void AbstractSceneConverterTest::thingNotSupported() { converter.add({image3D, image3D}); converter.add({compressedImage3D, compressedImage3D}); - CORRADE_COMPARE_AS(out.str(), + CORRADE_COMPARE_AS(out, "Trade::AbstractSceneConverter::convert(): mesh conversion not supported\n" "Trade::AbstractSceneConverter::convertInPlace(): mesh conversion not supported\n" "Trade::AbstractSceneConverter::convertToData(): mesh conversion not supported\n" @@ -1205,7 +1201,7 @@ void AbstractSceneConverterTest::thingLevelsNotSupported() { ImageData3D image3D{PixelFormat::RGBA8Unorm, {1, 1, 1}, DataFlags{}, imageData}; ImageData3D compressedImage3D{CompressedPixelFormat::Astc4x4RGBAF, {1, 1, 1}, DataFlags{}, imageData}; - std::ostringstream out; + Containers::String out; Error redirectError{&out}; converter.add({mesh, mesh}); converter.add({image1D, image1D}); @@ -1214,7 +1210,7 @@ void AbstractSceneConverterTest::thingLevelsNotSupported() { converter.add({compressedImage2D, compressedImage2D}); converter.add({image3D, image3D}); converter.add({compressedImage3D, compressedImage3D}); - CORRADE_COMPARE(out.str(), + CORRADE_COMPARE(out, "Trade::AbstractSceneConverter::add(): multi-level mesh conversion not supported\n" "Trade::AbstractSceneConverter::add(): multi-level 1D image conversion not supported\n" "Trade::AbstractSceneConverter::add(): multi-level compressed 1D image conversion not supported\n" @@ -1254,10 +1250,10 @@ void AbstractSceneConverterTest::convertMeshFailed() { } converter; /* The implementation is expected to print an error message on its own */ - std::ostringstream out; + Containers::String out; Error redirectError{&out}; CORRADE_VERIFY(!converter.convert(MeshData{MeshPrimitive::Triangles, 0})); - CORRADE_COMPARE(out.str(), ""); + CORRADE_COMPARE(out, ""); } void AbstractSceneConverterTest::convertMeshNotImplemented() { @@ -1267,10 +1263,10 @@ void AbstractSceneConverterTest::convertMeshNotImplemented() { SceneConverterFeatures doFeatures() const override { return SceneConverterFeature::ConvertMesh; } } converter; - std::ostringstream out; + Containers::String out; Error redirectError{&out}; converter.convert(MeshData{MeshPrimitive::Triangles, 6}); - CORRADE_COMPARE(out.str(), "Trade::AbstractSceneConverter::convert(): mesh conversion advertised but not implemented\n"); + CORRADE_COMPARE(out, "Trade::AbstractSceneConverter::convert(): mesh conversion advertised but not implemented\n"); } void AbstractSceneConverterTest::convertMeshNonOwningDeleters() { @@ -1337,10 +1333,10 @@ void AbstractSceneConverterTest::convertMeshCustomIndexDataDeleter() { char data[1]; } converter; - std::ostringstream out; + Containers::String out; Error redirectError{&out}; converter.convert(MeshData{MeshPrimitive::Triangles, 6}); - CORRADE_COMPARE(out.str(), + CORRADE_COMPARE(out, "Trade::AbstractSceneConverter::convert(): implementation is not allowed to use a custom Array deleter\n"); } @@ -1357,10 +1353,10 @@ void AbstractSceneConverterTest::convertMeshCustomVertexDataDeleter() { char data[1]; } converter; - std::ostringstream out; + Containers::String out; Error redirectError{&out}; converter.convert(MeshData{MeshPrimitive::Triangles, 6}); - CORRADE_COMPARE(out.str(), + CORRADE_COMPARE(out, "Trade::AbstractSceneConverter::convert(): implementation is not allowed to use a custom Array deleter\n"); } @@ -1377,10 +1373,10 @@ void AbstractSceneConverterTest::convertMeshCustomAttributeDataDeleter() { char data[1]; } converter; - std::ostringstream out; + Containers::String out; Error redirectError{&out}; converter.convert(MeshData{MeshPrimitive::Triangles, 6}); - CORRADE_COMPARE(out.str(), + CORRADE_COMPARE(out, "Trade::AbstractSceneConverter::convert(): implementation is not allowed to use a custom Array deleter\n"); } @@ -1419,10 +1415,10 @@ void AbstractSceneConverterTest::convertMeshInPlaceFailed() { MeshData mesh{MeshPrimitive::Triangles, 0}; /* The implementation is expected to print an error message on its own */ - std::ostringstream out; + Containers::String out; Error redirectError{&out}; CORRADE_VERIFY(!converter.convertInPlace(mesh)); - CORRADE_COMPARE(out.str(), ""); + CORRADE_COMPARE(out, ""); } void AbstractSceneConverterTest::convertMeshInPlaceNotImplemented() { @@ -1434,10 +1430,10 @@ void AbstractSceneConverterTest::convertMeshInPlaceNotImplemented() { MeshData mesh{MeshPrimitive::Triangles, 3}; - std::ostringstream out; + Containers::String out; Error redirectError{&out}; converter.convertInPlace(mesh); - CORRADE_COMPARE(out.str(), "Trade::AbstractSceneConverter::convertInPlace(): mesh conversion advertised but not implemented\n"); + CORRADE_COMPARE(out, "Trade::AbstractSceneConverter::convertInPlace(): mesh conversion advertised but not implemented\n"); } void AbstractSceneConverterTest::convertMeshToData() { @@ -1466,10 +1462,10 @@ void AbstractSceneConverterTest::convertMeshToDataFailed() { } converter; /* The implementation is expected to print an error message on its own */ - std::ostringstream out; + Containers::String out; Error redirectError{&out}; CORRADE_VERIFY(!converter.convertToData(MeshData{MeshPrimitive::Triangles, 0})); - CORRADE_COMPARE(out.str(), ""); + CORRADE_COMPARE(out, ""); } void AbstractSceneConverterTest::convertMeshToDataThroughBatch() { @@ -1529,11 +1525,11 @@ void AbstractSceneConverterTest::convertMeshToDataThroughBatchAddFailed() { } converter; /* The implementation is expected to print an error message on its own */ - std::ostringstream out; + Containers::String out; Error redirectError{&out}; CORRADE_VERIFY(!converter.convertToData(MeshData{MeshPrimitive::Triangles, 6})); CORRADE_VERIFY(!converter.isConverting()); - CORRADE_COMPARE(out.str(), ""); + CORRADE_COMPARE(out, ""); } void AbstractSceneConverterTest::convertMeshToDataThroughBatchEndFailed() { @@ -1555,11 +1551,11 @@ void AbstractSceneConverterTest::convertMeshToDataThroughBatchEndFailed() { } converter; /* The implementation is expected to print an error message on its own */ - std::ostringstream out; + Containers::String out; Error redirectError{&out}; CORRADE_VERIFY(!converter.convertToData(MeshData{MeshPrimitive::Triangles, 6})); CORRADE_VERIFY(!converter.isConverting()); - CORRADE_COMPARE(out.str(), ""); + CORRADE_COMPARE(out, ""); } void AbstractSceneConverterTest::convertMeshToDataNotImplemented() { @@ -1569,10 +1565,10 @@ void AbstractSceneConverterTest::convertMeshToDataNotImplemented() { SceneConverterFeatures doFeatures() const override { return SceneConverterFeature::ConvertMeshToData; } } converter; - std::ostringstream out; + Containers::String out; Error redirectError{&out}; converter.convertToData(MeshData{MeshPrimitive::Triangles, 6}); - CORRADE_COMPARE(out.str(), "Trade::AbstractSceneConverter::convertToData(): mesh conversion advertised but not implemented\n"); + CORRADE_COMPARE(out, "Trade::AbstractSceneConverter::convertToData(): mesh conversion advertised but not implemented\n"); } void AbstractSceneConverterTest::convertMeshToDataNonOwningDeleter() { @@ -1626,10 +1622,10 @@ void AbstractSceneConverterTest::convertMeshToDataCustomDeleter() { char data[1]; } converter; - std::ostringstream out; + Containers::String out; Error redirectError{&out}; converter.convertToData(MeshData{MeshPrimitive::Triangles, 6}); - CORRADE_COMPARE(out.str(), "Trade::AbstractSceneConverter::convertToData(): implementation is not allowed to use a custom Array deleter\n"); + CORRADE_COMPARE(out, "Trade::AbstractSceneConverter::convertToData(): implementation is not allowed to use a custom Array deleter\n"); } void AbstractSceneConverterTest::convertMeshToFile() { @@ -1663,10 +1659,10 @@ void AbstractSceneConverterTest::convertMeshToFileFailed() { } converter; /* The implementation is expected to print an error message on its own */ - std::ostringstream out; + Containers::String out; Error redirectError{&out}; CORRADE_VERIFY(!converter.convertToFile(MeshData{MeshPrimitive::Triangles, 0}, Utility::Path::join(TRADE_TEST_OUTPUT_DIR, "mesh.out"))); - CORRADE_COMPARE(out.str(), ""); + CORRADE_COMPARE(out, ""); } void AbstractSceneConverterTest::convertMeshToFileThroughData() { @@ -1705,11 +1701,11 @@ void AbstractSceneConverterTest::convertMeshToFileThroughDataFailed() { /* Function should fail, no file should get written and no error output should be printed (the base implementation assumes the plugin does it) */ - std::ostringstream out; + Containers::String out; Error redirectError{&out}; CORRADE_VERIFY(!converter.convertToFile(MeshData{MeshPrimitive::Triangles, 0xef}, filename)); CORRADE_VERIFY(!Utility::Path::exists(filename)); - CORRADE_COMPARE(out.str(), ""); + CORRADE_COMPARE(out, ""); } void AbstractSceneConverterTest::convertMeshToFileThroughDataNotWritable() { @@ -1721,11 +1717,11 @@ void AbstractSceneConverterTest::convertMeshToFileThroughDataNotWritable() { } } converter; - std::ostringstream out; + Containers::String out; Error redirectError{&out}; CORRADE_VERIFY(!converter.convertToFile(MeshData{MeshPrimitive::Triangles, 0xef}, "/some/path/that/does/not/exist")); /* There's an error from Path::write() before */ - CORRADE_COMPARE_AS(out.str(), + CORRADE_COMPARE_AS(out, "\nTrade::AbstractSceneConverter::convertToFile(): cannot write to file /some/path/that/does/not/exist\n", TestSuite::Compare::StringHasSuffix); } @@ -1794,11 +1790,11 @@ void AbstractSceneConverterTest::convertMeshToFileThroughBatchAddFailed() { } converter; /* The implementation is expected to print an error message on its own */ - std::ostringstream out; + Containers::String out; Error redirectError{&out}; CORRADE_VERIFY(!converter.convertToFile(MeshData{MeshPrimitive::Triangles, 0xfc}, Utility::Path::join(TRADE_TEST_OUTPUT_DIR, "mesh.out"))); CORRADE_VERIFY(!converter.isConverting()); - CORRADE_COMPARE(out.str(), ""); + CORRADE_COMPARE(out, ""); } void AbstractSceneConverterTest::convertMeshToFileThroughBatchEndFailed() { @@ -1820,11 +1816,11 @@ void AbstractSceneConverterTest::convertMeshToFileThroughBatchEndFailed() { } converter; /* The implementation is expected to print an error message on its own */ - std::ostringstream out; + Containers::String out; Error redirectError{&out}; CORRADE_VERIFY(!converter.convertToFile(MeshData{MeshPrimitive::Triangles, 0xfc}, Utility::Path::join(TRADE_TEST_OUTPUT_DIR, "mesh.out"))); CORRADE_VERIFY(!converter.isConverting()); - CORRADE_COMPARE(out.str(), ""); + CORRADE_COMPARE(out, ""); } void AbstractSceneConverterTest::convertMeshToFileNotImplemented() { @@ -1834,10 +1830,10 @@ void AbstractSceneConverterTest::convertMeshToFileNotImplemented() { SceneConverterFeatures doFeatures() const override { return SceneConverterFeature::ConvertMeshToFile; } } converter; - std::ostringstream out; + Containers::String out; Error redirectError{&out}; converter.convertToFile(MeshData{MeshPrimitive::Triangles, 6}, Utility::Path::join(TRADE_TEST_OUTPUT_DIR, "mesh.out")); - CORRADE_COMPARE(out.str(), "Trade::AbstractSceneConverter::convertToFile(): mesh conversion advertised but not implemented\n"); + CORRADE_COMPARE(out, "Trade::AbstractSceneConverter::convertToFile(): mesh conversion advertised but not implemented\n"); } void AbstractSceneConverterTest::beginEnd() { @@ -1895,10 +1891,10 @@ void AbstractSceneConverterTest::beginFailed() { } converter; /* The implementation is expected to print an error message on its own */ - std::ostringstream out; + Containers::String out; Error redirectError{&out}; CORRADE_VERIFY(!converter.begin()); - CORRADE_COMPARE(out.str(), ""); + CORRADE_COMPARE(out, ""); CORRADE_VERIFY(!converter.isConverting()); } @@ -1919,10 +1915,10 @@ void AbstractSceneConverterTest::endFailed() { CORRADE_VERIFY(converter.begin()); /* The implementation is expected to print an error message on its own */ - std::ostringstream out; + Containers::String out; Error redirectError{&out}; CORRADE_VERIFY(!converter.end()); - CORRADE_COMPARE(out.str(), ""); + CORRADE_COMPARE(out, ""); CORRADE_VERIFY(!converter.isConverting()); } @@ -1936,10 +1932,10 @@ void AbstractSceneConverterTest::beginNotImplemented() { } } converter; - std::ostringstream out; + Containers::String out; Error redirectError{&out}; converter.begin(); - CORRADE_COMPARE(out.str(), + CORRADE_COMPARE(out, "Trade::AbstractSceneConverter::begin(): feature advertised but not implemented\n"); } @@ -1956,10 +1952,10 @@ void AbstractSceneConverterTest::endNotImplemented() { CORRADE_VERIFY(converter.begin()); - std::ostringstream out; + Containers::String out; Error redirectError{&out}; converter.end(); - CORRADE_COMPARE(out.str(), + CORRADE_COMPARE(out, "Trade::AbstractSceneConverter::end(): feature advertised but not implemented\n"); } @@ -2009,10 +2005,10 @@ void AbstractSceneConverterTest::beginDataFailed() { } converter; /* The implementation is expected to print an error message on its own */ - std::ostringstream out; + Containers::String out; Error redirectError{&out}; CORRADE_VERIFY(!converter.beginData()); - CORRADE_COMPARE(out.str(), ""); + CORRADE_COMPARE(out, ""); CORRADE_VERIFY(!converter.isConverting()); } @@ -2033,10 +2029,10 @@ void AbstractSceneConverterTest::endDataFailed() { CORRADE_VERIFY(converter.beginData()); /* The implementation is expected to print an error message on its own */ - std::ostringstream out; + Containers::String out; Error redirectError{&out}; CORRADE_VERIFY(!converter.endData()); - CORRADE_COMPARE(out.str(), ""); + CORRADE_COMPARE(out, ""); CORRADE_VERIFY(!converter.isConverting()); } @@ -2050,10 +2046,10 @@ void AbstractSceneConverterTest::beginDataNotImplemented() { } } converter; - std::ostringstream out; + Containers::String out; Error redirectError{&out}; converter.beginData(); - CORRADE_COMPARE(out.str(), + CORRADE_COMPARE(out, "Trade::AbstractSceneConverter::beginData(): feature advertised but not implemented\n"); } @@ -2070,10 +2066,10 @@ void AbstractSceneConverterTest::endDataNotImplemented() { CORRADE_VERIFY(converter.beginData()); - std::ostringstream out; + Containers::String out; Error redirectError{&out}; converter.endData(); - CORRADE_COMPARE(out.str(), + CORRADE_COMPARE(out, "Trade::AbstractSceneConverter::endData(): feature advertised but not implemented\n"); } @@ -2096,10 +2092,10 @@ void AbstractSceneConverterTest::beginEndDataCustomDeleter() { CORRADE_VERIFY(converter.beginData()); - std::ostringstream out; + Containers::String out; Error redirectError{&out}; converter.endData(); - CORRADE_COMPARE(out.str(), "Trade::AbstractSceneConverter::endData(): implementation is not allowed to use a custom Array deleter\n"); + CORRADE_COMPARE(out, "Trade::AbstractSceneConverter::endData(): implementation is not allowed to use a custom Array deleter\n"); } void AbstractSceneConverterTest::beginEndFile() { @@ -2151,10 +2147,10 @@ void AbstractSceneConverterTest::beginFileFailed() { } converter; /* The implementation is expected to print an error message on its own */ - std::ostringstream out; + Containers::String out; Error redirectError{&out}; CORRADE_VERIFY(!converter.beginFile("file.gltf")); - CORRADE_COMPARE(out.str(), ""); + CORRADE_COMPARE(out, ""); CORRADE_VERIFY(!converter.isConverting()); } @@ -2173,10 +2169,10 @@ void AbstractSceneConverterTest::endFileFailed() { CORRADE_VERIFY(converter.beginFile("file.gltf")); /* The implementation is expected to print an error message on its own */ - std::ostringstream out; + Containers::String out; Error redirectError{&out}; CORRADE_VERIFY(!converter.endFile()); - CORRADE_COMPARE(out.str(), ""); + CORRADE_COMPARE(out, ""); CORRADE_VERIFY(!converter.isConverting()); } @@ -2229,12 +2225,12 @@ void AbstractSceneConverterTest::beginEndFileThroughDataFailed() { /* Function should fail, no file should get written and no error output should be printed (the base implementation assumes the plugin does it) */ - std::ostringstream out; + Containers::String out; Error redirectError{&out}; CORRADE_VERIFY(!converter.endFile()); CORRADE_VERIFY(!converter.isConverting()); CORRADE_VERIFY(!Utility::Path::exists(filename)); - CORRADE_COMPARE(out.str(), ""); + CORRADE_COMPARE(out, ""); } void AbstractSceneConverterTest::beginEndFileThroughDataNotWritable() { @@ -2254,12 +2250,12 @@ void AbstractSceneConverterTest::beginEndFileThroughDataNotWritable() { /* Function should fail, no file should get written and no error output should be printed (the base implementation assumes the plugin does it) */ - std::ostringstream out; + Containers::String out; Error redirectError{&out}; CORRADE_VERIFY(!converter.endFile()); CORRADE_VERIFY(!converter.isConverting()); /* There's an error from Path::write() before */ - CORRADE_COMPARE_AS(out.str(), + CORRADE_COMPARE_AS(out, "\nTrade::AbstractSceneConverter::endFile(): cannot write to file /some/path/that/does/not/exist\n", TestSuite::Compare::StringHasSuffix); } @@ -2273,10 +2269,10 @@ void AbstractSceneConverterTest::beginFileNotImplemented() { } } converter; - std::ostringstream out; + Containers::String out; Error redirectError{&out}; converter.beginFile("file.gltf"); - CORRADE_COMPARE(out.str(), "Trade::AbstractSceneConverter::beginFile(): feature advertised but not implemented\n"); + CORRADE_COMPARE(out, "Trade::AbstractSceneConverter::beginFile(): feature advertised but not implemented\n"); } void AbstractSceneConverterTest::endFileNotImplemented() { @@ -2292,10 +2288,10 @@ void AbstractSceneConverterTest::endFileNotImplemented() { CORRADE_VERIFY(converter.beginFile("file.gltf")); - std::ostringstream out; + Containers::String out; Error redirectError{&out}; converter.endFile(); - CORRADE_COMPARE(out.str(), "Trade::AbstractSceneConverter::endFile(): feature advertised but not implemented\n"); + CORRADE_COMPARE(out, "Trade::AbstractSceneConverter::endFile(): feature advertised but not implemented\n"); } void AbstractSceneConverterTest::abort() { @@ -2596,7 +2592,7 @@ void AbstractSceneConverterTest::thingNoBegin() { bool doBeginData() override { return true; } } converter; - std::ostringstream out; + Containers::String out; Error redirectError{&out}; converter.end(); converter.endData(); @@ -2653,7 +2649,7 @@ void AbstractSceneConverterTest::thingNoBegin() { converter.add({ImageData3D{PixelFormat::RGBA8Unorm, {1, 1, 1}, DataFlags{}, imageData}, ImageData3D{PixelFormat::RGBA8Unorm, {1, 1, 1}, DataFlags{}, imageData}}); - CORRADE_COMPARE(out.str(), + CORRADE_COMPARE(out, "Trade::AbstractSceneConverter::end(): no conversion in progress\n" "Trade::AbstractSceneConverter::endData(): no data conversion in progress\n" "Trade::AbstractSceneConverter::endFile(): no file conversion in progress\n" @@ -2717,10 +2713,10 @@ void AbstractSceneConverterTest::endMismatchedBegin() { CORRADE_VERIFY(converter.beginData()); - std::ostringstream out; + Containers::String out; Error redirectError{&out}; converter.end(); - CORRADE_COMPARE(out.str(), "Trade::AbstractSceneConverter::end(): no conversion in progress\n"); + CORRADE_COMPARE(out, "Trade::AbstractSceneConverter::end(): no conversion in progress\n"); } void AbstractSceneConverterTest::endDataMismatchedBegin() { @@ -2736,10 +2732,10 @@ void AbstractSceneConverterTest::endDataMismatchedBegin() { CORRADE_VERIFY(converter.begin()); - std::ostringstream out; + Containers::String out; Error redirectError{&out}; converter.endData(); - CORRADE_COMPARE(out.str(), "Trade::AbstractSceneConverter::endData(): no data conversion in progress\n"); + CORRADE_COMPARE(out, "Trade::AbstractSceneConverter::endData(): no data conversion in progress\n"); } void AbstractSceneConverterTest::endFileMismatchedBegin() { @@ -2755,10 +2751,10 @@ void AbstractSceneConverterTest::endFileMismatchedBegin() { CORRADE_VERIFY(converter.begin()); - std::ostringstream out; + Containers::String out; Error redirectError{&out}; converter.endFile(); - CORRADE_COMPARE(out.str(), "Trade::AbstractSceneConverter::endFile(): no file conversion in progress\n"); + CORRADE_COMPARE(out, "Trade::AbstractSceneConverter::endFile(): no file conversion in progress\n"); } void AbstractSceneConverterTest::addScene() { @@ -2813,10 +2809,10 @@ void AbstractSceneConverterTest::addSceneFailed() { /* The implementation is expected to print an error message on its own */ { - std::ostringstream out; + Containers::String out; Error redirectError{&out}; CORRADE_VERIFY(!converter.add(SceneData{SceneMappingType::UnsignedInt, 0, nullptr, nullptr})); - CORRADE_COMPARE(out.str(), ""); + CORRADE_COMPARE(out, ""); } /* It shouldn't abort the whole process */ @@ -2838,10 +2834,10 @@ void AbstractSceneConverterTest::addSceneNotImplemented() { CORRADE_VERIFY(converter.begin()); - std::ostringstream out; + Containers::String out; Error redirectError{&out}; converter.add(SceneData{SceneMappingType::UnsignedInt, 0, nullptr, nullptr}); - CORRADE_COMPARE(out.str(), "Trade::AbstractSceneConverter::add(): scene conversion advertised but not implemented\n"); + CORRADE_COMPARE(out, "Trade::AbstractSceneConverter::add(): scene conversion advertised but not implemented\n"); } void AbstractSceneConverterTest::setSceneFieldName() { @@ -2899,10 +2895,10 @@ void AbstractSceneConverterTest::setSceneFieldNameNotCustom() { CORRADE_VERIFY(converter.begin()); - std::ostringstream out; + Containers::String out; Error redirectError{&out}; converter.setSceneFieldName(SceneField::Transformation, "hello!"); - CORRADE_COMPARE(out.str(), "Trade::AbstractSceneConverter::setSceneFieldName(): Trade::SceneField::Transformation is not custom\n"); + CORRADE_COMPARE(out, "Trade::AbstractSceneConverter::setSceneFieldName(): Trade::SceneField::Transformation is not custom\n"); } void AbstractSceneConverterTest::setObjectName() { @@ -3021,10 +3017,10 @@ void AbstractSceneConverterTest::setDefaultSceneOutOfRange() { CORRADE_VERIFY(converter.add(SceneData{SceneMappingType::UnsignedInt, 0, nullptr, nullptr})); CORRADE_COMPARE(converter.sceneCount(), 2); - std::ostringstream out; + Containers::String out; Error redirectError{&out}; converter.setDefaultScene(2); - CORRADE_COMPARE(out.str(), "Trade::AbstractSceneConverter::setDefaultScene(): index 2 out of range for 2 scenes\n"); + CORRADE_COMPARE(out, "Trade::AbstractSceneConverter::setDefaultScene(): index 2 out of range for 2 scenes\n"); } void AbstractSceneConverterTest::addAnimation() { @@ -3079,10 +3075,10 @@ void AbstractSceneConverterTest::addAnimationFailed() { /* The implementation is expected to print an error message on its own */ { - std::ostringstream out; + Containers::String out; Error redirectError{&out}; CORRADE_VERIFY(!converter.add(AnimationData{nullptr, nullptr})); - CORRADE_COMPARE(out.str(), ""); + CORRADE_COMPARE(out, ""); } /* It shouldn't abort the whole process */ @@ -3104,10 +3100,10 @@ void AbstractSceneConverterTest::addAnimationNotImplemented() { CORRADE_VERIFY(converter.begin()); - std::ostringstream out; + Containers::String out; Error redirectError{&out}; converter.add(AnimationData{nullptr, nullptr}); - CORRADE_COMPARE(out.str(), "Trade::AbstractSceneConverter::add(): animation conversion advertised but not implemented\n"); + CORRADE_COMPARE(out, "Trade::AbstractSceneConverter::add(): animation conversion advertised but not implemented\n"); } void AbstractSceneConverterTest::setAnimationTrackTargetName() { @@ -3165,10 +3161,10 @@ void AbstractSceneConverterTest::setAnimationTrackTargetNameNotCustom() { CORRADE_VERIFY(converter.begin()); - std::ostringstream out; + Containers::String out; Error redirectError{&out}; converter.setAnimationTrackTargetName(AnimationTrackTarget::Scaling2D, "hello!"); - CORRADE_COMPARE(out.str(), "Trade::AbstractSceneConverter::setAnimationTrackTargetName(): Trade::AnimationTrackTarget::Scaling2D is not custom\n"); + CORRADE_COMPARE(out, "Trade::AbstractSceneConverter::setAnimationTrackTargetName(): Trade::AnimationTrackTarget::Scaling2D is not custom\n"); } void AbstractSceneConverterTest::addLight() { @@ -3223,10 +3219,10 @@ void AbstractSceneConverterTest::addLightFailed() { /* The implementation is expected to print an error message on its own */ { - std::ostringstream out; + Containers::String out; Error redirectError{&out}; CORRADE_VERIFY(!converter.add(LightData{LightType::Point, {}, 0.0f})); - CORRADE_COMPARE(out.str(), ""); + CORRADE_COMPARE(out, ""); } /* It shouldn't abort the whole process */ @@ -3248,10 +3244,10 @@ void AbstractSceneConverterTest::addLightNotImplemented() { CORRADE_VERIFY(converter.begin()); - std::ostringstream out; + Containers::String out; Error redirectError{&out}; converter.add(LightData{LightType::Point, {}, 0.0f}); - CORRADE_COMPARE(out.str(), "Trade::AbstractSceneConverter::add(): light conversion advertised but not implemented\n"); + CORRADE_COMPARE(out, "Trade::AbstractSceneConverter::add(): light conversion advertised but not implemented\n"); } void AbstractSceneConverterTest::addCamera() { @@ -3306,10 +3302,10 @@ void AbstractSceneConverterTest::addCameraFailed() { /* The implementation is expected to print an error message on its own */ { - std::ostringstream out; + Containers::String out; Error redirectError{&out}; CORRADE_VERIFY(!converter.add(CameraData{CameraType::Orthographic3D, {}, 0.0f, 1.0f})); - CORRADE_COMPARE(out.str(), ""); + CORRADE_COMPARE(out, ""); } /* It shouldn't abort the whole process */ @@ -3331,10 +3327,10 @@ void AbstractSceneConverterTest::addCameraNotImplemented() { CORRADE_VERIFY(converter.begin()); - std::ostringstream out; + Containers::String out; Error redirectError{&out}; converter.add(CameraData{CameraType::Orthographic3D, {}, 0.0f, 1.0f}); - CORRADE_COMPARE(out.str(), "Trade::AbstractSceneConverter::add(): camera conversion advertised but not implemented\n"); + CORRADE_COMPARE(out, "Trade::AbstractSceneConverter::add(): camera conversion advertised but not implemented\n"); } void AbstractSceneConverterTest::addSkin2D() { @@ -3389,10 +3385,10 @@ void AbstractSceneConverterTest::addSkin2DFailed() { /* The implementation is expected to print an error message on its own */ { - std::ostringstream out; + Containers::String out; Error redirectError{&out}; CORRADE_VERIFY(!converter.add(SkinData2D{nullptr, nullptr})); - CORRADE_COMPARE(out.str(), ""); + CORRADE_COMPARE(out, ""); } /* It shouldn't abort the whole process */ @@ -3414,10 +3410,10 @@ void AbstractSceneConverterTest::addSkin2DNotImplemented() { CORRADE_VERIFY(converter.begin()); - std::ostringstream out; + Containers::String out; Error redirectError{&out}; converter.add(SkinData2D{nullptr, nullptr}); - CORRADE_COMPARE(out.str(), "Trade::AbstractSceneConverter::add(): 2D skin conversion advertised but not implemented\n"); + CORRADE_COMPARE(out, "Trade::AbstractSceneConverter::add(): 2D skin conversion advertised but not implemented\n"); } void AbstractSceneConverterTest::addSkin3D() { @@ -3472,10 +3468,10 @@ void AbstractSceneConverterTest::addSkin3DFailed() { /* The implementation is expected to print an error message on its own */ { - std::ostringstream out; + Containers::String out; Error redirectError{&out}; CORRADE_VERIFY(!converter.add(SkinData3D{nullptr, nullptr})); - CORRADE_COMPARE(out.str(), ""); + CORRADE_COMPARE(out, ""); } /* It shouldn't abort the whole process */ @@ -3497,10 +3493,10 @@ void AbstractSceneConverterTest::addSkin3DNotImplemented() { CORRADE_VERIFY(converter.begin()); - std::ostringstream out; + Containers::String out; Error redirectError{&out}; converter.add(SkinData3D{nullptr, nullptr}); - CORRADE_COMPARE(out.str(), "Trade::AbstractSceneConverter::add(): 3D skin conversion advertised but not implemented\n"); + CORRADE_COMPARE(out, "Trade::AbstractSceneConverter::add(): 3D skin conversion advertised but not implemented\n"); } void AbstractSceneConverterTest::addMesh() { @@ -3555,10 +3551,10 @@ void AbstractSceneConverterTest::addMeshFailed() { /* The implementation is expected to print an error message on its own */ { - std::ostringstream out; + Containers::String out; Error redirectError{&out}; CORRADE_VERIFY(!converter.add(MeshData{MeshPrimitive::Triangles, 0})); - CORRADE_COMPARE(out.str(), ""); + CORRADE_COMPARE(out, ""); } /* It shouldn't abort the whole process */ @@ -3615,10 +3611,10 @@ void AbstractSceneConverterTest::addMeshThroughConvertMesh() { /* The mesh is returned only once, second time it will fail (but just an error, not an assert */ { - std::ostringstream out; + Containers::String out; Error redirectError{&out}; CORRADE_VERIFY(!importer->mesh(0)); - CORRADE_COMPARE(out.str(), "Trade::AbstractSceneConverter::end(): mesh can be retrieved only once from a converter with just Trade::SceneConverterFeature::ConvertMesh\n"); + CORRADE_COMPARE(out, "Trade::AbstractSceneConverter::end(): mesh can be retrieved only once from a converter with just Trade::SceneConverterFeature::ConvertMesh\n"); } /* Verify that it's also possible to close the importer without hitting @@ -3646,11 +3642,11 @@ void AbstractSceneConverterTest::addMeshThroughConvertMeshFailed() { CORRADE_COMPARE(converter.meshCount(), 0); /* But the observable behavior is as if no mesh was added */ - std::ostringstream out; + Containers::String out; Error redirectError{&out}; CORRADE_VERIFY(!converter.end()); CORRADE_VERIFY(!converter.isConverting()); - CORRADE_COMPARE(out.str(), "Trade::AbstractSceneConverter::end(): the converter requires exactly one mesh, got 0\n"); + CORRADE_COMPARE(out, "Trade::AbstractSceneConverter::end(): the converter requires exactly one mesh, got 0\n"); } void AbstractSceneConverterTest::addMeshThroughConvertMeshZeroMeshes() { @@ -3662,11 +3658,11 @@ void AbstractSceneConverterTest::addMeshThroughConvertMeshZeroMeshes() { CORRADE_VERIFY(converter.begin()); - std::ostringstream out; + Containers::String out; Error redirectError{&out}; CORRADE_VERIFY(!converter.end()); CORRADE_VERIFY(!converter.isConverting()); - CORRADE_COMPARE(out.str(), "Trade::AbstractSceneConverter::end(): the converter requires exactly one mesh, got 0\n"); + CORRADE_COMPARE(out, "Trade::AbstractSceneConverter::end(): the converter requires exactly one mesh, got 0\n"); } void AbstractSceneConverterTest::addMeshThroughConvertMeshTwoMeshes() { @@ -3687,13 +3683,13 @@ void AbstractSceneConverterTest::addMeshThroughConvertMeshTwoMeshes() { CORRADE_COMPARE(converter.meshCount(), 1); { - std::ostringstream out; + Containers::String out; Error redirectError{&out}; CORRADE_VERIFY(!converter.add(MeshData{MeshPrimitive::Triangles, 7})); /* It shouldn't abort the whole process */ CORRADE_VERIFY(converter.isConverting()); CORRADE_COMPARE(converter.meshCount(), 1); - CORRADE_COMPARE(out.str(), "Trade::AbstractSceneConverter::add(): the converter requires exactly one mesh, got 2\n"); + CORRADE_COMPARE(out, "Trade::AbstractSceneConverter::add(): the converter requires exactly one mesh, got 2\n"); } /* Getting the result should still work */ @@ -3765,11 +3761,11 @@ void AbstractSceneConverterTest::addMeshThroughConvertMeshToDataFailed() { CORRADE_COMPARE(converter.meshCount(), 0); /* But the observable behavior is as if no mesh was added */ - std::ostringstream out; + Containers::String out; Error redirectError{&out}; CORRADE_VERIFY(!converter.endData()); CORRADE_VERIFY(!converter.isConverting()); - CORRADE_COMPARE(out.str(), "Trade::AbstractSceneConverter::endData(): the converter requires exactly one mesh, got 0\n"); + CORRADE_COMPARE(out, "Trade::AbstractSceneConverter::endData(): the converter requires exactly one mesh, got 0\n"); } void AbstractSceneConverterTest::addMeshThroughConvertMeshToDataZeroMeshes() { @@ -3781,11 +3777,11 @@ void AbstractSceneConverterTest::addMeshThroughConvertMeshToDataZeroMeshes() { CORRADE_VERIFY(converter.beginData()); - std::ostringstream out; + Containers::String out; Error redirectError{&out}; CORRADE_VERIFY(!converter.endData()); CORRADE_VERIFY(!converter.isConverting()); - CORRADE_COMPARE(out.str(), "Trade::AbstractSceneConverter::endData(): the converter requires exactly one mesh, got 0\n"); + CORRADE_COMPARE(out, "Trade::AbstractSceneConverter::endData(): the converter requires exactly one mesh, got 0\n"); } void AbstractSceneConverterTest::addMeshThroughConvertMeshToDataTwoMeshes() { @@ -3806,13 +3802,13 @@ void AbstractSceneConverterTest::addMeshThroughConvertMeshToDataTwoMeshes() { CORRADE_COMPARE(converter.meshCount(), 1); { - std::ostringstream out; + Containers::String out; Error redirectError{&out}; CORRADE_VERIFY(!converter.add(MeshData{MeshPrimitive::Triangles, 7})); /* It shouldn't abort the whole process */ CORRADE_VERIFY(converter.isConverting()); CORRADE_COMPARE(converter.meshCount(), 1); - CORRADE_COMPARE(out.str(), "Trade::AbstractSceneConverter::add(): the converter requires exactly one mesh, got 2\n"); + CORRADE_COMPARE(out, "Trade::AbstractSceneConverter::add(): the converter requires exactly one mesh, got 2\n"); } /* Getting the result should still work */ @@ -3957,12 +3953,12 @@ void AbstractSceneConverterTest::addMeshThroughConvertMeshToFileFailed() { CORRADE_COMPARE(converter.meshCount(), 0); /* But the observable behavior is as if no mesh was added */ - std::ostringstream out; + Containers::String out; Error redirectError{&out}; CORRADE_VERIFY(!converter.endFile()); CORRADE_VERIFY(!converter.isConverting()); CORRADE_VERIFY(!Utility::Path::exists(filename)); - CORRADE_COMPARE(out.str(), "Trade::AbstractSceneConverter::endFile(): the converter requires exactly one mesh, got 0\n"); + CORRADE_COMPARE(out, "Trade::AbstractSceneConverter::endFile(): the converter requires exactly one mesh, got 0\n"); } void AbstractSceneConverterTest::addMeshThroughConvertMeshToFileZeroMeshes() { @@ -3980,12 +3976,12 @@ void AbstractSceneConverterTest::addMeshThroughConvertMeshToFileZeroMeshes() { CORRADE_VERIFY(converter.beginFile(filename)); CORRADE_VERIFY(!Utility::Path::exists(filename)); - std::ostringstream out; + Containers::String out; Error redirectError{&out}; CORRADE_VERIFY(!converter.endFile()); CORRADE_VERIFY(!converter.isConverting()); CORRADE_VERIFY(!Utility::Path::exists(filename)); - CORRADE_COMPARE(out.str(), "Trade::AbstractSceneConverter::endFile(): the converter requires exactly one mesh, got 0\n"); + CORRADE_COMPARE(out, "Trade::AbstractSceneConverter::endFile(): the converter requires exactly one mesh, got 0\n"); } void AbstractSceneConverterTest::addMeshThroughConvertMeshToFileTwoMeshes() { @@ -4017,13 +4013,13 @@ void AbstractSceneConverterTest::addMeshThroughConvertMeshToFileTwoMeshes() { CORRADE_VERIFY(Utility::Path::exists(filename)); { - std::ostringstream out; + Containers::String out; Error redirectError{&out}; CORRADE_VERIFY(!converter.add(MeshData{MeshPrimitive::Triangles, 0xb0})); /* It shouldn't abort the whole process */ CORRADE_VERIFY(converter.isConverting()); CORRADE_COMPARE(converter.meshCount(), 1); - CORRADE_COMPARE(out.str(), "Trade::AbstractSceneConverter::add(): the converter requires exactly one mesh, got 2\n"); + CORRADE_COMPARE(out, "Trade::AbstractSceneConverter::add(): the converter requires exactly one mesh, got 2\n"); } /* Getting the result should still work */ @@ -4048,10 +4044,10 @@ void AbstractSceneConverterTest::addMeshNotImplemented() { CORRADE_VERIFY(converter.begin()); - std::ostringstream out; + Containers::String out; Error redirectError{&out}; converter.add(MeshData{MeshPrimitive::Triangles, 0}); - CORRADE_COMPARE(out.str(), "Trade::AbstractSceneConverter::add(): mesh conversion advertised but not implemented\n"); + CORRADE_COMPARE(out, "Trade::AbstractSceneConverter::add(): mesh conversion advertised but not implemented\n"); } void AbstractSceneConverterTest::addMeshLevels() { @@ -4117,13 +4113,13 @@ void AbstractSceneConverterTest::addMeshLevelsFailed() { /* The implementation is expected to print an error message on its own */ { - std::ostringstream out; + Containers::String out; Error redirectError{&out}; CORRADE_VERIFY(!converter.add({ MeshData{MeshPrimitive::Triangles, 0}, MeshData{MeshPrimitive::Triangles, 0} })); - CORRADE_COMPARE(out.str(), ""); + CORRADE_COMPARE(out, ""); } /* It shouldn't abort the whole process */ @@ -4146,10 +4142,10 @@ void AbstractSceneConverterTest::addMeshLevelsNoLevels() { CORRADE_VERIFY(converter.begin()); - std::ostringstream out; + Containers::String out; Error redirectError{&out}; converter.add(Containers::Iterable{}); - CORRADE_COMPARE(out.str(), "Trade::AbstractSceneConverter::add(): at least one mesh level has to be specified\n"); + CORRADE_COMPARE(out, "Trade::AbstractSceneConverter::add(): at least one mesh level has to be specified\n"); } void AbstractSceneConverterTest::addMeshLevelsNotImplemented() { @@ -4167,13 +4163,13 @@ void AbstractSceneConverterTest::addMeshLevelsNotImplemented() { CORRADE_VERIFY(converter.begin()); - std::ostringstream out; + Containers::String out; Error redirectError{&out}; converter.add({ MeshData{MeshPrimitive::Triangles, 0}, MeshData{MeshPrimitive::Triangles, 0} }); - CORRADE_COMPARE(out.str(), "Trade::AbstractSceneConverter::add(): multi-level mesh conversion advertised but not implemented\n"); + CORRADE_COMPARE(out, "Trade::AbstractSceneConverter::add(): multi-level mesh conversion advertised but not implemented\n"); } void AbstractSceneConverterTest::addMeshThroughLevels() { @@ -4267,10 +4263,10 @@ void AbstractSceneConverterTest::setMeshAttributeNameNotCustom() { CORRADE_VERIFY(converter.begin()); - std::ostringstream out; + Containers::String out; Error redirectError{&out}; converter.setMeshAttributeName(MeshAttribute::ObjectId, "hello!"); - CORRADE_COMPARE(out.str(), "Trade::AbstractSceneConverter::setMeshAttributeName(): Trade::MeshAttribute::ObjectId is not custom\n"); + CORRADE_COMPARE(out, "Trade::AbstractSceneConverter::setMeshAttributeName(): Trade::MeshAttribute::ObjectId is not custom\n"); } void AbstractSceneConverterTest::addMaterial() { @@ -4325,10 +4321,10 @@ void AbstractSceneConverterTest::addMaterialFailed() { /* The implementation is expected to print an error message on its own */ { - std::ostringstream out; + Containers::String out; Error redirectError{&out}; CORRADE_VERIFY(!converter.add(MaterialData{{}, nullptr})); - CORRADE_COMPARE(out.str(), ""); + CORRADE_COMPARE(out, ""); } /* It shouldn't abort the whole process */ @@ -4350,10 +4346,10 @@ void AbstractSceneConverterTest::addMaterialNotImplemented() { CORRADE_VERIFY(converter.begin()); - std::ostringstream out; + Containers::String out; Error redirectError{&out}; converter.add(MaterialData{{}, nullptr}); - CORRADE_COMPARE(out.str(), "Trade::AbstractSceneConverter::add(): material conversion advertised but not implemented\n"); + CORRADE_COMPARE(out, "Trade::AbstractSceneConverter::add(): material conversion advertised but not implemented\n"); } void AbstractSceneConverterTest::addTexture() { @@ -4408,10 +4404,10 @@ void AbstractSceneConverterTest::addTextureFailed() { /* The implementation is expected to print an error message on its own */ { - std::ostringstream out; + Containers::String out; Error redirectError{&out}; CORRADE_VERIFY(!converter.add(TextureData{{}, {}, {}, {}, {}, 0})); - CORRADE_COMPARE(out.str(), ""); + CORRADE_COMPARE(out, ""); } /* It shouldn't abort the whole process */ @@ -4433,10 +4429,10 @@ void AbstractSceneConverterTest::addTextureNotImplemented() { CORRADE_VERIFY(converter.begin()); - std::ostringstream out; + Containers::String out; Error redirectError{&out}; converter.add(TextureData{{}, {}, {}, {}, {}, 0}); - CORRADE_COMPARE(out.str(), "Trade::AbstractSceneConverter::add(): texture conversion advertised but not implemented\n"); + CORRADE_COMPARE(out, "Trade::AbstractSceneConverter::add(): texture conversion advertised but not implemented\n"); } void AbstractSceneConverterTest::addImage1D() { @@ -4568,14 +4564,14 @@ void AbstractSceneConverterTest::addImage1DFailed() { /* The implementation is expected to print an error message on its own */ { - std::ostringstream out; + Containers::String out; Error redirectError{&out}; /* Testing all three variants to "fake" coverage for the name-less overloads as well */ CORRADE_VERIFY(!converter.add(ImageData1D{PixelFormat::RGBA8Unorm, 1, DataFlags{}, imageData})); CORRADE_VERIFY(!converter.add(ImageView1D{PixelFormat::RGBA8Unorm, 1, imageData})); CORRADE_VERIFY(!converter.add(CompressedImageView1D{CompressedPixelFormat::Astc4x4RGBAUnorm, 1, imageData})); - CORRADE_COMPARE(out.str(), ""); + CORRADE_COMPARE(out, ""); } /* It shouldn't abort the whole process */ @@ -4597,10 +4593,10 @@ void AbstractSceneConverterTest::addImage1DInvalidImage() { CORRADE_VERIFY(converter.begin()); - std::ostringstream out; + Containers::String out; Error redirectError{&out}; converter.add(ImageData1D{PixelFormat::RGBA8Unorm, {}, nullptr}); - CORRADE_COMPARE(out.str(), "Trade::AbstractSceneConverter::add(): can't add image with a zero size: Vector(0)\n"); + CORRADE_COMPARE(out, "Trade::AbstractSceneConverter::add(): can't add image with a zero size: Vector(0)\n"); } void AbstractSceneConverterTest::addImage1DNotImplemented() { @@ -4619,10 +4615,10 @@ void AbstractSceneConverterTest::addImage1DNotImplemented() { const char imageData[4]{}; - std::ostringstream out; + Containers::String out; Error redirectError{&out}; converter.add(ImageData1D{PixelFormat::RGBA8Unorm, 1, DataFlags{}, imageData}); - CORRADE_COMPARE(out.str(), "Trade::AbstractSceneConverter::add(): 1D image conversion advertised but not implemented\n"); + CORRADE_COMPARE(out, "Trade::AbstractSceneConverter::add(): 1D image conversion advertised but not implemented\n"); } void AbstractSceneConverterTest::addImage2D() { @@ -4756,14 +4752,14 @@ void AbstractSceneConverterTest::addImage2DFailed() { /* The implementation is expected to print an error message on its own */ { - std::ostringstream out; + Containers::String out; Error redirectError{&out}; /* Testing all three variants to "fake" coverage for the name-less overloads as well */ CORRADE_VERIFY(!converter.add(ImageData2D{PixelFormat::RGBA8Unorm, {1, 1}, DataFlags{}, imageData})); CORRADE_VERIFY(!converter.add(ImageView2D{PixelFormat::RGBA8Unorm, {1, 1}, imageData})); CORRADE_VERIFY(!converter.add(CompressedImageView2D{CompressedPixelFormat::Astc4x4RGBAUnorm, {1, 1}, imageData})); - CORRADE_COMPARE(out.str(), ""); + CORRADE_COMPARE(out, ""); } /* It shouldn't abort the whole process */ @@ -4787,10 +4783,10 @@ void AbstractSceneConverterTest::addImage2DZeroSize() { CORRADE_VERIFY(converter.begin()); - std::ostringstream out; + Containers::String out; Error redirectError{&out}; converter.add(ImageData2D{PixelFormat::RGBA8Unorm, {4, 0}, DataFlags{}, imageData}); - CORRADE_COMPARE(out.str(), "Trade::AbstractSceneConverter::add(): can't add image with a zero size: Vector(4, 0)\n"); + CORRADE_COMPARE(out, "Trade::AbstractSceneConverter::add(): can't add image with a zero size: Vector(4, 0)\n"); } void AbstractSceneConverterTest::addImage2DNullptr() { @@ -4807,10 +4803,10 @@ void AbstractSceneConverterTest::addImage2DNullptr() { CORRADE_VERIFY(converter.begin()); - std::ostringstream out; + Containers::String out; Error redirectError{&out}; converter.add(ImageData2D{PixelFormat::RGBA8Unorm, {1, 1}, DataFlags{}, {nullptr, 4}}); - CORRADE_COMPARE(out.str(), "Trade::AbstractSceneConverter::add(): can't add image with a nullptr view\n"); + CORRADE_COMPARE(out, "Trade::AbstractSceneConverter::add(): can't add image with a nullptr view\n"); } void AbstractSceneConverterTest::addImage2DNotImplemented() { @@ -4829,10 +4825,10 @@ void AbstractSceneConverterTest::addImage2DNotImplemented() { const char imageData[4]{}; - std::ostringstream out; + Containers::String out; Error redirectError{&out}; converter.add(ImageData2D{PixelFormat::RGBA8Unorm, {1, 1}, DataFlags{}, imageData}); - CORRADE_COMPARE(out.str(), "Trade::AbstractSceneConverter::add(): 2D image conversion advertised but not implemented\n"); + CORRADE_COMPARE(out, "Trade::AbstractSceneConverter::add(): 2D image conversion advertised but not implemented\n"); } void AbstractSceneConverterTest::addImage3D() { @@ -4966,14 +4962,14 @@ void AbstractSceneConverterTest::addImage3DFailed() { /* The implementation is expected to print an error message on its own */ { - std::ostringstream out; + Containers::String out; Error redirectError{&out}; /* Testing all three variants to "fake" coverage for the name-less overloads as well */ CORRADE_VERIFY(!converter.add(ImageData3D{PixelFormat::RGBA8Unorm, {1, 1, 1}, DataFlags{}, imageData})); CORRADE_VERIFY(!converter.add(ImageView3D{PixelFormat::RGBA8Unorm, {1, 1, 1}, imageData})); CORRADE_VERIFY(!converter.add(CompressedImageView3D{CompressedPixelFormat::Astc4x4RGBAUnorm, {1, 1, 1}, imageData})); - CORRADE_COMPARE(out.str(), ""); + CORRADE_COMPARE(out, ""); } /* It shouldn't abort the whole process */ @@ -4995,10 +4991,10 @@ void AbstractSceneConverterTest::addImage3DInvalidImage() { CORRADE_VERIFY(converter.begin()); - std::ostringstream out; + Containers::String out; Error redirectError{&out}; converter.add(ImageData3D{PixelFormat::RGBA8Unorm, {}, nullptr}); - CORRADE_COMPARE(out.str(), "Trade::AbstractSceneConverter::add(): can't add image with a zero size: Vector(0, 0, 0)\n"); + CORRADE_COMPARE(out, "Trade::AbstractSceneConverter::add(): can't add image with a zero size: Vector(0, 0, 0)\n"); } void AbstractSceneConverterTest::addImage3DNotImplemented() { @@ -5017,10 +5013,10 @@ void AbstractSceneConverterTest::addImage3DNotImplemented() { CORRADE_VERIFY(converter.begin()); - std::ostringstream out; + Containers::String out; Error redirectError{&out}; converter.add(ImageData3D{PixelFormat::RGBA8Unorm, {1, 1, 1}, DataFlags{}, imageData}); - CORRADE_COMPARE(out.str(), "Trade::AbstractSceneConverter::add(): 3D image conversion advertised but not implemented\n"); + CORRADE_COMPARE(out, "Trade::AbstractSceneConverter::add(): 3D image conversion advertised but not implemented\n"); } void AbstractSceneConverterTest::addImageLevels1D() { @@ -5170,7 +5166,7 @@ void AbstractSceneConverterTest::addImageLevels1DFailed() { /* The implementation is expected to print an error message on its own */ { - std::ostringstream out; + Containers::String out; Error redirectError{&out}; /* Testing all three variants to "fake" coverage for the name-less overloads as well */ @@ -5186,7 +5182,7 @@ void AbstractSceneConverterTest::addImageLevels1DFailed() { CompressedImageView1D{CompressedPixelFormat::Astc4x4RGBAUnorm, 1, imageData}, CompressedImageView1D{CompressedPixelFormat::Astc4x4RGBAUnorm, 1, imageData}, })); - CORRADE_COMPARE(out.str(), ""); + CORRADE_COMPARE(out, ""); } /* It shouldn't abort the whole process */ @@ -5209,10 +5205,10 @@ void AbstractSceneConverterTest::addImageLevels1DInvalidImage() { CORRADE_VERIFY(converter.begin()); - std::ostringstream out; + Containers::String out; Error redirectError{&out}; converter.add(std::initializer_list>{}); - CORRADE_COMPARE(out.str(), "Trade::AbstractSceneConverter::add(): at least one image level has to be specified\n"); + CORRADE_COMPARE(out, "Trade::AbstractSceneConverter::add(): at least one image level has to be specified\n"); } void AbstractSceneConverterTest::addImageLevels1DNotImplemented() { @@ -5232,13 +5228,13 @@ void AbstractSceneConverterTest::addImageLevels1DNotImplemented() { CORRADE_VERIFY(converter.begin()); - std::ostringstream out; + Containers::String out; Error redirectError{&out}; converter.add({ ImageData1D{PixelFormat::RGBA8Unorm, 1, DataFlags{}, imageData}, ImageData1D{PixelFormat::RGBA8Unorm, 1, DataFlags{}, imageData} }); - CORRADE_COMPARE(out.str(), "Trade::AbstractSceneConverter::add(): multi-level 1D image conversion advertised but not implemented\n"); + CORRADE_COMPARE(out, "Trade::AbstractSceneConverter::add(): multi-level 1D image conversion advertised but not implemented\n"); } void AbstractSceneConverterTest::addImageLevels2D() { @@ -5388,7 +5384,7 @@ void AbstractSceneConverterTest::addImageLevels2DFailed() { /* The implementation is expected to print an error message on its own */ { - std::ostringstream out; + Containers::String out; Error redirectError{&out}; /* Testing all three variants to "fake" coverage for the name-less overloads as well */ @@ -5404,7 +5400,7 @@ void AbstractSceneConverterTest::addImageLevels2DFailed() { CompressedImageView2D{CompressedPixelFormat::Astc4x4RGBAUnorm, {1, 1}, imageData}, CompressedImageView2D{CompressedPixelFormat::Astc4x4RGBAUnorm, {1, 1}, imageData} })); - CORRADE_COMPARE(out.str(), ""); + CORRADE_COMPARE(out, ""); } /* It shouldn't abort the whole process */ @@ -5427,10 +5423,10 @@ void AbstractSceneConverterTest::addImageLevels2DNoLevels() { CORRADE_VERIFY(converter.begin()); - std::ostringstream out; + Containers::String out; Error redirectError{&out}; converter.add(std::initializer_list>{}); - CORRADE_COMPARE(out.str(), "Trade::AbstractSceneConverter::add(): at least one image level has to be specified\n"); + CORRADE_COMPARE(out, "Trade::AbstractSceneConverter::add(): at least one image level has to be specified\n"); } void AbstractSceneConverterTest::addImageLevels2DZeroSize() { @@ -5450,13 +5446,13 @@ void AbstractSceneConverterTest::addImageLevels2DZeroSize() { CORRADE_VERIFY(converter.begin()); - std::ostringstream out; + Containers::String out; Error redirectError{&out}; converter.add({ ImageData2D{PixelFormat::RGBA8Unorm, {2, 2}, DataFlags{}, imageData}, ImageData2D{PixelFormat::RGBA8Unorm, {4, 0}, DataFlags{}, imageData} }); - CORRADE_COMPARE(out.str(), "Trade::AbstractSceneConverter::add(): can't add image level 1 with a zero size: Vector(4, 0)\n"); + CORRADE_COMPARE(out, "Trade::AbstractSceneConverter::add(): can't add image level 1 with a zero size: Vector(4, 0)\n"); } void AbstractSceneConverterTest::addImageLevels2DNullptr() { @@ -5476,13 +5472,13 @@ void AbstractSceneConverterTest::addImageLevels2DNullptr() { CORRADE_VERIFY(converter.begin()); - std::ostringstream out; + Containers::String out; Error redirectError{&out}; converter.add({ ImageData2D{PixelFormat::RGBA8Unorm, {2, 2}, DataFlags{}, imageData}, ImageData2D{PixelFormat::RGBA8Unorm, {1, 1}, DataFlags{}, {nullptr, 4}} }); - CORRADE_COMPARE(out.str(), "Trade::AbstractSceneConverter::add(): can't add image level 1 with a nullptr view\n"); + CORRADE_COMPARE(out, "Trade::AbstractSceneConverter::add(): can't add image level 1 with a nullptr view\n"); } void AbstractSceneConverterTest::addImageLevels2DInconsistentCompressed() { @@ -5505,11 +5501,11 @@ void AbstractSceneConverterTest::addImageLevels2DInconsistentCompressed() { ImageData2D a{PixelFormat::RGBA8Unorm, {2, 2}, DataFlags{}, imageData}; ImageData2D b{CompressedPixelFormat::Astc10x10RGBAF, {1, 1}, DataFlags{}, imageData}; - std::ostringstream out; + Containers::String out; Error redirectError{&out}; converter.add({a, b}); converter.add({b, b, a}); - CORRADE_COMPARE(out.str(), + CORRADE_COMPARE(out, "Trade::AbstractSceneConverter::add(): image level 1 is compressed but previous aren't\n" "Trade::AbstractSceneConverter::add(): image level 2 is not compressed but previous are\n"); } @@ -5531,14 +5527,14 @@ void AbstractSceneConverterTest::addImageLevels2DInconsistentFormat() { CORRADE_VERIFY(converter.begin()); - std::ostringstream out; + Containers::String out; Error redirectError{&out}; converter.add({ ImageData2D{PixelFormat::RGBA8Unorm, {2, 2}, DataFlags{}, imageData}, ImageData2D{PixelFormat::RGBA8Unorm, {1, 1}, DataFlags{}, imageData}, ImageData2D{PixelFormat::RGBA8Srgb, {4, 1}, DataFlags{}, imageData} }); - CORRADE_COMPARE(out.str(), "Trade::AbstractSceneConverter::add(): image levels don't have the same format, expected PixelFormat::RGBA8Unorm but got PixelFormat::RGBA8Srgb for level 2\n"); + CORRADE_COMPARE(out, "Trade::AbstractSceneConverter::add(): image levels don't have the same format, expected PixelFormat::RGBA8Unorm but got PixelFormat::RGBA8Srgb for level 2\n"); } void AbstractSceneConverterTest::addImageLevels2DInconsistentFormatExtra() { @@ -5558,14 +5554,14 @@ void AbstractSceneConverterTest::addImageLevels2DInconsistentFormatExtra() { CORRADE_VERIFY(converter.begin()); - std::ostringstream out; + Containers::String out; Error redirectError{&out}; converter.add({ ImageData2D{PixelStorage{}, 252, 1037, 4, {2, 2}, DataFlags{}, imageData}, ImageData2D{PixelStorage{}, 252, 1037, 4, {1, 1}, DataFlags{}, imageData}, ImageData2D{PixelStorage{}, 252, 4467, 4, {4, 1}, DataFlags{}, imageData} }); - CORRADE_COMPARE(out.str(), "Trade::AbstractSceneConverter::add(): image levels don't have the same extra format field, expected 1037 but got 4467 for level 2\n"); + CORRADE_COMPARE(out, "Trade::AbstractSceneConverter::add(): image levels don't have the same extra format field, expected 1037 but got 4467 for level 2\n"); } void AbstractSceneConverterTest::addImageLevels2DInconsistentCompressedFormat() { @@ -5585,14 +5581,14 @@ void AbstractSceneConverterTest::addImageLevels2DInconsistentCompressedFormat() CORRADE_VERIFY(converter.begin()); - std::ostringstream out; + Containers::String out; Error redirectError{&out}; converter.add({ ImageData2D{CompressedPixelFormat::Bc1RGBAUnorm, {2, 2}, DataFlags{}, imageData}, ImageData2D{CompressedPixelFormat::Bc1RGBAUnorm, {1, 1}, DataFlags{}, imageData}, ImageData2D{CompressedPixelFormat::Bc1RGBASrgb, {4, 1}, DataFlags{}, imageData} }); - CORRADE_COMPARE(out.str(), "Trade::AbstractSceneConverter::add(): image levels don't have the same format, expected CompressedPixelFormat::Bc1RGBAUnorm but got CompressedPixelFormat::Bc1RGBASrgb for level 2\n"); + CORRADE_COMPARE(out, "Trade::AbstractSceneConverter::add(): image levels don't have the same format, expected CompressedPixelFormat::Bc1RGBAUnorm but got CompressedPixelFormat::Bc1RGBASrgb for level 2\n"); } void AbstractSceneConverterTest::addImageLevels2DInconsistentFlags() { @@ -5612,14 +5608,14 @@ void AbstractSceneConverterTest::addImageLevels2DInconsistentFlags() { CORRADE_VERIFY(converter.begin()); - std::ostringstream out; + Containers::String out; Error redirectError{&out}; converter.add({ ImageData2D{PixelFormat::RGBA8Unorm, {2, 2}, DataFlags{}, imageData, ImageFlag2D::Array}, ImageData2D{PixelFormat::RGBA8Unorm, {1, 1}, DataFlags{}, imageData, ImageFlag2D::Array}, ImageData2D{PixelFormat::RGBA8Unorm, {4, 1}, DataFlags{}, imageData} }); - CORRADE_COMPARE(out.str(), "Trade::AbstractSceneConverter::add(): image levels don't have the same flags, expected ImageFlag2D::Array but got ImageFlags2D{} for level 2\n"); + CORRADE_COMPARE(out, "Trade::AbstractSceneConverter::add(): image levels don't have the same flags, expected ImageFlag2D::Array but got ImageFlags2D{} for level 2\n"); } void AbstractSceneConverterTest::addImageLevels2DNotImplemented() { @@ -5639,13 +5635,13 @@ void AbstractSceneConverterTest::addImageLevels2DNotImplemented() { CORRADE_VERIFY(converter.begin()); - std::ostringstream out; + Containers::String out; Error redirectError{&out}; converter.add({ ImageData2D{PixelFormat::RGBA8Unorm, {1, 1}, DataFlags{}, imageData}, ImageData2D{PixelFormat::RGBA8Unorm, {1, 1}, DataFlags{}, imageData} }); - CORRADE_COMPARE(out.str(), "Trade::AbstractSceneConverter::add(): multi-level 2D image conversion advertised but not implemented\n"); + CORRADE_COMPARE(out, "Trade::AbstractSceneConverter::add(): multi-level 2D image conversion advertised but not implemented\n"); } void AbstractSceneConverterTest::addImageLevels3D() { @@ -5795,7 +5791,7 @@ void AbstractSceneConverterTest::addImageLevels3DFailed() { /* The implementation is expected to print an error message on its own */ { - std::ostringstream out; + Containers::String out; Error redirectError{&out}; /* Testing all three variants to "fake" coverage for the name-less overloads as well */ @@ -5811,7 +5807,7 @@ void AbstractSceneConverterTest::addImageLevels3DFailed() { CompressedImageView3D{CompressedPixelFormat::Astc4x4RGBAUnorm, {1, 1, 1}, imageData}, CompressedImageView3D{CompressedPixelFormat::Astc4x4RGBAUnorm, {1, 1, 1}, imageData} })); - CORRADE_COMPARE(out.str(), ""); + CORRADE_COMPARE(out, ""); } /* It shouldn't abort the whole process */ @@ -5834,10 +5830,10 @@ void AbstractSceneConverterTest::addImageLevels3DInvalidImage() { CORRADE_VERIFY(converter.begin()); - std::ostringstream out; + Containers::String out; Error redirectError{&out}; converter.add(std::initializer_list>{}); - CORRADE_COMPARE(out.str(), "Trade::AbstractSceneConverter::add(): at least one image level has to be specified\n"); + CORRADE_COMPARE(out, "Trade::AbstractSceneConverter::add(): at least one image level has to be specified\n"); } void AbstractSceneConverterTest::addImageLevels3DNotImplemented() { @@ -5857,13 +5853,13 @@ void AbstractSceneConverterTest::addImageLevels3DNotImplemented() { CORRADE_VERIFY(converter.begin()); - std::ostringstream out; + Containers::String out; Error redirectError{&out}; converter.add({ ImageData3D{PixelFormat::RGBA8Unorm, {1, 1, 1}, DataFlags{}, imageData}, ImageData3D{PixelFormat::RGBA8Unorm, {1, 1, 1}, DataFlags{}, imageData} }); - CORRADE_COMPARE(out.str(), "Trade::AbstractSceneConverter::add(): multi-level 3D image conversion advertised but not implemented\n"); + CORRADE_COMPARE(out, "Trade::AbstractSceneConverter::add(): multi-level 3D image conversion advertised but not implemented\n"); } void AbstractSceneConverterTest::addImage1DThroughLevels() { @@ -6289,10 +6285,10 @@ void AbstractSceneConverterTest::addImporterContents() { converter.addFlags(data.flags); CORRADE_VERIFY(converter.beginData()); - std::ostringstream out; + Containers::String out; Debug redirectOutput{&out}; CORRADE_VERIFY(converter.addImporterContents(importer, data.contents)); - CORRADE_COMPARE(out.str(), data.expected); + CORRADE_COMPARE(out, data.expected); } void AbstractSceneConverterTest::addImporterContentsCustomSceneFields() { @@ -6342,11 +6338,11 @@ void AbstractSceneConverterTest::addImporterContentsCustomSceneFields() { CORRADE_VERIFY(converter.beginData()); - std::ostringstream out; + Containers::String out; Debug redirectOutput{&out}; CORRADE_VERIFY(converter.addImporterContents(importer)); /* No error message, the importer is expected to print that on its own */ - CORRADE_COMPARE(out.str(), + CORRADE_COMPARE(out, "Adding scene\n" /** @todo cache the names to avoid querying repeatedly */ "Setting field 34977 name to offsetSmall\n" @@ -6408,11 +6404,11 @@ void AbstractSceneConverterTest::addImporterContentsCustomMeshAttributes() { CORRADE_VERIFY(converter.beginData()); - std::ostringstream out; + Containers::String out; Debug redirectOutput{&out}; CORRADE_VERIFY(converter.addImporterContents(importer)); /* No error message, the importer is expected to print that on its own */ - CORRADE_COMPARE(out.str(), + CORRADE_COMPARE(out, "Adding mesh levels\n" /** @todo cache the names to avoid querying repeatedly */ "Setting attribute 31977 name to offsetSmall\n" @@ -6659,12 +6655,12 @@ void AbstractSceneConverterTest::addImporterContentsImportFail() { CORRADE_VERIFY(converter.beginData()); - std::ostringstream out; + Containers::String out; Debug redirectOutput{&out}; Error redirectError{&out}; CORRADE_VERIFY(!converter.addImporterContents(importer, data.contents)); /* No error message, the importer is expected to print that on its own */ - CORRADE_COMPARE(out.str(), Utility::format( + CORRADE_COMPARE(out, Utility::format( "Adding {0}\n" "Adding {0}\n", data.name)); } @@ -6902,12 +6898,12 @@ void AbstractSceneConverterTest::addImporterContentsConversionFail() { CORRADE_VERIFY(converter.beginData()); - std::ostringstream out; + Containers::String out; Debug redirectOutput{&out}; Error redirectError{&out}; CORRADE_VERIFY(!converter.addImporterContents(importer, data.contents)); /* No error message, the importer is expected to print that on its own */ - CORRADE_COMPARE(out.str(), Utility::format( + CORRADE_COMPARE(out, Utility::format( "Adding {0}\n" "Adding {0}\n", data.name)); } @@ -6927,10 +6923,10 @@ void AbstractSceneConverterTest::addImporterContentsNotConverting() { } } converter; - std::ostringstream out; + Containers::String out; Error redirectError{&out}; CORRADE_VERIFY(!converter.addImporterContents(importer, {})); - CORRADE_COMPARE(out.str(), "Trade::AbstractSceneConverter::addImporterContents(): no conversion in progress\n"); + CORRADE_COMPARE(out, "Trade::AbstractSceneConverter::addImporterContents(): no conversion in progress\n"); } void AbstractSceneConverterTest::addImporterContentsNotOpened() { @@ -6951,10 +6947,10 @@ void AbstractSceneConverterTest::addImporterContentsNotOpened() { CORRADE_VERIFY(converter.beginData()); - std::ostringstream out; + Containers::String out; Error redirectError{&out}; CORRADE_VERIFY(!converter.addImporterContents(importer)); - CORRADE_COMPARE(out.str(), "Trade::AbstractSceneConverter::addImporterContents(): the importer is not opened\n"); + CORRADE_COMPARE(out, "Trade::AbstractSceneConverter::addImporterContents(): the importer is not opened\n"); } void AbstractSceneConverterTest::addImporterContentsNotSupported() { @@ -6982,13 +6978,13 @@ void AbstractSceneConverterTest::addImporterContentsNotSupported() { CORRADE_VERIFY(converter.beginData()); - std::ostringstream out; + Containers::String out; Error redirectError{&out}; /* Scenes (which are not present in the input) should not be part of the error, materials are in the input and supported, meshes and lights are in the input but not supported so these should be printed */ CORRADE_VERIFY(!converter.addImporterContents(importer, SceneContent::Scenes|SceneContent::Cameras|SceneContent::Meshes|SceneContent::Lights)); - CORRADE_COMPARE(out.str(), "Trade::AbstractSceneConverter::addImporterContents(): unsupported contents Lights|Meshes\n"); + CORRADE_COMPARE(out, "Trade::AbstractSceneConverter::addImporterContents(): unsupported contents Lights|Meshes\n"); } void AbstractSceneConverterTest::addImporterContentsNotSupportedLevels() { @@ -7060,14 +7056,14 @@ void AbstractSceneConverterTest::addImporterContentsNotSupportedLevels() { CORRADE_VERIFY(converter.beginData()); - std::ostringstream out; + Containers::String out; Debug redirectOutput{&out}; Error redirectError{&out}; CORRADE_VERIFY(!converter.addImporterContents(importer, SceneContent::Meshes|SceneContent::MeshLevels)); CORRADE_VERIFY(!converter.addImporterContents(importer, SceneContent::Images1D|SceneContent::ImageLevels)); CORRADE_VERIFY(!converter.addImporterContents(importer, SceneContent::Images2D|SceneContent::ImageLevels)); CORRADE_VERIFY(!converter.addImporterContents(importer, SceneContent::Images3D|SceneContent::ImageLevels)); - CORRADE_COMPARE(out.str(), + CORRADE_COMPARE(out, "Adding mesh\n" "Adding mesh\n" "Trade::AbstractSceneConverter::addImporterContents(): mesh 2 contains 5 levels but the converter doesn't support Trade::SceneConverterFeature::MeshLevels\n" @@ -7139,13 +7135,13 @@ void AbstractSceneConverterTest::addImporterContentsNotSupportedUncompressedImag CORRADE_VERIFY(converter.beginData()); - std::ostringstream out; + Containers::String out; Debug redirectOutput{&out}; Error redirectError{&out}; CORRADE_VERIFY(!converter.addImporterContents(importer, SceneContent::Images1D|SceneContent::ImageLevels)); CORRADE_VERIFY(!converter.addImporterContents(importer, SceneContent::Images2D|SceneContent::ImageLevels)); CORRADE_VERIFY(!converter.addImporterContents(importer, SceneContent::Images3D|SceneContent::ImageLevels)); - CORRADE_COMPARE(out.str(), + CORRADE_COMPARE(out, "Added 1D image\n" "Added 1D image\n" "Trade::AbstractSceneConverter::addImporterContents(): 1D image 2 level 1 is uncompressed but the converter doesn't support Trade::SceneConverterFeature::AddImages1D\n" @@ -7217,13 +7213,13 @@ void AbstractSceneConverterTest::addImporterContentsNotSupportedCompressedImage( CORRADE_VERIFY(converter.beginData()); - std::ostringstream out; + Containers::String out; Debug redirectOutput{&out}; Error redirectError{&out}; CORRADE_VERIFY(!converter.addImporterContents(importer, SceneContent::Images1D|SceneContent::ImageLevels)); CORRADE_VERIFY(!converter.addImporterContents(importer, SceneContent::Images2D|SceneContent::ImageLevels)); CORRADE_VERIFY(!converter.addImporterContents(importer, SceneContent::Images3D|SceneContent::ImageLevels)); - CORRADE_COMPARE(out.str(), + CORRADE_COMPARE(out, "Added 1D image\n" "Added 1D image\n" "Trade::AbstractSceneConverter::addImporterContents(): 1D image 2 level 1 is compressed but the converter doesn't support Trade::SceneConverterFeature::AddCompressedImages1D\n" @@ -7387,10 +7383,10 @@ void AbstractSceneConverterTest::addSupportedImporterContents() { CORRADE_VERIFY(converter.beginData()); - std::ostringstream out; + Containers::String out; Warning redirectWarning{&out}; CORRADE_VERIFY(converter.addSupportedImporterContents(importer, ~data.wantExceptContents)); - CORRADE_COMPARE(out.str(), Utility::formatString( + CORRADE_COMPARE(out, Utility::format( "Trade::AbstractSceneConverter::addSupportedImporterContents(): ignoring {} not supported by the converter\n", data.except)); /* All data except the one unsupported should be added */ @@ -7492,10 +7488,10 @@ void AbstractSceneConverterTest::addSupportedImporterContentsLevels() { CORRADE_VERIFY(converter.beginData()); - std::ostringstream out; + Containers::String out; Warning redirectWarning{&out}; CORRADE_VERIFY(converter.addSupportedImporterContents(importer)); - CORRADE_COMPARE(out.str(), + CORRADE_COMPARE(out, "Trade::AbstractSceneConverter::addSupportedImporterContents(): ignoring extra 4 levels of mesh 2 not supported by the converter\n" "Trade::AbstractSceneConverter::addSupportedImporterContents(): ignoring extra 5 levels of 1D image 3 not supported by the converter\n" "Trade::AbstractSceneConverter::addSupportedImporterContents(): ignoring extra 6 levels of 2D image 4 not supported by the converter\n" @@ -7526,97 +7522,97 @@ void AbstractSceneConverterTest::addSupportedImporterContentsNotOpened() { CORRADE_VERIFY(converter.beginData()); - std::ostringstream out; + Containers::String out; Error redirectError{&out}; CORRADE_VERIFY(!converter.addSupportedImporterContents(importer)); - CORRADE_COMPARE(out.str(), "Trade::AbstractSceneConverter::addSupportedImporterContents(): the importer is not opened\n"); + CORRADE_COMPARE(out, "Trade::AbstractSceneConverter::addSupportedImporterContents(): the importer is not opened\n"); } void AbstractSceneConverterTest::debugFeature() { - std::ostringstream out; + Containers::String out; Debug{&out} << SceneConverterFeature::ConvertMeshInPlace << SceneConverterFeature(0xdeaddead); - CORRADE_COMPARE(out.str(), "Trade::SceneConverterFeature::ConvertMeshInPlace Trade::SceneConverterFeature(0xdeaddead)\n"); + CORRADE_COMPARE(out, "Trade::SceneConverterFeature::ConvertMeshInPlace Trade::SceneConverterFeature(0xdeaddead)\n"); } void AbstractSceneConverterTest::debugFeaturePacked() { - std::ostringstream out; + Containers::String 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"); + CORRADE_COMPARE(out, "ConvertMeshInPlace 0xdeaddead Trade::SceneConverterFeature::AddCameras\n"); } void AbstractSceneConverterTest::debugFeatures() { - std::ostringstream out; + Containers::String out; Debug{&out} << (SceneConverterFeature::ConvertMesh|SceneConverterFeature::ConvertMeshToFile) << SceneConverterFeatures{}; - CORRADE_COMPARE(out.str(), "Trade::SceneConverterFeature::ConvertMesh|Trade::SceneConverterFeature::ConvertMeshToFile Trade::SceneConverterFeatures{}\n"); + CORRADE_COMPARE(out, "Trade::SceneConverterFeature::ConvertMesh|Trade::SceneConverterFeature::ConvertMeshToFile Trade::SceneConverterFeatures{}\n"); } void AbstractSceneConverterTest::debugFeaturesPacked() { - std::ostringstream out; + Containers::String 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"); + CORRADE_COMPARE(out, "ConvertMesh|ConvertMeshToFile {} Trade::SceneConverterFeature::AddLights\n"); } void AbstractSceneConverterTest::debugFeaturesSupersets() { /* ConvertMeshToData is a superset of ConvertMeshToFile, so only one should be printed */ { - std::ostringstream out; + Containers::String out; Debug{&out} << (SceneConverterFeature::ConvertMeshToData|SceneConverterFeature::ConvertMeshToFile); - CORRADE_COMPARE(out.str(), "Trade::SceneConverterFeature::ConvertMeshToData\n"); + CORRADE_COMPARE(out, "Trade::SceneConverterFeature::ConvertMeshToData\n"); /* ConvertMultipleToData is a superset of ConvertMultipleToFile, so only one should be printed */ } { - std::ostringstream out; + Containers::String out; Debug{&out} << (SceneConverterFeature::ConvertMultipleToData|SceneConverterFeature::ConvertMultipleToFile); - CORRADE_COMPARE(out.str(), "Trade::SceneConverterFeature::ConvertMultipleToData\n"); + CORRADE_COMPARE(out, "Trade::SceneConverterFeature::ConvertMultipleToData\n"); } } void AbstractSceneConverterTest::debugFlag() { - std::ostringstream out; + Containers::String out; Debug{&out} << SceneConverterFlag::Verbose << SceneConverterFlag(0xf0); - CORRADE_COMPARE(out.str(), "Trade::SceneConverterFlag::Verbose Trade::SceneConverterFlag(0xf0)\n"); + CORRADE_COMPARE(out, "Trade::SceneConverterFlag::Verbose Trade::SceneConverterFlag(0xf0)\n"); } void AbstractSceneConverterTest::debugFlags() { - std::ostringstream out; + Containers::String out; Debug{&out} << (SceneConverterFlag::Verbose|SceneConverterFlag(0xf0)) << SceneConverterFlags{}; - CORRADE_COMPARE(out.str(), "Trade::SceneConverterFlag::Verbose|Trade::SceneConverterFlag(0xf0) Trade::SceneConverterFlags{}\n"); + CORRADE_COMPARE(out, "Trade::SceneConverterFlag::Verbose|Trade::SceneConverterFlag(0xf0) Trade::SceneConverterFlags{}\n"); } void AbstractSceneConverterTest::debugContent() { - std::ostringstream out; + Containers::String out; Debug{&out} << SceneContent::Skins3D << SceneContent(0xdeaddead); - CORRADE_COMPARE(out.str(), "Trade::SceneContent::Skins3D Trade::SceneContent(0xdeaddead)\n"); + CORRADE_COMPARE(out, "Trade::SceneContent::Skins3D Trade::SceneContent(0xdeaddead)\n"); } void AbstractSceneConverterTest::debugContentPacked() { - std::ostringstream out; + Containers::String out; /* Last is not packed, ones before should not make any flags persistent */ Debug{&out} << Debug::packed << SceneContent::Animations << Debug::packed << SceneContent(0xdeaddead) << SceneContent::Cameras; - CORRADE_COMPARE(out.str(), "Animations 0xdeaddead Trade::SceneContent::Cameras\n"); + CORRADE_COMPARE(out, "Animations 0xdeaddead Trade::SceneContent::Cameras\n"); } void AbstractSceneConverterTest::debugContents() { - std::ostringstream out; + Containers::String out; Debug{&out} << (SceneContent::Animations|SceneContent::MeshLevels) << SceneConverterFeatures{}; - CORRADE_COMPARE(out.str(), "Trade::SceneContent::Animations|Trade::SceneContent::MeshLevels Trade::SceneConverterFeatures{}\n"); + CORRADE_COMPARE(out, "Trade::SceneContent::Animations|Trade::SceneContent::MeshLevels Trade::SceneConverterFeatures{}\n"); } void AbstractSceneConverterTest::debugContentsPacked() { - std::ostringstream out; + Containers::String out; /* Last is not packed, ones before should not make any flags persistent */ Debug{&out} << Debug::packed << (SceneContent::Animations|SceneContent::MeshLevels) << Debug::packed << SceneConverterFeatures{} << SceneContent::Lights; - CORRADE_COMPARE(out.str(), "Animations|MeshLevels {} Trade::SceneContent::Lights\n"); + CORRADE_COMPARE(out, "Animations|MeshLevels {} Trade::SceneContent::Lights\n"); } }}}} diff --git a/src/Magnum/Trade/Test/AnimationDataTest.cpp b/src/Magnum/Trade/Test/AnimationDataTest.cpp index b8825d4de..cc9a7fb21 100644 --- a/src/Magnum/Trade/Test/AnimationDataTest.cpp +++ b/src/Magnum/Trade/Test/AnimationDataTest.cpp @@ -24,9 +24,8 @@ DEALINGS IN THE SOFTWARE. */ -#include +#include #include -#include #include "Magnum/Math/CubicHermite.h" #include "Magnum/Math/DualQuaternion.h" @@ -181,13 +180,13 @@ void AnimationDataTest::trackTypeSizeAlignment() { void AnimationDataTest::trackTypeSizeAlignmentInvalid() { CORRADE_SKIP_IF_NO_ASSERT(); - std::ostringstream out; + Containers::String out; Error redirectError{&out}; animationTrackTypeSize(AnimationTrackType{}); animationTrackTypeAlignment(AnimationTrackType{}); animationTrackTypeSize(AnimationTrackType(0x73)); animationTrackTypeAlignment(AnimationTrackType(0x73)); - CORRADE_COMPARE(out.str(), + CORRADE_COMPARE(out, "Trade::animationTrackTypeSize(): invalid type Trade::AnimationTrackType(0x0)\n" "Trade::animationTrackTypeAlignment(): invalid type Trade::AnimationTrackType(0x0)\n" "Trade::animationTrackTypeSize(): invalid type Trade::AnimationTrackType(0x73)\n" @@ -195,17 +194,17 @@ void AnimationDataTest::trackTypeSizeAlignmentInvalid() { } void AnimationDataTest::debugTrackType() { - std::ostringstream out; + Containers::String out; Debug{&out} << AnimationTrackType::DualQuaternion << AnimationTrackType(0xde); - CORRADE_COMPARE(out.str(), "Trade::AnimationTrackType::DualQuaternion Trade::AnimationTrackType(0xde)\n"); + CORRADE_COMPARE(out, "Trade::AnimationTrackType::DualQuaternion Trade::AnimationTrackType(0xde)\n"); } void AnimationDataTest::debugTrackTypePacked() { - std::ostringstream out; + Containers::String out; /* Second is not packed, the first should not make any flags persistent */ Debug{&out} << Debug::packed << AnimationTrackType::DualQuaternion << Debug::packed << AnimationTrackType(0xde) << AnimationTrackType::Float; - CORRADE_COMPARE(out.str(), "DualQuaternion 0xde Trade::AnimationTrackType::Float\n"); + CORRADE_COMPARE(out, "DualQuaternion 0xde Trade::AnimationTrackType::Float\n"); } void AnimationDataTest::customTrackTarget() { @@ -233,33 +232,33 @@ void AnimationDataTest::customTrackTarget() { void AnimationDataTest::customTrackTargetTooLarge() { CORRADE_SKIP_IF_NO_ASSERT(); - std::ostringstream out; + Containers::String out; Error redirectError{&out}; animationTrackTargetCustom(32768); - CORRADE_COMPARE(out.str(), "Trade::animationTrackTargetCustom(): index 32768 too large\n"); + CORRADE_COMPARE(out, "Trade::animationTrackTargetCustom(): index 32768 too large\n"); } void AnimationDataTest::customTrackTargetNotCustom() { CORRADE_SKIP_IF_NO_ASSERT(); - std::ostringstream out; + Containers::String out; Error redirectError{&out}; animationTrackTargetCustom(AnimationTrackTarget::Translation2D); - CORRADE_COMPARE(out.str(), "Trade::animationTrackTargetCustom(): Trade::AnimationTrackTarget::Translation2D is not custom\n"); + CORRADE_COMPARE(out, "Trade::animationTrackTargetCustom(): Trade::AnimationTrackTarget::Translation2D is not custom\n"); } void AnimationDataTest::debugTrackTarget() { - std::ostringstream out; + Containers::String out; Debug{&out} << AnimationTrackTarget::Rotation3D << animationTrackTargetCustom(9) << AnimationTrackTarget(0x4242); - CORRADE_COMPARE(out.str(), "Trade::AnimationTrackTarget::Rotation3D Trade::AnimationTrackTarget::Custom(9) Trade::AnimationTrackTarget(0x4242)\n"); + CORRADE_COMPARE(out, "Trade::AnimationTrackTarget::Rotation3D Trade::AnimationTrackTarget::Custom(9) Trade::AnimationTrackTarget(0x4242)\n"); } void AnimationDataTest::debugTrackTargetPacked() { - std::ostringstream out; + Containers::String out; /* Last is not packed, ones before should not make any flags persistent */ Debug{&out} << Debug::packed << AnimationTrackTarget::Rotation3D << Debug::packed << animationTrackTargetCustom(120) << Debug::packed << AnimationTrackTarget(0x4242) << AnimationTrackType::Float; - CORRADE_COMPARE(out.str(), "Rotation3D Custom(120) 0x4242 Trade::AnimationTrackType::Float\n"); + CORRADE_COMPARE(out, "Rotation3D Custom(120) 0x4242 Trade::AnimationTrackType::Float\n"); } void AnimationDataTest::constructTrackDefault() { @@ -570,20 +569,20 @@ void AnimationDataTest::constructTrackInconsitentViewSize() { Float time[2]; Vector2 value[3]; - std::ostringstream out; + Containers::String out; Error redirectError{&out}; AnimationTrackData{ AnimationTrackTarget::Rotation3D, 42, Containers::stridedArrayView(time), Containers::stridedArrayView(value), Animation::Interpolation::Linear}; - CORRADE_COMPARE(out.str(), "Trade::AnimationTrackData: expected key and value view to have the same size but got 2 and 3\n"); + CORRADE_COMPARE(out, "Trade::AnimationTrackData: expected key and value view to have the same size but got 2 and 3\n"); } void AnimationDataTest::constructTrackUnknownInterpolator() { CORRADE_SKIP_IF_NO_ASSERT(); - std::ostringstream out; + Containers::String out; Error redirectError{&out}; AnimationTrackData{ AnimationTrackTarget::Rotation3D, 42, @@ -598,7 +597,7 @@ void AnimationDataTest::constructTrackUnknownInterpolator() { nullptr, nullptr, Animation::Interpolation::Spline}; - CORRADE_COMPARE(out.str(), + CORRADE_COMPARE(out, "Trade::AnimationTrackData: can't deduce interpolator function for Trade::AnimationTrackType::CubicHermite1D, Trade::AnimationTrackType::Vector2 and Animation::Interpolation::Linear\n" /* This assertion is from the delegated-to interpolationFor(), which unfortunately doesn't print the types */ @@ -616,14 +615,14 @@ void AnimationDataTest::constructTrackWrongSize() { Animation::Interpolation::Constant }}; - std::ostringstream out; + Containers::String out; Error redirectError{&out}; AnimationTrackData{AnimationTrackTarget::Rotation3D, 16, Animation::TrackView{ {nullptr, 0x100000000ull}, {nullptr, 0x100000000ull}, Animation::Interpolation::Constant }}; - CORRADE_COMPARE(out.str(), + CORRADE_COMPARE(out, "Trade::AnimationTrackData: expected keyframe count to fit into 32 bits but got 4294967296\n"); } #endif @@ -645,7 +644,7 @@ void AnimationDataTest::constructTrackWrongStride() { Animation::Interpolation::Constant }}; - std::ostringstream out; + Containers::String out; Error redirectError{&out}; AnimationTrackData{AnimationTrackTarget::Scaling2D, 1, Animation::TrackView{ Containers::StridedArrayView1D{Containers::arrayCast(toomuch), 2, 32768}, @@ -667,7 +666,7 @@ void AnimationDataTest::constructTrackWrongStride() { Containers::StridedArrayView1D{Containers::arrayCast(toomuch), 2, 32769}.flipped<0>(), Animation::Interpolation::Constant }}; - CORRADE_COMPARE(out.str(), + CORRADE_COMPARE(out, "Trade::AnimationTrackData: expected key stride to fit into 16 bits but got 32768\n" "Trade::AnimationTrackData: expected key stride to fit into 16 bits but got -32769\n" "Trade::AnimationTrackData: expected value stride to fit into 16 bits but got 32768\n" @@ -911,20 +910,20 @@ void AnimationDataTest::constructImplicitDurationNotOwned() { void AnimationDataTest::constructNotOwnedFlagOwned() { CORRADE_SKIP_IF_NO_ASSERT(); - std::ostringstream out; + Containers::String out; Error redirectError{&out}; AnimationData data{DataFlag::Owned, nullptr, {}, {-1.0f, 7.0f}}; - CORRADE_COMPARE(out.str(), + CORRADE_COMPARE(out, "Trade::AnimationData: can't construct a non-owned instance with Trade::DataFlag::Owned\n"); } void AnimationDataTest::constructImplicitDurationNotOwnedFlagOwned() { CORRADE_SKIP_IF_NO_ASSERT(); - std::ostringstream out; + Containers::String out; Error redirectError{&out}; AnimationData data{DataFlag::Owned, nullptr, {}}; - CORRADE_COMPARE(out.str(), + CORRADE_COMPARE(out, "Trade::AnimationData: can't construct a non-owned instance with Trade::DataFlag::Owned\n"); } @@ -1044,12 +1043,12 @@ void AnimationDataTest::mutableAccessNotAllowed() { }}; CORRADE_COMPARE(data.dataFlags(), DataFlags{}); - std::ostringstream out; + Containers::String out; Error redirectError{&out}; data.mutableData(); data.mutableTrack(0); data.mutableTrack(0); - CORRADE_COMPARE(out.str(), + CORRADE_COMPARE(out, "Trade::AnimationData::mutableData(): the animation is not mutable\n" "Trade::AnimationData::mutableTrack(): the animation is not mutable\n" "Trade::AnimationData::mutableTrack(): the animation is not mutable\n"); @@ -1083,7 +1082,7 @@ void AnimationDataTest::trackCustomResultType() { void AnimationDataTest::trackWrongIndex() { CORRADE_SKIP_IF_NO_ASSERT(); - std::ostringstream out; + Containers::String out; Error redirectError{&out}; AnimationData data{nullptr, { @@ -1096,7 +1095,7 @@ void AnimationDataTest::trackWrongIndex() { data.track(1); data.mutableTrack(1); - CORRADE_COMPARE(out.str(), + CORRADE_COMPARE(out, "Trade::AnimationData::trackType(): index 1 out of range for 1 tracks\n" "Trade::AnimationData::trackResultType(): index 1 out of range for 1 tracks\n" "Trade::AnimationData::trackTargetName(): index 1 out of range for 1 tracks\n" @@ -1108,7 +1107,7 @@ void AnimationDataTest::trackWrongIndex() { void AnimationDataTest::trackWrongType() { CORRADE_SKIP_IF_NO_ASSERT(); - std::ostringstream out; + Containers::String out; Error redirectError{&out}; AnimationData data{nullptr, { @@ -1117,13 +1116,13 @@ void AnimationDataTest::trackWrongType() { data.track(0); - CORRADE_COMPARE(out.str(), "Trade::AnimationData::track(): improper type requested for Trade::AnimationTrackType::Vector3i\n"); + CORRADE_COMPARE(out, "Trade::AnimationData::track(): improper type requested for Trade::AnimationTrackType::Vector3i\n"); } void AnimationDataTest::trackWrongResultType() { CORRADE_SKIP_IF_NO_ASSERT(); - std::ostringstream out; + Containers::String out; Error redirectError{&out}; AnimationData data{nullptr, { @@ -1132,7 +1131,7 @@ void AnimationDataTest::trackWrongResultType() { data.track(0); - CORRADE_COMPARE(out.str(), "Trade::AnimationData::track(): improper result type requested for Trade::AnimationTrackType::Vector3\n"); + CORRADE_COMPARE(out, "Trade::AnimationData::track(): improper result type requested for Trade::AnimationTrackType::Vector3\n"); } void AnimationDataTest::release() { diff --git a/src/Magnum/Trade/Test/CameraDataTest.cpp b/src/Magnum/Trade/Test/CameraDataTest.cpp index 95dd9d056..07bfc0e57 100644 --- a/src/Magnum/Trade/Test/CameraDataTest.cpp +++ b/src/Magnum/Trade/Test/CameraDataTest.cpp @@ -24,9 +24,8 @@ DEALINGS IN THE SOFTWARE. */ -#include +#include #include -#include #include "Magnum/Trade/CameraData.h" @@ -110,23 +109,23 @@ void CameraDataTest::construct2D() { void CameraDataTest::construct2DFoV() { CORRADE_SKIP_IF_NO_ASSERT(); - std::ostringstream out; + Containers::String out; Error redirectError{&out}; CameraData{CameraType::Orthographic2D, 25.0_degf, 1.0f, 0.001f, 1000.0f}; - CORRADE_COMPARE(out.str(), "Trade::CameraData: only perspective cameras can have FoV specified\n"); + CORRADE_COMPARE(out, "Trade::CameraData: only perspective cameras can have FoV specified\n"); } void CameraDataTest::construct2DNearFar() { CORRADE_SKIP_IF_NO_ASSERT(); - std::ostringstream out; + Containers::String out; Error redirectError{&out}; CameraData{CameraType::Orthographic2D, {3.0f, 4.0f}, 0.001f, 1000.0f}; - CORRADE_COMPARE(out.str(), "Trade::CameraData: 2D cameras can't be specified with near and far clipping planes\n"); + CORRADE_COMPARE(out, "Trade::CameraData: 2D cameras can't be specified with near and far clipping planes\n"); } void CameraDataTest::constructCopy() { @@ -165,27 +164,27 @@ void CameraDataTest::constructMove() { void CameraDataTest::fovNonPerspective() { CORRADE_SKIP_IF_NO_ASSERT(); - std::ostringstream out; + Containers::String out; Error redirectError{&out}; CameraData a{CameraType::Orthographic2D, {3.0f, 4.0f}, {}, {}}; a.fov(); - CORRADE_COMPARE(out.str(), "Trade::CameraData::fov(): the camera is not perspective\n"); + CORRADE_COMPARE(out, "Trade::CameraData::fov(): the camera is not perspective\n"); } void CameraDataTest::debugType() { - std::ostringstream out; + Containers::String out; Debug{&out} << CameraType::Orthographic3D << CameraType(0xde); - CORRADE_COMPARE(out.str(), "Trade::CameraType::Orthographic3D Trade::CameraType(0xde)\n"); + CORRADE_COMPARE(out, "Trade::CameraType::Orthographic3D Trade::CameraType(0xde)\n"); } void CameraDataTest::debugTypePacked() { - std::ostringstream out; + Containers::String out; /* Last is not packed, ones before should not make any flags persistent */ Debug{&out} << Debug::packed << CameraType::Orthographic3D << Debug::packed << CameraType(0xde) << CameraType::Perspective3D; - CORRADE_COMPARE(out.str(), "Orthographic3D 0xde Trade::CameraType::Perspective3D\n"); + CORRADE_COMPARE(out, "Orthographic3D 0xde Trade::CameraType::Perspective3D\n"); } }}}} diff --git a/src/Magnum/Trade/Test/DataTest.cpp b/src/Magnum/Trade/Test/DataTest.cpp index d747fd7d9..5e89e4e97 100644 --- a/src/Magnum/Trade/Test/DataTest.cpp +++ b/src/Magnum/Trade/Test/DataTest.cpp @@ -24,9 +24,8 @@ DEALINGS IN THE SOFTWARE. */ -#include +#include #include -#include #include "Magnum/Trade/Data.h" @@ -49,31 +48,31 @@ DataTest::DataTest() { } void DataTest::debugDataFlag() { - std::ostringstream out; + Containers::String out; Debug{&out} << DataFlag::Owned << DataFlag(0xf0); - CORRADE_COMPARE(out.str(), "Trade::DataFlag::Owned Trade::DataFlag(0xf0)\n"); + CORRADE_COMPARE(out, "Trade::DataFlag::Owned Trade::DataFlag(0xf0)\n"); } void DataTest::debugDataFlagPacked() { - std::ostringstream out; + Containers::String out; /* Last is not packed, ones before should not make any flags persistent */ Debug{&out} << Debug::packed << DataFlag::Owned << Debug::packed << DataFlag(0xf0) << DataFlag::Mutable; - CORRADE_COMPARE(out.str(), "Owned 0xf0 Trade::DataFlag::Mutable\n"); + CORRADE_COMPARE(out, "Owned 0xf0 Trade::DataFlag::Mutable\n"); } void DataTest::debugDataFlags() { - std::ostringstream out; + Containers::String out; Debug{&out} << (DataFlag::Owned|DataFlag::Mutable) << DataFlags{}; - CORRADE_COMPARE(out.str(), "Trade::DataFlag::Owned|Trade::DataFlag::Mutable Trade::DataFlags{}\n"); + CORRADE_COMPARE(out, "Trade::DataFlag::Owned|Trade::DataFlag::Mutable Trade::DataFlags{}\n"); } void DataTest::debugDataFlagsPacked() { - std::ostringstream out; + Containers::String out; /* Last is not packed, ones before should not make any flags persistent */ Debug{&out} << Debug::packed << (DataFlag::Owned|DataFlag::Mutable) << Debug::packed << DataFlags{} << (DataFlag::ExternallyOwned|DataFlag::Mutable); - CORRADE_COMPARE(out.str(), "Owned|Mutable {} Trade::DataFlag::ExternallyOwned|Trade::DataFlag::Mutable\n"); + CORRADE_COMPARE(out, "Owned|Mutable {} Trade::DataFlag::ExternallyOwned|Trade::DataFlag::Mutable\n"); } }}}} diff --git a/src/Magnum/Trade/Test/FlatMaterialDataTest.cpp b/src/Magnum/Trade/Test/FlatMaterialDataTest.cpp index 44a890209..785d016bc 100644 --- a/src/Magnum/Trade/Test/FlatMaterialDataTest.cpp +++ b/src/Magnum/Trade/Test/FlatMaterialDataTest.cpp @@ -24,9 +24,8 @@ DEALINGS IN THE SOFTWARE. */ -#include +#include #include -#include #include "Magnum/Math/Color.h" #include "Magnum/Math/Matrix3.h" @@ -312,13 +311,13 @@ void FlatMaterialDataTest::invalidTextures() { FlatMaterialData data{{}, {}}; - std::ostringstream out; + Containers::String out; Error redirectError{&out}; data.texture(); data.textureMatrix(); data.textureCoordinates(); data.textureLayer(); - CORRADE_COMPARE(out.str(), + CORRADE_COMPARE(out, "Trade::FlatMaterialData::texture(): the material doesn't have a texture\n" "Trade::FlatMaterialData::textureMatrix(): the material doesn't have a texture\n" "Trade::FlatMaterialData::textureCoordinates(): the material doesn't have a texture\n" diff --git a/src/Magnum/Trade/Test/ImageConverterImplementationTest.cpp b/src/Magnum/Trade/Test/ImageConverterImplementationTest.cpp index 8b6f44be2..9a1577cd1 100644 --- a/src/Magnum/Trade/Test/ImageConverterImplementationTest.cpp +++ b/src/Magnum/Trade/Test/ImageConverterImplementationTest.cpp @@ -24,13 +24,11 @@ DEALINGS IN THE SOFTWARE. */ -#include -#include /** @todo remove once Debug is stream-free */ +#include /** @todo remove once Configuration is stream-free */ #include #include #include #include -#include /** @todo remove once Debug is stream-free */ #include #include "Magnum/Trade/Implementation/converterUtilities.h" @@ -102,10 +100,10 @@ void ImageConverterImplementationTest::pluginInfo() { Debug{} << "======================== visual color verification end ========================="; } - std::ostringstream out; + Containers::String out; Debug redirectOutput{&out}; Implementation::printPluginInfo(Debug::Flag::DisableColors, *converter); - CORRADE_COMPARE(out.str(), + CORRADE_COMPARE(out, "Plugin name: AnyImageConverter\n" "Features:\n" " Convert1DToFile\n" @@ -138,10 +136,10 @@ void ImageConverterImplementationTest::pluginInfoAliases() { Debug{} << "======================== visual color verification end ========================="; } - std::ostringstream out; + Containers::String out; Debug redirectOutput{&out}; Implementation::printPluginInfo(Debug::Flag::DisableColors, *importer); - CORRADE_COMPARE(out.str(), + CORRADE_COMPARE(out, "Plugin name: StbImageImporter\n" "Aliases:\n" " BmpImporter\n" @@ -168,10 +166,10 @@ void ImageConverterImplementationTest::pluginConfigurationInfoEmpty() { void doClose() override {} } importer; - std::ostringstream out; + Containers::String out; Debug redirectOutput{&out}; Implementation::printPluginConfigurationInfo(Debug::Flag::DisableColors, importer); - CORRADE_COMPARE(out.str(), ""); + CORRADE_COMPARE(out, ""); } void ImageConverterImplementationTest::pluginConfigurationInfo() { @@ -215,10 +213,10 @@ true=false Debug{} << "======================== visual color verification end ========================="; } - std::ostringstream out; + Containers::String out; Debug redirectOutput{&out}; Implementation::printPluginConfigurationInfo(Debug::Flag::DisableColors, importer); - CORRADE_COMPARE(out.str(), + CORRADE_COMPARE(out, "Configuration:\n" " # A comment\n" " ; Another\n" @@ -250,6 +248,7 @@ void ImageConverterImplementationTest::pluginConfigurationInfoDoxygenDelimiter() void doClose() override {} } importer; + /** @todo UGH, fix the insane Configuration API already */ std::stringstream in; in << R"(# [configuration_] [configuration] @@ -263,10 +262,10 @@ newlyAddedValue=42 importer.configuration() = Utility::ConfigurationGroup{*conf.group("configuration")}; - std::ostringstream out; + Containers::String out; Debug redirectOutput{&out}; Implementation::printPluginConfigurationInfo(Debug::Flag::DisableColors, importer); - CORRADE_COMPARE(out.str(), + CORRADE_COMPARE(out, "Configuration:\n" " # A comment\n" " value=yes\n" @@ -291,10 +290,10 @@ void ImageConverterImplementationTest::importerInfo() { Debug{} << "======================== visual color verification end ========================="; } - std::ostringstream out; + Containers::String out; Debug redirectOutput{&out}; Implementation::printImporterInfo(Debug::Flag::DisableColors, *importer); - CORRADE_COMPARE(out.str(), + CORRADE_COMPARE(out, "Plugin name: AnyImageImporter\n" "Features:\n" " OpenData\n" @@ -320,10 +319,10 @@ void ImageConverterImplementationTest::converterInfo() { Debug{} << "======================== visual color verification end ========================="; } - std::ostringstream out; + Containers::String out; Debug redirectOutput{&out}; Implementation::printImageConverterInfo(Debug::Flag::DisableColors, *converter); - CORRADE_COMPARE(out.str(), + CORRADE_COMPARE(out, "Plugin name: AnyImageConverter\n" "Features:\n" " Convert1DToFile\n" @@ -353,10 +352,10 @@ void ImageConverterImplementationTest::converterInfoExtensionMimeType() { Debug{} << "======================== visual color verification end ========================="; } - std::ostringstream out; + Containers::String out; Debug redirectOutput{&out}; Implementation::printImageConverterInfo(Debug::Flag::DisableColors, *converter); - CORRADE_COMPARE_AS(out.str(), + CORRADE_COMPARE_AS(out, "Plugin name: TgaImageConverter\n" "Features:\n" " Convert2DToData\n" @@ -385,10 +384,10 @@ void ImageConverterImplementationTest::converterInfoExtensionMimeTypeNoFileConve Debug{} << "======================== visual color verification end ========================="; } - std::ostringstream out; + Containers::String out; Debug redirectOutput{&out}; Implementation::printImageConverterInfo(Debug::Flag::DisableColors, *converter); - CORRADE_COMPARE_AS(out.str(), + CORRADE_COMPARE_AS(out, "Plugin name: StbResizeImageConverter\n" "Features:\n" " Convert2D\n" @@ -485,10 +484,10 @@ void ImageConverterImplementationTest::info() { Debug{} << "======================== visual color verification end ========================="; } - std::ostringstream out; + Containers::String out; Debug redirectOutput{&out}; Implementation::printImageInfo(Debug::Flag::DisableColors, infos, nullptr, nullptr, nullptr); - CORRADE_COMPARE_AS(out.str(), + CORRADE_COMPARE_AS(out, Utility::Path::join(TRADE_TEST_DIR, "ImageConverterImplementationTestFiles/info.txt"), TestSuite::Compare::StringToFile); } @@ -520,7 +519,7 @@ void ImageConverterImplementationTest::infoError() { bool error = false; std::chrono::high_resolution_clock::duration time; - std::ostringstream out; + Containers::String out; Debug redirectOutput{&out}; Error redirectError{&out}; Containers::Array infos = Implementation::imageInfo(importer, error, time); @@ -528,7 +527,7 @@ void ImageConverterImplementationTest::infoError() { CORRADE_VERIFY(error); CORRADE_VERIFY(infos.isEmpty()); /* But it should not exit after first error */ - CORRADE_COMPARE(out.str(), + CORRADE_COMPARE(out, "1D image 0 error!\n" "Can't import 1D image 0 level 0\n" "1D image 1 error!\n" diff --git a/src/Magnum/Trade/Test/ImageDataTest.cpp b/src/Magnum/Trade/Test/ImageDataTest.cpp index 3eb317e7d..4c8bd9c7a 100644 --- a/src/Magnum/Trade/Test/ImageDataTest.cpp +++ b/src/Magnum/Trade/Test/ImageDataTest.cpp @@ -29,10 +29,10 @@ arrayCast() template, which is forward-declared. */ #include "Magnum/Trade/ImageData.h" -#include #include +#include #include -#include +#include /** @todo remove once dataProperties() std::pair is gone */ #include "Magnum/ImageView.h" #include "Magnum/PixelFormat.h" @@ -598,11 +598,11 @@ void ImageDataTest::constructGenericNotOwnedFlagOwned() { char data[4*4]; - std::ostringstream out; + Containers::String out; Error redirectError{&out}; ImageData2D{PixelFormat::RGBA8Unorm, {1, 3}, DataFlag::Owned, data}; ImageData2D{PixelStorage{}.setAlignment(1), PixelFormat::R16UI, {1, 3}, DataFlag::Owned, data}; - CORRADE_COMPARE(out.str(), + CORRADE_COMPARE(out, "Trade::ImageData: can't construct a non-owned instance with Trade::DataFlag::Owned\n" "Trade::ImageData: can't construct a non-owned instance with Trade::DataFlag::Owned\n"); } @@ -612,11 +612,11 @@ void ImageDataTest::constructImplementationSpecificNotOwnedFlagOwned() { char data[3*12]; - std::ostringstream out; + Containers::String out; Error redirectError{&out}; ImageData2D{PixelStorage{}.setAlignment(1), Vk::PixelFormat::R32G32B32F, {1, 3}, DataFlag::Owned, data}; ImageData2D{PixelStorage{}.setAlignment(1), GL::PixelFormat::RGB, GL::PixelType::UnsignedShort, {1, 3}, DataFlag::Owned, data}; - CORRADE_COMPARE(out.str(), + CORRADE_COMPARE(out, "Trade::ImageData: can't construct a non-owned instance with Trade::DataFlag::Owned\n" "Trade::ImageData: can't construct a non-owned instance with Trade::DataFlag::Owned\n"); } @@ -626,12 +626,12 @@ void ImageDataTest::constructCompressedGenericNotOwnedFlagOwned() { char data[8]; - std::ostringstream out; + Containers::String out; Error redirectError{&out}; ImageData2D{CompressedPixelFormat::Bc1RGBAUnorm, {4, 4}, DataFlag::Owned, data}; ImageData2D{CompressedPixelStorage{}.setCompressedBlockSize(Vector3i{4}), CompressedPixelFormat::Bc1RGBAUnorm, {4, 4}, DataFlag::Owned, data}; - CORRADE_COMPARE(out.str(), + CORRADE_COMPARE(out, "Trade::ImageData: can't construct a non-owned instance with Trade::DataFlag::Owned\n" "Trade::ImageData: can't construct a non-owned instance with Trade::DataFlag::Owned\n"); } @@ -641,35 +641,35 @@ void ImageDataTest::constructCompressedImplementationSpecificNotOwnedFlagOwned() char data[8]; - std::ostringstream out; + Containers::String out; Error redirectError{&out}; ImageData2D a{CompressedPixelStorage{}.setCompressedBlockSize(Vector3i{4}), GL::CompressedPixelFormat::RGBS3tcDxt1, {4, 4}, DataFlag::Owned, data}; - CORRADE_COMPARE(out.str(), + CORRADE_COMPARE(out, "Trade::ImageData: can't construct a non-owned instance with Trade::DataFlag::Owned\n"); } void ImageDataTest::constructInvalidSize() { CORRADE_SKIP_IF_NO_ASSERT(); - std::ostringstream out; + Containers::String out; Error redirectError{&out}; /* Doesn't consider alignment */ ImageData2D{PixelFormat::RGB8Unorm, {1, 3}, Containers::Array{3*3}}; - CORRADE_COMPARE(out.str(), "Trade::ImageData: data too small, got 9 but expected at least 12 bytes\n"); + CORRADE_COMPARE(out, "Trade::ImageData: data too small, got 9 but expected at least 12 bytes\n"); } void ImageDataTest::constructInvalidCubeMap() { CORRADE_SKIP_IF_NO_ASSERT(); - std::ostringstream out; + Containers::String out; Error redirectError{&out}; ImageData3D{PixelFormat::RGBA8Unorm, {3, 3, 5}, Containers::Array{3*3*5*4}, ImageFlag3D::CubeMap}; ImageData3D{PixelFormat::RGBA8Unorm, {3, 4, 6}, Containers::Array{3*4*6*4}, ImageFlag3D::CubeMap}; ImageData3D{PixelFormat::RGBA8Unorm, {3, 3, 17}, Containers::Array{3*3*17*4}, ImageFlag3D::CubeMap |ImageFlag3D::Array}; ImageData3D{PixelFormat::RGBA8Unorm, {4, 3, 18}, Containers::Array{4*3*18*4}, ImageFlag3D::CubeMap |ImageFlag3D::Array}; - CORRADE_COMPARE(out.str(), + CORRADE_COMPARE(out, "Trade::ImageData: expected exactly 6 faces for a cube map, got 5\n" "Trade::ImageData: expected square faces for a cube map, got {3, 4}\n" "Trade::ImageData: expected a multiple of 6 faces for a cube map array, got 17\n" @@ -681,30 +681,30 @@ void ImageDataTest::constructCompressedInvalidSize() { /* Too small for given format */ { - std::ostringstream out; + Containers::String out; Error redirectError{&out}; ImageData2D{CompressedPixelFormat::Bc2RGBAUnorm, {4, 4}, Containers::Array{2}}; - CORRADE_COMPARE(out.str(), "Trade::ImageData::ImageData(): data too small, got 2 but expected at least 4 bytes\n"); + CORRADE_COMPARE(out, "Trade::ImageData::ImageData(): data too small, got 2 but expected at least 4 bytes\n"); /* Size should be rounded up even if the image size is not full block */ } { - std::ostringstream out; + Containers::String out; Error redirectError{&out}; ImageData2D{CompressedPixelFormat::Bc2RGBAUnorm, {2, 2}, Containers::Array{2}}; - CORRADE_COMPARE(out.str(), "Trade::ImageData::ImageData(): data too small, got 2 but expected at least 4 bytes\n"); + CORRADE_COMPARE(out, "Trade::ImageData::ImageData(): data too small, got 2 but expected at least 4 bytes\n"); } } void ImageDataTest::constructCompressedInvalidCubeMap() { CORRADE_SKIP_IF_NO_ASSERT(); - std::ostringstream out; + Containers::String out; Error redirectError{&out}; ImageData3D{CompressedPixelFormat::Bc1RGBAUnorm, {3, 3, 5}, Containers::Array{8*5}, ImageFlag3D::CubeMap}; ImageData3D{CompressedPixelFormat::Bc1RGBAUnorm, {3, 4, 6}, Containers::Array{8*6}, ImageFlag3D::CubeMap}; ImageData3D{CompressedPixelFormat::Bc1RGBAUnorm, {3, 3, 17}, Containers::Array{8*17}, ImageFlag3D::CubeMap |ImageFlag3D::Array}; ImageData3D{CompressedPixelFormat::Bc1RGBAUnorm, {4, 3, 18}, Containers::Array{8*18}, ImageFlag3D::CubeMap |ImageFlag3D::Array}; - CORRADE_COMPARE(out.str(), + CORRADE_COMPARE(out, "Trade::ImageData: expected exactly 6 faces for a cube map, got 5\n" "Trade::ImageData: expected square faces for a cube map, got {3, 4}\n" "Trade::ImageData: expected a multiple of 6 faces for a cube map array, got 17\n" @@ -1018,7 +1018,7 @@ void ImageDataTest::mutableAccessNotAllowed() { const char data[4*4]{}; ImageData2D a{PixelFormat::RGBA8Unorm, {2, 2}, DataFlags{}, data}; - std::ostringstream out; + Containers::String out; Error redirectError{&out}; a.mutableData(); a.mutablePixels(); @@ -1032,7 +1032,7 @@ void ImageDataTest::mutableAccessNotAllowed() { /* a.mutablePixels() calls non-templated mutablePixels(), so assume there it will blow up correctly as well (can't test because it asserts inside arrayCast() due to zero stride) */ - CORRADE_COMPARE(out.str(), + CORRADE_COMPARE(out, "Trade::ImageData::mutableData(): the image is not mutable\n" "Trade::ImageData::mutablePixels(): the image is not mutable\n" "Trade::ImageData: the image is not mutable\n" @@ -1150,14 +1150,14 @@ void ImageDataTest::pixelsCompressed() { Trade::ImageData2D a{CompressedPixelFormat::Bc1RGBAUnorm, {4, 4}, Containers::Array{8}}; - std::ostringstream out; + Containers::String out; Error redirectError{&out}; a.pixels(); /* a.pixels() calls non-templated pixels(), so assume there it will blow up correctly as well (can't test because it asserts inside arrayCast() due to zero stride) */ - CORRADE_COMPARE(out.str(), "Trade::ImageData::pixels(): the image is compressed\n"); + CORRADE_COMPARE(out, "Trade::ImageData::pixels(): the image is compressed\n"); } }}}} diff --git a/src/Magnum/Trade/Test/LightDataTest.cpp b/src/Magnum/Trade/Test/LightDataTest.cpp index 16351727a..42ff56419 100644 --- a/src/Magnum/Trade/Test/LightDataTest.cpp +++ b/src/Magnum/Trade/Test/LightDataTest.cpp @@ -24,10 +24,10 @@ DEALINGS IN THE SOFTWARE. */ -#include +#include /* arraySize() */ +#include #include -#include -#include +#include #include "Magnum/Trade/LightData.h" @@ -391,10 +391,10 @@ void LightDataTest::constructInvalid() { auto&& data = ConstructInvalidData[testCaseInstanceId()]; setTestCaseDescription(data.name); - std::ostringstream out; + Containers::String out; Error redirectError{&out}; LightData{data.type, {}, {}, data.attenuation, data.range, data.innerConeAngle, data.outerConeAngle}; - CORRADE_COMPARE(out.str(), Utility::formatString("Trade::LightData: {}\n", data.message)); + CORRADE_COMPARE(out, Utility::format("Trade::LightData: {}\n", data.message)); } void LightDataTest::constructCopy() { @@ -436,17 +436,17 @@ void LightDataTest::constructMove() { } void LightDataTest::debugType() { - std::ostringstream out; + Containers::String out; Debug(&out) << LightType::Spot << LightType(0xbe); - CORRADE_COMPARE(out.str(), "Trade::LightType::Spot Trade::LightType(0xbe)\n"); + CORRADE_COMPARE(out, "Trade::LightType::Spot Trade::LightType(0xbe)\n"); } void LightDataTest::debugTypePacked() { - std::ostringstream out; + Containers::String out; /* Last is not packed, ones before should not make any flags persistent */ Debug(&out) << Debug::packed << LightType::Spot << Debug::packed << LightType(0xbe) << LightType::Ambient; - CORRADE_COMPARE(out.str(), "Spot 0xbe Trade::LightType::Ambient\n"); + CORRADE_COMPARE(out, "Spot 0xbe Trade::LightType::Ambient\n"); } }}}} diff --git a/src/Magnum/Trade/Test/MaterialDataTest.cpp b/src/Magnum/Trade/Test/MaterialDataTest.cpp index 8e217d61e..85b61c414 100644 --- a/src/Magnum/Trade/Test/MaterialDataTest.cpp +++ b/src/Magnum/Trade/Test/MaterialDataTest.cpp @@ -25,13 +25,11 @@ */ #include /* std::next_permutation() */ -#include #include -#include /* partition() on a std::string */ +#include #include #include #include -#include #include "Magnum/Math/Color.h" #include "Magnum/Math/Matrix3.h" @@ -363,11 +361,11 @@ void MaterialDataTest::layerName() { void MaterialDataTest::layerNameInvalid() { CORRADE_SKIP_IF_NO_ASSERT(); - std::ostringstream out; + Containers::String out; Error redirectError{&out}; materialLayerName(MaterialLayer(0x0)); materialLayerName(MaterialLayer(0xdeadbeef)); - CORRADE_COMPARE(out.str(), + CORRADE_COMPARE(out, "Trade::materialLayerName(): invalid layer Trade::MaterialLayer(0x0)\n" "Trade::materialLayerName(): invalid layer Trade::MaterialLayer(0xdeadbeef)\n"); } @@ -379,11 +377,11 @@ void MaterialDataTest::attributeName() { void MaterialDataTest::attributeNameInvalid() { CORRADE_SKIP_IF_NO_ASSERT(); - std::ostringstream out; + Containers::String out; Error redirectError{&out}; materialAttributeName(MaterialAttribute(0x0)); materialAttributeName(MaterialAttribute(0xdeadbeef)); - CORRADE_COMPARE(out.str(), + CORRADE_COMPARE(out, "Trade::materialAttributeName(): invalid attribute Trade::MaterialAttribute(0x0)\n" "Trade::materialAttributeName(): invalid attribute Trade::MaterialAttribute(0xdeadbeef)\n"); } @@ -411,13 +409,13 @@ void MaterialDataTest::attributeTypeSize() { void MaterialDataTest::attributeTypeSizeInvalid() { CORRADE_SKIP_IF_NO_ASSERT(); - std::ostringstream out; + Containers::String out; Error redirectError{&out}; materialAttributeTypeSize(MaterialAttributeType(0x0)); materialAttributeTypeSize(MaterialAttributeType(0xfe)); materialAttributeTypeSize(MaterialAttributeType::String); materialAttributeTypeSize(MaterialAttributeType::Buffer); - CORRADE_COMPARE(out.str(), + CORRADE_COMPARE(out, "Trade::materialAttributeTypeSize(): invalid type Trade::MaterialAttributeType(0x0)\n" "Trade::materialAttributeTypeSize(): invalid type Trade::MaterialAttributeType(0xfe)\n" "Trade::materialAttributeTypeSize(): string and buffer size is unknown\n" @@ -774,11 +772,11 @@ void MaterialDataTest::constructAttributeLayer() { void MaterialDataTest::constructAttributeInvalidName() { CORRADE_SKIP_IF_NO_ASSERT(); - std::ostringstream out; + Containers::String out; Error redirectError{&out}; MaterialAttributeData{MaterialAttribute(0x0), 5}; MaterialAttributeData{MaterialAttribute(0xfefe), 5}; - CORRADE_COMPARE(out.str(), + CORRADE_COMPARE(out, "Trade::MaterialAttributeData: invalid name Trade::MaterialAttribute(0x0)\n" "Trade::MaterialAttributeData: invalid name Trade::MaterialAttribute(0xfefe)\n"); } @@ -786,11 +784,11 @@ void MaterialDataTest::constructAttributeInvalidName() { void MaterialDataTest::constructAttributeInvalidLayerName() { CORRADE_SKIP_IF_NO_ASSERT(); - std::ostringstream out; + Containers::String out; Error redirectError{&out}; MaterialAttributeData{MaterialLayer(0x0)}; MaterialAttributeData{MaterialLayer(0xfefe)}; - CORRADE_COMPARE(out.str(), + CORRADE_COMPARE(out, "Trade::MaterialAttributeData: invalid name Trade::MaterialLayer(0x0)\n" "Trade::MaterialAttributeData: invalid name Trade::MaterialLayer(0xfefe)\n"); } @@ -798,21 +796,21 @@ void MaterialDataTest::constructAttributeInvalidLayerName() { void MaterialDataTest::constructAttributeWrongTypeForName() { CORRADE_SKIP_IF_NO_ASSERT(); - std::ostringstream out; + Containers::String out; Error redirectError{&out}; MaterialAttributeData{MaterialAttribute::DiffuseColor, Vector3ui{255, 16, 24}}; - CORRADE_COMPARE(out.str(), + CORRADE_COMPARE(out, "Trade::MaterialAttributeData: expected Trade::MaterialAttributeType::Vector4 for Trade::MaterialAttribute::DiffuseColor but got Trade::MaterialAttributeType::Vector3ui\n"); } void MaterialDataTest::constructAttributeInvalidType() { CORRADE_SKIP_IF_NO_ASSERT(); - std::ostringstream out; + Containers::String out; Error redirectError{&out}; MaterialAttributeData{"bla", MaterialAttributeType(0x0), nullptr}; MaterialAttributeData{"bla", MaterialAttributeType(0xfe), nullptr}; - CORRADE_COMPARE(out.str(), + CORRADE_COMPARE(out, "Trade::materialAttributeTypeSize(): invalid type Trade::MaterialAttributeType(0x0)\n" "Trade::materialAttributeTypeSize(): invalid type Trade::MaterialAttributeType(0xfe)\n"); } @@ -820,13 +818,13 @@ void MaterialDataTest::constructAttributeInvalidType() { void MaterialDataTest::constructAttributeEmptyName() { CORRADE_SKIP_IF_NO_ASSERT(); - std::ostringstream out; + Containers::String out; Error redirectError{&out}; MaterialAttributeData{"", Int{}}; /* Constexpr variant has the same assert, but in the header. It should have the same output. */ /*constexpr*/ MaterialAttributeData{""_s, Int{}}; - CORRADE_COMPARE(out.str(), + CORRADE_COMPARE(out, "Trade::MaterialAttributeData: name is not allowed to be empty\n" "Trade::MaterialAttributeData: name is not allowed to be empty\n"); } @@ -838,13 +836,13 @@ void MaterialDataTest::constructAttributeEmptyNameString() { MaterialAttributeData{"hello this string is empty", ""}; MaterialAttributeData{"hello this string is empty"_s, ""_s}; - std::ostringstream out; + Containers::String out; Error redirectError{&out}; MaterialAttributeData{"", "hello"}; /* Constexpr variant has the same assert, but in the header. It should have the same output. */ /*constexpr*/ MaterialAttributeData{""_s, "hello"_s}; - CORRADE_COMPARE(out.str(), + CORRADE_COMPARE(out, "Trade::MaterialAttributeData: name is not allowed to be empty\n" "Trade::MaterialAttributeData: name is not allowed to be empty\n"); } @@ -855,17 +853,17 @@ void MaterialDataTest::constructAttributeEmptyNameBuffer() { /* This has no reason to not be allowed */ MaterialAttributeData{"hello this buffer is empty", Containers::ArrayView{}}; - std::ostringstream out; + Containers::String out; Error redirectError{&out}; MaterialAttributeData{"", Containers::ArrayView{"E", 2}}; - CORRADE_COMPARE(out.str(), + CORRADE_COMPARE(out, "Trade::MaterialAttributeData: name is not allowed to be empty\n"); } void MaterialDataTest::constructAttributeTooLarge() { CORRADE_SKIP_IF_NO_ASSERT(); - std::ostringstream out; + Containers::String out; Error redirectError{&out}; MaterialAttributeData{"attributeIsLong", Matrix3x4{}}; /* Constexpr variant has the same assert, but in the header. It should have @@ -873,11 +871,11 @@ void MaterialDataTest::constructAttributeTooLarge() { lost when encountering T in there, so the assert is less useful. */ /*constexpr*/ MaterialAttributeData{"attributeIsLong"_s, Matrix3x4{}}; #ifndef CORRADE_MSVC2015_COMPATIBILITY - CORRADE_COMPARE(out.str(), + CORRADE_COMPARE(out, "Trade::MaterialAttributeData: name attributeIsLong too long, expected at most 14 bytes for Trade::MaterialAttributeType::Matrix3x4 but got 15\n" "Trade::MaterialAttributeData: name attributeIsLong too long, expected at most 14 bytes for Trade::MaterialAttributeType::Matrix3x4 but got 15\n"); #else - CORRADE_COMPARE(out.str(), + CORRADE_COMPARE(out, "Trade::MaterialAttributeData: name attributeIsLong too long, expected at most 14 bytes for Trade::MaterialAttributeType::Matrix3x4 but got 15\n" "Trade::MaterialAttributeData: name attributeIsLong too long, got 15 bytes\n"); #endif @@ -886,13 +884,13 @@ void MaterialDataTest::constructAttributeTooLarge() { void MaterialDataTest::constructAttributeTooLargeString() { CORRADE_SKIP_IF_NO_ASSERT(); - std::ostringstream out; + Containers::String out; Error redirectError{&out}; MaterialAttributeData{"attribute is long", "This is a problem, got a long piece of text!"}; /* Constexpr variant has the same assert, but in the header. It should have the same output. */ /*constexpr*/ MaterialAttributeData{"attribute is long"_s, "This is a problem, got a long piece of text!"_s}; - CORRADE_COMPARE(out.str(), + CORRADE_COMPARE(out, "Trade::MaterialAttributeData: name attribute is long and value This is a problem, got a long piece of text! too long, expected at most 60 bytes in total but got 61\n" "Trade::MaterialAttributeData: name attribute is long and value This is a problem, got a long piece of text! too long, expected at most 60 bytes in total but got 61\n"); } @@ -902,20 +900,20 @@ void MaterialDataTest::constructAttributeTooLargeBuffer() { int data[10]; /* 40 bytes */ - std::ostringstream out; + Containers::String out; Error redirectError{&out}; MaterialAttributeData{"attribute is very long", data}; - CORRADE_COMPARE(out.str(), + CORRADE_COMPARE(out, "Trade::MaterialAttributeData: name attribute is very long and a 40-byte value too long, expected at most 61 bytes in total but got 62\n"); } void MaterialDataTest::constructAttributeTooLargeNameString() { CORRADE_SKIP_IF_NO_ASSERT(); - std::ostringstream out; + Containers::String out; Error redirectError{&out}; MaterialAttributeData{MaterialAttribute::LayerName, "This is a problem, got a huge, yuuge value to store"}; - CORRADE_COMPARE(out.str(), + CORRADE_COMPARE(out, "Trade::MaterialAttributeData: name LayerName and value This is a problem, got a huge, yuuge value to store too long, expected at most 60 bytes in total but got 61\n"); } @@ -926,10 +924,10 @@ void MaterialDataTest::constructAttributeTooLargeNameBuffer() { void MaterialDataTest::constructAttributeWrongAccessType() { CORRADE_SKIP_IF_NO_ASSERT(); - std::ostringstream out; + Containers::String out; Error redirectError{&out}; MaterialAttributeData{"thing3", Matrix4x3{}}.value(); - CORRADE_COMPARE(out.str(), "Trade::MaterialAttributeData::value(): thing3 is Trade::MaterialAttributeType::Matrix4x3 but requested a type equivalent to Trade::MaterialAttributeType::Int\n"); + CORRADE_COMPARE(out, "Trade::MaterialAttributeData::value(): thing3 is Trade::MaterialAttributeType::Matrix4x3 but requested a type equivalent to Trade::MaterialAttributeType::Int\n"); } void MaterialDataTest::constructAttributeWrongAccessPointerType() { @@ -945,12 +943,12 @@ void MaterialDataTest::constructAttributeWrongAccessPointerType() { thing3.value(); boom.value(); - std::ostringstream out; + Containers::String out; Error redirectError{&out}; thing3.value(); thing3.value(); boom.value(); - CORRADE_COMPARE(out.str(), + CORRADE_COMPARE(out, "Trade::MaterialAttributeData::value(): thing3 is Trade::MaterialAttributeType::MutablePointer but requested a type equivalent to Trade::MaterialAttributeType::Int\n" "Trade::MaterialAttributeData::value(): thing3 is Trade::MaterialAttributeType::MutablePointer but requested a type equivalent to Trade::MaterialAttributeType::Pointer\n" "Trade::MaterialAttributeData::value(): boom is Trade::MaterialAttributeType::Pointer but requested a type equivalent to Trade::MaterialAttributeType::MutablePointer\n"); @@ -959,19 +957,19 @@ void MaterialDataTest::constructAttributeWrongAccessPointerType() { void MaterialDataTest::constructAttributeWrongAccessTypeString() { CORRADE_SKIP_IF_NO_ASSERT(); - std::ostringstream out; + Containers::String out; Error redirectError{&out}; MaterialAttributeData{"thing3", Matrix4x3{}}.value(); - CORRADE_COMPARE(out.str(), "Trade::MaterialAttributeData::value(): thing3 of Trade::MaterialAttributeType::Matrix4x3 can't be retrieved as a string\n"); + CORRADE_COMPARE(out, "Trade::MaterialAttributeData::value(): thing3 of Trade::MaterialAttributeType::Matrix4x3 can't be retrieved as a string\n"); } void MaterialDataTest::constructAttributeWrongAccessTypeBuffer() { CORRADE_SKIP_IF_NO_ASSERT(); - std::ostringstream out; + Containers::String out; Error redirectError{&out}; MaterialAttributeData{"thing3", Matrix4x3{}}.value>(); - CORRADE_COMPARE(out.str(), "Trade::MaterialAttributeData::value(): thing3 of Trade::MaterialAttributeType::Matrix4x3 can't be retrieved as a buffer\n"); + CORRADE_COMPARE(out, "Trade::MaterialAttributeData::value(): thing3 of Trade::MaterialAttributeType::Matrix4x3 can't be retrieved as a buffer\n"); } void MaterialDataTest::construct() { @@ -1111,13 +1109,13 @@ void MaterialDataTest::construct() { void MaterialDataTest::constructEmptyAttribute() { CORRADE_SKIP_IF_NO_ASSERT(); - std::ostringstream out; + Containers::String out; Error redirectError{&out}; MaterialData{{}, { {"DiffuseTexture"_s, 12u}, MaterialAttributeData{} }}; - CORRADE_COMPARE(out.str(), "Trade::MaterialData: attribute 1 doesn't specify anything\n"); + CORRADE_COMPARE(out, "Trade::MaterialData: attribute 1 doesn't specify anything\n"); } void MaterialDataTest::constructDuplicateAttribute() { @@ -1142,12 +1140,12 @@ void MaterialDataTest::constructDuplicateAttribute() { return a.name() < b.name(); }); - std::ostringstream out; + Containers::String out; Error redirectError{&out}; MaterialData data{{}, Utility::move(attributes), Containers::array({1, 1, 6})}; /* Because with graceful asserts it doesn't exit on error, the assertion might get printed multiple times */ - CORRADE_COMPARE(Containers::StringView{out.str()}.partition('\n')[0], "Trade::MaterialData: duplicate attribute DiffuseTextureCoordinates in layer 2"); + CORRADE_COMPARE(out.partition('\n')[0], "Trade::MaterialData: duplicate attribute DiffuseTextureCoordinates in layer 2"_s); } void MaterialDataTest::constructFromImmutableSortedArray() { @@ -1488,7 +1486,7 @@ void MaterialDataTest::constructLayers() { void MaterialDataTest::constructLayersNotMonotonic() { CORRADE_SKIP_IF_NO_ASSERT(); - std::ostringstream out; + Containers::String out; Error redirectError{&out}; MaterialData data{MaterialType::Phong, { {MaterialAttribute::DoubleSided, true}, @@ -1497,13 +1495,13 @@ void MaterialDataTest::constructLayersNotMonotonic() { {MaterialAttribute::LayerName, "ClearCoat"}, {MaterialAttribute::NormalTexture, 3u} }, {2, 5, 4, 5}}; - CORRADE_COMPARE(out.str(), "Trade::MaterialData: invalid range (5, 4) for layer 2 with 5 attributes in total\n"); + CORRADE_COMPARE(out, "Trade::MaterialData: invalid range (5, 4) for layer 2 with 5 attributes in total\n"); } void MaterialDataTest::constructLayersOffsetOutOfRange() { CORRADE_SKIP_IF_NO_ASSERT(); - std::ostringstream out; + Containers::String out; Error redirectError{&out}; MaterialData data{MaterialType::Phong, { {MaterialAttribute::DoubleSided, true}, @@ -1512,13 +1510,13 @@ void MaterialDataTest::constructLayersOffsetOutOfRange() { {MaterialAttribute::LayerName, "ClearCoat"}, {MaterialAttribute::NormalTexture, 3u} }, {2, 6}}; - CORRADE_COMPARE(out.str(), "Trade::MaterialData: invalid range (2, 6) for layer 1 with 5 attributes in total\n"); + CORRADE_COMPARE(out, "Trade::MaterialData: invalid range (2, 6) for layer 1 with 5 attributes in total\n"); } void MaterialDataTest::constructLayersLastOffsetTooShort() { CORRADE_SKIP_IF_NO_ASSERT(); - std::ostringstream out; + Containers::String out; Error redirectError{&out}; MaterialData data{MaterialType::Phong, { {MaterialAttribute::DoubleSided, true}, @@ -1526,7 +1524,7 @@ void MaterialDataTest::constructLayersLastOffsetTooShort() { {MaterialAttribute::LayerFactor, 0.5f}, {MaterialAttribute::NormalTexture, 3u} }, {1, 3}}; - CORRADE_COMPARE(out.str(), "Trade::MaterialData: last layer offset 3 too short for 4 attributes in total\n"); + CORRADE_COMPARE(out, "Trade::MaterialData: last layer offset 3 too short for 4 attributes in total\n"); } void MaterialDataTest::constructNonOwned() { @@ -1634,11 +1632,11 @@ void MaterialDataTest::constructNonOwnedEmptyAttribute() { MaterialAttributeData{} }; - std::ostringstream out; + Containers::String out; Error redirectError{&out}; /* nullptr to avoid attributes interpreted as importerState */ MaterialData{{}, {}, attributes, nullptr}; - CORRADE_COMPARE(out.str(), "Trade::MaterialData: attribute 1 doesn't specify anything\n"); + CORRADE_COMPARE(out, "Trade::MaterialData: attribute 1 doesn't specify anything\n"); } void MaterialDataTest::constructNonOwnedNotSorted() { @@ -1649,11 +1647,11 @@ void MaterialDataTest::constructNonOwnedNotSorted() { {"DiffuseTexture"_s, 12u} }; - std::ostringstream out; + Containers::String out; Error redirectError{&out}; /* nullptr to avoid attributes interpreted as importerState */ MaterialData{{}, {}, attributes, nullptr}; - CORRADE_COMPARE(out.str(), "Trade::MaterialData: DiffuseTexture has to be sorted before DiffuseTextureCoordinates if passing non-owned data\n"); + CORRADE_COMPARE(out, "Trade::MaterialData: DiffuseTexture has to be sorted before DiffuseTextureCoordinates if passing non-owned data\n"); } void MaterialDataTest::constructNonOwnedDuplicateAttribute() { @@ -1665,11 +1663,11 @@ void MaterialDataTest::constructNonOwnedDuplicateAttribute() { {"DiffuseTextureCoordinates"_s, 12u} }; - std::ostringstream out; + Containers::String out; Error redirectError{&out}; /* nullptr to avoid attributes interpreted as importerState */ MaterialData{{}, {}, attributes, nullptr}; - CORRADE_COMPARE(out.str(), "Trade::MaterialData: duplicate attribute DiffuseTextureCoordinates\n"); + CORRADE_COMPARE(out, "Trade::MaterialData: duplicate attribute DiffuseTextureCoordinates\n"); } void MaterialDataTest::constructNonOwnedLayersNotMonotonic() { @@ -1687,12 +1685,12 @@ void MaterialDataTest::constructNonOwnedLayersNotMonotonic() { 2, 5, 4, 5 }; - std::ostringstream out; + Containers::String out; Error redirectError{&out}; MaterialData data{MaterialType::Phong, {}, attributes, {}, layers}; - CORRADE_COMPARE(out.str(), "Trade::MaterialData: invalid range (5, 4) for layer 2 with 5 attributes in total\n"); + CORRADE_COMPARE(out, "Trade::MaterialData: invalid range (5, 4) for layer 2 with 5 attributes in total\n"); } void MaterialDataTest::constructNonOwnedLayersOffsetOutOfRange() { @@ -1710,12 +1708,12 @@ void MaterialDataTest::constructNonOwnedLayersOffsetOutOfRange() { 2, 6 }; - std::ostringstream out; + Containers::String out; Error redirectError{&out}; MaterialData data{MaterialType::Phong, {}, attributes, {}, layers}; - CORRADE_COMPARE(out.str(), "Trade::MaterialData: invalid range (2, 6) for layer 1 with 5 attributes in total\n"); + CORRADE_COMPARE(out, "Trade::MaterialData: invalid range (2, 6) for layer 1 with 5 attributes in total\n"); } void MaterialDataTest::constructNonOwnedLayersLastOffsetTooShort() { @@ -1732,12 +1730,12 @@ void MaterialDataTest::constructNonOwnedLayersLastOffsetTooShort() { 1, 3 }; - std::ostringstream out; + Containers::String out; Error redirectError{&out}; MaterialData data{MaterialType::Phong, {}, attributes, {}, layers}; - CORRADE_COMPARE(out.str(), "Trade::MaterialData: last layer offset 3 too short for 4 attributes in total\n"); + CORRADE_COMPARE(out, "Trade::MaterialData: last layer offset 3 too short for 4 attributes in total\n"); } void MaterialDataTest::constructNonOwnedAttributeFlagOwned() { @@ -1747,10 +1745,10 @@ void MaterialDataTest::constructNonOwnedAttributeFlagOwned() { {MaterialAttribute::DoubleSided, true} }; - std::ostringstream out; + Containers::String out; Error redirectError{&out}; MaterialData data{{}, DataFlag::Owned, attributes}; - CORRADE_COMPARE(out.str(), "Trade::MaterialData: can't construct with non-owned attribute data but Trade::DataFlag::Owned\n"); + CORRADE_COMPARE(out, "Trade::MaterialData: can't construct with non-owned attribute data but Trade::DataFlag::Owned\n"); } void MaterialDataTest::constructNonOwnedLayerFlagOwned() { @@ -1764,10 +1762,10 @@ void MaterialDataTest::constructNonOwnedLayerFlagOwned() { 0, 1 }; - std::ostringstream out; + Containers::String out; Error redirectError{&out}; MaterialData data{{}, {}, attributes, DataFlag::Owned, layers}; - CORRADE_COMPARE(out.str(), "Trade::MaterialData: can't construct with non-owned layer data but Trade::DataFlag::Owned\n"); + CORRADE_COMPARE(out, "Trade::MaterialData: can't construct with non-owned layer data but Trade::DataFlag::Owned\n"); } void MaterialDataTest::constructCopy() { @@ -2015,7 +2013,7 @@ void MaterialDataTest::accessOutOfRange() { {MaterialAttribute::SpecularTexture, 3u} }}; - std::ostringstream out; + Containers::String out; Error redirectError{&out}; data.attributeName(2); data.attributeType(2); @@ -2025,7 +2023,7 @@ void MaterialDataTest::accessOutOfRange() { data.mutableAttribute(2); data.mutableAttribute(2); data.mutableAttribute(2); - CORRADE_COMPARE(out.str(), + CORRADE_COMPARE(out, "Trade::MaterialData::attributeName(): index 2 out of range for 2 attributes in layer 0\n" "Trade::MaterialData::attributeType(): index 2 out of range for 2 attributes in layer 0\n" "Trade::MaterialData::attribute(): index 2 out of range for 2 attributes in layer 0\n" @@ -2047,7 +2045,7 @@ void MaterialDataTest::accessNotFound() { CORRADE_VERIFY(!data.hasAttribute("DiffuseColour")); CORRADE_VERIFY(!data.findAttributeId("DiffuseColour")); - std::ostringstream out; + Containers::String out; Error redirectError{&out}; data.attributeId("DiffuseColour"); data.attributeType("DiffuseColour"); @@ -2055,7 +2053,7 @@ void MaterialDataTest::accessNotFound() { data.attribute("DiffuseColour"); data.mutableAttribute("DiffuseColour"); data.mutableAttribute("DiffuseColour"); - CORRADE_COMPARE(out.str(), + CORRADE_COMPARE(out, "Trade::MaterialData::attributeId(): attribute DiffuseColour not found in layer 0\n" "Trade::MaterialData::attributeType(): attribute DiffuseColour not found in layer 0\n" "Trade::MaterialData::attribute(): attribute DiffuseColour not found in layer 0\n" @@ -2071,7 +2069,7 @@ void MaterialDataTest::accessWrongType() { {"DiffuseColor", 0xff3366aa_rgbaf} }}; - std::ostringstream out; + Containers::String out; Error redirectError{&out}; data.attribute(0); data.attribute(MaterialAttribute::DiffuseColor); @@ -2083,7 +2081,7 @@ void MaterialDataTest::accessWrongType() { data.findAttribute("DiffuseColor"); data.attributeOr(MaterialAttribute::DiffuseColor, Color3{1.0f}); data.attributeOr("DiffuseColor", Color3{1.0f}); - CORRADE_COMPARE(out.str(), + CORRADE_COMPARE(out, "Trade::MaterialData::attribute(): DiffuseColor is Trade::MaterialAttributeType::Vector4 but requested a type equivalent to Trade::MaterialAttributeType::Vector3\n" "Trade::MaterialData::attribute(): DiffuseColor is Trade::MaterialAttributeType::Vector4 but requested a type equivalent to Trade::MaterialAttributeType::Vector3\n" "Trade::MaterialData::attribute(): DiffuseColor is Trade::MaterialAttributeType::Vector4 but requested a type equivalent to Trade::MaterialAttributeType::Vector3\n" @@ -2115,7 +2113,7 @@ void MaterialDataTest::accessWrongPointerType() { data.mutableAttribute("mutablePointer"); data.mutableAttribute("pointer"); - std::ostringstream out; + Containers::String out; Error redirectError{&out}; data.attribute("mutablePointer"); data.attribute("mutablePointer"); @@ -2123,7 +2121,7 @@ void MaterialDataTest::accessWrongPointerType() { data.mutableAttribute("mutablePointer"); data.mutableAttribute("mutablePointer"); data.mutableAttribute("pointer"); - CORRADE_COMPARE(out.str(), + CORRADE_COMPARE(out, "Trade::MaterialData::attribute(): mutablePointer is Trade::MaterialAttributeType::MutablePointer but requested a type equivalent to Trade::MaterialAttributeType::Int\n" "Trade::MaterialData::attribute(): mutablePointer is Trade::MaterialAttributeType::MutablePointer but requested a type equivalent to Trade::MaterialAttributeType::Pointer\n" "Trade::MaterialData::attribute(): pointer is Trade::MaterialAttributeType::Pointer but requested a type equivalent to Trade::MaterialAttributeType::MutablePointer\n" @@ -2139,7 +2137,7 @@ void MaterialDataTest::accessWrongTypeString() { {"Shininess", 0.0f} }}; - std::ostringstream out; + Containers::String out; Error redirectError{&out}; data.attribute(0); data.attribute(MaterialAttribute::Shininess); @@ -2151,7 +2149,7 @@ void MaterialDataTest::accessWrongTypeString() { data.findAttribute("Shininess"); data.attributeOr(MaterialAttribute::Shininess, Containers::StringView{}); data.attributeOr("Shininess", Containers::StringView{}); - CORRADE_COMPARE(out.str(), + CORRADE_COMPARE(out, "Trade::MaterialData::attribute(): Shininess of Trade::MaterialAttributeType::Float can't be retrieved as a string\n" "Trade::MaterialData::attribute(): Shininess of Trade::MaterialAttributeType::Float can't be retrieved as a string\n" "Trade::MaterialData::attribute(): Shininess of Trade::MaterialAttributeType::Float can't be retrieved as a string\n" @@ -2173,7 +2171,7 @@ void MaterialDataTest::accessWrongTypeBuffer() { {"Shininess", 0.0f} }}; - std::ostringstream out; + Containers::String out; Error redirectError{&out}; data.attribute>(0); data.attribute>(MaterialAttribute::Shininess); @@ -2185,7 +2183,7 @@ void MaterialDataTest::accessWrongTypeBuffer() { data.findAttribute>("Shininess"); data.attributeOr(MaterialAttribute::Shininess, Containers::ArrayView{}); data.attributeOr("Shininess", Containers::ArrayView{}); - CORRADE_COMPARE(out.str(), + CORRADE_COMPARE(out, "Trade::MaterialData::attribute(): Shininess of Trade::MaterialAttributeType::Float can't be retrieved as a buffer\n" "Trade::MaterialData::attribute(): Shininess of Trade::MaterialAttributeType::Float can't be retrieved as a buffer\n" "Trade::MaterialData::attribute(): Shininess of Trade::MaterialAttributeType::Float can't be retrieved as a buffer\n" @@ -2366,7 +2364,7 @@ void MaterialDataTest::accessLayersInvalidTextures() { {MaterialAttribute::LayerName, "ClearCoat"}, }, {0, 1}}; - std::ostringstream out; + Containers::String out; Error redirectError{&out}; data.layerFactorTexture(1); data.layerFactorTexture("ClearCoat"); @@ -2383,7 +2381,7 @@ void MaterialDataTest::accessLayersInvalidTextures() { data.layerFactorTextureLayer(1); data.layerFactorTextureLayer("ClearCoat"); data.layerFactorTextureLayer(MaterialLayer::ClearCoat); - CORRADE_COMPARE(out.str(), + CORRADE_COMPARE(out, "Trade::MaterialData::attribute(): attribute LayerFactorTexture not found in layer 1\n" "Trade::MaterialData::attribute(): attribute LayerFactorTexture not found in layer ClearCoat\n" "Trade::MaterialData::attribute(): attribute LayerFactorTexture not found in layer ClearCoat\n" @@ -2632,7 +2630,7 @@ void MaterialDataTest::accessLayerOutOfRange() { /* This is fine */ data.attributeDataOffset(2); - std::ostringstream out; + Containers::String out; Error redirectError{&out}; data.attributeDataOffset(3); data.layerName(2); @@ -2674,7 +2672,7 @@ void MaterialDataTest::accessLayerOutOfRange() { data.findAttribute(2, MaterialAttribute::AlphaMask); data.attributeOr(2, "AlphaMask", false); data.attributeOr(2, MaterialAttribute::AlphaMask, false); - CORRADE_COMPARE(out.str(), + CORRADE_COMPARE(out, "Trade::MaterialData::attributeDataOffset(): index 3 out of range for 2 layers\n" "Trade::MaterialData::layerName(): index 2 out of range for 2 layers\n" "Trade::MaterialData::layerFactor(): index 2 out of range for 2 layers\n" @@ -2728,7 +2726,7 @@ void MaterialDataTest::accessLayerNotFound() { /* This is fine */ CORRADE_VERIFY(!data.findLayerId("ClearCoat")); - std::ostringstream out; + Containers::String out; Error redirectError{&out}; data.layerId("ClearCoat"); data.layerFactor("ClearCoat"); @@ -2768,7 +2766,7 @@ void MaterialDataTest::accessLayerNotFound() { data.findAttribute("ClearCoat", MaterialAttribute::AlphaMask); data.attributeOr("ClearCoat", "AlphaMask", false); data.attributeOr("ClearCoat", MaterialAttribute::AlphaMask, false); - CORRADE_COMPARE(out.str(), + CORRADE_COMPARE(out, "Trade::MaterialData::layerId(): layer ClearCoat not found\n" "Trade::MaterialData::layerFactor(): layer ClearCoat not found\n" "Trade::MaterialData::layerFactorTexture(): layer ClearCoat not found\n" @@ -2814,7 +2812,7 @@ void MaterialDataTest::accessInvalidLayerName() { MaterialData data{{}, {}}; - std::ostringstream out; + Containers::String out; Error redirectError{&out}; data.findLayerId(MaterialLayer(0x0)); data.findLayerId(MaterialLayer(0xfefe)); @@ -2856,7 +2854,7 @@ void MaterialDataTest::accessInvalidLayerName() { data.findAttribute(MaterialLayer(0xfefe), MaterialAttribute::AlphaMask); data.attributeOr(MaterialLayer(0xfefe), "AlphaMask", false); data.attributeOr(MaterialLayer(0xfefe), MaterialAttribute::AlphaMask, false); - CORRADE_COMPARE(out.str(), + CORRADE_COMPARE(out, "Trade::MaterialData::findLayerId(): invalid name Trade::MaterialLayer(0x0)\n" "Trade::MaterialData::findLayerId(): invalid name Trade::MaterialLayer(0xfefe)\n" "Trade::MaterialData::layerId(): invalid name Trade::MaterialLayer(0xfefe)\n" @@ -2907,7 +2905,7 @@ void MaterialDataTest::accessOutOfRangeInLayerIndex() { {MaterialAttribute::SpecularTexture, 3u} }, {0, 2}}; - std::ostringstream out; + Containers::String out; Error redirectError{&out}; data.attributeData(1, 2); data.attributeName(1, 2); @@ -2918,7 +2916,7 @@ void MaterialDataTest::accessOutOfRangeInLayerIndex() { data.mutableAttribute(1, 2); data.mutableAttribute(1, 2); data.mutableAttribute(1, 2); - CORRADE_COMPARE(out.str(), + CORRADE_COMPARE(out, "Trade::MaterialData::attributeData(): index 2 out of range for 2 attributes in layer 1\n" "Trade::MaterialData::attributeName(): index 2 out of range for 2 attributes in layer 1\n" "Trade::MaterialData::attributeType(): index 2 out of range for 2 attributes in layer 1\n" @@ -2938,7 +2936,7 @@ void MaterialDataTest::accessOutOfRangeInLayerString() { {MaterialAttribute::AlphaMask, 0.5f} }, {0, 2}}; - std::ostringstream out; + Containers::String out; Error redirectError{&out}; data.attributeName("ClearCoat", 2); data.attributeType("ClearCoat", 2); @@ -2948,7 +2946,7 @@ void MaterialDataTest::accessOutOfRangeInLayerString() { data.mutableAttribute("ClearCoat", 2); data.mutableAttribute("ClearCoat", 2); data.mutableAttribute("ClearCoat", 2); - CORRADE_COMPARE(out.str(), + CORRADE_COMPARE(out, "Trade::MaterialData::attributeName(): index 2 out of range for 2 attributes in layer ClearCoat\n" "Trade::MaterialData::attributeType(): index 2 out of range for 2 attributes in layer ClearCoat\n" "Trade::MaterialData::attribute(): index 2 out of range for 2 attributes in layer ClearCoat\n" @@ -2970,7 +2968,7 @@ void MaterialDataTest::accessNotFoundInLayerIndex() { CORRADE_VERIFY(!data.hasAttribute(1, "DiffuseColour")); CORRADE_VERIFY(!data.findAttributeId(1, "DiffuseColour")); - std::ostringstream out; + Containers::String out; Error redirectError{&out}; data.attributeId(1, "DiffuseColour"); data.attributeType(1, "DiffuseColour"); @@ -2978,7 +2976,7 @@ void MaterialDataTest::accessNotFoundInLayerIndex() { data.attribute(1, "DiffuseColour"); data.mutableAttribute(1, "DiffuseColour"); data.mutableAttribute(1, "DiffuseColour"); - CORRADE_COMPARE(out.str(), + CORRADE_COMPARE(out, "Trade::MaterialData::attributeId(): attribute DiffuseColour not found in layer 1\n" "Trade::MaterialData::attributeType(): attribute DiffuseColour not found in layer 1\n" "Trade::MaterialData::attribute(): attribute DiffuseColour not found in layer 1\n" @@ -2999,7 +2997,7 @@ void MaterialDataTest::accessNotFoundInLayerString() { CORRADE_VERIFY(!data.hasAttribute("ClearCoat", "DiffuseColour")); CORRADE_VERIFY(!data.findAttributeId("ClearCoat", "DiffuseColour")); - std::ostringstream out; + Containers::String out; Error redirectError{&out}; data.attributeId("ClearCoat", "DiffuseColour"); data.attributeType("ClearCoat", "DiffuseColour"); @@ -3007,7 +3005,7 @@ void MaterialDataTest::accessNotFoundInLayerString() { data.attribute("ClearCoat", "DiffuseColour"); data.mutableAttribute("ClearCoat", "DiffuseColour"); data.mutableAttribute("ClearCoat", "DiffuseColour"); - CORRADE_COMPARE(out.str(), + CORRADE_COMPARE(out, "Trade::MaterialData::attributeId(): attribute DiffuseColour not found in layer ClearCoat\n" "Trade::MaterialData::attributeType(): attribute DiffuseColour not found in layer ClearCoat\n" "Trade::MaterialData::attribute(): attribute DiffuseColour not found in layer ClearCoat\n" @@ -3024,7 +3022,7 @@ void MaterialDataTest::accessInvalidAttributeName() { /* The name should be converted to a string first and foremost and only then delegated to another overload. Which means all asserts should print the leaf function name. */ - std::ostringstream out; + Containers::String out; Error redirectError{&out}; data.hasAttribute(0, MaterialAttribute(0x0)); data.hasAttribute("Layer", MaterialAttribute(0xfefe)); @@ -3048,7 +3046,7 @@ void MaterialDataTest::accessInvalidAttributeName() { data.findAttribute("Layer", MaterialAttribute(0xfefe)); data.attributeOr(0, MaterialAttribute(0x0), 42); data.attributeOr("Layer", MaterialAttribute(0xfefe), 42); - CORRADE_COMPARE(out.str(), + CORRADE_COMPARE(out, "Trade::MaterialData::hasAttribute(): invalid name Trade::MaterialAttribute(0x0)\n" "Trade::MaterialData::hasAttribute(): invalid name Trade::MaterialAttribute(0xfefe)\n" "Trade::MaterialData::findAttributeId(): invalid name Trade::MaterialAttribute(0x0)\n" @@ -3090,7 +3088,7 @@ void MaterialDataTest::accessMutableNotAllowed() { MaterialData data{{}, {}, attributes, {}, layers}; - std::ostringstream out; + Containers::String out; Error redirectError{&out}; data.mutableAttribute(0); data.mutableAttribute("DiffuseColor"); @@ -3137,7 +3135,7 @@ void MaterialDataTest::accessMutableNotAllowed() { data.mutableAttribute>(MaterialLayer::ClearCoat, 2); data.mutableAttribute>(MaterialLayer::ClearCoat, "data"); /** @todo test also builtin buffer attribute access once it exists */ - CORRADE_COMPARE(out.str(), + CORRADE_COMPARE(out, "Trade::MaterialData::mutableAttribute(): attribute data not mutable\n" "Trade::MaterialData::mutableAttribute(): attribute data not mutable\n" "Trade::MaterialData::mutableAttribute(): attribute data not mutable\n" @@ -3341,108 +3339,108 @@ void MaterialDataTest::templateLayerAccessMutable() { } void MaterialDataTest::debugLayer() { - std::ostringstream out; + Containers::String out; Debug{&out} << MaterialLayer::ClearCoat << MaterialLayer(0xfefe) << MaterialLayer{}; - CORRADE_COMPARE(out.str(), "Trade::MaterialLayer::ClearCoat Trade::MaterialLayer(0xfefe) Trade::MaterialLayer(0x0)\n"); + CORRADE_COMPARE(out, "Trade::MaterialLayer::ClearCoat Trade::MaterialLayer(0xfefe) Trade::MaterialLayer(0x0)\n"); } void MaterialDataTest::debugAttribute() { - std::ostringstream out; + Containers::String out; Debug{&out} << MaterialAttribute::DiffuseTextureCoordinates << MaterialAttribute::LayerName << MaterialAttribute(0xfefe) << MaterialAttribute{}; - CORRADE_COMPARE(out.str(), "Trade::MaterialAttribute::DiffuseTextureCoordinates Trade::MaterialAttribute::LayerName Trade::MaterialAttribute(0xfefe) Trade::MaterialAttribute(0x0)\n"); + CORRADE_COMPARE(out, "Trade::MaterialAttribute::DiffuseTextureCoordinates Trade::MaterialAttribute::LayerName Trade::MaterialAttribute(0xfefe) Trade::MaterialAttribute(0x0)\n"); } void MaterialDataTest::debugTextureSwizzle() { - std::ostringstream out; + Containers::String out; /* The swizzle is encoded as a fourCC, so it just prints the numerical value as a char. Worst case this will print nothing or four garbage letters. Sorry in that case. */ Debug{&out} << MaterialTextureSwizzle::BA << MaterialTextureSwizzle{}; - CORRADE_COMPARE(out.str(), "Trade::MaterialTextureSwizzle::BA Trade::MaterialTextureSwizzle::\n"); + CORRADE_COMPARE(out, "Trade::MaterialTextureSwizzle::BA Trade::MaterialTextureSwizzle::\n"); } void MaterialDataTest::debugTextureSwizzlePacked() { - std::ostringstream out; + Containers::String out; /* Last is not packed, ones before should not make any flags persistent */ Debug{&out} << Debug::packed << MaterialTextureSwizzle::BA << Debug::packed << MaterialTextureSwizzle{} << MaterialTextureSwizzle::RG; - CORRADE_COMPARE(out.str(), "BA Trade::MaterialTextureSwizzle::RG\n"); + CORRADE_COMPARE(out, "BA Trade::MaterialTextureSwizzle::RG\n"); } void MaterialDataTest::debugAttributeType() { - std::ostringstream out; + Containers::String out; Debug{&out} << MaterialAttributeType::Matrix3x2 << MaterialAttributeType(0xfe); - CORRADE_COMPARE(out.str(), "Trade::MaterialAttributeType::Matrix3x2 Trade::MaterialAttributeType(0xfe)\n"); + CORRADE_COMPARE(out, "Trade::MaterialAttributeType::Matrix3x2 Trade::MaterialAttributeType(0xfe)\n"); } void MaterialDataTest::debugAttributeTypePacked() { - std::ostringstream out; + Containers::String out; /* Last is not packed, ones before should not make any flags persistent */ Debug{&out} << Debug::packed << MaterialAttributeType::Matrix3x2 << Debug::packed << MaterialAttributeType(0xfe) << MaterialAttributeType::Float; - CORRADE_COMPARE(out.str(), "Matrix3x2 0xfe Trade::MaterialAttributeType::Float\n"); + CORRADE_COMPARE(out, "Matrix3x2 0xfe Trade::MaterialAttributeType::Float\n"); } void MaterialDataTest::debugType() { - std::ostringstream out; + Containers::String out; Debug(&out) << MaterialType::Phong << MaterialType(0xbe); - CORRADE_COMPARE(out.str(), "Trade::MaterialType::Phong Trade::MaterialType(0xbe)\n"); + CORRADE_COMPARE(out, "Trade::MaterialType::Phong Trade::MaterialType(0xbe)\n"); } void MaterialDataTest::debugTypePacked() { - std::ostringstream out; + Containers::String out; /* Last is not packed, ones before should not make any flags persistent */ Debug{&out} << Debug::packed << MaterialType::Phong << Debug::packed << MaterialType(0xbe) << MaterialType::Flat; - CORRADE_COMPARE(out.str(), "Phong 0xbe Trade::MaterialType::Flat\n"); + CORRADE_COMPARE(out, "Phong 0xbe Trade::MaterialType::Flat\n"); } void MaterialDataTest::debugTypes() { - std::ostringstream out; + Containers::String out; Debug{&out} << (MaterialType::Phong|MaterialType(0xe0)) << MaterialTypes{}; - CORRADE_COMPARE(out.str(), "Trade::MaterialType::Phong|Trade::MaterialType(0xe0) Trade::MaterialTypes{}\n"); + CORRADE_COMPARE(out, "Trade::MaterialType::Phong|Trade::MaterialType(0xe0) Trade::MaterialTypes{}\n"); } void MaterialDataTest::debugTypesPacked() { - std::ostringstream out; + Containers::String out; /* Last is not packed, ones before should not make any flags persistent */ Debug{&out} << Debug::packed << (MaterialType::Phong|MaterialType(0xe0)) << Debug::packed << MaterialTypes{} << MaterialType::Flat; - CORRADE_COMPARE(out.str(), "Phong|0xe0 {} Trade::MaterialType::Flat\n"); + CORRADE_COMPARE(out, "Phong|0xe0 {} Trade::MaterialType::Flat\n"); } #ifdef MAGNUM_BUILD_DEPRECATED CORRADE_IGNORE_DEPRECATED_PUSH void MaterialDataTest::debugFlag() { - std::ostringstream out; + Containers::String out; Debug{&out} << MaterialData::Flag::DoubleSided << MaterialData::Flag(0xf0); - CORRADE_COMPARE(out.str(), "Trade::MaterialData::Flag::DoubleSided Trade::MaterialData::Flag(0xf0)\n"); + CORRADE_COMPARE(out, "Trade::MaterialData::Flag::DoubleSided Trade::MaterialData::Flag(0xf0)\n"); } void MaterialDataTest::debugFlags() { - std::ostringstream out; + Containers::String out; Debug{&out} << MaterialData::Flag::DoubleSided << MaterialData::Flags{}; - CORRADE_COMPARE(out.str(), "Trade::MaterialData::Flag::DoubleSided Trade::MaterialData::Flags{}\n"); + CORRADE_COMPARE(out, "Trade::MaterialData::Flag::DoubleSided Trade::MaterialData::Flags{}\n"); } CORRADE_IGNORE_DEPRECATED_POP #endif void MaterialDataTest::debugAlphaMode() { - std::ostringstream out; + Containers::String out; Debug{&out} << MaterialAlphaMode::Opaque << MaterialAlphaMode(0xee); - CORRADE_COMPARE(out.str(), "Trade::MaterialAlphaMode::Opaque Trade::MaterialAlphaMode(0xee)\n"); + CORRADE_COMPARE(out, "Trade::MaterialAlphaMode::Opaque Trade::MaterialAlphaMode(0xee)\n"); } void MaterialDataTest::debugAlphaModePacked() { - std::ostringstream out; + Containers::String out; /* Last is not packed, ones before should not make any flags persistent */ Debug{&out} << Debug::packed << MaterialAlphaMode::Opaque << Debug::packed << MaterialAlphaMode(0xee) << MaterialAlphaMode::Blend; - CORRADE_COMPARE(out.str(), "Opaque 0xee Trade::MaterialAlphaMode::Blend\n"); + CORRADE_COMPARE(out, "Opaque 0xee Trade::MaterialAlphaMode::Blend\n"); } }}}} diff --git a/src/Magnum/Trade/Test/MeshDataTest.cpp b/src/Magnum/Trade/Test/MeshDataTest.cpp index 208a3dc5e..0addb0d47 100644 --- a/src/Magnum/Trade/Test/MeshDataTest.cpp +++ b/src/Magnum/Trade/Test/MeshDataTest.cpp @@ -25,14 +25,12 @@ DEALINGS IN THE SOFTWARE. */ -#include #include -#include /** @todo remove once Debug is stream-free */ +#include #include #include #include #include -#include /** @todo remove once Debug is stream-free */ #include "Magnum/Math/Color.h" #include "Magnum/Math/Half.h" @@ -548,32 +546,32 @@ void MeshDataTest::customAttributeName() { void MeshDataTest::customAttributeNameTooLarge() { CORRADE_SKIP_IF_NO_ASSERT(); - std::ostringstream out; + Containers::String out; Error redirectError{&out}; meshAttributeCustom(32768); - CORRADE_COMPARE(out.str(), "Trade::meshAttributeCustom(): index 32768 too large\n"); + CORRADE_COMPARE(out, "Trade::meshAttributeCustom(): index 32768 too large\n"); } void MeshDataTest::customAttributeNameNotCustom() { CORRADE_SKIP_IF_NO_ASSERT(); - std::ostringstream out; + Containers::String out; Error redirectError{&out}; meshAttributeCustom(MeshAttribute::TextureCoordinates); - CORRADE_COMPARE(out.str(), "Trade::meshAttributeCustom(): Trade::MeshAttribute::TextureCoordinates is not custom\n"); + CORRADE_COMPARE(out, "Trade::meshAttributeCustom(): Trade::MeshAttribute::TextureCoordinates is not custom\n"); } void MeshDataTest::debugAttributeName() { - std::ostringstream out; + Containers::String out; Debug{&out} << MeshAttribute::Position << meshAttributeCustom(73) << MeshAttribute(0x73); - CORRADE_COMPARE(out.str(), "Trade::MeshAttribute::Position Trade::MeshAttribute::Custom(73) Trade::MeshAttribute(0x73)\n"); + CORRADE_COMPARE(out, "Trade::MeshAttribute::Position Trade::MeshAttribute::Custom(73) Trade::MeshAttribute(0x73)\n"); } void MeshDataTest::debugAttributeNamePacked() { - std::ostringstream out; + Containers::String out; /* Last is not packed, ones before should not make any flags persistent */ Debug{&out} << Debug::packed << MeshAttribute::Position << Debug::packed << meshAttributeCustom(73) << Debug::packed << MeshAttribute(0x73) << MeshAttribute::Normal; - CORRADE_COMPARE(out.str(), "Position Custom(73) 0x73 Trade::MeshAttribute::Normal\n"); + CORRADE_COMPARE(out, "Position Custom(73) 0x73 Trade::MeshAttribute::Normal\n"); } using namespace Math::Literals; @@ -703,11 +701,11 @@ void MeshDataTest::constructIndexStridedWrongStride() { MeshIndexData{Containers::StridedArrayView1D{Containers::arrayCast(toomuch), 2, 32767}}; MeshIndexData{Containers::StridedArrayView1D{Containers::arrayCast(toomuch), 2, 32768}.flipped<0>()}; - std::ostringstream out; + Containers::String out; Error redirectError{&out}; MeshIndexData{Containers::StridedArrayView1D{Containers::arrayCast(toomuch), 2, 32768}}; MeshIndexData{Containers::StridedArrayView1D{Containers::arrayCast(toomuch), 2, 32769}.flipped<0>()}; - CORRADE_COMPARE(out.str(), + CORRADE_COMPARE(out, "Trade::MeshIndexData: expected stride to fit into 16 bits but got 32768\n" "Trade::MeshIndexData: expected stride to fit into 16 bits but got -32769\n"); } @@ -726,10 +724,10 @@ void MeshDataTest::constructIndexTypeErasedContiguousImplementationSpecificForma const char indexData[3*2]{}; - std::ostringstream out; + Containers::String out; Error redirectError{&out}; MeshIndexData{meshIndexTypeWrap(0xcaca), indexData}; - CORRADE_COMPARE(out.str(), "Trade::MeshIndexData: can't create index data from a contiguous view and an implementation-specific type 0xcaca, pass a strided view instead\n"); + CORRADE_COMPARE(out, "Trade::MeshIndexData: can't create index data from a contiguous view and an implementation-specific type 0xcaca, pass a strided view instead\n"); } void MeshDataTest::constructIndexTypeErasedContiguousWrongSize() { @@ -737,10 +735,10 @@ void MeshDataTest::constructIndexTypeErasedContiguousWrongSize() { const char indexData[3*2]{}; - std::ostringstream out; + Containers::String out; Error redirectError{&out}; MeshIndexData{MeshIndexType::UnsignedInt, indexData}; - CORRADE_COMPARE(out.str(), "Trade::MeshIndexData: view size 6 does not correspond to MeshIndexType::UnsignedInt\n"); + CORRADE_COMPARE(out, "Trade::MeshIndexData: view size 6 does not correspond to MeshIndexType::UnsignedInt\n"); } constexpr const char IndexData[3*4]{}; @@ -781,11 +779,11 @@ void MeshDataTest::constructIndexTypeErasedStridedWrongStride() { MeshIndexData{MeshIndexType::UnsignedByte, Containers::StridedArrayView1D{toomuch, 2, 32767}}; MeshIndexData{MeshIndexType::UnsignedByte, Containers::StridedArrayView1D{Containers::arrayCast(toomuch), 2, 32768}.flipped<0>()}; - std::ostringstream out; + Containers::String out; Error redirectError{&out}; MeshIndexData{MeshIndexType::UnsignedByte, Containers::StridedArrayView1D{toomuch, 2, 32768}}; MeshIndexData{MeshIndexType::UnsignedByte, Containers::StridedArrayView1D{Containers::arrayCast(toomuch), 2, 32769}.flipped<0>()}; - CORRADE_COMPARE(out.str(), + CORRADE_COMPARE(out, "Trade::MeshIndexData: expected stride to fit into 16 bits but got 32768\n" "Trade::MeshIndexData: expected stride to fit into 16 bits but got -32769\n"); } @@ -830,10 +828,10 @@ void MeshDataTest::constructIndex2DWrongSize() { const char data[3*3]{}; - std::ostringstream out; + Containers::String out; Error redirectError{&out}; MeshIndexData{Containers::StridedArrayView2D{data, {3, 3}}}; - CORRADE_COMPARE(out.str(), "Trade::MeshIndexData: expected index type size 1, 2 or 4 but got 3\n"); + CORRADE_COMPARE(out, "Trade::MeshIndexData: expected index type size 1, 2 or 4 but got 3\n"); } void MeshDataTest::constructIndex2DWrongStride() { @@ -845,11 +843,11 @@ void MeshDataTest::constructIndex2DWrongStride() { MeshIndexData{Containers::StridedArrayView2D{toomuch, {2, 1}, {32767, 1}}}; MeshIndexData{Containers::StridedArrayView2D{toomuch, {2, 1}, {32768, 1}}.flipped<0>()}; - std::ostringstream out; + Containers::String out; Error redirectError{&out}; MeshIndexData{Containers::StridedArrayView2D{toomuch, {2, 1}, {32768, 1}}}; MeshIndexData{Containers::StridedArrayView2D{toomuch, {2, 1}, {32769, 1}}.flipped<0>()}; - CORRADE_COMPARE(out.str(), + CORRADE_COMPARE(out, "Trade::MeshIndexData: expected stride to fit into 16 bits but got 32768\n" "Trade::MeshIndexData: expected stride to fit into 16 bits but got -32769\n"); } @@ -862,10 +860,10 @@ void MeshDataTest::constructIndex2DNonContiguous() { /* This should be fine */ MeshIndexData{Containers::StridedArrayView2D{data, {3, 2}, {4, 1}}}; - std::ostringstream out; + Containers::String out; Error redirectError{&out}; MeshIndexData{Containers::StridedArrayView2D{data, {3, 2}, {4, 2}}}; - CORRADE_COMPARE(out.str(), "Trade::MeshIndexData: second view dimension is not contiguous\n"); + CORRADE_COMPARE(out, "Trade::MeshIndexData: second view dimension is not contiguous\n"); } void MeshDataTest::constructIndexNullptr() { @@ -1002,12 +1000,12 @@ void MeshDataTest::constructAttribute2DWrongSize() { char positionData[4*sizeof(Vector2)]{}; - std::ostringstream out; + Containers::String out; Error redirectError{&out}; MeshAttributeData{MeshAttribute::Position, VertexFormat::Vector3, Containers::StridedArrayView2D{positionData, {4, sizeof(Vector2)}}.every(2)}; - CORRADE_COMPARE(out.str(), "Trade::MeshAttributeData: second view dimension size 8 doesn't match VertexFormat::Vector3\n"); + CORRADE_COMPARE(out, "Trade::MeshAttributeData: second view dimension size 8 doesn't match VertexFormat::Vector3\n"); } void MeshDataTest::constructAttribute2DNonContiguous() { @@ -1015,12 +1013,12 @@ void MeshDataTest::constructAttribute2DNonContiguous() { char positionData[4*sizeof(Vector2)]{}; - std::ostringstream out; + Containers::String out; Error redirectError{&out}; MeshAttributeData{MeshAttribute::Position, VertexFormat::Vector2, Containers::StridedArrayView2D{positionData, {2, sizeof(Vector2)*2}}.every({1, 2})}; - CORRADE_COMPARE(out.str(), "Trade::MeshAttributeData: second view dimension is not contiguous\n"); + CORRADE_COMPARE(out, "Trade::MeshAttributeData: second view dimension is not contiguous\n"); } void MeshDataTest::constructAttributeTypeErased() { @@ -1169,11 +1167,11 @@ void MeshDataTest::constructAttributeWrongFormat() { Vector2 positionData[3]; - std::ostringstream out; + Containers::String out; Error redirectError{&out}; MeshAttributeData{MeshAttribute::Color, Containers::arrayView(positionData)}; MeshAttributeData{MeshAttribute::Color, VertexFormat::Vector2, 0, 3, sizeof(Vector2)}; - CORRADE_COMPARE(out.str(), + CORRADE_COMPARE(out, "Trade::MeshAttributeData: VertexFormat::Vector2 is not a valid format for Trade::MeshAttribute::Color\n" "Trade::MeshAttributeData: VertexFormat::Vector2 is not a valid format for Trade::MeshAttribute::Color\n"); } @@ -1185,12 +1183,12 @@ void MeshDataTest::constructAttributeWrongSize() { /* This should be fine */ MeshAttributeData{MeshAttribute::Position, Containers::ArrayView{nullptr, 0xffffffffu}}; - std::ostringstream out; + Containers::String out; Error redirectError{&out}; MeshAttributeData{MeshAttribute::Position, Containers::ArrayView{nullptr, 0x100000000ull}}; /* The offset-only constructors takes the count as an UnsignedInt already, nothing to check there */ - CORRADE_COMPARE(out.str(), + CORRADE_COMPARE(out, "Trade::MeshAttributeData: expected vertex count to fit into 32 bits but got 4294967296\n"); } #endif @@ -1208,7 +1206,7 @@ void MeshDataTest::constructAttributeWrongStride() { MeshAttributeData{32767}; MeshAttributeData{-32768}; - std::ostringstream out; + Containers::String out; Error redirectError{&out}; MeshAttributeData{MeshAttribute::Position, Containers::StridedArrayView1D{Containers::arrayCast(toomuch), 2, 32768}}; MeshAttributeData{MeshAttribute::Position, Containers::StridedArrayView1D{Containers::arrayCast(toomuch), 2, 32769}.flipped<0>()}; @@ -1216,7 +1214,7 @@ void MeshDataTest::constructAttributeWrongStride() { MeshAttributeData{MeshAttribute::Position, VertexFormat::Vector2, 65536, 1, -32769}; MeshAttributeData{32768}; MeshAttributeData{-32769}; - CORRADE_COMPARE(out.str(), + CORRADE_COMPARE(out, "Trade::MeshAttributeData: expected stride to fit into 16 bits but got 32768\n" "Trade::MeshAttributeData: expected stride to fit into 16 bits but got -32769\n" "Trade::MeshAttributeData: expected stride to fit into 16 bits but got 32768\n" @@ -1236,13 +1234,13 @@ void MeshDataTest::constructAttributeWrongMorphTargetId() { MeshAttributeData{MeshAttribute::Position, VertexFormat::Vector2, 0, 1, sizeof(Vector2), 0, -1}; MeshAttributeData{MeshAttribute::Position, VertexFormat::Vector2, 0, 1, sizeof(Vector2), 0, 127}; - std::ostringstream out; + Containers::String out; Error redirectError{&out}; MeshAttributeData{MeshAttribute::Position, Containers::arrayView(positions), -56}; MeshAttributeData{MeshAttribute::Position, Containers::arrayView(positions), 128}; MeshAttributeData{MeshAttribute::Position, VertexFormat::Vector2, 0, 1, sizeof(Vector2), 0, -56}; MeshAttributeData{MeshAttribute::Position, VertexFormat::Vector2, 0, 1, sizeof(Vector2), 0, 128}; - CORRADE_COMPARE(out.str(), + CORRADE_COMPARE(out, "Trade::MeshAttributeData: expected morph target ID to be either -1 or less than 128 but got -56\n" "Trade::MeshAttributeData: expected morph target ID to be either -1 or less than 128 but got 128\n" "Trade::MeshAttributeData: expected morph target ID to be either -1 or less than 128 but got -56\n" @@ -1260,13 +1258,13 @@ void MeshDataTest::constructAttributeMorphTargetNotAllowed() { MeshAttributeData{MeshAttribute::ObjectId, VertexFormat::UnsignedInt, 0, 4, sizeof(UnsignedInt), 0, -1}; MeshAttributeData{MeshAttribute::JointIds, VertexFormat::UnsignedInt, 0, 1, sizeof(UnsignedInt), 4, -1}; - std::ostringstream out; + Containers::String out; Error redirectError{&out}; MeshAttributeData{MeshAttribute::ObjectId, Containers::arrayView(ids), 37}; MeshAttributeData{MeshAttribute::JointIds, Containers::stridedArrayView(ids).expanded<0>(Containers::Size2D{1, 4}), 37}; MeshAttributeData{MeshAttribute::ObjectId, VertexFormat::UnsignedInt, 0, 4, sizeof(UnsignedInt), 0, 37}; MeshAttributeData{MeshAttribute::JointIds, VertexFormat::UnsignedInt, 0, 1, sizeof(UnsignedInt), 4, 37}; - CORRADE_COMPARE(out.str(), + CORRADE_COMPARE(out, "Trade::MeshAttributeData: morph target not allowed for Trade::MeshAttribute::ObjectId\n" "Trade::MeshAttributeData: morph target not allowed for Trade::MeshAttribute::JointIds\n" "Trade::MeshAttributeData: morph target not allowed for Trade::MeshAttribute::ObjectId\n" @@ -1283,10 +1281,10 @@ void MeshDataTest::constructAttributeOnlyArrayAllowed() { MeshAttributeData{meshAttributeCustom(25), VertexFormat::Vector2, data}; MeshAttributeData{meshAttributeCustom(25), VertexFormat::Float, data, 2}; - std::ostringstream out; + Containers::String out; Error redirectError{&out}; MeshAttributeData{MeshAttribute::Weights, VertexFormat::Float, data}; - CORRADE_COMPARE(out.str(), + CORRADE_COMPARE(out, "Trade::MeshAttributeData: Trade::MeshAttribute::Weights has to be an array attribute\n"); } @@ -1301,10 +1299,10 @@ void MeshDataTest::constructAttributeWrongDataAccess() { a.data(positionData); /* This is fine, no asserts */ - std::ostringstream out; + Containers::String out; Error redirectError{&out}; b.data(); - CORRADE_COMPARE(out.str(), + CORRADE_COMPARE(out, "Trade::MeshAttributeData::data(): the attribute is offset-only, supply a data array\n"); } @@ -1370,12 +1368,12 @@ void MeshDataTest::constructArrayAttributeNonContiguous() { Vector2 vertexData[4*3]{}; - std::ostringstream out; + Containers::String out; Error redirectError{&out}; MeshAttributeData{meshAttributeCustom(35), Containers::StridedArrayView2D{vertexData, {4, 3}}.every({1, 2})}; - CORRADE_COMPARE(out.str(), "Trade::MeshAttributeData: second view dimension is not contiguous\n"); + CORRADE_COMPARE(out, "Trade::MeshAttributeData: second view dimension is not contiguous\n"); } void MeshDataTest::constructArrayAttribute2D() { @@ -1409,12 +1407,12 @@ void MeshDataTest::constructArrayAttribute2DWrongSize() { char vertexData[3*4*sizeof(Vector2)]{}; - std::ostringstream out; + Containers::String out; Error redirectError{&out}; MeshAttributeData{meshAttributeCustom(35), VertexFormat::Vector2, Containers::StridedArrayView2D{vertexData, {3, 4*sizeof(Vector2)}}, 3}; - CORRADE_COMPARE(out.str(), "Trade::MeshAttributeData: second view dimension size 32 doesn't match VertexFormat::Vector2 and array size 3\n"); + CORRADE_COMPARE(out, "Trade::MeshAttributeData: second view dimension size 32 doesn't match VertexFormat::Vector2 and array size 3\n"); } void MeshDataTest::constructArrayAttribute2DNonContiguous() { @@ -1422,12 +1420,12 @@ void MeshDataTest::constructArrayAttribute2DNonContiguous() { char vertexData[4*3*sizeof(Vector2)]{}; - std::ostringstream out; + Containers::String out; Error redirectError{&out}; MeshAttributeData{meshAttributeCustom(35), VertexFormat::Vector2, Containers::StridedArrayView2D{vertexData, {3, sizeof(Vector2)*4}}.every({1, 2}), 2}; - CORRADE_COMPARE(out.str(), "Trade::MeshAttributeData: second view dimension is not contiguous\n"); + CORRADE_COMPARE(out, "Trade::MeshAttributeData: second view dimension is not contiguous\n"); } void MeshDataTest::constructArrayAttributeTypeErased() { @@ -1552,13 +1550,13 @@ void MeshDataTest::constructArrayAttributeNotAllowed() { MeshAttributeData{meshAttributeCustom(35), vertexFormatWrap(0xdead), 0, 3, 6*sizeof(Vector2), 3}; /* This is not */ - std::ostringstream out; + Containers::String out; Error redirectError{&out}; MeshAttributeData{MeshAttribute::Position, VertexFormat::Vector2b, positions, 3}; MeshAttributeData{MeshAttribute::Position, positions2D}; MeshAttributeData{MeshAttribute::Position, VertexFormat::Vector2, positions2Dchar, 3}; MeshAttributeData{MeshAttribute::Position, VertexFormat::Vector2, 0, 3, 6*sizeof(Vector2), 3}; - CORRADE_COMPARE(out.str(), + CORRADE_COMPARE(out, "Trade::MeshAttributeData: Trade::MeshAttribute::Position can't be an array attribute\n" "Trade::MeshAttributeData: Trade::MeshAttribute::Position can't be an array attribute\n" "Trade::MeshAttributeData: Trade::MeshAttribute::Position can't be an array attribute\n" @@ -2809,19 +2807,19 @@ void MeshDataTest::constructIndexDataButNotIndexed() { Containers::Array indexData{6}; MeshAttributeData positions{MeshAttribute::Position, VertexFormat::Vector2, nullptr}; - std::ostringstream out; + Containers::String out; Error redirectError{&out}; MeshData{MeshPrimitive::Points, Utility::move(indexData), MeshIndexData{}, nullptr, {positions}}; - CORRADE_COMPARE(out.str(), "Trade::MeshData: indexData passed for a non-indexed mesh\n"); + CORRADE_COMPARE(out, "Trade::MeshData: indexData passed for a non-indexed mesh\n"); } void MeshDataTest::constructAttributelessImplicitVertexCount() { CORRADE_SKIP_IF_NO_ASSERT(); - std::ostringstream out; + Containers::String out; Error redirectError{&out}; MeshData{MeshPrimitive::Points, nullptr, {}}; - CORRADE_COMPARE(out.str(), "Trade::MeshData: vertex count can't be implicit if there are no attributes\n"); + CORRADE_COMPARE(out, "Trade::MeshData: vertex count can't be implicit if there are no attributes\n"); } void MeshDataTest::constructIndicesNotContained() { @@ -2842,7 +2840,7 @@ void MeshDataTest::constructIndicesNotContained() { ending at 0xbaddaf */ MeshData{MeshPrimitive::Triangles, {}, indexData, MeshIndexData{meshIndexTypeWrap(0xcaca), Containers::StridedArrayView1D{{reinterpret_cast(0xbaddaf), 1}, 1}.broadcasted<0>(3)}, 1}; - std::ostringstream out; + Containers::String out; Error redirectError{&out}; /* Basic "obviously wrong" case with owned index data */ MeshData{MeshPrimitive::Triangles, Utility::move(sameIndexDataButMovable), MeshIndexData{indexDataOut}, 1}; @@ -2866,7 +2864,7 @@ void MeshDataTest::constructIndicesNotContained() { zero size, and the stride is zero as well, but since it starts one byte after, it's wrong */ MeshData{MeshPrimitive::Triangles, {}, indexData, MeshIndexData{meshIndexTypeWrap(0xcaca), Containers::StridedArrayView1D{{reinterpret_cast(0xbaddaf + 1), 1}, 1}.broadcasted<0>(3)}, 1}; - CORRADE_COMPARE(out.str(), + CORRADE_COMPARE(out, "Trade::MeshData: indices [0xdead:0xdeb3] are not contained in passed indexData array [0xbadda9:0xbaddaf]\n" "Trade::MeshData: indices [0xbaddaa:0xbaddb0] are not contained in passed indexData array [0xbadda9:0xbaddaf]\n" "Trade::MeshData: indices [0xbadda9:0xbaddb3] are not contained in passed indexData array [0xbadda9:0xbaddaf]\n" @@ -2914,7 +2912,7 @@ void MeshDataTest::constructAttributeNotContained() { MeshAttributeData{MeshAttribute::Position, vertexFormatWrap(0xcaca), Containers::StridedArrayView1D{{reinterpret_cast(0xbaddc1), 1}, 1}.broadcasted<0>(3)} }}; - std::ostringstream out; + Containers::String out; Error redirectError{&out}; /* Basic "obviously wrong" case with owned vertex data */ MeshData{MeshPrimitive::Triangles, Utility::move(sameVertexDataButMovable), { @@ -2972,7 +2970,7 @@ void MeshDataTest::constructAttributeNotContained() { MeshData{MeshPrimitive::Triangles, {}, vertexData, { MeshAttributeData{MeshAttribute::Position, vertexFormatWrap(0xcaca), Containers::StridedArrayView1D{{reinterpret_cast(0xbaddc1 + 1), 1}, 1}.broadcasted<0>(3)} }}; - CORRADE_COMPARE(out.str(), + CORRADE_COMPARE(out, "Trade::MeshData: attribute 1 [0xdead:0xdec5] is not contained in passed vertexData array [0xbadda9:0xbaddc1]\n" "Trade::MeshData: attribute 0 [0xbaddaa:0xbaddc2] is not contained in passed vertexData array [0xbadda9:0xbaddc1]\n" "Trade::MeshData: attribute 0 [0xbadda9:0xbaddc9] is not contained in passed vertexData array [0xbadda9:0xbaddc1]\n" @@ -2999,7 +2997,7 @@ void MeshDataTest::constructInconsitentVertexCount() { MeshAttributeData positions2{MeshAttribute::Position, Containers::arrayCast(vertexData).prefix(2)}; - std::ostringstream out; + Containers::String out; Error redirectError{&out}; /* The explicit vertex count should be ignored for the assertion message, we only check that all passed attribute arrays have the same vertex @@ -3007,7 +3005,7 @@ void MeshDataTest::constructInconsitentVertexCount() { checked with the explicit vertex count -- see the constructAttributeNotContained() test above. */ MeshData{MeshPrimitive::Triangles, Utility::move(vertexData), {positions, positions2}, 17}; - CORRADE_COMPARE(out.str(), + CORRADE_COMPARE(out, "Trade::MeshData: attribute 1 has 2 vertices but 3 expected\n"); } @@ -3022,7 +3020,7 @@ void MeshDataTest::constructDifferentJointIdWeightCount() { } vertices[3]{}; auto view = Containers::stridedArrayView(vertices); - std::ostringstream out; + Containers::String out; Error redirectError{&out}; MeshData{MeshPrimitive::Points, {}, vertices, { /* Weights required to be here by the constructor */ @@ -3033,7 +3031,7 @@ void MeshDataTest::constructDifferentJointIdWeightCount() { MeshAttributeData{MeshAttribute::JointIds, VertexFormat::UnsignedShort, view.slice(&Vertex::secondaryJointIds), 4} }}; - CORRADE_COMPARE(out.str(), "Trade::MeshData: expected 2 weight attributes to match joint IDs but got 1\n"); + CORRADE_COMPARE(out, "Trade::MeshData: expected 2 weight attributes to match joint IDs but got 1\n"); } void MeshDataTest::constructInconsistentJointIdWeightArraySizes() { @@ -3048,7 +3046,7 @@ void MeshDataTest::constructInconsistentJointIdWeightArraySizes() { } vertices[3]{}; auto view = Containers::stridedArrayView(vertices); - std::ostringstream out; + Containers::String out; Error redirectError{&out}; MeshData{MeshPrimitive::Points, {}, vertices, { /* Weights required to be here by the constructor */ @@ -3061,7 +3059,7 @@ void MeshDataTest::constructInconsistentJointIdWeightArraySizes() { MeshAttributeData{MeshAttribute::JointIds, VertexFormat::UnsignedShort, view.slice(&Vertex::secondaryJointIds), 4} }}; - CORRADE_COMPARE(out.str(), "Trade::MeshData: expected 4 array items for weight attribute 1 to match joint IDs but got 3\n"); + CORRADE_COMPARE(out, "Trade::MeshData: expected 4 array items for weight attribute 1 to match joint IDs but got 3\n"); } void MeshDataTest::constructNotOwnedIndexFlagOwned() { @@ -3074,10 +3072,10 @@ void MeshDataTest::constructNotOwnedIndexFlagOwned() { MeshAttributeData positions{MeshAttribute::Position, Containers::arrayView(vertexData)}; - std::ostringstream out; + Containers::String out; Error redirectError{&out}; MeshData data{MeshPrimitive::Triangles, DataFlag::Owned, indexData, indices, {}, vertexData, {positions}}; - CORRADE_COMPARE(out.str(), + CORRADE_COMPARE(out, "Trade::MeshData: can't construct with non-owned index data but Trade::DataFlag::Owned\n"); } @@ -3091,10 +3089,10 @@ void MeshDataTest::constructNotOwnedVertexFlagOwned() { MeshAttributeData positions{MeshAttribute::Position, Containers::arrayView(vertexData)}; - std::ostringstream out; + Containers::String out; Error redirectError{&out}; MeshData data{MeshPrimitive::Triangles, {}, indexData, indices, DataFlag::Owned, vertexData, {positions}}; - CORRADE_COMPARE(out.str(), + CORRADE_COMPARE(out, "Trade::MeshData: can't construct with non-owned vertex data but Trade::DataFlag::Owned\n"); } @@ -3110,10 +3108,10 @@ void MeshDataTest::constructIndicesNotOwnedFlagOwned() { MeshIndexData indices{indexData}; MeshAttributeData positions{MeshAttribute::Position, vertexView}; - std::ostringstream out; + Containers::String out; Error redirectError{&out}; MeshData data{MeshPrimitive::Triangles, DataFlag::Owned, indexData, indices, Utility::move(vertexData), {positions}}; - CORRADE_COMPARE(out.str(), + CORRADE_COMPARE(out, "Trade::MeshData: can't construct with non-owned index data but Trade::DataFlag::Owned\n"); } @@ -3129,10 +3127,10 @@ void MeshDataTest::constructVerticesNotOwnedFlagOwned() { MeshAttributeData positions{MeshAttribute::Position, Containers::arrayView(vertexData)}; - std::ostringstream out; + Containers::String out; Error redirectError{&out}; MeshData data{MeshPrimitive::Triangles, Utility::move(indexData), indices, DataFlag::Owned, vertexData, {positions}}; - CORRADE_COMPARE(out.str(), + CORRADE_COMPARE(out, "Trade::MeshData: can't construct with non-owned vertex data but Trade::DataFlag::Owned\n"); } @@ -3143,10 +3141,10 @@ void MeshDataTest::constructIndexlessNotOwnedFlagOwned() { MeshAttributeData positions{MeshAttribute::Position, Containers::arrayView(vertexData)}; - std::ostringstream out; + Containers::String out; Error redirectError{&out}; MeshData data{MeshPrimitive::Triangles, DataFlag::Owned, vertexData, {positions}}; - CORRADE_COMPARE(out.str(), + CORRADE_COMPARE(out, "Trade::MeshData: can't construct with non-owned vertex data but Trade::DataFlag::Owned\n"); } @@ -3156,10 +3154,10 @@ void MeshDataTest::constructAttributelessNotOwnedFlagOwned() { const UnsignedShort indexData[]{0, 1, 0}; MeshIndexData indices{indexData}; - std::ostringstream out; + Containers::String out; Error redirectError{&out}; MeshData data{MeshPrimitive::Triangles, DataFlag::Owned, indexData, indices, 2}; - CORRADE_COMPARE(out.str(), + CORRADE_COMPARE(out, "Trade::MeshData: can't construct with non-owned index data but Trade::DataFlag::Owned\n"); } @@ -3169,11 +3167,11 @@ void MeshDataTest::constructInvalidAttributeData() { MeshAttributeData a; MeshAttributeData b{3}; - std::ostringstream out; + Containers::String out; Error redirectError{&out}; MeshData{MeshPrimitive::Triangles, nullptr, {a}}; MeshData{MeshPrimitive::Triangles, nullptr, {b}}; - CORRADE_COMPARE(out.str(), + CORRADE_COMPARE(out, "Trade::MeshData: attribute 0 doesn't specify anything\n" "Trade::MeshData: attribute 0 doesn't specify anything\n"); } @@ -3304,11 +3302,11 @@ void MeshDataTest::indicesIntoArrayInvalidSize() { UnsignedInt indices[3]{}; MeshData data{MeshPrimitive::Points, {}, indices, MeshIndexData{indices}, 1}; - std::ostringstream out; + Containers::String out; Error redirectError{&out}; UnsignedInt destination[2]; data.indicesInto(destination); - CORRADE_COMPARE(out.str(), + CORRADE_COMPARE(out, "Trade::MeshData::indicesInto(): expected a view with 3 elements but got 2\n"); } @@ -3428,11 +3426,11 @@ void MeshDataTest::positions2DIntoArrayInvalidSize() { Containers::arrayView(positions)} }}; - std::ostringstream out; + Containers::String out; Error redirectError{&out}; Vector2 destination[2]; data.positions2DInto(destination); - CORRADE_COMPARE(out.str(), + CORRADE_COMPARE(out, "Trade::MeshData::positions2DInto(): expected a view with 3 elements but got 2\n"); } @@ -3562,11 +3560,11 @@ void MeshDataTest::positions3DIntoArrayInvalidSize() { Containers::arrayView(positions)} }}; - std::ostringstream out; + Containers::String out; Error redirectError{&out}; Vector3 destination[2]; data.positions3DInto(destination); - CORRADE_COMPARE(out.str(), + CORRADE_COMPARE(out, "Trade::MeshData::positions3DInto(): expected a view with 3 elements but got 2\n"); } @@ -3631,11 +3629,11 @@ void MeshDataTest::tangentsIntoArrayInvalidSize() { Containers::arrayView(tangents)} }}; - std::ostringstream out; + Containers::String out; Error redirectError{&out}; Vector3 destination[2]; data.tangentsInto(destination); - CORRADE_COMPARE(out.str(), + CORRADE_COMPARE(out, "Trade::MeshData::tangentsInto(): expected a view with 3 elements but got 2\n"); } @@ -3698,11 +3696,11 @@ void MeshDataTest::bitangentSignsAsArrayNotFourComponent() { VertexFormat::Vector3sNormalized, Containers::arrayView(tangents)} }}; - std::ostringstream out; + Containers::String out; Error redirectError{&out}; Float destination[3]; data.bitangentSignsInto(destination); - CORRADE_COMPARE(out.str(), + CORRADE_COMPARE(out, "Trade::MeshData::bitangentSignsInto(): expected four-component tangents, but got VertexFormat::Vector3sNormalized\n"); } @@ -3715,11 +3713,11 @@ void MeshDataTest::bitangentSignsIntoArrayInvalidSize() { Containers::arrayView(tangents)} }}; - std::ostringstream out; + Containers::String out; Error redirectError{&out}; Float destination[2]; data.bitangentSignsInto(destination); - CORRADE_COMPARE(out.str(), + CORRADE_COMPARE(out, "Trade::MeshData::bitangentSignsInto(): expected a view with 3 elements but got 2\n"); } @@ -3784,11 +3782,11 @@ void MeshDataTest::bitangentsIntoArrayInvalidSize() { Containers::arrayView(bitangents)} }}; - std::ostringstream out; + Containers::String out; Error redirectError{&out}; Vector3 destination[2]; data.bitangentsInto(destination); - CORRADE_COMPARE(out.str(), + CORRADE_COMPARE(out, "Trade::MeshData::bitangentsInto(): expected a view with 3 elements but got 2\n"); } @@ -3852,11 +3850,11 @@ void MeshDataTest::normalsIntoArrayInvalidSize() { MeshAttributeData{MeshAttribute::Normal, Containers::arrayView(normals)} }}; - std::ostringstream out; + Containers::String out; Error redirectError{&out}; Vector3 destination[2]; data.normalsInto(destination); - CORRADE_COMPARE(out.str(), + CORRADE_COMPARE(out, "Trade::MeshData::normalsInto(): expected a view with 3 elements but got 2\n"); } @@ -3975,11 +3973,11 @@ void MeshDataTest::textureCoordinates2DIntoArrayInvalidSize() { MeshAttributeData{MeshAttribute::TextureCoordinates, Containers::arrayView(textureCoordinates)} }}; - std::ostringstream out; + Containers::String out; Error redirectError{&out}; Vector2 destination[2]; data.textureCoordinates2DInto(destination); - CORRADE_COMPARE(out.str(), + CORRADE_COMPARE(out, "Trade::MeshData::textureCoordinates2DInto(): expected a view with 3 elements but got 2\n"); } @@ -4041,11 +4039,11 @@ void MeshDataTest::colorsIntoArrayInvalidSize() { MeshAttributeData{MeshAttribute::Color, Containers::arrayView(colors)} }}; - std::ostringstream out; + Containers::String out; Error redirectError{&out}; Color4 destination[2]; data.colorsInto(destination); - CORRADE_COMPARE(out.str(), + CORRADE_COMPARE(out, "Trade::MeshData::colorsInto(): expected a view with 3 elements but got 2\n"); } @@ -4115,7 +4113,7 @@ void MeshDataTest::jointIdsIntoArrayInvalidSizeStride() { view.slice(&Vertex::jointIds), 2} }}; - std::ostringstream out; + Containers::String out; Error redirectError{&out}; UnsignedInt jointIds1[3*3]; UnsignedInt jointIds2[2*2]; @@ -4123,7 +4121,7 @@ void MeshDataTest::jointIdsIntoArrayInvalidSizeStride() { data.jointIdsInto(Containers::StridedArrayView2D{jointIds1, {3, 3}}); data.jointIdsInto(Containers::StridedArrayView2D{jointIds2, {2, 2}}); data.jointIdsInto(Containers::StridedArrayView2D{jointIds3, {3, 4}}.every({1, 2})); - CORRADE_COMPARE(out.str(), + CORRADE_COMPARE(out, "Trade::MeshData::jointIdsInto(): expected a view with {3, 2} elements but got {3, 3}\n" "Trade::MeshData::jointIdsInto(): expected a view with {3, 2} elements but got {2, 2}\n" "Trade::MeshData::jointIdsInto(): second view dimension is not contiguous\n"); @@ -4222,7 +4220,7 @@ void MeshDataTest::weightsIntoArrayInvalidSizeStride() { view.slice(&Vertex::weights), 2} }}; - std::ostringstream out; + Containers::String out; Error redirectError{&out}; Float weights1[3*3]; Float weights2[2*2]; @@ -4230,7 +4228,7 @@ void MeshDataTest::weightsIntoArrayInvalidSizeStride() { data.weightsInto(Containers::StridedArrayView2D{weights1, {3, 3}}); data.weightsInto(Containers::StridedArrayView2D{weights2, {2, 2}}); data.weightsInto(Containers::StridedArrayView2D{weights3, {3, 4}}.every({1, 2})); - CORRADE_COMPARE(out.str(), + CORRADE_COMPARE(out, "Trade::MeshData::weightsInto(): expected a view with {3, 2} elements but got {3, 3}\n" "Trade::MeshData::weightsInto(): expected a view with {3, 2} elements but got {2, 2}\n" "Trade::MeshData::weightsInto(): second view dimension is not contiguous\n"); @@ -4273,11 +4271,11 @@ void MeshDataTest::objectIdsIntoArrayInvalidSize() { Containers::arrayView(objectIds)} }}; - std::ostringstream out; + Containers::String out; Error redirectError{&out}; UnsignedInt destination[2]; data.objectIdsInto(destination); - CORRADE_COMPARE(out.str(), + CORRADE_COMPARE(out, "Trade::MeshData::objectIdsInto(): expected a view with 3 elements but got 2\n"); } @@ -4291,12 +4289,12 @@ void MeshDataTest::implementationSpecificIndexTypeWrongAccess() { MeshData data{MeshPrimitive::Triangles, DataFlag::Mutable, indexData, MeshIndexData{meshIndexTypeWrap(0xcaca), indices}, 1}; - std::ostringstream out; + Containers::String out; Error redirectError{&out}; data.indices(); data.mutableIndices(); data.indicesAsArray(); - CORRADE_COMPARE(out.str(), + CORRADE_COMPARE(out, "Trade::MeshData::indices(): can't cast data from an implementation-specific index type 0xcaca\n" "Trade::MeshData::mutableIndices(): can't cast data from an implementation-specific index type 0xcaca\n" "Trade::MeshData::indicesInto(): can't extract data out of an implementation-specific index type 0xcaca\n"); @@ -4329,7 +4327,7 @@ void MeshDataTest::implementationSpecificVertexFormatWrongAccess() { MeshAttributeData{MeshAttribute::ObjectId, vertexFormatWrap(0xdead9), attribute}}}; - std::ostringstream out; + Containers::String out; Error redirectError{&out}; data.attribute(MeshAttribute::Position); data.attribute(MeshAttribute::Normal); @@ -4350,7 +4348,7 @@ void MeshDataTest::implementationSpecificVertexFormatWrongAccess() { data.jointIdsAsArray(); data.weightsAsArray(); data.objectIdsAsArray(); - CORRADE_COMPARE(out.str(), + CORRADE_COMPARE(out, "Trade::MeshData::attribute(): can't cast data from an implementation-specific vertex format 0xdead1\n" "Trade::MeshData::attribute(): can't cast data from an implementation-specific vertex format 0xdead4\n" "Trade::MeshData::attribute(): can't cast data from an implementation-specific vertex format 0xdead5\n" @@ -4386,7 +4384,7 @@ void MeshDataTest::mutableAccessNotAllowed() { CORRADE_COMPARE(data.indexDataFlags(), DataFlags{}); CORRADE_COMPARE(data.vertexDataFlags(), DataFlags{}); - std::ostringstream out; + Containers::String out; Error redirectError{&out}; data.mutableIndexData(); data.mutableVertexData(); @@ -4398,7 +4396,7 @@ void MeshDataTest::mutableAccessNotAllowed() { data.mutableAttribute(MeshAttribute::Position); data.mutableAttribute(MeshAttribute::Position); data.mutableAttribute(MeshAttribute::Position); - CORRADE_COMPARE(out.str(), + CORRADE_COMPARE(out, "Trade::MeshData::mutableIndexData(): index data not mutable\n" "Trade::MeshData::mutableVertexData(): vertex data not mutable\n" "Trade::MeshData::mutableIndices(): index data not mutable\n" @@ -4416,7 +4414,7 @@ void MeshDataTest::indicesNotIndexed() { MeshData data{MeshPrimitive::Triangles, 37}; - std::ostringstream out; + Containers::String out; Error redirectError{&out}; data.indexCount(); data.indexType(); @@ -4427,7 +4425,7 @@ void MeshDataTest::indicesNotIndexed() { data.indicesAsArray(); UnsignedInt a[1]; data.indicesInto(a); - CORRADE_COMPARE(out.str(), + CORRADE_COMPARE(out, "Trade::MeshData::indexCount(): the mesh is not indexed\n" "Trade::MeshData::indexType(): the mesh is not indexed\n" "Trade::MeshData::indexOffset(): the mesh is not indexed\n" @@ -4446,11 +4444,11 @@ void MeshDataTest::indicesWrongType() { indices[0] = 57616; MeshData data{MeshPrimitive::Points, Utility::move(indexData), MeshIndexData{indices}, 57617}; - std::ostringstream out; + Containers::String out; Error redirectError{&out}; data.indices(); data.mutableIndices(); - CORRADE_COMPARE(out.str(), + CORRADE_COMPARE(out, "Trade::MeshData::indices(): indices are MeshIndexType::UnsignedShort but requested MeshIndexType::UnsignedByte\n" "Trade::MeshData::mutableIndices(): indices are MeshIndexType::UnsignedShort but requested MeshIndexType::UnsignedByte\n"); } @@ -4478,7 +4476,7 @@ void MeshDataTest::attributeNotFound() { CORRADE_COMPARE(data.findAttributeId(MeshAttribute::Color, 2), Containers::NullOpt); CORRADE_COMPARE(data.findAttributeId(MeshAttribute::Color, 3, 37), Containers::NullOpt); - std::ostringstream out; + Containers::String out; Error redirectError{&out}; data.attributeData(9); data.attributeName(9); @@ -4554,7 +4552,7 @@ void MeshDataTest::attributeNotFound() { data.weightsInto(nullptr, 2); /* Object IDs have no morph targets either */ data.objectIdsAsArray(); - CORRADE_COMPARE_AS(out.str(), + CORRADE_COMPARE_AS(out, "Trade::MeshData::attributeData(): index 9 out of range for 9 attributes\n" "Trade::MeshData::attributeName(): index 9 out of range for 9 attributes\n" "Trade::MeshData::attributeId(): index 9 out of range for 9 attributes\n" @@ -4635,13 +4633,13 @@ void MeshDataTest::attributeWrongType() { MeshAttributeData{MeshAttribute::Position, VertexFormat::Vector3, nullptr} }}; - std::ostringstream out; + Containers::String out; Error redirectError{&out}; data.attribute(MeshAttribute::Position); data.attribute(MeshAttribute::Position); data.mutableAttribute(MeshAttribute::Position); data.mutableAttribute(MeshAttribute::Position); - CORRADE_COMPARE(out.str(), + CORRADE_COMPARE(out, "Trade::MeshData::attribute(): Trade::MeshAttribute::Position is VertexFormat::Vector3 but requested a type equivalent to VertexFormat::Vector4\n" "Trade::MeshData::attribute(): Trade::MeshAttribute::Position is VertexFormat::Vector3 but requested a type equivalent to VertexFormat::Vector4\n" "Trade::MeshData::mutableAttribute(): Trade::MeshAttribute::Position is VertexFormat::Vector3 but requested a type equivalent to VertexFormat::Vector4\n" @@ -4665,13 +4663,13 @@ void MeshDataTest::attributeWrongArrayAccess() { /* Array access is allowed for non-array attributes (the second dimension is then always 1), tested directly in construct() */ - std::ostringstream out; + Containers::String out; Error redirectError{&out}; data.attribute(0); data.mutableAttribute(0); data.attribute(meshAttributeCustom(35)); data.mutableAttribute(meshAttributeCustom(35)); - CORRADE_COMPARE(out.str(), + CORRADE_COMPARE(out, "Trade::MeshData::attribute(): Trade::MeshAttribute::Custom(35) is an array attribute, use T[] to access it\n" "Trade::MeshData::mutableAttribute(): Trade::MeshAttribute::Custom(35) is an array attribute, use T[] to access it\n" "Trade::MeshData::attribute(): Trade::MeshAttribute::Custom(35) is an array attribute, use T[] to access it\n" diff --git a/src/Magnum/Trade/Test/ObjectData2DTest.cpp b/src/Magnum/Trade/Test/ObjectData2DTest.cpp index 47aba74a8..8c0130eb3 100644 --- a/src/Magnum/Trade/Test/ObjectData2DTest.cpp +++ b/src/Magnum/Trade/Test/ObjectData2DTest.cpp @@ -27,9 +27,8 @@ /* There's no better way to disable file deprecation warnings */ #define _MAGNUM_NO_DEPRECATED_OBJECTDATA -#include +#include #include -#include #include "Magnum/Trade/MeshObjectData2D.h" @@ -235,7 +234,7 @@ void ObjectData2DTest::constructMoveMesh() { void ObjectData2DTest::accessInvalidTransformations() { CORRADE_SKIP_IF_NO_ASSERT(); - std::ostringstream out; + Containers::String out; Error redirectOutput{&out}; const ObjectData2D data{{}, Matrix3{}}; @@ -243,28 +242,28 @@ void ObjectData2DTest::accessInvalidTransformations() { data.rotation(); data.scaling(); - CORRADE_COMPARE(out.str(), + CORRADE_COMPARE(out, "Trade::ObjectData2D::translation(): object has only a combined transformation\n" "Trade::ObjectData2D::rotation(): object has only a combined transformation\n" "Trade::ObjectData2D::scaling(): object has only a combined transformation\n"); } void ObjectData2DTest::debugType() { - std::ostringstream o; - Debug(&o) << ObjectInstanceType2D::Empty << ObjectInstanceType2D(0xbe); - CORRADE_COMPARE(o.str(), "Trade::ObjectInstanceType2D::Empty Trade::ObjectInstanceType2D(0xbe)\n"); + Containers::String out; + Debug{&out} << ObjectInstanceType2D::Empty << ObjectInstanceType2D(0xbe); + CORRADE_COMPARE(out, "Trade::ObjectInstanceType2D::Empty Trade::ObjectInstanceType2D(0xbe)\n"); } void ObjectData2DTest::debugFlag() { - std::ostringstream o; - Debug(&o) << ObjectFlag2D::HasTranslationRotationScaling << ObjectFlag2D(0xbe); - CORRADE_COMPARE(o.str(), "Trade::ObjectFlag2D::HasTranslationRotationScaling Trade::ObjectFlag2D(0xbe)\n"); + Containers::String out; + Debug{&out} << ObjectFlag2D::HasTranslationRotationScaling << ObjectFlag2D(0xbe); + CORRADE_COMPARE(out, "Trade::ObjectFlag2D::HasTranslationRotationScaling Trade::ObjectFlag2D(0xbe)\n"); } void ObjectData2DTest::debugFlags() { - std::ostringstream o; - Debug(&o) << (ObjectFlag2D::HasTranslationRotationScaling|ObjectFlags2D{}) << ObjectFlags2D{}; - CORRADE_COMPARE(o.str(), "Trade::ObjectFlag2D::HasTranslationRotationScaling Trade::ObjectFlags2D{}\n"); + Containers::String out; + Debug{&out} << (ObjectFlag2D::HasTranslationRotationScaling|ObjectFlags2D{}) << ObjectFlags2D{}; + CORRADE_COMPARE(out, "Trade::ObjectFlag2D::HasTranslationRotationScaling Trade::ObjectFlags2D{}\n"); } CORRADE_IGNORE_DEPRECATED_POP diff --git a/src/Magnum/Trade/Test/ObjectData3DTest.cpp b/src/Magnum/Trade/Test/ObjectData3DTest.cpp index bd89c2e91..1d93747b5 100644 --- a/src/Magnum/Trade/Test/ObjectData3DTest.cpp +++ b/src/Magnum/Trade/Test/ObjectData3DTest.cpp @@ -27,9 +27,8 @@ /* There's no better way to disable file deprecation warnings */ #define _MAGNUM_NO_DEPRECATED_OBJECTDATA -#include +#include #include -#include #include "Magnum/Trade/MeshObjectData3D.h" @@ -249,7 +248,7 @@ void ObjectData3DTest::constructMoveMesh() { void ObjectData3DTest::accessInvalidTransformations() { CORRADE_SKIP_IF_NO_ASSERT(); - std::ostringstream out; + Containers::String out; Error redirectOutput{&out}; const ObjectData3D data{{}, Matrix4{}}; @@ -257,28 +256,28 @@ void ObjectData3DTest::accessInvalidTransformations() { data.rotation(); data.scaling(); - CORRADE_COMPARE(out.str(), + CORRADE_COMPARE(out, "Trade::ObjectData3D::translation(): object has only a combined transformation\n" "Trade::ObjectData3D::rotation(): object has only a combined transformation\n" "Trade::ObjectData3D::scaling(): object has only a combined transformation\n"); } void ObjectData3DTest::debugType() { - std::ostringstream o; - Debug(&o) << ObjectInstanceType3D::Light << ObjectInstanceType3D(0xbe); - CORRADE_COMPARE(o.str(), "Trade::ObjectInstanceType3D::Light Trade::ObjectInstanceType3D(0xbe)\n"); + Containers::String out; + Debug{&out} << ObjectInstanceType3D::Light << ObjectInstanceType3D(0xbe); + CORRADE_COMPARE(out, "Trade::ObjectInstanceType3D::Light Trade::ObjectInstanceType3D(0xbe)\n"); } void ObjectData3DTest::debugFlag() { - std::ostringstream o; - Debug(&o) << ObjectFlag3D::HasTranslationRotationScaling << ObjectFlag3D(0xbe); - CORRADE_COMPARE(o.str(), "Trade::ObjectFlag3D::HasTranslationRotationScaling Trade::ObjectFlag3D(0xbe)\n"); + Containers::String out; + Debug{&out} << ObjectFlag3D::HasTranslationRotationScaling << ObjectFlag3D(0xbe); + CORRADE_COMPARE(out, "Trade::ObjectFlag3D::HasTranslationRotationScaling Trade::ObjectFlag3D(0xbe)\n"); } void ObjectData3DTest::debugFlags() { - std::ostringstream o; - Debug(&o) << (ObjectFlag3D::HasTranslationRotationScaling|ObjectFlags3D{}) << ObjectFlags3D{}; - CORRADE_COMPARE(o.str(), "Trade::ObjectFlag3D::HasTranslationRotationScaling Trade::ObjectFlags3D{}\n"); + Containers::String out; + Debug{&out} << (ObjectFlag3D::HasTranslationRotationScaling|ObjectFlags3D{}) << ObjectFlags3D{}; + CORRADE_COMPARE(out, "Trade::ObjectFlag3D::HasTranslationRotationScaling Trade::ObjectFlags3D{}\n"); } CORRADE_IGNORE_DEPRECATED_POP diff --git a/src/Magnum/Trade/Test/PbrClearCoatMaterialDataTest.cpp b/src/Magnum/Trade/Test/PbrClearCoatMaterialDataTest.cpp index 4b30752a8..224e35ae9 100644 --- a/src/Magnum/Trade/Test/PbrClearCoatMaterialDataTest.cpp +++ b/src/Magnum/Trade/Test/PbrClearCoatMaterialDataTest.cpp @@ -24,10 +24,8 @@ DEALINGS IN THE SOFTWARE. */ -#include #include #include -#include #include "Magnum/Trade/PbrClearCoatMaterialData.h" @@ -337,7 +335,7 @@ void PbrClearCoatMaterialDataTest::invalidTextures() { {MaterialLayer::ClearCoat}, }, {0, 1}}; - std::ostringstream out; + Containers::String out; Error redirectError{&out}; data.roughnessTexture(); data.roughnessTextureSwizzle(); @@ -350,7 +348,7 @@ void PbrClearCoatMaterialDataTest::invalidTextures() { data.normalTextureMatrix(); data.normalTextureCoordinates(); data.normalTextureLayer(); - CORRADE_COMPARE(out.str(), + CORRADE_COMPARE(out, "Trade::MaterialData::attribute(): attribute RoughnessTexture not found in layer ClearCoat\n" "Trade::PbrClearCoatMaterialData::roughnessTextureSwizzle(): the layer doesn't have a roughness texture\n" "Trade::PbrClearCoatMaterialData::roughnessTextureMatrix(): the layer doesn't have a roughness texture\n" @@ -494,12 +492,12 @@ void PbrClearCoatMaterialDataTest::noCommonTransformationCoordinatesLayer() { CORRADE_VERIFY(!data.hasCommonTextureTransformation()); CORRADE_VERIFY(!data.hasCommonTextureCoordinates()); - std::ostringstream out; + Containers::String out; Error redirectError{&out}; data.commonTextureMatrix(); data.commonTextureCoordinates(); data.commonTextureLayer(); - CORRADE_COMPARE(out.str(), + CORRADE_COMPARE(out, "Trade::PbrClearCoatMaterialData::commonTextureMatrix(): the layer doesn't have a common texture coordinate transformation\n" "Trade::PbrClearCoatMaterialData::commonTextureCoordinates(): the layer doesn't have a common texture coordinate set\n" "Trade::PbrClearCoatMaterialData::commonTextureLayer(): the layer doesn't have a common array texture layer\n"); diff --git a/src/Magnum/Trade/Test/PbrMetallicRoughnessMaterialDataTest.cpp b/src/Magnum/Trade/Test/PbrMetallicRoughnessMaterialDataTest.cpp index 8ece44b54..6a63d66e2 100644 --- a/src/Magnum/Trade/Test/PbrMetallicRoughnessMaterialDataTest.cpp +++ b/src/Magnum/Trade/Test/PbrMetallicRoughnessMaterialDataTest.cpp @@ -24,10 +24,8 @@ DEALINGS IN THE SOFTWARE. */ -#include #include #include -#include #include "Magnum/Math/Color.h" #include "Magnum/Math/Matrix3.h" @@ -801,7 +799,7 @@ void PbrMetallicRoughnessMaterialDataTest::invalidTextures() { PbrMetallicRoughnessMaterialData data{{}, {}}; - std::ostringstream out; + Containers::String out; Error redirectError{&out}; data.baseColorTexture(); data.baseColorTextureMatrix(); @@ -833,7 +831,7 @@ void PbrMetallicRoughnessMaterialDataTest::invalidTextures() { data.emissiveTextureMatrix(); data.emissiveTextureCoordinates(); data.emissiveTextureLayer(); - CORRADE_COMPARE(out.str(), + CORRADE_COMPARE(out, "Trade::MaterialData::attribute(): attribute BaseColorTexture not found in layer 0\n" "Trade::PbrMetallicRoughnessMaterialData::baseColorTextureMatrix(): the material doesn't have a base color texture\n" "Trade::PbrMetallicRoughnessMaterialData::baseColorTextureCoordinates(): the material doesn't have a base color texture\n" @@ -979,12 +977,12 @@ void PbrMetallicRoughnessMaterialDataTest::noCommonTransformationCoordinatesLaye CORRADE_VERIFY(!data.hasCommonTextureCoordinates()); CORRADE_VERIFY(!data.hasCommonTextureLayer()); - std::ostringstream out; + Containers::String out; Error redirectError{&out}; data.commonTextureMatrix(); data.commonTextureCoordinates(); data.commonTextureLayer(); - CORRADE_COMPARE(out.str(), + CORRADE_COMPARE(out, "Trade::PbrMetallicRoughnessMaterialData::commonTextureMatrix(): the material doesn't have a common texture coordinate transformation\n" "Trade::PbrMetallicRoughnessMaterialData::commonTextureCoordinates(): the material doesn't have a common texture coordinate set\n" "Trade::PbrMetallicRoughnessMaterialData::commonTextureLayer(): the material doesn't have a common array texture layer\n"); diff --git a/src/Magnum/Trade/Test/PbrSpecularGlossinessMaterialDataTest.cpp b/src/Magnum/Trade/Test/PbrSpecularGlossinessMaterialDataTest.cpp index 8c13188d8..f5a3d9e05 100644 --- a/src/Magnum/Trade/Test/PbrSpecularGlossinessMaterialDataTest.cpp +++ b/src/Magnum/Trade/Test/PbrSpecularGlossinessMaterialDataTest.cpp @@ -24,10 +24,8 @@ DEALINGS IN THE SOFTWARE. */ -#include #include #include -#include #include "Magnum/Math/Color.h" #include "Magnum/Math/Matrix3.h" @@ -481,7 +479,7 @@ void PbrSpecularGlossinessMaterialDataTest::invalidTextures() { PbrSpecularGlossinessMaterialData data{{}, {}}; - std::ostringstream out; + Containers::String out; Error redirectError{&out}; data.diffuseTexture(); data.diffuseTextureMatrix(); @@ -513,7 +511,7 @@ void PbrSpecularGlossinessMaterialDataTest::invalidTextures() { data.emissiveTextureMatrix(); data.emissiveTextureCoordinates(); data.emissiveTextureLayer(); - CORRADE_COMPARE(out.str(), + CORRADE_COMPARE(out, "Trade::MaterialData::attribute(): attribute DiffuseTexture not found in layer 0\n" "Trade::PbrSpecularGlossinessMaterialData::diffuseTextureMatrix(): the material doesn't have a diffuse texture\n" "Trade::PbrSpecularGlossinessMaterialData::diffuseTextureCoordinates(): the material doesn't have a diffuse texture\n" @@ -659,12 +657,12 @@ void PbrSpecularGlossinessMaterialDataTest::noCommonTransformationCoordinatesLay CORRADE_VERIFY(!data.hasCommonTextureCoordinates()); CORRADE_VERIFY(!data.hasCommonTextureLayer()); - std::ostringstream out; + Containers::String out; Error redirectError{&out}; data.commonTextureMatrix(); data.commonTextureCoordinates(); data.commonTextureLayer(); - CORRADE_COMPARE(out.str(), + CORRADE_COMPARE(out, "Trade::PbrSpecularGlossinessMaterialData::commonTextureMatrix(): the material doesn't have a common texture coordinate transformation\n" "Trade::PbrSpecularGlossinessMaterialData::commonTextureCoordinates(): the material doesn't have a common texture coordinate set\n" "Trade::PbrSpecularGlossinessMaterialData::commonTextureLayer(): the material doesn't have a common array texture layer\n"); diff --git a/src/Magnum/Trade/Test/PhongMaterialDataTest.cpp b/src/Magnum/Trade/Test/PhongMaterialDataTest.cpp index 75aa257c4..0b217317b 100644 --- a/src/Magnum/Trade/Test/PhongMaterialDataTest.cpp +++ b/src/Magnum/Trade/Test/PhongMaterialDataTest.cpp @@ -24,10 +24,8 @@ DEALINGS IN THE SOFTWARE. */ -#include #include #include -#include #include "Magnum/Math/Color.h" #include "Magnum/Math/Matrix3.h" @@ -245,7 +243,7 @@ void PhongMaterialDataTest::constructDeprecatedTexturedCoordinates() { void PhongMaterialDataTest::constructDeprecatedTextureTransformNoTextures() { CORRADE_SKIP_IF_NO_ASSERT(); - std::ostringstream out; + Containers::String out; Error redirectError{&out}; CORRADE_IGNORE_DEPRECATED_PUSH PhongMaterialData a{PhongMaterialData::Flag::TextureTransformation, @@ -254,14 +252,14 @@ void PhongMaterialDataTest::constructDeprecatedTextureTransformNoTextures() { {}, {}, {}, {}, {}, 0.5f, 80.0f}; CORRADE_IGNORE_DEPRECATED_POP - CORRADE_COMPARE(out.str(), + CORRADE_COMPARE(out, "Trade::PhongMaterialData: texture transformation enabled but the material has no textures\n"); } void PhongMaterialDataTest::constructDeprecatedNoTextureTransformationFlag() { CORRADE_SKIP_IF_NO_ASSERT(); - std::ostringstream out; + Containers::String out; Error redirectError{&out}; CORRADE_IGNORE_DEPRECATED_PUSH PhongMaterialData a{{}, @@ -270,14 +268,14 @@ void PhongMaterialDataTest::constructDeprecatedNoTextureTransformationFlag() { {}, {}, {}, Matrix3::rotation(90.0_degf), {}, 0.5f, 80.0f}; CORRADE_IGNORE_DEPRECATED_POP - CORRADE_COMPARE(out.str(), + CORRADE_COMPARE(out, "PhongMaterialData::PhongMaterialData: non-default texture matrix requires Flag::TextureTransformation to be enabled\n"); } void PhongMaterialDataTest::constructDeprecatedNoTextureCoordinatesFlag() { CORRADE_SKIP_IF_NO_ASSERT(); - std::ostringstream out; + Containers::String out; Error redirectError{&out}; CORRADE_IGNORE_DEPRECATED_PUSH PhongMaterialData a{{}, @@ -286,7 +284,7 @@ void PhongMaterialDataTest::constructDeprecatedNoTextureCoordinatesFlag() { {}, {}, 3, {}, 4, {}, {}, 0.5f, 80.0f}; CORRADE_IGNORE_DEPRECATED_POP - CORRADE_COMPARE(out.str(), + CORRADE_COMPARE(out, "PhongMaterialData::PhongMaterialData: non-zero texture coordinate sets require Flag::TextureCoordinates to be enabled\n"); } #endif @@ -477,7 +475,7 @@ void PhongMaterialDataTest::invalidTextures() { PhongMaterialData data{{}, {}}; - std::ostringstream out; + Containers::String out; Error redirectError{&out}; data.ambientTexture(); data.ambientTextureMatrix(); @@ -498,7 +496,7 @@ void PhongMaterialDataTest::invalidTextures() { data.normalTextureMatrix(); data.normalTextureCoordinates(); data.normalTextureLayer(); - CORRADE_COMPARE(out.str(), + CORRADE_COMPARE(out, "Trade::MaterialData::attribute(): attribute AmbientTexture not found in layer 0\n" "Trade::PhongMaterialData::ambientTextureMatrix(): the material doesn't have an ambient texture\n" "Trade::PhongMaterialData::ambientTextureCoordinates(): the material doesn't have an ambient texture\n" @@ -663,12 +661,12 @@ void PhongMaterialDataTest::noCommonTransformationCoordinatesLayer() { CORRADE_VERIFY(!data.hasCommonTextureCoordinates()); CORRADE_VERIFY(!data.hasCommonTextureLayer()); - std::ostringstream out; + Containers::String out; Error redirectError{&out}; data.commonTextureMatrix(); data.commonTextureCoordinates(); data.commonTextureLayer(); - CORRADE_COMPARE(out.str(), + CORRADE_COMPARE(out, "Trade::PhongMaterialData::commonTextureMatrix(): the material doesn't have a common texture coordinate transformation\n" "Trade::PhongMaterialData::commonTextureCoordinates(): the material doesn't have a common texture coordinate set\n" "Trade::PhongMaterialData::commonTextureLayer(): the material doesn't have a common array texture layer\n"); @@ -677,17 +675,17 @@ void PhongMaterialDataTest::noCommonTransformationCoordinatesLayer() { #ifdef MAGNUM_BUILD_DEPRECATED CORRADE_IGNORE_DEPRECATED_PUSH void PhongMaterialDataTest::debugFlag() { - std::ostringstream out; + Containers::String out; Debug{&out} << PhongMaterialData::Flag::AmbientTexture << PhongMaterialData::Flag(0xf0); - CORRADE_COMPARE(out.str(), "Trade::PhongMaterialData::Flag::AmbientTexture Trade::PhongMaterialData::Flag(0xf0)\n"); + CORRADE_COMPARE(out, "Trade::PhongMaterialData::Flag::AmbientTexture Trade::PhongMaterialData::Flag(0xf0)\n"); } void PhongMaterialDataTest::debugFlags() { - std::ostringstream out; + Containers::String out; Debug{&out} << (PhongMaterialData::Flag::DiffuseTexture|PhongMaterialData::Flag::SpecularTexture) << PhongMaterialData::Flags{}; - CORRADE_COMPARE(out.str(), "Trade::PhongMaterialData::Flag::DiffuseTexture|Trade::PhongMaterialData::Flag::SpecularTexture Trade::PhongMaterialData::Flags{}\n"); + CORRADE_COMPARE(out, "Trade::PhongMaterialData::Flag::DiffuseTexture|Trade::PhongMaterialData::Flag::SpecularTexture Trade::PhongMaterialData::Flags{}\n"); } CORRADE_IGNORE_DEPRECATED_POP #endif diff --git a/src/Magnum/Trade/Test/SceneDataTest.cpp b/src/Magnum/Trade/Test/SceneDataTest.cpp index a906b1b6c..a609d89d0 100644 --- a/src/Magnum/Trade/Test/SceneDataTest.cpp +++ b/src/Magnum/Trade/Test/SceneDataTest.cpp @@ -27,20 +27,18 @@ /* Including first to verify the StridedBitArrayView include is not needed */ #include "Magnum/Trade/SceneData.h" -#include #include #include #include #include +#include #include -#include /** @todo drop once Debug is stream-free */ #include #include #include #include #include -#include -#include +#include #include "Magnum/Magnum.h" #include "Magnum/Math/Half.h" @@ -695,7 +693,7 @@ void SceneDataTest::mappingTypeSizeAlignment() { void SceneDataTest::mappingTypeSizeAlignmentInvalid() { CORRADE_SKIP_IF_NO_ASSERT(); - std::ostringstream out; + Containers::String out; Error redirectError{&out}; sceneMappingTypeSize(SceneMappingType{}); @@ -703,7 +701,7 @@ void SceneDataTest::mappingTypeSizeAlignmentInvalid() { sceneMappingTypeSize(SceneMappingType(0x73)); sceneMappingTypeAlignment(SceneMappingType(0x73)); - CORRADE_COMPARE(out.str(), + CORRADE_COMPARE(out, "Trade::sceneMappingTypeSize(): invalid type Trade::SceneMappingType(0x0)\n" "Trade::sceneMappingTypeAlignment(): invalid type Trade::SceneMappingType(0x0)\n" "Trade::sceneMappingTypeSize(): invalid type Trade::SceneMappingType(0x73)\n" @@ -711,16 +709,16 @@ void SceneDataTest::mappingTypeSizeAlignmentInvalid() { } void SceneDataTest::debugMappingType() { - std::ostringstream out; + Containers::String out; Debug{&out} << SceneMappingType::UnsignedLong << SceneMappingType(0x73); - CORRADE_COMPARE(out.str(), "Trade::SceneMappingType::UnsignedLong Trade::SceneMappingType(0x73)\n"); + CORRADE_COMPARE(out, "Trade::SceneMappingType::UnsignedLong Trade::SceneMappingType(0x73)\n"); } void SceneDataTest::debugMappingTypePacked() { - std::ostringstream out; + Containers::String out; /* Last is not packed, ones before should not make any flags persistent */ Debug{&out} << Debug::packed << SceneMappingType::UnsignedLong << Debug::packed << SceneMappingType(0x73) << SceneMappingType::UnsignedInt; - CORRADE_COMPARE(out.str(), "UnsignedLong 0x73 Trade::SceneMappingType::UnsignedInt\n"); + CORRADE_COMPARE(out, "UnsignedLong 0x73 Trade::SceneMappingType::UnsignedInt\n"); } void SceneDataTest::customFieldName() { @@ -748,32 +746,32 @@ void SceneDataTest::customFieldName() { void SceneDataTest::customFieldNameTooLarge() { CORRADE_SKIP_IF_NO_ASSERT(); - std::ostringstream out; + Containers::String out; Error redirectError{&out}; sceneFieldCustom(1u << 31); - CORRADE_COMPARE(out.str(), "Trade::sceneFieldCustom(): index 2147483648 too large\n"); + CORRADE_COMPARE(out, "Trade::sceneFieldCustom(): index 2147483648 too large\n"); } void SceneDataTest::customFieldNameNotCustom() { CORRADE_SKIP_IF_NO_ASSERT(); - std::ostringstream out; + Containers::String out; Error redirectError{&out}; sceneFieldCustom(SceneField::Transformation); - CORRADE_COMPARE(out.str(), "Trade::sceneFieldCustom(): Trade::SceneField::Transformation is not custom\n"); + CORRADE_COMPARE(out, "Trade::sceneFieldCustom(): Trade::SceneField::Transformation is not custom\n"); } void SceneDataTest::debugFieldName() { - std::ostringstream out; + Containers::String out; Debug{&out} << SceneField::Transformation << sceneFieldCustom(73) << SceneField(0xdeadda7); - CORRADE_COMPARE(out.str(), "Trade::SceneField::Transformation Trade::SceneField::Custom(73) Trade::SceneField(0xdeadda7)\n"); + CORRADE_COMPARE(out, "Trade::SceneField::Transformation Trade::SceneField::Custom(73) Trade::SceneField(0xdeadda7)\n"); } void SceneDataTest::debugFieldNamePacked() { - std::ostringstream out; + Containers::String out; /* Last is not packed, ones before should not make any flags persistent */ Debug{&out} << Debug::packed << SceneField::Transformation << Debug::packed << sceneFieldCustom(73) << Debug::packed << SceneField(0xdeadda7) << SceneField::Parent; - CORRADE_COMPARE(out.str(), "Transformation Custom(73) 0xdeadda7 Trade::SceneField::Parent\n"); + CORRADE_COMPARE(out, "Transformation Custom(73) 0xdeadda7 Trade::SceneField::Parent\n"); } void SceneDataTest::fieldTypeSizeAlignment() { @@ -809,7 +807,7 @@ void SceneDataTest::fieldTypeSizeAlignment() { void SceneDataTest::fieldTypeSizeAlignmentInvalid() { CORRADE_SKIP_IF_NO_ASSERT(); - std::ostringstream out; + Containers::String out; Error redirectError{&out}; sceneFieldTypeSize(SceneFieldType{}); @@ -819,7 +817,7 @@ void SceneDataTest::fieldTypeSizeAlignmentInvalid() { sceneFieldTypeSize(SceneFieldType::Bit); sceneFieldTypeAlignment(SceneFieldType::Bit); - CORRADE_COMPARE(out.str(), + CORRADE_COMPARE(out, "Trade::sceneFieldTypeSize(): invalid type Trade::SceneFieldType(0x0)\n" "Trade::sceneFieldTypeAlignment(): invalid type Trade::SceneFieldType(0x0)\n" "Trade::sceneFieldTypeSize(): invalid type Trade::SceneFieldType(0xdead)\n" @@ -829,51 +827,51 @@ void SceneDataTest::fieldTypeSizeAlignmentInvalid() { } void SceneDataTest::debugFieldType() { - std::ostringstream out; + Containers::String out; Debug{&out} << SceneFieldType::Matrix3x4h << SceneFieldType(0xdead); - CORRADE_COMPARE(out.str(), "Trade::SceneFieldType::Matrix3x4h Trade::SceneFieldType(0xdead)\n"); + CORRADE_COMPARE(out, "Trade::SceneFieldType::Matrix3x4h Trade::SceneFieldType(0xdead)\n"); } void SceneDataTest::debugFieldTypePacked() { - std::ostringstream out; + Containers::String out; /* Last is not packed, ones before should not make any flags persistent */ Debug{&out} << Debug::packed << SceneFieldType::Matrix3x4h << Debug::packed << SceneFieldType(0xdead) << SceneFieldType::Float; - CORRADE_COMPARE(out.str(), "Matrix3x4h 0xdead Trade::SceneFieldType::Float\n"); + CORRADE_COMPARE(out, "Matrix3x4h 0xdead Trade::SceneFieldType::Float\n"); } void SceneDataTest::debugFieldFlag() { - std::ostringstream out; + Containers::String out; Debug{&out} << SceneFieldFlag::OffsetOnly << SceneFieldFlag(0xbe); - CORRADE_COMPARE(out.str(), "Trade::SceneFieldFlag::OffsetOnly Trade::SceneFieldFlag(0xbe)\n"); + CORRADE_COMPARE(out, "Trade::SceneFieldFlag::OffsetOnly Trade::SceneFieldFlag(0xbe)\n"); } void SceneDataTest::debugFieldFlagPacked() { - std::ostringstream out; + Containers::String out; /* Last is not packed, ones before should not make any flags persistent */ Debug{&out} << Debug::packed << SceneFieldFlag::OffsetOnly << Debug::packed << SceneFieldFlag(0xbe) << SceneFieldFlag::ImplicitMapping; - CORRADE_COMPARE(out.str(), "OffsetOnly 0xbe Trade::SceneFieldFlag::ImplicitMapping\n"); + CORRADE_COMPARE(out, "OffsetOnly 0xbe Trade::SceneFieldFlag::ImplicitMapping\n"); } void SceneDataTest::debugFieldFlags() { - std::ostringstream out; + Containers::String out; Debug{&out} << (SceneFieldFlag::OffsetOnly|SceneFieldFlag(0xe0)) << SceneFieldFlags{}; - CORRADE_COMPARE(out.str(), "Trade::SceneFieldFlag::OffsetOnly|Trade::SceneFieldFlag(0xe0) Trade::SceneFieldFlags{}\n"); + CORRADE_COMPARE(out, "Trade::SceneFieldFlag::OffsetOnly|Trade::SceneFieldFlag(0xe0) Trade::SceneFieldFlags{}\n"); } void SceneDataTest::debugFieldFlagsPacked() { - std::ostringstream out; + Containers::String out; /* Last is not packed, ones before should not make any flags persistent */ Debug{&out} << Debug::packed << (SceneFieldFlag::OffsetOnly|SceneFieldFlag(0xe0)) << Debug::packed << SceneFieldFlags{} << (SceneFieldFlag::OffsetOnly|SceneFieldFlag::ImplicitMapping); - CORRADE_COMPARE(out.str(), "OffsetOnly|0xe0 {} Trade::SceneFieldFlag::OffsetOnly|Trade::SceneFieldFlag::ImplicitMapping\n"); + CORRADE_COMPARE(out, "OffsetOnly|0xe0 {} Trade::SceneFieldFlag::OffsetOnly|Trade::SceneFieldFlag::ImplicitMapping\n"); } void SceneDataTest::debugFieldFlagsSupersets() { /* ImplicitMapping is a superset of OrderedMapping, so only one should be printed */ { - std::ostringstream out; + Containers::String out; Debug{&out} << (SceneFieldFlag::ImplicitMapping|SceneFieldFlag::OrderedMapping); - CORRADE_COMPARE(out.str(), "Trade::SceneFieldFlag::ImplicitMapping\n"); + CORRADE_COMPARE(out, "Trade::SceneFieldFlag::ImplicitMapping\n"); } } @@ -1892,12 +1890,12 @@ void SceneDataTest::constructFieldInconsistentViewSize() { const char helloStringData[5]{}; const UnsignedLong helloOffsetsData[2]{}; - std::ostringstream out; + Containers::String out; Error redirectError{&out}; SceneFieldData{SceneField::Rotation, Containers::arrayView(mappingData), Containers::arrayView(rotationFieldData)}; SceneFieldData{sceneFieldCustom(773), Containers::arrayView(mappingData), Containers::BitArrayView{hiddenFieldData, 0, 2}}; SceneFieldData{sceneFieldCustom(32), Containers::arrayView(mappingData), helloStringData, SceneFieldType::StringOffset64, Containers::arrayView(helloOffsetsData)}; - CORRADE_COMPARE(out.str(), + CORRADE_COMPARE(out, "Trade::SceneFieldData: expected Trade::SceneField::Rotation mapping and field view to have the same size but got 3 and 2\n" "Trade::SceneFieldData: expected Trade::SceneField::Custom(773) mapping and field view to have the same size but got 3 and 2\n" "Trade::SceneFieldData: expected Trade::SceneField::Custom(32) mapping and field view to have the same size but got 3 and 2\n"); @@ -1909,13 +1907,13 @@ void SceneDataTest::constructFieldWrongType() { const UnsignedShort rotationMappingData[3]{}; const Quaternion rotationFieldData[3]; - std::ostringstream out; + Containers::String out; Error redirectError{&out}; SceneFieldData{SceneField::Transformation, Containers::arrayView(rotationMappingData), Containers::arrayView(rotationFieldData)}; SceneFieldData{SceneField::Transformation, 3, SceneMappingType::UnsignedShort, 0, sizeof(UnsignedShort), SceneFieldType::Quaternion, 0, sizeof(Quaternion)}; /** @todo test also builtin bit and string fields with non-string types once there are any */ - CORRADE_COMPARE(out.str(), + CORRADE_COMPARE(out, "Trade::SceneFieldData: Trade::SceneFieldType::Quaternion is not a valid type for Trade::SceneField::Transformation\n" "Trade::SceneFieldData: Trade::SceneFieldType::Quaternion is not a valid type for Trade::SceneField::Transformation\n"); } @@ -1926,7 +1924,7 @@ void SceneDataTest::constructFieldWrongTypeBit() { const UnsignedShort hiddenMappingData[3]{}; const bool hiddenFieldData[3]{}; - std::ostringstream out; + Containers::String out; Error redirectError{&out}; /* Non-bit constructors with SceneFieldType::Bit. Only type-erased, 2D and offset-only construction, the regular and array constructor from typed @@ -1934,7 +1932,7 @@ void SceneDataTest::constructFieldWrongTypeBit() { SceneFieldData{sceneFieldCustom(773), SceneMappingType::UnsignedShort, Containers::arrayView(hiddenMappingData), SceneFieldType::Bit, Containers::arrayView(hiddenFieldData)}; SceneFieldData{sceneFieldCustom(773), Containers::arrayCast<2, const char>(Containers::arrayView(hiddenMappingData)), SceneFieldType::Bit, Containers::arrayCast<2, const char>(Containers::arrayView(hiddenFieldData))}; SceneFieldData{sceneFieldCustom(773), 3, SceneMappingType::UnsignedShort, 0, 2, SceneFieldType::Bit, 0, 1}; - CORRADE_COMPARE(out.str(), + CORRADE_COMPARE(out, "Trade::SceneFieldData: use a bit constructor for Trade::SceneFieldType::Bit\n" "Trade::SceneFieldData: use a bit constructor for Trade::SceneFieldType::Bit\n" "Trade::SceneFieldData: use a bit constructor for Trade::SceneFieldType::Bit\n"); @@ -1948,7 +1946,7 @@ void SceneDataTest::constructFieldWrongTypeString() { const char helloStringData[5]{}; const UnsignedLong helloFieldData[3]{}; - std::ostringstream out; + Containers::String out; Error redirectError{&out}; /* Non-string constructors with a string SceneFieldType. Only type-erased, 2D and offset-only construction, the regular and array constructor from @@ -1962,7 +1960,7 @@ void SceneDataTest::constructFieldWrongTypeString() { SceneFieldData{SceneField::Rotation, Containers::arrayCast<2, const char>(Containers::arrayView(mappingData)), helloStringData, SceneFieldType::Complexd, Containers::arrayCast<2, const char>(Containers::arrayView(rotationFieldData))}; SceneFieldData{SceneField::Rotation, Containers::arrayView(mappingData), helloStringData, SceneFieldType::Complexd, Containers::arrayView(rotationFieldData)}; SceneFieldData{SceneField::Rotation, 3, SceneMappingType::UnsignedLong, 0, 8, 0, SceneFieldType::Quaternion, 0, 16}; - CORRADE_COMPARE(out.str(), + CORRADE_COMPARE(out, "Trade::SceneFieldData: use a string constructor for Trade::SceneFieldType::StringOffset64\n" "Trade::SceneFieldData: use a string constructor for Trade::SceneFieldType::StringOffset64\n" "Trade::SceneFieldData: use a string constructor for Trade::SceneFieldType::StringRange16\n" @@ -1996,7 +1994,7 @@ void SceneDataTest::constructFieldTooLargeMappingStride() { SceneFieldData{sceneFieldCustom(35), 2, SceneMappingType::UnsignedInt, 0, 32767, 0, SceneFieldType::StringOffset32, 0, 4}; SceneFieldData{sceneFieldCustom(35), 2, SceneMappingType::UnsignedInt, 65536, -32768, 0, SceneFieldType::StringOffset32, 0, 4}; - std::ostringstream out; + Containers::String out; Error redirectError{&out}; SceneFieldData{SceneField::Mesh, SceneMappingType::UnsignedInt, Containers::StridedArrayView1D{Containers::arrayCast(toomuch), 2, 32768}, SceneFieldType::UnsignedInt, enough}; SceneFieldData{SceneField::Mesh, SceneMappingType::UnsignedInt, Containers::StridedArrayView1D{Containers::arrayCast(toomuch), 2, 32769}.flipped<0>(), SceneFieldType::UnsignedInt, enough}; @@ -2012,7 +2010,7 @@ void SceneDataTest::constructFieldTooLargeMappingStride() { SceneFieldData{sceneFieldCustom(25), SceneMappingType::UnsignedInt, Containers::StridedArrayView1D{Containers::arrayCast(toomuch), 2, 32769}.flipped<0>(), helloStringData, SceneFieldType::StringOffset32, enough}; SceneFieldData{sceneFieldCustom(35), 2, SceneMappingType::UnsignedInt, 0, 32768, 0, SceneFieldType::StringOffset32, 0, 4}; SceneFieldData{sceneFieldCustom(35), 2, SceneMappingType::UnsignedInt, 65538, -32769, 0, SceneFieldType::StringOffset32, 0, 4}; - CORRADE_COMPARE(out.str(), + CORRADE_COMPARE(out, "Trade::SceneFieldData: expected mapping view stride to fit into 16 bits but got 32768\n" "Trade::SceneFieldData: expected mapping view stride to fit into 16 bits but got -32769\n" "Trade::SceneFieldData: expected mapping view stride to fit into 16 bits but got 32768\n" @@ -2052,7 +2050,7 @@ void SceneDataTest::constructFieldTooLargeFieldStride() { SceneFieldData{sceneFieldCustom(35), 2, SceneMappingType::UnsignedInt, 0, 4, 0, SceneFieldType::StringRangeNullTerminated32, 0, 32767}; SceneFieldData{sceneFieldCustom(35), 2, SceneMappingType::UnsignedInt, 0, 4, 0, SceneFieldType::StringRangeNullTerminated32, 65536, -32768}; - std::ostringstream out; + Containers::String out; Error redirectError{&out}; SceneFieldData{SceneField::Mesh, SceneMappingType::UnsignedInt, enough, SceneFieldType::UnsignedInt, Containers::StridedArrayView1D{Containers::arrayCast(toomuch), 2, 32768}}; SceneFieldData{SceneField::Mesh, SceneMappingType::UnsignedInt, enough, SceneFieldType::UnsignedInt, Containers::StridedArrayView1D{Containers::arrayCast(toomuch), 2, 32769}.flipped<0>()}; @@ -2068,7 +2066,7 @@ void SceneDataTest::constructFieldTooLargeFieldStride() { SceneFieldData{sceneFieldCustom(35), SceneMappingType::UnsignedInt, enough, helloStringData, SceneFieldType::StringRangeNullTerminated32, Containers::StridedArrayView1D{Containers::arrayCast(toomuch), 2, 32769}.flipped<0>()}; SceneFieldData{sceneFieldCustom(35), 2, SceneMappingType::UnsignedInt, 0, 4, 0, SceneFieldType::StringRangeNullTerminated32, 0, 32768}; SceneFieldData{sceneFieldCustom(35), 2, SceneMappingType::UnsignedInt, 0, 4, 0, SceneFieldType::StringRangeNullTerminated32, 65538, -32769}; - CORRADE_COMPARE(out.str(), + CORRADE_COMPARE(out, "Trade::SceneFieldData: expected field view stride to fit into 16 bits but got 32768\n" "Trade::SceneFieldData: expected field view stride to fit into 16 bits but got -32769\n" "Trade::SceneFieldData: expected field view stride to fit into 16 bits but got 32768\n" @@ -2102,7 +2100,7 @@ void SceneDataTest::constructFieldFlagNotAllowed() { SceneFieldData{sceneFieldCustom(24), Containers::arrayView(mappingData), helloStringData, SceneFieldType::StringOffset32, helloFieldData, SceneFieldFlag::NullTerminatedString|SceneFieldFlag::MultiEntry}; SceneFieldData{sceneFieldCustom(24), 3, SceneMappingType::UnsignedShort, 0, 2, 0, SceneFieldType::StringOffset32, 0, 4, SceneFieldFlag::NullTerminatedString|SceneFieldFlag::MultiEntry}; - std::ostringstream out; + Containers::String out; Error redirectError{&out}; SceneFieldData{SceneField::Rotation, Containers::arrayView(mappingData), Containers::arrayView(rotationFieldData), SceneFieldFlag::OffsetOnly}; SceneFieldData{SceneField::Rotation, Containers::arrayView(mappingData), Containers::arrayView(rotationFieldData), SceneFieldFlag::MultiEntry}; @@ -2118,7 +2116,7 @@ void SceneDataTest::constructFieldFlagNotAllowed() { SceneFieldData{sceneFieldCustom(773), 3, SceneMappingType::UnsignedShort, 0, 2, 0, 0, 16, SceneFieldFlag::NullTerminatedString}; SceneFieldData{sceneFieldCustom(24), Containers::arrayView(mappingData), helloStringData, SceneFieldType::StringOffset32, helloFieldData, SceneFieldFlag::OffsetOnly}; - CORRADE_COMPARE_AS(out.str(), + CORRADE_COMPARE_AS(out, "Trade::SceneFieldData: can't pass Trade::SceneFieldFlag::OffsetOnly for a Trade::SceneField::Rotation view of Trade::SceneFieldType::Quaternion\n" "Trade::SceneFieldData: can't pass Trade::SceneFieldFlag::MultiEntry for a Trade::SceneField::Rotation view of Trade::SceneFieldType::Quaternion\n" "Trade::SceneFieldData: can't pass Trade::SceneFieldFlag::NullTerminatedString for a Trade::SceneField::Rotation view of Trade::SceneFieldType::Quaternion\n" @@ -2157,13 +2155,13 @@ void SceneDataTest::constructFieldWrongOffsetOnlyDataAccess() { c.fieldBitData(hello); d.stringData(hello); - std::ostringstream out; + Containers::String out; Error redirectError{&out}; b.mappingData(); b.fieldData(); d.fieldBitData(); d.stringData(); - CORRADE_COMPARE(out.str(), + CORRADE_COMPARE(out, "Trade::SceneFieldData::mappingData(): the field is offset-only, supply a data array\n" "Trade::SceneFieldData::fieldData(): the field is offset-only, supply a data array\n" "Trade::SceneFieldData::fieldBitData(): the field is offset-only, supply a data array\n" @@ -2180,13 +2178,13 @@ void SceneDataTest::constructFieldWrongBitDataAccess() { SceneFieldData a{sceneFieldCustom(773), Containers::arrayView(mappingData), Containers::BitArrayView{hiddenFieldData, 0, 3}}; SceneFieldData b{SceneField::Rotation, Containers::arrayView(mappingData), Containers::arrayView(rotationFieldData)}; - std::ostringstream out; + Containers::String out; Error redirectError{&out}; a.fieldData(); a.fieldData(hiddenFieldData); b.fieldBitData(); b.fieldBitData(rotationFieldData); - CORRADE_COMPARE(out.str(), + CORRADE_COMPARE(out, "Trade::SceneFieldData::fieldData(): the field is Trade::SceneFieldType::Bit, use fieldBitData() instead\n" "Trade::SceneFieldData::fieldData(): the field is Trade::SceneFieldType::Bit, use fieldBitData() instead\n" "Trade::SceneFieldData::fieldBitData(): the field is Trade::SceneFieldType::Quaternion, not a bit\n" @@ -2201,11 +2199,11 @@ void SceneDataTest::constructFieldWrongStringDataAccess() { SceneFieldData a{SceneField::Rotation, Containers::arrayView(rotationMappingData), Containers::arrayView(rotationFieldData)}; - std::ostringstream out; + Containers::String out; Error redirectError{&out}; a.stringData(); a.stringData(rotationFieldData); - CORRADE_COMPARE(out.str(), + CORRADE_COMPARE(out, "Trade::SceneFieldData::stringData(): the field is Trade::SceneFieldType::Quaternion, not a string\n" "Trade::SceneFieldData::stringData(): the field is Trade::SceneFieldType::Quaternion, not a string\n"); } @@ -2219,7 +2217,7 @@ void SceneDataTest::constructFieldTypeErased2DWrongSize() { char helloStringData[3]{}; char helloFieldData[4*sizeof(UnsignedShort)]{}; - std::ostringstream out; + Containers::String out; Error redirectError{&out}; SceneFieldData{SceneField::Rotation, Containers::StridedArrayView2D{mappingData, {4, 5}}.every(2), @@ -2246,7 +2244,7 @@ void SceneDataTest::constructFieldTypeErased2DWrongSize() { helloStringData, SceneFieldType::StringRange16, Containers::StridedArrayView2D{helloFieldData, {4, sizeof(UnsignedShort)}}.every(2)}; - CORRADE_COMPARE(out.str(), + CORRADE_COMPARE(out, "Trade::SceneFieldData: expected second mapping view dimension size 1, 2, 4 or 8 but got 5\n" "Trade::SceneFieldData: expected second mapping view dimension size 1, 2, 4 or 8 but got 5\n" "Trade::SceneFieldData: expected second mapping view dimension size 1, 2, 4 or 8 but got 5\n" @@ -2264,7 +2262,7 @@ void SceneDataTest::constructFieldTypeErased2DNonContiguous() { char helloStringData[3]{}; char helloFieldData[8*sizeof(UnsignedShort)]{}; - std::ostringstream out; + Containers::String out; Error redirectError{&out}; SceneFieldData{SceneField::Rotation, Containers::StridedArrayView2D{mappingData, {4, 2*sizeof(UnsignedInt)}}.every({1, 2}), @@ -2291,7 +2289,7 @@ void SceneDataTest::constructFieldTypeErased2DNonContiguous() { helloStringData, SceneFieldType::StringOffset8, Containers::StridedArrayView2D{helloFieldData, {4, 2*sizeof(UnsignedByte)}}.every({1, 2})}; - CORRADE_COMPARE(out.str(), + CORRADE_COMPARE(out, "Trade::SceneFieldData: second mapping view dimension is not contiguous\n" "Trade::SceneFieldData: second mapping view dimension is not contiguous\n" "Trade::SceneFieldData: second mapping view dimension is not contiguous\n" @@ -2306,13 +2304,13 @@ void SceneDataTest::constructFieldArrayNonContiguous() { Int offsetFieldData[3*4]; char hiddenFieldData[2]{}; - std::ostringstream out; + Containers::String out; Error redirectError{&out}; SceneFieldData data{sceneFieldCustom(34), Containers::arrayView(mappingData), Containers::StridedArrayView2D{offsetFieldData, {3, 4}}.every({1, 2})}; SceneFieldData{sceneFieldCustom(773), Containers::arrayView(mappingData), Containers::StridedBitArrayView2D{Containers::BitArrayView{hiddenFieldData}, {3, 4}}.every({1, 2})}; - CORRADE_COMPARE(out.str(), + CORRADE_COMPARE(out, "Trade::SceneFieldData: second field view dimension is not contiguous\n" "Trade::SceneFieldData: second field view dimension is not contiguous\n"); } @@ -2348,7 +2346,7 @@ void SceneDataTest::constructFieldArrayNotAllowed() { SceneFieldType::Quaternion, 0, sizeof(Quaternion), 3}; /* This is not */ - std::ostringstream out; + Containers::String out; Error redirectError{&out}; SceneFieldData{SceneField::Rotation, SceneMappingType::UnsignedShort, rotationMapping, @@ -2365,7 +2363,7 @@ void SceneDataTest::constructFieldArrayNotAllowed() { /* String fields can't be arrays, but for those the constructor doesn't even offer the array size; and constructing them with the regular constructor will fail as tested in constructFieldWrongTypeString() */ - CORRADE_COMPARE(out.str(), + CORRADE_COMPARE(out, "Trade::SceneFieldData: Trade::SceneField::Rotation can't be an array field\n" "Trade::SceneFieldData: Trade::SceneField::Rotation can't be an array field\n" "Trade::SceneFieldData: Trade::SceneField::Rotation can't be an array field\n" @@ -2378,13 +2376,13 @@ void SceneDataTest::constructFieldArrayTypeErased2DWrongSize() { char rotationMappingData[4*sizeof(UnsignedInt)]; char rotationFieldData[4*sizeof(Complex)]; - std::ostringstream out; + Containers::String out; Error redirectError{&out}; SceneFieldData{sceneFieldCustom(37), Containers::StridedArrayView2D{rotationMappingData, {4, sizeof(UnsignedInt)}}.every(2), SceneFieldType::Int, Containers::StridedArrayView2D{rotationFieldData, {4, sizeof(Complex)}}.every(2), 3}; - CORRADE_COMPARE(out.str(), + CORRADE_COMPARE(out, "Trade::SceneFieldData: second field view dimension size 8 doesn't match Trade::SceneFieldType::Int and field array size 3\n"); } @@ -2395,7 +2393,7 @@ void SceneDataTest::constructFieldArrayTypeErased2DNonContiguous() { char offsetFieldData[18*sizeof(Int)]; char hiddenFieldData[2]{}; - std::ostringstream out; + Containers::String out; Error redirectError{&out}; SceneFieldData{sceneFieldCustom(37), Containers::StridedArrayView2D{mappingData, {3, 2*sizeof(UnsignedInt)}}.every({1, 2}), @@ -2411,7 +2409,7 @@ void SceneDataTest::constructFieldArrayTypeErased2DNonContiguous() { SceneFieldData{sceneFieldCustom(773), Containers::StridedArrayView2D{mappingData, {3, sizeof(UnsignedInt)}}, Containers::StridedBitArrayView2D{Containers::BitArrayView{hiddenFieldData}, {3, 4}}.every({1, 2})}; - CORRADE_COMPARE(out.str(), + CORRADE_COMPARE(out, "Trade::SceneFieldData: second mapping view dimension is not contiguous\n" "Trade::SceneFieldData: second mapping view dimension is not contiguous\n" "Trade::SceneFieldData: second field view dimension is not contiguous\n" @@ -2425,10 +2423,10 @@ void SceneDataTest::constructFieldBitTooLargeBitOffset() { checks this on its own already. There it's a debug-only assert, be consistent and have it debug-only here as well. */ - std::ostringstream out; + Containers::String out; Error redirectError{&out}; SceneFieldData{sceneFieldCustom(773), 3, SceneMappingType::UnsignedInt, 0, sizeof(UnsignedInt), 0, 8, 1}; - CORRADE_COMPARE(out.str(), "Trade::SceneFieldData: bit offset expected to be smaller than 8, got 8\n"); + CORRADE_COMPARE(out, "Trade::SceneFieldData: bit offset expected to be smaller than 8, got 8\n"); } void SceneDataTest::constructFieldBitTooLargeSize() { @@ -2438,13 +2436,13 @@ void SceneDataTest::constructFieldBitTooLargeSize() { checks this on its own already. There it's a debug-only assert, be consistent and have it debug-only here as well. */ - std::ostringstream out; + Containers::String out; Error redirectError{&out}; SceneFieldData{sceneFieldCustom(773), std::size_t{1} << (sizeof(std::size_t)*8 - 3), SceneMappingType::UnsignedInt, 0, sizeof(UnsignedInt), 0, 0, 1}; #ifndef CORRADE_TARGET_32BIT - CORRADE_COMPARE(out.str(), "Trade::SceneFieldData: size expected to be smaller than 2^61 bits, got 2305843009213693952\n"); + CORRADE_COMPARE(out, "Trade::SceneFieldData: size expected to be smaller than 2^61 bits, got 2305843009213693952\n"); #else - CORRADE_COMPARE(out.str(), "Trade::SceneFieldData: size expected to be smaller than 2^29 bits, got 536870912\n"); + CORRADE_COMPARE(out, "Trade::SceneFieldData: size expected to be smaller than 2^29 bits, got 536870912\n"); #endif } @@ -2454,7 +2452,7 @@ void SceneDataTest::constructFieldStringDataTooFarApart() { UnsignedShort mappingData[3]{}; - std::ostringstream out; + Containers::String out; Error redirectError{&out}; SceneFieldData{sceneFieldCustom(166), Containers::arrayView(mappingData), @@ -2467,7 +2465,7 @@ void SceneDataTest::constructFieldStringDataTooFarApart() { SceneFieldData{sceneFieldCustom(661), 3, SceneMappingType::UnsignedShort, 1725676, 2, 0x800000000000ull, SceneFieldType::StringOffset8, 72567654, 8}; - CORRADE_COMPARE(out.str(), + CORRADE_COMPARE(out, "Trade::SceneFieldData: (signed) distance between string data and field data expected to fit into 48 bits but got 0xfeedbeef and 0x8000feedbeef\n" "Trade::SceneFieldData: (signed) distance between string data and field data expected to fit into 48 bits but got 0x8000feedbeef and 0xfeedbeef\n" "Trade::SceneFieldData: expected string data offset to fit into 48 bits but got 140737488355328\n"); @@ -3576,12 +3574,12 @@ void SceneDataTest::constructDeprecated() { void SceneDataTest::constructDeprecatedBoth2DAnd3D() { CORRADE_SKIP_IF_NO_ASSERT(); - std::ostringstream out; + Containers::String out; Error redirectError{&out}; CORRADE_IGNORE_DEPRECATED_PUSH SceneData scene{{5, 17}, {36, 22}}; CORRADE_IGNORE_DEPRECATED_POP - CORRADE_COMPARE(out.str(), "Trade::SceneData: it's no longer possible to have a scene with both 2D and 3D objects\n"); + CORRADE_COMPARE(out, "Trade::SceneData: it's no longer possible to have a scene with both 2D and 3D objects\n"); } #endif @@ -3618,10 +3616,10 @@ void SceneDataTest::constructDuplicateField() { SceneFieldData materials{SceneField::MeshMaterial, SceneMappingType::UnsignedInt, nullptr, SceneFieldType::Int, nullptr}; SceneFieldData meshesAgain{SceneField::Mesh, SceneMappingType::UnsignedInt, nullptr, SceneFieldType::UnsignedInt, nullptr}; - std::ostringstream out; + Containers::String out; Error redirectError{&out}; SceneData scene{SceneMappingType::UnsignedInt, 0, nullptr, {meshes, materials, meshesAgain}}; - CORRADE_COMPARE(out.str(), "Trade::SceneData: duplicate field Trade::SceneField::Mesh\n"); + CORRADE_COMPARE(out, "Trade::SceneData: duplicate field Trade::SceneField::Mesh\n"); } void SceneDataTest::constructDuplicateCustomField() { @@ -3633,10 +3631,10 @@ void SceneDataTest::constructDuplicateCustomField() { SceneFieldData customB{sceneFieldCustom(1038576154), SceneMappingType::UnsignedInt, nullptr, SceneFieldType::UnsignedInt, nullptr}; SceneFieldData customAAgain{sceneFieldCustom(37), SceneMappingType::UnsignedInt, nullptr, SceneFieldType::UnsignedInt, nullptr}; - std::ostringstream out; + Containers::String out; Error redirectError{&out}; SceneData scene{SceneMappingType::UnsignedInt, 0, nullptr, {customA, customB, customAAgain}}; - CORRADE_COMPARE(out.str(), "Trade::SceneData: duplicate field Trade::SceneField::Custom(37)\n"); + CORRADE_COMPARE(out, "Trade::SceneData: duplicate field Trade::SceneField::Custom(37)\n"); } void SceneDataTest::constructInconsistentMappingType() { @@ -3645,10 +3643,10 @@ void SceneDataTest::constructInconsistentMappingType() { SceneFieldData meshes{SceneField::Mesh, SceneMappingType::UnsignedInt, nullptr, SceneFieldType::UnsignedShort, nullptr}; SceneFieldData materials{SceneField::MeshMaterial, SceneMappingType::UnsignedShort, nullptr, SceneFieldType::Int, nullptr}; - std::ostringstream out; + Containers::String out; Error redirectError{&out}; SceneData scene{SceneMappingType::UnsignedInt, 0, nullptr, {meshes, materials}}; - CORRADE_COMPARE(out.str(), "Trade::SceneData: inconsistent mapping type, got Trade::SceneMappingType::UnsignedShort for field 1 but expected Trade::SceneMappingType::UnsignedInt\n"); + CORRADE_COMPARE(out, "Trade::SceneData: inconsistent mapping type, got Trade::SceneMappingType::UnsignedShort for field 1 but expected Trade::SceneMappingType::UnsignedInt\n"); } void SceneDataTest::constructMappingDataNotContained() { @@ -3660,7 +3658,7 @@ void SceneDataTest::constructMappingDataNotContained() { Containers::ArrayView dataSlightlyOut{reinterpret_cast(0xbaddaa), 5}; Containers::ArrayView dataOut{reinterpret_cast(0xdead), 5}; - std::ostringstream out; + Containers::String out; Error redirectError{&out}; /* Basic "obviously wrong" case with owned data */ SceneData{SceneMappingType::UnsignedShort, 5, Utility::move(sameDataButMovable), { @@ -3690,7 +3688,7 @@ void SceneDataTest::constructMappingDataNotContained() { SceneData{SceneMappingType::UnsignedByte, 6, Containers::Array{24}, { SceneFieldData{SceneField::Mesh, 6, SceneMappingType::UnsignedByte, 24, -4, SceneFieldType::UnsignedByte, 0, 4} }}; - CORRADE_COMPARE(out.str(), + CORRADE_COMPARE(out, "Trade::SceneData: mapping data [0xdead:0xdeb7] of field 1 are not contained in passed data array [0xbadda9:0xbaddb3]\n" "Trade::SceneData: mapping data [0xbaddaa:0xbaddb4] of field 0 are not contained in passed data array [0xbadda9:0xbaddb3]\n" "Trade::SceneData: mapping data [0xdead:0xdeb7] of field 0 are not contained in passed data array [0x0:0x0]\n" @@ -3715,7 +3713,7 @@ void SceneDataTest::constructFieldDataNotContained() { Containers::ArrayView dataSlightlyOut{reinterpret_cast(0xbaddaa), 5}; Containers::ArrayView dataOut{reinterpret_cast(0xdead), 5}; - std::ostringstream out; + Containers::String out; Error redirectError{&out}; /* Basic "obviously wrong" case with owned data */ SceneData{SceneMappingType::UnsignedShort, 5, Utility::move(sameDataButMovable), { @@ -3752,7 +3750,7 @@ void SceneDataTest::constructFieldDataNotContained() { SceneData{SceneMappingType::UnsignedByte, 6, Containers::Array{24}, { SceneFieldData{SceneField::Mesh, 6, SceneMappingType::UnsignedByte, 0, 4, SceneFieldType::UnsignedByte, 24, -4} }}; - CORRADE_COMPARE(out.str(), + CORRADE_COMPARE(out, "Trade::SceneData: field data [0xdead:0xdeb7] of field 1 are not contained in passed data array [0xbadda9:0xbaddb3]\n" "Trade::SceneData: field data [0xbaddaa:0xbaddb4] of field 0 are not contained in passed data array [0xbadda9:0xbaddb3]\n" "Trade::SceneData: field data [0xbadda9:0xbaddb5] of field 0 are not contained in passed data array [0xbadda9:0xbaddb3]\n" @@ -3780,7 +3778,7 @@ void SceneDataTest::constructBitFieldDataNotContained() { Containers::StridedBitArrayView1D dataOneBitOffsetBeforeOut{Containers::BitArrayView{reinterpret_cast(std::size_t{0xbadda8}), 7, 80}, 10, 8}; Containers::BitArrayView dataOut{reinterpret_cast(std::size_t{0xdead}), 7, 10}; - std::ostringstream out; + Containers::String out; Error redirectError{&out}; /* Basic "obviously wrong" case with owned data */ SceneData{SceneMappingType::UnsignedByte, 10, Utility::move(sameDataButMovable), { @@ -3842,7 +3840,7 @@ void SceneDataTest::constructBitFieldDataNotContained() { SceneData{SceneMappingType::UnsignedByte, 10, Containers::Array{10}, { SceneFieldData{sceneFieldCustom(773), 9, SceneMappingType::UnsignedByte, 0, 1, 10, 0, -9} }}; - CORRADE_COMPARE(out.str(), + CORRADE_COMPARE(out, "Trade::SceneData: field data [0xdead:0xdeb0] of field 1 are not contained in passed data array [0xbadda9:0xbaddb3]\n" "Trade::SceneData: field data [0xbaddaa:0xbaddb4] of field 0 are not contained in passed data array [0xbadda9:0xbaddb3]\n" @@ -3879,7 +3877,7 @@ void SceneDataTest::constructStringDataNotContained() { dataIn} }}; - std::ostringstream out; + Containers::String out; Error redirectError{&out}; /* Data too early */ SceneData{SceneMappingType::UnsignedShort, 5, {}, data, { @@ -3896,7 +3894,7 @@ void SceneDataTest::constructStringDataNotContained() { reinterpret_cast(0xbaddaa9 + 11), SceneFieldType::StringRange8, dataIn} }}; - CORRADE_COMPARE(out.str(), + CORRADE_COMPARE(out, "Trade::SceneData: field string data 0xbadda8 of field 1 are not contained in passed data array [0xbadda9:0xbaddb3]\n" "Trade::SceneData: field string data 0xbaddab4 of field 0 are not contained in passed data array [0xbadda9:0xbaddb3]\n"); } @@ -3909,12 +3907,12 @@ void SceneDataTest::constructMappingTypeTooSmall() { SceneData{SceneMappingType::UnsignedShort, 0xffff, nullptr, {}}; SceneData{SceneMappingType::UnsignedInt, 0xffffffffu, nullptr, {}}; - std::ostringstream out; + Containers::String out; Error redirectError{&out}; SceneData{SceneMappingType::UnsignedByte, 0x100, nullptr, {}}; SceneData{SceneMappingType::UnsignedShort, 0x10000, nullptr, {}}; SceneData{SceneMappingType::UnsignedInt, 0x100000000ull, nullptr, {}}; - CORRADE_COMPARE(out.str(), + CORRADE_COMPARE(out, "Trade::SceneData: Trade::SceneMappingType::UnsignedByte is too small for 256 objects\n" "Trade::SceneData: Trade::SceneMappingType::UnsignedShort is too small for 65536 objects\n" "Trade::SceneData: Trade::SceneMappingType::UnsignedInt is too small for 4294967296 objects\n"); @@ -3925,10 +3923,10 @@ void SceneDataTest::constructNotOwnedFlagOwned() { const char data[32]{}; - std::ostringstream out; + Containers::String out; Error redirectError{&out}; SceneData{SceneMappingType::UnsignedByte, 5, DataFlag::Owned, Containers::arrayView(data), {}}; - CORRADE_COMPARE(out.str(), + CORRADE_COMPARE(out, "Trade::SceneData: can't construct with non-owned data but Trade::DataFlag::Owned\n"); } @@ -3985,7 +3983,7 @@ void SceneDataTest::constructMismatchedTRSViews() { SceneData{SceneMappingType::UnsignedInt, 3, {}, data, {rotationsOffsetOnly, scalings}}; /* Test that all pairs get checked */ - std::ostringstream out; + Containers::String out; Error redirectError{&out}; SceneData{SceneMappingType::UnsignedInt, 3, {}, data, {translations, rotationsDifferentPointer}}; SceneData{SceneMappingType::UnsignedInt, 3, {}, data, {translations, rotationsDifferentPointerOffsetOnly}}; @@ -4004,7 +4002,7 @@ void SceneDataTest::constructMismatchedTRSViews() { SceneData{SceneMappingType::UnsignedInt, 3, {}, data, {rotationsOffsetOnly, scalingsDifferentPointer}}; SceneData{SceneMappingType::UnsignedInt, 3, {}, data, {rotations, scalingsDifferentSize}}; SceneData{SceneMappingType::UnsignedInt, 3, {}, data, {rotations, scalingsDifferentStride}}; - CORRADE_COMPARE_AS(out.str(), + CORRADE_COMPARE_AS(out, /* Different pointer, three variants with offset-only */ "Trade::SceneData: Trade::SceneField::Rotation mapping data {0xcafe0048, 3, 4} is different from Trade::SceneField::Translation mapping data {0xcafe004c, 3, 4}\n" "Trade::SceneData: Trade::SceneField::Rotation mapping data {0xcafe0048, 3, 4} is different from Trade::SceneField::Translation mapping data {0xcafe004c, 3, 4}\n" @@ -4095,7 +4093,7 @@ template void SceneDataTest::constructMismatchedTRSDimensionality() { SceneFieldData scalings3D{SceneField::Scaling, SceneMappingType::UnsignedInt, nullptr, Implementation::SceneFieldTypeFor>::type(), nullptr}; /* Test that all pairs get checked */ - std::ostringstream out; + Containers::String out; Error redirectError{&out}; SceneData{SceneMappingType::UnsignedInt, 0, nullptr, {transformationMatrices2D, translations3D}}; SceneData{SceneMappingType::UnsignedInt, 0, nullptr, {transformationMatrices2D, rotations3D}}; @@ -4124,7 +4122,7 @@ template void SceneDataTest::constructMismatchedTRSDimensionality() { SceneData{SceneMappingType::UnsignedInt, 0, nullptr, {translations3D, rotations2D}}; SceneData{SceneMappingType::UnsignedInt, 0, nullptr, {translations3D, scalings2D}}; SceneData{SceneMappingType::UnsignedInt, 0, nullptr, {rotations3D, scalings2D}}; - CORRADE_COMPARE(out.str(), Utility::formatString( + CORRADE_COMPARE(out, Utility::format( "Trade::SceneData: expected a 2D translation field but got Trade::SceneFieldType::{0}\n" "Trade::SceneData: expected a 2D rotation field but got Trade::SceneFieldType::{1}\n" "Trade::SceneData: expected a 2D scaling field but got Trade::SceneFieldType::{0}\n" @@ -4178,22 +4176,22 @@ void SceneDataTest::constructMismatchedMeshMaterialView() { SceneFieldData meshes{SceneField::Mesh, mappingData, meshFieldData}; SceneFieldData meshMaterialsDifferent{SceneField::MeshMaterial, mappingDifferentPointerData, meshMaterialFieldData}; - std::ostringstream out; + Containers::String out; Error redirectError{&out}; SceneData{SceneMappingType::UnsignedInt, 3, {}, data, {meshes, meshMaterialsDifferent}}; - CORRADE_COMPARE(out.str(), + CORRADE_COMPARE(out, "Trade::SceneData: Trade::SceneField::MeshMaterial mapping data {0xcafe0018, 3, 4} is different from Trade::SceneField::Mesh mapping data {0xcafe001c, 3, 4}\n"); } void SceneDataTest::constructAmbiguousSkinDimensions() { CORRADE_SKIP_IF_NO_ASSERT(); - std::ostringstream out; + Containers::String out; Error redirectError{&out}; SceneData{SceneMappingType::UnsignedInt, 0, nullptr, { SceneFieldData{SceneField::Skin, SceneMappingType::UnsignedInt, nullptr, SceneFieldType::UnsignedInt, nullptr} }}; - CORRADE_COMPARE(out.str(), "Trade::SceneData: a skin field requires some transformation field to be present in order to disambiguate between 2D and 3D\n"); + CORRADE_COMPARE(out, "Trade::SceneData: a skin field requires some transformation field to be present in order to disambiguate between 2D and 3D\n"); } void SceneDataTest::constructCopy() { @@ -4330,13 +4328,13 @@ void SceneDataTest::findFieldObjectOffsetInvalidOffset() { SceneFieldData{SceneField::Mesh, view.slice(&Field::object), view.slice(&Field::mesh)} }}; - std::ostringstream out; + Containers::String out; Error redirectError{&out}; scene.findFieldObjectOffset(0, 1, 4); scene.findFieldObjectOffset(SceneField::Mesh, 1, 4); scene.fieldObjectOffset(0, 1, 4); scene.fieldObjectOffset(SceneField::Mesh, 1, 4); - CORRADE_COMPARE(out.str(), + CORRADE_COMPARE(out, "Trade::SceneData::findFieldObjectOffset(): offset 4 out of range for a field of size 3\n" "Trade::SceneData::findFieldObjectOffset(): offset 4 out of range for a field of size 3\n" "Trade::SceneData::fieldObjectOffset(): offset 4 out of range for a field of size 3\n" @@ -4364,13 +4362,13 @@ void SceneDataTest::fieldObjectOffsetNotFound() { SceneFieldData{SceneField::Mesh, view.slice(&Field::object), view.slice(&Field::mesh)} }}; - std::ostringstream out; + Containers::String out; Error redirectError{&out}; scene.fieldObjectOffset(0, 4); scene.fieldObjectOffset(SceneField::Parent, 4); scene.fieldObjectOffset(1, 1, 2); scene.fieldObjectOffset(SceneField::Mesh, 1, 2); - CORRADE_COMPARE(out.str(), + CORRADE_COMPARE(out, "Trade::SceneData::fieldObjectOffset(): object 4 not found in field Trade::SceneField::Parent starting at offset 0\n" "Trade::SceneData::fieldObjectOffset(): object 4 not found in field Trade::SceneField::Parent starting at offset 0\n" "Trade::SceneData::fieldObjectOffset(): object 1 not found in field Trade::SceneField::Mesh starting at offset 2\n" @@ -4533,14 +4531,14 @@ void SceneDataTest::mappingIntoArrayInvalidSizeOrOffset() { SceneFieldData{SceneField::Mesh, view.slice(&Field::object), view.slice(&Field::mesh)} }}; - std::ostringstream out; + Containers::String out; Error redirectError{&out}; UnsignedInt destination[2]; scene.mappingInto(0, destination); scene.mappingInto(SceneField::Mesh, destination); scene.mappingInto(0, 4, destination); scene.mappingInto(SceneField::Mesh, 4, destination); - CORRADE_COMPARE(out.str(), + CORRADE_COMPARE(out, "Trade::SceneData::mappingInto(): expected a view with 3 elements but got 2\n" "Trade::SceneData::mappingInto(): expected a view with 3 elements but got 2\n" "Trade::SceneData::mappingInto(): offset 4 out of range for a field of size 3\n" @@ -4649,7 +4647,7 @@ void SceneDataTest::parentsIntoArrayInvalidSizeOrOffset() { SceneFieldData{SceneField::Parent, view.slice(&Field::object), view.slice(&Field::parent)} }}; - std::ostringstream out; + Containers::String out; Error redirectError{&out}; UnsignedInt mappingDestinationCorrect[3]; UnsignedInt mappingDestination[2]; @@ -4659,7 +4657,7 @@ void SceneDataTest::parentsIntoArrayInvalidSizeOrOffset() { scene.parentsInto(mappingDestinationCorrect, fieldDestination); scene.parentsInto(4, mappingDestination, fieldDestination); scene.parentsInto(0, mappingDestinationCorrect, fieldDestination); - CORRADE_COMPARE(out.str(), + CORRADE_COMPARE(out, "Trade::SceneData::parentsInto(): expected mapping destination view either empty or with 3 elements but got 2\n" "Trade::SceneData::parentsInto(): expected field destination view either empty or with 3 elements but got 2\n" "Trade::SceneData::parentsInto(): offset 4 out of range for a field of size 3\n" @@ -4955,11 +4953,11 @@ void SceneDataTest::transformations2DAsArrayBut3DType() { SceneFieldData{SceneField::Rotation, SceneMappingType::UnsignedInt, nullptr, SceneFieldType::Quaternion, nullptr} }}; - std::ostringstream out; + Containers::String out; Error redirectError{&out}; scene.transformations2DAsArray(); scene.translationsRotationsScalings2DAsArray(); - CORRADE_COMPARE(out.str(), + CORRADE_COMPARE(out, "Trade::SceneData::transformations2DInto(): scene has a 3D transformation type\n" "Trade::SceneData::translationsRotationsScalings2DInto(): scene has a 3D transformation type\n"); } @@ -5203,7 +5201,7 @@ void SceneDataTest::transformations2DIntoArrayInvalidSizeOrOffset() { SceneFieldData{SceneField::Transformation, view.slice(&Field::object), view.slice(&Field::transformation)} }}; - std::ostringstream out; + Containers::String out; Error redirectError{&out}; UnsignedInt mappingDestinationCorrect[3]; UnsignedInt mappingDestination[2]; @@ -5213,7 +5211,7 @@ void SceneDataTest::transformations2DIntoArrayInvalidSizeOrOffset() { scene.transformations2DInto(mappingDestinationCorrect, fieldDestination); scene.transformations2DInto(4, mappingDestination, fieldDestination); scene.transformations2DInto(0, mappingDestinationCorrect, fieldDestination); - CORRADE_COMPARE(out.str(), + CORRADE_COMPARE(out, "Trade::SceneData::transformations2DInto(): expected mapping destination view either empty or with 3 elements but got 2\n" "Trade::SceneData::transformations2DInto(): expected field destination view either empty or with 3 elements but got 2\n" "Trade::SceneData::transformations2DInto(): offset 4 out of range for a field of size 3\n" @@ -5234,7 +5232,7 @@ void SceneDataTest::transformations2DIntoArrayInvalidSizeOrOffsetTRS() { SceneFieldData{SceneField::Translation, view.slice(&Field::object), view.slice(&Field::translation)} }}; - std::ostringstream out; + Containers::String out; Error redirectError{&out}; UnsignedInt mappingDestinationCorrect[3]; UnsignedInt mappingDestination[2]; @@ -5255,7 +5253,7 @@ void SceneDataTest::transformations2DIntoArrayInvalidSizeOrOffsetTRS() { scene.translationsRotationsScalings2DInto(0, nullptr, translationDestinationCorrect, rotationDestination, nullptr); scene.translationsRotationsScalings2DInto(0, nullptr, translationDestinationCorrect, nullptr, scalingDestination); scene.translationsRotationsScalings2DInto(0, nullptr, nullptr, rotationDestinationCorrect, scalingDestination); - CORRADE_COMPARE(out.str(), + CORRADE_COMPARE(out, "Trade::SceneData::translationsRotationsScalings2DInto(): expected mapping destination view either empty or with 3 elements but got 2\n" "Trade::SceneData::translationsRotationsScalings2DInto(): expected translation destination view either empty or with 3 elements but got 2\n" "Trade::SceneData::translationsRotationsScalings2DInto(): expected rotation destination view either empty or with 3 elements but got 2\n" @@ -5551,11 +5549,11 @@ void SceneDataTest::transformations3DAsArrayBut2DType() { SceneFieldData{SceneField::Rotation, SceneMappingType::UnsignedInt, nullptr, SceneFieldType::Complex, nullptr} }}; - std::ostringstream out; + Containers::String out; Error redirectError{&out}; scene.transformations3DAsArray(); scene.translationsRotationsScalings3DAsArray(); - CORRADE_COMPARE(out.str(), + CORRADE_COMPARE(out, "Trade::SceneData::transformations3DInto(): scene has a 2D transformation type\n" "Trade::SceneData::translationsRotationsScalings3DInto(): scene has a 2D transformation type\n"); } @@ -5799,7 +5797,7 @@ void SceneDataTest::transformations3DIntoArrayInvalidSizeOrOffset() { SceneFieldData{SceneField::Transformation, view.slice(&Field::object), view.slice(&Field::transformation)} }}; - std::ostringstream out; + Containers::String out; Error redirectError{&out}; UnsignedInt mappingDestinationCorrect[3]; UnsignedInt mappingDestination[2]; @@ -5809,7 +5807,7 @@ void SceneDataTest::transformations3DIntoArrayInvalidSizeOrOffset() { scene.transformations3DInto(mappingDestinationCorrect, fieldDestination); scene.transformations3DInto(4, mappingDestination, fieldDestination); scene.transformations3DInto(0, mappingDestinationCorrect, fieldDestination); - CORRADE_COMPARE(out.str(), + CORRADE_COMPARE(out, "Trade::SceneData::transformations3DInto(): expected mapping destination view either empty or with 3 elements but got 2\n" "Trade::SceneData::transformations3DInto(): expected field destination view either empty or with 3 elements but got 2\n" "Trade::SceneData::transformations3DInto(): offset 4 out of range for a field of size 3\n" @@ -5830,7 +5828,7 @@ void SceneDataTest::transformations3DIntoArrayInvalidSizeOrOffsetTRS() { SceneFieldData{SceneField::Translation, view.slice(&Field::object), view.slice(&Field::translation)} }}; - std::ostringstream out; + Containers::String out; Error redirectError{&out}; UnsignedInt mappingDestinationCorrect[3]; UnsignedInt mappingDestination[2]; @@ -5851,7 +5849,7 @@ void SceneDataTest::transformations3DIntoArrayInvalidSizeOrOffsetTRS() { scene.translationsRotationsScalings3DInto(0, nullptr, translationDestinationCorrect, rotationDestination, nullptr); scene.translationsRotationsScalings3DInto(0, nullptr, translationDestinationCorrect, nullptr, scalingDestination); scene.translationsRotationsScalings3DInto(0, nullptr, nullptr, rotationDestinationCorrect, scalingDestination); - CORRADE_COMPARE(out.str(), + CORRADE_COMPARE(out, "Trade::SceneData::translationsRotationsScalings3DInto(): expected mapping destination view either empty or with 3 elements but got 2\n" "Trade::SceneData::translationsRotationsScalings3DInto(): expected translation destination view either empty or with 3 elements but got 2\n" "Trade::SceneData::translationsRotationsScalings3DInto(): expected rotation destination view either empty or with 3 elements but got 2\n" @@ -6006,7 +6004,7 @@ void SceneDataTest::meshesMaterialsIntoArrayInvalidSizeOrOffset() { SceneFieldData{SceneField::Mesh, view.slice(&Field::object), view.slice(&Field::mesh)} }}; - std::ostringstream out; + Containers::String out; Error redirectError{&out}; UnsignedInt mappingDestinationCorrect[3]; UnsignedInt mappingDestination[2]; @@ -6021,7 +6019,7 @@ void SceneDataTest::meshesMaterialsIntoArrayInvalidSizeOrOffset() { scene.meshesMaterialsInto(0, mappingDestinationCorrect, meshDestination, nullptr); scene.meshesMaterialsInto(0, mappingDestinationCorrect, nullptr, meshMaterialDestination); scene.meshesMaterialsInto(0, nullptr, meshDestinationCorrect, meshMaterialDestination); - CORRADE_COMPARE(out.str(), + CORRADE_COMPARE(out, "Trade::SceneData::meshesMaterialsInto(): expected mapping destination view either empty or with 3 elements but got 2\n" "Trade::SceneData::meshesMaterialsInto(): expected mesh destination view either empty or with 3 elements but got 2\n" "Trade::SceneData::meshesMaterialsInto(): expected mesh material destination view either empty or with 3 elements but got 2\n" @@ -6133,7 +6131,7 @@ void SceneDataTest::lightsIntoArrayInvalidSizeOrOffset() { SceneFieldData{SceneField::Light, view.slice(&Field::object), view.slice(&Field::light)} }}; - std::ostringstream out; + Containers::String out; Error redirectError{&out}; UnsignedInt mappingDestinationCorrect[3]; UnsignedInt mappingDestination[2]; @@ -6143,7 +6141,7 @@ void SceneDataTest::lightsIntoArrayInvalidSizeOrOffset() { scene.lightsInto(mappingDestinationCorrect, fieldDestination); scene.lightsInto(4, mappingDestination, fieldDestination); scene.lightsInto(0, mappingDestinationCorrect, fieldDestination); - CORRADE_COMPARE(out.str(), + CORRADE_COMPARE(out, "Trade::SceneData::lightsInto(): expected mapping destination view either empty or with 3 elements but got 2\n" "Trade::SceneData::lightsInto(): expected field destination view either empty or with 3 elements but got 2\n" "Trade::SceneData::lightsInto(): offset 4 out of range for a field of size 3\n" @@ -6252,7 +6250,7 @@ void SceneDataTest::camerasIntoArrayInvalidSizeOrOffset() { SceneFieldData{SceneField::Camera, view.slice(&Field::object), view.slice(&Field::camera)} }}; - std::ostringstream out; + Containers::String out; Error redirectError{&out}; UnsignedInt mappingDestinationCorrect[3]; UnsignedInt mappingDestination[2]; @@ -6262,7 +6260,7 @@ void SceneDataTest::camerasIntoArrayInvalidSizeOrOffset() { scene.camerasInto(mappingDestinationCorrect, fieldDestination); scene.camerasInto(4, mappingDestination, fieldDestination); scene.camerasInto(0, mappingDestinationCorrect, fieldDestination); - CORRADE_COMPARE(out.str(), + CORRADE_COMPARE(out, "Trade::SceneData::camerasInto(): expected mapping destination view either empty or with 3 elements but got 2\n" "Trade::SceneData::camerasInto(): expected field destination view either empty or with 3 elements but got 2\n" "Trade::SceneData::camerasInto(): offset 4 out of range for a field of size 3\n" @@ -6378,7 +6376,7 @@ void SceneDataTest::skinsIntoArrayInvalidSizeOrOffset() { SceneFieldData{SceneField::Skin, view.slice(&Field::object), view.slice(&Field::skin)} }}; - std::ostringstream out; + Containers::String out; Error redirectError{&out}; UnsignedInt mappingDestinationCorrect[3]; UnsignedInt mappingDestination[2]; @@ -6388,7 +6386,7 @@ void SceneDataTest::skinsIntoArrayInvalidSizeOrOffset() { scene.skinsInto(mappingDestinationCorrect, fieldDestination); scene.skinsInto(4, mappingDestination, fieldDestination); scene.skinsInto(0, mappingDestinationCorrect, fieldDestination); - CORRADE_COMPARE(out.str(), + CORRADE_COMPARE(out, "Trade::SceneData::skinsInto(): expected mapping destination view either empty or with 3 elements but got 2\n" "Trade::SceneData::skinsInto(): expected field destination view either empty or with 3 elements but got 2\n" "Trade::SceneData::skinsInto(): offset 4 out of range for a field of size 3\n" @@ -6501,7 +6499,7 @@ void SceneDataTest::importerStateIntoArrayInvalidSizeOrOffset() { SceneFieldData{SceneField::ImporterState, view.slice(&Field::object), view.slice(&Field::importerState)} }}; - std::ostringstream out; + Containers::String out; Error redirectError{&out}; UnsignedInt mappingDestinationCorrect[3]; UnsignedInt mappingDestination[2]; @@ -6511,7 +6509,7 @@ void SceneDataTest::importerStateIntoArrayInvalidSizeOrOffset() { scene.importerStateInto(mappingDestinationCorrect, fieldDestination); scene.importerStateInto(4, mappingDestination, fieldDestination); scene.importerStateInto(0, mappingDestinationCorrect, fieldDestination); - CORRADE_COMPARE(out.str(), + CORRADE_COMPARE(out, "Trade::SceneData::importerStateInto(): expected mapping destination view either empty or with 3 elements but got 2\n" "Trade::SceneData::importerStateInto(): expected field destination view either empty or with 3 elements but got 2\n" "Trade::SceneData::importerStateInto(): offset 4 out of range for a field of size 3\n" @@ -6538,7 +6536,7 @@ void SceneDataTest::mutableAccessNotAllowed() { view.slice(&Field::mesh)}, }}; - std::ostringstream out; + Containers::String out; Error redirectError{&out}; scene.mutableData(); scene.mutableMapping(0); @@ -6551,7 +6549,7 @@ void SceneDataTest::mutableAccessNotAllowed() { scene.mutableField(SceneField::Mesh); scene.mutableField(SceneField::Mesh); scene.mutableField(sceneFieldCustom(35)); - CORRADE_COMPARE(out.str(), + CORRADE_COMPARE(out, "Trade::SceneData::mutableData(): data not mutable\n" "Trade::SceneData::mutableMapping(): data not mutable\n" "Trade::SceneData::mutableMapping(): data not mutable\n" @@ -6581,7 +6579,7 @@ void SceneDataTest::mappingNotFound() { SceneFieldData{SceneField::Mesh, view.slice(&Field::object), view.slice(&Field::mesh)}, }}; - std::ostringstream out; + Containers::String out; Error redirectError{&out}; scene.mapping(2); scene.mapping(2); @@ -6594,7 +6592,7 @@ void SceneDataTest::mappingNotFound() { scene.mappingAsArray(2); scene.mappingAsArray(sceneFieldCustom(666)); - CORRADE_COMPARE(out.str(), + CORRADE_COMPARE(out, "Trade::SceneData::mapping(): index 2 out of range for 2 fields\n" "Trade::SceneData::mapping(): index 2 out of range for 2 fields\n" "Trade::SceneData::mutableMapping(): index 2 out of range for 2 fields\n" @@ -6624,13 +6622,13 @@ void SceneDataTest::mappingWrongType() { SceneFieldData{SceneField::Mesh, view.slice(&Field::object), view.slice(&Field::mesh)}, }}; - std::ostringstream out; + Containers::String out; Error redirectError{&out}; scene.mapping(1); scene.mutableMapping(1); scene.mapping(SceneField::Mesh); scene.mutableMapping(SceneField::Mesh); - CORRADE_COMPARE(out.str(), + CORRADE_COMPARE(out, "Trade::SceneData::mapping(): mapping is Trade::SceneMappingType::UnsignedShort but requested Trade::SceneMappingType::UnsignedByte\n" "Trade::SceneData::mutableMapping(): mapping is Trade::SceneMappingType::UnsignedShort but requested Trade::SceneMappingType::UnsignedByte\n" "Trade::SceneData::mapping(): mapping is Trade::SceneMappingType::UnsignedShort but requested Trade::SceneMappingType::UnsignedByte\n" @@ -6652,7 +6650,7 @@ void SceneDataTest::fieldNotFound() { SceneFieldData{sceneFieldCustom(35), view.slice(&Field::object), view.slice(&Field::bar)}, }}; - std::ostringstream out; + Containers::String out; Error redirectError{&out}; scene.findFieldObjectOffset(2, 0); scene.fieldObjectOffset(2, 0); @@ -6732,7 +6730,7 @@ void SceneDataTest::fieldNotFound() { scene.importerStateAsArray(); scene.importerStateInto(nullptr, nullptr); scene.importerStateInto(0, nullptr, nullptr); - CORRADE_COMPARE_AS(out.str(), + CORRADE_COMPARE_AS(out, "Trade::SceneData::findFieldObjectOffset(): index 2 out of range for 2 fields\n" "Trade::SceneData::fieldObjectOffset(): index 2 out of range for 2 fields\n" "Trade::SceneData::hasFieldObject(): index 2 out of range for 2 fields\n" @@ -6835,7 +6833,7 @@ void SceneDataTest::fieldWrongType() { SceneFieldData{sceneFieldCustom(773), view.slice(&Field::object), view.slice(&Field::yes).sliceBit(0)}, }}; - std::ostringstream out; + Containers::String out; Error redirectError{&out}; scene.field(2); scene.mutableField(2); @@ -6875,7 +6873,7 @@ void SceneDataTest::fieldWrongType() { scene.fieldStringData(SceneField::Mesh); scene.fieldStrings(SceneField::Mesh); - CORRADE_COMPARE(out.str(), + CORRADE_COMPARE(out, "Trade::SceneData::field(): Trade::SceneField::Custom(773) is Trade::SceneFieldType::Bit, use fieldBits() or fieldBitArrays() to access it\n" "Trade::SceneData::mutableField(): Trade::SceneField::Custom(773) is Trade::SceneFieldType::Bit, use mutableFieldBits() or mutableFieldBitArrays() to access it\n" @@ -6934,7 +6932,7 @@ void SceneDataTest::fieldWrongPointerType() { scene.mutableField(sceneFieldCustom(35)); scene.mutableField(SceneField::ImporterState); - std::ostringstream out; + Containers::String out; Error redirectError{&out}; scene.field(0); scene.field(0); @@ -6956,7 +6954,7 @@ void SceneDataTest::fieldWrongPointerType() { scene.mutableField(sceneFieldCustom(35)); scene.mutableField(SceneField::ImporterState); scene.mutableField(SceneField::ImporterState); - CORRADE_COMPARE(out.str(), + CORRADE_COMPARE(out, "Trade::SceneData::field(): Trade::SceneField::Custom(35) is Trade::SceneFieldType::MutablePointer but requested a type equivalent to Trade::SceneFieldType::Int\n" "Trade::SceneData::field(): Trade::SceneField::Custom(35) is Trade::SceneFieldType::MutablePointer but requested a type equivalent to Trade::SceneFieldType::Pointer\n" "Trade::SceneData::field(): Trade::SceneField::Custom(35) is Trade::SceneFieldType::MutablePointer but requested a type equivalent to Trade::SceneFieldType::Pointer\n" @@ -6998,7 +6996,7 @@ void SceneDataTest::fieldWrongArrayAccess() { /* Array access is allowed for non-array fields (the second dimension is then always 1), tested directly in construct() and constructBit() */ - std::ostringstream out; + Containers::String out; Error redirectError{&out}; scene.field(0); scene.mutableField(0); @@ -7008,7 +7006,7 @@ void SceneDataTest::fieldWrongArrayAccess() { scene.mutableFieldBits(1); scene.fieldBits(sceneFieldCustom(773)); scene.mutableFieldBits(sceneFieldCustom(773)); - CORRADE_COMPARE(out.str(), + CORRADE_COMPARE(out, "Trade::SceneData::field(): Trade::SceneField::Custom(35) is an array field, use T[] to access it\n" "Trade::SceneData::mutableField(): Trade::SceneField::Custom(35) is an array field, use T[] to access it\n" "Trade::SceneData::field(): Trade::SceneField::Custom(35) is an array field, use T[] to access it\n" @@ -7226,11 +7224,11 @@ void SceneDataTest::transformation2DForBut3DType() { SceneFieldData{SceneField::Translation, SceneMappingType::UnsignedInt, nullptr, SceneFieldType::Vector3, nullptr} }}; - std::ostringstream out; + Containers::String out; Error redirectError{&out}; scene.transformation2DFor(0); scene.translationRotationScaling2DFor(0); - CORRADE_COMPARE(out.str(), + CORRADE_COMPARE(out, "Trade::SceneData::transformation2DFor(): scene has a 3D transformation type\n" "Trade::SceneData::translationRotationScaling2DFor(): scene has a 3D transformation type\n"); } @@ -7316,11 +7314,11 @@ void SceneDataTest::transformation3DForBut2DType() { SceneFieldData{SceneField::Translation, SceneMappingType::UnsignedInt, nullptr, SceneFieldType::Vector2, nullptr} }}; - std::ostringstream out; + Containers::String out; Error redirectError{&out}; scene.transformation3DFor(0); scene.translationRotationScaling3DFor(0); - CORRADE_COMPARE(out.str(), + CORRADE_COMPARE(out, "Trade::SceneData::transformation3DFor(): scene has a 2D transformation type\n" "Trade::SceneData::translationRotationScaling3DFor(): scene has a 2D transformation type\n"); } @@ -7543,18 +7541,18 @@ void SceneDataTest::childrenDeprecated() { TestSuite::Compare::Container); CORRADE_IGNORE_DEPRECATED_POP } else { - std::ostringstream out; + Containers::String out; Warning redirectWarning{&out}; CORRADE_IGNORE_DEPRECATED_PUSH CORRADE_VERIFY(scene.children2D().empty()); CORRADE_VERIFY(scene.children3D().empty()); CORRADE_IGNORE_DEPRECATED_POP if(data.is2D) - CORRADE_COMPARE(out.str(), "Trade::SceneData::children2D(): no parent field present, returned array will be empty\n"); + CORRADE_COMPARE(out, "Trade::SceneData::children2D(): no parent field present, returned array will be empty\n"); else if(data.is3D) - CORRADE_COMPARE(out.str(), "Trade::SceneData::children3D(): no parent field present, returned array will be empty\n"); + CORRADE_COMPARE(out, "Trade::SceneData::children3D(): no parent field present, returned array will be empty\n"); else - CORRADE_COMPARE(out.str(), ""); + CORRADE_COMPARE(out, ""); } } #endif @@ -7591,7 +7589,7 @@ void SceneDataTest::findFieldObjectOffsetInvalidObject() { SceneFieldData{SceneField::Parent, SceneMappingType::UnsignedInt, nullptr, SceneFieldType::Int, nullptr}, }}; - std::ostringstream out; + Containers::String out; Error redirectError{&out}; scene.findFieldObjectOffset(0, 7); scene.findFieldObjectOffset(SceneField::Parent, 7); @@ -7610,7 +7608,7 @@ void SceneDataTest::findFieldObjectOffsetInvalidObject() { scene.lightsFor(7); scene.camerasFor(7); scene.skinsFor(7); - CORRADE_COMPARE(out.str(), + CORRADE_COMPARE(out, "Trade::SceneData::findFieldObjectOffset(): object 7 out of range for 7 objects\n" "Trade::SceneData::findFieldObjectOffset(): object 7 out of range for 7 objects\n" "Trade::SceneData::fieldObjectOffset(): object 7 out of range for 7 objects\n" diff --git a/src/Magnum/Trade/Test/SkinDataTest.cpp b/src/Magnum/Trade/Test/SkinDataTest.cpp index 8df22eef2..3b9ebd826 100644 --- a/src/Magnum/Trade/Test/SkinDataTest.cpp +++ b/src/Magnum/Trade/Test/SkinDataTest.cpp @@ -24,9 +24,8 @@ DEALINGS IN THE SOFTWARE. */ -#include +#include #include -#include #include "Magnum/Math/Matrix3.h" #include "Magnum/Math/Matrix4.h" @@ -89,10 +88,10 @@ void SkinDataTest::constructNonOwned() { void SkinDataTest::constructDifferentSize() { CORRADE_SKIP_IF_NO_ASSERT(); - std::ostringstream out; + Containers::String out; Error redirectError{&out}; SkinData3D data{{0, 2}, {{}, {}, {}}}; - CORRADE_COMPARE(out.str(), "Trade::SkinData: joint and inverse bind matrix arrays have different size, got 2 and 3\n"); + CORRADE_COMPARE(out, "Trade::SkinData: joint and inverse bind matrix arrays have different size, got 2 and 3\n"); } void SkinDataTest::constructCopy() { diff --git a/src/Magnum/Trade/Test/TextureDataTest.cpp b/src/Magnum/Trade/Test/TextureDataTest.cpp index 4c6ea8954..1ca3f5bed 100644 --- a/src/Magnum/Trade/Test/TextureDataTest.cpp +++ b/src/Magnum/Trade/Test/TextureDataTest.cpp @@ -24,9 +24,8 @@ DEALINGS IN THE SOFTWARE. */ -#include +#include #include -#include #include "Magnum/Trade/TextureData.h" @@ -119,17 +118,17 @@ void TextureDataTest::constructMove() { } void TextureDataTest::debugType() { - std::ostringstream out; + Containers::String out; Debug(&out) << TextureType::Texture3D << TextureType(0xbe); - CORRADE_COMPARE(out.str(), "Trade::TextureType::Texture3D Trade::TextureType(0xbe)\n"); + CORRADE_COMPARE(out, "Trade::TextureType::Texture3D Trade::TextureType(0xbe)\n"); } void TextureDataTest::debugTypePacked() { - std::ostringstream out; + Containers::String out; /* Last is not packed, ones before should not make any flags persistent */ Debug(&out) << Debug::packed << TextureType::Texture3D << Debug::packed << TextureType(0xbe) << TextureType::Texture2D; - CORRADE_COMPARE(out.str(), "Texture3D 0xbe Trade::TextureType::Texture2D\n"); + CORRADE_COMPARE(out, "Texture3D 0xbe Trade::TextureType::Texture2D\n"); } }}}} diff --git a/src/Magnum/Vk/Test/AssertDisabledTest.cpp b/src/Magnum/Vk/Test/AssertDisabledTest.cpp index dfcaa2afc..045d37665 100644 --- a/src/Magnum/Vk/Test/AssertDisabledTest.cpp +++ b/src/Magnum/Vk/Test/AssertDisabledTest.cpp @@ -24,14 +24,12 @@ DEALINGS IN THE SOFTWARE. */ -#include - #if !defined(CORRADE_STANDARD_ASSERT) && !defined(CORRADE_NO_ASSERT) #define CORRADE_NO_ASSERT #endif +#include #include -#include #include "Magnum/Vk/Assert.h" #include "Magnum/Vk/Result.h" @@ -59,7 +57,7 @@ AssertDisabledTest::AssertDisabledTest() { } void AssertDisabledTest::success() { - std::ostringstream out; + Containers::String out; Error redirectError{&out}; Result a = Result::ErrorUnknown; @@ -67,11 +65,11 @@ void AssertDisabledTest::success() { MAGNUM_VK_INTERNAL_ASSERT_SUCCESS(a = r); CORRADE_COMPARE(a, Result::ErrorFragmentedPool); - CORRADE_COMPARE(out.str(), ""); + CORRADE_COMPARE(out, ""); } void AssertDisabledTest::successOr() { - std::ostringstream out; + Containers::String out; Error redirectError{&out}; Result a = Result::ErrorUnknown; @@ -80,7 +78,7 @@ void AssertDisabledTest::successOr() { CORRADE_COMPARE(a, Result::ErrorExtensionNotPresent); CORRADE_COMPARE(a2, a); - CORRADE_COMPARE(out.str(), ""); + CORRADE_COMPARE(out, ""); /* Test also that a standalone macro won't cause warnings about unused expression results */ @@ -88,7 +86,7 @@ void AssertDisabledTest::successOr() { } void AssertDisabledTest::vkSuccess() { - std::ostringstream out; + Containers::String out; Error redirectError{&out}; VkResult a = VK_ERROR_UNKNOWN; @@ -96,11 +94,11 @@ void AssertDisabledTest::vkSuccess() { MAGNUM_VK_INTERNAL_ASSERT_SUCCESS(a = r); CORRADE_COMPARE(Result(a), Result::ErrorFragmentedPool); - CORRADE_COMPARE(out.str(), ""); + CORRADE_COMPARE(out, ""); } void AssertDisabledTest::vkSuccessOr() { - std::ostringstream out; + Containers::String out; Error redirectError{&out}; VkResult b = VK_ERROR_UNKNOWN; @@ -109,7 +107,7 @@ void AssertDisabledTest::vkSuccessOr() { CORRADE_COMPARE(Result(b), Result::ErrorExtensionNotPresent); CORRADE_COMPARE(b2, Result(b)); - CORRADE_COMPARE(out.str(), ""); + CORRADE_COMPARE(out, ""); /* Test also that a standalone macro won't cause warnings about unused expression results */ diff --git a/src/Magnum/Vk/Test/BufferTest.cpp b/src/Magnum/Vk/Test/BufferTest.cpp index 8ac6c55d3..8fbf54e05 100644 --- a/src/Magnum/Vk/Test/BufferTest.cpp +++ b/src/Magnum/Vk/Test/BufferTest.cpp @@ -25,10 +25,9 @@ */ #include -#include +#include #include #include -#include #include "Magnum/Vk/BufferCreateInfo.h" @@ -156,10 +155,10 @@ void BufferTest::dedicatedMemoryNotDedicated() { Buffer buffer{NoCreate}; CORRADE_VERIFY(!buffer.hasDedicatedMemory()); - std::ostringstream out; + Containers::String out; Error redirectError{&out}; buffer.dedicatedMemory(); - CORRADE_COMPARE(out.str(), "Vk::Buffer::dedicatedMemory(): buffer doesn't have a dedicated memory\n"); + CORRADE_COMPARE(out, "Vk::Buffer::dedicatedMemory(): buffer doesn't have a dedicated memory\n"); } void BufferTest::bufferCopyConstruct() { @@ -211,10 +210,10 @@ void BufferTest::bufferCopyConvertDisallowed() { BufferCopy copy{0, 0, 0}; copy->pNext = © - std::ostringstream out; + Containers::String out; Error redirectError{&out}; copy.vkBufferCopy(); - CORRADE_COMPARE(out.str(), "Vk::BufferCopy: disallowing conversion to VkBufferCopy with non-empty pNext to prevent information loss\n"); + CORRADE_COMPARE(out, "Vk::BufferCopy: disallowing conversion to VkBufferCopy with non-empty pNext to prevent information loss\n"); } void BufferTest::copyBufferInfoConstruct() { diff --git a/src/Magnum/Vk/Test/BufferVkTest.cpp b/src/Magnum/Vk/Test/BufferVkTest.cpp index 3e247b78b..d0a3c8b1b 100644 --- a/src/Magnum/Vk/Test/BufferVkTest.cpp +++ b/src/Magnum/Vk/Test/BufferVkTest.cpp @@ -24,12 +24,10 @@ DEALINGS IN THE SOFTWARE. */ -#include #include -#include +#include #include #include -#include #include "Magnum/Vk/BufferCreateInfo.h" #include "Magnum/Vk/CommandBuffer.h" @@ -264,10 +262,10 @@ void BufferVkTest::cmdCopyBufferDisallowedConversion() { /* The commands shouldn't do anything, so it should be fine to just call them without any render pass set up */ - std::ostringstream out; + Containers::String out; Error redirectError{&out}; cmd.copyBuffer(a); - CORRADE_COMPARE(out.str(), + CORRADE_COMPARE(out, "Vk::CommandBuffer::copyBuffer(): disallowing extraction of CopyBufferInfo with non-empty pNext to prevent information loss\n"); } diff --git a/src/Magnum/Vk/Test/DescriptorPoolTest.cpp b/src/Magnum/Vk/Test/DescriptorPoolTest.cpp index b61f3db1f..d8916d1a6 100644 --- a/src/Magnum/Vk/Test/DescriptorPoolTest.cpp +++ b/src/Magnum/Vk/Test/DescriptorPoolTest.cpp @@ -25,9 +25,8 @@ */ #include -#include +#include #include -#include #include "Magnum/Vk/DescriptorPoolCreateInfo.h" #include "Magnum/Vk/DescriptorType.h" @@ -82,31 +81,31 @@ void DescriptorPoolTest::createInfoConstruct() { void DescriptorPoolTest::createInfoConstructNoSets() { CORRADE_SKIP_IF_NO_ASSERT(); - std::ostringstream out; + Containers::String out; Error redirectError{&out}; DescriptorPoolCreateInfo{0, {}}; - CORRADE_COMPARE(out.str(), "Vk::DescriptorPoolCreateInfo: there has to be at least one set\n"); + CORRADE_COMPARE(out, "Vk::DescriptorPoolCreateInfo: there has to be at least one set\n"); } void DescriptorPoolTest::createInfoConstructNoPools() { CORRADE_SKIP_IF_NO_ASSERT(); - std::ostringstream out; + Containers::String out; Error redirectError{&out}; DescriptorPoolCreateInfo{5, {}}; - CORRADE_COMPARE(out.str(), "Vk::DescriptorPoolCreateInfo: there has to be at least one pool\n"); + CORRADE_COMPARE(out, "Vk::DescriptorPoolCreateInfo: there has to be at least one pool\n"); } void DescriptorPoolTest::createInfoConstructEmptyPool() { CORRADE_SKIP_IF_NO_ASSERT(); - std::ostringstream out; + Containers::String out; Error redirectError{&out}; DescriptorPoolCreateInfo{5, { {DescriptorType::InputAttachment, 2}, {DescriptorType::UniformBuffer, 0}, }}; - CORRADE_COMPARE(out.str(), "Vk::DescriptorPoolCreateInfo: pool 1 of Vk::DescriptorType::UniformBuffer has no descriptors\n"); + CORRADE_COMPARE(out, "Vk::DescriptorPoolCreateInfo: pool 1 of Vk::DescriptorType::UniformBuffer has no descriptors\n"); } void DescriptorPoolTest::createInfoConstructNoInit() { diff --git a/src/Magnum/Vk/Test/DescriptorPoolVkTest.cpp b/src/Magnum/Vk/Test/DescriptorPoolVkTest.cpp index 75d17ae9c..5ef3d811e 100644 --- a/src/Magnum/Vk/Test/DescriptorPoolVkTest.cpp +++ b/src/Magnum/Vk/Test/DescriptorPoolVkTest.cpp @@ -24,9 +24,8 @@ DEALINGS IN THE SOFTWARE. */ -#include #include -#include +#include #include "Magnum/Vk/DescriptorPoolCreateInfo.h" #include "Magnum/Vk/DescriptorSet.h" @@ -185,7 +184,7 @@ void DescriptorPoolVkTest::allocateFail() { { /* tryAllocate() should not assert, and should not print anything */ - std::ostringstream out; + Containers::String out; Error redirectError{&out}; { CORRADE_EXPECT_FAIL_IF(device().properties().name().contains("llvmpipe"), @@ -194,19 +193,19 @@ void DescriptorPoolVkTest::allocateFail() { "NVidia never fails an allocation."); CORRADE_VERIFY(!pool.tryAllocate(layout)); } - CORRADE_COMPARE(out.str(), ""); + CORRADE_COMPARE(out, ""); } { CORRADE_SKIP_IF_NO_ASSERT(); /* allocate() should assert with ErrorOutOfPoolMemory */ - std::ostringstream out; + Containers::String out; Error redirectError{&out}; pool.allocate(layout); CORRADE_EXPECT_FAIL_IF(device().properties().name().contains("llvmpipe"), "Mesa llvmpipe never fails an allocation."); CORRADE_EXPECT_FAIL_IF(device().properties().name().contains("NVIDIA"), "NVidia never fails an allocation."); - CORRADE_COMPARE(out.str(), "Vk::DescriptorPool::allocate(): allocation failed with Vk::Result::ErrorOutOfPoolMemory\n"); + CORRADE_COMPARE(out, "Vk::DescriptorPool::allocate(): allocation failed with Vk::Result::ErrorOutOfPoolMemory\n"); } } @@ -287,7 +286,7 @@ void DescriptorPoolVkTest::allocateVariableCountFail() { { /* tryAllocate() should not assert, and should not print anything */ - std::ostringstream out; + Containers::String out; Error redirectError{&out}; { CORRADE_EXPECT_FAIL_IF(device().properties().name().contains("llvmpipe"), @@ -296,12 +295,12 @@ void DescriptorPoolVkTest::allocateVariableCountFail() { "NVidia never fails an allocation."); CORRADE_VERIFY(!pool.tryAllocate(layout, 80)); } - CORRADE_COMPARE(out.str(), ""); + CORRADE_COMPARE(out, ""); } { CORRADE_SKIP_IF_NO_ASSERT(); /* allocate() should assert with ErrorOutOfPoolMemory */ - std::ostringstream out; + Containers::String out; Error redirectError{&out}; pool.allocate(layout, 80); { @@ -309,7 +308,7 @@ void DescriptorPoolVkTest::allocateVariableCountFail() { "Mesa llvmpipe never fails an allocation."); CORRADE_EXPECT_FAIL_IF(device().properties().name().contains("NVIDIA"), "NVidia never fails an allocation."); - CORRADE_COMPARE(out.str(), "Vk::DescriptorPool::allocate(): allocation failed with Vk::Result::ErrorOutOfPoolMemory\n"); + CORRADE_COMPARE(out, "Vk::DescriptorPool::allocate(): allocation failed with Vk::Result::ErrorOutOfPoolMemory\n"); } } } diff --git a/src/Magnum/Vk/Test/DescriptorTypeTest.cpp b/src/Magnum/Vk/Test/DescriptorTypeTest.cpp index 65ff97781..aa20e6631 100644 --- a/src/Magnum/Vk/Test/DescriptorTypeTest.cpp +++ b/src/Magnum/Vk/Test/DescriptorTypeTest.cpp @@ -24,9 +24,8 @@ DEALINGS IN THE SOFTWARE. */ -#include +#include #include -#include #include "Magnum/Vk/DescriptorType.h" @@ -43,9 +42,9 @@ DescriptorTypeTest::DescriptorTypeTest() { } void DescriptorTypeTest::debug() { - std::ostringstream out; + Containers::String out; Debug{&out} << DescriptorType::InputAttachment << DescriptorType(-10007655); - CORRADE_COMPARE(out.str(), "Vk::DescriptorType::InputAttachment Vk::DescriptorType(-10007655)\n"); + CORRADE_COMPARE(out, "Vk::DescriptorType::InputAttachment Vk::DescriptorType(-10007655)\n"); } }}}} diff --git a/src/Magnum/Vk/Test/DeviceFeaturesTest.cpp b/src/Magnum/Vk/Test/DeviceFeaturesTest.cpp index 54ad50590..0c4a2d60e 100644 --- a/src/Magnum/Vk/Test/DeviceFeaturesTest.cpp +++ b/src/Magnum/Vk/Test/DeviceFeaturesTest.cpp @@ -24,9 +24,8 @@ DEALINGS IN THE SOFTWARE. */ -#include +#include #include -#include #include "Magnum/Vk/DeviceFeatures.h" @@ -66,9 +65,9 @@ void DeviceFeaturesTest::mapping() { switch(feature) { #define _c(value, field) \ case DeviceFeature::value: { \ - std::ostringstream out; \ + Containers::String out; \ Debug{&out, Debug::Flag::NoNewlineAtTheEnd} << DeviceFeature::value; \ - CORRADE_COMPARE(out.str(), "Vk::DeviceFeature::" #value); \ + CORRADE_COMPARE(out, "Vk::DeviceFeature::" #value); \ CORRADE_COMPARE(nextHandled, i); \ CORRADE_COMPARE(firstUnhandled, 0xff); \ ++nextHandled; \ @@ -95,15 +94,15 @@ void DeviceFeaturesTest::mapping() { } void DeviceFeaturesTest::debugFeature() { - std::ostringstream out; + Containers::String out; Debug{&out} << DeviceFeature::FullDrawIndexUnsignedInt << DeviceFeature::VulkanMemoryModel << DeviceFeature(0xab); - CORRADE_COMPARE(out.str(), "Vk::DeviceFeature::FullDrawIndexUnsignedInt Vk::DeviceFeature::VulkanMemoryModel Vk::DeviceFeature(0xab)\n"); + CORRADE_COMPARE(out, "Vk::DeviceFeature::FullDrawIndexUnsignedInt Vk::DeviceFeature::VulkanMemoryModel Vk::DeviceFeature(0xab)\n"); } void DeviceFeaturesTest::debugFeatures() { - std::ostringstream out; + Containers::String out; Debug{&out} << (DeviceFeature::FullDrawIndexUnsignedInt|DeviceFeature::VulkanMemoryModel|DeviceFeature(0xab)|DeviceFeature(0xcc)) << DeviceFeatures{}; - CORRADE_COMPARE(out.str(), "Vk::DeviceFeature::FullDrawIndexUnsignedInt|Vk::DeviceFeature::VulkanMemoryModel|Vk::DeviceFeature(0xab)|Vk::DeviceFeature(0xcc) Vk::DeviceFeatures{}\n"); + CORRADE_COMPARE(out, "Vk::DeviceFeature::FullDrawIndexUnsignedInt|Vk::DeviceFeature::VulkanMemoryModel|Vk::DeviceFeature(0xab)|Vk::DeviceFeature(0xcc) Vk::DeviceFeatures{}\n"); } }}}} diff --git a/src/Magnum/Vk/Test/DevicePropertiesTest.cpp b/src/Magnum/Vk/Test/DevicePropertiesTest.cpp index f08d52db1..ac227a396 100644 --- a/src/Magnum/Vk/Test/DevicePropertiesTest.cpp +++ b/src/Magnum/Vk/Test/DevicePropertiesTest.cpp @@ -24,9 +24,8 @@ DEALINGS IN THE SOFTWARE. */ -#include +#include #include -#include #include "Magnum/Vk/DeviceProperties.h" @@ -74,39 +73,39 @@ void DevicePropertiesTest::constructCopy() { } void DevicePropertiesTest::debugDeviceType() { - std::ostringstream out; + Containers::String out; Debug{&out} << DeviceType::DiscreteGpu << DeviceType(-10007655); - CORRADE_COMPARE(out.str(), "Vk::DeviceType::DiscreteGpu Vk::DeviceType(-10007655)\n"); + CORRADE_COMPARE(out, "Vk::DeviceType::DiscreteGpu Vk::DeviceType(-10007655)\n"); } void DevicePropertiesTest::debugDeviceDriver() { - std::ostringstream out; + Containers::String out; Debug{&out} << DeviceDriver::MesaLlvmpipe << DeviceDriver(-10007655); - CORRADE_COMPARE(out.str(), "Vk::DeviceDriver::MesaLlvmpipe Vk::DeviceDriver(-10007655)\n"); + CORRADE_COMPARE(out, "Vk::DeviceDriver::MesaLlvmpipe Vk::DeviceDriver(-10007655)\n"); } void DevicePropertiesTest::debugQueueFamilyPropertiesFlag() { - std::ostringstream out; + Containers::String out; Debug{&out} << QueueFlag::SparseBinding << QueueFlag(0xdeadcafe); - CORRADE_COMPARE(out.str(), "Vk::QueueFlag::SparseBinding Vk::QueueFlag(0xdeadcafe)\n"); + CORRADE_COMPARE(out, "Vk::QueueFlag::SparseBinding Vk::QueueFlag(0xdeadcafe)\n"); } void DevicePropertiesTest::debugQueueFamilyPropertiesFlags() { - std::ostringstream out; + Containers::String out; Debug{&out} << (QueueFlag::Compute|QueueFlag::Graphics) << QueueFlags{}; - CORRADE_COMPARE(out.str(), "Vk::QueueFlag::Graphics|Vk::QueueFlag::Compute Vk::QueueFlags{}\n"); + CORRADE_COMPARE(out, "Vk::QueueFlag::Graphics|Vk::QueueFlag::Compute Vk::QueueFlags{}\n"); } void DevicePropertiesTest::debugMemoryHeapFlag() { - std::ostringstream out; + Containers::String out; Debug{&out} << MemoryHeapFlag::DeviceLocal << MemoryHeapFlag(0xdeadcafe); - CORRADE_COMPARE(out.str(), "Vk::MemoryHeapFlag::DeviceLocal Vk::MemoryHeapFlag(0xdeadcafe)\n"); + CORRADE_COMPARE(out, "Vk::MemoryHeapFlag::DeviceLocal Vk::MemoryHeapFlag(0xdeadcafe)\n"); } void DevicePropertiesTest::debugMemoryHeapFlags() { - std::ostringstream out; + Containers::String out; Debug{&out} << (MemoryHeapFlag::DeviceLocal|MemoryHeapFlag(0xf0)) << MemoryHeapFlags{}; - CORRADE_COMPARE(out.str(), "Vk::MemoryHeapFlag::DeviceLocal|Vk::MemoryHeapFlag(0xf0) Vk::MemoryHeapFlags{}\n"); + CORRADE_COMPARE(out, "Vk::MemoryHeapFlag::DeviceLocal|Vk::MemoryHeapFlag(0xf0) Vk::MemoryHeapFlags{}\n"); } }}}} diff --git a/src/Magnum/Vk/Test/DevicePropertiesVkTest.cpp b/src/Magnum/Vk/Test/DevicePropertiesVkTest.cpp index 788c22deb..1016a7436 100644 --- a/src/Magnum/Vk/Test/DevicePropertiesVkTest.cpp +++ b/src/Magnum/Vk/Test/DevicePropertiesVkTest.cpp @@ -24,14 +24,12 @@ DEALINGS IN THE SOFTWARE. */ -#include #include #include +#include #include -#include #include -#include -#include +#include #include "Magnum/Math/Functions.h" #include "Magnum/Vk/DeviceFeatures.h" @@ -361,10 +359,10 @@ void DevicePropertiesVkTest::enumerateExtensionsWithKhronosValidationLayer() { void DevicePropertiesVkTest::enumerateExtensionsNonexistentLayer() { CORRADE_SKIP("Currently this hits an internal assert, which can't be tested."); - std::ostringstream out; + Containers::String out; Error redirectError{&out}; enumerateInstanceExtensionProperties({"VK_LAYER_this_doesnt_exist"}); - CORRADE_COMPARE(out.str(), "TODO"); + CORRADE_COMPARE(out, "TODO"); } void DevicePropertiesVkTest::extensionConstructMove() { @@ -467,11 +465,11 @@ void DevicePropertiesVkTest::queueFamiliesOutOfRange() { const UnsignedInt count = devices[0].queueFamilyCount(); - std::ostringstream out; + Containers::String out; Error redirectError{&out}; devices[0].queueFamilySize(count); devices[0].queueFamilyFlags(count); - CORRADE_COMPARE(out.str(), Utility::formatString( + CORRADE_COMPARE(out, Utility::format( "Vk::DeviceProperties::queueFamilySize(): index {0} out of range for {0} entries\n" "Vk::DeviceProperties::queueFamilyFlags(): index {0} out of range for {0} entries\n", count)); } @@ -495,10 +493,10 @@ void DevicePropertiesVkTest::queueFamiliesPickFailed() { Containers::Array devices = enumerateDevices(instance()); CORRADE_VERIFY(!devices.isEmpty()); - std::ostringstream out; + Containers::String out; Error redirectError{&out}; CORRADE_VERIFY(!devices[0].tryPickQueueFamily(QueueFlag(0xc0ffeee0))); - CORRADE_COMPARE(out.str(), Utility::formatString( + CORRADE_COMPARE(out, Utility::format( "Vk::DeviceProperties::tryPickQueueFamily(): no Vk::QueueFlag(0xc0ffeee0) found among {} queue families\n", devices[0].queueFamilyCount())); } @@ -536,11 +534,11 @@ void DevicePropertiesVkTest::memoryHeapOutOfRange() { const UnsignedInt count = devices[0].memoryHeapCount(); - std::ostringstream out; + Containers::String out; Error redirectError{&out}; devices[0].memoryHeapSize(count); devices[0].memoryHeapFlags(count); - CORRADE_COMPARE(out.str(), Utility::formatString( + CORRADE_COMPARE(out, Utility::format( "Vk::DeviceProperties::memoryHeapSize(): index {0} out of range for {0} memory heaps\n" "Vk::DeviceProperties::memoryHeapFlags(): index {0} out of range for {0} memory heaps\n", count)); } @@ -578,11 +576,11 @@ void DevicePropertiesVkTest::memoryTypeOutOfRange() { const UnsignedInt count = devices[0].memoryCount(); - std::ostringstream out; + Containers::String out; Error redirectError{&out}; devices[0].memoryFlags(count); devices[0].memoryHeapIndex(count); - CORRADE_COMPARE(out.str(), Utility::formatString( + CORRADE_COMPARE(out, Utility::format( "Vk::DeviceProperties::memoryFlags(): index {0} out of range for {0} memory types\n" "Vk::DeviceProperties::memoryHeapIndex(): index {0} out of range for {0} memory types\n", count)); } @@ -632,12 +630,12 @@ void DevicePropertiesVkTest::memoryTypesPickFailed() { Containers::Array devices = enumerateDevices(instance()); CORRADE_VERIFY(!devices.isEmpty()); - std::ostringstream out; + Containers::String out; Error redirectError{&out}; CORRADE_VERIFY(!devices[0].tryPickMemory(MemoryFlag(0xc0ffeee0))); CORRADE_VERIFY(!devices[0].tryPickMemory({}, {}, 0)); CORRADE_VERIFY(!devices[0].tryPickMemory({}, 0)); - CORRADE_COMPARE(out.str(), Utility::formatString( + CORRADE_COMPARE(out, Utility::format( "Vk::DeviceProperties::tryPickMemory(): no Vk::MemoryFlag(0xc0ffeee0) found among {} considered memory types\n" "Vk::DeviceProperties::tryPickMemory(): no Vk::MemoryFlags{{}} found among 0 considered memory types\n" "Vk::DeviceProperties::tryPickMemory(): no Vk::MemoryFlags{{}} found among 0 considered memory types\n", devices[0].memoryCount())); @@ -684,10 +682,10 @@ void DevicePropertiesVkTest::pickDeviceError() { /* Creating a dedicated instance so we can pass custom args */ Instance instance2{InstanceCreateInfo{Int(data.args.size()), const_cast(data.args.data())}}; - std::ostringstream out; + Containers::String out; Error redirectError{&out}; CORRADE_VERIFY(!tryPickDevice(instance2)); - CORRADE_COMPARE(out.str(), Utility::formatString(data.message, enumerateDevices(instance2).size())); + CORRADE_COMPARE(out, Utility::format(data.message, enumerateDevices(instance2).size())); } }}}} diff --git a/src/Magnum/Vk/Test/DeviceVkTest.cpp b/src/Magnum/Vk/Test/DeviceVkTest.cpp index 8786acefa..add977727 100644 --- a/src/Magnum/Vk/Test/DeviceVkTest.cpp +++ b/src/Magnum/Vk/Test/DeviceVkTest.cpp @@ -24,15 +24,14 @@ DEALINGS IN THE SOFTWARE. */ -#include +#include /* std::getenv() */ #include #include +#include #include -#include /* StringHasPrefix */ #include #include -#include -#include +#include #include "Magnum/Vk/DeviceCreateInfo.h" #include "Magnum/Vk/DeviceFeatures.h" @@ -492,20 +491,20 @@ void DeviceVkTest::createInfoFeaturesEnableAllResetAll() { void DeviceVkTest::createInfoNoQueuePriorities() { CORRADE_SKIP_IF_NO_ASSERT(); - std::ostringstream out; + Containers::String out; Error redirectError{&out}; DeviceCreateInfo{pickDevice(instance())}.addQueues(0, {}, {}); - CORRADE_COMPARE(out.str(), "Vk::DeviceCreateInfo::addQueues(): at least one queue priority has to be specified\n"); + CORRADE_COMPARE(out, "Vk::DeviceCreateInfo::addQueues(): at least one queue priority has to be specified\n"); } void DeviceVkTest::createInfoWrongQueueOutputCount() { CORRADE_SKIP_IF_NO_ASSERT(); - std::ostringstream out; + Containers::String out; Error redirectError{&out}; Queue a{NoCreate}, b{NoCreate}; DeviceCreateInfo{pickDevice(instance())}.addQueues(0, {0.0f, 1.0f, 0.3f}, {a, b}); - CORRADE_COMPARE(out.str(), "Vk::DeviceCreateInfo::addQueues(): expected 3 outuput queue references but got 2\n"); + CORRADE_COMPARE(out, "Vk::DeviceCreateInfo::addQueues(): expected 3 outuput queue references but got 2\n"); } void DeviceVkTest::createInfoConstructCopy() { @@ -769,7 +768,7 @@ void DeviceVkTest::constructExtensionsCommandLineDisable() { if(!extensions.isSupported()) CORRADE_SKIP("VK_KHR_maintenance1 not supported, can't test"); - std::ostringstream out; + Containers::String out; Debug redirectOutput{&out}; Queue queue{NoCreate}; Device device{instance2, DeviceCreateInfo{deviceProperties, DeviceCreateInfo::Flag::NoImplicitExtensions} @@ -789,7 +788,7 @@ void DeviceVkTest::constructExtensionsCommandLineDisable() { UnsignedInt patch = versionPatch(deviceProperties.version()); /* The output might contain a device workaround list, cut that away. That's tested thoroughly in constructWorkaroundsCommandLineDisable(). */ - CORRADE_COMPARE_AS(out.str(), + CORRADE_COMPARE_AS(out, Utility::format(data.log, deviceProperties.name(), major, minor, /* SwiftShader reports just 1.1 with no patch version, special-case that */ @@ -831,7 +830,7 @@ void DeviceVkTest::constructExtensionsCommandLineEnable() { if(!extensions.isSupported()) CORRADE_SKIP("VK_KHR_maintenance1 not supported, can't test"); - std::ostringstream out; + Containers::String out; Debug redirectOutput{&out}; Queue queue{NoCreate}; Device device{instance2, DeviceCreateInfo{pickDevice(instance2), DeviceCreateInfo::Flag::NoImplicitExtensions} @@ -849,7 +848,7 @@ void DeviceVkTest::constructExtensionsCommandLineEnable() { UnsignedInt patch = versionPatch(deviceProperties.version()); /* The output might contain a device workaround list, cut that away. That's tested thoroughly in constructWorkaroundsCommandLineDisable(). */ - CORRADE_COMPARE_AS(out.str(), + CORRADE_COMPARE_AS(out, Utility::format(data.log, deviceProperties.name(), major, minor, /* SwiftShader reports just 1.1 with no patch version, special-case that */ @@ -877,7 +876,7 @@ void DeviceVkTest::constructWorkaroundsCommandLineDisable() { if(!deviceProperties.name().hasPrefix("SwiftShader"_s) && !data.shouldPassAlways) CORRADE_SKIP("Workarounds only available on SwiftShader, can't test."); - std::ostringstream out; + Containers::String out; Debug redirectOutput{&out}; Queue queue{NoCreate}; Device device{instance2, DeviceCreateInfo{deviceProperties, DeviceCreateInfo::Flag::NoImplicitExtensions} @@ -885,7 +884,7 @@ void DeviceVkTest::constructWorkaroundsCommandLineDisable() { }; CORRADE_VERIFY(device.handle()); - CORRADE_COMPARE(out.str(), Utility::formatString(data.log, deviceProperties.name(), deviceProperties.driverName(), deviceProperties.driverInfo())); + CORRADE_COMPARE(out, Utility::format(data.log, deviceProperties.name(), deviceProperties.driverName(), deviceProperties.driverInfo())); } void DeviceVkTest::constructMultipleQueues() { @@ -977,13 +976,13 @@ void DeviceVkTest::constructFeatureNotSupported() { if(properties.features() & DeviceFeature::SparseResidency16Samples) CORRADE_SKIP("The SparseResidency16Samples feature is supported, can't test"); - std::ostringstream out; + Containers::String out; Error redirectError{&out}; Queue queue{NoCreate}; Device device{instance(), DeviceCreateInfo{properties} .addQueues(0, {0.0f}, {queue}) .setEnabledFeatures(DeviceFeature::SparseBinding|DeviceFeature::SparseResidency16Samples)}; - CORRADE_COMPARE(out.str(), "Vk::Device::tryCreate(): some enabled features are not supported: Vk::DeviceFeature::SparseBinding|Vk::DeviceFeature::SparseResidency16Samples\n"); + CORRADE_COMPARE(out, "Vk::Device::tryCreate(): some enabled features are not supported: Vk::DeviceFeature::SparseBinding|Vk::DeviceFeature::SparseResidency16Samples\n"); } void DeviceVkTest::constructFeatureWithoutExtension() { @@ -998,19 +997,19 @@ void DeviceVkTest::constructFeatureWithoutExtension() { info.addQueues(0, {0.0f}, {queue}) .setEnabledFeatures(DeviceFeature::SamplerYcbcrConversion); - std::ostringstream out; + Containers::String out; Error redirectError{&out}; Device device{instance(), info}; - CORRADE_COMPARE(out.str(), "Vk::Device::tryCreate(): some enabled features need VK_KHR_sampler_ycbcr_conversion enabled\n"); + CORRADE_COMPARE(out, "Vk::Device::tryCreate(): some enabled features need VK_KHR_sampler_ycbcr_conversion enabled\n"); } void DeviceVkTest::constructNoQueue() { CORRADE_SKIP_IF_NO_ASSERT(); - std::ostringstream out; + Containers::String out; Error redirectError{&out}; Device device{instance(), DeviceCreateInfo{pickDevice(instance())}}; - CORRADE_COMPARE(out.str(), "Vk::Device::tryCreate(): needs at least one queue\n"); + CORRADE_COMPARE(out, "Vk::Device::tryCreate(): needs at least one queue\n"); } void DeviceVkTest::constructNoPortability() { @@ -1089,22 +1088,22 @@ void DeviceVkTest::tryCreateAlreadyCreated() { }; CORRADE_VERIFY(device.handle()); - std::ostringstream out; + Containers::String out; Error redirectError{&out}; device.tryCreate(instance(), DeviceCreateInfo{pickDevice(instance())}); - CORRADE_COMPARE(out.str(), "Vk::Device::tryCreate(): device already created\n"); + CORRADE_COMPARE(out, "Vk::Device::tryCreate(): device already created\n"); } void DeviceVkTest::tryCreateUnknownExtension() { Queue queue{NoCreate}; Device device{NoCreate}; - std::ostringstream out; + Containers::String out; Error redirectError{&out}; CORRADE_COMPARE(device.tryCreate(instance(), DeviceCreateInfo{pickDevice(instance())} .addQueues(0, {0.0f}, {queue}) .addEnabledExtensions({"VK_this_doesnt_exist"_s})), Result::ErrorExtensionNotPresent); - CORRADE_COMPARE(out.str(), "Vk::Device::tryCreate(): device creation failed: Vk::Result::ErrorExtensionNotPresent\n"); + CORRADE_COMPARE(out, "Vk::Device::tryCreate(): device creation failed: Vk::Result::ErrorExtensionNotPresent\n"); } void DeviceVkTest::wrap() { @@ -1199,10 +1198,10 @@ void DeviceVkTest::wrapAlreadyCreated() { }; CORRADE_VERIFY(device.handle()); - std::ostringstream out; + Containers::String out; Error redirectError{&out}; device.wrap(instance(), {}, {}, {}, {}, {}); - CORRADE_COMPARE(out.str(), "Vk::Device::wrap(): device already created\n"); + CORRADE_COMPARE(out, "Vk::Device::wrap(): device already created\n"); } void DeviceVkTest::populateGlobalFunctionPointers() { diff --git a/src/Magnum/Vk/Test/ExtensionPropertiesVkTest.cpp b/src/Magnum/Vk/Test/ExtensionPropertiesVkTest.cpp index 0430e4d8e..2dbe33178 100644 --- a/src/Magnum/Vk/Test/ExtensionPropertiesVkTest.cpp +++ b/src/Magnum/Vk/Test/ExtensionPropertiesVkTest.cpp @@ -24,13 +24,11 @@ DEALINGS IN THE SOFTWARE. */ -#include #include #include #include #include -#include -#include +#include #include "Magnum/Vk/Extensions.h" #include "Magnum/Vk/LayerProperties.h" @@ -149,10 +147,10 @@ void ExtensionPropertiesVkTest::enumerateInstanceWithKhronosValidationLayer() { void ExtensionPropertiesVkTest::enumerateInstanceNonexistentLayer() { CORRADE_SKIP("Currently this hits an internal assert, which can't be tested."); - std::ostringstream out; + Containers::String out; Error redirectError{&out}; enumerateInstanceExtensionProperties({"VK_LAYER_this_doesnt_exist"}); - CORRADE_COMPARE(out.str(), "TODO"); + CORRADE_COMPARE(out, "TODO"); } void ExtensionPropertiesVkTest::instanceExtensionIsSupported() { @@ -203,11 +201,11 @@ void ExtensionPropertiesVkTest::outOfRange() { InstanceExtensionProperties properties = enumerateInstanceExtensionProperties(); const UnsignedInt count = properties.count(); - std::ostringstream out; + Containers::String out; Error redirectError{&out}; properties.name(count); properties.revision(count); - CORRADE_COMPARE(out.str(), Utility::formatString( + CORRADE_COMPARE(out, Utility::format( "Vk::ExtensionProperties::name(): index {0} out of range for {0} entries\n" "Vk::ExtensionProperties::revision(): index {0} out of range for {0} entries\n", count)); } diff --git a/src/Magnum/Vk/Test/HandleTest.cpp b/src/Magnum/Vk/Test/HandleTest.cpp index 45d7af070..006c02977 100644 --- a/src/Magnum/Vk/Test/HandleTest.cpp +++ b/src/Magnum/Vk/Test/HandleTest.cpp @@ -24,9 +24,8 @@ DEALINGS IN THE SOFTWARE. */ -#include +#include #include -#include #include "Magnum/Vk/Handle.h" @@ -45,15 +44,15 @@ HandleTest::HandleTest() { } void HandleTest::debugHandleFlag() { - std::ostringstream out; + Containers::String out; Debug{&out} << HandleFlag::DestroyOnDestruction << HandleFlag(0xf0); - CORRADE_COMPARE(out.str(), "Vk::HandleFlag::DestroyOnDestruction Vk::HandleFlag(0xf0)\n"); + CORRADE_COMPARE(out, "Vk::HandleFlag::DestroyOnDestruction Vk::HandleFlag(0xf0)\n"); } void HandleTest::debugHandleFlags() { - std::ostringstream out; + Containers::String out; Debug{&out} << (HandleFlag::DestroyOnDestruction|HandleFlag(0xf0)) << HandleFlags{}; - CORRADE_COMPARE(out.str(), "Vk::HandleFlag::DestroyOnDestruction|Vk::HandleFlag(0xf0) Vk::HandleFlags{}\n"); + CORRADE_COMPARE(out, "Vk::HandleFlag::DestroyOnDestruction|Vk::HandleFlag(0xf0) Vk::HandleFlags{}\n"); } }}}} diff --git a/src/Magnum/Vk/Test/ImageTest.cpp b/src/Magnum/Vk/Test/ImageTest.cpp index c48acc73e..8f2417cd8 100644 --- a/src/Magnum/Vk/Test/ImageTest.cpp +++ b/src/Magnum/Vk/Test/ImageTest.cpp @@ -25,10 +25,9 @@ */ #include -#include #include +#include #include -#include #include "Magnum/PixelFormat.h" #include "Magnum/Vk/ImageCreateInfo.h" @@ -352,10 +351,10 @@ void ImageTest::aspectsFor() { void ImageTest::aspectsForInvalidFormat() { CORRADE_SKIP_IF_NO_ASSERT(); - std::ostringstream out; + Containers::String out; Error redirectError{&out}; imageAspectsFor(PixelFormat{}); - CORRADE_COMPARE(out.str(), "Vk::imageAspectsFor(): can't get an aspect for Vk::PixelFormat(0)\n"); + CORRADE_COMPARE(out, "Vk::imageAspectsFor(): can't get an aspect for Vk::PixelFormat(0)\n"); } void ImageTest::aspectsForGenericFormat() { @@ -384,10 +383,10 @@ void ImageTest::dedicatedMemoryNotDedicated() { Image image{NoCreate}; CORRADE_VERIFY(!image.hasDedicatedMemory()); - std::ostringstream out; + Containers::String out; Error redirectError{&out}; image.dedicatedMemory(); - CORRADE_COMPARE(out.str(), "Vk::Image::dedicatedMemory(): image doesn't have a dedicated memory\n"); + CORRADE_COMPARE(out, "Vk::Image::dedicatedMemory(): image doesn't have a dedicated memory\n"); } void ImageTest::imageCopyConstruct() { @@ -473,10 +472,10 @@ void ImageTest::imageCopyConvertDisallowed() { ImageCopy copy{ImageAspect{}, 0, 0, 0, {}, 0, 0, 0, {}, {}}; copy->pNext = © - std::ostringstream out; + Containers::String out; Error redirectError{&out}; copy.vkImageCopy(); - CORRADE_COMPARE(out.str(), "Vk::ImageCopy: disallowing conversion to VkImageCopy with non-empty pNext to prevent information loss\n"); + CORRADE_COMPARE(out, "Vk::ImageCopy: disallowing conversion to VkImageCopy with non-empty pNext to prevent information loss\n"); } void ImageTest::copyImageInfoConstruct() { @@ -708,10 +707,10 @@ void ImageTest::bufferImageCopyConvertDisallowed() { BufferImageCopy copy{0, 0, 0, ImageAspect{}, 0, 0, 0, {}}; copy->pNext = © - std::ostringstream out; + Containers::String out; Error redirectError{&out}; copy.vkBufferImageCopy(); - CORRADE_COMPARE(out.str(), "Vk::BufferImageCopy: disallowing conversion to VkBufferImageCopy with non-empty pNext to prevent information loss\n"); + CORRADE_COMPARE(out, "Vk::BufferImageCopy: disallowing conversion to VkBufferImageCopy with non-empty pNext to prevent information loss\n"); } void ImageTest::copyBufferToImageInfoConstruct() { @@ -825,15 +824,15 @@ void ImageTest::copyImageToBufferInfoConvertToVk() { } void ImageTest::debugAspect() { - std::ostringstream out; + Containers::String out; Debug{&out} << ImageAspect::Depth << ImageAspect(0xdeadcafe); - CORRADE_COMPARE(out.str(), "Vk::ImageAspect::Depth Vk::ImageAspect(0xdeadcafe)\n"); + CORRADE_COMPARE(out, "Vk::ImageAspect::Depth Vk::ImageAspect(0xdeadcafe)\n"); } void ImageTest::debugAspects() { - std::ostringstream out; + Containers::String out; Debug{&out} << (ImageAspect::Stencil|ImageAspect(0xf0)) << ImageAspects{}; - CORRADE_COMPARE(out.str(), "Vk::ImageAspect::Stencil|Vk::ImageAspect(0xf0) Vk::ImageAspects{}\n"); + CORRADE_COMPARE(out, "Vk::ImageAspect::Stencil|Vk::ImageAspect(0xf0) Vk::ImageAspects{}\n"); } }}}} diff --git a/src/Magnum/Vk/Test/ImageViewTest.cpp b/src/Magnum/Vk/Test/ImageViewTest.cpp index 5c1b7cfcf..15e0b74c5 100644 --- a/src/Magnum/Vk/Test/ImageViewTest.cpp +++ b/src/Magnum/Vk/Test/ImageViewTest.cpp @@ -25,9 +25,8 @@ */ #include -#include +#include #include -#include #include "Magnum/Vk/Device.h" #include "Magnum/Vk/Image.h" @@ -149,10 +148,10 @@ void ImageViewTest::createInfoConstructFromImageFormatUknown() { Device device{NoCreate}; Image image = Image::wrap(device, imageHandle, PixelFormat{}); - std::ostringstream out; + Containers::String out; Error redirectError{&out}; ImageViewCreateInfo{VK_IMAGE_VIEW_TYPE_2D, image}; - CORRADE_COMPARE(out.str(), + CORRADE_COMPARE(out, "Vk::ImageViewCreateInfo: the image has unknown format, you have to specify it explicitly\n" /* The second assert won't appear for the user, it's here only because the graceful assert can't do an early exist in a delegeated diff --git a/src/Magnum/Vk/Test/ImageVkTest.cpp b/src/Magnum/Vk/Test/ImageVkTest.cpp index a9d6f363c..f08a7604f 100644 --- a/src/Magnum/Vk/Test/ImageVkTest.cpp +++ b/src/Magnum/Vk/Test/ImageVkTest.cpp @@ -24,13 +24,11 @@ DEALINGS IN THE SOFTWARE. */ -#include #include -#include +#include #include #include #include -#include #include "Magnum/ImageView.h" #include "Magnum/PixelFormat.h" @@ -870,10 +868,10 @@ void ImageVkTest::cmdCopyImageDisallowedConversion() { /* The commands shouldn't do anything, so it should be fine to just call them without any render pass set up */ - std::ostringstream out; + Containers::String out; Error redirectError{&out}; cmd.copyImage(a); - CORRADE_COMPARE(out.str(), + CORRADE_COMPARE(out, "Vk::CommandBuffer::copyImage(): disallowing extraction of CopyImageInfo with non-empty pNext to prevent information loss\n"); } @@ -1412,11 +1410,11 @@ void ImageVkTest::cmdCopyBufferImageDisallowedConversion() { /* The commands shouldn't do anything, so it should be fine to just call them without any render pass set up */ - std::ostringstream out; + Containers::String out; Error redirectError{&out}; cmd.copyBufferToImage(a) .copyImageToBuffer(b); - CORRADE_COMPARE(out.str(), + CORRADE_COMPARE(out, "Vk::CommandBuffer::copyBufferToImage(): disallowing extraction of CopyBufferToImageInfo with non-empty pNext to prevent information loss\n" "Vk::CommandBuffer::copyImageToBuffer(): disallowing extraction of CopyImageToBufferInfo with non-empty pNext to prevent information loss\n"); } diff --git a/src/Magnum/Vk/Test/InstanceVkTest.cpp b/src/Magnum/Vk/Test/InstanceVkTest.cpp index 844e198f0..a3336d4bd 100644 --- a/src/Magnum/Vk/Test/InstanceVkTest.cpp +++ b/src/Magnum/Vk/Test/InstanceVkTest.cpp @@ -24,14 +24,13 @@ DEALINGS IN THE SOFTWARE. */ -#include +#include /* std::getenv() */ #include #include #include #include #include -#include -#include +#include #include "Magnum/Vk/Extensions.h" #include "Magnum/Vk/ExtensionProperties.h" @@ -376,7 +375,7 @@ void InstanceVkTest::constructCommandLineDisable() { if(!enumerateInstanceExtensionProperties({"VK_LAYER_KHRONOS_validation"}).isSupported()) CORRADE_SKIP("VK_EXT_validation_features not supported, can't test"); - std::ostringstream out; + Containers::String out; Warning redirectWarning{&out}; Debug redirectOutput{&out}; Instance instance{InstanceCreateInfo{Int(data.argsDisable.size()), data.argsDisable, @@ -395,7 +394,7 @@ void InstanceVkTest::constructCommandLineDisable() { UnsignedInt minor = versionMinor(enumerateInstanceVersion()); UnsignedInt patch = versionPatch(enumerateInstanceVersion()); /* Vulkan 1.0 instances report no patch version, special-case that */ - CORRADE_COMPARE(out.str(), Utility::formatString(data.log, major, minor, patch ? Utility::formatString(".{}", patch) : "")); + CORRADE_COMPARE(out, Utility::format(data.log, major, minor, patch ? Utility::format(".{}", patch) : "")); /* Verify that the entrypoint is actually (not) loaded as expected, to avoid all the above reporting being just smoke & mirrors */ @@ -416,7 +415,7 @@ void InstanceVkTest::constructCommandLineEnable() { if(!enumerateInstanceExtensionProperties({"VK_LAYER_KHRONOS_validation"}).isSupported()) CORRADE_SKIP("VK_EXT_validation_features not supported, can't test"); - std::ostringstream out; + Containers::String out; Warning redirectWarning{&out}; Debug redirectOutput{&out}; Instance instance{InstanceCreateInfo{Int(data.argsEnable.size()), data.argsEnable, @@ -433,7 +432,7 @@ void InstanceVkTest::constructCommandLineEnable() { UnsignedInt minor = versionMinor(enumerateInstanceVersion()); UnsignedInt patch = versionPatch(enumerateInstanceVersion()); /* Vulkan 1.0 instances report no patch version, special-case that */ - CORRADE_COMPARE(out.str(), Utility::formatString(data.log, major, minor, patch ? Utility::format(".{}", patch) : "")); + CORRADE_COMPARE(out, Utility::format(data.log, major, minor, patch ? Utility::format(".{}", patch) : "")); /* Verify that the entrypoint is actually (not) loaded as expected, to avoid all the above reporting being just smoke & mirrors */ @@ -446,30 +445,30 @@ void InstanceVkTest::tryCreateAlreadyCreated() { Instance instance; CORRADE_VERIFY(instance.handle()); - std::ostringstream out; + Containers::String out; Error redirectError{&out}; instance.tryCreate(); - CORRADE_COMPARE(out.str(), "Vk::Instance::tryCreate(): instance already created\n"); + CORRADE_COMPARE(out, "Vk::Instance::tryCreate(): instance already created\n"); } void InstanceVkTest::tryCreateUnknownLayer() { Instance instance{NoCreate}; - std::ostringstream out; + Containers::String out; Error redirectError{&out}; CORRADE_COMPARE(instance.tryCreate(InstanceCreateInfo{} .addEnabledLayers({"VK_LAYER_this_doesnt_exist"_s})), Result::ErrorLayerNotPresent); - CORRADE_COMPARE(out.str(), "Vk::Instance::tryCreate(): instance creation failed: Vk::Result::ErrorLayerNotPresent\n"); + CORRADE_COMPARE(out, "Vk::Instance::tryCreate(): instance creation failed: Vk::Result::ErrorLayerNotPresent\n"); } void InstanceVkTest::tryCreateUnknownExtension() { Instance instance{NoCreate}; - std::ostringstream out; + Containers::String out; Error redirectError{&out}; CORRADE_COMPARE(instance.tryCreate(InstanceCreateInfo{} .addEnabledExtensions({"VK_this_doesnt_exist"_s})), Result::ErrorExtensionNotPresent); - CORRADE_COMPARE(out.str(), "Vk::Instance::tryCreate(): instance creation failed: Vk::Result::ErrorExtensionNotPresent\n"); + CORRADE_COMPARE(out, "Vk::Instance::tryCreate(): instance creation failed: Vk::Result::ErrorExtensionNotPresent\n"); } void InstanceVkTest::wrap() { @@ -533,10 +532,10 @@ void InstanceVkTest::wrapAlreadyCreated() { Instance instance; CORRADE_VERIFY(instance.handle()); - std::ostringstream out; + Containers::String out; Error redirectError{&out}; instance.wrap({}, {}, {}); - CORRADE_COMPARE(out.str(), "Vk::Instance::wrap(): instance already created\n"); + CORRADE_COMPARE(out, "Vk::Instance::wrap(): instance already created\n"); } void InstanceVkTest::populateGlobalFunctionPointers() { diff --git a/src/Magnum/Vk/Test/LayerPropertiesVkTest.cpp b/src/Magnum/Vk/Test/LayerPropertiesVkTest.cpp index 2bc66bd51..c94eafb80 100644 --- a/src/Magnum/Vk/Test/LayerPropertiesVkTest.cpp +++ b/src/Magnum/Vk/Test/LayerPropertiesVkTest.cpp @@ -24,12 +24,10 @@ DEALINGS IN THE SOFTWARE. */ -#include #include #include #include -#include -#include +#include #include "Magnum/Vk/LayerProperties.h" #include "Magnum/Vk/Version.h" @@ -107,13 +105,13 @@ void LayerPropertiesVkTest::outOfRange() { LayerProperties properties = enumerateLayerProperties(); const UnsignedInt count = properties.count(); - std::ostringstream out; + Containers::String out; Error redirectError{&out}; properties.name(count); properties.revision(count); properties.version(count); properties.description(count); - CORRADE_COMPARE(out.str(), Utility::formatString( + CORRADE_COMPARE(out, Utility::format( "Vk::LayerProperties::name(): index {0} out of range for {0} entries\n" "Vk::LayerProperties::revision(): index {0} out of range for {0} entries\n" "Vk::LayerProperties::version(): index {0} out of range for {0} entries\n" diff --git a/src/Magnum/Vk/Test/MemoryTest.cpp b/src/Magnum/Vk/Test/MemoryTest.cpp index 848640cf1..35e51d526 100644 --- a/src/Magnum/Vk/Test/MemoryTest.cpp +++ b/src/Magnum/Vk/Test/MemoryTest.cpp @@ -24,10 +24,9 @@ DEALINGS IN THE SOFTWARE. */ -#include #include +#include #include -#include #include "Magnum/Vk/Device.h" #include "Magnum/Vk/MemoryAllocateInfo.h" @@ -118,10 +117,10 @@ void MemoryTest::requirementsAlignedSizeZeroAlignement() { VkMemoryRequirements2 vkRequirements{}; vkRequirements.memoryRequirements.size = 16384; - std::ostringstream out; + Containers::String out; Error redirectError{&out}; MemoryRequirements{vkRequirements}.alignedSize(0); - CORRADE_COMPARE(out.str(), "Vk::MemoryRequirements::alignedSize(): alignment can't be zero\n"); + CORRADE_COMPARE(out, "Vk::MemoryRequirements::alignedSize(): alignment can't be zero\n"); } void MemoryTest::allocateInfoConstruct() { @@ -171,25 +170,25 @@ void MemoryTest::mapWrappedUnknownSize() { Device device{NoCreate}; Memory memory = Memory::wrap(device, {}, 0); - std::ostringstream out; + Containers::String out; Error redirectError{&out}; memory.map(); memory.mapRead(); - CORRADE_COMPARE(out.str(), + CORRADE_COMPARE(out, "Vk::Memory::map(): the memory has unknown size, you have to specify it explicitly\n" "Vk::Memory::mapRead(): the memory has unknown size, you have to specify it explicitly\n"); } void MemoryTest::debugMemoryFlag() { - std::ostringstream out; + Containers::String out; Debug{&out} << MemoryFlag::HostCached << MemoryFlag(0xdeadcafe); - CORRADE_COMPARE(out.str(), "Vk::MemoryFlag::HostCached Vk::MemoryFlag(0xdeadcafe)\n"); + CORRADE_COMPARE(out, "Vk::MemoryFlag::HostCached Vk::MemoryFlag(0xdeadcafe)\n"); } void MemoryTest::debugMemoryFlags() { - std::ostringstream out; + Containers::String out; Debug{&out} << (MemoryFlag::HostCached|MemoryFlag::LazilyAllocated) << MemoryFlags{}; - CORRADE_COMPARE(out.str(), "Vk::MemoryFlag::HostCached|Vk::MemoryFlag::LazilyAllocated Vk::MemoryFlags{}\n"); + CORRADE_COMPARE(out, "Vk::MemoryFlag::HostCached|Vk::MemoryFlag::LazilyAllocated Vk::MemoryFlags{}\n"); } }}}} diff --git a/src/Magnum/Vk/Test/MeshLayoutTest.cpp b/src/Magnum/Vk/Test/MeshLayoutTest.cpp index be6880d5b..631f630aa 100644 --- a/src/Magnum/Vk/Test/MeshLayoutTest.cpp +++ b/src/Magnum/Vk/Test/MeshLayoutTest.cpp @@ -25,10 +25,9 @@ */ #include -#include #include +#include #include -#include #include "Magnum/Mesh.h" #include "Magnum/VertexFormat.h" @@ -157,26 +156,26 @@ void MeshLayoutTest::mapMeshPrimitiveUnsupported() { CORRADE_VERIFY(!hasMeshPrimitive(Magnum::MeshPrimitive::LineLoop)); - std::ostringstream out; + Containers::String out; { Error redirectError{&out}; meshPrimitive(Magnum::MeshPrimitive::LineLoop); } - CORRADE_COMPARE(out.str(), + CORRADE_COMPARE(out, "Vk::meshPrimitive(): unsupported primitive MeshPrimitive::LineLoop\n"); } void MeshLayoutTest::mapMeshPrimitiveInvalid() { CORRADE_SKIP_IF_NO_ASSERT(); - std::ostringstream out; + Containers::String out; Error redirectError{&out}; hasMeshPrimitive(Magnum::MeshPrimitive{}); hasMeshPrimitive(Magnum::MeshPrimitive(0x12)); meshPrimitive(Magnum::MeshPrimitive{}); meshPrimitive(Magnum::MeshPrimitive(0x12)); - CORRADE_COMPARE(out.str(), + CORRADE_COMPARE(out, "Vk::hasMeshPrimitive(): invalid primitive MeshPrimitive(0x0)\n" "Vk::hasMeshPrimitive(): invalid primitive MeshPrimitive(0x12)\n" "Vk::meshPrimitive(): invalid primitive MeshPrimitive(0x0)\n" @@ -339,11 +338,11 @@ void MeshLayoutTest::addBindingWrongOrder() { MeshLayout layout{MeshPrimitive::Triangles}; layout.addBinding(15, 23); - std::ostringstream out; + Containers::String out; Error redirectError{&out}; layout.addBinding(15, 27) .addInstancedBinding(15, 27); - CORRADE_COMPARE(out.str(), + CORRADE_COMPARE(out, "Vk::MeshLayout::addBinding(): binding 15 can't be ordered after 15\n" "Vk::MeshLayout::addInstancedBinding(): binding 15 can't be ordered after 15\n"); } @@ -373,10 +372,10 @@ void MeshLayoutTest::addAttributeWrongOrder() { MeshLayout layout{MeshPrimitive::Triangles}; layout.addAttribute(5, 17, VertexFormat{}, 0); - std::ostringstream out; + Containers::String out; Error redirectError{&out}; layout.addAttribute(5, 25, VertexFormat{}, 1); - CORRADE_COMPARE(out.str(), + CORRADE_COMPARE(out, "Vk::MeshLayout::addAttribute(): location 5 can't be ordered after 5\n"); } @@ -515,11 +514,11 @@ void MeshLayoutTest::compareExternalPointers() { /* Test both comparison directions to verify the check is done for both */ - std::ostringstream out; + Containers::String out; Error redirectError{&out}; layout.operator==(empty); /* to avoid unused expression warnings */ empty.operator==(layout); - CORRADE_COMPARE(out.str(), + CORRADE_COMPARE(out, "Vk::MeshLayout: can't compare structures with external pointers\n" "Vk::MeshLayout: can't compare structures with external pointers\n"); @@ -528,10 +527,10 @@ void MeshLayoutTest::compareExternalPointers() { MeshLayout layout{MeshPrimitive::Lines}; layout.vkPipelineInputAssemblyStateCreateInfo().pNext = &layout; - std::ostringstream out; + Containers::String out; Error redirectError{&out}; layout.operator==(layout); /* to avoid unused expression warnings */ - CORRADE_COMPARE(out.str(), "Vk::MeshLayout: can't compare structures with external pointers\n"); + CORRADE_COMPARE(out, "Vk::MeshLayout: can't compare structures with external pointers\n"); /* Disallowed pNext inside the divisor struct */ } { @@ -542,10 +541,10 @@ void MeshLayoutTest::compareExternalPointers() { CORRADE_VERIFY(layout.vkPipelineVertexInputStateCreateInfo().pNext); static_cast(const_cast(layout.vkPipelineVertexInputStateCreateInfo().pNext))->pNext = &layout; - std::ostringstream out; + Containers::String out; Error redirectError{&out}; layout.operator==(layout); /* to avoid unused expression warnings */ - CORRADE_COMPARE(out.str(), "Vk::MeshLayout: can't compare structures with external pointers\n"); + CORRADE_COMPARE(out, "Vk::MeshLayout: can't compare structures with external pointers\n"); /* External vertex bindings */ } { @@ -553,20 +552,20 @@ void MeshLayoutTest::compareExternalPointers() { MeshLayout layout{MeshPrimitive::Lines}; layout.vkPipelineVertexInputStateCreateInfo().pVertexBindingDescriptions = &bindingData; - std::ostringstream out; + Containers::String out; Error redirectError{&out}; layout.operator==(layout); /* to avoid unused expression warnings */ - CORRADE_COMPARE(out.str(), "Vk::MeshLayout: can't compare structures with external pointers\n"); + CORRADE_COMPARE(out, "Vk::MeshLayout: can't compare structures with external pointers\n"); /* Null vertex bindings but non-zero size */ } { MeshLayout layout{MeshPrimitive::Lines}; layout.vkPipelineVertexInputStateCreateInfo().vertexAttributeDescriptionCount = 3; - std::ostringstream out; + Containers::String out; Error redirectError{&out}; layout.operator==(layout); /* to avoid unused expression warnings */ - CORRADE_COMPARE(out.str(), "Vk::MeshLayout: can't compare structures with external pointers\n"); + CORRADE_COMPARE(out, "Vk::MeshLayout: can't compare structures with external pointers\n"); /* External vertex divisors */ } { @@ -578,10 +577,10 @@ void MeshLayoutTest::compareExternalPointers() { CORRADE_VERIFY(layout.vkPipelineVertexInputStateCreateInfo().pNext); static_cast(const_cast(layout.vkPipelineVertexInputStateCreateInfo().pNext))->pVertexBindingDivisors = &bindingDivisorData; - std::ostringstream out; + Containers::String out; Error redirectError{&out}; layout.operator==(layout); /* to avoid unused expression warnings */ - CORRADE_COMPARE(out.str(), "Vk::MeshLayout: can't compare structures with external pointers\n"); + CORRADE_COMPARE(out, "Vk::MeshLayout: can't compare structures with external pointers\n"); /* Null vertex divisors but non-zero size */ } { @@ -592,10 +591,10 @@ void MeshLayoutTest::compareExternalPointers() { CORRADE_VERIFY(layout.vkPipelineVertexInputStateCreateInfo().pNext); static_cast(const_cast(layout.vkPipelineVertexInputStateCreateInfo().pNext))->pVertexBindingDivisors = nullptr; - std::ostringstream out; + Containers::String out; Error redirectError{&out}; layout.operator==(layout); /* to avoid unused expression warnings */ - CORRADE_COMPARE(out.str(), "Vk::MeshLayout: can't compare structures with external pointers\n"); + CORRADE_COMPARE(out, "Vk::MeshLayout: can't compare structures with external pointers\n"); /* External attributes */ } { @@ -603,27 +602,27 @@ void MeshLayoutTest::compareExternalPointers() { MeshLayout layout{MeshPrimitive::Lines}; layout.vkPipelineVertexInputStateCreateInfo().pVertexAttributeDescriptions = &attributeData; - std::ostringstream out; + Containers::String out; Error redirectError{&out}; layout.operator==(layout); /* to avoid unused warnings */ - CORRADE_COMPARE(out.str(), "Vk::MeshLayout: can't compare structures with external pointers\n"); + CORRADE_COMPARE(out, "Vk::MeshLayout: can't compare structures with external pointers\n"); /* Null attributes but non-zero size */ } { MeshLayout layout{MeshPrimitive::Lines}; layout.vkPipelineVertexInputStateCreateInfo().vertexAttributeDescriptionCount = 3; - std::ostringstream out; + Containers::String out; Error redirectError{&out}; layout.operator==(layout); /* to avoid unused warnings */ - CORRADE_COMPARE(out.str(), "Vk::MeshLayout: can't compare structures with external pointers\n"); + CORRADE_COMPARE(out, "Vk::MeshLayout: can't compare structures with external pointers\n"); } } void MeshLayoutTest::debugMeshPrimitive() { - std::ostringstream out; + Containers::String out; Debug{&out} << MeshPrimitive::TriangleFan << MeshPrimitive(-10007655); - CORRADE_COMPARE(out.str(), "Vk::MeshPrimitive::TriangleFan Vk::MeshPrimitive(-10007655)\n"); + CORRADE_COMPARE(out, "Vk::MeshPrimitive::TriangleFan Vk::MeshPrimitive(-10007655)\n"); } }}}} diff --git a/src/Magnum/Vk/Test/MeshTest.cpp b/src/Magnum/Vk/Test/MeshTest.cpp index 8f1c8114f..175d3547c 100644 --- a/src/Magnum/Vk/Test/MeshTest.cpp +++ b/src/Magnum/Vk/Test/MeshTest.cpp @@ -24,10 +24,10 @@ DEALINGS IN THE SOFTWARE. */ -#include +#include +#include #include #include -#include #include "Magnum/Mesh.h" #include "Magnum/Vk/Buffer.h" @@ -106,11 +106,11 @@ void MeshTest::mapIndexTypeImplementationSpecific() { void MeshTest::mapIndexTypeInvalid() { CORRADE_SKIP_IF_NO_ASSERT(); - std::ostringstream out; + Containers::String out; Error redirectError{&out}; meshIndexType(Magnum::MeshIndexType(0x0)); meshIndexType(Magnum::MeshIndexType(0x12)); - CORRADE_COMPARE(out.str(), + CORRADE_COMPARE(out, "Vk::meshIndexType(): invalid type MeshIndexType(0x0)\n" "Vk::meshIndexType(): invalid type MeshIndexType(0x12)\n"); } @@ -245,11 +245,11 @@ void MeshTest::addVertexBufferNoSuchBinding() { .addBinding(1, 2) .addInstancedBinding(5, 3)}; - std::ostringstream out; + Containers::String out; Error redirectError{&out}; noBindings.addVertexBuffer(2, VkBuffer{}, 0); differentBindings.addVertexBuffer(3, Buffer{NoCreate}, 5); - CORRADE_COMPARE(out.str(), + CORRADE_COMPARE(out, "Vk::Mesh::addVertexBuffer(): binding 2 not present among 0 bindings in the layout\n" "Vk::Mesh::addVertexBuffer(): binding 3 not present among 2 bindings in the layout\n"); } @@ -292,21 +292,21 @@ void MeshTest::indexPropertiesNotIndexed() { Mesh mesh{MeshLayout{MeshPrimitive::Triangles}}; CORRADE_VERIFY(!mesh.isIndexed()); - std::ostringstream out; + Containers::String out; Error redirectError{&out}; mesh.indexBuffer(); mesh.indexBufferOffset(); mesh.indexType(); - CORRADE_COMPARE(out.str(), + CORRADE_COMPARE(out, "Vk::Mesh::indexBuffer(): the mesh is not indexed\n" "Vk::Mesh::indexBufferOffset(): the mesh is not indexed\n" "Vk::Mesh::indexType(): the mesh is not indexed\n"); } void MeshTest::debugIndexType() { - std::ostringstream out; + Containers::String out; Debug{&out} << MeshIndexType::UnsignedShort << MeshIndexType(-10007655); - CORRADE_COMPARE(out.str(), "Vk::MeshIndexType::UnsignedShort Vk::MeshIndexType(-10007655)\n"); + CORRADE_COMPARE(out, "Vk::MeshIndexType::UnsignedShort Vk::MeshIndexType(-10007655)\n"); } }}}} diff --git a/src/Magnum/Vk/Test/MeshVkTest.cpp b/src/Magnum/Vk/Test/MeshVkTest.cpp index 822f96556..78fd98855 100644 --- a/src/Magnum/Vk/Test/MeshVkTest.cpp +++ b/src/Magnum/Vk/Test/MeshVkTest.cpp @@ -24,13 +24,11 @@ DEALINGS IN THE SOFTWARE. */ -#include #include #include #include #include #include -#include #include #include "Magnum/ImageView.h" @@ -668,10 +666,10 @@ void MeshVkTest::cmdDrawNoCountSet() { ) .bindPipeline(pipeline); - std::ostringstream out; + Containers::String out; Error redirectError{&out}; cmd.draw(mesh); - CORRADE_COMPARE(out.str(), "Vk::CommandBuffer::draw(): Mesh::setCount() was never called, probably a mistake?\n"); + CORRADE_COMPARE(out, "Vk::CommandBuffer::draw(): Mesh::setCount() was never called, probably a mistake?\n"); } void MeshVkTest::cmdDrawDynamicPrimitive() { @@ -877,10 +875,10 @@ void MeshVkTest::cmdDrawDynamicStrideInsufficientImplementation() { ) .bindPipeline(fakeDynamicStatePipeline); - std::ostringstream out; + Containers::String out; Error redirectError{&out}; cmd.draw(mesh); - CORRADE_COMPARE(out.str(), "Vk::CommandBuffer::draw(): dynamic strides supplied for an implementation without extended dynamic state\n"); + CORRADE_COMPARE(out, "Vk::CommandBuffer::draw(): dynamic strides supplied for an implementation without extended dynamic state\n"); } }}}} diff --git a/src/Magnum/Vk/Test/PipelineTest.cpp b/src/Magnum/Vk/Test/PipelineTest.cpp index 0d7dd59f3..8dd50761a 100644 --- a/src/Magnum/Vk/Test/PipelineTest.cpp +++ b/src/Magnum/Vk/Test/PipelineTest.cpp @@ -25,11 +25,9 @@ */ #include -#include #include -#include +#include #include -#include #include "Magnum/Math/Range.h" #include "Magnum/Vk/ComputePipelineCreateInfo.h" @@ -572,10 +570,10 @@ void PipelineTest::computeCreateInfoConstructNotSingleShader() { ShaderSet shaderSet; - std::ostringstream out; + Containers::String out; Error redirectError{&out}; ComputePipelineCreateInfo info{shaderSet, {}}; - CORRADE_COMPARE(out.str(), "Vk::ComputePipelineCreateInfo: the shader set has to contain exactly one shader, got 0\n"); + CORRADE_COMPARE(out, "Vk::ComputePipelineCreateInfo: the shader set has to contain exactly one shader, got 0\n"); } void PipelineTest::computeCreateInfoConstructNoInit() { @@ -729,21 +727,21 @@ void PipelineTest::imageMemoryBarrierConstructFromVk() { } void PipelineTest::debugBindPoint() { - std::ostringstream out; + Containers::String out; Debug{&out} << PipelineBindPoint::Compute << PipelineBindPoint(-10007655); - CORRADE_COMPARE(out.str(), "Vk::PipelineBindPoint::Compute Vk::PipelineBindPoint(-10007655)\n"); + CORRADE_COMPARE(out, "Vk::PipelineBindPoint::Compute Vk::PipelineBindPoint(-10007655)\n"); } void PipelineTest::debugDynamicRasterizationState() { - std::ostringstream out; + Containers::String out; Debug{&out} << DynamicRasterizationState::VertexInputBindingStride << DynamicRasterizationState(0xab); - CORRADE_COMPARE(out.str(), "Vk::DynamicRasterizationState::VertexInputBindingStride Vk::DynamicRasterizationState(0xab)\n"); + CORRADE_COMPARE(out, "Vk::DynamicRasterizationState::VertexInputBindingStride Vk::DynamicRasterizationState(0xab)\n"); } void PipelineTest::debugDynamicRasterizationStates() { - std::ostringstream out; + Containers::String out; Debug{&out} << (DynamicRasterizationState::Viewport|DynamicRasterizationState::Scissor|DynamicRasterizationState(0x2a)|DynamicRasterizationState(0x3f)) << DynamicRasterizationStates{}; - CORRADE_COMPARE(out.str(), "Vk::DynamicRasterizationState::Viewport|Vk::DynamicRasterizationState::Scissor|Vk::DynamicRasterizationState(0x2a)|Vk::DynamicRasterizationState(0x3f) Vk::DynamicRasterizationStates{}\n"); + CORRADE_COMPARE(out, "Vk::DynamicRasterizationState::Viewport|Vk::DynamicRasterizationState::Scissor|Vk::DynamicRasterizationState(0x2a)|Vk::DynamicRasterizationState(0x3f) Vk::DynamicRasterizationStates{}\n"); } }}}} diff --git a/src/Magnum/Vk/Test/PipelineVkTest.cpp b/src/Magnum/Vk/Test/PipelineVkTest.cpp index b7644fdc8..23655d4f6 100644 --- a/src/Magnum/Vk/Test/PipelineVkTest.cpp +++ b/src/Magnum/Vk/Test/PipelineVkTest.cpp @@ -24,11 +24,9 @@ DEALINGS IN THE SOFTWARE. */ -#include #include #include #include -#include #include #include "Magnum/Math/Range.h" @@ -170,10 +168,10 @@ void PipelineVkTest::constructRasterizationViewportNotSet() { }; CORRADE_VERIFY(!info->pViewportState); - std::ostringstream out; + Containers::String out; Error redirectError{&out}; Pipeline pipeline{device(), info}; - CORRADE_COMPARE(out.str(), "Vk::Pipeline: if rasterization discard is not enabled, the viewport has to be either dynamic or set via setViewport()\n"); + CORRADE_COMPARE(out, "Vk::Pipeline: if rasterization discard is not enabled, the viewport has to be either dynamic or set via setViewport()\n"); } void PipelineVkTest::constructRasterizationViewportNotSetDiscardEnabled() { @@ -441,10 +439,10 @@ void PipelineVkTest::dynamicRasterizationStatesNotRasterization() { shaderSet, pipelineLayout }}; - std::ostringstream out; + Containers::String out; Error redirectError{&out}; pipeline.dynamicRasterizationStates(); - CORRADE_COMPARE(out.str(), "Vk::Pipeline::dynamicRasterizationStates(): not a rasterization pipeline\n"); + CORRADE_COMPARE(out, "Vk::Pipeline::dynamicRasterizationStates(): not a rasterization pipeline\n"); } void PipelineVkTest::cmdBindRasterization() { diff --git a/src/Magnum/Vk/Test/PixelFormatTest.cpp b/src/Magnum/Vk/Test/PixelFormatTest.cpp index f4251636f..cba40cf48 100644 --- a/src/Magnum/Vk/Test/PixelFormatTest.cpp +++ b/src/Magnum/Vk/Test/PixelFormatTest.cpp @@ -24,10 +24,9 @@ DEALINGS IN THE SOFTWARE. */ -#include #include +#include #include -#include #include "Magnum/PixelFormat.h" #include "Magnum/Vk/PixelFormat.h" @@ -99,9 +98,9 @@ void PixelFormatTest::map() { CORRADE_COMPARE(genericPixelFormat(PixelFormat::format), Magnum::PixelFormat::format); \ CORRADE_COMPARE(pixelFormat(Magnum::PixelFormat::format), PixelFormat::format); \ { \ - std::ostringstream out; \ + Containers::String out; \ Debug{&out} << pixelFormat(Magnum::PixelFormat::format); \ - CORRADE_COMPARE(out.str(), "Vk::PixelFormat::" #format "\n"); \ + CORRADE_COMPARE(out, "Vk::PixelFormat::" #format "\n"); \ } \ ++nextHandled; \ continue; @@ -110,12 +109,12 @@ void PixelFormatTest::map() { CORRADE_COMPARE(nextHandled, i); \ CORRADE_COMPARE(firstUnhandled, 0xffff); \ CORRADE_VERIFY(!hasPixelFormat(Magnum::PixelFormat::format)); \ - std::ostringstream out; \ + Containers::String out; \ { /* Redirected otherwise graceful assert would abort */ \ Error redirectError{&out}; \ pixelFormat(Magnum::PixelFormat::format); \ } \ - Debug{Debug::Flag::NoNewlineAtTheEnd} << out.str(); \ + Debug{Debug::Flag::NoNewlineAtTheEnd} << out; \ ++nextHandled; \ continue; \ } @@ -148,25 +147,25 @@ void PixelFormatTest::mapUnsupported() { #if 1 CORRADE_SKIP("All pixel formats are supported."); #else - std::ostringstream out; + Containers::String out; Error redirectError{&out}; pixelFormat(Magnum::PixelFormat::RGB16UI); - CORRADE_COMPARE(out.str(), "Vk::pixelFormat(): unsupported format PixelFormat::RGB16UI\n"); + CORRADE_COMPARE(out, "Vk::pixelFormat(): unsupported format PixelFormat::RGB16UI\n"); #endif } void PixelFormatTest::mapInvalid() { CORRADE_SKIP_IF_NO_ASSERT(); - std::ostringstream out; + Containers::String out; Error redirectError{&out}; hasPixelFormat(Magnum::PixelFormat{}); hasPixelFormat(Magnum::PixelFormat(0x123)); pixelFormat(Magnum::PixelFormat{}); pixelFormat(Magnum::PixelFormat(0x123)); - CORRADE_COMPARE(out.str(), + CORRADE_COMPARE(out, "Vk::hasPixelFormat(): invalid format PixelFormat(0x0)\n" "Vk::hasPixelFormat(): invalid format PixelFormat(0x123)\n" "Vk::pixelFormat(): invalid format PixelFormat(0x0)\n" @@ -216,9 +215,9 @@ void PixelFormatTest::mapCompressed() { CORRADE_COMPARE(genericCompressedPixelFormat(PixelFormat::Compressed ## expectedFormat), Magnum::CompressedPixelFormat::format); \ CORRADE_COMPARE(pixelFormat(Magnum::CompressedPixelFormat::format), PixelFormat::Compressed ## expectedFormat); \ { \ - std::ostringstream out; \ + Containers::String out; \ Debug{&out} << pixelFormat(Magnum::CompressedPixelFormat::format); \ - CORRADE_COMPARE(out.str(), "Vk::PixelFormat::Compressed" #expectedFormat "\n"); \ + CORRADE_COMPARE(out, "Vk::PixelFormat::Compressed" #expectedFormat "\n"); \ } \ ++nextHandled; \ continue; @@ -232,9 +231,9 @@ void PixelFormatTest::mapCompressed() { CORRADE_VERIFY(hasPixelFormat(Magnum::CompressedPixelFormat::format)); \ CORRADE_COMPARE(pixelFormat(Magnum::CompressedPixelFormat::format), PixelFormat::Compressed ## expectedFormat); \ { \ - std::ostringstream out; \ + Containers::String out; \ Debug{&out} << pixelFormat(Magnum::CompressedPixelFormat::format); \ - CORRADE_COMPARE(out.str(), "Vk::PixelFormat::Compressed" #expectedFormat "\n"); \ + CORRADE_COMPARE(out, "Vk::PixelFormat::Compressed" #expectedFormat "\n"); \ } \ ++nextHandled; \ continue; @@ -243,12 +242,12 @@ void PixelFormatTest::mapCompressed() { CORRADE_COMPARE(nextHandled, i); \ CORRADE_COMPARE(firstUnhandled, 0xffff); \ CORRADE_VERIFY(!hasPixelFormat(Magnum::CompressedPixelFormat::format)); \ - std::ostringstream out; \ + Containers::String out; \ { /* Redirected otherwise graceful assert would abort */ \ Error redirectError{&out}; \ pixelFormat(Magnum::CompressedPixelFormat::format); \ } \ - Debug{Debug::Flag::NoNewlineAtTheEnd} << out.str(); \ + Debug{Debug::Flag::NoNewlineAtTheEnd} << out; \ ++nextHandled; \ continue; \ } @@ -280,23 +279,23 @@ void PixelFormatTest::mapCompressedUnsupported() { CORRADE_VERIFY(!hasPixelFormat(Magnum::CompressedPixelFormat::Astc3x3x3RGBAUnorm)); - std::ostringstream out; + Containers::String out; Error redirectError{&out}; pixelFormat(Magnum::CompressedPixelFormat::Astc3x3x3RGBAUnorm); - CORRADE_COMPARE(out.str(), "Vk::pixelFormat(): unsupported format CompressedPixelFormat::Astc3x3x3RGBAUnorm\n"); + CORRADE_COMPARE(out, "Vk::pixelFormat(): unsupported format CompressedPixelFormat::Astc3x3x3RGBAUnorm\n"); } void PixelFormatTest::mapCompressedInvalid() { CORRADE_SKIP_IF_NO_ASSERT(); - std::ostringstream out; + Containers::String out; Error redirectError{&out}; hasPixelFormat(Magnum::CompressedPixelFormat{}); hasPixelFormat(Magnum::CompressedPixelFormat(0x123)); pixelFormat(Magnum::CompressedPixelFormat{}); pixelFormat(Magnum::CompressedPixelFormat(0x123)); - CORRADE_COMPARE(out.str(), + CORRADE_COMPARE(out, "Vk::hasPixelFormat(): invalid format CompressedPixelFormat(0x0)\n" "Vk::hasPixelFormat(): invalid format CompressedPixelFormat(0x123)\n" "Vk::pixelFormat(): invalid format CompressedPixelFormat(0x0)\n" @@ -312,9 +311,9 @@ void PixelFormatTest::mapGenericCompressedUnsupported() { } void PixelFormatTest::debug() { - std::ostringstream out; + Containers::String out; Debug{&out} << PixelFormat::RGB16UI << PixelFormat(-10007655); - CORRADE_COMPARE(out.str(), "Vk::PixelFormat::RGB16UI Vk::PixelFormat(-10007655)\n"); + CORRADE_COMPARE(out, "Vk::PixelFormat::RGB16UI Vk::PixelFormat(-10007655)\n"); } }}}} diff --git a/src/Magnum/Vk/Test/RenderPassTest.cpp b/src/Magnum/Vk/Test/RenderPassTest.cpp index 92b765d50..b99056b6d 100644 --- a/src/Magnum/Vk/Test/RenderPassTest.cpp +++ b/src/Magnum/Vk/Test/RenderPassTest.cpp @@ -25,11 +25,9 @@ */ #include -#include #include -#include +#include #include -#include #include "Magnum/Math/Color.h" #include "Magnum/Math/Range.h" @@ -356,10 +354,10 @@ void RenderPassTest::attachmentDescriptionConvertDisallowed() { AttachmentDescription description{PixelFormat{}, AttachmentLoadOperation{}, AttachmentStoreOperation{}, ImageLayout{}, ImageLayout{}}; description->pNext = &description; - std::ostringstream out; + Containers::String out; Error redirectError{&out}; description.vkAttachmentDescription(); - CORRADE_COMPARE(out.str(), "Vk::AttachmentDescription: disallowing conversion to VkAttachmentDescription with non-empty pNext to prevent information loss\n"); + CORRADE_COMPARE(out, "Vk::AttachmentDescription: disallowing conversion to VkAttachmentDescription with non-empty pNext to prevent information loss\n"); } void RenderPassTest::attachmentReferenceConstruct() { @@ -414,10 +412,10 @@ void RenderPassTest::attachmentReferenceConvertDisallowed() { AttachmentReference reference{0, ImageLayout{}}; reference->pNext = &reference; - std::ostringstream out; + Containers::String out; Error redirectError{&out}; reference.vkAttachmentReference(); - CORRADE_COMPARE(out.str(), "Vk::AttachmentReference: disallowing conversion to VkAttachmentReference with non-empty pNext to prevent information loss\n"); + CORRADE_COMPARE(out, "Vk::AttachmentReference: disallowing conversion to VkAttachmentReference with non-empty pNext to prevent information loss\n"); } void RenderPassTest::subpassDescriptionConstruct() { @@ -498,10 +496,10 @@ void RenderPassTest::subpassDescriptionConstructColorResolveAttachmentsWrongCoun SubpassDescription description; - std::ostringstream out; + Containers::String out; Error redirectError{&out}; description.setColorAttachments({{}, {}}, {{}, {}, {}}); - CORRADE_COMPARE(out.str(), + CORRADE_COMPARE(out, "Vk::SubpassDescription::setColorAttachments(): resolve attachments expected to be either empty or have a size of 2 but got 3\n"); } @@ -740,10 +738,10 @@ void RenderPassTest::subpassDescriptionConvertDisallowed() { SubpassDescription description; description->pNext = &description; - std::ostringstream out; + Containers::String out; Error redirectError{&out}; description.vkSubpassDescription(); - CORRADE_COMPARE(out.str(), "Vk::SubpassDescription: disallowing conversion to VkSubpassDescription with non-empty pNext to prevent information loss\n"); + CORRADE_COMPARE(out, "Vk::SubpassDescription: disallowing conversion to VkSubpassDescription with non-empty pNext to prevent information loss\n"); } void RenderPassTest::subpassDescriptionRvalue() { @@ -843,10 +841,10 @@ void RenderPassTest::subpassDependencyConvertDisallowed() { SubpassDependency dependency{0, 1, PipelineStages{}, PipelineStages{}, Accesses{}, Accesses{}}; dependency->pNext = &dependency; - std::ostringstream out; + Containers::String out; Error redirectError{&out}; dependency.vkSubpassDependency(); - CORRADE_COMPARE(out.str(), "Vk::SubpassDependency: disallowing conversion to VkSubpassDependency with non-empty pNext to prevent information loss\n"); + CORRADE_COMPARE(out, "Vk::SubpassDependency: disallowing conversion to VkSubpassDependency with non-empty pNext to prevent information loss\n"); } void RenderPassTest::createInfoConstruct() { @@ -1154,10 +1152,10 @@ void RenderPassTest::beginInfoConstructImplicitSizeUnknown() { Framebuffer framebuffer{NoCreate}; - std::ostringstream out; + Containers::String out; Error redirectError{&out}; RenderPassBeginInfo{VkRenderPass{}, framebuffer}; - CORRADE_COMPARE(out.str(), + CORRADE_COMPARE(out, "Vk::RenderPassBeginInfo: the framebuffer has unknown size, you have to specify the render area explicitly\n"); } diff --git a/src/Magnum/Vk/Test/RenderPassVkTest.cpp b/src/Magnum/Vk/Test/RenderPassVkTest.cpp index b1f5ac8a8..6dc63b38c 100644 --- a/src/Magnum/Vk/Test/RenderPassVkTest.cpp +++ b/src/Magnum/Vk/Test/RenderPassVkTest.cpp @@ -24,9 +24,8 @@ DEALINGS IN THE SOFTWARE. */ -#include #include -#include +#include #include "Magnum/Math/Color.h" #include "Magnum/Math/Range.h" @@ -96,10 +95,10 @@ void RenderPassVkTest::construct() { void RenderPassVkTest::constructNoSubpasses() { CORRADE_SKIP_IF_NO_ASSERT(); - std::ostringstream out; + Containers::String out; Error redirectError{&out}; RenderPass{device(), RenderPassCreateInfo{}}; - CORRADE_COMPARE(out.str(), "Vk::RenderPass: needs to be created with at least one subpass\n"); + CORRADE_COMPARE(out, "Vk::RenderPass: needs to be created with at least one subpass\n"); } void RenderPassVkTest::constructSubpassNoAttachments() { @@ -245,13 +244,13 @@ void RenderPassVkTest::cmdBeginEndDisallowedConversion() { /* The commands shouldn't do anything, so it should be fine to just call them without any render pass set up */ - std::ostringstream out; + Containers::String out; Error redirectError{&out}; cmd.beginRenderPass(RenderPassBeginInfo{NoInit}, beginInfo) .nextSubpass(beginInfo) .nextSubpass(endInfo) .endRenderPass(endInfo); - CORRADE_COMPARE(out.str(), + CORRADE_COMPARE(out, "Vk::CommandBuffer::beginRenderPass(): disallowing conversion of SubpassBeginInfo to VkSubpassContents with non-empty pNext to prevent information loss\n" "Vk::CommandBuffer::nextRenderPass(): disallowing conversion of SubpassBeginInfo to VkSubpassContents with non-empty pNext to prevent information loss\n" "Vk::CommandBuffer::nextRenderPass(): disallowing omission of SubpassEndInfo with non-empty pNext to prevent information loss\n" diff --git a/src/Magnum/Vk/Test/ResultTest.cpp b/src/Magnum/Vk/Test/ResultTest.cpp index 1dd00ce08..3301b8eb6 100644 --- a/src/Magnum/Vk/Test/ResultTest.cpp +++ b/src/Magnum/Vk/Test/ResultTest.cpp @@ -24,9 +24,8 @@ DEALINGS IN THE SOFTWARE. */ -#include +#include #include -#include #include "Magnum/Vk/Result.h" @@ -46,9 +45,9 @@ ResultTest::ResultTest() { } void ResultTest::debug() { - std::ostringstream out; + Containers::String out; Debug{&out} << Result::ErrorExtensionNotPresent << Result(-10007655); - CORRADE_COMPARE(out.str(), "Vk::Result::ErrorExtensionNotPresent Vk::Result(-10007655)\n"); + CORRADE_COMPARE(out, "Vk::Result::ErrorExtensionNotPresent Vk::Result(-10007655)\n"); } }}}} diff --git a/src/Magnum/Vk/Test/SamplerTest.cpp b/src/Magnum/Vk/Test/SamplerTest.cpp index 891d084d4..7de346ac7 100644 --- a/src/Magnum/Vk/Test/SamplerTest.cpp +++ b/src/Magnum/Vk/Test/SamplerTest.cpp @@ -24,9 +24,9 @@ DEALINGS IN THE SOFTWARE. */ -#include +#include +#include #include -#include #include "Magnum/Sampler.h" #include "Magnum/Math/Vector3.h" @@ -122,11 +122,11 @@ void SamplerTest::mapFilter() { void SamplerTest::mapFilterInvalid() { CORRADE_SKIP_IF_NO_ASSERT(); - std::ostringstream out; + Containers::String out; Error redirectError{&out}; samplerFilter(Magnum::SamplerFilter(0x123)); - CORRADE_COMPARE(out.str(), + CORRADE_COMPARE(out, "Vk::samplerFilter(): invalid filter SamplerFilter(0x123)\n"); } @@ -139,11 +139,11 @@ void SamplerTest::mapMipmap() { void SamplerTest::mapMipmapInvalid() { CORRADE_SKIP_IF_NO_ASSERT(); - std::ostringstream out; + Containers::String out; Error redirectError{&out}; samplerMipmap(Magnum::SamplerMipmap(0x123)); - CORRADE_COMPARE(out.str(), + CORRADE_COMPARE(out, "Vk::samplerMipmap(): invalid mode SamplerMipmap(0x123)\n"); } @@ -164,11 +164,11 @@ void SamplerTest::mapWrappingVector() { void SamplerTest::mapWrappingInvalid() { CORRADE_SKIP_IF_NO_ASSERT(); - std::ostringstream out; + Containers::String out; Error redirectError{&out}; samplerWrapping(Magnum::SamplerWrapping(0x123)); - CORRADE_COMPARE(out.str(), + CORRADE_COMPARE(out, "Vk::samplerWrapping(): invalid wrapping SamplerWrapping(0x123)\n"); } @@ -262,21 +262,21 @@ void SamplerTest::constructCopy() { } void SamplerTest::debugFilter() { - std::ostringstream out; + Containers::String out; Debug{&out} << SamplerFilter::Linear << SamplerFilter(-10007655); - CORRADE_COMPARE(out.str(), "Vk::SamplerFilter::Linear Vk::SamplerFilter(-10007655)\n"); + CORRADE_COMPARE(out, "Vk::SamplerFilter::Linear Vk::SamplerFilter(-10007655)\n"); } void SamplerTest::debugMipmap() { - std::ostringstream out; + Containers::String out; Debug{&out} << SamplerMipmap::Linear << SamplerMipmap(-10007655); - CORRADE_COMPARE(out.str(), "Vk::SamplerMipmap::Linear Vk::SamplerMipmap(-10007655)\n"); + CORRADE_COMPARE(out, "Vk::SamplerMipmap::Linear Vk::SamplerMipmap(-10007655)\n"); } void SamplerTest::debugWrapping() { - std::ostringstream out; + Containers::String out; Debug{&out} << SamplerWrapping::MirrorClampToEdge << SamplerWrapping(-10007655); - CORRADE_COMPARE(out.str(), "Vk::SamplerWrapping::MirrorClampToEdge Vk::SamplerWrapping(-10007655)\n"); + CORRADE_COMPARE(out, "Vk::SamplerWrapping::MirrorClampToEdge Vk::SamplerWrapping(-10007655)\n"); } }}}} diff --git a/src/Magnum/Vk/Test/ShaderSetTest.cpp b/src/Magnum/Vk/Test/ShaderSetTest.cpp index 1a082b8aa..e938d5d81 100644 --- a/src/Magnum/Vk/Test/ShaderSetTest.cpp +++ b/src/Magnum/Vk/Test/ShaderSetTest.cpp @@ -24,12 +24,10 @@ DEALINGS IN THE SOFTWARE. */ -#include #include -#include +#include #include #include -#include #include "Magnum/Vk/Device.h" #include "Magnum/Vk/Shader.h" @@ -376,10 +374,10 @@ void ShaderSetTest::addShaderTooManyStages() { .addShader({}, {}, {}) .addShader({}, {}, {}); - std::ostringstream out; + Containers::String out; Error redirectError{&out}; set.addShader({}, {}, {}); - CORRADE_COMPARE(out.str(), "Vk::ShaderSet::addShader(): too many stages, expected at most 6\n"); + CORRADE_COMPARE(out, "Vk::ShaderSet::addShader(): too many stages, expected at most 6\n"); } }}}} diff --git a/src/Magnum/Vk/Test/VersionTest.cpp b/src/Magnum/Vk/Test/VersionTest.cpp index f1a4ea029..d326acf48 100644 --- a/src/Magnum/Vk/Test/VersionTest.cpp +++ b/src/Magnum/Vk/Test/VersionTest.cpp @@ -24,10 +24,8 @@ DEALINGS IN THE SOFTWARE. */ -#include #include #include -#include #include "Magnum/Magnum.h" #include "Magnum/Vk/Version.h" @@ -127,11 +125,11 @@ void VersionTest::comparison() { } void VersionTest::debug() { - std::ostringstream out; + Containers::String out; Debug{&out} << Version::Vk12 << version(1, 5, 789) << Version::None /* packed should omit "Vulkan" */ << Debug::packed << version(20, 6); - CORRADE_COMPARE(out.str(), "Vulkan 1.2 Vulkan 1.5.789 Vulkan 1023.1023.4095 20.6\n"); + CORRADE_COMPARE(out, "Vulkan 1.2 Vulkan 1.5.789 Vulkan 1023.1023.4095 20.6\n"); } void VersionTest::configuration() { diff --git a/src/Magnum/Vk/Test/VertexFormatTest.cpp b/src/Magnum/Vk/Test/VertexFormatTest.cpp index 8d7ae01da..83d330fa8 100644 --- a/src/Magnum/Vk/Test/VertexFormatTest.cpp +++ b/src/Magnum/Vk/Test/VertexFormatTest.cpp @@ -23,9 +23,8 @@ DEALINGS IN THE SOFTWARE. */ -#include +#include #include -#include #include "Magnum/VertexFormat.h" #include "Magnum/Vk/VertexFormat.h" @@ -83,9 +82,9 @@ void VertexFormatTest::map() { CORRADE_VERIFY(hasVertexFormat(Magnum::VertexFormat::input)); \ CORRADE_COMPARE(vertexFormat(Magnum::VertexFormat::input), VertexFormat::output); \ { \ - std::ostringstream out; \ + Containers::String out; \ Debug{&out} << vertexFormat(Magnum::VertexFormat::input); \ - CORRADE_COMPARE(out.str(), "Vk::VertexFormat::" #output "\n"); \ + CORRADE_COMPARE(out, "Vk::VertexFormat::" #output "\n"); \ } \ ++nextHandled; \ continue; @@ -94,7 +93,7 @@ void VertexFormatTest::map() { CORRADE_COMPARE(nextHandled, i); \ CORRADE_COMPARE(firstUnhandled, 0xffff); \ CORRADE_VERIFY(!hasVertexFormat(Magnum::VertexFormat::format)); \ - std::ostringstream out; \ + Containers::String out; \ { /* Redirected otherwise graceful assert would abort */ \ Error redirectError{&out}; \ vertexFormat(Magnum::VertexFormat::format); \ @@ -132,25 +131,25 @@ void VertexFormatTest::mapUnsupported() { #if 1 CORRADE_SKIP("All vertex formats are supported."); #else - std::ostringstream out; + Containers::String out; Error redirectError{&out}; vertexFormat(Magnum::VertexFormat::Vector3d); - CORRADE_COMPARE(out.str(), "Vk::vertexFormat(): unsupported format VertexFormat::Vector3d\n"); + CORRADE_COMPARE(out, "Vk::vertexFormat(): unsupported format VertexFormat::Vector3d\n"); #endif } void VertexFormatTest::mapInvalid() { CORRADE_SKIP_IF_NO_ASSERT(); - std::ostringstream out; + Containers::String out; Error redirectError{&out}; hasVertexFormat(Magnum::VertexFormat{}); hasVertexFormat(Magnum::VertexFormat(0x123)); vertexFormat(Magnum::VertexFormat{}); vertexFormat(Magnum::VertexFormat(0x123)); - CORRADE_COMPARE(out.str(), + CORRADE_COMPARE(out, "Vk::hasVertexFormat(): invalid format VertexFormat(0x0)\n" "Vk::hasVertexFormat(): invalid format VertexFormat(0x123)\n" "Vk::vertexFormat(): invalid format VertexFormat(0x0)\n" @@ -158,9 +157,9 @@ void VertexFormatTest::mapInvalid() { } void VertexFormatTest::debug() { - std::ostringstream out; + Containers::String out; Debug{&out} << VertexFormat::Vector2usNormalized << VertexFormat(-10007655); - CORRADE_COMPARE(out.str(), "Vk::VertexFormat::Vector2usNormalized Vk::VertexFormat(-10007655)\n"); + CORRADE_COMPARE(out, "Vk::VertexFormat::Vector2usNormalized Vk::VertexFormat(-10007655)\n"); } }}}} diff --git a/src/MagnumPlugins/AnyAudioImporter/Test/AnyAudioImporterTest.cpp b/src/MagnumPlugins/AnyAudioImporter/Test/AnyAudioImporterTest.cpp index 532da9585..1bc5489d6 100644 --- a/src/MagnumPlugins/AnyAudioImporter/Test/AnyAudioImporterTest.cpp +++ b/src/MagnumPlugins/AnyAudioImporter/Test/AnyAudioImporterTest.cpp @@ -24,13 +24,11 @@ DEALINGS IN THE SOFTWARE. */ -#include #include #include #include #include -#include -#include +#include #include #include "Magnum/Audio/AbstractImporter.h" @@ -119,16 +117,16 @@ void AnyImporterTest::detect() { Containers::Pointer importer = _manager.instantiate("AnyAudioImporter"); - std::ostringstream out; + Containers::String out; Error redirectError{&out}; CORRADE_VERIFY(!importer->openFile(data.filename)); #ifndef CORRADE_PLUGINMANAGER_NO_DYNAMIC_PLUGIN_SUPPORT - CORRADE_COMPARE(out.str(), Utility::formatString( + CORRADE_COMPARE(out, Utility::format( "PluginManager::Manager::load(): plugin {0} is not static and was not found in nonexistent\n" "Audio::AnyImporter::openFile(): cannot load the {0} plugin\n", data.plugin)); #else - CORRADE_COMPARE(out.str(), Utility::formatString( + CORRADE_COMPARE(out, Utility::format( "PluginManager::Manager::load(): plugin {0} was not found\n" "Audio::AnyImporter::openFile(): cannot load the {0} plugin\n", data.plugin)); @@ -138,10 +136,10 @@ void AnyImporterTest::detect() { void AnyImporterTest::unknown() { Containers::Pointer importer = _manager.instantiate("AnyAudioImporter"); - std::ostringstream out; + Containers::String out; Error redirectError{&out}; CORRADE_VERIFY(!importer->openFile("sound.mid")); - CORRADE_COMPARE(out.str(), "Audio::AnyImporter::openFile(): cannot determine the format of sound.mid\n"); + CORRADE_COMPARE(out, "Audio::AnyImporter::openFile(): cannot determine the format of sound.mid\n"); } void AnyImporterTest::propagateConfiguration() { @@ -155,10 +153,10 @@ void AnyImporterTest::propagateConfigurationUnknown() { Containers::Pointer importer = _manager.instantiate("AnyAudioImporter"); importer->configuration().setValue("noSuchOption", "isHere"); - std::ostringstream out; + Containers::String out; Warning redirectWarning{&out}; CORRADE_VERIFY(importer->openFile(Utility::Path::join(WAVAUDIOIMPORTER_TEST_DIR, "stereo8.wav"))); - CORRADE_COMPARE(out.str(), "Audio::AnyImporter::openFile(): option noSuchOption not recognized by WavAudioImporter\n"); + CORRADE_COMPARE(out, "Audio::AnyImporter::openFile(): option noSuchOption not recognized by WavAudioImporter\n"); } }}}} diff --git a/src/MagnumPlugins/AnyImageConverter/Test/AnyImageConverterTest.cpp b/src/MagnumPlugins/AnyImageConverter/Test/AnyImageConverterTest.cpp index afa6cd1db..41b7f7087 100644 --- a/src/MagnumPlugins/AnyImageConverter/Test/AnyImageConverterTest.cpp +++ b/src/MagnumPlugins/AnyImageConverter/Test/AnyImageConverterTest.cpp @@ -24,7 +24,6 @@ DEALINGS IN THE SOFTWARE. */ -#include #include /* std::thread::hardware_concurrency(), sigh */ #include #include @@ -33,8 +32,7 @@ #include #include #include -#include -#include +#include #include #include "Magnum/ImageView.h" @@ -713,16 +711,16 @@ void AnyImageConverterTest::detect1D() { Containers::Pointer converter = _manager.instantiate("AnyImageConverter"); - std::ostringstream out; + Containers::String out; Error redirectError{&out}; CORRADE_VERIFY(!converter->convertToFile(Image1D, data.filename)); #ifndef CORRADE_PLUGINMANAGER_NO_DYNAMIC_PLUGIN_SUPPORT - CORRADE_COMPARE(out.str(), Utility::formatString( + CORRADE_COMPARE(out, Utility::format( "PluginManager::Manager::load(): plugin {0} is not static and was not found in nonexistent\n" "Trade::AnyImageConverter::convertToFile(): cannot load the {0} plugin\n", data.plugin)); #else - CORRADE_COMPARE(out.str(), Utility::formatString( + CORRADE_COMPARE(out, Utility::format( "PluginManager::Manager::load(): plugin {0} was not found\n" "Trade::AnyImageConverter::convertToFile(): cannot load the {0} plugin\n", data.plugin)); #endif @@ -734,16 +732,16 @@ void AnyImageConverterTest::detect2D() { Containers::Pointer converter = _manager.instantiate("AnyImageConverter"); - std::ostringstream out; + Containers::String out; Error redirectError{&out}; CORRADE_VERIFY(!converter->convertToFile(Image2D, data.filename)); #ifndef CORRADE_PLUGINMANAGER_NO_DYNAMIC_PLUGIN_SUPPORT - CORRADE_COMPARE(out.str(), Utility::formatString( + CORRADE_COMPARE(out, Utility::format( "PluginManager::Manager::load(): plugin {0} is not static and was not found in nonexistent\n" "Trade::AnyImageConverter::convertToFile(): cannot load the {0} plugin\n", data.plugin)); #else - CORRADE_COMPARE(out.str(), Utility::formatString( + CORRADE_COMPARE(out, Utility::format( "PluginManager::Manager::load(): plugin {0} was not found\n" "Trade::AnyImageConverter::convertToFile(): cannot load the {0} plugin\n", data.plugin)); #endif @@ -755,16 +753,16 @@ void AnyImageConverterTest::detect3D() { Containers::Pointer converter = _manager.instantiate("AnyImageConverter"); - std::ostringstream out; + Containers::String out; Error redirectError{&out}; CORRADE_VERIFY(!converter->convertToFile(Image3D, data.filename)); #ifndef CORRADE_PLUGINMANAGER_NO_DYNAMIC_PLUGIN_SUPPORT - CORRADE_COMPARE(out.str(), Utility::formatString( + CORRADE_COMPARE(out, Utility::format( "PluginManager::Manager::load(): plugin {0} is not static and was not found in nonexistent\n" "Trade::AnyImageConverter::convertToFile(): cannot load the {0} plugin\n", data.plugin)); #else - CORRADE_COMPARE(out.str(), Utility::formatString( + CORRADE_COMPARE(out, Utility::format( "PluginManager::Manager::load(): plugin {0} was not found\n" "Trade::AnyImageConverter::convertToFile(): cannot load the {0} plugin\n", data.plugin)); @@ -777,16 +775,16 @@ void AnyImageConverterTest::detectCompressed1D() { Containers::Pointer converter = _manager.instantiate("AnyImageConverter"); - std::ostringstream out; + Containers::String out; Error redirectError{&out}; CORRADE_VERIFY(!converter->convertToFile(CompressedImage1D, data.filename)); #ifndef CORRADE_PLUGINMANAGER_NO_DYNAMIC_PLUGIN_SUPPORT - CORRADE_COMPARE(out.str(), Utility::formatString( + CORRADE_COMPARE(out, Utility::format( "PluginManager::Manager::load(): plugin {0} is not static and was not found in nonexistent\n" "Trade::AnyImageConverter::convertToFile(): cannot load the {0} plugin\n", data.plugin)); #else - CORRADE_COMPARE(out.str(), Utility::formatString( + CORRADE_COMPARE(out, Utility::format( "PluginManager::Manager::load(): plugin {0} was not found\n" "Trade::AnyImageConverter::convertToFile(): cannot load the {0} plugin\n", data.plugin)); #endif @@ -798,16 +796,16 @@ void AnyImageConverterTest::detectCompressed2D() { Containers::Pointer converter = _manager.instantiate("AnyImageConverter"); - std::ostringstream out; + Containers::String out; Error redirectError{&out}; CORRADE_VERIFY(!converter->convertToFile(CompressedImage2D, data.filename)); #ifndef CORRADE_PLUGINMANAGER_NO_DYNAMIC_PLUGIN_SUPPORT - CORRADE_COMPARE(out.str(), Utility::formatString( + CORRADE_COMPARE(out, Utility::format( "PluginManager::Manager::load(): plugin {0} is not static and was not found in nonexistent\n" "Trade::AnyImageConverter::convertToFile(): cannot load the {0} plugin\n", data.plugin)); #else - CORRADE_COMPARE(out.str(), Utility::formatString( + CORRADE_COMPARE(out, Utility::format( "PluginManager::Manager::load(): plugin {0} was not found\n" "Trade::AnyImageConverter::convertToFile(): cannot load the {0} plugin\n", data.plugin)); #endif @@ -819,16 +817,16 @@ void AnyImageConverterTest::detectCompressed3D() { Containers::Pointer converter = _manager.instantiate("AnyImageConverter"); - std::ostringstream out; + Containers::String out; Error redirectError{&out}; CORRADE_VERIFY(!converter->convertToFile(CompressedImage3D, data.filename)); #ifndef CORRADE_PLUGINMANAGER_NO_DYNAMIC_PLUGIN_SUPPORT - CORRADE_COMPARE(out.str(), Utility::formatString( + CORRADE_COMPARE(out, Utility::format( "PluginManager::Manager::load(): plugin {0} is not static and was not found in nonexistent\n" "Trade::AnyImageConverter::convertToFile(): cannot load the {0} plugin\n", data.plugin)); #else - CORRADE_COMPARE(out.str(), Utility::formatString( + CORRADE_COMPARE(out, Utility::format( "PluginManager::Manager::load(): plugin {0} was not found\n" "Trade::AnyImageConverter::convertToFile(): cannot load the {0} plugin\n", data.plugin)); #endif @@ -840,18 +838,18 @@ void AnyImageConverterTest::detectLevels1D() { Containers::Pointer converter = _manager.instantiate("AnyImageConverter"); - std::ostringstream out; + Containers::String out; Error redirectError{&out}; /* Using the list API even though there's just one image, which should still trigger the correct code path for AnyImageConverter. */ CORRADE_VERIFY(!converter->convertToFile({Image1D}, data.filename)); #ifndef CORRADE_PLUGINMANAGER_NO_DYNAMIC_PLUGIN_SUPPORT - CORRADE_COMPARE(out.str(), Utility::formatString( + CORRADE_COMPARE(out, Utility::format( "PluginManager::Manager::load(): plugin {0} is not static and was not found in nonexistent\n" "Trade::AnyImageConverter::convertToFile(): cannot load the {0} plugin\n", data.plugin)); #else - CORRADE_COMPARE(out.str(), Utility::formatString( + CORRADE_COMPARE(out, Utility::format( "PluginManager::Manager::load(): plugin {0} was not found\n" "Trade::AnyImageConverter::convertToFile(): cannot load the {0} plugin\n", data.plugin)); #endif @@ -863,18 +861,18 @@ void AnyImageConverterTest::detectLevels2D() { Containers::Pointer converter = _manager.instantiate("AnyImageConverter"); - std::ostringstream out; + Containers::String out; Error redirectError{&out}; /* Using the list API even though there's just one image, which should still trigger the correct code path for AnyImageConverter. */ CORRADE_VERIFY(!converter->convertToFile({Image2D}, data.filename)); #ifndef CORRADE_PLUGINMANAGER_NO_DYNAMIC_PLUGIN_SUPPORT - CORRADE_COMPARE(out.str(), Utility::formatString( + CORRADE_COMPARE(out, Utility::format( "PluginManager::Manager::load(): plugin {0} is not static and was not found in nonexistent\n" "Trade::AnyImageConverter::convertToFile(): cannot load the {0} plugin\n", data.plugin)); #else - CORRADE_COMPARE(out.str(), Utility::formatString( + CORRADE_COMPARE(out, Utility::format( "PluginManager::Manager::load(): plugin {0} was not found\n" "Trade::AnyImageConverter::convertToFile(): cannot load the {0} plugin\n", data.plugin)); @@ -887,18 +885,18 @@ void AnyImageConverterTest::detectLevels3D() { Containers::Pointer converter = _manager.instantiate("AnyImageConverter"); - std::ostringstream out; + Containers::String out; Error redirectError{&out}; /* Using the list API even though there's just one image, which should still trigger the correct code path for AnyImageConverter. */ CORRADE_VERIFY(!converter->convertToFile({Image3D}, data.filename)); #ifndef CORRADE_PLUGINMANAGER_NO_DYNAMIC_PLUGIN_SUPPORT - CORRADE_COMPARE(out.str(), Utility::formatString( + CORRADE_COMPARE(out, Utility::format( "PluginManager::Manager::load(): plugin {0} is not static and was not found in nonexistent\n" "Trade::AnyImageConverter::convertToFile(): cannot load the {0} plugin\n", data.plugin)); #else - CORRADE_COMPARE(out.str(), Utility::formatString( + CORRADE_COMPARE(out, Utility::format( "PluginManager::Manager::load(): plugin {0} was not found\n" "Trade::AnyImageConverter::convertToFile(): cannot load the {0} plugin\n", data.plugin)); @@ -911,18 +909,18 @@ void AnyImageConverterTest::detectCompressedLevels1D() { Containers::Pointer converter = _manager.instantiate("AnyImageConverter"); - std::ostringstream out; + Containers::String out; Error redirectError{&out}; /* Using the list API even though there's just one image, which should still trigger the correct code path for AnyImageConverter. */ CORRADE_VERIFY(!converter->convertToFile({CompressedImage1D}, data.filename)); #ifndef CORRADE_PLUGINMANAGER_NO_DYNAMIC_PLUGIN_SUPPORT - CORRADE_COMPARE(out.str(), Utility::formatString( + CORRADE_COMPARE(out, Utility::format( "PluginManager::Manager::load(): plugin {0} is not static and was not found in nonexistent\n" "Trade::AnyImageConverter::convertToFile(): cannot load the {0} plugin\n", data.plugin)); #else - CORRADE_COMPARE(out.str(), Utility::formatString( + CORRADE_COMPARE(out, Utility::format( "PluginManager::Manager::load(): plugin {0} was not found\n" "Trade::AnyImageConverter::convertToFile(): cannot load the {0} plugin\n", data.plugin)); @@ -935,18 +933,18 @@ void AnyImageConverterTest::detectCompressedLevels2D() { Containers::Pointer converter = _manager.instantiate("AnyImageConverter"); - std::ostringstream out; + Containers::String out; Error redirectError{&out}; /* Using the list API even though there's just one image, which should still trigger the correct code path for AnyImageConverter. */ CORRADE_VERIFY(!converter->convertToFile({CompressedImage2D}, data.filename)); #ifndef CORRADE_PLUGINMANAGER_NO_DYNAMIC_PLUGIN_SUPPORT - CORRADE_COMPARE(out.str(), Utility::formatString( + CORRADE_COMPARE(out, Utility::format( "PluginManager::Manager::load(): plugin {0} is not static and was not found in nonexistent\n" "Trade::AnyImageConverter::convertToFile(): cannot load the {0} plugin\n", data.plugin)); #else - CORRADE_COMPARE(out.str(), Utility::formatString( + CORRADE_COMPARE(out, Utility::format( "PluginManager::Manager::load(): plugin {0} was not found\n" "Trade::AnyImageConverter::convertToFile(): cannot load the {0} plugin\n", data.plugin)); @@ -959,18 +957,18 @@ void AnyImageConverterTest::detectCompressedLevels3D() { Containers::Pointer converter = _manager.instantiate("AnyImageConverter"); - std::ostringstream out; + Containers::String out; Error redirectError{&out}; /* Using the list API even though there's just one image, which should still trigger the correct code path for AnyImageConverter. */ CORRADE_VERIFY(!converter->convertToFile({CompressedImage3D}, data.filename)); #ifndef CORRADE_PLUGINMANAGER_NO_DYNAMIC_PLUGIN_SUPPORT - CORRADE_COMPARE(out.str(), Utility::formatString( + CORRADE_COMPARE(out, Utility::format( "PluginManager::Manager::load(): plugin {0} is not static and was not found in nonexistent\n" "Trade::AnyImageConverter::convertToFile(): cannot load the {0} plugin\n", data.plugin)); #else - CORRADE_COMPARE(out.str(), Utility::formatString( + CORRADE_COMPARE(out, Utility::format( "PluginManager::Manager::load(): plugin {0} was not found\n" "Trade::AnyImageConverter::convertToFile(): cannot load the {0} plugin\n", data.plugin)); @@ -980,109 +978,109 @@ void AnyImageConverterTest::detectCompressedLevels3D() { void AnyImageConverterTest::unknown1D() { Containers::Pointer converter = _manager.instantiate("AnyImageConverter"); - std::ostringstream out; + Containers::String out; Error redirectError{&out}; CORRADE_VERIFY(!converter->convertToFile(Image1D, "image.jpg")); - CORRADE_COMPARE(out.str(), "Trade::AnyImageConverter::convertToFile(): cannot determine the format of image.jpg for a 1D image\n"); + CORRADE_COMPARE(out, "Trade::AnyImageConverter::convertToFile(): cannot determine the format of image.jpg for a 1D image\n"); } void AnyImageConverterTest::unknown2D() { Containers::Pointer converter = _manager.instantiate("AnyImageConverter"); - std::ostringstream out; + Containers::String out; Error redirectError{&out}; CORRADE_VERIFY(!converter->convertToFile(Image2D, "image.xcf")); - CORRADE_COMPARE(out.str(), "Trade::AnyImageConverter::convertToFile(): cannot determine the format of image.xcf for a 2D image\n"); + CORRADE_COMPARE(out, "Trade::AnyImageConverter::convertToFile(): cannot determine the format of image.xcf for a 2D image\n"); } void AnyImageConverterTest::unknown3D() { Containers::Pointer converter = _manager.instantiate("AnyImageConverter"); - std::ostringstream out; + Containers::String out; Error redirectError{&out}; CORRADE_VERIFY(!converter->convertToFile(Image3D, "image.dds")); - CORRADE_COMPARE(out.str(), "Trade::AnyImageConverter::convertToFile(): cannot determine the format of image.dds for a 3D image\n"); + CORRADE_COMPARE(out, "Trade::AnyImageConverter::convertToFile(): cannot determine the format of image.dds for a 3D image\n"); } void AnyImageConverterTest::unknownCompressed1D() { Containers::Pointer converter = _manager.instantiate("AnyImageConverter"); - std::ostringstream out; + Containers::String out; Error redirectError{&out}; CORRADE_VERIFY(!converter->convertToFile(CompressedImage1D, "image.exr")); - CORRADE_COMPARE(out.str(), "Trade::AnyImageConverter::convertToFile(): cannot determine the format of image.exr for a compressed 1D image\n"); + CORRADE_COMPARE(out, "Trade::AnyImageConverter::convertToFile(): cannot determine the format of image.exr for a compressed 1D image\n"); } void AnyImageConverterTest::unknownCompressed2D() { Containers::Pointer converter = _manager.instantiate("AnyImageConverter"); - std::ostringstream out; + Containers::String out; Error redirectError{&out}; CORRADE_VERIFY(!converter->convertToFile(CompressedImage2D, "image.png")); - CORRADE_COMPARE(out.str(), "Trade::AnyImageConverter::convertToFile(): cannot determine the format of image.png for a compressed 2D image\n"); + CORRADE_COMPARE(out, "Trade::AnyImageConverter::convertToFile(): cannot determine the format of image.png for a compressed 2D image\n"); } void AnyImageConverterTest::unknownCompressed3D() { Containers::Pointer converter = _manager.instantiate("AnyImageConverter"); - std::ostringstream out; + Containers::String out; Error redirectError{&out}; CORRADE_VERIFY(!converter->convertToFile(CompressedImage3D, "image.exr")); - CORRADE_COMPARE(out.str(), "Trade::AnyImageConverter::convertToFile(): cannot determine the format of image.exr for a compressed 3D image\n"); + CORRADE_COMPARE(out, "Trade::AnyImageConverter::convertToFile(): cannot determine the format of image.exr for a compressed 3D image\n"); } void AnyImageConverterTest::unknownLevels1D() { Containers::Pointer converter = _manager.instantiate("AnyImageConverter"); - std::ostringstream out; + Containers::String out; Error redirectError{&out}; CORRADE_VERIFY(!converter->convertToFile({Image1D}, "image.tga")); - CORRADE_COMPARE(out.str(), "Trade::AnyImageConverter::convertToFile(): cannot determine the format of image.tga for a multi-level 1D image\n"); + CORRADE_COMPARE(out, "Trade::AnyImageConverter::convertToFile(): cannot determine the format of image.tga for a multi-level 1D image\n"); } void AnyImageConverterTest::unknownLevels2D() { Containers::Pointer converter = _manager.instantiate("AnyImageConverter"); - std::ostringstream out; + Containers::String out; Error redirectError{&out}; CORRADE_VERIFY(!converter->convertToFile({Image2D}, "image.png")); - CORRADE_COMPARE(out.str(), "Trade::AnyImageConverter::convertToFile(): cannot determine the format of image.png for a multi-level 2D image\n"); + CORRADE_COMPARE(out, "Trade::AnyImageConverter::convertToFile(): cannot determine the format of image.png for a multi-level 2D image\n"); } void AnyImageConverterTest::unknownLevels3D() { Containers::Pointer converter = _manager.instantiate("AnyImageConverter"); - std::ostringstream out; + Containers::String out; Error redirectError{&out}; CORRADE_VERIFY(!converter->convertToFile({Image3D}, "image.jpg")); - CORRADE_COMPARE(out.str(), "Trade::AnyImageConverter::convertToFile(): cannot determine the format of image.jpg for a multi-level 3D image\n"); + CORRADE_COMPARE(out, "Trade::AnyImageConverter::convertToFile(): cannot determine the format of image.jpg for a multi-level 3D image\n"); } void AnyImageConverterTest::unknownCompressedLevels1D() { Containers::Pointer converter = _manager.instantiate("AnyImageConverter"); - std::ostringstream out; + Containers::String out; Error redirectError{&out}; CORRADE_VERIFY(!converter->convertToFile({CompressedImage1D}, "image.bmp")); - CORRADE_COMPARE(out.str(), "Trade::AnyImageConverter::convertToFile(): cannot determine the format of image.bmp for a multi-level compressed 1D image\n"); + CORRADE_COMPARE(out, "Trade::AnyImageConverter::convertToFile(): cannot determine the format of image.bmp for a multi-level compressed 1D image\n"); } void AnyImageConverterTest::unknownCompressedLevels2D() { Containers::Pointer converter = _manager.instantiate("AnyImageConverter"); - std::ostringstream out; + Containers::String out; Error redirectError{&out}; CORRADE_VERIFY(!converter->convertToFile({CompressedImage2D}, "image.exr")); - CORRADE_COMPARE(out.str(), "Trade::AnyImageConverter::convertToFile(): cannot determine the format of image.exr for a multi-level compressed 2D image\n"); + CORRADE_COMPARE(out, "Trade::AnyImageConverter::convertToFile(): cannot determine the format of image.exr for a multi-level compressed 2D image\n"); } void AnyImageConverterTest::unknownCompressedLevels3D() { Containers::Pointer converter = _manager.instantiate("AnyImageConverter"); - std::ostringstream out; + Containers::String out; Error redirectError{&out}; CORRADE_VERIFY(!converter->convertToFile({CompressedImage3D}, "image.exr")); - CORRADE_COMPARE(out.str(), "Trade::AnyImageConverter::convertToFile(): cannot determine the format of image.exr for a multi-level compressed 3D image\n"); + CORRADE_COMPARE(out, "Trade::AnyImageConverter::convertToFile(): cannot determine the format of image.exr for a multi-level compressed 3D image\n"); } void AnyImageConverterTest::propagateFlags1D() { @@ -1100,13 +1098,13 @@ void AnyImageConverterTest::propagateFlags2D() { /* Just test that the exported file exists */ Containers::Pointer converter = _manager.instantiate("AnyImageConverter"); converter->setFlags(ImageConverterFlag::Verbose); - std::ostringstream out; + Containers::String out; { Debug redirectOutput{&out}; CORRADE_VERIFY(converter->convertToFile(Image2D, filename)); } CORRADE_VERIFY(Utility::Path::exists(filename)); - CORRADE_COMPARE(out.str(), + CORRADE_COMPARE(out, "Trade::AnyImageConverter::convertToFile(): using TgaImageConverter\n" "Trade::TgaImageConverter::convertToData(): converting from RGB to BGR\n" "Trade::TgaImageConverter::convertToData(): RLE output 3 bytes larger than uncompressed, falling back to uncompressed\n"); @@ -1139,13 +1137,13 @@ void AnyImageConverterTest::propagateFlags3D() { CORRADE_VERIFY(Utility::Path::remove(filename)); converter->setFlags(ImageConverterFlag::Verbose); - std::ostringstream out; + Containers::String out; { Debug redirectOutput{&out}; CORRADE_VERIFY(converter->convertToFile(ImageCube, filename)); } CORRADE_VERIFY(Utility::Path::exists(filename)); - CORRADE_COMPARE(out.str(), Utility::formatString( + CORRADE_COMPARE(out, Utility::format( "Trade::AnyImageConverter::convertToFile(): using OpenExrImageConverter\n" "Trade::OpenExrImageConverter::convertToData(): autodetected hardware concurrency to {} threads\n", std::thread::hardware_concurrency())); @@ -1194,7 +1192,7 @@ void AnyImageConverterTest::propagateFlagsLevels2D() { CORRADE_VERIFY(Utility::Path::remove(filename)); converter->setFlags(ImageConverterFlag::Verbose); - std::ostringstream out; + Containers::String out; { Debug redirectOutput{&out}; /* Using the list API even though there's just one image, which should @@ -1202,7 +1200,7 @@ void AnyImageConverterTest::propagateFlagsLevels2D() { CORRADE_VERIFY(converter->convertToFile({Image2DFloat}, filename)); } CORRADE_VERIFY(Utility::Path::exists(filename)); - CORRADE_COMPARE(out.str(), Utility::formatString( + CORRADE_COMPARE(out, Utility::format( "Trade::AnyImageConverter::convertToFile(): using OpenExrImageConverter\n" "Trade::OpenExrImageConverter::convertToData(): autodetected hardware concurrency to {} threads\n", std::thread::hardware_concurrency())); @@ -1235,7 +1233,7 @@ void AnyImageConverterTest::propagateFlagsLevels3D() { CORRADE_VERIFY(Utility::Path::remove(filename)); converter->setFlags(ImageConverterFlag::Verbose); - std::ostringstream out; + Containers::String out; { Debug redirectOutput{&out}; /* Using the list API even though there's just one image, which should @@ -1243,7 +1241,7 @@ void AnyImageConverterTest::propagateFlagsLevels3D() { CORRADE_VERIFY(converter->convertToFile({ImageCube}, filename)); } CORRADE_VERIFY(Utility::Path::exists(filename)); - CORRADE_COMPARE(out.str(), Utility::formatString( + CORRADE_COMPARE(out, Utility::format( "Trade::AnyImageConverter::convertToFile(): using OpenExrImageConverter\n" "Trade::OpenExrImageConverter::convertToData(): autodetected hardware concurrency to {} threads\n", std::thread::hardware_concurrency())); @@ -1352,13 +1350,13 @@ void AnyImageConverterTest::propagateConfigurationUnknown1D() { converter->configuration().setValue("noSuchOption", "isHere"); converter->setFlags(data.flags); - std::ostringstream out; + Containers::String out; Warning redirectWarning{&out}; CORRADE_VERIFY(converter->convertToFile(Image1D, Utility::Path::join(ANYIMAGECONVERTER_TEST_OUTPUT_DIR, "1d.ktx2"))); if(data.quiet) - CORRADE_COMPARE(out.str(), ""); + CORRADE_COMPARE(out, ""); else - CORRADE_COMPARE(out.str(), "Trade::AnyImageConverter::convertToFile(): option noSuchOption not recognized by KtxImageConverter\n"); + CORRADE_COMPARE(out, "Trade::AnyImageConverter::convertToFile(): option noSuchOption not recognized by KtxImageConverter\n"); } void AnyImageConverterTest::propagateConfigurationUnknown2D() { @@ -1372,13 +1370,13 @@ void AnyImageConverterTest::propagateConfigurationUnknown2D() { converter->configuration().setValue("noSuchOption", "isHere"); converter->setFlags(data.flags); - std::ostringstream out; + Containers::String out; Warning redirectWarning{&out}; CORRADE_VERIFY(converter->convertToFile(Image2D, Utility::Path::join(ANYIMAGECONVERTER_TEST_OUTPUT_DIR, "2d.tga"))); if(data.quiet) - CORRADE_COMPARE(out.str(), ""); + CORRADE_COMPARE(out, ""); else - CORRADE_COMPARE(out.str(), "Trade::AnyImageConverter::convertToFile(): option noSuchOption not recognized by TgaImageConverter\n"); + CORRADE_COMPARE(out, "Trade::AnyImageConverter::convertToFile(): option noSuchOption not recognized by TgaImageConverter\n"); } void AnyImageConverterTest::propagateConfigurationUnknown3D() { @@ -1398,13 +1396,13 @@ void AnyImageConverterTest::propagateConfigurationUnknown3D() { converter->configuration().setValue("noSuchOption", "isHere"); converter->setFlags(data.flags); - std::ostringstream out; + Containers::String out; Warning redirectWarning{&out}; CORRADE_VERIFY(converter->convertToFile(Image3D, Utility::Path::join(ANYIMAGECONVERTER_TEST_OUTPUT_DIR, "3d.ktx2"))); if(data.quiet) - CORRADE_COMPARE(out.str(), ""); + CORRADE_COMPARE(out, ""); else - CORRADE_COMPARE(out.str(), "Trade::AnyImageConverter::convertToFile(): option noSuchOption not recognized by KtxImageConverter\n"); + CORRADE_COMPARE(out, "Trade::AnyImageConverter::convertToFile(): option noSuchOption not recognized by KtxImageConverter\n"); } void AnyImageConverterTest::propagateConfigurationCompressed1D() { @@ -1499,13 +1497,13 @@ void AnyImageConverterTest::propagateConfigurationCompressedUnknown1D() { converter->configuration().setValue("noSuchOption", "isHere"); converter->setFlags(data.flags); - std::ostringstream out; + Containers::String out; Warning redirectWarning{&out}; CORRADE_VERIFY(converter->convertToFile(CompressedImage1D, Utility::Path::join(ANYIMAGECONVERTER_TEST_OUTPUT_DIR, "compressed-1d.ktx2"))); if(data.quiet) - CORRADE_COMPARE(out.str(), ""); + CORRADE_COMPARE(out, ""); else - CORRADE_COMPARE(out.str(), "Trade::AnyImageConverter::convertToFile(): option noSuchOption not recognized by KtxImageConverter\n"); + CORRADE_COMPARE(out, "Trade::AnyImageConverter::convertToFile(): option noSuchOption not recognized by KtxImageConverter\n"); } void AnyImageConverterTest::propagateConfigurationCompressedUnknown2D() { @@ -1525,13 +1523,13 @@ void AnyImageConverterTest::propagateConfigurationCompressedUnknown2D() { converter->configuration().setValue("noSuchOption", "isHere"); converter->setFlags(data.flags); - std::ostringstream out; + Containers::String out; Warning redirectWarning{&out}; CORRADE_VERIFY(converter->convertToFile(CompressedImage2D, Utility::Path::join(ANYIMAGECONVERTER_TEST_OUTPUT_DIR, "compressed-2d.ktx2"))); if(data.quiet) - CORRADE_COMPARE(out.str(), ""); + CORRADE_COMPARE(out, ""); else - CORRADE_COMPARE(out.str(), "Trade::AnyImageConverter::convertToFile(): option noSuchOption not recognized by KtxImageConverter\n"); + CORRADE_COMPARE(out, "Trade::AnyImageConverter::convertToFile(): option noSuchOption not recognized by KtxImageConverter\n"); } void AnyImageConverterTest::propagateConfigurationCompressedUnknown3D() { @@ -1551,13 +1549,13 @@ void AnyImageConverterTest::propagateConfigurationCompressedUnknown3D() { converter->configuration().setValue("noSuchOption", "isHere"); converter->setFlags(data.flags); - std::ostringstream out; + Containers::String out; Warning redirectWarning{&out}; CORRADE_VERIFY(converter->convertToFile(CompressedImage3D, Utility::Path::join(ANYIMAGECONVERTER_TEST_OUTPUT_DIR, "compressed-3d.ktx2"))); if(data.quiet) - CORRADE_COMPARE(out.str(), ""); + CORRADE_COMPARE(out, ""); else - CORRADE_COMPARE(out.str(), "Trade::AnyImageConverter::convertToFile(): option noSuchOption not recognized by KtxImageConverter\n"); + CORRADE_COMPARE(out, "Trade::AnyImageConverter::convertToFile(): option noSuchOption not recognized by KtxImageConverter\n"); } void AnyImageConverterTest::propagateConfigurationLevels1D() { @@ -1658,15 +1656,15 @@ void AnyImageConverterTest::propagateConfigurationUnknownLevels1D() { converter->configuration().setValue("noSuchOption", "isHere"); converter->setFlags(data.flags); - std::ostringstream out; + Containers::String out; Warning redirectWarning{&out}; /* Using the list API even though there's just one image, which should still trigger the correct code path for AnyImageConverter. */ CORRADE_VERIFY(converter->convertToFile({Image1D}, Utility::Path::join(ANYIMAGECONVERTER_TEST_OUTPUT_DIR, "1d.ktx2"))); if(data.quiet) - CORRADE_COMPARE(out.str(), ""); + CORRADE_COMPARE(out, ""); else - CORRADE_COMPARE(out.str(), "Trade::AnyImageConverter::convertToFile(): option noSuchOption not recognized by KtxImageConverter\n"); + CORRADE_COMPARE(out, "Trade::AnyImageConverter::convertToFile(): option noSuchOption not recognized by KtxImageConverter\n"); } void AnyImageConverterTest::propagateConfigurationUnknownLevels2D() { @@ -1686,15 +1684,15 @@ void AnyImageConverterTest::propagateConfigurationUnknownLevels2D() { converter->configuration().setValue("noSuchOption", "isHere"); converter->setFlags(data.flags); - std::ostringstream out; + Containers::String out; Warning redirectWarning{&out}; /* Using the list API even though there's just one image, which should still trigger the correct code path for AnyImageConverter. */ CORRADE_VERIFY(converter->convertToFile({Image2D}, Utility::Path::join(ANYIMAGECONVERTER_TEST_OUTPUT_DIR, "2d.ktx2"))); if(data.quiet) - CORRADE_COMPARE(out.str(), ""); + CORRADE_COMPARE(out, ""); else - CORRADE_COMPARE(out.str(), "Trade::AnyImageConverter::convertToFile(): option noSuchOption not recognized by KtxImageConverter\n"); + CORRADE_COMPARE(out, "Trade::AnyImageConverter::convertToFile(): option noSuchOption not recognized by KtxImageConverter\n"); } void AnyImageConverterTest::propagateConfigurationUnknownLevels3D() { @@ -1714,15 +1712,15 @@ void AnyImageConverterTest::propagateConfigurationUnknownLevels3D() { converter->configuration().setValue("noSuchOption", "isHere"); converter->setFlags(data.flags); - std::ostringstream out; + Containers::String out; Warning redirectWarning{&out}; /* Using the list API even though there's just one image, which should still trigger the correct code path for AnyImageConverter. */ CORRADE_VERIFY(converter->convertToFile({Image3D}, Utility::Path::join(ANYIMAGECONVERTER_TEST_OUTPUT_DIR, "3d.ktx2"))); if(data.quiet) - CORRADE_COMPARE(out.str(), ""); + CORRADE_COMPARE(out, ""); else - CORRADE_COMPARE(out.str(), "Trade::AnyImageConverter::convertToFile(): option noSuchOption not recognized by KtxImageConverter\n"); + CORRADE_COMPARE(out, "Trade::AnyImageConverter::convertToFile(): option noSuchOption not recognized by KtxImageConverter\n"); } void AnyImageConverterTest::propagateConfigurationCompressedLevels1D() { @@ -1823,15 +1821,15 @@ void AnyImageConverterTest::propagateConfigurationCompressedUnknownLevels1D() { converter->configuration().setValue("noSuchOption", "isHere"); converter->setFlags(data.flags); - std::ostringstream out; + Containers::String out; Warning redirectWarning{&out}; /* Using the list API even though there's just one image, which should still trigger the correct code path for AnyImageConverter. */ CORRADE_VERIFY(converter->convertToFile({CompressedImage1D}, Utility::Path::join(ANYIMAGECONVERTER_TEST_OUTPUT_DIR, "compressed-1d.ktx2"))); if(data.quiet) - CORRADE_COMPARE(out.str(), ""); + CORRADE_COMPARE(out, ""); else - CORRADE_COMPARE(out.str(), "Trade::AnyImageConverter::convertToFile(): option noSuchOption not recognized by KtxImageConverter\n"); + CORRADE_COMPARE(out, "Trade::AnyImageConverter::convertToFile(): option noSuchOption not recognized by KtxImageConverter\n"); } void AnyImageConverterTest::propagateConfigurationCompressedUnknownLevels2D() { @@ -1851,15 +1849,15 @@ void AnyImageConverterTest::propagateConfigurationCompressedUnknownLevels2D() { converter->configuration().setValue("noSuchOption", "isHere"); converter->setFlags(data.flags); - std::ostringstream out; + Containers::String out; Warning redirectWarning{&out}; /* Using the list API even though there's just one image, which should still trigger the correct code path for AnyImageConverter. */ CORRADE_VERIFY(converter->convertToFile({CompressedImage2D}, Utility::Path::join(ANYIMAGECONVERTER_TEST_OUTPUT_DIR, "compressed-2d.ktx2"))); if(data.quiet) - CORRADE_COMPARE(out.str(), ""); + CORRADE_COMPARE(out, ""); else - CORRADE_COMPARE(out.str(), "Trade::AnyImageConverter::convertToFile(): option noSuchOption not recognized by KtxImageConverter\n"); + CORRADE_COMPARE(out, "Trade::AnyImageConverter::convertToFile(): option noSuchOption not recognized by KtxImageConverter\n"); } void AnyImageConverterTest::propagateConfigurationCompressedUnknownLevels3D() { @@ -1879,15 +1877,15 @@ void AnyImageConverterTest::propagateConfigurationCompressedUnknownLevels3D() { converter->configuration().setValue("noSuchOption", "isHere"); converter->setFlags(data.flags); - std::ostringstream out; + Containers::String out; Warning redirectWarning{&out}; /* Using the list API even though there's just one image, which should still trigger the correct code path for AnyImageConverter. */ CORRADE_VERIFY(converter->convertToFile({CompressedImage3D}, Utility::Path::join(ANYIMAGECONVERTER_TEST_OUTPUT_DIR, "compressed-3d.ktx2"))); if(data.quiet) - CORRADE_COMPARE(out.str(), ""); + CORRADE_COMPARE(out, ""); else - CORRADE_COMPARE(out.str(), "Trade::AnyImageConverter::convertToFile(): option noSuchOption not recognized by KtxImageConverter\n"); + CORRADE_COMPARE(out, "Trade::AnyImageConverter::convertToFile(): option noSuchOption not recognized by KtxImageConverter\n"); } }}}} diff --git a/src/MagnumPlugins/AnyImageImporter/Test/AnyImageImporterTest.cpp b/src/MagnumPlugins/AnyImageImporter/Test/AnyImageImporterTest.cpp index 52816d70c..e61f490cf 100644 --- a/src/MagnumPlugins/AnyImageImporter/Test/AnyImageImporterTest.cpp +++ b/src/MagnumPlugins/AnyImageImporter/Test/AnyImageImporterTest.cpp @@ -25,15 +25,13 @@ DEALINGS IN THE SOFTWARE. */ -#include #include #include #include #include #include #include -#include -#include +#include #include #include "Magnum/ImageView.h" @@ -270,7 +268,7 @@ void AnyImageImporterTest::detect() { Containers::Pointer importer = _manager.instantiate("AnyImageImporter"); Containers::String filename = Utility::Path::join(ANYIMAGEIMPORTER_TEST_DIR, data.filename); - std::ostringstream out; + Containers::String out; Error redirectError{&out}; if(data.asData) { Containers::Optional> read = Utility::Path::read(filename); @@ -278,12 +276,12 @@ void AnyImageImporterTest::detect() { CORRADE_VERIFY(!importer->openData(*read)); } else CORRADE_VERIFY(!importer->openFile(filename)); #ifndef CORRADE_PLUGINMANAGER_NO_DYNAMIC_PLUGIN_SUPPORT - CORRADE_COMPARE(out.str(), Utility::formatString( + CORRADE_COMPARE(out, Utility::format( "PluginManager::Manager::load(): plugin {0} is not static and was not found in nonexistent\n" "Trade::AnyImageImporter::{1}(): cannot load the {0} plugin\n", data.plugin, data.asData ? "openData" : "openFile")); #else - CORRADE_COMPARE(out.str(), Utility::formatString( + CORRADE_COMPARE(out, Utility::format( "PluginManager::Manager::load(): plugin {0} was not found\n" "Trade::AnyImageImporter::{1}(): cannot load the {0} plugin\n", data.plugin, data.asData ? "openData" : "openFile")); @@ -315,17 +313,17 @@ void AnyImageImporterTest::ktxBasisFallbackFile() { if(data.verbose) importer->setFlags(ImporterFlag::Verbose); - std::ostringstream out; + Containers::String out; Debug redirectOutput{&out}; Error redirectError{&out}; /* We don't care if the file opens (it won't if BasisImporter isn't present), just verifying if correct plugin got picked by checking the message. */ importer->openFile(Utility::Path::join(ANYIMAGEIMPORTER_TEST_DIR, "basis.ktx2")); - if(data.expectedMessage) CORRADE_COMPARE_AS(out.str(), - Utility::formatString(data.expectedMessage, "openFile"), + if(data.expectedMessage) CORRADE_COMPARE_AS(out, + Utility::format(data.expectedMessage, "openFile"), TestSuite::Compare::StringHasPrefix); - else CORRADE_COMPARE(out.str(), ""); + else CORRADE_COMPARE(out, ""); } void AnyImageImporterTest::ktxBasisFallbackData() { @@ -356,26 +354,26 @@ void AnyImageImporterTest::ktxBasisFallbackData() { Containers::Optional> read = Utility::Path::read(Utility::Path::join(ANYIMAGEIMPORTER_TEST_DIR, "basis.ktx2")); CORRADE_VERIFY(read); - std::ostringstream out; + Containers::String out; Debug redirectOutput{&out}; Error redirectError{&out}; /* We don't care if the file opens (it won't if BasisImporter isn't present), just verifying if correct plugin got picked by checking the message. */ importer->openData(*read); - if(data.expectedMessage) CORRADE_COMPARE_AS(out.str(), - Utility::formatString(data.expectedMessage, "openData"), + if(data.expectedMessage) CORRADE_COMPARE_AS(out, + Utility::format(data.expectedMessage, "openData"), TestSuite::Compare::StringHasPrefix); - else CORRADE_COMPARE(out.str(), ""); + else CORRADE_COMPARE(out, ""); } void AnyImageImporterTest::unknownExtension() { Containers::Pointer importer = _manager.instantiate("AnyImageImporter"); - std::ostringstream out; + Containers::String out; Error redirectError{&out}; CORRADE_VERIFY(!importer->openFile("image.xcf")); - CORRADE_COMPARE(out.str(), "Trade::AnyImageImporter::openFile(): cannot determine the format of image.xcf\n"); + CORRADE_COMPARE(out, "Trade::AnyImageImporter::openFile(): cannot determine the format of image.xcf\n"); } void AnyImageImporterTest::unknownSignature() { @@ -384,19 +382,19 @@ void AnyImageImporterTest::unknownSignature() { Containers::Pointer importer = _manager.instantiate("AnyImageImporter"); - std::ostringstream out; + Containers::String out; Error redirectError{&out}; CORRADE_VERIFY(!importer->openData(data.data)); - CORRADE_COMPARE(out.str(), Utility::formatString("Trade::AnyImageImporter::openData(): cannot determine the format from signature 0x{}\n", data.signature)); + CORRADE_COMPARE(out, Utility::format("Trade::AnyImageImporter::openData(): cannot determine the format from signature 0x{}\n", data.signature)); } void AnyImageImporterTest::emptyData() { Containers::Pointer importer = _manager.instantiate("AnyImageImporter"); - std::ostringstream out; + Containers::String out; Error redirectError{&out}; CORRADE_VERIFY(!importer->openData(nullptr)); - CORRADE_COMPARE(out.str(), "Trade::AnyImageImporter::openData(): file is empty\n"); + CORRADE_COMPARE(out, "Trade::AnyImageImporter::openData(): file is empty\n"); } void AnyImageImporterTest::propagateFlags() { @@ -409,7 +407,7 @@ void AnyImageImporterTest::propagateFlags() { Containers::Pointer importer = _manager.instantiate("AnyImageImporter"); importer->setFlags(ImporterFlag::Verbose); - std::ostringstream out; + Containers::String out; { Debug redirectOutput{&out}; if(data.asData) { @@ -419,7 +417,7 @@ void AnyImageImporterTest::propagateFlags() { } else CORRADE_VERIFY(importer->openFile(Utility::Path::join(ANYIMAGEIMPORTER_TEST_DIR, data.filename))); CORRADE_VERIFY(importer->image2D(0)); } - CORRADE_COMPARE(out.str(), Utility::formatString( + CORRADE_COMPARE(out, Utility::format( "Trade::AnyImageImporter::{}(): using TgaImporter\n" "Trade::TgaImporter::image2D(): converting from BGR to RGB\n", data.messageFunctionName)); @@ -471,7 +469,7 @@ void AnyImageImporterTest::propagateConfigurationUnknown() { importer->configuration().setValue("noSuchOption", "isHere"); importer->setFlags(data.flags); - std::ostringstream out; + Containers::String out; Warning redirectWarning{&out}; if(data.asData) { Containers::Optional> read = Utility::Path::read(Utility::Path::join(ANYIMAGEIMPORTER_TEST_DIR, data.filename)); @@ -479,9 +477,9 @@ void AnyImageImporterTest::propagateConfigurationUnknown() { CORRADE_VERIFY(importer->openData(*read)); } else CORRADE_VERIFY(importer->openFile(Utility::Path::join(ANYIMAGEIMPORTER_TEST_DIR, data.filename))); if(data.quiet) - CORRADE_COMPARE(out.str(), ""); + CORRADE_COMPARE(out, ""); else - CORRADE_COMPARE(out.str(), Utility::formatString("Trade::AnyImageImporter::{}(): option noSuchOption not recognized by TgaImporter\n", data.messageFunctionName)); + CORRADE_COMPARE(out, Utility::format("Trade::AnyImageImporter::{}(): option noSuchOption not recognized by TgaImporter\n", data.messageFunctionName)); } void AnyImageImporterTest::propagateFileCallback() { diff --git a/src/MagnumPlugins/AnySceneConverter/Test/AnySceneConverterTest.cpp b/src/MagnumPlugins/AnySceneConverter/Test/AnySceneConverterTest.cpp index 3f05a0a8e..4889fa6c1 100644 --- a/src/MagnumPlugins/AnySceneConverter/Test/AnySceneConverterTest.cpp +++ b/src/MagnumPlugins/AnySceneConverter/Test/AnySceneConverterTest.cpp @@ -24,7 +24,6 @@ DEALINGS IN THE SOFTWARE. */ -#include #include #include #include @@ -34,8 +33,7 @@ #include #include #include -#include -#include +#include #include #include "Magnum/ImageView.h" @@ -265,16 +263,16 @@ void AnySceneConverterTest::detectConvert() { Containers::Pointer converter = _manager.instantiate("AnySceneConverter"); - std::ostringstream out; + Containers::String out; Error redirectError{&out}; CORRADE_VERIFY(!converter->convertToFile(MeshData{MeshPrimitive::Triangles, 0}, data.filename)); #ifndef CORRADE_PLUGINMANAGER_NO_DYNAMIC_PLUGIN_SUPPORT - CORRADE_COMPARE(out.str(), Utility::formatString( + CORRADE_COMPARE(out, Utility::format( "PluginManager::Manager::load(): plugin {0} is not static and was not found in nonexistent\n" "Trade::AnySceneConverter::convertToFile(): cannot load the {0} plugin\n", data.plugin)); #else - CORRADE_COMPARE(out.str(), Utility::formatString( + CORRADE_COMPARE(out, Utility::format( "PluginManager::Manager::load(): plugin {0} was not found\n" "Trade::AnySceneConverter::convertToFile(): cannot load the {0} plugin\n", data.plugin)); @@ -287,16 +285,16 @@ void AnySceneConverterTest::detectBeginEnd() { Containers::Pointer converter = _manager.instantiate("AnySceneConverter"); - std::ostringstream out; + Containers::String out; Error redirectError{&out}; CORRADE_VERIFY(!converter->beginFile(data.filename)); #ifndef CORRADE_PLUGINMANAGER_NO_DYNAMIC_PLUGIN_SUPPORT - CORRADE_COMPARE(out.str(), Utility::formatString( + CORRADE_COMPARE(out, Utility::format( "PluginManager::Manager::load(): plugin {0} is not static and was not found in nonexistent\n" "Trade::AnySceneConverter::beginFile(): cannot load the {0} plugin\n", data.plugin)); #else - CORRADE_COMPARE(out.str(), Utility::formatString( + CORRADE_COMPARE(out, Utility::format( "PluginManager::Manager::load(): plugin {0} was not found\n" "Trade::AnySceneConverter::beginFile(): cannot load the {0} plugin\n", data.plugin)); #endif @@ -305,19 +303,19 @@ void AnySceneConverterTest::detectBeginEnd() { void AnySceneConverterTest::unknownConvert() { Containers::Pointer converter = _manager.instantiate("AnySceneConverter"); - std::ostringstream out; + Containers::String out; Error redirectError{&out}; CORRADE_VERIFY(!converter->convertToFile(MeshData{MeshPrimitive::Triangles, 0}, "mesh.obj")); - CORRADE_COMPARE(out.str(), "Trade::AnySceneConverter::convertToFile(): cannot determine the format of mesh.obj\n"); + CORRADE_COMPARE(out, "Trade::AnySceneConverter::convertToFile(): cannot determine the format of mesh.obj\n"); } void AnySceneConverterTest::unknownBeginEnd() { Containers::Pointer converter = _manager.instantiate("AnySceneConverter"); - std::ostringstream out; + Containers::String out; Error redirectError{&out}; CORRADE_VERIFY(!converter->beginFile("mesh.obj")); - CORRADE_COMPARE(out.str(), "Trade::AnySceneConverter::beginFile(): cannot determine the format of mesh.obj\n"); + CORRADE_COMPARE(out, "Trade::AnySceneConverter::beginFile(): cannot determine the format of mesh.obj\n"); } void AnySceneConverterTest::propagateFlagsConvert() { @@ -346,13 +344,13 @@ void AnySceneConverterTest::propagateFlagsConvert() { Containers::Pointer converter = manager.instantiate("AnySceneConverter"); converter->setFlags(SceneConverterFlag::Verbose); - std::ostringstream out; + Containers::String out; { Debug redirectOutput{&out}; CORRADE_VERIFY(converter->convertToFile(mesh, filename)); CORRADE_VERIFY(Utility::Path::exists(filename)); } - CORRADE_COMPARE(out.str(), + CORRADE_COMPARE(out, "Trade::AnySceneConverter::convertToFile(): using StanfordSceneConverter\n"); /* We tested AnySceneConverter's verbose output, but can't actually test @@ -386,7 +384,7 @@ void AnySceneConverterTest::propagateFlagsBeginEnd() { Containers::Pointer converter = manager.instantiate("AnySceneConverter"); converter->setFlags(SceneConverterFlag::Verbose); - std::ostringstream out; + Containers::String out; { Debug redirectOutput{&out}; CORRADE_VERIFY(converter->beginFile(filename)); @@ -394,7 +392,7 @@ void AnySceneConverterTest::propagateFlagsBeginEnd() { CORRADE_VERIFY(converter->add(mesh)); CORRADE_VERIFY(converter->endFile()); CORRADE_VERIFY(Utility::Path::exists(filename)); - CORRADE_COMPARE(out.str(), + CORRADE_COMPARE(out, "Trade::AnySceneConverter::beginFile(): using StanfordSceneConverter\n"); /* We tested AnySceneConverter's verbose output, but can't actually test @@ -500,13 +498,13 @@ void AnySceneConverterTest::propagateConfigurationUnknownConvert() { converter->configuration().setValue("noSuchOption", "isHere"); converter->setFlags(data.flags); - std::ostringstream out; + Containers::String out; Warning redirectWarning{&out}; CORRADE_VERIFY(converter->convertToFile(mesh, Utility::Path::join(ANYSCENECONVERTER_TEST_OUTPUT_DIR, "file.ply"))); if(data.quiet) - CORRADE_COMPARE(out.str(), ""); + CORRADE_COMPARE(out, ""); else - CORRADE_COMPARE(out.str(), "Trade::AnySceneConverter::convertToFile(): option noSuchOption not recognized by StanfordSceneConverter\n"); + CORRADE_COMPARE(out, "Trade::AnySceneConverter::convertToFile(): option noSuchOption not recognized by StanfordSceneConverter\n"); } void AnySceneConverterTest::propagateConfigurationUnknownBeginEnd() { @@ -535,7 +533,7 @@ void AnySceneConverterTest::propagateConfigurationUnknownBeginEnd() { converter->configuration().setValue("noSuchOption", "isHere"); converter->setFlags(data.flags); - std::ostringstream out; + Containers::String out; { Warning redirectWarning{&out}; CORRADE_VERIFY(converter->beginFile(Utility::Path::join(ANYSCENECONVERTER_TEST_OUTPUT_DIR, "file.ply"))); @@ -543,9 +541,9 @@ void AnySceneConverterTest::propagateConfigurationUnknownBeginEnd() { CORRADE_VERIFY(converter->add(mesh)); CORRADE_VERIFY(converter->endFile()); if(data.quiet) - CORRADE_COMPARE(out.str(), ""); + CORRADE_COMPARE(out, ""); else - CORRADE_COMPARE(out.str(), "Trade::AnySceneConverter::beginFile(): option noSuchOption not recognized by StanfordSceneConverter\n"); + CORRADE_COMPARE(out, "Trade::AnySceneConverter::beginFile(): option noSuchOption not recognized by StanfordSceneConverter\n"); } void AnySceneConverterTest::animations() { diff --git a/src/MagnumPlugins/AnySceneImporter/Test/AnySceneImporterTest.cpp b/src/MagnumPlugins/AnySceneImporter/Test/AnySceneImporterTest.cpp index 24596e4c9..2853cc383 100644 --- a/src/MagnumPlugins/AnySceneImporter/Test/AnySceneImporterTest.cpp +++ b/src/MagnumPlugins/AnySceneImporter/Test/AnySceneImporterTest.cpp @@ -24,7 +24,6 @@ DEALINGS IN THE SOFTWARE. */ -#include #include #include #include @@ -32,8 +31,7 @@ #include #include #include -#include -#include +#include #include #include "Magnum/Math/Vector3.h" @@ -49,6 +47,8 @@ #include "Magnum/Trade/TextureData.h" #ifdef MAGNUM_BUILD_DEPRECATED +#include + #define _MAGNUM_NO_DEPRECATED_MESHDATA /* So it doesn't yell here */ #define _MAGNUM_NO_DEPRECATED_OBJECTDATA @@ -230,16 +230,16 @@ void AnySceneImporterTest::detect() { Containers::Pointer importer = _manager.instantiate("AnySceneImporter"); - std::ostringstream out; + Containers::String out; Error redirectError{&out}; CORRADE_VERIFY(!importer->openFile(data.filename)); #ifndef CORRADE_PLUGINMANAGER_NO_DYNAMIC_PLUGIN_SUPPORT - CORRADE_COMPARE(out.str(), Utility::formatString( + CORRADE_COMPARE(out, Utility::format( "PluginManager::Manager::load(): plugin {0} is not static and was not found in nonexistent\n" "Trade::AnySceneImporter::openFile(): cannot load the {0} plugin\n", data.plugin)); #else - CORRADE_COMPARE(out.str(), Utility::formatString( + CORRADE_COMPARE(out, Utility::format( "PluginManager::Manager::load(): plugin {0} was not found\n" "Trade::AnySceneImporter::openFile(): cannot load the {0} plugin\n", data.plugin)); @@ -249,10 +249,10 @@ void AnySceneImporterTest::detect() { void AnySceneImporterTest::unknown() { Containers::Pointer importer = _manager.instantiate("AnySceneImporter"); - std::ostringstream out; + Containers::String out; Error redirectError{&out}; CORRADE_VERIFY(!importer->openFile("mesh.wtf")); - CORRADE_COMPARE(out.str(), "Trade::AnySceneImporter::openFile(): cannot determine the format of mesh.wtf\n"); + CORRADE_COMPARE(out, "Trade::AnySceneImporter::openFile(): cannot determine the format of mesh.wtf\n"); } void AnySceneImporterTest::propagateFlags() { @@ -271,14 +271,14 @@ void AnySceneImporterTest::propagateFlags() { Containers::Pointer importer = manager.instantiate("AnySceneImporter"); importer->setFlags(ImporterFlag::Verbose); - std::ostringstream out; + Containers::String out; { Debug redirectOutput{&out}; CORRADE_VERIFY(importer->openFile(filename)); CORRADE_VERIFY(importer->mesh(0)); } - CORRADE_COMPARE_AS(out.str(), Utility::formatString( + CORRADE_COMPARE_AS(out, Utility::format( "Trade::AnySceneImporter::openFile(): using StanfordImporter (provided by AssimpImporter)\n" "Trade::AssimpImporter: Info, T0: Load {}\n", filename), TestSuite::Compare::StringHasPrefix); @@ -338,13 +338,13 @@ void AnySceneImporterTest::propagateConfigurationUnknown() { importer->configuration().group("postprocess")->addGroup("feh")->setValue("noHereNotEither", false); importer->setFlags(data.flags); - std::ostringstream out; + Containers::String out; Warning redirectWarning{&out}; CORRADE_VERIFY(importer->openFile(Utility::Path::join(ANYSCENEIMPORTER_TEST_DIR, "per-face-colors-be.ply"))); if(data.quiet) - CORRADE_COMPARE(out.str(), ""); + CORRADE_COMPARE(out, ""); else - CORRADE_COMPARE(out.str(), + CORRADE_COMPARE(out, "Trade::AnySceneImporter::openFile(): option noSuchOption not recognized by AssimpImporter\n" "Trade::AnySceneImporter::openFile(): option postprocess/notHere not recognized by AssimpImporter\n" "Trade::AnySceneImporter::openFile(): option postprocess/feh/noHereNotEither not recognized by AssimpImporter\n"); @@ -365,10 +365,10 @@ void AnySceneImporterTest::propagateConfigurationUnknownInEmptySubgroup() { importer->configuration().group("customSceneFieldTypes")->setValue("another", "Int"); importer->configuration().group("customSceneFieldTypes")->addGroup("notFound")->setValue("noHereNotEither", false); - std::ostringstream out; + Containers::String out; Warning redirectWarning{&out}; CORRADE_VERIFY(importer->openFile(Utility::Path::join(ANYSCENEIMPORTER_TEST_DIR, "scenes.gltf"))); - CORRADE_COMPARE(out.str(), + CORRADE_COMPARE(out, /* Should not warn for values added to the empty customSceneFieldTypes group, but should warn if a subgroup is added there. This is consistent with how the magnum-*converter -i / -c options are diff --git a/src/MagnumPlugins/AnyShaderConverter/Test/AnyConverterTest.cpp b/src/MagnumPlugins/AnyShaderConverter/Test/AnyConverterTest.cpp index 36f2fd934..f2bd7a35f 100644 --- a/src/MagnumPlugins/AnyShaderConverter/Test/AnyConverterTest.cpp +++ b/src/MagnumPlugins/AnyShaderConverter/Test/AnyConverterTest.cpp @@ -24,7 +24,6 @@ DEALINGS IN THE SOFTWARE. */ -#include #include #include #include @@ -32,8 +31,7 @@ #include #include #include -#include -#include +#include #include #include "Magnum/ShaderTools/AbstractConverter.h" @@ -290,16 +288,16 @@ void AnyConverterTest::validateFile() { void AnyConverterTest::validateFilePluginLoadFailed() { Containers::Pointer converter = _manager.instantiate("AnyShaderConverter"); - std::ostringstream out; + Containers::String out; Error redirectError{&out}; CORRADE_COMPARE(converter->validateFile({}, "file.glsl"), Containers::pair(false, Containers::String{})); #ifndef CORRADE_PLUGINMANAGER_NO_DYNAMIC_PLUGIN_SUPPORT - CORRADE_COMPARE(out.str(), + CORRADE_COMPARE(out, "PluginManager::Manager::load(): plugin GlslShaderConverter is not static and was not found in nonexistent\n" "ShaderTools::AnyConverter::validateFile(): cannot load the GlslShaderConverter plugin\n"); #else - CORRADE_COMPARE(out.str(), + CORRADE_COMPARE(out, "PluginManager::Manager::load(): plugin GlslShaderConverter was not found\n" "ShaderTools::AnyConverter::validateFile(): cannot load the GlslShaderConverter plugin\n"); #endif @@ -308,11 +306,11 @@ void AnyConverterTest::validateFilePluginLoadFailed() { void AnyConverterTest::validateFileUnknown() { Containers::Pointer converter = _manager.instantiate("AnyShaderConverter"); - std::ostringstream out; + Containers::String out; Error redirectError{&out}; CORRADE_COMPARE(converter->validateFile({}, "dead.cg"), Containers::pair(false, Containers::String{})); - CORRADE_COMPARE(out.str(), "ShaderTools::AnyConverter::validateFile(): cannot determine the format of dead.cg\n"); + CORRADE_COMPARE(out, "ShaderTools::AnyConverter::validateFile(): cannot determine the format of dead.cg\n"); } void AnyConverterTest::validateFileNotSupported() { @@ -334,11 +332,11 @@ void AnyConverterTest::validateFilePreprocessNotSupported() { {"DEFINE", "hahahahah"} }); - std::ostringstream out; + Containers::String out; Error redirectError{&out}; CORRADE_COMPARE(converter->validateFile({}, Utility::Path::join(ANYSHADERCONVERTER_TEST_DIR, "file.spv")), Containers::pair(false, Containers::String{})); - CORRADE_COMPARE(out.str(), + CORRADE_COMPARE(out, "ShaderTools::AnyConverter::validateFile(): SpirvToolsShaderConverter does not support preprocessing\n"); } @@ -359,11 +357,11 @@ void AnyConverterTest::validateFilePropagateFlags() { also print the verbose info. */ converter->setFlags(ConverterFlag::Verbose|ConverterFlag::WarningAsError); - std::ostringstream out; + Containers::String out; Debug redirectDebug{&out}; CORRADE_COMPARE(converter->validateFile(Stage::Fragment, filename), Containers::pair(false, Utility::format("WARNING: {}:10: 'reserved__identifier' : identifiers containing consecutive underscores (\"__\") are reserved", filename))); - CORRADE_COMPARE(out.str(), + CORRADE_COMPARE(out, "ShaderTools::AnyConverter::validateFile(): using GlslShaderConverter (provided by GlslangShaderConverter)\n"); } @@ -383,11 +381,11 @@ void AnyConverterTest::validateFilePropagateInputVersion() { AbstractConverter::doValidateFile() with the file contents. */ converter->setInputFormat(Format::Glsl, "100"); - std::ostringstream out; + Containers::String out; Error redirectError{&out}; CORRADE_COMPARE(converter->validateFile(Stage::Fragment, Utility::Path::join(ANYSHADERCONVERTER_TEST_DIR, "file.glsl")), Containers::pair(false, Containers::String{})); - CORRADE_COMPARE(out.str(), + CORRADE_COMPARE(out, "ShaderTools::GlslangConverter::validateData(): input format version should be one of supported GLSL #version strings but got 100\n"); } @@ -407,11 +405,11 @@ void AnyConverterTest::validateFilePropagateOutputVersion() { AbstractConverter::doValidateFile() with the file contents. */ converter->setOutputFormat(Format::Glsl, "opengl4.0"); - std::ostringstream out; + Containers::String out; Error redirectError{&out}; CORRADE_COMPARE(converter->validateFile(Stage::Fragment, Utility::Path::join(ANYSHADERCONVERTER_TEST_DIR, "file.glsl")), Containers::pair(false, Containers::String{})); - CORRADE_COMPARE(out.str(), + CORRADE_COMPARE(out, "ShaderTools::GlslangConverter::validateData(): output format should be Spirv or Unspecified but got ShaderTools::Format::Glsl\n"); } @@ -483,14 +481,14 @@ void AnyConverterTest::validateFilePropagateConfigurationUnknown() { converter->setDefinitions({{"reserved__identifier", "sorry"}}); converter->setFlags(data.flags); - std::ostringstream out; + Containers::String out; Warning redirectWarning{&out}; CORRADE_COMPARE(converter->validateFile(Stage::Fragment, Utility::Path::join(ANYSHADERCONVERTER_TEST_DIR, "file.glsl")), Containers::pair(true, Containers::String{})); if(data.quiet) - CORRADE_COMPARE(out.str(), ""); + CORRADE_COMPARE(out, ""); else - CORRADE_COMPARE(out.str(), + CORRADE_COMPARE(out, "ShaderTools::AnyConverter::validateFile(): option noSuchOption not recognized by GlslangShaderConverter\n"); } @@ -519,16 +517,16 @@ void AnyConverterTest::validateDataPluginLoadFailed() { converter->setInputFormat(Format::Glsl); - std::ostringstream out; + Containers::String out; Error redirectError{&out}; CORRADE_COMPARE(converter->validateData({}, {}), Containers::pair(false, Containers::String{})); #ifndef CORRADE_PLUGINMANAGER_NO_DYNAMIC_PLUGIN_SUPPORT - CORRADE_COMPARE(out.str(), + CORRADE_COMPARE(out, "PluginManager::Manager::load(): plugin GlslShaderConverter is not static and was not found in nonexistent\n" "ShaderTools::AnyConverter::validateData(): cannot load the GlslShaderConverter plugin\n"); #else - CORRADE_COMPARE(out.str(), + CORRADE_COMPARE(out, "PluginManager::Manager::load(): plugin GlslShaderConverter was not found\n" "ShaderTools::AnyConverter::validateData(): cannot load the GlslShaderConverter plugin\n"); #endif @@ -537,11 +535,11 @@ void AnyConverterTest::validateDataPluginLoadFailed() { void AnyConverterTest::validateDataNoFormatSet() { Containers::Pointer converter = _manager.instantiate("AnyShaderConverter"); - std::ostringstream out; + Containers::String out; Error redirectError{&out}; CORRADE_COMPARE(converter->validateData({}, "dead.cg"), Containers::pair(false, Containers::String{})); - CORRADE_COMPARE(out.str(), "ShaderTools::AnyConverter::validateData(): no input format specified\n"); + CORRADE_COMPARE(out, "ShaderTools::AnyConverter::validateData(): no input format specified\n"); } void AnyConverterTest::validateDataNotSupported() { @@ -568,11 +566,11 @@ void AnyConverterTest::validateDataPreprocessNotSupported() { Containers::Optional> data = Utility::Path::read(Utility::Path::join(ANYSHADERCONVERTER_TEST_DIR, "file.spv")); CORRADE_VERIFY(data); - std::ostringstream out; + Containers::String out; Error redirectError{&out}; CORRADE_COMPARE(converter->validateData({}, *data), Containers::pair(false, Containers::String{})); - CORRADE_COMPARE(out.str(), + CORRADE_COMPARE(out, "ShaderTools::AnyConverter::validateData(): SpirvToolsShaderConverter does not support preprocessing\n"); } @@ -596,11 +594,11 @@ void AnyConverterTest::validateDataPropagateFlags() { Containers::Optional> data = Utility::Path::read(Utility::Path::join(ANYSHADERCONVERTER_TEST_DIR, "file.glsl")); CORRADE_VERIFY(data); - std::ostringstream out; + Containers::String out; Debug redirectDebug{&out}; CORRADE_COMPARE(converter->validateData(Stage::Fragment, *data), Containers::pair(false, Containers::String{"WARNING: 0:10: 'reserved__identifier' : identifiers containing consecutive underscores (\"__\") are reserved"})); - CORRADE_COMPARE(out.str(), + CORRADE_COMPARE(out, "ShaderTools::AnyConverter::validateData(): using GlslShaderConverter (provided by GlslangShaderConverter)\n"); } @@ -625,11 +623,11 @@ void AnyConverterTest::validateDataPropagateInputVersion() { Containers::Optional> data = Utility::Path::read(Utility::Path::join(ANYSHADERCONVERTER_TEST_DIR, "file.glsl")); CORRADE_VERIFY(data); - std::ostringstream out; + Containers::String out; Error redirectError{&out}; CORRADE_COMPARE(converter->validateData(Stage::Fragment, *data), Containers::pair(false, Containers::String{})); - CORRADE_COMPARE(out.str(), + CORRADE_COMPARE(out, "ShaderTools::GlslangConverter::validateData(): input format version should be one of supported GLSL #version strings but got 100\n"); } @@ -654,11 +652,11 @@ void AnyConverterTest::validateDataPropagateOutputVersion() { Containers::Optional> data = Utility::Path::read(Utility::Path::join(ANYSHADERCONVERTER_TEST_DIR, "file.glsl")); CORRADE_VERIFY(data); - std::ostringstream out; + Containers::String out; Error redirectError{&out}; CORRADE_COMPARE(converter->validateData(Stage::Fragment, *data), Containers::pair(false, Containers::String{})); - CORRADE_COMPARE(out.str(), + CORRADE_COMPARE(out, "ShaderTools::GlslangConverter::validateData(): output format should be Spirv or Unspecified but got ShaderTools::Format::Glsl\n"); } @@ -739,14 +737,14 @@ void AnyConverterTest::validateDataPropagateConfigurationUnknown() { Containers::Optional> shaderData = Utility::Path::read(Utility::Path::join(ANYSHADERCONVERTER_TEST_DIR, "file.glsl")); CORRADE_VERIFY(shaderData); - std::ostringstream out; + Containers::String out; Warning redirectWarning{&out}; CORRADE_COMPARE(converter->validateData(Stage::Fragment, *shaderData), Containers::pair(true, Containers::String{})); if(data.quiet) - CORRADE_COMPARE(out.str(), ""); + CORRADE_COMPARE(out, ""); else - CORRADE_COMPARE(out.str(), + CORRADE_COMPARE(out, "ShaderTools::AnyConverter::validateData(): option noSuchOption not recognized by GlslangShaderConverter\n"); } @@ -767,11 +765,11 @@ void AnyConverterTest::convertFileToFile() { CORRADE_VERIFY(Utility::Path::remove(outputFilename)); /* Make it print a warning so we know it's doing something */ - std::ostringstream out; + Containers::String out; Warning redirectWarning{&out}; CORRADE_VERIFY(converter->convertFileToFile(Stage::Fragment, inputFilename, outputFilename)); CORRADE_VERIFY(Utility::Path::exists(outputFilename)); - CORRADE_COMPARE(out.str(), Utility::formatString( + CORRADE_COMPARE(out, Utility::format( "ShaderTools::GlslangConverter::convertDataToData(): compilation succeeded with the following message:\n" "WARNING: {}:10: 'reserved__identifier' : identifiers containing consecutive underscores (\"__\") are reserved\n", inputFilename)); } @@ -779,15 +777,15 @@ void AnyConverterTest::convertFileToFile() { void AnyConverterTest::convertFileToFilePluginLoadFailed() { Containers::Pointer converter = _manager.instantiate("AnyShaderConverter"); - std::ostringstream out; + Containers::String out; Error redirectError{&out}; CORRADE_VERIFY(!converter->convertFileToFile({}, "file.spv", "file.glsl")); #ifndef CORRADE_PLUGINMANAGER_NO_DYNAMIC_PLUGIN_SUPPORT - CORRADE_COMPARE(out.str(), + CORRADE_COMPARE(out, "PluginManager::Manager::load(): plugin SpirvToGlslShaderConverter is not static and was not found in nonexistent\n" "ShaderTools::AnyConverter::convertFileToFile(): cannot load the SpirvToGlslShaderConverter plugin\n"); #else - CORRADE_COMPARE(out.str(), + CORRADE_COMPARE(out, "PluginManager::Manager::load(): plugin SpirvToGlslShaderConverter was not found\n" "ShaderTools::AnyConverter::convertFileToFile(): cannot load the SpirvToGlslShaderConverter plugin\n"); #endif @@ -796,19 +794,19 @@ void AnyConverterTest::convertFileToFilePluginLoadFailed() { void AnyConverterTest::convertFileToFileUnknownInput() { Containers::Pointer converter = _manager.instantiate("AnyShaderConverter"); - std::ostringstream out; + Containers::String out; Error redirectError{&out}; CORRADE_VERIFY(!converter->convertFileToFile({}, "dead.cg", "whatever.osl")); - CORRADE_COMPARE(out.str(), "ShaderTools::AnyConverter::convertFileToFile(): cannot determine the format of dead.cg\n"); + CORRADE_COMPARE(out, "ShaderTools::AnyConverter::convertFileToFile(): cannot determine the format of dead.cg\n"); } void AnyConverterTest::convertFileToFileUnknownOutput() { Containers::Pointer converter = _manager.instantiate("AnyShaderConverter"); - std::ostringstream out; + Containers::String out; Error redirectError{&out}; CORRADE_VERIFY(!converter->convertFileToFile({}, "file.spv", "whatever.osl")); - CORRADE_COMPARE(out.str(), "ShaderTools::AnyConverter::convertFileToFile(): cannot determine the format of whatever.osl\n"); + CORRADE_COMPARE(out, "ShaderTools::AnyConverter::convertFileToFile(): cannot determine the format of whatever.osl\n"); } void AnyConverterTest::convertFileToFileNotSupported() { @@ -830,20 +828,20 @@ void AnyConverterTest::convertFileToFilePreprocessNotSupported() { {"DEFINE", "hahahahah"} }); - std::ostringstream out; + Containers::String out; Error redirectError{&out}; CORRADE_VERIFY(!converter->convertFileToFile({}, Utility::Path::join(ANYSHADERCONVERTER_TEST_DIR, "file.spv"), Utility::Path::join(ANYSHADERCONVERTER_TEST_OUTPUT_DIR, "file.spvasm"))); - CORRADE_COMPARE(out.str(), + CORRADE_COMPARE(out, "ShaderTools::AnyConverter::convertFileToFile(): SpirvToolsShaderConverter does not support preprocessing\n"); /* It should fail for the flag as well */ - out.str({}); + out = {}; converter->setDefinitions({}); converter->setFlags(ConverterFlag::PreprocessOnly); CORRADE_VERIFY(!converter->convertFileToFile({}, Utility::Path::join(ANYSHADERCONVERTER_TEST_DIR, "file.spv"), Utility::Path::join(ANYSHADERCONVERTER_TEST_OUTPUT_DIR, "file.spvasm"))); - CORRADE_COMPARE(out.str(), + CORRADE_COMPARE(out, "ShaderTools::AnyConverter::convertFileToFile(): SpirvToolsShaderConverter does not support preprocessing\n"); } @@ -860,13 +858,13 @@ void AnyConverterTest::convertFileToFileDebugInfoNotSupported() { converter->setDebugInfoLevel("1"); - std::ostringstream out; + Containers::String out; Error redirectError{&out}; CORRADE_VERIFY(!converter->convertFileToFile({}, Utility::Path::join(ANYSHADERCONVERTER_TEST_DIR, "file.spv"), Utility::Path::join(ANYSHADERCONVERTER_TEST_OUTPUT_DIR, "file.spvasm"))); /** @todo it once may support that, in which case we need to find another victim */ - CORRADE_COMPARE(out.str(), + CORRADE_COMPARE(out, "ShaderTools::AnyConverter::convertFileToFile(): SpirvToolsShaderConverter does not support controlling debug info output\n"); } @@ -883,13 +881,13 @@ void AnyConverterTest::convertFileToFileOptimizationNotSupported() { converter->setOptimizationLevel("1"); - std::ostringstream out; + Containers::String out; Error redirectError{&out}; CORRADE_VERIFY(!converter->convertFileToFile({}, Utility::Path::join(ANYSHADERCONVERTER_TEST_DIR, "file.glsl"), Utility::Path::join(ANYSHADERCONVERTER_TEST_OUTPUT_DIR, "file.spv"))); /** @todo it once may support that, in which case we need to find another victim */ - CORRADE_COMPARE(out.str(), + CORRADE_COMPARE(out, "ShaderTools::AnyConverter::convertFileToFile(): GlslangShaderConverter does not support optimization\n"); } @@ -913,11 +911,11 @@ void AnyConverterTest::convertFileToFilePropagateFlags() { /* We have to supply a valid file path because the version gets checked in doConvertDataToData(), called from AbstractConverter::doConvertFileToFile() with the file contents. */ - std::ostringstream out; + Containers::String out; Debug redirectDebug{&out}; Error redirectError{&out}; CORRADE_VERIFY(!converter->convertFileToFile(Stage::Fragment, filename, Utility::Path::join(ANYSHADERCONVERTER_TEST_OUTPUT_DIR, "file.spv"))); - CORRADE_COMPARE(out.str(), Utility::formatString( + CORRADE_COMPARE(out, Utility::format( "ShaderTools::AnyConverter::convertFileToFile(): using GlslToSpirvShaderConverter (provided by GlslangShaderConverter)\n" "ShaderTools::GlslangConverter::convertDataToData(): compilation failed:\n" "WARNING: {}:10: 'reserved__identifier' : identifiers containing consecutive underscores (\"__\") are reserved\n", filename)); @@ -940,10 +938,10 @@ void AnyConverterTest::convertFileToFilePropagateInputVersion() { /* We have to supply a valid file path because the version gets checked in doConvertDataToData(), called from AbstractConverter::doConvertFileToFile() with the file contents. */ - std::ostringstream out; + Containers::String out; Error redirectError{&out}; CORRADE_VERIFY(!converter->convertFileToFile(Stage::Fragment, Utility::Path::join(ANYSHADERCONVERTER_TEST_DIR, "file.glsl"), Utility::Path::join(ANYSHADERCONVERTER_TEST_OUTPUT_DIR, "file.spv"))); - CORRADE_COMPARE(out.str(), + CORRADE_COMPARE(out, "ShaderTools::GlslangConverter::convertDataToData(): input format version should be one of supported GLSL #version strings but got 100\n"); } @@ -964,10 +962,10 @@ void AnyConverterTest::convertFileToFilePropagateOutputVersion() { /* We have to supply a valid file path because the version gets checked in doConvertDataToData(), called from AbstractConverter::doConvertFileToFile() with the file contents. */ - std::ostringstream out; + Containers::String out; Error redirectError{&out}; CORRADE_VERIFY(!converter->convertFileToFile(Stage::Fragment, Utility::Path::join(ANYSHADERCONVERTER_TEST_DIR, "file.glsl"), Utility::Path::join(ANYSHADERCONVERTER_TEST_OUTPUT_DIR, "file.spv"))); - CORRADE_COMPARE(out.str(), + CORRADE_COMPARE(out, "ShaderTools::GlslangConverter::convertDataToData(): output format version target should be opengl4.5 or vulkanX.Y but got opengl4.0\n"); } @@ -996,11 +994,11 @@ void AnyConverterTest::convertFileToFilePropagatePreprocess() { CORRADE_VERIFY(Utility::Path::remove(outputFilename)); /* Make it print a warning so we know it's doing something */ - std::ostringstream out; + Containers::String out; Warning redirectWarning{&out}; CORRADE_VERIFY(converter->convertFileToFile(Stage::Fragment, inputFilename, outputFilename)); CORRADE_VERIFY(Utility::Path::exists(outputFilename)); - CORRADE_COMPARE(out.str(), Utility::formatString( + CORRADE_COMPARE(out, Utility::format( "ShaderTools::GlslangConverter::convertDataToData(): compilation succeeded with the following message:\n" "WARNING: {}:10: 'different__but_also_wrong' : identifiers containing consecutive underscores (\"__\") are reserved\n", inputFilename)); } @@ -1022,10 +1020,10 @@ void AnyConverterTest::convertFileToFilePropagateDebugInfo() { /* We have to supply a valid file path because the version gets checked in doConvertDataToData(), called from AbstractConverter::doConvertFileToFile() with the file contents. */ - std::ostringstream out; + Containers::String out; Error redirectError{&out}; CORRADE_VERIFY(!converter->convertFileToFile(Stage::Fragment, Utility::Path::join(ANYSHADERCONVERTER_TEST_DIR, "file.glsl"), Utility::Path::join(ANYSHADERCONVERTER_TEST_OUTPUT_DIR, "file.spv"))); - CORRADE_COMPARE(out.str(), + CORRADE_COMPARE(out, "ShaderTools::GlslangConverter::convertDataToData(): debug info level should be 0, 1 or empty but got 2\n"); } @@ -1046,10 +1044,10 @@ void AnyConverterTest::convertFileToFilePropagateOptimization() { /* We have to supply a valid file path because the version gets checked in doConvertDataToData(), called from AbstractConverter::doConvertFileToFile() with the file contents. */ - std::ostringstream out; + Containers::String out; Error redirectError{&out}; CORRADE_VERIFY(!converter->convertFileToFile(Stage::Fragment, Utility::Path::join(ANYSHADERCONVERTER_TEST_DIR, "file.spv"), Utility::Path::join(ANYSHADERCONVERTER_TEST_OUTPUT_DIR, "file.spv"))); - CORRADE_COMPARE(out.str(), + CORRADE_COMPARE(out, "ShaderTools::SpirvToolsConverter::convertDataToData(): optimization level should be 0, 1, s, legalizeHlsl or empty but got 2\n"); } @@ -1068,19 +1066,19 @@ void AnyConverterTest::convertFileToFilePropagateConfiguration() { Containers::String output = Utility::Path::join(ANYSHADERCONVERTER_TEST_OUTPUT_DIR, "file.spv"); { - std::ostringstream out; + Containers::String out; Error redirectError{&out}; CORRADE_VERIFY(!converter->convertFileToFile(Stage::Fragment, input, output)); - CORRADE_COMPARE(out.str(), - Utility::formatString("ShaderTools::GlslangConverter::convertDataToData(): compilation failed:\nERROR: {}:2: '#version' : must occur first in shader \nERROR: 1 compilation errors. No code generated.\n", input)); + CORRADE_COMPARE(out, + Utility::format("ShaderTools::GlslangConverter::convertDataToData(): compilation failed:\nERROR: {}:2: '#version' : must occur first in shader \nERROR: 1 compilation errors. No code generated.\n", input)); } { converter->configuration().setValue("permissive", true); /* Lol stupid thing, apparently it has two differently worded messages for the same thing? Dumpster fire. */ - std::ostringstream out; + Containers::String out; Warning redirectWarning{&out}; CORRADE_VERIFY(converter->convertFileToFile(Stage::Fragment, input, output)); - CORRADE_COMPARE(out.str(), + CORRADE_COMPARE(out, "ShaderTools::GlslangConverter::convertDataToData(): compilation succeeded with the following message:\nWARNING: 0:0: '#version' : Illegal to have non-comment, non-whitespace tokens before #version\n"); } } @@ -1103,13 +1101,13 @@ void AnyConverterTest::convertFileToFilePropagateConfigurationUnknown() { converter->setDefinitions({{"reserved__identifier", "sorry"}}); converter->setFlags(data.flags); - std::ostringstream out; + Containers::String out; Warning redirectWarning{&out}; CORRADE_VERIFY(converter->convertFileToFile(Stage::Fragment, Utility::Path::join(ANYSHADERCONVERTER_TEST_DIR, "file.glsl"), Utility::Path::join(ANYSHADERCONVERTER_TEST_OUTPUT_DIR, "file.glsl"))); if(data.quiet) - CORRADE_COMPARE(out.str(), ""); + CORRADE_COMPARE(out, ""); else - CORRADE_COMPARE(out.str(), + CORRADE_COMPARE(out, "ShaderTools::AnyConverter::convertFileToFile(): option noSuchOption not recognized by GlslangShaderConverter\n"); } @@ -1129,10 +1127,10 @@ void AnyConverterTest::convertFileToData() { Containers::String inputFilename = Utility::Path::join(ANYSHADERCONVERTER_TEST_DIR, "file.glsl"); /* Make it print a warning so we know it's doing something */ - std::ostringstream out; + Containers::String out; Warning redirectWarning{&out}; CORRADE_VERIFY(converter->convertFileToData(Stage::Fragment, inputFilename)); - CORRADE_COMPARE(out.str(), Utility::formatString( + CORRADE_COMPARE(out, Utility::format( "ShaderTools::GlslangConverter::convertDataToData(): compilation succeeded with the following message:\n" "WARNING: {}:10: 'reserved__identifier' : identifiers containing consecutive underscores (\"__\") are reserved\n", inputFilename)); } @@ -1142,15 +1140,15 @@ void AnyConverterTest::convertFileToDataPluginLoadFailed() { converter->setOutputFormat(Format::Wgsl); - std::ostringstream out; + Containers::String out; Error redirectError{&out}; CORRADE_VERIFY(!converter->convertFileToData({}, "file.spv")); #ifndef CORRADE_PLUGINMANAGER_NO_DYNAMIC_PLUGIN_SUPPORT - CORRADE_COMPARE(out.str(), + CORRADE_COMPARE(out, "PluginManager::Manager::load(): plugin SpirvToWgslShaderConverter is not static and was not found in nonexistent\n" "ShaderTools::AnyConverter::convertFileToData(): cannot load the SpirvToWgslShaderConverter plugin\n"); #else - CORRADE_COMPARE(out.str(), + CORRADE_COMPARE(out, "PluginManager::Manager::load(): plugin SpirvToWgslShaderConverter was not found\n" "ShaderTools::AnyConverter::convertFileToData(): cannot load the SpirvToWgslShaderConverter plugin\n"); #endif @@ -1159,19 +1157,19 @@ void AnyConverterTest::convertFileToDataPluginLoadFailed() { void AnyConverterTest::convertFileToDataUnknown() { Containers::Pointer converter = _manager.instantiate("AnyShaderConverter"); - std::ostringstream out; + Containers::String out; Error redirectError{&out}; CORRADE_VERIFY(!converter->convertFileToData({}, "dead.cg")); - CORRADE_COMPARE(out.str(), "ShaderTools::AnyConverter::convertFileToData(): cannot determine the format of dead.cg\n"); + CORRADE_COMPARE(out, "ShaderTools::AnyConverter::convertFileToData(): cannot determine the format of dead.cg\n"); } void AnyConverterTest::convertFileToDataNoFormatSet() { Containers::Pointer converter = _manager.instantiate("AnyShaderConverter"); - std::ostringstream out; + Containers::String out; Error redirectError{&out}; CORRADE_VERIFY(!converter->convertFileToData({}, "file.spv")); - CORRADE_COMPARE(out.str(), "ShaderTools::AnyConverter::convertFileToData(): no output format specified\n"); + CORRADE_COMPARE(out, "ShaderTools::AnyConverter::convertFileToData(): no output format specified\n"); } void AnyConverterTest::convertFileToDataNotSupported() { @@ -1195,18 +1193,18 @@ void AnyConverterTest::convertFileToDataPreprocessNotSupported() { {"DEFINE", "hahahahah"} }); - std::ostringstream out; + Containers::String out; Error redirectError{&out}; CORRADE_VERIFY(!converter->convertFileToData({}, Utility::Path::join(ANYSHADERCONVERTER_TEST_DIR, "file.spv"))); - CORRADE_COMPARE(out.str(), + CORRADE_COMPARE(out, "ShaderTools::AnyConverter::convertFileToData(): SpirvToolsShaderConverter does not support preprocessing\n"); /* It should fail for the flag as well */ - out.str({}); + out = {}; converter->setDefinitions({}); converter->setFlags(ConverterFlag::PreprocessOnly); CORRADE_VERIFY(!converter->convertFileToData({}, Utility::Path::join(ANYSHADERCONVERTER_TEST_DIR, "file.spv"))); - CORRADE_COMPARE(out.str(), + CORRADE_COMPARE(out, "ShaderTools::AnyConverter::convertFileToData(): SpirvToolsShaderConverter does not support preprocessing\n"); } @@ -1225,12 +1223,12 @@ void AnyConverterTest::convertFileToDataDebugInfoNotSupported() { converter->setDebugInfoLevel("1"); - std::ostringstream out; + Containers::String out; Error redirectError{&out}; CORRADE_VERIFY(!converter->convertFileToData({}, Utility::Path::join(ANYSHADERCONVERTER_TEST_DIR, "file.spv"))); /** @todo it once may support that, in which case we need to find another victim */ - CORRADE_COMPARE(out.str(), + CORRADE_COMPARE(out, "ShaderTools::AnyConverter::convertFileToData(): SpirvToolsShaderConverter does not support controlling debug info output\n"); } @@ -1249,12 +1247,12 @@ void AnyConverterTest::convertFileToDataOptimizationNotSupported() { converter->setOptimizationLevel("1"); - std::ostringstream out; + Containers::String out; Error redirectError{&out}; CORRADE_VERIFY(!converter->convertFileToData({}, Utility::Path::join(ANYSHADERCONVERTER_TEST_DIR, "file.glsl"))); /** @todo it once may support that, in which case we need to find another victim */ - CORRADE_COMPARE(out.str(), + CORRADE_COMPARE(out, "ShaderTools::AnyConverter::convertFileToData(): GlslangShaderConverter does not support optimization\n"); } @@ -1280,11 +1278,11 @@ void AnyConverterTest::convertFileToDataPropagateFlags() { /* We have to supply a valid file path because the version gets checked in doConvertDataToData(), called from AbstractConverter::doConvertFileToFile() with the file contents. */ - std::ostringstream out; + Containers::String out; Debug redirectDebug{&out}; Error redirectError{&out}; CORRADE_VERIFY(!converter->convertFileToData(Stage::Fragment, filename)); - CORRADE_COMPARE(out.str(), Utility::formatString( + CORRADE_COMPARE(out, Utility::format( "ShaderTools::AnyConverter::convertFileToData(): using GlslToSpirvShaderConverter (provided by GlslangShaderConverter)\n" "ShaderTools::GlslangConverter::convertDataToData(): compilation failed:\n" "WARNING: {}:10: 'reserved__identifier' : identifiers containing consecutive underscores (\"__\") are reserved\n", filename)); @@ -1309,10 +1307,10 @@ void AnyConverterTest::convertFileToDataPropagateInputVersion() { /* We have to supply a valid file path because the version gets checked in doConvertDataToData(), called from AbstractConverter::doConvertFileToFile() with the file contents. */ - std::ostringstream out; + Containers::String out; Error redirectError{&out}; CORRADE_VERIFY(!converter->convertFileToData(Stage::Fragment, Utility::Path::join(ANYSHADERCONVERTER_TEST_DIR, "file.glsl"))); - CORRADE_COMPARE(out.str(), + CORRADE_COMPARE(out, "ShaderTools::GlslangConverter::convertDataToData(): input format version should be one of supported GLSL #version strings but got 100\n"); } @@ -1333,10 +1331,10 @@ void AnyConverterTest::convertFileToDataPropagateOutputVersion() { /* We have to supply a valid file path because the version gets checked in doConvertDataToData(), called from AbstractConverter::doConvertFileToFile() with the file contents. */ - std::ostringstream out; + Containers::String out; Error redirectError{&out}; CORRADE_VERIFY(!converter->convertFileToData(Stage::Fragment, Utility::Path::join(ANYSHADERCONVERTER_TEST_DIR, "file.glsl"))); - CORRADE_COMPARE(out.str(), + CORRADE_COMPARE(out, "ShaderTools::GlslangConverter::convertDataToData(): output format version target should be opengl4.5 or vulkanX.Y but got opengl4.0\n"); } @@ -1364,10 +1362,10 @@ void AnyConverterTest::convertFileToDataPropagatePreprocess() { Containers::String inputFilename = Utility::Path::join(ANYSHADERCONVERTER_TEST_DIR, "file.glsl"); /* Make it print a warning so we know it's doing something */ - std::ostringstream out; + Containers::String out; Warning redirectWarning{&out}; CORRADE_VERIFY(converter->convertFileToData(Stage::Fragment, inputFilename)); - CORRADE_COMPARE(out.str(), Utility::formatString( + CORRADE_COMPARE(out, Utility::format( "ShaderTools::GlslangConverter::convertDataToData(): compilation succeeded with the following message:\n" "WARNING: {}:10: 'different__but_also_wrong' : identifiers containing consecutive underscores (\"__\") are reserved\n", inputFilename)); } @@ -1391,10 +1389,10 @@ void AnyConverterTest::convertFileToDataPropagateDebugInfo() { /* We have to supply a valid file path because the version gets checked in doConvertDataToData(), called from AbstractConverter::doConvertFileToFile() with the file contents. */ - std::ostringstream out; + Containers::String out; Error redirectError{&out}; CORRADE_VERIFY(!converter->convertFileToData(Stage::Fragment, Utility::Path::join(ANYSHADERCONVERTER_TEST_DIR, "file.glsl"))); - CORRADE_COMPARE(out.str(), + CORRADE_COMPARE(out, "ShaderTools::GlslangConverter::convertDataToData(): debug info level should be 0, 1 or empty but got 2\n"); } @@ -1417,10 +1415,10 @@ void AnyConverterTest::convertFileToDataPropagateOptimization() { /* We have to supply a valid file path because the version gets checked in doConvertDataToData(), called from AbstractConverter::doConvertFileToFile() with the file contents. */ - std::ostringstream out; + Containers::String out; Error redirectError{&out}; CORRADE_VERIFY(!converter->convertFileToData(Stage::Fragment, Utility::Path::join(ANYSHADERCONVERTER_TEST_DIR, "file.spv"))); - CORRADE_COMPARE(out.str(), + CORRADE_COMPARE(out, "ShaderTools::SpirvToolsConverter::convertDataToData(): optimization level should be 0, 1, s, legalizeHlsl or empty but got 2\n"); } @@ -1440,19 +1438,19 @@ void AnyConverterTest::convertFileToDataPropagateConfiguration() { Containers::String input = Utility::Path::join(ANYSHADERCONVERTER_TEST_DIR, "version-not-first.glsl"); { - std::ostringstream out; + Containers::String out; Error redirectError{&out}; CORRADE_VERIFY(!converter->convertFileToData(Stage::Fragment, input)); - CORRADE_COMPARE(out.str(), - Utility::formatString("ShaderTools::GlslangConverter::convertDataToData(): compilation failed:\nERROR: {}:2: '#version' : must occur first in shader \nERROR: 1 compilation errors. No code generated.\n", input)); + CORRADE_COMPARE(out, + Utility::format("ShaderTools::GlslangConverter::convertDataToData(): compilation failed:\nERROR: {}:2: '#version' : must occur first in shader \nERROR: 1 compilation errors. No code generated.\n", input)); } { converter->configuration().setValue("permissive", true); /* Lol stupid thing, apparently it has two differently worded messages for the same thing? Dumpster fire. */ - std::ostringstream out; + Containers::String out; Warning redirectWarning{&out}; CORRADE_VERIFY(converter->convertFileToData(Stage::Fragment, input)); - CORRADE_COMPARE(out.str(), + CORRADE_COMPARE(out, "ShaderTools::GlslangConverter::convertDataToData(): compilation succeeded with the following message:\nWARNING: 0:0: '#version' : Illegal to have non-comment, non-whitespace tokens before #version\n"); } } @@ -1476,13 +1474,13 @@ void AnyConverterTest::convertFileToDataPropagateConfigurationUnknown() { converter->setDefinitions({{"reserved__identifier", "sorry"}}); converter->setFlags(data.flags); - std::ostringstream out; + Containers::String out; Warning redirectWarning{&out}; CORRADE_VERIFY(converter->convertFileToData(Stage::Fragment, Utility::Path::join(ANYSHADERCONVERTER_TEST_DIR, "file.glsl"))); if(data.quiet) - CORRADE_COMPARE(out.str(), ""); + CORRADE_COMPARE(out, ""); else - CORRADE_COMPARE(out.str(), + CORRADE_COMPARE(out, "ShaderTools::AnyConverter::convertFileToData(): option noSuchOption not recognized by GlslangShaderConverter\n"); } @@ -1504,10 +1502,10 @@ void AnyConverterTest::convertDataToData() { CORRADE_VERIFY(data); /* Make it print a warning so we know it's doing something */ - std::ostringstream out; + Containers::String out; Warning redirectWarning{&out}; CORRADE_VERIFY(converter->convertDataToData(Stage::Fragment, *data)); - CORRADE_COMPARE(out.str(), + CORRADE_COMPARE(out, "ShaderTools::GlslangConverter::convertDataToData(): compilation succeeded with the following message:\n" "WARNING: 0:10: 'reserved__identifier' : identifiers containing consecutive underscores (\"__\") are reserved\n"); } @@ -1518,15 +1516,15 @@ void AnyConverterTest::convertDataToDataPluginLoadFailed() { converter->setInputFormat(Format::Hlsl); converter->setOutputFormat(Format::Wgsl); - std::ostringstream out; + Containers::String out; Error redirectError{&out}; CORRADE_VERIFY(!converter->convertDataToData({}, {})); #ifndef CORRADE_PLUGINMANAGER_NO_DYNAMIC_PLUGIN_SUPPORT - CORRADE_COMPARE(out.str(), + CORRADE_COMPARE(out, "PluginManager::Manager::load(): plugin HlslToWgslShaderConverter is not static and was not found in nonexistent\n" "ShaderTools::AnyConverter::convertDataToData(): cannot load the HlslToWgslShaderConverter plugin\n"); #else - CORRADE_COMPARE(out.str(), + CORRADE_COMPARE(out, "PluginManager::Manager::load(): plugin HlslToWgslShaderConverter was not found\n" "ShaderTools::AnyConverter::convertDataToData(): cannot load the HlslToWgslShaderConverter plugin\n"); #endif @@ -1535,10 +1533,10 @@ void AnyConverterTest::convertDataToDataPluginLoadFailed() { void AnyConverterTest::convertDataToDataNoInputFormatSet() { Containers::Pointer converter = _manager.instantiate("AnyShaderConverter"); - std::ostringstream out; + Containers::String out; Error redirectError{&out}; CORRADE_VERIFY(!converter->convertDataToData({}, {})); - CORRADE_COMPARE(out.str(), "ShaderTools::AnyConverter::convertDataToData(): no input format specified\n"); + CORRADE_COMPARE(out, "ShaderTools::AnyConverter::convertDataToData(): no input format specified\n"); } void AnyConverterTest::convertDataToDataNoOutputFormatSet() { @@ -1546,10 +1544,10 @@ void AnyConverterTest::convertDataToDataNoOutputFormatSet() { converter->setInputFormat(Format::Spirv); - std::ostringstream out; + Containers::String out; Error redirectError{&out}; CORRADE_VERIFY(!converter->convertDataToData({}, {})); - CORRADE_COMPARE(out.str(), "ShaderTools::AnyConverter::convertDataToData(): no output format specified\n"); + CORRADE_COMPARE(out, "ShaderTools::AnyConverter::convertDataToData(): no output format specified\n"); } void AnyConverterTest::convertDataToDataNotSupported() { @@ -1577,18 +1575,18 @@ void AnyConverterTest::convertDataToDataPreprocessNotSupported() { Containers::Optional> data = Utility::Path::read(Utility::Path::join(ANYSHADERCONVERTER_TEST_DIR, "file.spv")); CORRADE_VERIFY(data); - std::ostringstream out; + Containers::String out; Error redirectError{&out}; CORRADE_VERIFY(!converter->convertDataToData({}, *data)); - CORRADE_COMPARE(out.str(), + CORRADE_COMPARE(out, "ShaderTools::AnyConverter::convertDataToData(): SpirvToolsShaderConverter does not support preprocessing\n"); /* It should fail for the flag as well */ - out.str({}); + out = {}; converter->setDefinitions({}); converter->setFlags(ConverterFlag::PreprocessOnly); CORRADE_VERIFY(!converter->convertDataToData({}, *data)); - CORRADE_COMPARE(out.str(), + CORRADE_COMPARE(out, "ShaderTools::AnyConverter::convertDataToData(): SpirvToolsShaderConverter does not support preprocessing\n"); } @@ -1611,12 +1609,12 @@ void AnyConverterTest::convertDataToDataDebugInfoNotSupported() { Containers::Optional> data = Utility::Path::read(Utility::Path::join(ANYSHADERCONVERTER_TEST_DIR, "file.spv")); CORRADE_VERIFY(data); - std::ostringstream out; + Containers::String out; Error redirectError{&out}; CORRADE_VERIFY(!converter->convertDataToData({}, *data)); /** @todo it once may support that, in which case we need to find another victim */ - CORRADE_COMPARE(out.str(), + CORRADE_COMPARE(out, "ShaderTools::AnyConverter::convertDataToData(): SpirvToolsShaderConverter does not support controlling debug info output\n"); } @@ -1639,12 +1637,12 @@ void AnyConverterTest::convertDataToDataOptimizationNotSupported() { Containers::Optional> data = Utility::Path::read(Utility::Path::join(ANYSHADERCONVERTER_TEST_DIR, "file.glsl")); CORRADE_VERIFY(data); - std::ostringstream out; + Containers::String out; Error redirectError{&out}; CORRADE_VERIFY(!converter->convertDataToData({}, *data)); /** @todo it once may support that, in which case we need to find another victim */ - CORRADE_COMPARE(out.str(), + CORRADE_COMPARE(out, "ShaderTools::AnyConverter::convertDataToData(): GlslangShaderConverter does not support optimization\n"); } @@ -1672,11 +1670,11 @@ void AnyConverterTest::convertDataToDataPropagateFlags() { /* We have to supply a valid file path because the version gets checked in doConvertDataToData(), called from AbstractConverter::doConvertFileToFile() with the file contents. */ - std::ostringstream out; + Containers::String out; Debug redirectDebug{&out}; Error redirectError{&out}; CORRADE_VERIFY(!converter->convertDataToData(Stage::Fragment, *data)); - CORRADE_COMPARE(out.str(), + CORRADE_COMPARE(out, "ShaderTools::AnyConverter::convertDataToData(): using GlslToSpirvShaderConverter (provided by GlslangShaderConverter)\n" "ShaderTools::GlslangConverter::convertDataToData(): compilation failed:\n" "WARNING: 0:10: 'reserved__identifier' : identifiers containing consecutive underscores (\"__\") are reserved\n"); @@ -1704,10 +1702,10 @@ void AnyConverterTest::convertDataToDataPropagateInputVersion() { /* We have to supply a valid file path because the version gets checked in doConvertDataToData(), called from AbstractConverter::doConvertFileToFile() with the file contents. */ - std::ostringstream out; + Containers::String out; Error redirectError{&out}; CORRADE_VERIFY(!converter->convertDataToData(Stage::Fragment, *data)); - CORRADE_COMPARE(out.str(), + CORRADE_COMPARE(out, "ShaderTools::GlslangConverter::convertDataToData(): input format version should be one of supported GLSL #version strings but got 100\n"); } @@ -1733,10 +1731,10 @@ void AnyConverterTest::convertDataToDataPropagateOutputVersion() { /* We have to supply a valid file path because the version gets checked in doConvertDataToData(), called from AbstractConverter::doConvertFileToFile() with the file contents. */ - std::ostringstream out; + Containers::String out; Error redirectError{&out}; CORRADE_VERIFY(!converter->convertDataToData(Stage::Fragment, *data)); - CORRADE_COMPARE(out.str(), + CORRADE_COMPARE(out, "ShaderTools::GlslangConverter::convertDataToData(): output format version target should be opengl4.5 or vulkanX.Y but got opengl4.0\n"); } @@ -1766,10 +1764,10 @@ void AnyConverterTest::convertDataToDataPropagatePreprocess() { CORRADE_VERIFY(data); /* Make it print a warning so we know it's doing something */ - std::ostringstream out; + Containers::String out; Warning redirectWarning{&out}; CORRADE_VERIFY(converter->convertDataToData(Stage::Fragment, *data)); - CORRADE_COMPARE(out.str(), + CORRADE_COMPARE(out, "ShaderTools::GlslangConverter::convertDataToData(): compilation succeeded with the following message:\n" "WARNING: 0:10: 'different__but_also_wrong' : identifiers containing consecutive underscores (\"__\") are reserved\n"); } @@ -1797,10 +1795,10 @@ void AnyConverterTest::convertDataToDataPropagateDebugInfo() { /* We have to supply a valid file path because the version gets checked in doConvertDataToData(), called from AbstractConverter::doConvertFileToFile() with the file contents. */ - std::ostringstream out; + Containers::String out; Error redirectError{&out}; CORRADE_VERIFY(!converter->convertDataToData(Stage::Fragment, *data)); - CORRADE_COMPARE(out.str(), + CORRADE_COMPARE(out, "ShaderTools::GlslangConverter::convertDataToData(): debug info level should be 0, 1 or empty but got 2\n"); } @@ -1827,10 +1825,10 @@ void AnyConverterTest::convertDataToDataPropagateOptimization() { /* We have to supply a valid file path because the version gets checked in doConvertDataToData(), called from AbstractConverter::doConvertFileToFile() with the file contents. */ - std::ostringstream out; + Containers::String out; Error redirectError{&out}; CORRADE_VERIFY(!converter->convertDataToData(Stage::Fragment, *data)); - CORRADE_COMPARE(out.str(), + CORRADE_COMPARE(out, "ShaderTools::SpirvToolsConverter::convertDataToData(): optimization level should be 0, 1, s, legalizeHlsl or empty but got 2\n"); } @@ -1852,19 +1850,19 @@ void AnyConverterTest::convertDataToDataPropagateConfiguration() { CORRADE_VERIFY(data); { - std::ostringstream out; + Containers::String out; Error redirectError{&out}; CORRADE_VERIFY(!converter->convertDataToData(Stage::Fragment, *data)); - CORRADE_COMPARE(out.str(), + CORRADE_COMPARE(out, "ShaderTools::GlslangConverter::convertDataToData(): compilation failed:\nERROR: 0:2: '#version' : must occur first in shader \nERROR: 1 compilation errors. No code generated.\n"); } { converter->configuration().setValue("permissive", true); /* Lol stupid thing, apparently it has two differently worded messages for the same thing? Dumpster fire. */ - std::ostringstream out; + Containers::String out; Warning redirectWarning{&out}; CORRADE_VERIFY(converter->convertDataToData(Stage::Fragment, *data)); - CORRADE_COMPARE(out.str(), + CORRADE_COMPARE(out, "ShaderTools::GlslangConverter::convertDataToData(): compilation succeeded with the following message:\nWARNING: 0:0: '#version' : Illegal to have non-comment, non-whitespace tokens before #version\n"); } } @@ -1892,13 +1890,13 @@ void AnyConverterTest::convertDataToDataPropagateConfigurationUnknown() { Containers::Optional> shaderData = Utility::Path::read(Utility::Path::join(ANYSHADERCONVERTER_TEST_DIR, "file.glsl")); CORRADE_VERIFY(shaderData); - std::ostringstream out; + Containers::String out; Warning redirectWarning{&out}; CORRADE_VERIFY(converter->convertDataToData(Stage::Fragment, *shaderData)); if(data.quiet) - CORRADE_COMPARE(out.str(), ""); + CORRADE_COMPARE(out, ""); else - CORRADE_COMPARE(out.str(), + CORRADE_COMPARE(out, "ShaderTools::AnyConverter::convertDataToData(): option noSuchOption not recognized by GlslangShaderConverter\n"); } @@ -1908,16 +1906,16 @@ void AnyConverterTest::detectValidate() { Containers::Pointer converter = _manager.instantiate("AnyShaderConverter"); - std::ostringstream out; + Containers::String out; Error redirectError{&out}; CORRADE_COMPARE(converter->validateFile({}, data.filename), Containers::pair(false, Containers::String{})); #ifndef CORRADE_PLUGINMANAGER_NO_DYNAMIC_PLUGIN_SUPPORT - CORRADE_COMPARE(out.str(), Utility::formatString( + CORRADE_COMPARE(out, Utility::format( "PluginManager::Manager::load(): plugin {0} is not static and was not found in nonexistent\n" "ShaderTools::AnyConverter::validateFile(): cannot load the {0} plugin\n", data.plugin)); #else - CORRADE_COMPARE(out.str(), Utility::formatString( + CORRADE_COMPARE(out, Utility::format( "PluginManager::Manager::load(): plugin {0} was not found\n" "ShaderTools::AnyConverter::validateFile(): cannot load the {0} plugin\n", data.plugin)); #endif @@ -1929,16 +1927,16 @@ void AnyConverterTest::detectValidateExplicitFormat() { /* It should pick up this format and not bother with the extension */ converter->setInputFormat(Format::Hlsl); - std::ostringstream out; + Containers::String out; Error redirectError{&out}; CORRADE_COMPARE(converter->validateFile({}, "file.spv"), Containers::pair(false, Containers::String{})); #ifndef CORRADE_PLUGINMANAGER_NO_DYNAMIC_PLUGIN_SUPPORT - CORRADE_COMPARE(out.str(), + CORRADE_COMPARE(out, "PluginManager::Manager::load(): plugin HlslShaderConverter is not static and was not found in nonexistent\n" "ShaderTools::AnyConverter::validateFile(): cannot load the HlslShaderConverter plugin\n"); #else - CORRADE_COMPARE(out.str(), + CORRADE_COMPARE(out, "PluginManager::Manager::load(): plugin HlslShaderConverter was not found\n" "ShaderTools::AnyConverter::validateFile(): cannot load the HlslShaderConverter plugin\n"); #endif @@ -1950,15 +1948,15 @@ void AnyConverterTest::detectConvert() { Containers::Pointer converter = _manager.instantiate("AnyShaderConverter"); - std::ostringstream out; + Containers::String out; Error redirectError{&out}; CORRADE_VERIFY(!converter->convertFileToFile({}, data.from, Utility::Path::join(ANYSHADERCONVERTER_TEST_OUTPUT_DIR, data.to))); #ifndef CORRADE_PLUGINMANAGER_NO_DYNAMIC_PLUGIN_SUPPORT - CORRADE_COMPARE(out.str(), Utility::formatString( + CORRADE_COMPARE(out, Utility::format( "PluginManager::Manager::load(): plugin {0} is not static and was not found in nonexistent\n" "ShaderTools::AnyConverter::convertFileToFile(): cannot load the {0} plugin\n", data.plugin)); #else - CORRADE_COMPARE(out.str(), Utility::formatString( + CORRADE_COMPARE(out, Utility::format( "PluginManager::Manager::load(): plugin {0} was not found\n" "ShaderTools::AnyConverter::convertFileToFile(): cannot load the {0} plugin\n", data.plugin)); #endif @@ -1971,15 +1969,15 @@ void AnyConverterTest::detectConvertExplicitFormat() { converter->setInputFormat(Format::Hlsl); converter->setOutputFormat(Format::Wgsl); - std::ostringstream out; + Containers::String out; Error redirectError{&out}; CORRADE_VERIFY(!converter->convertFileToFile({}, "file.spv", Utility::Path::join(ANYSHADERCONVERTER_TEST_OUTPUT_DIR, "file.glsl"))); #ifndef CORRADE_PLUGINMANAGER_NO_DYNAMIC_PLUGIN_SUPPORT - CORRADE_COMPARE(out.str(), + CORRADE_COMPARE(out, "PluginManager::Manager::load(): plugin HlslToWgslShaderConverter is not static and was not found in nonexistent\n" "ShaderTools::AnyConverter::convertFileToFile(): cannot load the HlslToWgslShaderConverter plugin\n"); #else - CORRADE_COMPARE(out.str(), + CORRADE_COMPARE(out, "PluginManager::Manager::load(): plugin HlslToWgslShaderConverter was not found\n" "ShaderTools::AnyConverter::convertFileToFile(): cannot load the HlslToWgslShaderConverter plugin\n"); #endif diff --git a/src/MagnumPlugins/MagnumFont/Test/MagnumFontGLTest.cpp b/src/MagnumPlugins/MagnumFont/Test/MagnumFontGLTest.cpp index 8476c9e29..3da1cd8db 100644 --- a/src/MagnumPlugins/MagnumFont/Test/MagnumFontGLTest.cpp +++ b/src/MagnumPlugins/MagnumFont/Test/MagnumFontGLTest.cpp @@ -24,10 +24,8 @@ DEALINGS IN THE SOFTWARE. */ -#include #include #include -#include /** @todo remove once AbstractFont is -free */ #include #include diff --git a/src/MagnumPlugins/MagnumFont/Test/MagnumFontTest.cpp b/src/MagnumPlugins/MagnumFont/Test/MagnumFontTest.cpp index 02fed61b0..041eac7db 100644 --- a/src/MagnumPlugins/MagnumFont/Test/MagnumFontTest.cpp +++ b/src/MagnumPlugins/MagnumFont/Test/MagnumFontTest.cpp @@ -24,17 +24,16 @@ DEALINGS IN THE SOFTWARE. */ -#include #include #include #include -#include /** @todo remove once AbstractFont is -free */ #include +#include #include #include #include -#include #include +#include /** @todo remove file callbacks are std::string-free */ #include "Magnum/FileCallback.h" #include "Magnum/PixelFormat.h" @@ -103,11 +102,11 @@ MagnumFontTest::MagnumFontTest() { void MagnumFontTest::nonexistent() { Containers::Pointer font = _fontManager.instantiate("MagnumFont"); - std::ostringstream out; + Containers::String out; Error redirectError{&out}; CORRADE_VERIFY(!font->openFile("nonexistent.conf", 0.0f)); /* There's an error message from Path::read() before */ - CORRADE_COMPARE_AS(out.str(), + CORRADE_COMPARE_AS(out, "\nText::AbstractFont::openFile(): cannot open file nonexistent.conf\n", TestSuite::Compare::StringHasSuffix); } @@ -328,12 +327,12 @@ void MagnumFontTest::fileCallbackImageNotFound() { return Containers::Optional>{}; }); - std::ostringstream out; + Containers::String out; Error redirectError{&out}; Containers::Optional> conf = Utility::Path::read(Utility::Path::join(MAGNUMFONT_TEST_DIR, "font.conf")); CORRADE_VERIFY(conf); CORRADE_VERIFY(!font->openData(*conf, 13.0f)); - CORRADE_COMPARE(out.str(), "Trade::AbstractImporter::openFile(): cannot open file font.tga\n"); + CORRADE_COMPARE(out, "Trade::AbstractImporter::openFile(): cannot open file font.tga\n"); } }}}} diff --git a/src/MagnumPlugins/MagnumFontConverter/Test/MagnumFontConverterTest.cpp b/src/MagnumPlugins/MagnumFontConverter/Test/MagnumFontConverterTest.cpp index 0663e6989..041181838 100644 --- a/src/MagnumPlugins/MagnumFontConverter/Test/MagnumFontConverterTest.cpp +++ b/src/MagnumPlugins/MagnumFontConverter/Test/MagnumFontConverterTest.cpp @@ -24,7 +24,7 @@ DEALINGS IN THE SOFTWARE. */ -#include +#include /** @todo remove once AbstractFontConverter is STL-free */ #include #include #include @@ -32,7 +32,6 @@ #include #include #include -#include #include #include "Magnum/Image.h" @@ -447,10 +446,10 @@ void MagnumFontConverterTest::exportFontImageProcessingGlyphCacheNoDownload() { Containers::Pointer converter = _fontConverterManager.instantiate("MagnumFontConverter"); - std::ostringstream out; + Containers::String out; Error redirectError{&out}; converter->exportFontToFile(font, cache, Utility::Path::join(MAGNUMFONTCONVERTER_TEST_WRITE_DIR, "font"), "Wave"); - CORRADE_COMPARE(out.str(), "Text::MagnumFontConverter::exportFontToData(): glyph cache has image processing but doesn't support image download\n"); + CORRADE_COMPARE(out, "Text::MagnumFontConverter::exportFontToData(): glyph cache has image processing but doesn't support image download\n"); } void MagnumFontConverterTest::exportFontArrayCache() { @@ -477,10 +476,10 @@ void MagnumFontConverterTest::exportFontArrayCache() { Containers::Pointer converter = _fontConverterManager.instantiate("MagnumFontConverter"); - std::ostringstream out; + Containers::String out; Error redirectError{&out}; converter->exportFontToFile(font, cache, Utility::Path::join(MAGNUMFONTCONVERTER_TEST_WRITE_DIR, "font"), "Wave"); - CORRADE_COMPARE(out.str(), "Text::MagnumFontConverter::exportFontToData(): exporting array glyph caches is not supported\n"); + CORRADE_COMPARE(out, "Text::MagnumFontConverter::exportFontToData(): exporting array glyph caches is not supported\n"); } void MagnumFontConverterTest::exportFontNotFoundInCache() { @@ -508,10 +507,10 @@ void MagnumFontConverterTest::exportFontNotFoundInCache() { Containers::Pointer converter = _fontConverterManager.instantiate("MagnumFontConverter"); - std::ostringstream out; + Containers::String out; Error redirectError{&out}; converter->exportFontToFile(font1, cache, Utility::Path::join(MAGNUMFONTCONVERTER_TEST_WRITE_DIR, "font"), "Wave"); - CORRADE_COMPARE(out.str(), "Text::MagnumFontConverter::exportFontToData(): font not found among 2 fonts in passed glyph cache\n"); + CORRADE_COMPARE(out, "Text::MagnumFontConverter::exportFontToData(): font not found among 2 fonts in passed glyph cache\n"); } void MagnumFontConverterTest::exportFontImageConversionFailed() { @@ -549,10 +548,10 @@ void MagnumFontConverterTest::exportFontImageConversionFailed() { Containers::Pointer converter = _fontConverterManager.instantiate("MagnumFontConverter"); - std::ostringstream out; + Containers::String out; Error redirectError{&out}; converter->exportFontToFile(font, cache, Utility::Path::join(MAGNUMFONTCONVERTER_TEST_WRITE_DIR, "font"), "Wave"); - CORRADE_COMPARE(out.str(), + CORRADE_COMPARE(out, "Trade::TgaImageConverter::convertToData(): unsupported pixel format PixelFormat::R32F\n" "Text::MagnumFontConverter::exportFontToData(): cannot create a TGA image\n"); } diff --git a/src/MagnumPlugins/ObjImporter/Test/ObjImporterTest.cpp b/src/MagnumPlugins/ObjImporter/Test/ObjImporterTest.cpp index 2ce6f32f3..ce9776abe 100644 --- a/src/MagnumPlugins/ObjImporter/Test/ObjImporterTest.cpp +++ b/src/MagnumPlugins/ObjImporter/Test/ObjImporterTest.cpp @@ -24,13 +24,11 @@ DEALINGS IN THE SOFTWARE. */ -#include #include #include #include #include -#include -#include +#include #include #include "Magnum/Mesh.h" @@ -229,10 +227,10 @@ void ObjImporterTest::empty() { CORRADE_COMPARE(importer->meshName(0), ""); CORRADE_COMPARE(importer->meshForName(""), -1); - std::ostringstream out; + Containers::String out; Error redirectError{&out}; CORRADE_VERIFY(!importer->mesh(0)); - CORRADE_COMPARE(out.str(), "Trade::ObjImporter::mesh(): incomplete position data\n"); + CORRADE_COMPARE(out, "Trade::ObjImporter::mesh(): incomplete position data\n"); } void ObjImporterTest::meshPrimitivePoints() { @@ -565,10 +563,10 @@ void ObjImporterTest::invalid() { CORRADE_COMPARE(importer->meshCount(), 1); - std::ostringstream out; + Containers::String out; Error redirectError{&out}; CORRADE_VERIFY(!importer->mesh(0)); - CORRADE_COMPARE(out.str(), Utility::formatString("Trade::ObjImporter::mesh(): {}\n", data.message)); + CORRADE_COMPARE(out, Utility::format("Trade::ObjImporter::mesh(): {}\n", data.message)); } void ObjImporterTest::invalidMixedPrimitives() { @@ -581,10 +579,10 @@ void ObjImporterTest::invalidMixedPrimitives() { /* Ensure we didn't forget to test any case */ CORRADE_COMPARE(importer->meshCount(), Containers::arraySize(InvalidMixedPrimitivesData)); - std::ostringstream out; + Containers::String out; Error redirectError{&out}; CORRADE_VERIFY(!importer->mesh(data.name)); - CORRADE_COMPARE(out.str(), Utility::formatString("Trade::ObjImporter::mesh(): {}\n", data.message)); + CORRADE_COMPARE(out, Utility::format("Trade::ObjImporter::mesh(): {}\n", data.message)); } void ObjImporterTest::invalidNumbers() { @@ -597,10 +595,10 @@ void ObjImporterTest::invalidNumbers() { /* Ensure we didn't forget to test any case */ CORRADE_COMPARE(importer->meshCount(), Containers::arraySize(InvalidNumbersData)); - std::ostringstream out; + Containers::String out; Error redirectError{&out}; CORRADE_VERIFY(!importer->mesh(data.name)); - CORRADE_COMPARE(out.str(), Utility::formatString("Trade::ObjImporter::mesh(): {}\n", data.message)); + CORRADE_COMPARE(out, Utility::format("Trade::ObjImporter::mesh(): {}\n", data.message)); } void ObjImporterTest::invalidNumberCount() { @@ -613,10 +611,10 @@ void ObjImporterTest::invalidNumberCount() { /* Ensure we didn't forget to test any case */ CORRADE_COMPARE(importer->meshCount(), Containers::arraySize(InvalidNumberCountData)); - std::ostringstream out; + Containers::String out; Error redirectError{&out}; CORRADE_VERIFY(!importer->mesh(data.name)); - CORRADE_COMPARE(out.str(), Utility::formatString("Trade::ObjImporter::mesh(): {}\n", data.message)); + CORRADE_COMPARE(out, Utility::format("Trade::ObjImporter::mesh(): {}\n", data.message)); } void ObjImporterTest::invalidInconsistentIndexTuple() { @@ -629,10 +627,10 @@ void ObjImporterTest::invalidInconsistentIndexTuple() { /* Ensure we didn't forget to test any case */ CORRADE_COMPARE(importer->meshCount(), Containers::arraySize(InvalidInconsistentIndexTupleData)); - std::ostringstream out; + Containers::String out; Error redirectError{&out}; CORRADE_VERIFY(!importer->mesh(data.name)); - CORRADE_COMPARE(out.str(), Utility::formatString("Trade::ObjImporter::mesh(): {}\n", data.message)); + CORRADE_COMPARE(out, Utility::format("Trade::ObjImporter::mesh(): {}\n", data.message)); } void ObjImporterTest::invalidIncompleteData() { @@ -645,10 +643,10 @@ void ObjImporterTest::invalidIncompleteData() { /* Ensure we didn't forget to test any case */ CORRADE_COMPARE(importer->meshCount(), Containers::arraySize(InvalidIncompleteDataData)); - std::ostringstream out; + Containers::String out; Error redirectError{&out}; CORRADE_VERIFY(!importer->mesh(data.name)); - CORRADE_COMPARE(out.str(), Utility::formatString("Trade::ObjImporter::mesh(): {}\n", data.message)); + CORRADE_COMPARE(out, Utility::format("Trade::ObjImporter::mesh(): {}\n", data.message)); } void ObjImporterTest::invalidOptionalCoordinate() { @@ -661,10 +659,10 @@ void ObjImporterTest::invalidOptionalCoordinate() { /* Ensure we didn't forget to test any case */ CORRADE_COMPARE(importer->meshCount(), Containers::arraySize(InvalidOptionalCoordinateData)); - std::ostringstream out; + Containers::String out; Error redirectError{&out}; CORRADE_VERIFY(!importer->mesh(data.name)); - CORRADE_COMPARE(out.str(), Utility::formatString("Trade::ObjImporter::mesh(): {}\n", data.message)); + CORRADE_COMPARE(out, Utility::format("Trade::ObjImporter::mesh(): {}\n", data.message)); } void ObjImporterTest::openTwice() { diff --git a/src/MagnumPlugins/TgaImageConverter/Test/TgaImageConverterTest.cpp b/src/MagnumPlugins/TgaImageConverter/Test/TgaImageConverterTest.cpp index 50f96a50c..d94b50c47 100644 --- a/src/MagnumPlugins/TgaImageConverter/Test/TgaImageConverterTest.cpp +++ b/src/MagnumPlugins/TgaImageConverter/Test/TgaImageConverterTest.cpp @@ -24,7 +24,6 @@ DEALINGS IN THE SOFTWARE. */ -#include #include #include #include @@ -32,8 +31,7 @@ #include #include #include -#include /** @todo remove once Debug is stream-free */ -#include +#include #include #include "Magnum/ImageView.h" @@ -327,10 +325,10 @@ void TgaImageConverterTest::wrongFormat() { Containers::Pointer converter = _converterManager.instantiate("TgaImageConverter"); const char data[4]{}; - std::ostringstream out; + Containers::String out; Error redirectError{&out}; CORRADE_VERIFY(!converter->convertToData(ImageView2D{PixelFormat::RG8Unorm, {1, 1}, data})); - CORRADE_COMPARE(out.str(), "Trade::TgaImageConverter::convertToData(): unsupported pixel format PixelFormat::RG8Unorm\n"); + CORRADE_COMPARE(out, "Trade::TgaImageConverter::convertToData(): unsupported pixel format PixelFormat::RG8Unorm\n"); } /* Padded to four byte alignment (the resulting file is *not* padded) */ @@ -364,14 +362,14 @@ void TgaImageConverterTest::uncompressedRgb() { /* Disable RLE, that's tested in rle*() instead */ converter->configuration().setValue("rle", false); - std::ostringstream out; + Containers::String out; Containers::Optional> array; { Debug redirectOutput{&out}; array = converter->convertToData(OriginalRGB); } CORRADE_VERIFY(array); - CORRADE_COMPARE(out.str(), data.message24); + CORRADE_COMPARE(out, data.message24); if(!(_importerManager.loadState("TgaImporter") & PluginManager::LoadState::Loaded)) CORRADE_SKIP("TgaImporter plugin not enabled, can't test the result"); @@ -406,14 +404,14 @@ void TgaImageConverterTest::uncompressedRgba() { /* Disable RLE, that's tested in rle*() instead */ converter->configuration().setValue("rle", false); - std::ostringstream out; + Containers::String out; Containers::Optional> array; { Debug redirectOutput{&out}; array = converter->convertToData(OriginalRGBA); } CORRADE_VERIFY(array); - CORRADE_COMPARE(out.str(), data.message32); + CORRADE_COMPARE(out, data.message32); if(!(_importerManager.loadState("TgaImporter") & PluginManager::LoadState::Loaded)) CORRADE_SKIP("TgaImporter plugin not enabled, can't test the result"); @@ -620,7 +618,7 @@ void TgaImageConverterTest::rleFallbackIfLarger() { if(data.rleFallbackIfLarger) converter->configuration().setValue("rleFallbackIfLarger", *data.rleFallbackIfLarger); - std::ostringstream out; + Containers::String out; Containers::Optional> array; { Debug redirectOutput{&out}; @@ -632,7 +630,7 @@ void TgaImageConverterTest::rleFallbackIfLarger() { .exceptPrefix(sizeof(Implementation::TgaHeader)), data.expected, TestSuite::Compare::Container); - CORRADE_COMPARE(out.str(), data.message); + CORRADE_COMPARE(out, data.message); if(!(_importerManager.loadState("TgaImporter") & PluginManager::LoadState::Loaded)) CORRADE_SKIP("TgaImporter plugin not enabled, can't test the result"); @@ -659,13 +657,13 @@ void TgaImageConverterTest::unsupportedMetadata() { const char imageData[4]{}; ImageView2D image{PixelFormat::RGBA8Unorm, {1, 1}, imageData, data.imageFlags}; - std::ostringstream out; + Containers::String out; Warning redirectWarning{&out}; CORRADE_VERIFY(converter->convertToData(image)); if(!data.message) - CORRADE_COMPARE(out.str(), ""); + CORRADE_COMPARE(out, ""); else - CORRADE_COMPARE(out.str(), Utility::formatString("Trade::TgaImageConverter::convertToData(): {}\n", data.message)); + CORRADE_COMPARE(out, Utility::format("Trade::TgaImageConverter::convertToData(): {}\n", data.message)); } }}}} diff --git a/src/MagnumPlugins/TgaImporter/Test/TgaImporterTest.cpp b/src/MagnumPlugins/TgaImporter/Test/TgaImporterTest.cpp index a642894be..288007a3b 100644 --- a/src/MagnumPlugins/TgaImporter/Test/TgaImporterTest.cpp +++ b/src/MagnumPlugins/TgaImporter/Test/TgaImporterTest.cpp @@ -24,15 +24,13 @@ DEALINGS IN THE SOFTWARE. */ -#include #include #include #include #include #include #include -#include -#include +#include #include #include "Magnum/PixelFormat.h" @@ -314,12 +312,12 @@ TgaImporterTest::TgaImporterTest() { void TgaImporterTest::invalidEmpty() { Containers::Pointer importer = _manager.instantiate("TgaImporter"); - std::ostringstream out; + Containers::String out; Error redirectError{&out}; char a{}; /* Explicitly checking non-null but empty view */ CORRADE_VERIFY(!importer->openData({&a, 0})); - CORRADE_COMPARE(out.str(), "Trade::TgaImporter::openData(): the file is empty\n"); + CORRADE_COMPARE(out, "Trade::TgaImporter::openData(): the file is empty\n"); } void TgaImporterTest::invalidShort() { @@ -330,10 +328,10 @@ void TgaImporterTest::invalidShort() { CORRADE_VERIFY(importer->openData(data.data)); - std::ostringstream out; + Containers::String out; Error redirectError{&out}; CORRADE_VERIFY(!importer->image2D(0)); - CORRADE_COMPARE(out.str(), Utility::formatString("Trade::TgaImporter::image2D(): {}\n", data.message)); + CORRADE_COMPARE(out, Utility::format("Trade::TgaImporter::image2D(): {}\n", data.message)); } void TgaImporterTest::invalid() { @@ -344,10 +342,10 @@ void TgaImporterTest::invalid() { CORRADE_VERIFY(importer->openData(data.data)); - std::ostringstream out; + Containers::String out; Error redirectError{&out}; CORRADE_VERIFY(!importer->image2D(0)); - CORRADE_COMPARE(out.str(), Utility::formatString("Trade::TgaImporter::image2D(): {}\n", data.message)); + CORRADE_COMPARE(out, Utility::format("Trade::TgaImporter::image2D(): {}\n", data.message)); } void TgaImporterTest::invalidBits() { @@ -360,10 +358,10 @@ void TgaImporterTest::invalidBits() { }; CORRADE_VERIFY(importer->openData(imageData)); - std::ostringstream out; + Containers::String out; Error redirectError{&out}; CORRADE_VERIFY(!importer->image2D(0)); - CORRADE_COMPARE(out.str(), Utility::formatString("Trade::TgaImporter::image2D(): {}\n", data.message)); + CORRADE_COMPARE(out, Utility::format("Trade::TgaImporter::image2D(): {}\n", data.message)); } void TgaImporterTest::color24() { @@ -374,7 +372,7 @@ void TgaImporterTest::color24() { importer->setFlags(data.flags); CORRADE_VERIFY(importer->openData(Color24)); - std::ostringstream out; + Containers::String out; Containers::Optional image; { Debug redirectOutput{&out}; @@ -390,7 +388,7 @@ void TgaImporterTest::color24() { 5, 4, 3, 6, 5, 4, 7, 6, 5, 8, 7, 6 }), TestSuite::Compare::Container); - CORRADE_COMPARE(out.str(), data.message24); + CORRADE_COMPARE(out, data.message24); } void TgaImporterTest::color24Rle() { @@ -401,7 +399,7 @@ void TgaImporterTest::color24Rle() { importer->setFlags(data.flags); CORRADE_VERIFY(importer->openData(Color24Rle)); - std::ostringstream out; + Containers::String out; Containers::Optional image; { Debug redirectOutput{&out}; @@ -417,7 +415,7 @@ void TgaImporterTest::color24Rle() { 5, 4, 3, 6, 5, 4, 6, 5, 4, 6, 5, 4 }), TestSuite::Compare::Container); - CORRADE_COMPARE(out.str(), data.message24); + CORRADE_COMPARE(out, data.message24); } void TgaImporterTest::color32() { @@ -434,7 +432,7 @@ void TgaImporterTest::color32() { }; CORRADE_VERIFY(importer->openData(input)); - std::ostringstream out; + Containers::String out; Containers::Optional image; { Debug redirectOutput{&out}; @@ -450,7 +448,7 @@ void TgaImporterTest::color32() { 5, 4, 3, 6, 6, 5, 4, 7, 7, 6, 5, 8, 8, 7, 6, 9 }), TestSuite::Compare::Container); - CORRADE_COMPARE(out.str(), data.message32); + CORRADE_COMPARE(out, data.message32); } void TgaImporterTest::color32Rle() { @@ -471,7 +469,7 @@ void TgaImporterTest::color32Rle() { }; CORRADE_VERIFY(importer->openData(input)); - std::ostringstream out; + Containers::String out; Containers::Optional image; { Debug redirectOutput{&out}; @@ -487,7 +485,7 @@ void TgaImporterTest::color32Rle() { 5, 4, 3, 6, 6, 5, 4, 7, 7, 6, 5, 8, 8, 7, 6, 9 }), TestSuite::Compare::Container); - CORRADE_COMPARE(out.str(), data.message32); + CORRADE_COMPARE(out, data.message32); } void TgaImporterTest::grayscale8() { @@ -561,7 +559,7 @@ void TgaImporterTest::fileTooLong() { Containers::StringView{data.extra})); Containers::Optional image; - std::ostringstream out; + Containers::String out; { Warning redirectWarning{&out}; image = importer->image2D(0); @@ -577,9 +575,9 @@ void TgaImporterTest::fileTooLong() { 5, 6 }), TestSuite::Compare::Container); if(data.quiet) - CORRADE_COMPARE(out.str(), ""); + CORRADE_COMPARE(out, ""); else - CORRADE_COMPARE(out.str(), "Trade::TgaImporter::image2D(): ignoring 5 extra bytes at the end of image data\n"); + CORRADE_COMPARE(out, "Trade::TgaImporter::image2D(): ignoring 5 extra bytes at the end of image data\n"); } void TgaImporterTest::openMemory() { diff --git a/src/MagnumPlugins/WavAudioImporter/Test/WavHeaderTest.cpp b/src/MagnumPlugins/WavAudioImporter/Test/WavHeaderTest.cpp index bcdc61206..726797979 100644 --- a/src/MagnumPlugins/WavAudioImporter/Test/WavHeaderTest.cpp +++ b/src/MagnumPlugins/WavAudioImporter/Test/WavHeaderTest.cpp @@ -25,9 +25,8 @@ DEALINGS IN THE SOFTWARE. */ -#include +#include #include -#include #include "Magnum/Magnum.h" #include "MagnumPlugins/WavAudioImporter/WavHeader.h" @@ -45,10 +44,10 @@ WavHeaderTest::WavHeaderTest() { } void WavHeaderTest::debugAudioFormat() { - std::ostringstream out; + Containers::String out; Debug{&out} << Implementation::WavAudioFormat::IeeeFloat << Implementation::WavAudioFormat(0xdead); - CORRADE_COMPARE(out.str(), "Audio::WavAudioFormat::IeeeFloat Audio::WavAudioFormat(0xdead)\n"); + CORRADE_COMPARE(out, "Audio::WavAudioFormat::IeeeFloat Audio::WavAudioFormat(0xdead)\n"); } }}}} diff --git a/src/MagnumPlugins/WavAudioImporter/Test/WavImporterTest.cpp b/src/MagnumPlugins/WavAudioImporter/Test/WavImporterTest.cpp index 16d355fd5..d49487b1f 100644 --- a/src/MagnumPlugins/WavAudioImporter/Test/WavImporterTest.cpp +++ b/src/MagnumPlugins/WavAudioImporter/Test/WavImporterTest.cpp @@ -25,13 +25,12 @@ DEALINGS IN THE SOFTWARE. */ -#include +#include /** @todo remove once AbstractImporter is -free */ #include #include #include /** @todo remove once AbstractImporter is -free */ #include #include -#include #include #include "Magnum/Audio/AbstractImporter.h" @@ -134,66 +133,66 @@ WavImporterTest::WavImporterTest() { void WavImporterTest::empty() { Containers::Pointer importer = _manager.instantiate("WavAudioImporter"); - std::ostringstream out; + Containers::String out; Error redirectError{&out}; char a{}; /* Explicitly checking non-null but empty view */ CORRADE_VERIFY(!importer->openData({&a, 0})); - CORRADE_COMPARE(out.str(), "Audio::WavImporter::openData(): the file is too short: 0 bytes\n"); + CORRADE_COMPARE(out, "Audio::WavImporter::openData(): the file is too short: 0 bytes\n"); } void WavImporterTest::wrongSignature() { - std::ostringstream out; + Containers::String out; Error redirectError{&out}; Containers::Pointer importer = _manager.instantiate("WavAudioImporter"); CORRADE_VERIFY(!importer->openFile(Utility::Path::join(WAVAUDIOIMPORTER_TEST_DIR, "wrongSignature.wav"))); - CORRADE_COMPARE(out.str(), "Audio::WavImporter::openData(): the file signature is invalid\n"); + CORRADE_COMPARE(out, "Audio::WavImporter::openData(): the file signature is invalid\n"); } void WavImporterTest::unsupportedFormat() { - std::ostringstream out; + Containers::String out; Error redirectError{&out}; Containers::Pointer importer = _manager.instantiate("WavAudioImporter"); CORRADE_VERIFY(!importer->openFile(Utility::Path::join(WAVAUDIOIMPORTER_TEST_DIR, "unsupportedFormat.wav"))); - CORRADE_COMPARE(out.str(), "Audio::WavImporter::openData(): unsupported format Audio::WavAudioFormat::AdPcm\n"); + CORRADE_COMPARE(out, "Audio::WavImporter::openData(): unsupported format Audio::WavAudioFormat::AdPcm\n"); } void WavImporterTest::unsupportedChannelCount() { - std::ostringstream out; + Containers::String out; Error redirectError{&out}; Containers::Pointer importer = _manager.instantiate("WavAudioImporter"); CORRADE_VERIFY(!importer->openFile(Utility::Path::join(WAVAUDIOIMPORTER_TEST_DIR, "unsupportedChannelCount.wav"))); - CORRADE_COMPARE(out.str(), "Audio::WavImporter::openData(): PCM with unsupported channel count 6 with 8 bits per sample\n"); + CORRADE_COMPARE(out, "Audio::WavImporter::openData(): PCM with unsupported channel count 6 with 8 bits per sample\n"); } void WavImporterTest::invalidPadding() { - std::ostringstream out; + Containers::String out; Error redirectError{&out}; Containers::Pointer importer = _manager.instantiate("WavAudioImporter"); CORRADE_VERIFY(!importer->openFile(Utility::Path::join(WAVAUDIOIMPORTER_TEST_DIR, "invalidPadding.wav"))); - CORRADE_COMPARE(out.str(), "Audio::WavImporter::openData(): the file has improper size, expected 66 but got 73\n"); + CORRADE_COMPARE(out, "Audio::WavImporter::openData(): the file has improper size, expected 66 but got 73\n"); } void WavImporterTest::invalidLength() { - std::ostringstream out; + Containers::String out; Error redirectError{&out}; Containers::Pointer importer = _manager.instantiate("WavAudioImporter"); CORRADE_VERIFY(!importer->openFile(Utility::Path::join(WAVAUDIOIMPORTER_TEST_DIR, "invalidLength.wav"))); - CORRADE_COMPARE(out.str(), "Audio::WavImporter::openData(): the file has improper size, expected 160844 but got 80444\n"); + CORRADE_COMPARE(out, "Audio::WavImporter::openData(): the file has improper size, expected 160844 but got 80444\n"); } void WavImporterTest::invalidDataChunk() { - std::ostringstream out; + Containers::String out; Error redirectError{&out}; Containers::Pointer importer = _manager.instantiate("WavAudioImporter"); CORRADE_VERIFY(!importer->openFile(Utility::Path::join(WAVAUDIOIMPORTER_TEST_DIR, "invalidDataChunk.wav"))); - CORRADE_COMPARE(out.str(), "Audio::WavImporter::openData(): the file contains no data chunk\n"); + CORRADE_COMPARE(out, "Audio::WavImporter::openData(): the file contains no data chunk\n"); } void WavImporterTest::invalidFactChunk() { @@ -220,12 +219,12 @@ void WavImporterTest::zeroSamples() { } void WavImporterTest::mono4() { - std::ostringstream out; + Containers::String out; Error redirectError{&out}; Containers::Pointer importer = _manager.instantiate("WavAudioImporter"); CORRADE_VERIFY(!importer->openFile(Utility::Path::join(WAVAUDIOIMPORTER_TEST_DIR, "mono4.wav"))); - CORRADE_COMPARE(out.str(), "Audio::WavImporter::openData(): unsupported format Audio::WavAudioFormat::AdPcm\n"); + CORRADE_COMPARE(out, "Audio::WavImporter::openData(): unsupported format Audio::WavAudioFormat::AdPcm\n"); } void WavImporterTest::mono8() { @@ -304,12 +303,12 @@ void WavImporterTest::mono16BigEndian() { } void WavImporterTest::stereo4() { - std::ostringstream out; + Containers::String out; Error redirectError{&out}; Containers::Pointer importer = _manager.instantiate("WavAudioImporter"); CORRADE_VERIFY(!importer->openFile(Utility::Path::join(WAVAUDIOIMPORTER_TEST_DIR, "stereo4.wav"))); - CORRADE_COMPARE(out.str(), "Audio::WavImporter::openData(): unsupported format Audio::WavAudioFormat::AdPcm\n"); + CORRADE_COMPARE(out, "Audio::WavImporter::openData(): unsupported format Audio::WavAudioFormat::AdPcm\n"); } void WavImporterTest::stereo8() { @@ -351,12 +350,12 @@ void WavImporterTest::stereo8MuLaw() { } void WavImporterTest::stereo12() { - std::ostringstream out; + Containers::String out; Error redirectError{&out}; Containers::Pointer importer = _manager.instantiate("WavAudioImporter"); CORRADE_VERIFY(!importer->openFile(Utility::Path::join(WAVAUDIOIMPORTER_TEST_DIR, "stereo12.wav"))); - CORRADE_COMPARE(out.str(), "Audio::WavImporter::openData(): PCM with unsupported channel count 2 with 12 bits per sample\n"); + CORRADE_COMPARE(out, "Audio::WavImporter::openData(): PCM with unsupported channel count 2 with 12 bits per sample\n"); } void WavImporterTest::stereo16() { @@ -372,21 +371,21 @@ void WavImporterTest::stereo16() { } void WavImporterTest::stereo24() { - std::ostringstream out; + Containers::String out; Error redirectError{&out}; Containers::Pointer importer = _manager.instantiate("WavAudioImporter"); CORRADE_VERIFY(!importer->openFile(Utility::Path::join(WAVAUDIOIMPORTER_TEST_DIR, "stereo24.wav"))); - CORRADE_COMPARE(out.str(), "Audio::WavImporter::openData(): PCM with unsupported channel count 2 with 24 bits per sample\n"); + CORRADE_COMPARE(out, "Audio::WavImporter::openData(): PCM with unsupported channel count 2 with 24 bits per sample\n"); } void WavImporterTest::stereo32() { - std::ostringstream out; + Containers::String out; Error redirectError{&out}; Containers::Pointer importer = _manager.instantiate("WavAudioImporter"); CORRADE_VERIFY(!importer->openFile(Utility::Path::join(WAVAUDIOIMPORTER_TEST_DIR, "stereo32.wav"))); - CORRADE_COMPARE(out.str(), "Audio::WavImporter::openData(): PCM with unsupported channel count 2 with 32 bits per sample\n"); + CORRADE_COMPARE(out, "Audio::WavImporter::openData(): PCM with unsupported channel count 2 with 32 bits per sample\n"); } void WavImporterTest::mono32f() { @@ -455,21 +454,21 @@ void WavImporterTest::stereo64fBigEndian() { } void WavImporterTest::surround51Channel16() { - std::ostringstream out; + Containers::String out; Error redirectError{&out}; Containers::Pointer importer = _manager.instantiate("WavAudioImporter"); CORRADE_VERIFY(!importer->openFile(Utility::Path::join(WAVAUDIOIMPORTER_TEST_DIR, "surround51Channel16.wav"))); - CORRADE_COMPARE(out.str(), "Audio::WavImporter::openData(): unsupported format Audio::WavAudioFormat::Extensible\n"); + CORRADE_COMPARE(out, "Audio::WavImporter::openData(): unsupported format Audio::WavAudioFormat::Extensible\n"); } void WavImporterTest::surround71Channel24() { - std::ostringstream out; + Containers::String out; Error redirectError{&out}; Containers::Pointer importer = _manager.instantiate("WavAudioImporter"); CORRADE_VERIFY(!importer->openFile(Utility::Path::join(WAVAUDIOIMPORTER_TEST_DIR, "surround71Channel24.wav"))); - CORRADE_COMPARE(out.str(), "Audio::WavImporter::openData(): unsupported format Audio::WavAudioFormat::Extensible\n"); + CORRADE_COMPARE(out, "Audio::WavImporter::openData(): unsupported format Audio::WavAudioFormat::Extensible\n"); } }}}}