asunit4 4.2.2.pre → 4.2.3.pre

Sign up to get free protection for your applications and to get access to all the features.
Files changed (95) hide show
  1. data/Gemfile.lock +26 -0
  2. data/bin/AsUnit-4.1.2.swc +0 -0
  3. data/bin/AsUnit-4.2.3.pre.swc +0 -0
  4. data/bin/AsUnitRunner.swf +0 -0
  5. data/bin/Flex4AsUnitRunner.swf +0 -0
  6. data/build.xml +42 -2
  7. data/lib/SwiftSuspenders-v1.5.1.swc +0 -0
  8. data/lib/flexUnitTasks.jar +0 -0
  9. data/pkg/sprout-asunit4-library-4.1.2.gem +0 -0
  10. data/rakefile.rb +4 -1
  11. data/sprout/lib/asunit4.rb +1 -1
  12. data/src/asunit/asserts/assertMatches.as +6 -0
  13. data/src/asunit/asserts/assertThrowsWithMessage.as +5 -0
  14. data/src/asunit/core/AsUnitCore.as +42 -88
  15. data/src/asunit/core/FlashBuilderCore.as +2 -2
  16. data/src/asunit/core/FlashDevelopCore.as +1 -1
  17. data/src/asunit/core/FlexUnitCICore.as +17 -0
  18. data/src/asunit/core/TextCore.as +36 -54
  19. data/src/asunit/framework/Assert.as +76 -11
  20. data/src/asunit/framework/Async.as +1 -1
  21. data/src/asunit/framework/IResult.as +1 -6
  22. data/src/asunit/framework/IRunListener.as +0 -3
  23. data/src/asunit/framework/IRunner.as +0 -3
  24. data/src/asunit/framework/IRunnerFactory.as +3 -3
  25. data/src/asunit/framework/ITestListener.as +1 -2
  26. data/src/asunit/framework/Method.as +82 -80
  27. data/src/asunit/framework/Result.as +3 -24
  28. data/src/asunit/framework/RunnerFactory.as +13 -34
  29. data/src/asunit/framework/SuiteIterator.as +28 -22
  30. data/src/asunit/framework/TestCase.as +8 -3
  31. data/src/asunit/printers/FlashBuilderPrinter.as +25 -83
  32. data/src/asunit/printers/FlashDevelopPrinter.as +1 -2
  33. data/src/asunit/printers/FlexUnitCIPrinter.as +181 -0
  34. data/src/asunit/printers/TextPrinter.as +17 -46
  35. data/src/asunit/printers/XMLPrinter.as +127 -0
  36. data/src/asunit/runners/LegacyRunner.as +6 -1
  37. data/src/asunit/runners/SuiteRunner.as +30 -66
  38. data/src/asunit/runners/TestRunner.as +90 -255
  39. data/test/AllTests.as +9 -4
  40. data/test/AsUnitCIRunner.as +18 -0
  41. data/test/AsUnitRunner.as +2 -0
  42. data/test/AsUnitRunnerCS3.fla +0 -0
  43. data/test/asunit/core/AsUnitCoreTest.as +33 -15
  44. data/test/asunit/framework/AssertEqualsArraysIgnoringOrderTest.as +14 -0
  45. data/test/asunit/framework/AssertThrowsWithMessageTest.as +50 -0
  46. data/test/asunit/framework/AsyncTest.as +0 -4
  47. data/test/asunit/framework/ProceedOnEventTest.as +1 -2
  48. data/test/asunit/framework/ResultObserverTest.as +61 -0
  49. data/test/asunit/framework/RunnerFactoryTest.as +7 -9
  50. data/test/asunit/framework/VisualTestCaseTest.as +2 -26
  51. data/test/asunit/printers/FlashBuilderPrinterTest.as +18 -0
  52. data/test/asunit/printers/XMLPrinterTest.as +131 -0
  53. data/test/asunit/runners/LegacyRunnerTest.as +4 -4
  54. data/test/asunit/runners/SuiteRunnerTest.as +10 -7
  55. data/test/asunit/runners/TestRunnerAsyncMethodTest.as +9 -7
  56. data/test/asunit/runners/TestRunnerErrorMethodTest.as +1 -1
  57. data/test/asunit/runners/TestRunnerExpectsErrorTest.as +2 -2
  58. data/test/asunit/runners/TestRunnerExpectsErrorWithMessageTest.as +125 -0
  59. data/test/asunit/runners/TestRunnerIgnoredMethodTest.as +2 -3
  60. data/test/asunit/runners/TestRunnerTest.as +4 -27
  61. data/test/asunit/support/{CustomTestRunner.as → CustomSuiteRunner.as} +7 -3
  62. data/test/asunit/support/InjectionVerification.as +2 -30
  63. data/test/asunit/support/SuiteWithCustomRunner.as +1 -1
  64. data/vendor/as3injection/org/swiftsuspenders/InjectionConfig.as +78 -0
  65. data/vendor/as3injection/org/swiftsuspenders/InjectionType.as +16 -0
  66. data/vendor/as3injection/org/swiftsuspenders/Injector.as +376 -0
  67. data/vendor/as3injection/org/swiftsuspenders/InjectorError.as +17 -0
  68. data/vendor/as3injection/org/swiftsuspenders/Reflector.as +95 -0
  69. data/vendor/as3injection/org/swiftsuspenders/getConstructor.as +33 -0
  70. data/vendor/as3injection/org/swiftsuspenders/injectionpoints/ConstructorInjectionPoint.as +94 -0
  71. data/vendor/as3injection/org/swiftsuspenders/injectionpoints/InjectionPoint.as +35 -0
  72. data/vendor/as3injection/org/swiftsuspenders/injectionpoints/MethodInjectionPoint.as +122 -0
  73. data/vendor/as3injection/org/swiftsuspenders/injectionpoints/NoParamsConstructorInjectionPoint.as +24 -0
  74. data/vendor/as3injection/org/swiftsuspenders/injectionpoints/PostConstructInjectionPoint.as +52 -0
  75. data/vendor/as3injection/org/swiftsuspenders/injectionpoints/PropertyInjectionPoint.as +62 -0
  76. data/vendor/as3injection/org/swiftsuspenders/injectionresults/InjectClassResult.as +33 -0
  77. data/vendor/as3injection/org/swiftsuspenders/injectionresults/InjectOtherRuleResult.as +34 -0
  78. data/vendor/as3injection/org/swiftsuspenders/injectionresults/InjectSingletonResult.as +43 -0
  79. data/vendor/as3injection/org/swiftsuspenders/injectionresults/InjectValueResult.as +33 -0
  80. data/vendor/as3injection/org/swiftsuspenders/injectionresults/InjectionResult.as +26 -0
  81. metadata +44 -19
  82. data/bin/AsUnit-4.2.1.pre.swc +0 -0
  83. data/bin/AsUnit-4.2.2.pre.swc +0 -0
  84. data/src/asunit/framework/CallbackBridge.as +0 -175
  85. data/src/asunit/framework/ITestResult.as +0 -21
  86. data/src/asunit/framework/InjectionDelegate.as +0 -96
  87. data/src/asunit/framework/MessageBridge.as +0 -24
  88. data/src/asunit/framework/TestObserver.as +0 -12
  89. data/test/asunit/framework/CallbackBridgeTest.as +0 -73
  90. data/test/asunit/framework/InjectionDelegateTest.as +0 -79
  91. data/test/asunit/support/AnnotatedSubClass.as +0 -18
  92. data/test/asunit/support/AnnotatedSuperClass.as +0 -15
  93. data/test/asunit/support/FakeRunner.as +0 -32
  94. data/test/asunit/support/InjectTimeoutOnAsync.as +0 -14
  95. data/test/asunit/support/TestForFakeRunner.as +0 -14
