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> <!DOCTYPE html>
<meta charset="UTF-8"> <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> <style>
.parent { .parent {
opacity: 0.8; opacity: 0.8;
} }
.target { .target {
width: 100px; width: 100px;
height: 100px; height: 100px;
...@@ -11,76 +20,77 @@ ...@@ -11,76 +20,77 @@
display: inline-block; display: inline-block;
opacity: 0.1; opacity: 0.1;
} }
.expected { .expected {
background-color: green; background-color: green;
} }
</style> </style>
<body> <body>
<script src="resources/interpolation-test.js"></script>
<script> <script>
assertInterpolation({ test_interpolation({
property: 'opacity', property: 'opacity',
from: neutralKeyframe, from: neutralKeyframe,
to: '0.2', to: '0.2',
}, [ }, [
{at: -0.3, is: '0.07'}, {at: -0.3, expect: '0.07'},
{at: 0, is: '0.1'}, {at: 0, expect: '0.1'},
{at: 0.3, is: '0.13'}, {at: 0.3, expect: '0.13'},
{at: 0.6, is: '0.16'}, {at: 0.6, expect: '0.16'},
{at: 1, is: '0.2'}, {at: 1, expect: '0.2'},
{at: 1.5, is: '0.25'}, {at: 1.5, expect: '0.25'},
]); ]);
assertInterpolation({ test_interpolation({
property: 'opacity', property: 'opacity',
from: 'initial', from: 'initial',
to: '0.2', to: '0.2',
}, [ }, [
{at: -0.3, is: '1'}, {at: -0.3, expect: '1'},
{at: 0, is: '1'}, {at: 0, expect: '1'},
{at: 0.3, is: '0.76'}, {at: 0.3, expect: '0.76'},
{at: 0.6, is: '0.52'}, {at: 0.6, expect: '0.52'},
{at: 1, is: '0.2'}, {at: 1, expect: '0.2'},
{at: 1.5, is: '0'}, {at: 1.5, expect: '0'},
]); ]);
assertInterpolation({ test_interpolation({
property: 'opacity', property: 'opacity',
from: 'inherit', from: 'inherit',
to: '0.2', to: '0.2',
}, [ }, [
{at: -0.3, is: '0.98'}, {at: -0.3, expect: '0.98'},
{at: 0, is: '0.8'}, {at: 0, expect: '0.8'},
{at: 0.3, is: '0.62'}, {at: 0.3, expect: '0.62'},
{at: 0.6, is: '0.44'}, {at: 0.6, expect: '0.44'},
{at: 1, is: '0.2'}, {at: 1, expect: '0.2'},
{at: 1.5, is: '0'}, {at: 1.5, expect: '0'},
]); ]);
assertInterpolation({ test_interpolation({
property: 'opacity', property: 'opacity',
from: 'unset', from: 'unset',
to: '0.2', to: '0.2',
}, [ }, [
{at: -0.3, is: '1'}, {at: -0.3, expect: '1'},
{at: 0, is: '1'}, {at: 0, expect: '1'},
{at: 0.3, is: '0.76'}, {at: 0.3, expect: '0.76'},
{at: 0.6, is: '0.52'}, {at: 0.6, expect: '0.52'},
{at: 1, is: '0.2'}, {at: 1, expect: '0.2'},
{at: 1.5, is: '0'}, {at: 1.5, expect: '0'},
]); ]);
assertInterpolation({ test_interpolation({
property: 'opacity', property: 'opacity',
from: '0', from: '0',
to: '1' to: '1'
}, [ }, [
{at: -0.3, is: '0'}, // CSS opacity is [0-1]. {at: -0.3, expect: '0'}, // CSS opacity is [0-1].
{at: 0, is: '0'}, {at: 0, expect: '0'},
{at: 0.3, is: '0.3'}, {at: 0.3, expect: '0.3'},
{at: 0.6, is: '0.6'}, {at: 0.6, expect: '0.6'},
{at: 1, is: '1'}, {at: 1, expect: '1'},
{at: 1.5, is: '1'} {at: 1.5, expect: '1'}
]); ]);
</script> </script>
</body> </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