diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-19 01:47:29 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-19 01:47:29 +0000 |
commit | 0ebf5bdf043a27fd3dfb7f92e0cb63d88954c44d (patch) | |
tree | a31f07c9bcca9d56ce61e9a1ffd30ef350d513aa /testing/web-platform/tests/css/css-sizing/animation | |
parent | Initial commit. (diff) | |
download | firefox-esr-0ebf5bdf043a27fd3dfb7f92e0cb63d88954c44d.tar.xz firefox-esr-0ebf5bdf043a27fd3dfb7f92e0cb63d88954c44d.zip |
Adding upstream version 115.8.0esr.upstream/115.8.0esr
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'testing/web-platform/tests/css/css-sizing/animation')
15 files changed, 1165 insertions, 0 deletions
diff --git a/testing/web-platform/tests/css/css-sizing/animation/aspect-ratio-interpolation.html b/testing/web-platform/tests/css/css-sizing/animation/aspect-ratio-interpolation.html new file mode 100644 index 0000000000..3628ff607c --- /dev/null +++ b/testing/web-platform/tests/css/css-sizing/animation/aspect-ratio-interpolation.html @@ -0,0 +1,130 @@ +<!DOCTYPE html> +<meta charset="UTF-8"> +<title>aspect-ratio interpolation</title> +<link rel="help" href="https://drafts.csswg.org/css-sizing-4/#aspect-ratio"> +<meta name="assert" content="aspect-ratio supports animation"> + +<script src="/resources/testharness.js"></script> +<script src="/resources/testharnessreport.js"></script> +<script src="/css/support/interpolation-testcommon.js"></script> + +<style> +.target { + font-size: 16px; + background-color: black; + width: 10px; + aspect-ratio: 0.5; +} +</style> + +<body> + <template id="target-template"> + <div class="container"> + <div class="target"></div> + </div> + </template> +</body> + +<script> +test_interpolation({ + property: 'aspect-ratio', + from: '0.5', + to: '2', +}, [ + {at: -0.5, expect: '0.25 / 1'}, + {at: 0, expect: '0.5 / 1'}, + {at: 0.5, expect: '1 / 1'}, + {at: 1, expect: '2 / 1'}, + {at: 1.5, expect: '4 / 1'} +]); + +test_interpolation({ + property: 'aspect-ratio', + from: '1 / 2', + to: '2 / 1', +}, [ + {at: -0.5, expect: '0.25 / 1'}, + {at: 0, expect: '0.5 / 1'}, + {at: 0.5, expect: '1 / 1'}, + {at: 1, expect: '2 / 1'}, + {at: 1.5, expect: '4 / 1'} +]); + +// Test neutral keyframe +test_interpolation({ + property: 'aspect-ratio', + from: '', + to: '2 / 1', +}, [ + {at: -0.5, expect: '0.25 / 1'}, + {at: 0, expect: '0.5 / 1'}, + {at: 0.5, expect: '1 / 1'}, + {at: 1, expect: '2 / 1'}, + {at: 1.5, expect: '4 / 1'} +]); + +test_interpolation({ + property: 'aspect-ratio', + from: 'auto 1 / 2', + to: 'auto 2 / 1', +}, [ + {at: -0.5, expect: 'auto 0.25 / 1'}, + {at: 0, expect: 'auto 0.5 / 1'}, + {at: 0.5, expect: 'auto 1 / 1'}, + {at: 1, expect: 'auto 2 / 1'}, + {at: 1.5, expect: 'auto 4 / 1'} +]); + +test_no_interpolation({ + property: 'aspect-ratio', + from: 'auto', + to: '2 / 1', +}); + +test_no_interpolation({ + property: 'aspect-ratio', + from: 'auto 1 / 1', + to: '2 / 1', +}); + +// If either number in the ratio is 0 or infinite, it represents a degenerate +// ratio and will not be interpolated: +// https://drafts.csswg.org/css-values-4/#combine-ratio +test_no_interpolation({ + property: 'aspect-ratio', + from: '1 / 0', + to: '1 / 1', +}); +test_no_interpolation({ + property: 'aspect-ratio', + from: '1 / 1', + to: '0 / 1', +}); + +// Addition of <ratio>s is not possible. +// https://drafts.csswg.org/css-values/#combine-ratio +// +// And if a value type does not define a specific procedure for addition or is +// defined as not additive, its addition operation is simply Vresult = Va. +// (The first value is Va, the second value is Vb, and the result is Vresult.) +// https://drafts.csswg.org/css-values-4/#not-additive, +// +// So in this test case: +// 1. The 1st keyframe: { aspectRatio: 0.5/1, composite: 'replace', offset: 0 } +// 2. The 2nd keyframe: { aspectRatio: 1/1, composite: 'add', offset: 1 } +// and the underlying value is 2/1. Based on the spec, the composited from_value +// is 0.5/1 (because we just replace it), and the composited to_value is 2/1 +// (because we use Va as the result value). +test_composition({ + property: 'aspect-ratio', + underlying: '2 / 1', + replaceFrom: '0.5 / 1', + addTo: '1 / 1', +}, [ + {at: 0, expect: '0.5 / 1'}, + {at: 0.5, expect: '1 / 1'}, + {at: 1, expect: '2 / 1'} +]); + +</script> +</body> diff --git a/testing/web-platform/tests/css/css-sizing/animation/box-sizing-no-interpolation.html b/testing/web-platform/tests/css/css-sizing/animation/box-sizing-no-interpolation.html new file mode 100644 index 0000000000..d68844561a --- /dev/null +++ b/testing/web-platform/tests/css/css-sizing/animation/box-sizing-no-interpolation.html @@ -0,0 +1,15 @@ +<!DOCTYPE html> +<link rel=author href="mailto:jarhar@chromium.org"> +<link rel=help href="https://github.com/w3c/csswg-drafts/issues/4441"> +<script src="/resources/testharness.js"></script> +<script src="/resources/testharnessreport.js"></script> +<script src="/css/support/interpolation-testcommon.js"></script> + +<body> +<script> +test_no_interpolation({ + property: 'box-sizing', + from: 'initial', + to: 'border-box' +}); +</script> diff --git a/testing/web-platform/tests/css/css-sizing/animation/height-composition.html b/testing/web-platform/tests/css/css-sizing/animation/height-composition.html new file mode 100644 index 0000000000..094e247dcf --- /dev/null +++ b/testing/web-platform/tests/css/css-sizing/animation/height-composition.html @@ -0,0 +1,78 @@ +<!DOCTYPE html> +<meta charset="UTF-8"> +<title>height composition</title> +<link rel="help" href="https://drafts.csswg.org/css-sizing-3/#propdef-height"> +<meta name="assert" content="height supports animation by computed value"> + +<script src="/resources/testharness.js"></script> +<script src="/resources/testharnessreport.js"></script> +<script src="/css/support/interpolation-testcommon.js"></script> + +<body> +<script> +test_composition({ + property: 'height', + underlying: '50px', + addFrom: '100px', + addTo: '200px', +}, [ + {at: -0.3, expect: '120px'}, + {at: 0, expect: '150px'}, + {at: 0.5, expect: '200px'}, + {at: 1, expect: '250px'}, + {at: 1.5, expect: '300px'}, +]); + +test_composition({ + property: 'height', + underlying: '100px', + addFrom: '10px', + addTo: '2px', +}, [ + {at: -0.5, expect: '114px'}, + {at: 0, expect: '110px'}, + {at: 0.5, expect: '106px'}, + {at: 1, expect: '102px'}, + {at: 1.5, expect: '98px'}, // Value clamping should happen after composition. +]); + +test_composition({ + property: 'height', + underlying: '10%', + addFrom: '100px', + addTo: '20%', +}, [ + {at: -0.3, expect: 'calc(130px + 4%)'}, + {at: 0, expect: 'calc(100px + 10%)'}, + {at: 0.5, expect: 'calc(50px + 20%)'}, + {at: 1, expect: '30%'}, + {at: 1.5, expect: 'calc(-50px + 40%)'}, +]); + +test_composition({ + property: 'height', + underlying: '50px', + addFrom: '100px', + replaceTo: '200px', +}, [ + {at: -0.3, expect: '135px'}, + {at: 0, expect: '150px'}, + {at: 0.5, expect: '175px'}, + {at: 1, expect: '200px'}, + {at: 1.5, expect: '225px'}, +]); + +test_composition({ + property: 'height', + underlying: '100px', + addFrom: '100px', + addTo: 'auto', +}, [ + {at: -0.3, expect: '200px'}, + {at: 0, expect: '200px'}, + {at: 0.5, expect: 'auto'}, + {at: 1, expect: 'auto'}, + {at: 1.5, expect: 'auto'}, +]); +</script> +</body> diff --git a/testing/web-platform/tests/css/css-sizing/animation/height-interpolation.html b/testing/web-platform/tests/css/css-sizing/animation/height-interpolation.html new file mode 100644 index 0000000000..10ceed5b2c --- /dev/null +++ b/testing/web-platform/tests/css/css-sizing/animation/height-interpolation.html @@ -0,0 +1,81 @@ +<!DOCTYPE html> +<meta charset="UTF-8"> +<title>height interpolation</title> +<link rel="help" href="https://drafts.csswg.org/css-sizing-3/#propdef-height"> +<meta name="assert" content="height supports animation by computed value"> + +<script src="/resources/testharness.js"></script> +<script src="/resources/testharnessreport.js"></script> +<script src="/css/support/interpolation-testcommon.js"></script> + +<style> +.parent { + height: 200px; +} +.target { + width: 100px; + height: 100px; + background-color: black; + display: inline-block; + margin-right: 5px; + height: 10px; +} +.expected { + background-color: green; +} +</style> + +<body></body> + +<script> +test_interpolation({ + property: 'height', + from: neutralKeyframe, + to: '20px', +}, [ + {at: -0.3, expect: '7px'}, + {at: 0, expect: '10px'}, + {at: 0.3, expect: '13px'}, + {at: 0.6, expect: '16px'}, + {at: 1, expect: '20px'}, + {at: 1.5, expect: '25px'}, +]); + +test_no_interpolation({ + property: 'height', + from: 'initial', + to: '20px', +}); + +test_interpolation({ + property: 'height', + from: 'inherit', + to: '20px', +}, [ + {at: -0.3, expect: '254px'}, + {at: 0, expect: '200px'}, + {at: 0.3, expect: '146px'}, + {at: 0.6, expect: '92px'}, + {at: 1, expect: '20px'}, + {at: 1.5, expect: '0px'}, +]); + +test_no_interpolation({ + property: 'height', + from: 'unset', + to: '20px', +}); + +test_interpolation({ + property: 'height', + from: '0px', + to: '100px', +}, [ + {at: -0.3, expect: '0px'}, // CSS height can't be negative. + {at: 0, expect: '0px'}, + {at: 0.3, expect: '30px'}, + {at: 0.6, expect: '60px'}, + {at: 1, expect: '100px'}, + {at: 1.5, expect: '150px'} +]); +</script> diff --git a/testing/web-platform/tests/css/css-sizing/animation/height-no-interpolation.html b/testing/web-platform/tests/css/css-sizing/animation/height-no-interpolation.html new file mode 100644 index 0000000000..902fe2e22f --- /dev/null +++ b/testing/web-platform/tests/css/css-sizing/animation/height-no-interpolation.html @@ -0,0 +1,18 @@ +<!DOCTYPE html> +<link rel=author href="mailto:jarhar@chromium.org"> +<link rel=help href="https://github.com/w3c/csswg-drafts/issues/4441"> +<link rel=help href="https://drafts.csswg.org/css-transitions-2/#transition-property-property"> +<link rel=help href="https://w3c.github.io/csswg-drafts/css-sizing/#preferred-size-properties"> +<script src="/resources/testharness.js"></script> +<script src="/resources/testharnessreport.js"></script> +<script src="/css/support/interpolation-testcommon.js"></script> + +<body> +<script> +// height is interpolable, but height:auto is not. +test_no_interpolation({ + property: 'height', + from: '0px', + to: 'auto' +}); +</script> diff --git a/testing/web-platform/tests/css/css-sizing/animation/max-height-composition.html b/testing/web-platform/tests/css/css-sizing/animation/max-height-composition.html new file mode 100644 index 0000000000..fb5b241d00 --- /dev/null +++ b/testing/web-platform/tests/css/css-sizing/animation/max-height-composition.html @@ -0,0 +1,78 @@ +<!DOCTYPE html> +<meta charset="UTF-8"> +<title>max-height composition</title> +<link rel="help" href="https://drafts.csswg.org/css-sizing-3/#propdef-max-height"> +<meta name="assert" content="max-height supports animation by computed value"> + +<script src="/resources/testharness.js"></script> +<script src="/resources/testharnessreport.js"></script> +<script src="/css/support/interpolation-testcommon.js"></script> + +<body> +<script> +test_composition({ + property: 'max-height', + underlying: '50px', + addFrom: '100px', + addTo: '200px', +}, [ + {at: -0.3, expect: '120px'}, + {at: 0, expect: '150px'}, + {at: 0.5, expect: '200px'}, + {at: 1, expect: '250px'}, + {at: 1.5, expect: '300px'}, +]); + +test_composition({ + property: 'max-height', + underlying: '100px', + addFrom: '10px', + addTo: '2px', +}, [ + {at: -0.5, expect: '114px'}, + {at: 0, expect: '110px'}, + {at: 0.5, expect: '106px'}, + {at: 1, expect: '102px'}, + {at: 1.5, expect: '98px'}, // Value clamping should happen after composition. +]); + +test_composition({ + property: 'max-height', + underlying: '10%', + addFrom: '100px', + addTo: '20%', +}, [ + {at: -0.3, expect: 'calc(130px + 4%)'}, + {at: 0, expect: 'calc(100px + 10%)'}, + {at: 0.5, expect: 'calc(50px + 20%)'}, + {at: 1, expect: '30%'}, + {at: 1.5, expect: 'calc(-50px + 40%)'}, +]); + +test_composition({ + property: 'max-height', + underlying: '50px', + addFrom: '100px', + replaceTo: '200px', +}, [ + {at: -0.3, expect: '135px'}, + {at: 0, expect: '150px'}, + {at: 0.5, expect: '175px'}, + {at: 1, expect: '200px'}, + {at: 1.5, expect: '225px'}, +]); + +test_composition({ + property: 'max-height', + underlying: '100px', + addFrom: '100px', + addTo: 'none', +}, [ + {at: -0.3, expect: '200px'}, + {at: 0, expect: '200px'}, + {at: 0.5, expect: 'none'}, + {at: 1, expect: 'none'}, + {at: 1.5, expect: 'none'}, +]); +</script> +</body> diff --git a/testing/web-platform/tests/css/css-sizing/animation/max-height-interpolation.html b/testing/web-platform/tests/css/css-sizing/animation/max-height-interpolation.html new file mode 100644 index 0000000000..c4cab0e1cf --- /dev/null +++ b/testing/web-platform/tests/css/css-sizing/animation/max-height-interpolation.html @@ -0,0 +1,87 @@ +<!DOCTYPE html> +<meta charset="UTF-8"> +<title>max-height interpolation</title> +<link rel="help" href="https://drafts.csswg.org/css-sizing-3/#propdef-max-height"> +<meta name="assert" content="max-height supports animation by computed value"> + +<script src="/resources/testharness.js"></script> +<script src="/resources/testharnessreport.js"></script> +<script src="/css/support/interpolation-testcommon.js"></script> + +<style> +.parent { + max-height: 30px; +} +.target { + width: 100px; + height: 100px; + background-color: black; + display: inline-block; + max-height: 10px; +} +.expected { + background-color: green; +} + +</style> + +<body> +<template id="target-template"> + <div> + <div class="target"></div> + </div> +</template> +</body> + +<script> +test_interpolation({ + property: 'max-height', + from: neutralKeyframe, + to: '20px', +}, [ + {at: -0.5, expect: '5px'}, + {at: 0, expect: '10px'}, + {at: 0.3, expect: '13px'}, + {at: 0.6, expect: '16px'}, + {at: 1, expect: '20px'}, + {at: 1.5, expect: '25px'}, +]); + +test_no_interpolation({ + property: 'max-height', + from: 'initial', + to: '20px', +}); + +test_interpolation({ + property: 'max-height', + from: 'inherit', + to: '20px', +}, [ + {at: -0.5, expect: '35px'}, + {at: 0, expect: '30px'}, + {at: 0.3, expect: '27px'}, + {at: 0.6, expect: '24px'}, + {at: 1, expect: '20px'}, + {at: 1.5, expect: '15px'}, +]); + +test_no_interpolation({ + property: 'max-height', + from: 'unset', + to: '20px', +}); + +test_interpolation({ + property: 'max-height', + from: '0px', + to: '100px', +}, [ + {at: -0.5, expect: '0'}, // CSS max-height can't be negative. + {at: 0, expect: '0'}, + {at: 0.3, expect: '30px'}, + {at: 0.6, expect: '60px'}, + {at: 1, expect: '100px'}, + {at: 1.5, expect: '150px'} +]); +</script> diff --git a/testing/web-platform/tests/css/css-sizing/animation/max-width-composition.html b/testing/web-platform/tests/css/css-sizing/animation/max-width-composition.html new file mode 100644 index 0000000000..8b6d8b704c --- /dev/null +++ b/testing/web-platform/tests/css/css-sizing/animation/max-width-composition.html @@ -0,0 +1,78 @@ +<!DOCTYPE html> +<meta charset="UTF-8"> +<title>max-width composition</title> +<link rel="help" href="https://drafts.csswg.org/css-sizing-3/#propdef-max-width"> +<meta name="assert" content="max-width supports animation by computed value"> + +<script src="/resources/testharness.js"></script> +<script src="/resources/testharnessreport.js"></script> +<script src="/css/support/interpolation-testcommon.js"></script> + +<body> +<script> +test_composition({ + property: 'max-width', + underlying: '50px', + addFrom: '100px', + addTo: '200px', +}, [ + {at: -0.3, expect: '120px'}, + {at: 0, expect: '150px'}, + {at: 0.5, expect: '200px'}, + {at: 1, expect: '250px'}, + {at: 1.5, expect: '300px'}, +]); + +test_composition({ + property: 'max-width', + underlying: '100px', + addFrom: '10px', + addTo: '2px', +}, [ + {at: -0.5, expect: '114px'}, + {at: 0, expect: '110px'}, + {at: 0.5, expect: '106px'}, + {at: 1, expect: '102px'}, + {at: 1.5, expect: '98px'}, // Value clamping should happen after composition. +]); + +test_composition({ + property: 'max-width', + underlying: '10%', + addFrom: '100px', + addTo: '20%', +}, [ + {at: -0.3, expect: 'calc(130px + 4%)'}, + {at: 0, expect: 'calc(100px + 10%)'}, + {at: 0.5, expect: 'calc(50px + 20%)'}, + {at: 1, expect: '30%'}, + {at: 1.5, expect: 'calc(-50px + 40%)'}, +]); + +test_composition({ + property: 'max-width', + underlying: '50px', + addFrom: '100px', + replaceTo: '200px', +}, [ + {at: -0.3, expect: '135px'}, + {at: 0, expect: '150px'}, + {at: 0.5, expect: '175px'}, + {at: 1, expect: '200px'}, + {at: 1.5, expect: '225px'}, +]); + +test_composition({ + property: 'max-width', + underlying: '100px', + addFrom: '100px', + addTo: 'none', +}, [ + {at: -0.3, expect: '200px'}, + {at: 0, expect: '200px'}, + {at: 0.5, expect: 'none'}, + {at: 1, expect: 'none'}, + {at: 1.5, expect: 'none'}, +]); +</script> +</body> diff --git a/testing/web-platform/tests/css/css-sizing/animation/max-width-interpolation.html b/testing/web-platform/tests/css/css-sizing/animation/max-width-interpolation.html new file mode 100644 index 0000000000..111199baa7 --- /dev/null +++ b/testing/web-platform/tests/css/css-sizing/animation/max-width-interpolation.html @@ -0,0 +1,80 @@ +<!DOCTYPE html> +<meta charset="UTF-8"> +<title>max-width interpolation</title> +<link rel="help" href="https://drafts.csswg.org/css-sizing-3/#propdef-max-width"> +<meta name="assert" content="max-width supports animation by computed value"> + +<script src="/resources/testharness.js"></script> +<script src="/resources/testharnessreport.js"></script> +<script src="/css/support/interpolation-testcommon.js"></script> + +<style> +.parent { + max-width: 100px; +} +.target { + width: 200px; + height: 10px; + background-color: black; + max-width: 10px; +} +.expected { + background-color: green; + margin-bottom: 10px; +} +</style> + +<body></body> + +<script> +test_interpolation({ + property: 'max-width', + from: neutralKeyframe, + to: '20px', +}, [ + {at: -0.5, expect: '5px'}, + {at: 0, expect: '10px'}, + {at: 0.3, expect: '13px'}, + {at: 0.6, expect: '16px'}, + {at: 1, expect: '20px'}, + {at: 1.5, expect: '25px'}, +]); + +test_no_interpolation({ + property: 'max-width', + from: 'initial', + to: '20px', +}); + +test_interpolation({ + property: 'max-width', + from: 'inherit', + to: '20px', +}, [ + {at: -0.5, expect: '140px'}, + {at: 0, expect: '100px'}, + {at: 0.3, expect: '76px'}, + {at: 0.6, expect: '52px'}, + {at: 1, expect: '20px'}, + {at: 1.5, expect: '0px'}, +]); + +test_no_interpolation({ + property: 'max-width', + from: 'unset', + to: '20px', +}); + +test_interpolation({ + property: 'max-width', + from: '0px', + to: '100px', +}, [ + {at: -0.5, expect: '0'}, // CSS max-width can't be negative. + {at: 0, expect: '0'}, + {at: 0.3, expect: '30px'}, + {at: 0.6, expect: '60px'}, + {at: 1, expect: '100px'}, + {at: 1.5, expect: '150px'} +]); +</script> diff --git a/testing/web-platform/tests/css/css-sizing/animation/min-height-composition.html b/testing/web-platform/tests/css/css-sizing/animation/min-height-composition.html new file mode 100644 index 0000000000..1e92b0ec2f --- /dev/null +++ b/testing/web-platform/tests/css/css-sizing/animation/min-height-composition.html @@ -0,0 +1,78 @@ +<!DOCTYPE html> +<meta charset="UTF-8"> +<title>min-height composition</title> +<link rel="help" href="https://drafts.csswg.org/css-sizing-3/#propdef-min-height"> +<meta name="assert" content="min-height supports animation by computed value"> + +<script src="/resources/testharness.js"></script> +<script src="/resources/testharnessreport.js"></script> +<script src="/css/support/interpolation-testcommon.js"></script> + +<body> +<script> +test_composition({ + property: 'min-height', + underlying: '50px', + addFrom: '100px', + addTo: '200px', +}, [ + {at: -0.3, expect: '120px'}, + {at: 0, expect: '150px'}, + {at: 0.5, expect: '200px'}, + {at: 1, expect: '250px'}, + {at: 1.5, expect: '300px'}, +]); + +test_composition({ + property: 'min-height', + underlying: '100px', + addFrom: '10px', + addTo: '2px', +}, [ + {at: -0.5, expect: '114px'}, + {at: 0, expect: '110px'}, + {at: 0.5, expect: '106px'}, + {at: 1, expect: '102px'}, + {at: 1.5, expect: '98px'}, // Value clamping should happen after composition. +]); + +test_composition({ + property: 'min-height', + underlying: '10%', + addFrom: '100px', + addTo: '20%', +}, [ + {at: -0.3, expect: 'calc(130px + 4%)'}, + {at: 0, expect: 'calc(100px + 10%)'}, + {at: 0.5, expect: 'calc(50px + 20%)'}, + {at: 1, expect: '30%'}, + {at: 1.5, expect: 'calc(-50px + 40%)'}, +]); + +test_composition({ + property: 'min-height', + underlying: '50px', + addFrom: '100px', + replaceTo: '200px', +}, [ + {at: -0.3, expect: '135px'}, + {at: 0, expect: '150px'}, + {at: 0.5, expect: '175px'}, + {at: 1, expect: '200px'}, + {at: 1.5, expect: '225px'}, +]); + +test_composition({ + property: 'min-height', + underlying: '100px', + addFrom: '100px', + addTo: 'auto', +}, [ + {at: -0.3, expect: '200px'}, + {at: 0, expect: '200px'}, + {at: 0.5, expect: 'auto'}, + {at: 1, expect: 'auto'}, + {at: 1.5, expect: 'auto'}, +]); +</script> +</body> diff --git a/testing/web-platform/tests/css/css-sizing/animation/min-height-interpolation.html b/testing/web-platform/tests/css/css-sizing/animation/min-height-interpolation.html new file mode 100644 index 0000000000..6fd5b4e2f5 --- /dev/null +++ b/testing/web-platform/tests/css/css-sizing/animation/min-height-interpolation.html @@ -0,0 +1,80 @@ +<!DOCTYPE html> +<meta charset="UTF-8"> +<title>min-height interpolation</title> +<link rel="help" href="https://drafts.csswg.org/css-sizing-3/#propdef-min-height"> +<meta name="assert" content="min-height supports animation by computed value"> + +<script src="/resources/testharness.js"></script> +<script src="/resources/testharnessreport.js"></script> +<script src="/css/support/interpolation-testcommon.js"></script> + +<style> +.parent { + min-height: 30px; +} +.target { + width: 10px; + height: 0px; + background-color: black; + display: inline-block; + min-height: 10px; +} +.expected { + background-color: green; +} +</style> + +<body></body> + +<script> +test_interpolation({ + property: 'min-height', + from: neutralKeyframe, + to: '20px', +}, [ + {at: -0.5, expect: '5px'}, + {at: 0, expect: '10px'}, + {at: 0.3, expect: '13px'}, + {at: 0.6, expect: '16px'}, + {at: 1, expect: '20px'}, + {at: 1.5, expect: '25px'}, +]); + +test_no_interpolation({ + property: 'min-height', + from: 'initial', + to: '20px', +}); + +test_interpolation({ + property: 'min-height', + from: 'inherit', + to: '20px', +}, [ + {at: -0.5, expect: '35px'}, + {at: 0, expect: '30px'}, + {at: 0.3, expect: '27px'}, + {at: 0.6, expect: '24px'}, + {at: 1, expect: '20px'}, + {at: 1.5, expect: '15px'}, +]); + +test_no_interpolation({ + property: 'min-height', + from: 'unset', + to: '20px', +}); + +test_interpolation({ + property: 'min-height', + from: '0px', + to: '100px', +}, [ + {at: -0.5, expect: '0'}, // CSS min-height can't be negative. + {at: 0, expect: '0'}, + {at: 0.3, expect: '30px'}, + {at: 0.6, expect: '60px'}, + {at: 1, expect: '100px'}, + {at: 1.5, expect: '150px'} +]); +</script> diff --git a/testing/web-platform/tests/css/css-sizing/animation/min-width-composition.html b/testing/web-platform/tests/css/css-sizing/animation/min-width-composition.html new file mode 100644 index 0000000000..e8bd41030b --- /dev/null +++ b/testing/web-platform/tests/css/css-sizing/animation/min-width-composition.html @@ -0,0 +1,78 @@ +<!DOCTYPE html> +<meta charset="UTF-8"> +<title>min-width composition</title> +<link rel="help" href="https://drafts.csswg.org/css-sizing-3/#propdef-min-width"> +<meta name="assert" content="min-width supports animation by computed value"> + +<script src="/resources/testharness.js"></script> +<script src="/resources/testharnessreport.js"></script> +<script src="/css/support/interpolation-testcommon.js"></script> + +<body> +<script> +test_composition({ + property: 'min-width', + underlying: '50px', + addFrom: '100px', + addTo: '200px', +}, [ + {at: -0.3, expect: '120px'}, + {at: 0, expect: '150px'}, + {at: 0.5, expect: '200px'}, + {at: 1, expect: '250px'}, + {at: 1.5, expect: '300px'}, +]); + +test_composition({ + property: 'min-width', + underlying: '100px', + addFrom: '10px', + addTo: '2px', +}, [ + {at: -0.5, expect: '114px'}, + {at: 0, expect: '110px'}, + {at: 0.5, expect: '106px'}, + {at: 1, expect: '102px'}, + {at: 1.5, expect: '98px'}, // Value clamping should happen after composition. +]); + +test_composition({ + property: 'min-width', + underlying: '10%', + addFrom: '100px', + addTo: '20%', +}, [ + {at: -0.3, expect: 'calc(130px + 4%)'}, + {at: 0, expect: 'calc(100px + 10%)'}, + {at: 0.5, expect: 'calc(50px + 20%)'}, + {at: 1, expect: '30%'}, + {at: 1.5, expect: 'calc(-50px + 40%)'}, +]); + +test_composition({ + property: 'min-width', + underlying: '50px', + addFrom: '100px', + replaceTo: '200px', +}, [ + {at: -0.3, expect: '135px'}, + {at: 0, expect: '150px'}, + {at: 0.5, expect: '175px'}, + {at: 1, expect: '200px'}, + {at: 1.5, expect: '225px'}, +]); + +test_composition({ + property: 'min-width', + underlying: '100px', + addFrom: '100px', + addTo: 'auto', +}, [ + {at: -0.3, expect: '200px'}, + {at: 0, expect: '200px'}, + {at: 0.5, expect: 'auto'}, + {at: 1, expect: 'auto'}, + {at: 1.5, expect: 'auto'}, +]); +</script> +</body> diff --git a/testing/web-platform/tests/css/css-sizing/animation/min-width-interpolation.html b/testing/web-platform/tests/css/css-sizing/animation/min-width-interpolation.html new file mode 100644 index 0000000000..d11fb3d5cb --- /dev/null +++ b/testing/web-platform/tests/css/css-sizing/animation/min-width-interpolation.html @@ -0,0 +1,79 @@ +<!DOCTYPE html> +<meta charset="UTF-8"> +<title>min-width interpolation</title> +<link rel="help" href="https://drafts.csswg.org/css-sizing-3/#propdef-min-width"> +<meta name="assert" content="min-width supports animation by computed value"> + +<script src="/resources/testharness.js"></script> +<script src="/resources/testharnessreport.js"></script> +<script src="/css/support/interpolation-testcommon.js"></script> + +<style> +.parent { + min-width: 30px; +} +.target { + width: 0px; + height: 10px; + background-color: black; + min-width: 10px; +} +.expected { + background-color: green; +} +</style> + +<body></body> + +<script> +test_interpolation({ + property: 'min-width', + from: neutralKeyframe, + to: '20px', +}, [ + {at: -0.5, expect: '5px'}, + {at: 0, expect: '10px'}, + {at: 0.3, expect: '13px'}, + {at: 0.6, expect: '16px'}, + {at: 1, expect: '20px'}, + {at: 1.5, expect: '25px'}, +]); + +test_no_interpolation({ + property: 'min-width', + from: 'initial', + to: '20px', +}); + +test_interpolation({ + property: 'min-width', + from: 'inherit', + to: '20px', +}, [ + {at: -0.5, expect: '35px'}, + {at: 0, expect: '30px'}, + {at: 0.3, expect: '27px'}, + {at: 0.6, expect: '24px'}, + {at: 1, expect: '20px'}, + {at: 1.5, expect: '15px'}, +]); + +test_no_interpolation({ + property: 'min-width', + from: 'unset', + to: '20px', +}); + +test_interpolation({ + property: 'min-width', + from: '0px', + to: '100px' +}, [ + {at: -0.5, expect: '0'}, // CSS min-width can't be negative. + {at: 0, expect: '0'}, + {at: 0.3, expect: '30px'}, + {at: 0.6, expect: '60px'}, + {at: 1, expect: '100px'}, + {at: 1.5, expect: '150px'} +]); +</script> diff --git a/testing/web-platform/tests/css/css-sizing/animation/width-composition.html b/testing/web-platform/tests/css/css-sizing/animation/width-composition.html new file mode 100644 index 0000000000..bfe45cb314 --- /dev/null +++ b/testing/web-platform/tests/css/css-sizing/animation/width-composition.html @@ -0,0 +1,78 @@ +<!DOCTYPE html> +<meta charset="UTF-8"> +<title>width composition</title> +<link rel="help" href="https://drafts.csswg.org/css-sizing-3/#propdef-width"> +<meta name="assert" content="width supports animation by computed value"> + +<script src="/resources/testharness.js"></script> +<script src="/resources/testharnessreport.js"></script> +<script src="/css/support/interpolation-testcommon.js"></script> + +<body> +<script> +test_composition({ + property: 'width', + underlying: '50px', + addFrom: '100px', + addTo: '200px', +}, [ + {at: -0.3, expect: '120px'}, + {at: 0, expect: '150px'}, + {at: 0.5, expect: '200px'}, + {at: 1, expect: '250px'}, + {at: 1.5, expect: '300px'}, +]); + +test_composition({ + property: 'width', + underlying: '100px', + addFrom: '10px', + addTo: '2px', +}, [ + {at: -0.5, expect: '114px'}, + {at: 0, expect: '110px'}, + {at: 0.5, expect: '106px'}, + {at: 1, expect: '102px'}, + {at: 1.5, expect: '98px'}, // Value clamping should happen after composition. +]); + +test_composition({ + property: 'width', + underlying: '10%', + addFrom: '100px', + addTo: '20%', +}, [ + {at: -0.3, expect: 'calc(130px + 4%)'}, + {at: 0, expect: 'calc(100px + 10%)'}, + {at: 0.5, expect: 'calc(50px + 20%)'}, + {at: 1, expect: '30%'}, + {at: 1.5, expect: 'calc(-50px + 40%)'}, +]); + +test_composition({ + property: 'width', + underlying: '50px', + addFrom: '100px', + replaceTo: '200px', +}, [ + {at: -0.3, expect: '135px'}, + {at: 0, expect: '150px'}, + {at: 0.5, expect: '175px'}, + {at: 1, expect: '200px'}, + {at: 1.5, expect: '225px'}, +]); + +test_composition({ + property: 'width', + underlying: '100px', + addFrom: '100px', + addTo: 'auto', +}, [ + {at: -0.3, expect: '200px'}, + {at: 0, expect: '200px'}, + {at: 0.5, expect: 'auto'}, + {at: 1, expect: 'auto'}, + {at: 1.5, expect: 'auto'}, +]); +</script> +</body> diff --git a/testing/web-platform/tests/css/css-sizing/animation/width-interpolation.html b/testing/web-platform/tests/css/css-sizing/animation/width-interpolation.html new file mode 100644 index 0000000000..d165c994b5 --- /dev/null +++ b/testing/web-platform/tests/css/css-sizing/animation/width-interpolation.html @@ -0,0 +1,127 @@ +<!DOCTYPE html> +<meta charset="UTF-8"> +<title>width interpolation</title> +<link rel="help" href="https://drafts.csswg.org/css-sizing-3/#propdef-width"> +<meta name="assert" content="width supports animation by computed value"> + +<script src="/resources/testharness.js"></script> +<script src="/resources/testharnessreport.js"></script> +<script src="/css/support/interpolation-testcommon.js"></script> + +<style> +.parent { + width: 100px; + overflow: visible; +} +.target { + font-size: 16px; + background-color: black; + width: 10px; + height: 10px; +} +.expected { + background-color: green; +} +</style> + +<body> + <template id="target-template"> + <div class="container"> + <div class="target"></div> + </div> + </template> +</body> + +<script> +test_interpolation({ + property: 'width', + from: neutralKeyframe, + to: '40px', +}, [ + {at: -0.3, expect: '1px'}, + {at: 0, expect: '10px'}, + {at: 0.3, expect: '19px'}, + {at: 0.6, expect: '28px'}, + {at: 1, expect: '40px'}, + {at: 1.5, expect: '55px'}, +]); + +test_no_interpolation({ + property: 'width', + from: 'initial', + to: '40px', +}); + +test_interpolation({ + property: 'width', + from: 'inherit', + to: '40px', +}, [ + {at: -0.3, expect: '118px'}, + {at: 0, expect: '100px'}, + {at: 0.3, expect: '82px'}, + {at: 0.6, expect: '64px'}, + {at: 1, expect: '40px'}, + {at: 1.5, expect: '10px'}, +]); + +test_no_interpolation({ + property: 'width', + from: 'unset', + to: '40px', +}); + +test_interpolation({ + property: 'width', + from: '0px', + to: '100px', +}, [ + {at: -0.3, expect: '0px'}, // CSS width can't be negative. + {at: 0, expect: '0px'}, + {at: 0.3, expect: '30px'}, + {at: 0.6, expect: '60px'}, + {at: 1, expect: '100px'}, + {at: 1.5, expect: '150px'} +]); + +test_interpolation({ + property: 'width', + from: '10px', + to: '100%' +}, [ + {at: -0.3, expect: '0px'}, // CSS width can't be negative. + {at: 0, expect: '10px'}, + {at: 0.3, expect: '37px'}, + {at: 0.6, expect: '64px'}, + {at: 1, expect: '100px'}, + {at: 1.5, expect: '145px'} +]); + +// The "vw" unit equals to 1% of the width of the viewport's initial containing +// block: +// https://developer.mozilla.org/en-US/docs/Web/CSS/length +function vw(x) { + return (x * window.innerWidth / 100); +} + +// In here, 16 is the font-size which is the value of 1em, and vw(10) is the +// value of 10vw. The calc here takes the "at" in the next interpolation test +// and computes the expected value. +function calc(x) { + return Math.max(16 + (vw(10) - 16) * x, 0).toFixed(2) + "px"; +} + +test_interpolation({ + property: 'width', + from: '1em', + to: '10vw' +}, [ + {at: -0.3, expect: calc(-0.3)}, + {at: 0, expect: calc(0)}, + {at: 0.3, expect: calc(0.3)}, + {at: 0.6, expect: calc(0.6)}, + {at: 1, expect: calc(1)}, + {at: 1.5, expect: calc(1.5)} +]); +</script> +</body> |