summaryrefslogtreecommitdiffstats
path: root/testing/web-platform/tests/css/css-fonts/animations/font-size-adjust-interpolation.html
diff options
context:
space:
mode:
Diffstat (limited to 'testing/web-platform/tests/css/css-fonts/animations/font-size-adjust-interpolation.html')
-rw-r--r--testing/web-platform/tests/css/css-fonts/animations/font-size-adjust-interpolation.html169
1 files changed, 169 insertions, 0 deletions
diff --git a/testing/web-platform/tests/css/css-fonts/animations/font-size-adjust-interpolation.html b/testing/web-platform/tests/css/css-fonts/animations/font-size-adjust-interpolation.html
new file mode 100644
index 0000000000..a138d7fee5
--- /dev/null
+++ b/testing/web-platform/tests/css/css-fonts/animations/font-size-adjust-interpolation.html
@@ -0,0 +1,169 @@
+<!DOCTYPE html>
+<meta charset="UTF-8">
+<title>font-size-adjust interpolation</title>
+<link rel="help" href="https://drafts.csswg.org/css-fonts-3/#propdef-font-size-adjust">
+<meta name="assert" content="font-size-adjust supports animation as a number">
+
+<script src="/resources/testharness.js"></script>
+<script src="/resources/testharnessreport.js"></script>
+<script src="/css/support/interpolation-testcommon.js"></script>
+
+<style type="text/css">
+.container {
+ font-size: 20px;
+ line-height: 1;
+}
+
+.parent {
+ font-size-adjust: 3;
+}
+
+.target {
+ display: inline-block;
+ font-size-adjust: 1;
+}
+
+.expected {
+ color: green;
+ margin-right: 30px;
+}
+</style>
+
+<body>
+<template id="target-template">
+ <span class="container">
+ <div class="target">x</span>
+ </div>
+</template>
+</body>
+
+<script>
+test_interpolation({
+ property: 'font-size-adjust',
+ from: neutralKeyframe,
+ to: '2',
+}, [
+ {at: -2, expect: '0'},
+ {at: -0.3, expect: '0.7'},
+ {at: 0, expect: '1'},
+ {at: 0.3, expect: '1.3'},
+ {at: 0.6, expect: '1.6'},
+ {at: 1, expect: '2'},
+ {at: 1.5, expect: '2.5'},
+]);
+
+test_no_interpolation({
+ property: 'font-size-adjust',
+ from: 'initial',
+ to: '2',
+});
+
+test_no_interpolation({
+ property: 'font-size-adjust',
+ from: 'initial',
+ to: 'cap-height 2',
+});
+
+test_interpolation({
+ property: 'font-size-adjust',
+ from: 'inherit',
+ to: '2',
+}, [
+ {at: -2, expect: '5'},
+ {at: -0.3, expect: '3.3'},
+ {at: 0, expect: '3'},
+ {at: 0.3, expect: '2.7'},
+ {at: 0.6, expect: '2.4'},
+ {at: 1, expect: '2'},
+ {at: 1.5, expect: '1.5'},
+]);
+
+test_interpolation({
+ property: 'font-size-adjust',
+ from: 'unset',
+ to: '2',
+}, [
+ {at: -2, expect: '5'},
+ {at: -0.3, expect: '3.3'},
+ {at: 0, expect: '3'},
+ {at: 0.3, expect: '2.7'},
+ {at: 0.6, expect: '2.4'},
+ {at: 1, expect: '2'},
+ {at: 1.5, expect: '1.5'},
+]);
+
+
+test_interpolation({
+ property: 'font-size-adjust',
+ from: '0',
+ to: '1.2'
+}, [
+ {at: -2, expect: '0'},
+ {at: -0.3, expect: '0'},
+ {at: 0, expect: '0'},
+ {at: 0.3, expect: '0.36'},
+ {at: 0.6, expect: '0.72'},
+ {at: 1, expect: '1.2'},
+ {at: 1.5, expect: '1.8'},
+]);
+
+test_interpolation({
+ property: 'font-size-adjust',
+ from: 'cap-height 0',
+ to: 'cap-height 1.2'
+}, [
+ {at: -2, expect: 'cap-height 0'},
+ {at: -0.3, expect: 'cap-height 0'},
+ {at: 0, expect: 'cap-height 0'},
+ {at: 0.3, expect: 'cap-height 0.36'},
+ {at: 0.6, expect: 'cap-height 0.72'},
+ {at: 1, expect: 'cap-height 1.2'},
+ {at: 1.5, expect: 'cap-height 1.8'},
+]);
+
+test_no_interpolation({
+ property: 'font-size-adjust',
+ from: 'none',
+ to: '1.2'
+});
+
+test_no_interpolation({
+ property: 'font-size-adjust',
+ from: 'none',
+ to: 'cap-height 1.2'
+});
+
+test_interpolation({
+ property: 'font-size-adjust',
+ from: '0.2',
+ to: '1.2'
+}, [
+ {at: -2, expect: '0'}, // CSS font-size-adjust can't be negative.
+ {at: -0.3, expect: '0'},
+ {at: 0, expect: '0.2'},
+ {at: 0.3, expect: '0.5'},
+ {at: 0.6, expect: '0.8'},
+ {at: 1, expect: '1.2'},
+ {at: 1.5, expect: '1.7'},
+]);
+
+test_interpolation({
+ property: 'font-size-adjust',
+ from: 'ch-width 0.2',
+ to: 'ch-width 1.2'
+}, [
+ {at: -2, expect: 'ch-width 0'}, // CSS font-size-adjust can't be negative.
+ {at: -0.3, expect: 'ch-width 0'},
+ {at: 0, expect: 'ch-width 0.2'},
+ {at: 0.3, expect: 'ch-width 0.5'},
+ {at: 0.6, expect: 'ch-width 0.8'},
+ {at: 1, expect: 'ch-width 1.2'},
+ {at: 1.5, expect: 'ch-width 1.7'},
+]);
+
+test_no_interpolation({ // can't interpolate between different adjustment basis
+ property: 'font-size-adjust',
+ from: 'ex-height 0.2',
+ to: 'cap-height 1.2'
+});
+</script>