Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1261)

Unified Diff: tests/ImageDecodingTest.cpp

Issue 132843002: Add REPORTF test macro. (Closed) Base URL: https://skia.googlecode.com/svn/trunk
Patch Set: factor Created 6 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « tests/GpuBitmapCopyTest.cpp ('k') | tests/MathTest.cpp » ('j') | tests/Test.h » ('J')
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: tests/ImageDecodingTest.cpp
diff --git a/tests/ImageDecodingTest.cpp b/tests/ImageDecodingTest.cpp
index c74bb35ccf43927f4e8f4544f82b5b2b7e077c50..a94fd35797df532c1cfd1b5faf0b7c336d4ce792 100644
--- a/tests/ImageDecodingTest.cpp
+++ b/tests/ImageDecodingTest.cpp
@@ -410,6 +410,23 @@ static inline const char* SkColorType_to_string(SkColorType colorType) {
}
}
+static inline const char* options_colorType(
+ const SkDecodingImageGenerator::Options& opts) {
+ if (opts.fUseRequestedColorType) {
+ return SkColorType_to_string(opts.fRequestedColorType);
+ } else {
+ return "(none)";
+ }
+}
+
+static inline const char* yn(bool value) {
+ if (value) {
+ return "yes";
+ } else {
+ return "no";
+ }
+}
+
/**
* Given either a SkStream or a SkData, try to decode the encoded
* image using the specified options and report errors.
@@ -443,13 +460,10 @@ static void test_options(skiatest::Reporter* reporter,
}
// If we get here, it's a failure and we will need more
// information about why it failed.
- reporter->reportFailed(SkStringPrintf(
- "Bounds decode failed "
- "[sampleSize=%d dither=%s colorType=%s %s] %s:%d",
- opts.fSampleSize, (opts.fDitherImage ? "yes" : "no"),
- (opts.fUseRequestedColorType
- ? SkColorType_to_string(opts.fRequestedColorType) : "(none)"),
- path.c_str(), __FILE__, __LINE__));
+ REPORTF(reporter,
+ ("Bounds decode failed [sampleSize=%d dither=%s colorType=%s"
+ " %s]", opts.fSampleSize, yn(opts.fDitherImage),
+ options_colorType(opts), path.c_str()));
return;
}
#if defined(SK_BUILD_FOR_ANDROID) || defined(SK_BUILD_FOR_UNIX)
@@ -463,13 +477,10 @@ static void test_options(skiatest::Reporter* reporter,
#endif // SK_BUILD_FOR_ANDROID || SK_BUILD_FOR_UNIX
SkAutoLockPixels alp(bm);
if (bm.getPixels() == NULL) {
- reporter->reportFailed(SkStringPrintf(
- "Pixel decode failed "
- "[sampleSize=%d dither=%s colorType=%s %s] %s:%d",
- opts.fSampleSize, (opts.fDitherImage ? "yes" : "no"),
- (opts.fUseRequestedColorType
- ? SkColorType_to_string(opts.fRequestedColorType) : "(none)"),
- path.c_str(), __FILE__, __LINE__));
+ REPORTF(reporter,
+ ("Pixel decode failed [sampleSize=%d dither=%s colorType=%s"
+ " %s]", opts.fSampleSize, yn(opts.fDitherImage),
+ options_colorType(opts), path.c_str()));
return;
}
@@ -496,14 +507,12 @@ static void test_options(skiatest::Reporter* reporter,
}
}
if (pixelErrors != 0) {
- reporter->reportFailed(SkStringPrintf(
- "Pixel-level mismatch (%d of %d) [sampleSize=%d "
- "dither=%s colorType=%s %s] %s:%d",
- pixelErrors, kExpectedHeight * kExpectedWidth,
- opts.fSampleSize, (opts.fDitherImage ? "yes" : "no"),
- (opts.fUseRequestedColorType
- ? SkColorType_to_string(opts.fRequestedColorType)
- : "(none)"), path.c_str(), __FILE__, __LINE__));
+ REPORTF(reporter,
+ ("Pixel-level mismatch (%d of %d) [sampleSize=%d "
+ "dither=%s colorType=%s %s]",
+ pixelErrors, kExpectedHeight * kExpectedWidth,
+ opts.fSampleSize, yn(opts.fDitherImage),
+ options_colorType(opts), path.c_str()));
}
}
}
« no previous file with comments | « tests/GpuBitmapCopyTest.cpp ('k') | tests/MathTest.cpp » ('j') | tests/Test.h » ('J')

Powered by Google App Engine
This is Rietveld 408576698