-
-
Notifications
You must be signed in to change notification settings - Fork 843
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
tests: Port remainder of shumway tests over
- Loading branch information
1 parent
0eab440
commit 8d9b50d
Showing
406 changed files
with
4,208 additions
and
0 deletions.
There are no files selected for viewing
126 changes: 126 additions & 0 deletions
126
tests/tests/swfs/from_shumway/3_joystick/code/Interactivity3.as
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,126 @@ | ||
package code | ||
{ | ||
/***************************************** | ||
* Interactivity3 : | ||
* Demonstrates movement controlled by a joystick. | ||
* http://www.adobe.com/devnet/actionscript/samples/interactivity_3.html | ||
* ------------------- | ||
* See 3_joystick.fla | ||
****************************************/ | ||
|
||
import flash.events.Event; | ||
import flash.events.MouseEvent; | ||
import flash.display.MovieClip; | ||
|
||
public class Interactivity3 extends MovieClip | ||
{ | ||
//************************* | ||
// Properties: | ||
|
||
public var initx:Number = 0; | ||
public var inity:Number = 0; | ||
public var tension:Number = .5; | ||
public var decay:Number = .5; | ||
public var xSpeed:Number = 0; | ||
public var dragging:Boolean = false; | ||
private var moved:Boolean = false; | ||
|
||
//************************* | ||
// Constructor: | ||
|
||
public function Interactivity3() | ||
{ | ||
trace('Interactivity3 init'); | ||
initx = joystick.x; | ||
inity = joystick.y; | ||
|
||
// Respond to mouse events | ||
joystick.addEventListener(MouseEvent.MOUSE_DOWN,dragPressHandler); | ||
stage.addEventListener(MouseEvent.MOUSE_UP,dragReleaseHandler); | ||
|
||
// Update screen every frame | ||
addEventListener(Event.ENTER_FRAME,enterFrameHandler); | ||
} | ||
|
||
//************************* | ||
// Event Handling: | ||
|
||
protected function dragPressHandler(event:MouseEvent):void | ||
{ | ||
trace('dragPressHandler'); | ||
dragging = true; | ||
} | ||
|
||
protected function dragReleaseHandler(event:MouseEvent):void | ||
{ | ||
trace('dragReleaseHandler'); | ||
dragging = false; | ||
} | ||
|
||
protected function enterFrameHandler(event:Event):void | ||
{ | ||
with( joystick ) | ||
{ | ||
if( dragging ) | ||
{ | ||
// Calculate the angle | ||
// of the joystick | ||
var angle = Math.atan2(root.mouseY-inity,root.mouseX-initx)/(Math.PI/180); | ||
rotation = angle; | ||
|
||
with( knob ) | ||
{ | ||
// Rotate the knob inversely to | ||
// the rotation of the whole joystick | ||
rotation = -angle; | ||
|
||
// Drag the joystick but constrain it | ||
// to a circle with a radius of 75 | ||
x = parent.mouseX; | ||
if( x > 75 ){ | ||
x = 75; | ||
} | ||
} | ||
with( beetle ) | ||
{ | ||
// Set rotation of beetle equal to | ||
// the rotation of the joystick | ||
rotation = angle; | ||
|
||
// Loop to opposite side of the masked | ||
// area when the beetle travels off-screen | ||
if( y < 0 ) { | ||
y = 231; | ||
} | ||
if( y > 231 ){ | ||
y = 0; | ||
} | ||
if( x < 231 ){ | ||
x = 465; | ||
} | ||
if (x > 370 && !moved) { | ||
moved = true; | ||
trace('wrap'); | ||
} | ||
if( x > 465 ){ | ||
x = 231; | ||
} | ||
// Move the beetle in proportion to how far | ||
// the joystick is dragged from its center | ||
y += Math.sin(angle*(Math.PI/180))*(knob.x/8); | ||
x += Math.cos(angle*(Math.PI/180))*(knob.x/8); | ||
} | ||
// Scale the length of the joystick shaft | ||
shaft.width = (knob.x-shaft.x); | ||
shaft.alpha = 1; | ||
} | ||
else{ | ||
// Snap back to center when the joystick is released | ||
xSpeed = -knob.x*tension+(xSpeed*decay); | ||
knob.x += xSpeed; | ||
shaft.alpha = 0; | ||
} | ||
} | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
[ | ||
{"type": "Wait"}, | ||
{"type": "MouseMove", "pos": [115.1, 116]}, | ||
{"type": "Wait"}, | ||
{"type": "MouseDown", "pos": [115.1, 116], "btn": "Left"}, | ||
{"type": "Wait"}, | ||
{"type": "MouseMove", "pos": [135.1, 116]}, | ||
{"type": "Wait"}, | ||
{"type": "Wait"}, | ||
{"type": "Wait"}, | ||
{"type": "Wait"}, | ||
{"type": "Wait"}, | ||
{"type": "Wait"}, | ||
{"type": "Wait"}, | ||
{"type": "Wait"}, | ||
{"type": "Wait"}, | ||
{"type": "Wait"}, | ||
{"type": "Wait"}, | ||
{"type": "Wait"}, | ||
{"type": "Wait"}, | ||
{"type": "Wait"}, | ||
{"type": "MouseUp", "pos": [135.1, 116], "btn": "Left"}, | ||
{"type": "Wait"} | ||
] |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
Interactivity3 init | ||
dragPressHandler | ||
wrap | ||
dragReleaseHandler |
Binary file not shown.
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
num_ticks = 20 | ||
|
||
[image_comparisons.output] | ||
tolerance = 3 | ||
|
||
[player_options] | ||
with_renderer = { optional = true, sample_count = 1 } |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
package { | ||
|
||
import flash.display.MovieClip; | ||
import flash.display.Sprite; | ||
|
||
public class MaskTest extends MovieClip { | ||
public function MaskTest() { | ||
graphics.beginFill(0xFF00FF); | ||
graphics.drawCircle(100, 100, 100); | ||
graphics.endFill(); | ||
|
||
var sprite : Sprite = new Sprite(); | ||
sprite.graphics.beginFill(0xFF00FF); | ||
sprite.graphics.drawRect(20, 0, 160, 200); | ||
sprite.graphics.endFill(); | ||
|
||
mask = sprite; | ||
} | ||
} | ||
} |
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
num_frames = 1 | ||
|
||
[image_comparisons.output] | ||
tolerance = 0 | ||
|
||
[player_options] | ||
with_renderer = { optional = false, sample_count = 1 } |
Empty file.
Binary file not shown.
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
num_frames = 1 | ||
known_failure = true | ||
|
||
[image_comparisons.output] | ||
tolerance = 3 | ||
|
||
[player_options] | ||
with_renderer = { optional = false, sample_count = 1 } |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
[object Shape] | ||
null | ||
[object Sprite] | ||
null |
Binary file not shown.
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
num_frames = 4 | ||
known_failure = true | ||
|
||
[image_comparisons.output] | ||
tolerance = 3 | ||
|
||
[player_options] | ||
with_renderer = { optional = false, sample_count = 1 } |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
3 | ||
NaN | ||
NaN | ||
_level0a | ||
NaN | ||
1a | ||
a1 | ||
NaN | ||
nulla | ||
b[type Function] | ||
[type Object]c |
Binary file not shown.
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
num_ticks = 1 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
package { | ||
public interface Interface1 { | ||
function run():void; | ||
} | ||
} |
41 changes: 41 additions & 0 deletions
41
tests/tests/swfs/from_shumway/as3-interfaces/LoadService.as
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
/* | ||
Compiled with: | ||
node utils/compileabc.js --swf LoadService,100,100,60 -p test/swfs/as3-interfaces/Interface1.as test/swfs/as3-interfaces/LoadService.as | ||
*/ | ||
|
||
package { | ||
import flash.display.Loader; | ||
import flash.display.Sprite; | ||
import flash.events.Event; | ||
import flash.net.URLRequest; | ||
import flash.system.fscommand; | ||
import Interface1; | ||
|
||
public class LoadService extends Sprite { | ||
|
||
private var _loader:Loader; | ||
|
||
public function LoadService() { | ||
trace('loading started'); | ||
_loader = new Loader(); | ||
_loader.contentLoaderInfo.addEventListener(Event.COMPLETE, loader_complete); | ||
addChild(_loader); | ||
_loader.load(new URLRequest("./Service1.swf")); | ||
} | ||
|
||
private function loader_complete(event:Event):void { | ||
trace("loading complete"); | ||
|
||
var content: * = _loader.content; | ||
var service_as: Interface1 = content as Interface1; | ||
trace('content as Interface1 != null: ' + (service_as != null)); | ||
|
||
var service_co: Interface1 = Interface1(content); | ||
trace(service_co); | ||
service_co.run(); | ||
|
||
fscommand('quit'); | ||
} | ||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
/* | ||
Compiled with: | ||
node utils/compileabc.js --swf Service1,100,100,60 -p test/swfs/as3-interfaces/Interface1.as test/swfs/as3-interfaces/Service1.as | ||
*/ | ||
|
||
package { | ||
import flash.display.Sprite; | ||
import flash.events.Event; | ||
import Interface1; | ||
|
||
public class Service1 extends Sprite implements Interface1 { | ||
public function Service1() { | ||
trace('service initialized'); | ||
} | ||
|
||
public function run(): void { | ||
trace('service: run()'); | ||
graphics.clear(); | ||
graphics.beginFill( 0x00FF00); | ||
graphics.drawRect(0, 0, 100, 100); | ||
} | ||
} | ||
} |
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
loading started | ||
service initialized | ||
loading complete | ||
content as Interface1 != null: true | ||
[object Service1] | ||
service: run() |
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
num_ticks = 2 |
Binary file not shown.
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
loadee frame executed |
Binary file not shown.
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
num_ticks = 2 |
Empty file.
1 change: 1 addition & 0 deletions
1
tests/tests/swfs/from_shumway/as3-loader/bug1157243/empty/output.txt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
true |
Binary file not shown.
Binary file not shown.
1 change: 1 addition & 0 deletions
1
tests/tests/swfs/from_shumway/as3-loader/bug1157243/empty/test.toml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
num_ticks = 2 |
1 change: 1 addition & 0 deletions
1
tests/tests/swfs/from_shumway/as3-loader/bug1157243/invalid/invalid.swf
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
This is not a valid SWF file. |
1 change: 1 addition & 0 deletions
1
tests/tests/swfs/from_shumway/as3-loader/bug1157243/invalid/output.txt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
true |
Binary file not shown.
Binary file added
BIN
+856 Bytes
tests/tests/swfs/from_shumway/as3-loader/bug1157243/invalid/test.swf
Binary file not shown.
1 change: 1 addition & 0 deletions
1
tests/tests/swfs/from_shumway/as3-loader/bug1157243/invalid/test.toml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
num_ticks = 2 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
package { | ||
import flash.display.MovieClip; | ||
|
||
public class Child extends MovieClip { | ||
public function Child() { | ||
trace('construct ' + this.name + ', parent: ' + parent); | ||
} | ||
} | ||
} |
14 changes: 14 additions & 0 deletions
14
tests/tests/swfs/from_shumway/as3-loader/events/LoaderEvents.as
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
package { | ||
import flash.display.MovieClip; | ||
import flash.events.Event; | ||
|
||
public class LoaderEvents extends MovieClip { | ||
public function LoaderEvents() { | ||
var self = this; | ||
trace('constructed ' + this.name); | ||
addEventListener(Event.ADDED, function(e) { | ||
trace('added ' + e.target['name']); | ||
}); | ||
} | ||
} | ||
} |
Binary file not shown.
Binary file not shown.
Oops, something went wrong.