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

Side by Side Diff: third_party/WebKit/LayoutTests/css3/filters/script-tests/filter-property-parsing.js

Issue 2055733002: Clean up script-tests in css3/filters (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fix expectations for un-duped test Created 4 years, 6 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
(Empty)
1 description("Test the parsing of the -webkit-filter property.");
2
3 // These have to be global for the test helpers to see them.
4 var stylesheet, cssRule, declaration;
5 var styleElement = document.createElement("style");
6 document.head.appendChild(styleElement);
7 stylesheet = styleElement.sheet;
8
9 function testFilterRule(description, rule, expectedValue)
10 {
11 if (expectedValue === undefined)
12 expectedValue = rule;
13
14 debug("");
15 debug(description + " : " + rule);
16
17 stylesheet.insertRule("body { -webkit-filter: " + rule + "; }", 0);
18 cssRule = stylesheet.cssRules.item(0);
19
20 shouldBe("cssRule.type", "1");
21
22 declaration = cssRule.style;
23 shouldBe("declaration.length", "1");
24 shouldBeEqualToString("declaration.getPropertyValue('-webkit-filter')", expe ctedValue);
25 }
26
27 testFilterRule("Basic reference", "url('#a')", 'url("#a")');
28 testFilterRule("Bare unquoted reference converting to quoted form", "url(#a)", ' url("#a")');
29 testFilterRule("Multiple references", "url('#a') url('#b')", 'url("#a") url("#b" )');
30 testFilterRule("Reference as 2nd value", "grayscale(1) url('#a')", 'grayscale(1) url("#a")');
31 testFilterRule("Integer value", "grayscale(1)");
32 testFilterRule("Percentage value", "grayscale(50%)");
33 testFilterRule("Float value converts to integer", "grayscale(1.0)", "grayscale(1 )");
34 testFilterRule("Zero value", "grayscale(0)");
35 testFilterRule("No values", "grayscale()");
36 testFilterRule("Multiple values", "grayscale(0.5) grayscale(0.25)");
37 testFilterRule("Integer value", "sepia(1)");
38 testFilterRule("Percentage value", "sepia(50%)");
39 testFilterRule("Float value converts to integer", "sepia(1.0)", "sepia(1)");
40 testFilterRule("Zero value", "sepia(0)");
41 testFilterRule("No values", "sepia()");
42 testFilterRule("Multiple values", "sepia(0.5) sepia(0.25)");
43 testFilterRule("Rule combinations", "sepia(0.5) grayscale(0.25)");
44 testFilterRule("Integer value", "saturate(1)");
45 testFilterRule("Percentage value", "saturate(50%)");
46 testFilterRule("Percentage value > 1", "saturate(250%)");
47 testFilterRule("Float value converts to integer", "saturate(1.0)", "saturate(1)" );
48 testFilterRule("Input value > 1", "saturate(5.5)");
49 testFilterRule("Zero value", "saturate(0)");
50 testFilterRule("No values", "saturate()");
51 testFilterRule("Multiple values", "saturate(0.5) saturate(0.25)");
52 testFilterRule("Rule combinations", "saturate(0.5) grayscale(0.25)");
53 testFilterRule("Degrees value as integer", "hue-rotate(10deg)");
54 testFilterRule("Degrees float value converts to integer", "hue-rotate(10.0deg)", "hue-rotate(10deg)");
55 testFilterRule("Radians value", "hue-rotate(10rad)");
56 testFilterRule("Gradians value", "hue-rotate(10grad)");
57 testFilterRule("Turns value", "hue-rotate(0.5turn)");
58 testFilterRule("Zero value", "hue-rotate(0)", "hue-rotate(0deg)");
59 testFilterRule("No values", "hue-rotate()");
60 testFilterRule("Rule combinations", "hue-rotate(10deg) grayscale(0.25)");
61 testFilterRule("Integer value", "invert(1)")
62 testFilterRule("Percentage value", "invert(50%)");
63 testFilterRule("Float value converts to integer", "invert(1.0)", "invert(1)");
64 testFilterRule("Zero value", "invert(0)");
65 testFilterRule("No values", "invert()");
66 testFilterRule("Multiple values", "invert(0.5) invert(0.25)");
67 testFilterRule("Rule combinations", "invert(0.5) grayscale(0.25)");
68 testFilterRule("Integer value", "opacity(1)");
69 testFilterRule("Percentage value", "opacity(50%)");
70 testFilterRule("Float value converts to integer", "opacity(1.0)", "opacity(1)");
71 testFilterRule("Zero value", "opacity(0)");
72 testFilterRule("No values", "opacity()");
73 testFilterRule("Multiple values", "opacity(0.5) opacity(0.25)");
74 testFilterRule("Rule combinations", "opacity(0.5) grayscale(0.25)");
75 testFilterRule("Integer value", "brightness(1)");
76 testFilterRule("Percentage value", "brightness(50%)");
77 testFilterRule("Float value converts to integer", "brightness(1.0)", "brightness (1)");
78 testFilterRule("Zero value", "brightness(0)");
79 testFilterRule("No values", "brightness()");
80 testFilterRule("Multiple values", "brightness(0.5) brightness(0.25)");
81 testFilterRule("Rule combinations", "brightness(0.5) grayscale(0.25)");
82 testFilterRule("Parameter less than -100%", "brightness(-1.1)");
83 testFilterRule("Parameter more than 100%", "brightness(101%)");
84 testFilterRule("Rule combinations", "grayscale(0.25) brightness(0.5)");
85 testFilterRule("Integer value", "contrast(1)");
86 testFilterRule("Percentage value", "contrast(50%)");
87 testFilterRule("Percentage value > 1", "contrast(250%)");
88 testFilterRule("Float value converts to integer", "contrast(1.0)", "contrast(1)" );
89 testFilterRule("Zero value", "contrast(0)");
90 testFilterRule("No values", "contrast()");
91 testFilterRule("Value greater than one", "contrast(2)");
92 testFilterRule("Multiple values", "contrast(0.5) contrast(0.25)");
93 testFilterRule("Rule combinations", "contrast(0.5) grayscale(0.25)");
94 testFilterRule("Rule combinations", "grayscale(0.25) contrast(0.5)");
95 testFilterRule("One zero to px", "blur(0)", "blur(0px)");
96 testFilterRule("One length", "blur(10px)");
97 testFilterRule("No values", "blur()");
98 testFilterRule("Color then three values", "drop-shadow(red 1px 2px 3px)");
99 testFilterRule("Three values then color", "drop-shadow(1px 2px 3px red)", "drop- shadow(red 1px 2px 3px)");
100
101 testFilterRule("Color then three values with zero length",
102 "drop-shadow(#abc 0 0 0)", "drop-shadow(rgb(170, 187, 204) 0px 0px 0px)");
103
104 testFilterRule("Three values with zero length",
105 "drop-shadow(0 0 0)", "drop-shadow(0px 0px 0px)");
106
107 testFilterRule("Two values no color", "drop-shadow(1px 2px)");
108
109 testFilterRule("Multiple operations",
110 "grayscale(0.5) sepia(0.25) saturate(0.75) hue-rotate(35deg) inve rt(0.2) opacity(0.9) blur(5px) drop-shadow(green 1px 2px 3px)");
111
112 successfullyParsed = true;
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698