-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
RulesEngine: extract method showWinMessage();
create TestCase CardTest; remove MainSuite; change some timing logic of Card;
- Loading branch information
Showing
9 changed files
with
144 additions
and
48 deletions.
There are no files selected for viewing
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 |
---|---|---|
@@ -1,7 +1,10 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<testrun name="" > | ||
<testsuite name="Default Test Suite" project="Mahjong"> | ||
<testsuite name="tests:MainSuite" type="testcaseclass"/> | ||
<testsuite name="tests:CardTest" type="testsuiteclass"/> | ||
<testsuite name="tests:CardsGeneratorTest" type="testsuiteclass"/> | ||
<testsuite name="tests:CardsImagesLoaderTest" type="testsuiteclass"/> | ||
<testsuite name="tests:SimpleCardsPlacerTest" type="testsuiteclass"/> | ||
</testsuite> | ||
<portNumber value="8765" /> | ||
</testrun> |
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,10 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<testrun name="" > | ||
<testsuite name="Default Test Suite" project="Mahjong"> | ||
<testsuite name="tests:CardsGeneratorTest" type="testcaseclass"/> | ||
<testsuite name="tests:CardsImagesLoaderTest" type="testcaseclass"/> | ||
<testsuite name="tests:CardTest" type="testcaseclass"/> | ||
<testsuite name="tests:SimpleCardsPlacerTest" type="testcaseclass"/> | ||
</testsuite> | ||
<portNumber value="8765" /> | ||
</testrun> |
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
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
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 |
---|---|---|
@@ -1,23 +1,23 @@ | ||
/** | ||
*This file is automatically generated by Flash Builder to compile FlexUnit classes and is not intended for modification. | ||
*Please click on the "Refresh" icon in "FlexUnit Results" view to regenerate this file. | ||
*/ | ||
*This file is automatically generated by Flash Builder to compile FlexUnit classes and is not intended for modification. | ||
*Please click on the "Refresh" icon in "FlexUnit Results" view to regenerate this file. | ||
*/ | ||
|
||
package | ||
{ | ||
import flash.display.Sprite; | ||
|
||
import tests.MainSuite; | ||
import tests.CardsImagesLoaderTest; | ||
import tests.CardTest; | ||
import tests.CardsGeneratorTest; | ||
import tests.CardsImagesLoaderTest; | ||
import tests.SimpleCardsPlacerTest; | ||
|
||
public class FlexUnitCompilerApplication extends Sprite | ||
{ | ||
|
||
private var tests_SimpleCardsPlacerTest_obj:tests.SimpleCardsPlacerTest; | ||
private var tests_CardGeneratorTest_obj:tests.CardsGeneratorTest; | ||
private var tests_CardTest_obj:tests.CardTest; | ||
private var tests_CardsImagesLoaderTest_obj:tests.CardsImagesLoaderTest; | ||
|
||
private var tests_MainSuite_obj:tests.MainSuite; | ||
private var tests_CardsGeneratorTest_obj:tests.CardsGeneratorTest; | ||
} | ||
} |
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
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
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,87 @@ | ||
package tests | ||
{ | ||
import engines.Card; | ||
import engines.events.CardEvent; | ||
|
||
import flash.display.Bitmap; | ||
import flash.display.BitmapData; | ||
import flash.events.Event; | ||
|
||
import flexunit.framework.Assert; | ||
|
||
import org.flexunit.async.Async; | ||
|
||
public class CardTest | ||
{ | ||
|
||
[Before] | ||
public function setUp():void | ||
{ | ||
} | ||
|
||
[After] | ||
public function tearDown():void | ||
{ | ||
} | ||
|
||
[BeforeClass] | ||
public static function setUpBeforeClass():void | ||
{ | ||
} | ||
|
||
[AfterClass] | ||
public static function tearDownAfterClass():void | ||
{ | ||
} | ||
|
||
[Test] | ||
public function testCard():void | ||
{ | ||
var back:BitmapData = new BitmapData(1, 1); | ||
var card:Card = new Card(new BitmapData(1, 1), back); | ||
var cardImage:Bitmap = Bitmap(card.getChildAt(0)); | ||
Assert.assertEquals("Card is not closed!", cardImage.bitmapData, back); | ||
} | ||
|
||
[Test(async)] | ||
public function testClose():void | ||
{ | ||
var back:BitmapData = new BitmapData(1, 1); | ||
var card:Card = new Card(new BitmapData(1, 1), back); | ||
card.addEventListener(CardEvent.CARD_CLOSE, Async.asyncHandler(this, onCardClose, 100, back, onCardEventTimeout)); | ||
card.open(); | ||
card.close(); | ||
} | ||
|
||
[Test] | ||
public function testDestroy():void | ||
{ | ||
Assert.fail("Test method Not yet implemented"); | ||
} | ||
|
||
[Test(async)] | ||
public function testOpen():void | ||
{ | ||
var card:Card = new Card(new BitmapData(1, 1), new BitmapData(1, 1)); | ||
card.addEventListener(CardEvent.CARD_OPEN, Async.asyncHandler(this, onCardOpen, 100, null, onCardEventTimeout)); | ||
card.open(); | ||
} | ||
|
||
private function onCardOpen(event:CardEvent, passThroughData:Object):void | ||
{ | ||
var cardImage:Bitmap = Bitmap(Card(event.target).getChildAt(0)); | ||
Assert.assertEquals("Card is not opened!", cardImage.bitmapData, Card(event.target).front); | ||
} | ||
|
||
private function onCardClose(event:CardEvent, passThroughData:Object):void | ||
{ | ||
var cardImage:Bitmap = Bitmap(Card(event.target).getChildAt(0)); | ||
Assert.assertEquals("Card is not closed!", cardImage.bitmapData, passThroughData); | ||
} | ||
|
||
private function onCardEventTimeout(passThroughData:Object):void | ||
{ | ||
Assert.fail("Card event is not dispatched!"); | ||
} | ||
} | ||
} |
This file was deleted.
Oops, something went wrong.