dom/smil/test/db_smilAnimateMotion.js

Sat, 03 Jan 2015 20:18:00 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Sat, 03 Jan 2015 20:18:00 +0100
branch
TOR_BUG_3246
changeset 7
129ffea94266
permissions
-rw-r--r--

Conditionally enable double key logic according to:
private browsing mode or privacy.thirdparty.isolate preference and
implement in GetCookieStringCommon and FindCookie where it counts...
With some reservations of how to convince FindCookie users to test
condition and pass a nullptr when disabling double key logic.

michael@0 1 /* -*- Mode: Java; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
michael@0 2 /* vim: set ts=2 sw=2 sts=2 et: */
michael@0 3 /* This Source Code Form is subject to the terms of the Mozilla Public
michael@0 4 * License, v. 2.0. If a copy of the MPL was not distributed with this
michael@0 5 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
michael@0 6
michael@0 7 /* testcase data for <animateMotion> */
michael@0 8
michael@0 9 // Fake motion 'attribute', to satisfy testing code that expects an attribute.
michael@0 10 var gMotionAttr = new AdditiveAttribute(SMILUtil.getMotionFakeAttributeName(),
michael@0 11 "XML", "rect");
michael@0 12
michael@0 13 // CTM-summary-definitions, for re-use by multiple testcase bundles below.
michael@0 14 var _reusedCTMLists = {
michael@0 15 pacedBasic: { ctm0: [100, 200, 0],
michael@0 16 ctm1_6: [105, 205, 0],
michael@0 17 ctm1_3: [110, 210, 0],
michael@0 18 ctm2_3: [120, 220, 0],
michael@0 19 ctm1: [130, 210, 0]
michael@0 20 },
michael@0 21 pacedR60: { ctm0: [100, 200, Math.PI/3],
michael@0 22 ctm1_6: [105, 205, Math.PI/3],
michael@0 23 ctm1_3: [110, 210, Math.PI/3],
michael@0 24 ctm2_3: [120, 220, Math.PI/3],
michael@0 25 ctm1: [130, 210, Math.PI/3]
michael@0 26 },
michael@0 27 pacedRAuto: { ctm0: [100, 200, Math.PI/4],
michael@0 28 ctm1_6: [105, 205, Math.PI/4],
michael@0 29 ctm1_3: [110, 210, Math.PI/4],
michael@0 30 ctm2_3: [120, 220, -Math.PI/4],
michael@0 31 ctm1: [130, 210, -Math.PI/4]
michael@0 32 },
michael@0 33 pacedRAutoReverse : { ctm0: [100, 200, 5*Math.PI/4],
michael@0 34 ctm1_6: [105, 205, 5*Math.PI/4],
michael@0 35 ctm1_3: [110, 210, 5*Math.PI/4],
michael@0 36 ctm2_3: [120, 220, 3*Math.PI/4],
michael@0 37 ctm1: [130, 210, 3*Math.PI/4]
michael@0 38 },
michael@0 39
michael@0 40 discreteBasic : { ctm0: [100, 200, 0],
michael@0 41 ctm1_6: [100, 200, 0],
michael@0 42 ctm1_3: [120, 220, 0],
michael@0 43 ctm2_3: [130, 210, 0],
michael@0 44 ctm1: [130, 210, 0]
michael@0 45 },
michael@0 46 discreteRAuto : { ctm0: [100, 200, Math.PI/4],
michael@0 47 ctm1_6: [100, 200, Math.PI/4],
michael@0 48 ctm1_3: [120, 220, -Math.PI/4],
michael@0 49 ctm2_3: [130, 210, -Math.PI/4],
michael@0 50 ctm1: [130, 210, -Math.PI/4]
michael@0 51 },
michael@0 52 justMoveBasic : { ctm0: [40, 80, 0],
michael@0 53 ctm1_6: [40, 80, 0],
michael@0 54 ctm1_3: [40, 80, 0],
michael@0 55 ctm2_3: [40, 80, 0],
michael@0 56 ctm1: [40, 80, 0]
michael@0 57 },
michael@0 58 justMoveR60 : { ctm0: [40, 80, Math.PI/3],
michael@0 59 ctm1_6: [40, 80, Math.PI/3],
michael@0 60 ctm1_3: [40, 80, Math.PI/3],
michael@0 61 ctm2_3: [40, 80, Math.PI/3],
michael@0 62 ctm1: [40, 80, Math.PI/3]
michael@0 63 },
michael@0 64 justMoveRAuto : { ctm0: [40, 80, Math.atan(2)],
michael@0 65 ctm1_6: [40, 80, Math.atan(2)],
michael@0 66 ctm1_3: [40, 80, Math.atan(2)],
michael@0 67 ctm2_3: [40, 80, Math.atan(2)],
michael@0 68 ctm1: [40, 80, Math.atan(2)]
michael@0 69 },
michael@0 70 justMoveRAutoReverse : { ctm0: [40, 80, Math.PI + Math.atan(2)],
michael@0 71 ctm1_6: [40, 80, Math.PI + Math.atan(2)],
michael@0 72 ctm1_3: [40, 80, Math.PI + Math.atan(2)],
michael@0 73 ctm2_3: [40, 80, Math.PI + Math.atan(2)],
michael@0 74 ctm1: [40, 80, Math.PI + Math.atan(2)]
michael@0 75 },
michael@0 76 nullMoveBasic : { ctm0: [0, 0, 0],
michael@0 77 ctm1_6: [0, 0, 0],
michael@0 78 ctm1_3: [0, 0, 0],
michael@0 79 ctm2_3: [0, 0, 0],
michael@0 80 ctm1: [0, 0, 0]
michael@0 81 },
michael@0 82 nullMoveRAutoReverse : { ctm0: [0, 0, Math.PI],
michael@0 83 ctm1_6: [0, 0, Math.PI],
michael@0 84 ctm1_3: [0, 0, Math.PI],
michael@0 85 ctm2_3: [0, 0, Math.PI],
michael@0 86 ctm1: [0, 0, Math.PI]
michael@0 87 },
michael@0 88 };
michael@0 89
michael@0 90 var gMotionBundles =
michael@0 91 [
michael@0 92 // Bundle to test basic functionality (using default calcMode='paced')
michael@0 93 new TestcaseBundle(gMotionAttr, [
michael@0 94 // Basic paced-mode (default) test, with values/mpath/path
michael@0 95 new AnimMotionTestcase({ "values": "100, 200; 120, 220; 130, 210" },
michael@0 96 _reusedCTMLists.pacedBasic),
michael@0 97 new AnimMotionTestcase({ "path": "M100 200 L120 220 L130 210" },
michael@0 98 _reusedCTMLists.pacedBasic),
michael@0 99 new AnimMotionTestcase({ "mpath": "M100 200 L120 220 L130 210" },
michael@0 100 _reusedCTMLists.pacedBasic),
michael@0 101
michael@0 102 // ..and now with rotate=constant value in degrees
michael@0 103 new AnimMotionTestcase({ "values": "100,200; 120,220; 130, 210",
michael@0 104 "rotate": "60" },
michael@0 105 _reusedCTMLists.pacedR60),
michael@0 106 new AnimMotionTestcase({ "path": "M100 200 L120 220 L130 210",
michael@0 107 "rotate": "60" },
michael@0 108 _reusedCTMLists.pacedR60),
michael@0 109 new AnimMotionTestcase({ "mpath": "M100 200 L120 220 L130 210",
michael@0 110 "rotate": "60" },
michael@0 111 _reusedCTMLists.pacedR60),
michael@0 112
michael@0 113 // ..and now with rotate=constant value in radians
michael@0 114 new AnimMotionTestcase({ "path": "M100 200 L120 220 L130 210",
michael@0 115 "rotate": "1.0471975512rad" }, // pi/3
michael@0 116 _reusedCTMLists.pacedR60),
michael@0 117
michael@0 118 // ..and now with rotate=auto
michael@0 119 new AnimMotionTestcase({ "values": "100,200; 120,220; 130, 210",
michael@0 120 "rotate": "auto" },
michael@0 121 _reusedCTMLists.pacedRAuto),
michael@0 122 new AnimMotionTestcase({ "path": "M100 200 L120 220 L130 210",
michael@0 123 "rotate": "auto" },
michael@0 124 _reusedCTMLists.pacedRAuto),
michael@0 125 new AnimMotionTestcase({ "mpath": "M100 200 L120 220 L130 210",
michael@0 126 "rotate": "auto" },
michael@0 127 _reusedCTMLists.pacedRAuto),
michael@0 128
michael@0 129 // ..and now with rotate=auto-reverse
michael@0 130 new AnimMotionTestcase({ "values": "100,200; 120,220; 130, 210",
michael@0 131 "rotate": "auto-reverse" },
michael@0 132 _reusedCTMLists.pacedRAutoReverse),
michael@0 133 new AnimMotionTestcase({ "path": "M100 200 L120 220 L130 210",
michael@0 134 "rotate": "auto-reverse" },
michael@0 135 _reusedCTMLists.pacedRAutoReverse),
michael@0 136 new AnimMotionTestcase({ "mpath": "M100 200 L120 220 L130 210",
michael@0 137 "rotate": "auto-reverse" },
michael@0 138 _reusedCTMLists.pacedRAutoReverse),
michael@0 139
michael@0 140 ]),
michael@0 141
michael@0 142 // Bundle to test calcMode='discrete'
michael@0 143 new TestcaseBundle(gMotionAttr, [
michael@0 144 new AnimMotionTestcase({ "values": "100, 200; 120, 220; 130, 210",
michael@0 145 "calcMode": "discrete" },
michael@0 146 _reusedCTMLists.discreteBasic),
michael@0 147 new AnimMotionTestcase({ "path": "M100 200 L120 220 L130 210",
michael@0 148 "calcMode": "discrete" },
michael@0 149 _reusedCTMLists.discreteBasic),
michael@0 150 new AnimMotionTestcase({ "mpath": "M100 200 L120 220 L130 210",
michael@0 151 "calcMode": "discrete" },
michael@0 152 _reusedCTMLists.discreteBasic),
michael@0 153 // ..and now with rotate=auto
michael@0 154 new AnimMotionTestcase({ "values": "100, 200; 120, 220; 130, 210",
michael@0 155 "calcMode": "discrete",
michael@0 156 "rotate": "auto" },
michael@0 157 _reusedCTMLists.discreteRAuto),
michael@0 158 new AnimMotionTestcase({ "path": "M100 200 L120 220 L130 210",
michael@0 159 "calcMode": "discrete",
michael@0 160 "rotate": "auto" },
michael@0 161 _reusedCTMLists.discreteRAuto),
michael@0 162 new AnimMotionTestcase({ "mpath": "M100 200 L120 220 L130 210",
michael@0 163 "calcMode": "discrete",
michael@0 164 "rotate": "auto" },
michael@0 165 _reusedCTMLists.discreteRAuto),
michael@0 166 ]),
michael@0 167
michael@0 168 // Bundle to test relative units ('em')
michael@0 169 new TestcaseBundle(gMotionAttr, [
michael@0 170 // First with unitless values from->by...
michael@0 171 new AnimMotionTestcase({ "from": "10, 10",
michael@0 172 "by": "30, 60" },
michael@0 173 { ctm0: [10, 10, 0],
michael@0 174 ctm1_6: [15, 20, 0],
michael@0 175 ctm1_3: [20, 30, 0],
michael@0 176 ctm2_3: [30, 50, 0],
michael@0 177 ctm1: [40, 70, 0]
michael@0 178 }),
michael@0 179 // ... then add 'em' units (with 1em=10px) on half the values
michael@0 180 new AnimMotionTestcase({ "from": "1em, 10",
michael@0 181 "by": "30, 6em" },
michael@0 182 { ctm0: [10, 10, 0],
michael@0 183 ctm1_6: [15, 20, 0],
michael@0 184 ctm1_3: [20, 30, 0],
michael@0 185 ctm2_3: [30, 50, 0],
michael@0 186 ctm1: [40, 70, 0]
michael@0 187 }),
michael@0 188 ]),
michael@0 189
michael@0 190 // Bundle to test a path with just a "move" command and nothing else
michael@0 191 new TestcaseBundle(gMotionAttr, [
michael@0 192 new AnimMotionTestcase({ "values": "40, 80" },
michael@0 193 _reusedCTMLists.justMoveBasic),
michael@0 194 new AnimMotionTestcase({ "path": "M40 80" },
michael@0 195 _reusedCTMLists.justMoveBasic),
michael@0 196 new AnimMotionTestcase({ "mpath": "m40 80" },
michael@0 197 _reusedCTMLists.justMoveBasic),
michael@0 198 ]),
michael@0 199 // ... and now with a fixed rotate-angle
michael@0 200 new TestcaseBundle(gMotionAttr, [
michael@0 201 new AnimMotionTestcase({ "values": "40, 80",
michael@0 202 "rotate": "60" },
michael@0 203 _reusedCTMLists.justMoveR60),
michael@0 204 new AnimMotionTestcase({ "path": "M40 80",
michael@0 205 "rotate": "60" },
michael@0 206 _reusedCTMLists.justMoveR60),
michael@0 207 new AnimMotionTestcase({ "mpath": "m40 80",
michael@0 208 "rotate": "60" },
michael@0 209 _reusedCTMLists.justMoveR60),
michael@0 210 ]),
michael@0 211 // ... and now with 'auto' (should use the move itself as
michael@0 212 // our tangent angle, I think)
michael@0 213 new TestcaseBundle(gMotionAttr, [
michael@0 214 new AnimMotionTestcase({ "values": "40, 80",
michael@0 215 "rotate": "auto" },
michael@0 216 _reusedCTMLists.justMoveRAuto),
michael@0 217 new AnimMotionTestcase({ "path": "M40 80",
michael@0 218 "rotate": "auto" },
michael@0 219 _reusedCTMLists.justMoveRAuto),
michael@0 220 new AnimMotionTestcase({ "mpath": "m40 80",
michael@0 221 "rotate": "auto" },
michael@0 222 _reusedCTMLists.justMoveRAuto),
michael@0 223 ]),
michael@0 224 // ... and now with 'auto-reverse'
michael@0 225 new TestcaseBundle(gMotionAttr, [
michael@0 226 new AnimMotionTestcase({ "values": "40, 80",
michael@0 227 "rotate": "auto-reverse" },
michael@0 228 _reusedCTMLists.justMoveRAutoReverse),
michael@0 229 new AnimMotionTestcase({ "path": "M40 80",
michael@0 230 "rotate": "auto-reverse" },
michael@0 231 _reusedCTMLists.justMoveRAutoReverse),
michael@0 232 new AnimMotionTestcase({ "mpath": "m40 80",
michael@0 233 "rotate": "auto-reverse" },
michael@0 234 _reusedCTMLists.justMoveRAutoReverse),
michael@0 235 ]),
michael@0 236 // ... and now with a null move to make sure 'auto'/'auto-reverse' don't
michael@0 237 // blow up
michael@0 238 new TestcaseBundle(gMotionAttr, [
michael@0 239 new AnimMotionTestcase({ "values": "0, 0",
michael@0 240 "rotate": "auto" },
michael@0 241 _reusedCTMLists.nullMoveBasic),
michael@0 242 ]),
michael@0 243 new TestcaseBundle(gMotionAttr, [
michael@0 244 new AnimMotionTestcase({ "values": "0, 0",
michael@0 245 "rotate": "auto-reverse" },
michael@0 246 _reusedCTMLists.nullMoveRAutoReverse),
michael@0 247 ]),
michael@0 248 ];
michael@0 249
michael@0 250 // XXXdholbert Add more tests:
michael@0 251 // - keyPoints/keyTimes
michael@0 252 // - paths with curves
michael@0 253 // - Control path with from/by/to

mercurial