Index: tests/SerializationTest.cpp |
diff --git a/tests/SerializationTest.cpp b/tests/SerializationTest.cpp |
index ff9b342074adc1d7d8b5d54d4c7364077cda633b..a237afac95c2aedc4c288e44ebb7fecb6183828c 100644 |
--- a/tests/SerializationTest.cpp |
+++ b/tests/SerializationTest.cpp |
@@ -103,6 +103,15 @@ template<> struct SerializationUtils<SkColor> { |
} |
}; |
+template<> struct SerializationUtils<SkColor4f> { |
+ static void Write(SkWriteBuffer& writer, SkColor4f* data, uint32_t arraySize) { |
+ writer.writeColor4fArray(data, arraySize); |
+ } |
+ static bool Read(SkValidatingReadBuffer& reader, SkColor4f* data, uint32_t arraySize) { |
+ return reader.readColor4fArray(data, arraySize); |
+ } |
+}; |
+ |
template<> struct SerializationUtils<int32_t> { |
static void Write(SkWriteBuffer& writer, int32_t* data, uint32_t arraySize) { |
writer.writeIntArray(data, arraySize); |
@@ -224,7 +233,7 @@ static void TestArraySerialization(T* data, skiatest::Reporter* reporter) { |
// This should write the length (in 4 bytes) and the array |
REPORTER_ASSERT(reporter, (4 + kArraySize * sizeof(T)) == bytesWritten); |
- unsigned char dataWritten[1024]; |
+ unsigned char dataWritten[2048]; |
writer.writeToMemory(dataWritten); |
// Make sure this fails when it should |
@@ -493,6 +502,17 @@ DEF_TEST(Serialization, reporter) { |
TestArraySerialization(data, reporter); |
} |
+ // Test readColor4fArray |
+ { |
+ SkColor4f data[kArraySize] = { |
+ SkColor4f::FromColor(SK_ColorBLACK), |
+ SkColor4f::FromColor(SK_ColorWHITE), |
+ SkColor4f::FromColor(SK_ColorRED), |
+ { 1.f, 2.f, 4.f, 8.f } |
+ }; |
+ TestArraySerialization(data, reporter); |
+ } |
+ |
// Test readIntArray |
{ |
int32_t data[kArraySize] = { 1, 2, 4, 8 }; |