1
// LoaderInfo_as.hx: ActionScript 3 "LoaderInfo" class, for Gnash.
3
// Generated by gen-as3.sh on: 20090514 by "rob". Remove this
4
// after any hand editing loosing changes.
6
// Copyright (C) 2009 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.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;
39
import flash.MovieClip;
45
// import our testing API
48
// Class must be named with the _as suffix, as that's the same name as the file.
50
static function main() {
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");
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) {
65
loader.contentLoaderInfo.addEventListener(Event.COMPLETE, function(e) {
67
// Make sure we actually get a valid class
68
if (Std.is(x1, LoaderInfo)) {
69
DejaGnu.pass("LoaderInfo class exists");
71
DejaGnu.fail("LoaderInfo lass doesn't exist");
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");
80
DejaGnu.fail("LoaderInfo::actionScriptVersion property doesn't exist");
82
if (Std.is(x1.applicationDomain, ApplicationDomain)) {
83
DejaGnu.pass("LoaderInfo::applicationDomain property exists");
85
DejaGnu.fail("LoaderInfo::applicationDomain property doesn't exist");
88
/*if (Std.is(x1.bytes, Array)) {
89
DejaGnu.pass("LoaderInfo::bytes property exists");
91
DejaGnu.fail("LoaderInfo::bytes property doesn't exist");
93
if (Std.is(x1.bytesLoaded, Int)) {
94
DejaGnu.pass("LoaderInfo::bytesLoaded property exists");
96
DejaGnu.fail("LoaderInfo::bytesLoaded property doesn't exist");
98
if (Std.is(x1.bytesTotal, Int)) {
99
DejaGnu.pass("LoaderInfo::bytesTotal property exists");
101
DejaGnu.fail("LoaderInfo::bytesTotal property doesn't exist");
103
if (Std.is(x1.childAllowsParent, Bool)) {
104
DejaGnu.pass("LoaderInfo::childAllowsParent property exists");
106
DejaGnu.fail("LoaderInfo::childAllowsParent property doesn't exist");
108
if (Std.is(x1.content, DisplayObject)) {
109
DejaGnu.pass("LoaderInfo::content property exists");
111
DejaGnu.fail("LoaderInfo::content property doesn't exist");
113
if (Type.typeof(x1.contentType)!=ValueType.TNull) {
114
DejaGnu.pass("LoaderInfo::contentType property exists");
116
DejaGnu.fail("LoaderInfo::contentType property doesn't exist");
118
if (Std.is(x1.frameRate, Int)) {
119
DejaGnu.pass("LoaderInfo::frameRate property exists");
121
DejaGnu.fail("LoaderInfo::frameRate property doesn't exist");
123
if (Std.is(x1.height, Int)) {
124
DejaGnu.pass("LoaderInfo::height property exists");
126
DejaGnu.fail("LoaderInfo::height property doesn't exist");
128
if (Std.is(x1.loader, Loader)) {
129
DejaGnu.pass("LoaderInfo::loader property exists");
131
DejaGnu.fail("LoaderInfo::loader property doesn't exist");
133
if (Type.typeof(x1.loaderURL)!=ValueType.TNull) {
134
DejaGnu.pass("LoaderInfo::loaderURL property exists");
136
DejaGnu.fail("LoaderInfo::loaderURL property doesn't exist");
138
if (Std.is(x1.parameters, Dynamic)) {
139
DejaGnu.pass("LoaderInfo::parameters property exists");
141
DejaGnu.fail("LoaderInfo::parameters property doesn't exist");
143
if (Std.is(x1.parentAllowsChild, Bool)) {
144
DejaGnu.pass("LoaderInfo::parentAllowsChild property exists");
146
DejaGnu.fail("LoaderInfo::parentAllowsChild property doesn't exist");
148
if (Std.is(x1.sameDomain, Bool)) {
149
DejaGnu.pass("LoaderInfo::sameDomain property exists");
151
DejaGnu.fail("LoaderInfo::sameDomain property doesn't exist");
153
if (Std.is(x1.sharedEvents, EventDispatcher)) {
154
DejaGnu.pass("LoaderInfo::sharedEvents property exists");
156
DejaGnu.fail("LoaderInfo::sharedEvents property doesn't exist");
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");
166
DejaGnu.fail("LoaderInfo::swfVersion property doesn't exist");
169
if (Std.is(x1.swfVersion, SWFVersion)) {
170
DejaGnu.pass("LoaderInfo::swfVersion property exists");
172
DejaGnu.fail("LoaderInfo::swfVersion property doesn't exist");
175
if (Type.typeof(x1.url)!=ValueType.TNull) {
176
DejaGnu.pass("LoaderInfo::url property exists");
178
DejaGnu.fail("LoaderInfo::url property doesn't exist");
180
if (Std.is(x1.width, Int)) {
181
DejaGnu.pass("LoaderInfo::width property exists");
183
DejaGnu.fail("LoaderInfo::width property doesn't exist");
185
// childSandboxBridge property only available in the AIR runtime. Not tested
186
/*if (x1.childSandboxBridge == Object) {
187
DejaGnu.pass("LoaderInfo::childSandboxBridge property exists");
189
DejaGnu.fail("LoaderInfo::childSandboxBridge property doesn't exist");
191
// parentSandboxBridge property only available in the AIR runtime. Not tested
192
/*if (x1.parentSandboxBridge == Object) {
193
DejaGnu.pass("LoaderInfo::parentSandboxBridge property exists");
195
DejaGnu.fail("LoaderInfo::parentSandboxBridge property doesn't exist");
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.
202
// FIXME: method doesn't exist (maybe haXe problem)
203
/*if (Type.typeof(LoaderInfo.getLoaderInfoByDefinition)==TFunction) {
204
DejaGnu.pass("LoaderInfo::getLoaderInfoByDefinition() method exists");
206
DejaGnu.fail("LoaderInfo::getLoaderInfoByDefinition() method doesn't exist");
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"));
216
DejaGnu.note("LoaderInfo is not valid in versions 8 and below");
223
// indent-tabs-mode: t