| OLD | NEW |
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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 <stddef.h> | 5 #include <stddef.h> |
| 6 | 6 |
| 7 #include "cc/output/filter_operations.h" | 7 #include "cc/output/filter_operations.h" |
| 8 #include "testing/gtest/include/gtest/gtest.h" | 8 #include "testing/gtest/include/gtest/gtest.h" |
| 9 #include "third_party/skia/include/effects/SkBlurImageFilter.h" | 9 #include "third_party/skia/include/effects/SkBlurImageFilter.h" |
| 10 #include "third_party/skia/include/effects/SkDropShadowImageFilter.h" | 10 #include "third_party/skia/include/effects/SkDropShadowImageFilter.h" |
| (...skipping 938 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 949 from.Append(FilterOperation::CreateOpacityFilter(1.f)); | 949 from.Append(FilterOperation::CreateOpacityFilter(1.f)); |
| 950 to.Append(FilterOperation::CreateOpacityFilter(1.f)); | 950 to.Append(FilterOperation::CreateOpacityFilter(1.f)); |
| 951 blended = to.Blend(from, -0.75); | 951 blended = to.Blend(from, -0.75); |
| 952 EXPECT_EQ(to, blended); | 952 EXPECT_EQ(to, blended); |
| 953 blended = to.Blend(from, 0.75); | 953 blended = to.Blend(from, 0.75); |
| 954 EXPECT_EQ(to, blended); | 954 EXPECT_EQ(to, blended); |
| 955 blended = to.Blend(from, 1.5); | 955 blended = to.Blend(from, 1.5); |
| 956 EXPECT_EQ(to, blended); | 956 EXPECT_EQ(to, blended); |
| 957 } | 957 } |
| 958 | 958 |
| 959 TEST(FilterOperationsTest, ToString) { |
| 960 FilterOperations filters; |
| 961 EXPECT_EQ(std::string("{\"FilterOperations\":[]}"), filters.ToString()); |
| 962 |
| 963 filters.Append(FilterOperation::CreateSaturateFilter(3.f)); |
| 964 filters.Append(FilterOperation::CreateBlurFilter(2.f)); |
| 965 EXPECT_EQ(std::string("{\"FilterOperations\":[{\"amount\":3.0,\"type\":2}," |
| 966 "{\"amount\":2.0,\"type\":8}]}"), |
| 967 filters.ToString()); |
| 968 } |
| 969 |
| 959 } // namespace | 970 } // namespace |
| 960 } // namespace cc | 971 } // namespace cc |
| OLD | NEW |