1// Camera_as.hx:  ActionScript 3 "Camera" class, for Gnash.
2//
3// Generated by gen-as3.sh on: 20090503 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.
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
27import flash.media.Camera;
28import flash.display.MovieClip;
29import flash.media.Video;
30#else
31import flash.Camera;
32import flash.MovieClip;
33#end
34import flash.Lib;
35import Type;
36
37import DejaGnu;
38
39// Class must be named with the PP prefix, as that's the name the
40// file passed to haxe will have after the preprocessing step
41class Camera_as {
42    static function typeof(thing:Dynamic) {
43        return ("" + untyped __typeof__(thing));
44    }
45
46    static function main() {
47        #if flash9
48		var x1:Camera = Camera.getCamera();
49        #end
50		#if !flash9
51		var x1:Camera = Camera.get();
52		#end
53
54        // Make sure we actually get a valid class
55        if (x1 != null) {
56            DejaGnu.pass("Camera class exists");
57        } else {
58            DejaGnu.xfail("Camera class doesn't exist");
59        }
60// Tests to see if all the properties exist. All these do is test for
61// existance of a property, and don't test the functionality at all. This
62// is primarily useful only to test completeness of the API implementation.
63
64	#if flash9
65	if (typeof(x1.activityLevel) == "number") {
66	    DejaGnu.pass("Camera::activityLevel property exists");
67	} else {
68	    DejaGnu.fail("Camera::activityLevel property doesn't exist");
69	}
70	if (Type.typeof(x1.bandwidth) == ValueType.TInt) {
71	    DejaGnu.pass("Camera::bandwidth property exists");
72	} else {
73	    DejaGnu.fail("Camera::bandwidth property doesn't exist");
74	}
75	if (typeof(x1.currentFPS) == "number") {
76	    DejaGnu.pass("Camera::currentFPS property exists");
77	} else {
78	    DejaGnu.fail("Camera::currentFPS property doesn't exist");
79	}
80	if (typeof(x1.fps) == "number") {
81	    DejaGnu.pass("Camera::fps property exists");
82	} else {
83	    DejaGnu.fail("Camera::fps property doesn't exist");
84	}
85	if (Type.typeof(x1.height) == ValueType.TInt) {
86	    DejaGnu.pass("Camera::height property exists");
87	} else {
88	    DejaGnu.fail("Camera::height property doesn't exist");
89	}
90	if (Type.typeof(x1.index) == ValueType.TInt) {
91	    DejaGnu.pass("Camera::index property exists");
92	} else {
93	    DejaGnu.fail("Camera::index property doesn't exist");
94	}
95	if (Type.typeof(x1.keyFrameInterval) == ValueType.TInt) {
96	    DejaGnu.pass("Camera::keyFrameInterval property exists");
97	} else {
98	    DejaGnu.fail("Camera::keyFrameInterval property doesn't exist");
99	}
100	if (typeof(x1.loopback) == "boolean") {
101	    DejaGnu.pass("Camera::loopback property exists");
102	} else {
103	    DejaGnu.fail("Camera::loopback property doesn't exist");
104	}
105	if (Type.typeof(x1.motionLevel) == ValueType.TInt) {
106	    DejaGnu.pass("Camera::motionLevel property exists");
107	} else {
108	    DejaGnu.fail("Camera::motionLevel property doesn't exist");
109	}
110	if (Type.typeof(x1.motionTimeout) == ValueType.TInt) {
111	    DejaGnu.pass("Camera::motionTimeout property exists");
112	} else {
113	    DejaGnu.fail("Camera::motionTimeout property doesn't exist");
114	}
115	if (typeof(x1.muted) == "boolean") {
116	    DejaGnu.pass("Camera::muted property exists");
117	} else {
118	    DejaGnu.fail("Camera::muted property doesn't exist");
119	}
120	//FIXME: it would be nice if this checked to make sure the name is
121	//a string
122	if (typeof(x1.name) == "string") {
123	    DejaGnu.pass("Camera::name property exists");
124	} else {
125	    DejaGnu.fail("Camera::name property doesn't exist");
126	}
127	if (Type.typeof(x1.quality) == ValueType.TInt) {
128	    DejaGnu.pass("Camera::quality property exists");
129	} else {
130	    DejaGnu.fail("Camera::quality property doesn't exist");
131	}
132	if (Type.typeof(x1.width) == ValueType.TInt) {
133	    DejaGnu.pass("Camera::width property exists");
134	} else {
135	    DejaGnu.fail("Camera::width property doesn't exist");
136	}
137	#end
138	#if !flash9
139	if (typeof(x1.activityLevel) == "number") {
140	    DejaGnu.pass("Camera::activityLevel property exists");
141	} else {
142	    DejaGnu.fail("Camera::activityLevel property doesn't exist");
143	}
144	if (typeof(x1.bandwidth) == "number") {
145	    DejaGnu.pass("Camera::bandwidth property exists");
146	} else {
147	    DejaGnu.fail("Camera::bandwidth property doesn't exist");
148	}
149	if (typeof(x1.currentFps) == "number") {
150	    DejaGnu.pass("Camera::currentFPS property exists");
151	} else {
152	    DejaGnu.fail("Camera::currentFPS property doesn't exist");
153	}
154	if (typeof(x1.fps) == "number") {
155	    DejaGnu.pass("Camera::fps property exists");
156	} else {
157	    DejaGnu.fail("Camera::fps property doesn't exist");
158	}
159	if (typeof(x1.height) == "number") {
160	    DejaGnu.pass("Camera::height property exists");
161	} else {
162	    DejaGnu.fail("Camera::height property doesn't exist");
163	}
164	if (typeof(x1.index) == "string") {
165	    DejaGnu.pass("Camera::index property exists");
166	} else {
167	    DejaGnu.fail("Camera::index property doesn't exist ");
168	}
169	if (typeof(x1.motionLevel) == "number") {
170	    DejaGnu.pass("Camera::motionLevel property exists");
171	} else {
172	    DejaGnu.fail("Camera::motionLevel property doesn't exist");
173	}
174	if (typeof(x1.muted) == "boolean") {
175	    DejaGnu.pass("Camera::muted property exists");
176	} else {
177	    DejaGnu.fail("Camera::muted property doesn't exist");
178	}
179    if (typeof(x1.name) == "string") {
180        DejaGnu.pass("Camera::name property exists");
181    } else {
182        DejaGnu.fail("Camera::name property doesn't exist");
183    }
184
185	if (typeof(x1.quality) == "number") {
186	    DejaGnu.pass("Camera::quality property exists");
187	} else {
188	    DejaGnu.fail("Camera::quality property doesn't exist");
189	}
190	if (typeof(x1.width) == "number") {
191	    DejaGnu.pass("Camera::width property exists");
192	} else {
193	    DejaGnu.fail("Camera::width property doesn't exist");
194	}
195
196    x1.setMode(800, 600, 30);
197	#end
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	#if flash9
202	if (Type.typeof(x1.setKeyFrameInterval) == ValueType.TFunction) {
203	    DejaGnu.pass("Camera::setKeyFrameInterval() method exists");
204	} else {
205	    DejaGnu.fail("Camera::setKeyFrameInterval() method doesn't exist");
206	}
207	if (Type.typeof(x1.setLoopback) == ValueType.TFunction) {
208	    DejaGnu.pass("Camera::setLoopback() method exists");
209	} else {
210	    DejaGnu.fail("Camera::setLoopback() method doesn't exist");
211	}
212	if (Type.typeof(x1.setMode) == ValueType.TFunction) {
213	    DejaGnu.pass("Camera::setMode() method exists");
214	} else {
215	    DejaGnu.fail("Camera::setMode() method doesn't exist");
216	}
217	if (Type.typeof(x1.setMotionLevel) == ValueType.TFunction) {
218	    DejaGnu.pass("Camera::setMotionLevel() method exists");
219	} else {
220	    DejaGnu.fail("Camera::setMotionLevel() method doesn't exist");
221	}
222	if (Type.typeof(x1.setQuality) == ValueType.TFunction) {
223	    DejaGnu.pass("Camera::setQuality() method exists");
224	} else {
225	    DejaGnu.fail("Camera::setQuality() method doesn't exist");
226	}
227	//FIXME: we should add tests to check that Events in this class are
228	//being properly handled.
229
230	#end
231        // Call this after finishing all tests. It prints out the totals.
232        DejaGnu.done();
233    }
234}
235