tests: Add a test for AS3 `BitmapData.clone()`

This commit is contained in:
David Wendt 2022-10-06 18:59:16 -04:00 committed by Aaron Hill
parent 23b5eb6d72
commit 066ca11cff
8 changed files with 41 additions and 0 deletions

View File

@ -197,6 +197,7 @@ swf_tests! {
(as3_bitmap_subclass, "avm2/bitmap_subclass", 1), (as3_bitmap_subclass, "avm2/bitmap_subclass", 1),
#[cfg_attr(not(feature = "imgtests"), ignore)] (as3_bitmap_subclass_properties, "avm2/bitmap_subclass_properties", 1, img = true), #[cfg_attr(not(feature = "imgtests"), ignore)] (as3_bitmap_subclass_properties, "avm2/bitmap_subclass_properties", 1, img = true),
(as3_bitmap_timeline, "avm2/bitmap_timeline", 1), (as3_bitmap_timeline, "avm2/bitmap_timeline", 1),
#[cfg_attr(not(feature = "imgtests"), ignore)] (as3_bitmapdata_clone, "avm2/bitmapdata_clone", 1, img = true),
(as3_bitmapdata_constr, "avm2/bitmapdata_constr", 1), (as3_bitmapdata_constr, "avm2/bitmapdata_constr", 1),
(as3_bitmapdata_dispose, "avm2/bitmapdata_dispose", 1), (as3_bitmapdata_dispose, "avm2/bitmapdata_dispose", 1),
// We need a render backend in order to call `BitmapData.draw` // We need a render backend in order to call `BitmapData.draw`

View File

@ -0,0 +1,27 @@
package {
public class Test {
}
}
import flash.display.BitmapData;
trace("///var tbd = new TestBitmapData(128, 128).clone();");
var tbd = new TestBitmapData(128, 128).clone();
trace("///tbd.width;");
trace(tbd.width);
trace("///tbd.height;");
trace(tbd.height);
trace("///tbd.getPixel(0,0);");
trace(tbd.getPixel(0,0));
trace("///tbd.getPixel(12,12);");
trace(tbd.getPixel(12,12));
trace("///tbd instanceof BitmapData");
trace(tbd instanceof BitmapData);
trace("///tbd instanceof TestBitmapData");
trace(tbd instanceof TestBitmapData);

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.7 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.7 KiB

View File

@ -0,0 +1,13 @@
///var tbd = new TestBitmapData(128, 128).clone();
///tbd.width;
32
///tbd.height;
24
///tbd.getPixel(0,0);
16777215
///tbd.getPixel(12,12);
0
///tbd instanceof BitmapData
true
///tbd instanceof TestBitmapData
false

Binary file not shown.

Binary file not shown.

After

Width:  |  Height:  |  Size: 233 B

Binary file not shown.