diff options
Diffstat (limited to 'tests/PackedConfigsTextureTest.cpp')
-rw-r--r-- | tests/PackedConfigsTextureTest.cpp | 19 |
1 files changed, 12 insertions, 7 deletions
diff --git a/tests/PackedConfigsTextureTest.cpp b/tests/PackedConfigsTextureTest.cpp index b1fbc77977..5f18ef3d57 100644 --- a/tests/PackedConfigsTextureTest.cpp +++ b/tests/PackedConfigsTextureTest.cpp @@ -97,7 +97,7 @@ static void check_565(skiatest::Reporter* reporter, } static void run_test(skiatest::Reporter* reporter, GrContext* context, int arraySize, - GrColorType colorType) { + SkColorType colorType) { SkTDArray<uint16_t> controlPixelData; // We will read back into an 8888 buffer since 565/4444 read backs aren't supported SkTDArray<GrColor> readBuffer; @@ -113,19 +113,24 @@ static void run_test(skiatest::Reporter* reporter, GrContext* context, int array kRGBA_8888_SkColorType, kOpaque_SkAlphaType); for (auto origin : { kTopLeft_GrSurfaceOrigin, kBottomLeft_GrSurfaceOrigin }) { - auto proxy = sk_gpu_test::MakeTextureProxyFromData(context, false, DEV_W, DEV_H, colorType, + auto proxy = sk_gpu_test::MakeTextureProxyFromData(context, false, DEV_W, DEV_H, + SkColorTypeToGrColorType(colorType), origin, controlPixelData.begin(), 0); SkASSERT(proxy); sk_sp<GrSurfaceContext> sContext = context->contextPriv().makeWrappedSurfaceContext( std::move(proxy)); - SkAssertResult(sContext->readPixels(dstInfo, readBuffer.begin(), 0, 0, 0)); + if (!sContext->readPixels(dstInfo, readBuffer.begin(), 0, 0, 0)) { + // We only require this to succeed if the format is renderable. + REPORTER_ASSERT(reporter, !context->colorTypeSupportedAsSurface(colorType)); + return; + } - if (GrColorType::kABGR_4444 == colorType) { + if (kARGB_4444_SkColorType == colorType) { check_4444(reporter, controlPixelData, readBuffer); } else { - SkASSERT(GrColorType::kRGB_565 == colorType); + SkASSERT(kRGB_565_SkColorType == colorType); check_565(reporter, controlPixelData, readBuffer); } } @@ -134,11 +139,11 @@ static void run_test(skiatest::Reporter* reporter, GrContext* context, int array static const int CONTROL_ARRAY_SIZE = DEV_W * DEV_H; DEF_GPUTEST_FOR_RENDERING_CONTEXTS(RGBA4444TextureTest, reporter, ctxInfo) { - run_test(reporter, ctxInfo.grContext(), CONTROL_ARRAY_SIZE, GrColorType::kABGR_4444); + run_test(reporter, ctxInfo.grContext(), CONTROL_ARRAY_SIZE, kARGB_4444_SkColorType); } DEF_GPUTEST_FOR_RENDERING_CONTEXTS(RGB565TextureTest, reporter, ctxInfo) { - run_test(reporter, ctxInfo.grContext(), CONTROL_ARRAY_SIZE, GrColorType::kRGB_565); + run_test(reporter, ctxInfo.grContext(), CONTROL_ARRAY_SIZE, kRGB_565_SkColorType); } #endif |