Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(122)

Unified Diff: tests/SerializationTest.cpp

Issue 596333002: Fix SkXfermode deserialization. (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Add comment per review. Created 6 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « src/core/SkXfermode.cpp ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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(&region, reporter);
}
+ // Test xfermode serialization
+ {
+ TestXfermodeSerialization(reporter);
+ }
+
// Test string serialization
{
SkString string("string");
« no previous file with comments | « src/core/SkXfermode.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698