59 lines
1.9 KiB
HTML
59 lines
1.9 KiB
HTML
<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML//EN">
|
|
<html>
|
|
<head>
|
|
<script src="../../resources/js-test-pre.js"></script>
|
|
<script src="../dynamic-updates/resources/SVGTestCase.js"></script>
|
|
<script src="resources/SVGAnimationTestCase.js"></script>
|
|
</head>
|
|
<body onload="runSMILTest()">
|
|
<h1>SVG 1.1 dynamic animation tests</h1>
|
|
<p id="description"></p>
|
|
<div id="console"></div>
|
|
<script>
|
|
description("This tests scripting a CSS property while animation is running");
|
|
embedSVGTestCase("resources/change-css-property-while-animating-fill-freeze.svg");
|
|
|
|
// Setup animation test
|
|
function sample1() {
|
|
shouldBeCloseEnough("getComputedStyle(rect).getPropertyCSSValue('opacity').getFloatValue(CSSPrimitiveValue.CSS_NUMBER)", "0");
|
|
}
|
|
|
|
function sample2() {
|
|
shouldBeCloseEnough("getComputedStyle(rect).getPropertyCSSValue('opacity').getFloatValue(CSSPrimitiveValue.CSS_NUMBER)", "0.25");
|
|
rect.setAttribute("opacity", "1");
|
|
}
|
|
|
|
function sample3() {
|
|
shouldBeCloseEnough("getComputedStyle(rect).getPropertyCSSValue('opacity').getFloatValue(CSSPrimitiveValue.CSS_NUMBER)", "0.25");
|
|
}
|
|
|
|
function sample4() {
|
|
shouldBeCloseEnough("getComputedStyle(rect).getPropertyCSSValue('opacity').getFloatValue(CSSPrimitiveValue.CSS_NUMBER)", "0.5");
|
|
}
|
|
|
|
function sample5() {
|
|
shouldBeCloseEnough("getComputedStyle(rect).getPropertyCSSValue('opacity').getFloatValue(CSSPrimitiveValue.CSS_NUMBER)", "0.5");
|
|
}
|
|
|
|
function executeTest() {
|
|
rect = rootSVGElement.ownerDocument.getElementsByTagName("rect")[0];
|
|
|
|
const expectedValues = [
|
|
// [animationId, time, sampleCallback]
|
|
["an1", 0.0, sample1],
|
|
["an1", 2.0, sample2],
|
|
["an1", 2.001, sample3],
|
|
["an1", 3.999, sample4],
|
|
["an1", 4.001, sample5],
|
|
["an1", 60.0, sample5]
|
|
];
|
|
|
|
runAnimationTest(expectedValues);
|
|
}
|
|
|
|
window.animationStartsImmediately = true;
|
|
var successfullyParsed = true;
|
|
</script>
|
|
</body>
|
|
</html>
|