chromium/third_party/blink/web_tests/css3/filters/filter-property-parsing-invalid.html

<!DOCTYPE html>
<title>Parsing of the filter property; invalid values</title>
<script src="../../resources/testharness.js"></script>
<script src="../../resources/testharnessreport.js"></script>
<script src="../../css-parser/resources/property-parsing-test.js"></script>
<script>
assert_invalid_value("filter", "url(#a #b)"); // Too many parameters

assert_invalid_value("filter", "grayscale(10px)"); // Length instead of number
assert_invalid_value("filter", "grayscale(0.5 0.5)"); // Too many parameters
assert_invalid_value("filter", "grayscale(0.5, 0.5)"); // Too many parameters and commas
assert_invalid_value("filter", "grayscale(0.5,)"); // Trailing comma
assert_invalid_value("filter", "grayscale(-0.5)"); // Negative parameter
assert_invalid_value("filter", "grayscale(-10%)"); // Negative percent

assert_invalid_value("filter", "sepia(0.5 0.5 3.0)"); // Too many parameters
assert_invalid_value("filter", "sepia(0.1, 0.1)"); // Too many parameters and commas
assert_invalid_value("filter", "sepia(0.5,)"); // Trailing comma
assert_invalid_value("filter", "sepia(-0.01)"); // Negative parameter
assert_invalid_value("filter", "sepia(-10%)"); // Negative percent

assert_invalid_value("filter", "saturate(10px)"); // Length instead of number
assert_invalid_value("filter", "saturate(0.5 0.5)"); // Too many parameters
assert_invalid_value("filter", "saturate(0.5, 0.5)"); // Too many parameters and commas
assert_invalid_value("filter", "saturate(0.5,)"); // Trailing comma
assert_invalid_value("filter", "saturate(-0.5)"); // Negative parameter
assert_invalid_value("filter", "saturate(-10%)"); // Negative percent

assert_invalid_value("filter", "hue-rotate(10)"); // Bare number
assert_invalid_value("filter", "hue-rotate(10px)"); // Length
assert_invalid_value("filter", "hue-rotate(10deg 4)"); // Too many parameters
assert_invalid_value("filter", "hue-rotate(10deg, 5deg)"); // Too many parameters and commas
assert_invalid_value("filter", "hue-rotate(10deg,)"); // Trailing comma

assert_invalid_value("filter", "invert(10px)"); // Length instead of number
assert_invalid_value("filter", "invert(0.5 0.5)"); // Too many parameters
assert_invalid_value("filter", "invert(0.5, 0.5)"); // Too many parameters and commas
assert_invalid_value("filter", "invert(0.5,)"); // Trailing comma
assert_invalid_value("filter", "invert(-0.5)"); // Negative parameter

assert_invalid_value("filter", "opacity(10px)"); // Length instead of number
assert_invalid_value("filter", "opacity(0.5 0.5)"); // Too many parameters
assert_invalid_value("filter", "opacity(0.5, 0.5)"); // Too many parameters and commas
assert_invalid_value("filter", "opacity(0.5,)"); // Trailing comma
assert_invalid_value("filter", "opacity(-0.5)"); // Negative parameter
assert_invalid_value("filter", "opacity(-10%)"); // Negative percent

assert_invalid_value("filter", "brightness(10px)"); // Length instead of number
assert_invalid_value("filter", "brightness(0.5 0.5)"); // Too many parameters
assert_invalid_value("filter", "brightness(0.5, 0.5)"); // Too many parameters and commas
assert_invalid_value("filter", "brightness(0.5,)"); // Trailing comma
assert_invalid_value("filter", "brightness(-1.1)"); // Parameter is negative

assert_invalid_value("filter", "contrast(10px)"); // Length instead of number
assert_invalid_value("filter", "contrast(0.5 0.5)"); // Too many parameters
assert_invalid_value("filter", "contrast(0.5, 0.5)"); // Too many parameters and commas
assert_invalid_value("filter", "contrast(0.5,)"); // Trailing comma
assert_invalid_value("filter", "contrast(-0.5)"); // Negative parameter
assert_invalid_value("filter", "contrast(-10%)"); // Negative percent

assert_invalid_value("filter", "blur(1)"); // Bare number
assert_invalid_value("filter", "blur(-1px)"); // Negative number
assert_invalid_value("filter", "blur(10%)"); // Percentage
assert_invalid_value("filter", "blur(1px 1px)"); // Too many parameters
assert_invalid_value("filter", "blur(1em, 1em)"); // Too many parameters and commas
assert_invalid_value("filter", "blur(10px, 10px)"); // Commas
assert_invalid_value("filter", "blur(1em,)"); // Trailing comma

assert_invalid_value("filter", "drop-shadow()"); // No values
assert_invalid_value("filter", "drop-shadow(red)"); // Missing lengths
assert_invalid_value("filter", "drop-shadow(red 1px)"); // Not enough lengths
assert_invalid_value("filter", "drop-shadow(red 1 2 3)"); // Missing units
assert_invalid_value("filter", "drop-shadow(red 1px 2px 3px inset)"); // Inset
assert_invalid_value("filter", "drop-shadow(red 1px 2px 3px 4px)"); // Too many parameters
assert_invalid_value("filter", "drop-shadow(red, 1px, 2px, 3px)"); // Commas
assert_invalid_value("filter", "drop-shadow(10px 10px -1px red)"); // Negative radius

assert_invalid_value("filter", "fancify(150%)"); // Unknown function
</script>