Skip to content

Truly independent web browser

Tests/LibWeb: Import font-palette animation and shorthand tests

Andreas Kling8f835ca1f28f
diff --git a/Tests/LibWeb/Text/expected/wpt-import/css/css-fonts/animations/font-palette-animation-not-specified-endpoints.txt b/Tests/LibWeb/Text/expected/wpt-import/css/css-fonts/animations/font-palette-animation-not-specified-endpoints.txt
new file mode 100644
index 00000000000..e6aea98d9e1
--- /dev/null
+++ b/Tests/LibWeb/Text/expected/wpt-import/css/css-fonts/animations/font-palette-animation-not-specified-endpoints.txt
@@ -0,0 +1,7 @@
+Harness status: OK
+
+Found 2 tests
+
+2 Fail
+Fail Verify font-palette is animated when `from` keyframe is not specified
+Fail Verify font-palette is animated when `to` keyframe is not specified
\ No newline at end of file
diff --git a/Tests/LibWeb/Text/expected/wpt-import/css/css-fonts/animations/font-palette-interpolation.txt b/Tests/LibWeb/Text/expected/wpt-import/css/css-fonts/animations/font-palette-interpolation.txt
new file mode 100644
index 00000000000..660cc41fd0f
--- /dev/null
+++ b/Tests/LibWeb/Text/expected/wpt-import/css/css-fonts/animations/font-palette-interpolation.txt
@@ -0,0 +1,119 @@
+Harness status: OK
+
+Found 114 tests
+
+114 Fail
+Fail CSS Transitions: property <font-palette> from [light] to [dark] at (-2) should be [light]
+Fail CSS Transitions: property <font-palette> from [light] to [dark] at (-0.25) should be [light]
+Fail CSS Transitions: property <font-palette> from [light] to [dark] at (0) should be [light]
+Fail CSS Transitions: property <font-palette> from [light] to [dark] at (0.3) should be [palette-mix(in oklab, light, dark 30%)]
+Fail CSS Transitions: property <font-palette> from [light] to [dark] at (0.6) should be [palette-mix(in oklab, light, dark 60%)]
+Fail CSS Transitions: property <font-palette> from [light] to [dark] at (1) should be [dark]
+Fail CSS Transitions: property <font-palette> from [light] to [dark] at (1.5) should be [dark]
+Fail CSS Transitions with transition: all: property <font-palette> from [light] to [dark] at (-2) should be [light]
+Fail CSS Transitions with transition: all: property <font-palette> from [light] to [dark] at (-0.25) should be [light]
+Fail CSS Transitions with transition: all: property <font-palette> from [light] to [dark] at (0) should be [light]
+Fail CSS Transitions with transition: all: property <font-palette> from [light] to [dark] at (0.3) should be [palette-mix(in oklab, light, dark 30%)]
+Fail CSS Transitions with transition: all: property <font-palette> from [light] to [dark] at (0.6) should be [palette-mix(in oklab, light, dark 60%)]
+Fail CSS Transitions with transition: all: property <font-palette> from [light] to [dark] at (1) should be [dark]
+Fail CSS Transitions with transition: all: property <font-palette> from [light] to [dark] at (1.5) should be [dark]
+Fail CSS Animations: property <font-palette> from [light] to [dark] at (-2) should be [light]
+Fail CSS Animations: property <font-palette> from [light] to [dark] at (-0.25) should be [light]
+Fail CSS Animations: property <font-palette> from [light] to [dark] at (0) should be [light]
+Fail CSS Animations: property <font-palette> from [light] to [dark] at (0.3) should be [palette-mix(in oklab, light, dark 30%)]
+Fail CSS Animations: property <font-palette> from [light] to [dark] at (0.6) should be [palette-mix(in oklab, light, dark 60%)]
+Fail CSS Animations: property <font-palette> from [light] to [dark] at (1) should be [dark]
+Fail CSS Animations: property <font-palette> from [light] to [dark] at (1.5) should be [dark]
+Fail Web Animations: property <font-palette> from [light] to [dark] at (-2) should be [light]
+Fail Web Animations: property <font-palette> from [light] to [dark] at (-0.25) should be [light]
+Fail Web Animations: property <font-palette> from [light] to [dark] at (0) should be [light]
+Fail Web Animations: property <font-palette> from [light] to [dark] at (0.3) should be [palette-mix(in oklab, light, dark 30%)]
+Fail Web Animations: property <font-palette> from [light] to [dark] at (0.6) should be [palette-mix(in oklab, light, dark 60%)]
+Fail Web Animations: property <font-palette> from [light] to [dark] at (1) should be [dark]
+Fail Web Animations: property <font-palette> from [light] to [dark] at (1.5) should be [dark]
+Fail CSS Transitions: property <font-palette> from [initial] to [inherit] at (-2) should be [normal]
+Fail CSS Transitions: property <font-palette> from [initial] to [inherit] at (-0.25) should be [normal]
+Fail CSS Transitions: property <font-palette> from [initial] to [inherit] at (0) should be [normal]
+Fail CSS Transitions: property <font-palette> from [initial] to [inherit] at (0.3) should be [palette-mix(in oklab, normal, light 30%)]
+Fail CSS Transitions: property <font-palette> from [initial] to [inherit] at (0.6) should be [palette-mix(in oklab, normal, light 60%)]
+Fail CSS Transitions: property <font-palette> from [initial] to [inherit] at (1) should be [light]
+Fail CSS Transitions: property <font-palette> from [initial] to [inherit] at (1.5) should be [light]
+Fail CSS Transitions with transition: all: property <font-palette> from [initial] to [inherit] at (-2) should be [normal]
+Fail CSS Transitions with transition: all: property <font-palette> from [initial] to [inherit] at (-0.25) should be [normal]
+Fail CSS Transitions with transition: all: property <font-palette> from [initial] to [inherit] at (0) should be [normal]
+Fail CSS Transitions with transition: all: property <font-palette> from [initial] to [inherit] at (0.3) should be [palette-mix(in oklab, normal, light 30%)]
+Fail CSS Transitions with transition: all: property <font-palette> from [initial] to [inherit] at (0.6) should be [palette-mix(in oklab, normal, light 60%)]
+Fail CSS Transitions with transition: all: property <font-palette> from [initial] to [inherit] at (1) should be [light]
+Fail CSS Transitions with transition: all: property <font-palette> from [initial] to [inherit] at (1.5) should be [light]
+Fail CSS Animations: property <font-palette> from [initial] to [inherit] at (-2) should be [normal]
+Fail CSS Animations: property <font-palette> from [initial] to [inherit] at (-0.25) should be [normal]
+Fail CSS Animations: property <font-palette> from [initial] to [inherit] at (0) should be [normal]
+Fail CSS Animations: property <font-palette> from [initial] to [inherit] at (0.3) should be [palette-mix(in oklab, normal, light 30%)]
+Fail CSS Animations: property <font-palette> from [initial] to [inherit] at (0.6) should be [palette-mix(in oklab, normal, light 60%)]
+Fail CSS Animations: property <font-palette> from [initial] to [inherit] at (1) should be [light]
+Fail CSS Animations: property <font-palette> from [initial] to [inherit] at (1.5) should be [light]
+Fail Web Animations: property <font-palette> from [initial] to [inherit] at (-2) should be [normal]
+Fail Web Animations: property <font-palette> from [initial] to [inherit] at (-0.25) should be [normal]
+Fail Web Animations: property <font-palette> from [initial] to [inherit] at (0) should be [normal]
+Fail Web Animations: property <font-palette> from [initial] to [inherit] at (0.3) should be [palette-mix(in oklab, normal, light 30%)]
+Fail Web Animations: property <font-palette> from [initial] to [inherit] at (0.6) should be [palette-mix(in oklab, normal, light 60%)]
+Fail Web Animations: property <font-palette> from [initial] to [inherit] at (1) should be [light]
+Fail Web Animations: property <font-palette> from [initial] to [inherit] at (1.5) should be [light]
+Fail CSS Transitions: property <font-palette> from [--custom-palette] to [normal] at (-2) should be [--custom-palette]
+Fail CSS Transitions: property <font-palette> from [--custom-palette] to [normal] at (-0.25) should be [--custom-palette]
+Fail CSS Transitions: property <font-palette> from [--custom-palette] to [normal] at (0) should be [--custom-palette]
+Fail CSS Transitions: property <font-palette> from [--custom-palette] to [normal] at (0.3) should be [palette-mix(in oklab, --custom-palette, normal 30%)]
+Fail CSS Transitions: property <font-palette> from [--custom-palette] to [normal] at (0.6) should be [palette-mix(in oklab, --custom-palette, normal 60%)]
+Fail CSS Transitions: property <font-palette> from [--custom-palette] to [normal] at (1) should be [normal]
+Fail CSS Transitions: property <font-palette> from [--custom-palette] to [normal] at (1.5) should be [normal]
+Fail CSS Transitions with transition: all: property <font-palette> from [--custom-palette] to [normal] at (-2) should be [--custom-palette]
+Fail CSS Transitions with transition: all: property <font-palette> from [--custom-palette] to [normal] at (-0.25) should be [--custom-palette]
+Fail CSS Transitions with transition: all: property <font-palette> from [--custom-palette] to [normal] at (0) should be [--custom-palette]
+Fail CSS Transitions with transition: all: property <font-palette> from [--custom-palette] to [normal] at (0.3) should be [palette-mix(in oklab, --custom-palette, normal 30%)]
+Fail CSS Transitions with transition: all: property <font-palette> from [--custom-palette] to [normal] at (0.6) should be [palette-mix(in oklab, --custom-palette, normal 60%)]
+Fail CSS Transitions with transition: all: property <font-palette> from [--custom-palette] to [normal] at (1) should be [normal]
+Fail CSS Transitions with transition: all: property <font-palette> from [--custom-palette] to [normal] at (1.5) should be [normal]
+Fail CSS Animations: property <font-palette> from [--custom-palette] to [normal] at (-2) should be [--custom-palette]
+Fail CSS Animations: property <font-palette> from [--custom-palette] to [normal] at (-0.25) should be [--custom-palette]
+Fail CSS Animations: property <font-palette> from [--custom-palette] to [normal] at (0) should be [--custom-palette]
+Fail CSS Animations: property <font-palette> from [--custom-palette] to [normal] at (0.3) should be [palette-mix(in oklab, --custom-palette, normal 30%)]
+Fail CSS Animations: property <font-palette> from [--custom-palette] to [normal] at (0.6) should be [palette-mix(in oklab, --custom-palette, normal 60%)]
+Fail CSS Animations: property <font-palette> from [--custom-palette] to [normal] at (1) should be [normal]
+Fail CSS Animations: property <font-palette> from [--custom-palette] to [normal] at (1.5) should be [normal]
+Fail Web Animations: property <font-palette> from [--custom-palette] to [normal] at (-2) should be [--custom-palette]
+Fail Web Animations: property <font-palette> from [--custom-palette] to [normal] at (-0.25) should be [--custom-palette]
+Fail Web Animations: property <font-palette> from [--custom-palette] to [normal] at (0) should be [--custom-palette]
+Fail Web Animations: property <font-palette> from [--custom-palette] to [normal] at (0.3) should be [palette-mix(in oklab, --custom-palette, normal 30%)]
+Fail Web Animations: property <font-palette> from [--custom-palette] to [normal] at (0.6) should be [palette-mix(in oklab, --custom-palette, normal 60%)]
+Fail Web Animations: property <font-palette> from [--custom-palette] to [normal] at (1) should be [normal]
+Fail Web Animations: property <font-palette> from [--custom-palette] to [normal] at (1.5) should be [normal]
+Fail CSS Transitions: property <font-palette> from [initial] to [normal] at (-2) should be [normal]
+Fail CSS Transitions: property <font-palette> from [initial] to [normal] at (-0.25) should be [normal]
+Fail CSS Transitions: property <font-palette> from [initial] to [normal] at (0) should be [normal]
+Fail CSS Transitions: property <font-palette> from [initial] to [normal] at (0.3) should be [normal]
+Fail CSS Transitions: property <font-palette> from [initial] to [normal] at (0.6) should be [normal]
+Fail CSS Transitions: property <font-palette> from [initial] to [normal] at (1) should be [normal]
+Fail CSS Transitions: property <font-palette> from [initial] to [normal] at (1.5) should be [normal]
+Fail CSS Transitions with transition: all: property <font-palette> from [initial] to [normal] at (-2) should be [normal]
+Fail CSS Transitions with transition: all: property <font-palette> from [initial] to [normal] at (-0.25) should be [normal]
+Fail CSS Transitions with transition: all: property <font-palette> from [initial] to [normal] at (0) should be [normal]
+Fail CSS Transitions with transition: all: property <font-palette> from [initial] to [normal] at (0.3) should be [normal]
+Fail CSS Transitions with transition: all: property <font-palette> from [initial] to [normal] at (0.6) should be [normal]
+Fail CSS Transitions with transition: all: property <font-palette> from [initial] to [normal] at (1) should be [normal]
+Fail CSS Transitions with transition: all: property <font-palette> from [initial] to [normal] at (1.5) should be [normal]
+Fail CSS Animations: property <font-palette> from [initial] to [normal] at (-2) should be [normal]
+Fail CSS Animations: property <font-palette> from [initial] to [normal] at (-0.25) should be [normal]
+Fail CSS Animations: property <font-palette> from [initial] to [normal] at (0) should be [normal]
+Fail CSS Animations: property <font-palette> from [initial] to [normal] at (0.3) should be [normal]
+Fail CSS Animations: property <font-palette> from [initial] to [normal] at (0.6) should be [normal]
+Fail CSS Animations: property <font-palette> from [initial] to [normal] at (1) should be [normal]
+Fail CSS Animations: property <font-palette> from [initial] to [normal] at (1.5) should be [normal]
+Fail Web Animations: property <font-palette> from [initial] to [normal] at (-2) should be [normal]
+Fail Web Animations: property <font-palette> from [initial] to [normal] at (-0.25) should be [normal]
+Fail Web Animations: property <font-palette> from [initial] to [normal] at (0) should be [normal]
+Fail Web Animations: property <font-palette> from [initial] to [normal] at (0.3) should be [normal]
+Fail Web Animations: property <font-palette> from [initial] to [normal] at (0.6) should be [normal]
+Fail Web Animations: property <font-palette> from [initial] to [normal] at (1) should be [normal]
+Fail Web Animations: property <font-palette> from [initial] to [normal] at (1.5) should be [normal]
+Fail An interpolation to inherit updates correctly on a parent style change.
+Fail Test additive animations
\ No newline at end of file
diff --git a/Tests/LibWeb/Text/expected/wpt-import/css/css-fonts/animations/multiple-elements-font-palette-animation.txt b/Tests/LibWeb/Text/expected/wpt-import/css/css-fonts/animations/multiple-elements-font-palette-animation.txt
new file mode 100644
index 00000000000..a0339ff60b7
--- /dev/null
+++ b/Tests/LibWeb/Text/expected/wpt-import/css/css-fonts/animations/multiple-elements-font-palette-animation.txt
@@ -0,0 +1,7 @@
+Harness status: OK
+
+Found 2 tests
+
+2 Fail
+Fail Verify font-palette value of the first element after animation
+Fail Verify font-palette value of the second element after animation
\ No newline at end of file
diff --git a/Tests/LibWeb/Text/expected/wpt-import/css/css-fonts/font-palette-vs-shorthand.txt b/Tests/LibWeb/Text/expected/wpt-import/css/css-fonts/font-palette-vs-shorthand.txt
new file mode 100644
index 00000000000..3564126993f
--- /dev/null
+++ b/Tests/LibWeb/Text/expected/wpt-import/css/css-fonts/font-palette-vs-shorthand.txt
@@ -0,0 +1,9 @@
+Harness status: OK
+
+Found 4 tests
+
+4 Fail
+Fail CSS Fonts Module Level 4: interaction of font-palette and font shorthand
+Fail CSS Fonts Module Level 4: interaction of font-palette and font shorthand 1
+Fail CSS Fonts Module Level 4: interaction of font-palette and font shorthand 2
+Fail CSS Fonts Module Level 4: interaction of font-palette and font shorthand 3
\ No newline at end of file
diff --git a/Tests/LibWeb/Text/input/wpt-import/css/css-fonts/animations/font-palette-animation-not-specified-endpoints.html b/Tests/LibWeb/Text/input/wpt-import/css/css-fonts/animations/font-palette-animation-not-specified-endpoints.html
new file mode 100644
index 00000000000..c3cb2cbe08a
--- /dev/null
+++ b/Tests/LibWeb/Text/input/wpt-import/css/css-fonts/animations/font-palette-animation-not-specified-endpoints.html
@@ -0,0 +1,67 @@
+<!DOCTYPE html>
+<meta charset="UTF-8">
+<title>Font-palette animation with unspecified endpoints keyframes</title>
+<link rel="help" href="https://www.w3.org/TR/css-fonts-4/#propdef-font-palette">
+<meta name="assert" content="Font-palette should be animated if `from` and `to` keyframes are not specified.">
+
+<script src="../../../resources/testharness.js"></script>
+<script src="../../../resources/testharnessreport.js"></script>
+<style>
+ @font-face {
+ font-family: "COLR-test-font";
+ src: url("../resources/COLR-palettes-test-font.ttf") format("truetype");
+ }
+ @font-palette-values --custom {
+ font-family: "COLR-test-font";
+ base-palette: 3;
+ }
+ @keyframes animFrom {
+ from {
+ font-palette: --custom;
+ }
+ }
+ @keyframes animTo {
+ to {
+ font-palette: --custom;
+ }
+ }
+ .demo {
+ font-family: "COLR-test-font";
+ font-size: 130px;
+ }
+ .animFrom {
+ animation: animFrom 0.1s forwards;
+ }
+ .animTo {
+ animation: animTo 0.1s forwards;
+ }
+</style>
+
+<body>
+ <div class="demo">
+ <div id="a" class="animTo">A</div>
+ <div id="b" class="animFrom" style="font-palette: --custom;">A</div>
+ </div>
+</body>
+
+<script>
+ var afterPaletteAnimationTest1 = async_test(
+ "Verify font-palette is animated when `from` keyframe is not specified"
+ );
+ document.getElementById("a").addEventListener("animationend",
+ afterPaletteAnimationTest1.step_func_done(function() {
+ assert_equals(window.getComputedStyle(
+ document.getElementById("a"))
+ .getPropertyValue('font-palette'), "--custom");
+ }));
+
+ var afterPaletteAnimationTest2 = async_test(
+ "Verify font-palette is animated when `to` keyframe is not specified"
+ );
+ document.getElementById("b").addEventListener("animationend",
+ afterPaletteAnimationTest2.step_func_done(function() {
+ assert_equals(window.getComputedStyle(
+ document.getElementById("b"))
+ .getPropertyValue('font-palette'), "normal");
+ }));
+</script>
diff --git a/Tests/LibWeb/Text/input/wpt-import/css/css-fonts/animations/font-palette-interpolation.html b/Tests/LibWeb/Text/input/wpt-import/css/css-fonts/animations/font-palette-interpolation.html
new file mode 100644
index 00000000000..83fc9837eaa
--- /dev/null
+++ b/Tests/LibWeb/Text/input/wpt-import/css/css-fonts/animations/font-palette-interpolation.html
@@ -0,0 +1,142 @@
+<!DOCTYPE html>
+<meta charset="UTF-8">
+<title>font-palette interpolation</title>
+<link rel="help" href="https://www.w3.org/TR/css-fonts-4/#propdef-font-palette">
+<meta name="assert" content="Font-palette should be animated smoothly.">
+
+<script src="../../../resources/testharness.js"></script>
+<script src="../../../resources/testharnessreport.js"></script>
+<script src="../../../css/support/interpolation-testcommon.js"></script>
+<style>
+@font-palette-values --custom-palette {
+ font-family: "Color font";
+ base-palette: 0;
+ override-colors: 1 #000000;
+}
+
+.container {
+ font-palette: light;
+}
+.container2 {
+ font-palette: dark;
+}
+.target {
+ display: inline-block;
+ font: 100px sans-serif;
+ font-palette: normal;
+}
+.expected {
+ color: green;
+ margin-right: 30px;
+}
+</style>
+
+<body>
+<template id="target-template">
+ <span class="container">
+ <div class="target">TT</div>
+ </span>
+</template>
+
+<span id="inv-container" class="container">
+ <div id="inv-target" class="target">TT</div>
+</span>
+</body>
+
+<script>
+
+test_interpolation({
+ property: 'font-palette',
+ from: 'light',
+ to: 'dark'
+}, [
+ {at: -2, expect: 'light'},
+ {at: -0.25, expect: 'light'},
+ {at: 0, expect: 'light'},
+ {at: 0.3, expect: 'palette-mix(in oklab, light, dark 30%)'},
+ {at: 0.6, expect: 'palette-mix(in oklab, light, dark 60%)'},
+ {at: 1, expect: 'dark'},
+ {at: 1.5, expect: 'dark'},
+]);
+
+test_interpolation({
+ property: 'font-palette',
+ from: 'initial',
+ to: 'inherit'
+}, [
+ {at: -2, expect: 'normal'},
+ {at: -0.25, expect: 'normal'},
+ {at: 0, expect: 'normal'},
+ {at: 0.3, expect: 'palette-mix(in oklab, normal, light 30%)'},
+ {at: 0.6, expect: 'palette-mix(in oklab, normal, light 60%)'},
+ {at: 1, expect: 'light'},
+ {at: 1.5, expect: 'light'},
+]);
+
+test_interpolation({
+ property: 'font-palette',
+ from: '--custom-palette',
+ to: 'normal'
+}, [
+ {at: -2, expect: '--custom-palette'},
+ {at: -0.25, expect: '--custom-palette'},
+ {at: 0, expect: '--custom-palette'},
+ {at: 0.3, expect: 'palette-mix(in oklab, --custom-palette, normal 30%)'},
+ {at: 0.6, expect: 'palette-mix(in oklab, --custom-palette, normal 60%)'},
+ {at: 1, expect: 'normal'},
+ {at: 1.5, expect: 'normal'},
+]);
+
+/* palette-mix function for the equal endpoints should be simplified. */
+test_interpolation({
+ property: 'font-palette',
+ from: 'initial',
+ to: 'normal'
+}, [
+ {at: -2, expect: 'normal'},
+ {at: -0.25, expect: 'normal'},
+ {at: 0, expect: 'normal'},
+ {at: 0.3, expect: 'normal'},
+ {at: 0.6, expect: 'normal'},
+ {at: 1, expect: 'normal'},
+ {at: 1.5, expect: 'normal'},
+]);
+
+test(t => {
+ var container = document.getElementById('inv-container');
+ var target = document.getElementById('inv-target');
+ var anim = target.animate({ fontPalette: ['normal', 'inherit'] }, 1000);
+ anim.pause();
+ anim.currentTime = 500;
+ assert_equals(getComputedStyle(target).fontPalette, 'palette-mix(in oklab, normal, light)');
+
+ container.setAttribute('class', 'container2');
+ assert_equals(getComputedStyle(target).fontPalette, 'palette-mix(in oklab, normal, dark)');
+}, "An interpolation to inherit updates correctly on a parent style change.");
+
+test(t => {
+ var target = document.getElementById('inv-target');
+ target.animate(
+ { fontPalette: ['light', 'normal'] },
+ {
+ duration: 1000
+ }
+ );
+ target.animate(
+ { fontPalette: ['normal', 'dark'] },
+ {
+ duration: 1000,
+ /* Should work like 'replace', since <Color> type is not additive,
+ compare: https://drafts.csswg.org/css-values-4/#combine-colors. */
+ composite: "add"
+ }
+ );
+ document.getAnimations().forEach((animation) => {
+ animation.pause();
+ animation.currentTime = 500;
+ });
+ assert_equals(getComputedStyle(target).fontPalette,
+ "palette-mix(in oklab, normal, dark)");
+}, "Test additive animations");
+
+</script>
\ No newline at end of file
diff --git a/Tests/LibWeb/Text/input/wpt-import/css/css-fonts/animations/multiple-elements-font-palette-animation.html b/Tests/LibWeb/Text/input/wpt-import/css/css-fonts/animations/multiple-elements-font-palette-animation.html
new file mode 100644
index 00000000000..d943947054a
--- /dev/null
+++ b/Tests/LibWeb/Text/input/wpt-import/css/css-fonts/animations/multiple-elements-font-palette-animation.html
@@ -0,0 +1,61 @@
+<!DOCTYPE html>
+<meta charset="UTF-8">
+<title>Font-palette animation of multiple elements</title>
+<link rel="help" href="https://www.w3.org/TR/css-fonts-4/#propdef-font-palette">
+<meta name="assert" content="Animating font-palette CSS property of multiple elements.">
+
+<script src="../../../resources/testharness.js"></script>
+<script src="../../../resources/testharnessreport.js"></script>
+<style>
+ @font-face {
+ font-family: "COLR-test-font";
+ src: url("../resources/COLR-palettes-test-font.ttf") format("truetype");
+ }
+ @font-palette-values --custom {
+ font-family: "COLR-test-font";
+ base-palette: 3;
+ }
+ @keyframes anim {
+ from {
+ font-palette: normal;
+ }
+ to {
+ font-palette: --custom;
+ }
+ }
+ .demo {
+ font-family: "COLR-test-font";
+ font-size: 130px;
+ }
+ .anim {
+ animation: anim 0.1s forwards;
+ }
+</style>
+
+<body>
+ <div class="demo">
+ <div id="a" class="anim">A</div><div id="b" class="anim">A</div>
+ </div>
+</body>
+
+<script>
+ var afterPaletteAnimationTest1 = async_test(
+ "Verify font-palette value of the first element after animation"
+ );
+ document.getElementById("a").addEventListener("animationend",
+ afterPaletteAnimationTest1.step_func_done(function() {
+ assert_equals(window.getComputedStyle(
+ document.getElementById("a"))
+ .getPropertyValue('font-palette'), "--custom");
+ }));
+
+ var afterPaletteAnimationTest2 = async_test(
+ "Verify font-palette value of the second element after animation"
+ );
+ document.getElementById("b").addEventListener("animationend",
+ afterPaletteAnimationTest2.step_func_done(function() {
+ assert_equals(window.getComputedStyle(
+ document.getElementById("b"))
+ .getPropertyValue('font-palette'), "--custom");
+ }));
+</script>
\ No newline at end of file
diff --git a/Tests/LibWeb/Text/input/wpt-import/css/css-fonts/font-palette-vs-shorthand.html b/Tests/LibWeb/Text/input/wpt-import/css/css-fonts/font-palette-vs-shorthand.html
new file mode 100644
index 00000000000..0a6b0c7738a
--- /dev/null
+++ b/Tests/LibWeb/Text/input/wpt-import/css/css-fonts/font-palette-vs-shorthand.html
@@ -0,0 +1,90 @@
+<!DOCTYPE html>
+<html>
+<head>
+<meta charset="utf-8">
+<title>CSS Fonts Module Level 4: interaction of font-palette and font shorthand</title>
+<link rel="help" href="https://drafts.csswg.org/css-fonts/#font-prop">
+<meta name="assert" content="font-palette is NOT reset to normal by font shorthand.">
+<script src="../../resources/testharness.js"></script>
+<script src="../../resources/testharnessreport.js"></script>
+<style id="style">
+@font-face {
+ font-family: colr;
+ src: url("resources/COLR-palettes-test-font.ttf") format("truetype");
+}
+div {
+ margin: 10px;
+}
+#a {
+ font: 50px colr;
+ font-palette: dark; /* should NOT cause the shorthand to be empty */
+}
+#b {
+ font-palette: dark;
+ font: 50px colr; /* should NOT reset font-palette to normal */
+}
+#c {
+ font-palette: dark;
+ font-size: 50px;
+ font-family: colr;
+}
+#d {
+ font-palette: dark;
+ font-size: 50px;
+ font-family: colr;
+ font-palette: normal;
+}
+</style>
+</head>
+<body>
+<p>The first three examples should use the 'dark' palette; the fourth, 'normal'.</p>
+<div id=a>A</div>
+<div id=b>A</div>
+<div id=c>A</div>
+<div id=d>A</div>
+<script>
+test(function() {
+ let testElem = document.getElementById("a");
+ let computed = window.getComputedStyle(testElem);
+ assert_equals(computed.fontPalette, "dark");
+ assert_not_equals(computed.font, "");
+ /* The exact form of the font shorthand varies, but should include these pieces: */
+ assert_not_equals(computed.font.indexOf("50px"), -1);
+ assert_not_equals(computed.font.indexOf("colr"), -1);
+ assert_equals(computed.fontFamily, "colr");
+ assert_equals(computed.fontSize, "50px");
+});
+
+test(function() {
+ let testElem = document.getElementById("b");
+ let computed = window.getComputedStyle(testElem);
+ assert_equals(computed.fontPalette, "dark");
+ assert_not_equals(computed.font, "");
+ assert_not_equals(computed.font.indexOf("50px"), -1);
+ assert_not_equals(computed.font.indexOf("colr"), -1);
+ assert_equals(computed.fontFamily, "colr");
+ assert_equals(computed.fontSize, "50px");
+});
+
+test(function() {
+ let testElem = document.getElementById("c");
+ let computed = window.getComputedStyle(testElem);
+ assert_equals(computed.fontPalette, "dark");
+ assert_not_equals(computed.font.indexOf("50px"), -1);
+ assert_not_equals(computed.font.indexOf("colr"), -1);
+ assert_equals(computed.fontFamily, "colr");
+ assert_equals(computed.fontSize, "50px");
+});
+
+test(function() {
+ let testElem = document.getElementById("d");
+ let computed = window.getComputedStyle(testElem);
+ assert_equals(computed.fontPalette, "normal");
+ assert_not_equals(computed.font.indexOf("50px"), -1);
+ assert_not_equals(computed.font.indexOf("colr"), -1);
+ assert_equals(computed.fontFamily, "colr");
+ assert_equals(computed.fontSize, "50px");
+});
+</script>
+</body>
+</html>
diff --git a/Tests/LibWeb/Text/input/wpt-import/css/css-fonts/resources/COLR-palettes-test-font.ttf b/Tests/LibWeb/Text/input/wpt-import/css/css-fonts/resources/COLR-palettes-test-font.ttf
new file mode 100644
index 00000000000..0f28caf21e6
Binary files /dev/null and b/Tests/LibWeb/Text/input/wpt-import/css/css-fonts/resources/COLR-palettes-test-font.ttf differ