PageRenderTime 58ms CodeModel.GetById 28ms RepoModel.GetById 0ms app.codeStats 0ms

/test/unit/tests/org/asaplibrary/util/actionqueue/ActionQueueTestCase.as

http://asaplibrary.googlecode.com/
ActionScript | 621 lines | 464 code | 121 blank | 36 comment | 20 complexity | a0012dabf0911489d6829bf9e2b59bf4 MD5 | raw file
  1. package org.asaplibrary.util.actionqueue {
  2. import flash.events.Event;
  3. import flash.display.Sprite;
  4. import flash.display.Shape;
  5. import flash.display.Graphics;
  6. import asunit.framework.TestCase;
  7. import AsUnitTestRunner;
  8. import org.asaplibrary.util.actionqueue.*;
  9. import org.asaplibrary.util.FrameDelay;
  10. import org.asaplibrary.util.debug.Log;
  11. /**
  12. @todo Markers
  13. */
  14. public class ActionQueueTestCase extends TestCase {
  15. private static var sAddActionCalled:int = 0;
  16. private static const EXPECTED_ADD_ACTION_CALLED_COUNT:int = 2;
  17. private static var sAddActionParams:String = "";
  18. private static const EXPECTED_ADD_ACTIONS_PARAMS:String = "A";
  19. private static var sTestInsertQueueParams:String = "";
  20. private static const EXPECTED_INSERT_QUEUE_PARAMS:String = "ABECD";
  21. private static var sTestaddActionCount:Number = 0;
  22. private static const EXPECTED_ADD_METHOD_COUNT = 4;
  23. private static var sTestInsertQueueActionsString:String = "";
  24. private static const EXPECTED_INSERT_QUEUE_ACTIONS:String = "ABCDE";
  25. private static var sTestSkipValue:int = 0;
  26. private static const EXPECTED_SKIP_VALUE:int = 1;
  27. private static var sResetQueueValue:Number = 0;
  28. private static const EXPECTED_RESET_QUEUE_VALUE:Number = 1;
  29. private static var sAfterPauseValue:Number = 0;
  30. private static const EXPECTED_AFTER_PAUSE_VALUE:Number = 1;
  31. private static var SHAPE_PROPERTY_HEIGHT:Shape;
  32. private static const EXPECTED_PROPERTY_HEIGHT:Number = 98;
  33. private static var SHAPE_PROPERTY_Y:Shape;
  34. private static const EXPECTED_PROPERTY_Y:Number = 401;
  35. private static var sEventSTARTEDCalled:uint = 0;
  36. private static const EXPECTED_EVENT_STARTED_CALLED:uint = 1;
  37. private static var sEventFINISHEDCalled:uint = 0;
  38. private static const EXPECTED_EVENT_FINISHED_CALLED:uint = 2;
  39. private static var sEventQUITCalled:uint = 0;
  40. private static const EXPECTED_EVENT_QUIT_CALLED:uint = 1;
  41. private static var sEventPAUSEDCalled:uint = 0;
  42. private static const EXPECTED_EVENT_PAUSED_CALLED:uint = 1;
  43. private static var sEventRESUMEDCalled:uint = 0;
  44. private static const EXPECTED_EVENT_RESUMED_CALLED:uint = 1;
  45. private static var sEventSTOPPEDCalled:uint = 0;
  46. private static const EXPECTED_EVENT_STOPPED_CALLED:uint = 1;
  47. private static var sOrderedEventList:String = "";
  48. private static const EXPECTED_ORDERED_EVENT_LIST:String = "onActionStartedonActionFinished";
  49. // Not tested yet
  50. private static var sEventMARKER_PASSEDCalled:uint = 0;
  51. private static const EXPECTED_EVENT_MARKER_PASSED_CALLED:uint = 0;
  52. private static var sLoopCalled:Number = 0;
  53. private static const EXPECTED_LOOP_CALLED:Number = 3;
  54. private static const TEST_DELAY:Number = 31;
  55. private static const CURRENT:Number = Number.NaN;
  56. private var mInstance:ActionQueueTestCase = this as ActionQueueTestCase;
  57. private var mCanvas : Sprite;
  58. public function ActionQueueTestCase (inCanvas:Sprite) {
  59. super();
  60. mCanvas = inCanvas;
  61. }
  62. /**
  63. List tests that should be run first - before any function starting with 'test'.
  64. */
  65. public override function run() : void {
  66. doTestAddAction();
  67. doTestAddActionBeforeAndAfter();
  68. doTestReset();
  69. //doTestQuit();
  70. doTestIsFinished();
  71. doTestPauseAndContinue();
  72. doTestTogglePlay();
  73. doTestAddPause();
  74. doTestSkip();
  75. doTestFade();
  76. doTestMove();
  77. doTestScale();
  78. doTestAddAsynchronousAction();
  79. doTestSet();
  80. doTestAddMove();
  81. doTestFollowMouse();
  82. doTestBlink();
  83. doTestPulse();
  84. doTestProperty();
  85. doTestEvents();
  86. doTestEventsOrder();
  87. doTestLoops();
  88. new FrameDelay(startTests, TEST_DELAY);
  89. }
  90. /**
  91. Now call each public function starting with 'test'.
  92. */
  93. public function startTests () : void {
  94. super.run();
  95. }
  96. public function testEvaluateResult () : void {
  97. assertTrue("ActionQueueTestCase sAddActionCalled", sAddActionCalled == EXPECTED_ADD_ACTION_CALLED_COUNT);
  98. assertTrue("ActionQueueTestCase sAddActionParams", sAddActionParams == EXPECTED_ADD_ACTIONS_PARAMS);
  99. assertTrue("ActionQueueTestCase sTestaddActionCount", sTestaddActionCount == EXPECTED_ADD_METHOD_COUNT);
  100. assertTrue("ActionQueueTestCase sResetQueueValue", sResetQueueValue == EXPECTED_RESET_QUEUE_VALUE);
  101. assertTrue("ActionQueueTestCase sTestSkipValue", sTestSkipValue == EXPECTED_SKIP_VALUE);
  102. // Events
  103. assertTrue("ActionRunner EXPECTED_EVENT_STARTED_CALLED", (sEventSTARTEDCalled == EXPECTED_EVENT_STARTED_CALLED));
  104. assertTrue("ActionRunner EXPECTED_EVENT_FINISHED_CALLED", (sEventFINISHEDCalled == EXPECTED_EVENT_FINISHED_CALLED));
  105. assertTrue("ActionRunner EXPECTED_EVENT_QUIT_CALLED", (sEventQUITCalled == EXPECTED_EVENT_QUIT_CALLED));
  106. assertTrue("ActionRunner EXPECTED_EVENT_PAUSED_CALLED", (sEventPAUSEDCalled == EXPECTED_EVENT_PAUSED_CALLED));
  107. assertTrue("ActionRunner EXPECTED_EVENT_RESUMED_CALLED", (sEventRESUMEDCalled == EXPECTED_EVENT_RESUMED_CALLED));
  108. assertTrue("ActionRunner EXPECTED_EVENT_STOPPED_CALLED", (sEventSTOPPEDCalled == EXPECTED_EVENT_STOPPED_CALLED));
  109. assertTrue("ActionRunner EXPECTED_EVENT_MARKER_PASSED_CALLED", (sEventMARKER_PASSEDCalled == EXPECTED_EVENT_MARKER_PASSED_CALLED));
  110. assertTrue("ActionRunner EXPECTED_EVENT_MARKER_PASSED_CALLED", (sLoopCalled == EXPECTED_LOOP_CALLED));
  111. assertTrue("ActionRunner EXPECTED_ORDERED_EVENT_LIST", (sOrderedEventList == EXPECTED_ORDERED_EVENT_LIST));
  112. evaluatePropertyHeight();
  113. evaluatePropertyY();
  114. }
  115. private function doTestAddAction () : void {
  116. var queueAddAction:ActionQueue = new ActionQueue("ActionQueueTestCase addAction");
  117. queueAddAction.addAction( performAddAction, "A" );
  118. var action:Action = new Action(performAddAction);
  119. queueAddAction.addAction(action);
  120. queueAddAction.run();
  121. }
  122. private function performAddAction (inValue:String = "") : void {
  123. sAddActionParams += inValue;
  124. sAddActionCalled++;
  125. }
  126. private function doTestAddActionBeforeAndAfter () : void {
  127. var queue:ActionQueue = new ActionQueue("ActionQueueTestCase addActionBeforeAndAfter");
  128. queue.addAction( performTestaddAction2 ); // increment by to 1
  129. queue.addAction( mInstance, "performTestaddAction2" ); // increment to 2
  130. queue.addAction( mInstance, "performTestaddAction2" ); // increment to 3
  131. queue.run();
  132. queue.addAction( mInstance, "performTestaddAction2" );
  133. queue.run();
  134. }
  135. public function performTestaddAction2 () : void {
  136. sTestaddActionCount++;
  137. }
  138. private function doTestReset () : void {
  139. var queue:ActionQueue = new ActionQueue("reset queue");
  140. queue.addAction( this, "funcResetValue" );
  141. queue.reset();
  142. queue.addAction( this, "funcResetValue" );
  143. queue.run();
  144. }
  145. public function funcResetValue () : void {
  146. sResetQueueValue++;
  147. }
  148. public function dummyFunc () : void {
  149. //
  150. }
  151. private function doTestQuit () : void {
  152. var queue:ActionQueue = new ActionQueue("quit queue");
  153. queue.addAction( this, "dummyFunc" );
  154. queue.quit();
  155. }
  156. private function doTestIsFinished () : void {
  157. var queue:ActionQueue = new ActionQueue("finished queue");
  158. queue.addAction( this, "dummyFunc" );
  159. queue.run();
  160. assertTrue("ActionQueueTestCase doTestIsFinished", queue.isFinished());
  161. }
  162. private function doTestPauseAndContinue () : void {
  163. var pauseQueue = new ActionQueue("test pause and continue");
  164. pauseQueue.pause();
  165. assertTrue("ActionQueueTestCase test pause and continue is paused", pauseQueue.isPaused());
  166. pauseQueue.run();
  167. assertTrue("ActionQueueTestCase test pause and continue is paused 2", pauseQueue.isPaused());
  168. pauseQueue.resume();
  169. assertFalse("ActionQueueTestCase test pause and continue is paused 3", pauseQueue.isPaused());
  170. }
  171. private function doTestTogglePlay () : void {
  172. var queue = new ActionQueue("toggle play");
  173. queue.pause();
  174. assertTrue("ActionQueueTestCase toggle play 1", queue.isPaused());
  175. queue.togglePlay();
  176. assertFalse("ActionQueueTestCase toggle play 2", queue.isPaused());
  177. queue.togglePlay();
  178. assertTrue("ActionQueueTestCase toggle play 1", queue.isPaused());
  179. }
  180. private function doTestAddPause () : void {
  181. var queue = new ActionQueue("addPause");
  182. queue.addPause(0.1);
  183. queue.addAction(doAfterPause);
  184. queue.addPause(); // pause queue
  185. queue.addAction(doAfterPause); // should not get called
  186. queue.run();
  187. new FrameDelay(evaluateAfterPause, TEST_DELAY);
  188. }
  189. private function doAfterPause () : void {
  190. sAfterPauseValue++;
  191. }
  192. private function evaluateAfterPause () : void {
  193. assertTrue("ActionQueueTestCase after addPause", sAfterPauseValue == EXPECTED_AFTER_PAUSE_VALUE);
  194. }
  195. private function doTestSkip () : void {
  196. var skipQueue = new ActionQueue("skip");
  197. skipQueue.addAction( addToSkip );
  198. skipQueue.addAction( addToSkip );
  199. skipQueue.skip();
  200. skipQueue.run();
  201. }
  202. public function addToSkip () : void {
  203. sTestSkipValue++;
  204. }
  205. public function doTestFade () : void {
  206. var shape:Shape = createRectShape(0xff0000, 50, 50);
  207. var queue:ActionQueue = new ActionQueue("fade");
  208. queue.addAction( new AQFade().fade(shape, .3, CURRENT, 0 ));
  209. queue.run();
  210. new FrameDelay(evaluateShapeProperty, TEST_DELAY, [shape, 'alpha', 0]);
  211. }
  212. public function doTestMove () : void {
  213. var shape:Shape = createRectShape(0xff00ff, 100, 50);
  214. var queue:ActionQueue = new ActionQueue("move");
  215. queue.addAction( new AQMove().move(shape, .3, CURRENT, CURRENT, CURRENT, 100 ));
  216. queue.run();
  217. new FrameDelay(evaluateShapeProperty, TEST_DELAY, [shape, 'x', 100]);
  218. new FrameDelay(evaluateShapeProperty, TEST_DELAY, [shape, 'y', 100]);
  219. }
  220. public function doTestScale () : void {
  221. var shape:Shape = createRectShape(0xff00ff, 250, 50);
  222. var queue:ActionQueue = new ActionQueue("scale");
  223. queue.addAction( new AQScale().scale(shape, .3, CURRENT, CURRENT, 2.5, 2.5 ));
  224. queue.run();
  225. new FrameDelay(evaluateShapeProperty, TEST_DELAY, [shape, 'scaleX', 2.5]);
  226. }
  227. public function doTestAddAsynchronousAction () : void {
  228. var shape:Shape = createRectShape(0xff00ff, 350, 50);
  229. var queue:ActionQueue = new ActionQueue("scale");
  230. queue.addAsynchronousAction( new AQFade().fade(shape, .3, CURRENT, .5 ));
  231. queue.addAction( new AQScale().scale(shape, .3, CURRENT, CURRENT, 2.5, 2.5 ));
  232. queue.run();
  233. new FrameDelay(evaluateShapeProperty, TEST_DELAY, [shape, 'scaleX', 2.5]);
  234. new FrameDelay(evaluateShapeProperty, TEST_DELAY, [shape, 'alpha', .5]);
  235. }
  236. public function doTestSet () : void {
  237. doTestSetLoc();
  238. doTestSetVisible();
  239. doTestSetAlpha();
  240. doTestSetScale();
  241. doTestSetToMouse();
  242. doTestSetCenterOnStage();
  243. }
  244. private function doTestSetLoc() : void {
  245. var shape:Shape = createRectShape(randomColor(), 400, 10);
  246. var queue:ActionQueue = new ActionQueue("doTestSetLoc");
  247. queue.addAction(new AQSet().setLoc(shape, CURRENT, 20));
  248. queue.run();
  249. new FrameDelay(evaluateShapeProperty, TEST_DELAY, [shape, 'x', 400]);
  250. new FrameDelay(evaluateShapeProperty, TEST_DELAY, [shape, 'y', 20]);
  251. }
  252. private function doTestSetVisible() : void {
  253. var shape:Shape = createRectShape(randomColor(), 400, 40);
  254. var queue:ActionQueue = new ActionQueue("doTestSetVisible");
  255. queue.addAction(new AQSet().setVisible(shape, false));
  256. queue.run();
  257. new FrameDelay(evaluateShapeProperty, TEST_DELAY, [shape, 'visible', false]);
  258. }
  259. private function randomColor () : int {
  260. return 30000 + Math.floor(Math.random() * 30000);
  261. }
  262. private function doTestSetAlpha() : void {
  263. var shape:Shape = createRectShape(randomColor(), 400, 80);
  264. var queue:ActionQueue = new ActionQueue("doTestSetAlpha");
  265. queue.addAction(new AQSet().setAlpha(shape, 0));
  266. queue.run();
  267. new FrameDelay(evaluateShapeProperty, TEST_DELAY, [shape, 'alpha', 0]);
  268. }
  269. private function doTestSetScale() : void {
  270. doTestSetScaleX();
  271. doTestSetScaleY();
  272. }
  273. private function doTestSetScaleX() : void {
  274. var shape:Shape = createRectShape(randomColor(), 400, 120);
  275. var queue:ActionQueue = new ActionQueue("doTestSetScaleX");
  276. queue.addAction(new AQSet().setScale(shape, .5, CURRENT));
  277. queue.run();
  278. new FrameDelay(evaluateShapeProperty, TEST_DELAY, [shape, 'scaleX', .5]);
  279. }
  280. private function doTestSetScaleY() : void {
  281. var shape:Shape = createRectShape(randomColor(), 400, 140);
  282. var queue:ActionQueue = new ActionQueue("doTestSetScaleY");
  283. queue.addAction(new AQSet().setScale(shape, CURRENT, .5));
  284. queue.run();
  285. new FrameDelay(evaluateShapeProperty, TEST_DELAY, [shape, 'scaleY', .5]);
  286. }
  287. private function doTestSetToMouse() : void {
  288. var shape:Shape = createRectShape(randomColor(), 400, 180);
  289. var queue:ActionQueue = new ActionQueue("doTestSetToMouse");
  290. queue.addAction(new AQSet().setToMouse(shape));
  291. queue.run();
  292. var mouseX:Number = mCanvas.mouseX;
  293. var mouseY:Number = mCanvas.mouseY;
  294. new FrameDelay(evaluateShapeProperty, TEST_DELAY, [shape, 'x', mouseX]);
  295. new FrameDelay(evaluateShapeProperty, TEST_DELAY, [shape, 'y', mouseY]);
  296. }
  297. private function doTestSetCenterOnStage() : void {
  298. var shape:Shape = createRectShape(randomColor(), 400, 180);
  299. var queue:ActionQueue = new ActionQueue("doTestSetCenterOnStage");
  300. queue.addAction(new AQSet().centerOnStage(shape, 50, 0));
  301. queue.run();
  302. var centerX:Number = mCanvas.stage.stageWidth/2 + 50;
  303. var centerY:Number = mCanvas.stage.stageHeight/2;
  304. new FrameDelay(evaluateShapeProperty, TEST_DELAY, [shape, 'x', centerX]);
  305. new FrameDelay(evaluateShapeProperty, TEST_DELAY, [shape, 'y', centerY]);
  306. }
  307. /**
  308. Visual tests
  309. */
  310. private function doTestBlink() : void {
  311. doTestBlinkCount();
  312. doTestBlinkDuration();
  313. doTestMaskBlink();
  314. }
  315. /**
  316. Visual test
  317. */
  318. private function doTestBlinkCount() : void {
  319. var shape:Shape = createRectShape(0xffffff, 50, 200);
  320. shape.alpha = 0;
  321. var queue:ActionQueue = new ActionQueue("doTestBlinkCount");
  322. queue.addAction(new AQBlink().blink(shape, 4, 1, 1, .1, .1));
  323. queue.run();
  324. }
  325. /**
  326. Visual test
  327. */
  328. private function doTestBlinkDuration() : void {
  329. var shape:Shape = createRectShape(0xffffff, 50, 220);
  330. shape.alpha = 0;
  331. var queue:ActionQueue = new ActionQueue("doTestBlinkDuration");
  332. queue.addAction(new AQBlink().blink(shape, 4, 2, 1, .1, .1, 2));
  333. queue.run();
  334. }
  335. /**
  336. Visual test
  337. */
  338. private function doTestMaskBlink () : void {
  339. var shape:Shape = createRectShape(0xffffff, 50, 240);
  340. var queue:ActionQueue = new ActionQueue("blink");
  341. queue.addAction( new AQBlink().maskBlink(shape, 4, 1, true, 2 ));
  342. queue.run();
  343. }
  344. private function doTestAddMove () : void {
  345. var shape:Shape = createRectShape(0xff9900, 150, 50);
  346. var queue:ActionQueue = new ActionQueue("addmove");
  347. queue.addAction( new AQAddMove().addMove(shape, .3, -10, 50 ));
  348. queue.run();
  349. new FrameDelay(evaluateTestAddMove, TEST_DELAY, [shape, 100]);
  350. }
  351. private function evaluateTestAddMove (s:Shape, value:Number) : void {
  352. // because of rounding errors we cannot measure y to the floating point, so we use a round
  353. assertTrue("ActionQueueTestCase evaluateTestAddMove", Math.round(s.y) == Math.round(value));
  354. }
  355. /**
  356. Visual tests
  357. */
  358. private function doTestFollowMouse () : void {
  359. doTestFollowMouseDraw();
  360. doTestFollowMouseBallBack();
  361. }
  362. /**
  363. Visual test
  364. */
  365. private function doTestFollowMouseDraw () : void {
  366. var shape:Shape = createRectShape(randomColor(), 200, 200);
  367. var queue:ActionQueue = new ActionQueue("followmouse");
  368. queue.addAction( new AQFollowMouse().followMouse(shape, 0, 0.15 ));
  369. queue.run();
  370. }
  371. /**
  372. Visual test
  373. */
  374. private function doTestFollowMouseBallBack () : void {
  375. var shape:Shape = createRectShape(randomColor(), 200, 200);
  376. var queue:ActionQueue = new ActionQueue("doTestFollowMouseBallBack");
  377. var NULL:Number = Number.NaN;
  378. queue.addAction( new AQFollowMouse().followMouse(shape, 0, .15, NULL, 25, 0, followMouseCallBackFunc ));
  379. queue.run();
  380. }
  381. private function followMouseCallBackFunc (inShape:Shape, inX:Number, inY:Number) : void {
  382. inShape.x = inX;
  383. inShape.y = inY;
  384. }
  385. public function doTestPulse () : void {
  386. doTestPulseFade();
  387. doTestPulseScale();
  388. }
  389. private function doTestPulseFade () : void {
  390. var shape:Shape = createRectShape(randomColor(), 350, 320);
  391. shape.alpha = 0;
  392. var queue:ActionQueue = new ActionQueue("pulse fade");
  393. queue.addAction( new AQPulse().fade(shape, 6, 0.6, 1, .2, 1) );
  394. queue.run();
  395. }
  396. private function doTestPulseScale () : void {
  397. var shape:Shape = createRectShape(0x0066ff, 350, 340);
  398. var queue:ActionQueue = new ActionQueue("pulse scale");
  399. queue.addAction( new AQPulse().scale(shape, 6, 0.6, 1, .2, 1) );
  400. queue.run();
  401. }
  402. public function doTestProperty () : void {
  403. doTestPropertyHeight();
  404. doTestPropertyY();
  405. }
  406. private function doTestPropertyHeight () : void {
  407. SHAPE_PROPERTY_HEIGHT = createRectShape(randomColor(), 450, 320);
  408. var queue:ActionQueue = new ActionQueue("property height");
  409. queue.addAction( new AQProperty().change(SHAPE_PROPERTY_HEIGHT, "height", .6, NaN, EXPECTED_PROPERTY_HEIGHT) );
  410. queue.run();
  411. }
  412. private function evaluatePropertyHeight () : void {
  413. assertTrue("ActionRunner EXPECTED_PROPERTY_HEIGHT", (SHAPE_PROPERTY_HEIGHT["height"] == EXPECTED_PROPERTY_HEIGHT));
  414. }
  415. private function doTestPropertyY () : void {
  416. SHAPE_PROPERTY_Y = createRectShape(randomColor(), 475, 320);
  417. var queue:ActionQueue = new ActionQueue("property y");
  418. queue.addAction( new AQProperty().change(SHAPE_PROPERTY_Y, "y", .6, NaN, EXPECTED_PROPERTY_Y) );
  419. queue.run();
  420. }
  421. private function evaluatePropertyY () : void {
  422. assertTrue("ActionRunner EXPECTED_PROPERTY_Y", (SHAPE_PROPERTY_Y["y"] == EXPECTED_PROPERTY_Y));
  423. }
  424. private function doTestEvents () : void {
  425. var queue:ActionQueue = new ActionQueue();
  426. queue.addAction(new Action(dummyFunc));
  427. queue.addEventListener(ActionEvent._EVENT, onActionEvent);
  428. queue.run();
  429. queue.pause();
  430. queue.resume();
  431. queue.stop();
  432. queue.quit();
  433. }
  434. private function doTestEventsOrder () : void {
  435. var queue:ActionQueue = new ActionQueue();
  436. queue.addAction(new Action(dummyFunc));
  437. queue.addEventListener(ActionEvent._EVENT, onActionEventOrder);
  438. queue.run();
  439. }
  440. private function doTestLoops () : void {
  441. var queue:ActionQueue = new ActionQueue();
  442. queue.addStartLoop("LOOP", 3);
  443. queue.addAction(loopCalled);
  444. queue.addEndLoop("LOOP");
  445. queue.run();
  446. }
  447. private function loopCalled () : void {
  448. sLoopCalled++;
  449. }
  450. private function onActionEvent (e:ActionEvent) : void {
  451. switch (e.subtype) {
  452. case ActionEvent.STARTED:
  453. sEventSTARTEDCalled++;
  454. break;
  455. case ActionEvent.FINISHED:
  456. sEventFINISHEDCalled++;
  457. break;
  458. case ActionEvent.QUIT:
  459. sEventQUITCalled++;
  460. break;
  461. case ActionEvent.PAUSED:
  462. sEventPAUSEDCalled++;
  463. break;
  464. case ActionEvent.RESUMED:
  465. sEventRESUMEDCalled++;
  466. break;
  467. case ActionEvent.STOPPED:
  468. sEventSTOPPEDCalled++;
  469. break;
  470. case ActionEvent.MARKER_VISITED:
  471. sEventMARKER_PASSEDCalled++;
  472. break;
  473. }
  474. }
  475. private function onActionEventOrder (e:ActionEvent) : void {
  476. sOrderedEventList += e.subtype;
  477. }
  478. private function createRectShape (inColor:int, inX:int, inY:int) : Shape {
  479. var s:Shape = new Shape();
  480. mCanvas.addChild(s);
  481. drawColoredRectIn(s.graphics, inColor);
  482. s.x = inX;
  483. s.y = inY;
  484. return s;
  485. }
  486. private function evaluateShapeProperty (s:Shape, type:String, value:Number) : void {
  487. // trace("evaluateShapeProperty: " + type + " should be:" + value + " is:" + s[type]);
  488. assertTrue("ActionQueueTestCase evaluateShapeProperty " + type, s[type] == value);
  489. }
  490. private function drawColoredRectIn(target:Graphics, color:int):void {
  491. target.lineStyle(0, color, 0);
  492. target.beginFill(color);
  493. var size:Number = 20;
  494. target.drawRect(-size/2, -size/2, size, size);
  495. }
  496. public override function toString () : String {
  497. return ";org.asaplibrary.util.actionqueue.ActionQueueTestCase";
  498. }
  499. }
  500. }