Index: third_party/WebKit/LayoutTests/css3/filters/filter-property-computed-style.html |
diff --git a/third_party/WebKit/LayoutTests/css3/filters/filter-property-computed-style.html b/third_party/WebKit/LayoutTests/css3/filters/filter-property-computed-style.html |
index 3420706262c7bf54bc719b2acd88e40b23c1e9e9..cafc72ae255096d0211eb51ab81d6962007d1143 100644 |
--- a/third_party/WebKit/LayoutTests/css3/filters/filter-property-computed-style.html |
+++ b/third_party/WebKit/LayoutTests/css3/filters/filter-property-computed-style.html |
@@ -1,11 +1,107 @@ |
-<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML//EN"> |
-<html> |
-<head> |
-<script src="../../resources/js-test.js"></script> |
-</head> |
-<body> |
-<p id="description"></p> |
-<div id="console"></div> |
-<script src="script-tests/filter-property-computed-style.js"></script> |
-</body> |
-</html> |
+<!DOCTYPE html> |
+<title>Computed style of the -webkit-filter property</title> |
+<script src="../../resources/testharness.js"></script> |
+<script src="../../resources/testharnessreport.js"></script> |
+<script> |
+function assert_computed_style(property, value, expectedValue) { |
+ if (expectedValue === undefined) |
+ expectedValue = value; |
+ |
+ var stringifiedValue = JSON.stringify(value); |
+ |
+ test(function() { |
+ var div = document.createElement('div'); |
+ div.style[property] = value; |
+ document.head.appendChild(div); |
+ var computedStyleValue = getComputedStyle(div)[property]; |
+ div.remove(); |
+ assert_equals(computedStyleValue, expectedValue); |
+ }, "Computed style after setting e.style['" + property + "'] = " + stringifiedValue); |
+} |
+ |
+assert_computed_style("webkitFilter", "url('#a')", 'url("#a")'); // Basic reference |
+assert_computed_style("webkitFilter", "url(#a)", 'url("#a")'); // Bare unquoted reference converting to quoted form |
+assert_computed_style("webkitFilter", "url('#a') url('#b')", 'url("#a") url("#b")'); // Multiple references |
+ |
+assert_computed_style("webkitFilter", "grayscale(1)"); // Integer value |
+assert_computed_style("webkitFilter", "grayscale(1.0)", "grayscale(1)"); // Float value converts to integer |
+assert_computed_style("webkitFilter", "grayscale(0)"); // Zero value |
+assert_computed_style("webkitFilter", "grayscale()", "grayscale(1)"); // No arguments |
+assert_computed_style("webkitFilter", "grayscale(0.5) grayscale(0.25)"); // Multiple values |
+ |
+assert_computed_style("webkitFilter", "sepia(1)"); // Integer value |
+assert_computed_style("webkitFilter", "sepia(1.0)", "sepia(1)"); // Float value converts to integer |
+assert_computed_style("webkitFilter", "sepia(0)"); // Zero value |
+assert_computed_style("webkitFilter", "sepia()", "sepia(1)"); // No arguments |
+assert_computed_style("webkitFilter", "sepia(0.5) sepia(0.25)"); // Multiple values |
+ |
+assert_computed_style("webkitFilter", "saturate(1)"); // Integer value |
+assert_computed_style("webkitFilter", "saturate(1.0)", "saturate(1)"); // Float value converts to integer |
+assert_computed_style("webkitFilter", "saturate(0)"); // Zero value |
+assert_computed_style("webkitFilter", "saturate()", "saturate(1)"); // No arguments |
+assert_computed_style("webkitFilter", "saturate(0.5) saturate(0.25)"); // Multiple values |
+ |
+assert_computed_style("webkitFilter", "hue-rotate(10deg)"); // Degrees value as integer |
+assert_computed_style("webkitFilter", "hue-rotate(10.0deg)", "hue-rotate(10deg)"); // Degrees float value converts to integer |
+assert_computed_style("webkitFilter", "hue-rotate(10rad)", "hue-rotate(572.958deg)"); // Radians value |
+assert_computed_style("webkitFilter", "hue-rotate(10grad)", "hue-rotate(9deg)"); // Gradians value |
+assert_computed_style("webkitFilter", "hue-rotate(0.5turn)", "hue-rotate(180deg)"); // Turns value |
+assert_computed_style("webkitFilter", "hue-rotate(0)", "hue-rotate(0deg)"); // Zero value |
+assert_computed_style("webkitFilter", "hue-rotate()", "hue-rotate(0deg)"); // No arguments |
+ |
+assert_computed_style("webkitFilter", "invert(1)"); // Integer value |
+assert_computed_style("webkitFilter", "invert(1.0)", "invert(1)"); // Float value converts to integer |
+assert_computed_style("webkitFilter", "invert(0)"); // Zero value |
+assert_computed_style("webkitFilter", "invert()", "invert(1)"); // No arguments |
+assert_computed_style("webkitFilter", "invert(0.5) invert(0.25)"); // Multiple values |
+ |
+assert_computed_style("webkitFilter", "opacity(1)"); // Integer value |
+assert_computed_style("webkitFilter", "opacity(1.0)", "opacity(1)"); // Float value converts to integer |
+assert_computed_style("webkitFilter", "opacity(0)"); // Zero value |
+assert_computed_style("webkitFilter", "opacity()", "opacity(1)"); // No arguments |
+assert_computed_style("webkitFilter", "opacity(0.5) opacity(0.25)"); // Multiple values |
+ |
+assert_computed_style("webkitFilter", "brightness(1)"); // Integer value |
+assert_computed_style("webkitFilter", "brightness(1.0)", "brightness(1)"); // Float value converts to integer |
+assert_computed_style("webkitFilter", "brightness(0)"); // Zero value |
+assert_computed_style("webkitFilter", "brightness()", "brightness(0)"); // No arguments |
+assert_computed_style("webkitFilter", "brightness(0.5) brightness(0.25)"); // Multiple values |
+ |
+assert_computed_style("webkitFilter", "contrast(1)"); // Integer value |
+assert_computed_style("webkitFilter", "contrast(2)"); // Value greater than 1 |
+assert_computed_style("webkitFilter", "contrast(1.0)", "contrast(1)"); // Float value converts to integer |
+assert_computed_style("webkitFilter", "contrast(0)"); // Zero value |
+assert_computed_style("webkitFilter", "contrast()", "contrast(1)"); // No arguments |
+assert_computed_style("webkitFilter", "contrast(0.5) contrast(0.25)"); // Multiple values |
+ |
+assert_computed_style("webkitFilter", "blur(0)", "blur(0px)"); // One zero to px |
+assert_computed_style("webkitFilter", "blur(2em)", "blur(32px)"); // One length |
+assert_computed_style("webkitFilter", "blur(5px)"); // One length |
+assert_computed_style("webkitFilter", "blur()", "blur(0px)"); // No arguments |
+ |
+assert_computed_style("webkitFilter", |
+ "drop-shadow(red 1px 2px 3px)", "drop-shadow(rgb(255, 0, 0) 1px 2px 3px)"); // Color then three values |
+assert_computed_style("webkitFilter", |
+ "drop-shadow(1px 2px 3px red)", "drop-shadow(rgb(255, 0, 0) 1px 2px 3px)"); // Three values then color |
+assert_computed_style("webkitFilter", |
+ "drop-shadow(#abc 0 0 0)", "drop-shadow(rgb(170, 187, 204) 0px 0px 0px)"); // Color then three values with zero length |
+assert_computed_style("webkitFilter", |
+ "drop-shadow(0 0 0)", "drop-shadow(rgb(0, 0, 0) 0px 0px 0px)"); // Three values with zero length |
+assert_computed_style("webkitFilter", |
+ "drop-shadow(1px 2px)", "drop-shadow(rgb(0, 0, 0) 1px 2px 0px)"); // Two values no color |
+ |
+// Combinations |
+assert_computed_style("webkitFilter", "grayscale(1) url('#a')", 'grayscale(1) url("#a")'); |
+assert_computed_style("webkitFilter", "sepia(0.5) grayscale(0.25)"); |
+assert_computed_style("webkitFilter", "saturate(0.5) grayscale(0.25)"); |
+assert_computed_style("webkitFilter", "hue-rotate(10deg) grayscale(0.25)"); |
+assert_computed_style("webkitFilter", "invert(0.5) grayscale(0.25)"); |
+assert_computed_style("webkitFilter", "opacity(0.5) grayscale(0.25)"); |
+assert_computed_style("webkitFilter", "brightness(0.5) grayscale(0.25)"); |
+assert_computed_style("webkitFilter", "contrast(0.5) grayscale(0.25)"); |
+assert_computed_style("webkitFilter", |
+ "grayscale(0.5) sepia(0.25) saturate(0.75) hue-rotate(35deg) invert(0.2) opacity(0.9) blur(5px)"); |
+assert_computed_style("webkitFilter", |
+ "grayscale(50%) sepia(25%) saturate(75%) invert(20%) opacity(90%) brightness(60%) contrast(30%)", |
+ "grayscale(0.5) sepia(0.25) saturate(0.75) invert(0.2) opacity(0.9) brightness(0.6) contrast(0.3)"); |
+</script> |