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

Unified Diff: cc/output/filter_operations_unittest.cc

Issue 64123005: Update filter blending to match spec draft. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Remove early check size() == from.size() Created 7 years, 1 month 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
« cc/output/filter_operations.cc ('K') | « cc/output/filter_operations.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: cc/output/filter_operations_unittest.cc
diff --git a/cc/output/filter_operations_unittest.cc b/cc/output/filter_operations_unittest.cc
index 7f439b9f15c102469eb9ee2b1f41067baeec7b19..329601fd7260aabc89f5b693203ce5071d09bb11 100644
--- a/cc/output/filter_operations_unittest.cc
+++ b/cc/output/filter_operations_unittest.cc
@@ -644,8 +644,7 @@ TEST(FilterOperationsTest, BlendEmptySequences) {
EXPECT_EQ(blended, empty);
}
-// Tests blending non-empty sequences that either have different lengths or
-// have non-matching operations.
+// Tests blending non-empty sequences that have non-matching operations.
TEST(FilterOperationsTest, BlendNonMatchingSequences) {
FilterOperations from;
FilterOperations to;
@@ -653,6 +652,7 @@ TEST(FilterOperationsTest, BlendNonMatchingSequences) {
from.Append(FilterOperation::CreateSaturateFilter(3.f));
from.Append(FilterOperation::CreateBlurFilter(2.f));
to.Append(FilterOperation::CreateSaturateFilter(4.f));
+ to.Append(FilterOperation::CreateHueRotateFilter(0.5f));
FilterOperations blended = to.Blend(from, -0.75);
EXPECT_EQ(to, blended);
@@ -660,8 +660,37 @@ TEST(FilterOperationsTest, BlendNonMatchingSequences) {
EXPECT_EQ(to, blended);
blended = to.Blend(from, 1.5);
EXPECT_EQ(to, blended);
+}
- to.Append(FilterOperation::CreateHueRotateFilter(0.5f));
+// Tests blending non-empty sequences of different sizes.
+TEST(FilterOperationsTest, BlendRaggedSequences) {
+ FilterOperations from;
+ FilterOperations to;
+
+ from.Append(FilterOperation::CreateSaturateFilter(3.f));
+ from.Append(FilterOperation::CreateBlurFilter(2.f));
+ to.Append(FilterOperation::CreateSaturateFilter(4.f));
+
+ FilterOperations blended = to.Blend(from, -0.75);
+ FilterOperations expected;
+ expected.Append(FilterOperation::CreateSaturateFilter(2.25f));
+ expected.Append(FilterOperation::CreateBlurFilter(3.5f));
+ EXPECT_EQ(expected, blended);
+
+ blended = to.Blend(from, 0.75);
+ expected.Clear();
+ expected.Append(FilterOperation::CreateSaturateFilter(3.75f));
+ expected.Append(FilterOperation::CreateBlurFilter(0.5f));
+ EXPECT_EQ(expected, blended);
+
+ blended = to.Blend(from, 1.5);
+ expected.Clear();
+ expected.Append(FilterOperation::CreateSaturateFilter(4.5f));
+ expected.Append(FilterOperation::CreateBlurFilter(0.f));
+ EXPECT_EQ(expected, blended);
+
+ from.Append(FilterOperation::CreateOpacityFilter(1.f));
+ to.Append(FilterOperation::CreateOpacityFilter(1.f));
blended = to.Blend(from, -0.75);
EXPECT_EQ(to, blended);
blended = to.Blend(from, 0.75);
« cc/output/filter_operations.cc ('K') | « cc/output/filter_operations.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698