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

Unified Diff: tests/ImageTest.cpp

Issue 1997703003: Make SkPngCodec decode progressively. (Closed) Base URL: https://skia.googlesource.com/skia.git@foil
Patch Set: Add explanatory comment Created 4 years, 7 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
« src/codec/SkPngCodec.cpp ('K') | « tests/ColorSpaceTest.cpp ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: tests/ImageTest.cpp
diff --git a/tests/ImageTest.cpp b/tests/ImageTest.cpp
index 0922364d0fda07742188528c36c1c4ee9a028a3a..b2bf49533842785a8f5b618c0d51b349825d2c33 100644
--- a/tests/ImageTest.cpp
+++ b/tests/ImageTest.cpp
@@ -161,6 +161,10 @@ static void test_encode(skiatest::Reporter* reporter, SkImage* image) {
REPORTER_ASSERT(reporter, origEncoded->size() > 0);
sk_sp<SkImage> decoded(SkImage::MakeFromEncoded(origEncoded));
+ if (!decoded) {
+ ERRORF(reporter, "failed to decode image!");
+ return;
+ }
REPORTER_ASSERT(reporter, decoded);
assert_equal(reporter, image, nullptr, decoded.get());
@@ -518,6 +522,10 @@ static bool has_pixels(const SkPMColor pixels[], int count, SkPMColor expected)
}
static void test_read_pixels(skiatest::Reporter* reporter, SkImage* image) {
+ if (!image) {
+ ERRORF(reporter, "Failed to create image!");
+ return;
+ }
const SkPMColor expected = SkPreMultiplyColor(SK_ColorWHITE);
const SkPMColor notExpected = ~expected;
@@ -603,6 +611,10 @@ static void check_legacy_bitmap(skiatest::Reporter* reporter, const SkImage* ima
}
static void test_legacy_bitmap(skiatest::Reporter* reporter, const SkImage* image, SkImage::LegacyBitmapMode mode) {
+ if (!image) {
+ ERRORF(reporter, "Failed to create image.");
+ return;
+ }
SkBitmap bitmap;
REPORTER_ASSERT(reporter, image->asLegacyBitmap(&bitmap, mode));
check_legacy_bitmap(reporter, image, bitmap, mode);
@@ -654,6 +666,10 @@ DEF_GPUTEST_FOR_RENDERING_CONTEXTS(ImageLegacyBitmap_Gpu, reporter, ctxInfo) {
#endif
static void test_peek(skiatest::Reporter* reporter, SkImage* image, bool expectPeekSuccess) {
+ if (!image) {
+ ERRORF(reporter, "Failed to create image!");
+ return;
+ }
SkPixmap pm;
bool success = image->peekPixels(&pm);
REPORTER_ASSERT(reporter, expectPeekSuccess == success);
@@ -857,6 +873,10 @@ DEF_GPUTEST_FOR_RENDERING_CONTEXTS(DeferredTextureImage, reporter, ctxInfo) {
for (auto testCase : testCases) {
sk_sp<SkImage> image(testCase.fImageFactory());
+ if (!image) {
+ ERRORF(reporter, "Failed to create image!");
+ continue;
+ }
// This isn't currently used in the implementation, just set any old values.
SkImage::DeferredTextureImageUsageParams params;
« src/codec/SkPngCodec.cpp ('K') | « tests/ColorSpaceTest.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698