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>
diff --git a/tests/ProxyConversionTest.cpp b/tests/ProxyConversionTest.cpp
index 98ceca7..c8b6905 100644
--- a/tests/ProxyConversionTest.cpp
+++ b/tests/ProxyConversionTest.cpp
@@ -57,50 +57,54 @@
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());
+ }
}
}