Commit 555e52aa authored by Stephen McGruer's avatar Stephen McGruer Committed by Commit Bot

Port a few color-related interpolation tests to WPT

Bug: 900581
Change-Id: I3a9a292495b86ddf32ebfd67a1531d5995e5879a
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1769314Reviewed-by: default avatarXida Chen <xidachen@chromium.org>
Commit-Queue: Stephen McGruer <smcgruer@chromium.org>
Cr-Commit-Position: refs/heads/master@{#690331}
parent 04740cc9
......@@ -17,83 +17,8 @@
<template id="target-template">T</template>
<script src="resources/interpolation-test.js"></script>
<script>
assertInterpolation({
property: 'caret-color',
from: neutralKeyframe,
to: 'green',
}, [
{at: -0.3, is: 'rgb(255, 255, 0)'},
{at: 0, is: 'rgb(255, 255, 0)'},
{at: 0.3, is: 'rgb(179, 217, 0)'},
{at: 0.6, is: 'rgb(102, 179, 0)'},
{at: 1, is: 'rgb(0, 128, 0)'},
{at: 1.5, is: 'rgb(0, 65, 0)'},
]);
assertNoInterpolation({
property: 'caret-color',
from: 'initial',
to: 'green',
});
assertNoInterpolation({
property: 'caret-color',
from: 'auto',
to: 'green',
});
assertInterpolation({
property: 'caret-color',
from: 'currentColor',
to: 'green',
}, [
{at: -0.3, is: 'rgb(0, 0, 0)'},
{at: 0, is: 'rgb(0, 0, 0)'},
{at: 0.3, is: 'rgb(0, 38, 0)'},
{at: 0.6, is: 'rgb(0, 77, 0)'},
{at: 1, is: 'rgb(0, 128, 0)'},
{at: 1.5, is: 'rgb(0, 192, 0)'},
]);
assertInterpolation({
property: 'caret-color',
from: 'inherit',
to: 'green',
}, [
{at: -0.3, is: 'rgb(0, 0, 255)'},
{at: 0, is: 'rgb(0, 0, 255)'},
{at: 0.3, is: 'rgb(0, 38, 179)'},
{at: 0.6, is: 'rgb(0, 77, 102)'},
{at: 1, is: 'rgb(0, 128, 0)'},
{at: 1.5, is: 'rgb(0, 192, 0)'},
]);
assertInterpolation({
property: 'caret-color',
from: 'unset',
to: 'green',
}, [
{at: -0.3, is: 'rgb(0, 0, 255)'},
{at: 0, is: 'rgb(0, 0, 255)'},
{at: 0.3, is: 'rgb(0, 38, 179)'},
{at: 0.6, is: 'rgb(0, 77, 102)'},
{at: 1, is: 'rgb(0, 128, 0)'},
{at: 1.5, is: 'rgb(0, 192, 0)'},
]);
assertInterpolation({
property: 'caret-color',
from: 'black',
to: 'orange',
}, [
{at: -0.3, is: 'rgb(0, 0, 0)'},
{at: 0, is: 'rgb(0, 0, 0)'},
{at: 0.3, is: 'rgb(77, 50, 0)'},
{at: 0.6, is: 'rgb(153, 99, 0)'},
{at: 1, is: 'rgb(255, 165, 0)'},
{at: 1.5, is: 'rgb(255, 248, 0)'},
]);
// New tests should be added to external/wpt/css/css-ui/animation/caret-color-interpolation.html,
// but these legacy tests are kept here as they rely on prefixed values.
assertInterpolation({
property: 'caret-color',
from: '-webkit-activelink',
......
......@@ -17,71 +17,8 @@
<template id="target-template">T</template>
<script src="resources/interpolation-test.js"></script>
<script>
assertInterpolation({
property: 'color',
from: neutralKeyframe,
to: 'green',
}, [
{at: -0.3, is: 'rgb(255, 255, 0)'},
{at: 0, is: 'rgb(255, 255, 0)'},
{at: 0.3, is: 'rgb(179, 217, 0)'},
{at: 0.6, is: 'rgb(102, 179, 0)'},
{at: 1, is: 'rgb(0, 128, 0)'},
{at: 1.5, is: 'rgb(0, 65, 0)'},
]);
assertInterpolation({
property: 'color',
from: 'initial',
to: 'green',
}, [
{at: -0.3, is: 'rgb(0, 0, 0)'},
{at: 0, is: 'rgb(0, 0, 0)'},
{at: 0.3, is: 'rgb(0, 38, 0)'},
{at: 0.6, is: 'rgb(0, 77, 0)'},
{at: 1, is: 'rgb(0, 128, 0)'},
{at: 1.5, is: 'rgb(0, 192, 0)'},
]);
assertInterpolation({
property: 'color',
from: 'inherit',
to: 'green',
}, [
{at: -0.3, is: 'rgb(0, 0, 255)'},
{at: 0, is: 'rgb(0, 0, 255)'},
{at: 0.3, is: 'rgb(0, 38, 179)'},
{at: 0.6, is: 'rgb(0, 77, 102)'},
{at: 1, is: 'rgb(0, 128, 0)'},
{at: 1.5, is: 'rgb(0, 192, 0)'},
]);
assertInterpolation({
property: 'color',
from: 'unset',
to: 'green',
}, [
{at: -0.3, is: 'rgb(0, 0, 255)'},
{at: 0, is: 'rgb(0, 0, 255)'},
{at: 0.3, is: 'rgb(0, 38, 179)'},
{at: 0.6, is: 'rgb(0, 77, 102)'},
{at: 1, is: 'rgb(0, 128, 0)'},
{at: 1.5, is: 'rgb(0, 192, 0)'},
]);
assertInterpolation({
property: 'color',
from: 'black',
to: 'orange',
}, [
{at: -0.3, is: 'rgb(0, 0, 0)'},
{at: 0, is: 'rgb(0, 0, 0)'},
{at: 0.3, is: 'rgb(77, 50, 0)'},
{at: 0.6, is: 'rgb(153, 99, 0)'},
{at: 1, is: 'rgb(255, 165, 0)'},
{at: 1.5, is: 'rgb(255, 248, 0)'},
]);
// New tests should be added to external/wpt/css/css-color/animation/color-interpolation.html,
// but these legacy tests are kept here as they rely on prefixed values.
assertInterpolation({
property: 'color',
from: '-webkit-activelink',
......
<!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)'},
]);
</script>
<!DOCTYPE html>
<meta charset="UTF-8">
<title>caret-color interpolation</title>
<link rel="help" href="https://drafts.csswg.org/css-ui-3/#propdef-caret-color">
<meta name="assert" content="caret-color 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 {
caret-color: blue;
}
.target {
display: inline-block;
font-size: 60pt;
caret-color: yellow;
}
.expected {
margin-right: 15px;
}
</style>
<body contenteditable>
<template id="target-template">T</template>
</body>
<script>
test_interpolation({
property: 'caret-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_no_interpolation({
property: 'caret-color',
from: 'initial',
to: 'green',
});
test_no_interpolation({
property: 'caret-color',
from: 'auto',
to: 'green',
});
test_interpolation({
property: 'caret-color',
from: 'currentColor',
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: 'caret-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: 'caret-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: 'caret-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)'},
]);
</script>
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment