Index: tests/SerializationTest.cpp |
diff --git a/tests/SerializationTest.cpp b/tests/SerializationTest.cpp |
index bc2770ebda0d0a9e0143a408bf115e2ceb2f7bc8..f0412ba48c9b71e7c03c3a4aee4fdd2bdc83e031 100644 |
--- a/tests/SerializationTest.cpp |
+++ b/tests/SerializationTest.cpp |
@@ -104,6 +104,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); |
@@ -225,7 +234,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 |
@@ -494,6 +503,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 }; |