| OLD | NEW |
| 1 description("Test the computed style of the -webkit-filter property."); | 1 description("Test the computed style of the -webkit-filter property."); |
| 2 | 2 |
| 3 // These have to be global for the test helpers to see them. | 3 // These have to be global for the test helpers to see them. |
| 4 var filterStyle; | 4 var filterStyle; |
| 5 var styleElement = document.createElement("style"); | 5 var styleElement = document.createElement("style"); |
| 6 document.head.appendChild(styleElement); | 6 document.head.appendChild(styleElement); |
| 7 var stylesheet = styleElement.sheet; | 7 var stylesheet = styleElement.sheet; |
| 8 | 8 |
| 9 function testComputedFilterRule(description, rule, expectedValue) | 9 function testComputedFilterRule(description, rule, expectedValue) |
| 10 { | 10 { |
| 11 if (expectedValue === undefined) | 11 if (expectedValue === undefined) |
| 12 expectedValue = rule; | 12 expectedValue = rule; |
| 13 | 13 |
| 14 debug(""); | 14 debug(""); |
| 15 debug(description + " : " + rule); | 15 debug(description + " : " + rule); |
| 16 | 16 |
| 17 stylesheet.insertRule("body { -webkit-filter: " + rule + "; }", 0); | 17 stylesheet.insertRule("body { -webkit-filter: " + rule + "; }", 0); |
| 18 | 18 |
| 19 filterStyle = window.getComputedStyle(document.body).getPropertyValue('-webk
it-filter'); | 19 filterStyle = window.getComputedStyle(document.body).getPropertyValue('-webk
it-filter'); |
| 20 shouldBeEqualToString("filterStyle", expectedValue); | 20 shouldBeEqualToString("filterStyle", expectedValue); |
| 21 stylesheet.deleteRule(0); | 21 stylesheet.deleteRule(0); |
| 22 } | 22 } |
| 23 | 23 |
| 24 testComputedFilterRule("Basic reference", "url('#a')"); | 24 testComputedFilterRule("Basic reference", "url('#a')", 'url("#a")'); |
| 25 testComputedFilterRule("Bare unquoted reference converting to quoted form", "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')"); | 26 testComputedFilterRule("Multiple references", "url('#a') url('#b')", 'url("#a")
url("#b")'); |
| 27 testComputedFilterRule("Reference as 2nd value", "grayscale(1) url('#a')"); | 27 testComputedFilterRule("Reference as 2nd value", "grayscale(1) url('#a')", 'gray
scale(1) url("#a")'); |
| 28 testComputedFilterRule("Integer value", "grayscale(1)"); | 28 testComputedFilterRule("Integer value", "grayscale(1)"); |
| 29 testComputedFilterRule("Float value converts to integer", "grayscale(1.0)", "gra
yscale(1)"); | 29 testComputedFilterRule("Float value converts to integer", "grayscale(1.0)", "gra
yscale(1)"); |
| 30 testComputedFilterRule("Zero value", "grayscale(0)"); | 30 testComputedFilterRule("Zero value", "grayscale(0)"); |
| 31 testComputedFilterRule("No values", "grayscale()", "grayscale(1)"); | 31 testComputedFilterRule("No values", "grayscale()", "grayscale(1)"); |
| 32 testComputedFilterRule("Multiple values", "grayscale(0.5) grayscale(0.25)"); | 32 testComputedFilterRule("Multiple values", "grayscale(0.5) grayscale(0.25)"); |
| 33 testComputedFilterRule("Integer value", "sepia(1)"); | 33 testComputedFilterRule("Integer value", "sepia(1)"); |
| 34 testComputedFilterRule("Float value converts to integer", "sepia(1.0)", "sepia(1
)"); | 34 testComputedFilterRule("Float value converts to integer", "sepia(1.0)", "sepia(1
)"); |
| 35 testComputedFilterRule("Zero value", "sepia(0)"); | 35 testComputedFilterRule("Zero value", "sepia(0)"); |
| 36 testComputedFilterRule("No values", "sepia()", "sepia(1)"); | 36 testComputedFilterRule("No values", "sepia()", "sepia(1)"); |
| 37 testComputedFilterRule("Multiple values", "sepia(0.5) sepia(0.25)"); | 37 testComputedFilterRule("Multiple values", "sepia(0.5) sepia(0.25)"); |
| (...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 96 "drop-shadow(1px 2px)", "drop-shadow(rgb(0, 0, 0) 1px 2px 0px)"); | 96 "drop-shadow(1px 2px)", "drop-shadow(rgb(0, 0, 0) 1px 2px 0px)"); |
| 97 | 97 |
| 98 testComputedFilterRule("Multiple operations", | 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)"); | 99 "grayscale(0.5) sepia(0.25) saturate(0.75) hue-rotate(35deg) invert(0.2) opa
city(0.9) blur(5px)"); |
| 100 | 100 |
| 101 testComputedFilterRule("Percentage values", | 101 testComputedFilterRule("Percentage values", |
| 102 "grayscale(50%) sepia(25%) saturate(75%) invert(20%) opacity(90%) brightness
(60%) contrast(30%)", | 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)"); | 103 "grayscale(0.5) sepia(0.25) saturate(0.75) invert(0.2) opacity(0.9) brightne
ss(0.6) contrast(0.3)"); |
| 104 | 104 |
| 105 successfullyParsed = true; | 105 successfullyParsed = true; |
| OLD | NEW |