haikuwebkit/LayoutTests/animations/fill-mode-missing-from-to-k...

195 lines
5.4 KiB
HTML
Raw Permalink Normal View History

<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd">
<html lang="en">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<title>Test missing keyframes with fill modes</title>
<style type="text/css" media="screen">
.box {
position: relative;
left: 100px;
top: 10px;
height: 30px;
width: 200px;
-webkit-animation-delay: 0.1s;
-webkit-animation-duration: 0.1s;
-webkit-animation-timing-function: linear;
}
@-webkit-keyframes anim1 {
from { left: 200px; }
50% { left: 250px; }
to { left: 300px; }
}
@-webkit-keyframes anim2 {
50% { left: 250px; }
to { left: 300px; }
}
@-webkit-keyframes anim3 {
from { left: 200px; }
50% { left: 250px; }
}
@-webkit-keyframes anim4 {
50% { left: 250px; }
}
#a {
background-color: blue;
-webkit-animation-fill-mode: none;
-webkit-animation-name: anim1;
}
#b {
background-color: red;
-webkit-animation-fill-mode: backwards;
-webkit-animation-name: anim1;
}
#c {
background-color: green;
-webkit-animation-fill-mode: forwards;
-webkit-animation-name: anim1;
}
#d {
background-color: yellow;
-webkit-animation-fill-mode: both;
-webkit-animation-name: anim1;
}
#e {
background-color: #999;
-webkit-animation-fill-mode: both;
-webkit-animation-iteration-count: 2;
-webkit-animation-direction: alternate;
-webkit-animation-name: anim1;
}
#f {
background-color: blue;
-webkit-animation-fill-mode: none;
-webkit-animation-name: anim2;
}
#g {
background-color: red;
-webkit-animation-fill-mode: backwards;
-webkit-animation-name: anim2;
}
#h {
background-color: green;
-webkit-animation-fill-mode: forwards;
-webkit-animation-name: anim2;
}
#i {
background-color: yellow;
-webkit-animation-fill-mode: both;
-webkit-animation-name: anim2;
}
#j {
background-color: #999;
-webkit-animation-fill-mode: both;
-webkit-animation-iteration-count: 2;
-webkit-animation-direction: alternate;
-webkit-animation-name: anim2;
}
</style>
<script type="text/javascript" charset="utf-8">
const numAnims = 10;
var animsFinished = 0;
const allowance = 5;
const expectedValues = [
{id: "a", start: 100, end: 100},
{id: "b", start: 200, end: 100},
{id: "c", start: 100, end: 300},
{id: "d", start: 200, end: 300},
{id: "e", start: 200, end: 200}
];
var result = "";
Use testRunner instead of layoutTestController in animations tests https://bugs.webkit.org/show_bug.cgi?id=88757 Reviewed by Tony Chang. * animations/3d/change-transform-in-end-event.html: * animations/3d/replace-filling-transform.html: * animations/3d/state-at-end-event-transform.html: * animations/3d/transform-origin-vs-functions.html: * animations/animation-add-events-in-handler.html: * animations/animation-border-overflow.html: * animations/animation-controller-drt-api.html: * animations/animation-direction-reverse-fill-mode-hardware.html: * animations/animation-direction-reverse-fill-mode.html: * animations/animation-drt-api-multiple-keyframes.html: * animations/animation-drt-api.html: * animations/animation-end-event-destroy-renderer.html: * animations/animation-end-event-short-iterations.html: * animations/animation-hit-test-transform.html: * animations/animation-hit-test.html: * animations/animation-iteration-event-destroy-renderer.html: * animations/animation-matrix-negative-scale-unmatrix.html: * animations/animation-on-inline-crash.html: * animations/animation-shorthand-overriding.html: * animations/animation-shorthand-removed.html: * animations/animation-shorthand.html: * animations/animation-start-event-destroy-renderer.html: * animations/animation-welcome-safari.html: * animations/body-removal-crash.html: * animations/change-keyframes-name.html: * animations/change-transform-style-during-animation.html: * animations/combo-transform-translate+scale.html: * animations/empty-keyframes.html: * animations/fill-mode-forwards.html: * animations/fill-mode-iteration-count-non-integer.html: * animations/fill-mode-missing-from-to-keyframes.html: * animations/fill-mode-multiple-keyframes.html: * animations/fill-mode-removed.html: * animations/fill-mode-reverse.html: * animations/fill-mode-transform.html: * animations/fill-mode.html: * animations/fill-unset-properties.html: * animations/font-size-using-ems.html-disabled: * animations/import-crash.html: * animations/keyframe-timing-functions-transform.html: * animations/keyframe-timing-functions2.html: * animations/keyframes-iteration-count-non-integer.html: * animations/longhand-timing-function.html: * animations/missing-from-to-transforms.html: * animations/missing-from-to.html: * animations/pause-crash.html: * animations/resources/animation-test-helpers.js: (checkExpectedValue): (endTest): * animations/state-at-end-event.html: * animations/suspend-resume-animation-events.html: * animations/suspend-transform-animation.html: * animations/transition-and-animation-3.html: * animations/unanimated-style.html: Canonical link: https://commits.webkit.org/106621@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@119985 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2012-06-11 17:22:07 +00:00
if (window.testRunner) {
testRunner.dumpAsText();
testRunner.waitUntilDone();
}
function animationEnded(event) {
if (++animsFinished == numAnims) {
setTimeout(endTest, 0); // this set timeout should be ok in the test environment
// since we're just giving style a chance to resolve
}
};
function endTest() {
for (var i=0; i < expectedValues.length; i++) {
var el = document.getElementById(expectedValues[i].id);
var expectedValue = expectedValues[i].end;
var realValue = window.getComputedStyle(el).getPropertyCSSValue("left").getFloatValue(CSSPrimitiveValue.CSS_NUMBER);
if (Math.abs(expectedValue - realValue) < allowance) {
result += "PASS";
} else {
result += "FAIL";
}
result += " - end of animation - id: " + expectedValues[i].id + " expected: " + expectedValue + " actual: " + realValue + "<br>";
}
document.getElementById('result').innerHTML = result;
Use testRunner instead of layoutTestController in animations tests https://bugs.webkit.org/show_bug.cgi?id=88757 Reviewed by Tony Chang. * animations/3d/change-transform-in-end-event.html: * animations/3d/replace-filling-transform.html: * animations/3d/state-at-end-event-transform.html: * animations/3d/transform-origin-vs-functions.html: * animations/animation-add-events-in-handler.html: * animations/animation-border-overflow.html: * animations/animation-controller-drt-api.html: * animations/animation-direction-reverse-fill-mode-hardware.html: * animations/animation-direction-reverse-fill-mode.html: * animations/animation-drt-api-multiple-keyframes.html: * animations/animation-drt-api.html: * animations/animation-end-event-destroy-renderer.html: * animations/animation-end-event-short-iterations.html: * animations/animation-hit-test-transform.html: * animations/animation-hit-test.html: * animations/animation-iteration-event-destroy-renderer.html: * animations/animation-matrix-negative-scale-unmatrix.html: * animations/animation-on-inline-crash.html: * animations/animation-shorthand-overriding.html: * animations/animation-shorthand-removed.html: * animations/animation-shorthand.html: * animations/animation-start-event-destroy-renderer.html: * animations/animation-welcome-safari.html: * animations/body-removal-crash.html: * animations/change-keyframes-name.html: * animations/change-transform-style-during-animation.html: * animations/combo-transform-translate+scale.html: * animations/empty-keyframes.html: * animations/fill-mode-forwards.html: * animations/fill-mode-iteration-count-non-integer.html: * animations/fill-mode-missing-from-to-keyframes.html: * animations/fill-mode-multiple-keyframes.html: * animations/fill-mode-removed.html: * animations/fill-mode-reverse.html: * animations/fill-mode-transform.html: * animations/fill-mode.html: * animations/fill-unset-properties.html: * animations/font-size-using-ems.html-disabled: * animations/import-crash.html: * animations/keyframe-timing-functions-transform.html: * animations/keyframe-timing-functions2.html: * animations/keyframes-iteration-count-non-integer.html: * animations/longhand-timing-function.html: * animations/missing-from-to-transforms.html: * animations/missing-from-to.html: * animations/pause-crash.html: * animations/resources/animation-test-helpers.js: (checkExpectedValue): (endTest): * animations/state-at-end-event.html: * animations/suspend-resume-animation-events.html: * animations/suspend-transform-animation.html: * animations/transition-and-animation-3.html: * animations/unanimated-style.html: Canonical link: https://commits.webkit.org/106621@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@119985 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2012-06-11 17:22:07 +00:00
if (window.testRunner)
testRunner.notifyDone();
}
window.onload = function () {
for (var i=0; i < expectedValues.length; i++) {
var el = document.getElementById(expectedValues[i].id);
var expectedValue = expectedValues[i].start;
var realValue = window.getComputedStyle(el).getPropertyCSSValue("left").getFloatValue(CSSPrimitiveValue.CSS_NUMBER);
if (Math.abs(expectedValue - realValue) < allowance) {
result += "PASS";
} else {
result += "FAIL";
}
result += " - start of animation - id: " + expectedValues[i].id + " expected: " + expectedValue + " actual: " + realValue + "<br>";
}
document.addEventListener("webkitAnimationEnd", animationEnded, false);
};
</script>
</head>
<body>
This test performs an animation of the left property with four different
fill modes. It animates over 0.1 second with a 0.1 second delay.
It takes snapshots at document load and the end of the animation.
<div id="a" class="box">
None - from/to present
</div>
<div id="b" class="box">
Backwards - from/to present
</div>
<div id="c" class="box">
Forwards - from/to present
</div>
<div id="d" class="box">
Both - from/to present
</div>
<div id="e" class="box">
Both iterating - from/to present
</div>
<div id="f" class="box">
None - from missing
</div>
<div id="g" class="box">
Backwards - from missing
</div>
<div id="h" class="box">
Forwards - from missing
</div>
<div id="i" class="box">
Both - from missing
</div>
<div id="j" class="box">
Both iterating - from missing
</div>
<div id="result">
</div>
</body>
</html>