summaryrefslogtreecommitdiffstats
path: root/testing/web-platform/tests/css/css-color/animation
diff options
context:
space:
mode:
Diffstat (limited to 'testing/web-platform/tests/css/css-color/animation')
-rw-r--r--testing/web-platform/tests/css/css-color/animation/color-composition.html50
-rw-r--r--testing/web-platform/tests/css/css-color/animation/color-interpolation.html133
-rw-r--r--testing/web-platform/tests/css/css-color/animation/opacity-animation-ending-correctly-001-ref.html24
-rw-r--r--testing/web-platform/tests/css/css-color/animation/opacity-animation-ending-correctly-001.html48
-rw-r--r--testing/web-platform/tests/css/css-color/animation/opacity-animation-ending-correctly-002.html50
-rw-r--r--testing/web-platform/tests/css/css-color/animation/opacity-interpolation.html96
6 files changed, 401 insertions, 0 deletions
diff --git a/testing/web-platform/tests/css/css-color/animation/color-composition.html b/testing/web-platform/tests/css/css-color/animation/color-composition.html
new file mode 100644
index 0000000000..c3e481830b
--- /dev/null
+++ b/testing/web-platform/tests/css/css-color/animation/color-composition.html
@@ -0,0 +1,50 @@
+<!DOCTYPE html>
+<meta charset="UTF-8">
+<title>color composition</title>
+<link rel="help" href="https://drafts.csswg.org/css-color/#the-color-property">
+<meta name="assert" content="color supports animation by computed value type">
+
+<script src="/resources/testharness.js"></script>
+<script src="/resources/testharnessreport.js"></script>
+<script src="/css/support/interpolation-testcommon.js"></script>
+
+<style>
+.target {
+ width: 40px;
+ height: 40px;
+ background-color: black;
+}
+.expected {
+ background-color: green;
+}
+</style>
+
+<body>
+<script>
+test_composition({
+ property: 'color',
+ underlying: 'rgb(50, 50, 50)',
+ addFrom: 'rgb(10, 10, 10)',
+ replaceTo: 'rgb(30, 30, 30)',
+}, [
+ {at: 0, expect: 'rgb(60, 60, 60)'},
+ {at: 0.2, expect: 'rgb(54, 54, 54)'},
+ {at: 1, expect: 'rgb(30, 30, 30)'},
+ {at: 1.2, expect: 'rgb(24, 24, 24)'},
+ {at: 1.5, expect: 'rgb(15, 15, 15)'},
+]);
+
+test_composition({
+ property: 'color',
+ underlying: 'rgb(60, 60, 60)',
+ addFrom: 'rgb(0, 0, 0)',
+ replaceTo: 'rgb(50, 50, 50)',
+}, [
+ {at: 0, expect: 'rgb(60, 60, 60)'},
+ {at: 0.5, expect: 'rgb(55, 55, 55)'},
+ {at: 1, expect: 'rgb(50, 50, 50)'},
+ {at: 1.2, expect: 'rgb(48, 48, 48)'},
+ {at: 1.5, expect: 'rgb(45, 45, 45)'},
+]);
+</script>
+</body>
diff --git a/testing/web-platform/tests/css/css-color/animation/color-interpolation.html b/testing/web-platform/tests/css/css-color/animation/color-interpolation.html
new file mode 100644
index 0000000000..d22f53409c
--- /dev/null
+++ b/testing/web-platform/tests/css/css-color/animation/color-interpolation.html
@@ -0,0 +1,133 @@
+<!DOCTYPE html>
+<meta charset="UTF-8">
+<title>color interpolation</title>
+<link rel="help" href="https://drafts.csswg.org/css-color/#the-color-property">
+<meta name="assert" content="color supports animation by computed value type">
+
+<script src="/resources/testharness.js"></script>
+<script src="/resources/testharnessreport.js"></script>
+<script src="/css/support/interpolation-testcommon.js"></script>
+
+<style>
+.parent {
+ color: blue;
+}
+.target {
+ display: inline-block;
+ font-size: 60pt;
+ color: yellow;
+}
+.expected {
+ margin-right: 15px;
+}
+</style>
+
+<body>
+ <template id="target-template">T</template>
+</body>
+
+<script>
+test_interpolation({
+ property: 'color',
+ from: neutralKeyframe,
+ to: 'green',
+}, [
+ {at: -0.3, expect: 'rgb(255, 255, 0)'},
+ {at: 0, expect: 'rgb(255, 255, 0)'},
+ {at: 0.3, expect: 'rgb(179, 217, 0)'},
+ {at: 0.6, expect: 'rgb(102, 179, 0)'},
+ {at: 1, expect: 'rgb(0, 128, 0)'},
+ {at: 1.5, expect: 'rgb(0, 65, 0)'},
+]);
+
+test_interpolation({
+ property: 'color',
+ from: 'initial',
+ to: 'green',
+}, [
+ {at: -0.3, expect: 'rgb(0, 0, 0)'},
+ {at: 0, expect: 'rgb(0, 0, 0)'},
+ {at: 0.3, expect: 'rgb(0, 38, 0)'},
+ {at: 0.6, expect: 'rgb(0, 77, 0)'},
+ {at: 1, expect: 'rgb(0, 128, 0)'},
+ {at: 1.5, expect: 'rgb(0, 192, 0)'},
+]);
+
+test_interpolation({
+ property: 'color',
+ from: 'inherit',
+ to: 'green',
+}, [
+ {at: -0.3, expect: 'rgb(0, 0, 255)'},
+ {at: 0, expect: 'rgb(0, 0, 255)'},
+ {at: 0.3, expect: 'rgb(0, 38, 179)'},
+ {at: 0.6, expect: 'rgb(0, 77, 102)'},
+ {at: 1, expect: 'rgb(0, 128, 0)'},
+ {at: 1.5, expect: 'rgb(0, 192, 0)'},
+]);
+
+test_interpolation({
+ property: 'color',
+ from: 'unset',
+ to: 'green',
+}, [
+ {at: -0.3, expect: 'rgb(0, 0, 255)'},
+ {at: 0, expect: 'rgb(0, 0, 255)'},
+ {at: 0.3, expect: 'rgb(0, 38, 179)'},
+ {at: 0.6, expect: 'rgb(0, 77, 102)'},
+ {at: 1, expect: 'rgb(0, 128, 0)'},
+ {at: 1.5, expect: 'rgb(0, 192, 0)'},
+]);
+
+test_interpolation({
+ property: 'color',
+ from: 'black',
+ to: 'orange',
+}, [
+ {at: -0.3, expect: 'rgb(0, 0, 0)'},
+ {at: 0, expect: 'rgb(0, 0, 0)'},
+ {at: 0.3, expect: 'rgb(77, 50, 0)'},
+ {at: 0.6, expect: 'rgb(153, 99, 0)'},
+ {at: 1, expect: 'rgb(255, 165, 0)'},
+ {at: 1.5, expect: 'rgb(255, 248, 0)'},
+]);
+
+test_interpolation({
+ property: 'color',
+ from: 'rgb(0 0 0)',
+ to: 'color(srgb 1 1 1)',
+}, [
+ {at: -0.3, expect: 'oklab(0 0 0)'},
+ {at: 0, expect: 'oklab(0 0 0)'},
+ {at: 0.3, expect: 'oklab(0.3 0 0)'},
+ {at: 0.6, expect: 'oklab(0.6 0 0)'},
+ {at: 1, expect: 'oklab(1 0 0)'},
+ {at: 1.5, expect: 'oklab(1 0 0)'},
+]);
+
+test_interpolation({
+ property: 'color',
+ from: 'color(srgb 0 0 0)',
+ to: 'rgb(255 255 255)',
+}, [
+ {at: -0.3, expect: 'oklab(0 0 0)'},
+ {at: 0, expect: 'oklab(0 0 0)'},
+ {at: 0.3, expect: 'oklab(0.3 0 0)'},
+ {at: 0.6, expect: 'oklab(0.6 0 0)'},
+ {at: 1, expect: 'oklab(1 0 0)'},
+ {at: 1.5, expect: 'oklab(1 0 0)'},
+]);
+
+test_interpolation({
+ property: 'color',
+ from: 'color(srgb 0 0 0)',
+ to: 'color(srgb 1 1 1)',
+}, [
+ {at: -0.3, expect: 'oklab(0 0 0)'},
+ {at: 0, expect: 'oklab(0 0 0)'},
+ {at: 0.3, expect: 'oklab(0.3 0 0)'},
+ {at: 0.6, expect: 'oklab(0.6 0 0)'},
+ {at: 1, expect: 'oklab(1 0 0)'},
+ {at: 1.5, expect: 'oklab(1 0 0)'},
+]);
+</script>
diff --git a/testing/web-platform/tests/css/css-color/animation/opacity-animation-ending-correctly-001-ref.html b/testing/web-platform/tests/css/css-color/animation/opacity-animation-ending-correctly-001-ref.html
new file mode 100644
index 0000000000..ca55dc66f3
--- /dev/null
+++ b/testing/web-platform/tests/css/css-color/animation/opacity-animation-ending-correctly-001-ref.html
@@ -0,0 +1,24 @@
+<!DOCTYPE HTML>
+<html>
+<title>CSS Test Reference (Color): ending of opacity animation</title>
+<link rel="author" title="L. David Baron" href="https://dbaron.org/">
+<link rel="author" title="Google" href="https://www.google.com/">
+
+<style>
+#test {
+ position: sticky;
+ top: 0;
+ height: 50px;
+ background: blue;
+ opacity: 0.2;
+}
+
+.tall {
+ height: 5000px;
+}
+</style>
+
+<div id="test">
+</div>
+<div class="tall">
+</div>
diff --git a/testing/web-platform/tests/css/css-color/animation/opacity-animation-ending-correctly-001.html b/testing/web-platform/tests/css/css-color/animation/opacity-animation-ending-correctly-001.html
new file mode 100644
index 0000000000..1fb36cd366
--- /dev/null
+++ b/testing/web-platform/tests/css/css-color/animation/opacity-animation-ending-correctly-001.html
@@ -0,0 +1,48 @@
+<!DOCTYPE HTML>
+<html class="reftest-wait">
+<title>CSS Test (Color): ending of opacity animation</title>
+<link rel="author" title="L. David Baron" href="https://dbaron.org/">
+<link rel="author" title="Google" href="https://www.google.com/">
+<link rel="help" href="https://bugs.chromium.org/p/chromium/issues/detail?id=1330438">
+<link rel="help" href="https://www.w3.org/TR/css-color-3/#transparency">
+<link rel="match" href="opacity-animation-ending-correctly-001-ref.html">
+
+<style>
+#test {
+ position: sticky;
+ top: 0;
+ height: 50px;
+ background: blue;
+ transition: opacity 50ms step-start;
+}
+
+#test.fade {
+ opacity: 0.2;
+}
+
+.tall {
+ height: 5000px;
+}
+</style>
+
+<div id="test">
+</div>
+<div class="tall">
+</div>
+
+<script>
+function flushStyleLayoutAndPrePaint() {
+ document.elementFromPoint(10, 10);
+}
+
+document.getElementById("test").addEventListener("transitionend", function(e) {
+ document.documentElement.classList.remove("reftest-wait");
+});
+requestAnimationFrame(function() {
+ flushStyleLayoutAndPrePaint();
+ requestAnimationFrame(function() {
+ document.getElementById("test").classList.add("fade");
+ flushStyleLayoutAndPrePaint();
+ });
+});
+</script>
diff --git a/testing/web-platform/tests/css/css-color/animation/opacity-animation-ending-correctly-002.html b/testing/web-platform/tests/css/css-color/animation/opacity-animation-ending-correctly-002.html
new file mode 100644
index 0000000000..7ba097fb10
--- /dev/null
+++ b/testing/web-platform/tests/css/css-color/animation/opacity-animation-ending-correctly-002.html
@@ -0,0 +1,50 @@
+<!DOCTYPE HTML>
+<html class="reftest-wait">
+<title>CSS Test (Color): ending of opacity animation</title>
+<link rel="author" title="L. David Baron" href="https://dbaron.org/">
+<link rel="author" title="Google" href="https://www.google.com/">
+<link rel="help" href="https://bugs.chromium.org/p/chromium/issues/detail?id=1330438">
+<link rel="help" href="https://www.w3.org/TR/css-color-3/#transparency">
+<link rel="match" href="opacity-animation-ending-correctly-001-ref.html">
+
+<style>
+#test {
+ position: sticky;
+ top: 0;
+ height: 50px;
+ background: blue;
+ transform: translate(0);
+ filter: grayscale(0%);
+ transition: opacity 50ms step-start;
+}
+
+#test.fade {
+ opacity: 0.2;
+}
+
+.tall {
+ height: 5000px;
+}
+</style>
+
+<div id="test">
+</div>
+<div class="tall">
+</div>
+
+<script>
+function flushStyleLayoutAndPrePaint() {
+ document.elementFromPoint(10, 10);
+}
+
+document.getElementById("test").addEventListener("transitionend", function(e) {
+ document.documentElement.classList.remove("reftest-wait");
+});
+requestAnimationFrame(function() {
+ flushStyleLayoutAndPrePaint();
+ requestAnimationFrame(function() {
+ document.getElementById("test").classList.add("fade");
+ flushStyleLayoutAndPrePaint();
+ });
+});
+</script>
diff --git a/testing/web-platform/tests/css/css-color/animation/opacity-interpolation.html b/testing/web-platform/tests/css/css-color/animation/opacity-interpolation.html
new file mode 100644
index 0000000000..ce26a8c799
--- /dev/null
+++ b/testing/web-platform/tests/css/css-color/animation/opacity-interpolation.html
@@ -0,0 +1,96 @@
+<!DOCTYPE html>
+<meta charset="UTF-8">
+<title>opacity interpolation</title>
+<link rel="help" href="https://drafts.csswg.org/css-color-3/#opacity">
+<meta name="assert" content="opacity supports animation">
+
+<script src="/resources/testharness.js"></script>
+<script src="/resources/testharnessreport.js"></script>
+<script src="/css/support/interpolation-testcommon.js"></script>
+
+<style>
+.parent {
+ opacity: 0.8;
+}
+
+.target {
+ width: 100px;
+ height: 100px;
+ background-color: black;
+ display: inline-block;
+ opacity: 0.1;
+}
+
+.expected {
+ background-color: green;
+}
+</style>
+
+<body>
+<script>
+test_interpolation({
+ property: 'opacity',
+ from: neutralKeyframe,
+ to: '0.2',
+}, [
+ {at: -0.3, expect: '0.07'},
+ {at: 0, expect: '0.1'},
+ {at: 0.3, expect: '0.13'},
+ {at: 0.6, expect: '0.16'},
+ {at: 1, expect: '0.2'},
+ {at: 1.5, expect: '0.25'},
+]);
+
+test_interpolation({
+ property: 'opacity',
+ from: 'initial',
+ to: '0.2',
+}, [
+ {at: -0.3, expect: '1'},
+ {at: 0, expect: '1'},
+ {at: 0.3, expect: '0.76'},
+ {at: 0.6, expect: '0.52'},
+ {at: 1, expect: '0.2'},
+ {at: 1.5, expect: '0'},
+]);
+
+test_interpolation({
+ property: 'opacity',
+ from: 'inherit',
+ to: '0.2',
+}, [
+ {at: -0.3, expect: '0.98'},
+ {at: 0, expect: '0.8'},
+ {at: 0.3, expect: '0.62'},
+ {at: 0.6, expect: '0.44'},
+ {at: 1, expect: '0.2'},
+ {at: 1.5, expect: '0'},
+]);
+
+test_interpolation({
+ property: 'opacity',
+ from: 'unset',
+ to: '0.2',
+}, [
+ {at: -0.3, expect: '1'},
+ {at: 0, expect: '1'},
+ {at: 0.3, expect: '0.76'},
+ {at: 0.6, expect: '0.52'},
+ {at: 1, expect: '0.2'},
+ {at: 1.5, expect: '0'},
+]);
+
+test_interpolation({
+ property: 'opacity',
+ from: '0',
+ to: '1'
+}, [
+ {at: -0.3, expect: '0'}, // CSS opacity is [0-1].
+ {at: 0, expect: '0'},
+ {at: 0.3, expect: '0.3'},
+ {at: 0.6, expect: '0.6'},
+ {at: 1, expect: '1'},
+ {at: 1.5, expect: '1'}
+]);
+</script>
+</body>