<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML//EN">
<html>
<title>Test 'to' animation of SVGPreserveAspectRatio.</title>
<head>
<script src="../../resources/testharness.js"></script>
<script src="../../resources/testharnessreport.js"></script>
<script src="resources/SVGAnimationTestCase-testharness.js"></script>
</head>
<body onload="">
<svg id="root" preserveAspectRatio="xMaxYMin meet">
<animate id="animation" attributeName="preserveAspectRatio" dur="4s" from="xMinYMin meet" to="xMaxYMid slice">
</svg>
<script>
var rootSVGElement;
// Setup animation test
rootSVGElement = document.querySelector("#root");
function sample1() {
assert_equals(rootSVGElement.preserveAspectRatio.animVal.align, SVGPreserveAspectRatio.SVG_PRESERVEASPECTRATIO_XMINYMIN, "1.1");
assert_equals(rootSVGElement.preserveAspectRatio.animVal.meetOrSlice, SVGPreserveAspectRatio.SVG_MEETORSLICE_MEET, "1.2");
assert_equals(rootSVGElement.preserveAspectRatio.baseVal.align, SVGPreserveAspectRatio.SVG_PRESERVEASPECTRATIO_XMAXYMIN, "1.3");
assert_equals(rootSVGElement.preserveAspectRatio.baseVal.meetOrSlice, SVGPreserveAspectRatio.SVG_MEETORSLICE_MEET, "1.4");
}
function sample2() {
assert_equals(rootSVGElement.preserveAspectRatio.animVal.align, SVGPreserveAspectRatio.SVG_PRESERVEASPECTRATIO_XMINYMIN, "2.1");
assert_equals(rootSVGElement.preserveAspectRatio.animVal.meetOrSlice, SVGPreserveAspectRatio.SVG_MEETORSLICE_MEET, "2.2");
assert_equals(rootSVGElement.preserveAspectRatio.baseVal.align, SVGPreserveAspectRatio.SVG_PRESERVEASPECTRATIO_XMAXYMIN, "2.3");
assert_equals(rootSVGElement.preserveAspectRatio.baseVal.meetOrSlice, SVGPreserveAspectRatio.SVG_MEETORSLICE_MEET, "2.4");
}
function sample3() {
assert_equals(rootSVGElement.preserveAspectRatio.animVal.align, SVGPreserveAspectRatio.SVG_PRESERVEASPECTRATIO_XMAXYMID, "3.1");
assert_equals(rootSVGElement.preserveAspectRatio.animVal.meetOrSlice, SVGPreserveAspectRatio.SVG_MEETORSLICE_SLICE, "3.2");
assert_equals(rootSVGElement.preserveAspectRatio.baseVal.align, SVGPreserveAspectRatio.SVG_PRESERVEASPECTRATIO_XMAXYMIN, "3.3");
assert_equals(rootSVGElement.preserveAspectRatio.baseVal.meetOrSlice, SVGPreserveAspectRatio.SVG_MEETORSLICE_MEET, "3.4");
}
function sample4() {
assert_equals(rootSVGElement.preserveAspectRatio.animVal.align, SVGPreserveAspectRatio.SVG_PRESERVEASPECTRATIO_XMAXYMIN, "4.1");
assert_equals(rootSVGElement.preserveAspectRatio.animVal.meetOrSlice, SVGPreserveAspectRatio.SVG_MEETORSLICE_MEET, "4.2");
assert_equals(rootSVGElement.preserveAspectRatio.baseVal.align, SVGPreserveAspectRatio.SVG_PRESERVEASPECTRATIO_XMAXYMIN, "4.3");
assert_equals(rootSVGElement.preserveAspectRatio.baseVal.meetOrSlice, SVGPreserveAspectRatio.SVG_MEETORSLICE_MEET, "4.3");
}
smil_async_test(t => {
const expectedValues = [
// [animationId, time, sampleCallback]
["animation", 0.1, sample1],
["animation", 1.5, sample2],
["animation", 3.999, sample3],
["animation", 4.001, sample4],
];
runAnimationTest(t, expectedValues);
});
</script>
</body>
</html>