michael@0: /* -*- Mode: Java; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ michael@0: /* vim: set ts=2 sw=2 sts=2 et: */ michael@0: /* This Source Code Form is subject to the terms of the Mozilla Public michael@0: * License, v. 2.0. If a copy of the MPL was not distributed with this michael@0: * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ michael@0: michael@0: /* testcase data for */ michael@0: michael@0: // Fake motion 'attribute', to satisfy testing code that expects an attribute. michael@0: var gMotionAttr = new AdditiveAttribute(SMILUtil.getMotionFakeAttributeName(), michael@0: "XML", "rect"); michael@0: michael@0: // CTM-summary-definitions, for re-use by multiple testcase bundles below. michael@0: var _reusedCTMLists = { michael@0: pacedBasic: { ctm0: [100, 200, 0], michael@0: ctm1_6: [105, 205, 0], michael@0: ctm1_3: [110, 210, 0], michael@0: ctm2_3: [120, 220, 0], michael@0: ctm1: [130, 210, 0] michael@0: }, michael@0: pacedR60: { ctm0: [100, 200, Math.PI/3], michael@0: ctm1_6: [105, 205, Math.PI/3], michael@0: ctm1_3: [110, 210, Math.PI/3], michael@0: ctm2_3: [120, 220, Math.PI/3], michael@0: ctm1: [130, 210, Math.PI/3] michael@0: }, michael@0: pacedRAuto: { ctm0: [100, 200, Math.PI/4], michael@0: ctm1_6: [105, 205, Math.PI/4], michael@0: ctm1_3: [110, 210, Math.PI/4], michael@0: ctm2_3: [120, 220, -Math.PI/4], michael@0: ctm1: [130, 210, -Math.PI/4] michael@0: }, michael@0: pacedRAutoReverse : { ctm0: [100, 200, 5*Math.PI/4], michael@0: ctm1_6: [105, 205, 5*Math.PI/4], michael@0: ctm1_3: [110, 210, 5*Math.PI/4], michael@0: ctm2_3: [120, 220, 3*Math.PI/4], michael@0: ctm1: [130, 210, 3*Math.PI/4] michael@0: }, michael@0: michael@0: discreteBasic : { ctm0: [100, 200, 0], michael@0: ctm1_6: [100, 200, 0], michael@0: ctm1_3: [120, 220, 0], michael@0: ctm2_3: [130, 210, 0], michael@0: ctm1: [130, 210, 0] michael@0: }, michael@0: discreteRAuto : { ctm0: [100, 200, Math.PI/4], michael@0: ctm1_6: [100, 200, Math.PI/4], michael@0: ctm1_3: [120, 220, -Math.PI/4], michael@0: ctm2_3: [130, 210, -Math.PI/4], michael@0: ctm1: [130, 210, -Math.PI/4] michael@0: }, michael@0: justMoveBasic : { ctm0: [40, 80, 0], michael@0: ctm1_6: [40, 80, 0], michael@0: ctm1_3: [40, 80, 0], michael@0: ctm2_3: [40, 80, 0], michael@0: ctm1: [40, 80, 0] michael@0: }, michael@0: justMoveR60 : { ctm0: [40, 80, Math.PI/3], michael@0: ctm1_6: [40, 80, Math.PI/3], michael@0: ctm1_3: [40, 80, Math.PI/3], michael@0: ctm2_3: [40, 80, Math.PI/3], michael@0: ctm1: [40, 80, Math.PI/3] michael@0: }, michael@0: justMoveRAuto : { ctm0: [40, 80, Math.atan(2)], michael@0: ctm1_6: [40, 80, Math.atan(2)], michael@0: ctm1_3: [40, 80, Math.atan(2)], michael@0: ctm2_3: [40, 80, Math.atan(2)], michael@0: ctm1: [40, 80, Math.atan(2)] michael@0: }, michael@0: justMoveRAutoReverse : { ctm0: [40, 80, Math.PI + Math.atan(2)], michael@0: ctm1_6: [40, 80, Math.PI + Math.atan(2)], michael@0: ctm1_3: [40, 80, Math.PI + Math.atan(2)], michael@0: ctm2_3: [40, 80, Math.PI + Math.atan(2)], michael@0: ctm1: [40, 80, Math.PI + Math.atan(2)] michael@0: }, michael@0: nullMoveBasic : { ctm0: [0, 0, 0], michael@0: ctm1_6: [0, 0, 0], michael@0: ctm1_3: [0, 0, 0], michael@0: ctm2_3: [0, 0, 0], michael@0: ctm1: [0, 0, 0] michael@0: }, michael@0: nullMoveRAutoReverse : { ctm0: [0, 0, Math.PI], michael@0: ctm1_6: [0, 0, Math.PI], michael@0: ctm1_3: [0, 0, Math.PI], michael@0: ctm2_3: [0, 0, Math.PI], michael@0: ctm1: [0, 0, Math.PI] michael@0: }, michael@0: }; michael@0: michael@0: var gMotionBundles = michael@0: [ michael@0: // Bundle to test basic functionality (using default calcMode='paced') michael@0: new TestcaseBundle(gMotionAttr, [ michael@0: // Basic paced-mode (default) test, with values/mpath/path michael@0: new AnimMotionTestcase({ "values": "100, 200; 120, 220; 130, 210" }, michael@0: _reusedCTMLists.pacedBasic), michael@0: new AnimMotionTestcase({ "path": "M100 200 L120 220 L130 210" }, michael@0: _reusedCTMLists.pacedBasic), michael@0: new AnimMotionTestcase({ "mpath": "M100 200 L120 220 L130 210" }, michael@0: _reusedCTMLists.pacedBasic), michael@0: michael@0: // ..and now with rotate=constant value in degrees michael@0: new AnimMotionTestcase({ "values": "100,200; 120,220; 130, 210", michael@0: "rotate": "60" }, michael@0: _reusedCTMLists.pacedR60), michael@0: new AnimMotionTestcase({ "path": "M100 200 L120 220 L130 210", michael@0: "rotate": "60" }, michael@0: _reusedCTMLists.pacedR60), michael@0: new AnimMotionTestcase({ "mpath": "M100 200 L120 220 L130 210", michael@0: "rotate": "60" }, michael@0: _reusedCTMLists.pacedR60), michael@0: michael@0: // ..and now with rotate=constant value in radians michael@0: new AnimMotionTestcase({ "path": "M100 200 L120 220 L130 210", michael@0: "rotate": "1.0471975512rad" }, // pi/3 michael@0: _reusedCTMLists.pacedR60), michael@0: michael@0: // ..and now with rotate=auto michael@0: new AnimMotionTestcase({ "values": "100,200; 120,220; 130, 210", michael@0: "rotate": "auto" }, michael@0: _reusedCTMLists.pacedRAuto), michael@0: new AnimMotionTestcase({ "path": "M100 200 L120 220 L130 210", michael@0: "rotate": "auto" }, michael@0: _reusedCTMLists.pacedRAuto), michael@0: new AnimMotionTestcase({ "mpath": "M100 200 L120 220 L130 210", michael@0: "rotate": "auto" }, michael@0: _reusedCTMLists.pacedRAuto), michael@0: michael@0: // ..and now with rotate=auto-reverse michael@0: new AnimMotionTestcase({ "values": "100,200; 120,220; 130, 210", michael@0: "rotate": "auto-reverse" }, michael@0: _reusedCTMLists.pacedRAutoReverse), michael@0: new AnimMotionTestcase({ "path": "M100 200 L120 220 L130 210", michael@0: "rotate": "auto-reverse" }, michael@0: _reusedCTMLists.pacedRAutoReverse), michael@0: new AnimMotionTestcase({ "mpath": "M100 200 L120 220 L130 210", michael@0: "rotate": "auto-reverse" }, michael@0: _reusedCTMLists.pacedRAutoReverse), michael@0: michael@0: ]), michael@0: michael@0: // Bundle to test calcMode='discrete' michael@0: new TestcaseBundle(gMotionAttr, [ michael@0: new AnimMotionTestcase({ "values": "100, 200; 120, 220; 130, 210", michael@0: "calcMode": "discrete" }, michael@0: _reusedCTMLists.discreteBasic), michael@0: new AnimMotionTestcase({ "path": "M100 200 L120 220 L130 210", michael@0: "calcMode": "discrete" }, michael@0: _reusedCTMLists.discreteBasic), michael@0: new AnimMotionTestcase({ "mpath": "M100 200 L120 220 L130 210", michael@0: "calcMode": "discrete" }, michael@0: _reusedCTMLists.discreteBasic), michael@0: // ..and now with rotate=auto michael@0: new AnimMotionTestcase({ "values": "100, 200; 120, 220; 130, 210", michael@0: "calcMode": "discrete", michael@0: "rotate": "auto" }, michael@0: _reusedCTMLists.discreteRAuto), michael@0: new AnimMotionTestcase({ "path": "M100 200 L120 220 L130 210", michael@0: "calcMode": "discrete", michael@0: "rotate": "auto" }, michael@0: _reusedCTMLists.discreteRAuto), michael@0: new AnimMotionTestcase({ "mpath": "M100 200 L120 220 L130 210", michael@0: "calcMode": "discrete", michael@0: "rotate": "auto" }, michael@0: _reusedCTMLists.discreteRAuto), michael@0: ]), michael@0: michael@0: // Bundle to test relative units ('em') michael@0: new TestcaseBundle(gMotionAttr, [ michael@0: // First with unitless values from->by... michael@0: new AnimMotionTestcase({ "from": "10, 10", michael@0: "by": "30, 60" }, michael@0: { ctm0: [10, 10, 0], michael@0: ctm1_6: [15, 20, 0], michael@0: ctm1_3: [20, 30, 0], michael@0: ctm2_3: [30, 50, 0], michael@0: ctm1: [40, 70, 0] michael@0: }), michael@0: // ... then add 'em' units (with 1em=10px) on half the values michael@0: new AnimMotionTestcase({ "from": "1em, 10", michael@0: "by": "30, 6em" }, michael@0: { ctm0: [10, 10, 0], michael@0: ctm1_6: [15, 20, 0], michael@0: ctm1_3: [20, 30, 0], michael@0: ctm2_3: [30, 50, 0], michael@0: ctm1: [40, 70, 0] michael@0: }), michael@0: ]), michael@0: michael@0: // Bundle to test a path with just a "move" command and nothing else michael@0: new TestcaseBundle(gMotionAttr, [ michael@0: new AnimMotionTestcase({ "values": "40, 80" }, michael@0: _reusedCTMLists.justMoveBasic), michael@0: new AnimMotionTestcase({ "path": "M40 80" }, michael@0: _reusedCTMLists.justMoveBasic), michael@0: new AnimMotionTestcase({ "mpath": "m40 80" }, michael@0: _reusedCTMLists.justMoveBasic), michael@0: ]), michael@0: // ... and now with a fixed rotate-angle michael@0: new TestcaseBundle(gMotionAttr, [ michael@0: new AnimMotionTestcase({ "values": "40, 80", michael@0: "rotate": "60" }, michael@0: _reusedCTMLists.justMoveR60), michael@0: new AnimMotionTestcase({ "path": "M40 80", michael@0: "rotate": "60" }, michael@0: _reusedCTMLists.justMoveR60), michael@0: new AnimMotionTestcase({ "mpath": "m40 80", michael@0: "rotate": "60" }, michael@0: _reusedCTMLists.justMoveR60), michael@0: ]), michael@0: // ... and now with 'auto' (should use the move itself as michael@0: // our tangent angle, I think) michael@0: new TestcaseBundle(gMotionAttr, [ michael@0: new AnimMotionTestcase({ "values": "40, 80", michael@0: "rotate": "auto" }, michael@0: _reusedCTMLists.justMoveRAuto), michael@0: new AnimMotionTestcase({ "path": "M40 80", michael@0: "rotate": "auto" }, michael@0: _reusedCTMLists.justMoveRAuto), michael@0: new AnimMotionTestcase({ "mpath": "m40 80", michael@0: "rotate": "auto" }, michael@0: _reusedCTMLists.justMoveRAuto), michael@0: ]), michael@0: // ... and now with 'auto-reverse' michael@0: new TestcaseBundle(gMotionAttr, [ michael@0: new AnimMotionTestcase({ "values": "40, 80", michael@0: "rotate": "auto-reverse" }, michael@0: _reusedCTMLists.justMoveRAutoReverse), michael@0: new AnimMotionTestcase({ "path": "M40 80", michael@0: "rotate": "auto-reverse" }, michael@0: _reusedCTMLists.justMoveRAutoReverse), michael@0: new AnimMotionTestcase({ "mpath": "m40 80", michael@0: "rotate": "auto-reverse" }, michael@0: _reusedCTMLists.justMoveRAutoReverse), michael@0: ]), michael@0: // ... and now with a null move to make sure 'auto'/'auto-reverse' don't michael@0: // blow up michael@0: new TestcaseBundle(gMotionAttr, [ michael@0: new AnimMotionTestcase({ "values": "0, 0", michael@0: "rotate": "auto" }, michael@0: _reusedCTMLists.nullMoveBasic), michael@0: ]), michael@0: new TestcaseBundle(gMotionAttr, [ michael@0: new AnimMotionTestcase({ "values": "0, 0", michael@0: "rotate": "auto-reverse" }, michael@0: _reusedCTMLists.nullMoveRAutoReverse), michael@0: ]), michael@0: ]; michael@0: michael@0: // XXXdholbert Add more tests: michael@0: // - keyPoints/keyTimes michael@0: // - paths with curves michael@0: // - Control path with from/by/to