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

Side by Side Diff: third_party/WebKit/LayoutTests/css3/filters/script-tests/filter-property-computed-style.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 computed style of the -webkit-filter property.");
2
3 // These have to be global for the test helpers to see them.
4 var filterStyle;
5 var styleElement = document.createElement("style");
6 document.head.appendChild(styleElement);
7 var stylesheet = styleElement.sheet;
8
9 function testComputedFilterRule(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
19 filterStyle = window.getComputedStyle(document.body).getPropertyValue('-webk it-filter');
20 shouldBeEqualToString("filterStyle", expectedValue);
21 stylesheet.deleteRule(0);
22 }
23
24 testComputedFilterRule("Basic reference", "url('#a')", 'url("#a")');
25 testComputedFilterRule("Bare unquoted reference converting to quoted form", "url (#a)", 'url("#a")');
26 testComputedFilterRule("Multiple references", "url('#a') url('#b')", 'url("#a") url("#b")');
27 testComputedFilterRule("Reference as 2nd value", "grayscale(1) url('#a')", 'gray scale(1) url("#a")');
28 testComputedFilterRule("Integer value", "grayscale(1)");
29 testComputedFilterRule("Float value converts to integer", "grayscale(1.0)", "gra yscale(1)");
30 testComputedFilterRule("Zero value", "grayscale(0)");
31 testComputedFilterRule("No values", "grayscale()", "grayscale(1)");
32 testComputedFilterRule("Multiple values", "grayscale(0.5) grayscale(0.25)");
33 testComputedFilterRule("Integer value", "sepia(1)");
34 testComputedFilterRule("Float value converts to integer", "sepia(1.0)", "sepia(1 )");
35 testComputedFilterRule("Zero value", "sepia(0)");
36 testComputedFilterRule("No values", "sepia()", "sepia(1)");
37 testComputedFilterRule("Multiple values", "sepia(0.5) sepia(0.25)");
38 testComputedFilterRule("Rule combinations", "sepia(0.5) grayscale(0.25)");
39 testComputedFilterRule("Integer value", "saturate(1)");
40 testComputedFilterRule("Float value converts to integer", "saturate(1.0)", "satu rate(1)");
41 testComputedFilterRule("Zero value", "saturate(0)");
42 testComputedFilterRule("No values", "saturate()", "saturate(1)");
43 testComputedFilterRule("Multiple values", "saturate(0.5) saturate(0.25)");
44 testComputedFilterRule("Rule combinations", "saturate(0.5) grayscale(0.25)");
45 testComputedFilterRule("Degrees value as integer", "hue-rotate(10deg)");
46 testComputedFilterRule("Degrees float value converts to integer", "hue-rotate(10 .0deg)", "hue-rotate(10deg)");
47 testComputedFilterRule("Radians value", "hue-rotate(10rad)", "hue-rotate(572.958 deg)");
48 testComputedFilterRule("Gradians value", "hue-rotate(10grad)", "hue-rotate(9deg) ");
49 testComputedFilterRule("Turns value", "hue-rotate(0.5turn)", "hue-rotate(180deg) ");
50 testComputedFilterRule("Zero value", "hue-rotate(0)", "hue-rotate(0deg)");
51 testComputedFilterRule("No values", "hue-rotate()", "hue-rotate(0deg)");
52 testComputedFilterRule("Rule combinations", "hue-rotate(10deg) grayscale(0.25)") ;
53 testComputedFilterRule("Integer value", "invert(1)");
54 testComputedFilterRule("Float value converts to integer", "invert(1.0)", "invert (1)");
55 testComputedFilterRule("Zero value", "invert(0)");
56 testComputedFilterRule("No values", "invert()", "invert(1)");
57 testComputedFilterRule("Multiple values", "invert(0.5) invert(0.25)");
58 testComputedFilterRule("Rule combinations", "invert(0.5) grayscale(0.25)");
59 testComputedFilterRule("Integer value", "opacity(1)");
60 testComputedFilterRule("Float value converts to integer", "opacity(1.0)", "opaci ty(1)");
61 testComputedFilterRule("Zero value", "opacity(0)");
62 testComputedFilterRule("No values", "opacity()", "opacity(1)");
63 testComputedFilterRule("Multiple values", "opacity(0.5) opacity(0.25)");
64 testComputedFilterRule("Rule combinations", "opacity(0.5) grayscale(0.25)");
65 testComputedFilterRule("Integer value", "brightness(1)");
66 testComputedFilterRule("Float value converts to integer", "brightness(1.0)", "br ightness(1)");
67 testComputedFilterRule("Zero value", "brightness(0)");
68 testComputedFilterRule("No values", "brightness()", "brightness(0)");
69 testComputedFilterRule("Multiple values", "brightness(0.5) brightness(0.25)");
70 testComputedFilterRule("Rule combinations", "brightness(0.5) grayscale(0.25)");
71 testComputedFilterRule("Integer value", "contrast(1)");
72 testComputedFilterRule("Value greater than 1", "contrast(2)");
73 testComputedFilterRule("Float value converts to integer", "contrast(1.0)", "cont rast(1)");
74 testComputedFilterRule("Zero value", "contrast(0)");
75 testComputedFilterRule("No values", "contrast()", "contrast(1)");
76 testComputedFilterRule("Multiple values", "contrast(0.5) contrast(0.25)");
77 testComputedFilterRule("Rule combinations", "contrast(0.5) grayscale(0.25)");
78 testComputedFilterRule("One zero to px", "blur(0)", "blur(0px)");
79 testComputedFilterRule("One length", "blur(2em)", "blur(32px)");
80 testComputedFilterRule("One length", "blur(5px)");
81 testComputedFilterRule("No values", "blur()", "blur(0px)");
82
83 testComputedFilterRule("Color then three values",
84 "drop-shadow(red 1px 2px 3px)", "drop-shadow(rgb(255, 0, 0) 1px 2px 3px)");
85
86 testComputedFilterRule("Three values then color",
87 "drop-shadow(1px 2px 3px red)", "drop-shadow(rgb(255, 0, 0) 1px 2px 3px)");
88
89 testComputedFilterRule("Color then three values with zero length",
90 "drop-shadow(#abc 0 0 0)", "drop-shadow(rgb(170, 187, 204) 0px 0px 0px)");
91
92 testComputedFilterRule("Three values with zero length",
93 "drop-shadow(0 0 0)", "drop-shadow(rgb(0, 0, 0) 0px 0px 0px)");
94
95 testComputedFilterRule("Two values no color",
96 "drop-shadow(1px 2px)", "drop-shadow(rgb(0, 0, 0) 1px 2px 0px)");
97
98 testComputedFilterRule("Multiple operations",
99 "grayscale(0.5) sepia(0.25) saturate(0.75) hue-rotate(35deg) invert(0.2) opa city(0.9) blur(5px)");
100
101 testComputedFilterRule("Percentage values",
102 "grayscale(50%) sepia(25%) saturate(75%) invert(20%) opacity(90%) brightness (60%) contrast(30%)",
103 "grayscale(0.5) sepia(0.25) saturate(0.75) invert(0.2) opacity(0.9) brightne ss(0.6) contrast(0.3)");
104
105 successfullyParsed = true;
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698