DXR is a code search and navigation tool aimed at making sense of large projects. It supports full-text and regex searches as well as structural queries.

Mercurial (c68fe15a81fc)

VCS Links

Line Code
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136
<!doctype html>
<html>
<meta charset="utf-8">
<title>This tests additive='sum' support on animate elements with multiple begin times</title>
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<script src="/resources/SVGAnimationTestCase-testharness.js"></script>

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1 Tiny//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11-tiny.dtd">
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 1000 1000">
<rect width="100" height="100" fill="green">
    <animate id="an1" attributeName="y" attributeType="XML" begin="0s" dur="12s" from="100" to="900" fill="freeze" />
    <animate attributeName="x" attributeType="XML" calcMode="discrete" begin="0s; 2s" from="0" to="400" dur="8s" additive="sum" />
</rect>
</svg>

<script>
var rootSVGElement = document.querySelector("svg");
var epsilon = 1.0;

// Setup animation test
function checkBaseValues() {
return;
    assert_equals(rect.x.baseVal.value, 0);
    assert_equals(rect.y.baseVal.value, 0);
}

function sample1() {
    assert_equals(rect.x.animVal.value, 0);
    assert_approx_equals(rect.y.animVal.value, 100, epsilon);
    checkBaseValues();
}

function sample2() {
    assert_equals(rect.x.animVal.value, 0);
    assert_approx_equals(rect.y.animVal.value, 166.67, epsilon);
    checkBaseValues();
}

function sample3() {
    assert_equals(rect.x.animVal.value, 0);
    assert_approx_equals(rect.y.animVal.value, 366.60, epsilon);
    checkBaseValues();
}

function sample4() {
    assert_equals(rect.x.animVal.value, 0);
    assert_approx_equals(rect.y.animVal.value, 366.73, epsilon);
    checkBaseValues();
}

function sample5() {
    assert_equals(rect.x.animVal.value, 0);
    assert_approx_equals(rect.y.animVal.value, 499.93, epsilon);
    checkBaseValues();
}

function sample6() {
    assert_equals(rect.x.animVal.value, 400);
    assert_approx_equals(rect.y.animVal.value, 500.06, epsilon);
    checkBaseValues();
}

function sample7() {
    assert_equals(rect.x.animVal.value, 400);
    assert_approx_equals(rect.y.animVal.value, 566.67, epsilon);
    checkBaseValues();
}

function sample8() {
    assert_equals(rect.x.animVal.value, 400);
    assert_approx_equals(rect.y.animVal.value, 633.33, epsilon);
    checkBaseValues();
}

function sample9() {
    assert_equals(rect.x.animVal.value, 400);
    assert_approx_equals(rect.y.animVal.value, 700, epsilon);
    checkBaseValues();
}

function sample10() {
    assert_equals(rect.x.animVal.value, 400);
    assert_approx_equals(rect.y.animVal.value, 766.60, epsilon);
    checkBaseValues();
}

function sample11() {
    assert_equals(rect.x.animVal.value, 0);
    assert_approx_equals(rect.y.animVal.value, 766.67, epsilon);
    checkBaseValues();
}

function sample12() {
    assert_equals(rect.x.animVal.value, 0);
    assert_approx_equals(rect.y.animVal.value, 833.33, epsilon);
    checkBaseValues();
}

function sample13() {
    assert_equals(rect.x.animVal.value, 0);
    assert_approx_equals(rect.y.animVal.value, 900, epsilon);
    checkBaseValues();
}

smil_async_test((t) => {
    rect = rootSVGElement.ownerDocument.getElementsByTagName("rect")[0];

    // All animations in the test file use the same duration, so it's not needed to list all sample points individually for an5/an6/an7/an8.
    const expectedValues = [
        // [animationId, time, sampleCallback]
        ["an1", 0.0,    sample1],
        ["an1", 1.0,    sample2],
        ["an1", 3.999,  sample3],
        ["an1", 4.001,  sample4],
        ["an1", 5.999,  sample5],
        ["an1", 6.001,  sample6],
        ["an1", 7.0,    sample7],
        ["an1", 7.999,  sample8],
        ["an1", 8.001,  sample8],
        ["an1", 9.0,    sample9],
        ["an1", 9.999,  sample10],
        ["an1", 10.001, sample11],
        ["an1", 11.0,   sample12],
        ["an1", 11.999, sample13],
        ["an1", 12.001, sample13],
        ["an1", 60.0,   sample13]
    ];

    runAnimationTest(t, expectedValues);
});

window.animationStartsImmediately = true;

</script>