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

Unified Diff: tests/ImageTest.cpp

Issue 1997703003: Make SkPngCodec decode progressively. (Closed) Base URL: https://skia.googlesource.com/skia.git@foil
Patch Set: Rebase Created 4 years, 3 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/CodecTest.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 e53d14222c7273a66c50afd512c6a7a2760fb21c..993c3fa0f20da04f2368a62f8e729516483291ba 100644
--- a/tests/ImageTest.cpp
+++ b/tests/ImageTest.cpp
@@ -171,6 +171,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());
@@ -599,6 +603,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;
@@ -684,6 +692,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);
@@ -735,6 +747,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);
@@ -926,6 +942,11 @@ 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;
+ }
+
size_t size = image->getDeferredTextureImageData(*proxy, testCase.fParams.data(),
static_cast<int>(testCase.fParams.size()),
nullptr, SkSourceGammaTreatment::kIgnore);
« no previous file with comments | « tests/CodecTest.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698