@@ -0,0 +1,26 @@
1
+ GEM
2
+ remote: http://rubygems.org/
3
+ specs:
4
+ archive-tar-minitar (0.5.2)
5
+ flashsdk (1.0.23.pre)
6
+ sprout (>= 1.1.8.pre)
7
+ mocha (0.9.10)
8
+ rake
9
+ open4 (1.0.1)
10
+ rake (0.8.7)
11
+ rubyzip (0.9.4)
12
+ shoulda (2.11.3)
13
+ sprout (1.1.10.pre)
14
+ archive-tar-minitar (= 0.5.2)
15
+ bundler (>= 0.9.19)
16
+ open4 (>= 0.9.6)
17
+ rake (>= 0.8.7)
18
+ rubyzip (= 0.9.4)
19
+
20
+ PLATFORMS
21
+ ruby
22
+
23
+ DEPENDENCIES
24
+ flashsdk (>= 1.0.2.pre)
25
+ mocha
26
+ shoulda
Binary file
Binary file
Binary file
Binary file
data/build.xml CHANGED
@@ -14,7 +14,13 @@
14
14
  <property name="libs.dir" location="${root.dir}/lib"/>
15
15
  <property name="output.dir" location="${root.dir}/bin"/>
16
16
  <property name="output.swc" location="${output.dir}/asunit.swc"/>
