gecko-dev/testing/web-platform/tests/css/css-backgrounds/animations/background-image-interpolation.html
haozhe 2ce5cfdd94 Bug 1600143 [wpt PR 20514] - Remove cross fade from backgrounds, a=testonly
Automatic update from web-platform-tests
Remove cross fade from backgrounds

background-image-interpolation should not use cross fade. Bug filed: https://bugs.chromium.org/p/chromium/issues/detail?id=1029358
background-image-interpolation when interpolate from single image to multiple images at progress -0.3 will give from, from instead just from.
Bug filed: https://bugs.chromium.org/p/chromium/issues/detail?id=1029529

Bug: 900581
Change-Id: I481725439b8ef3944693b4c65dbc4112eca42265
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1942492
Reviewed-by: Xida Chen <xidachen@chromium.org>
Commit-Queue: Hao Sheng <haozhes@chromium.org>
Cr-Commit-Position: refs/heads/master@{#720267}

--

wpt-commits: c2efb44a06853e1acaf0f2cbc298399bdee28a32
wpt-pr: 20514
2019-12-04 12:12:59 +00:00

230 lines
5.3 KiB
HTML

<!DOCTYPE html>
<meta charset="UTF-8">
<link rel="help" href="https://drafts.csswg.org/css-backgrounds-3/#background-image">
<meta name="test" content="background-image supports animation">
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<script src="/css/support/interpolation-testcommon.js"></script>
<style>
.parent {
background-image: url(../resources/blue-100.png);
background-size: 0 0;
}
.target {
width: 100px;
height: 100px;
display: inline-block;
border: 10px solid black;
background-repeat: no-repeat;
background-image: url(../resources/blue-100.png);
}
.expected {
border-color: green;
margin-right: 2px;
}
</style>
<body>
<script>
// Neutral to image
var from = 'url(../resources/blue-100.png)';
var to = 'url(../resources/green-100.png)';
test_interpolation({
property: 'background-image',
from: neutralKeyframe,
to: to,
}, [
{at: -0.3, expect: from},
{at: 0, expect: from},
{at: 0.3, expect: from},
{at: 0.6, expect: to},
{at: 1, expect: to},
{at: 1.5, expect: to},
]);
// initial to image
to = 'url(../resources/green-100.png)';
test_interpolation({
property: 'background-image',
from: 'initial',
to: to,
}, [
{at: -0.3, expect: 'none'},
{at: 0, expect: 'none'},
{at: 0.3, expect: 'none'},
{at: 0.6, expect: to},
{at: 1, expect: to},
{at: 1.5, expect: to},
]);
// inherit to image
from = 'url(../resources/blue-100.png)';
to = 'url(../resources/green-100.png)';
test_interpolation({
property: 'background-image',
from: 'inherit',
to: to,
}, [
{at: -0.3, expect: from},
{at: 0, expect: from},
{at: 0.3, expect: from},
{at: 0.6, expect: to},
{at: 1, expect: to},
{at: 1.5, expect: to},
]);
// unset to image
test_interpolation({
property: 'background-image',
from: 'unset',
to: to,
}, [
{at: -0.3, expect: 'none'},
{at: 0, expect: 'none'},
{at: 0.3, expect: 'none'},
{at: 0.6, expect: to},
{at: 1, expect: to},
{at: 1.5, expect: to},
]);
// Image to image
from = 'url(../resources/blue-100.png)';
to = 'url(../resources/green-100.png)';
test_interpolation({
property: 'background-image',
from: from,
to: to,
}, [
{at: -0.3, expect: from},
{at: 0, expect: from},
{at: 0.3, expect: from},
{at: 0.6, expect: to},
{at: 1, expect: to},
{at: 1.5, expect: to},
]);
// Image to gradient
from = 'url(../resources/blue-100.png)';
to = 'linear-gradient(45deg, blue, orange)';
test_interpolation({
property: 'background-image',
from: from,
to: to,
}, [
{at: -0.3, expect: from},
{at: 0, expect: from},
{at: 0.3, expect: from},
{at: 0.6, expect: to},
{at: 1, expect: to},
{at: 1.5, expect: to},
]);
// Image to crossfade
from = 'url(../resources/blue-100.png)';
to = 'cross-fade(url(../resources/green-100.png), url(../resources/stripes-100.png), 0.5)';
test_interpolation({
property: 'background-image',
from: from,
to: to,
}, [
{at: -0.3, expect: from},
{at: 0, expect: from},
{at: 0.3, expect: from},
{at: 0.6, expect: to},
{at: 1, expect: to},
{at: 1.5, expect: to},
]);
// Gradient to gradient
from = 'linear-gradient(-45deg, red, yellow)';
to = 'linear-gradient(45deg, blue, orange)';
test_interpolation({
property: 'background-image',
from: from,
to: to,
}, [
{at: -0.3, expect: from},
{at: 0, expect: from},
{at: 0.3, expect: from},
{at: 0.6, expect: to},
{at: 1, expect: to},
{at: 1.5, expect: to},
]);
// Keyword to image
from = 'none';
to = 'url(../resources/green-100.png)';
test_interpolation({
property: 'background-image',
from: from,
to: to,
}, [
{at: -0.3, expect: from},
{at: 0, expect: from},
{at: 0.3, expect: from},
{at: 0.6, expect: to},
{at: 1, expect: to},
{at: 1.5, expect: to},
]);
// Multiple to multiple
var fromA = 'url(../resources/stripes-100.png)';
var fromB = 'url(../resources/blue-100.png)';
var toA = 'url(../resources/blue-100.png)';
var toB = 'url(../resources/stripes-100.png)';
from = fromA + ', ' + fromB;
to = toA + ', ' + toB;
test_interpolation({
property: 'background-image',
from: from,
to: to,
}, [
{at: -0.3, expect: from},
{at: 0, expect: from},
{at: 0.3, expect: from},
{at: 0.6, expect: to},
{at: 1, expect: to},
{at: 1.5, expect: to},
]);
// Single to multiple
from = 'url(../resources/blue-100.png)';
var toA = 'url(../resources/stripes-100.png)';
var toB = 'url(../resources/green-100.png)';
to = toA + ', ' + toB;
test_interpolation({
property: 'background-image',
from: from,
to: to,
}, [
// The interpolation of different numbers of background-images looks a bit strange here.
// Animating background-image is not specified to be possible however we do it for backwards compatibility.
// With this in mind we kept the implementation simple at the expense of this corner case because there is
// no official specification to support.
{at: -0.3, expect: from},
{at: 0, expect: from},
{at: 0.3, expect: from},
{at: 0.6, expect: to},
{at: 1, expect: to},
{at: 1.5, expect: to},
]);
// Multiple mismatched types
from = 'url(../resources/blue-100.png), none';
to = 'url(../resources/stripes-100.png), url(../resources/green-100.png)';
test_interpolation({
property: 'background-image',
from: from,
to: to,
}, [
{at: -0.3, expect: from},
{at: 0, expect: from},
{at: 0.3, expect: from},
{at: 0.6, expect: to},
{at: 1, expect: to},
{at: 1.5, expect: to},
]);
</script>
</body>