aboutsummaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorRobert Phillips <robertphillips@google.com>2018-01-23 16:57:35 -0500
committerSkia Commit-Bot <skia-commit-bot@chromium.org>2018-01-23 22:28:35 +0000
commit78d762d1ff62a9a281bb9fcd17d424edbc3bbbcc (patch)
tree2a867a90ca4e52146dfc0618ddb4d6d0fa739b66 /tests
parent757c15402ddb3dd03f0b5f208d288164c7317499 (diff)
downloadskqp-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.cpp60
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());
+ }
}
}