mirror of
https://github.com/servo/servo.git
synced 2025-08-18 20:05:34 +01:00
Update web-platform-tests to revision b'4a4653e088039aec186d6dc1d488120d77695c3a'
This commit is contained in:
parent
470a50ab60
commit
6337336fab
1043 changed files with 19705 additions and 6973 deletions
|
@ -46,12 +46,12 @@
|
|||
{ src: 'url("foo.ttf") format(embedded-opentype), url("bar.html")', valid: true },
|
||||
{ src: 'url("foo.ttf") format("svg"), url("bar.html")', valid: true },
|
||||
{ src: 'url("foo.ttf") format(svg), url("bar.html")', valid: true },
|
||||
// Hard parsing errors should make the line invalid.
|
||||
{ src: 'url("foo.ttf") format(xyzz 200px), url("bar.html")', valid: false },
|
||||
{ src: 'url("foo.ttf") format(xyzz), url("bar.html")', valid: false },
|
||||
{ src: 'url("foo.ttf") dummy(xyzzy), url("bar.html")', valid: false },
|
||||
{ src: 'url("foo.ttf") format(), url("bar.html")', valid: false },
|
||||
{ src: 'url("foo.ttf") format(none), url("bar.html")', valid: false },
|
||||
// A parsing error in one component does not make the entire descriptor invalid.
|
||||
{ src: 'url("foo.ttf") format(xyzz 200px), url("bar.html")', valid: true },
|
||||
{ src: 'url("foo.ttf") format(xyzz), url("bar.html")', valid: true },
|
||||
{ src: 'url("foo.ttf") dummy(xyzzy), url("bar.html")', valid: true },
|
||||
{ src: 'url("foo.ttf") format(), url("bar.html")', valid: true },
|
||||
{ src: 'url("foo.ttf") format(none), url("bar.html")', valid: true },
|
||||
];
|
||||
|
||||
for (let t of tests) {
|
||||
|
|
|
@ -0,0 +1,43 @@
|
|||
<!DOCTYPE html>
|
||||
<title>CSS Fonts 4 test: parsing the src descriptor list</title>
|
||||
<meta name="assert" content="A parse error in one component of the source list does not invalidate the entire descriptor">
|
||||
<link rel="help" href="https://drafts.csswg.org/css-fonts/#font-face-src-parsing">
|
||||
<script src="/resources/testharness.js"></script>
|
||||
<script src="/resources/testharnessreport.js"></script>
|
||||
<style id="testStyle">
|
||||
</style>
|
||||
<script>
|
||||
const sheet = testStyle.sheet;
|
||||
tests = [
|
||||
// A component with a parse error does not invalidate the entire descriptor
|
||||
// if there's some other valid component present.
|
||||
{ src: 'local(inherit), url(foo.ttf)', valid: true },
|
||||
{ src: 'local("myfont"), local(unset)', valid: true },
|
||||
{ src: 'local(), url(foo.ttf)', valid: true },
|
||||
{ src: 'local(12px monospace), url(foo.ttf)', valid: true },
|
||||
{ src: 'local("myfont") format(opentype), url(foo.ttf)', valid: true },
|
||||
{ src: 'url(not a valid url/bar.ttf), url(foo.ttf)', valid: true },
|
||||
{ src: 'url(foo.ttf) format(bad), url(foo.ttf)', valid: true },
|
||||
{ src: 'url(foo.ttf) tech(unknown), url(foo.ttf)', valid: true },
|
||||
{ src: 'url(foo.ttf), url(something.ttf) format(broken)', valid: true },
|
||||
{ src: '/* an empty component */, url(foo.ttf)', valid: true },
|
||||
{ src: 'local(""), url(foo.ttf), unparseable-garbage, local("another font name")', valid: true },
|
||||
// But if all components are bad, the descriptor is invalid.
|
||||
{ src: 'local(), local(initial)', valid: false },
|
||||
{ src: 'local("textfont") format(opentype), local("emoji") tech(color-COLRv0)', valid: false },
|
||||
{ src: 'local(), /*empty*/, url(should be quoted.ttf), junk', valid: false },
|
||||
{ src: 'url(foo.ttf) format(unknown), url(bar.ttf) tech(broken)', valid: false },
|
||||
];
|
||||
|
||||
for (let t of tests) {
|
||||
test(() => {
|
||||
assert_equals(sheet.cssRules.length, 0, "testSheet should initially be empty");
|
||||
sheet.insertRule("@font-face { src: " + t.src + "}");
|
||||
try {
|
||||
assert_equals(sheet.cssRules[0].style.getPropertyValue("src") != "", t.valid);
|
||||
} finally {
|
||||
sheet.deleteRule(0);
|
||||
}
|
||||
}, "Check that src: " + t.src + " is " + (t.valid ? "valid" : "invalid"));
|
||||
}
|
||||
</script>
|
|
@ -53,9 +53,10 @@
|
|||
{ src: 'url("foo.ttf") dummy("opentype") tech(variations)', valid: false },
|
||||
{ src: 'url("foo.ttf") dummy("opentype") dummy(variations)', valid: false },
|
||||
{ src: 'url("foo.ttf") format(opentype) tech(features-opentype) dummy(something)', valid: false },
|
||||
// Valid value after unparseable value must be ignored.
|
||||
{ src: 'url("foo.ttf") format(dummy), url("foo.ttf") tech(variations)', valid: false },
|
||||
{ src: 'url("foo.ttf") tech(color, url("bar.html")', valid: false },
|
||||
// A parsing error in one component does not make the entire descriptor invalid.
|
||||
{ src: 'url("foo.ttf") format(dummy), url("foo.ttf") tech(variations)', valid: true },
|
||||
// check_same_tech isn't currently smart enough to handle this.
|
||||
{ src: 'url("foo.ttf") tech(color), url("bar.html")', dontcomparetech: true, valid: true },
|
||||
];
|
||||
|
||||
// Assert that the two arguments have the same set of keywords in the tech() function,
|
||||
|
@ -69,7 +70,9 @@
|
|||
const tech = /tech\((.+)\)/;
|
||||
var specified_techs = tech.exec(specified)[1].split(/,\s*/).sort().join(", ");
|
||||
var serialized_techs = tech.exec(serialized)[1].split(/,\s*/).sort().join(", ");
|
||||
assert_equals(serialized_techs, specified_techs, "expected matching tech() lists");
|
||||
// Per CSSOM spec, keywords are serialized in ASCII-lowercase form:
|
||||
// https://drafts.csswg.org/cssom/#serialize-a-css-component-value
|
||||
assert_equals(serialized_techs, specified_techs.toLowerCase(), "expected matching tech() lists");
|
||||
}
|
||||
|
||||
for (let t of tests) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue