| OLD | NEW |
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "cc/proto/skia_conversions.h" | 5 #include "cc/proto/skia_conversions.h" |
| 6 | 6 |
| 7 #include <stddef.h> | 7 #include <stddef.h> |
| 8 | 8 |
| 9 #include "cc/proto/skregion.pb.h" | 9 #include "cc/proto/skregion.pb.h" |
| 10 #include "cc/proto/skrrect.pb.h" | 10 #include "cc/proto/skrrect.pb.h" |
| 11 #include "cc/proto/skxfermode.pb.h" | 11 #include "cc/proto/skxfermode.pb.h" |
| 12 #include "testing/gtest/include/gtest/gtest.h" | 12 #include "testing/gtest/include/gtest/gtest.h" |
| 13 #include "third_party/skia/include/core/SkBlendMode.h" | 13 #include "third_party/skia/include/core/SkBlendMode.h" |
| 14 #include "third_party/skia/include/core/SkClipOp.h" | 14 #include "third_party/skia/include/core/SkClipOp.h" |
| 15 #include "third_party/skia/include/core/SkRRect.h" | 15 #include "third_party/skia/include/core/SkRRect.h" |
| 16 | 16 |
| 17 namespace cc { | 17 namespace cc { |
| 18 namespace { | 18 namespace { |
| 19 | 19 |
| 20 TEST(SkiaProtoConversionsTest, SerializeDeserializeSkClipOp) { | 20 TEST(SkiaProtoConversionsTest, SerializeDeserializeSkClipOp) { |
| 21 // explicitly list the clipops, as this list will be reduced overtime | 21 // explicitly list the clipops, as this list will be reduced overtime |
| 22 // as skia constricts the valid ops for clipping | 22 // as skia constricts the valid ops for clipping |
| 23 // https://bugs.chromium.org/p/skia/issues/detail?id=3191 | 23 // https://bugs.chromium.org/p/skia/issues/detail?id=3191 |
| 24 const SkClipOp ops[] = { | 24 const SkClipOp ops[] = { |
| 25 kDifference_SkClipOp, kIntersect_SkClipOp, kUnion_SkClipOp, | 25 SkClipOp::kDifference, SkClipOp::kIntersect, SkClipOp::kUnion, |
| 26 kXOR_SkClipOp, kReverseDifference_SkClipOp, kReplace_SkClipOp, | 26 SkClipOp::kXOR, SkClipOp::kReverseDifference, SkClipOp::kReplace, |
| 27 }; | 27 }; |
| 28 for (SkClipOp op : ops) { | 28 for (SkClipOp op : ops) { |
| 29 EXPECT_EQ(op, SkClipOpFromProto(SkClipOpToProto(op))); | 29 EXPECT_EQ(op, SkClipOpFromProto(SkClipOpToProto(op))); |
| 30 } | 30 } |
| 31 } | 31 } |
| 32 | 32 |
| 33 TEST(SkiaProtoConversionsTest, SerializeDeserializeSkXfermodeMode) { | 33 TEST(SkiaProtoConversionsTest, SerializeDeserializeSkXfermodeMode) { |
| 34 for (size_t i = 0; i < static_cast<size_t>(SkBlendMode::kLastMode); i++) { | 34 for (size_t i = 0; i < static_cast<size_t>(SkBlendMode::kLastMode); i++) { |
| 35 SkBlendMode mode = static_cast<SkBlendMode>(i); | 35 SkBlendMode mode = static_cast<SkBlendMode>(i); |
| 36 EXPECT_EQ(mode, SkXfermodeModeFromProto(SkXfermodeModeToProto(mode))); | 36 EXPECT_EQ(mode, SkXfermodeModeFromProto(SkXfermodeModeToProto(mode))); |
| (...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 72 proto.radii_lower_left().x()); | 72 proto.radii_lower_left().x()); |
| 73 EXPECT_EQ(rrect.radii(SkRRect::kLowerLeft_Corner).y(), | 73 EXPECT_EQ(rrect.radii(SkRRect::kLowerLeft_Corner).y(), |
| 74 proto.radii_lower_left().y()); | 74 proto.radii_lower_left().y()); |
| 75 | 75 |
| 76 // Test ProtoToRRect | 76 // Test ProtoToRRect |
| 77 EXPECT_EQ(rrect, ProtoToSkRRect(proto)); | 77 EXPECT_EQ(rrect, ProtoToSkRRect(proto)); |
| 78 } | 78 } |
| 79 | 79 |
| 80 } // namespace | 80 } // namespace |
| 81 } // namespace cc | 81 } // namespace cc |
| OLD | NEW |