Fix for Android ClipCache unit test crash
http://codereview.appspot.com/6199063/
git-svn-id: http://skia.googlecode.com/svn/trunk@3902 2bbb7eff-a529-9590-31e7-b0007b416f81
diff --git a/tests/ClipCacheTest.cpp b/tests/ClipCacheTest.cpp
index 41f0ef2..999dc54 100644
--- a/tests/ClipCacheTest.cpp
+++ b/tests/ClipCacheTest.cpp
@@ -14,16 +14,15 @@
////////////////////////////////////////////////////////////////////////////////
static GrTexture* createTexture(GrContext* context) {
- unsigned char textureData[X_SIZE][Y_SIZE];
+ unsigned char textureData[X_SIZE][Y_SIZE][4];
- memset(textureData, 0, X_SIZE * Y_SIZE);
+ memset(textureData, 0, 4* X_SIZE * Y_SIZE);
GrTextureDesc desc;
// let Skia know we will be using this texture as a render target
desc.fFlags = kRenderTarget_GrTextureFlagBit;
- // it is a single channel texture
- desc.fConfig = kAlpha_8_GrPixelConfig;
+ desc.fConfig = kSkia8888_PM_GrPixelConfig;
desc.fWidth = X_SIZE;
desc.fHeight = Y_SIZE;
desc.fSampleCnt = 0;
@@ -84,6 +83,11 @@
clip1.setFromRect(bound1);
SkAutoTUnref<GrTexture> texture(createTexture(context));
+ REPORTER_ASSERT(reporter, texture.get());
+
+ if (NULL == texture.get()) {
+ return;
+ }
cache.set(clip1, 128, 128, texture.get(), bound1);
@@ -144,7 +148,7 @@
////////////////////////////////////////////////////////////////////////////////
static void TestClipCache(skiatest::Reporter* reporter, GrContext* context) {
- // test_cache(reporter, context);
+ test_cache(reporter, context);
}
////////////////////////////////////////////////////////////////////////////////