17
-
17
+ <property name="tests.swf" location="${root.dir}/AsUnitCIRunner.swf"/>
18
+ <property name="report.dir" location="${root.dir}/report"/>
19
+
20
+ <taskdef resource="flexUnitTasks.tasks" classpath="${libs.dir}/flexUnitTasks.jar" />
21
+
22
+ <!-- TARGETS -->
23
+
18
24
  <target name="swc" depends="" description="Compile AS3 code into a SWC">
19
25
  <echo>Using Flex SDK at: ${FLEX_HOME}</echo>
20
26
 
@@ -29,7 +35,7 @@
29
35
  <arg value="-include-sources=${src.dir}" />
30
36
 
31
37
  <!-- Link in classes from swc library (only those used). -->
32
- <!--<arg value="-library-path+=${libs.dir}" />-->
38
+ <arg value="-library-path+=${libs.dir}" />
33
39
 
34
40
  <!-- Exclude Flex and AIR framework classes from swc. -->
35
41
  <arg value="-external-library-path+=${FLEX_HOME}/frameworks/libs" />
@@ -42,5 +48,39 @@
42
48
  </java>
43
49
 
44
50
  </target>
51
+
52
+ <target name="ci" depends="swc" description="Run continuous integration">
53
+ <echo>[test] Running Unit Tests</echo>
54
+ <delete dir="${report.dir}" quiet="true"/>
55
+ <mkdir dir="${report.dir}"/>
56
+
57
+ <!-- Compile SWF -->
58
+ <java jar="${FLEX_HOME}/lib/mxmlc.jar" dir="${FLEX_HOME}/frameworks" fork="true" failonerror="true">
59
+ <arg value="${test.dir}/AsUnitCIRunner.as"/>
60
+ <arg value="-incremental=true"/>
61
+ <arg value="-source-path+=${src.dir}"/>
62
+ <arg value="-output=${tests.swf}"/>
63
+ <arg value="-target-player=10"/>
64
+ <arg value="-default-size=1000,800"/>
65
+ <arg value="-default-background-color=0x000000"/>
66
+ <arg value="-static-link-runtime-shared-libraries=true"/>
67
+ <!-- Include classes from SWCs in this folder, but only the ones we use. -->
68
+ <arg value="-library-path+=${libs.dir}"/>
69
+ <arg value="-verbose-stacktraces=true"/>
70
+ <arg value="-headless-server=true"/>
71
+ <arg value="-keep-as3-metadata+=Test,Suite,Before,BeforeClass,After,AfterClass,RunWith,Ignore,Inject"/>
72
+ </java>
73
+
74
+ <!-- Execute TestRunner.swf as FlexUnit tests and publish reports -->
75
+ <flexunit swf="${tests.swf}" toDir="${report.dir}" haltonfailure="false" verbose="true" localTrusted="false" />
76
+
77
+ <!-- Generate readable JUnit-style reports -->
78
+ <junitreport todir="${report.dir}">
79
+ <fileset dir="${report.dir}">
80
+ <include name="TEST-*.xml" />
81
+ </fileset>
82
+ <report format="frames" todir="${report.dir}/html" />
83
+ </junitreport>
84
+ </target>
45
85
 
46
86
  </project>
Binary file
@@ -41,6 +41,7 @@ def configure_test_task(t)
41
41
  t.default_size = '1000,600'
42
42
  t.source_path << 'src'
43
43
  t.library_path << 'lib/Reflection.swc'
44
+ t.library_path << 'lib/SwiftSuspenders-v1.5.1.swc'
44
45
  t.debug = true
45
46
  t.static_link_runtime_shared_libraries = true
46
47
  apply_as3_meta_data_args(t)
@@ -133,10 +134,12 @@ compc "bin/AsUnit-#{AsUnit::VERSION}.swc" do |t|
133
134
  t.include_sources << 'src'
134
135
  t.source_path << 'src'
135
136
  t.library_path << 'lib/Reflection.swc'
137
+ t.library_path << 'lib/SwiftSuspenders-v1.5.1.swc'
136
138
  t.static_link_runtime_shared_libraries = true
