Created
May 9, 2013 05:47
-
-
Save mia-0032/5545788 to your computer and use it in GitHub Desktop.
Adobe ASプロジェクトでHelloWorldとUnitTest
This file contains hidden or 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
| package | |
| { | |
| import flash.display.Sprite; | |
| import flash.text.TextField; | |
| import flash.text.TextFieldAutoSize; | |
| import flash.text.TextFormat; | |
| public class HelloworldAs extends Sprite | |
| { | |
| public function HelloworldAs() | |
| { | |
| addChild(this.getText()); | |
| } | |
| public function getText():TextField | |
| { | |
| var tf:TextField = new TextField(); | |
| tf.defaultTextFormat = new TextFormat("_typeWriter", 60, 0x0, true); | |
| tf.text = "HelloWorld!!"; | |
| tf.autoSize = TextFieldAutoSize.LEFT; | |
| return tf; | |
| } | |
| } | |
| } |
This file contains hidden or 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
| package flexUnitTests | |
| { | |
| import flash.text.TextField; | |
| import flash.text.TextFieldAutoSize; | |
| import flash.text.TextFormat; | |
| import flexunit.framework.Assert; | |
| public class HelloworldAsTest | |
| { | |
| private var obj:HelloworldAs; | |
| [Before] | |
| public function setUp():void | |
| { | |
| this.obj = new HelloworldAs(); | |
| } | |
| [After] | |
| public function tearDown():void | |
| { | |
| } | |
| [BeforeClass] | |
| public static function setUpBeforeClass():void | |
| { | |
| } | |
| [AfterClass] | |
| public static function tearDownAfterClass():void | |
| { | |
| } | |
| [Test] | |
| public function testGetText():void | |
| { | |
| var tf:TextField = this.obj.getText(); | |
| Assert.assertEquals("HelloWorld!!", tf.text); | |
| Assert.assertEquals(TextFieldAutoSize.LEFT, tf.autoSize); | |
| } | |
| } | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment