Browse Source

DebugTools: don't print a newline after comparison delta image.

It makes other stuff too nasty.
findsdl-include-root
Vladimír Vondruš 7 years ago
parent
commit
cb492f932a
  1. 4
      src/Magnum/DebugTools/CompareImage.cpp
  2. 15
      src/Magnum/DebugTools/Test/CompareImageTest.cpp

4
src/Magnum/DebugTools/CompareImage.cpp

@ -203,6 +203,7 @@ void printDeltaImage(Debug& out, Containers::ArrayView<const Float> deltas, cons
const Vector2i blockCount = (size + pixelsPerBlock - Vector2i{1})/pixelsPerBlock; const Vector2i blockCount = (size + pixelsPerBlock - Vector2i{1})/pixelsPerBlock;
for(std::int_fast32_t y = 0; y != blockCount.y(); ++y) { for(std::int_fast32_t y = 0; y != blockCount.y(); ++y) {
if(y) out << Debug::newline;
out << " |"; out << " |";
for(std::int_fast32_t x = 0; x != blockCount.x(); ++x) { for(std::int_fast32_t x = 0; x != blockCount.x(); ++x) {
@ -232,7 +233,7 @@ void printDeltaImage(Debug& out, Containers::ArrayView<const Float> deltas, cons
else out << Debug::nospace << std::string{c}; else out << Debug::nospace << std::string{c};
} }
out << Debug::nospace << "|" << Debug::newline; out << Debug::nospace << "|";
} }
} }
@ -654,6 +655,7 @@ void ImageComparatorBase::printMessage(TestSuite::ComparisonStatusFlags, Debug&
out << "Delta image:" << Debug::newline; out << "Delta image:" << Debug::newline;
DebugTools::Implementation::printDeltaImage(out, _state->delta, _state->expectedImage->size(), _state->max, _state->maxThreshold, _state->meanThreshold); DebugTools::Implementation::printDeltaImage(out, _state->delta, _state->expectedImage->size(), _state->max, _state->maxThreshold, _state->meanThreshold);
out << Debug::newline;
CORRADE_INTERNAL_ASSERT(_state->actualFormat == _state->expectedImage->format()); CORRADE_INTERNAL_ASSERT(_state->actualFormat == _state->expectedImage->format());
DebugTools::Implementation::printPixelDeltas(out, _state->delta, _state->actualFormat, _state->actualPixels, _state->expectedImage->pixels(), _state->maxThreshold, _state->meanThreshold, 10); DebugTools::Implementation::printPixelDeltas(out, _state->delta, _state->actualFormat, _state->actualPixels, _state->expectedImage->pixels(), _state->maxThreshold, _state->meanThreshold, 10);
} }

15
src/Magnum/DebugTools/Test/CompareImageTest.cpp

@ -383,7 +383,7 @@ void CompareImageTest::deltaImage() {
" |,::::::~~~~===+++????77IIIZZZ$$$|\n" " |,::::::~~~~===+++????77IIIZZZ$$$|\n"
" |,,,,,::::~~~===+++???777IIIZZZ$$|\n" " |,,,,,::::~~~===+++???777IIIZZZ$$|\n"
" |...,,,,:::~~~===+++??777IIIZZZ$$|\n" " |...,,,,:::~~~===+++??777IIIZZZ$$|\n"
" | ....,,:::~~~===+++???777IIZZZ$$|\n"); " | ....,,:::~~~===+++???777IIZZZ$$|");
} }
void CompareImageTest::deltaImageScaling() { void CompareImageTest::deltaImageScaling() {
@ -406,15 +406,16 @@ void CompareImageTest::deltaImageScaling() {
" |::::~~~~===+++??777IIZZZ$$00088DD|\n" " |::::~~~~===+++??777IIZZZ$$00088DD|\n"
" |,,::::~~~===++???777IIZZ$$$00888D|\n" " |,,::::~~~===++???777IIZZ$$$00888D|\n"
" |.,,,,:::~~===++???77IIZZZ$$000888|\n" " |.,,,,:::~~===++???77IIZZZ$$000888|\n"
" |...,,,::~~~==++???77IIIZZ$$000888|\n"); " |...,,,::~~~==++???77IIIZZ$$000888|");
} }
void CompareImageTest::deltaImageColors() { void CompareImageTest::deltaImageColors() {
/* Print for visual color verification */ /* Print for visual color verification */
{ {
Debug() << "Visual verification -- some letters should be yellow, some red, some white:"; Debug out;
Debug d{Debug::Flag::NoNewlineAtTheEnd}; out << "Visual verification -- some letters should be yellow, some red, some white:"
Implementation::printDeltaImage(d, DeltaRed, {3, 3}, 2.0f, 0.5f, 0.2f); << Debug::newline;
Implementation::printDeltaImage(out, DeltaRed, {3, 3}, 2.0f, 0.5f, 0.2f);
} }
std::ostringstream out; std::ostringstream out;
@ -424,7 +425,7 @@ void CompareImageTest::deltaImageColors() {
preserve image ratio */ preserve image ratio */
CORRADE_COMPARE(out.str(), CORRADE_COMPARE(out.str(),
" |.7 |\n" " |.7 |\n"
" |: ,|\n"); " |: ,|");
} }
void CompareImageTest::deltaImageSpecials() { void CompareImageTest::deltaImageSpecials() {
@ -443,7 +444,7 @@ void CompareImageTest::deltaImageSpecials() {
otherwise */ otherwise */
CORRADE_COMPARE(out.str(), CORRADE_COMPARE(out.str(),
" |MM |\n" " |MM |\n"
" |~M8|\n"); " |~M8|");
} }
void CompareImageTest::pixelDelta() { void CompareImageTest::pixelDelta() {

Loading…
Cancel
Save