Make display tests more robust; add esc.swf as a test case

This commit is contained in:
Jeff Dyer 2013-06-07 10:30:44 -07:00
Родитель 8ef59fb012
Коммит c3ac6ddb3f
18 изменённых файлов: 166 добавлений и 120 удалений

Двоичные данные
test/swfs/esc.swf Normal file

Двоичный файл не отображается.

Просмотреть файл

@ -10,7 +10,7 @@ package {
public class DisplayObjectTest extends Sprite {
public function DisplayObjectTest() {
stage.frameRate = 20;
stage.frameRate = 4;
var child:CustomDisplayObject = new CustomDisplayObject();
addChild(child);
}

Двоичные данные
test/swfs/flash_display_DisplayObject.swf

Двоичный файл не отображается.

Просмотреть файл

@ -1,7 +1,7 @@
/* -*- Mode: java; indent-tabs-mode: nil -*- */
/*
Compiled with:
java -jar utils/asc.jar -import playerglobal.abc -swf DisplayObjectContainerTest,100,100,2 test/swfs/flash_display_DisplayObjectContainer.as
java -jar utils/asc.jar -import playerglobal.abc -swf DisplayObjectContainerTest,600,600 test/swfs/flash_display_DisplayObjectContainer.as
*/
package {
@ -10,6 +10,7 @@ package {
public class DisplayObjectContainerTest extends Sprite {
public function DisplayObjectContainerTest() {
stage.frameRate = 4;
var child:DisplayObjectContainerObject = new DisplayObjectContainerObject();
addChild(child);
addEventListener(Event.ENTER_FRAME, child.enterFrameHandler);
@ -32,8 +33,8 @@ dynamic class DisplayObjectContainerObject extends Sprite {
private function _addChild():void {
var shape = new Shape;
shape.graphics.lineStyle(10, color);
shape.graphics.moveTo(10, 10);
shape.graphics.lineTo(90, 90);
shape.graphics.moveTo(5, 5);
shape.graphics.lineTo(95, 95);
this.addChild(shape);
var result = this.contains(shape) ? "PASS" : "FAIL";
trace(result + ": flash.display::DisplayObjectContainer/addChild ()");
@ -54,11 +55,11 @@ dynamic class DisplayObjectContainerObject extends Sprite {
private function _addChildAt():void {
var shape1 = new Shape;
shape1.graphics.beginFill(color);
shape1.graphics.beginFill(color, .3);
shape1.graphics.drawRect(10, 10, 60, 60);
this.addChildAt(shape1, 0);
var shape2 = new Shape;
shape2.graphics.beginFill(color << 8);
shape2.graphics.beginFill(color << 8, .3);
shape2.graphics.drawRect(30, 30, 60, 60);
this.addChildAt(shape2, 0);
var result = (this.getChildIndex(shape1) === 1 &&
@ -80,7 +81,7 @@ dynamic class DisplayObjectContainerObject extends Sprite {
var shape1 = new Shape;
var name = "foo";
shape1.graphics.beginFill(0x00FF00);
shape1.graphics.drawRect(0, 0, 100, 100);
shape1.graphics.drawRect(0, 0, 20, 100);
shape1.name = name;
this.addChildAt(shape1, 0);
var result = (this.getChildByName(name).name === name) ? "PASS" : "FAIL";

Двоичный файл не отображается.

Просмотреть файл

@ -7,3 +7,12 @@ PASS: flash.display::DisplayObjectContainer/get numChildren ()
PASS: flash.display::DisplayObjectContainer/addChildAt ()
PASS: flash.display::DisplayObjectContainer/getChildIndex ()
PASS: flash.display::DisplayObjectContainer/get numChildren ()
PASS: flash.display::DisplayObjectContainer/removeChildAt ()
PASS: flash.display::DisplayObjectContainer/get numChildren ()
PASS: flash.display::DisplayObjectContainer/getChildByName ()
PASS: flash.display::DisplayObject/set name ()
PASS: flash.display::DisplayObject/get name ()
PASS: flash.display::DisplayObjectContainer/get mouseChildren ()
PASS: flash.display::DisplayObjectContainer/set mouseChildren ()
PASS: flash.display::DisplayObjectContainer/get tabChildren ()
PASS: flash.display::DisplayObjectContainer/set tabChildren ()

Просмотреть файл

@ -1,7 +1,7 @@
/* -*- Mode: java; indent-tabs-mode: nil -*- */
/*
Compiled with:
java -jar utils/asc.jar -import playerglobal.abc -swf GraphicsTest,400,400 test/swfs/flash_display_Grahics.as
java -jar utils/asc.jar -import playerglobal.abc -swf GraphicsTest,600,600 test/swfs/flash_display_Grahics.as
*/
package {
@ -9,6 +9,7 @@ package {
public class GraphicsTest extends Sprite {
public function GraphicsTest() {
stage.frameRate = 4;
var child:GraphicsObject = new GraphicsObject();
addChild(child);
}
@ -26,100 +27,10 @@ dynamic class GraphicsObject extends Sprite {
addEventListener(Event.ENTER_FRAME, enterFrameHandler);
}
private function beginFill():void {
graphics.clear();
graphics.beginFill(color);
graphics.drawRect(0, 0, size, size);
graphics.endFill();
}
private function drawCircle():void {
graphics.clear();
graphics.beginFill(color);
graphics.drawCircle(50, 50, size/2);
graphics.endFill();
}
private function drawRect():void {
graphics.clear();
graphics.beginFill(color);
graphics.drawRect(0, 0, size, size);
graphics.endFill();
}
private function drawRoundRect():void {
graphics.clear();
graphics.beginFill(color);
graphics.drawRoundRect(0, 0, size, size, size/5, size/5);
graphics.endFill();
}
private function beginGradientFill():void {
graphics.clear();
var fillType:String = GradientType.LINEAR;
var colors:Array = [0xFF0000, 0x0000FF];
var alphas:Array = [1, 1];
var ratios:Array = [0x00, 0xFF];
graphics.beginGradientFill(fillType, colors, alphas, ratios);
graphics.drawRect(0,0,size,size);
graphics.endFill();
}
private function lineTo():void {
graphics.clear();
graphics.lineStyle(10, color);
graphics.moveTo(0, 0);
graphics.lineTo(size, size);
//var bits = new BitmapData(100, 100);
//bits.draw(this);
//trace("expected: " + color);
//trace("found: " + bits.getPixel(size, size));
}
private function moveTo():void {
graphics.clear();
graphics.lineStyle(10, color);
graphics.moveTo(size, 10);
graphics.lineTo(size, size);
}
private function lineStyle():void {
graphics.clear();
graphics.lineStyle(10, color << 2, 0.5);
graphics.moveTo(size/2, size);
graphics.lineTo(10, 10);
graphics.lineStyle(10, color >> 2, 0.5);
graphics.lineTo(size, 10);
graphics.lineStyle(10, color, 0.5);
graphics.lineTo(10, size);
}
private function endFill():void {
graphics.clear();
graphics.beginFill(0x00FF00);
graphics.lineStyle(10, color << 2, 0.5);
graphics.moveTo(size/2, size);
graphics.lineTo(10, 10);
graphics.lineTo(size, 10);
graphics.endFill();
}
private function lineGradientStyle():void {
graphics.clear();
var fillType:String = GradientType.LINEAR;
var colors:Array = [0xFF0000, 0x00FFFF];
var alphas:Array = [1, 1];
var ratios:Array = [0x00, 0xFF];
graphics.lineStyle(20);
graphics.lineGradientStyle(fillType, colors, alphas, ratios);
graphics.moveTo(size/2, size);
graphics.lineTo(10, 10);
graphics.lineTo(size, 10);
graphics.lineTo(10, size);
}
private function clear() {
graphics.clear();
graphics.beginFill(0xFFFFFF);
graphics.lineStyle(0, 0x000000, 0);
graphics.drawRect(0, 0, 600, 600);
}
private var frameCount = 0;
@ -128,34 +39,112 @@ dynamic class GraphicsObject extends Sprite {
var target = event.target;
switch (frameCount) {
case 0:
beginFill();
(function () {
clear();
graphics.beginFill(color);
graphics.drawRect(0, 0, size, size);
graphics.endFill();
})();
break;
case 1:
drawRoundRect();
(function () {
clear();
graphics.beginFill(color);
graphics.drawRoundRect(0, 0, size, size, size/5, size/5);
graphics.endFill();
})();
break;
case 2:
drawRect();
(function () {
clear();
graphics.beginFill(color);
graphics.drawRect(0, 0, size, size);
graphics.endFill();
})();
break;
case 3:
drawCircle();
(function () {
clear();
graphics.beginFill(color);
graphics.drawCircle(50, 50, size/2);
graphics.endFill();
})();
break;
case 4:
beginGradientFill();
(function () {
clear();
var fillType:String = GradientType.LINEAR;
var colors:Array = [0xFF0000, 0x0000FF];
var alphas:Array = [1, 1];
var ratios:Array = [0x00, 0xFF];
graphics.beginGradientFill(fillType, colors, alphas, ratios);
graphics.drawRect(0,0,size,size);
graphics.endFill();
})();
break;
case 5:
lineTo();
(function () {
clear();
graphics.lineStyle(10, color);
graphics.moveTo(0, 0);
graphics.lineTo(size, size);
graphics.lineTo(0, size);
graphics.lineTo(size, 0);
})();
break;
case 6:
moveTo();
(function () {
clear();
graphics.lineStyle(10, color);
graphics.moveTo(size, 10);
graphics.lineTo(size, size);
})();
break;
case 7:
lineStyle();
(function () {
clear();
graphics.lineStyle(10, color << 2, 0.5);
graphics.moveTo(size/2, size);
graphics.lineTo(10, 10);
graphics.lineStyle(10, color >> 2, 0.5);
graphics.lineTo(size, 10);
graphics.lineStyle(10, color, 0.5);
graphics.lineTo(10, size);
})();
return;
break;
case 8:
lineGradientStyle();
(function ():void {
clear();
var fillType:String = GradientType.LINEAR;
var colors:Array = [0xFF0000, 0x00FFFF];
var alphas:Array = [1, 1];
var ratios:Array = [0x00, 0xFF];
graphics.lineStyle(20);
//FIXME not implemented
//graphics.lineGradientStyle(fillType, colors, alphas, ratios);
graphics.moveTo(size/2, size);
graphics.lineTo(10, 10);
graphics.lineTo(size, 10);
graphics.lineTo(10, size);
})();
break;
case 9:
endFill();
(function () {
clear();
graphics.beginFill(0x00FF00);
graphics.lineStyle(10, color << 2, 0.5);
graphics.moveTo(size/2, size);
graphics.lineTo(10, 10);
graphics.lineTo(size, 10);
graphics.endFill();
})();
break;
case 10:
graphics.clear();
break;
case 11:
// check for blank stage
break;
default:
removeEventListener("enterFrame", enterFrameHandler);

Двоичные данные
test/swfs/flash_display_Graphics.swf

Двоичный файл не отображается.

Просмотреть файл

@ -13,7 +13,7 @@ package {
public class BlurFilterTest extends Sprite {
public var loader;
public function BlurFilterTest() {
stage.frameRate = 20;
stage.frameRate = 4;
var child = new TestObject();
background(0xFFFFFF);
addEventListener(Event.ENTER_FRAME, child.enterFrameHandler);

Двоичные данные
test/swfs/flash_filters_BlurFilter.swf

Двоичный файл не отображается.

Просмотреть файл

@ -13,7 +13,7 @@ package {
public class DropShadowFilterTest extends Sprite {
public var loader;
public function DropShadowFilterTest() {
stage.frameRate = 20;
stage.frameRate = 4;
var child = new TestObject();
background(0xFFFFFF);
addEventListener(Event.ENTER_FRAME, child.enterFrameHandler);

Двоичные данные
test/swfs/flash_filters_DropShadowFilter.swf

Двоичный файл не отображается.

Просмотреть файл

@ -13,7 +13,7 @@ package {
public class GlowFilterTest extends Sprite {
public var loader;
public function GlowFilterTest() {
stage.frameRate = 20;
stage.frameRate = 4;
var child = new TestObject();
background(0xFFFFFF);
addEventListener(Event.ENTER_FRAME, child.enterFrameHandler);

Двоичные данные
test/swfs/flash_filters_GlowFilter.swf

Двоичный файл не отображается.

Просмотреть файл

@ -1,7 +1,7 @@
PASS: flash.filters::GlowFilter/get alpha ()
PASS: flash.filters::GlowFilter/get blurX ()
PASS: flash.filters::GlowFilter/get blurY ()
PASS: flash.filters::GlowFilter/get blurY ()
PASS: flash.filters::GlowFilter/get color ()
PASS: flash.filters::GlowFilter/get inner ()
PASS: flash.filters::GlowFilter/get knockout ()
PASS: flash.filters::GlowFilter/get quality ()

15
test/swfs/trace2s.stas Normal file
Просмотреть файл

@ -0,0 +1,15 @@
// Simple text output comparison test script
run_test = function (t, file) {
print ("Testing " + file);
t.reset (file);
var expected = Buffer.load (file + ".trace");
t.advance (2000);
var diff = t.trace.diff (expected);
};
t = new Test ();
for (var i = 0; i < filenames.length; i++) {
run_test (t, filenames[i]);
}

15
test/swfs/trace5s.stas Normal file
Просмотреть файл

@ -0,0 +1,15 @@
// Simple text output comparison test script
run_test = function (t, file) {
print ("Testing " + file);
t.reset (file);
var expected = Buffer.load (file + ".trace");
t.advance (5000);
var diff = t.trace.diff (expected);
};
t = new Test ();
for (var i = 0; i < filenames.length; i++) {
run_test (t, filenames[i]);
}

Просмотреть файл

@ -102,7 +102,7 @@
"type": "stas"
},
{ "id": "flash_display_DisplayObject trace",
"stas": "swfs/trace.stas",
"stas": "swfs/trace5s.stas",
"filenames": [
"swfs/flash_display_DisplayObject.swf"
],
@ -113,13 +113,30 @@
"swf": "swfs/flash_display_DisplayObject.swf",
"type": "eq"
},
{ "id": "flash_display_DisplayObjectContainer trace",
"stas": "swfs/trace5s.stas",
"filenames": [
"swfs/flash_display_DisplayObjectContainer.swf"
],
"type": "stas"
},
{ "id": "flash_display_DisplayObjectContainer screen",
"frames": [0,1,2,3,4,5,6,7,8,9,10,11],
"swf": "swfs/flash_display_DisplayObjectContainer.swf",
"type": "eq"
},
{ "id": "flash_display_Graphics trace",
"stas": "swfs/trace.stas",
"stas": "swfs/trace5s.stas",
"filenames": [
"swfs/flash_display_Graphics.swf"
],
"type": "stas"
},
{ "id": "flash_display_Graphics screen",
"frames": [0,1,2,3,4,5,6,7,8,9,10,11],
"swf": "swfs/flash_display_Graphics.swf",
"type": "eq"
},
{ "id": "flash_system_System trace",
"stas": "swfs/trace.stas",
"filenames": [
@ -170,7 +187,7 @@
"type": "stas"
},
{ "id": "flash_filters_BlurFilter trace",
"stas": "swfs/trace.stas",
"stas": "swfs/trace2s.stas",
"filenames": [
"swfs/flash_filters_BlurFilter.swf"
],
@ -182,7 +199,7 @@
"type": "eq"
},
{ "id": "flash_filters_DropShadowFilter trace",
"stas": "swfs/trace.stas",
"stas": "swfs/trace5s.stas",
"filenames": [
"swfs/flash_filters_DropShadowFilter.swf"
],
@ -194,7 +211,7 @@
"type": "eq"
},
{ "id": "flash_filters_GlowFilter trace",
"stas": "swfs/trace.stas",
"stas": "swfs/trace5s.stas",
"filenames": [
"swfs/flash_filters_GlowFilter.swf"
],