diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-07 09:22:09 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-07 09:22:09 +0000 |
commit | 43a97878ce14b72f0981164f87f2e35e14151312 (patch) | |
tree | 620249daf56c0258faa40cbdcf9cfba06de2a846 /testing/web-platform/tests/css/css-position/animations | |
parent | Initial commit. (diff) | |
download | firefox-upstream.tar.xz firefox-upstream.zip |
Adding upstream version 110.0.1.upstream/110.0.1upstream
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'testing/web-platform/tests/css/css-position/animations')
9 files changed, 696 insertions, 0 deletions
diff --git a/testing/web-platform/tests/css/css-position/animations/bottom-composition.html b/testing/web-platform/tests/css/css-position/animations/bottom-composition.html new file mode 100644 index 0000000000..68a830dfbd --- /dev/null +++ b/testing/web-platform/tests/css/css-position/animations/bottom-composition.html @@ -0,0 +1,78 @@ +<!DOCTYPE html> +<meta charset="UTF-8"> +<title>bottom composition</title> +<link rel="help" href="https://drafts.csswg.org/css-position-3/#propdef-bottom"> +<meta name="assert" content="bottom support animation"> + +<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: 'bottom', + 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: 'bottom', + 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'}, +]); + +test_composition({ + property: 'bottom', + 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: 'bottom', + 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: 'bottom', + 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-position/animations/bottom-interpolation.html b/testing/web-platform/tests/css/css-position/animations/bottom-interpolation.html new file mode 100644 index 0000000000..272e79fc05 --- /dev/null +++ b/testing/web-platform/tests/css/css-position/animations/bottom-interpolation.html @@ -0,0 +1,78 @@ +<!DOCTYPE html> +<meta charset="UTF-8"> +<link rel="help" href="https://drafts.csswg.org/css-position-3/#propdef-bottom"> +<meta name="test" content="bottom supports animation as a length or percentage"> + +<script src="/resources/testharness.js"></script> +<script src="/resources/testharnessreport.js"></script> +<script src="/css/support/interpolation-testcommon.js"></script> + +<style> +.parent { + bottom: 30px; +} +.target { + position: relative; + width: 100px; + height: 100px; + background-color: black; + display: inline-block; + margin: 20px 5px 20px 0px; + bottom: 10px; +} +.expected { + background-color: green; +} +</style> + +<body></body> + +<script> +test_interpolation({ + property: 'bottom', + from: neutralKeyframe, + to: '20px', +}, [ + {at: -0.3, expect: '7px'}, + {at: 0, expect: '10px'}, + {at: 0.5, expect: '15px'}, + {at: 1, expect: '20px'}, + {at: 1.5, expect: '25px'}, +]); + +test_no_interpolation({ + property: 'bottom', + from: 'initial', + to: '20px', +}); + +test_interpolation({ + property: 'bottom', + from: 'inherit', + to: '20px', +}, [ + {at: -0.3, expect: '33px'}, + {at: 0, expect: '30px'}, + {at: 0.5, expect: '25px'}, + {at: 1, expect: '20px'}, + {at: 1.5, expect: '15px'}, +]); + +test_no_interpolation({ + property: 'bottom', + from: 'unset', + to: '20px', +}); + +test_interpolation({ + property: 'bottom', + from: '-10px', + to: '10px' +}, [ + {at: -0.3, expect: '-16px'}, + {at: 0, expect: '-10px'}, + {at: 0.5, expect: '0px'}, + {at: 1, expect: '10px'}, + {at: 1.5, expect: '20px'} +]); +</script> diff --git a/testing/web-platform/tests/css/css-position/animations/left-composition.html b/testing/web-platform/tests/css/css-position/animations/left-composition.html new file mode 100644 index 0000000000..14b3dfda76 --- /dev/null +++ b/testing/web-platform/tests/css/css-position/animations/left-composition.html @@ -0,0 +1,91 @@ +<!DOCTYPE html> +<meta charset="UTF-8"> +<title>left composition</title> +<link rel="help" href="https://drafts.csswg.org/css-position-3/#propdef-left"> +<meta name="assert" content="left support animation"> + +<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: 'left', + 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: 'left', + 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'}, +]); + +test_composition({ + property: 'left', + 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: 'left', + underlying: '10%', + addFrom: '100px', + addTo: '-10%', +}, [ + {at: -0.3, expect: 'calc(130px + 13%)'}, + {at: 0, expect: 'calc(100px + 10%)'}, + {at: 0.5, expect: 'calc(50px + 5%)'}, + {at: 1, expect: '0%'}, + {at: 1.5, expect: 'calc(-50px - 5%)'}, +]); + +test_composition({ + property: 'left', + 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: 'left', + 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-position/animations/left-interpolation.html b/testing/web-platform/tests/css/css-position/animations/left-interpolation.html new file mode 100644 index 0000000000..33ed0b4ec3 --- /dev/null +++ b/testing/web-platform/tests/css/css-position/animations/left-interpolation.html @@ -0,0 +1,76 @@ +<!DOCTYPE html> +<meta charset="UTF-8"> +<link rel="help" href="https://drafts.csswg.org/css-position-3/#propdef-left"> +<meta name="test" content="left supports animation as a length or percentage"> + +<script src="/resources/testharness.js"></script> +<script src="/resources/testharnessreport.js"></script> +<script src="/css/support/interpolation-testcommon.js"></script> + +<style> +.parent { + position: relative; + left: 30px; +} +.target { + position: relative; + width: 10px; + height: 10px; + background-color: black; + left: 10px; +} +.expected { + background-color: green; +} +</style> +<body></body> + +<script> +test_interpolation({ + property: 'left', + from: neutralKeyframe, + to: '20px', +}, [ + {at: -0.3, expect: '7px'}, + {at: 0, expect: '10px'}, + {at: 0.5, expect: '15px'}, + {at: 1, expect: '20px'}, + {at: 1.5, expect: '25px'}, +]); + +test_no_interpolation({ + property: 'left', + from: 'initial', + to: '20px', +}); + +test_interpolation({ + property: 'left', + from: 'inherit', + to: '20px', +}, [ + {at: -0.3, expect: '33px'}, + {at: 0, expect: '30px'}, + {at: 0.5, expect: '25px'}, + {at: 1, expect: '20px'}, + {at: 1.5, expect: '15px'}, +]); + +test_no_interpolation({ + property: 'left', + from: 'unset', + to: '20px', +}); + +test_interpolation({ + property: 'left', + from: '-10px', + to: '10px' +}, [ + {at: -0.3, expect: '-16px'}, + {at: 0, expect: '-10px'}, + {at: 0.5, expect: '0px'}, + {at: 1, expect: '10px'}, + {at: 1.5, expect: '20px'} +]); +</script> diff --git a/testing/web-platform/tests/css/css-position/animations/position-interpolation.html b/testing/web-platform/tests/css/css-position/animations/position-interpolation.html new file mode 100644 index 0000000000..a4ad50240a --- /dev/null +++ b/testing/web-platform/tests/css/css-position/animations/position-interpolation.html @@ -0,0 +1,61 @@ +<!DOCTYPE html> +<meta charset="UTF-8"> +<title>position interpolation</title> +<link rel="help" href="https://drafts.csswg.org/css-position-3/#position-property"> +<meta name="assert" content="position has discrete animation"> + +<script src="/resources/testharness.js"></script> +<script src="/resources/testharnessreport.js"></script> +<script src="/css/support/interpolation-testcommon.js"></script> + +<style> +.parent { + position: relative; + display: inline-block; + height: 10px; + margin: 0px; +} +.target { + width: 10px; + height: 10px; + background-color: black; + left: 10px; + position: 10px; +} +.expected { + background-color: green; +} +</style> + +<body> +<template id="target-template"> + <div class="parent"> + <div class="target"></div> + </div> +</template> +</body> + +<script> +test_no_interpolation({ + property: 'position', + from: 'absolute', + to: 'static', +}); + +// This is still discrete interpolation; this test ensures that the neutral +// keyframe is defined correctly for position. +test_interpolation({ + property: 'position', + from: neutralKeyframe, + to: 'absolute', + method: 'CSS Animations', +}, [ + {at: -1, expect: 'static'}, + {at: 0, expect: 'static'}, + {at: 0.25, expect: 'static'}, + {at: 0.5, expect: 'absolute'}, + {at: 0.75, expect: 'absolute'}, + {at: 1, expect: 'absolute'}, + {at: 2, expect: 'absolute'}, +]); +</script> diff --git a/testing/web-platform/tests/css/css-position/animations/right-composition.html b/testing/web-platform/tests/css/css-position/animations/right-composition.html new file mode 100644 index 0000000000..995bb8d6be --- /dev/null +++ b/testing/web-platform/tests/css/css-position/animations/right-composition.html @@ -0,0 +1,78 @@ +<!DOCTYPE html> +<meta charset="UTF-8"> +<title>right composition</title> +<link rel="help" href="https://drafts.csswg.org/css-position-3/#propdef-right"> +<meta name="assert" content="right support animation"> + +<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: 'right', + 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: 'right', + 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'}, +]); + +test_composition({ + property: 'right', + 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: 'right', + 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: 'right', + 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-position/animations/right-interpolation.html b/testing/web-platform/tests/css/css-position/animations/right-interpolation.html new file mode 100644 index 0000000000..284d435e56 --- /dev/null +++ b/testing/web-platform/tests/css/css-position/animations/right-interpolation.html @@ -0,0 +1,77 @@ +<!DOCTYPE html> +<meta charset="UTF-8"> +<link rel="help" href="https://drafts.csswg.org/css-position-3/#propdef-right"> +<meta name="test" content="right supports animation as a length or percentage"> + +<script src="/resources/testharness.js"></script> +<script src="/resources/testharnessreport.js"></script> +<script src="/css/support/interpolation-testcommon.js"></script> + +<style> +.parent { + margin-left: 40px; + right: 30px; +} +.target { + position: relative; + width: 10px; + height: 10px; + background-color: black; + right: 10px; +} +.expected { + background-color: green; +} +</style> + +<body></body> + +<script> +test_interpolation({ + property: 'right', + from: neutralKeyframe, + to: '20px', +}, [ + {at: -0.3, expect: '7px'}, + {at: 0, expect: '10px'}, + {at: 0.5, expect: '15px'}, + {at: 1, expect: '20px'}, + {at: 1.5, expect: '25px'}, +]); + +test_no_interpolation({ + property: 'right', + from: 'initial', + to: '20px', +}); + +test_interpolation({ + property: 'right', + from: 'inherit', + to: '20px', +}, [ + {at: -0.3, expect: '33px'}, + {at: 0, expect: '30px'}, + {at: 0.5, expect: '25px'}, + {at: 1, expect: '20px'}, + {at: 1.5, expect: '15px'}, +]); + +test_no_interpolation({ + property: 'right', + from: 'unset', + to: '20px', +}); + +test_interpolation({ + property: 'right', + from: '-10px', + to: '10px' +}, [ + {at: -0.3, expect: '-16px'}, + {at: 0, expect: '-10px'}, + {at: 0.5, expect: '0px'}, + {at: 1, expect: '10px'}, + {at: 1.5, expect: '20px'} +]); +</script> diff --git a/testing/web-platform/tests/css/css-position/animations/top-composition.html b/testing/web-platform/tests/css/css-position/animations/top-composition.html new file mode 100644 index 0000000000..47782e8536 --- /dev/null +++ b/testing/web-platform/tests/css/css-position/animations/top-composition.html @@ -0,0 +1,78 @@ +<!DOCTYPE html> +<meta charset="UTF-8"> +<title>top composition</title> +<link rel="help" href="https://drafts.csswg.org/css-position-3/#propdef-top"> +<meta name="assert" content="top support animation"> + +<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: 'top', + 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: 'top', + 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'}, +]); + +test_composition({ + property: 'top', + 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: 'top', + 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: 'top', + 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-position/animations/top-interpolation.html b/testing/web-platform/tests/css/css-position/animations/top-interpolation.html new file mode 100644 index 0000000000..f5af530c38 --- /dev/null +++ b/testing/web-platform/tests/css/css-position/animations/top-interpolation.html @@ -0,0 +1,79 @@ +<!DOCTYPE html> +<meta charset="UTF-8"> +<link rel="help" href="https://drafts.csswg.org/css-position-3/#propdef-top"> +<meta name="assert" content="top supports animation as a length or percentage"> + +<script src="/resources/testharness.js"></script> +<script src="/resources/testharnessreport.js"></script> +<script src="/css/support/interpolation-testcommon.js"></script> + +<style> +.parent { + top: 30px; + margin-bottom: 40px; +} +.target { + position: relative; + width: 10px; + height: 10px; + background-color: black; + display: inline-block; + top: 10px; +} +.expected { + background-color: green; + margin-right: 10px; +} +</style> + +<body></body> + +<script> +test_interpolation({ + property: 'top', + from: neutralKeyframe, + to: '20px', +}, [ + {at: -0.3, expect: '7px'}, + {at: 0, expect: '10px'}, + {at: 0.5, expect: '15px'}, + {at: 1, expect: '20px'}, + {at: 1.5, expect: '25px'}, +]); + +test_no_interpolation({ + property: 'top', + from: 'initial', + to: '20px', +}); + +test_interpolation({ + property: 'top', + from: 'inherit', + to: '20px', +}, [ + {at: -0.3, expect: '33px'}, + {at: 0, expect: '30px'}, + {at: 0.5, expect: '25px'}, + {at: 1, expect: '20px'}, + {at: 1.5, expect: '15px'}, +]); + +test_no_interpolation({ + property: 'top', + from: 'unset', + to: '20px', +}); + +test_interpolation({ + property: 'top', + from: '-10px', + to: '10px' +}, [ + {at: -0.3, expect: '-16px'}, + {at: 0, expect: '-10px'}, + {at: 0.5, expect: '0px'}, + {at: 1, expect: '10px'}, + {at: 1.5, expect: '20px'} +]); +</script> |