diff options
author | Robert Phillips <robertphillips@google.com> | 2018-01-23 16:57:35 -0500 |
---|---|---|
committer | Skia Commit-Bot <skia-commit-bot@chromium.org> | 2018-01-23 22:28:35 +0000 |
commit | 78d762d1ff62a9a281bb9fcd17d424edbc3bbbcc (patch) | |
tree | 2a867a90ca4e52146dfc0618ddb4d6d0fa739b66 /tests | |
parent | 757c15402ddb3dd03f0b5f208d288164c7317499 (diff) | |
download | skqp-78d762d1ff62a9a281bb9fcd17d424edbc3bbbcc.tar.gz |
Added bullet proofing to WrappedProxyConversionTest
Change-Id: I8a3f023b2e81d0f3224022a9a5e3a37bc0b37f64
Reviewed-on: https://skia-review.googlesource.com/99041
Reviewed-by: Brian Osman <brianosman@google.com>
Commit-Queue: Robert Phillips <robertphillips@google.com>
Diffstat (limited to 'tests')
-rw-r--r-- | tests/ProxyConversionTest.cpp | 60 |
1 files changed, 32 insertions, 28 deletions
diff --git a/tests/ProxyConversionTest.cpp b/tests/ProxyConversionTest.cpp index 98ceca72bf..c8b690528f 100644 --- a/tests/ProxyConversionTest.cpp +++ b/tests/ProxyConversionTest.cpp @@ -57,50 +57,54 @@ DEF_GPUTEST_FOR_RENDERING_CONTEXTS(WrappedProxyConversionTest, reporter, ctxInfo if (kOpenGL_GrBackend == ctxInfo.backend()) { // External on-screen render target. sk_sp<GrSurfaceProxy> sProxy(make_wrapped_FBO0(proxyProvider, reporter, desc)); - - // RenderTarget-only - GrRenderTargetProxy* rtProxy = sProxy->asRenderTargetProxy(); - REPORTER_ASSERT(reporter, rtProxy); - REPORTER_ASSERT(reporter, !rtProxy->asTextureProxy()); - REPORTER_ASSERT(reporter, rtProxy->asRenderTargetProxy() == rtProxy); + if (sProxy) { + // RenderTarget-only + GrRenderTargetProxy* rtProxy = sProxy->asRenderTargetProxy(); + REPORTER_ASSERT(reporter, rtProxy); + REPORTER_ASSERT(reporter, !rtProxy->asTextureProxy()); + REPORTER_ASSERT(reporter, rtProxy->asRenderTargetProxy() == rtProxy); + } } { // Internal offscreen render target. sk_sp<GrSurfaceProxy> sProxy(make_wrapped_offscreen_rt(proxyProvider, desc)); - - // Both RenderTarget and Texture - GrRenderTargetProxy* rtProxy = sProxy->asRenderTargetProxy(); - REPORTER_ASSERT(reporter, rtProxy); - GrTextureProxy* tProxy = rtProxy->asTextureProxy(); - REPORTER_ASSERT(reporter, tProxy); - REPORTER_ASSERT(reporter, tProxy->asRenderTargetProxy() == rtProxy); - REPORTER_ASSERT(reporter, rtProxy->asRenderTargetProxy() == rtProxy); + if (sProxy) { + // Both RenderTarget and Texture + GrRenderTargetProxy* rtProxy = sProxy->asRenderTargetProxy(); + REPORTER_ASSERT(reporter, rtProxy); + GrTextureProxy* tProxy = rtProxy->asTextureProxy(); + REPORTER_ASSERT(reporter, tProxy); + REPORTER_ASSERT(reporter, tProxy->asRenderTargetProxy() == rtProxy); + REPORTER_ASSERT(reporter, rtProxy->asRenderTargetProxy() == rtProxy); + } } { // Internal offscreen render target - but through GrTextureProxy sk_sp<GrSurfaceProxy> sProxy(make_wrapped_texture(proxyProvider, desc)); - - // Both RenderTarget and Texture - GrTextureProxy* tProxy = sProxy->asTextureProxy(); - REPORTER_ASSERT(reporter, tProxy); - GrRenderTargetProxy* rtProxy = tProxy->asRenderTargetProxy(); - REPORTER_ASSERT(reporter, rtProxy); - REPORTER_ASSERT(reporter, rtProxy->asTextureProxy() == tProxy); - REPORTER_ASSERT(reporter, tProxy->asTextureProxy() == tProxy); + if (sProxy) { + // Both RenderTarget and Texture + GrTextureProxy* tProxy = sProxy->asTextureProxy(); + REPORTER_ASSERT(reporter, tProxy); + GrRenderTargetProxy* rtProxy = tProxy->asRenderTargetProxy(); + REPORTER_ASSERT(reporter, rtProxy); + REPORTER_ASSERT(reporter, rtProxy->asTextureProxy() == tProxy); + REPORTER_ASSERT(reporter, tProxy->asTextureProxy() == tProxy); + } } { desc.fFlags = kNone_GrSurfaceFlags; // force no-RT sk_sp<GrSurfaceProxy> sProxy(make_wrapped_texture(proxyProvider, desc)); - - // Texture-only - GrTextureProxy* tProxy = sProxy->asTextureProxy(); - REPORTER_ASSERT(reporter, tProxy); - REPORTER_ASSERT(reporter, tProxy->asTextureProxy() == tProxy); - REPORTER_ASSERT(reporter, !tProxy->asRenderTargetProxy()); + if (sProxy) { + // Texture-only + GrTextureProxy* tProxy = sProxy->asTextureProxy(); + REPORTER_ASSERT(reporter, tProxy); + REPORTER_ASSERT(reporter, tProxy->asTextureProxy() == tProxy); + REPORTER_ASSERT(reporter, !tProxy->asRenderTargetProxy()); + } } } |