~ubuntu-branches/ubuntu/saucy/gnash/saucy-proposed

« back to all changes in this revision

Viewing changes to testsuite/misc-haxe.all/classes.all/display/LoaderInfo_as.hx

  • Committer: Bazaar Package Importer
  • Author(s): Sindhudweep Narayan Sarkar
  • Date: 2009-10-07 00:06:10 UTC
  • mfrom: (1.1.12 upstream)
  • Revision ID: james.westby@ubuntu.com-20091007000610-mj9rwqe774gizn1j
Tags: 0.8.6-0ubuntu1
new upstream release 0.8.6 (LP: #435897)

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
// LoaderInfo_as.hx:  ActionScript 3 "LoaderInfo" class, for Gnash.
 
2
//
 
3
// Generated by gen-as3.sh on: 20090514 by "rob". Remove this
 
4
// after any hand editing loosing changes.
 
5
//
 
6
//   Copyright (C) 2009 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.
 
12
//
 
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.
 
17
//
 
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
 
21
//
 
22
 
 
23
// This test case must be processed by CPP before compiling to include the
 
24
// DejaGnu.hx header file for the testing framework support.
 
25
 
 
26
#if flash9
 
27
import flash.display.DisplayObject;
 
28
import flash.display.Loader;
 
29
import flash.display.LoaderInfo;
 
30
import flash.display.MovieClip;
 
31
import flash.display.SWFVersion;
 
32
import flash.events.Event;
 
33
import flash.events.EventDispatcher;
 
34
import flash.events.IOErrorEvent;
 
35
import flash.net.URLRequest;
 
36
import flash.system.ApplicationDomain;
 
37
import flash.utils.ByteArray;
 
38
#else
 
39
import flash.MovieClip;
 
40
#end
 
41
import flash.Lib;
 
42
import Type;
 
43
import Std;
 
44
 
 
45
// import our testing API
 
46
import DejaGnu;
 
47
 
 
48
// Class must be named with the _as suffix, as that's the same name as the file.
 
49
class LoaderInfo_as {
 
50
    static function main() {
 
51
        
 
52
                #if flash9
 
53
                
 
54
                                DejaGnu.note("\nIf test does not run properly -- ie: error of some" +
 
55
                                        " sort, then check line212 and make sure there is a" +
 
56
                                        " valid url path for a swf\n");
 
57
                                        
 
58
                var loader:Loader = new Loader();
 
59
                //var loader = new flash.display.Loader();
 
60
                var x1 = loader.contentLoaderInfo;
 
61
                loader.contentLoaderInfo.addEventListener(IOErrorEvent.IO_ERROR, function(e) {
 
62
                        trace(e);
 
63
                });
 
64
 
 
65
                loader.contentLoaderInfo.addEventListener(Event.COMPLETE, function(e) {
 
66
 
 
67
                // Make sure we actually get a valid class        
 
68
                if (Std.is(x1, LoaderInfo)) {
 
69
                    DejaGnu.pass("LoaderInfo class exists");
 
70
        } else {
 
71
            DejaGnu.fail("LoaderInfo lass doesn't exist");
 
72
        }
 
73
 
 
74
                // Tests to see if all the properties exist. All these do is test for
 
75
                // existance of a property, and don't test the functionality at all. This
 
76
                // is primarily useful only to test completeness of the API implementation.
 
77
                if (Std.is(x1.actionScriptVersion, Int)) {
 
78
                    DejaGnu.pass("LoaderInfo::actionScriptVersion property exists");
 
79
                } else {
 
80
                    DejaGnu.fail("LoaderInfo::actionScriptVersion property doesn't exist");
 
81
                }
 
82
                if (Std.is(x1.applicationDomain, ApplicationDomain)) {
 
83
                    DejaGnu.pass("LoaderInfo::applicationDomain property exists");
 
84
                } else {
 
85
                    DejaGnu.fail("LoaderInfo::applicationDomain property doesn't exist");
 
86
                }
 
87
                // Cannot test
 
88
                /*if (Std.is(x1.bytes, Array)) {
 
89
                    DejaGnu.pass("LoaderInfo::bytes property exists");
 
90
                } else {
 
91
                    DejaGnu.fail("LoaderInfo::bytes property doesn't exist");
 
92
                }*/
 
93
                if (Std.is(x1.bytesLoaded, Int)) {
 
94
                    DejaGnu.pass("LoaderInfo::bytesLoaded property exists");
 
95
                } else {
 
96
                    DejaGnu.fail("LoaderInfo::bytesLoaded property doesn't exist");
 
97
                }
 
98
                if (Std.is(x1.bytesTotal, Int)) {
 
99
                    DejaGnu.pass("LoaderInfo::bytesTotal property exists");
 
100
                } else {
 
101
                    DejaGnu.fail("LoaderInfo::bytesTotal property doesn't exist");
 
102
                }
 
103
                if (Std.is(x1.childAllowsParent, Bool)) {
 
104
                    DejaGnu.pass("LoaderInfo::childAllowsParent property exists");
 
105
                } else {
 
106
                    DejaGnu.fail("LoaderInfo::childAllowsParent property doesn't exist");
 
107
                }
 
108
                if (Std.is(x1.content, DisplayObject)) {
 
109
                    DejaGnu.pass("LoaderInfo::content property exists");
 
110
                } else {
 
111
                    DejaGnu.fail("LoaderInfo::content property doesn't exist");
 
112
                }
 
113
                if (Type.typeof(x1.contentType)!=ValueType.TNull) {
 
114
                    DejaGnu.pass("LoaderInfo::contentType property exists");
 
115
                } else {
 
116
                    DejaGnu.fail("LoaderInfo::contentType property doesn't exist");
 
117
                }
 
118
                if (Std.is(x1.frameRate, Int)) {
 
119
                    DejaGnu.pass("LoaderInfo::frameRate property exists");
 
120
                } else {
 
121
                    DejaGnu.fail("LoaderInfo::frameRate property doesn't exist");
 
122
                }
 
123
                if (Std.is(x1.height, Int)) {
 
124
                    DejaGnu.pass("LoaderInfo::height property exists");
 
125
                } else {
 
126
                    DejaGnu.fail("LoaderInfo::height property doesn't exist");
 
127
                }
 
128
                if (Std.is(x1.loader, Loader)) {
 
129
                    DejaGnu.pass("LoaderInfo::loader property exists");
 
130
                } else {
 
131
                    DejaGnu.fail("LoaderInfo::loader property doesn't exist");
 
132
                }
 
133
                if (Type.typeof(x1.loaderURL)!=ValueType.TNull) {
 
134
                    DejaGnu.pass("LoaderInfo::loaderURL property exists");
 
135
                } else {
 
136
                    DejaGnu.fail("LoaderInfo::loaderURL property doesn't exist");
 
137
                }
 
138
                if (Std.is(x1.parameters, Dynamic)) {
 
139
                    DejaGnu.pass("LoaderInfo::parameters property exists");
 
140
                } else {
 
141
                    DejaGnu.fail("LoaderInfo::parameters property doesn't exist");
 
142
                }
 
143
                if (Std.is(x1.parentAllowsChild, Bool)) {
 
144
                    DejaGnu.pass("LoaderInfo::parentAllowsChild property exists");
 
145
                } else {
 
146
                    DejaGnu.fail("LoaderInfo::parentAllowsChild property doesn't exist");
 
147
                }
 
148
                if (Std.is(x1.sameDomain, Bool)) {
 
149
                    DejaGnu.pass("LoaderInfo::sameDomain property exists");
 
150
                } else {
 
151
                    DejaGnu.fail("LoaderInfo::sameDomain property doesn't exist");
 
152
                }
 
153
                if (Std.is(x1.sharedEvents, EventDispatcher)) {
 
154
                    DejaGnu.pass("LoaderInfo::sharedEvents property exists");
 
155
                } else {
 
156
                    DejaGnu.fail("LoaderInfo::sharedEvents property doesn't exist");
 
157
                }
 
158
                
 
159
                // For older versions (FP<9), the swfVersion returned type int.  However
 
160
                // for new versions (FP>=9) it returned the class SWFVersion.  This test
 
161
                // to see which version the swf is.  
 
162
                if (Type.typeof(x1.swfVersion)==ValueType.TInt) { 
 
163
                        if (Std.is(x1.swfVersion, Int)) {
 
164
                            DejaGnu.pass("LoaderInfo::swfVersion property exists");
 
165
                        } else {
 
166
                            DejaGnu.fail("LoaderInfo::swfVersion property doesn't exist");
 
167
                        }
 
168
                } else {
 
169
                        if (Std.is(x1.swfVersion, SWFVersion)) {
 
170
                            DejaGnu.pass("LoaderInfo::swfVersion property exists");
 
171
                        } else {
 
172
                            DejaGnu.fail("LoaderInfo::swfVersion property doesn't exist");
 
173
                        }
 
174
                }
 
175
                if (Type.typeof(x1.url)!=ValueType.TNull) {
 
176
                    DejaGnu.pass("LoaderInfo::url property exists");
 
177
                } else {
 
178
                    DejaGnu.fail("LoaderInfo::url property doesn't exist");
 
179
                }
 
180
                if (Std.is(x1.width, Int)) {
 
181
                    DejaGnu.pass("LoaderInfo::width property exists");
 
182
                } else {
 
183
                    DejaGnu.fail("LoaderInfo::width property doesn't exist");
 
184
                }
 
185
                // childSandboxBridge property only available in the AIR runtime. Not tested
 
186
                /*if (x1.childSandboxBridge == Object) {
 
187
                    DejaGnu.pass("LoaderInfo::childSandboxBridge property exists");
 
188
                } else {
 
189
                    DejaGnu.fail("LoaderInfo::childSandboxBridge property doesn't exist");
 
190
                }*/
 
191
                // parentSandboxBridge property only available in the AIR runtime. Not tested
 
192
                /*if (x1.parentSandboxBridge == Object) {
 
193
                    DejaGnu.pass("LoaderInfo::parentSandboxBridge property exists");
 
194
                } else {
 
195
                    DejaGnu.fail("LoaderInfo::parentSandboxBridge property doesn't exist");
 
196
                }*/
 
197
 
 
198
                // Tests to see if all the methods exist. All these do is test for
 
199
                // existance of a method, and don't test the functionality at all. This
 
200
                // is primarily useful only to test completeness of the API implementation.
 
201
 
 
202
                // FIXME: method doesn't exist (maybe haXe problem)     
 
203
                /*if (Type.typeof(LoaderInfo.getLoaderInfoByDefinition)==TFunction) {
 
204
                    DejaGnu.pass("LoaderInfo::getLoaderInfoByDefinition() method exists");
 
205
                } else {
 
206
                    DejaGnu.fail("LoaderInfo::getLoaderInfoByDefinition() method doesn't exist");
 
207
                }*/
 
208
               
 
209
                DejaGnu.done();
 
210
        });
 
211
        
 
212
        // Specify file where .swf resides -- user can simply replace their username in the
 
213
        // appropriate spot below
 
214
        loader.load(new URLRequest("/home/user_name/gnash/trunk/testsuite/samples/car_smash.swf"));
 
215
#else
 
216
        DejaGnu.note("LoaderInfo is not valid in versions 8 and below");
 
217
#end
 
218
    }
 
219
}
 
220
 
 
221
// local Variables:
 
222
// mode: C++
 
223
// indent-tabs-mode: t
 
224
// End:
 
225