chromium/third_party/blink/web_tests/svg/animations/calcMode-use-counters.html

<!DOCTYPE html>
<script src="../../resources/testharness.js"></script>
<script src="../../resources/testharnessreport.js"></script>
<svg width="400" height="400">
    <rect id="target" x="10" y="10" width="80" height="80" />
</svg>
<script>
'use strict';

// From UseCounter.h
var SVGCalcModeDiscrete = 1287;
var SVGCalcModeLinear = 1288;
var SVGCalcModePaced = 1289;
var SVGCalcModeSpline = 1290;

test(() => {
    var target = document.getElementById('target');
    assert_false(internals.isUseCounted(document, SVGCalcModeDiscrete));
    var animation = document.createElementNS("http://www.w3.org/2000/svg", "animate");
    animation.setAttribute("calcMode", "discrete");
    target.appendChild(animation);
    assert_true(internals.isUseCounted(document, SVGCalcModeDiscrete));
}, 'calcMode discrete is use counted.');

test(() => {
    var target = document.getElementById('target');
    var animation = document.createElementNS("http://www.w3.org/2000/svg", "animateTransform");
    animation.setAttribute("calcMode", "linear");
    target.appendChild(animation);
    assert_false(internals.isUseCounted(document, SVGCalcModeLinear));
}, 'calcMode linear is not counted for animateTransform.');

test(() => {
    var target = document.getElementById('target');
    assert_false(internals.isUseCounted(document, SVGCalcModeLinear));
    var animation = document.createElementNS("http://www.w3.org/2000/svg", "animateMotion");
    animation.setAttribute("calcMode", "linear");
    target.appendChild(animation);
    assert_true(internals.isUseCounted(document, SVGCalcModeLinear));
}, 'calcMode linear is use counted for animateMotion.');

test(() => {
    var target = document.getElementById('target');
    var animation = document.createElementNS("http://www.w3.org/2000/svg", "animateMotion");
    animation.setAttribute("calcMode", "paced");
    target.appendChild(animation);
    assert_false(internals.isUseCounted(document, SVGCalcModePaced));
}, 'calcMode paced is not counted for animateMotion.');

test(() => {
    var target = document.getElementById('target');
    assert_false(internals.isUseCounted(document, SVGCalcModePaced));
    var animation = document.createElementNS("http://www.w3.org/2000/svg", "animate");
    animation.setAttribute("calcMode", "paced");
    target.appendChild(animation);
    assert_true(internals.isUseCounted(document, SVGCalcModePaced));
}, 'calcMode paced is use counted for animate.');

test(() => {
    var target = document.getElementById('target');
    assert_false(internals.isUseCounted(document, SVGCalcModeSpline));
    var animation = document.createElementNS("http://www.w3.org/2000/svg", "animateTransform");
    animation.setAttribute("calcMode", "spline");
    target.appendChild(animation);
    assert_true(internals.isUseCounted(document, SVGCalcModeSpline));
}, 'calcMode spline is use counted.');
</script>