10三/10
Robotlegs 的 LazyMediator 扩展
Read in English: Robotlegs Utility LazyMediator
为了游戏中有更好的性能为 Robotlegs 写了一个 LazyMediator 扩展。
如何使用
- 在 context 里 override mediatorMap 的 getter 方法:
return _mediatorMap || (_mediatorMap = new LazyMediatorMap(contextView, injector));
- 在 view 类的构造函数里增加:
new LazyMediatorActivator(this);
作用
- LazyMediatorMap 不监听显示列表里所有的 ADDED_TO_STAGE 事件而检测所有被添加到显示列表的显示对象。
如何工作
- 当 view 被添加到 stage 或从 stage 移除时 LazyMediatorActivator 广播 LazyMediatorEvent。
- LazyMediatorMap 监听 context 的 LazyMediatorEvent 然后检查对应的 view。
6一/10
as3-signals 的 FlexUnit4 扩展
Read in English: FlexUnit 4 Utility of as3-signals
为 as3-signals 写了一个 FlexUnit 4 的扩展。
例子:
Async.proceedOnEvent(this, new SignalAsync(instance.someSignal), SignalAsyncEvent.CALLED); instance.doSomeThingShouldDispatchSomeSignal(); |
30十二/09
Built in unit test support in Flash Builder and more I expected
Now we have FlexUnit1 and FlexUnit4 support built in Flash Builder beta 2:
- Create a test suite class
- Create a test case class
- Create a test case class of an exist class and choose which methods to test.
- Right click a test case class and run it.
- Right click a test suite class and run it.
- Choose any set of test suites and test cases (test methods) to run.
- See test results in FlexUnit Results View
To see more detail Click Here.
They are good for unit test, but not for TDD (write test before code).
I wish to see some more:
- Set the source folder for real code and tests folder for test classes.
- Create a test case class in the tests folder, and choose if create the class to be tested in the source folder.
- Create and update test suite classes automatically in every package in the tests folder.
27十二/09
使用 FlexUnit 和 Robotlegs 尝试 TDD
Get the Flash Player to see this content.
尝试使用TDD的小例子(视频)。
Download (Right-click and “save as”) | 下载(右键另存为)
