1 // Stage_as.hx: ActionScript 3 "Stage" class, for Gnash.
3 // Generated on: 20090601 by "bnaugle". Remove this
4 // after any hand editing loosing changes.
6 // Copyright (C) 2009, 2010 Free Software Foundation, Inc.
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.
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
;
36 import flash
.geom
.Rectangle
;
39 import flash
.MovieClip
;
48 // import our testing API
51 // Class must be named with the _as suffix, as that's the same name as the file.
54 static var desc
= untyped __global__
["flash.utils.describeType"];
55 static var className
=
56 untyped __global__
["flash.utils.getQualifiedClassName"];
59 static function main() {
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
;
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");
76 DejaGnu
.fail("Stage class doesn't exist");
80 //-------------------------------------------------------------------------
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 ***");
89 if (Std
.is(x1
.enableColorCorrection
, Bool)) {
90 DejaGnu
.pass("Stage.enableColorCorrection() method exists");
92 DejaGnu
.fail("Stage.enableColorCorrection() method doesn't exist");
94 if (untyped x1
.hasOwnProperty('nativeWindow')) {
95 DejaGnu
.pass("Stage.nativeWindow property exists");
97 DejaGnu
.fail("Stage.nativeWindow property does not exist");
103 if (untyped x1
.hasOwnProperty("align")) {
104 DejaGnu
.pass("Stage.align property exists");
106 DejaGnu
.fail("Stage.align property doesn't exist");
109 if (untyped x1
.hasOwnProperty("cacheAsBitmap")) {
110 DejaGnu
.pass("cacheAsBitmap exists");
112 DejaGnu
.fail("cacheAsBitmap does not exist");
115 if (untyped x1
.hasOwnProperty('displayState')) {
116 DejaGnu
.pass("Stage.displayState property exists");
118 DejaGnu
.fail("Stage.displayState property does not exist");
121 if (untyped x1
.hasOwnProperty('focus')) {
122 DejaGnu
.pass("Stage.focus property exists");
124 DejaGnu
.fail("Stage.focus property does not exist");
127 if (untyped x1
.hasOwnProperty('frameRate')) {
128 DejaGnu
.pass("Stage.frameRate property exists");
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");
142 //~ DejaGnu.fail("Stage.fullScreenSourceRect property doesn't exist");
144 if (untyped x1
.hasOwnProperty('fullScreenSourceRect')) {
145 DejaGnu
.pass("Stage.fullScreenSourceRect property exists");
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");
155 // DejaGnu.fail("Stage.fullScreenHeight property doesn't exist");
157 // if (Std.is(x1.fullScreenWidth, Int)) {
158 // DejaGnu.pass("Stage.fullScreenWidth property exists");
160 // DejaGnu.fail("Stage.fullScreenWidth property doesn't exist");
164 if (untyped x1
.hasOwnProperty('height')) {
165 DejaGnu
.pass("Stage.height property exists");
167 DejaGnu
.fail("Stage.height property does not exist");
170 if (untyped x1
.hasOwnProperty('mouseChildren')) {
171 DejaGnu
.pass("Stage.mouseChildren property exists");
173 DejaGnu
.fail("Stage.mouseChildren property does not exist");
175 if (untyped x1
.hasOwnProperty('numChildren')) {
176 DejaGnu
.pass("Stage.numChildren property exists");
178 DejaGnu
.fail("Stage.numChildren property does not exist");
180 if (untyped x1
.hasOwnProperty('quality')) {
181 DejaGnu
.pass("Stage.quality property exists");
183 DejaGnu
.fail("Stage.quality property doesn't exist");
185 if (untyped x1
.hasOwnProperty('scaleMode')) {
186 DejaGnu
.pass("Stage.scaleMode property exists");
188 DejaGnu
.fail("Stage.scaleMode property doesn't exist");
190 if (untyped x1
.hasOwnProperty('showDefaultContextMenu')) {
191 DejaGnu
.pass("Stage.showDefaultContextMenu property exists");
193 DejaGnu
.fail("Stage.showDefaultContextMenu property doesn't exist");
195 if (untyped x1
.hasOwnProperty('stageFocusRect')) {
196 DejaGnu
.pass("Stage.stageFocusRect property exists");
198 DejaGnu
.fail("Stage.stageFocusRect property doesn't exist");
200 if (untyped x1
.hasOwnProperty('stageHeight')) {
201 DejaGnu
.pass("Stage.stageHeight property exists");
203 DejaGnu
.fail("Stage.stageHeight property doesn't exist");
205 if (untyped x1
.hasOwnProperty('stageWidth')) {
206 DejaGnu
.pass("Stage.stageWidth property exists");
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");
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");
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");
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");
232 DejaGnu
.fail("Stage.width property doesn't exist");
235 if (untyped Stage
.hasOwnProperty('align')) {
236 DejaGnu
.pass("Stage.align property exists");
238 DejaGnu
.fail("Stage.align property doesn't exist");
240 if (untyped Stage
.hasOwnProperty('width')) {
241 DejaGnu
.pass("Stage.width property exists");
243 DejaGnu
.fail("Stage.width property doesn't exist");
245 if (untyped Stage
.hasOwnProperty('height')) {
246 DejaGnu
.pass("Stage.height property exists");
248 DejaGnu
.fail("Stage.height property doesn't exist");
250 if (untyped Stage
.hasOwnProperty('scaleMode')) {
251 DejaGnu
.pass("Stage.scaleMode property exists");
253 DejaGnu
.fail("Stage.scaleMode property doesn't exist");
255 if (untyped Stage
.hasOwnProperty('align')) {
256 DejaGnu
.pass("Stage.align property exists");
258 DejaGnu
.fail("Stage.align property doesn't exist");
260 if (untyped Stage
.hasOwnProperty('showMenu')) {
261 DejaGnu
.pass("Stage.showMenu property exists");
263 DejaGnu
.fail("Stage.showMenu property doesn't exist");
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");
275 if (Type
.typeof(x1
.assignFocus
) == ValueType
.TFunction
) {
276 DejaGnu
.pass("Stage.assignFocus() method exists");
278 DejaGnu
.fail("Stage.assignFocus() method doesn't exist");
283 if (Type
.typeof(x1
.addChild
) == ValueType
.TFunction
) {
284 DejaGnu
.pass("Stage.addChild() method exists");
286 DejaGnu
.fail("Stage.addChild() method doesn't exist");
288 if (Type
.typeof(x1
.addChildAt
) == ValueType
.TFunction
) {
289 DejaGnu
.pass("Stage.addChildAt() method exists");
291 DejaGnu
.fail("Stage.addChildAt() method doesn't exist");
293 if (Type
.typeof(x1
.addEventListener
) == ValueType
.TFunction
) {
294 DejaGnu
.pass("Stage.addEventListener() method exists");
296 DejaGnu
.fail("Stage.addEventListener() method doesn't exist");
298 if (Type
.typeof(x1
.dispatchEvent
) == ValueType
.TFunction
) {
299 DejaGnu
.pass("Stage.dispatchEvent() method exists");
301 DejaGnu
.fail("Stage.dispatchEvent() method doesn't exist");
303 if (Type
.typeof(x1
.hasEventListener
) == ValueType
.TFunction
) {
304 DejaGnu
.pass("Stage.hasEventListener() method exists");
306 DejaGnu
.fail("Stage.hasEventListener() method doesn't exist");
308 if (Type
.typeof(x1
.invalidate
) == ValueType
.TFunction
) {
309 DejaGnu
.pass("Stage.invalidate() method exists");
311 DejaGnu
.fail("Stage.invalidate() method doesn't exist");
313 if (Type
.typeof(x1
.isFocusInaccessible
) == ValueType
.TFunction
) {
314 DejaGnu
.pass("Stage.isFocusInaccessible() method exists");
316 DejaGnu
.fail("Stage.isFocusInaccessible() method doesn't exist");
318 if (Type
.typeof(x1
.removeChild
) == ValueType
.TFunction
) {
319 DejaGnu
.pass("Stage.removeChildAt() method exists");
321 DejaGnu
.fail("Stage.removeChildAt() method doesn't exist");
323 if (Type
.typeof(x1
.setChildIndex
) == ValueType
.TFunction
) {
324 DejaGnu
.pass("Stage.setChildIndex() method exists");
326 DejaGnu
.fail("Stage.setChildIndex() method doesn't exist");
328 if (Type
.typeof(x1
.swapChildrenAt
) == ValueType
.TFunction
) {
329 DejaGnu
.pass("Stage.swapChildrenAt() method exists");
331 DejaGnu
.fail("Stage.swapChildrenAt() method doesn't exist");
333 if (Type
.typeof(x1
.willTrigger
) == ValueType
.TFunction
) {
334 DejaGnu
.pass("Stage.willTrigger() method exists");
336 DejaGnu
.fail("Stage.willTrigger() method doesn't exist");
340 if (untyped Stage
.hasOwnProperty('addListener')) {
341 DejaGnu
.pass("Stage.addListener() method exists");
343 DejaGnu
.fail("Stage.addListener() method does not exist");
345 if (untyped Stage
.hasOwnProperty('removeListener')) {
346 DejaGnu
.pass("Stage.removeListener() method exists");
348 DejaGnu
.fail("Stage.removeListener() method does not exist");
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");
365 if (untyped __typeof__(x1
.align
) == 'string') {
366 DejaGnu
.pass("Stage.align is a String object");
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");
375 DejaGnu
.fail("cacheAsBitmap is not a boolean");
379 if (untyped __typeof__(x1
.displayState
) == 'object') {
380 DejaGnu
.pass("displayState is an object");
382 DejaGnu
.fail("displayState is not an object");
386 if (untyped __typeof__(x1
.focus
) == 'object') {
387 DejaGnu
.pass("Stage.focus is an object");
389 DejaGnu
.fail("Stage.focus is not an object");
391 if ( className(x1
.focus
) == 'null') {
392 DejaGnu
.pass("Stage.focus initially set to null");
394 DejaGnu
.fail("Stage.focus initially set to something other than null ");
396 var t1
:TextField
= new TextField();
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");
403 DejaGnu
.fail("Stage.focus property is not an InteractiveObject");
407 if (untyped __typeof__(x1
.frameRate
) == 'number') {
408 DejaGnu
.pass("Stage.frameRate is a number");
410 DejaGnu
.fail("Stage.frameRate is a number");
414 if (untyped __typeof__(x1
.height
) == 'number') {
415 DejaGnu
.pass("height property is a number");
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");
424 DejaGnu
.fail("Stage.mouseChildren is not a boolean");
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 ***");
439 if (Type
.typeof(untyped Stage
.addListener
) == ValueType
.TFunction
) {
440 DejaGnu
.pass("Stage.addChild() method exists");
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");
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");
452 DejaGnu
.fail("Stage.broadcastMessage method doesn't exist");
456 if (untyped Stage
.hasOwnProperty("_listeners")) {
457 DejaGnu
.pass("_listeners property exists");
459 DejaGnu
.fail("_listeners property does not exist");
461 if (Reflect
.isObject(untyped Stage
._listeners
)) {
462 DejaGnu
.pass("_listeners is an object");
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");
469 DejaGnu
.fail("_listeners is not an array");
471 if (untyped Stage
.hasOwnProperty("height")) {
472 DejaGnu
.pass("height property exists");
474 DejaGnu
.fail("height property does not exist");
476 if (untyped Stage
.hasOwnProperty("width")) {
477 DejaGnu
.pass("width property exists");
479 DejaGnu
.fail("width property does not exist");
481 if (untyped Stage
.hasOwnProperty("scaleMode")) {
482 DejaGnu
.pass("scaleMode property exists");
484 DejaGnu
.fail("scaleMode property does not exist");
486 if (untyped Stage
.hasOwnProperty("showMenu")) {
487 DejaGnu
.pass("showMenu property exists");
489 DejaGnu
.fail("showMenu property does not exist");
491 if (untyped Stage
.hasOwnProperty("align")) {
492 DejaGnu
.pass("align property exists");
494 DejaGnu
.fail("align property does not exist");
496 if (untyped Stage
.hasOwnProperty("displayState")) {
497 DejaGnu
.pass("displayState property exists");
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");
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'");
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'");
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'");
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'");
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'");
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'");
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'");
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'");
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'");
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'");
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'");
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'");
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'");
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'");
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'");
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'");
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'");
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'");
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'");
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'");
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 ''");
674 DejaGnu
.fail("Stage.align is not initialized to ''");
679 var stageheightcheck
= 0;
682 var listener
: Dynamic = {};
683 listener
.onResize
= function() {
684 untyped Stage
.height
= 1;
685 stageheightcheck
= untyped Stage
.height
;
693 listener
.onFullScreen
= function(fs
) {
694 DejaGnu
.note("onFullScreen event received: value " + fs
);
695 valtype
= untyped __typeof__(fs
);
699 untyped Stage
.addListener(listener
);
701 untyped Stage
.scaleMode
= 5;
703 if (untyped Stage
.scaleMode
=="showAll") {
704 DejaGnu
.pass("Stage.scaleMode set to showAll");
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");
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");
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");
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");
738 DejaGnu
.fail("Stage.scaleMode not set to noScale");
741 untyped Stage
.displayState
= "fullScreen";
742 untyped Stage
.displayState
= "normal";
744 // Fixes failure in pp
747 DejaGnu
.pass("fscount = 2");
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)");
755 DejaGnu
.pass("rscount = 0");
757 DejaGnu
.xfail("rscount = " + rscount
);
760 // Fixes failure in pp
762 // valtype is null -- FAIL!
763 if (valtype
=="boolean") {
764 //if (Type.typeof(valtype)==ValueType.TBool) {
765 DejaGnu
.pass("valtype returns a boolean");
767 DejaGnu
.fail("valtype does not return a boolean");
770 if (stageheightcheck
!=1) {
771 DejaGnu
.pass("stageheightcheck is not equal to 1");
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
);
785 if (untyped Stage
.addListener
==null) {
786 DejaGnu
.pass("Stage.addListener is undefined");
788 DejaGnu
.fail("Stage.addListener is defined");
790 if (untyped Stage
.removeListener
==null) {
791 DejaGnu
.pass("Stage.removeListener is undefined");
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");
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");
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");
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");
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");
834 DejaGnu.fail("Stage.displayState is not set to normal");
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'");
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");
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");
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");
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");
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");
889 DejaGnu
.fail("showMenu not correctly set with object valueOf");
895 // Call this after finishing all tests. It prints out the totals.
902 // indent-tabs-mode: t