add canCopyTo(), to preflight if copyTo can succeed. update unittests for it
git-svn-id: http://skia.googlecode.com/svn/trunk@169 2bbb7eff-a529-9590-31e7-b0007b416f81
diff --git a/tests/BitmapCopyTest.cpp b/tests/BitmapCopyTest.cpp
index 95b49ce..e54cde3 100644
--- a/tests/BitmapCopyTest.cpp
+++ b/tests/BitmapCopyTest.cpp
@@ -39,7 +39,8 @@
{ SkBitmap::kRGB_565_Config, "00101110" },
{ SkBitmap::kARGB_4444_Config, "00101110" },
{ SkBitmap::kARGB_8888_Config, "00101110" },
- { SkBitmap::kRLE_Index8_Config, "00000000" }
+// TODO: create valid RLE bitmap to test with
+ // { SkBitmap::kRLE_Index8_Config, "00101111" }
};
const int W = 20;
@@ -51,7 +52,8 @@
SkColorTable* ct = NULL;
src.setConfig(gPairs[i].fConfig, W, H);
- if (SkBitmap::kIndex8_Config == src.config()) {
+ if (SkBitmap::kIndex8_Config == src.config() ||
+ SkBitmap::kRLE_Index8_Config == src.config()) {
ct = init_ctable();
}
src.allocPixels(ct);
@@ -67,6 +69,15 @@
boolStr(success));
reporter->reportFailed(str);
}
+
+ bool canSucceed = src.canCopyTo(gPairs[j].fConfig);
+ if (success != canSucceed) {
+ SkString str;
+ str.printf("SkBitmap::copyTo from %s to %s. returned %s canCopyTo %s",
+ gConfigName[i], gConfigName[j], boolStr(success),
+ boolStr(canSucceed));
+ reporter->reportFailed(str);
+ }
if (success) {
REPORTER_ASSERT(reporter, src.width() == dst.width());