Update web-platform-tests to revision b'2703c75d5e889bb7c6a918de44841bf9de8d63a7'

This commit is contained in:
WPT Sync Bot 2023-03-25 01:51:50 +00:00
parent d8e886a792
commit 7bf23c63b3
338 changed files with 9438 additions and 933 deletions

View file

@ -0,0 +1,16 @@
<!DOCTYPE html>
<title>Image set calc x rendering</title>
<link rel="help" href="https://drafts.csswg.org/css-images-4/#image-set-notation">
<link rel="match" href="reference/image-set-rendering-ref.html">
<meta name="assert" content="image-set calc x rendering">
<style>
#test {
background-image: image-set(
url("/images/green.png") calc(0.5x * 2),
url("/images/red.png") 2x
);
width: 100px;
height: 100px;
}
</style>
<div id="test"></div>

View file

@ -0,0 +1,13 @@
<!DOCTYPE html>
<title>Image set calc x rendering</title>
<link rel="help" href="https://drafts.csswg.org/css-images-4/#image-set-notation">
<link rel="match" href="reference/image-set-rendering-ref.html">
<meta name="assert" content="image-set calc x rendering">
<style>
#test {
background-image: image-set(url("/images/green.png") calc(0.5x * 2));
width: 100px;
height: 100px;
}
</style>
<div id="test"></div>

View file

@ -16,6 +16,32 @@ function test_computed_value_variants(property, specified, computed) {
test_computed_value(property, "-webkit-" + specified, computed);
}
function test_calculated_resolution_units() {
test_computed_value_variants(
'background-image',
"image-set(url('http://{{host}}/example.png') calc(1x * 2))",
'image-set(url("http://{{host}}/example.png") 2dppx)'
);
test_computed_value_variants(
'background-image',
"image-set(url('http://{{host}}/example.png') calc(6dppx / 3))",
'image-set(url("http://{{host}}/example.png") 2dppx)'
);
test_computed_value_variants(
'background-image',
"image-set(url('http://{{host}}/example.png') calc(100dpi - 4dpi))",
'image-set(url("http://{{host}}/example.png") 1dppx)'
);
test_computed_value_variants(
'background-image',
"image-set(url('http://{{host}}/example.png') calc(37dpcm + 0.79532dpcm))",
'image-set(url("http://{{host}}/example.png") 1dppx)'
);
}
// The resolution unit is expected to be converted to the canonical unit 'dppx'
// for computed style.
test_computed_value_variants('background-image', "image-set(url(http://{{host}}/example.png) 1x)", 'image-set(url("http://{{host}}/example.png") 1dppx)');
@ -33,4 +59,6 @@ test_computed_value_variants('content', "image-set(url('http://{{host}}/example.
// Unsupported type should still serialize.
test_computed_value_variants('background-image', 'image-set(url("http://{{host}}/example.png") type("image/unsupported"))', 'image-set(url("http://{{host}}/example.png") 1dppx type("image/unsupported"))');
test_computed_value_variants('background-image', 'image-set(url("http://{{host}}/example.png") 2x type("image/unsupported"), url("http://{{host}}/example.png") 1x type("image/unsupported"))', 'image-set(url("http://{{host}}/example.png") 2dppx type("image/unsupported"), url("http://{{host}}/example.png") 1dppx type("image/unsupported"))');
test_calculated_resolution_units();
</script>

View file

@ -1,18 +1,18 @@
import os
import sys
HERE = os.path.abspath(os.path.dirname(__file__))
def generate_file(source, destination, tag, name, image_source):
file = open(source)
lines = file.read()
file.close()
with open(os.path.join(HERE, source)) as file:
lines = file.read()
replaced_lines = lines.replace('__TAG__',
tag).replace('__NAME__', name).replace(
'__IMAGE_SOURCE__', image_source)
replaced_lines = '<!-- This is an autogen file. Run support/generate_object_view_box_tests.py to update -->\n' + replaced_lines
new_file = open(destination, "w")
new_file.write(replaced_lines)
new_file.close()
with open(os.path.join(HERE, destination), "w") as new_file:
new_file.write(replaced_lines)
def generate_for_object_fit(object_fit):
@ -24,14 +24,12 @@ def generate_for_object_fit(object_fit):
]
for i in range(len(names)):
source = 'object-view-box-fit-' + object_fit + '-template.html'
destination = '../object-view-box-fit-' + object_fit + '-' + names[
i] + '.html'
source = f'object-view-box-fit-{object_fit}-template.html'
destination = f'../object-view-box-fit-{object_fit}-{names[i]}.html'
generate_file(source, destination, tags[i], names[i], image_sources[i])
source = 'object-view-box-fit-' + object_fit + '-ref-template.html'
destination = '../object-view-box-fit-' + object_fit + '-' + names[
i] + '-ref.html'
source = f'object-view-box-fit-{object_fit}-ref-template.html'
destination = f'../object-view-box-fit-{object_fit}-{names[i]}-ref.html'
generate_file(source, destination, tags[i], names[i], image_sources[i])
@ -45,12 +43,11 @@ def generate_for_writing_mode():
for i in range(len(names)):
source = 'object-view-box-writing-mode-template.html'
destination = '../object-view-box-writing-mode-' + names[i] + '.html'
destination = f'../object-view-box-writing-mode-{names[i]}.html'
generate_file(source, destination, tags[i], names[i], image_sources[i])
source = 'object-view-box-writing-mode-ref-template.html'
destination = '../object-view-box-writing-mode-' + names[
i] + '-ref.html'
destination = f'../object-view-box-writing-mode-{names[i]}-ref.html'
generate_file(source, destination, tags[i], names[i], image_sources[i])