asproject 0.1.92 → 0.1.118
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/lib/asclass_arguments.rb +1 -1
- data/lib/asproject.rb +3 -1
- data/lib/asproject/version.rb +1 -1
- data/lib/asproject_arguments.rb +5 -5
- data/lib/path_finder.rb +17 -7
- data/lib/tasks/asunit.rb +8 -0
- data/lib/tasks/flash_log.rb +2 -1
- data/lib/tasks/flash_player.rb +10 -6
- data/lib/tasks/mxmlc.rb +13 -2
- data/lib/tasks/remote_file_loader.rb +144 -0
- data/lib/tasks/remote_file_task.rb +2 -128
- data/lib/tasks/remote_library_task.rb +75 -0
- data/templates/asclass/as2/Class.as +1 -1
- data/templates/asproject/as2/{art → assets}/.crap_file +0 -0
- data/templates/asproject/as2/project/rakefile.rb +3 -2
- data/templates/asproject/as3/{art → assets}/.crap_file +0 -0
- data/templates/asproject/as3/project/rakefile.rb +3 -3
- data/templates/asproject/fdt/project/.as2_classpath +1 -1
- metadata +9 -129
- data/templates/asproject/asunit2/project/lib/asunit/AsUnitUi.swf +0 -0
- data/templates/asproject/asunit2/project/lib/asunit/Sys.as +0 -70
- data/templates/asproject/asunit2/project/lib/asunit/com/asunit/controls/LocalOutputPanel.as +0 -182
- data/templates/asproject/asunit2/project/lib/asunit/com/asunit/controls/LocalOutputPanelTest.as +0 -84
- data/templates/asproject/asunit2/project/lib/asunit/com/asunit/controls/LocalOutputPanelTextArea.as +0 -111
- data/templates/asproject/asunit2/project/lib/asunit/com/asunit/controls/LocalOutputPanelTextAreaTest.as +0 -26
- data/templates/asproject/asunit2/project/lib/asunit/com/asunit/controls/LocalOutputPanelTitleBar.as +0 -81
- data/templates/asproject/asunit2/project/lib/asunit/com/asunit/controls/ResizeHandle.as +0 -35
- data/templates/asproject/asunit2/project/lib/asunit/com/asunit/controls/ScrollArrow.as +0 -34
- data/templates/asproject/asunit2/project/lib/asunit/com/asunit/controls/ScrollHandle.as +0 -43
- data/templates/asproject/asunit2/project/lib/asunit/com/asunit/controls/ScrollListener.as +0 -10
- data/templates/asproject/asunit2/project/lib/asunit/com/asunit/controls/TextScroller.as +0 -169
- data/templates/asproject/asunit2/project/lib/asunit/com/asunit/controls/shapes/Rectangle.as +0 -29
- data/templates/asproject/asunit2/project/lib/asunit/com/asunit/controls/shapes/Triangle.as +0 -27
- data/templates/asproject/asunit2/project/lib/asunit/com/asunit/framework/AsUnit.as +0 -19
- data/templates/asproject/asunit2/project/lib/asunit/com/asunit/framework/Assert.as +0 -408
- data/templates/asproject/asunit2/project/lib/asunit/com/asunit/framework/Assertion.as +0 -27
- data/templates/asproject/asunit2/project/lib/asunit/com/asunit/framework/Reflection.as +0 -68
- data/templates/asproject/asunit2/project/lib/asunit/com/asunit/framework/Test.as +0 -3
- data/templates/asproject/asunit2/project/lib/asunit/com/asunit/framework/TestCase.as +0 -191
- data/templates/asproject/asunit2/project/lib/asunit/com/asunit/framework/TestCaseXml.as +0 -31
- data/templates/asproject/asunit2/project/lib/asunit/com/asunit/framework/TestFailure.as +0 -15
- data/templates/asproject/asunit2/project/lib/asunit/com/asunit/framework/TestResult.as +0 -15
- data/templates/asproject/asunit2/project/lib/asunit/com/asunit/framework/TestRunner.as +0 -41
- data/templates/asproject/asunit2/project/lib/asunit/com/asunit/framework/TestSetup.as +0 -19
- data/templates/asproject/asunit2/project/lib/asunit/com/asunit/framework/TestSuite.as +0 -22
- data/templates/asproject/asunit2/project/lib/asunit/com/asunit/ui/Main.as +0 -325
- data/templates/asproject/asunit2/project/lib/asunit/com/asunit/ui/RemoteVersion.as +0 -24
- data/templates/asproject/asunit2/project/lib/asunit/com/asunit/ui/SuccessMeter.as +0 -32
- data/templates/asproject/asunit2/project/lib/asunit/com/asunit/util/Comparable.as +0 -7
- data/templates/asproject/asunit2/project/lib/asunit/com/asunit/util/EventListener.as +0 -29
- data/templates/asproject/asunit2/project/lib/asunit/com/asunit/util/EventSource.as +0 -89
- data/templates/asproject/asunit2/project/lib/asunit/com/asunit/util/LocalConnClient.as +0 -42
- data/templates/asproject/asunit2/project/lib/asunit/com/asunit/util/LocalConnGateway.as +0 -47
- data/templates/asproject/asunit2/project/lib/asunit/com/asunit/util/LocalConnServer.as +0 -61
- data/templates/asproject/asunit2/project/lib/asunit/com/asunit/util/LocalMessageBroker.as +0 -58
- data/templates/asproject/asunit2/project/lib/asunit/com/asunit/util/Observable.as +0 -11
- data/templates/asproject/asunit2/project/lib/asunit/com/asunit/util/TextFile.as +0 -30
- data/templates/asproject/asunit25/project/lib/asunit/AsUnitTestRunner.as +0 -13
- data/templates/asproject/asunit25/project/lib/asunit/asunit/errors/AssertionFailedError.as +0 -7
- data/templates/asproject/asunit25/project/lib/asunit/asunit/errors/AssertionPassedError.as +0 -7
- data/templates/asproject/asunit25/project/lib/asunit/asunit/errors/ClassNotFoundError.as +0 -7
- data/templates/asproject/asunit25/project/lib/asunit/asunit/errors/IllegalOperationError.as +0 -7
- data/templates/asproject/asunit25/project/lib/asunit/asunit/errors/InstanceNotFoundError.as +0 -7
- data/templates/asproject/asunit25/project/lib/asunit/asunit/errors/InvocationTargetError.as +0 -7
- data/templates/asproject/asunit25/project/lib/asunit/asunit/errors/UnimplementedFeatureError.as +0 -7
- data/templates/asproject/asunit25/project/lib/asunit/asunit/framework/Assert.as +0 -376
- data/templates/asproject/asunit25/project/lib/asunit/asunit/framework/AssertMock.as +0 -15
- data/templates/asproject/asunit25/project/lib/asunit/asunit/framework/AssertTest.as +0 -59
- data/templates/asproject/asunit25/project/lib/asunit/asunit/framework/ITestListener.as +0 -13
- data/templates/asproject/asunit25/project/lib/asunit/asunit/framework/Test.as +0 -11
- data/templates/asproject/asunit25/project/lib/asunit/asunit/framework/TestCase.as +0 -278
- data/templates/asproject/asunit25/project/lib/asunit/asunit/framework/TestCaseMock.as +0 -23
- data/templates/asproject/asunit25/project/lib/asunit/asunit/framework/TestCaseTest.as +0 -29
- data/templates/asproject/asunit25/project/lib/asunit/asunit/framework/TestCaseXml.as +0 -38
- data/templates/asproject/asunit25/project/lib/asunit/asunit/framework/TestFailure.as +0 -47
- data/templates/asproject/asunit25/project/lib/asunit/asunit/framework/TestResult.as +0 -168
- data/templates/asproject/asunit25/project/lib/asunit/asunit/framework/TestSuite.as +0 -102
- data/templates/asproject/asunit25/project/lib/asunit/asunit/runner/BaseTestRunner.as +0 -101
- data/templates/asproject/asunit25/project/lib/asunit/asunit/runner/IResultPrinter.as +0 -8
- data/templates/asproject/asunit25/project/lib/asunit/asunit/textui/ResultPrinter.as +0 -254
- data/templates/asproject/asunit25/project/lib/asunit/asunit/textui/SuccessBar.as +0 -41
- data/templates/asproject/asunit25/project/lib/asunit/asunit/textui/TestRunner.as +0 -17
- data/templates/asproject/asunit25/project/lib/asunit/asunit/util/ArrayIterator.as +0 -24
- data/templates/asproject/asunit25/project/lib/asunit/asunit/util/ArrayIteratorTest.as +0 -52
- data/templates/asproject/asunit25/project/lib/asunit/asunit/util/Iterator.as +0 -5
- data/templates/asproject/asunit3/project/lib/asunit/AsUnitTestRunner.as +0 -10
- data/templates/asproject/asunit3/project/lib/asunit/asunit/errors/AbstractMemberCalledError.as +0 -10
- data/templates/asproject/asunit3/project/lib/asunit/asunit/errors/AssertionFailedError.as +0 -10
- data/templates/asproject/asunit3/project/lib/asunit/asunit/errors/ClassNotFoundError.as +0 -10
- data/templates/asproject/asunit3/project/lib/asunit/asunit/errors/InstanceNotFoundError.as +0 -10
- data/templates/asproject/asunit3/project/lib/asunit/asunit/errors/UnimplementedFeatureError.as +0 -10
- data/templates/asproject/asunit3/project/lib/asunit/asunit/framework/Assert.as +0 -271
- data/templates/asproject/asunit3/project/lib/asunit/asunit/framework/AsynchronousTestCase.as +0 -52
- data/templates/asproject/asunit3/project/lib/asunit/asunit/framework/AsynchronousTestCaseExample.as +0 -71
- data/templates/asproject/asunit3/project/lib/asunit/asunit/framework/Test.as +0 -15
- data/templates/asproject/asunit3/project/lib/asunit/asunit/framework/TestCase.as +0 -354
- data/templates/asproject/asunit3/project/lib/asunit/asunit/framework/TestCaseExample.as +0 -73
- data/templates/asproject/asunit3/project/lib/asunit/asunit/framework/TestFailure.as +0 -47
- data/templates/asproject/asunit3/project/lib/asunit/asunit/framework/TestListener.as +0 -22
- data/templates/asproject/asunit3/project/lib/asunit/asunit/framework/TestResult.as +0 -158
- data/templates/asproject/asunit3/project/lib/asunit/asunit/framework/TestSuite.as +0 -115
- data/templates/asproject/asunit3/project/lib/asunit/asunit/runner/BaseTestRunner.as +0 -15
- data/templates/asproject/asunit3/project/lib/asunit/asunit/runner/TestSuiteLoader.as +0 -9
- data/templates/asproject/asunit3/project/lib/asunit/asunit/runner/Version.as +0 -11
- data/templates/asproject/asunit3/project/lib/asunit/asunit/textui/FlexRunner.as +0 -19
- data/templates/asproject/asunit3/project/lib/asunit/asunit/textui/FlexTestRunner.as +0 -55
- data/templates/asproject/asunit3/project/lib/asunit/asunit/textui/ResultPrinter.as +0 -245
- data/templates/asproject/asunit3/project/lib/asunit/asunit/textui/TestRunner.as +0 -121
- data/templates/asproject/asunit3/project/lib/asunit/asunit/util/ArrayIterator.as +0 -26
- data/templates/asproject/asunit3/project/lib/asunit/asunit/util/Iterator.as +0 -9
- data/templates/asproject/asunit3/project/lib/asunit/asunit/util/Properties.as +0 -30
@@ -1,19 +0,0 @@
|
|
1
|
-
package asunit.textui {
|
2
|
-
import asunit.framework.TestResult;
|
3
|
-
|
4
|
-
import mx.core.Application;
|
5
|
-
|
6
|
-
public class FlexRunner extends Application {
|
7
|
-
protected var runner:TestRunner;
|
8
|
-
|
9
|
-
override protected function createChildren():void {
|
10
|
-
super.createChildren();
|
11
|
-
runner = new FlexTestRunner();
|
12
|
-
rawChildren.addChild(runner);
|
13
|
-
}
|
14
|
-
|
15
|
-
public function start(testCase:Class, testMethod:String = null, showTrace:Boolean = false):TestResult {
|
16
|
-
return runner.start(testCase, testMethod, showTrace);
|
17
|
-
}
|
18
|
-
}
|
19
|
-
}
|
@@ -1,55 +0,0 @@
|
|
1
|
-
package asunit.textui {
|
2
|
-
import flash.display.DisplayObject;
|
3
|
-
import flash.events.Event;
|
4
|
-
import mx.core.IUIComponent;
|
5
|
-
import asunit.textui.TestRunner;
|
6
|
-
|
7
|
-
public class FlexTestRunner extends TestRunner {
|
8
|
-
|
9
|
-
public function FlexTestRunner() {
|
10
|
-
setPrinter(new ResultPrinter());
|
11
|
-
}
|
12
|
-
|
13
|
-
protected override function addedHandler(event:Event):void {
|
14
|
-
if(event.target === this) {
|
15
|
-
parent.addEventListener(Event.RESIZE, resizeHandler);
|
16
|
-
resizeHandler(new Event(Event.RESIZE));
|
17
|
-
}
|
18
|
-
else {
|
19
|
-
event.stopPropagation();
|
20
|
-
}
|
21
|
-
}
|
22
|
-
|
23
|
-
public override function set width(w:Number):void {
|
24
|
-
fPrinter.width = w;
|
25
|
-
}
|
26
|
-
|
27
|
-
public override function set height(h:Number):void {
|
28
|
-
fPrinter.height = h;
|
29
|
-
}
|
30
|
-
|
31
|
-
public function resizeHandler(event:Event):void {
|
32
|
-
width = parent.width;
|
33
|
-
height = parent.height;
|
34
|
-
}
|
35
|
-
|
36
|
-
public override function addChild(child:DisplayObject):DisplayObject {
|
37
|
-
if(parent && child is IUIComponent) {
|
38
|
-
// AND check for 'is' UIUComponent...
|
39
|
-
return parent.addChild(child);
|
40
|
-
}
|
41
|
-
else {
|
42
|
-
return super.addChild(child);
|
43
|
-
}
|
44
|
-
}
|
45
|
-
|
46
|
-
public override function removeChild(child:DisplayObject):DisplayObject {
|
47
|
-
if(child is IUIComponent) {
|
48
|
-
return parent.removeChild(child);
|
49
|
-
}
|
50
|
-
else {
|
51
|
-
return super.removeChild(child);
|
52
|
-
}
|
53
|
-
}
|
54
|
-
}
|
55
|
-
}
|
@@ -1,245 +0,0 @@
|
|
1
|
-
package asunit.textui {
|
2
|
-
import asunit.errors.AssertionFailedError;
|
3
|
-
import asunit.framework.Test;
|
4
|
-
import asunit.framework.TestFailure;
|
5
|
-
import asunit.framework.TestListener;
|
6
|
-
import asunit.framework.TestResult;
|
7
|
-
import asunit.runner.BaseTestRunner;
|
8
|
-
import asunit.runner.Version;
|
9
|
-
|
10
|
-
import flash.display.Shape;
|
11
|
-
import flash.display.Sprite;
|
12
|
-
import flash.display.Stage;
|
13
|
-
import flash.display.StageAlign;
|
14
|
-
import flash.display.StageScaleMode;
|
15
|
-
import flash.events.*;
|
16
|
-
import flash.text.TextField;
|
17
|
-
import flash.text.TextFormat;
|
18
|
-
import flash.ui.Keyboard;
|
19
|
-
import flash.utils.setTimeout;
|
20
|
-
|
21
|
-
public class ResultPrinter extends Sprite implements TestListener {
|
22
|
-
private var fColumn:int = 0;
|
23
|
-
private var textArea:TextField;
|
24
|
-
private var gutter:uint = 0;
|
25
|
-
private var backgroundColor:uint = 0x333333;
|
26
|
-
private var bar:SuccessBar;
|
27
|
-
private var barHeight:Number = 3;
|
28
|
-
private var showTrace:Boolean;
|
29
|
-
|
30
|
-
public function ResultPrinter(showTrace:Boolean = false) {
|
31
|
-
this.showTrace = showTrace;
|
32
|
-
configureAssets();
|
33
|
-
println();
|
34
|
-
}
|
35
|
-
|
36
|
-
private function configureAssets():void {
|
37
|
-
textArea = new TextField();
|
38
|
-
textArea.background = true;
|
39
|
-
textArea.backgroundColor = backgroundColor;
|
40
|
-
textArea.border = true;
|
41
|
-
textArea.wordWrap = true;
|
42
|
-
var format:TextFormat = new TextFormat();
|
43
|
-
format.font = "Verdana";
|
44
|
-
format.size = 10;
|
45
|
-
format.color = 0xFFFFFF;
|
46
|
-
textArea.defaultTextFormat = format;
|
47
|
-
addChild(textArea);
|
48
|
-
println("AsUnit " + Version.id() + " by Luke Bayes and Ali Mills");
|
49
|
-
|
50
|
-
bar = new SuccessBar();
|
51
|
-
addChild(bar);
|
52
|
-
}
|
53
|
-
|
54
|
-
public function setShowTrace(showTrace:Boolean):void {
|
55
|
-
this.showTrace = showTrace;
|
56
|
-
}
|
57
|
-
|
58
|
-
public override function set width(w:Number):void {
|
59
|
-
textArea.x = gutter;
|
60
|
-
textArea.width = w - gutter*2;
|
61
|
-
bar.x = gutter;
|
62
|
-
bar.width = textArea.width;
|
63
|
-
}
|
64
|
-
|
65
|
-
public override function set height(h:Number):void {
|
66
|
-
textArea.height = h - ((gutter*2) + barHeight);
|
67
|
-
textArea.y = gutter;
|
68
|
-
bar.y = h - (gutter + barHeight);
|
69
|
-
bar.height = barHeight;
|
70
|
-
}
|
71
|
-
|
72
|
-
public function println(...args:Array):void {
|
73
|
-
textArea.appendText(args.toString() + "\n");
|
74
|
-
}
|
75
|
-
|
76
|
-
public function print(...args:Array):void {
|
77
|
-
textArea.appendText(args.toString());
|
78
|
-
}
|
79
|
-
/* API for use by textui.TestRunner
|
80
|
-
*/
|
81
|
-
|
82
|
-
public function printResult(result:TestResult, runTime:Number):void {
|
83
|
-
printHeader(runTime);
|
84
|
-
printErrors(result);
|
85
|
-
printFailures(result);
|
86
|
-
printFooter(result);
|
87
|
-
|
88
|
-
bar.setSuccess(result.wasSuccessful());
|
89
|
-
if(showTrace) {
|
90
|
-
trace(textArea.text);
|
91
|
-
}
|
92
|
-
}
|
93
|
-
|
94
|
-
/* Internal methods
|
95
|
-
*/
|
96
|
-
protected function printHeader(runTime:Number):void {
|
97
|
-
println();
|
98
|
-
println();
|
99
|
-
println("Time: " + elapsedTimeAsString(runTime));
|
100
|
-
}
|
101
|
-
|
102
|
-
protected function printErrors(result:TestResult):void {
|
103
|
-
printDefects(result.errors(), result.errorCount(), "error");
|
104
|
-
}
|
105
|
-
|
106
|
-
protected function printFailures(result:TestResult):void {
|
107
|
-
printDefects(result.failures(), result.failureCount(), "failure");
|
108
|
-
}
|
109
|
-
|
110
|
-
protected function printDefects(booBoos:Object, count:int, type:String):void {
|
111
|
-
if (count == 0) {
|
112
|
-
return;
|
113
|
-
}
|
114
|
-
if (count == 1) {
|
115
|
-
println("There was " + count + " " + type + ":");
|
116
|
-
}
|
117
|
-
else {
|
118
|
-
println("There were " + count + " " + type + "s:");
|
119
|
-
}
|
120
|
-
var i:uint;
|
121
|
-
for each (var item:TestFailure in booBoos) {
|
122
|
-
printDefect(TestFailure(item), i);
|
123
|
-
i++;
|
124
|
-
}
|
125
|
-
}
|
126
|
-
|
127
|
-
public function printDefect(booBoo:TestFailure, count:int ):void { // only public for testing purposes
|
128
|
-
printDefectHeader(booBoo, count);
|
129
|
-
printDefectTrace(booBoo);
|
130
|
-
}
|
131
|
-
|
132
|
-
protected function printDefectHeader(booBoo:TestFailure, count:int):void {
|
133
|
-
// I feel like making this a println, then adding a line giving the throwable a chance to print something
|
134
|
-
// before we get to the stack trace.
|
135
|
-
var startIndex:uint = textArea.text.length;
|
136
|
-
println(count + ") " + booBoo.failedTest());
|
137
|
-
var endIndex:uint = textArea.text.length;
|
138
|
-
|
139
|
-
var format:TextFormat = textArea.getTextFormat();
|
140
|
-
format.bold = true;
|
141
|
-
|
142
|
-
// GROSS HACK because of bug in flash player - TextField isn't accepting formats...
|
143
|
-
setTimeout(onFormatTimeout, 1, format, startIndex, endIndex);
|
144
|
-
}
|
145
|
-
|
146
|
-
public function onFormatTimeout(format:TextFormat, startIndex:uint, endIndex:uint):void {
|
147
|
-
textArea.setTextFormat(format, startIndex, endIndex);
|
148
|
-
}
|
149
|
-
|
150
|
-
protected function printDefectTrace(booBoo:TestFailure):void {
|
151
|
-
println(BaseTestRunner.getFilteredTrace(booBoo.thrownException().getStackTrace()));
|
152
|
-
}
|
153
|
-
|
154
|
-
protected function printFooter(result:TestResult):void {
|
155
|
-
println();
|
156
|
-
if (result.wasSuccessful()) {
|
157
|
-
print("OK");
|
158
|
-
println (" (" + result.runCount() + " test" + (result.runCount() == 1 ? "": "s") + ")");
|
159
|
-
} else {
|
160
|
-
println("FAILURES!!!");
|
161
|
-
println("Tests run: " + result.runCount()+
|
162
|
-
", Failures: "+result.failureCount()+
|
163
|
-
", Errors: "+result.errorCount());
|
164
|
-
}
|
165
|
-
println();
|
166
|
-
}
|
167
|
-
|
168
|
-
/**
|
169
|
-
* Returns the formatted string of the elapsed time.
|
170
|
-
* Duplicated from BaseTestRunner. Fix it.
|
171
|
-
*/
|
172
|
-
protected function elapsedTimeAsString(runTime:Number):String {
|
173
|
-
return Number(runTime/1000).toString();
|
174
|
-
}
|
175
|
-
|
176
|
-
/**
|
177
|
-
* @see junit.framework.TestListener#addError(Test, Throwable)
|
178
|
-
*/
|
179
|
-
public function addError(test:Test, t:Error):void {
|
180
|
-
print("E");
|
181
|
-
}
|
182
|
-
|
183
|
-
/**
|
184
|
-
* @see junit.framework.TestListener#addFailure(Test, AssertionFailedError)
|
185
|
-
*/
|
186
|
-
public function addFailure(test:Test, t:AssertionFailedError):void {
|
187
|
-
print("F");
|
188
|
-
}
|
189
|
-
|
190
|
-
/**
|
191
|
-
* @see junit.framework.TestListener#endTest(Test)
|
192
|
-
*/
|
193
|
-
public function endTest(test:Test):void {
|
194
|
-
}
|
195
|
-
|
196
|
-
/**
|
197
|
-
* @see junit.framework.TestListener#startTest(Test)
|
198
|
-
*/
|
199
|
-
public function startTest(test:Test):void {
|
200
|
-
var count:uint = test.countTestCases();
|
201
|
-
for(var i:uint; i < count; i++) {
|
202
|
-
print(".");
|
203
|
-
if (fColumn++ >= 80) {
|
204
|
-
println();
|
205
|
-
fColumn = 0;
|
206
|
-
}
|
207
|
-
}
|
208
|
-
}
|
209
|
-
}
|
210
|
-
}
|
211
|
-
|
212
|
-
import flash.display.Sprite;
|
213
|
-
|
214
|
-
class SuccessBar extends Sprite {
|
215
|
-
private var myWidth:uint;
|
216
|
-
private var myHeight:uint;
|
217
|
-
private var bgColor:uint;
|
218
|
-
private var passingColor:uint = 0x00FF00;
|
219
|
-
private var failingColor:uint = 0xFD0000;
|
220
|
-
|
221
|
-
public function SuccessBar() {
|
222
|
-
}
|
223
|
-
|
224
|
-
public function setSuccess(success:Boolean):void {
|
225
|
-
bgColor = (success) ? passingColor : failingColor;
|
226
|
-
draw();
|
227
|
-
}
|
228
|
-
|
229
|
-
public override function set width(num:Number):void {
|
230
|
-
myWidth = num;
|
231
|
-
draw();
|
232
|
-
}
|
233
|
-
|
234
|
-
public override function set height(num:Number):void {
|
235
|
-
myHeight = num;
|
236
|
-
draw();
|
237
|
-
}
|
238
|
-
|
239
|
-
private function draw():void {
|
240
|
-
graphics.clear();
|
241
|
-
graphics.beginFill(bgColor);
|
242
|
-
graphics.drawRect(0, 0, myWidth, myHeight);
|
243
|
-
graphics.endFill();
|
244
|
-
}
|
245
|
-
}
|
@@ -1,121 +0,0 @@
|
|
1
|
-
package asunit.textui {
|
2
|
-
import asunit.errors.AbstractMemberCalledError;
|
3
|
-
import asunit.framework.Test;
|
4
|
-
import asunit.framework.TestResult;
|
5
|
-
|
6
|
-
import flash.display.Sprite;
|
7
|
-
import flash.display.StageAlign;
|
8
|
-
import flash.display.StageScaleMode;
|
9
|
-
import flash.events.Event;
|
10
|
-
import flash.system.fscommand;
|
11
|
-
import flash.utils.clearInterval;
|
12
|
-
import flash.utils.describeType;
|
13
|
-
import flash.utils.getTimer;
|
14
|
-
import flash.utils.setInterval;
|
15
|
-
import flash.utils.Timer;
|
16
|
-
import flash.events.TimerEvent;
|
17
|
-
|
18
|
-
/**
|
19
|
-
* A command line based tool to run tests.
|
20
|
-
* <pre>
|
21
|
-
* java junit.textui.TestRunner TestCaseClass
|
22
|
-
* </pre>
|
23
|
-
* TestRunner expects the name of a TestCase class as argument.
|
24
|
-
* If this class defines a static <code>suite</code> method it
|
25
|
-
* will be invoked and the returned test is run. Otherwise all
|
26
|
-
* the methods starting with "test" having no arguments are run.
|
27
|
-
* <p>
|
28
|
-
* TestRunner prints a trace as the tests are executed followed by a
|
29
|
-
* summary at the end.
|
30
|
-
*/
|
31
|
-
public class TestRunner extends Sprite {
|
32
|
-
public static const SUCCESS_EXIT:int = 0;
|
33
|
-
public static const FAILURE_EXIT:int = 1;
|
34
|
-
public static const EXCEPTION_EXIT:int = 2;
|
35
|
-
public static const SHOW_TRACE:Boolean = true;
|
36
|
-
protected var fPrinter:ResultPrinter;
|
37
|
-
protected var startTime:Number;
|
38
|
-
protected var result:TestResult;
|
39
|
-
|
40
|
-
public function TestRunner() {
|
41
|
-
configureListeners();
|
42
|
-
}
|
43
|
-
|
44
|
-
private function configureListeners():void {
|
45
|
-
addEventListener(Event.ADDED, addedHandler);
|
46
|
-
}
|
47
|
-
|
48
|
-
protected function addedHandler(event:Event):void {
|
49
|
-
if(event.target === fPrinter) {
|
50
|
-
stage.align = StageAlign.TOP_LEFT;
|
51
|
-
stage.scaleMode = StageScaleMode.NO_SCALE;
|
52
|
-
stage.addEventListener(Event.RESIZE, resizeHandler);
|
53
|
-
resizeHandler(new Event("resize"));
|
54
|
-
}
|
55
|
-
}
|
56
|
-
|
57
|
-
private function resizeHandler(event:Event):void {
|
58
|
-
fPrinter.width = stage.stageWidth;
|
59
|
-
fPrinter.height = stage.stageHeight;
|
60
|
-
}
|
61
|
-
|
62
|
-
/**
|
63
|
-
* Starts a test run based on the TestCase/TestSuite provided
|
64
|
-
* Create a new custom class that extends TestRunner
|
65
|
-
* and call start(TestCaseClass) from within the
|
66
|
-
* constructor.
|
67
|
-
*/
|
68
|
-
public function start(testCase:Class, testMethod:String = null, showTrace:Boolean = false):TestResult {
|
69
|
-
// fscommand("showmenu", "false");
|
70
|
-
|
71
|
-
try {
|
72
|
-
var instance:Test;
|
73
|
-
if(testMethod != null) {
|
74
|
-
instance = new testCase(testMethod);
|
75
|
-
}
|
76
|
-
else {
|
77
|
-
instance = new testCase();
|
78
|
-
}
|
79
|
-
return doRun(instance, showTrace);
|
80
|
-
}
|
81
|
-
catch(e:Error) {
|
82
|
-
throw new Error("Could not create and run test suite: " + e.getStackTrace());
|
83
|
-
}
|
84
|
-
return null;
|
85
|
-
}
|
86
|
-
|
87
|
-
public function doRun(test:Test, showTrace:Boolean = false):TestResult {
|
88
|
-
result = new TestResult();
|
89
|
-
if(fPrinter == null) {
|
90
|
-
setPrinter(new ResultPrinter(showTrace));
|
91
|
-
}
|
92
|
-
else {
|
93
|
-
fPrinter.setShowTrace(showTrace);
|
94
|
-
}
|
95
|
-
result.addListener(getPrinter());
|
96
|
-
startTime = getTimer();
|
97
|
-
test.setResult(result);
|
98
|
-
test.setContext(this);
|
99
|
-
test.addEventListener(Event.COMPLETE, testCompleteHandler);
|
100
|
-
test.run();
|
101
|
-
return result;
|
102
|
-
}
|
103
|
-
|
104
|
-
private function testCompleteHandler(event:Event):void {
|
105
|
-
var endTime:Number = getTimer();
|
106
|
-
var runTime:Number = endTime - startTime;
|
107
|
-
getPrinter().printResult(result, runTime);
|
108
|
-
}
|
109
|
-
|
110
|
-
public function setPrinter(printer:ResultPrinter):void {
|
111
|
-
if(fPrinter == null) {
|
112
|
-
fPrinter = printer;
|
113
|
-
addChild(fPrinter);
|
114
|
-
}
|
115
|
-
}
|
116
|
-
|
117
|
-
public function getPrinter():ResultPrinter {
|
118
|
-
return fPrinter;
|
119
|
-
}
|
120
|
-
}
|
121
|
-
}
|
@@ -1,26 +0,0 @@
|
|
1
|
-
package asunit.util {
|
2
|
-
|
3
|
-
import asunit.util.Iterator;
|
4
|
-
|
5
|
-
[ExcludeClass]
|
6
|
-
public class ArrayIterator implements Iterator {
|
7
|
-
private var list:Array;
|
8
|
-
private var index:Number = 0;
|
9
|
-
|
10
|
-
public function ArrayIterator(list:Array) {
|
11
|
-
this.list = list;
|
12
|
-
}
|
13
|
-
|
14
|
-
public function hasNext():Boolean {
|
15
|
-
return list[index] != null;
|
16
|
-
}
|
17
|
-
|
18
|
-
public function next():Object {
|
19
|
-
return list[index++];
|
20
|
-
}
|
21
|
-
|
22
|
-
public function reset():void {
|
23
|
-
index = 0;
|
24
|
-
}
|
25
|
-
}
|
26
|
-
}
|