Index: tests/SerializationTest.cpp |
diff --git a/tests/SerializationTest.cpp b/tests/SerializationTest.cpp |
index b6ee978869c1b7fda10f471ba2c63e70b4b3dad6..af146006e7f1975ac20bb24a971dd36e61561650 100644 |
--- a/tests/SerializationTest.cpp |
+++ b/tests/SerializationTest.cpp |
@@ -261,6 +261,19 @@ static void TestBitmapSerialization(const SkBitmap& validBitmap, |
} |
} |
+static void TestXfermodeSerialization(skiatest::Reporter* reporter) { |
+ for (size_t i = 0; i <= SkXfermode::kLastMode; ++i) { |
+ if (i == SkXfermode::kSrcOver_Mode) { |
+ // skip SrcOver, as it is allowed to return NULL from Create() |
+ continue; |
+ } |
+ SkAutoTUnref<SkXfermode> mode(SkXfermode::Create(static_cast<SkXfermode::Mode>(i))); |
+ REPORTER_ASSERT(reporter, mode.get()); |
+ SkAutoTUnref<SkXfermode> copy( |
+ TestFlattenableSerialization<SkXfermode>(mode.get(), true, reporter)); |
+ } |
+} |
+ |
static SkBitmap draw_picture(SkPicture& picture) { |
SkBitmap bitmap; |
bitmap.allocN32Pixels(SkScalarCeilToInt(picture.cullRect().width()), |
@@ -406,6 +419,11 @@ DEF_TEST(Serialization, reporter) { |
TestObjectSerialization(®ion, reporter); |
} |
+ // Test xfermode serialization |
+ { |
+ TestXfermodeSerialization(reporter); |
+ } |
+ |
// Test string serialization |
{ |
SkString string("string"); |