Index: tests/SerializationTest.cpp |
diff --git a/tests/SerializationTest.cpp b/tests/SerializationTest.cpp |
index af146006e7f1975ac20bb24a971dd36e61561650..dd9b938d52e26df4d9761144db484c35a90c4b08 100644 |
--- a/tests/SerializationTest.cpp |
+++ b/tests/SerializationTest.cpp |
@@ -11,6 +11,7 @@ |
#include "SkMallocPixelRef.h" |
#include "SkOSFile.h" |
#include "SkPictureRecorder.h" |
+#include "SkTableColorFilter.h" |
#include "SkTemplates.h" |
#include "SkTypeface.h" |
#include "SkWriteBuffer.h" |
@@ -177,7 +178,7 @@ static T* TestFlattenableSerialization(T* testObj, bool shouldSucceed, |
size_t bytesWritten = writer.bytesWritten(); |
REPORTER_ASSERT(reporter, SkAlign4(bytesWritten) == bytesWritten); |
- unsigned char dataWritten[1024]; |
+ unsigned char dataWritten[4096]; |
SkASSERT(bytesWritten <= sizeof(dataWritten)); |
writer.writeToMemory(dataWritten); |
@@ -274,6 +275,16 @@ static void TestXfermodeSerialization(skiatest::Reporter* reporter) { |
} |
} |
+static void TestColorFilterSerialization(skiatest::Reporter* reporter) { |
+ uint8_t table[256]; |
+ for (int i = 0; i < 256; ++i) { |
+ table[i] = (i * 41) % 256; |
+ } |
+ SkAutoTUnref<SkColorFilter> colorFilter(SkTableColorFilter::Create(table)); |
+ SkAutoTUnref<SkColorFilter> copy( |
+ TestFlattenableSerialization<SkColorFilter>(colorFilter.get(), true, reporter)); |
+} |
+ |
static SkBitmap draw_picture(SkPicture& picture) { |
SkBitmap bitmap; |
bitmap.allocN32Pixels(SkScalarCeilToInt(picture.cullRect().width()), |
@@ -424,6 +435,11 @@ DEF_TEST(Serialization, reporter) { |
TestXfermodeSerialization(reporter); |
} |
+ // Test color filter serialization |
+ { |
+ TestColorFilterSerialization(reporter); |
+ } |
+ |
// Test string serialization |
{ |
SkString string("string"); |