diff --git a/css/css-images/image-set/image-set-parsing.html b/css/css-images/image-set/image-set-parsing.html index 23e1c8397ce7e4..52f99ecf0a5b6a 100644 --- a/css/css-images/image-set/image-set-parsing.html +++ b/css/css-images/image-set/image-set-parsing.html @@ -1,6 +1,7 @@ <!DOCTYPE html> <title>Image set parsing</title> <link rel="author" title="Noam Rosenthal" href="mailto:noam.j.rosenthal@gmail.com"> +<link rel="author" title="Traian Captan" href="mailto:tcaptan@chromium.org"> <link rel="help" href="https://drafts.csswg.org/css-images-4/#image-set-notation"> <meta name="assert" content="General image-set parsing follows CSS Images 4 rules."> <script src="/resources/testharness.js"></script> @@ -95,18 +96,59 @@ ); } +function test_gradient_images_parsing() { + test_valid_value_variants( + 'background-image', + "image-set(linear-gradient(black, white) 1x)" + ); + test_valid_value_variants( + 'background-image', + "image-set(repeating-linear-gradient(red, blue 25%) 1x)" + ); + test_valid_value_variants( + 'background-image', + "image-set(radial-gradient(black, white) 1x)" + ); + test_valid_value_variants( + 'background-image', + "image-set(repeating-radial-gradient(red, blue 25%) 1x)" + ); + test_valid_value_variants( + 'background-image', + "image-set(conic-gradient(black, white) 1x)" + ); + test_valid_value_variants( + 'background-image', + "image-set(repeating-conic-gradient(red, blue 25%) 1x)" + ); + test_valid_value_variants( + 'content', + 'image-set(linear-gradient(black, white) 1x, url("example.png") 4x)' + ); + test_valid_value_variants( + 'content', + 'image-set(url("example.png") 192dpi, linear-gradient(black, white) 1x)' + ); + + test_invalid_value_variants( + 'cursor', + "image-set(linear-gradient(black, white) 1x)" + ); + test_invalid_value_variants( + 'background-image', + "image-set(linear-gradient(red) 1x)" + ); +} + function test_image_set_parsing() { test_valid_value_variants('background-image', "image-set(url(example.png) 1x)", 'image-set(url("example.png") 1x)'); test_valid_value_variants('background-image', "image-set('example.jpg' 1x)", 'image-set(url("example.jpg") 1x)'); test_valid_value_variants('background-image', "image-set(url(example.png) 1x, 'example.png' 2x)", 'image-set(url("example.png") 1x, url("example.png") 2x)'); test_valid_value_variants('background-image', "image-set(url(example.png) 1dpcm, 'example.png' 2x)", 'image-set(url("example.png") 1dpcm, url("example.png") 2x)'); test_valid_value_variants('background-image', "image-set('example.jpeg' 222dpi, url(example.png) 3.5x)", 'image-set(url("example.jpeg") 222dpi, url("example.png") 3.5x)'); - test_valid_value_variants('background-image', "image-set(linear-gradient(black, white) 1x)"); test_valid_value_variants('background-image', 'image-set(url("example.png") 1x type("image/png"))'); test_valid_value_variants('background-image', "image-set(url(example.png) type('image/png'))", 'image-set(url("example.png") 1x type("image/png"))'); test_valid_value_variants('background-image', "image-set(url(example.png) type('image/png') 1x)", 'image-set(url("example.png") 1x type("image/png"))'); - test_valid_value_variants('content', "image-set(linear-gradient(black, white) 1x, 'example.png' 4x)", 'image-set(linear-gradient(black, white) 1x, url("example.png") 4x)'); - test_valid_value_variants('content', 'image-set(url("example.png") 192dpi, linear-gradient(black, white) 1x)'); test_invalid_value_variants('background-image', "image-set(none, url(example.png) 1x)"); test_invalid_value_variants('background-image', "image-set()"); @@ -117,14 +159,13 @@ test_invalid_value_variants('background-image', "image-set(url(example.png) type('image/png') type('image/png'))"); test_invalid_value_variants('background-image', "image-set(url(example.png) 1xtype('image/png'))"); test_invalid_value_variants('background-image', "image-set(type('image/png') url(example.png) 1x)"); - test_invalid_value_variants('cursor', "image-set(linear-gradient(black, white) 1x)"); - test_invalid_value_variants('background-image', "image-set(url(example.png) 1x url(example.jpeg))"); test_invalid_value_variants('background-image', "image-set(url(example.png) 1x 2x)"); test_invalid_value_variants('background-image', "image-set(image-set(url(example.png)) 2x)"); test_default_resolution_parsing(); test_resolution_units_parsing(); + test_gradient_images_parsing(); } test_image_set_parsing();