mirror of
https://github.com/servo/servo.git
synced 2025-08-06 06:00:15 +01:00
Update web-platform-tests to revision 90aab682c731f768872ca2b37f047752d5da2d8a
This commit is contained in:
parent
701b698999
commit
a71c7758db
139 changed files with 2383 additions and 998 deletions
|
@ -15,14 +15,14 @@ function rejection(promise) {
|
|||
test(() => {
|
||||
const face = new FontFace(
|
||||
'ascent-override-initial',
|
||||
'url(https://example.com/font.woff)');
|
||||
'url(https://{{host}}/font.woff)');
|
||||
assert_equals(face.ascentOverride, 'normal');
|
||||
}, "Initial value of ascentOverride should be 'normal'");
|
||||
|
||||
test(() => {
|
||||
const face = new FontFace(
|
||||
'ascent-override-initialize-with-normal',
|
||||
'url(https://example.com/font.woff)',
|
||||
'url(https://{{host}}/font.woff)',
|
||||
{ascentOverride: 'normal'});
|
||||
assert_equals(face.ascentOverride, 'normal');
|
||||
}, "Initialize ascentOverride with 'normal' should succeed");
|
||||
|
@ -30,7 +30,7 @@ test(() => {
|
|||
test(() => {
|
||||
const face = new FontFace(
|
||||
'ascent-override-initialize-with-percentage',
|
||||
'url(https://example.com/font.woff)',
|
||||
'url(https://{{host}}/font.woff)',
|
||||
{ascentOverride: '50%'});
|
||||
assert_equals(face.ascentOverride, '50%');
|
||||
}, "Initialize ascentOverride with a percentage should succeed");
|
||||
|
@ -38,7 +38,7 @@ test(() => {
|
|||
promise_test(async () => {
|
||||
const face = new FontFace(
|
||||
'ascent-override-initialize-with-negative-percentage',
|
||||
'url(https://example.com/font.woff)',
|
||||
'url(https://{{host}}/font.woff)',
|
||||
{ascentOverride: '-50%'});
|
||||
const error = await rejection(face.load());
|
||||
assert_equals('error', face.status);
|
||||
|
@ -48,7 +48,7 @@ promise_test(async () => {
|
|||
promise_test(async () => {
|
||||
const face = new FontFace(
|
||||
'ascent-override-initialize-with-non-percentage',
|
||||
'url(https://example.com/font.woff)',
|
||||
'url(https://{{host}}/font.woff)',
|
||||
{ascentOverride: '10px'});
|
||||
const error = await rejection(face.load());
|
||||
assert_equals('error', face.status);
|
||||
|
@ -58,7 +58,7 @@ promise_test(async () => {
|
|||
test(() => {
|
||||
const face = new FontFace(
|
||||
'ascent-override-normal-to-percentage',
|
||||
'url(https://example.com/font.woff)',
|
||||
'url(https://{{host}}/font.woff)',
|
||||
{ascentOverride: 'normal'});
|
||||
face.ascentOverride = '50%';
|
||||
assert_equals(face.ascentOverride, '50%');
|
||||
|
@ -67,7 +67,7 @@ test(() => {
|
|||
test(() => {
|
||||
const face = new FontFace(
|
||||
'ascent-override-percentage-to-normal',
|
||||
'url(https://example.com/font.woff)',
|
||||
'url(https://{{host}}/font.woff)',
|
||||
{ascentOverride: '50%'});
|
||||
face.ascentOverride = 'normal';
|
||||
assert_equals(face.ascentOverride, 'normal');
|
||||
|
@ -76,7 +76,7 @@ test(() => {
|
|||
test(() => {
|
||||
const face = new FontFace(
|
||||
'ascent-override-set-to-invalid',
|
||||
'url(https://example.com/font.woff)');
|
||||
'url(https://{{host}}/font.woff)');
|
||||
assert_throws_dom('SyntaxError', () => {face.ascentOverride = '10px'});
|
||||
}, "Changing ascentOverride to invalid value should fail");
|
||||
|
||||
|
@ -85,14 +85,14 @@ test(() => {
|
|||
test(() => {
|
||||
const face = new FontFace(
|
||||
'descent-override-initial',
|
||||
'url(https://example.com/font.woff)');
|
||||
'url(https://{{host}}/font.woff)');
|
||||
assert_equals(face.descentOverride, 'normal');
|
||||
}, "Initial value of descentOverride should be 'normal'");
|
||||
|
||||
test(() => {
|
||||
const face = new FontFace(
|
||||
'descent-override-initialize-with-normal',
|
||||
'url(https://example.com/font.woff)',
|
||||
'url(https://{{host}}/font.woff)',
|
||||
{descentOverride: 'normal'});
|
||||
assert_equals(face.descentOverride, 'normal');
|
||||
}, "Initialize descentOverride with 'normal' should succeed");
|
||||
|
@ -100,7 +100,7 @@ test(() => {
|
|||
test(() => {
|
||||
const face = new FontFace(
|
||||
'descent-override-initialize-with-percentage',
|
||||
'url(https://example.com/font.woff)',
|
||||
'url(https://{{host}}/font.woff)',
|
||||
{descentOverride: '50%'});
|
||||
assert_equals(face.descentOverride, '50%');
|
||||
}, "Initialize descentOverride with a percentage should succeed");
|
||||
|
@ -108,7 +108,7 @@ test(() => {
|
|||
promise_test(async () => {
|
||||
const face = new FontFace(
|
||||
'descent-override-initialize-with-negative-percentage',
|
||||
'url(https://example.com/font.woff)',
|
||||
'url(https://{{host}}/font.woff)',
|
||||
{descentOverride: '-50%'});
|
||||
const error = await rejection(face.load());
|
||||
assert_equals('error', face.status);
|
||||
|
@ -118,7 +118,7 @@ promise_test(async () => {
|
|||
promise_test(async () => {
|
||||
const face = new FontFace(
|
||||
'descent-override-initialize-with-non-percentage',
|
||||
'url(https://example.com/font.woff)',
|
||||
'url(https://{{host}}/font.woff)',
|
||||
{descentOverride: '10px'});
|
||||
const error = await rejection(face.load());
|
||||
assert_equals('error', face.status);
|
||||
|
@ -128,7 +128,7 @@ promise_test(async () => {
|
|||
test(() => {
|
||||
const face = new FontFace(
|
||||
'descent-override-normal-to-percentage',
|
||||
'url(https://example.com/font.woff)',
|
||||
'url(https://{{host}}/font.woff)',
|
||||
{descentOverride: 'normal'});
|
||||
face.descentOverride = '50%';
|
||||
assert_equals(face.descentOverride, '50%');
|
||||
|
@ -137,7 +137,7 @@ test(() => {
|
|||
test(() => {
|
||||
const face = new FontFace(
|
||||
'descent-override-percentage-to-normal',
|
||||
'url(https://example.com/font.woff)',
|
||||
'url(https://{{host}}/font.woff)',
|
||||
{descentOverride: '50%'});
|
||||
face.descentOverride = 'normal';
|
||||
assert_equals(face.descentOverride, 'normal');
|
||||
|
@ -146,7 +146,7 @@ test(() => {
|
|||
test(() => {
|
||||
const face = new FontFace(
|
||||
'descent-override-set-to-invalid',
|
||||
'url(https://example.com/font.woff)');
|
||||
'url(https://{{host}}/font.woff)');
|
||||
assert_throws_dom('SyntaxError', () => {face.descentOverride = '10px'});
|
||||
}, "Changing descentOverride to invalid value should fail");
|
||||
|
||||
|
@ -155,14 +155,14 @@ test(() => {
|
|||
test(() => {
|
||||
const face = new FontFace(
|
||||
'lineGap-override-initial',
|
||||
'url(https://example.com/font.woff)');
|
||||
'url(https://{{host}}/font.woff)');
|
||||
assert_equals(face.lineGapOverride, 'normal');
|
||||
}, "Initial value of lineGapOverride should be 'normal'");
|
||||
|
||||
test(() => {
|
||||
const face = new FontFace(
|
||||
'lineGap-override-initialize-with-normal',
|
||||
'url(https://example.com/font.woff)',
|
||||
'url(https://{{host}}/font.woff)',
|
||||
{lineGapOverride: 'normal'});
|
||||
assert_equals(face.lineGapOverride, 'normal');
|
||||
}, "Initialize lineGapOverride with 'normal' should succeed");
|
||||
|
@ -170,7 +170,7 @@ test(() => {
|
|||
test(() => {
|
||||
const face = new FontFace(
|
||||
'lineGap-override-initialize-with-percentage',
|
||||
'url(https://example.com/font.woff)',
|
||||
'url(https://{{host}}/font.woff)',
|
||||
{lineGapOverride: '50%'});
|
||||
assert_equals(face.lineGapOverride, '50%');
|
||||
}, "Initialize lineGapOverride with a percentage should succeed");
|
||||
|
@ -178,7 +178,7 @@ test(() => {
|
|||
promise_test(async () => {
|
||||
const face = new FontFace(
|
||||
'lineGap-override-initialize-with-negative-percentage',
|
||||
'url(https://example.com/font.woff)',
|
||||
'url(https://{{host}}/font.woff)',
|
||||
{lineGapOverride: '-50%'});
|
||||
const error = await rejection(face.load());
|
||||
assert_equals('error', face.status);
|
||||
|
@ -188,7 +188,7 @@ promise_test(async () => {
|
|||
promise_test(async () => {
|
||||
const face = new FontFace(
|
||||
'lineGap-override-initialize-with-non-percentage',
|
||||
'url(https://example.com/font.woff)',
|
||||
'url(https://{{host}}/font.woff)',
|
||||
{lineGapOverride: '10px'});
|
||||
const error = await rejection(face.load());
|
||||
assert_equals('error', face.status);
|
||||
|
@ -198,7 +198,7 @@ promise_test(async () => {
|
|||
test(() => {
|
||||
const face = new FontFace(
|
||||
'lineGap-override-normal-to-percentage',
|
||||
'url(https://example.com/font.woff)',
|
||||
'url(https://{{host}}/font.woff)',
|
||||
{lineGapOverride: 'normal'});
|
||||
face.lineGapOverride = '50%';
|
||||
assert_equals(face.lineGapOverride, '50%');
|
||||
|
@ -207,7 +207,7 @@ test(() => {
|
|||
test(() => {
|
||||
const face = new FontFace(
|
||||
'lineGap-override-percentage-to-normal',
|
||||
'url(https://example.com/font.woff)',
|
||||
'url(https://{{host}}/font.woff)',
|
||||
{lineGapOverride: '50%'});
|
||||
face.lineGapOverride = 'normal';
|
||||
assert_equals(face.lineGapOverride, 'normal');
|
||||
|
@ -216,7 +216,7 @@ test(() => {
|
|||
test(() => {
|
||||
const face = new FontFace(
|
||||
'lineGap-override-set-to-invalid',
|
||||
'url(https://example.com/font.woff)');
|
||||
'url(https://{{host}}/font.woff)');
|
||||
assert_throws_dom('SyntaxError', () => {face.lineGapOverride = '10px'});
|
||||
}, "Changing lineGapOverride to invalid value should fail");
|
||||
</script>
|
|
@ -0,0 +1,44 @@
|
|||
<!DOCTYPE html>
|
||||
<title>SyntaxError thrown when matching loading values with var()</title>
|
||||
<link rel="help" href="https://drafts.csswg.org/css-font-loading/#font-face-set-load">
|
||||
<link rel="help" href="https://drafts.csswg.org/css-font-loading/#find-the-matching-font-faces">
|
||||
<script src="/resources/testharness.js"></script>
|
||||
<script src="/resources/testharnessreport.js"></script>
|
||||
<script>
|
||||
|
||||
function load_on_worker(keyword) {
|
||||
return new Promise((resolve, reject) =>{
|
||||
var blob = new Blob([`
|
||||
self.fonts.load('${keyword}').then(
|
||||
()=>{ self.postMessage('success') },
|
||||
(e)=>{ self.postMessage(e) }
|
||||
);
|
||||
`]);
|
||||
var blob_url = window.URL.createObjectURL(blob);
|
||||
let worker = new Worker(blob_url);
|
||||
worker.onmessage = msg => {
|
||||
if (msg === 'success')
|
||||
resolve(msg.data)
|
||||
else
|
||||
reject(msg.data)
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
promise_test(test => {
|
||||
return promise_rejects_dom(test, 'SyntaxError', document.fonts.load('var(--x) serif'));
|
||||
}, 'Loading "var(--x) serif" causes SyntaxError (document)')
|
||||
|
||||
promise_test(test => {
|
||||
return promise_rejects_dom(test, 'SyntaxError', document.fonts.load('var(--x, 10px) serif'));
|
||||
}, 'Loading "var(--x, 10px) serif" causes SyntaxError (document)')
|
||||
|
||||
promise_test(test => {
|
||||
return promise_rejects_dom(test, 'SyntaxError', load_on_worker('var(--x) serif'));
|
||||
}, 'Loading "var(--x) serif" causes SyntaxError (worker)')
|
||||
|
||||
promise_test(test => {
|
||||
return promise_rejects_dom(test, 'SyntaxError', load_on_worker('var(--x, 10px) serif'));
|
||||
}, 'Loading "var(--x, 10px) serif" causes SyntaxError (worker)')
|
||||
|
||||
</script>
|
Loading…
Add table
Add a link
Reference in a new issue