Thu, 15 Jan 2015 21:03:48 +0100
Integrate friendly tips from Tor colleagues to make (or not) 4.5 alpha 3;
This includes removal of overloaded (but unused) methods, and addition of
a overlooked call to DataStruct::SetData(nsISupports, uint32_t, bool.)
michael@0 | 1 | /* Any copyright is dedicated to the Public Domain. |
michael@0 | 2 | http://creativecommons.org/publicdomain/zero/1.0/ */ |
michael@0 | 3 | "use strict"; |
michael@0 | 4 | |
michael@0 | 5 | function cloneUpdate(update) { |
michael@0 | 6 | return { |
michael@0 | 7 | rotation: quat4.create(update.rotation), |
michael@0 | 8 | translation: vec3.create(update.translation) |
michael@0 | 9 | }; |
michael@0 | 10 | } |
michael@0 | 11 | |
michael@0 | 12 | function isExpectedUpdate(update1, update2) { |
michael@0 | 13 | if (update1.length !== update2.length) { |
michael@0 | 14 | return false; |
michael@0 | 15 | } |
michael@0 | 16 | for (let i = 0, len = update1.length; i < len; i++) { |
michael@0 | 17 | if (!isApproxVec(update1[i].rotation, update2[i].rotation) || |
michael@0 | 18 | !isApproxVec(update1[i].translation, update2[i].translation)) { |
michael@0 | 19 | info("isExpectedUpdate expected " + JSON.stringify(update1), ", got " + |
michael@0 | 20 | JSON.stringify(update2) + " instead."); |
michael@0 | 21 | return false; |
michael@0 | 22 | } |
michael@0 | 23 | } |
michael@0 | 24 | return true; |
michael@0 | 25 | } |
michael@0 | 26 | |
michael@0 | 27 | function test() { |
michael@0 | 28 | let arcball1 = new TiltVisualizer.Arcball(window, 123, 456); |
michael@0 | 29 | |
michael@0 | 30 | is(arcball1.width, 123, |
michael@0 | 31 | "The first arcball width wasn't set correctly."); |
michael@0 | 32 | is(arcball1.height, 456, |
michael@0 | 33 | "The first arcball height wasn't set correctly."); |
michael@0 | 34 | is(arcball1.radius, 123, |
michael@0 | 35 | "The first arcball radius wasn't implicitly set correctly."); |
michael@0 | 36 | |
michael@0 | 37 | |
michael@0 | 38 | let arcball2 = new TiltVisualizer.Arcball(window, 987, 654); |
michael@0 | 39 | |
michael@0 | 40 | is(arcball2.width, 987, |
michael@0 | 41 | "The second arcball width wasn't set correctly."); |
michael@0 | 42 | is(arcball2.height, 654, |
michael@0 | 43 | "The second arcball height wasn't set correctly."); |
michael@0 | 44 | is(arcball2.radius, 654, |
michael@0 | 45 | "The second arcball radius wasn't implicitly set correctly."); |
michael@0 | 46 | |
michael@0 | 47 | |
michael@0 | 48 | let arcball3 = new TiltVisualizer.Arcball(window, 512, 512); |
michael@0 | 49 | |
michael@0 | 50 | let sphereVec = vec3.create(); |
michael@0 | 51 | arcball3._pointToSphere(123, 456, 256, 512, 512, sphereVec); |
michael@0 | 52 | |
michael@0 | 53 | ok(isApproxVec(sphereVec, [-0.009765625, 0.390625, 0.9204980731010437]), |
michael@0 | 54 | "The _pointToSphere() function didn't map the coordinates correctly."); |
michael@0 | 55 | |
michael@0 | 56 | let stack1 = []; |
michael@0 | 57 | let expect1 = [ |
michael@0 | 58 | { rotation: [ |
michael@0 | 59 | -0.08877250552177429, 0.0242881178855896, |
michael@0 | 60 | -0.04222869873046875, -0.9948599338531494], |
michael@0 | 61 | translation: [0, 0, 0] }, |
michael@0 | 62 | { rotation: [ |
michael@0 | 63 | -0.13086390495300293, 0.03413732722401619, |
michael@0 | 64 | -0.06334304809570312, -0.9887855648994446], |
michael@0 | 65 | translation: [0, 0, 0] }, |
michael@0 | 66 | { rotation: [ |
michael@0 | 67 | -0.15138940513134003, 0.03854173421859741, |
michael@0 | 68 | -0.07390022277832031, -0.9849540591239929], |
michael@0 | 69 | translation: [0, 0, 0] }, |
michael@0 | 70 | { rotation: [ |
michael@0 | 71 | -0.1615273654460907, 0.040619146078825, |
michael@0 | 72 | -0.0791788101196289, -0.9828477501869202], |
michael@0 | 73 | translation: [0, 0, 0] }, |
michael@0 | 74 | { rotation: [ |
michael@0 | 75 | -0.16656573116779327, 0.04162723943591118, |
michael@0 | 76 | -0.0818181037902832, -0.9817478656768799], |
michael@0 | 77 | translation: [0, 0, 0] }, |
michael@0 | 78 | { rotation: [ |
michael@0 | 79 | -0.16907735168933868, 0.042123712599277496, |
michael@0 | 80 | -0.08313775062561035, -0.9811863303184509], |
michael@0 | 81 | translation: [0, 0, 0] }, |
michael@0 | 82 | { rotation: [ |
michael@0 | 83 | -0.17033125460147858, 0.042370058596134186, |
michael@0 | 84 | -0.08379757404327393, -0.9809026718139648], |
michael@0 | 85 | translation: [0, 0, 0] }, |
michael@0 | 86 | { rotation: [ |
michael@0 | 87 | -0.17095772922039032, 0.04249274358153343, |
michael@0 | 88 | -0.08412748575210571, -0.9807600975036621], |
michael@0 | 89 | translation: [0, 0, 0] }, |
michael@0 | 90 | { rotation: [ |
michael@0 | 91 | -0.17127084732055664, 0.04255397245287895, |
michael@0 | 92 | -0.0842924416065216, -0.9806886315345764], |
michael@0 | 93 | translation: [0, 0, 0] }, |
michael@0 | 94 | { rotation: [ |
michael@0 | 95 | -0.171427384018898, 0.042584557086229324, |
michael@0 | 96 | -0.08437491953372955, -0.9806528687477112], |
michael@0 | 97 | translation: [0, 0, 0] }]; |
michael@0 | 98 | |
michael@0 | 99 | arcball3.mouseDown(10, 10, 1); |
michael@0 | 100 | arcball3.mouseMove(10, 100); |
michael@0 | 101 | for (let i1 = 0; i1 < 10; i1++) { |
michael@0 | 102 | stack1.push(cloneUpdate(arcball3.update())); |
michael@0 | 103 | } |
michael@0 | 104 | |
michael@0 | 105 | ok(isExpectedUpdate(stack1, expect1), |
michael@0 | 106 | "Mouse down & move events didn't create the expected transform. results."); |
michael@0 | 107 | |
michael@0 | 108 | let stack2 = []; |
michael@0 | 109 | let expect2 = [ |
michael@0 | 110 | { rotation: [ |
michael@0 | 111 | -0.1684110015630722, 0.04199237748980522, |
michael@0 | 112 | -0.0827873945236206, -0.9813361167907715], |
michael@0 | 113 | translation: [0, 0, 0] }, |
michael@0 | 114 | { rotation: [ |
michael@0 | 115 | -0.16936375200748444, 0.04218007251620293, |
michael@0 | 116 | -0.08328840136528015, -0.9811217188835144], |
michael@0 | 117 | translation: [0, 0, 0] }, |
michael@0 | 118 | { rotation: [ |
michael@0 | 119 | -0.17003019154071808, 0.04231100529432297, |
michael@0 | 120 | -0.08363909274339676, -0.9809709787368774], |
michael@0 | 121 | translation: [0, 0, 0] }, |
michael@0 | 122 | { rotation: [ |
michael@0 | 123 | -0.17049652338027954, 0.042402446269989014, |
michael@0 | 124 | -0.0838845893740654, -0.9808651208877563], |
michael@0 | 125 | translation: [0, 0, 0] }, |
michael@0 | 126 | { rotation: [ |
michael@0 | 127 | -0.17082282900810242, 0.042466338723897934, |
michael@0 | 128 | -0.08405643701553345, -0.9807908535003662], |
michael@0 | 129 | translation: [0, 0, 0] }, |
michael@0 | 130 | { rotation: [ |
michael@0 | 131 | -0.17105120420455933, 0.04251104220747948, |
michael@0 | 132 | -0.08417671173810959, -0.9807388186454773], |
michael@0 | 133 | translation: [0, 0, 0] }, |
michael@0 | 134 | { rotation: [ |
michael@0 | 135 | -0.17121103405952454, 0.04254228621721268, |
michael@0 | 136 | -0.08426092565059662, -0.9807023406028748], |
michael@0 | 137 | translation: [0, 0, 0] }, |
michael@0 | 138 | { rotation: [ |
michael@0 | 139 | -0.17132291197776794, 0.042564138770103455, |
michael@0 | 140 | -0.08431987464427948, -0.9806767106056213], |
michael@0 | 141 | translation: [0, 0, 0] }, |
michael@0 | 142 | { rotation: [ |
michael@0 | 143 | -0.1714012324810028, 0.04257945716381073, |
michael@0 | 144 | -0.08436112850904465, -0.9806588888168335], |
michael@0 | 145 | translation: [0, 0, 0] }, |
michael@0 | 146 | { rotation: [ |
michael@0 | 147 | -0.17145603895187378, 0.042590171098709106, |
michael@0 | 148 | -0.08439001441001892, -0.9806463718414307], |
michael@0 | 149 | translation: [0, 0, 0] }]; |
michael@0 | 150 | |
michael@0 | 151 | arcball3.mouseUp(100, 100); |
michael@0 | 152 | for (let i2 = 0; i2 < 10; i2++) { |
michael@0 | 153 | stack2.push(cloneUpdate(arcball3.update())); |
michael@0 | 154 | } |
michael@0 | 155 | |
michael@0 | 156 | ok(isExpectedUpdate(stack2, expect2), |
michael@0 | 157 | "Mouse up events didn't create the expected transformation results."); |
michael@0 | 158 | |
michael@0 | 159 | let stack3 = []; |
michael@0 | 160 | let expect3 = [ |
michael@0 | 161 | { rotation: [ |
michael@0 | 162 | -0.17149439454078674, 0.04259764403104782, |
michael@0 | 163 | -0.08441022783517838, -0.9806375503540039], |
michael@0 | 164 | translation: [0, 0, -1] }, |
michael@0 | 165 | { rotation: [ |
michael@0 | 166 | -0.17152123153209686, 0.04260288551449776, |
michael@0 | 167 | -0.08442437648773193, -0.980631411075592], |
michael@0 | 168 | translation: [0, 0, -1.899999976158142] }, |
michael@0 | 169 | { rotation: [ |
michael@0 | 170 | -0.1715400665998459, 0.04260658100247383, |
michael@0 | 171 | -0.08443428575992584, -0.9806271195411682], |
michael@0 | 172 | translation: [0, 0, -2.7100000381469727] }, |
michael@0 | 173 | { rotation: [ |
michael@0 | 174 | -0.17155319452285767, 0.04260912910103798, |
michael@0 | 175 | -0.08444121479988098, -0.9806240797042847], |
michael@0 | 176 | translation: [0, 0, -3.439000129699707] }, |
michael@0 | 177 | { rotation: [ |
michael@0 | 178 | -0.17156240344047546, 0.042610932141542435, |
michael@0 | 179 | -0.08444607257843018, -0.9806219935417175], |
michael@0 | 180 | translation: [0, 0, -4.095099925994873] }, |
michael@0 | 181 | { rotation: [ |
michael@0 | 182 | -0.1715688556432724, 0.042612191289663315, |
michael@0 | 183 | -0.08444946259260178, -0.9806205034255981], |
michael@0 | 184 | translation: [0, 0, -4.685589790344238] }, |
michael@0 | 185 | { rotation: [ |
michael@0 | 186 | -0.17157337069511414, 0.04261308163404465, |
michael@0 | 187 | -0.0844518393278122, -0.980619490146637], |
michael@0 | 188 | translation: [0, 0, -5.217031002044678] }, |
michael@0 | 189 | { rotation: [ |
michael@0 | 190 | -0.17157652974128723, 0.0426136814057827, |
michael@0 | 191 | -0.0844535157084465, -0.9806187748908997], |
michael@0 | 192 | translation: [0, 0, -5.6953277587890625] }, |
michael@0 | 193 | { rotation: [ |
michael@0 | 194 | -0.17157875001430511, 0.04261413961648941, |
michael@0 | 195 | -0.08445467799901962, -0.9806182980537415], |
michael@0 | 196 | translation: [0, 0, -6.125794887542725] }, |
michael@0 | 197 | { rotation: [ |
michael@0 | 198 | -0.17158031463623047, 0.04261442646384239, |
michael@0 | 199 | -0.08445550501346588, -0.980617880821228], |
michael@0 | 200 | translation: [0, 0, -6.5132155418396] }]; |
michael@0 | 201 | |
michael@0 | 202 | arcball3.zoom(10); |
michael@0 | 203 | for (let i3 = 0; i3 < 10; i3++) { |
michael@0 | 204 | stack3.push(cloneUpdate(arcball3.update())); |
michael@0 | 205 | } |
michael@0 | 206 | |
michael@0 | 207 | ok(isExpectedUpdate(stack3, expect3), |
michael@0 | 208 | "Mouse zoom events didn't create the expected transformation results."); |
michael@0 | 209 | |
michael@0 | 210 | let stack4 = []; |
michael@0 | 211 | let expect4 = [ |
michael@0 | 212 | { rotation: [ |
michael@0 | 213 | -0.17158135771751404, 0.04261462762951851, |
michael@0 | 214 | -0.08445606380701065, -0.9806176424026489], |
michael@0 | 215 | translation: [0, 0, -6.861894130706787] }, |
michael@0 | 216 | { rotation: [ |
michael@0 | 217 | -0.1715821474790573, 0.04261479899287224, |
michael@0 | 218 | -0.08445646613836288, -0.9806175231933594], |
michael@0 | 219 | translation: [0, 0, -7.1757049560546875] }, |
michael@0 | 220 | { rotation: [ |
michael@0 | 221 | -0.1715826541185379, 0.0426148846745491, |
michael@0 | 222 | -0.08445674180984497, -0.980617344379425], |
michael@0 | 223 | translation: [0, 0, -7.458134651184082] }, |
michael@0 | 224 | { rotation: [ |
michael@0 | 225 | -0.17158304154872894, 0.04261497035622597, |
michael@0 | 226 | -0.08445693552494049, -0.9806172847747803], |
michael@0 | 227 | translation: [0, 0, -7.7123212814331055] }, |
michael@0 | 228 | { rotation: [ |
michael@0 | 229 | -0.17158329486846924, 0.042615000158548355, |
michael@0 | 230 | -0.08445708453655243, -0.9806172251701355], |
michael@0 | 231 | translation: [0, 0, -7.941089153289795] }, |
michael@0 | 232 | { rotation: [ |
michael@0 | 233 | -0.17158347368240356, 0.04261505603790283, |
michael@0 | 234 | -0.084457166492939, -0.9806172251701355], |
michael@0 | 235 | translation: [0, 0, -8.146980285644531] }, |
michael@0 | 236 | { rotation: [ |
michael@0 | 237 | -0.1715836226940155, 0.04261508584022522, |
michael@0 | 238 | -0.08445724099874496, -0.9806171655654907], |
michael@0 | 239 | translation: [0, 0, -8.332282066345215] }, |
michael@0 | 240 | { rotation: [ |
michael@0 | 241 | -0.17158368229866028, 0.04261508584022522, |
michael@0 | 242 | -0.08445728570222855, -0.980617105960846], |
michael@0 | 243 | translation: [0, 0, -8.499053955078125] }, |
michael@0 | 244 | { rotation: [ |
michael@0 | 245 | -0.17158377170562744, 0.04261511191725731, |
michael@0 | 246 | -0.08445732295513153, -0.980617105960846], |
michael@0 | 247 | translation: [0, 0, -8.649148941040039] }, |
michael@0 | 248 | { rotation: [ |
michael@0 | 249 | -0.17158380150794983, 0.04261511191725731, |
michael@0 | 250 | -0.08445733785629272, -0.980617105960846], |
michael@0 | 251 | translation: [0, 0, -8.784234046936035] }]; |
michael@0 | 252 | |
michael@0 | 253 | arcball3.keyDown(arcball3.rotateKeys.left); |
michael@0 | 254 | arcball3.keyDown(arcball3.rotateKeys.right); |
michael@0 | 255 | arcball3.keyDown(arcball3.rotateKeys.up); |
michael@0 | 256 | arcball3.keyDown(arcball3.rotateKeys.down); |
michael@0 | 257 | arcball3.keyDown(arcball3.panKeys.left); |
michael@0 | 258 | arcball3.keyDown(arcball3.panKeys.right); |
michael@0 | 259 | arcball3.keyDown(arcball3.panKeys.up); |
michael@0 | 260 | arcball3.keyDown(arcball3.panKeys.down); |
michael@0 | 261 | for (let i4 = 0; i4 < 10; i4++) { |
michael@0 | 262 | stack4.push(cloneUpdate(arcball3.update())); |
michael@0 | 263 | } |
michael@0 | 264 | |
michael@0 | 265 | ok(isExpectedUpdate(stack4, expect4), |
michael@0 | 266 | "Key down events didn't create the expected transformation results."); |
michael@0 | 267 | |
michael@0 | 268 | let stack5 = []; |
michael@0 | 269 | let expect5 = [ |
michael@0 | 270 | { rotation: [ |
michael@0 | 271 | -0.1715838462114334, 0.04261511191725731, |
michael@0 | 272 | -0.08445736765861511, -0.980617105960846], |
michael@0 | 273 | translation: [0, 0, -8.905810356140137] }, |
michael@0 | 274 | { rotation: [ |
michael@0 | 275 | -0.1715838462114334, 0.04261511191725731, |
michael@0 | 276 | -0.08445736765861511, -0.980617105960846], |
michael@0 | 277 | translation: [0, 0, -9.015229225158691] }, |
michael@0 | 278 | { rotation: [ |
michael@0 | 279 | -0.1715838462114334, 0.04261511191725731, |
michael@0 | 280 | -0.08445736765861511, -0.980617105960846], |
michael@0 | 281 | translation: [0, 0, -9.113706588745117] }, |
michael@0 | 282 | { rotation: [ |
michael@0 | 283 | -0.1715838611125946, 0.04261511191725731, |
michael@0 | 284 | -0.0844573825597763, -0.9806170463562012], |
michael@0 | 285 | translation: [0, 0, -9.202336311340332] }, |
michael@0 | 286 | { rotation: [ |
michael@0 | 287 | -0.17158392071723938, 0.0426151417195797, |
michael@0 | 288 | -0.0844573974609375, -0.980617105960846], |
michael@0 | 289 | translation: [0, 0, -9.282102584838867] }, |
michael@0 | 290 | { rotation: [ |
michael@0 | 291 | -0.17158392071723938, 0.0426151417195797, |
michael@0 | 292 | -0.0844573974609375, -0.980617105960846], |
michael@0 | 293 | translation: [0, 0, -9.35389232635498] }, |
michael@0 | 294 | { rotation: [ |
michael@0 | 295 | -0.17158392071723938, 0.0426151417195797, |
michael@0 | 296 | -0.0844573974609375, -0.980617105960846], |
michael@0 | 297 | translation: [0, 0, -9.418502807617188] }, |
michael@0 | 298 | { rotation: [ |
michael@0 | 299 | -0.17158392071723938, 0.0426151417195797, |
michael@0 | 300 | -0.0844573974609375, -0.980617105960846], |
michael@0 | 301 | translation: [0, 0, -9.476652145385742] }, |
michael@0 | 302 | { rotation: [ |
michael@0 | 303 | -0.17158392071723938, 0.0426151417195797, |
michael@0 | 304 | -0.0844573974609375, -0.980617105960846], |
michael@0 | 305 | translation: [0, 0, -9.528986930847168] }, |
michael@0 | 306 | { rotation: [ |
michael@0 | 307 | -0.17158392071723938, 0.0426151417195797, |
michael@0 | 308 | -0.0844573974609375, -0.980617105960846], |
michael@0 | 309 | translation: [0, 0, -9.576087951660156] }]; |
michael@0 | 310 | |
michael@0 | 311 | arcball3.keyUp(arcball3.rotateKeys.left); |
michael@0 | 312 | arcball3.keyUp(arcball3.rotateKeys.right); |
michael@0 | 313 | arcball3.keyUp(arcball3.rotateKeys.up); |
michael@0 | 314 | arcball3.keyUp(arcball3.rotateKeys.down); |
michael@0 | 315 | arcball3.keyUp(arcball3.panKeys.left); |
michael@0 | 316 | arcball3.keyUp(arcball3.panKeys.right); |
michael@0 | 317 | arcball3.keyUp(arcball3.panKeys.up); |
michael@0 | 318 | arcball3.keyUp(arcball3.panKeys.down); |
michael@0 | 319 | for (let i5 = 0; i5 < 10; i5++) { |
michael@0 | 320 | stack5.push(cloneUpdate(arcball3.update())); |
michael@0 | 321 | } |
michael@0 | 322 | |
michael@0 | 323 | ok(isExpectedUpdate(stack5, expect5), |
michael@0 | 324 | "Key up events didn't create the expected transformation results."); |
michael@0 | 325 | |
michael@0 | 326 | let stack6 = []; |
michael@0 | 327 | let expect6 = [ |
michael@0 | 328 | { rotation: [ |
michael@0 | 329 | -0.17158392071723938, 0.0426151417195797, |
michael@0 | 330 | -0.0844573974609375, -0.980617105960846], |
michael@0 | 331 | translation: [0, 0, -9.618478775024414] }, |
michael@0 | 332 | { rotation: [ |
michael@0 | 333 | -0.17158392071723938, 0.0426151417195797, |
michael@0 | 334 | -0.0844573974609375, -0.980617105960846], |
michael@0 | 335 | translation: [0, 0, -6.156630992889404] }, |
michael@0 | 336 | { rotation: [ |
michael@0 | 337 | -0.17158392071723938, 0.0426151417195797, |
michael@0 | 338 | -0.0844573974609375, -0.980617105960846], |
michael@0 | 339 | translation: [0, 0, 0.4590320587158203] }, |
michael@0 | 340 | { rotation: [ |
michael@0 | 341 | -0.17158392071723938, 0.0426151417195797, |
michael@0 | 342 | -0.0844573974609375, -0.980617105960846], |
michael@0 | 343 | translation: [0, 0, 9.913128852844238] }, |
michael@0 | 344 | { rotation: [ |
michael@0 | 345 | -0.17158392071723938, 0.0426151417195797, |
michael@0 | 346 | -0.0844573974609375, -0.980617105960846], |
michael@0 | 347 | translation: [0, 0, 21.921815872192383] }, |
michael@0 | 348 | { rotation: [ |
michael@0 | 349 | -0.17158392071723938, 0.0426151417195797, |
michael@0 | 350 | -0.0844573974609375, -0.980617105960846], |
michael@0 | 351 | translation: [0, 0, 36.22963333129883] }, |
michael@0 | 352 | { rotation: [ |
michael@0 | 353 | -0.17158392071723938, 0.0426151417195797, |
michael@0 | 354 | -0.0844573974609375, -0.980617105960846], |
michael@0 | 355 | translation: [0, 0, 52.60667037963867] }, |
michael@0 | 356 | { rotation: [ |
michael@0 | 357 | -0.17158392071723938, 0.0426151417195797, |
michael@0 | 358 | -0.0844573974609375, -0.980617105960846], |
michael@0 | 359 | translation: [0, 0, 70.84600067138672] }, |
michael@0 | 360 | { rotation: [ |
michael@0 | 361 | -0.17158392071723938, 0.0426151417195797, |
michael@0 | 362 | -0.0844573974609375, -0.980617105960846], |
michael@0 | 363 | translation: [0, 0, 90.76139831542969] }, |
michael@0 | 364 | { rotation: [ |
michael@0 | 365 | -0.17158392071723938, 0.0426151417195797, |
michael@0 | 366 | -0.0844573974609375, -0.980617105960846], |
michael@0 | 367 | translation: [0, 0, 112.18525695800781] }]; |
michael@0 | 368 | |
michael@0 | 369 | arcball3.keyDown(arcball3.zoomKeys["in"][0]); |
michael@0 | 370 | arcball3.keyDown(arcball3.zoomKeys["in"][1]); |
michael@0 | 371 | arcball3.keyDown(arcball3.zoomKeys["in"][2]); |
michael@0 | 372 | for (let i6 = 0; i6 < 10; i6++) { |
michael@0 | 373 | stack6.push(cloneUpdate(arcball3.update())); |
michael@0 | 374 | } |
michael@0 | 375 | arcball3.keyUp(arcball3.zoomKeys["in"][0]); |
michael@0 | 376 | arcball3.keyUp(arcball3.zoomKeys["in"][1]); |
michael@0 | 377 | arcball3.keyUp(arcball3.zoomKeys["in"][2]); |
michael@0 | 378 | |
michael@0 | 379 | ok(isExpectedUpdate(stack6, expect6), |
michael@0 | 380 | "Key zoom in events didn't create the expected transformation results."); |
michael@0 | 381 | |
michael@0 | 382 | let stack7 = []; |
michael@0 | 383 | let expect7 = [ |
michael@0 | 384 | { rotation: [ |
michael@0 | 385 | -0.17158392071723938, 0.0426151417195797, |
michael@0 | 386 | -0.0844573974609375, -0.980617105960846], |
michael@0 | 387 | translation: [0, 0, 134.96673583984375] }, |
michael@0 | 388 | { rotation: [ |
michael@0 | 389 | -0.17158392071723938, 0.0426151417195797, |
michael@0 | 390 | -0.0844573974609375, -0.980617105960846], |
michael@0 | 391 | translation: [0, 0, 151.97006225585938] }, |
michael@0 | 392 | { rotation: [ |
michael@0 | 393 | -0.17158392071723938, 0.0426151417195797, |
michael@0 | 394 | -0.0844573974609375, -0.980617105960846], |
michael@0 | 395 | translation: [0, 0, 163.77305603027344] }, |
michael@0 | 396 | { rotation: [ |
michael@0 | 397 | -0.17158392071723938, 0.0426151417195797, |
michael@0 | 398 | -0.0844573974609375, -0.980617105960846], |
michael@0 | 399 | translation: [0, 0, 170.895751953125] }, |
michael@0 | 400 | { rotation: [ |
michael@0 | 401 | -0.17158392071723938, 0.0426151417195797, |
michael@0 | 402 | -0.0844573974609375, -0.980617105960846], |
michael@0 | 403 | translation: [0, 0, 173.80618286132812] }, |
michael@0 | 404 | { rotation: [ |
michael@0 | 405 | -0.17158392071723938, 0.0426151417195797, |
michael@0 | 406 | -0.0844573974609375, -0.980617105960846], |
michael@0 | 407 | translation: [0, 0, 172.92556762695312] }, |
michael@0 | 408 | { rotation: [ |
michael@0 | 409 | -0.17158392071723938, 0.0426151417195797, |
michael@0 | 410 | -0.0844573974609375, -0.980617105960846], |
michael@0 | 411 | translation: [0, 0, 168.6330108642578] }, |
michael@0 | 412 | { rotation: [ |
michael@0 | 413 | -0.17158392071723938, 0.0426151417195797, |
michael@0 | 414 | -0.0844573974609375, -0.980617105960846], |
michael@0 | 415 | translation: [0, 0, 161.26971435546875] }, |
michael@0 | 416 | { rotation: [ |
michael@0 | 417 | -0.17158392071723938, 0.0426151417195797, |
michael@0 | 418 | -0.0844573974609375, -0.980617105960846], |
michael@0 | 419 | translation: [0, 0, 151.1427459716797] }, |
michael@0 | 420 | { rotation: [ |
michael@0 | 421 | -0.17158392071723938, 0.0426151417195797, |
michael@0 | 422 | -0.0844573974609375, -0.980617105960846], |
michael@0 | 423 | translation: [0, 0, 138.52847290039062] }]; |
michael@0 | 424 | |
michael@0 | 425 | arcball3.keyDown(arcball3.zoomKeys["out"][0]); |
michael@0 | 426 | arcball3.keyDown(arcball3.zoomKeys["out"][1]); |
michael@0 | 427 | for (let i7 = 0; i7 < 10; i7++) { |
michael@0 | 428 | stack7.push(cloneUpdate(arcball3.update())); |
michael@0 | 429 | } |
michael@0 | 430 | arcball3.keyUp(arcball3.zoomKeys["out"][0]); |
michael@0 | 431 | arcball3.keyUp(arcball3.zoomKeys["out"][1]); |
michael@0 | 432 | |
michael@0 | 433 | ok(isExpectedUpdate(stack7, expect7), |
michael@0 | 434 | "Key zoom out events didn't create the expected transformation results."); |
michael@0 | 435 | |
michael@0 | 436 | let stack8 = []; |
michael@0 | 437 | let expect8 = [ |
michael@0 | 438 | { rotation: [ |
michael@0 | 439 | -0.17158392071723938, 0.0426151417195797, |
michael@0 | 440 | -0.0844573974609375, -0.980617105960846], |
michael@0 | 441 | translation: [0, 0, 123.67562866210938] }, |
michael@0 | 442 | { rotation: [ |
michael@0 | 443 | -0.17158392071723938, 0.0426151417195797, |
michael@0 | 444 | -0.0844573974609375, -0.980617105960846], |
michael@0 | 445 | translation: [0, 0, 111.30806732177734] }, |
michael@0 | 446 | { rotation: [ |
michael@0 | 447 | -0.17158392071723938, 0.0426151417195797, |
michael@0 | 448 | -0.0844573974609375, -0.980617105960846], |
michael@0 | 449 | translation: [0, 0, 100.17726135253906] }, |
michael@0 | 450 | { rotation: [ |
michael@0 | 451 | -0.17158392071723938, 0.0426151417195797, |
michael@0 | 452 | -0.0844573974609375, -0.980617105960846], |
michael@0 | 453 | translation: [0, 0, 90.15953826904297] }, |
michael@0 | 454 | { rotation: [ |
michael@0 | 455 | -0.17158392071723938, 0.0426151417195797, |
michael@0 | 456 | -0.0844573974609375, -0.980617105960846], |
michael@0 | 457 | translation: [0, 0, 81.14358520507812] }, |
michael@0 | 458 | { rotation: [ |
michael@0 | 459 | -0.17158392071723938, 0.0426151417195797, |
michael@0 | 460 | -0.0844573974609375, -0.980617105960846], |
michael@0 | 461 | translation: [0, 0, 73.02922821044922] }, |
michael@0 | 462 | { rotation: [ |
michael@0 | 463 | -0.17158392071723938, 0.0426151417195797, |
michael@0 | 464 | -0.0844573974609375, -0.980617105960846], |
michael@0 | 465 | translation: [0, 0, 65.72630310058594] }, |
michael@0 | 466 | { rotation: [ |
michael@0 | 467 | -0.17158392071723938, 0.0426151417195797, |
michael@0 | 468 | -0.0844573974609375, -0.980617105960846], |
michael@0 | 469 | translation: [0, 0, 59.15367126464844] }, |
michael@0 | 470 | { rotation: [ |
michael@0 | 471 | -0.17158392071723938, 0.0426151417195797, |
michael@0 | 472 | -0.0844573974609375, -0.980617105960846], |
michael@0 | 473 | translation: [0, 0, 53.238304138183594] }, |
michael@0 | 474 | { rotation: [ |
michael@0 | 475 | -0.17158392071723938, 0.0426151417195797, |
michael@0 | 476 | -0.0844573974609375, -0.980617105960846], |
michael@0 | 477 | translation: [0, 0, 47.91447448730469] }]; |
michael@0 | 478 | |
michael@0 | 479 | arcball3.keyDown(arcball3.zoomKeys["unzoom"]); |
michael@0 | 480 | for (let i8 = 0; i8 < 10; i8++) { |
michael@0 | 481 | stack8.push(cloneUpdate(arcball3.update())); |
michael@0 | 482 | } |
michael@0 | 483 | arcball3.keyUp(arcball3.zoomKeys["unzoom"]); |
michael@0 | 484 | |
michael@0 | 485 | ok(isExpectedUpdate(stack8, expect8), |
michael@0 | 486 | "Key zoom reset events didn't create the expected transformation results."); |
michael@0 | 487 | |
michael@0 | 488 | |
michael@0 | 489 | arcball3.resize(123, 456); |
michael@0 | 490 | is(arcball3.width, 123, |
michael@0 | 491 | "The third arcball width wasn't updated correctly."); |
michael@0 | 492 | is(arcball3.height, 456, |
michael@0 | 493 | "The third arcball height wasn't updated correctly."); |
michael@0 | 494 | is(arcball3.radius, 123, |
michael@0 | 495 | "The third arcball radius wasn't implicitly updated correctly."); |
michael@0 | 496 | } |