Repository: flex-tlf Updated Branches: refs/heads/develop 5349b7aac -> ac6b0473d
Add WritingModeTest, UndoRedoTest, TextFlowEditTest Remove unused variable from TestDescriptorRunner Project: http://git-wip-us.apache.org/repos/asf/flex-tlf/repo Commit: http://git-wip-us.apache.org/repos/asf/flex-tlf/commit/ac6b0473 Tree: http://git-wip-us.apache.org/repos/asf/flex-tlf/tree/ac6b0473 Diff: http://git-wip-us.apache.org/repos/asf/flex-tlf/diff/ac6b0473 Branch: refs/heads/develop Commit: ac6b0473d73ddf11af373c523d868a42daa7e714 Parents: 5349b7a Author: piotrz <[email protected]> Authored: Wed Oct 29 08:19:47 2014 +0100 Committer: piotrz <[email protected]> Committed: Wed Oct 29 08:19:47 2014 +0100 ---------------------------------------------------------------------- .../src/UnitTest/TestDescriptorRunner.mxml | 3 +- automation_tests/src/AllTestsSuite.as | 6 + .../src/UnitTest/Tests/TextFlowEditTest.as | 305 +++---- .../src/UnitTest/Tests/UndoRedoTest.as | 153 ++-- .../src/UnitTest/Tests/WritingModeTest.as | 795 ++++++++++--------- 5 files changed, 660 insertions(+), 602 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/flex-tlf/blob/ac6b0473/automation_apps/src/UnitTest/TestDescriptorRunner.mxml ---------------------------------------------------------------------- diff --git a/automation_apps/src/UnitTest/TestDescriptorRunner.mxml b/automation_apps/src/UnitTest/TestDescriptorRunner.mxml index c9edada..d1eb0c4 100644 --- a/automation_apps/src/UnitTest/TestDescriptorRunner.mxml +++ b/automation_apps/src/UnitTest/TestDescriptorRunner.mxml @@ -26,9 +26,8 @@ private var core:FlexUnitCore; - public function startTest(isMinimalTests:Boolean = false):void + public function startTest():void { - core = new FlexUnitCore(); core.addUncaughtErrorListener( systemManager.loaderInfo ); core.addListener(new RunListener()); http://git-wip-us.apache.org/repos/asf/flex-tlf/blob/ac6b0473/automation_tests/src/AllTestsSuite.as ---------------------------------------------------------------------- diff --git a/automation_tests/src/AllTestsSuite.as b/automation_tests/src/AllTestsSuite.as index e7f603d..641c924 100644 --- a/automation_tests/src/AllTestsSuite.as +++ b/automation_tests/src/AllTestsSuite.as @@ -39,6 +39,9 @@ package import UnitTest.Tests.GeneralFunctionsTest; import UnitTest.Tests.OperationTest; import UnitTest.Tests.ScrollingTest; + import UnitTest.Tests.TextFlowEditTest; + import UnitTest.Tests.UndoRedoTest; + import UnitTest.Tests.WritingModeTest; [Suite] [RunWith("org.flexunit.runners.Suite")] @@ -64,6 +67,9 @@ package public var eventOverrideTest:EventOverrideTest; public var flowModelTest:FlowModelTest; public var generalFunctionsTest:GeneralFunctionsTest; + public var writingModeTest:WritingModeTest; + public var undoRedoTest:UndoRedoTest; + public var textFlowEditTest:TextFlowEditTest; } } http://git-wip-us.apache.org/repos/asf/flex-tlf/blob/ac6b0473/automation_tests/src/UnitTest/Tests/TextFlowEditTest.as ---------------------------------------------------------------------- diff --git a/automation_tests/src/UnitTest/Tests/TextFlowEditTest.as b/automation_tests/src/UnitTest/Tests/TextFlowEditTest.as index 53f508c..f56746d 100644 --- a/automation_tests/src/UnitTest/Tests/TextFlowEditTest.as +++ b/automation_tests/src/UnitTest/Tests/TextFlowEditTest.as @@ -18,155 +18,170 @@ //////////////////////////////////////////////////////////////////////////////// package UnitTest.Tests { - import UnitTest.ExtendedClasses.TestDescriptor; - import UnitTest.ExtendedClasses.TestSuiteExtended; - import UnitTest.ExtendedClasses.VellumTestCase; - import UnitTest.Fixtures.TestConfig; + import UnitTest.ExtendedClasses.VellumTestCase; + import UnitTest.Fixtures.TestConfig; - import flash.events.*; + import flashx.textLayout.edit.*; + import flashx.textLayout.elements.FlowElement; + import flashx.textLayout.elements.FlowGroupElement; + import flashx.textLayout.elements.InlineGraphicElement; + import flashx.textLayout.elements.ParagraphElement; - import flashx.textLayout.*; - import flashx.textLayout.edit.*; - import flashx.textLayout.elements.FlowElement; - import flashx.textLayout.elements.FlowGroupElement; - import flashx.textLayout.elements.InlineGraphicElement; - import flashx.textLayout.elements.ParagraphElement; - - import mx.utils.LoaderUtil; + import mx.utils.LoaderUtil; import org.flexunit.asserts.assertTrue; public class TextFlowEditTest extends VellumTestCase - { - public function TextFlowEditTest(methodName:String, testID:String, testConfig:TestConfig, testXML:XML = null) - { - super(methodName, testID, testConfig); - - // Note: These must correspond to a Watson product area (case-sensitive) - metaData.productArea = "Editing"; - } - - public static function suite(testConfig:TestConfig, ts:TestSuiteExtended):void - { - ts.addTestDescriptor (new TestDescriptor (TextFlowEditTest, "simulateClipboardTest", testConfig ) ); //HBS - ts.addTestDescriptor (new TestDescriptor (TextFlowEditTest, "addChildTest", testConfig ) ); - ts.addTestDescriptor (new TestDescriptor (TextFlowEditTest, "removeChildTest", testConfig ) ); - } - - // Returns the string from begIdx through and including endIdx - private function getText( begIdx:int, endIdx:int ): String - { - var outString:String = ""; - - for ( var x:int = begIdx; x < endIdx; x++ ) - { - outString += SelManager.textFlow.getCharAtPosition(x); - } - - return outString; - } - - // Tests FlowGroupElement's addChild and addChildAt on TextFlow - public function addChildTest():void - { - var origLength:int = SelManager.textFlow.textLength; - var firstPara:FlowElement = SelManager.textFlow.getChildAt(0).deepCopy(); - - // Test addChild - SelManager.textFlow.removeChildAt(0); - var flowLength:int = SelManager.textFlow.textLength; - var tempPara:FlowElement = SelManager.textFlow.getChildAt(0).deepCopy(); - SelManager.textFlow.addChild(tempPara); - flowLength *= 2; - assertTrue( "addChild failed on textFlow", - flowLength == SelManager.textFlow.textLength ); - - // Try to add an already added element this should simply replace it - SelManager.textFlow.addChild(tempPara); - assertTrue( "readdChild failed on textFlow", - flowLength == SelManager.textFlow.textLength && tempPara.parent == SelManager.textFlow && tempPara == SelManager.textFlow.getChildAt(SelManager.textFlow.numChildren-1)); - - // Test addChildAt - SelManager.textFlow.addChildAt(1,firstPara); - SelManager.textFlow.removeChildAt(2); - assertTrue( "addChildAt failed on textFlow", - origLength == SelManager.textFlow.textLength ); - assertTrue ( "addChildAt failed to place child at correct position", - getText(0,7) == "The man" ); - } - - // Tests FlowGroupElement's removeChild and removeChildAt on TextFlow - public function removeChildTest():void - { - SelManager.textFlow.removeChildAt(0); - assertTrue( "Removing first child paragraph failed", - SelManager.textFlow.getChildAt(1) == null ); - - SelManager.selectRange(25,25); - SelManager.insertInlineGraphic(LoaderUtil.createAbsoluteURL(baseURL,"../../test/testFiles/assets/gremlin.jpg"), 20, 20 ); - - var paraElem:FlowGroupElement = SelManager.textFlow.getChildAt(0) as ParagraphElement; - var imgElem:FlowElement = paraElem.getChildAt(paraElem.findChildIndexAtPosition(25)); - assertTrue("Expected InlineImageElement not found", imgElem is InlineGraphicElement ); - paraElem.removeChild(imgElem); - - assertTrue("FlowGroupElement method removeChild failed to remove InlineGraphic", - !(paraElem.getChildAt( - paraElem.findChildIndexAtPosition(25)) - is InlineGraphicElement) ) - - // Try to remove an element that isn't here - var gotError:Boolean = false; - try - { - SelManager.textFlow.removeChild(imgElem); - } - catch ( e:ArgumentError ) - { - gotError = true; - } - - assertTrue( "Removing invalid child element failed to throw error", - gotError ); - } - - /** - * Selects the characters between the 10th and 50th characters and does a cut. It then - * does an undo, redo, and another undo of the cut operation. - * Verifies that there is the correct amount of characters on the clipboard after the cut operation. - * Verifies that the correct amount of characters are left in the document after the cut operation. - * Verifies that the correct amount of characters are left in the doucment after undoing the cut operation. - * Verifies that the correct amount of characters are left in the document after redoing the cut operation. - * Verifies that the correct amount of characters are left in the document after re-undoing the cut operation. - */ - public function simulateClipboardTest():void //HBS - { - var startIndx:int = 10; - var endIndx:int = 50; - - SelManager.selectRange(startIndx,endIndx); - var initLength:uint = SelManager.textFlow.textLength; - var peudoClipboard:TextScrap = SelManager.cutTextScrap(); - var endLength:uint = SelManager.textFlow.textLength; - assertTrue("Text length is incorrect after a cut operation", endLength == initLength - (endIndx - startIndx) ); - - SelManager.undo(); - var afterUndoLength:uint = SelManager.textFlow.textLength; - assertTrue("Text length is incorrect after undoing a cut operation", afterUndoLength == initLength); - - //everything is ok so far if we get down here. Now, redo the undo operation and - //make suer the flow goes back to the endLength - - SelManager.redo(); - var afterRedoLength:uint = SelManager.textFlow.textLength; - assertTrue("Text length is incorrect after redoing a cut operation", afterRedoLength == endLength); - - //everything is ok so far if we get down here. Now, do an undo again to get - //the doc back to it's original state so that we can go on with tests. - - SelManager.undo(); - afterUndoLength = SelManager.textFlow.textLength; - assertTrue("Text length is incorrect after undoing a cut operation", afterUndoLength == initLength); - } - } + { + public function TextFlowEditTest() + { + super("", "TextFlowEditTest", TestConfig.getInstance()) + + metaData = {}; + // Note: These must correspond to a Watson product area (case-sensitive) + metaData.productArea = "Editing"; + } + + [Before] + override public function setUpTest():void + { + super.setUpTest(); + } + + [After] + override public function tearDownTest():void + { + super.tearDownTest(); + } + + [Test] + /** + * Tests FlowGroupElement's addChild and addChildAt on TextFlow + */ + public function addChildTest():void + { + var origLength:int = SelManager.textFlow.textLength; + var firstPara:FlowElement = SelManager.textFlow.getChildAt(0).deepCopy(); + + // Test addChild + SelManager.textFlow.removeChildAt(0); + var flowLength:int = SelManager.textFlow.textLength; + var tempPara:FlowElement = SelManager.textFlow.getChildAt(0).deepCopy(); + SelManager.textFlow.addChild(tempPara); + flowLength *= 2; + assertTrue("addChild failed on textFlow", + flowLength == SelManager.textFlow.textLength); + + // Try to add an already added element this should simply replace it + SelManager.textFlow.addChild(tempPara); + assertTrue("readdChild failed on textFlow", + flowLength == SelManager.textFlow.textLength && tempPara.parent == SelManager.textFlow && tempPara == SelManager.textFlow.getChildAt(SelManager.textFlow.numChildren - 1)); + + // Test addChildAt + SelManager.textFlow.addChildAt(1, firstPara); + SelManager.textFlow.removeChildAt(2); + assertTrue("addChildAt failed on textFlow", + origLength == SelManager.textFlow.textLength); + assertTrue("addChildAt failed to place child at correct position", + getText(0, 7) == "The man"); + } + + [Test] + /** + * Tests FlowGroupElement's removeChild and removeChildAt on TextFlow + */ + public function removeChildTest():void + { + SelManager.textFlow.removeChildAt(0); + assertTrue("Removing first child paragraph failed", + SelManager.textFlow.getChildAt(1) == null); + + SelManager.selectRange(25, 25); + SelManager.insertInlineGraphic(LoaderUtil.createAbsoluteURL(baseURL, "../../test/testFiles/assets/gremlin.jpg"), 20, 20); + + var paraElem:FlowGroupElement = SelManager.textFlow.getChildAt(0) as ParagraphElement; + var imgElem:FlowElement = paraElem.getChildAt(paraElem.findChildIndexAtPosition(25)); + assertTrue("Expected InlineImageElement not found", imgElem is InlineGraphicElement); + paraElem.removeChild(imgElem); + + assertTrue("FlowGroupElement method removeChild failed to remove InlineGraphic", + !(paraElem.getChildAt( + paraElem.findChildIndexAtPosition(25)) + is InlineGraphicElement)) + + // Try to remove an element that isn't here + var gotError:Boolean = false; + try + { + SelManager.textFlow.removeChild(imgElem); + } + catch (e:ArgumentError) + { + gotError = true; + } + + assertTrue("Removing invalid child element failed to throw error", + gotError); + } + + [Test] + /** + * Selects the characters between the 10th and 50th characters and does a cut. It then + * does an undo, redo, and another undo of the cut operation. + * Verifies that there is the correct amount of characters on the clipboard after the cut operation. + * Verifies that the correct amount of characters are left in the document after the cut operation. + * Verifies that the correct amount of characters are left in the doucment after undoing the cut operation. + * Verifies that the correct amount of characters are left in the document after redoing the cut operation. + * Verifies that the correct amount of characters are left in the document after re-undoing the cut operation. + */ + public function simulateClipboardTest():void //HBS + { + var startIndx:int = 10; + var endIndx:int = 50; + + SelManager.selectRange(startIndx, endIndx); + var initLength:uint = SelManager.textFlow.textLength; + var peudoClipboard:TextScrap = SelManager.cutTextScrap(); + var endLength:uint = SelManager.textFlow.textLength; + assertTrue("Text length is incorrect after a cut operation", endLength == initLength - (endIndx - startIndx)); + + SelManager.undo(); + var afterUndoLength:uint = SelManager.textFlow.textLength; + assertTrue("Text length is incorrect after undoing a cut operation", afterUndoLength == initLength); + + //everything is ok so far if we get down here. Now, redo the undo operation and + //make suer the flow goes back to the endLength + + SelManager.redo(); + var afterRedoLength:uint = SelManager.textFlow.textLength; + assertTrue("Text length is incorrect after redoing a cut operation", afterRedoLength == endLength); + + //everything is ok so far if we get down here. Now, do an undo again to get + //the doc back to it's original state so that we can go on with tests. + + SelManager.undo(); + afterUndoLength = SelManager.textFlow.textLength; + assertTrue("Text length is incorrect after undoing a cut operation", afterUndoLength == initLength); + } + + + /** + * Returns the string from begIdx through and including endIdx + * + * @param begIdx + * @param endIdx + * @return + */ + private function getText(begIdx:int, endIdx:int):String + { + var outString:String = ""; + + for (var x:int = begIdx; x < endIdx; x++) + { + outString += SelManager.textFlow.getCharAtPosition(x); + } + + return outString; + } + } } http://git-wip-us.apache.org/repos/asf/flex-tlf/blob/ac6b0473/automation_tests/src/UnitTest/Tests/UndoRedoTest.as ---------------------------------------------------------------------- diff --git a/automation_tests/src/UnitTest/Tests/UndoRedoTest.as b/automation_tests/src/UnitTest/Tests/UndoRedoTest.as index b0bfcee..54ac062 100644 --- a/automation_tests/src/UnitTest/Tests/UndoRedoTest.as +++ b/automation_tests/src/UnitTest/Tests/UndoRedoTest.as @@ -18,88 +18,87 @@ //////////////////////////////////////////////////////////////////////////////// package UnitTest.Tests { - import UnitTest.ExtendedClasses.VellumTestCase; - import UnitTest.Fixtures.TestEditManager; - import UnitTest.Fixtures.TestConfig; - import UnitTest.ExtendedClasses.TestSuiteExtended; + import UnitTest.ExtendedClasses.TestSuiteExtended; + import UnitTest.ExtendedClasses.VellumTestCase; + import UnitTest.Fixtures.TestConfig; + import UnitTest.Fixtures.TestEditManager; - import flash.display.Sprite; - import flashx.textLayout.container.ContainerController; - import flashx.textLayout.conversion.ConversionType; - import flashx.textLayout.conversion.TextConverter; - import flashx.textLayout.edit.IEditManager; - import flashx.textLayout.edit.EditManager; - import flashx.textLayout.elements.TextFlow; - import flashx.undo.IUndoManager; - import flashx.undo.UndoManager; - import flashx.textLayout.operations.ApplyLinkOperation; - - import flashx.textLayout.tlf_internal; + import flash.display.Sprite; + + import flashx.textLayout.container.ContainerController; + import flashx.textLayout.conversion.TextConverter; + import flashx.textLayout.elements.TextFlow; + import flashx.textLayout.operations.ApplyLinkOperation; + import flashx.textLayout.tlf_internal; + import flashx.undo.IUndoManager; + import flashx.undo.UndoManager; import org.flexunit.asserts.assertTrue; use namespace tlf_internal; - /** Test the state of selection after each operation is done, undone, and redone. - */ - public class UndoRedoTest extends VellumTestCase - { - public function UndoRedoTest(methodName:String, testID:String, testConfig:TestConfig, testCaseXML:XML=null) - { - super(methodName, testID, testConfig, testCaseXML); - } - public static function suiteFromXML(testListXML:XML, testConfig:TestConfig, ts:TestSuiteExtended):void - { - var testCaseClass:Class = UndoRedoTest; - VellumTestCase.suiteFromXML(testCaseClass, testListXML, testConfig, ts); - } - - private var container:Sprite; - //private const ANY_URL:String = "http://livedocs.adobe.com/"; - - protected function get initialImport():XML { - return <TextFlow color="#000000" fontFamily="Tahoma" fontSize="14" fontStyle="normal" fontWeight="normal" lineHeight="130%" textDecoration="none" whiteSpaceCollapse="preserve" xmlns="http://ns.adobe.com/textLayout/2008"> - <p> - <span>aaa</span> - </p> - <p styleName="h1"> - <span>bbb</span> - </p> - </TextFlow> - } - - protected function get initialImportString():String { - return null - } - - protected var initialImportXMLString:String = initialImport.normalize().toXMLString(); - protected var editManager:TestEditManager; - protected var undoManager:IUndoManager; - protected var textFlow:TextFlow ; - - private function setup():void - { - container = new Sprite(); - var controllerOne:ContainerController = new ContainerController(container, 500, 500); - textFlow = TextConverter.importToFlow(initialImport, TextConverter.TEXT_LAYOUT_FORMAT); - undoManager = new UndoManager(); - editManager = new TestEditManager(undoManager); - textFlow.interactionManager = editManager; - textFlow.flowComposer.addController(controllerOne); - textFlow.flowComposer.updateAllControllers(); - } - - public function undoRedoLinkTest():void - { - setup(); - //position > 3 will be in 2nd paragraph, cause error #2549628, no fix for now so the range is set to 3 to let the test case pass - var posOfSelection:int = TestData.posOfSelection; - editManager.selectRange(1,posOfSelection); - editManager.doOperation(new ApplyLinkOperation(editManager.getSelectionState(), "http://www.yahoo.com", "_self", true)); - var resultString:String = editManager.errors; - assertTrue("Undo and Redo not successfully. " + resultString, resultString == ""); - } + /** Test the state of selection after each operation is done, undone, and redone. + */ + public class UndoRedoTest extends VellumTestCase + { + private var container:Sprite; + protected var editManager:TestEditManager; + protected var undoManager:IUndoManager; + protected var textFlow:TextFlow; + + public function UndoRedoTest() + { + super("", "UndoRedoTest", TestConfig.getInstance()); + } + + protected function get initialImport():XML + { + return <TextFlow color="#000000" fontFamily="Tahoma" fontSize="14" fontStyle="normal" fontWeight="normal" lineHeight="130%" textDecoration="none" whiteSpaceCollapse="preserve" xmlns="http://ns.adobe.com/textLayout/2008"> + <p> + <span>aaa</span> + </p> + <p styleName="h1"> + <span>bbb</span> + </p> + </TextFlow> + } + + [Before] + override public function setUpTest():void + { + super.setUpTest(); + + container = new Sprite(); + var controllerOne:ContainerController = new ContainerController(container, 500, 500); + textFlow = TextConverter.importToFlow(initialImport, TextConverter.TEXT_LAYOUT_FORMAT); + undoManager = new UndoManager(); + editManager = new TestEditManager(undoManager); + textFlow.interactionManager = editManager; + textFlow.flowComposer.addController(controllerOne); + textFlow.flowComposer.updateAllControllers(); + } + + [After] + override public function tearDownTest():void + { + super.tearDownTest(); + + container = null; + undoManager = null; + editManager = null; + textFlow = null; + } + + [Test] + public function undoRedoLinkTest():void + { + //position > 3 will be in 2nd paragraph, cause error #2549628, no fix for now so the range is set to 3 to let the test case pass + var posOfSelection:int = TestData.posOfSelection; + editManager.selectRange(1, posOfSelection); + editManager.doOperation(new ApplyLinkOperation(editManager.getSelectionState(), "http://flex.apache.org", "_self", true)); + var resultString:String = editManager.errors; + assertTrue("Undo and Redo not successfully. " + resultString, resultString == ""); + } - - } + } } http://git-wip-us.apache.org/repos/asf/flex-tlf/blob/ac6b0473/automation_tests/src/UnitTest/Tests/WritingModeTest.as ---------------------------------------------------------------------- diff --git a/automation_tests/src/UnitTest/Tests/WritingModeTest.as b/automation_tests/src/UnitTest/Tests/WritingModeTest.as index 7b35e35..43891c5 100644 --- a/automation_tests/src/UnitTest/Tests/WritingModeTest.as +++ b/automation_tests/src/UnitTest/Tests/WritingModeTest.as @@ -18,388 +18,427 @@ //////////////////////////////////////////////////////////////////////////////// package UnitTest.Tests { - import UnitTest.ExtendedClasses.TestSuiteExtended; - import UnitTest.ExtendedClasses.VellumTestCase; - import UnitTest.Fixtures.TestConfig; + import UnitTest.ExtendedClasses.VellumTestCase; + import UnitTest.Fixtures.TestConfig; - import flash.display.DisplayObject; - import flash.text.engine.TextLine; + import flash.display.DisplayObject; + import flash.text.engine.TextLine; - import flashx.textLayout.container.ContainerController; - import flashx.textLayout.formats.BlockProgression; - import flashx.textLayout.formats.Direction; + import flashx.textLayout.formats.BlockProgression; + import flashx.textLayout.formats.Direction; import org.flexunit.asserts.assertTrue; public class WritingModeTest extends VellumTestCase - { - public function WritingModeTest(methodName:String, testID:String, testConfig:TestConfig, testCaseXML:XML=null) - { - super(methodName, testID, testConfig, testCaseXML); - - // Note: These must correspond to a Watson product area (case-sensitive) - metaData.productArea = "Text Container"; - metaData.productSubArea = "Text Direction"; - } - - public static function suiteFromXML(testListXML:XML, testConfig:TestConfig, ts:TestSuiteExtended):void - { - var testCaseClass:Class = WritingModeTest; - VellumTestCase.suiteFromXML(testCaseClass, testListXML, testConfig, ts); - } - - // test each writingMode with two columns setting them on the TextFlow - // have to clear any container overrides - not sure how they got there. - - public function japaneseAttrib():void - { - SelManager.selectRange(0,0); - SelManager.flushPendingOperations(); - - SelManager.textFlow.blockProgression = BlockProgression.RL; - SelManager.textFlow.columnCount = 2; - SelManager.textFlow.direction = Direction.LTR; - - assertTrue(true, SelManager.textFlow.format.blockProgression == BlockProgression.RL); - assertTrue(true, SelManager.textFlow.computedFormat.blockProgression == BlockProgression.RL); - } - - public function arabicAttrib():void - { - SelManager.selectRange(0,0); - SelManager.flushPendingOperations(); - - SelManager.textFlow.blockProgression = BlockProgression.TB; - SelManager.textFlow.columnCount = 2; - SelManager.textFlow.direction = Direction.RTL; - - assertTrue(true, SelManager.textFlow.format.blockProgression == BlockProgression.TB ); - assertTrue(true, SelManager.textFlow.computedFormat.blockProgression == BlockProgression.TB ); - } - - public function romanAttrib():void - { - SelManager.selectRange(0,0); - SelManager.flushPendingOperations(); - - SelManager.textFlow.blockProgression = BlockProgression.TB; - SelManager.textFlow.columnCount = 2; - SelManager.textFlow.direction = Direction.LTR; - - assertTrue(true, SelManager.textFlow.format.blockProgression == BlockProgression.TB ); - assertTrue(true, SelManager.textFlow.computedFormat.blockProgression == BlockProgression.TB ); - } - - // No writing system uses this, but it's still a possible combination - public function rtlAttrib():void - { - SelManager.selectRange(0,0); - SelManager.flushPendingOperations(); - - SelManager.textFlow.blockProgression = BlockProgression.RL; - SelManager.textFlow.columnCount = 2; - SelManager.textFlow.direction = Direction.RTL; - - assertTrue(true, SelManager.textFlow.format.blockProgression == BlockProgression.RL); - assertTrue(true, SelManager.textFlow.computedFormat.blockProgression == BlockProgression.RL); - } - - // Test BlockProgression.RL + Direction.LTR - public function japanesePositioning():void - { - // Force the intended text positioning - SelManager.textFlow.blockProgression = BlockProgression.RL; - SelManager.textFlow.direction = Direction.LTR; - SelManager.textFlow.paddingBottom = 0; - SelManager.textFlow.paddingLeft = 0; - SelManager.textFlow.paddingRight = 0; - SelManager.textFlow.paddingTop = 0; - SelManager.textFlow.columnCount = 2; - SelManager.textFlow.columnGap = 0; - - // Create a new paragraph in the second column - SelManager.selectRange(1842,1842); - SelManager.splitParagraph(); - - SelManager.flushPendingOperations(); - - // Get the posititioning of the first and second columns - var x1:int = SelManager.textFlow.flowComposer.findLineAtPosition(0).x; - var y1:int = SelManager.textFlow.flowComposer.findLineAtPosition(0).y; - var x2:int = SelManager.textFlow.flowComposer.findLineAtPosition(1843).x; - var y2:int = SelManager.textFlow.flowComposer.findLineAtPosition(1843).y; - - assertTrue( - "BlockProgression: BP: R to L, Direction: L to R placed text in an incorrect direction.", - x1 == x2 - ); - assertTrue( - "BlockProgression: BP: R to L, Direction: L to R placed text in an incorrect direction.", - y1 < y2 - ); - } - - // Test BlockProgression.TB + Direction.LTR - public function romanPositioning():void - { - // Force the intended text positioning - SelManager.textFlow.blockProgression = BlockProgression.TB; - SelManager.textFlow.direction = Direction.LTR; - SelManager.textFlow.paddingBottom = 0; - SelManager.textFlow.paddingLeft = 0; - SelManager.textFlow.paddingRight = 0; - SelManager.textFlow.paddingTop = 0; - SelManager.textFlow.columnCount = 2; - SelManager.textFlow.columnGap = 0; - - // Create a new paragraph in the second column - SelManager.selectRange(1862,1862); - SelManager.splitParagraph(); - - SelManager.flushPendingOperations(); - - // Get the posititioning of the first and second columns - var x1:int = SelManager.textFlow.flowComposer.findLineAtPosition(0).x; - var y1:int = SelManager.textFlow.flowComposer.findLineAtPosition(0).y; - var x2:int = SelManager.textFlow.flowComposer.findLineAtPosition(1873).x; - var y2:int = SelManager.textFlow.flowComposer.findLineAtPosition(1873).y; - - assertTrue( - "BlockProgression: BP: T to B, Direction: L to R placed text in an incorrect direction.", - x1 < x2 - ); - assertTrue( - "BlockProgression: BP: T to B, Direction: L to R placed text in an incorrect direction.", - y1 == y2 - ); - } - - // Test BlockProgression.RL + Direction.RTL - public function rtlPositioning():void - { - // Force the intended text positioning - SelManager.textFlow.blockProgression = BlockProgression.RL; - SelManager.textFlow.direction = Direction.RTL; - SelManager.textFlow.paddingBottom = 0; - SelManager.textFlow.paddingLeft = 0; - SelManager.textFlow.paddingRight = 0; - SelManager.textFlow.paddingTop = 0; - SelManager.textFlow.columnCount = 2; - SelManager.textFlow.columnGap = 0; - - // Create a new paragraph in the second column - SelManager.selectRange(1842,1842); - SelManager.splitParagraph(); - - SelManager.flushPendingOperations(); - - // Get the posititioning of the first and second columns - var x1:int = SelManager.textFlow.flowComposer.findLineAtPosition(0).x; - var y1:int = SelManager.textFlow.flowComposer.findLineAtPosition(0).y; - var x2:int = SelManager.textFlow.flowComposer.findLineAtPosition(1843).x; - var y2:int = SelManager.textFlow.flowComposer.findLineAtPosition(1843).y; - - assertTrue( - "BlockProgression: BP: R to L, Direction: R to L placed text in an incorrect direction.", - x1 == x2 - ); - assertTrue( - "BlockProgression: BP: R to L, Direction: R to L placed text in an incorrect direction.", - y1 < y2 - ); - } - - // Test BlockProgression.TB + Direction.RTL - public function arabicPositioning():void - { - // Force the intended text positioning - SelManager.textFlow.blockProgression = BlockProgression.TB; - SelManager.textFlow.direction = Direction.RTL; - SelManager.textFlow.paddingBottom = 0; - SelManager.textFlow.paddingLeft = 0; - SelManager.textFlow.paddingRight = 0; - SelManager.textFlow.paddingTop = 0; - SelManager.textFlow.columnCount = 2; - SelManager.textFlow.columnGap = 0; - - // Create a new paragraph in the second column - SelManager.selectRange(1862,1862); - SelManager.splitParagraph(); - - SelManager.flushPendingOperations(); - - // Get the posititioning of the first and second columns - var x1:int = SelManager.textFlow.flowComposer.findLineAtPosition(0).x; - var y1:int = SelManager.textFlow.flowComposer.findLineAtPosition(0).y; - var x2:int = SelManager.textFlow.flowComposer.findLineAtPosition(1873).x; - var y2:int = SelManager.textFlow.flowComposer.findLineAtPosition(1873).y; - - assertTrue( - "BlockProgression: BlockProgression: T to B, Direction: R to L placed text in an incorrect direction.", - x1 > x2 - ); - assertTrue( - "BlockProgression: BlockProgression: T to B, Direction: R to L placed text in an incorrect direction.", - y1 == y2 - ); - } - - // Test BlockProgression.RL + Direction.LTR - public function japaneseJustification():void - { - // Force the intended text positioning - SelManager.textFlow.blockProgression = BlockProgression.RL; - SelManager.textFlow.direction = Direction.LTR; - - // Create new paragraphs to with severe justification differences - SelManager.insertText("M"); - SelManager.insertText("MMMMMM"); - SelManager.insertText("MMMMMMMMMMMM"); - SelManager.selectRange(1,1); - SelManager.splitParagraph(); - SelManager.selectRange(8,8); - SelManager.splitParagraph(); - - var xPos:Array = new Array(); - var yPos:Array = new Array(); - - for ( var l:int = 0; l < TestFrame.textFlow.flowComposer.numLines; l++ ) - { - var testLine:TextLine = SelManager.textFlow.flowComposer.getLineAt(l).getTextLine(); - - xPos.push(testLine.getBounds( TestFrame.container as DisplayObject ).x); - yPos.push(testLine.getBounds( TestFrame.container as DisplayObject ).y); - } - - // Check that we're on different lines - assertTrue( "Justification incorrect with BlockProgression: R to L, Direction: L to R", - xPos[0] > xPos[1] && xPos[1] > xPos[2] ); - // Justification is correct - assertTrue( "Justification incorrect with BlockProgression: R to L, Direction: L to R", - yPos[0] == yPos[1] && yPos[1] == yPos[2] ); - } - - // Test BlockProgression.TB + Direction.LTR - public function romanJustification():void - { - // Force the intended text positioning - SelManager.textFlow.blockProgression = BlockProgression.TB; - SelManager.textFlow.direction = Direction.LTR; - - // Create new paragraphs to with severe justification differences - SelManager.insertText("M"); - SelManager.insertText("MMMMMM"); - SelManager.insertText("MMMMMMMMMMMM"); - SelManager.selectRange(1,1); - SelManager.splitParagraph(); - SelManager.selectRange(8,8); - SelManager.splitParagraph(); - - var xPos:Array = new Array(); - var yPos:Array = new Array(); - - for ( var l:int = 0; l < TestFrame.textFlow.flowComposer.numLines; l++ ) - { - var testLine:TextLine = SelManager.textFlow.flowComposer.getLineAt(l).getTextLine(); - - xPos.push(testLine.getBounds( TestFrame.container as DisplayObject ).x); - yPos.push(testLine.getBounds( TestFrame.container as DisplayObject ).y); - } - - // Check that we're on different lines - assertTrue( "Justification incorrect with BlockProgression: T to B, Direction: L to R", - yPos[0] != yPos[1] && yPos[1] != yPos[2] ); - // Justification is correct - assertTrue( "Justification incorrect with BlockProgression: T to B, Direction: L to R", - xPos[0] == xPos[1] && xPos[1] == xPos[2] ); - } - - // Test BlockProgression.RL + Direction.RTL - public function rtlJustification():void - { - // Force the intended text positioning - SelManager.textFlow.blockProgression = BlockProgression.RL; - SelManager.textFlow.direction = Direction.RTL; - - // Create new paragraphs to with severe justification differences - SelManager.insertText("M"); - SelManager.insertText("MMMMMM"); - SelManager.insertText("MMMMMMMMMMMM"); - SelManager.selectRange(1,1); - SelManager.splitParagraph(); - SelManager.selectRange(8,8); - SelManager.splitParagraph(); - - var xPos:Array = new Array(); - var yPos:Array = new Array(); - - for ( var l:int = 0; l < TestFrame.textFlow.flowComposer.numLines; l++ ) - { - var testLine:TextLine = SelManager.textFlow.flowComposer.getLineAt(l).getTextLine(); - - xPos.push(testLine.getBounds( TestFrame.container as DisplayObject ).x); - yPos.push(testLine.getBounds( TestFrame.container as DisplayObject ).y); - } - - // Check that we're on different lines - assertTrue( "Justification incorrect with BlockProgression: R to L, Direction: R to L", - xPos[0] != xPos[1] && xPos[1] != xPos[2] ); - // Justification is correct - assertTrue( "Justification incorrect with BlockProgression: R to L, Direction: R to L", - yPos[0] > yPos[1] && yPos[1] > yPos[2] ); - } - - // Test BlockProgression.TB + Direction.RTL - public function arabicJustification():void - { - // Force the intended text positioning - SelManager.textFlow.blockProgression = BlockProgression.TB; - SelManager.textFlow.direction = Direction.RTL; - - // Create new paragraphs to with severe justification differences - SelManager.insertText("M"); - SelManager.insertText("MMMMMM"); - SelManager.insertText("MMMMMMMMMMMM"); - SelManager.selectRange(1,1); - SelManager.splitParagraph(); - SelManager.selectRange(8,8); - SelManager.splitParagraph(); - - var xPos:Array = new Array(); - var yPos:Array = new Array(); - - for ( var l:int = 0; l < TestFrame.textFlow.flowComposer.numLines; l++ ) - { - var testLine:TextLine = SelManager.textFlow.flowComposer.getLineAt(l).getTextLine(); - - xPos.push(testLine.getBounds( TestFrame.container as DisplayObject ).x); - yPos.push(testLine.getBounds( TestFrame.container as DisplayObject ).y); - } - - // Check that we're on different lines - assertTrue( "Justification incorrect with BlockProgression: T to B & Direction: R to L", - yPos[0] != yPos[1] && yPos[1] != yPos[2] ); - // Justification is correct - assertTrue( "Justification incorrect with BlockProgression: T to B & Direction: R to L", - xPos[0] > xPos[1] && xPos[1] > xPos[2] ); - } - - // Make sure the right to left fonts are displayed right to left - public function arabicDirection():void - { - for ( var l:int = 0; l < TestFrame.textFlow.flowComposer.numLines; l++ ) - { - var testLine:TextLine = SelManager.textFlow.flowComposer.getLineAt(l).getTextLine(); - - for ( var i:int = 1; i < testLine.atomCount; i++) - { - assertTrue( "Display direction incorrect on right to left fonts", - testLine.getAtomBounds(i).x > testLine.getAtomBounds(i-1).x ); - - assertTrue( "Display direction incorrect on right to left fonts", - testLine.getAtomBounds(i).y == testLine.getAtomBounds(i-1).y ); - } - } - } - } + { + public function WritingModeTest() + { + super("", "WritingModeTest", TestConfig.getInstance()); + + metaData = {}; + // Note: These must correspond to a Watson product area (case-sensitive) + metaData.productArea = "Text Container"; + metaData.productSubArea = "Text Direction"; + } + + [Before] + override public function setUpTest():void + { + super.setUpTest(); + } + + [After] + override public function tearDownTest():void + { + super.tearDownTest(); + } + + [Test] + /** + * test each writingMode with two columns setting them on the TextFlow + * have to clear any container overrides - not sure how they got there + */ + public function japaneseAttrib():void + { + SelManager.selectRange(0, 0); + SelManager.flushPendingOperations(); + + SelManager.textFlow.blockProgression = BlockProgression.RL; + SelManager.textFlow.columnCount = 2; + SelManager.textFlow.direction = Direction.LTR; + + assertTrue(true, SelManager.textFlow.format.blockProgression == BlockProgression.RL); + assertTrue(true, SelManager.textFlow.computedFormat.blockProgression == BlockProgression.RL); + } + + [Test] + public function arabicAttrib():void + { + SelManager.selectRange(0, 0); + SelManager.flushPendingOperations(); + + SelManager.textFlow.blockProgression = BlockProgression.TB; + SelManager.textFlow.columnCount = 2; + SelManager.textFlow.direction = Direction.RTL; + + assertTrue(true, SelManager.textFlow.format.blockProgression == BlockProgression.TB); + assertTrue(true, SelManager.textFlow.computedFormat.blockProgression == BlockProgression.TB); + } + + [Test] + public function romanAttrib():void + { + SelManager.selectRange(0, 0); + SelManager.flushPendingOperations(); + + SelManager.textFlow.blockProgression = BlockProgression.TB; + SelManager.textFlow.columnCount = 2; + SelManager.textFlow.direction = Direction.LTR; + + assertTrue(true, SelManager.textFlow.format.blockProgression == BlockProgression.TB); + assertTrue(true, SelManager.textFlow.computedFormat.blockProgression == BlockProgression.TB); + } + + [Test] + /** + * No writing system uses this, but it's still a possible combination + */ + public function rtlAttrib():void + { + SelManager.selectRange(0, 0); + SelManager.flushPendingOperations(); + + SelManager.textFlow.blockProgression = BlockProgression.RL; + SelManager.textFlow.columnCount = 2; + SelManager.textFlow.direction = Direction.RTL; + + assertTrue(true, SelManager.textFlow.format.blockProgression == BlockProgression.RL); + assertTrue(true, SelManager.textFlow.computedFormat.blockProgression == BlockProgression.RL); + } + + [Test] + /** + * Test BlockProgression.RL + Direction.LTR + */ + public function japanesePositioning():void + { + // Force the intended text positioning + SelManager.textFlow.blockProgression = BlockProgression.RL; + SelManager.textFlow.direction = Direction.LTR; + SelManager.textFlow.paddingBottom = 0; + SelManager.textFlow.paddingLeft = 0; + SelManager.textFlow.paddingRight = 0; + SelManager.textFlow.paddingTop = 0; + SelManager.textFlow.columnCount = 2; + SelManager.textFlow.columnGap = 0; + + // Create a new paragraph in the second column + SelManager.selectRange(1842, 1842); + SelManager.splitParagraph(); + + SelManager.flushPendingOperations(); + + // Get the posititioning of the first and second columns + var x1:int = SelManager.textFlow.flowComposer.findLineAtPosition(0).x; + var y1:int = SelManager.textFlow.flowComposer.findLineAtPosition(0).y; + var x2:int = SelManager.textFlow.flowComposer.findLineAtPosition(1843).x; + var y2:int = SelManager.textFlow.flowComposer.findLineAtPosition(1843).y; + + assertTrue( + "BlockProgression: BP: R to L, Direction: L to R placed text in an incorrect direction.", + x1 == x2 + ); + assertTrue( + "BlockProgression: BP: R to L, Direction: L to R placed text in an incorrect direction.", + y1 < y2 + ); + } + + [Test] + /** + * Test BlockProgression.TB + Direction.LTR + */ + public function romanPositioning():void + { + // Force the intended text positioning + SelManager.textFlow.blockProgression = BlockProgression.TB; + SelManager.textFlow.direction = Direction.LTR; + SelManager.textFlow.paddingBottom = 0; + SelManager.textFlow.paddingLeft = 0; + SelManager.textFlow.paddingRight = 0; + SelManager.textFlow.paddingTop = 0; + SelManager.textFlow.columnCount = 2; + SelManager.textFlow.columnGap = 0; + + // Create a new paragraph in the second column + SelManager.selectRange(1862, 1862); + SelManager.splitParagraph(); + + SelManager.flushPendingOperations(); + + // Get the posititioning of the first and second columns + var x1:int = SelManager.textFlow.flowComposer.findLineAtPosition(0).x; + var y1:int = SelManager.textFlow.flowComposer.findLineAtPosition(0).y; + var x2:int = SelManager.textFlow.flowComposer.findLineAtPosition(1873).x; + var y2:int = SelManager.textFlow.flowComposer.findLineAtPosition(1873).y; + + assertTrue( + "BlockProgression: BP: T to B, Direction: L to R placed text in an incorrect direction.", + x1 < x2 + ); + assertTrue( + "BlockProgression: BP: T to B, Direction: L to R placed text in an incorrect direction.", + y1 == y2 + ); + } + + [Test] + /** + * Test BlockProgression.RL + Direction.RTL + */ + public function rtlPositioning():void + { + // Force the intended text positioning + SelManager.textFlow.blockProgression = BlockProgression.RL; + SelManager.textFlow.direction = Direction.RTL; + SelManager.textFlow.paddingBottom = 0; + SelManager.textFlow.paddingLeft = 0; + SelManager.textFlow.paddingRight = 0; + SelManager.textFlow.paddingTop = 0; + SelManager.textFlow.columnCount = 2; + SelManager.textFlow.columnGap = 0; + + // Create a new paragraph in the second column + SelManager.selectRange(1842, 1842); + SelManager.splitParagraph(); + + SelManager.flushPendingOperations(); + + // Get the posititioning of the first and second columns + var x1:int = SelManager.textFlow.flowComposer.findLineAtPosition(0).x; + var y1:int = SelManager.textFlow.flowComposer.findLineAtPosition(0).y; + var x2:int = SelManager.textFlow.flowComposer.findLineAtPosition(1843).x; + var y2:int = SelManager.textFlow.flowComposer.findLineAtPosition(1843).y; + + assertTrue( + "BlockProgression: BP: R to L, Direction: R to L placed text in an incorrect direction.", + x1 == x2 + ); + assertTrue( + "BlockProgression: BP: R to L, Direction: R to L placed text in an incorrect direction.", + y1 < y2 + ); + } + + [Test] + /** + * + */ + public function arabicPositioning():void + { + // Force the intended text positioning + SelManager.textFlow.blockProgression = BlockProgression.TB; + SelManager.textFlow.direction = Direction.RTL; + SelManager.textFlow.paddingBottom = 0; + SelManager.textFlow.paddingLeft = 0; + SelManager.textFlow.paddingRight = 0; + SelManager.textFlow.paddingTop = 0; + SelManager.textFlow.columnCount = 2; + SelManager.textFlow.columnGap = 0; + + // Create a new paragraph in the second column + SelManager.selectRange(1862, 1862); + SelManager.splitParagraph(); + + SelManager.flushPendingOperations(); + + // Get the posititioning of the first and second columns + var x1:int = SelManager.textFlow.flowComposer.findLineAtPosition(0).x; + var y1:int = SelManager.textFlow.flowComposer.findLineAtPosition(0).y; + var x2:int = SelManager.textFlow.flowComposer.findLineAtPosition(1873).x; + var y2:int = SelManager.textFlow.flowComposer.findLineAtPosition(1873).y; + + assertTrue( + "BlockProgression: BlockProgression: T to B, Direction: R to L placed text in an incorrect direction.", + x1 > x2 + ); + assertTrue( + "BlockProgression: BlockProgression: T to B, Direction: R to L placed text in an incorrect direction.", + y1 == y2 + ); + } + + [Test] + /** + * Test BlockProgression.RL + Direction.LTR + */ + public function japaneseJustification():void + { + // Force the intended text positioning + SelManager.textFlow.blockProgression = BlockProgression.RL; + SelManager.textFlow.direction = Direction.LTR; + + // Create new paragraphs to with severe justification differences + SelManager.insertText("M"); + SelManager.insertText("MMMMMM"); + SelManager.insertText("MMMMMMMMMMMM"); + SelManager.selectRange(1, 1); + SelManager.splitParagraph(); + SelManager.selectRange(8, 8); + SelManager.splitParagraph(); + + var xPos:Array = new Array(); + var yPos:Array = new Array(); + + for (var l:int = 0; l < TestFrame.textFlow.flowComposer.numLines; l++) + { + var testLine:TextLine = SelManager.textFlow.flowComposer.getLineAt(l).getTextLine(); + + xPos.push(testLine.getBounds(TestFrame.container as DisplayObject).x); + yPos.push(testLine.getBounds(TestFrame.container as DisplayObject).y); + } + + // Check that we're on different lines + assertTrue("Justification incorrect with BlockProgression: R to L, Direction: L to R", + xPos[0] > xPos[1] && xPos[1] > xPos[2]); + // Justification is correct + assertTrue("Justification incorrect with BlockProgression: R to L, Direction: L to R", + yPos[0] == yPos[1] && yPos[1] == yPos[2]); + } + + [Test] + /** + * Test BlockProgression.TB + Direction.LTR + */ + public function romanJustification():void + { + // Force the intended text positioning + SelManager.textFlow.blockProgression = BlockProgression.TB; + SelManager.textFlow.direction = Direction.LTR; + + // Create new paragraphs to with severe justification differences + SelManager.insertText("M"); + SelManager.insertText("MMMMMM"); + SelManager.insertText("MMMMMMMMMMMM"); + SelManager.selectRange(1, 1); + SelManager.splitParagraph(); + SelManager.selectRange(8, 8); + SelManager.splitParagraph(); + + var xPos:Array = new Array(); + var yPos:Array = new Array(); + + for (var l:int = 0; l < TestFrame.textFlow.flowComposer.numLines; l++) + { + var testLine:TextLine = SelManager.textFlow.flowComposer.getLineAt(l).getTextLine(); + + xPos.push(testLine.getBounds(TestFrame.container as DisplayObject).x); + yPos.push(testLine.getBounds(TestFrame.container as DisplayObject).y); + } + + // Check that we're on different lines + assertTrue("Justification incorrect with BlockProgression: T to B, Direction: L to R", + yPos[0] != yPos[1] && yPos[1] != yPos[2]); + // Justification is correct + assertTrue("Justification incorrect with BlockProgression: T to B, Direction: L to R", + xPos[0] == xPos[1] && xPos[1] == xPos[2]); + } + + [Test] + /** + * Test BlockProgression.RL + Direction.RTL + */ + public function rtlJustification():void + { + // Force the intended text positioning + SelManager.textFlow.blockProgression = BlockProgression.RL; + SelManager.textFlow.direction = Direction.RTL; + + // Create new paragraphs to with severe justification differences + SelManager.insertText("M"); + SelManager.insertText("MMMMMM"); + SelManager.insertText("MMMMMMMMMMMM"); + SelManager.selectRange(1, 1); + SelManager.splitParagraph(); + SelManager.selectRange(8, 8); + SelManager.splitParagraph(); + + var xPos:Array = new Array(); + var yPos:Array = new Array(); + + for (var l:int = 0; l < TestFrame.textFlow.flowComposer.numLines; l++) + { + var testLine:TextLine = SelManager.textFlow.flowComposer.getLineAt(l).getTextLine(); + + xPos.push(testLine.getBounds(TestFrame.container as DisplayObject).x); + yPos.push(testLine.getBounds(TestFrame.container as DisplayObject).y); + } + + // Check that we're on different lines + assertTrue("Justification incorrect with BlockProgression: R to L, Direction: R to L", + xPos[0] != xPos[1] && xPos[1] != xPos[2]); + // Justification is correct + assertTrue("Justification incorrect with BlockProgression: R to L, Direction: R to L", + yPos[0] > yPos[1] && yPos[1] > yPos[2]); + } + + [Test] + /** + * Test BlockProgression.TB + Direction.RTL + */ + public function arabicJustification():void + { + // Force the intended text positioning + SelManager.textFlow.blockProgression = BlockProgression.TB; + SelManager.textFlow.direction = Direction.RTL; + + // Create new paragraphs to with severe justification differences + SelManager.insertText("M"); + SelManager.insertText("MMMMMM"); + SelManager.insertText("MMMMMMMMMMMM"); + SelManager.selectRange(1, 1); + SelManager.splitParagraph(); + SelManager.selectRange(8, 8); + SelManager.splitParagraph(); + + var xPos:Array = new Array(); + var yPos:Array = new Array(); + + for (var l:int = 0; l < TestFrame.textFlow.flowComposer.numLines; l++) + { + var testLine:TextLine = SelManager.textFlow.flowComposer.getLineAt(l).getTextLine(); + + xPos.push(testLine.getBounds(TestFrame.container as DisplayObject).x); + yPos.push(testLine.getBounds(TestFrame.container as DisplayObject).y); + } + + // Check that we're on different lines + assertTrue("Justification incorrect with BlockProgression: T to B & Direction: R to L", + yPos[0] != yPos[1] && yPos[1] != yPos[2]); + // Justification is correct + assertTrue("Justification incorrect with BlockProgression: T to B & Direction: R to L", + xPos[0] > xPos[1] && xPos[1] > xPos[2]); + } + + [Test] + /** + * Make sure the right to left fonts are displayed right to left + */ + public function arabicDirection():void + { + for (var l:int = 0; l < TestFrame.textFlow.flowComposer.numLines; l++) + { + var testLine:TextLine = SelManager.textFlow.flowComposer.getLineAt(l).getTextLine(); + + for (var i:int = 1; i < testLine.atomCount; i++) + { + assertTrue("Display direction incorrect on right to left fonts", + testLine.getAtomBounds(i).x > testLine.getAtomBounds(i - 1).x); + + assertTrue("Display direction incorrect on right to left fonts", + testLine.getAtomBounds(i).y == testLine.getAtomBounds(i - 1).y); + } + } + } + } }
