2 // Copyright (C) 2005, 2006, 2007, 2009, 2010 Free Software
5 // This program is free software; you can redistribute it and/or modify
6 // it under the terms of the GNU General Public License as published by
7 // the Free Software Foundation; either version 3 of the License, or
8 // (at your option) any later version.
10 // This program is distributed in the hope that it will be useful,
11 // but WITHOUT ANY WARRANTY; without even the implied warranty of
12 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 // GNU General Public License for more details.
15 // You should have received a copy of the GNU General Public License
16 // along with this program; if not, write to the Free Software
17 // Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
20 // Test case for Function ActionScript class
21 // compile this test case with Ming makeswf, and then
22 // execute it like this gnash -1 -r 0 -v out.swf
27 // Utility function to print a Matrix with optional rounding
28 printMatrix
= function(m
, roundToDecimal
)
30 if ( roundToDecimal
!= undefined )
32 var round
= Math.pow
(10, roundToDecimal
);
33 // trace('rounding to '+round);
34 return '(a=' + Math.round
(m
.a
*round
)/round
+ ', b='+ Math.round
(m
.b
*round
)/round
+ ', c='+ Math.round
(m
.c
*round
)/round
+ ', d=' + Math.round
(m
.d
*round
)/round
+ ', tx='+Math.round
(m
.tx
*round
)/round
+', ty='+Math.round
(m
.ty
*round
)/round
+')';
43 #if OUTPUT_VERSION
== 5
44 Object.prototype
.hasOwnProperty
= ASnative
(101, 5);
47 check
(MovieClip.prototype
.hasOwnProperty
("attachAudio"));
48 check
(MovieClip.prototype
.hasOwnProperty
("attachVideo"));
49 check
(MovieClip.prototype
.hasOwnProperty
("getDepth"));
50 check
(MovieClip.prototype
.hasOwnProperty
("setMask"));
51 check
(MovieClip.prototype
.hasOwnProperty
("createEmptyMovieClip"));
52 check
(MovieClip.prototype
.hasOwnProperty
("beginFill"));
53 check
(MovieClip.prototype
.hasOwnProperty
("beginGradientFill"));
54 check
(MovieClip.prototype
.hasOwnProperty
("moveTo"));
55 check
(MovieClip.prototype
.hasOwnProperty
("lineTo"));
56 check
(MovieClip.prototype
.hasOwnProperty
("curveTo"));
57 check
(MovieClip.prototype
.hasOwnProperty
("lineStyle"));
58 check
(MovieClip.prototype
.hasOwnProperty
("endFill"));
59 check
(MovieClip.prototype
.hasOwnProperty
("clear"));
60 check
(MovieClip.prototype
.hasOwnProperty
("createTextField"));
61 check
(MovieClip.prototype
.hasOwnProperty
("getTextSnapshot"));
62 check
(MovieClip.prototype
.hasOwnProperty
("blendMode"));
63 check
(MovieClip.prototype
.hasOwnProperty
("attachBitmap"));
64 check
(MovieClip.prototype
.hasOwnProperty
("cacheAsBitmap"));
65 check
(MovieClip.prototype
.hasOwnProperty
("enabled"));
66 check
(MovieClip.prototype
.hasOwnProperty
("filters"));
67 check
(MovieClip.prototype
.hasOwnProperty
("forceSmoothing"));
68 check
(MovieClip.prototype
.hasOwnProperty
("opaqueBackground"));
69 check
(MovieClip.prototype
.hasOwnProperty
("scale9Grid"));
70 check
(MovieClip.prototype
.hasOwnProperty
("scrollRect"));
71 check
(MovieClip.prototype
.hasOwnProperty
("tabIndex"));
72 check
(MovieClip.prototype
.hasOwnProperty
("transform"));
73 check
(MovieClip.prototype
.hasOwnProperty
("useHandCursor"));
74 check
(MovieClip.prototype
.hasOwnProperty
("_lockroot"));
75 check
(MovieClip.prototype
.hasOwnProperty
("beginBitmapFill"));
76 check
(MovieClip.prototype
.hasOwnProperty
("beginMeshFill"));
77 check
(MovieClip.prototype
.hasOwnProperty
("getRect"));
78 check
(MovieClip.prototype
.hasOwnProperty
("lineGradientStyle"));
79 check
(MovieClip.prototype
.hasOwnProperty
("getInstanceAtDepth"));
80 check
(MovieClip.prototype
.hasOwnProperty
("getNextHighestDepth"));
82 check
(!MovieClip.prototype
.hasOwnProperty
("focusEnabled"));
83 check
(!MovieClip.prototype
.hasOwnProperty
("hitArea"));
84 check
(!MovieClip.prototype
.hasOwnProperty
("menu"));
85 check
(!MovieClip.prototype
.hasOwnProperty
("tabChildren"));
86 check
(!MovieClip.prototype
.hasOwnProperty
("tabEnabled"));
87 check
(!MovieClip.prototype
.hasOwnProperty
("trackAsMenu"));
88 check
(!MovieClip.prototype
.hasOwnProperty
("_alpha"));
89 check
(!MovieClip.prototype
.hasOwnProperty
("_currentframe"));
90 check
(!MovieClip.prototype
.hasOwnProperty
("_droptarget"));
91 check
(!MovieClip.prototype
.hasOwnProperty
("_focusrect"));
92 check
(!MovieClip.prototype
.hasOwnProperty
("_height"));
93 check
(!MovieClip.prototype
.hasOwnProperty
("_highquality"));
94 check
(!MovieClip.prototype
.hasOwnProperty
("_name"));
95 check
(!MovieClip.prototype
.hasOwnProperty
("_parent"));
96 check
(!MovieClip.prototype
.hasOwnProperty
("_quality"));
97 check
(!MovieClip.prototype
.hasOwnProperty
("_rotation"));
98 check
(!MovieClip.prototype
.hasOwnProperty
("_soundbuftime"));
99 check
(!MovieClip.prototype
.hasOwnProperty
("_target"));
100 check
(!MovieClip.prototype
.hasOwnProperty
("_totalframes"));
101 check
(!MovieClip.prototype
.hasOwnProperty
("_url"));
102 check
(!MovieClip.prototype
.hasOwnProperty
("_visible"));
103 check
(!MovieClip.prototype
.hasOwnProperty
("_width"));
104 check
(!MovieClip.prototype
.hasOwnProperty
("_x"));
105 check
(!MovieClip.prototype
.hasOwnProperty
("_xmouse"));
106 check
(!MovieClip.prototype
.hasOwnProperty
("_xscale"));
107 check
(!MovieClip.prototype
.hasOwnProperty
("_y"));
108 check
(!MovieClip.prototype
.hasOwnProperty
("_ymouse"));
109 check
(!MovieClip.prototype
.hasOwnProperty
("_yscale"));
110 check
(!MovieClip.prototype
.hasOwnProperty
("_root"));
111 check
(!MovieClip.prototype
.hasOwnProperty
("_global"));
114 // To be called at end of test
115 endOfTest
= function()
117 #if OUTPUT_VERSION
<= 5
118 check_totals
(355); // SWF5
121 #if OUTPUT_VERSION
== 6
122 check_totals
(927); // SWF6
125 #if OUTPUT_VERSION
== 7
126 check_totals
(960); // SWF7
129 #if OUTPUT_VERSION
>= 8
130 check_totals
(1077); // SWF8+
136 // Get a reference to a MovieClip
138 check_equals
(typeof(mc
), "movieclip");
140 // Check some references
141 check_equals
(typeof(this), 'movieclip');
142 check_equals
(typeof(_parent
), 'undefined');
143 #if OUTPUT_VERSION
> 5
144 check
(!mc
.hasOwnProperty
('_parent'));
145 check
(!MovieClip.prototype
.hasOwnProperty
('_parent'));
147 check_equals
(_root
, this);
148 check_equals
(typeof(this['_root']), 'movieclip');
149 check_equals
(typeof(this['_level0']), 'movieclip');
150 check_equals
(typeof(this['this']), 'undefined');
151 check_equals
(_root
['_root'], _root
);
152 check_equals
(_level0
['_root'], _root
);
153 check_equals
(_root
['_level0'], _root
);
154 #if OUTPUT_VERSION
>= 6
155 check_equals
(typeof(_root
['_global']), 'object');
156 check_equals
(_root
.hasOwnProperty
('_root'), false);
158 check_equals
(typeof(_global
['_root']), 'undefined');
160 check_equals
(x
['_root'], undefined);
165 check_equals
(mc
.__proto__
, MovieClip.prototype
);
166 check_equals
(typeof(MovieClip.prototype
._width
), "undefined");
167 check_equals
(typeof(MovieClip.prototype
.attachMovie
), "function");
168 check_equals
(typeof(MovieClip.prototype
.__proto__
), "object");
169 check_equals
(MovieClip.prototype
.__proto__
, Object.prototype
);
170 check_equals
(typeof(mc
._width
), "number");
172 // Check methods existance
175 check_equals
(typeof(mc
.attachMovie
), 'function');
176 check_equals
(typeof(mc
.getBytesLoaded
), 'function');
177 check_equals
(typeof(mc
.getBytesTotal
), 'function');
178 check_equals
(typeof(mc
.getBounds
), 'function');
179 check_equals
(typeof(mc
.globalToLocal
), 'function');
180 check_equals
(typeof(mc
.localToGlobal
), 'function');
181 check_equals
(typeof(mc
.unloadMovie
), 'function');
182 check_equals
(typeof(mc
.meth
), 'function');
183 check_equals
(typeof(mc
.getSWFVersion
), 'function');
184 check_equals
(mc
.getSWFVersion
(), OUTPUT_VERSION
);
185 check_equals
(MovieClip.constructor
, Function);
187 #if OUTPUT_VERSION
>= 6
188 check
(MovieClip.prototype
.hasOwnProperty
('loadMovie'));
189 check
(MovieClip.prototype
.hasOwnProperty
('_lockroot'));
190 check
(!MovieClip.prototype
.hasOwnProperty
('loadMovieNum'));
191 check
(!MovieClip.prototype
.hasOwnProperty
('valueOf'));
192 check
(!MovieClip.prototype
.hasOwnProperty
('toString'));
193 check
(MovieClip.prototype
.hasOwnProperty
('meth'));
194 check
(MovieClip.prototype
.hasOwnProperty
('useHandCursor'));
196 check_equals
(typeof(mc
.valueOf
), 'function');
197 check_equals
(typeof(mc
.toString
), 'function');
199 check_equals
(typeof(mc
.valueOf
()), 'movieclip');
201 check_equals
(typeof(mc
.enabled
), 'boolean');
202 #if OUTPUT_VERSION
>= 6
203 check
(!mc
.hasOwnProperty
('enabled'));
204 check
(mc
.__proto__
.hasOwnProperty
('enabled'));
205 check
(!mc
.hasOwnProperty
('valueOf'));
206 check
(!mc
.hasOwnProperty
('toString'));
209 check_equals
(mc
.enabled
, true);
211 check_equals
(typeof(mc
.enabled
), 'boolean');
212 check_equals
(mc
.enabled
, false);
213 mc
.enabled
= 'a string';
214 check_equals
(typeof(mc
.enabled
), 'string');
215 check_equals
(mc
.enabled
, 'a string');
217 check_equals
(typeof(mc
.enabled
), 'number');
218 check_equals
(mc
.enabled
, 56.5);
219 check
(delete mc
.enabled
);
220 check_equals
(typeof(mc
.enabled
), 'boolean');
221 check_equals
(mc
.enabled
, true);
222 mc
.__proto__
.enabled
= 'a string';
223 check_equals
(typeof(mc
.enabled
), 'string'); // yes, we can set to arbitrary values
224 check_equals
(mc
.enabled
, 'a string'); // yes, we can set to arbitrary values
225 mc
.__proto__
.enabled
= true; // better keep as it was initially, who knows what it would do...
227 // NOTE: due to a bug in Ming < 00040005, mc.loadMovie would
228 // be converted to lowercase, so we use the [] hack
229 check_equals
(typeof(mc
['duplicateMovieClip']), 'function');
231 #if OUTPUT_VERSION
>= 6
232 check_equals
(typeof(mc
.setMask
), 'function');
233 check_equals
(typeof(mc
.beginFill
), 'function');
234 check_equals
(typeof(mc
.beginGradientFill
), 'function');
235 check_equals
(typeof(mc
.clear
), 'function');
236 check_equals
(typeof(mc
.createEmptyMovieClip
), 'function');
237 check_equals
(typeof(mc
.createTextField
), 'function');
238 check_equals
(typeof(mc
.curveTo
), 'function');
239 check_equals
(typeof(mc
.lineStyle
), 'function');
240 check_equals
(typeof(mc
.lineTo
), 'function');
241 check_equals
(typeof(mc
.moveTo
), 'function');
242 check_equals
(typeof(mc
.attachAudio
), 'function');
243 check_equals
(typeof(mc
.endFill
), 'function');
244 check_equals
(typeof(mc
.getDepth
), 'function');
245 check_equals
(typeof(mc
.getURL
), 'function');
246 check_equals
(typeof(mc
.gotoAndPlay
), 'function');
247 check_equals
(typeof(mc
.gotoAndStop
), 'function');
248 check_equals
(typeof(mc
.hitTest
), 'function');
249 check_equals
(typeof(mc
.nextFrame
), 'function');
250 check_equals
(typeof(mc
.play
), 'function');
251 check_equals
(typeof(mc
.prevFrame
), 'function');
252 check_equals
(typeof(mc
.stop
), 'function');
253 check_equals
(typeof(mc
.swapDepths
), 'function');
254 check_equals
(typeof(mc
.startDrag
), 'function');
255 check_equals
(typeof(mc
.stopDrag
), 'function');
256 check_equals
(typeof(mc
.getTextSnapshot
), 'function');
258 // NOTE: due to a bug in Ming < 00040005, mc.loadMovie would
259 // be converted to lowercase, so we use the [] hack
260 check_equals
(typeof(mc
['loadMovie']), 'function');
261 check_equals
(typeof(mc
['removeMovieClip']), 'function');
263 check
(MovieClip.prototype
.hasOwnProperty
('removeMovieClip'));
264 check
(!mc
.hasOwnProperty
('removeMovieClip'));
266 #endif
// OUTPUT_VERSION >= 6
268 #if OUTPUT_VERSION
>= 7
270 check_equals
(typeof(mc
.getInstanceAtDepth
), 'function');
271 check
( MovieClip.prototype
.hasOwnProperty
('getInstanceAtDepth') );
272 check
( ! mc
.hasOwnProperty
('getInstanceAtDepth') );
274 // can't confirm this works !
275 // maybe we should just NOT use the _root for this ?
276 //check(mc.loadVariables != undefined);
278 // maybe this is the start condition...
279 check_equals
(mc
.focusEnabled
, undefined);
280 check_equals
(mc
.hitArea
, undefined);
281 check_equals
(mc
.menu
, undefined);
283 check_equals
(mc
.getNextHighestDepth
(), 0);
285 check_equals
(mc
.getNextHighestDepth
(), undefined);
288 // Even handlers are initially undefined, user can
289 // assign them a function to be called on that event...
290 check_equals
(mc
.onData
, undefined);
291 check_equals
(mc
.onDragOut
, undefined);
292 check_equals
(mc
.onDragOver
, undefined);
293 check_equals
(mc
.onEnterFrame
, undefined);
294 check_equals
(mc
.onKeyDown
, undefined);
295 check_equals
(mc
.onKeyUp
, undefined);
296 check_equals
(mc
.onKillFocus
, undefined);
297 check_equals
(mc
.onLoad
, undefined);
298 check_equals
(mc
.onMouseDown
, undefined);
299 check_equals
(mc
.onMouseMove
, undefined);
300 check_equals
(mc
.onMouseUp
, undefined);
301 check_equals
(mc
.onPress
, undefined);
302 check_equals
(mc
.onRelease
, undefined);
303 check_equals
(mc
.onReleaseOutside
, undefined);
304 check_equals
(mc
.onRollOut
, undefined);
305 check_equals
(mc
.onRollOver
, undefined);
306 check_equals
(mc
.onSetFocus
, undefined);
307 check_equals
(mc
.onUnload
, undefined);
308 #if OUTPUT_VERSION
>=6
309 check
(! mc
.hasOwnProperty
('onData'));
310 check
(! mc
.hasOwnProperty
('onDragOut'));
311 check
(! mc
.hasOwnProperty
('onDragOver'));
312 check_equals
(mc
.hasOwnProperty
('onEnterFrame'), false);
313 check
(! mc
.hasOwnProperty
('onKeyDown'));
314 check
(! mc
.hasOwnProperty
('onKeyUp'));
315 check
(! mc
.hasOwnProperty
('onKillFocus'));
316 check
(! mc
.hasOwnProperty
('onLoad'));
317 check
(! mc
.hasOwnProperty
('onMouseDown'));
318 check
(! mc
.hasOwnProperty
('onMouseMove'));
319 check
(! mc
.hasOwnProperty
('onMouseUp'));
320 check
(! mc
.hasOwnProperty
('onPress'));
321 check
(! mc
.hasOwnProperty
('onRelease'));
322 check
(! mc
.hasOwnProperty
('onReleaseOutside'));
323 check
(! mc
.hasOwnProperty
('onRollOut'));
324 check
(! mc
.hasOwnProperty
('onRollOver'));
325 check
(! mc
.hasOwnProperty
('onSetFocus'));
326 check
(! mc
.hasOwnProperty
('onUnload'));
329 // Check property existance
331 // These are undefined by default
332 check_equals
(mc
.tabChildren
, undefined);
333 mc
.tabChildren
= false;
334 check_equals
(mc
.tabChildren
, false);
335 mc
.tabChildren
= true;
336 check_equals
(mc
.tabChildren
, true);
337 check_equals
(mc
.tabEnabled
, undefined);
338 check_equals
(mc
.tabIndex
, undefined);
339 check_equals
(mc
.trackAsMenu
, undefined);
340 check_equals
(mc
.useHandCursor
, true);
341 mc
.useHandCursor
= false;
342 check_equals
(mc
.useHandCursor
, false);
343 check_equals
(mc
._alpha
, 100);
344 check
(mc
._currentframe
!= undefined);
346 if (typeof(mc
._droptarget
) != "string")
348 fail
("typeof(mc._droptarget) = "+typeof(mc
._droptarget
)+" (expected 'string') ["+__FILE__
+":"+__LINE__
+"]");
349 note
(" WARNING: some players have been reported to evaluate _droptarget to undefined, rather then the empty string. Reguardless of SWF target.");
353 pass
("typeof(mc._droptarget) = "+typeof(mc
._droptarget
)+" ["+__FILE__
+":"+__LINE__
+"]");
356 check
(mc
._focusrect
!= undefined);
357 check_equals
(mc
._focusrect
, true);
358 mc
._focusrect
= false;
359 check_equals
(mc
._focusrect
, false);
361 check_equals
(mc
._focusrect
, true);
362 mc
._focusrect
= undefined;
363 check_equals
(mc
._focusrect
, true);
364 mc
._focusrect
= null;
365 check_equals
(mc
._focusrect
, true);
367 check_equals
(mc
._focusrect
, false);
369 #if OUTPUT_VERSION
== 5
370 check_equals
(typeof(mc
._focusrect
), "number");
372 check_equals
(typeof(mc
._focusrect
), "boolean");
375 #if OUTPUT_VERSION
> 5
376 j
= createEmptyMovieClip
("j", getNextHighestDepth
());
377 check_equals
(typeof(j
._focusrect
), "null");
380 check
(mc
._framesloaded
!= undefined);
381 check
(mc
._height
!= undefined);
382 check
(mc
._highquality
!= undefined);
383 check
(mc
._y
!= undefined);
384 check
(mc
._ymouse
!= undefined);
385 check
(mc
._yscale
!= undefined);
386 check_equals
(typeof(MovieClip.prototype
._lockroot
), 'undefined');
387 check_equals
(typeof(mc
._lockroot
), 'boolean');
388 check_equals
(mc
._lockroot
, false);
390 check_equals
(typeof(mc
._lockroot
), 'boolean');
391 check_equals
(mc
._lockroot
, true);
393 check_equals
(typeof(mc
._lockroot
), 'boolean');
394 check_equals
(mc
._lockroot
, false);
396 #if OUTPUT_VERSION
> 5
397 check_equals
(mc
._name
, "");
398 check_equals
(typeof(mc
._name
), "string");
399 mc
._name
= "changed";
400 check_equals
(typeof(mc
._name
), "string");
401 check_equals
(typeof(mc
), "movieclip");
403 // Tested with: LNX 10,0,12,10
406 check_equals
(mc
._name
, "");
409 check
(mc
._parent
== undefined);
410 check
(mc
._rotation
!= undefined);
411 check
(mc
._soundbuftime
!= undefined);
412 check
(mc
._target
!= undefined);
413 check
(mc
._totalframes
!= undefined);
414 check
(mc
._url
!= undefined);
415 check
(mc
._visible
!= undefined);
416 check
(mc
._width
!= undefined);
417 check
(mc
._x
!= undefined);
418 check
(mc
._xmouse
!= undefined);
419 check
(mc
._xscale
!= undefined);
421 #if OUTPUT_VERSION
>= 6
423 // focused test on _* properties
424 check_equals
(typeof(mc
._x
), 'number');
425 check
(!mc
.hasOwnProperty
("_x"));
426 check
(!mc
.__proto__
.hasOwnProperty
("_x"));
427 check
(!MovieClip.prototype
.hasOwnProperty
("_x"));
429 check_equals
(typeof(mc
._y
), 'number');
430 check
(!mc
.hasOwnProperty
("_y"));
431 check
(!mc
.__proto__
.hasOwnProperty
("_y"));
432 check
(!MovieClip.prototype
.hasOwnProperty
("_y"));
434 check_equals
(typeof(mc
._height
), 'number');
435 check
(!mc
.hasOwnProperty
("_height"));
436 check
(!mc
.__proto__
.hasOwnProperty
("_height"));
437 check
(!MovieClip.prototype
.hasOwnProperty
("_height"));
439 check_equals
(typeof(mc
._width
), 'number');
440 check
(!mc
.hasOwnProperty
("_width"));
441 check
(!mc
.__proto__
.hasOwnProperty
("_width"));
442 check
(!MovieClip.prototype
.hasOwnProperty
("_width"));
444 check_equals
(typeof(mc
._xscale
), 'number');
445 check
(!mc
.hasOwnProperty
("_xscale"));
446 check
(!mc
.__proto__
.hasOwnProperty
("_xscale"));
447 check
(!MovieClip.prototype
.hasOwnProperty
("_xscale"));
449 check_equals
(typeof(mc
._yscale
), 'number');
450 check
(!mc
.hasOwnProperty
("_yscale"));
451 check
(!mc
.__proto__
.hasOwnProperty
("_yscale"));
452 check
(!MovieClip.prototype
.hasOwnProperty
("_yscale"));
454 check_equals
(typeof(mc
._xmouse
), 'number');
455 check
(!mc
.hasOwnProperty
("_xmouse"));
456 check
(!mc
.__proto__
.hasOwnProperty
("_xmouse"));
457 check
(!MovieClip.prototype
.hasOwnProperty
("_xmouse"));
459 check_equals
(typeof(mc
._ymouse
), 'number');
460 check
(!mc
.hasOwnProperty
("_ymouse"));
461 check
(!mc
.__proto__
.hasOwnProperty
("_ymouse"));
462 check
(!MovieClip.prototype
.hasOwnProperty
("_ymouse"));
464 check_equals
(typeof(mc
._rotation
), 'number');
465 check
(!mc
.hasOwnProperty
("_rotation"));
466 check
(!mc
.__proto__
.hasOwnProperty
("_rotation"));
467 check
(!MovieClip.prototype
.hasOwnProperty
("_rotation"));
469 check_equals
(typeof(mc
._totalframes
), 'number');
470 check
(!mc
.hasOwnProperty
("_totalframes"));
471 check
(!mc
.__proto__
.hasOwnProperty
("_totalframes"));
472 check
(!MovieClip.prototype
.hasOwnProperty
("_totalframes"));
474 check
(!mc
.hasOwnProperty
("_level"));
475 check
(!mc
.__proto__
.hasOwnProperty
("_level"));
476 check
(!mc
.hasOwnProperty
("_target"));
477 check
(!mc
.hasOwnProperty
("_url"));
478 check
(!mc
.hasOwnProperty
("_soundbuftime"));
479 check
(!mc
.hasOwnProperty
("_focusrect"));
480 check
(!mc
.hasOwnProperty
("_framesloaded"));
481 check
(!mc
.hasOwnProperty
("_lockroot"));
482 check
(!mc
.hasOwnProperty
("_highquality"));
483 #endif
//if OUTPUT_VERSION >= 6
485 //----------------------------------------------
486 // Test _soundbuftime
487 //----------------------------------------------
489 check_equals
(mc
._soundbuftime
, _soundbuftime
);
490 xcheck_equals
(mc
._soundbuftime
, 5);
491 xcheck_equals
(_soundbuftime
, 5);
493 mc
._soundbuftime
= 20;
494 xcheck_equals
(mc
._soundbuftime
, 20);
495 xcheck_equals
(_soundbuftime
, 20);
497 mc
._soundbuftime
= -20;
498 xcheck_equals
(mc
._soundbuftime
, -20);
499 xcheck_equals
(_soundbuftime
, -20);
501 mc
._soundbuftime
= 0;
502 check_equals
(mc
._soundbuftime
, 0);
503 check_equals
(_soundbuftime
, 0);
505 mc
._soundbuftime
= 1.5;
506 xcheck_equals
(mc
._soundbuftime
, 1);
507 xcheck_equals
(_soundbuftime
, 1);
511 mc
._soundbuftime
= o
;
512 xcheck_equals
(mc
._soundbuftime
, 1);
513 xcheck_equals
(_soundbuftime
, 1);
515 o
.valueOf
= function() { return 4; };
517 mc
._soundbuftime
= o
;
518 xcheck_equals
(mc
._soundbuftime
, 4);
519 xcheck_equals
(_soundbuftime
, 4);
521 mc
._soundbuftime
= "string";
522 xcheck_equals
(mc
._soundbuftime
, 4);
523 xcheck_equals
(_soundbuftime
, 4);
525 #if OUTPUT_VERSION
>= 6
527 // _soundbuftime points to the same value, is not MovieClip-specific
528 mc
._soundbuftime
= 10;
529 xcheck_equals
(mc
._soundbuftime
, 10);
530 mc2
= createEmptyMovieClip
("mc2_mc", 50, 0, 0, 0);
531 xcheck_equals
(mc2
._soundbuftime
, 10);
532 mc2
._soundbuftime
= 20;
533 xcheck_equals
(mc
._soundbuftime
, 20);
539 //----------------------------------------------
540 // Test createEmptyMovieClip
541 //----------------------------------------------
543 #if OUTPUT_VERSION
>= 6 // {
545 // Test movieclip creation
546 var mc2
= createEmptyMovieClip
("mc2_mc", 50, 0, 0, 0);
547 check
(mc2
!= undefined);
548 check_equals
(mc2_mc
.getBytesLoaded
(), 0);
549 check_equals
(mc2_mc
.getBytesTotal
(), 0);
550 check_equals
(mc2
.getBytesLoaded
(), 0);
551 check_equals
(mc2
.getBytesTotal
(), 0);
552 check_equals
(mc2
._url
, _root
._url
);
554 check
(!mc2
.hasOwnProperty
('_parent'));
556 #if OUTPUT_VERSION
> 6 // {
557 check_equals
(getInstanceAtDepth
(50), mc2
);
560 var mc3
= createEmptyMovieClip
("mc3_mc", 50);
561 check
(mc3
!= undefined);
562 check_equals
(mc3
.getDepth
(), 50);
564 mc3
.bd
= Button.prototype
.getDepth
;
565 // Tested with: LNX 10,0,12,10
568 check_equals
(typeof(mc3
.bd
()), 'undefined');
570 #if OUTPUT_VERSION
> 6 // {
571 check_equals
(getInstanceAtDepth
(50), mc3
);
574 // By default useHandCursor is true
575 check_equals
(mc3
.useHandCursor
, true);
576 check
(!mc3
.hasOwnProperty
("useHandCursor"));
577 // We add a mouse event handler, and expect this
578 // to make useHandCursor true
579 mc3
.onMouseOver
= function() { trace
("over"); };
580 check_equals
(mc3
.useHandCursor
, true);
581 mc3
.useHandCursor
= false;
582 check_equals
(mc3
.useHandCursor
, false);
583 mc3
.useHandCursor
= "string";
584 check_equals
(mc3
.useHandCursor
, "string");
586 check_equals
(mc3_mc
.getBytesLoaded
(), 0);
587 check_equals
(mc3_mc
.getBytesTotal
(), 0);
588 check_equals
(mc3
.getBytesLoaded
(), 0);
589 check_equals
(mc3
.getBytesTotal
(), 0);
590 check_equals
(mc3_mc
, _level0
.mc3_mc
);
591 check_equals
(String(mc3_mc
), "_level0.mc3_mc");
596 // Test the _target property
597 check_equals
(_root
._target
, "/");
599 // Test the _level property
600 check_equals
(typeof(_root
._level
), "movieclip");
601 check_equals
(_root
._level
, _level0
);
603 #if OUTPUT_VERSION
>= 6
604 // unfortunately we can't use createEmptyMovieClip with
605 // lower SWF targets...
606 var mc4
= _root
.createEmptyMovieClip
("mc4_mc", 60);
607 check_equals
(mc4
._parent
, _root
);
608 check_equals
(mc4
._target
, "/mc4_mc");
609 check_equals
(targetPath
(mc4
), "_level0.mc4_mc");
610 var mc5
= mc4
.createEmptyMovieClip
("mc5_mc", 60);
611 check_equals
(mc5
._target
, "/mc4_mc/mc5_mc");
612 check_equals
(targetPath
(mc5
), "_level0.mc4_mc.mc5_mc");
613 check_equals
(typeof(mc4_mc
), 'movieclip');
614 check_equals
(typeof(mc4_mc
.mc5_mc
), 'movieclip');
615 check_equals
(typeof(mc4
), 'movieclip');
616 check_equals
(typeof(mc5
), 'movieclip');
617 mc4
._name
= 'changed';
618 check_equals
(typeof(mc4_mc
), 'undefined');
619 check_equals
(typeof(mc4_mc
.mc5_mc
), 'undefined');
620 check_equals
(typeof(mc4
), 'movieclip');
621 check_equals
(typeof(mc5
), 'movieclip');
622 check_equals
(mc4
._target
, "/changed");
623 check_equals
(mc5
._target
, "/changed/mc5_mc");
624 check_equals
(targetPath
(mc4
), "_level0.changed");
625 check_equals
(targetPath
(mc5
), "_level0.changed.mc5_mc");
626 check_equals
(mc4
.toString
(), "[object Object]");
627 check_equals
(mc5
.toString
(), "[object Object]");
628 check_equals
(changed
._target
, "/changed");
629 check_equals
(changed
.mc5_mc
._target
, "/changed/mc5_mc");
630 check_equals
(changed
.toString
(), "[object Object]");
631 check_equals
(changed
.mc5_mc
.toString
(), "[object Object]");
632 #endif
// OUTPUT_VERSION >= 6
634 //--------------------------------------------------------------------------
635 // Test "soft" references
636 // See http://thread.gmane.org/gmane.comp.web.flashcoders.devel/84030
637 //--------------------------------------------------------------------------
639 // There's no such think as a _global.removeMovieClip
640 // What is referred to the "global" function does actually
641 // resolve to an ActionRemoveClip tag (0.25)
642 check_equals
(typeof(_global
.removeMovieClip
), 'undefined');
644 #if OUTPUT_VERSION
>= 6
646 // Here we create 3 clips
647 // - hardref has no onUnload
648 // - hardref2 has an onUnload
649 // - hardref3 has no onUnload but a child with onUnload
650 // We'll see that when the three clips are removed from the stage
651 // those with any onUnload handler (either theirs or in their childrens)
652 // will still be on the stage, only with their depth shifted at -32769-depth
653 // (see character::removedRepthOffset)
655 softref
= _root
.createEmptyMovieClip
("hardref", 60);
656 softref2
= _root
.createEmptyMovieClip
("hardref2", 70);
657 softref3
= _root
.createEmptyMovieClip
("hardref3", 80);
658 softref3child
= softref3
.createEmptyMovieClip
("hardref3child", 1);
659 softref3child2
= softref3
.createEmptyMovieClip
("hardref3child2", 2);
660 softref3child
.onUnload
= function() { check_equals
(this._target
, '/hardref3/hardref3child'); note
(this+".onUnload called"); };
661 hardref2
.onUnload
= function() { /*note(this+".onUnload called");*/ };
662 check_equals
(typeof(hardref
), 'movieclip');
663 check_equals
(typeof(softref
), 'movieclip');
664 check_equals
(typeof(hardref2
), 'movieclip');
665 check_equals
(typeof(softref2
), 'movieclip');
666 check_equals
(typeof(hardref3
), 'movieclip');
667 check_equals
(typeof(softref3
), 'movieclip');
668 check_equals
(typeof(hardref3
.hardref3child
), 'movieclip');
669 check_equals
(typeof(softref3child
), 'movieclip');
673 softref3child
.member
= '3child';
674 softref3child2
.member
= '3child2';
675 check_equals
(typeof(softref
.member
), 'number');
676 check_equals
(typeof(softref2
.member
), 'number');
677 check_equals
(typeof(softref3
.member
), 'number');
678 check_equals
(typeof(softref3child
.member
), 'string');
679 check_equals
(softref
.member
, 1);
680 check_equals
(softref2
.member
, 2);
681 check_equals
(softref3
.member
, 3);
682 check_equals
(softref3child
.member
, '3child');
683 check_equals
(softref
._target
, "/hardref");
684 check_equals
(softref2
._target
, "/hardref2");
685 check_equals
(softref3
._target
, "/hardref3");
686 check_equals
(softref3child
._target
, "/hardref3/hardref3child");
687 check_equals
(hardref
.getDepth
(), 60);
688 check_equals
(hardref2
.getDepth
(), 70);
689 check_equals
(hardref3
.getDepth
(), 80);
690 check_equals
(softref3child
.getDepth
(), 1);
691 check_equals
(softref3child2
.getDepth
(), 2);
692 #if OUTPUT_VERSION
> 6
693 check_equals
(getInstanceAtDepth
(60), hardref
);
694 check_equals
(getInstanceAtDepth
(70), hardref2
);
695 check_equals
(getInstanceAtDepth
(80), hardref3
);
696 check_equals
(hardref3
.getInstanceAtDepth
(1), hardref3
.hardref3child
);
697 removeMovieClip
(hardref
); // using ActionRemoveClip (0x25)
698 removeMovieClip
(hardref2
); // using ActionRemoveClip (0x25)
699 removeMovieClip
(hardref3
); // using ActionRemoveClip (0x25)
700 check_equals
(getInstanceAtDepth
(60), undefined);
701 check_equals
(getInstanceAtDepth
(-32839), hardref2
);
703 // just to test another way, ActionRemoveClip in SWF6 will work as well
704 hardref
.removeMovieClip
(); // using the sprite's removeMovieClip
705 hardref2
.removeMovieClip
(); // using the sprite's removeMovieClip
706 hardref3
.removeMovieClip
(); // using the sprite's removeMovieClip
707 //softref.removeMovieClip(); // use the softref's removeMovieClip
710 check_equals
(typeof(hardref
), 'undefined');
711 check_equals
(typeof(hardref2
), 'movieclip');
712 check_equals
(typeof(hardref3
), 'movieclip'); // still accessible due to onUnload defined for its child
713 check_equals
(hardref2
.getDepth
(), -32839);
714 check_equals
(hardref3
.getDepth
(), -32849);
715 check_equals
(hardref3
.hardref3child
.getDepth
(), 1);
716 check_equals
(typeof(softref
), 'movieclip');
717 check_equals
(typeof(softref2
), 'movieclip');
718 check_equals
(typeof(softref3
), 'movieclip');
719 check_equals
(typeof(softref3child
), 'movieclip');
720 check_equals
(typeof(softref
.member
), 'undefined');
721 check_equals
(typeof(softref
._target
), 'undefined');
722 check_equals
("x"+softref
, 'x');
723 check_equals
(softref2
.member
, 2);
724 check_equals
(softref2
._target
, '/hardref2');
725 check_equals
(softref3
.member
, 3);
726 check_equals
(softref3
._target
, '/hardref3');
727 check_equals
(softref3child
.member
, '3child');
728 check_equals
(softref3child
._target
, '/hardref3/hardref3child');
729 check_equals
(softref3child
.getDepth
(), 1);
730 removeMovieClip
(softref3child
); // using ActionRemoveClip (0x25)
731 check_equals
(softref3child2
.member
, '3child2');
732 check_equals
(softref3child2
._target
, '/hardref3/hardref3child2');
733 check_equals
(softref3child2
.getDepth
(), 2);
735 // Delete is needed, or further inspection functions will hit the variable before the character
737 sr61
= _root
.createEmptyMovieClip
("hardref", 61);
739 check_equals
(typeof(softref
.member
), 'number');
740 check_equals
(softref
.member
, 2);
742 // Two movieclips can have the same name
743 sr62
= _root
.createEmptyMovieClip
("hardref", 62);
744 // Still, soft references correctly point each to
745 // it's distinct clip !
747 check_equals
(sr61
.member
, 6);
748 check_equals
(typeof(sr62
.member
), 'undefined');
749 check_equals
(sr61
._name
, "hardref");
750 check_equals
(sr62
._name
, "hardref");
753 #if OUTPUT_VERSION
> 6
755 ul4
= _root
.createEmptyMovieClip
("hul4", getNextHighestDepth
());
756 ul5
= ul4
.createEmptyMovieClip
("hul5", ul4
.getNextHighestDepth
());
758 ul6
= ul4
.createEmptyMovieClip
("hul6", ul4
.getNextHighestDepth
());
760 ul7
= ul4
.createEmptyMovieClip
("hul7", ul4
.getNextHighestDepth
());
762 ul8
= ul4
.createEmptyMovieClip
("hul8", ul4
.getNextHighestDepth
());
764 ul9
= ul4
.createEmptyMovieClip
("hul9", ul4
.getNextHighestDepth
());
767 ul7
.onUnload
= function() {};
768 ul9
.onUnload
= function() {};
771 check_equals
(ul5
.a
, 7);
773 ul4
.removeMovieClip
();
775 // Child property removed
776 check_equals
(typeof(ul4
.hul5
), "undefined");
778 // MovieClip still exists
779 check_equals
(typeof(ul5
), "movieclip");
781 // But without properties.
782 check_equals
(ul5
.a
, undefined);
784 // Same with this child
785 check_equals
(typeof(ul4
.hul6
), "undefined");
786 check_equals
(typeof(ul6
), "movieclip");
787 check_equals
(ul6
.a
, undefined);
789 // Has unload handler, so not removed.
790 check_equals
(typeof(ul4
.hul7
), "movieclip");
791 check_equals
(typeof(ul7
), "movieclip");
792 check_equals
(ul7
.a
, 7);
794 // No unload handler, but still not removed because there was a handler at
796 check_equals
(typeof(ul4
.hul8
), "movieclip");
797 check_equals
(typeof(ul8
), "movieclip");
798 check_equals
(ul8
.a
, 7);
800 // Also has unload handler.
801 check_equals
(typeof(ul4
.hul9
), "movieclip");
802 check_equals
(typeof(ul9
), "movieclip");
803 check_equals
(ul9
.a
, 7);
807 // When getting a member by name, the one with lowest
808 // depth comes up first
809 check_equals
(hardref
.member
, 6); // depth 61 < 62
810 sr60
= _root
.createEmptyMovieClip
("hardref", 60);
812 check_equals
(hardref
.member
, 60); // depth 60 < 61 < 62
814 // Here we verify that the "soft-reference" always refers to
815 // the original target of the sprite it was bound to even
816 // if it's re-bound to a new sprite. In particular we check that:
818 // 1. Original target of a re-bound target isn't used for further
820 // 2. No rebind is attempted till the original sprite is destroyed (not simply unloaded!)
821 // 3. After original bounded sprite is unloaded, rebinding is *always*
825 // _level0.hardref4 created, soft ref sr62 set
826 sr62
= _root
.createEmptyMovieClip
("hardref4", 62);
827 sr62
.member
= 'hardref4_original';
828 check_equals
(sr62
.member
, "hardref4_original");
830 // _level0.hardref4_n created and renamed to _level0.hardref
831 // this does NOT trigger rebinding of sr62, still bound to
832 // it's original sprite
834 sr60
= _root
.createEmptyMovieClip
("hardref4_n", 60);
835 sr60
._name
= "hardref4";
836 check_equals
(sr62
.member
, "hardref4_original");
837 sr60
.removeMovieClip
();
838 check_equals
(sr62
.member
, "hardref4_original");
840 // _level0.hardref4 unloaded.
841 // From now on, sr62 is a dangling soft refefence
842 // and will try to rebind to something else
844 hardref4
.removeMovieClip
();
845 check_equals
(typeof(hardref4
), 'undefined');
846 check_equals
(typeof(sr62
.member
), 'undefined');
848 // _level0.hardref4_with_another_name created
849 sr63
= _root
.createEmptyMovieClip
("hardref4_with_another_name", 63);
850 sr63
.member
= "hardref4_63";
852 // sr62 is still unbound
853 check_equals
(typeof(sr62
.member
), "undefined");
855 // renamed _level0.hardref4_with_another_name to _level0.hardref4
856 // sr62 will now rebind to the new sprite.
857 // sr63 and sr63_bis refs created.
859 sr63
._name
= "hardref4";
861 check_equals
(sr62
.member
, "hardref4_63");
863 // A new sprite is created at depth 60 and named
864 // _level0.hardref4 again
866 // The sr62 soft-ref is rebound again, even if the
867 // currently bound sprite wasn't unloaded !
868 // The sr63 soft-ref, originally bound to the character
869 // at depth 63, isn't rebound instead.
871 sr60
= _root
.createEmptyMovieClip
("hardref4_60", 60);
872 sr60
.member
= "hardref4_60";
873 sr60
._name
= "hardref4";
874 check_equals
(hardref4
.member
, 'hardref4_60');
875 check_equals
(sr62
.member
, "hardref4_60");
876 check_equals
(sr63
.member
, "hardref4_63");
878 // Removing the at depth 60 (currently bound to sr62)
879 // exposes depth63 again for next binding attempt of sr62
880 sr62
.removeMovieClip
();
881 check_equals
(sr62
.member
, "hardref4_63");
883 // depth 63 unloaded, sr62 is orphaned again
884 check_equals
(hardref4
, sr63
);
885 hardref4
.removeMovieClip
();
886 check_equals
(typeof(sr63
.member
), 'undefined');
887 check_equals
(typeof(sr62
.member
), "undefined");
889 // Finally, we create a sprite at depth 64 and see how changing
890 // it's name triggers rebinding
891 sr64
= _root
.createEmptyMovieClip
("hardref4_with_yet_another_name", 64);
892 sr64
.member
= "hardref4_64";
894 // Naming it "hardref4" rebinds sr62 (dangling)
895 // but leaves sr63 orphaned (dangling, but pointing to
896 // _level0.hardref4_with_another_name)
898 sr64
._name
= "hardref4";
899 check_equals
(sr62
.member
, "hardref4_64");
900 check_equals
(typeof(sr63
.member
), 'undefined');
902 // Naming it "hardref4_with_another_name"
903 // makes sr62 orphaned (dangling and pointing to _level0.hardref4),
904 // rebinds sr63 and sr63_bis to it
905 // (previously dangling and pointing to _level0.hardref4_with_another_name)
907 sr64
._name
= "hardref4_with_another_name";
908 check_equals
(typeof(sr62
.member
), "undefined");
909 check_equals
(sr63
.member
, 'hardref4_64');
910 check_equals
(sr63_bis
.member
, 'hardref4_64');
911 check_equals
(sr64
.member
, 'hardref4_64');
913 // Now check that unloaded-but-not-destroyed sprite
914 // do NOT trigger rebinding
915 sr59
= createEmptyMovieClip
("hardref5", 59);
916 sr59
.member
= "hardref5@59";
917 sr59
.onUnload
= function() {};
918 sr60
= createEmptyMovieClip
("hardref5", 60);
919 sr60
.member
= "hardref5@60";
920 sr60
.onUnload
= function() {};
921 check_equals
(sr59
.getDepth
(), 59);
922 check_equals
(sr60
.getDepth
(), 60);
923 check_equals
(sr59
._target
, "/hardref5");
924 check_equals
(sr60
._target
, "/hardref5");
925 sr60
.removeMovieClip
();
926 check_equals
(sr59
.getDepth
(), 59);
927 check_equals
(sr60
.getDepth
(), -32829);
928 check_equals
(sr59
._target
, "/hardref5");
929 check_equals
(sr60
._target
, "/hardref5");
930 sr59
.removeMovieClip
();
931 // sr59, despite the fact hardref5@59 was unloaded, still
932 // points to the original sprite. This means no rebind is
933 // attempted, otherwise hardref5@60 will be found first
934 // being at a lower depth
935 check_equals
(hardref5
.getDepth
(), -32829);
936 check_equals
(hardref5
._target
, "/hardref5");
937 check_equals
(hardref5
.member
, "hardref5@60");
938 // Gnash fails because it's "unload" event triggering rebinding
939 // rather then "destroy" event (unsupported in Gnash).
940 check_equals
(sr59
.getDepth
(), -32828);
941 check_equals
(sr59
.member
, "hardref5@59");
942 check_equals
(sr59
._target
, "/hardref5");
943 check_equals
(sr60
.getDepth
(), -32829);
944 check_equals
(sr60
._target
, "/hardref5");
945 check_equals
(sr60
.member
, "hardref5@60");
947 #endif
// OUTPUT_VERSION >= 6
949 //----------------------------------------------
951 //----------------------------------------------
952 #if OUTPUT_VERSION
>= 6
953 umc
= _root
.createEmptyMovieClip
("umc", getNextHighestDepth
());
954 check_equals
(typeof(umc
), 'movieclip');
956 check_equals
(umc
.getBounds
().xMax
, 6710886.35);
958 // This shouldn't be seen.
960 lineStyle
(2, 0xff6699);
969 #if OUTPUT_VERSION
>=8
970 check_equals
(umc
.getBounds
().xMax
, 101);
972 check_equals
(umc
.getBounds
().xMax
, 102);
975 umc
.onData
= function() { };
976 umc
.onLoad
= function() { };
981 #if OUTPUT_VERSION
>=8
982 check_equals
(umc
.getBounds
().xMax
, 101);
984 check_equals
(umc
.getBounds
().xMax
, 102);
987 check_equals
(umc
.a
, 7);
988 check_equals
(umc
.b
, "string");
989 check_equals
(typeof(umc
.onRollOut
), "undefined");
990 check_equals
(typeof(umc
.onData
), "function");
991 check_equals
(typeof(umc
.onLoad
), "function");
993 // Prevent it from being really removed.
995 umc
.removeMovieClip
();
996 check_equals
(typeof(umc
), 'movieclip');
997 check_equals
(typeof(umcref
), 'movieclip');
998 check_equals
(umc
.getBounds
().xMax
, undefined);
999 check_equals
(umc
.a
, undefined);
1000 check_equals
(umc
.b
, undefined);
1001 check_equals
(typeof(umc
.onRollOut
), "undefined");
1002 check_equals
(typeof(umc
.onData
), "undefined");
1003 check_equals
(typeof(umc
.onLoad
), "undefined");
1007 //----------------------------------------------
1008 // Test duplicateMovieClip
1009 //----------------------------------------------
1010 #if OUTPUT_VERSION
>= 6
1011 _root
.createEmptyMovieClip
("original", 61);
1012 _root
.original
.createEmptyMovieClip
("child1", 1);
1013 _root
.original
._x
= 100;
1014 _root
.original
.onEnterFrame
= function() { };
1015 _root
.original
.onRollOver
= function() { };
1016 check_equals
(typeof(_root
.original
), 'movieclip');
1017 check_equals
(typeof(_root
.original
.child1
), 'movieclip');
1018 check_equals
(_root
.original
._x
, 100);
1019 check_equals
(typeof(_root
.original
.onEnterFrame
), 'function');
1020 check_equals
(typeof(_root
.original
.onRollOver
), 'function');
1022 duplicateMovieClip
(_root
.original
, "copy1", 63);
1023 check_equals
(typeof(_root
.copy1
), 'movieclip');
1024 check_equals
(typeof(_root
.copy1
.child1
), 'undefined');
1025 check_equals
(typeof(_root
.copy1
.onEnterFrame
), 'undefined');
1026 check_equals
(typeof(_root
.copy1
.onRollOver
), 'undefined');
1027 check_equals
(_root
.copy1
.getDepth
(), 63);
1028 check_equals
(_root
.copy1
._x
, 100);
1030 duplicateMovieClip
(_root
, "copy88", -1000);
1031 check_equals
(typeof(_root
.getBytesLoaded
()), "number");
1032 check_equals
(copy88
.getBytesLoaded
(), undefined);
1034 #if OUTPUT_VERSION
== 6
1035 // SWF7 and higher removed duplicateMovieClip method of MovieClip class
1036 _root
.original
.duplicateMovieClip
("copy2", 64);
1037 check_equals
(typeof(_root
.copy2
), 'movieclip');
1038 check_equals
(typeof(_root
.copy2
.child1
), 'undefined');
1039 check_equals
(typeof(_root
.copy2
.onEnterFrame
), 'undefined');
1040 check_equals
(typeof(_root
.copy2
.onRollOver
), 'undefined');
1041 check_equals
(_root
.copy2
.getDepth
(), 64);
1042 check_equals
(_root
.copy2
._x
, 100);
1043 #endif
// OUTPUT_VERSION = 6
1044 #endif
// OUTPUT_VERSION >= 6
1046 //----------------------------------------------
1047 // Test timeline variables
1048 //----------------------------------------------
1053 check_equals
(_root
.c
, 1);
1055 check_equals
(_root
.b
, 1);
1057 //----------------------------------------------
1058 // Test new MovieClip
1059 //----------------------------------------------
1061 var cl
= new MovieClip();
1062 check_equals
(cl
.__proto__
.constructor
, MovieClip);
1063 check_equals
(cl
.constructor
, MovieClip);
1064 check_equals
(cl
.__constructor__
, MovieClip);
1065 check
(cl instanceOf
MovieClip);
1066 check
(cl instanceOf
Object);
1067 check_equals
(typeof(cl
), "object");
1068 check_equals
(typeof(cl
.attachMovie
), "function");
1069 check_equals
(typeof(cl
._width
), "undefined");
1070 check_equals
(typeof(cl
._parent
), "undefined");
1072 //------------------------------------------------
1073 // Test onLoad to be allowed to be set to anything
1074 //------------------------------------------------
1077 check_equals
(typeof(_root
.onLoad
), 'number');
1078 _root
.onLoad
= "test";
1079 check_equals
(typeof(_root
.onLoad
), 'string');
1081 //-----------------------------------------------------------
1083 //-----------------------------------------------------------
1085 #if OUTPUT_VERSION
>= 6
1086 check
(this.hasOwnProperty
("$version"));
1088 check_equals
(typeof(this.$version
), 'string');
1090 function enumerate
(obj
, enum
)
1093 for (var i
in obj
) {
1100 // Check that $version is enumerable
1101 enum
= new Object; enumlen
= enumerate
(this, enum
);
1102 check_equals
(typeof(enum
['$version']), 'string');
1104 // Check that $version is overridable and deletable
1105 this.$version
= "fake version";
1106 check_equals
(this.$version
, 'fake version');
1107 check
(delete $version
);
1108 check_equals
(typeof(this.$version
), 'undefined');
1112 // A new array is returned each time; each element is recreated each time.
1113 // Non-filter objects passed to the setter in the array are ignored.
1114 // Assigning a non-array also clears the filters.
1115 // A fake array works.
1117 #if OUTPUT_VERSION
> 7
1118 check_equals
(typeof(_root
.filters
), "object");
1119 check
(_root
.filters
.hasOwnProperty
("length"));
1120 check_equals
(_root
.filters
.length
, 0);
1123 check_equals
(typeof(_root
.filters
), "object");
1125 _root
.filters
.push
(7);
1126 check_equals
(_root
.filters
.toString
(), "");
1128 _root
.filters
.push
(new Object());
1129 check_equals
(_root
.filters
.toString
(), "");
1131 _root
.filters
.push
(new Date(0));
1132 check_equals
(_root
.filters
.toString
(), "");
1134 _root
.filters
.length
= 4;
1135 check_equals
(_root
.filters
.toString
(), "");
1136 check_equals
(_root
.filters
.length
, 0);
1138 _root
.filters
.push
(new flash
.filters
.ConvolutionFilter());
1139 check_equals
(_root
.filters
.toString
(), "");
1141 _root
.filters
= [ 1, 3, 4, 5 ];
1142 check_equals
(_root
.filters
.length
, 0);
1143 check_equals
(_root
.filters
.toString
(), "");
1145 _root
.filters
= [ new flash
.filters
.ConvolutionFilter() ];
1146 xcheck_equals
(_root
.filters
.length
, 1);
1147 xcheck_equals
(_root
.filters
.toString
(), "[object Object]");
1149 _root
.filters
= [ new flash
.filters
.ConvolutionFilter(),
1150 new flash
.filters
.DropShadowFilter() ];
1151 xcheck_equals
(_root
.filters
.length
, 2);
1152 xcheck_equals
(_root
.filters
.toString
(), "[object Object],[object Object]");
1154 // The filters are recreated every time.
1155 tmp1
= _root
.filters
;
1156 tmp2
= _root
.filters
;
1157 xcheck
(tmp1
[0] !== tmp2
[0]);
1159 _root
.filters
= [ new flash
.filters
.ConvolutionFilter(),
1160 new flash
.filters
.DropShadowFilter(),
1162 xcheck_equals
(_root
.filters
.length
, 2);
1163 xcheck_equals
(_root
.filters
.toString
(), "[object Object],[object Object]");
1165 _root
.filters
= [ new flash
.filters
.ConvolutionFilter(),
1167 new flash
.filters
.BlurFilter() ];
1168 xcheck_equals
(_root
.filters
.length
, 2);
1169 xcheck_equals
(_root
.filters
.toString
(), "[object Object],[object Object]");
1172 check_equals
(_root
.filters
.length
, 0);
1176 fake
[0] = new flash
.filters
.ConvolutionFilter();
1177 fake
[1] = new flash
.filters
.DisplacementMapFilter();
1178 fake
[2] = new flash
.filters
.ConvolutionFilter();
1179 _root
.filters
= fake
;
1180 xcheck_equals
(_root
.filters
.length
, 3);
1181 xcheck_equals
(_root
.filters
.toString
(),
1182 "[object Object],[object Object],[object Object]");
1184 backup
= _global
.Array;
1188 // It uses [], not new Array().
1189 _global
.Array = function() { this.test
= "passed"; };
1191 check_equals
(ch
.test
, undefined);
1192 ch
.toString
= backup
.prototype
.toString
;
1193 xcheck_equals
(ch
.toString
(),
1194 "[object Object],[object Object],[object Object]");
1196 _global
.Array = backup
;
1199 check_equals
(_root
.filters
.length
, 0);
1203 //------------------------------------------------
1205 //------------------------------------------------
1207 #ifdef MING_SUPPORTS_ASM_GETPROPERTY
1211 push
"" // this doesn't resolve to top of with stack
1216 #if OUTPUT_VERSION
> 5
1217 check_equals
(a
, "changed");
1219 // Tested with: LNX 10,0,12,10
1224 check_equals
(typeof(a
), 'string');
1225 check_equals
(a
, '');
1230 push
"" // this doesn't resolve to top of with stack
1235 check_equals
(b
, "/");
1244 #if OUTPUT_VERSION
> 5
1245 check_equals
(a
, "changed");
1247 // Tested with: LNX 10,0,12,10
1252 check_equals
(typeof(a
), 'string');
1253 check_equals
(a
, '');
1263 check_equals
(b
, "/");
1265 #endif
// MING_SUPPORT_ASM_GETPROPERTY
1267 //------------------------------------------------
1268 // Test createTextField
1269 //------------------------------------------------
1271 t
= createTextField
("textfieldTest", 3, 0, 100, 100, 100);
1272 #if OUTPUT_VERSION
< 8
1273 check_equals
(typeof(t
), 'undefined');
1275 check_equals
(typeof(t
), 'object');
1276 check_equals
(t
, _root
.textfieldTest
);
1277 #endif
// OUTPUT_VERSION >= 8
1279 #if OUTPUT_VERSION
> 5
1280 check_equals
(typeof(textfieldTest
), 'object');
1281 check
(textfieldTest
instanceof TextField);
1283 xcheck_equals
(typeof(textfieldTest
), 'movieclip');
1284 xcheck
(textfieldTest
instanceof MovieClip);
1287 //----------------------------------------------
1289 //----------------------------------------------
1291 // A getDepth call against a script-created clip
1292 // is already tested in the createEmptyMovieClip test
1293 // section. Here we try to test it against a statically
1294 // defined movie. We hope that the 'dejagnu' clip
1295 // is statically defined, if it's not we'll raise a
1296 // warning about it.
1298 // getDepth was not available as of SWF5
1299 #if OUTPUT_VERSION
> 5
1301 // _level0 is at depth 0 !
1302 // _level1 is at depth 1 ! (and so on)..
1303 check_equals
(_root
.getDepth
(), -16384);
1305 static_clip_name
= "__shared_assets";
1306 static_clip
= eval
(static_clip_name
);
1307 if ( typeof(static_clip
) == 'movieclip' )
1309 check_equals
(static_clip
.getDepth
(), -16383);
1313 note
("There is not '"+static_clip_name
+"' clip statically-defined, so we could not test getDepth() against it");
1317 #endif
// OUTPUT_VERSION > 5
1320 //----------------------------------------------
1321 // Test _width, _height and getBounds
1322 //----------------------------------------------
1324 #if OUTPUT_VERSION
>= 6
1326 createEmptyMovieClip
("container", 5);
1327 check
(!container
.hasOwnProperty
("$version"));
1328 check_equals
(typeof(container
['$version']), 'undefined');
1329 container
.createEmptyMovieClip
("draw", 5);
1330 draw
= container
.draw
;
1332 check_equals
(draw
._width
, 0);
1333 check_equals
(draw
._height
, 0);
1334 b
= draw
.getBounds
();
1335 check_equals
(typeof(b
), 'object');
1336 check_equals
(typeof(b
.xMin
), 'number');
1337 check_equals
(typeof(b
.xMax
), 'number');
1338 check_equals
(typeof(b
.yMin
), 'number');
1339 check_equals
(typeof(b
.yMax
), 'number');
1340 // Returned number is (2^28/2)-1 twips : any ringing bell ?
1341 //check_equals(b.xMin, 6710886.35);
1342 //check_equals(b.xMax, 6710886.35);
1343 //check_equals(b.yMin, 6710886.35);
1344 //check_equals(b.yMax, 6710886.35);
1345 check
(b
.xMin
-6710886.35 < 0.001);
1346 check
(b
.xMax
-6710886.35 < 0.001);
1347 check
(b
.yMin
-6710886.35 < 0.001);
1348 check
(b
.yMax
-6710886.35 < 0.001);
1352 lineStyle
(0, 0x000000);
1359 check_equals
(draw
._width
, 10);
1360 check_equals
(draw
._height
, 20);
1362 // getRect and getBounds are the same in this case.
1366 #if OUTPUT_VERSION
< 8
1367 check_equals
(c
.xMin
, undefined);
1369 xcheck_equals
(c
.xMin
, 10);
1370 xcheck_equals
(c
.xMax
, 20);
1371 xcheck_equals
(c
.yMin
, 10);
1372 xcheck_equals
(c
.yMax
, 30);
1375 b
= draw
.getBounds
();
1376 check_equals
(b
.xMin
, 10);
1377 check_equals
(b
.xMax
, 20);
1378 check_equals
(b
.yMin
, 10);
1379 check_equals
(b
.yMax
, 30);
1381 b
= draw
.getBounds
(container
);
1382 check_equals
(b
.xMin
, 10);
1383 check_equals
(b
.xMax
, 20);
1384 check_equals
(b
.yMin
, 10);
1385 check_equals
(b
.yMax
, 30);
1387 c
= draw
.getRect
(container
);
1388 #if OUTPUT_VERSION
< 8
1389 check_equals
(c
.xMin
, undefined);
1391 xcheck_equals
(c
.xMin
, 10);
1392 xcheck_equals
(c
.xMax
, 20);
1393 xcheck_equals
(c
.yMin
, 10);
1394 xcheck_equals
(c
.yMax
, 30);
1398 b
= draw
.getBounds
();
1399 check_equals
(b
.xMin
, 10);
1400 check_equals
(b
.xMax
, 20);
1401 b
= draw
.getBounds
(container
);
1402 check_equals
(b
.xMin
, 30);
1403 check_equals
(b
.xMax
, 40);
1405 b
= draw
.getBounds
();
1406 check_equals
(b
.xMin
, 10);
1407 check_equals
(b
.xMax
, 20);
1408 b
= draw
.getBounds
(container
);
1409 check_equals
(b
.xMin
, 30);
1410 check_equals
(b
.xMax
, 40);
1411 check_equals
(b
.yMin
, 10);
1412 check_equals
(b
.yMax
, 30);
1413 check_equals
(draw
._width
, 10);
1414 check_equals
(draw
._height
, 20);
1415 b
= draw
.getBounds
(_root
);
1416 check_equals
(b
.xMin
, 10);
1417 check_equals
(b
.xMax
, 20);
1421 draw
._rotation
= 90;
1423 #if OUTPUT_VERSION
>= 8
1424 check_equals
(printMatrix
(draw
.transform
.matrix
, 2), "(a=0, b=1, c=-1, d=0, tx=0, ty=0)");
1425 check_equals
(printMatrix
(container
.transform
.matrix
, 2), "(a=1, b=0, c=0, d=1, tx=0, ty=0)");
1428 check_equals
(draw
._width
, 20);
1429 check_equals
(draw
._height
, 10);
1430 b
= draw
.getBounds
(); // these are local, untransformed
1431 check_equals
(b
.xMin
, 10);
1432 check_equals
(b
.xMax
, 20);
1433 check_equals
(b
.yMin
, 10);
1434 check_equals
(b
.yMax
, 30);
1435 b
= draw
.getBounds
(container
); // these are transformed by container draw matrix
1436 check_equals
(b
.xMin
, -30);
1437 check_equals
(b
.xMax
, -10);
1438 check_equals
(b
.yMin
, 10);
1439 check_equals
(b
.yMax
, 20);
1441 draw
._visible
= false;
1442 check_equals
(draw
._width
, 20);
1443 check_equals
(draw
._height
, 10);
1444 b
= draw
.getBounds
(); // these are local, untransformed
1445 check_equals
(b
.xMin
, 10);
1446 check_equals
(b
.xMax
, 20);
1447 check_equals
(b
.yMin
, 10);
1448 check_equals
(b
.yMax
, 30);
1449 b
= draw
.getBounds
(container
); // these are transformed by container draw matrix
1450 check_equals
(b
.xMin
, -30);
1451 check_equals
(b
.xMax
, -10);
1452 check_equals
(b
.yMin
, 10);
1453 check_equals
(b
.yMax
, 20);
1456 check_equals
(draw
._width
, 20);
1457 check_equals
(draw
._height
, 20);
1460 check_equals
(draw
._width
, 20);
1461 check_equals
(draw
._height
, 20);
1463 draw
._visible
= true;
1465 check_equals
(draw
._width
, 10);
1466 check_equals
(draw
._height
, 20);
1469 check_equals
(draw
._width
, 10);
1470 check_equals
(draw
._height
, 10);
1471 check_equals
(container
._width
, 10);
1472 check_equals
(container
._height
, 10);
1474 container
._xscale
= 800;
1475 check_equals
(draw
._width
, 10);
1476 check_equals
(draw
._height
, 10);
1477 check_equals
(container
._width
, 80);
1478 check_equals
(container
._height
, 10);
1479 b
= draw
.getBounds
(); // these are local, untransformed
1480 check_equals
(b
.xMin
, 10);
1481 check_equals
(b
.xMax
, 20);
1482 check_equals
(b
.yMin
, 10);
1483 check_equals
(b
.yMax
, 30);
1484 b
= draw
.getBounds
(container
); // these are transformed by container draw matrix
1485 check_equals
(b
.xMin
, 10);
1486 check_equals
(b
.xMax
, 20);
1487 check_equals
(b
.yMin
, 5);
1488 check_equals
(b
.yMax
, 15);
1491 check_equals
(draw
._yscale
, -50);
1492 check_equals
(draw
._height
, 10);
1494 #if OUTPUT_VERSION
>= 8
1495 check_equals
(printMatrix
(draw
.transform
.matrix
, 2), "(a=1, b=0, c=0, d=-0.5, tx=0, ty=0)");
1497 b
= draw
.getBounds
(container
); // these are transformed by container draw matrix
1498 check_equals
(b
.xMin
, 10);
1499 check_equals
(b
.xMax
, 20);
1500 check_equals
(b
.yMin
, -15);
1501 check_equals
(b
.yMax
, -5);
1504 check_equals
(draw
._xscale
, -50);
1505 check_equals
(draw
._yscale
, -50); // setting _xscale didn't change _yscale
1506 check_equals
(draw
._width
, 5);
1508 #if OUTPUT_VERSION
>= 8
1509 check_equals
(printMatrix
(draw
.transform
.matrix
, 2), "(a=-0.5, b=0, c=0, d=-0.5, tx=0, ty=0)");
1511 b
= draw
.getBounds
(container
); // these are transformed by container draw matrix
1512 check_equals
(b
.xMin
, -10);
1513 check_equals
(b
.xMax
, -5);
1514 check_equals
(b
.yMin
, -15);
1515 check_equals
(b
.yMax
, -5);
1518 check_equals
(draw
._width
, 10);
1519 check_equals
(draw
._xscale
, 100); // reset to positive on setting _width
1520 check_equals
(draw
._yscale
, 50); // reset to positive on setting _width !
1522 #if OUTPUT_VERSION
>= 8
1523 check_equals
(printMatrix
(draw
.transform
.matrix
, 2), "(a=1, b=0, c=0, d=0.5, tx=0, ty=0)");
1525 b
= draw
.getBounds
(container
); // these are transformed by container draw matrix
1526 check_equals
(b
.xMin
, 10);
1527 check_equals
(b
.xMax
, 20);
1528 check_equals
(b
.yMin
, 5);
1529 check_equals
(b
.yMax
, 15);
1531 draw
._height
= 10; // TODO: dumb check, it's 10 already !!
1532 check_equals
(draw
._yscale
, 50); // was already positive
1534 #if OUTPUT_VERSION
>= 8
1535 check_equals
(printMatrix
(draw
.transform
.matrix
, 2), "(a=1, b=0, c=0, d=0.5, tx=0, ty=0)");
1537 b
= draw
.getBounds
(container
); // these are transformed by container draw matrix
1538 check_equals
(b
.xMin
, 10);
1539 check_equals
(b
.xMax
, 20);
1540 check_equals
(b
.yMin
, 5);
1541 check_equals
(b
.yMax
, 15);
1543 container
._xscale
= 100;
1544 container
._yscale
= 100;
1548 #if OUTPUT_VERSION
>= 8
1549 check_equals
(printMatrix
(draw
.transform
.matrix
, 2), "(a=1, b=0, c=0, d=1, tx=0, ty=0)");
1550 check_equals
(printMatrix
(container
.transform
.matrix
, 0), "(a=1, b=0, c=0, d=1, tx=0, ty=0)");
1553 b
= draw
.getBounds
(container
); // these are transformed by container draw matrix
1554 check_equals
(b
.xMin
, 10);
1555 check_equals
(b
.xMax
, 20);
1556 check_equals
(b
.yMin
, 10);
1557 check_equals
(b
.yMax
, 30);
1558 container
.createEmptyMovieClip
("draw2", 6);
1559 draw
= container
.draw2
;
1562 lineStyle
(0, 0x000000);
1570 b
= container
.draw
.getBounds
(container
);
1571 check_equals
(b
.xMin
, 10);
1572 check_equals
(b
.xMax
, 20);
1573 check_equals
(b
.yMin
, 10);
1574 check_equals
(b
.yMax
, 30);
1575 b
= container
.draw
.getBounds
();
1576 check_equals
(b
.xMin
, 10);
1577 check_equals
(b
.xMax
, 20);
1578 check_equals
(b
.yMin
, 10);
1579 check_equals
(b
.yMax
, 30);
1580 b
= container
.draw2
.getBounds
(container
);
1581 check_equals
(b
.xMin
, 60);
1582 check_equals
(b
.xMax
, 80);
1583 check_equals
(b
.yMin
, 20);
1584 check_equals
(b
.yMax
, 40);
1585 b
= container
.draw2
.getBounds
(container
.draw
);
1586 check_equals
(b
.xMin
, 60);
1587 check_equals
(b
.xMax
, 80);
1588 check_equals
(b
.yMin
, 20);
1589 check_equals
(b
.yMax
, 40);
1590 b
= container
.draw2
.getBounds
(invalid
);
1591 check_equals
(typeof(b
), 'undefined');
1592 b
= container
.draw2
.getBounds
(__shared_assets
);
1593 check_equals
(b
.xMin
, 60);
1594 check_equals
(b
.xMax
, 80);
1595 check_equals
(b
.yMin
, 20);
1596 check_equals
(b
.yMax
, 40);
1598 b
= container
.draw2
.getBounds
();
1599 check_equals
(b
.xMin
, 60);
1600 check_equals
(b
.xMax
, 80);
1601 check_equals
(b
.yMin
, 20);
1602 check_equals
(b
.yMax
, 40);
1603 b
= container
.getBounds
();
1604 check_equals
(b
.xMin
, 10);
1605 check_equals
(b
.xMax
, 80);
1606 check_equals
(b
.yMin
, 10);
1607 check_equals
(b
.yMax
, 40);
1609 container
.draw2
._x
+= 20;
1610 b
= container
.getBounds
();
1611 check_equals
(b
.xMin
, 10);
1612 check_equals
(b
.xMax
, 100);
1613 check_equals
(b
.yMin
, 10);
1614 check_equals
(b
.yMax
, 40);
1615 check_equals
(container
._width
, 90);
1616 check_equals
(container
._height
, 30);
1618 container
.draw2
._xscale
= 200;
1619 b
= container
.getBounds
();
1620 check_equals
(b
.xMin
, 10);
1621 check_equals
(b
.xMax
, 180);
1622 check_equals
(b
.yMin
, 10);
1623 check_equals
(b
.yMax
, 40);
1625 // Check effects of unload on bounds
1626 // TODO: test this with bounds defined by SWF tags !
1627 container
.onUnload
= function() {};
1628 container_ref
= container
;
1629 container
.removeMovieClip
();
1630 check_equals
(typeof(container
), 'movieclip');
1631 check_equals
(typeof(container_ref
.getBounds
), 'function');
1632 b
= container
.getBounds
();
1633 // check_equals(b.xMin, 6710886.35);
1634 // check_equals(b.xMax, 6710886.35);
1635 // check_equals(b.yMin, 6710886.35);
1636 // check_equals(b.yMax, 6710886.35);
1637 check
(b
.xMin
- 6710886.35 < 0.0001);
1638 check
(b
.xMax
- 6710886.35 < 0.0001);
1639 check
(b
.yMin
- 6710886.35 < 0.0001);
1640 check
(b
.yMax
- 6710886.35 < 0.0001);
1642 b
= container_ref
.getBounds
();
1643 // check_equals(b.xMin, 6710886.35);
1644 // check_equals(b.xMax, 6710886.35);
1645 // check_equals(b.yMin, 6710886.35);
1646 // check_equals(b.yMax, 6710886.35);
1647 check
(b
.xMin
- 6710886.35 < 0.0001);
1648 check
(b
.xMax
- 6710886.35 < 0.0001);
1649 check
(b
.yMin
- 6710886.35 < 0.0001);
1650 check
(b
.yMax
- 6710886.35 < 0.0001);
1652 container
.createEmptyMovieClip
("draw3",13);
1653 draw
= container
.draw3
;
1656 lineStyle
(10, 0x000000);
1663 #if OUTPUT_VERSION
< 8
1664 check_equals
(draw
._width
, 30);
1665 check_equals
(draw
._height
, 40);
1667 // SWF8 results are more correct (half-thickness added on each side)
1668 check_equals
(draw
._width
, 20);
1669 check_equals
(draw
._height
, 30);
1672 // Test effects of setting _width of a 0-size character
1673 createEmptyMovieClip
("draw4", 14);
1674 check_equals
(draw4
._width
, 0);
1675 check_equals
(draw4
._xscale
, 100);
1676 check_equals
(draw4
._yscale
, 100);
1677 draw4
._width
= 10; // setting _width affects _yscale too !!
1678 check_equals
(draw4
._width
, 0);
1679 check
(!isNaN
(draw4
._xscale
));
1680 check_equals
(typeof(draw4
._xscale
), 'number');
1681 check_equals
(draw4
._xscale
, 0);
1682 check
(!isNaN
(draw4
._yscale
));
1683 check_equals
(typeof(draw4
._yscale
), 'number');
1684 xcheck_equals
(draw4
._yscale
, 0);
1687 lineStyle
(0, 0x000000);
1694 check_equals
(draw4
._width
, 0);
1695 xcheck_equals
(draw4
._height
, 0);
1696 check_equals
(draw4
._xscale
, 0);
1697 xcheck_equals
(draw4
._yscale
, 0);
1699 check_equals
(draw4
._width
, 10);
1700 xcheck_equals
(draw4
._height
, 0);
1701 check_equals
(draw4
._xscale
, 100);
1702 xcheck_equals
(draw4
._yscale
, 0);
1703 draw4
._yscale
= 100;
1704 check_equals
(draw4
._width
, 10);
1705 check_equals
(draw4
._height
, 20);
1706 check_equals
(draw4
._xscale
, 100);
1707 check_equals
(draw4
._yscale
, 100);
1708 draw4
._width
= 20; // setting _width does NOT affect _yscale here
1709 check_equals
(draw4
._xscale
, 200);
1710 check_equals
(draw4
._yscale
, 100);
1713 // TODO: check bounds of non-scaled strokes
1714 // relative to a container which is scaled
1716 #endif
// OUTPUT_VERSION >= 6
1718 //----------------------------------------------
1720 //----------------------------------------------
1723 check_equals
(typeof(_alpha
), 'number');
1724 check_equals
(_alpha
, 100);
1727 check_equals
(_alpha
, 25);
1729 o
= {}; o
.valueOf
= function() { return 50; };
1731 check_equals
(typeof(_alpha
), 'number');
1732 check_equals
(_alpha
, 50);
1735 check_equals
(typeof(_alpha
), 'number');
1736 check_equals
(_alpha
, 50);
1739 check_equals
(typeof(_alpha
), 'number');
1740 check_equals
(_alpha
, 50);
1743 check_equals
(typeof(_alpha
), 'number');
1744 check_equals
(_alpha
, 50);
1747 check_equals
(typeof(_alpha
), 'number');
1748 check_equals
(_alpha
, 50);
1751 check_equals
(typeof(_alpha
), 'number');
1752 check_equals
(_alpha
, 50);
1755 check_equals
(typeof(_alpha
), 'number');
1756 check_equals
(_alpha
, -50);
1759 check_equals
(typeof(_alpha
), 'number');
1760 #if OUTPUT_VERSION
< 7
1761 check_equals
(_alpha
, 0);
1763 check_equals
(_alpha
, -50);
1768 check_equals
(typeof(_alpha
), 'number');
1769 check_equals
(_alpha
, 100);
1774 //----------------------------------------------
1776 //----------------------------------------------
1778 #if OUTPUT_VERSION
>=8
1779 tmp
= _root
.createEmptyMovieClip
("tmp", getNextHighestDepth
());
1780 tmptr
= tmp
.transform
;
1782 check_equals
(printMatrix
(tmp
.transform
.matrix
, 2), "(a=1, b=0, c=0, d=1, tx=0, ty=0)");
1784 check_equals
(printMatrix
(tmp
.transform
.matrix
, 2), "(a=1, b=0, c=0, d=2, tx=0, ty=0)");
1785 tmp
._rotation
= Math.PI
/ 4;
1786 check_equals
(printMatrix
(tmp
.transform
.matrix
, 2), "(a=1, b=0.01, c=-0.03, d=2, tx=0, ty=0)");
1788 check_equals
(printMatrix
(tmp
.transform
.matrix
, 2), "(a=1, b=0.01, c=0.01, d=-1, tx=0, ty=0)");
1790 check_equals
(printMatrix
(tmp
.transform
.matrix
, 2), "(a=1, b=0.01, c=0.01, d=-1, tx=0, ty=0)");
1792 check_equals
(printMatrix
(tmp
.transform
.matrix
, 2), "(a=1, b=0.01, c=-0.01, d=1, tx=0, ty=0)");
1794 check_equals
(printMatrix
(tmp
.transform
.matrix
, 2), "(a=-1, b=-0.01, c=-0.01, d=1, tx=0, ty=0)");
1795 tmp
._rotation
= Math.PI
/ 2;
1796 check_equals
(printMatrix
(tmp
.transform
.matrix
, 2), "(a=-1, b=-0.03, c=-0.03, d=1, tx=0, ty=0)");
1798 check_equals
(printMatrix
(tmp
.transform
.matrix
, 2), "(a=1, b=0.03, c=-0.03, d=1, tx=0, ty=0)");
1800 check_equals
(printMatrix
(tmp
.transform
.matrix
, 2), "(a=1, b=0.03, c=0.03, d=-1, tx=0, ty=0)");
1803 check_equals
(printMatrix
(tmp
.transform
.matrix
, 2), "(a=1, b=0.03, c=0.03, d=-1, tx=3, ty=6)");
1805 check_equals
(printMatrix
(tmp
.transform
.matrix
, 2), "(a=1, b=0.03, c=-0.03, d=1, tx=3, ty=6)");
1807 check_equals
(printMatrix
(tmp
.transform
.matrix
, 2), "(a=1, b=0.03, c=0, d=0, tx=3, ty=6)");
1809 check_equals
(printMatrix
(tmp
.transform
.matrix
, 2), "(a=1, b=0.03, c=0, d=0, tx=3, ty=6)");
1813 #if OUTPUT_VERSION
< 8
1814 check_equals
(typeof(_root
.transform
), 'undefined');
1817 // TODO: test these !!
1818 check_equals
(typeof(_root
.transform
), 'object');
1820 oldTransform
= _root
.transform
;
1821 check
(oldTransform
=== oldTransform
);
1822 check
(oldTransform
!= _root
.transform
); // everytime transform is accessed, it's a new object!
1824 Matrix = flash
.geom
.Matrix;
1825 check
(_root
.transform instanceOf
Object);
1826 check
(!_root
.transform instanceOf
Matrix);
1827 temp
= _root
.transform
;
1828 props
= []; for (var i
in temp
) props
.push
(i
);
1829 check_equals
(props
.toString
(), "pixelBounds,concatenatedColorTransform,colorTransform,concatenatedMatrix,matrix");
1831 check_equals
(typeof(_root
.transform
.colorTransform
), 'object');
1832 // TODO: test colorTransform
1834 check_equals
(typeof(_root
.transform
.concatenatedColorTransform
), 'object');
1835 // TODO: test concatenatedColorTransform
1837 check_equals
(typeof(_root
.transform
.concatenatedMatrix
), 'object');
1838 check
(_root
.transform
.concatenatedMatrix instanceOf
Matrix);
1840 check_equals
(typeof(_root
.transform
.matrix
), 'object');
1841 check
(_root
.transform
.matrix instanceOf
Matrix);
1843 note
('x:'+_root
._x
+' y:'+_root
._y
+' rot:'+_root
._rotation
+' xs:'+_root
._xscale
+' yx:'+_root
._yscale
);
1845 check_equals
(_root
.transform
.matrix
.a
, 1);
1846 check_equals
(_root
.transform
.matrix
.b
, 0);
1847 check_equals
(_root
.transform
.matrix
.c
, 0);
1848 check_equals
(_root
.transform
.matrix
.d
, 1);
1849 check_equals
(_root
.transform
.matrix
.tx
, 0);
1850 check_equals
(_root
.transform
.matrix
.ty
, 0);
1851 // TODO: test concatenatedMatrix
1856 check_equals
(_root
.transform
.matrix
.toString
(), "(a=1, b=0, c=0, d=1, tx=30, ty=20)");
1857 xcheck_equals
(_root
.transform
.pixelBounds
.toString
(), "(x=27, y=27, w=799, h=842)");
1859 _root
._xscale
= -300;
1861 check_equals
(_root
.transform
.matrix
.toString
(), "(a=-3, b=0, c=0, d=1, tx=30, ty=20)");
1862 xcheck_equals
(_root
.transform
.pixelBounds
.toString
(), "(x=-2361, y=27, w=2397, h=842)");
1864 _root
._yscale
= -200;
1866 check_equals
(_root
.transform
.matrix
.toString
(), "(a=-3, b=0, c=0, d=-2, tx=30, ty=20)");
1867 xcheck_equals
(_root
.transform
.pixelBounds
.toString
(), "(x=-2361, y=-1671, w=2397, h=1684)");
1869 _root
._rotation
= -90;
1871 check_equals
(_root
.transform
.matrix
.a
, 0);
1872 check_equals
(_root
.transform
.matrix
.b
, 3);
1873 check_equals
(_root
.transform
.matrix
.c
, -2);
1874 check_equals
(_root
.transform
.matrix
.d
, 0);
1875 check_equals
(_root
.transform
.matrix
.tx
, 30);
1876 check_equals
(_root
.transform
.matrix
.ty
, 20);
1877 xcheck_equals
(_root
.transform
.pixelBounds
.toString
(), "(x=-1663, y=16, w=1684, h=2397)");
1878 // TODO: test concatenatedMatrix
1880 _root
.transform
.matrix
.ty
= 300;
1881 check_equals
(_root
._y
, 20); // changing the AS matrix doesn't change the actual matrix
1883 check_equals
(_root
.transform
.matrix
.toString
(), "(a=0, b=3, c=-2, d=0, tx=30, ty=20)");
1884 xcheck_equals
(_root
.transform
.pixelBounds
.toString
(), "(x=-1663, y=16, w=1684, h=2397)");
1885 _root
._x
= _root
._y
= _root
._rotation
= 0;
1887 check_equals
(_root
.transform
.matrix
.toString
(), "(a=-3, b=0, c=0, d=-2, tx=0, ty=0)");
1888 xcheck_equals
(_root
.transform
.pixelBounds
.toString
(), "(x=-2391, y=-1691, w=2397, h=1684)");
1890 _root
._xscale
= 100;
1892 check_equals
(_root
.transform
.matrix
.toString
(), "(a=1, b=0, c=0, d=-2, tx=0, ty=0)");
1893 xcheck_equals
(_root
.transform
.pixelBounds
.toString
(), "(x=-2, y=-1691, w=799, h=1684)");
1895 _root
._yscale
= 100;
1897 check_equals
(_root
.transform
.matrix
.toString
(), "(a=1, b=0, c=0, d=1, tx=0, ty=0)");
1898 xcheck_equals
(_root
.transform
.pixelBounds
.toString
(), "(x=-2, y=7, w=799, h=842)");
1900 OldTransform
= flash
.geom
.Transform;
1902 flash
.geom
.Transform = 1;
1903 check_equals
(_root
.transform
.toString
(), undefined);
1904 check_equals
(_root
.transform
.matrix
.toString
(), undefined);
1906 flash
.geom
.Transform = OldTransform
;
1907 flash
.geom
.Transform.matrix
= 3;
1908 check_equals
(_root
.transform
.matrix
.toString
(), "(a=1, b=0, c=0, d=1, tx=0, ty=0)");
1910 flash
.geom
.Transform = OldTransform
;
1911 check_equals
(_root
.transform
.toString
(), "[object Object]");
1915 //----------------------------------------------
1916 // Test localToGlobal and globalToLocal
1917 //----------------------------------------------
1919 static_clip_name
= "__shared_assets";
1920 static_clip
= __shared_assets
;
1921 if ( typeof(static_clip
) == 'movieclip' )
1924 static_clip
.localToGlobal
(o
);
1925 check_equals
(o
.x
, 0);
1926 check_equals
(o
.y
, 0);
1927 static_clip
.globalToLocal
(o
);
1928 check_equals
(o
.x
, 0);
1929 check_equals
(o
.y
, 0);
1931 static_clip
._x
+= 50;
1932 static_clip
._y
-= 30;
1935 static_clip
.localToGlobal
(o
);
1936 check_equals
(o
.x
, 50);
1937 check_equals
(o
.y
, -30);
1938 static_clip
.globalToLocal
(o
);
1939 check_equals
(o
.x
, 0);
1940 check_equals
(o
.y
, 0);
1943 static_clip
.localToGlobal
(o
);
1944 check_equals
(o
.x
, 51);
1945 check_equals
(o
.y
, -29);
1946 static_clip
.globalToLocal
(o
);
1947 check_equals
(o
.x
, 1);
1948 check_equals
(o
.y
, 1);
1950 static_clip
._xscale
*= 2;
1951 static_clip
._yscale
*= 0.5;
1954 static_clip
.localToGlobal
(o
);
1955 check_equals
(o
.x
, 50);
1956 check_equals
(o
.y
, -30);
1957 static_clip
.globalToLocal
(o
);
1958 check_equals
(o
.x
, 0);
1959 check_equals
(o
.y
, 0);
1962 static_clip
.localToGlobal
(o
);
1963 check_equals
(o
.x
, 54);
1964 check_equals
(o
.y
, -29);
1965 static_clip
.globalToLocal
(o
);
1966 check_equals
(o
.x
, 2);
1967 check_equals
(o
.y
, 2);
1969 static_clip
._rotation
= 90;
1972 static_clip
.localToGlobal
(o
);
1973 check_equals
(o
.x
, 50);
1974 check_equals
(o
.y
, -30);
1975 static_clip
.globalToLocal
(o
);
1976 check_equals
(o
.x
, 0);
1977 check_equals
(o
.y
, 0);
1980 static_clip
.localToGlobal
(o
);
1981 check_equals
(o
.x
, 49);
1982 check_equals
(o
.y
, -26);
1983 static_clip
.globalToLocal
(o
);
1984 check_equals
(o
.x
, 2);
1985 check_equals
(o
.y
, 2);
1987 // omit the 'y' member (invalid call)
1989 static_clip
.localToGlobal
(o
);
1990 check_equals
(o
.x
, 2);
1991 check_equals
(typeof(o
.y
), 'undefined');
1992 static_clip
.globalToLocal
(o
);
1993 check_equals
(o
.x
, 2);
1994 check_equals
(typeof(o
.y
), 'undefined');
1998 static_clip
.localToGlobal
(o
);
1999 #if OUTPUT_VERSION
< 7
2000 check_equals
(o
.X
, 49);
2001 check_equals
(o
.Y
, -26);
2002 #else // OUTPUT_VERSION >= 7
2003 check_equals
(o
.X
, 2);
2004 check_equals
(o
.Y
, 2);
2005 check_equals
(typeof(o
.x
), 'undefined');
2006 check_equals
(typeof(o
.y
), 'undefined');
2008 static_clip
.globalToLocal
(o
);
2009 check_equals
(o
.X
, 2);
2010 check_equals
(o
.Y
, 2);
2012 static_clip
._rotation
= 0;
2013 static_clip
._x
-= 50;
2014 static_clip
._y
+= 30;
2015 static_clip
._xscale
*= 0.5;
2016 static_clip
._yscale
*= 2;
2018 // If it's not one twip, it's nothing
2019 static_clip
._y
+= 0.04;
2020 check_equals
(static_clip
._y
, 0);
2022 static_clip
._y
+= 0.04;
2023 check_equals
(static_clip
._y
, 0);
2025 static_clip
._y
+= 0.04;
2026 check_equals
(static_clip
._y
, 0);
2028 static_clip
._y
= 0.09;
2029 check
(static_clip
._y
> 0.04999 && static_clip
._y
< 0.050001);
2031 // Gnash can't do this because _x and _y are floats at the
2032 // moment, but it probably should be able to.
2033 check_equals
(static_clip
._y
, 0.05);
2035 // If it's not one twip, it's nothing
2036 static_clip
._x
+= 0.04;
2037 check_equals
(static_clip
._x
, 0);
2039 static_clip
._x
+= 0.04;
2040 check_equals
(static_clip
._x
, 0);
2042 static_clip
._x
+= 0.04;
2043 check_equals
(static_clip
._x
, 0);
2045 static_clip
._x
= 20.09;
2046 check
(static_clip
._x
> 20.049999 && static_clip
._x
< 20.050001);
2047 check_equals
(static_clip
._x
, 20.05);
2050 // TODO: try with x/y being getter-setter of the localToGlobal and globalToLocal parameter
2055 note
("There is not '"+static_clip_name
+"' clip statically-defined, so we could not test localToGlobal() and globalToLocal() against it");
2059 //---------------------------------------------------------------------
2060 // TODO: Test getInstanceAtDepth
2061 // (tested somehow above, but I mean a well-focused test here)
2062 //---------------------------------------------------------------------
2064 #if OUTPUT_VERSION
>= 7
2066 check_equals
(typeof(getInstanceAtDepth
(-6)), 'undefined');
2067 check_equals
(typeof(getInstanceAtDepth
()), 'undefined');
2068 createEmptyMovieClip
("tt2", -6);
2069 check_equals
(typeof(getInstanceAtDepth
(-6)), 'movieclip');
2070 o
= new Object; o
.valueOf
= function() { return -6; };
2071 check_equals
(typeof(getInstanceAtDepth
(o
)), 'movieclip');
2072 check_equals
(getInstanceAtDepth
(o
), tt2
);
2073 check_equals
(getInstanceAtDepth
(-6.7), tt2
);
2074 check_equals
(getInstanceAtDepth
(-6.2), tt2
);
2076 // what if we point to a non-sprite instance ? is it still considered a "movieclip" ?
2078 #endif
// OUTPUT_VERSION >= 7
2080 //---------------------------------------------------------------------
2081 // Test the MovieClip.prototype.meth function
2082 //---------------------------------------------------------------------
2085 check_equals
(typeof(ret
), 'number');
2086 check_equals
(ret
, 0);
2088 ret
= _root
.meth
(1);
2089 check_equals
(typeof(ret
), 'number');
2090 check_equals
(ret
, 0);
2092 Number.prototype
.toLowerCase
= function() { retCaller
=arguments.caller
; return "post"; };
2093 ret
= _root
.meth
(1);
2094 #if OUTPUT_VERSION
< 6
2095 check_equals
(retCaller
, _root
.meth
); // in gnash works because functions resolve equal to undefined
2097 check_equals
(retCaller
, _root
.meth
); // check that arguments.caller is also set for builtin functions
2099 check_equals
(typeof(ret
), 'number');
2100 check_equals
(ret
, 2);
2102 ret
= _root
.meth
('post');
2103 check_equals
(typeof(ret
), 'number');
2104 check_equals
(ret
, 2);
2106 ret
= _root
.meth
('POSt');
2107 check_equals
(typeof(ret
), 'number');
2108 check_equals
(ret
, 2);
2110 ret
= _root
.meth
('pOStIcipate');
2111 check_equals
(typeof(ret
), 'number');
2112 check_equals
(ret
, 0);
2114 ret
= _root
.meth
('G');
2115 check_equals
(typeof(ret
), 'number');
2116 check_equals
(ret
, 0);
2118 ret
= _root
.meth
('geT');
2119 check_equals
(typeof(ret
), 'number');
2120 check_equals
(ret
, 1);
2122 ret
= _root
.meth
('geTty');
2123 check_equals
(typeof(ret
), 'number');
2124 check_equals
(ret
, 0);
2126 o
= {}; o
.toString
= function() { return "post"; };
2127 ret
= _root
.meth
(o
);
2128 check_equals
(typeof(ret
), 'number');
2129 check_equals
(ret
, 0);
2131 o
.toLowerCase
= function() { return "get"; };
2132 ret
= _root
.meth
(o
);
2133 check_equals
(typeof(ret
), 'number');
2134 check_equals
(ret
, 1);
2136 //---------------------------------------------------------------------
2137 // Test native properties (getter-setter?)
2138 //---------------------------------------------------------------------
2140 #if OUTPUT_VERSION
> 5 // addProperty needs SWF6
2142 //createEmptyMovieClip('mc', 10);
2145 check_equals
(mc
._x
, 20);
2146 get = function() { /*note('get called');*/ getCalls
++; return 17; };
2147 set = function() { /*note('set called');*/ setCalls
++; };
2148 ret
= mc
.addProperty
('_x', get, set);
2149 check_equals
(ret
, true);
2150 getCalls
=0; setCalls
=0;
2152 check_equals
(inspect
, 17); // getMember invokes the getter
2153 check_equals
(getCalls
, 1);
2154 check_equals
(setCalls
, 0);
2155 mc
.x
= 10; // sets the property, but doesn't call the setter !
2156 check_equals
(getCalls
, 1); // assignment did call the getter
2157 check_equals
(setCalls
, 0);
2158 #ifdef MING_SUPPORTS_ASM
2166 // setMember did set the prop, didn't call the setter
2167 check_equals
(propinspect
, 20);
2168 #endif
//MING_SUPPORTS_ASM
2170 createEmptyMovieClip
('mc', 10);
2172 ret
= mc
.addProperty
('_x', get, set);
2173 check_equals
(ret
, true);
2174 getCalls
=0; setCalls
=0;
2176 check_equals
(inspect
, 17); // getMember invokes the getter
2177 check_equals
(getCalls
, 1);
2178 check_equals
(setCalls
, 0);
2179 mc
.x
= 10; // does NOT set the property, but doesn't call the setter !
2180 check_equals
(getCalls
, 1); // assignment did call the getter
2181 check_equals
(setCalls
, 0);
2182 #ifdef MING_SUPPORTS_ASM
2190 // setMember did NOT set the prop, didn't call the setter
2191 check_equals
(propinspect
, 0);
2192 #endif
//MING_SUPPORTS_ASM
2195 #endif
// OUTPUT_VERSION > 5
2198 //---------------------------------------------------------------------
2199 // Test the MovieClip.loadVariables function
2200 //---------------------------------------------------------------------
2206 note
("onData called, dataLoaded: "+dataLoaded
);
2207 check_equals
(arguments.length
, 0);
2208 #if OUTPUT_VERSION
> 5
2209 check_equals
(_root
.var1
, 'val1');
2211 // leading BOM confuses player 5 (but not gnash)
2212 xcheck_equals
(typeof(_root
.var1
), 'undefined');
2214 check_equals
(_root
.var2
, 'val2');
2215 check_equals
(_root
.var3
, 'val3\n');
2216 delete _root
.var1
; // = 'val1custom';
2217 delete _root
.var2
; // = 'val2custom';
2221 //note("Clearing data load interval "+dataLoadInterval);
2222 clearInterval
(dataLoadInterval
);
2227 // This should use GetURL
2228 loadVariables
(MEDIA
(vars
.txt
), "_root");
2234 ret
= _root
.loadVariables
(MEDIA
(vars
.txt
), "GET");
2235 check_equals
(dataLoaded
, 0);
2236 check_equals
(typeof(ret
), 'undefined');
2238 #if OUTPUT_VERSION
<= 5
2239 // It seems for SWF5 onData isn't invoked,
2240 // neighter does onEnterFrame work..
2241 onDataCheck
= function()
2243 //note("1000 interval called");
2244 if ( _root
.var3
!= undefined ) onData
();
2246 //dataLoadInterval = setInterval(onData, 1000);
2247 dataLoadInterval
= setInterval
(onDataCheck
, 1000);
2251 /// loadVariables always calls MovieClip.meth
2252 backup
= _root
.meth
;
2255 _root
.meth
= function() { mcm
++; };
2256 _root
.loadVariables
("", "", "post");
2257 check_equals
(mcm
, 1);
2258 _root
.loadVariables
("", "");
2259 check_equals
(mcm
, 2);
2260 _root
.loadVariables
("");
2261 check_equals
(mcm
, 3);
2262 _root
.loadVariables
();
2263 check_equals
(mcm
, 4);
2265 _root
.meth
= backup
;
2267 //----------------------------------------------------------
2268 // Test getURL a bit
2269 //----------------------------------------------------------
2271 /// getURL calls MovieClip.meth.
2272 backup
= _root
.meth
;
2275 _root
.meth
= function() { mcm
++; };
2276 _root
.getURL
("", "", "post");
2277 check_equals
(mcm
, 1);
2278 _root
.getURL
("", "");
2279 check_equals
(mcm
, 2);
2281 check_equals
(mcm
, 3);
2283 check_equals
(mcm
, 4);
2285 _root
.meth
= backup
;
2287 //----------------------------------------------------------
2288 // Test loadMovie a bit
2289 //----------------------------------------------------------
2291 #if OUTPUT_VERSION
> 5
2293 mcdump
= _root
.createEmptyMovieClip
("mcdump", getNextHighestDepth
());
2296 mcdump
.meth
= function() { mcm
++; };
2298 mcdump
.loadMovie
(o
, o
, o
);
2299 check_equals
(mcm
, 1);
2300 mcdump
.loadMovie
(o
, o
);
2301 check_equals
(mcm
, 2);
2302 mcdump
.loadMovie
(o
);
2303 check_equals
(mcm
, 3);
2305 check_equals
(mcm
, 4);
2309 /// Depth tests for createEmptyMovieClip, which was introduced
2313 #if OUTPUT_VERSION
> 5
2314 createEmptyMovieClip
("d1", -200000000);
2315 check_equals
(d1
.getDepth
(), -200000000);
2317 createEmptyMovieClip
("d2", -0xffffffff);
2318 check_equals
(d2
.getDepth
(), 1);
2320 createEmptyMovieClip
("d3", 0xffffffff);
2321 check_equals
(d3
.getDepth
(), -1);
2323 createEmptyMovieClip
("d4", 0x80000000);
2324 check_equals
(d4
.getDepth
(), -2147483648);
2326 createEmptyMovieClip
("d5", 0x79999999);
2327 check_equals
(d5
.getDepth
(), 2040109465);
2331 // Test _visible property
2333 #if OUTPUT_VERSION
> 5
2334 vis
= _root
.createEmptyMovieClip
("vis", getNextHighestDepth
());
2335 check_equals
(vis
._visible
, true);
2336 vis
._visible
= false;
2337 check_equals
(vis
._visible
, false);
2339 check_equals
(vis
._visible
, true);
2341 check_equals
(vis
._visible
, false);
2342 vis
._visible
= "true";
2343 check_equals
(vis
._visible
, false);
2344 vis
._visible
= "false";
2345 check_equals
(vis
._visible
, false);
2346 vis
._visible
= "gibberish";
2347 check_equals
(vis
._visible
, false);
2348 vis
._visible
= undefined;
2349 check_equals
(vis
._visible
, false);
2352 check_equals
(_root
.focusEnabled
, undefined);
2353 _root
.focusEnabled
= 5;
2354 check_equals
(_root
.focusEnabled
, 5);
2355 _root
.focusEnabled
= 0;
2356 check_equals
(_root
.focusEnabled
, 0);
2357 _root
.focusEnabled
= true;
2358 check_equals
(_root
.focusEnabled
, true);
2359 _root
.focusEnabled
= false;
2360 check_equals
(_root
.focusEnabled
, false);
2361 _root
.focusEnabled
= "hello";
2362 check_equals
(_root
.focusEnabled
, "hello");
2365 // Note: Flash Player 10 seems to handle this differently: setting the
2366 // blendMode to 2 gets 'multiply' not 'layer'.
2368 #if OUTPUT_VERSION
> 7
2369 check_equals
(_root
.blendMode
, "normal");
2370 check_equals
(typeof(_root
.blendMode
), "string");
2371 _root
.blendMode
= 2;
2372 check_equals
(_root
.blendMode
, "layer");
2373 _root
.blendMode
= "multiply";
2374 check_equals
(_root
.blendMode
, "multiply");
2375 _root
.blendMode
= 0;
2376 check_equals
(_root
.blendMode
, undefined);
2377 _root
.blendMode
= 14;
2378 check_equals
(_root
.blendMode
, "hardlight");
2379 _root
.blendMode
= 15;
2380 check_equals
(_root
.blendMode
, undefined);
2381 _root
.blendMode
= "scre";
2382 check_equals
(_root
.blendMode
, undefined);
2383 _root
.blendMode
= "daRkEn";
2384 check_equals
(_root
.blendMode
, undefined);
2385 _root
.blendMode
= "darken";
2386 check_equals
(_root
.blendMode
, "darken");
2387 _root
.blendMode
= "Some rubbish";
2388 check_equals
(_root
.blendMode
, "darken");
2389 _root
.blendMode
= -1;
2390 check_equals
(_root
.blendMode
, undefined);
2391 _root
.blendMode
= 0xffffffff;
2392 check_equals
(_root
.blendMode
, undefined);
2393 _root
.blendMode
= -0xffffffff;
2394 check_equals
(_root
.blendMode
, undefined);
2395 _root
.blendMode
= 5.5;
2396 check_equals
(_root
.blendMode
, "lighten");
2397 _root
.blendMode
= "NORMAL";
2398 check_equals
(_root
.blendMode
, "lighten");
2399 _root
.blendMode
= undefined;
2400 check_equals
(_root
.blendMode
, "normal");
2402 // Set back to normal so we can see the results...
2403 _root
.blendMode
= "normal";
2404 check_equals
(_root
.blendMode
, "normal");
2408 #if OUTPUT_VERSION
> 5
2410 r
= createEmptyMovieClip
("r", getNextHighestDepth
());
2411 check_equals
(typeof(r
._highquality
), "number");
2412 check_equals
(r
._highquality
, 1);
2414 check_equals
(r
._quality
, "HIGH");
2415 check_equals
(r
._highquality
, 1);
2416 check_equals
(_root
._highquality
, 1);
2419 check_equals
(r
._quality
, "BEST");
2420 check_equals
(r
._highquality
, 2);
2421 check_equals
(_root
._highquality
, 2);
2423 r
._highquality
= "1";
2424 check_equals
(r
._quality
, "HIGH");
2425 check_equals
(r
._highquality
, 1);
2426 check_equals
(_root
._highquality
, 1);
2428 r
._highquality
= false;
2429 check_equals
(r
._quality
, "LOW");
2430 check_equals
(typeof(r
._highquality
), "number");
2431 check_equals
(r
._highquality
, 0);
2432 check_equals
(_root
._highquality
, 0);
2435 check_equals
(r
._quality
, "LOW");
2436 check_equals
(typeof(r
._highquality
), "number");
2437 check_equals
(r
._highquality
, 0);
2438 check_equals
(_root
._highquality
, 0);
2440 r
._highquality
= -1;
2441 check_equals
(r
._quality
, "HIGH");
2442 check_equals
(typeof(r
._highquality
), "number");
2443 check_equals
(r
._highquality
, 1);
2444 check_equals
(_root
._highquality
, 1);
2446 r
._highquality
= -2;
2447 check_equals
(r
._quality
, "HIGH");
2448 check_equals
(typeof(r
._highquality
), "number");
2449 check_equals
(r
._highquality
, 1);
2450 check_equals
(_root
._highquality
, 1);
2452 /// Test setting _quality
2454 r
._quality
= "MEDIUM";
2455 check_equals
(r
._quality
, "MEDIUM");
2456 check_equals
(typeof(r
._quality
), "string");
2457 check_equals
(r
._highquality
, 0);
2458 check_equals
(_root
._highquality
, 0);
2460 r
._quality
= "HIGH";
2461 check_equals
(r
._quality
, "HIGH");
2462 check_equals
(typeof(r
._quality
), "string");
2463 check_equals
(r
._highquality
, 1);
2464 check_equals
(_root
._highquality
, 1);
2466 r
._quality
= "BEST";
2467 check_equals
(r
._quality
, "BEST");
2468 check_equals
(typeof(r
._quality
), "string");
2469 check_equals
(r
._highquality
, 2);
2470 check_equals
(_root
._highquality
, 2);
2473 check_equals
(r
._quality
, "BEST");
2474 check_equals
(typeof(r
._quality
), "string");
2475 check_equals
(r
._highquality
, 2);
2476 check_equals
(_root
._highquality
, 2);
2479 check_equals
(r
._quality
, "BEST");
2480 check_equals
(typeof(r
._quality
), "string");
2481 check_equals
(r
._highquality
, 2);
2482 check_equals
(_root
._highquality
, 2);
2485 check_equals
(r
._quality
, "LOW");
2486 check_equals
(typeof(r
._quality
), "string");
2487 check_equals
(r
._highquality
, 0);
2488 check_equals
(_root
._highquality
, 0);
2490 r
._quality
= "high";
2491 check_equals
(r
._quality
, "HIGH");
2492 check_equals
(typeof(r
._quality
), "string");
2493 check_equals
(r
._highquality
, 1);
2494 check_equals
(_root
._highquality
, 1);
2497 // Check the old toggle quality action
2498 check_equals
(_root
._quality
, "HIGH");
2501 check_equals
(_root
._quality
, "LOW");
2504 check_equals
(_root
._quality
, "HIGH");
2506 _root
._quality
= "medium";
2507 check_equals
(_root
._quality
, "MEDIUM");
2510 check_equals
(_root
._quality
, "HIGH");
2512 _root
._quality
= "medium";
2513 check_equals
(_root
._quality
, "MEDIUM");
2516 check_equals
(_root
._quality
, "HIGH");
2519 check_equals
(_root
._quality
, "LOW");
2522 check_equals
(_root
._quality
, "HIGH");
2524 //_root.loadVariables(MEDIA(vars.txt), "GET");
2527 // Can't rely on this to call onData!
2529 //------------------------------------------
2530 // Check MovieClip methods on other objects.
2531 //------------------------------------------
2537 check_equals
(_root
.getSWFVersion
(), OUTPUT_VERSION
);
2538 o
.getSWFVersion
= MovieClip.prototype
.getSWFVersion
;
2539 check_equals
(o
.getSWFVersion
(), -1);
2540 createTextField
("t1", 3, 0, 100, 100, 100);
2541 #if OUTPUT_VERSION
> 5
2542 check_equals
(_level0
.t1
.getSWFVersion
(), undefined);
2543 check_equals
(_level0
.t1
.toString
(), "[object Object]");
2545 xcheck_equals
(_level0
.t1
.getSWFVersion
(), OUTPUT_VERSION
);
2546 xcheck_equals
(_level0
.t1
.toString
(), "[object Object]");
2548 _level0
.t1
.getSWFVersion
= MovieClip.prototype
.getSWFVersion
;
2549 check_equals
(_level0
.t1
.getSWFVersion
(), OUTPUT_VERSION
);
2551 o
.meth
= MovieClip.prototype
.meth
;
2552 check_equals
(o
.meth
("post"), 2);
2553 check_equals
(o
.meth
(), 0);
2555 // Check that MovieClip data is separate from Relay data.
2557 #if OUTPUT_VERSION
> 5
2559 // Run the Date constructor
2560 dc
= function(const) {
2561 this.__proto__
.__constructor__
= const;
2565 createEmptyMovieClip
("mc", 3);
2566 mc
.lineStyle
(2, 0, 100);
2567 mc
.lineTo
(100, 100);
2569 o
.getTime
= Date.prototype
.getTime
;
2570 mc
.getTime
= Date.prototype
.getTime
;
2578 check_equals
(typeof(o
.getTime
()), "number");
2580 // mc is now a Date.
2581 check_equals
(typeof(mc
.getTime
()), "number");
2583 mc
.lineStyle
(2, 0xff, 100);
2586 // But it is still a MovieClip.
2587 check_equals
(mc
._x
, 17);
2589 mc
.toString
= Boolean.prototype
.toString
;
2590 check_equals
(mc
.toString
(), undefined);
2594 // mc is now a Boolean
2595 check_equals
(typeof(mc
.getTime
()), "undefined");
2596 check_equals
(mc
.toString
(), "false");
2598 // But it is still a MovieClip
2599 check_equals
(mc
._x
, 17);