Update with current status
[gnash.git] / testsuite / misc-haxe.all / classes.all / display / BitmapData_as.hx
blob80cbe39c9182fdbd408559a2a8eb4bcb2dbd3150
1 // BitmapData_as.hx: ActionScript 3 "BitmapData" class, for Gnash.
2 //
3 // Generated on: 20090528 by "bnaugle". 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.
27 #if flash9
28 import flash.utils.ByteArray;
29 import flash.display.DisplayObject;
30 import flash.display.MovieClip;
31 import flash.display.BitmapData;
32 import flash.display.Bitmap;
33 import flash.Error;
34 #end
35 #if flash8
36 import flash.MovieClip;
37 import flash.display.BitmapData;
38 #end
39 #if (flash8 || flash9)
40 import flash.geom.Rectangle;
41 #end
42 import flash.Lib;
43 import Type;
44 import Std;
45 import haxe.PosInfos;
47 // import our testing API
48 import DejaGnu;
50 // Class must be named with the _as suffix, as that's the same name as the file.
51 class BitmapData_as {
52 static function main() {
54 #if !(flash6 || flash7)
56 #if flash8
57 DejaGnu.note("*** Class/Method/Property existence tests ");
58 //check_equals(typeof(Bitmap), 'function');
59 if(untyped __typeof__(BitmapData) == 'function') {
60 DejaGnu.pass("BitmapData is a function");
61 } else {
62 DejaGnu.fail("BitmapData is not a function");
64 //check_equals(typeof(Bitmap.prototype), 'object');
65 if(untyped __typeof__(BitmapData.prototype) == 'object') {
66 DejaGnu.pass("BitmapData prototype is an object");
67 } else {
68 DejaGnu.fail("BitmapData prototype is not an object");
70 if(untyped BitmapData.prototype.hasOwnProperty('applyFilter')) {
71 DejaGnu.pass("BitmapData prototype has 'applyFilter' property");
72 } else {
73 DejaGnu.fail("BitmapData prototype does not have 'applyFilter' property");
75 if(untyped BitmapData.prototype.hasOwnProperty('clone')) {
76 DejaGnu.pass("BitmapData prototype has 'clone' property");
77 } else {
78 DejaGnu.fail("BitmapData prototype does not have 'clone' property");
80 if(untyped BitmapData.prototype.hasOwnProperty('colorTransform')) {
81 DejaGnu.pass("BitmapData prototype has 'colorTransform' property");
82 } else {
83 DejaGnu.fail("BitmapData prototype does not have 'colorTransform' property");
85 if(untyped BitmapData.prototype.hasOwnProperty('copyChannel')) {
86 DejaGnu.pass("BitmapData prototype has 'copyChannel' property");
87 } else {
88 DejaGnu.fail("BitmapData prototype does not have 'copyChannel' property");
90 if(untyped BitmapData.prototype.hasOwnProperty('copyPixels')) {
91 DejaGnu.pass("BitmapData prototype has 'copyPixels' property");
92 } else {
93 DejaGnu.fail("BitmapData prototype does not have 'copyPixels' property");
95 if(untyped BitmapData.prototype.hasOwnProperty('dispose')) {
96 DejaGnu.pass("BitmapData prototype has 'dispose' property");
97 } else {
98 DejaGnu.fail("BitmapData prototype does not have 'dispose' property");
100 if(untyped BitmapData.prototype.hasOwnProperty('draw')) {
101 DejaGnu.pass("BitmapData prototype has 'draw' property");
102 } else {
103 DejaGnu.fail("BitmapData prototype does not have 'draw' property");
105 if(untyped BitmapData.prototype.hasOwnProperty('fillRect')) {
106 DejaGnu.pass("BitmapData prototype has 'fillRect' property");
107 } else {
108 DejaGnu.fail("BitmapData prototype does not have 'fillRect' property");
110 if(untyped BitmapData.prototype.hasOwnProperty('floodFill')) {
111 DejaGnu.pass("BitmapData prototype has 'floodFill' property");
112 } else {
113 DejaGnu.fail("BitmapData prototype does not have 'floodFill' property");
115 if(untyped BitmapData.prototype.hasOwnProperty('generateFilterRect')) {
116 DejaGnu.pass("BitmapData prototype has 'generateFilterRect' property");
117 } else {
118 DejaGnu.fail("BitmapData prototype does not have 'generateFilterRect' property");
120 if(untyped BitmapData.prototype.hasOwnProperty('getColorBoundsRect')) {
121 DejaGnu.pass("BitmapData prototype has 'getColorBoundsRect' property");
122 } else {
123 DejaGnu.fail("BitmapData prototype does not have 'getColorBoundsRect' property");
125 if(untyped BitmapData.prototype.hasOwnProperty('getPixel')) {
126 DejaGnu.pass("BitmapData prototype has 'getPixel' property");
127 } else {
128 DejaGnu.fail("BitmapData prototype does not have 'getPixel' property");
130 if(untyped BitmapData.prototype.hasOwnProperty('getPixel32')) {
131 DejaGnu.pass("BitmapData prototype has 'getPixel32' property");
132 } else {
133 DejaGnu.fail("BitmapData prototype does not have 'getPixel32' property");
135 if(untyped BitmapData.prototype.hasOwnProperty('hitTest')) {
136 DejaGnu.pass("BitmapData prototype has 'hitTest' property");
137 } else {
138 DejaGnu.fail("BitmapData prototype does not have 'hitTest' property");
140 if(untyped BitmapData.prototype.hasOwnProperty('merge')) {
141 DejaGnu.pass("BitmapData prototype has 'merge' property");
142 } else {
143 DejaGnu.fail("BitmapData prototype does not have 'merge' property");
145 if(untyped BitmapData.prototype.hasOwnProperty('noise')) {
146 DejaGnu.pass("BitmapData prototype has 'noise' property");
147 } else {
148 DejaGnu.fail(" BitmapData prototype does not have 'noise' property");
150 if(untyped BitmapData.prototype.hasOwnProperty('paletteMap')) {
151 DejaGnu.pass("BitmapData prototype has 'paletteMap' property");
152 } else {
153 DejaGnu.fail("BitmapData prototype does not have 'paletteMap' property");
155 if(untyped BitmapData.prototype.hasOwnProperty('perlinNoise')) {
156 DejaGnu.pass("BitmapData prototype has 'perlinNoise' property");
157 } else {
158 DejaGnu.fail("BitmapData prototype does not have 'perlinNoise' property");
160 if(untyped BitmapData.prototype.hasOwnProperty('pixelDissolve')) {
161 DejaGnu.pass("BitmapData prototype has 'pixelDissolve' property");
162 } else {
163 DejaGnu.fail("BitmapData prototype does not have 'pixelDissolve' property");
165 if(untyped BitmapData.prototype.hasOwnProperty('scroll')) {
166 DejaGnu.pass("BitmapData prototype has 'scroll' property");
167 } else {
168 DejaGnu.fail("BitmapData prototype does not have 'scroll' property");
170 if(untyped BitmapData.prototype.hasOwnProperty('setPixel')) {
171 DejaGnu.pass("BitmapData prototype has 'setPixel' property");
172 } else {
173 DejaGnu.fail("BitmapData prototype does not have 'setPixel' property");
175 if(untyped BitmapData.prototype.hasOwnProperty('setPixel32')) {
176 DejaGnu.pass("BitmapData prototype has 'setPixel32' property");
177 } else {
178 DejaGnu.fail("BitmapData prototype does not have 'setPixel32' property");
180 if(untyped BitmapData.prototype.hasOwnProperty('threshold')) {
181 DejaGnu.pass("BitmapData prototype has 'threshold' property");
182 } else {
183 DejaGnu.fail("BitmapData prototype does not have 'threshold' property");
185 if(untyped BitmapData.prototype.hasOwnProperty('height')) {
186 DejaGnu.pass("BitmapData prototype has 'height' property");
187 } else {
188 DejaGnu.fail("BitmapData prototype does not have 'height' property");
190 if(untyped BitmapData.prototype.hasOwnProperty('width')) {
191 DejaGnu.pass("BitmapData prototype has 'width' property");
192 } else {
193 DejaGnu.fail("BitmapData prototype does not have 'width' property");
195 if(untyped BitmapData.prototype.hasOwnProperty('rectangle')) {
196 DejaGnu.pass("BitmapData prototype has 'rectangle' property");
197 } else {
198 DejaGnu.fail("BitmapData prototype does not have 'rectangle' property");
200 if(untyped BitmapData.prototype.hasOwnProperty('transparent')) {
201 DejaGnu.pass("BitmapData prototype has 'transparent' property");
202 } else {
203 DejaGnu.fail("BitmapData prototype does not have 'transparent' property");
206 if(!(untyped BitmapData.prototype.hasOwnProperty('loadBitmap'))) {
207 DejaGnu.pass("BitmapData prototype does not have 'loadBitmap' property");
208 } else {
209 DejaGnu.fail("BitmapData prototype has 'loadBitmapData' property");
211 if(untyped BitmapData.hasOwnProperty('loadBitmap')) {
212 DejaGnu.pass("BitmapData has 'loadBitmap' property");
213 } else {
214 DejaGnu.fail("BitmapData does not have 'loadBitmap' property");
217 #else
219 DejaGnu.note("*** Class/Method/Property existence tests ");
220 // In flash 9 we seem to need an instance of the object to test these.
221 // This is probably because of the difference in the way inheritance
222 // and class objects work
223 var bdata = new BitmapData(200, 300);
224 //check_equals(typeof(Bitmap), 'function');
225 if(untyped __typeof__(BitmapData) == 'object') {
226 DejaGnu.pass("BitmapData is a function");
227 } else {
228 DejaGnu.fail("BitmapData is not a function");
230 //check_equals(typeof(Bitmap.prototype), 'object');
231 if(untyped __typeof__(BitmapData.prototype) == 'object') {
232 DejaGnu.pass("BitmapData is an object");
233 } else {
234 DejaGnu.fail("BitmapData is not an object");
237 if(untyped bdata.hasOwnProperty('applyFilter')) {
238 DejaGnu.pass("BitmapData has 'applyFilter' property");
239 } else {
240 DejaGnu.fail("BitmapData does not have 'applyFilter' property");
242 if(untyped bdata.hasOwnProperty('clone')) {
243 DejaGnu.pass("BitmapData has 'clone' property");
244 } else {
245 DejaGnu.fail("BitmapData does not have 'clone' property");
247 if(untyped bdata.hasOwnProperty('colorTransform')) {
248 DejaGnu.pass("BitmapData has 'colorTransform' property");
249 } else {
250 DejaGnu.fail("BitmapData does not have 'colorTransform' property");
252 if(untyped bdata.hasOwnProperty('copyChannel')) {
253 DejaGnu.pass("BitmapData has 'copyChannel' property");
254 } else {
255 DejaGnu.fail("BitmapData does not have 'copyChannel' property");
257 if(untyped bdata.hasOwnProperty('copyPixels')) {
258 DejaGnu.pass("BitmapData has 'copyPixels' property");
259 } else {
260 DejaGnu.fail("BitmapData does not have 'copyPixels' property");
262 if(untyped bdata.hasOwnProperty('dispose')) {
263 DejaGnu.pass("BitmapData has 'dispose' property");
264 } else {
265 DejaGnu.fail("BitmapData does not have 'dispose' property");
267 if(untyped bdata.hasOwnProperty('draw')) {
268 DejaGnu.pass("BitmapData has 'draw' property");
269 } else {
270 DejaGnu.fail("BitmapData does not have 'draw' property");
272 if(untyped bdata.hasOwnProperty('fillRect')) {
273 DejaGnu.pass("BitmapData has 'fillRect' property");
274 } else {
275 DejaGnu.fail("BitmapData does not have 'fillRect' property");
277 if(untyped bdata.hasOwnProperty('floodFill')) {
278 DejaGnu.pass("BitmapData has 'floodFill' property");
279 } else {
280 DejaGnu.fail("BitmapData does not have 'floodFill' property");
282 if(untyped bdata.hasOwnProperty('generateFilterRect')) {
283 DejaGnu.pass("BitmapData has 'generateFilterRect' property");
284 } else {
285 DejaGnu.fail("BitmapData does not have 'generateFilterRect' property");
287 if(untyped bdata.hasOwnProperty('getColorBoundsRect')) {
288 DejaGnu.pass("BitmapData has 'getColorBoundsRect' property");
289 } else {
290 DejaGnu.fail("BitmapData prototype does not have 'getColorBoundsRect' property");
292 if(untyped bdata.hasOwnProperty('getPixel')) {
293 DejaGnu.pass("BitmapData has 'getPixel' property");
294 } else {
295 DejaGnu.fail("BitmapData does not have 'getPixel' property");
297 if(untyped bdata.hasOwnProperty('getPixel32')) {
298 DejaGnu.pass("BitmapData has 'getPixel32' property");
299 } else {
300 DejaGnu.fail("BitmapData does not have 'getPixel32' property");
302 if(untyped bdata.hasOwnProperty('hitTest')) {
303 DejaGnu.pass("BitmapData has 'hitTest' property");
304 } else {
305 DejaGnu.fail("BitmapData does not have 'hitTest' property");
307 if(untyped bdata.hasOwnProperty('merge')) {
308 DejaGnu.pass("BitmapData has 'merge' property");
309 } else {
310 DejaGnu.fail("BitmapData does not have 'merge' property");
312 if(untyped bdata.hasOwnProperty('noise')) {
313 DejaGnu.pass("BitmapData has 'noise' property");
314 } else {
315 DejaGnu.fail("BitmapData does not have 'noise' property");
317 if(untyped bdata.hasOwnProperty('paletteMap')) {
318 DejaGnu.pass("BitmapData has 'paletteMap' property");
319 } else {
320 DejaGnu.fail("BitmapData does not have 'paletteMap' property");
322 if(untyped bdata.hasOwnProperty('perlinNoise')) {
323 DejaGnu.pass("BitmapData has 'perlinNoise' property");
324 } else {
325 DejaGnu.fail("BitmapData does not have 'perlinNoise' property");
327 if(untyped bdata.hasOwnProperty('pixelDissolve')) {
328 DejaGnu.pass("BitmapData has 'pixelDissolve' property");
329 } else {
330 DejaGnu.fail("BitmapData does not have 'pixelDissolve' property");
332 if(untyped bdata.hasOwnProperty('scroll')) {
333 DejaGnu.pass("BitmapData has 'scroll' property");
334 } else {
335 DejaGnu.fail("BitmapData does not have 'scroll' property");
337 if(untyped bdata.hasOwnProperty('setPixel')) {
338 DejaGnu.pass("BitmapData has 'setPixel' property");
339 } else {
340 DejaGnu.fail("BitmapData does not have 'setPixel' property");
342 if(untyped bdata.hasOwnProperty('setPixel32')) {
343 DejaGnu.pass("BitmapData has 'setPixel32' property");
344 } else {
345 DejaGnu.fail("BitmapData does not have 'setPixel32' property");
347 if(untyped bdata.hasOwnProperty('threshold')) {
348 DejaGnu.pass("BitmapData has 'threshold' property");
349 } else {
350 DejaGnu.fail("BitmapData does not have 'threshold' property");
352 if(untyped bdata.hasOwnProperty('height')) {
353 DejaGnu.pass("BitmapData has 'height' property");
354 } else {
355 DejaGnu.fail("BitmapData does not have 'height' property");
357 if(untyped bdata.hasOwnProperty('width')) {
358 DejaGnu.pass("BitmapData has 'width' property");
359 } else {
360 DejaGnu.fail("BitmapData does not have 'width' property");
362 if(untyped bdata.hasOwnProperty('rect')) {
363 DejaGnu.pass("BitmapData has 'rectangle' property");
364 } else {
365 DejaGnu.fail("BitmapData does not have 'rectangle' property");
367 if(untyped bdata.hasOwnProperty('transparent')) {
368 DejaGnu.pass("BitmapData has 'transparent' property");
369 } else {
370 DejaGnu.fail("BitmapData does not have 'transparent' property");
372 //NOTE: This property supposedly does not exist in flash9 (according to
373 // the Adobe livedocs but this test seems to pass anyway
374 if( !(untyped bdata.hasOwnProperty('loadBitmap')) ) {
375 DejaGnu.pass("BitmapData 'loadBitmap' property exists even though livedocs claim it doesn't");
376 } else {
377 DejaGnu.fail("BitmapData does not have 'loadBitmap' property");
380 #end
382 //Testing that functions are actually functions
383 var x1 = new BitmapData(20, 30, false, 0xeeddee);
384 // Change these, but keep them
385 if (Type.typeof(x1.applyFilter) == ValueType.TFunction) {
386 DejaGnu.pass("BitmapData::applyFilter() is a function");
387 } else {
388 DejaGnu.fail(" BitmapData::applyFilter() is not a function");
390 if (Type.typeof(x1.clone) == ValueType.TFunction) {
391 DejaGnu.pass("BitmapData::clone() is a function");
392 } else {
393 DejaGnu.fail(" BitmapData::clone() is not a function");
395 if (Type.typeof(x1.colorTransform) == ValueType.TFunction) {
396 DejaGnu.pass("BitmapData::colorTransform() is a function");
397 } else {
398 DejaGnu.fail(" BitmapData::colorTransform() is not a function");
400 #if flash9
401 if (Type.typeof(x1.compare) == ValueType.TFunction) {
402 DejaGnu.pass("BitmapData::compare() is a function");
403 } else {
404 DejaGnu.fail(" BitmapData::compare() is not a function");
406 #end
407 if (Type.typeof(x1.copyChannel) == ValueType.TFunction) {
408 DejaGnu.pass("BitmapData::copyChannel() is a function");
409 } else {
410 DejaGnu.fail(" BitmapData::copyChannel() is not a function");
412 if (Type.typeof(x1.copyPixels) == ValueType.TFunction) {
413 DejaGnu.pass("BitmapData::copyPixels() is a function");
414 } else {
415 DejaGnu.fail(" BitmapData::copyPixels() is not a function");
417 if (Type.typeof(x1.dispose) == ValueType.TFunction) {
418 DejaGnu.pass("BitmapData::dispose() is a function");
419 } else {
420 DejaGnu.fail(" BitmapData::dispose() is not a function");
422 if (Type.typeof(x1.draw) == ValueType.TFunction) {
423 DejaGnu.pass("BitmapData::draw() is a function");
424 } else {
425 DejaGnu.fail(" BitmapData::draw() is not a function");
427 if (Type.typeof(x1.generateFilterRect) == ValueType.TFunction) {
428 DejaGnu.pass("BitmapData::generateFilterRect() is a function");
429 } else {
430 DejaGnu.fail(" BitmapData::generateFilterRect() is not a function");
432 if (Type.typeof(x1.getColorBoundsRect) == ValueType.TFunction) {
433 DejaGnu.pass("BitmapData::getColorBoundsRect() is a function");
434 } else {
435 DejaGnu.fail(" BitmapData::getColorBoundsRect() is not a function");
437 #if flash9
438 if (Type.typeof(x1.getPixels) == ValueType.TFunction) {
439 DejaGnu.pass("BitmapData::getPixels() is a function");
440 } else {
441 DejaGnu.fail(" BitmapData::getPixels() is not a function");
443 //FIXME: These method exists in HaXe API Documentation, but is not supported, and does not exist in Adobe documentation
444 // if (Type.typeof(x1.getVector) == ValueType.TFunction) {
445 // DejaGnu.pass("BitmapData::getVector() method exists");
446 // } else {
447 // DejaGnu.fail("BitmapData::getVector() is not a function");
448 // }
449 // if (Type.typeof(x1.histogram) == ValueType.TFunction) {
450 // DejaGnu.pass("BitmapData::histogram() method exists");
451 // } else {
452 // DejaGnu.fail("BitmapData::histogram() is not a function");
453 // }
454 #end
455 if (Type.typeof(x1.hitTest) == ValueType.TFunction) {
456 DejaGnu.pass("BitmapData::hitTest() is a function");
457 } else {
458 DejaGnu.fail(" BitmapData::hitTest() is not a function");
460 #if flash9
461 if (Type.typeof(x1.lock) == ValueType.TFunction) {
462 DejaGnu.pass("BitmapData::lock() is a function");
463 } else {
464 DejaGnu.fail(" BitmapData::lock() is not a function");
466 #end
467 if (Type.typeof(x1.merge) == ValueType.TFunction) {
468 DejaGnu.pass("BitmapData::merge() is a function");
469 } else {
470 DejaGnu.fail(" BitmapData::merge() is not a function");
472 if (Type.typeof(x1.noise) == ValueType.TFunction) {
473 DejaGnu.pass("BitmapData::noise() is a function");
474 } else {
475 DejaGnu.fail(" BitmapData::noise() is not a function");
477 if (Type.typeof(x1.paletteMap) == ValueType.TFunction) {
478 DejaGnu.pass("BitmapData::paletteMap() is a function");
479 } else {
480 DejaGnu.fail(" BitmapData::paletteMap() is not a function");
482 if (Type.typeof(x1.perlinNoise) == ValueType.TFunction) {
483 DejaGnu.pass("BitmapData::perlinNoise() is a function");
484 } else {
485 DejaGnu.fail(" BitmapData::perlinNoise() is not a function");
487 if (Type.typeof(x1.pixelDissolve) == ValueType.TFunction) {
488 DejaGnu.pass("BitmapData::pixelDissolve() is a function");
489 } else {
490 DejaGnu.fail(" BitmapData::pixelDissolve() is not a function");
492 if (Type.typeof(x1.scroll) == ValueType.TFunction) {
493 DejaGnu.pass("BitmapData::scroll() is a function");
494 } else {
495 DejaGnu.fail(" BitmapData::scroll() is not a function");
497 #if flash9
498 if (Type.typeof(x1.setPixels) == ValueType.TFunction) {
499 DejaGnu.pass("BitmapData::setPixels() is a function");
500 } else {
501 DejaGnu.fail(" BitmapData::setPixels() is not a function");
503 //FIXME: This method exists in HaXe API Documentation, but is not supported, and does not exist in Adobe documentation
504 // if (Type.typeof(x1.setVector) == ValueType.TFunction) {
505 // DejaGnu.pass("BitmapData::setVector() method exists");
506 // } else {
507 // DejaGnu.fail("BitmapData::setVector() is not a function");
508 // }
509 #end
510 if (Type.typeof(x1.threshold) == ValueType.TFunction) {
511 DejaGnu.pass("BitmapData::threshold() is a function");
512 } else {
513 DejaGnu.fail(" BitmapData::threshold() is not a function");
515 #if flash9
516 if (Type.typeof(x1.unlock) == ValueType.TFunction) {
517 DejaGnu.pass("BitmapData::unlock() is a function");
518 } else {
519 DejaGnu.fail(" BitmapData::unlock() is not a function");
521 #else
522 if (Type.typeof(BitmapData.loadBitmap) == ValueType.TFunction) {
523 DejaGnu.pass("BitmapData::loadBitmap() is a function");
524 } else {
525 DejaGnu.fail(" BitmapData::loadBitmap() is not a function");
527 #end
529 //-------------------------------------------------------------
530 // Test constructor
531 //-------------------------------------------------------------
532 DejaGnu.note("*** BitmapData Constructor Tests ***");
534 #if flash8
535 DejaGnu.note("** Ctor BitmapData()");
536 var bmpNoArg:BitmapData = untyped __new__(BitmapData);
538 //FIXME: This test illustrates a problem in gnash that nobody has fixed
539 if(untyped __typeof__(bmpNoArg) == 'undefined') {
540 DejaGnu.pass("Bitmap constructor with no args returned undefined");
541 } else {
542 DejaGnu.fail("Bitmap constructor did not return undefined");
544 #else
545 //NOTE: Should Gnash throw an error here too?
546 // finally figured out how to make a test out of this with try .. catch
547 // will probably have to individually test error codes to see what each
548 // errorID is
549 DejaGnu.note("The PP throws an error if we call the constructor with no arguments");
550 try {
551 var bmpNoArg:BitmapData = untyped __new__(BitmapData);
552 DejaGnu.fail("Ctor BitmapData() did not throw an error, it should");
553 } catch( e : Error ) {
554 DejaGnu.pass("Ctor BitmapData() correctly threw an error, id: " + e.errorID);
555 if ( e.name == 'ArgumentError') {
556 DejaGnu.pass("Ctor BitmapData() correctly threw 'ArgumentError' id: " + e.message);
557 } else {
558 DejaGnu.fail("Ctor did not throw 'ArgumentError', error caught: " + e);
562 #end
564 DejaGnu.note("** Ctor BitmapData(10, 10)");
565 var bmp = new BitmapData(10, 10);
566 //check_equals(typeof(bmp), 'object');
567 if (untyped __typeof__(bmp) == 'object') {
568 DejaGnu.pass("Constructor BitmapData(10, 10) returns an object");
569 } else {
570 DejaGnu.fail("Constructor BitmapData(10, 10) did not return an object");
573 //NOTE: flash 9 does not have the instanceof function, however the haxe
574 // function Std.is seems to work in SWF8 & 9. This probably needs more
575 // investigation
576 //check(bmp instanceof Bitmap);
577 if (Std.is(bmp, BitmapData)) {
578 DejaGnu.pass("bmp is an instance of a BitmapData");
579 } else {
580 DejaGnu.fail("bmp is not an instance of a BitmapData");
584 #if flash8
585 //NOTE: The pp gives different behavior here between SWF8 and SWF9. This
586 // has to do with the differences in property inheritance and the
587 // hasOwnProperty function between the two versions
589 // These are prototype properties in flash8 and don't exist on instances
590 //check(!bmp.hasOwnProperty("height"));
591 if ( !(untyped bmp.hasOwnProperty('height')) ) {
592 DejaGnu.pass("Constructor did not set the 'height' property for bmp");
593 } else {
594 DejaGnu.fail("Constructor set the 'height' property for bmp");
596 //check(!bmp.hasOwnProperty("width"));
597 if ( !(untyped bmp.hasOwnProperty("width")) ) {
598 DejaGnu.pass("Constructor did not set the 'width' property for bmp");
599 } else {
600 DejaGnu.fail("Constructor set the 'width' property for bmp");
602 //check(!bmp.hasOwnProperty("rectangle"));
603 if ( !(untyped bmp.hasOwnProperty('rectangle')) ) {
604 DejaGnu.pass("Constructor did not set the 'rectangle' property for bmp");
605 } else {
606 DejaGnu.fail("Constructor set the 'rectangle' property for bmp");
608 //check(!bmp.hasOwnProperty("transparent"));
609 if ( !(untyped bmp.hasOwnProperty('transparent')) ) {
610 DejaGnu.pass("Constructor did not set the 'transparent' property for bmp");
611 } else {
612 DejaGnu.fail("Constructor set the 'transparent' property for bmp");
614 #else
615 //These are object properties in flash9 that the instance should have
616 if ( untyped bmp.hasOwnProperty('height') ) {
617 DejaGnu.pass("Constructor set the 'height' property for bmp");
618 } else {
619 DejaGnu.fail("Constructor did not set the 'height' property for bmp");
621 if ( untyped bmp.hasOwnProperty("width") ) {
622 DejaGnu.pass("Constructor set the 'width' property for bmp");
623 } else {
624 DejaGnu.fail("Constructor did not set the 'width' property for bmp");
626 //NOTE: need to check 'rect' for flash 9
627 if ( untyped bmp.hasOwnProperty('rect') ) {
628 DejaGnu.pass("Constructor set the 'rect' property for bmp");
629 } else {
630 DejaGnu.fail("Constructor did not set the 'rect' property for bmp");
632 if ( untyped bmp.hasOwnProperty('transparent') ) {
633 DejaGnu.pass("Constructor set the 'transparent' property for bmp");
634 } else {
635 DejaGnu.fail("Constructor did not set the 'transparent' property for bmp");
637 #end
638 //check_equals(bmp.height, 10);
639 if (bmp.height == 10) {
640 DejaGnu.pass("bmp.height == 10 after construction");
641 } else {
642 DejaGnu.fail("bmp.height != 10 after construction");
644 //check_equals(bmp.width, 10);
645 if (bmp.width == 10) {
646 DejaGnu.pass("bmp.width == 10 after construction");
647 } else {
648 DejaGnu.fail("bmp.width != 10 after construction");
650 //check_equals(bmp.transparent, true);
651 if (bmp.transparent == true) {
652 DejaGnu.pass("bmp.transparent == true after construction");
653 } else {
654 DejaGnu.fail("bmp.transparent != true after construction");
656 #if flash8
657 //check_equals(bmp.rectangle.toString(), "(x=0, y=0, w=10, h=10)");
658 if (bmp.rectangle.toString() == "(x=0, y=0, w=10, h=10)") {
659 DejaGnu.pass("bmp.rectangle initialized correctly during construction");
660 } else {
661 DejaGnu.fail("bmp.rectangle not initialized correctly during construction");
663 //check(bmp.rectangle instanceOf flash.geom.Rectangle);
664 if (Std.is(bmp.rectangle, flash.geom.Rectangle)) {
665 DejaGnu.pass("bmp.rectangle is an instance of a rectangle");
666 } else {
667 DejaGnu.fail("bmp.rectangle is not an instance of a rectangle");
669 #else
670 if (bmp.rect.toString() == "(x=0, y=0, w=10, h=10)") {
671 DejaGnu.pass("bmp.rect initialized correctly during construction");
672 } else {
673 DejaGnu.fail("bmp.rect not initialized correctly during construction");
675 //check(bmp.rectangle instanceOf flash.geom.Rectangle);
676 if (Std.is(bmp.rect, flash.geom.Rectangle)) {
677 DejaGnu.pass("bmp.rect is an instance of a rectangle");
678 } else {
679 DejaGnu.fail("bmp.rect is not an instance of a rectangle");
681 #end
682 //check_equals(bmp.getPixel(1, 1), 16777215);
683 if (bmp.getPixel(1,1) == 16777215) {
684 DejaGnu.pass("bmp pixel (1, 1,) initialized correctly");
685 } else {
686 DejaGnu.fail("bmp pixel (1, 1) was not initialized correctly");
688 //check_equals(bmp.getPixel(9, 9), 16777215);
689 if (bmp.getPixel(9, 9) == 16777215) {
690 DejaGnu.pass("bmp pixel (9, 9) initialized correctly");
691 } else {
692 DejaGnu.fail("bmp pixel (9, 9) was not initialized correctly");
694 #if flash8
695 //NOTE: The pp returns different numbers here based on the version.
696 // Different precission values are returned based on version
698 // The livedocs claim that SWF8 returns a Number, which is a double-
699 // precission IEEE-754 value
701 //check_equals(bmp.getPixel32(1, 1), -1);
702 if (bmp.getPixel32(1, 1) == -1) {
703 DejaGnu.pass("bmp.getPixel32(1, 1) correctly returned -1");
704 } else {
705 DejaGnu.fail("bmp.getPixel32(1 1) did not return correctly");
707 #else
708 // The livedocs claim that SWF9 returns a uint value, which is a 32 bit
709 // unsigned integer
710 if (bmp.getPixel32(1, 1) == 4294967295) {
711 DejaGnu.pass("bmp.getPixel32(1, 1) correctly returns 4294967295");
712 } else {
713 DejaGnu.fail("bmp.getPixel32(1, 1) did not return correctly");
715 #end
718 DejaGnu.note("** Ctor BitmapData(10, 10, true)");
719 bmp = new BitmapData(10, 10, true);
720 //see previous note about precission
721 #if flash8
722 //check_equals(bmp.getPixel32(1, 1), -1);
723 if (bmp.getPixel32(1, 1) == -1) {
724 DejaGnu.pass("Ctor BitmapData(10, 10, true) created correct (1, 1) pixel");
725 } else {
726 DejaGnu.fail("Constructor BitmapData(10, 10, true) did not operate correctly");
728 #else
729 if (bmp.getPixel32(1, 1) == 4294967295) {
730 DejaGnu.pass("Ctor BitmapData(10, 10, true) created correct (1, 1) pixel");
731 } else {
732 DejaGnu.fail("Constructor BitmapData(10, 10, true) did not operate correctly");
734 #end
736 DejaGnu.note("** Ctor BitmapData(10, 10, false)");
737 bmp = new BitmapData(10, 10, false);
738 //see previous note about precission
739 #if flash8
740 //check_equals(bmp.getPixel32(1, 1), -1);
741 if (bmp.getPixel32(1, 1) == -1) {
742 DejaGnu.pass("Ctor BitmapData(10, 10, false) created correct (1, 1) pixel");
743 } else {
744 DejaGnu.fail("Ctor BitmapData(10, 10, false) did not operate correctly");
746 #else
747 if (bmp.getPixel32(1, 1) == 4294967295) {
748 DejaGnu.pass("Ctor BitmapData(10, 10, true) created correct (1, 1) pixel");
749 } else {
750 DejaGnu.fail("Constructor BitmapData(10, 10, true) did not operate correctly");
752 #end
755 DejaGnu.note("** Ctor BitmapData(10, 30, false, 0xeeddee)");
756 var x1 = new BitmapData(20, 30, false, 0xeeddee);
757 // check(x1 instanceof Bitmap);
758 if (Std.is(x1,BitmapData)) {
759 DejaGnu.pass("x1 is an instance of a BitmapData");
760 } else {
761 DejaGnu.fail("x1 is not an instance of a BitmapData");
764 //check_equals(x1.height, 10);
765 if (Type.typeof(x1.height) == ValueType.TInt) {
766 DejaGnu.pass("BitmapData::height property exists");
767 if (x1.height == 30) {
768 DejaGnu.pass("BitmapData.height property is correct int (30)");
769 } else {
770 DejaGnu.fail("BitmapData.height " +
771 "property is incorrect int (should be 30, is "+x1.height+")");
773 } else {
774 DejaGnu.fail("BitmapData::height property doesn't exist");
776 //check_equals(x1.width, 10);
777 if (Type.typeof(x1.width) == ValueType.TInt) {
778 DejaGnu.pass("BitmapData::width property exists");
779 if (x1.width == 20) {
780 DejaGnu.pass("BitmapData.width property is correct int (20)");
781 } else {
782 DejaGnu.fail("BitmapData.width property"
783 + "is incorrect int (should be 20, is "+x1.width+")");
785 } else {
786 DejaGnu.fail("BitmapData::width property doesn't exist");
788 //check_equals(x1.transparent, true);
789 if (Type.typeof(x1.transparent) == ValueType.TBool) {
790 DejaGnu.pass("BitmapData::transparent property exists");
791 if (x1.transparent == false) {
792 DejaGnu.pass("BitmapData.transparent property is correct bool (false)");
793 } else {
794 DejaGnu.fail("BitmapData.transparent" +
795 "property is incorrect bool (should be false, is "+
796 x1.transparent+")");
798 } else {
799 DejaGnu.fail("BitmapData::transparent property doesn't exist");
801 #if flash9
802 //check_equals(x1.rect.toString(), "(x=0, y=0, w=10, h=10)");
803 if (Std.is(x1.rect, Rectangle)) {
804 DejaGnu.pass("BitmapData::rect property exists");
805 if (x1.rect.toString() == "(x=0, y=0, w=20, h=30)") {
806 DejaGnu.pass("BitmapData.rect property is correct rectangle (x=0, y=0, w=20, h=30)");
807 } else {
808 DejaGnu.fail("BitmapData.rect property is incorrect rectangle (should be (x=0, y=0, w=20, h=30), is "+x1.rect.toString()+")");
810 } else {
811 DejaGnu.fail("BitmapData::rect property doesn't exist");
813 #else
814 //check_equals(x1.rectangle.toString(), "(x=0, y=0, w=10, h=10)");
815 if (Std.is(x1.rectangle, Rectangle)) {
816 DejaGnu.pass("BitmapData::rectangle property exists");
817 if (x1.rectangle.toString() == "(x=0, y=0, w=20, h=30)") {
818 DejaGnu.pass("BitmapData.rectangle property is correct rectangle (x=0, y=0, w=20, h=30)");
819 } else {
820 DejaGnu.fail("BitmapData.rectangle property is incorrect rectangle (should be (x=0, y=0, w=20, h=30), is "+x1.rectangle.toString()+")");
822 } else {
823 DejaGnu.fail("BitmapData::rectangle property doesn't exist");
825 #end
827 //check_equals(bmp.getPixel(1, 1), 0xeeddee);
828 if (x1.getPixel(1,1) == 0xeeddee) {
829 DejaGnu.pass("BitmapData::getPixel(1,1) method returns correct number (0xeeddee)");
830 } else {
831 DejaGnu.fail("BitmapData::getPixel(1,1) method returns incorrect number (should be 0xeeddee, is "+x1.getPixel(1,1)+")");
833 //check_equals(bmp.getPixel(50, 1), 0);
834 if (x1.getPixel(50,1) == 0) {
835 DejaGnu.pass("BitmapData::getPixel(50,1) returns correct value (0)");
836 } else {
837 DejaGnu.fail("BitmapData::getPixel(50,1) returns incorrect value (should be 0, is "+x1.getPixel(50,1)+")");
839 //check_equals(bmp.getPixel(0, 0), 15654382);
840 if (x1.getPixel(0,0) == 0xeeddee) {
841 DejaGnu.pass("BitmapData::getPixel(0,0) returns correct value (0xeeddee)");
842 } else {
843 DejaGnu.fail("BitmapData::getPixel(0,0) returns incorrect value (should be 0xeeddee, is "+x1.getPixel(0,0)+")");
845 //check_equals(bmp.getPixel(-2, -5), 0);
846 if (x1.getPixel(-2,-5) == 0) {
847 DejaGnu.pass("BitmapData::getPixel(-2,-5) returns correct value (0)");
848 } else {
849 DejaGnu.fail("BitmapData::getPixel(-2,-5) returns incorrect value (should be 0, is "+x1.getPixel(-2,-5)+")");
851 //check_equals(bmp.getPixel(20, 30), 0);
852 if (x1.getPixel(20,30) == 0) {
853 DejaGnu.pass("BitmapData::getPixel(20,30) returns correct value (0)");
854 } else {
855 DejaGnu.fail("BitmapData::getPixel(20,30) returns incorrect value (should be 0, is "+x1.getPixel(20,30)+")");
859 //check_equals(bmp.getPixel32(1, 1), -1122834);
860 //getPixel32() should return a float in AS2, and a uint in AS3.
861 #if !flash9
862 if (untyped __typeof__(x1.getPixel32(1,1)) == 'number') {
863 DejaGnu.pass("BitmapData::getPixel32() method returns correct type (number)");
864 if (x1.getPixel32(1,1) == -1122834) {
865 DejaGnu.pass("BitmapData::getPixel32() method returns correct number (-01122834)");
866 } else {
867 DejaGnu.fail("BitmapData::getPixel32() method returns incorrect number (should be -01122834, is "+x1.getPixel32(1,1)+")");
869 } else {
870 DejaGnu.fail("BitmapData::getPixel32() method returns incorrect type (should be number, is "+untyped __typeof__(x1.getPixel32(1,1))+")");
872 #else
873 if ( untyped __typeof__(x1.getPixel32(1,1)) == 'number') {
874 DejaGnu.pass("BitmapData::getPixel32() method returns correct type 'number'");
875 if (x1.getPixel32(1,1) == 4293844462) {
876 DejaGnu.pass("BitmapData::getPixel32() method returns correct number (4293844462)");
877 } else {
878 DejaGnu.fail("BitmapData::getPixel32() method returns incorrect number (should be 4293844462, is "+x1.getPixel32(1,1)+")");
880 } else {
881 DejaGnu.xfail("BitmapData::getPixel32() method returns incorrect type (should be number, is "+untyped __typeof__(x1.getPixel32(1,1))+")");
883 #end
885 // Testing limits on constructor values:
886 // 2880 is the maximum dimension value, 1 the minimum. Returns
887 // undefined if the dimensions are invalid.
888 DejaGnu.note("*** Ctor limit tests ");
891 //bmp = new Bitmap(2880, 2880);
892 var bmp = new BitmapData(2880, 2880);
893 //check_equals(typeof(bmp), "object");
894 if (untyped __typeof__(bmp) == 'object') {
895 DejaGnu.pass("Ctor BitmapData(2880, 2880) returned an 'object'");
896 } else {
897 DejaGnu.fail("Ctor BitmapData(2880, 2880) did not return an 'object'");
899 //check_equals(bmp.height, 2880);
900 if ( bmp.height == 2880) {
901 DejaGnu.pass("bmp.height value is 2880");
902 } else {
903 DejaGnu.fail("bmp.height value is not 2880");
906 //bmp = new Bitmap(2879, 2879);
907 bmp = new BitmapData(2879, 2879);
908 //check_equals(typeof(bmp), "object");
909 if (untyped __typeof__(bmp) == 'object') {
910 DejaGnu.pass("Ctor BitmapData(2879, 2879) returned 'object'");
911 } else {
912 DejaGnu.fail("Ctor BitmapData(2879, 2879) did not return an 'object'");
914 //check_equals(bmp.height, 2879);
915 if ( bmp.height == 2879) {
916 DejaGnu.pass("bmp.height value is 2879");
917 } else {
918 DejaGnu.fail("bmp.height value is not 2879");
921 #if flash8
922 //bmp = new Bitmap(10000, 3);
923 bmp = new BitmapData(10000, 3);
924 //xcheck_equals(typeof(bmp), "undefined");
925 if (untyped __typeof__(bmp) == 'undefined') {
926 DejaGnu.pass("Ctor BitmapData(10000, 3) returned 'undefined'");
927 } else {
928 DejaGnu.fail("Ctor BitmapData(10000, 3) returned an object instead of 'undefined'");
930 //check_equals(bmp.height, undefined);
931 if ( bmp.height == null) {
932 DejaGnu.pass("bmp.height value is 'undefined'");
933 } else {
934 DejaGnu.fail("bmp.height value is not 'undefined'");
937 //bmp = new Bitmap(0, 10000)
938 bmp = new BitmapData(0, 10000);
939 //xcheck_equals(typeof(bmp), "undefined");
940 if (untyped __typeof__(bmp) == 'undefined') {
941 DejaGnu.pass("Ctor BitmapData(0, 10000) returned 'undefined'");
942 } else {
943 DejaGnu.fail("Ctor BitmapData(0, 10000) returned an object instead of 'undefined'");
945 //check_equals(bmp.height, undefined);
946 if ( bmp.height == null) {
947 DejaGnu.pass("bmp.height value is 'undefined'");
948 } else {
949 DejaGnu.fail("bmp.height value is not 'undefined'");
952 //bmp = new Bitmap(2880, 2881);
953 bmp = new BitmapData(2880, 2881);
954 //xcheck_equals(typeof(bmp), "undefined");
955 if (untyped __typeof__(bmp) == 'undefined') {
956 DejaGnu.pass("Ctor BitmapData(2880, 2881) returned 'undefined'");
957 } else {
958 DejaGnu.fail("Ctor BitmapData(2880, 2881) returned an object instead of 'undefined'");
960 //check_equals(bmp.height, undefined);
961 if ( bmp.height == null) {
962 DejaGnu.pass("bmp.height value is 'undefined'");
963 } else {
964 DejaGnu.fail("bmp.height value is not 'undefined'");
967 //bmp = new Bitmap(0, 2880);
968 bmp = new BitmapData(0, 2880);
969 //xcheck_equals(bmp, undefined);
970 if (untyped __typeof__(bmp) == 'undefined') {
971 DejaGnu.pass("Ctor BitmapData(0, 2880) returned 'undefined'");
972 } else {
973 DejaGnu.fail("Ctor BitmapData(0, 2880) returned an object instead of 'undefined'");
975 //check_equals(bmp.height, undefined);
976 if ( bmp.height == null) {
977 DejaGnu.pass("bmp.height value is 'undefined'");
978 } else {
979 DejaGnu.fail("bmp.height value is not 'undefined'");
982 //bmp = new Bitmap(0, 2879);
983 bmp = new BitmapData(0, 2879);
984 //xcheck_equals(bmp, undefined);
985 if (untyped __typeof__(bmp) == 'undefined') {
986 DejaGnu.pass("Ctor BitmapData(0, 2879) returned 'undefined'");
987 } else {
988 DejaGnu.fail("Ctor BitmapData(0, 2879) returned an object instead of 'undefined'");
990 //check_equals(bmp.height, undefined);
991 if ( bmp.height == null) {
992 DejaGnu.pass("bmp.height value is 'undefined'");
993 } else {
994 DejaGnu.fail("bmp.height value is not 'undefined'");
997 //bmp = new Bitmap(-1, 10, false, 0xff);
998 bmp = new BitmapData(-1, 10, false, 0xff);
999 //xcheck_equals(bmp, undefined);
1000 if (untyped __typeof__(bmp) == 'undefined') {
1001 DejaGnu.pass("Ctor BitmapData(-1, 10, false, 0xff) returned 'undefined'");
1002 } else {
1003 DejaGnu.fail("Ctor BitmapData(-1, 10, false, 0xff) returned an object instead of 'undefined'");
1005 //check_equals(bmp.height, undefined)
1006 if ( bmp.height == null) {
1007 DejaGnu.pass("bmp.height value is 'undefined'");
1008 } else {
1009 DejaGnu.fail("bmp.height value is not 'undefined'");
1012 #else
1014 //NOTE: Gnash should also throw SWF errors here
1015 DejaGnu.note("The pp throws an 'ArgumentError' in SWF9 if we try to call a constructor with out of bounds arguments");
1017 //bmp = new Bitmap(0, 10000
1018 try {
1019 bmp = new BitmapData(10000, 3);
1020 DejaGnu.fail("Ctor BitmapData(10000, 3) did not throw an error, it should");
1021 } catch( e : Error ) {
1022 DejaGnu.pass("Ctor BitmapData(10000, 3) correctly threw an error, id: " + e.errorID);
1023 if ( e.name == 'ArgumentError') {
1024 DejaGnu.pass("Ctor correctly threw 'ArgumentError' id: " + e.message);
1025 } else {
1026 DejaGnu.fail("Ctor did not throw 'ArgumentError'; error caught: " + e);
1030 //bmp = new Bitmap(0, 10000)
1031 try {
1032 bmp = new BitmapData(0, 10000);
1033 DejaGnu.fail("Ctor BitmapData(0, 10000) did not throw an error, it should");
1034 } catch( e : Error ) {
1035 DejaGnu.pass("Ctor BitmapData(10, 10000) correctly threw an error, id: " + e.errorID);
1036 if ( e.name == 'ArgumentError') {
1037 DejaGnu.pass("Ctor correctly threw 'ArgumentError' id: " + e.message);
1038 } else {
1039 DejaGnu.fail("Ctor did not throw 'ArgumentError'; error caught: " + e);
1043 //bmp = new Bitmap(2880, 2881);
1044 try {
1045 bmp = new BitmapData(2880, 2881);
1046 DejaGnu.fail("Ctor BitmapData(2880, 2881) did not throw an error, it should");
1047 } catch( e : Error ) {
1048 DejaGnu.pass("Ctor BitmapData(2880, 2881) correctly threw an error, id: " + e.errorID);
1049 if ( e.name == 'ArgumentError') {
1050 DejaGnu.pass("Ctor correctly threw 'ArgumentError' id: " + e.message);
1051 } else {
1052 DejaGnu.fail("Ctor did not throw 'ArgumentError'; error caught: " + e);
1056 //bmp = new Bitmap(0, 2880);
1057 try {
1058 bmp = new BitmapData(0, 2880);
1059 DejaGnu.fail("Ctor BitmapData(0, 2880) did not throw an error, it should");
1060 } catch( e : Error ) {
1061 DejaGnu.pass("Ctor BitmapData(0, 2880) correctly threw an error, id: " + e.errorID);
1062 if ( e.name == 'ArgumentError') {
1063 DejaGnu.pass("Ctor correctly threw 'ArgumentError' id: " + e.message);
1064 } else {
1065 DejaGnu.fail("Ctor did not throw 'ArgumentError'; error caught: " + e);
1069 //bmp = new Bitmap(0, 2879);
1070 try {
1071 bmp = new BitmapData(0, 2879);
1072 DejaGnu.fail("Ctor BitmapData(0, 2879) did not throw an error, it should");
1073 } catch( e : Error ) {
1074 DejaGnu.pass("Ctor BitmapData(0, 2879) correctly threw an error, id: " + e.errorID);
1075 if ( e.name == 'ArgumentError') {
1076 DejaGnu.pass("Ctor correctly threw 'ArgumentError' id: " + e.message);
1077 } else {
1078 DejaGnu.fail("Ctor did not throw 'ArgumentError'; error caught: " + e);
1082 //bmp = new Bitmap(-1, 10, false, 0xff);
1083 try {
1084 bmp = new BitmapData(-1, 10, false, 0xff);
1085 DejaGnu.fail("Ctor BitmapData(-1, 10, false, 0xff) did not throw an error, it should");
1086 } catch( e : Error ) {
1087 DejaGnu.pass("Ctor BitmapData(-1, 10, false, 0xff) correctly threw an error, id: " + e.errorID);
1088 if ( e.name == 'ArgumentError') {
1089 DejaGnu.pass("Ctor correctly threw 'ArgumentError' id: " + e.message);
1090 } else {
1091 DejaGnu.fail("Ctor did not throw 'ArgumentError'; error caught: " + e);
1096 #end
1099 // --------------------
1100 // setPixel, setPixel32
1101 // --------------------
1102 DejaGnu.note("**** setPixel and setPixel32 testing ****");
1104 var tr:BitmapData = new BitmapData(30, 30, true);
1105 var ntr:BitmapData = new BitmapData(30, 30, false);
1107 if (untyped __typeof__(tr.setPixel) == 'function') {
1108 DejaGnu.pass("BitmapData::setPixel() is a function");
1109 } else {
1110 DejaGnu.fail(" BitmapData::setPixel() is not a function");
1112 //FIXME: How to check return type void
1113 if (untyped __typeof__(tr.setPixel32) == 'function') {
1114 DejaGnu.pass("BitmapData::setPixel32() is a function");
1115 } else {
1116 DejaGnu.fail(" BitmapData::setPixel32() is not a function");
1118 //FIXME: How to check return type void
1121 tr.setPixel(3, 3, 0xff);
1122 //check_equals(tr.getPixel(3, 3), 0xff);
1123 if (tr.getPixel(3,3) == 0xff) {
1124 DejaGnu.pass("BitmapData::setPixel(3,3,0xff) has set the correct value (0xff)");
1125 } else {
1126 DejaGnu.fail(" BitmapData::setPixel(3,3,0xff) has set an incorrect value (should be 0xff, is "+tr.getPixel(3,3)+")");
1128 //check_equals(tr.getPixel32(3, 3), -16776961);
1129 #if flash8
1130 if ((tr.getPixel32(3, 3) == -16776961)) {
1131 DejaGnu.pass("BitmapData::setPixel(3,3,0xff) has set the correct value (-16776961)");
1132 } else {
1133 DejaGnu.fail(" BitmapData::setPixel(3,3,0xff) has set an incorrect value (should be -16776961, is "+tr.getPixel32(3,3)+")");
1135 #else
1136 // compiler bug?
1137 if (tr.getPixel32(3, 3) == 4278190335) {
1138 DejaGnu.pass("BitmapData::setPixel(3,3,0xff) has set the correct value (4278190335)");
1139 } else {
1140 DejaGnu.fail(" BitmapData::setPixel(3,3,0xff) has set an incorrect value (should be 4278190335, is "+tr.getPixel32(3,3)+")");
1142 #end
1144 ntr.setPixel(5, 5, 0xff);
1145 //check_equals(ntr.getPixel(5, 5), 0xff);
1146 if (ntr.getPixel(5, 5) == 0xff) {
1147 DejaGnu.pass("setPixel(3,3,0xff) has set the correct value - getPixel");
1148 } else {
1149 DejaGnu.fail("setPixel(5, 5, 0xff) set incorrect value: "+ntr.getPixel(5,5)+" should be 0xff");
1151 //check_equals(ntr.getPixel32(5, 5), -16776961);
1152 #if flash8
1153 if (ntr.getPixel32(5,5) == -16776961) {
1154 DejaGnu.pass("setPixel(3,3,0xff) has set the correct value - getPixel32");
1155 } else {
1156 DejaGnu.fail("setPixel(5, 5, 0xff) set incorrect value: "+ntr.getPixel(5,5)+" should be -16776961");
1158 #else
1159 if (ntr.getPixel32(5,5) == 4278190335) {
1160 DejaGnu.pass("setPixel(3,3,0xff) has set the correct value - getPixel32");
1161 } else {
1162 DejaGnu.fail("setPixel(5, 5, 0xff) set incorrect value: "+ntr.getPixel32(5,5)+" should be 4278190335");
1164 #end
1166 // not sure what the following not from the ming test means
1167 //// Premultiplication?
1168 tr.setPixel32(2, 2, 0x220000aa);
1169 //xcheck_equals(tr.getPixel(2, 2), 0xac);
1170 if (tr.getPixel(2, 2) == 0xac) {
1171 DejaGnu.xpass("setPixel32(2, 2, 0x220000aa) has set the correct value - getPixel");
1172 } else {
1173 DejaGnu.xfail("setPixel32(2, 2, 0x220000aa) set incorrect value: "+tr.getPixel(2,2)+" should be 0xac");
1175 //xcheck_equals(tr.getPixel32(2, 2), 0x220000ac);
1176 if (tr.getPixel32(2, 2) == 0x220000ac) {
1177 DejaGnu.xpass("setPixel32(2, 2, 0x220000aa) has set the correct value - getPixel32");
1178 } else {
1179 DejaGnu.xfail("setPixel32(2, 2, 0x220000aa) set incorrect value: "+tr.getPixel(2,2)+" should be 0x0x220000ac");
1182 tr.setPixel32(2, 2, 0xff0000aa);
1183 //check_equals(tr.getPixel(2, 2), 0xaa);
1184 if (tr.getPixel(2, 2) == 0xaa) {
1185 DejaGnu.pass("setPixel32(2, 2, 0xff0000aa) has set the correct value - getPixel");
1186 } else {
1187 DejaGnu.fail("setPixel32(2, 2, 0xff0000aa) set incorrect value: "+tr.getPixel(2,2)+" should be 0xaa");
1189 //check_equals(tr.getPixel32(2, 2), -16777046);
1190 #if flash8
1191 if (tr.getPixel32(2, 2) == -16777046) {
1192 DejaGnu.pass("setPixel32(2, 2, 0xff0000aa) has set the correct value - getPixel32");
1193 } else {
1194 DejaGnu.fail("setPixel32(2, 2, 0xff0000aa) set incorrect value: "+tr.getPixel32(2,2)+" should be -16777046");
1196 #else
1197 if (tr.getPixel32(2, 2) == 4278190250) {
1198 DejaGnu.pass("setPixel32(2, 2, 0xff0000aa) has set the correct value - getPixel32");
1199 } else {
1200 DejaGnu.fail("setPixel32(2, 2, 0xff0000aa) set incorrect value: "+tr.getPixel32(2,2)+" should be 4278190250");
1202 #end
1204 //// Premultiplication?
1205 tr.setPixel32(4, 4, 0x44444444);
1206 //xcheck_equals(tr.getPixel(4, 4), 0x434343);
1207 if (tr.getPixel(4, 4) == 0x434343) {
1208 DejaGnu.xpass("setPixel32(4, 4, 0x44444444) has set the correct value - getPixel");
1209 } else {
1210 DejaGnu.xfail("setPixel32(4, 4, 0x44444444) set incorrect value: "+tr.getPixel(4,4)+" should be 0x434343");
1212 //xcheck_equals(tr.getPixel32(4, 4), 0x44434343);
1213 if (tr.getPixel32(4, 4) == 0x44434343) {
1214 DejaGnu.xpass("setPixel32(4, 4, 0x44444444) has set the correct value - getPixel32");
1215 } else {
1216 DejaGnu.xfail("setPixel32(4, 4, 0x44444444) set incorrect value: "+tr.getPixel32(4,4)+" should be 0x44434343");
1219 tr.setPixel32(4, 4, 0x10101010);
1220 //check_equals(tr.getPixel(4, 4), 0x101010);
1221 if (tr.getPixel(4, 4) == 0x101010) {
1222 DejaGnu.pass("setPixel32(4, 4, 0x10101010) has set the correct value - getPixel");
1223 } else {
1224 DejaGnu.fail("setPixel32(4, 4, 0x10101010) set incorrect value: "+tr.getPixel(4,4)+" should be 0x101010");
1226 //check_equals(tr.getPixel32(4, 4), 0x10101010);
1227 if (tr.getPixel32(4, 4) == 0x10101010) {
1228 DejaGnu.pass("setPixel32(2, 2, 0xff0000aa) has set the correct value - getPixel32");
1229 } else {
1230 DejaGnu.fail("setPixel32(2, 2, 0xff0000aa) set incorrect value: "+tr.getPixel32(2,2)+" should be -16777046");
1233 //// Premultiplication?
1234 tr.setPixel32(4, 4, 0x43434343);
1235 //xcheck_equals(tr.getPixel(4, 4), 0x444444);
1236 if (tr.getPixel(4, 4) == 0x444444) {
1237 DejaGnu.xpass("setPixel32(4, 4, 0x43434343) has set the correct value - getPixel");
1238 } else {
1239 DejaGnu.xfail("setPixel32(4, 4, 0x43434343) set incorrect value: "+tr.getPixel(4,4)+" should be 0x444444");
1241 //xcheck_equals(tr.getPixel32(4, 4), 0x43444444);
1242 if (tr.getPixel32(4, 4) == 0x43444444) {
1243 DejaGnu.xpass("setPixel32(4, 4, 0x43434343) has set the correct value - getPixel32");
1244 } else {
1245 DejaGnu.xfail("setPixel32(4, 4, 0x43434343) set incorrect value: "+tr.getPixel32(4,4)+" should be 0x43444444");
1248 //// Premultiplication?
1249 tr.setPixel32(2, 2, 0x44);
1250 //xcheck_equals(tr.getPixel(2, 2), 0x00);
1251 if (tr.getPixel(2, 2) == 0x00) {
1252 DejaGnu.xpass("setPixel32(2, 2, 0x44) has set the correct value - getPixel");
1253 } else {
1254 DejaGnu.xfail("setPixel32(2, 2, 0x44) set incorrect value: "+tr.getPixel(2,2)+" should be 0x00");
1256 //xcheck_equals(tr.getPixel32(2, 2), 0);
1257 if (tr.getPixel32(2, 2) == 0) {
1258 DejaGnu.xpass("setPixel32(2, 2, 0x44) has set the correct value - getPixel32");
1259 } else {
1260 DejaGnu.xfail("setPixel32(2, 2, 0x44) set incorrect value: "+tr.getPixel32(2,2)+" should be 0");
1263 ntr.setPixel32(6, 6, 0x44444444);
1264 //check_equals(ntr.getPixel(6, 6), 0x444444);
1265 if (ntr.getPixel(6, 6) == 0x444444) {
1266 DejaGnu.pass("setPixel32(6, 6, 0x44444444) has set the correct value - getPixel");
1267 } else {
1268 DejaGnu.fail("setPixel32(6, 6, 0x44444444) set incorrect value: "+ntr.getPixel(6, 6)+" should be 0x444444");
1270 //check_equals(ntr.getPixel32(6, 6), -12303292);
1271 #if flash8
1272 if (ntr.getPixel32(6, 6) == -12303292) {
1273 DejaGnu.pass("setPixel32(6, 6, 0x44444444) has set the correct value - getPixel32");
1274 } else {
1275 DejaGnu.fail("setPixel32(6, 6, 0x44444444) set incorrect value: "+ntr.getPixel32(6, 6)+" should be -12303292");
1277 #else
1278 if (ntr.getPixel32(6, 6) == 4282664004) {
1279 DejaGnu.pass("setPixel32(6, 6, 0x44444444) has set the correct value - getPixel32");
1280 } else {
1281 DejaGnu.fail("setPixel32(6, 6, 0x44444444) set incorrect value: "+ntr.getPixel32(6, 6)+" should be 4282664004");
1283 #end
1286 // --------------------------------------------------------------------
1287 // floodFill
1288 // --------------------------------------------------------------------
1289 DejaGnu.note("**** floodFill() function testing ****");
1292 var bmp = new BitmapData(20, 20, false);
1294 if (untyped __typeof__(bmp.floodFill) == 'function') {
1295 DejaGnu.pass("BitmapData.floodFill is a function");
1296 } else {
1297 DejaGnu.fail("BitmapData.floodfill is not a function");
1300 //NOTE: as of 8/13/09 floodFill is unimplemented in gnash
1301 bmp.floodFill(10, 10, 0x0000ff00);
1302 //xcheck_equals(bmp.getPixel(10, 10), 0x0000ff00);
1303 if (bmp.getPixel(10,10) == 0x0000ff00) {
1304 DejaGnu.pass("floodFill correctly set the pixel (10, 10) to 0x0000ff00");
1305 } else {
1306 DejaGnu.fail("floodFill did not correctly set pixel (10, 10); value is: "+bmp.getPixel(10,10));
1309 bmp.floodFill(5, 5, 0x000000ff);
1310 //xcheck_equals(bmp.getPixel(10, 0), 0x000000ff);
1311 if (bmp.getPixel(10,0) == 0x000000ff) {
1312 DejaGnu.pass("flodFill correctly set the pixel (10, 0) to 0x000000ff");
1313 } else {
1314 DejaGnu.fail("floodFill did not correctly set pixel (10, 0); value is: "+bmp.getPixel(10,0));
1318 #if flash8
1319 var depth:Int = flash.Lib.current.getNextHighestDepth();
1320 //mc = this.createEmptyMovieClip("mc", this.getNextHighestDepth());
1321 var mc:MovieClip = flash.Lib.current.createEmptyMovieClip("mc_" + depth, depth);
1322 //mc.attachBitmap(bmp, this.getNextHighestDepth());
1323 mc.attachBitmap(bmp, depth);
1324 #else
1325 var mc:MovieClip = new MovieClip();
1326 var dispbmp:Bitmap = new Bitmap(bmp);
1327 mc.addChild(dispbmp);
1328 #end
1330 // not needed?
1331 //Rectangle = flash.geom.Rectangle;
1333 //---------------------------------------------------------------------
1334 // fillRect()
1335 //---------------------------------------------------------------------
1336 DejaGnu.note("**** fillRect() function testing *****");
1338 bmp = new BitmapData(20, 20, false);
1339 //r = new Rectangle(2, 2, 5, 5);
1340 #if flash9
1341 var r:Rectangle = new Rectangle(2, 2, 5, 5);
1342 #else
1343 var r:Rectangle<Int> = new Rectangle(2, 2, 5, 5);
1344 #end
1346 bmp.fillRect(r, 0xff1100);
1347 //check_equals(bmp.getPixel(1, 1), 0xffffff);
1348 if (bmp.getPixel(1, 1) == 0xffffff) {
1349 DejaGnu.pass("fillRect correctly set pixel (1,1) to 0xffffff");
1350 } else {
1351 DejaGnu.fail("fillRect incorrectly set pixel (1,1); value is: "+bmp.getPixel(1,1));
1353 //check_equals(bmp.getPixel(2, 2), 0xff1100);
1354 if (bmp.getPixel(2, 2) == 0xff1100) {
1355 DejaGnu.pass("fillRect correctly set pixel (2,2) to 0xff1100");
1356 } else {
1357 DejaGnu.fail("fillRect incorrectly set pixel (2,2); value is: "+bmp.getPixel(2,2));
1359 //check_equals(bmp.getPixel(2, 5), 0xff1100);
1360 if (bmp.getPixel(2, 5) == 0xff1100) {
1361 DejaGnu.pass("fillRect correctly set pixel (2,5) to 0xff1100");
1362 } else {
1363 DejaGnu.fail("fillRect incorrectly set pixel (2,5); value is: "+bmp.getPixel(2,5));
1365 //check_equals(bmp.getPixel(5, 2), 0xff1100);
1366 if (bmp.getPixel(5, 2) == 0xff1100) {
1367 DejaGnu.pass("fillRect correctly set pixel (5,2) to 0xff1100");
1368 } else {
1369 DejaGnu.fail("fillRect incorrectly set pixel (5,2); value is: "+bmp.getPixel(5,2));
1371 //check_equals(bmp.getPixel(2, 6), 0xff1100);
1372 if (bmp.getPixel(2, 6) == 0xff1100) {
1373 DejaGnu.pass("fillRect correctly set pixel (2,6) to 0xff1100");
1374 } else {
1375 DejaGnu.fail("fillRect incorrectly set pixel (2,6); value is: "+bmp.getPixel(2,6));
1377 //check_equals(bmp.getPixel(6, 6), 0xff1100);
1378 if (bmp.getPixel(6, 6) == 0xff1100) {
1379 DejaGnu.pass("fillRect correctly set pixel (6,6) to 0xff1100");
1380 } else {
1381 DejaGnu.fail("fillRect incorrectly set pixel (6,6); value is: "+bmp.getPixel(6,6));
1383 //check_equals(bmp.getPixel(6, 7), 0xffffff);
1384 if (bmp.getPixel(6, 7) == 0xffffff) {
1385 DejaGnu.pass("fillRect correctly set pixel (6,7) to 0xffffff");
1386 } else {
1387 DejaGnu.fail("fillRect incorrectly set pixel (6,7); value is: "+bmp.getPixel(6,7));
1389 //check_equals(bmp.getPixel(7, 6), 0xffffff);
1390 if (bmp.getPixel(7, 6) == 0xffffff) {
1391 DejaGnu.pass("fillRect correctly set pixel (7,6) to 0xffffff");
1392 } else {
1393 DejaGnu.fail("fillRect incorrectly set pixel (7,6); value is: "+bmp.getPixel(7,6));
1396 r = new Rectangle(-2, -2, 8, 8);
1397 bmp.fillRect(r, 0x00ff00);
1398 //check_equals(bmp.getPixel(1, 1), 0x00ff00);
1399 if (bmp.getPixel(1, 1) == 0x00ff00) {
1400 DejaGnu.pass("fillRect correctly set pixel (1,1) to 0x00ff00");
1401 } else {
1402 DejaGnu.fail("fillRect incorrectly set pixel (1,1); value is: "+bmp.getPixel(1,1));
1405 //// Fails.
1406 r = new Rectangle(18, 18, -4, -4);
1407 bmp.fillRect(r, 0x0000ff);
1408 //check_equals(bmp.getPixel(7, 6), 0xffffff);
1409 if (bmp.getPixel(7, 6) == 0xffffff) {
1410 DejaGnu.pass("fillRect correctly set pixel (7,6) to 0xffffff");
1411 } else {
1412 DejaGnu.fail("fillRect incorrectly set pixel (7,6); value is: "+bmp.getPixel(7,6));
1415 r = new Rectangle(18, 18, 200, 200);
1416 bmp.fillRect(r, 0x0000ff);
1417 //check_equals(bmp.getPixel(19,19), 0x0000ff);
1418 if (bmp.getPixel(19, 19) == 0x0000ff) {
1419 DejaGnu.pass("fillRect correctly set pixel (19,19) to 0x0000ff");
1420 } else {
1421 DejaGnu.fail("fillRect incorrectly set pixel (19,19); value is: "+bmp.getPixel(19,19));
1424 //// Doesn't have to be a rectangle
1425 // This doesn't seem to be true in flash 9 - throws an error
1426 //g = {x: 15, y: 15, width: 2, height: 2};
1427 var g = {x: 15, y: 15, width: 2, height: 2};
1428 #if flash8
1429 bmp.fillRect(untyped g, 0xff00ff);
1430 //check_equals(bmp.getPixel(16, 16), 0xff00ff);
1431 if (bmp.getPixel(16, 16) == 0xff00ff) {
1432 DejaGnu.pass("fillRect correctly set pixel (16,16) to 0xff00ff");
1433 } else {
1434 DejaGnu.fail("fillRect incorrectly set pixel (16,16); value is: "+bmp.getPixel(16,16));
1436 #else
1437 try {
1438 bmp.fillRect(untyped g, 0xff00ff);
1439 DejaGnu.fail("fillRect(g, 0xff0ff) did not throw an error, it should");
1440 } catch( e : Error ) {
1441 DejaGnu.pass("fillRect(g, 0xff0ff) correctly threw an error, id: " + e.errorID);
1442 if ( e.name == 'TypeError') {
1443 DejaGnu.pass("fillRect correctly threw 'TypeError' id: " + e.message);
1444 } else {
1445 DejaGnu.fail("fillRect did not throw 'TypeError'; error caught: " + e);
1448 #end
1450 #if flash8
1451 //// Transparency (this bitmap is not transparent).
1452 //g = {x: 18, y: 2, width: 7, height: 7};
1453 g = {x: 18, y: 2, width: 7, height: 7};
1454 bmp.fillRect(untyped g, 0xddff00ff);
1455 //check_equals(bmp.getPixel32(18, 2), -65281);
1456 if (bmp.getPixel32(18, 2) == -65281) {
1457 DejaGnu.pass("fillRect correctly set pixel (18,2) to -65281");
1458 } else {
1459 DejaGnu.fail("fillRect incorrectly set pixel (18,2); value is: "+bmp.getPixel32(18,2));
1461 #end
1463 #if flash8
1464 mc.attachBitmap(bmp, depth);
1465 #else
1466 dispbmp = new Bitmap(bmp);
1467 mc.addChild(dispbmp);
1468 #end
1470 //// Transparency (transparent bitmap). Fill just obliterates
1471 //// what was there, even if it's transparent.
1472 bmp = new BitmapData(20, 20, true);
1473 r = new Rectangle(1, 1, 10, 10);
1474 bmp.fillRect(r, 0xff00ff00);
1475 r = new Rectangle(2, 2, 9, 9);
1476 bmp.fillRect(r, 0x99ff1100);
1477 #if flash8
1478 //check_equals(bmp.getPixel32(3, 3), -1711337216);
1479 if (bmp.getPixel32(3, 3) == -1711337216) {
1480 DejaGnu.pass("fillRect correctly set pixel (3,3) to -1711337216");
1481 } else {
1482 DejaGnu.fail("fillRect incorrectly set pixel (3,3); value is: "+bmp.getPixel32(3,3));
1484 #else
1485 //precission difference
1486 if (bmp.getPixel32(3, 3) == 2583630080) {
1487 DejaGnu.pass("fillRect correctly set pixel (3,3) to 2583630080");
1488 } else {
1489 DejaGnu.fail("fillRect incorrectly set pixel (3,3); value is: "+bmp.getPixel32(3,3));
1491 #end
1493 #if flash8
1494 mc.attachBitmap(bmp, depth);
1495 #else
1496 dispbmp = new Bitmap(bmp);
1497 mc.addChild(dispbmp);
1498 #end
1500 //----------------------------------------------------------------------
1501 // dispose()
1502 //----------------------------------------------------------------------
1503 DejaGnu.note("**** dispose() function testing ****");
1505 bmp.dispose();
1507 //check(bmp instanceOf Bitmap);
1508 if (Std.is(bmp, BitmapData) ) {
1509 DejaGnu.pass("dispose() correctly did not change the type of bmp");
1510 } else {
1511 DejaGnu.fail("dispose() incorrectly changed"+
1512 " the type of bmp to: "+ untyped __typeof__(bmp) );
1514 #if flash8
1515 //check_equals(bmp.height, -1);
1516 if (bmp.height == -1) {
1517 DejaGnu.pass("BitmapData.dispose correctly set bmp.height to -1");
1518 } else {
1519 DejaGnu.fail("dispose() did not correctly"+
1520 " set bmp.height; value is: "+bmp.height);
1522 //check_equals(bmp.width, -1);
1523 if (bmp.width == -1) {
1524 DejaGnu.pass("BitmapData.dispose correctly set bmp.width to -1");
1525 } else {
1526 DejaGnu.fail("dispose() did not correctly"+
1527 " set bmp.width; value is: "+bmp.width);
1529 //check_equals(bmp.transparent, -1);
1530 if (bmp.transparent == untyped -1) {
1531 DejaGnu.pass("BitmapData.dispose correctly set bmp.transparent to -1");
1532 } else {
1533 DejaGnu.fail("dispose() did not correctly"+
1534 " set bmp.transparent; value is: "+bmp.transparent);
1536 //check_equals(typeof(bmp.rectangle), "number");
1537 if (untyped __typeof__(bmp.rectangle) == 'number') {
1538 DejaGnu.pass("BitmapData.dispose correctly changed bmp.rectangle"+
1539 " to a number");
1540 } else {
1541 DejaGnu.fail("dispose() did not correctly"+
1542 "change bmp.rectangle; type is: "+
1543 untyped __typeof__(bmp.rectangle) );
1545 //check_equals(bmp.rectangle, -1);
1546 if (bmp.rectangle == untyped -1) {
1547 DejaGnu.pass("BitmapData.dispose correctly set bmp.rectangle to -1");
1548 } else {
1549 DejaGnu.fail("dispose() did not correctly"+
1550 " set bmp.rectangle; value is: "+bmp.rectangle);
1552 //check_equals(bmp.rectangle.toString(), "-1");
1553 if ( bmp.rectangle.toString() == "-1") {
1554 DejaGnu.pass("dispose() correctly set bmp.rectangle.toString()"+
1555 " to '-1'");
1556 } else {
1557 DejaGnu.fail("dispose() did not correctly"+
1558 " set bmp.rectangle.toString(); value is: "
1559 + bmp.rectangle.toString() );
1562 bmp.height = 2;
1563 //check_equals(bmp.height, -1);
1564 if (bmp.height == -1) {
1565 DejaGnu.pass("After calling dispose() we cannot change bmp.height");
1566 } else {
1567 DejaGnu.fail("After calling dispose() we"+
1568 " were still able to change bmp.height which is not"+
1569 " allowed");
1571 #else
1572 var x1;
1573 //check_equals(bmp.height, -1);
1574 try {
1575 x1 = bmp.height;
1576 DejaGnu.fail("After dispose() getting"+
1577 " bmp.height did not throw an error, it should");
1578 } catch( e : Error ) {
1579 DejaGnu.pass("After dispose() getting bmp.height correctly threw"+
1580 " an error, id: " + e.errorID);
1581 if ( e.name == 'ArgumentError') {
1582 DejaGnu.pass("getting bmp.height correctly threw"+
1583 " 'ArgumentError' id: " + e.message);
1584 } else {
1585 DejaGnu.fail("getting bmp.height did"+
1586 " not throw 'ArgumentError'; error caught: " + e);
1589 //check_equals(bmp.width, -1);
1590 try {
1591 x1 = bmp.width;
1592 DejaGnu.fail("After dispose() getting"+
1593 " bmp.width did not throw an error, it should");
1594 } catch( e : Error ) {
1595 DejaGnu.pass("After dispose() getting bmp.width correctly threw"+
1596 " an error, id: " + e.errorID);
1597 if ( e.name == 'ArgumentError') {
1598 DejaGnu.pass("getting bmp.width correctly threw"+
1599 " 'ArgumentError' id: " + e.message);
1600 } else {
1601 DejaGnu.fail("getting bmp.width did"+
1602 " not throw 'ArgumentError'; error caught: " + e);
1605 //check_equals(bmp.transparent, -1);
1606 var x2;
1607 try {
1608 x2 = bmp.transparent;
1609 DejaGnu.fail("After dispose() getting"+
1610 " bmp.transparent did not throw an error, it should");
1611 } catch( e : Error ) {
1612 DejaGnu.pass("After dispose() getting bmp.transparent correctly"+
1613 " threw an error, id: " + e.errorID);
1614 if ( e.name == 'ArgumentError') {
1615 DejaGnu.pass("getting bmp.transparent correctly threw"+
1616 " 'ArgumentError' id: " + e.message);
1617 } else {
1618 DejaGnu.fail("getting bmp.transparent"+
1619 " did not throw 'ArgumentError'; error caught: "
1620 + e );
1623 //check_equals(bmp.rectangle, -1);
1624 var x3;
1625 try {
1626 x3 = bmp.rect;
1627 DejaGnu.fail("After dispose() getting"+
1628 " bmp.rect did not throw an error, it should");
1629 } catch( e : Error ) {
1630 DejaGnu.pass("After dispose() getting bmp.rect correctly"+
1631 " threw an error, id: " + e.errorID);
1632 if ( e.name == 'ArgumentError') {
1633 DejaGnu.pass("getting bmp.rect correctly threw"+
1634 " 'ArgumentError' id: " + e.message);
1635 } else {
1636 DejaGnu.fail("getting bmp.rect"+
1637 " did not throw 'ArgumentError'; error caught: "
1638 + e );
1642 #end
1644 DejaGnu.unresolved("Skipping some ming tests");
1645 DejaGnu.note("Skipping some very strange tests from the ming test cases");
1646 DejaGnu.note("Haxe will not allow assignment to flash.geom.Rectangle");
1647 DejaGnu.note("Does flash allow this sort of thing and should we"+
1648 " allow this in Gnash?");
1650 //bmp = new BitmapData(20, 10, true);
1651 //var backup = flash.geom.Rectangle;
1652 //flash.geom.Rectangle = 2;
1653 //check_equals(bmp.rectangle, -1);
1655 //flash.geom.Rectangle = function (x, y, w, h)
1657 //this.y = x + 5;
1658 //this.x = 10.5;
1659 //this.width = h;
1660 //this.height = w;
1661 //};
1662 //check_equals(bmp.rectangle.toString(), "[object Object]");
1664 //flash.geom.Rectangle = function (x, y, w, h)
1666 //};
1667 //check_equals(bmp.rectangle.toString(), "[object Object]");
1669 //flash.geom.Rectangle = function ()
1671 //};
1672 //check_equals(bmp.rectangle.toString(), "[object Object]");
1674 //flash.geom.Rectangle = backup;
1675 //check_equals(bmp.rectangle.toString(), "(x=0, y=0, w=20, h=10)");
1681 //-------------------------------------------------------------
1682 // END OF TEST
1683 //-------------------------------------------------------------
1685 #else
1686 DejaGnu.note("This class (BitmapData) is only available in flash8 and flash9");
1687 #end
1688 // Call this after finishing all tests. It prints out the totals.
1689 DejaGnu.done();
1693 // local Variables:
1694 // mode: C++
1695 // indent-tabs-mode: t
1696 // End: