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

Side by Side Diff: third_party/WebKit/Source/core/style/FilterOperationsTest.cpp

Issue 2609803002: Use ShadowData in DropShadowFilterOperation (Closed)
Patch Set: Fix blend(...) order Created 3 years, 11 months 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 unified diff | Download patch
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2012 Google Inc. All rights reserved. 2 * Copyright (C) 2012 Google Inc. All rights reserved.
3 * 3 *
4 * Redistribution and use in source and binary forms, with or without 4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions 5 * modification, are permitted provided that the following conditions
6 * are met: 6 * are met:
7 * 7 *
8 * 1. Redistributions of source code must retain the above copyright 8 * 1. Redistributions of source code must retain the above copyright
9 * notice, this list of conditions and the following disclaimer. 9 * notice, this list of conditions and the following disclaimer.
10 * 2. Redistributions in binary form must reproduce the above copyright 10 * 2. Redistributions in binary form must reproduce the above copyright
(...skipping 28 matching lines...) Expand all
39 TEST(FilterOperationsTest, mapRectBlur) { 39 TEST(FilterOperationsTest, mapRectBlur) {
40 FilterOperations ops; 40 FilterOperations ops;
41 ops.operations().append(BlurFilterOperation::create(Length(20.0, Fixed))); 41 ops.operations().append(BlurFilterOperation::create(Length(20.0, Fixed)));
42 EXPECT_TRUE(ops.hasFilterThatMovesPixels()); 42 EXPECT_TRUE(ops.hasFilterThatMovesPixels());
43 EXPECT_EQ(IntRect(-57, -57, 124, 124), 43 EXPECT_EQ(IntRect(-57, -57, 124, 124),
44 enclosingIntRect(ops.mapRect(FloatRect(0, 0, 10, 10)))); 44 enclosingIntRect(ops.mapRect(FloatRect(0, 0, 10, 10))));
45 } 45 }
46 46
47 TEST(FilterOperationsTest, mapRectDropShadow) { 47 TEST(FilterOperationsTest, mapRectDropShadow) {
48 FilterOperations ops; 48 FilterOperations ops;
49 ops.operations().append( 49 ops.operations().append(DropShadowFilterOperation::create(
50 DropShadowFilterOperation::create(IntPoint(3, 8), 20, Color(1, 2, 3))); 50 ShadowData(FloatPoint(3, 8), 20, 0, Normal, StyleColor(Color(1, 2, 3)))));
51 EXPECT_TRUE(ops.hasFilterThatMovesPixels()); 51 EXPECT_TRUE(ops.hasFilterThatMovesPixels());
52 EXPECT_EQ(IntRect(-54, -49, 124, 124), 52 EXPECT_EQ(IntRect(-54, -49, 124, 124),
53 enclosingIntRect(ops.mapRect(FloatRect(0, 0, 10, 10)))); 53 enclosingIntRect(ops.mapRect(FloatRect(0, 0, 10, 10))));
54 } 54 }
55 55
56 TEST(FilterOperationsTest, mapRectBoxReflect) { 56 TEST(FilterOperationsTest, mapRectBoxReflect) {
57 FilterOperations ops; 57 FilterOperations ops;
58 ops.operations().append(BoxReflectFilterOperation::create( 58 ops.operations().append(BoxReflectFilterOperation::create(
59 BoxReflection(BoxReflection::VerticalReflection, 100))); 59 BoxReflection(BoxReflection::VerticalReflection, 100)));
60 EXPECT_TRUE(ops.hasFilterThatMovesPixels()); 60 EXPECT_TRUE(ops.hasFilterThatMovesPixels());
61 61
62 // original IntRect(0, 0, 10, 10) + reflection IntRect(90, 90, 10, 10) 62 // original IntRect(0, 0, 10, 10) + reflection IntRect(90, 90, 10, 10)
63 EXPECT_EQ(FloatRect(0, 0, 10, 100), ops.mapRect(FloatRect(0, 0, 10, 10))); 63 EXPECT_EQ(FloatRect(0, 0, 10, 100), ops.mapRect(FloatRect(0, 0, 10, 10)));
64 } 64 }
65 65
66 TEST(FilterOperationsTest, mapRectDropShadowAndBoxReflect) { 66 TEST(FilterOperationsTest, mapRectDropShadowAndBoxReflect) {
67 // This is a case where the order of filter operations matters, and it's 67 // This is a case where the order of filter operations matters, and it's
68 // important that the bounds be filtered in the correct order. 68 // important that the bounds be filtered in the correct order.
69 FilterOperations ops; 69 FilterOperations ops;
70 ops.operations().append( 70 ops.operations().append(DropShadowFilterOperation::create(ShadowData(
71 DropShadowFilterOperation::create(IntPoint(100, 200), 0, Color::black)); 71 FloatPoint(100, 200), 0, 0, Normal, StyleColor(Color::black))));
72 ops.operations().append(BoxReflectFilterOperation::create( 72 ops.operations().append(BoxReflectFilterOperation::create(
73 BoxReflection(BoxReflection::VerticalReflection, 50))); 73 BoxReflection(BoxReflection::VerticalReflection, 50)));
74 EXPECT_TRUE(ops.hasFilterThatMovesPixels()); 74 EXPECT_TRUE(ops.hasFilterThatMovesPixels());
75 EXPECT_EQ(FloatRect(0, -160, 110, 370), ops.mapRect(FloatRect(0, 0, 10, 10))); 75 EXPECT_EQ(FloatRect(0, -160, 110, 370), ops.mapRect(FloatRect(0, 0, 10, 10)));
76 } 76 }
77 77
78 } // namespace blink 78 } // namespace blink
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/core/style/FilterOperation.cpp ('k') | third_party/WebKit/Source/core/style/ShadowData.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698