137
139
  apply_as3_meta_data_args(t)
138
140
  end
139
141
 
142
+ desc "Build the SWC file for #{AsUnit::VERSION}"
140
143
  task :swc => "bin/AsUnit-#{AsUnit::VERSION}.swc"
141
144
 
142
145
  ##########################################
@@ -171,7 +174,7 @@ task :gem => [:clean, :swc, "bin/asunit4-#{AsUnit::VERSION}.gem"]
171
174
 
172
175
 
173
176
  desc "Create the gem package"
174
- task :package_gem => :swc do
177
+ task :package => :swc do
175
178
  sh "gem build asunit4.gemspec"
176
179
  end
177
180
 
@@ -4,7 +4,7 @@ $:.unshift File.dirname(__FILE__)
4
4
 
5
5
  module AsUnit
6
6
  NAME = 'asunit4'
7
- VERSION = '4.2.2.pre'
7
+ VERSION = '4.2.3.pre'
8
8
  end
9
9
 
10
10
  require 'asunit4/test_class_generator'
@@ -0,0 +1,6 @@
1
+
2
+ package asunit.asserts {
3
+ import asunit.framework.Assert;
4
+
5
+ public const assertMatches:Function = Assert.assertMatches;
6
+ }
@@ -0,0 +1,5 @@
1
+ package asunit.asserts {
2
+ import asunit.framework.Assert;
3
+
4
+ public var assertThrowsWithMessage:Function = Assert.assertThrowsWithMessage;
5
+ }
@@ -1,47 +1,41 @@
1
1
  package asunit.core {
2
-
3
- import asunit.framework.IResult;
4
- import asunit.framework.IRunListener;
5
- import asunit.framework.IRunner;
6
- import asunit.framework.Result;
7
- import asunit.framework.RunnerFactory;
8
- import asunit.framework.TestObserver;
9
- import asunit.runners.LegacyRunner;
10
-
11
- import flash.display.DisplayObjectContainer;
12
- import flash.events.Event;
13
- import flash.events.EventDispatcher;
14
- import flash.events.IEventDispatcher;
15
- import asunit.framework.InjectionDelegate;
16
- import asunit.framework.CallbackBridge;
17
2
 
18
- public class AsUnitCore implements IEventDispatcher {
3
+ import asunit.framework.IResult;
4
+ import asunit.framework.IRunnerFactory;
5
+ import asunit.framework.Result;
6
+ import asunit.framework.IRunner;
7
+ import asunit.framework.RunnerFactory;
8
+ import asunit.framework.IRunListener;
9
+ import asunit.runners.LegacyRunner;
10
+ import org.swiftsuspenders.Injector;
11
+
12
+ import flash.display.DisplayObjectContainer;
13
+ import flash.events.Event;
14
+ import flash.events.EventDispatcher;
15
+
16
+ public class AsUnitCore extends EventDispatcher {
19
17
 
20
- [Inject]
21
- public var bridge:CallbackBridge;
18
+ internal var result:IResult;
22
19
 
23
- protected var bridgeInjector:InjectionDelegate;
24
- protected var dispatcher:IEventDispatcher;
20
+ protected var injector:Injector;
25
21
  protected var legacyRunnerReference:LegacyRunner;
26
- protected var observers:Array;
27
22
  protected var runner:IRunner;
28
23
  protected var _visualContext:DisplayObjectContainer;
29
24
 
30
25
  public function AsUnitCore() {
31
26
  super();
32
- initializeBridgeInjector();
33
- initializeDispatcher();
27
+ initializeInjector();
34
28
  initializeObservers();
35
29
  initialize();
36
30
  }
37
31
 
38
- protected function initializeBridgeInjector():void {
39
- bridgeInjector = new InjectionDelegate();
32
+ protected function initializeInjector():void {
33
+ injector = new Injector();
34
+ injector.mapValue(Injector, injector);
35
+ injector.mapClass(IRunnerFactory, RunnerFactory);
36
+ result = new Result();
37
+ injector.mapValue(IResult, result);
40
38
  }
41
-
42
- protected function initializeDispatcher():void {
43
- dispatcher = new EventDispatcher();
44
- }
45
39
 
46
40
  /**
47
41
  * Template method for subclasses to override,
@@ -60,18 +54,8 @@ package asunit.core {
60
54
  }
61
55
 
62
56
  /**
63
- * Add a new Observer instance to this test run.
64
- *
65
- * The TestObserver interface is simply a marker interface
66
- * that indicates your observer has at least one [Inject]
67
- * variable where a bridge will be injected.
68
- *
69
- * Concrete observers are coupled to concrete runners
70
- * by using [Inject] metadata and Bridges for message passing.
57
+ * Add a listener to this test run.
71
58
  *
72
- * The primary TestRunner, CallbackBridge and TextPrinter
73
- * are good examples of how to build this relationship.
74
- *
75
59
  * To use a different TestRunner on a Suite or Test, simply set:
76
60
  *
77
61
  * [RunWith("fully.qualified.ClassName")]
@@ -85,9 +69,9 @@ package asunit.core {
85
69
  * provided by a couple of concrete runners.
86
70
  *
87
71
  */
88
- public function addObserver(observer:TestObserver):void {
89
- bridgeInjector.updateInjectionPoints(observer, InjectionDelegate.THROW_ERROR_ON_MISSING_INJECTION_POINT);
90
- }
72
+ public function addListener(listener:IRunListener):void {
73
+ result.addListener(listener);
74
+ }
91
75
 
92
76
  /**
93
77
  * Set the visual context that will parent all injected
@@ -119,59 +103,29 @@ package asunit.core {
119
103
  */
120
104
  public function start(testOrSuite:Class, testMethodName:String=null, visualContext:DisplayObjectContainer=null):void {
121
105
 
122
- // Will instantiate a new CallbackBridge:
123
- // and set it on this instance - but share it
124
- // with any Runners or Observers that also
125
- // use the CallbackBridge.
126
- bridgeInjector.updateInjectionPoints(this, InjectionDelegate.THROW_ERROR_ON_MISSING_INJECTION_POINT);
127
- // Must use the accessor, not the _ value:
128
- if(visualContext) this.visualContext = visualContext;
106
+ // Must use the accessor, not the _ value:
107
+ if(visualContext) this.visualContext = visualContext;
129
108
 
130
- var factory:RunnerFactory = new RunnerFactory();
131
- factory.injector = bridgeInjector;
132
- runner = factory.runnerFor(testOrSuite);
133
- runner.addEventListener(Event.COMPLETE, runCompleteHandler);
134
- bridge.onRunStarted();
135
- runner.run(testOrSuite, testMethodName, this.visualContext);
136
- }
109
+ var factory:IRunnerFactory = injector.getInstance(IRunnerFactory);
110
+ runner = factory.runnerFor(testOrSuite);
111
+ runner.addEventListener(Event.COMPLETE, onRunnerComplete);
112
+ result.onRunStarted();
113
+ runner.run(testOrSuite, testMethodName, this.visualContext);
114
+ }
137
115
 
138
- private function runCompleteHandler(event:Event):void {
116
+ protected function onRunnerComplete(event:Event):void {
139
117
  runner.removeEventListener(Event.COMPLETE, onRunCompleted);
140
- bridge.onRunCompleted(bridge);
141
- onRunCompleted();
118
+ result.onRunCompleted(result);
119
+ onRunCompleted();
142
120
  dispatchEvent(event);
143
121
  }
144
-
145
-
146
- /**
147
- * Template method that subclasses can override to perform some
122
+
123
+ /**
124
+ * Subclasses can override to perform some
148
125
  * operation when the run is complete.
149
126
  */
150
127
  protected function onRunCompleted():void {
128
+
151
129
  }
152
-
153
- // BEGIN: Implement the IEvent Dispatcher Interface:
154
-
155
- public function addEventListener(type:String, listener:Function, useCapture:Boolean=false, priority:int=0, useWeakReference:Boolean=false):void {
156
- dispatcher.addEventListener(type, listener, useCapture, priority, useWeakReference);
157
- }
158
-
159
- public function removeEventListener(type:String, listener:Function, useCapture:Boolean=false):void {
160
- dispatcher.removeEventListener(type, listener, useCapture);
161
- }
162
-
163
- public function dispatchEvent(event:Event):Boolean {
164
- return dispatcher.dispatchEvent(event);
165
- }
166
-
167
- public function hasEventListener(type:String):Boolean {
168
- return dispatcher.hasEventListener(type);
169
- }
170
-
171
- public function willTrigger(type:String):Boolean {
172
- return dispatcher.willTrigger(type);
173
- }
174
-
175
- // END: Implement the IEvent Dispatcher Interface:
176
130
  }
177
131
  }
@@ -8,10 +8,10 @@ package asunit.core {
8
8
 
9
9
  override protected function initializeObservers():void {
10
10
  super.initializeObservers();
11
-
12
11
  var projectName:String = 'SomeProject';
13
- addObserver(new FlashBuilderPrinter(projectName));
12
+ addListener(new FlashBuilderPrinter(projectName));
14
13
  }
14
+
15
15
  override protected function onRunCompleted():void {
16
16
  super.onRunCompleted();
17
17
  fscommand('quit'); // fails silently if not in debug player
@@ -8,7 +8,7 @@ package asunit.core {
8
8
 
9
9
  override protected function initializeObservers():void {
10
10
  super.initializeObservers();
11
- addObserver(new FlashDevelopPrinter());
11
+ addListener(new FlashDevelopPrinter());
12
12
  }
13
13
 
14
14
  override protected function onRunCompleted():void {
@@ -0,0 +1,17 @@
1
+ package asunit.core {
2
+
3
+ import asunit.printers.FlexUnitCIPrinter;
4
+
5
+ public class FlexUnitCICore extends TextCore {
6
+
7
+ override protected function initializeObservers():void {
8
+ super.initializeObservers();
9
+ addListener(new FlexUnitCIPrinter());
10
+ }
11
+
12
+ override protected function onRunCompleted():void {
13
+ super.onRunCompleted();
14
+ // The FlexUnitCIPrinter will close Flash Player when the socket acknowledges the end.
15
+ }
16
+ }
17
+ }
@@ -1,54 +1,36 @@
1
- package asunit.core {
2
-
3
- import asunit.printers.TextPrinter;
4
-
5
- import flash.display.DisplayObjectContainer;
6
-
7
- /**
8
- * TextCore is just a simple helper class that
9
- * configures the base class AsUnitCore to use the
10
- * standard TextPrinter.
11
- *
12
- * The main idea is that you may want a completely
13
- * different text output without the default TextPrinter,
14
- * and if that's the case, you can go ahead and
15
- * instantiate AsUnitCore and configure it however you
16
- * wish.
17
- */
18
- public class TextCore extends AsUnitCore {
19
-
20
- private var textPrinter:TextPrinter;
21
-
22
- override protected function initializeObservers():void {
23
- super.initializeObservers();
24
-
25
- textPrinter = new TextPrinter();
26
- addObserver(textPrinter);
27
- }
28
-
29
- /* Delegate some configuration to the TextPrinter */
30
- public function set displayPerformanceDetails(show:Boolean):void {
31
- textPrinter.displayPerformanceDetails = show;
32
- }
33
-
34
- public function get displayPerformanceDetails():Boolean {
35
- return textPrinter.displayPerformanceDetails;
36
- }
37
-
38
- public function set traceOnComplete(should:Boolean):void {
39
- textPrinter.traceOnComplete = should;
40
- }
41
-
42
- public function get traceOnComplete():Boolean {
43
- return textPrinter.traceOnComplete;
44
- }
45
-
46
-
47
- override public function set visualContext(context:DisplayObjectContainer):void {
48
- super.visualContext = context;
49
- // Add the TextPrinter to the Display List:
50
- visualContext.addChild(textPrinter);
51
- }
52
- }
53
- }
54
-
1
+ package asunit.core {
2
+
3
+ import asunit.printers.TextPrinter;
4
+
5
+ import flash.display.DisplayObjectContainer;
6
+
7
+ /**
8
+ * TextCore is just a simple helper class that
9
+ * configures the base class AsUnitCore to use the
10
+ * standard TextPrinter.
11
+ *
12
+ * The main idea is that you may want a completely
13
+ * different text output without the default TextPrinter,
14
+ * and if that's the case, you can go ahead and
15
+ * instantiate AsUnitCore and configure it however you
16
+ * wish.
17
+ */
18
+ public class TextCore extends AsUnitCore {
19
+
20
+ public var textPrinter:TextPrinter;
21
+
22
+ override protected function initializeObservers():void {
23
+ super.initializeObservers();
24
+
25
+ textPrinter = new TextPrinter();
26
+ addListener(textPrinter);
27
+ }
28
+
29
+ override public function set visualContext(context:DisplayObjectContainer):void {
30
+ super.visualContext = context;
31
+ // Add the TextPrinter to the Display List:
32
+ visualContext.addChild(textPrinter);
33
+ }
34
+ }
35
+ }
36
+