Be more stringent about API failure cases in AsyncReadPixels test

Bug: skia:8962
Change-Id: I636d8d5c53a653c7b02bfe315e927c1e2fbc0ddf
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/222791
Commit-Queue: Brian Salomon <bsalomon@google.com>
Reviewed-by: Robert Phillips <robertphillips@google.com>
diff --git a/tests/ReadPixelsTest.cpp b/tests/ReadPixelsTest.cpp
index 1c5f518..062654f 100644
--- a/tests/ReadPixelsTest.cpp
+++ b/tests/ReadPixelsTest.cpp
@@ -743,7 +743,20 @@
                         if (rect.isEmpty() || !SkIRect::MakeWH(kW, kH).contains(rect)) {
                             REPORTER_ASSERT(reporter, !context.fSuceeded);
                         }
-                        if (!context.fSuceeded) {
+                        if (context.fSuceeded) {
+                            REPORTER_ASSERT(reporter, readCT != kUnknown_SkColorType &&
+                                                      !rect.isEmpty());
+                        } else {
+                            // TODO: Support reading to kGray.
+                            auto surfBounds = SkIRect::MakeWH(surf->width(), surf->height());
+                            if (readCT != kUnknown_SkColorType && readCT != kGray_8_SkColorType &&
+                                !rect.isEmpty() && surfBounds.contains(rect)) {
+                                ERRORF(reporter,
+                                       "Async read failed. Surf Color Type: %d, Read CT: %d,"
+                                       "Rect [%d, %d, %d, %d], origin: %d, CS conversion: %d\n",
+                                       surfCT, readCT, rect.fLeft, rect.fTop, rect.fRight,
+                                       rect.fBottom, origin, (bool)readCS);
+                            }
                             continue;
                         }
                         // We use a synchronous read as the source of truth.