diff options
author | WPT Sync Bot <josh+wptsync@joshmatthews.net> | 2018-03-26 21:10:36 -0400 |
---|---|---|
committer | WPT Sync Bot <josh+wptsync@joshmatthews.net> | 2018-03-26 22:40:53 -0400 |
commit | c6c4fb2f7a62b295c39e53a8600b74df203e53ab (patch) | |
tree | f0c151ad0ad73321973e2695509f4c1cb4c8e2f9 /tests/wpt/web-platform-tests | |
parent | 1981efcc3585d244f6293716fbcf833afa58e629 (diff) | |
download | servo-c6c4fb2f7a62b295c39e53a8600b74df203e53ab.tar.gz servo-c6c4fb2f7a62b295c39e53a8600b74df203e53ab.zip |
Update web-platform-tests to revision 06f77f6bfaa86f3643a79f1ec2c49c6b6955cf18
Diffstat (limited to 'tests/wpt/web-platform-tests')
46 files changed, 1550 insertions, 90 deletions
diff --git a/tests/wpt/web-platform-tests/common/worklet-reftest.js b/tests/wpt/web-platform-tests/common/worklet-reftest.js index 49e129ee0aa..abdda5b05e7 100644 --- a/tests/wpt/web-platform-tests/common/worklet-reftest.js +++ b/tests/wpt/web-platform-tests/common/worklet-reftest.js @@ -1,25 +1,33 @@ +// Imports code into a worklet. E.g. +// +// importWorklet(CSS.paintWorklet, {url: 'script.js'}); +// importWorklet(CSS.paintWorklet, '/* javascript string */'); +function importWorklet(worklet, code) { + let url; + if (typeof code === 'object') { + url = code.url; + } else { + const blob = new Blob([code], {type: 'text/javascript'}); + url = URL.createObjectURL(blob); + } + + return worklet.addModule(url); +} + // To make sure that we take the snapshot at the right time, we do double // requestAnimationFrame. In the second frame, we take a screenshot, that makes // sure that we already have a full frame. -function importWorkletAndTerminateTestAfterAsyncPaint(worklet, code) { +async function importWorkletAndTerminateTestAfterAsyncPaint(worklet, code) { if (typeof worklet === 'undefined') { takeScreenshot(); return; } - let url; - if (typeof code === 'object') { - url = code.url; - } else { - const blob = new Blob([code], {type: 'text/javascript'}); - url = URL.createObjectURL(blob); - } + await importWorklet(worklet, code); - worklet.addModule(url).then(function() { + requestAnimationFrame(function() { requestAnimationFrame(function() { - requestAnimationFrame(function() { - takeScreenshot(); - }); + takeScreenshot(); }); }); } diff --git a/tests/wpt/web-platform-tests/css/css-flexbox/table-as-item-auto-min-width.html b/tests/wpt/web-platform-tests/css/css-flexbox/table-as-item-auto-min-width.html new file mode 100644 index 00000000000..66a77327f0f --- /dev/null +++ b/tests/wpt/web-platform-tests/css/css-flexbox/table-as-item-auto-min-width.html @@ -0,0 +1,11 @@ +<!DOCTYPE html> +<title>CSS Flexbox Test: Flex item as table, specified width less than minimum intrinsic width</title> +<link rel="author" title="Morten Stenshorne" href="mailto:mstensho@chromium.org"> +<link rel="help" href="https://www.w3.org/TR/css-flexbox-1/#layout-algorithm" title="9. Flex Layout Algorithm"> +<link rel="match" href="../reference/ref-filled-green-100px-square.xht"> +<p>Test passes if there is a filled green square and <strong>no red</strong>.</p> +<div style="display:flex; width:100px; background:red;"> + <div style="display:table; width:10px; max-width:10px; height:100px; background:green;"> + <div style="width:100px; height:10px; background:green;"></div> + </div> +</div> diff --git a/tests/wpt/web-platform-tests/css/css-layout-api/fallback-layout-invalid-child.https.html b/tests/wpt/web-platform-tests/css/css-layout-api/fallback-layout-invalid-child.https.html new file mode 100644 index 00000000000..19b4188a839 --- /dev/null +++ b/tests/wpt/web-platform-tests/css/css-layout-api/fallback-layout-invalid-child.https.html @@ -0,0 +1,84 @@ +<!DOCTYPE html> +<html class=reftest-wait> +<link rel="help" href="https://drafts.css-houdini.org/css-layout-api/#invoke-a-layout-callback"> +<link rel="match" href="fallback-ref.html"> +<meta name="assert" content="This test checks that a layout() class performing layout on an invalid child will fallback to block layout." /> +<style> +.test { + background: red; + border: solid 2px; + width: 100px; +} + +.test > div { + height: 100px; +} + +@supports (display: layout(bad-child-layout)) { + .test { + display: layout(bad-child-layout); + background: green; + } +} +</style> +<script src="/common/reftest-wait.js"></script> +<script src="/common/worklet-reftest.js"></script> + +<div class="test"> + <div></div> +</div> + +<script id="code" type="text/worklet"> +registerLayout('bad-child-layout', class { + static get inputProperties() { return ['--fail']; } + + *intrinsicSizes() {} + *layout(children, _, __, styleMap) { + if (styleMap.get('--fail').toString() !== 'true') { + this.child = children[0]; + } + + // Try to perform layout on the child. If its invalid (we skipped the if + // statement above) we should fallback to block layout. + const fragment = yield this.child.layoutNextFragment({}); + + return {autoBlockSize: 0, childFragments: [fragment]}; + } +}); +</script> + +<script> +function raf() { + return new Promise((resolve) => { + requestAnimationFrame(() => { + resolve(); + }); + }); +} + +(async function() { + if (typeof CSS.layoutWorklet === 'undefined') { + takeScreenshot(); + return; + } + + await importWorklet(CSS.layoutWorklet, document.getElementById('code').textContent); + + // Ensure that all instances have a child to perform an invalid layout upon. + const test = document.getElementsByClassName('test')[0]; + for (let i = 0; i < 100; i++) { + test.innerHTML = '<div><div>'; + await raf(); + } + + // The next layout should mean that we will fallback to block. + test.innerHTML = '<div></div>'; + test.style.setProperty('--fail', 'true'); + + // Finish up the test. + await raf(); + await raf(); + takeScreenshot(); +})(); +</script> +</html> diff --git a/tests/wpt/web-platform-tests/css/css-layout-api/fallback-layout-invalid-fragment-request.https.html b/tests/wpt/web-platform-tests/css/css-layout-api/fallback-layout-invalid-fragment-request.https.html new file mode 100644 index 00000000000..ccbf38b4fd2 --- /dev/null +++ b/tests/wpt/web-platform-tests/css/css-layout-api/fallback-layout-invalid-fragment-request.https.html @@ -0,0 +1,84 @@ +<!DOCTYPE html> +<html class=reftest-wait> +<link rel="help" href="https://drafts.css-houdini.org/css-layout-api/#invoke-a-layout-callback"> +<link rel="match" href="fallback-ref.html"> +<meta name="assert" content="This test checks that a layout() class performing layout on an invalid fragment request will fallback to block layout." /> +<style> +.test { + background: red; + border: solid 2px; + width: 100px; +} + +.test > div { + height: 100px; +} + +@supports (display: layout(bad-request)) { + .test { + display: layout(bad-request); + background: green; + } +} +</style> +<script src="/common/reftest-wait.js"></script> +<script src="/common/worklet-reftest.js"></script> + +<div class="test"> + <div></div> +</div> + +<script id="code" type="text/worklet"> +registerLayout('bad-request', class { + static get inputProperties() { return ['--fail']; } + + *intrinsicSizes() {} + *layout(children, _, __, styleMap) { + if (styleMap.get('--fail').toString() !== 'true') { + this.request = children[0].layoutNextFragment({}); + } + + // Try to perform layout on the child. If its invalid (we skipped the if + // statement above) we should fallback to block layout. + const childFragments = yield [this.request]; + + return {autoBlockSize: 0, childFragments}; + } +}); +</script> + +<script> +function raf() { + return new Promise((resolve) => { + requestAnimationFrame(() => { + resolve(); + }); + }); +} + +(async function() { + if (typeof CSS.layoutWorklet === 'undefined') { + takeScreenshot(); + return; + } + + await importWorklet(CSS.layoutWorklet, document.getElementById('code').textContent); + + // Ensure that all instances have a child to perform an invalid layout upon. + const test = document.getElementsByClassName('test')[0]; + for (let i = 0; i < 100; i++) { + test.innerHTML = '<div><div>'; + await raf(); + } + + // The next layout should mean that we will fallback to block. + test.innerHTML = '<div></div>'; + test.style.setProperty('--fail', 'true'); + + // Finish up the test. + await raf(); + await raf(); + takeScreenshot(); +})(); +</script> +</html> diff --git a/tests/wpt/web-platform-tests/css/css-layout-api/fallback-layout-invalid-fragment.https.html b/tests/wpt/web-platform-tests/css/css-layout-api/fallback-layout-invalid-fragment.https.html new file mode 100644 index 00000000000..e4253ff3935 --- /dev/null +++ b/tests/wpt/web-platform-tests/css/css-layout-api/fallback-layout-invalid-fragment.https.html @@ -0,0 +1,82 @@ +<!DOCTYPE html> +<html class=reftest-wait> +<link rel="help" href="https://drafts.css-houdini.org/css-layout-api/#invoke-a-layout-callback"> +<link rel="match" href="fallback-ref.html"> +<meta name="assert" content="This test checks that a layout() class returning an invalid fragment will fallback to block layout." /> +<style> +.test { + background: red; + border: solid 2px; + width: 100px; +} + +.test > div { + height: 100px; +} + +@supports (display: layout(bad-request)) { + .test { + display: layout(bad-request); + background: green; + } +} +</style> +<script src="/common/reftest-wait.js"></script> +<script src="/common/worklet-reftest.js"></script> + +<div class="test"> + <div></div> +</div> + +<script id="code" type="text/worklet"> +registerLayout('bad-request', class { + static get inputProperties() { return ['--fail']; } + + *intrinsicSizes() {} + *layout(children, _, __, styleMap) { + if (styleMap.get('--fail').toString() !== 'true') { + this.fragment = yield children[0].layoutNextFragment({}); + } + + // Return, if the fragment is invalid (we skipped the if statement above) + // we should fallback to block layout. + return {autoBlockSize: 0, childFragments: [this.fragment]}; + } +}); +</script> + +<script> +function raf() { + return new Promise((resolve) => { + requestAnimationFrame(() => { + resolve(); + }); + }); +} + +(async function() { + if (typeof CSS.layoutWorklet === 'undefined') { + takeScreenshot(); + return; + } + + await importWorklet(CSS.layoutWorklet, document.getElementById('code').textContent); + + // Ensure that all instances have a child to perform an invalid layout upon. + const test = document.getElementsByClassName('test')[0]; + for (let i = 0; i < 100; i++) { + test.innerHTML = '<div><div>'; + await raf(); + } + + // The next layout should mean that we will fallback to block. + test.innerHTML = '<div></div>'; + test.style.setProperty('--fail', 'true'); + + // Finish up the test. + await raf(); + await raf(); + takeScreenshot(); +})(); +</script> +</html> diff --git a/tests/wpt/web-platform-tests/css/css-layout-api/perform-child-layout-fixed-block-size-vrl.https.html b/tests/wpt/web-platform-tests/css/css-layout-api/perform-child-layout-fixed-block-size-vrl.https.html new file mode 100644 index 00000000000..1fbfec9f792 --- /dev/null +++ b/tests/wpt/web-platform-tests/css/css-layout-api/perform-child-layout-fixed-block-size-vrl.https.html @@ -0,0 +1,61 @@ +<!DOCTYPE html> +<html class=reftest-wait> +<link rel="help" href="https://drafts.css-houdini.org/css-layout-api/#dom-layoutconstraintsoptions-fixedinlinesize"> +<link rel="match" href="layout-child-ref.html"> +<meta name="assert" content="This test checks that fixing the block size of children works as expected." /> + +<style> +.test { + writing-mode: vertical-rl; + background: red; + margin: 10px; + height: 100px; +} + +.htb { + writing-mode: horizontal-tb; + visibility: hidden; + width: 3px; + height: 2px; + + --fixed-block-size: 10; + + --inline-size-expected: 2; + --block-size-expected: 10; +} + +.vrl { + writing-mode: vertical-rl; + visibility: hidden; + width: 3px; + height: 2px; + + --fixed-block-size: 10; + + --inline-size-expected: 2; + --block-size-expected: 10; +} + +@supports (display: layout(test)) { + .test { + background: green; + display: layout(test); + } +} +</style> +<script src="/common/reftest-wait.js"></script> +<script src="/common/worklet-reftest.js"></script> + +<div class="test"> + <div class="htb"></div> + <div class="vrl"></div> + <!-- min/max-width should have no effect, fixedBlockSize wins. --> + <div class="htb" style="max-width: 5px;"></div> + <div class="vrl" style="max-width: 5px;"></div> + <div class="htb" style="min-width: 15px;"></div> + <div class="vrl" style="min-width: 15px;"></div> +</div> + +<script> +importWorkletAndTerminateTestAfterAsyncPaint(CSS.layoutWorklet, {url: 'support/layout-child-fixed-sizes-worklet.js'}); +</script> diff --git a/tests/wpt/web-platform-tests/css/css-layout-api/perform-child-layout-fixed-block-size.https.html b/tests/wpt/web-platform-tests/css/css-layout-api/perform-child-layout-fixed-block-size.https.html new file mode 100644 index 00000000000..a158840894f --- /dev/null +++ b/tests/wpt/web-platform-tests/css/css-layout-api/perform-child-layout-fixed-block-size.https.html @@ -0,0 +1,60 @@ +<!DOCTYPE html> +<html class=reftest-wait> +<link rel="help" href="https://drafts.css-houdini.org/css-layout-api/#dom-layoutconstraintsoptions-fixedblocksize"> +<link rel="match" href="layout-child-ref.html"> +<meta name="assert" content="This test checks that fixing the block size of children works as expected." /> + +<style> +.test { + background: red; + margin: 10px; + width: 100px; +} + +.htb { + writing-mode: horizontal-tb; + visibility: hidden; + width: 3px; + height: 2px; + + --fixed-block-size: 10; + + --inline-size-expected: 3; + --block-size-expected: 10; +} + +.vrl { + writing-mode: vertical-rl; + visibility: hidden; + width: 3px; + height: 2px; + + --fixed-block-size: 10; + + --inline-size-expected: 3; + --block-size-expected: 10; +} + +@supports (display: layout(test)) { + .test { + background: green; + display: layout(test); + } +} +</style> +<script src="/common/reftest-wait.js"></script> +<script src="/common/worklet-reftest.js"></script> + +<div class="test"> + <div class="htb"></div> + <div class="vrl"></div> + <!-- min/max-height should have no effect, fixedBlockSize wins. --> + <div class="htb" style="max-height: 5px;"></div> + <div class="vrl" style="max-height: 5px;"></div> + <div class="htb" style="min-height: 15px;"></div> + <div class="vrl" style="min-height: 15px;"></div> +</div> + +<script> +importWorkletAndTerminateTestAfterAsyncPaint(CSS.layoutWorklet, {url: 'support/layout-child-fixed-sizes-worklet.js'}); +</script> diff --git a/tests/wpt/web-platform-tests/css/css-layout-api/perform-child-layout-fixed-inline-size-vrl.https.html b/tests/wpt/web-platform-tests/css/css-layout-api/perform-child-layout-fixed-inline-size-vrl.https.html new file mode 100644 index 00000000000..8fab5e44ac4 --- /dev/null +++ b/tests/wpt/web-platform-tests/css/css-layout-api/perform-child-layout-fixed-inline-size-vrl.https.html @@ -0,0 +1,61 @@ +<!DOCTYPE html> +<html class=reftest-wait> +<link rel="help" href="https://drafts.css-houdini.org/css-layout-api/#dom-layoutconstraintsoptions-fixedinlinesize"> +<link rel="match" href="layout-child-ref.html"> +<meta name="assert" content="This test checks that fixing the inline size of children works as expected." /> + +<style> +.test { + writing-mode: vertical-rl; + background: red; + margin: 10px; + height: 100px; +} + +.htb { + writing-mode: horizontal-tb; + visibility: hidden; + width: 3px; + height: 2px; + + --fixed-inline-size: 10; + + --inline-size-expected: 10; + --block-size-expected: 3; +} + +.vrl { + writing-mode: vertical-rl; + visibility: hidden; + width: 3px; + height: 2px; + + --fixed-inline-size: 10; + + --inline-size-expected: 10; + --block-size-expected: 3; +} + +@supports (display: layout(test)) { + .test { + background: green; + display: layout(test); + } +} +</style> +<script src="/common/reftest-wait.js"></script> +<script src="/common/worklet-reftest.js"></script> + +<div class="test"> + <div class="htb"></div> + <div class="vrl"></div> + <!-- min/max-height should have no effect, fixedInlineSize wins. --> + <div class="htb" style="max-height: 5px;"></div> + <div class="vrl" style="max-height: 5px;"></div> + <div class="htb" style="min-height: 15px;"></div> + <div class="vrl" style="min-height: 15px;"></div> +</div> + +<script> +importWorkletAndTerminateTestAfterAsyncPaint(CSS.layoutWorklet, {url: 'support/layout-child-fixed-sizes-worklet.js'}); +</script> diff --git a/tests/wpt/web-platform-tests/css/css-layout-api/perform-child-layout-fixed-inline-size.https.html b/tests/wpt/web-platform-tests/css/css-layout-api/perform-child-layout-fixed-inline-size.https.html new file mode 100644 index 00000000000..79d2aca2a75 --- /dev/null +++ b/tests/wpt/web-platform-tests/css/css-layout-api/perform-child-layout-fixed-inline-size.https.html @@ -0,0 +1,60 @@ +<!DOCTYPE html> +<html class=reftest-wait> +<link rel="help" href="https://drafts.css-houdini.org/css-layout-api/#dom-layoutconstraintsoptions-fixedinlinesize"> +<link rel="match" href="layout-child-ref.html"> +<meta name="assert" content="This test checks that fixing the inline size of children works as expected." /> + +<style> +.test { + background: red; + margin: 10px; + width: 100px; +} + +.htb { + writing-mode: horizontal-tb; + visibility: hidden; + width: 3px; + height: 2px; + + --fixed-inline-size: 10; + + --inline-size-expected: 10; + --block-size-expected: 2; +} + +.vrl { + writing-mode: vertical-rl; + visibility: hidden; + width: 3px; + height: 2px; + + --fixed-inline-size: 10; + + --inline-size-expected: 10; + --block-size-expected: 2; +} + +@supports (display: layout(test)) { + .test { + background: green; + display: layout(test); + } +} +</style> +<script src="/common/reftest-wait.js"></script> +<script src="/common/worklet-reftest.js"></script> + +<div class="test"> + <div class="htb"></div> + <div class="vrl"></div> + <!-- min/max-width should have no effect, fixedInlineSize wins. --> + <div class="htb" style="max-width: 5px;"></div> + <div class="vrl" style="max-width: 5px;"></div> + <div class="htb" style="min-width: 15px;"></div> + <div class="vrl" style="min-width: 15px;"></div> +</div> + +<script> +importWorkletAndTerminateTestAfterAsyncPaint(CSS.layoutWorklet, {url: 'support/layout-child-fixed-sizes-worklet.js'}); +</script> diff --git a/tests/wpt/web-platform-tests/css/css-layout-api/support/layout-child-fixed-sizes-worklet.js b/tests/wpt/web-platform-tests/css/css-layout-api/support/layout-child-fixed-sizes-worklet.js new file mode 100644 index 00000000000..73155732971 --- /dev/null +++ b/tests/wpt/web-platform-tests/css/css-layout-api/support/layout-child-fixed-sizes-worklet.js @@ -0,0 +1,52 @@ +import {areArraysEqual} from '/common/arrays.js'; + +function parseNumber(value) { + const num = parseInt(value.toString()); + if (isNaN(num)) return undefined; + return num; +} + +registerLayout('test', class { + static get childInputProperties() { + return [ + '--fixed-inline-size', + '--fixed-block-size', + '--inline-size-expected', + '--block-size-expected' + ]; + } + + *intrinsicSizes() {} + *layout(children, edges, constraints, styleMap) { + const childFragments = yield children.map((child) => { + const childConstraints = {}; + const fixedInlineSize = parseNumber(child.styleMap.get('--fixed-inline-size')); + const fixedBlockSize = parseNumber(child.styleMap.get('--fixed-block-size')); + return child.layoutNextFragment({fixedInlineSize, fixedBlockSize}); + }); + + const actual = childFragments.map((childFragment) => { + return { + inlineSize: childFragment.inlineSize, + blockSize: childFragment.blockSize, + }; + }); + + const expected = children.map((child) => { + return { + inlineSize: parseInt(child.styleMap.get('--inline-size-expected').toString()), + blockSize: parseInt(child.styleMap.get('--block-size-expected').toString()), + }; + }); + + const equalityFunc = (a, b) => { + return a.inlineSize == b.inlineSize && a.blockSize == b.blockSize; + }; + + if (!areArraysEqual(expected, actual, equalityFunc)) { + return {autoBlockSize: 0, childFragments}; + } + + return {autoBlockSize: 100, childFragments}; + } +}); diff --git a/tests/wpt/web-platform-tests/css/css-layout-api/support/layout-child-worklet.js b/tests/wpt/web-platform-tests/css/css-layout-api/support/layout-child-worklet.js index 0daa89d45a1..db20e2ec76b 100644 --- a/tests/wpt/web-platform-tests/css/css-layout-api/support/layout-child-worklet.js +++ b/tests/wpt/web-platform-tests/css/css-layout-api/support/layout-child-worklet.js @@ -16,9 +16,11 @@ registerLayout('test', class { return child.styleMap.get('--child').toString().trim(); }); + const childFragments = yield children.map((child) => { return child.layoutNextFragment({}); }); + if (!areArraysEqual(expected, actual)) - return {autoBlockSize: 0}; + return {autoBlockSize: 0, childFragments}; - return {autoBlockSize: 100}; + return {autoBlockSize: 100, childFragments}; } }); diff --git a/tests/wpt/web-platform-tests/css/css-sizing/intrinsic-percent-non-replaced-001-ref.html b/tests/wpt/web-platform-tests/css/css-sizing/intrinsic-percent-non-replaced-001-ref.html new file mode 100644 index 00000000000..0b217dd192c --- /dev/null +++ b/tests/wpt/web-platform-tests/css/css-sizing/intrinsic-percent-non-replaced-001-ref.html @@ -0,0 +1,71 @@ +<!DOCTYPE html> +<title>Reference</title> + +<style> + /* establish context */ + .container { + clear: both; + padding: 10px; + color: blue; + font: 20px/1 Ahem; + } + .zero { + width: 0; + } + .infinite { + width: 400px; /* close enough */ + } + + /* visualize size contribution */ + .container > div { + float: left; + border: solid orange 20px; + border-style: none solid; + } + .container > div > div { + border-right: solid 20px aqua; + } + + /* controls for min-width */ + /* content = 100% = 80px = 4ch + border */ + /* choose sizes that are larger than content to see if how they take effect */ + .control { + width: 60px; + } + .raw-percent, + .calc-percent { + width: 160px; + margin-right: -100px; + } + .no-percent { + width: 160px; + } +</style> + +<!-- calculating min-content widths --> +<div class='zero container'> + <div><div class="control">ppp pp</div></div> +</div> +<div class='zero container'> + <div><div class="raw-percent">ppp pp</div></div> +</div> +<div class='zero container'> + <div><div class="calc-percent">ppp pp</div></div> +</div> +<div class='zero container'> + <div><div class="no-percent">ppp pp</div></div> +</div> + +<!-- calculating max-content widths --> +<div class='infinite container'> + <div><div class="control">p p</div></div> +</div> +<div class='infinite container'> + <div><div class="raw-percent">p p</div></div> +</div> +<div class='infinite container'> + <div><div class="calc-percent">p p</div></div> +</div> +<div class='infinite container'> + <div><div class="no-percent">p p</div></div> +</div> diff --git a/tests/wpt/web-platform-tests/css/css-sizing/intrinsic-percent-non-replaced-001.html b/tests/wpt/web-platform-tests/css/css-sizing/intrinsic-percent-non-replaced-001.html new file mode 100644 index 00000000000..19b0a94fe36 --- /dev/null +++ b/tests/wpt/web-platform-tests/css/css-sizing/intrinsic-percent-non-replaced-001.html @@ -0,0 +1,71 @@ +<!DOCTYPE html> +<title>Percentages of min-width on non-replaced blocks are ignored for intrinsic sizing and resolved afterwards</title> +<link rel="help" href="https://www.w3.org/TR/css-sizing-3/#intrinsic-contribution"> +<link rel="match" href="intrinsic-percent-non-replaced-001-ref.html"> + +<style> + /* establish context */ + .container { + clear: both; + padding: 10px; + color: blue; + font: 20px/1 Ahem; + } + .zero { + width: 0; + } + .infinite { + width: 400px; /* close enough */ + } + + /* visualize size contribution */ + .container > div { + float: left; + border: solid orange 20px; + border-style: none solid; + } + .container > div > div { + border-right: solid 20px aqua; + } + + /* test min-width */ + /* content = 100% = 80px = 4ch + border */ + /* choose sizes that are larger than content to see if how they take effect */ + .raw-percent { + min-width: 200%; + } + .calc-percent { + min-width: calc(160px + 0%); + } + .no-percent { + min-width: 160px; + } +</style> + +<!-- calculating min-content widths --> +<div class='zero container'> + <div><div class="control">ppp pp</div></div> +</div> +<div class='zero container'> + <div><div class="raw-percent">ppp pp</div></div> +</div> +<div class='zero container'> + <div><div class="calc-percent">ppp pp</div></div> +</div> +<div class='zero container'> + <div><div class="no-percent">ppp pp</div></div> +</div> + +<!-- calculating max-content widths --> +<div class='infinite container'> + <div><div class="control">p p</div></div> +</div> +<div class='infinite container'> + <div><div class="raw-percent">p p</div></div> +</div> +<div class='infinite container'> + <div><div class="calc-percent">p p</div></div> +</div> +<div class='infinite container'> + <div><div class="no-percent">p p</div></div> +</div> diff --git a/tests/wpt/web-platform-tests/css/css-sizing/intrinsic-percent-non-replaced-002-ref.html b/tests/wpt/web-platform-tests/css/css-sizing/intrinsic-percent-non-replaced-002-ref.html new file mode 100644 index 00000000000..bb818918e2a --- /dev/null +++ b/tests/wpt/web-platform-tests/css/css-sizing/intrinsic-percent-non-replaced-002-ref.html @@ -0,0 +1,71 @@ +<!DOCTYPE html> +<title>Reference</title> + +<style> + /* establish context */ + .container { + clear: both; + padding: 10px; + color: blue; + font: 20px/1 Ahem; + } + .zero { + width: 0; + } + .infinite { + width: 400px; /* close enough */ + } + + /* visualize size contribution */ + .container > div { + float: left; /* shrinkwrap */ + border: solid orange 20px; + border-style: none solid; + } + .container > div > div { + border-right: solid 20px aqua; + } + + /* controls for width, max-width */ + /* content = 100% = 80px = 4ch + border */ + /* choose sizes that are larger than content to see if how they take effect */ + .control { + width: 60px; + } + .raw-percent, + .calc-percent { + width: 40px; + margin-right: 20px; + } + .no-percent { + width: 40px; + } +</style> + +<!-- calculating min-content widths --> +<div class='zero container'> + <div><div class="control">ppp pp</div></div> +</div> +<div class='zero container'> + <div><div class="raw-percent">ppp pp</div></div> +</div> +<div class='zero container'> + <div><div class="calc-percent">ppp pp</div></div> +</div> +<div class='zero container'> + <div><div class="no-percent">ppp pp</div></div> +</div> + +<!-- calculating max-content widths --> +<div class='infinite container'> + <div><div class="control">p p</div></div> +</div> +<div class='infinite container'> + <div><div class="raw-percent">p p</div></div> +</div> +<div class='infinite container'> + <div><div class="calc-percent">p p</div></div> +</div> +<div class='infinite container'> + <div><div class="no-percent">p p</div></div> +</div> diff --git a/tests/wpt/web-platform-tests/css/css-sizing/intrinsic-percent-non-replaced-002.html b/tests/wpt/web-platform-tests/css/css-sizing/intrinsic-percent-non-replaced-002.html new file mode 100644 index 00000000000..763549fb186 --- /dev/null +++ b/tests/wpt/web-platform-tests/css/css-sizing/intrinsic-percent-non-replaced-002.html @@ -0,0 +1,70 @@ +<!DOCTYPE html> +<title>Percentages of max-width on non-replaced blocks are ignored for intrinsic sizing and resolved afterwards</title> +<link rel="help" href="https://www.w3.org/TR/css-sizing-3/#intrinsic-contribution"> + +<style> + /* establish context */ + .container { + clear: both; + padding: 10px; + color: blue; + font: 20px/1 Ahem; + } + .zero { + width: 0; + } + .infinite { + width: 400px; /* close enough */ + } + + /* visualize size contribution */ + .container > div { + float: left; /* shrinkwrap */ + border: solid orange 20px; + border-style: none solid; + } + .container > div > div { + border-right: solid 20px aqua; + } + + /* test max-width */ + /* content = 100% = 80px = 4ch + border */ + /* choose sizes that are smaller than content to see if how they take effect */ + .raw-percent { + max-width: 50%; + } + .calc-percent { + max-width: calc(40px + 0%); + } + .no-percent { + max-width: 40px; + } +</style> + +<!-- calculating min-content widths --> +<div class='zero container'> + <div><div class="control">ppp pp</div></div> +</div> +<div class='zero container'> + <div><div class="raw-percent">ppp pp</div></div> +</div> +<div class='zero container'> + <div><div class="calc-percent">ppp pp</div></div> +</div> +<div class='zero container'> + <div><div class="no-percent">ppp pp</div></div> +</div> + +<!-- calculating max-content widths --> +<div class='infinite container'> + <div><div class="control">p p</div></div> +</div> +<div class='infinite container'> + <div><div class="raw-percent">p p</div></div> +</div> +<div class='infinite container'> + <div><div class="calc-percent">p p</div></div> +</div> +<div class='infinite container'> + <div><div class="no-percent">p p</div></div> +</div> diff --git a/tests/wpt/web-platform-tests/css/css-sizing/intrinsic-percent-non-replaced-003.html b/tests/wpt/web-platform-tests/css/css-sizing/intrinsic-percent-non-replaced-003.html new file mode 100644 index 00000000000..2dd247c9b8e --- /dev/null +++ b/tests/wpt/web-platform-tests/css/css-sizing/intrinsic-percent-non-replaced-003.html @@ -0,0 +1,71 @@ +<!DOCTYPE html> +<title>Percentages of width on non-replaced blocks are ignored for intrinsic sizing and resolved afterwards</title> +<link rel="help" href="https://www.w3.org/TR/css-sizing-3/#intrinsic-contribution"> +<link rel="match" href="intrinsic-percent-non-replaced-002-ref.html"> + +<style> + /* establish context */ + .container { + clear: both; + padding: 10px; + color: blue; + font: 20px/1 Ahem; + } + .zero { + width: 0; + } + .infinite { + width: 400px; /* close enough */ + } + + /* visualize size contribution */ + .container > div { + float: left; + border: solid orange 20px; + border-style: none solid; + } + .container > div > div { + border-right: solid 20px aqua; + } + + /* test width */ + /* content = 100% = 80px = 4ch + border */ + /* choose sizes that are different than content to see if how they take effect */ + .raw-percent { + width: 50%; + } + .calc-percent { + width: calc(40px + 0%); + } + .no-percent { + width: 40px; + } +</style> + +<!-- calculating min-content widths --> +<div class='zero container'> + <div><div class="control">ppp pp</div></div> +</div> +<div class='zero container'> + <div><div class="raw-percent">ppp pp</div></div> +</div> +<div class='zero container'> + <div><div class="calc-percent">ppp pp</div></div> +</div> +<div class='zero container'> + <div><div class="no-percent">ppp pp</div></div> +</div> + +<!-- calculating max-content widths --> +<div class='infinite container'> + <div><div class="control">p p</div></div> +</div> +<div class='infinite container'> + <div><div class="raw-percent">p p</div></div> +</div> +<div class='infinite container'> + <div><div class="calc-percent">p p</div></div> +</div> +<div class='infinite container'> + <div><div class="no-percent">p p</div></div> +</div> diff --git a/tests/wpt/web-platform-tests/css/css-typed-om/the-stylepropertymap/properties/block-size.html b/tests/wpt/web-platform-tests/css/css-typed-om/the-stylepropertymap/properties/block-size.html new file mode 100644 index 00000000000..d1a1e095775 --- /dev/null +++ b/tests/wpt/web-platform-tests/css/css-typed-om/the-stylepropertymap/properties/block-size.html @@ -0,0 +1,51 @@ +<!doctype html> +<meta charset="utf-8"> +<title>'block-size' property</title> +<link rel="help" href="https://drafts.css-houdini.org/css-typed-om-1/#dom-stylepropertymap-get"> +<link rel="help" href="https://drafts.css-houdini.org/css-typed-om-1/#dom-stylepropertymap-set"> +<link rel="help" href="https://drafts.css-houdini.org/css-typed-om-1/#property-stle-value-normalization"> +<script src="/resources/testharness.js"></script> +<script src="/resources/testharnessreport.js"></script> +<script src="../../resources/testhelper.js"></script> +<script src="resources/testsuite.js"></script> +<body> +<div id="log"></div> +<script> +'use strict'; + +runPropertyTests('block-size', [ + { syntax: 'auto' }, + { + syntax: '<percentage>', + specified: assert_is_equal_with_range_handling + }, + { + syntax: '<length>', + specified: assert_is_equal_with_range_handling + }, +]); + +runPropertyTests('min-block-size', [ + { + syntax: '<percentage>', + specified: assert_is_equal_with_range_handling + }, + { + syntax: '<length>', + specified: assert_is_equal_with_range_handling + }, +]); + +runPropertyTests('max-block-size', [ + { syntax: 'none' }, + { + syntax: '<percentage>', + specified: assert_is_equal_with_range_handling + }, + { + syntax: '<length>', + specified: assert_is_equal_with_range_handling + }, +]); + +</script>
\ No newline at end of file diff --git a/tests/wpt/web-platform-tests/css/css-typed-om/the-stylepropertymap/properties/font-family.html b/tests/wpt/web-platform-tests/css/css-typed-om/the-stylepropertymap/properties/font-family.html new file mode 100644 index 00000000000..eb35ef1799b --- /dev/null +++ b/tests/wpt/web-platform-tests/css/css-typed-om/the-stylepropertymap/properties/font-family.html @@ -0,0 +1,23 @@ +<!doctype html> +<meta charset="utf-8"> +<title>'font-family' property</title> +<link rel="help" href="https://drafts.css-houdini.org/css-typed-om-1/#dom-stylepropertymap-get"> +<link rel="help" href="https://drafts.css-houdini.org/css-typed-om-1/#dom-stylepropertymap-set"> +<link rel="help" href="https://drafts.css-houdini.org/css-typed-om-1/#property-stle-value-normalization"> +<script src="/resources/testharness.js"></script> +<script src="/resources/testharnessreport.js"></script> +<script src="../../resources/testhelper.js"></script> +<script src="resources/testsuite.js"></script> +<body> +<div id="log"></div> +<script> +'use strict'; + +// FIXME: font-family is list-valued. Run list-valued tests here too. +runUnsupportedPropertyTests('font-family', [ + 'Georgia', + '"Gill Sans"', + 'sans-serif', +]); + +</script> diff --git a/tests/wpt/web-platform-tests/css/css-typed-om/the-stylepropertymap/properties/font-language-override.html b/tests/wpt/web-platform-tests/css/css-typed-om/the-stylepropertymap/properties/font-language-override.html new file mode 100644 index 00000000000..daf380389eb --- /dev/null +++ b/tests/wpt/web-platform-tests/css/css-typed-om/the-stylepropertymap/properties/font-language-override.html @@ -0,0 +1,24 @@ +<!doctype html> +<meta charset="utf-8"> +<title>'font-language-override' property</title> +<link rel="help" href="https://drafts.css-houdini.org/css-typed-om-1/#dom-stylepropertymap-get"> +<link rel="help" href="https://drafts.css-houdini.org/css-typed-om-1/#dom-stylepropertymap-set"> +<link rel="help" href="https://drafts.css-houdini.org/css-typed-om-1/#property-stle-value-normalization"> +<script src="/resources/testharness.js"></script> +<script src="/resources/testharnessreport.js"></script> +<script src="../../resources/testhelper.js"></script> +<script src="resources/testsuite.js"></script> +<body> +<div id="log"></div> +<script> +'use strict'; + +runPropertyTests('font-language-override', [ + { syntax: 'normal' }, +]); + +runUnsupportedPropertyTests('font-language-override', [ + '"SRB"', +]); + +</script> diff --git a/tests/wpt/web-platform-tests/css/css-typed-om/the-stylepropertymap/properties/font-optical-sizing.html b/tests/wpt/web-platform-tests/css/css-typed-om/the-stylepropertymap/properties/font-optical-sizing.html new file mode 100644 index 00000000000..0018ef1390b --- /dev/null +++ b/tests/wpt/web-platform-tests/css/css-typed-om/the-stylepropertymap/properties/font-optical-sizing.html @@ -0,0 +1,21 @@ +<!doctype html> +<meta charset="utf-8"> +<title>'font-optical-sizing' property</title> +<link rel="help" href="https://drafts.css-houdini.org/css-typed-om-1/#dom-stylepropertymap-get"> +<link rel="help" href="https://drafts.css-houdini.org/css-typed-om-1/#dom-stylepropertymap-set"> +<link rel="help" href="https://drafts.css-houdini.org/css-typed-om-1/#property-stle-value-normalization"> +<script src="/resources/testharness.js"></script> +<script src="/resources/testharnessreport.js"></script> +<script src="../../resources/testhelper.js"></script> +<script src="resources/testsuite.js"></script> +<body> +<div id="log"></div> +<script> +'use strict'; + +runPropertyTests('font-optical-sizing', [ + { syntax: 'auto' }, + { syntax: 'none' }, +]); + +</script> diff --git a/tests/wpt/web-platform-tests/css/css-typed-om/the-stylepropertymap/properties/font-palette.html b/tests/wpt/web-platform-tests/css/css-typed-om/the-stylepropertymap/properties/font-palette.html new file mode 100644 index 00000000000..ad62945f6bc --- /dev/null +++ b/tests/wpt/web-platform-tests/css/css-typed-om/the-stylepropertymap/properties/font-palette.html @@ -0,0 +1,26 @@ +<!doctype html> +<meta charset="utf-8"> +<title>'font-palette' property</title> +<link rel="help" href="https://drafts.css-houdini.org/css-typed-om-1/#dom-stylepropertymap-get"> +<link rel="help" href="https://drafts.css-houdini.org/css-typed-om-1/#dom-stylepropertymap-set"> +<link rel="help" href="https://drafts.css-houdini.org/css-typed-om-1/#property-stle-value-normalization"> +<script src="/resources/testharness.js"></script> +<script src="/resources/testharnessreport.js"></script> +<script src="../../resources/testhelper.js"></script> +<script src="resources/testsuite.js"></script> +<body> +<div id="log"></div> +<script> +'use strict'; + +runPropertyTests('font-palette', [ + { syntax: 'normal' }, + { syntax: 'light' }, + { syntax: 'dark' }, +]); + +runUnsupportedPropertyTests('font-palette', [ + 'Augusta' +]); + +</script> diff --git a/tests/wpt/web-platform-tests/css/css-typed-om/the-stylepropertymap/properties/font-presentation.html b/tests/wpt/web-platform-tests/css/css-typed-om/the-stylepropertymap/properties/font-presentation.html new file mode 100644 index 00000000000..44484660d6d --- /dev/null +++ b/tests/wpt/web-platform-tests/css/css-typed-om/the-stylepropertymap/properties/font-presentation.html @@ -0,0 +1,22 @@ +<!doctype html> +<meta charset="utf-8"> +<title>'font-presentation' property</title> +<link rel="help" href="https://drafts.css-houdini.org/css-typed-om-1/#dom-stylepropertymap-get"> +<link rel="help" href="https://drafts.css-houdini.org/css-typed-om-1/#dom-stylepropertymap-set"> +<link rel="help" href="https://drafts.css-houdini.org/css-typed-om-1/#property-stle-value-normalization"> +<script src="/resources/testharness.js"></script> +<script src="/resources/testharnessreport.js"></script> +<script src="../../resources/testhelper.js"></script> +<script src="resources/testsuite.js"></script> +<body> +<div id="log"></div> +<script> +'use strict'; + +runPropertyTests('font-presentation', [ + { syntax: 'auto' }, + { syntax: 'text' }, + { syntax: 'emoji' }, +]); + +</script> diff --git a/tests/wpt/web-platform-tests/css/css-typed-om/the-stylepropertymap/properties/font-size-adjust.html b/tests/wpt/web-platform-tests/css/css-typed-om/the-stylepropertymap/properties/font-size-adjust.html new file mode 100644 index 00000000000..71cb54c7272 --- /dev/null +++ b/tests/wpt/web-platform-tests/css/css-typed-om/the-stylepropertymap/properties/font-size-adjust.html @@ -0,0 +1,24 @@ +<!doctype html> +<meta charset="utf-8"> +<title>'font-size-adjust' property</title> +<link rel="help" href="https://drafts.css-houdini.org/css-typed-om-1/#dom-stylepropertymap-get"> +<link rel="help" href="https://drafts.css-houdini.org/css-typed-om-1/#dom-stylepropertymap-set"> +<link rel="help" href="https://drafts.css-houdini.org/css-typed-om-1/#property-stle-value-normalization"> +<script src="/resources/testharness.js"></script> +<script src="/resources/testharnessreport.js"></script> +<script src="../../resources/testhelper.js"></script> +<script src="resources/testsuite.js"></script> +<body> +<div id="log"></div> +<script> +'use strict'; + +runPropertyTests('font-size-adjust', [ + { syntax: 'none' }, + { + syntax: '<number>', + specified: assert_is_equal_with_range_handling + }, +]); + +</script> diff --git a/tests/wpt/web-platform-tests/css/css-typed-om/the-stylepropertymap/properties/font-size.html b/tests/wpt/web-platform-tests/css/css-typed-om/the-stylepropertymap/properties/font-size.html index 620f68ff653..fc76e0f8764 100644 --- a/tests/wpt/web-platform-tests/css/css-typed-om/the-stylepropertymap/properties/font-size.html +++ b/tests/wpt/web-platform-tests/css/css-typed-om/the-stylepropertymap/properties/font-size.html @@ -13,53 +13,60 @@ <script> 'use strict'; -runPropertyTests('font-size', [ - { - syntax: 'xx-small', - computed: (_, result) => assert_is_unit('px', result) - }, - { - syntax: 'x-small', - computed: (_, result) => assert_is_unit('px', result) - }, - { - syntax: 'small', - computed: (_, result) => assert_is_unit('px', result) - }, - { - syntax: 'medium', - computed: (_, result) => assert_is_unit('px', result) - }, - { - syntax: 'large', - computed: (_, result) => assert_is_unit('px', result) - }, - { - syntax: 'x-large', - computed: (_, result) => assert_is_unit('px', result) - }, - { - syntax: 'xx-large', - computed: (_, result) => assert_is_unit('px', result) - }, - { - syntax: 'larger', - computed: (_, result) => assert_is_unit('px', result) - }, - { - syntax: 'smaller', - computed: (_, result) => assert_is_unit('px', result) - }, - { - syntax: '<length>', - specified: assert_is_equal_with_range_handling, - computed: (_, result) => assert_is_unit('px', result) - }, - { - syntax: '<percentage>', - specified: assert_is_equal_with_range_handling, - computed: (_, result) => assert_is_unit('px', result) - }, -]); +for (const property of ['font-size', 'font-min-size', 'font-max-size']) { + // font-max-size also supports 'infinity' keyword + const infinity = property === 'font-max-size' ? + [{ syntax: 'infinity'}] : []; + + runPropertyTests(property, [ + ...infinity, + { + syntax: 'xx-small', + computed: (_, result) => assert_is_unit('px', result) + }, + { + syntax: 'x-small', + computed: (_, result) => assert_is_unit('px', result) + }, + { + syntax: 'small', + computed: (_, result) => assert_is_unit('px', result) + }, + { + syntax: 'medium', + computed: (_, result) => assert_is_unit('px', result) + }, + { + syntax: 'large', + computed: (_, result) => assert_is_unit('px', result) + }, + { + syntax: 'x-large', + computed: (_, result) => assert_is_unit('px', result) + }, + { + syntax: 'xx-large', + computed: (_, result) => assert_is_unit('px', result) + }, + { + syntax: 'larger', + computed: (_, result) => assert_is_unit('px', result) + }, + { + syntax: 'smaller', + computed: (_, result) => assert_is_unit('px', result) + }, + { + syntax: '<length>', + specified: assert_is_equal_with_range_handling, + computed: (_, result) => assert_is_unit('px', result) + }, + { + syntax: '<percentage>', + specified: assert_is_equal_with_range_handling, + computed: (_, result) => assert_is_unit('px', result) + }, + ]); +} </script> diff --git a/tests/wpt/web-platform-tests/css/css-typed-om/the-stylepropertymap/properties/font-stretch.html b/tests/wpt/web-platform-tests/css/css-typed-om/the-stylepropertymap/properties/font-stretch.html new file mode 100644 index 00000000000..3871ff3e04f --- /dev/null +++ b/tests/wpt/web-platform-tests/css/css-typed-om/the-stylepropertymap/properties/font-stretch.html @@ -0,0 +1,32 @@ +<!doctype html> +<meta charset="utf-8"> +<title>'font-stretch' property</title> +<link rel="help" href="https://drafts.css-houdini.org/css-typed-om-1/#dom-stylepropertymap-get"> +<link rel="help" href="https://drafts.css-houdini.org/css-typed-om-1/#dom-stylepropertymap-set"> +<link rel="help" href="https://drafts.css-houdini.org/css-typed-om-1/#property-stle-value-normalization"> +<script src="/resources/testharness.js"></script> +<script src="/resources/testharnessreport.js"></script> +<script src="../../resources/testhelper.js"></script> +<script src="resources/testsuite.js"></script> +<body> +<div id="log"></div> +<script> +'use strict'; + +runPropertyTests('font-stretch', [ + { syntax: 'normal' }, + { syntax: 'ultra-condensed' }, + { syntax: 'extra-condensed' }, + { syntax: 'condensed' }, + { syntax: 'semi-condensed' }, + { syntax: 'semi-expanded' }, + { syntax: 'expanded' }, + { syntax: 'extra-expanded' }, + { syntax: 'ultra-expanded' }, + { + syntax: '<percentage>', + specified: assert_is_equal_with_range_handling + }, +]); + +</script> diff --git a/tests/wpt/web-platform-tests/css/css-typed-om/the-stylepropertymap/properties/font-synthesis.html b/tests/wpt/web-platform-tests/css/css-typed-om/the-stylepropertymap/properties/font-synthesis.html new file mode 100644 index 00000000000..b8c79e6cafe --- /dev/null +++ b/tests/wpt/web-platform-tests/css/css-typed-om/the-stylepropertymap/properties/font-synthesis.html @@ -0,0 +1,27 @@ +<!doctype html> +<meta charset="utf-8"> +<title>'font-synthesis' property</title> +<link rel="help" href="https://drafts.css-houdini.org/css-typed-om-1/#dom-stylepropertymap-get"> +<link rel="help" href="https://drafts.css-houdini.org/css-typed-om-1/#dom-stylepropertymap-set"> +<link rel="help" href="https://drafts.css-houdini.org/css-typed-om-1/#property-stle-value-normalization"> +<script src="/resources/testharness.js"></script> +<script src="/resources/testharnessreport.js"></script> +<script src="../../resources/testhelper.js"></script> +<script src="resources/testsuite.js"></script> +<body> +<div id="log"></div> +<script> +'use strict'; + +runPropertyTests('font-synthesis', [ + { syntax: 'none' }, + { syntax: 'weight' }, + { syntax: 'style' }, + { syntax: 'small-caps' }, +]); + +runUnsupportedPropertyTests('font-synthesis', [ + 'weight style', 'style small-caps', 'small-caps weight style' +]); + +</script> diff --git a/tests/wpt/web-platform-tests/css/css-typed-om/the-stylepropertymap/properties/font-variant-alternates.html b/tests/wpt/web-platform-tests/css/css-typed-om/the-stylepropertymap/properties/font-variant-alternates.html new file mode 100644 index 00000000000..521eb3a68ae --- /dev/null +++ b/tests/wpt/web-platform-tests/css/css-typed-om/the-stylepropertymap/properties/font-variant-alternates.html @@ -0,0 +1,31 @@ +<!doctype html> +<meta charset="utf-8"> +<title>'font-variant-alternates' property</title> +<link rel="help" href="https://drafts.css-houdini.org/css-typed-om-1/#dom-stylepropertymap-get"> +<link rel="help" href="https://drafts.css-houdini.org/css-typed-om-1/#dom-stylepropertymap-set"> +<link rel="help" href="https://drafts.css-houdini.org/css-typed-om-1/#property-stle-value-normalization"> +<script src="/resources/testharness.js"></script> +<script src="/resources/testharnessreport.js"></script> +<script src="../../resources/testhelper.js"></script> +<script src="resources/testsuite.js"></script> +<body> +<div id="log"></div> +<script> +'use strict'; + +runPropertyTests('font-variant-alternates', [ + { syntax: 'normal' }, + { syntax: 'historical-forms' }, +]); + +runUnsupportedPropertyTests('font-variant-alternates', [ + 'stylistic(foo)', + 'styleset(foo)', + 'character-variant(foo)', + 'swash(foo)', + 'ornaments(foo)', + 'annotation(foo)', + 'swash(foo) annotation(foo2)', +]); + +</script> diff --git a/tests/wpt/web-platform-tests/css/css-typed-om/the-stylepropertymap/properties/font-variant-emoji.html b/tests/wpt/web-platform-tests/css/css-typed-om/the-stylepropertymap/properties/font-variant-emoji.html new file mode 100644 index 00000000000..38cd6d237be --- /dev/null +++ b/tests/wpt/web-platform-tests/css/css-typed-om/the-stylepropertymap/properties/font-variant-emoji.html @@ -0,0 +1,22 @@ +<!doctype html> +<meta charset="utf-8"> +<title>'font-variant-emoji' property</title> +<link rel="help" href="https://drafts.css-houdini.org/css-typed-om-1/#dom-stylepropertymap-get"> +<link rel="help" href="https://drafts.css-houdini.org/css-typed-om-1/#dom-stylepropertymap-set"> +<link rel="help" href="https://drafts.css-houdini.org/css-typed-om-1/#property-stle-value-normalization"> +<script src="/resources/testharness.js"></script> +<script src="/resources/testharnessreport.js"></script> +<script src="../../resources/testhelper.js"></script> +<script src="resources/testsuite.js"></script> +<body> +<div id="log"></div> +<script> +'use strict'; + +runPropertyTests('font-variant-emoji', [ + { syntax: 'auto' }, + { syntax: 'text' }, + { syntax: 'emoji' }, +]); + +</script> diff --git a/tests/wpt/web-platform-tests/css/css-typed-om/the-stylepropertymap/properties/font-variant.html b/tests/wpt/web-platform-tests/css/css-typed-om/the-stylepropertymap/properties/font-variant.html new file mode 100644 index 00000000000..765ce28bd84 --- /dev/null +++ b/tests/wpt/web-platform-tests/css/css-typed-om/the-stylepropertymap/properties/font-variant.html @@ -0,0 +1,21 @@ +<!doctype html> +<meta charset="utf-8"> +<title>'font-variant' property</title> +<link rel="help" href="https://drafts.css-houdini.org/css-typed-om-1/#dom-stylepropertymap-get"> +<link rel="help" href="https://drafts.css-houdini.org/css-typed-om-1/#dom-stylepropertymap-set"> +<link rel="help" href="https://drafts.css-houdini.org/css-typed-om-1/#property-stle-value-normalization"> +<script src="/resources/testharness.js"></script> +<script src="/resources/testharnessreport.js"></script> +<script src="../../resources/testhelper.js"></script> +<script src="resources/testsuite.js"></script> +<body> +<div id="log"></div> +<script> +'use strict'; + +runUnsupportedPropertyTests('font-variant', [ + 'normal', 'no-common-ligatures proportional-nums', + 'common-ligatures tabular-nums', 'small-caps slashed-zero' +]); + +</script> diff --git a/tests/wpt/web-platform-tests/css/css-typed-om/the-stylepropertymap/properties/font-variation-settings.html b/tests/wpt/web-platform-tests/css/css-typed-om/the-stylepropertymap/properties/font-variation-settings.html new file mode 100644 index 00000000000..12d62618bc0 --- /dev/null +++ b/tests/wpt/web-platform-tests/css/css-typed-om/the-stylepropertymap/properties/font-variation-settings.html @@ -0,0 +1,24 @@ +<!doctype html> +<meta charset="utf-8"> +<title>'font-variation-settings' property</title> +<link rel="help" href="https://drafts.css-houdini.org/css-typed-om-1/#dom-stylepropertymap-get"> +<link rel="help" href="https://drafts.css-houdini.org/css-typed-om-1/#dom-stylepropertymap-set"> +<link rel="help" href="https://drafts.css-houdini.org/css-typed-om-1/#property-stle-value-normalization"> +<script src="/resources/testharness.js"></script> +<script src="/resources/testharnessreport.js"></script> +<script src="../../resources/testhelper.js"></script> +<script src="resources/testsuite.js"></script> +<body> +<div id="log"></div> +<script> +'use strict'; + +runPropertyTests('font-variation-settings', [ + { syntax: 'normal' }, +]); + +runUnsupportedPropertyTests('font-variation-settings', [ + '"XHGT" 0.7', +]); + +</script> diff --git a/tests/wpt/web-platform-tests/css/css-typed-om/the-stylepropertymap/properties/font.html b/tests/wpt/web-platform-tests/css/css-typed-om/the-stylepropertymap/properties/font.html new file mode 100644 index 00000000000..b8a1e88a271 --- /dev/null +++ b/tests/wpt/web-platform-tests/css/css-typed-om/the-stylepropertymap/properties/font.html @@ -0,0 +1,24 @@ +<!doctype html> +<meta charset="utf-8"> +<title>'font' property</title> +<link rel="help" href="https://drafts.css-houdini.org/css-typed-om-1/#dom-stylepropertymap-get"> +<link rel="help" href="https://drafts.css-houdini.org/css-typed-om-1/#dom-stylepropertymap-set"> +<link rel="help" href="https://drafts.css-houdini.org/css-typed-om-1/#property-stle-value-normalization"> +<script src="/resources/testharness.js"></script> +<script src="/resources/testharnessreport.js"></script> +<script src="../../resources/testhelper.js"></script> +<script src="resources/testsuite.js"></script> +<body> +<div id="log"></div> +<script> +'use strict'; + +runUnsupportedPropertyTests('font', [ + '1.2em "Fira Sans", sans-serif', + 'italic 1.2em "Fira Sans", serif', + 'italic small-caps bold 16px/2 cursive', + 'small-caps bold 24px/1 sans-serif', + 'caption', +]); + +</script> diff --git a/tests/wpt/web-platform-tests/css/css-typed-om/the-stylepropertymap/properties/gap.html b/tests/wpt/web-platform-tests/css/css-typed-om/the-stylepropertymap/properties/gap.html new file mode 100644 index 00000000000..e07d1cd54d5 --- /dev/null +++ b/tests/wpt/web-platform-tests/css/css-typed-om/the-stylepropertymap/properties/gap.html @@ -0,0 +1,30 @@ +<!doctype html> +<meta charset="utf-8"> +<title>'*-gap' properties</title> +<link rel="help" href="https://drafts.css-houdini.org/css-typed-om/#dom-stylepropertymapreadonly-get"> +<link rel="help" href="https://drafts.css-houdini.org/css-typed-om/#dom-stylepropertymap-set"> +<link rel="help" href="https://drafts.css-houdini.org/css-typed-om/#reify-stylevalue"> +<script src="/resources/testharness.js"></script> +<script src="/resources/testharnessreport.js"></script> +<script src="../../resources/testhelper.js"></script> +<script src="resources/testsuite.js"></script> +<body> +<div id="log"></div> +<script> +'use strict'; + +for (const prefix of ['column', 'row']) { + runPropertyTests(`${prefix}-gap`, [ + { syntax: 'normal' }, + { + syntax: '<length>', + specified: assert_is_equal_with_range_handling + }, + { + syntax: '<percentage>', + specified: assert_is_equal_with_range_handling + }, + ]); +} + +</script> diff --git a/tests/wpt/web-platform-tests/css/css-typed-om/the-stylepropertymap/properties/inline-size.html b/tests/wpt/web-platform-tests/css/css-typed-om/the-stylepropertymap/properties/inline-size.html new file mode 100644 index 00000000000..f509d4a33e8 --- /dev/null +++ b/tests/wpt/web-platform-tests/css/css-typed-om/the-stylepropertymap/properties/inline-size.html @@ -0,0 +1,51 @@ +<!doctype html> +<meta charset="utf-8"> +<title>'inline-size' property</title> +<link rel="help" href="https://drafts.css-houdini.org/css-typed-om-1/#dom-stylepropertymap-get"> +<link rel="help" href="https://drafts.css-houdini.org/css-typed-om-1/#dom-stylepropertymap-set"> +<link rel="help" href="https://drafts.css-houdini.org/css-typed-om-1/#property-stle-value-normalization"> +<script src="/resources/testharness.js"></script> +<script src="/resources/testharnessreport.js"></script> +<script src="../../resources/testhelper.js"></script> +<script src="resources/testsuite.js"></script> +<body> +<div id="log"></div> +<script> +'use strict'; + +runPropertyTests('inline-size', [ + { syntax: 'auto' }, + { + syntax: '<percentage>', + specified: assert_is_equal_with_range_handling + }, + { + syntax: '<length>', + specified: assert_is_equal_with_range_handling + }, +]); + +runPropertyTests('min-inline-size', [ + { + syntax: '<percentage>', + specified: assert_is_equal_with_range_handling + }, + { + syntax: '<length>', + specified: assert_is_equal_with_range_handling + }, +]); + +runPropertyTests('max-inline-size', [ + { syntax: 'none' }, + { + syntax: '<percentage>', + specified: assert_is_equal_with_range_handling + }, + { + syntax: '<length>', + specified: assert_is_equal_with_range_handling + }, +]); + +</script>
\ No newline at end of file diff --git a/tests/wpt/web-platform-tests/dom/nodes/Element-classlist.html b/tests/wpt/web-platform-tests/dom/nodes/Element-classlist.html index 2b376d4cb00..5453da90da6 100644 --- a/tests/wpt/web-platform-tests/dom/nodes/Element-classlist.html +++ b/tests/wpt/web-platform-tests/dom/nodes/Element-classlist.html @@ -31,6 +31,13 @@ function checkModification(e, funcName, args, expectedRes, before, after, } setClass(e, before); + var obs; + // If we have MutationObservers available, do some checks to make + // sure attribute sets are happening at sane times. + if (self.MutationObserver) { + obs = new MutationObserver(() => {}); + obs.observe(e, { attributes: true }); + } if (shouldThrow) { assert_throws(expectedException, function() { var list = e.classList; @@ -40,6 +47,21 @@ function checkModification(e, funcName, args, expectedRes, before, after, var list = e.classList; var res = list[funcName].apply(list, args); } + if (obs) { + var mutationRecords = obs.takeRecords(); + obs.disconnect(); + if (shouldThrow) { + assert_equals(mutationRecords.length, 0, + "There should have been no mutation"); + } else if (funcName == "replace") { + assert_equals(mutationRecords.length == 1, + expectedRes, + "Should have a mutation exactly when replace() returns true"); + } else { + // For other functions, would need to check when exactly + // mutations are supposed to happen. + } + } if (!shouldThrow) { assert_equals(res, expectedRes, "wrong return value"); } diff --git a/tests/wpt/web-platform-tests/mediacapture-streams/MediaDevices-enumerateDevices.https.html b/tests/wpt/web-platform-tests/mediacapture-streams/MediaDevices-enumerateDevices.https.html index a29b5832a9e..c66251a03f3 100644 --- a/tests/wpt/web-platform-tests/mediacapture-streams/MediaDevices-enumerateDevices.https.html +++ b/tests/wpt/web-platform-tests/mediacapture-streams/MediaDevices-enumerateDevices.https.html @@ -33,6 +33,8 @@ promise_test(function() { assert_equals(typeof capabilities.groupId, "string", "groupId must be a string."); if (mediainfo.kind == "audioinput") { assert_equals(typeof capabilities.echoCancellation, "object", "echoCancellation must be an object."); + assert_equals(typeof capabilities.autoGainControl, "object", "autoGainControl must be an object."); + assert_equals(typeof capabilities.noiseSuppression, "object", "noiseSuppression must be an object."); } if (mediainfo.kind == "videoinput") { assert_equals(typeof capabilities.facingMode, "object", "facingMode must be an object."); diff --git a/tests/wpt/web-platform-tests/mediacapture-streams/MediaStreamTrack-getCapabilities.https.html b/tests/wpt/web-platform-tests/mediacapture-streams/MediaStreamTrack-getCapabilities.https.html index 30f5d50079a..257578f67ca 100644 --- a/tests/wpt/web-platform-tests/mediacapture-streams/MediaStreamTrack-getCapabilities.https.html +++ b/tests/wpt/web-platform-tests/mediacapture-streams/MediaStreamTrack-getCapabilities.https.html @@ -12,6 +12,8 @@ var videoCapabilities = stream.getVideoTracks()[0].getCapabilities(); assert_true(undefined !== audioCapabilities.deviceId, "MediaTrackCapabilities's deviceId should exist for an audio track."); assert_true(undefined !== audioCapabilities.echoCancellation, "MediaTrackCapabilities's echoCancellation should exist for an audio track."); + assert_true(undefined !== audioCapabilities.autoGainControl, "MediaTrackCapabilities's autoGainControl should exist for an audio track."); + assert_true(undefined !== audioCapabilities.noiseSuppression, "MediaTrackCapabilities's noiseSuppression should exist for an audio track."); assert_true(undefined !== videoCapabilities.deviceId, "MediaTrackCapabilities's deviceId should exist for a video track."); }); }); diff --git a/tests/wpt/web-platform-tests/resources/test/README.md b/tests/wpt/web-platform-tests/resources/test/README.md index 773b83bfc05..c228372399c 100644 --- a/tests/wpt/web-platform-tests/resources/test/README.md +++ b/tests/wpt/web-platform-tests/resources/test/README.md @@ -11,16 +11,18 @@ Install the following dependencies: - [the Mozilla Firefox web browser](https://mozilla.org/firefox) - [the GeckoDriver server](https://github.com/mozilla/geckodriver) -Once these dependencies are satisfied, the tests may be run from a command line -by executing the following command from this directory: +Make sure `geckodriver` can be found in your `PATH`. - tox +Currently, the tests should be run with the latest *Firefox Nightly*. In order to +specify the path to Firefox Nightly, use the following command-line option: -Currently, the tests should be run with Firefox Nightly. + tox -- --binary=/path/to/FirefoxNightly -In order to specify the path to Firefox Nightly, use the following command-line option: +### Automated Script - tox -- --binary=/path/to/FirefoxNightly +Alternatively, you may run `tools/ci/ci_resources_unittest.sh`, which only depends on +Python 2. The script will install other dependencies automatically and start `tox` with +the correct arguments. ## Authoring Tests diff --git a/tests/wpt/web-platform-tests/tools/wptrunner/wptrunner/executors/base.py b/tests/wpt/web-platform-tests/tools/wptrunner/wptrunner/executors/base.py index 708903f5dcd..fbb75d658ce 100644 --- a/tests/wpt/web-platform-tests/tools/wptrunner/wptrunner/executors/base.py +++ b/tests/wpt/web-platform-tests/tools/wptrunner/wptrunner/executors/base.py @@ -8,7 +8,7 @@ import urlparse from abc import ABCMeta, abstractmethod from ..testrunner import Stop -from protocol import Protocol +from protocol import Protocol, BaseProtocolPart here = os.path.split(__file__)[0] @@ -411,7 +411,23 @@ class WdspecRun(object): self.result_flag.set() +class ConnectionlessBaseProtocolPart(BaseProtocolPart): + def execute_script(self, script, async=False): + pass + + def set_timeout(self, timeout): + pass + + def wait(self): + pass + + def set_window(self, handle): + pass + + class ConnectionlessProtocol(Protocol): + implements = [ConnectionlessBaseProtocolPart] + def connect(self): pass diff --git a/tests/wpt/web-platform-tests/workers/modules/dedicated-worker-import.html b/tests/wpt/web-platform-tests/workers/modules/dedicated-worker-import.html new file mode 100644 index 00000000000..3d4236393ee --- /dev/null +++ b/tests/wpt/web-platform-tests/workers/modules/dedicated-worker-import.html @@ -0,0 +1,48 @@ +<!DOCTYPE html> +<title>DedicatedWorker: import</title> +<script src="/resources/testharness.js"></script> +<script src="/resources/testharnessreport.js"></script> +<script> + +// Start a dedicated worker for |scriptURL| and wait until MessageEvents from +// imported modules up to |expectedNumberOfImportedModules|. +function RunImportTest(scriptURL, expectedNumberOfImportedModules) { + return new Promise(resolve => { + let numberOfImportedModules = 0; + const worker = new Worker(scriptURL, { type: 'module' }); + worker.onmessage = e => { + if (e.data === 'LOADED') + ++numberOfImportedModules; + if (numberOfImportedModules === expectedNumberOfImportedModules) + resolve(); + }; + }); +} + +promise_test(() => { + return RunImportTest('resources/static-import-worker.js', 2); +}, 'Test static import on DedicatedWorkerGlobalScope.'); + +promise_test(() => { + return RunImportTest('resources/nested-static-import-worker.js', 3); +}, 'Test nested static import on DedicatedWorkerGlobalScope.'); + +promise_test(() => { + return RunImportTest( + 'resources/static-import-and-then-dynamic-import-worker.js', 3); +}, 'Test static import and then dynamic import on DedicatedWorkerGlobalScope.'); + +promise_test(() => { + return RunImportTest('resources/dynamic-import-worker.js', 2); +}, 'Test dynamic import on DedicatedWorkerGlobalScope.'); + +promise_test(() => { + return RunImportTest('resources/nested-dynamic-import-worker.js', 3); +}, 'Test nested dynamic import on DedicatedWorkerGlobalScope.'); + +promise_test(() => { + return RunImportTest( + 'resources/dynamic-import-and-then-static-import-worker.js', 3); +}, 'Test dynamic import and then static import on DedicatedWorkerGlobalScope.'); + +</script> diff --git a/tests/wpt/web-platform-tests/workers/modules/dedicated-worker-static-import.html b/tests/wpt/web-platform-tests/workers/modules/dedicated-worker-static-import.html deleted file mode 100644 index ee5de185800..00000000000 --- a/tests/wpt/web-platform-tests/workers/modules/dedicated-worker-static-import.html +++ /dev/null @@ -1,21 +0,0 @@ -<!DOCTYPE html> -<title>DedicatedWorker: static import</title> -<script src="/resources/testharness.js"></script> -<script src="/resources/testharnessreport.js"></script> -<script> - -promise_test(() => { - const worker = new Worker('resources/static-import-worker.js', - { type: 'module' }); - return new Promise(resolve => worker.onmessage = resolve) - .then(msg_event => assert_equals(msg_event.data, 'LOADED')); -}, 'Test static import on DedicatedWorkerGlobalScope.'); - -promise_test(() => { - const worker = new Worker('resources/nested-static-import-worker.js', - { type: 'module' }); - return new Promise(resolve => worker.onmessage = resolve) - .then(msg_event => assert_equals(msg_event.data, 'LOADED')); -}, 'Test nested static import on DedicatedWorkerGlobalScope.'); - -</script> diff --git a/tests/wpt/web-platform-tests/workers/modules/resources/dynamic-import-and-then-static-import-worker.js b/tests/wpt/web-platform-tests/workers/modules/resources/dynamic-import-and-then-static-import-worker.js new file mode 100644 index 00000000000..eaa3f1c686e --- /dev/null +++ b/tests/wpt/web-platform-tests/workers/modules/resources/dynamic-import-and-then-static-import-worker.js @@ -0,0 +1,2 @@ +import('./static-import-worker.js') + .then(module => postMessage('LOADED')); diff --git a/tests/wpt/web-platform-tests/workers/modules/resources/dynamic-import-worker.js b/tests/wpt/web-platform-tests/workers/modules/resources/dynamic-import-worker.js new file mode 100644 index 00000000000..98381b9da2a --- /dev/null +++ b/tests/wpt/web-platform-tests/workers/modules/resources/dynamic-import-worker.js @@ -0,0 +1,2 @@ +import('./post-message-on-load-worker.js') + .then(module => postMessage('LOADED')); diff --git a/tests/wpt/web-platform-tests/workers/modules/resources/nested-dynamic-import-worker.js b/tests/wpt/web-platform-tests/workers/modules/resources/nested-dynamic-import-worker.js new file mode 100644 index 00000000000..8f56d156e2a --- /dev/null +++ b/tests/wpt/web-platform-tests/workers/modules/resources/nested-dynamic-import-worker.js @@ -0,0 +1,2 @@ +import('./dynamic-import-worker.js') + .then(module => postMessage('LOADED')); diff --git a/tests/wpt/web-platform-tests/workers/modules/resources/nested-static-import-worker.js b/tests/wpt/web-platform-tests/workers/modules/resources/nested-static-import-worker.js index bcaf7d89c58..f2ef5207cae 100644 --- a/tests/wpt/web-platform-tests/workers/modules/resources/nested-static-import-worker.js +++ b/tests/wpt/web-platform-tests/workers/modules/resources/nested-static-import-worker.js @@ -1 +1,2 @@ import './static-import-worker.js'; +postMessage('LOADED') diff --git a/tests/wpt/web-platform-tests/workers/modules/resources/static-import-and-then-dynamic-import-worker.js b/tests/wpt/web-platform-tests/workers/modules/resources/static-import-and-then-dynamic-import-worker.js new file mode 100644 index 00000000000..4e66d041a1b --- /dev/null +++ b/tests/wpt/web-platform-tests/workers/modules/resources/static-import-and-then-dynamic-import-worker.js @@ -0,0 +1,2 @@ +import './dynamic-import-worker.js'; +postMessage('LOADED'); diff --git a/tests/wpt/web-platform-tests/workers/modules/resources/static-import-worker.js b/tests/wpt/web-platform-tests/workers/modules/resources/static-import-worker.js index edb8caf34af..46931699e59 100644 --- a/tests/wpt/web-platform-tests/workers/modules/resources/static-import-worker.js +++ b/tests/wpt/web-platform-tests/workers/modules/resources/static-import-worker.js @@ -1 +1,2 @@ import './post-message-on-load-worker.js'; +postMessage('LOADED'); |