gnash-commit
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Gnash-commit] /srv/bzr/gnash/trunk r11244: Created ASnative_as.hx and m


From: Sharad Desai
Subject: [Gnash-commit] /srv/bzr/gnash/trunk r11244: Created ASnative_as.hx and migrated mings cases to haXe
Date: Fri, 10 Jul 2009 15:13:09 -0600
User-agent: Bazaar (1.13.1)

------------------------------------------------------------
revno: 11244
committer: Sharad Desai <address@hidden>
branch nick: trunk
timestamp: Fri 2009-07-10 15:13:09 -0600
message:
  Created ASnative_as.hx and migrated mings cases to haXe
added:
  testsuite/misc-haxe.all/classes.all/ASnative_as.hx
    ------------------------------------------------------------
    revno: 11211.1.1
    committer: Sharad Desai <address@hidden>
    branch nick: desaiChg
    timestamp: Fri 2009-07-10 15:11:25 -0600
    message:
      Created ASnative_as.hx and migrated mings cases to haXe
    added:
      testsuite/misc-haxe.all/classes.all/ASnative_as.hx
=== added file 'testsuite/misc-haxe.all/classes.all/ASnative_as.hx'
--- a/testsuite/misc-haxe.all/classes.all/ASnative_as.hx        1970-01-01 
00:00:00 +0000
+++ b/testsuite/misc-haxe.all/classes.all/ASnative_as.hx        2009-07-10 
21:11:25 +0000
@@ -0,0 +1,859 @@
+// ASnative_as.hx:  ActionScript 3 "ExternalInterface" class, for Gnash.
+//
+// Generated by gen-as3.sh on: 20090709 by "sharad". Remove this
+// after any hand editing loosing changes.
+//
+//   Copyright (C) 2009 Free Software Foundation, Inc.
+//
+// This program is free software; you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation; either version 3 of the License, or
+// (at your option) any later version.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License
+// along with this program; if not, write to the Free Software
+// Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+//
+
+// This test case must be processed by CPP before compiling to include the
+//  DejaGnu.hx header file for the testing framework support.
+
+// FIXMES: fix Stage calls
+
+// Really don't need anything here for ASnative, except these imports
+import flash.Lib;
+import Type;
+import Std;
+
+// import our testing API
+import DejaGnu;
+
+// Class must be named with the _as suffix, as that's the same name as the 
file.
+class ASnative_as {
+       
+       static var undef = untyped __global__("undefined");
+       
+    static function main() {
+               
+               #if (flash6 || flash7 || flash8)
+                       if (Type.typeof(untyped ASnative) == 
ValueType.TFunction) {
+                               DejaGnu.pass("typeof(ASnative)=='function'");
+                       } else {
+                               DejaGnu.fail("typeof(ASnative)!='function'");
+                       }
+                       
+                       var result = "";
+                       var a = untyped ASnative(2,0);
+                       
+                       var func = function() {
+                                       if (untyped a()) { 
+                                       result = "true"; 
+                               } else { 
+                                       result =  "false"; 
+                               }
+                       };
+                       
+                       func();
+                       
+                       if (result == "false") {
+                               DejaGnu.pass("result=='false'");
+                       } else {
+                               DejaGnu.fail("result!='false'");
+                       }
+                       
+                       var discard = untyped __new__(func());
+                       
+                       if (result == "true") {
+                               DejaGnu.pass("result=='true'");
+                       } else {
+                               DejaGnu.xfail("result!='true'");
+                       }
+                       
+                       // Escape
+                       a = untyped ASnative(100, 0);
+                       
+                       var b = Reflect.callMethod(flash.Lib.current, a, [" "]);
+
+                       if (Std.string(b)=="%20") {
+                               DejaGnu.pass("a('')==%20"); 
+                       } else {
+                               DejaGnu.fail("a('')!=%20 ");
+                       }
+               
+                       // Unescape 
+                       a = untyped ASnative(100, 1);
+                       
+                       b = Reflect.callMethod(flash.Lib.current, a, ["%20"]);
+                       
+                       if (Std.string(b)==" ") {
+                               DejaGnu.pass("a('%20')==' '");
+                       } else {
+                               DejaGnu.fail("a('%20')!=' '");
+                       }
+                       
+                       // parseInt 
+                       a = untyped ASnative (100, 2); 
+                       
+                       b = Reflect.callMethod(flash.Lib.current, a, ["  
566765s"]);
+                       
+                       if (Std.string(b)=="566765") {
+                               DejaGnu.pass("a('  566765s')=='566765'");
+                       } else {
+                               DejaGnu.fail("a('  566765s')!='566765'");
+                       }
+                       
+                       // parseFloat
+                       a = untyped ASnative(100, 3);
+                       
+                       b = Reflect.callMethod(flash.Lib.current, a, ["8.4e6"]);
+                       
+                       if (b==8.4e6) {
+                               DejaGnu.pass("a('8.4e6')==8.4e6");
+                       } else {
+                               DejaGnu.fail("a('8.4e6')!=8.4e6");
+                       }
+
+                       a = untyped ASnative(103, 257);
+                       
+                       b = Reflect.callMethod(flash.Lib.current, a, [65, 1, 1, 
1, 1, 1, 1]);
+                       
+                       if (b==untyped Date.UTC(65, 1, 1, 1, 1, 1, 1)) {
+                               DejaGnu.pass("a(65, 1, 1, 1, 1, 1, 1) == 
Date.UTC(65, 1, 1, 1, 1, 1, 1)");
+                       } else {
+                               DejaGnu.fail("a(65, 1, 1, 1, 1, 1, 1) == 
Date.UTC(65, 1, 1, 1, 1, 1, 1)");
+                       }
+                       
+                       // _global.Date()
+                       var e = untyped ASnative(103, 256);
+                       
+                       if (e().valueOf()==untyped Date().valueOf()) {
+                               DejaGnu.pass("e().valueOf()==untyped 
Date().valueOf()");
+                       } else {
+                               DejaGnu.xfail("e().valueOf()!=untyped 
Date().valueOf()");
+                       }
+                       
+                       var g = e;
+                       
+                       if (Std.is(g().valueOf(), String)) {
+                               DejaGnu.pass("typeof(g().valueOf()=='string'");
+                       } else {
+                               DejaGnu.xfail("typeof(g().valueOf()!='string'");
+                       }
+                       
+                       var t = Reflect.callMethod(flash.Lib.current, e, 
[100000]);
+                       
+                       if (t.valueOf()==untyped Date().valueOf()) {
+                               
DejaGnu.pass("e(100000).valueOf()==Date().valueOf()");
+                       } else {
+                               DejaGnu.xfail("e(100000).valueOf(), 
Date().valueOf()");
+                       }
+                       
+                       g = untyped e();
+                       
+                       if (untyped g.getMilliseconds()==null) {
+                               
DejaGnu.pass("typeof(getMilliseconds)=='undefined'");
+                       } else {
+                               
DejaGnu.fail("typeof(getMilliseconds)!='undefined'");
+                       }
+
+                       var f = untyped __new__(e, 100000000);
+                       
+                       if (Type.typeof(f)==ValueType.TObject) {
+                               DejaGnu.pass("typeof(f)=='object'");
+                       } else {
+                               DejaGnu.xfail("typeof(f)!='object'");
+                       }
+                       
+                       if (Type.typeof(f.getMilliseconds())==ValueType.TNull) {
+                               
DejaGnu.pass("typeof(f.getMilliseconds)=='undefined'");
+                       } else {
+                               
DejaGnu.fail("typeof(f.getMilliseconds)!='undefined'");
+                       }
+                       
+                       if (untyped f().getMilliseconds==null) {
+                               
DejaGnu.pass("typeof(f().getMilliseconds)=='undefined'");
+                       } else {
+                               
DejaGnu.fail("typeof(f().getMilliseconds)!='undefined'");
+                       }
+                       
+                       var d = untyped __new__(Date(123456789));
+                       
+                       d.a = untyped ASnative(103, 0);
+                       
+                       if (d.a()==d.getFullYear()) {
+                               DejaGnu.pass("d.a()==d.getFullYear()");
+                       } else {
+                               DejaGnu.fail("d.a()!=d.getFullYear()");
+                       }
+                       
+                       d.a = untyped ASnative(103, 1);
+                       
+                       if (d.a()==d.getYear()) {
+                               DejaGnu.pass("d.a()==d.getYear()");
+                       } else {
+                               DejaGnu.fail("d.a()!=d.getYear()");
+                       }
+                       
+                       d.a = untyped ASnative(103, 2);
+                       
+                       if (d.a()==d.getFullYear()) {
+                               DejaGnu.pass("d.a()==d.getMonth()");
+                       } else {
+                               DejaGnu.fail("d.a()!=d.getMonth()");
+                       }
+                       
+                       d.a = untyped ASnative(103, 3);
+                       
+                       if (d.a()==d.getDate()) {
+                               DejaGnu.pass("d.a()==d.getDate()");
+                       } else {
+                               DejaGnu.fail("d.a()!=d.getDate()");
+                       }
+
+                       d.a = untyped ASnative(103, 4);
+                       
+                       if (d.a()==d.getDay()) {
+                               DejaGnu.pass("d.a()==d.getDay()");
+                       } else {
+                               DejaGnu.fail("d.a()!=d.getDay()");
+                       }
+
+                       d.a = untyped ASnative(103, 5);
+                       
+                       if (d.a()==d.getHours()) {
+                               DejaGnu.pass("d.a()==d.getHours()");
+                       } else {
+                               DejaGnu.fail("d.a()!=d.getHours()");
+                       }
+                       
+                       d.a = untyped ASnative(103, 6);
+                       
+                       if (d.a()==d.getMinutes()) {
+                               DejaGnu.pass("d.a()==d.getMinutes()");
+                       } else {
+                               DejaGnu.fail("d.a()!=d.getMinutes()");
+                       }
+
+                       d.a = untyped ASnative(103, 7);
+                       
+                       if (d.a()==d.getSeconds()) {
+                               DejaGnu.pass("d.a()==d.getSeconds()");
+                       } else {
+                               DejaGnu.fail("d.a()!=d.getSeconds()");
+                       }
+
+                       d.a = untyped ASnative(103, 8);
+                       
+                       if (d.a()==d.getMilliseconds()) {
+                               DejaGnu.pass("d.a()==d.getMilliseconds()");
+                       } else {
+                               DejaGnu.fail("d.a()!=d.getMilliseconds()");
+                       }
+
+                       d.a = untyped ASnative(103, 16);
+                       
+                       if (d.a()==d.getTime()) {
+                               DejaGnu.pass("d.a()==d.getTime()");
+                       } else {
+                               DejaGnu.fail("d.a()!=d.getTime()");
+                       }
+
+                       d.a = untyped ASnative(103, 18);
+                       
+                       if (d.a()==d.getTimezoneOffset()) {
+                               DejaGnu.pass("d.a()==d.getTimezoneOffset()");
+                       } else {
+                               DejaGnu.fail("d.a()!=d.getTimezoneOffset()");
+                       }
+                       
+                       d.a = untyped ASnative(103, 19);
+                       
+                       if (d.a()==d.toString()) {
+                               DejaGnu.pass("d.a()==d.toString()");
+                       } else {
+                               DejaGnu.fail("d.a()!=d.toString()");
+                       }
+                       
+                       d.a = untyped ASnative(103, 128);
+                       
+                       if (d.a()==d.getUTCFullYear()) {
+                               DejaGnu.pass("d.a()==d.getUTCFullYear()");
+                       } else {
+                               DejaGnu.fail("d.a()!=d.getUTCFullYear()");
+                       }
+                       
+                       d.a = untyped ASnative(103, 129);
+                       
+                       if (d.a()==d.getUTCYear()) {
+                               DejaGnu.pass("d.a()==d.getUTCYear()");
+                       } else {
+                               DejaGnu.fail("d.a()!=d.getUTCYear()");
+                       }
+
+                       d.a = untyped ASnative(103, 130);
+                       
+                       if (d.a()==d.getUTCMonth()) {
+                               DejaGnu.pass("d.a()==d.getUTCMonth()");
+                       } else {
+                               DejaGnu.fail("d.a()!=d.getUTCMonth()");
+                       }
+
+                       d.a = untyped ASnative(103, 131);
+                       
+                       if (d.a()==d.getUTCDate()) {
+                               DejaGnu.pass("d.a()==d.getUTCDate()");
+                       } else {
+                               DejaGnu.fail("d.a()!=d.getUTCDate()");
+                       }
+
+                       d.a = untyped ASnative(103, 132);
+                       
+                       if (d.a()==d.getUTCDay()) {
+                               DejaGnu.pass("d.a()==d.getUTCDay()");
+                       } else {
+                               DejaGnu.fail("d.a()!=d.getUTCDay()");
+                       }
+
+                       d.a = untyped ASnative(103, 133);
+                       
+                       if (d.a()==d.getUTCHours()) {
+                               DejaGnu.pass("d.a()==d.getUTCHours()");
+                       } else {
+                               DejaGnu.fail("d.a()!=d.getUTCHours()");
+                       }
+
+                       d.a = untyped ASnative(103, 134);
+                       
+                       if (d.a()==d.getUTCMinutes()) {
+                               DejaGnu.pass("d.a()==d.getUTCMinutes()");
+                       } else {
+                               DejaGnu.fail("d.a()!=d.getUTCMinutes()");
+                       }
+
+                       d.a = untyped ASnative(103, 135);
+                       
+                       if (d.a()==d.getUTCSeconds()) {
+                               DejaGnu.pass("d.a()==d.getUTCSeconds()");
+                       } else {
+                               DejaGnu.fail("d.a()!=d.getUTCSeconds()");
+                       }
+                       
+                       d.a = untyped ASnative(103, 136);
+                       
+                       if (d.a()==d.getUTCMilliseconds()) {
+                               DejaGnu.pass("d.a()==d.getUTCMilliseconds()");
+                       } else {
+                               DejaGnu.fail("d.a()!=d.getUTCMilliseconds()");
+                       }
+
+                       d.a = untyped ASnative(103, 1);
+                       
+                       if (d.a()==d.getYear()) {
+                               DejaGnu.pass("d.a()==d.getYear()");
+                       } else {
+                               DejaGnu.fail("d.a()!=d.getYear()");
+                       }
+                       
+                       var countVO = 0;
+                       var countTS = 0;
+
+                       // ASNative Math (call valueOf)
+                       var func : Dynamic = {};
+                       
+                       func.valueOf = function () {
+                               countVO++;
+                               return 0.3;
+                       };
+
+                       func.toString = function () {
+                               countTS++;
+                               return "gNaSh mUsT woRK!";
+                       };
+                       
+                       // abs function
+                       a = untyped ASnative(200, 0);
+
+                       b = Reflect.callMethod(flash.Lib.current, a, [func]);
+                       
+                       if (b==0.3) {
+                               DejaGnu.pass("a(func)==0.3");
+                       } else {
+                               DejaGnu.fail("a(func)!=0.3");
+                       }
+                       
+                       var b = Reflect.callMethod(flash.Lib.current, a, [0.3]);
+                       
+                       if (b==0.3) {
+                               DejaGnu.pass("a(0.3)==0.3");
+                       } else {
+                               DejaGnu.fail("a(0.3)!=0.3");
+                       }
+               
+                       // min function
+                       a = untyped ASnative(200, 1);
+                       
+                       b = Reflect.callMethod(flash.Lib.current, a, [func, 
func+1]);
+                       
+                       if (b==0.3) {
+                               DejaGnu.pass("a(func, func + 1)==0.3");
+                       } else {
+                               DejaGnu.fail("a(func, func + 1)!=0.3");
+                       }
+
+                       b = Reflect.callMethod(flash.Lib.current, a, [0.3, 
1.3]);
+                       
+                       if (b==0.3) {
+                               DejaGnu.pass("a(0.3, 1.3)==1.3");
+                       } else {
+                               DejaGnu.fail("a(0.3, 1.3)!=1.3");
+                       }
+                       
+                       // max function
+                       a = untyped ASnative(200, 2);
+                       
+                       b = Reflect.callMethod(flash.Lib.current, a, [func, 
func+1]);
+                       
+                       if (b==1.3) {
+                               DejaGnu.pass("a(func, func + !)==1.3");
+                       } else {
+                               DejaGnu.fail("a(func, func + !)!=1.3");
+                       }
+
+                       b = Reflect.callMethod(flash.Lib.current, a, [0.3, 
1.3]);
+                       
+                       if (b==1.3) {
+                               DejaGnu.pass("a(0.3, 1.3)==1.3");
+                       } else {
+                               DejaGnu.fail("a(0.3, 1.3)!=1.3");
+                       }
+                       
+                       // sin function
+                       a = untyped ASnative(200, 3);
+                       
+                       b = Reflect.callMethod(flash.Lib.current, a, [func]);
+                       
+                       if (Std.string(b)=="0.29552020666134") {
+                               
DejaGnu.pass("a(func).toString()=='0.29552020666134'");
+                       } else {
+                               
DejaGnu.fail("a(func).toString()!='0.29552020666134'");
+                       }
+                       
+                       b = Reflect.callMethod(flash.Lib.current, a, [0.3]);
+                       
+                       if (Std.string(b)=="0.29552020666134") {
+                               
DejaGnu.pass("a(0.3).toString()=='0.29552020666134'");
+                       } else {
+                               
DejaGnu.fail("a(0.3).toString()!='0.29552020666134'");
+                       }
+                       
+                       // cos function
+                       a = untyped ASnative(200, 4);
+                       
+                       b = Reflect.callMethod(flash.Lib.current, a, [func]);
+                       
+                       if (Std.string(b)=="0.955336489125606") {
+                               
DejaGnu.pass("a(func).toString()=='0.955336489125606'");
+                       } else {
+                               
DejaGnu.fail("a(func).toString()!='0.955336489125606'");
+                       }
+                       
+                       b = Reflect.callMethod(flash.Lib.current, a, [0.3]);
+
+                       if (Std.string(b)=="0.955336489125606") {
+                               
DejaGnu.pass("a(0.3).toString()=='0.955336489125606'");
+                       } else {
+                               
DejaGnu.fail("a(0.3).toString()!='0.955336489125606'");
+                       }
+                       
+                       // atan2 function
+                       a = untyped ASnative(200, 5);
+                       
+                       b = Reflect.callMethod(flash.Lib.current, a, [func, 
func + 1]);
+                       
+                       if (Std.string(b)=="0.226798848053886") {
+                               DejaGnu.pass("a(func, func + 
1).toString()=='0.226798848053886'");
+                       } else {
+                               DejaGnu.pass("a(func, func + 
1).toString()!='0.226798848053886'");
+                       }
+                       
+                       b = Reflect.callMethod(flash.Lib.current, a, [0.3, 
1.3]);
+                       
+                       if (Std.string(b)=="0.226798848053886") {
+                               DejaGnu.pass("a(0.3, 
1.3).toString()=='226798848053886'");
+                       } else {
+                               DejaGnu.fail("a(0.3, 
1.3).toString()!='226798848053886'");
+                       }
+                       
+                       // tan function
+                       a = untyped ASnative(200, 6);
+                       
+                       b = Reflect.callMethod(flash.Lib.current, a, [func]);
+                       
+                       if (Std.string(b)=="0.309336249609623") {
+                               
DejaGnu.pass("a(func).toString()=='0.309336249609623'");
+                       } else {
+                               
DejaGnu.fail("a(func).toString()!='0.309336249609623'");
+                       }
+                       
+                       // exp function
+                       a = untyped ASnative(200, 7);
+                       
+                       b = Reflect.callMethod(flash.Lib.current, a, [func]);
+                       
+                       if (Std.string(b)=="1.349858807576") {
+                               
DejaGnu.pass("a(func).toString()=='1.349858807576'");
+                       } else {
+                               
DejaGnu.fail("a(func).toString()!='1.349858807576'");
+                       }
+                       
+                       // log function
+                       a = untyped ASnative(200, 8);
+                       
+                       b = Reflect.callMethod(flash.Lib.current, a, [func]);
+                       
+                       if (Std.string(b)=="-1.20397280432594") {
+                               
DejaGnu.pass("a(func).toString()=='-1.20397280432594'");
+                       } else {
+                               
DejaGnu.fail("a(func).toString()!='-1.20397280432594'");
+                       }
+
+                       // sqrt function
+                       a = untyped ASnative(200, 9);
+                       
+                       b = Reflect.callMethod(flash.Lib.current, a, [func]);
+                       
+                       if (Std.string(b)=="0.547722557505166") {
+                               
DejaGnu.pass("a(func).toString()=='0.547722557505166'");
+                       } else {
+                               
DejaGnu.fail("a(func).toString()!='0.547722557505166'");
+                       }
+                       
+                       // round function
+                       a = untyped ASnative(200, 10);
+                       
+                       b = Reflect.callMethod(flash.Lib.current, a, [func]);
+                       
+                       if (Std.string(b)=="0") {
+                               DejaGnu.pass("a(func).toString()=='0'");
+                       } else {
+                               DejaGnu.fail("a(func).toString()!='0'");
+                       } 
+
+                       // random function
+                       a = untyped ASnative(200, 11);
+                       
+                       b = Reflect.callMethod(flash.Lib.current, a, [func]);
+                       b = Reflect.callMethod(flash.Lib.current, a, [func]);
+                       
+                       if (b >= 0 && b < 1) {
+                               DejaGnu.pass("a(func) >= 0 && a(func < 1)");
+                       } else {
+                               DejaGnu.fail("a(func) >= 0 && a(func < 1)");
+                       }
+                       
+                       // floor function
+                       a = untyped ASnative(200, 12);
+                       
+                       b = Reflect.callMethod(flash.Lib.current, a, [func]);
+                       
+                       if (b==0) {
+                               DejaGnu.pass("a(func)==0");
+                       } else {
+                               DejaGnu.fail("a(func)!=0");
+                       }
+
+                       // ceiling function
+                       a = untyped ASnative(200, 13);
+                       
+                       b = Reflect.callMethod(flash.Lib.current, a, [func]);
+                       
+                       if (b==1) {
+                               DejaGnu.pass("a(func)==1");
+                       } else {
+                               DejaGnu.fail("a(func)!=1");
+                       }
+                       
+                       // atan function
+                       a = untyped ASnative(200, 14);
+                       
+                       b = Reflect.callMethod(flash.Lib.current, a, [func]);
+                       
+                       if (Std.string(b)=="0.291456794477867") {
+                               
DejaGnu.pass("a(func).toString()=='0.291456794477867'");
+                       } else {
+                               
DejaGnu.fail("a(func).toString()!='0.291456794477867'");
+                       }
+                       
+                       // asin function
+                       a = untyped ASnative(200, 15);
+                       
+                       b = Reflect.callMethod(flash.Lib.current, a, [func]);
+                       
+                       if (Std.string(b)=="0.304692654015398") {
+                               
DejaGnu.pass("a(func).toString()=='0.304692654015398'");
+                       } else {
+                               
DejaGnu.fail("a(func).toString()!='0.304692654015398'");
+                       }
+
+                       // acos function
+                       a = untyped ASnative(200, 16);
+                       
+                       b = Reflect.callMethod(flash.Lib.current, a, [func]);
+                       
+                       if (Std.string(b)=="1.2661036727795") {
+                               
DejaGnu.pass("a(func).toString()=='1.2661036727795'");
+                       } else {
+                               
DejaGnu.fail("a(func).toString()!='1.2661036727795'");
+                       }
+                       
+                       // pow function
+                       a = untyped ASnative(200, 17);
+                       
+                       b = Reflect.callMethod(flash.Lib.current, a, [func, 
func + 1]);
+                       
+                       if (Std.string(b)=="0.209053590580785") {
+                               
DejaGnu.pass("a(func).toString()=='0.209053590580785'");
+                       } else {
+                               
DejaGnu.fail("a(func).toString()!='0.209053590580785'");
+                       } 
+                       
+                       // isNaN function
+                       a = untyped ASnative(200, 18);
+                       
+                       b = Reflect.callMethod(flash.Lib.current, a, [func]);
+                       
+                       if (b==0) {
+                               DejaGnu.pass("a(func)==false");
+                       } else {
+                               DejaGnu.fail("a(func)!=false");
+                       }
+                       
+                       // isFinite function
+                       a = untyped ASnative(200, 19);
+                       
+                       b = Reflect.callMethod(flash.Lib.current, a, [func]);
+                       
+                       if (b==1) {
+                               DejaGnu.pass("a(func)==true");
+                       } else {
+                               DejaGnu.fail("a(func)!=true");
+                       }
+
+                       if (countTS==0) {
+                               DejaGnu.pass("countTS==0");
+                       } else {
+                               DejaGnu.fail("countTS!=0");
+                       }
+                       
+                       if (countVO==25) {
+                               DejaGnu.pass("countVO==25");
+                       } else {
+                               DejaGnu.fail("countVO!=25 " + countVO);
+                       }
+                       
+                       // String functions (call toString)
+                       
+                       // String.toUpperCase
+                       a = untyped ASnative(251, 3);
+                       
+                       b = Reflect.callMethod(flash.Lib.current, a, ["Hello 
World"]);
+                       
+                       if (Std.string(b)=="_LEVEL0") {
+                               DejaGnu.pass("a('Hello World')=='_LEVEL0'");
+                       } else {
+                               DejaGnu.fail("a('Hello World')!='_LEVEL0'");
+                       }
+                       
+                       // SWF5 to upper
+                       a = untyped ASnative(102, 0);
+                       
+                       b = Reflect.callMethod(flash.Lib.current, a, ["Hello 
World"]);
+                       
+                       if (Std.string(b)=="_LEVEL0") {
+                               DejaGnu.pass("a('Hello World')=='_LEVEL0'");
+                       } else {
+                               DejaGnu.fail("a('Hello World')!='_LEVEL0'");
+                       }
+                       
+                       if (countTS==0) {
+                               DejaGnu.pass("countTS==0");
+                       } else {
+                               DejaGnu.fail("countTS!=0");
+                       }
+                                       
+                       #if !flash5
+                       // String.toUpperCase
+                       func.a = untyped ASnative(251, 3);
+                       
+                       if (func.a()=="GNASH MUST WORK!") {
+                               DejaGnu.pass("func.a()=='GNASH MUST WORK!'");
+                       } else {
+                               DejaGnu.fail("func.a()!='GNASH MUST WORK!' " + 
func.a());
+                       }
+                       
+                       // String toLowerCase
+                       func.a = untyped ASnative(251, 4);
+                       
+                       if (func.a()=="gnash must work!") {
+                               DejaGnu.pass("func.a()=='gnash must work!'");
+                       } else {
+                               DejaGnu.fail("func.a()!='gnash must work!'");
+                       }
+                       
+                       if (countTS==2) {
+                               DejaGnu.pass("countTS==2");
+                       } else {
+                               DejaGnu.fail("countTS!=2");
+                       }
+                       #end
+                       
+                       // SWF5 to upper
+                       func.a = untyped ASnative(102, 0);
+                       
+                       if (func.a()=="GNASH MUST WORK!") {
+                               DejaGnu.pass("func.a()=='GNASH MUST WORK!'");
+                       } else {
+                               DejaGnu.fail("func.a()!='GNASH MUST WORK!'");
+                       }
+                       
+                       // SWF5 to lower
+                       func.a = untyped ASnative(102, 1);
+                       
+                       if (func.a()=="gnash must work!") {
+                               DejaGnu.pass("func.a()=='gnash must work!'");
+                       } else {
+                               DejaGnu.fail("func.a()!='gnash must work!'");
+                       }
+                       
+                       #if !flash5
+                       if (countTS==4) {
+                               DejaGnu.pass("countTS==4");
+                       } else {
+                               DejaGnu.fail("countTS!=4 " + countTS);
+                       }
+                       #else
+                       if (countTS==2) {
+                               DejaGnu.pass("countTS==2");
+                       } else {
+                               DejaGnu.fail("countTS!=2 " +countTS);
+                       }
+                       #end
+
+                       // FIXME: cannot figure out these Stage ASnative tests
+                       // Stage
+                       /*var st = untyped ASnative(666, 2);
+                       Reflect.callMethod(flash.Lib.current, "st", 
["exactFit"]);
+                       st = untyped ASnative(666, 1);
+                       
+                       if (Std.string(st())=="exactFit") {
+                               DejaGnu.pass("st()=='exactFit'");
+                       } else {
+                               DejaGnu.fail("st()!='exactFit' " + 
Std.string(st()));
+                       }
+                       
+                       // Stage.align
+                       st = untyped ASnative(666, 4);
+                       Reflect.callMethod(flash.Lib.current, "st", ["BRL"]);
+                       st = untyped ASnative(666, 3);
+                       
+                       if (Std.string(st())=="LRB") {
+                               DejaGnu.pass("st()=='LRB'");
+                       } else {
+                               DejaGnu.fail("st()!='LRB' " + Std.string(st()));
+                       }
+                       
+                       // Stage.width
+                       st = untyped ASnative(666, 6);
+                       Reflect.callMethod(flash.Lib.current, "st", [402]);
+                       st = untyped ASnative(666, 5);
+                       
+                       if (st()==640) {
+                               DejaGnu.pass("st()==640");
+                       } else {
+                               DejaGnu.fail("st()!=640 " + st());
+                       }
+                       
+                       // Stage.height
+                       st = untyped ASnative(666, 8);
+                       Reflect.callMethod(flash.Lib.current, "st", [402]);
+                       st = untyped ASnative(666, 7);
+                       
+                       if (st()==480) {
+                               DejaGnu.pass("st()==480");
+                       } else {
+                               DejaGnu.fail("st()!=480 " + st());
+                       }
+                       
+                       // Stage.showMenu
+                       st = untyped ASnative(666, 10);
+                       st = untyped ASnative(666, 9);
+                       */
+                       
+                       #if !flash5
+                       if (countTS==4) {
+                               DejaGnu.pass("countTS==4");
+                       } else {
+                               DejaGnu.fail("countTS!=4 " + countTS);
+                       }
+                       #else
+                       if (countTS==2) {
+                               DejaGnu.pass("countTS==2");
+                       } else {
+                               DejaGnu.fail("countTS!=2 " +countTS);
+                       }
+                       #end
+               
+                       var f = Reflect.callMethod(flash.Lib.current, 
"ASnative", ["level1/level2/settings", "/", null]);
+                       if (Type.typeof(f)==ValueType.TNull) {
+                               DejaGnu.pass("typeof(f)=='null'");
+                       } else {
+                               DejaGnu.fail("typeof(f)!='null'");
+                       }
+
+                       a = untyped ASnative(2106, 204);
+                       
+                       f = untyped __new__(SharedObject());
+                       
+                       if (f.data==null) {
+                               DejaGnu.pass("f.data=='undefined'");
+                       } else {
+                               DejaGnu.fail("f.data!='undefined'");
+                       }
+                       
+                       var ret = Reflect.callMethod(flash.Lib.current, 
"ASnative", ["level1/level2/settings", "/", undef]);
+                       
+                       if (ret==true) {
+                               DejaGnu.pass("ret==true");
+                       } else {
+                               DejaGnu.xfail("ret!=true");
+                       }
+                       
+                       if (Type.typeof(f.data)==ValueType.TObject) {
+                               DejaGnu.pass("typeof(f.data)=='object'");
+                       } else {
+                               DejaGnu.xfail("typeof(f.data)!='object'");
+                       }
+               
+               #else
+                       DejaGnu.note("ASnative only valid for versions 6-8");
+               #end
+               // Call this when done, it will print the totals.
+               DejaGnu.done();
+       }
+}
+               
+               
+               
+               
+               
+               
+               
+               
+               
+               
+               


reply via email to

[Prev in Thread] Current Thread [Next in Thread]