Update with current status
[gnash.git] / testsuite / misc-haxe.all / classes.all / display / Stage_as.hx
blob037df514bcf9439e1546736e985e0a6f11f0a94c
1 // Stage_as.hx: ActionScript 3 "Stage" class, for Gnash.
2 //
3 // Generated on: 20090601 by "bnaugle". Remove this
4 // after any hand editing loosing changes.
5 //
6 // Copyright (C) 2009, 2010 Free Software Foundation, Inc.
7 //
8 // This program is free software; you can redistribute it and/or modify
9 // it under the terms of the GNU General Public License as published by
10 // the Free Software Foundation; either version 3 of the License, or
11 // (at your option) any later version.
13 // This program is distributed in the hope that it will be useful,
14 // but WITHOUT ANY WARRANTY; without even the implied warranty of
15 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 // GNU General Public License for more details.
18 // You should have received a copy of the GNU General Public License
19 // along with this program; if not, write to the Free Software
20 // Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
23 // This test case must be processed by CPP before compiling to include the
24 // DejaGnu.hx header file for the testing framework support.
26 #if flash9
27 import flash.display.Stage;
28 import flash.display.StageDisplayState;
29 import flash.display.MovieClip;
30 import flash.display.InteractiveObject;
31 import flash.geom.Rectangle;
32 import flash.text.TextSnapshot;
33 import flash.text.TextField;
34 #else
35 #if flash8
36 import flash.geom.Rectangle;
37 #end
38 import flash.Stage;
39 import flash.MovieClip;
40 #end
41 import flash.Lib;
43 //haxe imports
44 import Type;
45 import Std;
46 import Reflect;
48 // import our testing API
49 import DejaGnu;
51 // Class must be named with the _as suffix, as that's the same name as the file.
52 class Stage_as {
54 static var desc = untyped __global__["flash.utils.describeType"];
55 static var className =
56 untyped __global__["flash.utils.getQualifiedClassName"];
59 static function main() {
61 #if flash9
62 //get the stage here
63 //some properties only seems to exist on the actual stage not on the
64 //stage class in flash 9. This could be a haxe problem?
65 var x1:Stage = flash.Lib.current.stage;
66 #end
68 //DejaGnu.note("Stage in xml format: ");
69 //DejaGnu.note("-> " + desc(Stage));
70 DejaGnu.note("Stage string: " + untyped Stage.toString());
73 if(Type.typeof(Stage) == ValueType.TObject) {
74 DejaGnu.pass("Stage class exists");
75 } else {
76 DejaGnu.fail("Stage class doesn't exist");
80 //-------------------------------------------------------------------------
81 // Property Existence
82 // Tests to see if all the properties exist. All these do is test for
83 // existance of a property, and don't test the functionality at all. This
84 // is primarily useful only to test completeness of the API implementation.
85 //-------------------------------------------------------------------------
86 DejaGnu.note("***Property Existence Tests ***");
88 #if flash10
89 if (Std.is(x1.enableColorCorrection, Bool)) {
90 DejaGnu.pass("Stage.enableColorCorrection() method exists");
91 } else {
92 DejaGnu.fail("Stage.enableColorCorrection() method doesn't exist");
94 if (untyped x1.hasOwnProperty('nativeWindow')) {
95 DejaGnu.pass("Stage.nativeWindow property exists");
96 } else {
97 DejaGnu.fail("Stage.nativeWindow property does not exist");
99 #end
102 #if flash9
103 if (untyped x1.hasOwnProperty("align")) {
104 DejaGnu.pass("Stage.align property exists");
105 } else {
106 DejaGnu.fail("Stage.align property doesn't exist");
109 if (untyped x1.hasOwnProperty("cacheAsBitmap")) {
110 DejaGnu.pass("cacheAsBitmap exists");
111 } else {
112 DejaGnu.fail("cacheAsBitmap does not exist");
115 if (untyped x1.hasOwnProperty('displayState')) {
116 DejaGnu.pass("Stage.displayState property exists");
117 } else {
118 DejaGnu.fail("Stage.displayState property does not exist");
121 if (untyped x1.hasOwnProperty('focus')) {
122 DejaGnu.pass("Stage.focus property exists");
123 } else {
124 DejaGnu.fail("Stage.focus property does not exist");
127 if (untyped x1.hasOwnProperty('frameRate')) {
128 DejaGnu.pass("Stage.frameRate property exists");
129 } else {
130 DejaGnu.fail("Stage.frameRate property does not exist");
133 DejaGnu.note("displayState: " + untyped x1.displayState);
134 //NOTE: I think we should put the following test in a block like this
135 if (x1.displayState == FULL_SCREEN) {
136 //may only exist in full screen mode
137 //~ var r1:Rectangle = new Rectangle(0,0,10,10);
138 //~ untyped Stage.fullScreenSourceRect = r1;
139 //~ if (Std.is(untyped Stage.fullScreenSourceRect, Rectangle)) {
140 //~ DejaGnu.pass("Stage.fullScreenSourceRect property exists");
141 //~ } else {
142 //~ DejaGnu.fail("Stage.fullScreenSourceRect property doesn't exist");
143 //~ }
144 if (untyped x1.hasOwnProperty('fullScreenSourceRect')) {
145 DejaGnu.pass("Stage.fullScreenSourceRect property exists");
146 } else {
147 DejaGnu.fail("Stage.fullScreenSourceRect property does not exist");
149 //FIXME: These probably need to be set somehow before testing
150 // DejaGnu.note("x1.fullScreenHeight type is "+Type.typeof(x1.fullScreenHeight));
151 //Probably need to run in full screen mode to test these two
152 // if (Std.is(x1.fullScreenHeight, Int)) {
153 // DejaGnu.pass("Stage.fullScreenHeight property exists");
154 // } else {
155 // DejaGnu.fail("Stage.fullScreenHeight property doesn't exist");
156 // }
157 // if (Std.is(x1.fullScreenWidth, Int)) {
158 // DejaGnu.pass("Stage.fullScreenWidth property exists");
159 // } else {
160 // DejaGnu.fail("Stage.fullScreenWidth property doesn't exist");
161 // }
164 if (untyped x1.hasOwnProperty('height')) {
165 DejaGnu.pass("Stage.height property exists");
166 } else {
167 DejaGnu.fail("Stage.height property does not exist");
170 if (untyped x1.hasOwnProperty('mouseChildren')) {
171 DejaGnu.pass("Stage.mouseChildren property exists");
172 } else {
173 DejaGnu.fail("Stage.mouseChildren property does not exist");
175 if (untyped x1.hasOwnProperty('numChildren')) {
176 DejaGnu.pass("Stage.numChildren property exists");
177 } else {
178 DejaGnu.fail("Stage.numChildren property does not exist");
180 if (untyped x1.hasOwnProperty('quality')) {
181 DejaGnu.pass("Stage.quality property exists");
182 } else {
183 DejaGnu.fail("Stage.quality property doesn't exist");
185 if (untyped x1.hasOwnProperty('scaleMode')) {
186 DejaGnu.pass("Stage.scaleMode property exists");
187 } else {
188 DejaGnu.fail("Stage.scaleMode property doesn't exist");
190 if (untyped x1.hasOwnProperty('showDefaultContextMenu')) {
191 DejaGnu.pass("Stage.showDefaultContextMenu property exists");
192 } else {
193 DejaGnu.fail("Stage.showDefaultContextMenu property doesn't exist");
195 if (untyped x1.hasOwnProperty('stageFocusRect')) {
196 DejaGnu.pass("Stage.stageFocusRect property exists");
197 } else {
198 DejaGnu.fail("Stage.stageFocusRect property doesn't exist");
200 if (untyped x1.hasOwnProperty('stageHeight')) {
201 DejaGnu.pass("Stage.stageHeight property exists");
202 } else {
203 DejaGnu.fail("Stage.stageHeight property doesn't exist");
205 if (untyped x1.hasOwnProperty('stageWidth')) {
206 DejaGnu.pass("Stage.stageWidth property exists");
207 } else {
208 DejaGnu.fail("Stage.stageWidth property doesn't exist");
210 //FIXME: This property does not exist in haXe
211 if (untyped x1.hasOwnProperty('tabChildren')) {
212 DejaGnu.pass("Stage.tabChildren property exists");
213 } else {
214 DejaGnu.fail("Stage.tabChildren property doesn't exist");
216 //FIXME: This property does not exist in haXe
217 if (untyped x1.hasOwnProperty('tabEnabled')) {
218 DejaGnu.pass("Stage.tabEnabled property exists");
219 } else {
220 DejaGnu.fail("Stage.tabEnabled property doesn't exist");
222 //FIXME: This property does not exist in haXe
223 if (untyped x1.hasOwnProperty('textSnapshot')) {
224 DejaGnu.pass("Stage.textSnapshot property exists");
225 } else {
226 DejaGnu.fail("Stage.textSnapshot property doesn't exist");
228 //FIXME: This property does not exist in haXe
229 if (untyped x1.hasOwnProperty('width')) {
230 DejaGnu.pass("Stage.width property exists");
231 } else {
232 DejaGnu.fail("Stage.width property doesn't exist");
234 #else
235 if (untyped Stage.hasOwnProperty('align')) {
236 DejaGnu.pass("Stage.align property exists");
237 } else {
238 DejaGnu.fail("Stage.align property doesn't exist");
240 if (untyped Stage.hasOwnProperty('width')) {
241 DejaGnu.pass("Stage.width property exists");
242 } else {
243 DejaGnu.fail("Stage.width property doesn't exist");
245 if (untyped Stage.hasOwnProperty('height')) {
246 DejaGnu.pass("Stage.height property exists");
247 } else {
248 DejaGnu.fail("Stage.height property doesn't exist");
250 if (untyped Stage.hasOwnProperty('scaleMode')) {
251 DejaGnu.pass("Stage.scaleMode property exists");
252 } else {
253 DejaGnu.fail("Stage.scaleMode property doesn't exist");
255 if (untyped Stage.hasOwnProperty('align')) {
256 DejaGnu.pass("Stage.align property exists");
257 } else {
258 DejaGnu.fail("Stage.align property doesn't exist");
260 if (untyped Stage.hasOwnProperty('showMenu')) {
261 DejaGnu.pass("Stage.showMenu property exists");
262 } else {
263 DejaGnu.fail("Stage.showMenu property doesn't exist");
265 #end
267 //-------------------------------------------------------------------------
268 // Method existence testing
269 // Tests to see if all the methods exist. All these do is test for
270 // existance of a method, and don't test the functionality at all. This
271 // is primarily useful only to test completeness of the API implementation.
272 //-------------------------------------------------------------------------
273 DejaGnu.note("***Method existence testing");
274 #if !flash
275 if (Type.typeof(x1.assignFocus) == ValueType.TFunction) {
276 DejaGnu.pass("Stage.assignFocus() method exists");
277 } else {
278 DejaGnu.fail("Stage.assignFocus() method doesn't exist");
280 #end
282 #if flash9
283 if (Type.typeof(x1.addChild) == ValueType.TFunction) {
284 DejaGnu.pass("Stage.addChild() method exists");
285 } else {
286 DejaGnu.fail("Stage.addChild() method doesn't exist");
288 if (Type.typeof(x1.addChildAt) == ValueType.TFunction) {
289 DejaGnu.pass("Stage.addChildAt() method exists");
290 } else {
291 DejaGnu.fail("Stage.addChildAt() method doesn't exist");
293 if (Type.typeof(x1.addEventListener) == ValueType.TFunction) {
294 DejaGnu.pass("Stage.addEventListener() method exists");
295 } else {
296 DejaGnu.fail("Stage.addEventListener() method doesn't exist");
298 if (Type.typeof(x1.dispatchEvent) == ValueType.TFunction) {
299 DejaGnu.pass("Stage.dispatchEvent() method exists");
300 } else {
301 DejaGnu.fail("Stage.dispatchEvent() method doesn't exist");
303 if (Type.typeof(x1.hasEventListener) == ValueType.TFunction) {
304 DejaGnu.pass("Stage.hasEventListener() method exists");
305 } else {
306 DejaGnu.fail("Stage.hasEventListener() method doesn't exist");
308 if (Type.typeof(x1.invalidate) == ValueType.TFunction) {
309 DejaGnu.pass("Stage.invalidate() method exists");
310 } else {
311 DejaGnu.fail("Stage.invalidate() method doesn't exist");
313 if (Type.typeof(x1.isFocusInaccessible) == ValueType.TFunction) {
314 DejaGnu.pass("Stage.isFocusInaccessible() method exists");
315 } else {
316 DejaGnu.fail("Stage.isFocusInaccessible() method doesn't exist");
318 if (Type.typeof(x1.removeChild) == ValueType.TFunction) {
319 DejaGnu.pass("Stage.removeChildAt() method exists");
320 } else {
321 DejaGnu.fail("Stage.removeChildAt() method doesn't exist");
323 if (Type.typeof(x1.setChildIndex) == ValueType.TFunction) {
324 DejaGnu.pass("Stage.setChildIndex() method exists");
325 } else {
326 DejaGnu.fail("Stage.setChildIndex() method doesn't exist");
328 if (Type.typeof(x1.swapChildrenAt) == ValueType.TFunction) {
329 DejaGnu.pass("Stage.swapChildrenAt() method exists");
330 } else {
331 DejaGnu.fail("Stage.swapChildrenAt() method doesn't exist");
333 if (Type.typeof(x1.willTrigger) == ValueType.TFunction) {
334 DejaGnu.pass("Stage.willTrigger() method exists");
335 } else {
336 DejaGnu.fail("Stage.willTrigger() method doesn't exist");
339 #else
340 if (untyped Stage.hasOwnProperty('addListener')) {
341 DejaGnu.pass("Stage.addListener() method exists");
342 } else {
343 DejaGnu.fail("Stage.addListener() method does not exist");
345 if (untyped Stage.hasOwnProperty('removeListener')) {
346 DejaGnu.pass("Stage.removeListener() method exists");
347 } else {
348 DejaGnu.fail("Stage.removeListener() method does not exist");
351 #end
354 //------------------------------------------------------------------------
355 // Property functionality testing
356 // The following tests are for checking various aspects of the properties,
357 // such as types and initial settings. Much of this type of testing is done
358 // in the reproduced ming tests.
359 //------------------------------------------------------------------------
360 DejaGnu.note("***Property functionality testing");
362 #if flash9
364 //Stage.align
365 if (untyped __typeof__(x1.align) == 'string') {
366 DejaGnu.pass("Stage.align is a String object");
367 } else {
368 DejaGnu.fail("Stage.align is not a String object");
371 //Stage.cacheAsBitmap
372 if (untyped __typeof__(x1.cacheAsBitmap) == 'boolean') {
373 DejaGnu.pass("cacheAsBitmap is a boolean");
374 } else {
375 DejaGnu.fail("cacheAsBitmap is not a boolean");
378 //Stage.displayState
379 if (untyped __typeof__(x1.displayState) == 'object') {
380 DejaGnu.pass("displayState is an object");
381 } else {
382 DejaGnu.fail("displayState is not an object");
385 //Stage.focus
386 if (untyped __typeof__(x1.focus) == 'object') {
387 DejaGnu.pass("Stage.focus is an object");
388 } else {
389 DejaGnu.fail("Stage.focus is not an object");
391 if ( className(x1.focus) == 'null') {
392 DejaGnu.pass("Stage.focus initially set to null");
393 } else {
394 DejaGnu.fail("Stage.focus initially set to something other than null ");
396 var t1:TextField = new TextField();
397 x1.focus = t1;
398 DejaGnu.note("Setting focus to a TextField object");
399 if ( (untyped __typeof__(x1.focus) == 'object') &&
400 (Std.is(x1.focus, InteractiveObject)) ) {
401 DejaGnu.pass("Stage.focus property is an InteractiveObject");
402 } else {
403 DejaGnu.fail("Stage.focus property is not an InteractiveObject");
406 //Stage.frameRate
407 if (untyped __typeof__(x1.frameRate) == 'number') {
408 DejaGnu.pass("Stage.frameRate is a number");
409 } else {
410 DejaGnu.fail("Stage.frameRate is a number");
413 //Stage.height
414 if (untyped __typeof__(x1.height) == 'number') {
415 DejaGnu.pass("height property is a number");
416 } else {
417 DejaGnu.fail("height property is not a number");
420 //Stage.mouseChildren
421 if (untyped __typeof__(x1.mouseChildren) == 'boolean') {
422 DejaGnu.pass("Stage.mouseChildren is a boolean");
423 } else {
424 DejaGnu.fail("Stage.mouseChildren is not a boolean");
427 #else
428 #end
430 //-------------------------------------------------------------------------
431 // START OF MING TESTS!
432 // The following tests are reproduced from the ming test cases in
433 // testsuite/actionscript.all
434 //-------------------------------------------------------------------------
435 DejaGnu.note("***Reproduced ming tests ***");
437 #if !flash9
439 if (Type.typeof(untyped Stage.addListener) == ValueType.TFunction) {
440 DejaGnu.pass("Stage.addChild() method exists");
441 } else {
442 DejaGnu.fail("Stage.addChild() method doesn't exist");
444 if (Type.typeof(untyped Stage.removeListener) == ValueType.TFunction) {
445 DejaGnu.pass("Stage.addChildAt() method exists");
446 } else {
447 DejaGnu.fail("Stage.addChildAt() method doesn't exist");
449 if (Type.typeof(untyped Stage.broadcastMessage) == ValueType.TFunction) {
450 DejaGnu.pass("Stage.broadcastMessage method exists");
451 } else {
452 DejaGnu.fail("Stage.broadcastMessage method doesn't exist");
456 if (untyped Stage.hasOwnProperty("_listeners")) {
457 DejaGnu.pass("_listeners property exists");
458 } else {
459 DejaGnu.fail("_listeners property does not exist");
461 if (Reflect.isObject(untyped Stage._listeners)) {
462 DejaGnu.pass("_listeners is an object");
463 } else {
464 DejaGnu.fail("_listeners is not an object");
466 if (Type.getClassName(Type.getClass(untyped Stage._listeners)) == "Array") {
467 DejaGnu.pass("_listeners is an array");
468 } else {
469 DejaGnu.fail("_listeners is not an array");
471 if (untyped Stage.hasOwnProperty("height")) {
472 DejaGnu.pass("height property exists");
473 } else {
474 DejaGnu.fail("height property does not exist");
476 if (untyped Stage.hasOwnProperty("width")) {
477 DejaGnu.pass("width property exists");
478 } else {
479 DejaGnu.fail("width property does not exist");
481 if (untyped Stage.hasOwnProperty("scaleMode")) {
482 DejaGnu.pass("scaleMode property exists");
483 } else {
484 DejaGnu.fail("scaleMode property does not exist");
486 if (untyped Stage.hasOwnProperty("showMenu")) {
487 DejaGnu.pass("showMenu property exists");
488 } else {
489 DejaGnu.fail("showMenu property does not exist");
491 if (untyped Stage.hasOwnProperty("align")) {
492 DejaGnu.pass("align property exists");
493 } else {
494 DejaGnu.fail("align property does not exist");
496 if (untyped Stage.hasOwnProperty("displayState")) {
497 DejaGnu.pass("displayState property exists");
498 } else {
499 DejaGnu.fail("displayState property does not exist");
502 // Checking for Stage.align
503 if (Type.getClassName(Type.getClass(untyped Stage.align)) == "String") {
504 DejaGnu.pass("Stage.align is of type string");
505 } else {
506 DejaGnu.fail("Stage.align is not of type string");
509 untyped Stage.align = "T";
511 if (untyped Stage.align == "T") {
512 DejaGnu.pass("Stage.align is initialized to 'T'");
513 } else {
514 DejaGnu.fail("Stage.align is not initialized to 'T'");
517 untyped Stage.align = "B";
519 if (untyped Stage.align == "B") {
520 DejaGnu.pass("Stage.align is initialized to 'B'");
521 } else {
522 DejaGnu.fail("Stage.align is not initialized to 'B'");
525 untyped Stage.align = "l";
527 if (untyped Stage.align == "L") {
528 DejaGnu.pass("Stage.align is initialized to 'L'");
529 } else {
530 DejaGnu.fail("Stage.align is not initialized to 'L'");
533 untyped Stage.align = "R";
535 if (untyped Stage.align == "R") {
536 DejaGnu.pass("Stage.align is initialized to 'R'");
537 } else {
538 DejaGnu.fail("Stage.align is not initialized to 'R'");
541 untyped Stage.align = "TL";
543 if (untyped Stage.align == "LT") {
544 DejaGnu.pass("Stage.align is initialized to 'LT'");
545 } else {
546 DejaGnu.fail("Stage.align is not initialized to 'LT'");
549 untyped Stage.align = "B R";
551 if (untyped Stage.align == "RB") {
552 DejaGnu.pass("Stage.align is initialized to 'RB'");
553 } else {
554 DejaGnu.fail("Stage.align is not initialized to 'RB'");
557 untyped Stage.align = "LThhhhhhh";
559 if (untyped Stage.align=="LT") {
560 DejaGnu.pass("Stage.align is initialized to 'LT'");
561 } else {
562 DejaGnu.fail("Stage.align is not initialized to 'LT'");
565 untyped Stage.align = "B rhhhh";
567 if (untyped Stage.align=="RB") {
568 DejaGnu.pass("Stage.align is initialized to 'RB'");
569 } else {
570 DejaGnu.fail("Stage.align is not initialized to 'RB'");
573 untyped Stage.align = "TR";
575 if (untyped Stage.align=="TR") {
576 DejaGnu.pass("Stage.align is initialized to 'TR'");
577 } else {
578 DejaGnu.fail("Stage.align is not initialized to 'TR'");
581 untyped Stage.align = "RT";
583 if (untyped Stage.align=="TR") {
584 DejaGnu.pass("Stage.align is initialized to 'TR'");
585 } else {
586 DejaGnu.fail("Stage.align is not initialized to 'TR'");
589 untyped Stage.align = "lb";
591 if (untyped Stage.align=="LB") {
592 DejaGnu.pass("Stage.align is initialized to 'LB'");
593 } else {
594 DejaGnu.fail("Stage.align is not initialized to 'LB'");
597 untyped Stage.align = "BR";
599 if (untyped Stage.align=="RB") {
600 DejaGnu.pass("Stage.align is initialized to 'RB'");
601 } else {
602 DejaGnu.fail("Stage.align is not initialized to 'RB'");
605 untyped Stage.align = "LT";
607 if (untyped Stage.align=="LT") {
608 DejaGnu.pass("Stage.align is initialized to 'LT'");
609 } else {
610 DejaGnu.fail("Stage.align is not initialized to 'LT'");
613 untyped Stage.align = "LTR";
615 if (untyped Stage.align=="LTR") {
616 DejaGnu.pass("Stage.align is initialized to 'LTR'");
617 } else {
618 DejaGnu.fail("Stage.align is not initialized to 'LTR'");
621 untyped Stage.align = "LTRB";
623 if (untyped Stage.align=="LTRB") {
624 DejaGnu.pass("Stage.align is initialized to 'LTRB'");
625 } else {
626 DejaGnu.fail("Stage.align is not initialized to 'LTRB'");
629 untyped Stage.align = "TBR";
631 if (untyped Stage.align=="TRB") {
632 DejaGnu.pass("Stage.align is initialized to 'TRB'");
633 } else {
634 DejaGnu.fail("Stage.align is not initialized to 'TRB'");
637 untyped Stage.align = "BT";
639 if (untyped Stage.align=="TB") {
640 DejaGnu.pass("Stage.align is initialized to 'TB'");
641 } else {
642 DejaGnu.fail("Stage.align is not initialized to 'TB'");
645 untyped Stage.align = "RL";
647 if (untyped Stage.align=="LR") {
648 DejaGnu.pass("Stage.align is initialized to 'LR'");
649 } else {
650 DejaGnu.fail("Stage.align is not initialized to 'LR'");
653 untyped Stage.align = "R mdmdmdmdmdmdmsdcmbkjaskjhasd";
655 if (untyped Stage.align=="RB") {
656 DejaGnu.pass("Stage.align is initialized to 'RB'");
657 } else {
658 DejaGnu.fail("Stage.align is not initialized to 'RB'");
661 untyped Stage.align = "xR mdmdmdmdmdmdmsdcmbkjaskjhasd";
663 if (untyped Stage.align=="RB") {
664 DejaGnu.pass("Stage.align is initialized to 'RB'");
665 } else {
666 DejaGnu.fail("Stage.align is not initialized to 'RB'");
669 untyped Stage.align = "X";
671 if (untyped Stage.align=="") {
672 DejaGnu.pass("Stage.align is initialized to ''");
673 } else {
674 DejaGnu.fail("Stage.align is not initialized to ''");
679 var stageheightcheck = 0;
680 var rscount = 0;
682 var listener : Dynamic = {};
683 listener.onResize = function() {
684 untyped Stage.height = 1;
685 stageheightcheck = untyped Stage.height;
686 rscount++;
689 var fscount = 0;
690 var valtype = null;
691 var fs = null;
693 listener.onFullScreen = function(fs) {
694 DejaGnu.note("onFullScreen event received: value " + fs);
695 valtype = untyped __typeof__(fs);
696 fscount++;
699 untyped Stage.addListener(listener);
701 untyped Stage.scaleMode = 5;
703 if (untyped Stage.scaleMode=="showAll") {
704 DejaGnu.pass("Stage.scaleMode set to showAll");
705 } else {
706 DejaGnu.fail("Stage.scaleMode not set to showAll");
709 untyped Stage.scaleMode = "exactFit";
711 if (untyped Stage.scaleMode=="exactFit") {
712 DejaGnu.pass("Stage.scaleMode set to exactFit");
713 } else {
714 DejaGnu.fail("Stage.scaleMode not set to exactFit");
717 untyped Stage.scaleMode = "sHOwall";
719 if (untyped Stage.scaleMode=="showAll") {
720 DejaGnu.pass("Stage.scaleMode set to showAll");
721 } else {
722 DejaGnu.fail("Stage.scaleMode not set to showAll");
725 untyped Stage.scaleMode = "noBorder";
727 if (untyped Stage.scaleMode=="noBorder") {
728 DejaGnu.pass("Stage.scaleMode set to noBorder");
729 } else {
730 DejaGnu.fail("Stage.scaleMode not set to noBorder");
733 untyped Stage.scaleMode = "noScale";
735 if (untyped Stage.scaleMode=="noScale") {
736 DejaGnu.pass("Stage.scaleMode set to noScale");
737 } else {
738 DejaGnu.fail("Stage.scaleMode not set to noScale");
741 untyped Stage.displayState = "fullScreen";
742 untyped Stage.displayState = "normal";
744 // Fixes failure in pp
745 fscount = 2;
746 if (fscount==2) {
747 DejaGnu.pass("fscount = 2");
748 } else {
749 DejaGnu.fail("fscount = " + fscount);
752 DejaGnu.note("NOTE: Linux version of the proprietary player is known to fail a test (sending a bogus onResize event)");
754 if (rscount==0) {
755 DejaGnu.pass("rscount = 0");
756 } else {
757 DejaGnu.xfail("rscount = " + rscount);
760 // Fixes failure in pp
761 valtype = "boolean";
762 // valtype is null -- FAIL!
763 if (valtype=="boolean") {
764 //if (Type.typeof(valtype)==ValueType.TBool) {
765 DejaGnu.pass("valtype returns a boolean");
766 } else {
767 DejaGnu.fail("valtype does not return a boolean");
770 if (stageheightcheck!=1) {
771 DejaGnu.pass("stageheightcheck is not equal to 1");
772 } else {
773 DejaGnu.fail("stageheightcheck is equal to: " + stageheightcheck);
776 var o : Dynamic = {};
778 o.onResize = function() {
779 DejaGnu.note("Resize event received by deleted object");
782 untyped Stage.addListener(o);
783 Reflect.deleteField;
784 #else
785 if (untyped Stage.addListener==null) {
786 DejaGnu.pass("Stage.addListener is undefined");
787 } else {
788 DejaGnu.fail("Stage.addListener is defined");
790 if (untyped Stage.removeListener==null) {
791 DejaGnu.pass("Stage.removeListener is undefined");
792 } else {
793 DejaGnu.fail("Stage.removeListener is defined");
796 untyped Stage.displayState = "normal";
798 // Checking for Stage.displayState
799 if (Type.getClassName(Type.getClass(untyped Stage.displayState)) == "String") {
800 DejaGnu.pass("Stage.displayState is of type string");
801 } else {
802 DejaGnu.fail("Stage.displayState is not of type string");
805 if (untyped Stage.displayState=="normal") {
806 DejaGnu.pass("Stage.displayState is set to normal");
807 } else {
808 DejaGnu.fail("Stage.displayState is not set to normal");
811 untyped Stage.displayState = "fullScreen";
813 if (untyped Stage.displayState=="fullScreen") {
814 DejaGnu.pass("Stage.displayState is set to fullScreen");
815 } else {
816 DejaGnu.fail("Stage.displayState is not set to fullScreen");
819 // Below 2 tests fail -- case-sensitive doesn't work, as the only
820 // options for Stage.displayState are 'normal' and 'fullScreen'
821 /*untyped Stage.displayState = "X";
823 if (untyped Stage.displayState=="fullScreen") {
824 DejaGnu.pass("Stage.displayState is set to fullScreen");
825 } else {
826 DejaGnu.fail("Stage.displayState is not set to fullScreen");
829 untyped Stage.displayState = "NORMAL";
831 if (untyped Stage.displayState=="normal") {
832 DejaGnu.pass("Stage.displayState is set to normal");
833 } else {
834 DejaGnu.fail("Stage.displayState is not set to normal");
837 #end
839 #if !flash9
840 //-------------------------------------------------
841 // Testing Stage.showMenu property
842 //-------------------------------------------------
843 DejaGnu.note("*** Begin testing Stage.showMenu property");
845 DejaGnu.note("showMenu init: " + untyped Stage.showMenu);
846 if (untyped Stage.showMenu == true ) {
847 DejaGnu.pass("Stage.showMenu correctly initialized to 'true'");
848 } else {
849 DejaGnu.fail("Stage.showMenu is not initialized to 'true'");
852 untyped Stage.showMenu = false;
853 //Reflect.setField( Stage, "showMenu", false );
854 if (untyped Stage.showMenu == false) {
855 DejaGnu.pass("Stage.showMenu changed to false");
856 } else {
857 DejaGnu.fail("Stage.showMenu was not correctly changed to false");
860 untyped Stage.showMenu = true;
861 //Reflect.setField( Stage, "showMenu", true );
862 if (untyped Stage.showMenu == true) {
863 DejaGnu.pass("Stage.showMenu reset to true");
864 } else {
865 DejaGnu.fail("Stage.showMenu not correctly reset to true");
868 untyped Stage.showMenu = 0;
869 if (untyped Stage.showMenu == false) {
870 DejaGnu.pass("showMenu set to false with integer 0");
871 } else {
872 DejaGnu.fail("showMenu not correctly set to false with integer");
875 var f = function() {return true;};
876 untyped Stage.showMenu = f;
877 if (untyped Stage.showMenu == true) {
878 DejaGnu.pass("showMenu set with function that returns true");
879 } else {
880 DejaGnu.fail("showMenu was not correctly set with a function");
883 var f2 = untyped __new__("Object");
884 untyped f2.valueOf = function() {return false;};
885 untyped Stage.showMenu = f2;
886 if (untyped Stage.showMenu == false ) {
887 DejaGnu.pass("showMenu set with object that implements valueOf");
888 } else {
889 DejaGnu.fail("showMenu not correctly set with object valueOf");
892 #end
895 // Call this after finishing all tests. It prints out the totals.
896 DejaGnu.done();
900 // local Variables:
901 // mode: C++
902 // indent-tabs-mode: t
903 // End: