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

Side by Side Diff: third_party/WebKit/LayoutTests/css3/filters/script-tests/filter-property-parsing-invalid.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
« no previous file with comments | « third_party/WebKit/LayoutTests/css3/filters/script-tests/filter-property-parsing.js ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 testInvalidFilterRule(description, rule)
10 {
11 debug("");
12 debug(description + " : " + rule);
13
14 stylesheet.insertRule("body { -webkit-filter: " + rule + "; }", 0);
15 cssRule = stylesheet.cssRules.item(0);
16
17 shouldBe("cssRule.type", "1");
18
19 declaration = cssRule.style;
20 shouldBe("declaration.length", "0");
21 shouldBeEqualToString("declaration.getPropertyValue('-webkit-filter')", "");
22 }
23
24 testInvalidFilterRule("Too many parameters", "url(#a #b)");
25
26 testInvalidFilterRule("Length instead of number", "grayscale(10px)");
27 testInvalidFilterRule("Too many parameters", "grayscale(0.5 0.5)");
28 testInvalidFilterRule("Too many parameters and commas", "grayscale(0.5, 0.5)");
29 testInvalidFilterRule("Trailing comma", "grayscale(0.5,)");
30 testInvalidFilterRule("Negative parameter", "grayscale(-0.5)");
31 testInvalidFilterRule("Negative percent", "grayscale(-10%)");
32 testInvalidFilterRule("Parameter out of bounds", "grayscale(1.5)");
33
34 testInvalidFilterRule("Too many parameters", "sepia(0.5 0.5 3.0)");
35 testInvalidFilterRule("Too many parameters and commas", "sepia(0.1, 0.1)");
36 testInvalidFilterRule("Trailing comma", "sepia(0.5,)");
37 testInvalidFilterRule("Negative parameter", "sepia(-0.01)");
38 testInvalidFilterRule("Negative percent", "sepia(-10%)");
39 testInvalidFilterRule("Parameter out of bounds", "sepia(10000)");
40
41 testInvalidFilterRule("Length instead of number", "saturate(10px)");
42 testInvalidFilterRule("Too many parameters", "saturate(0.5 0.5)");
43 testInvalidFilterRule("Too many parameters and commas", "saturate(0.5, 0.5)");
44 testInvalidFilterRule("Trailing comma", "saturate(0.5,)");
45 testInvalidFilterRule("Negative parameter", "saturate(-0.5)");
46 testInvalidFilterRule("Negative percent", "saturate(-10%)");
47
48 testInvalidFilterRule("Bare number", "hue-rotate(10)");
49 testInvalidFilterRule("Length", "hue-rotate(10px)");
50 testInvalidFilterRule("Too many parameters", "hue-rotate(10deg 4)");
51 testInvalidFilterRule("Too many parameters and commas", "hue-rotate(10deg, 5deg) ");
52 testInvalidFilterRule("Trailing comma", "hue-rotate(10deg,)");
53
54 testInvalidFilterRule("Length instead of number", "invert(10px)");
55 testInvalidFilterRule("Too many parameters", "invert(0.5 0.5)");
56 testInvalidFilterRule("Too many parameters and commas", "invert(0.5, 0.5)");
57 testInvalidFilterRule("Trailing comma", "invert(0.5,)");
58 testInvalidFilterRule("Negative parameter", "invert(-0.5)");
59 testInvalidFilterRule("Parameter out of bounds", "invert(1.5)");
60
61 testInvalidFilterRule("Length instead of number", "opacity(10px)");
62 testInvalidFilterRule("Too many parameters", "opacity(0.5 0.5)");
63 testInvalidFilterRule("Too many parameters and commas", "opacity(0.5, 0.5)");
64 testInvalidFilterRule("Trailing comma", "opacity(0.5,)");
65 testInvalidFilterRule("Negative parameter", "opacity(-0.5)");
66 testInvalidFilterRule("Negative percent", "opacity(-10%)");
67 testInvalidFilterRule("Parameter out of bounds", "opacity(1.5)");
68
69 testInvalidFilterRule("Length instead of number", "brightness(10px)");
70 testInvalidFilterRule("Too many parameters", "brightness(0.5 0.5)");
71 testInvalidFilterRule("Too many parameters and commas", "brightness(0.5, 0.5)");
72 testInvalidFilterRule("Trailing comma", "brightness(0.5,)");
73
74 testInvalidFilterRule("Length instead of number", "contrast(10px)");
75 testInvalidFilterRule("Too many parameters", "contrast(0.5 0.5)");
76 testInvalidFilterRule("Too many parameters and commas", "contrast(0.5, 0.5)");
77 testInvalidFilterRule("Trailing comma", "contrast(0.5,)");
78 testInvalidFilterRule("Negative parameter", "contrast(-0.5)");
79 testInvalidFilterRule("Negative percent", "contrast(-10%)");
80
81 testInvalidFilterRule("Bare number", "blur(1)");
82 testInvalidFilterRule("Negative number", "blur(-1px)");
83 testInvalidFilterRule("Percentage", "blur(10%)");
84 testInvalidFilterRule("Too many parameters", "blur(1px 1px)");
85 testInvalidFilterRule("Too many parameters and commas", "blur(1em, 1em)");
86 testInvalidFilterRule("Commas", "blur(10px, 10px)");
87 testInvalidFilterRule("Trailing comma", "blur(1em,)");
88
89 testInvalidFilterRule("No values", "drop-shadow()");
90 testInvalidFilterRule("Missing lengths", "drop-shadow(red)");
91 testInvalidFilterRule("Not enough lengths", "drop-shadow(red 1px)");
92 testInvalidFilterRule("Missing units", "drop-shadow(red 1 2 3)");
93 testInvalidFilterRule("Inset", "drop-shadow(red 1px 2px 3px inset)");
94 testInvalidFilterRule("Too many parameters", "drop-shadow(red 1px 2px 3px 4px)") ;
95 testInvalidFilterRule("Commas", "drop-shadow(red, 1px, 2px, 3px)");
96 testInvalidFilterRule("Negative radius", "drop-shadow(10px 10px -1px red)");
97
98 testInvalidFilterRule("Unknown function", "fancify(150%)");
99
100 successfullyParsed = true;
OLDNEW
« no previous file with comments | « third_party/WebKit/LayoutTests/css3/filters/script-tests/filter-property-parsing.js ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698