Commit a9f9aa4e authored by Xida Chen's avatar Xida Chen Committed by Commit Bot

Port opacity-interpolation.html to wpt

Bug: 900581
Change-Id: I21076e39559d9cc1bf90c567dcab5ac5e7cb6268
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1832295Reviewed-by: default avatarYi Gu <yigu@chromium.org>
Commit-Queue: Xida Chen <xidachen@chromium.org>
Cr-Commit-Position: refs/heads/master@{#701393}
parent cc06ae16
<!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;
......@@ -11,76 +20,77 @@
display: inline-block;
opacity: 0.1;
}
.expected {
background-color: green;
}
</style>
<body>
<script src="resources/interpolation-test.js"></script>
<script>
assertInterpolation({
test_interpolation({
property: 'opacity',
from: neutralKeyframe,
to: '0.2',
}, [
{at: -0.3, is: '0.07'},
{at: 0, is: '0.1'},
{at: 0.3, is: '0.13'},
{at: 0.6, is: '0.16'},
{at: 1, is: '0.2'},
{at: 1.5, is: '0.25'},
{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'},
]);
assertInterpolation({
test_interpolation({
property: 'opacity',
from: 'initial',
to: '0.2',
}, [
{at: -0.3, is: '1'},
{at: 0, is: '1'},
{at: 0.3, is: '0.76'},
{at: 0.6, is: '0.52'},
{at: 1, is: '0.2'},
{at: 1.5, is: '0'},
{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'},
]);
assertInterpolation({
test_interpolation({
property: 'opacity',
from: 'inherit',
to: '0.2',
}, [
{at: -0.3, is: '0.98'},
{at: 0, is: '0.8'},
{at: 0.3, is: '0.62'},
{at: 0.6, is: '0.44'},
{at: 1, is: '0.2'},
{at: 1.5, is: '0'},
{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'},
]);
assertInterpolation({
test_interpolation({
property: 'opacity',
from: 'unset',
to: '0.2',
}, [
{at: -0.3, is: '1'},
{at: 0, is: '1'},
{at: 0.3, is: '0.76'},
{at: 0.6, is: '0.52'},
{at: 1, is: '0.2'},
{at: 1.5, is: '0'},
{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'},
]);
assertInterpolation({
test_interpolation({
property: 'opacity',
from: '0',
to: '1'
}, [
{at: -0.3, is: '0'}, // CSS opacity is [0-1].
{at: 0, is: '0'},
{at: 0.3, is: '0.3'},
{at: 0.6, is: '0.6'},
{at: 1, is: '1'},
{at: 1.5, is: '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>
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