Update with current status
[gnash.git] / testsuite / misc-haxe.all / classes.all / external / ExternalInterface_as.hx
blob8a6df6a664c501e5cd1c8b0e9204587535cb9f74
1 // ExternalInterface_as.hx: ActionScript 3 "ExternalInterface" class, for Gnash.
2 //
3 // Generated by gen-as3.sh on: 20090515 by "rob". 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.external.ExternalInterface;
28 import flash.display.MovieClip;
29 #else
30 import flash.external.ExternalInterface;
31 import flash.MovieClip;
32 #end
33 import flash.Lib;
34 import Type;
35 import Std;
37 // import our testing API
38 import DejaGnu;
40 // Class must be named with the _as suffix, as that's the same name as the file.
41 class ExternalInterface_as {
42 static function main() {
43 #if (flash8 || flash9)
44 // Make sure we actually get a valid class
45 if (flash.external.ExternalInterface != null) {
46 DejaGnu.pass("ExternalInterface class exists");
47 } else {
48 DejaGnu.fail("ExternalInterface class doesn't exist");
51 // Tests to see if all the properties exist. All these do is test for
52 // existance of a property, and don't test the functionality at all. This
53 // is primarily useful only to test completeness of the API implementation.
55 //check objectID and marshallExceptions only for flashv9
56 #if flash9
57 if (Type.typeof(flash.external.ExternalInterface.marshallExceptions) == ValueType.TBool) {
58 DejaGnu.pass("ExternalInterface.marshallExceptions property exists");
59 } else {
60 DejaGnu.fail("EI.marshallExceptions property doesn't exist");
63 //this should be changed to check for a proper string returned
64 if (Std.is(flash.external.ExternalInterface.objectID, String)) {
65 DejaGnu.pass("ExternalInterface.objectID property exists");
66 } else {
67 DejaGnu.fail("ExternalInterface.objectID property doesn't exist");
69 #end
71 //change this to just false if ExternalInterfacing is not supported
72 if (Type.typeof(flash.external.ExternalInterface.available) == ValueType.TBool) {
73 DejaGnu.pass("ExternalInterface.available property exists");
74 } else {
75 DejaGnu.xfail("ExternalInterface.available property doesn't exist");
78 // Tests to see if all the methods exist. All these do is test for
79 // existance of a method, and don't test the functionality at all. This
80 // is primarily useful only to test completeness of the API implementation.
81 if (Type.typeof(flash.external.ExternalInterface.addCallback) == ValueType.TFunction) {
82 DejaGnu.pass("ExternalInterface::addCallback() method exists");
83 } else {
84 DejaGnu.fail("ExternalInterface::addCallback() method doesn't exist");
87 //tests if the EI call function is available
88 if (Type.typeof(flash.external.ExternalInterface.call) == ValueType.TFunction) {
89 DejaGnu.pass("ExternalInterface::call() method exists");
90 } else {
91 DejaGnu.fail("ExternalInterface::call() method doesn't exist");
93 #end
94 // Call this after finishing all tests. It prints out the totals.
95 DejaGnu.done();
99 // local Variables:
100 // mode: C++
101 // indent-tabs-mode: t
102 // End: