Repository: flex-tlf Updated Branches: refs/heads/develop a576c24b3 -> 712c063fe
Add test configuration to ContainerTypeTest Rename tests parameter in AllEventTest and ContainerAttributeTest Project: http://git-wip-us.apache.org/repos/asf/flex-tlf/repo Commit: http://git-wip-us.apache.org/repos/asf/flex-tlf/commit/712c063f Tree: http://git-wip-us.apache.org/repos/asf/flex-tlf/tree/712c063f Diff: http://git-wip-us.apache.org/repos/asf/flex-tlf/diff/712c063f Branch: refs/heads/develop Commit: 712c063fef172a26959c13cd4b5f10c14bfc5de4 Parents: a576c24 Author: piotrz <[email protected]> Authored: Mon Mar 16 07:52:49 2015 +0100 Committer: piotrz <[email protected]> Committed: Mon Mar 16 07:52:49 2015 +0100 ---------------------------------------------------------------------- .../UnitTest/ExtendedClasses/VellumTestCase.as | 2 +- .../src/UnitTest/Tests/AllEventTest.as | 34 ++--- .../UnitTest/Tests/ContainerAttributeTest.as | 152 +++++++++--------- .../src/UnitTest/Tests/ContainerTypeTest.as | 153 ++++++++++++------- 4 files changed, 194 insertions(+), 147 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/flex-tlf/blob/712c063f/automation_core/src/UnitTest/ExtendedClasses/VellumTestCase.as ---------------------------------------------------------------------- diff --git a/automation_core/src/UnitTest/ExtendedClasses/VellumTestCase.as b/automation_core/src/UnitTest/ExtendedClasses/VellumTestCase.as index d1fca70..dcace79 100644 --- a/automation_core/src/UnitTest/ExtendedClasses/VellumTestCase.as +++ b/automation_core/src/UnitTest/ExtendedClasses/VellumTestCase.as @@ -129,7 +129,7 @@ package UnitTest.ExtendedClasses // set defaults to some items in TestData - these can be overridden // in a specific test case's constructor or in an XML file - TestData.bitmapSnapshot = "false"; + TestData.bitmapSnapshot = false; TestData.lineSnapshot = "false"; TestData.xflSnapshot = "false"; TestData.minimal = "true"; http://git-wip-us.apache.org/repos/asf/flex-tlf/blob/712c063f/automation_tests/src/UnitTest/Tests/AllEventTest.as ---------------------------------------------------------------------- diff --git a/automation_tests/src/UnitTest/Tests/AllEventTest.as b/automation_tests/src/UnitTest/Tests/AllEventTest.as index b3c0f66..91fb213 100644 --- a/automation_tests/src/UnitTest/Tests/AllEventTest.as +++ b/automation_tests/src/UnitTest/Tests/AllEventTest.as @@ -72,31 +72,31 @@ package UnitTest.Tests [RunWith("org.flexunit.runners.Parameterized")] public class AllEventTest extends VellumTestCase { - [DataPoints(loader="shortTextMouseEventTBLTRTestLoader")] + [DataPoints(loader=shortTextMouseEventTBLTRTestLoader)] [ArrayElementType("UnitTest.Fixtures.TestCaseVo")] public static var shortTextMouseEventTBLTRTestDp:Array; public static var shortTextMouseEventTBLTRTestLoader:TestConfigurationLoader = new TestConfigurationLoader("../../test/testCases/AllEventTest.xml", "ShortTextMouseEventTBLTRTest"); - [DataPoints(loader="shortTextMouseEventTBRTLTestLoader")] + [DataPoints(loader=shortTextMouseEventTBRTLTestLoader)] [ArrayElementType("UnitTest.Fixtures.TestCaseVo")] public static var shortTextMouseEventTBRTLTestDp:Array; public static var shortTextMouseEventTBRTLTestLoader:TestConfigurationLoader = new TestConfigurationLoader("../../test/testCases/AllEventTest.xml", "ShortTextMouseEventTBRTLTest"); - [DataPoints(loader="shortTextMouseEventRLLTRTestLoader")] + [DataPoints(loader=shortTextMouseEventRLLTRTestLoader)] [ArrayElementType("UnitTest.Fixtures.TestCaseVo")] public static var shortTextMouseEventRLLTRTestDp:Array; public static var shortTextMouseEventRLLTRTestLoader:TestConfigurationLoader = new TestConfigurationLoader("../../test/testCases/AllEventTest.xml", "ShortTextMouseEventRLLTRTest"); - [DataPoints(loader="shortTextMouseEventRLRTLTestLoader")] + [DataPoints(loader=shortTextMouseEventRLRTLTestLoader)] [ArrayElementType("UnitTest.Fixtures.TestCaseVo")] public static var shortTextMouseEventRLRTLTestDp:Array; public static var shortTextMouseEventRLRTLTestLoader:TestConfigurationLoader = new TestConfigurationLoader("../../test/testCases/AllEventTest.xml", "ShortTextMouseEventRLRTLTest"); - [DataPoints(loader="flowElementMouseEventTestLoader")] + [DataPoints(loader=flowElementMouseEventTestLoader)] [ArrayElementType("UnitTest.Fixtures.TestCaseVo")] public static var flowElementMouseEventTestDp:Array; @@ -440,30 +440,30 @@ package UnitTest.Tests } [Test(dataProvider=shortTextMouseEventTBLTRTestDp)] - public function ShortTextMouseEventTBLTRTest(dpData:TestCaseVo):void + public function ShortTextMouseEventTBLTRTest(testCaseVo:TestCaseVo):void { - SelManager.textFlow = getTextFlowTBLTR(dpData); + SelManager.textFlow = getTextFlowTBLTR(testCaseVo); ShortTextMouseEventTest(); } [Test(dataProvider=shortTextMouseEventTBRTLTestDp)] - public function ShortTextMouseEventTBRTLTest(dpData:TestCaseVo):void + public function ShortTextMouseEventTBRTLTest(testCaseVo:TestCaseVo):void { - SelManager.textFlow = getTextFlowTBLTR(dpData); + SelManager.textFlow = getTextFlowTBLTR(testCaseVo); ShortTextMouseEventTest(); } [Test(dataProvider=shortTextMouseEventRLLTRTestDp)] - public function ShortTextMouseEventRLLTRTest(dpData:TestCaseVo):void + public function ShortTextMouseEventRLLTRTest(testCaseVo:TestCaseVo):void { - SelManager.textFlow = getTextFlowTBLTR(dpData); + SelManager.textFlow = getTextFlowTBLTR(testCaseVo); ShortTextMouseEventTest(); } [Test(dataProvider=shortTextMouseEventRLRTLTestDp)] - public function ShortTextMouseEventRLRTLTest(dpData:TestCaseVo):void + public function ShortTextMouseEventRLRTLTest(testCaseVo:TestCaseVo):void { - SelManager.textFlow = getTextFlowTBLTR(dpData); + SelManager.textFlow = getTextFlowTBLTR(testCaseVo); ShortTextMouseEventTest(); } @@ -590,17 +590,17 @@ package UnitTest.Tests // 2. link across several lines // For now, only covering first line in link [Test(dataProvider=flowElementMouseEventTestDp)] - public function FlowElementMouseEventTest(dpData:TestCaseVo):void + public function FlowElementMouseEventTest(testCaseVo:TestCaseVo):void { var validator:FlowElementMouseEventValidator; var cc:ContainerController = SelManager.textFlow.flowComposer.getControllerAt(0); - if (dpData.id == "FlowElementMouseEventTestScrollingOn") + if (testCaseVo.id == "FlowElementMouseEventTestScrollingOn") { cc.verticalScrollPolicy = ScrollPolicy.ON; cc.horizontalScrollPolicy = ScrollPolicy.ON; } - else if (dpData.id == "FlowElementMouseEventTestScrolled") + else if (testCaseVo.id == "FlowElementMouseEventTestScrolled") { cc.verticalScrollPolicy = ScrollPolicy.ON; cc.horizontalScrollPolicy = ScrollPolicy.ON; @@ -631,7 +631,7 @@ package UnitTest.Tests TestFrame.textFlow.flowComposer.updateAllControllers(); var container:DisplayObjectContainer = SelManager.textFlow.flowComposer.getControllerAt(0).container; - if (dpData.id == "FlowElementMouseEventTestMeasure") + if (testCaseVo.id == "FlowElementMouseEventTestMeasure") { container.height = NaN; container.width = NaN; http://git-wip-us.apache.org/repos/asf/flex-tlf/blob/712c063f/automation_tests/src/UnitTest/Tests/ContainerAttributeTest.as ---------------------------------------------------------------------- diff --git a/automation_tests/src/UnitTest/Tests/ContainerAttributeTest.as b/automation_tests/src/UnitTest/Tests/ContainerAttributeTest.as index 10524f7..30e2a39 100644 --- a/automation_tests/src/UnitTest/Tests/ContainerAttributeTest.as +++ b/automation_tests/src/UnitTest/Tests/ContainerAttributeTest.as @@ -63,49 +63,49 @@ package UnitTest.Tests [RunWith("org.flexunit.runners.Parameterized")] public class ContainerAttributeTest extends VellumTestCase { - [DataPoints(loader="checkColumnWidthOnGapChangeTestLoader")] + [DataPoints(loader=checkColumnWidthOnGapChangeTestLoader)] [ArrayElementType("UnitTest.Fixtures.TestCaseVo")] public static var checkColumnWidthOnGapChangeTestDp:Array; public static var checkColumnWidthOnGapChangeTestLoader:TestConfigurationLoader = new TestConfigurationLoader("../../test/testCases/ContainerAttributeTests.xml", "checkColumnWidthOnGapChangeTest"); - [DataPoints(loader="checkVerticalAlignTopTestLoader")] + [DataPoints(loader=checkVerticalAlignTopTestLoader)] [ArrayElementType("UnitTest.Fixtures.TestCaseVo")] public static var checkVerticalAlignTopTestDp:Array; public static var checkVerticalAlignTopTestLoader:TestConfigurationLoader = new TestConfigurationLoader("../../test/testCases/ContainerAttributeTests.xml", "checkVerticalAlignTopTest"); - [DataPoints(loader="checkVerticalAlignBottomTestLoader")] + [DataPoints(loader=checkVerticalAlignBottomTestLoader)] [ArrayElementType("UnitTest.Fixtures.TestCaseVo")] public static var checkVerticalAlignBottomTestDp:Array; public static var checkVerticalAlignBottomTestLoader:TestConfigurationLoader = new TestConfigurationLoader("../../test/testCases/ContainerAttributeTests.xml", "checkVerticalAlignBottomTest"); - [DataPoints(loader="leftPaddingSqueezeTestLoader")] + [DataPoints(loader=leftPaddingSqueezeTestLoader)] [ArrayElementType("UnitTest.Fixtures.TestCaseVo")] public static var leftPaddingSqueezeTestDp:Array; public static var leftPaddingSqueezeTestLoader:TestConfigurationLoader = new TestConfigurationLoader("../../test/testCases/ContainerAttributeTests.xml", "leftPaddingSqueezeTest"); - [DataPoints(loader="checkVerticalAlignMiddleTestLoader")] + [DataPoints(loader=checkVerticalAlignMiddleTestLoader)] [ArrayElementType("UnitTest.Fixtures.TestCaseVo")] public static var checkVerticalAlignMiddleTestDp:Array; public static var checkVerticalAlignMiddleTestLoader:TestConfigurationLoader = new TestConfigurationLoader("../../test/testCases/ContainerAttributeTests.xml", "checkVerticalAlignMiddleTest"); - [DataPoints(loader="contentBoundsWithWhitespacesLoader")] + [DataPoints(loader=contentBoundsWithWhitespacesLoader)] [ArrayElementType("UnitTest.Fixtures.TestCaseVo")] public static var contentBoundsWithWhitespacesDp:Array; public static var contentBoundsWithWhitespacesLoader:TestConfigurationLoader = new TestConfigurationLoader("../../test/testCases/ContainerAttributeTests.xml", "ContentBoundsWithWhitespaces"); - [DataPoints(loader="hBeamCursorTestLoader")] + [DataPoints(loader=hBeamCursorTestLoader)] [ArrayElementType("UnitTest.Fixtures.TestCaseVo")] public static var hBeamCursorTestDp:Array; public static var hBeamCursorTestLoader:TestConfigurationLoader = new TestConfigurationLoader("../../test/testCases/ContainerAttributeTests.xml", "HBeamCursorTest"); - [DataPoints(loader="topPaddingSqueezeTestLoader")] + [DataPoints(loader=topPaddingSqueezeTestLoader)] [ArrayElementType("UnitTest.Fixtures.TestCaseVo")] public static var topPaddingSqueezeTestDp:Array; @@ -116,7 +116,7 @@ package UnitTest.Tests private var outputContainerAttrs:ITextLayoutFormat; private var initSize:Point; - private var currentDpData:Object; + private var currentTestCaseVo:TestCaseVo; public function ContainerAttributeTest() { @@ -142,11 +142,11 @@ package UnitTest.Tests columnWidth = FormatValue.AUTO; columnCount = FormatValue.AUTO; - testContainer = currentDpData.testContainer; - TestData.bitmapSnapshot = currentDpData.bitmapSnapshot ? "true" : "false"; - TestData.minimal = currentDpData.minimal ? "true" : "false"; - writingDirection[0] = currentDpData.rl_ltr == "true" ? BlockProgression.TB : BlockProgression.RL; - writingDirection[1] = currentDpData.tb_rtl == "true" ? Direction.LTR : Direction.RTL; + testContainer = currentTestCaseVo.testContainer; + TestData.bitmapSnapshot = currentTestCaseVo.bitmapSnapshot ? "true" : "false"; + TestData.minimal = currentTestCaseVo.minimal ? "true" : "false"; + writingDirection[0] = currentTestCaseVo.rl_ltr == "true" ? BlockProgression.TB : BlockProgression.RL; + writingDirection[1] = currentTestCaseVo.tb_rtl == "true" ? Direction.LTR : Direction.RTL; } [After] @@ -366,9 +366,9 @@ package UnitTest.Tests * Set and get the firstBaselineOffset string values and test bound of numeric values. */ [Test(dataProvider=checkColumnWidthOnGapChangeTestDp)] - public function checkfirstBaselineOffset(dpData:TestCaseVo):void // KJT + public function checkfirstBaselineOffset(testCaseVo:TestCaseVo):void // KJT { - currentDpData = dpData; + currentTestCaseVo = testCaseVo; setUpTest(); inputContainerAttrs.firstBaselineOffset = BaselineOffset.ASCENT; @@ -437,9 +437,9 @@ package UnitTest.Tests * Set the column count, then change the column gap and see how the column width changes. */ [Test(dataProvider=checkColumnWidthOnGapChangeTestDp)] - public function checkColumnWidthOnGapChangeTest(dpData:TestCaseVo):void + public function checkColumnWidthOnGapChangeTest(testCaseVo:TestCaseVo):void { - currentDpData = dpData; + currentTestCaseVo = testCaseVo; setUpTest(); var width:Number = testFrameWidth; @@ -467,9 +467,9 @@ package UnitTest.Tests * Set the column gap, then change the column count to see how the column width changes. */ [Test(dataProvider=checkColumnWidthOnGapChangeTestDp)] - public function checkColumnWidthOnCountChangeTest(dpData:TestCaseVo):void + public function checkColumnWidthOnCountChangeTest(testCaseVo:TestCaseVo):void { - currentDpData = dpData; + currentTestCaseVo = testCaseVo; setUpTest(); var bp:String = TestFrame.textFlow.computedFormat.blockProgression; @@ -502,9 +502,9 @@ package UnitTest.Tests */ [Test(dataProvider=checkColumnWidthOnGapChangeTestDp)] [Ignore] - public function checkColumnGapOnWidthChangeTest(dpData:TestCaseVo):void + public function checkColumnGapOnWidthChangeTest(testCaseVo:TestCaseVo):void { - currentDpData = dpData; + currentTestCaseVo = testCaseVo; setUpTest(); var width:Number = testFrameWidth; @@ -536,9 +536,9 @@ package UnitTest.Tests * NOTE: Currently commented out due to bug 1657149. */ [Test(dataProvider=checkColumnWidthOnGapChangeTestDp)] - public function checkColumnGapOnCountChangeTest(dpData:TestCaseVo):void + public function checkColumnGapOnCountChangeTest(testCaseVo:TestCaseVo):void { - currentDpData = dpData; + currentTestCaseVo = testCaseVo; setUpTest(); var width:Number = testFrameWidth; @@ -566,9 +566,9 @@ package UnitTest.Tests * then verify that the last line was the line pushed off the screen. */ [Test(dataProvider=topPaddingSqueezeTestDp)] - public function topPaddingSqueezeTest(dpData:TestCaseVo):void + public function topPaddingSqueezeTest(testCaseVo:TestCaseVo):void { - currentDpData = dpData; + currentTestCaseVo = testCaseVo; setUpTest(); var length:int = SelManager.textFlow.flowComposer.numLines; @@ -596,9 +596,9 @@ package UnitTest.Tests * then verify that the last line was the line eaten. */ [Test(dataProvider=topPaddingSqueezeTestDp)] - public function bottomPaddingSqueezeTest(dpData:TestCaseVo):void + public function bottomPaddingSqueezeTest(testCaseVo:TestCaseVo):void { - currentDpData = dpData; + currentTestCaseVo = testCaseVo; setUpTest(); //FLEX: Why no lines? @@ -626,9 +626,9 @@ package UnitTest.Tests * Increase the left padding until you force the flow to create a new line. */ [Test(dataProvider=leftPaddingSqueezeTestDp)] - public function leftPaddingSqueezeTest(dpData:TestCaseVo):void + public function leftPaddingSqueezeTest(testCaseVo:TestCaseVo):void { - currentDpData = dpData; + currentTestCaseVo = testCaseVo; setUpTest(); var length:int = SelManager.textFlow.flowComposer.numLines; @@ -651,9 +651,9 @@ package UnitTest.Tests * Increase the right padding until you force the flow to create a new line. */ [Test(dataProvider=leftPaddingSqueezeTestDp)] - public function rightPaddingSqueezeTest(dpData:TestCaseVo):void + public function rightPaddingSqueezeTest(testCaseVo:TestCaseVo):void { - currentDpData = dpData; + currentTestCaseVo = testCaseVo; setUpTest(); var length:int = SelManager.textFlow.flowComposer.numLines; @@ -673,9 +673,9 @@ package UnitTest.Tests } [Test(dataProvider=checkColumnWidthOnGapChangeTestDp)] - public function writingModeBreakTest(dpData:TestCaseVo):void + public function writingModeBreakTest(testCaseVo:TestCaseVo):void { - currentDpData = dpData; + currentTestCaseVo = testCaseVo; setUpTest(); // clear all padding on the textFlow for this test @@ -742,9 +742,9 @@ package UnitTest.Tests * This test exists solely for snapshotting. */ [Test(dataProvider=checkVerticalAlignTopTestDp)] - public function checkVerticalAlignTopTest(dpData:TestCaseVo):void + public function checkVerticalAlignTopTest(testCaseVo:TestCaseVo):void { - currentDpData = dpData; + currentTestCaseVo = testCaseVo; setUpTest(); var division:int = @@ -807,9 +807,9 @@ package UnitTest.Tests * This test exists solely for snapshotting. */ [Test(dataProvider=checkVerticalAlignBottomTestDp)] - public function checkVerticalAlignBottomTest(dpData:Object):void + public function checkVerticalAlignBottomTest(testCaseVo:TestCaseVo):void { - currentDpData = dpData; + currentTestCaseVo = testCaseVo; setUpTest(); var division:int = @@ -869,9 +869,9 @@ package UnitTest.Tests * This test exists solely for snapshotting. */ [Test(dataProvider=checkVerticalAlignMiddleTestDp)] - public function checkVerticalAlignMiddleTest(dpData:TestCaseVo):void + public function checkVerticalAlignMiddleTest(testCaseVo:TestCaseVo):void { - currentDpData = dpData; + currentTestCaseVo = testCaseVo; setUpTest(); var division:int = @@ -938,9 +938,9 @@ package UnitTest.Tests * This test exists solely for snapshotting. */ [Test(dataProvider=checkVerticalAlignTopTestDp)] - public function checkVerticalAlignJustifyTest(dpData:TestCaseVo):void + public function checkVerticalAlignJustifyTest(testCaseVo:TestCaseVo):void { - currentDpData = dpData; + currentTestCaseVo = testCaseVo; setUpTest(); var division:int = @@ -1000,9 +1000,9 @@ package UnitTest.Tests // non-empty flow, check if attribute changed after insertion point at position 0 [Test(dataProvider=leftPaddingSqueezeTestDp)] - public function insertPos0CheckColumnWidthTest(dpData:TestCaseVo):void + public function insertPos0CheckColumnWidthTest(testCaseVo:TestCaseVo):void { - currentDpData = dpData; + currentTestCaseVo = testCaseVo; setUpTest(); var bp:String = TestFrame.textFlow.computedFormat.blockProgression; @@ -1028,9 +1028,9 @@ package UnitTest.Tests //check if container attribute change after insertion in an empty flow [Test(dataProvider=leftPaddingSqueezeTestDp)] - public function checkColumnCountEmptyFlowInsertTest(dpData:TestCaseVo):void + public function checkColumnCountEmptyFlowInsertTest(testCaseVo:TestCaseVo):void { - currentDpData = dpData; + currentTestCaseVo = testCaseVo; setUpTest(); var width:Number = testFrameWidth; @@ -1055,9 +1055,9 @@ package UnitTest.Tests // non-empty flow, check if attribute changed after insertion point at end position [Test(dataProvider=leftPaddingSqueezeTestDp)] - public function insertAtEndOfFlowCheckColumnGapTest(dpData:TestCaseVo):void + public function insertAtEndOfFlowCheckColumnGapTest(testCaseVo:TestCaseVo):void { - currentDpData = dpData; + currentTestCaseVo = testCaseVo; setUpTest(); var bp:String = TestFrame.textFlow.computedFormat.blockProgression; @@ -1082,9 +1082,9 @@ package UnitTest.Tests } [Test(dataProvider=checkColumnWidthOnGapChangeTestDp)] - public function columnBreakTest(dpData:TestCaseVo):void + public function columnBreakTest(testCaseVo:TestCaseVo):void { - currentDpData = dpData; + currentTestCaseVo = testCaseVo; setUpTest(); var TestCanvas:Canvas = myEmptyChilds(); @@ -1167,9 +1167,9 @@ package UnitTest.Tests } [Test(dataProvider=checkColumnWidthOnGapChangeTestDp)] - public function containerBreakTest(dpData:TestCaseVo):void + public function containerBreakTest(testCaseVo:TestCaseVo):void { - currentDpData = dpData; + currentTestCaseVo = testCaseVo; setUpTest(); var TestCanvas:Canvas = myEmptyChilds(); @@ -1251,45 +1251,45 @@ package UnitTest.Tests } [Test(dataProvider=checkColumnWidthOnGapChangeTestDp)] - public function columnContainerBreakTest0(dpData:TestCaseVo):void + public function columnContainerBreakTest0(testCaseVo:TestCaseVo):void { - currentDpData = dpData; + currentTestCaseVo = testCaseVo; setUpTest(); columnContainerBreakTestX(0); } [Test(dataProvider=checkColumnWidthOnGapChangeTestDp)] - public function columnContainerBreakTest1000(dpData:Object):void + public function columnContainerBreakTest1000(testCaseVo:TestCaseVo):void { - currentDpData = dpData; + currentTestCaseVo = testCaseVo; setUpTest(); columnContainerBreakTestX(1000); } [Test(dataProvider=checkColumnWidthOnGapChangeTestDp)] - public function columnContainerBreakTest2000(dpData:Object):void + public function columnContainerBreakTest2000(testCaseVo:TestCaseVo):void { - currentDpData = dpData; + currentTestCaseVo = testCaseVo; setUpTest(); columnContainerBreakTestX(2000); } [Test(dataProvider=checkColumnWidthOnGapChangeTestDp)] - public function columnContainerBreakTest3000(dpData:Object):void + public function columnContainerBreakTest3000(testCaseVo:TestCaseVo):void { - currentDpData = dpData; + currentTestCaseVo = testCaseVo; setUpTest(); columnContainerBreakTestX(3000); } [Test(dataProvider=checkColumnWidthOnGapChangeTestDp)] - public function columnContainerBreakTest4000(dpData:TestCaseVo):void + public function columnContainerBreakTest4000(testCaseVo:TestCaseVo):void { - currentDpData = dpData; + currentTestCaseVo = testCaseVo; setUpTest(); columnContainerBreakTestX(4000); @@ -1485,9 +1485,9 @@ package UnitTest.Tests // mjzhang : Watson Bug#2841799 When lineBreak="toFit" the contentBounds width does // not include the trailing whitespace [Test(dataProvider=contentBoundsWithWhitespacesDp)] - public function ContentBoundsWithWhitespaces(dpData:TestCaseVo):void + public function ContentBoundsWithWhitespaces(testCaseVo:TestCaseVo):void { - currentDpData = dpData; + currentTestCaseVo = testCaseVo; setUpTest(); // This is the switch for calculate whitespace or not regardless lineBreak="toFix". @@ -1527,9 +1527,9 @@ package UnitTest.Tests // mjzhang : Bug#2835316 The TextLine is INVALID and cannot be used to access the current state of the TextBlock [Test(dataProvider=contentBoundsWithWhitespacesDp)] - public function TextSelectAllTest(dpData:TestCaseVo):void + public function TextSelectAllTest(testCaseVo:TestCaseVo):void { - currentDpData = dpData; + currentTestCaseVo = testCaseVo; setUpTest(); var textFlow:TextFlow = SelManager.textFlow; @@ -1562,9 +1562,9 @@ package UnitTest.Tests // mjzhang : Bug#2898924 TLF reports incorrect content height after composition when floats are used with padding [Test(dataProvider=hBeamCursorTestDp)] - public function ContentBoundsWithPaddingTest(dpData:TestCaseVo):void + public function ContentBoundsWithPaddingTest(testCaseVo:TestCaseVo):void { - currentDpData = dpData; + currentTestCaseVo = testCaseVo; setUpTest(); // Get image content height which has padding top set @@ -1607,9 +1607,9 @@ package UnitTest.Tests // mjzhang : Bug#2758977 <s:p color="red"/> throws out of range error - can you do color lookup like Flex SDK? // Tests all the color options, also test Upper case and bad case(XXX) [Test(dataProvider=contentBoundsWithWhitespacesDp)] - public function colorPropetyTest(dpData:TestCaseVo):void + public function colorPropetyTest(testCaseVo:TestCaseVo):void { - currentDpData = dpData; + currentTestCaseVo = testCaseVo; setUpTest(); var textFlow:TextFlow = SelManager.textFlow; @@ -1744,9 +1744,9 @@ package UnitTest.Tests } [Test(dataProvider=hBeamCursorTestDp)] - public function HBeamCursorTest(dpData:TestCaseVo):void + public function HBeamCursorTest(testCaseVo:TestCaseVo):void { - currentDpData = dpData; + currentTestCaseVo = testCaseVo; setUpTest(); SelManager.selectAll(); @@ -1770,9 +1770,9 @@ package UnitTest.Tests // mjzhang : Bug#2907691 When composition starts in middle of the container, paddingBottom for the previous paragraph is ignored [Ignore][Test(dataProvider=hBeamCursorTestDp)] - public function paddingBottomTest(dpData:TestCaseVo):void + public function paddingBottomTest(testCaseVo:TestCaseVo):void { - currentDpData = dpData; + currentTestCaseVo = testCaseVo; setUpTest(); var textFlow:TextFlow = SelManager.textFlow; @@ -1793,9 +1793,9 @@ package UnitTest.Tests //Fix bug 2869747 using TextFlow.flowComposer and ContainerController, displayed text is incorrectly masked [Test(dataProvider=checkVerticalAlignMiddleTestDp)] - public function scrollRectTest(dpData:TestCaseVo):void + public function scrollRectTest(testCaseVo:TestCaseVo):void { - currentDpData = dpData; + currentTestCaseVo = testCaseVo; setUpTest(); var textFlow:TextFlow = SelManager.textFlow; http://git-wip-us.apache.org/repos/asf/flex-tlf/blob/712c063f/automation_tests/src/UnitTest/Tests/ContainerTypeTest.as ---------------------------------------------------------------------- diff --git a/automation_tests/src/UnitTest/Tests/ContainerTypeTest.as b/automation_tests/src/UnitTest/Tests/ContainerTypeTest.as index 87c8745..a486d13 100644 --- a/automation_tests/src/UnitTest/Tests/ContainerTypeTest.as +++ b/automation_tests/src/UnitTest/Tests/ContainerTypeTest.as @@ -26,7 +26,9 @@ package UnitTest.Tests { + import UnitTest.ExtendedClasses.TestConfigurationLoader; import UnitTest.ExtendedClasses.VellumTestCase; + import UnitTest.Fixtures.TestCaseVo; import UnitTest.Fixtures.TestConfig; import flash.display.DisplayObject; @@ -58,8 +60,57 @@ package UnitTest.Tests import org.flexunit.asserts.fail; [TestCase(order=11)] + [RunWith("org.flexunit.runners.Parameterized")] public class ContainerTypeTest extends VellumTestCase { + [DataPoints(loader=singleTextLineLoader)] + [ArrayElementType("UnitTest.Fixtures.TestCaseVo")] + public static var singleTextLineDp:Array; + + public static var singleTextLineLoader:TestConfigurationLoader = new TestConfigurationLoader("../../test/testCases/ContainerTypeTests.xml", "singleTextLine"); + + [DataPoints(loader=tenTextLinesLoader)] + [ArrayElementType("UnitTest.Fixtures.TestCaseVo")] + public static var tenTextLinesDp:Array; + + public static var tenTextLinesLoader:TestConfigurationLoader = new TestConfigurationLoader("../../test/testCases/ContainerTypeTests.xml", "tenTextLinesDp"); + + [DataPoints(loader=clickLinkedContainerTestLoader)] + [ArrayElementType("UnitTest.Fixtures.TestCaseVo")] + public static var clickLinkedContainerTestDp:Array; + + public static var clickLinkedContainerTestLoader:TestConfigurationLoader = new TestConfigurationLoader("../../test/testCases/ContainerTypeTests.xml", "clickLinkedContainerTest"); + + [DataPoints(loader=checkContainerAttributesAfterTextInsertionLoader)] + [ArrayElementType("UnitTest.Fixtures.TestCaseVo")] + public static var checkContainerAttributesAfterTextInsertionDp:Array; + + public static var checkContainerAttributesAfterTextInsertionLoader:TestConfigurationLoader = new TestConfigurationLoader("../../test/testCases/ContainerTypeTests.xml", "checkContainerAttributesAfterTextInsertion"); + + [DataPoints(loader=navigateByLineTestLoader)] + [ArrayElementType("UnitTest.Fixtures.TestCaseVo")] + public static var navigateByLineTestDp:Array; + + public static var navigateByLineTestLoader:TestConfigurationLoader = new TestConfigurationLoader("../../test/testCases/ContainerTypeTests.xml", "navigateByLineTest"); + + [DataPoints(loader=tenTextLinesStaticLoader)] + [ArrayElementType("UnitTest.Fixtures.TestCaseVo")] + public static var tenTextLinesStaticDp:Array; + + public static var tenTextLinesStaticLoader:TestConfigurationLoader = new TestConfigurationLoader("../../test/testCases/ContainerTypeTests.xml", "tenTextLinesStatic"); + + [DataPoints(loader=singleTextLineStaticLoader)] + [ArrayElementType("UnitTest.Fixtures.TestCaseVo")] + public static var singleTextLineStaticDp:Array; + + public static var singleTextLineStaticLoader:TestConfigurationLoader = new TestConfigurationLoader("../../test/testCases/ContainerTypeTests.xml", "singleTextLineStatic"); + + [DataPoints(loader=clickMultiLinkedContainerTestLoader)] + [ArrayElementType("UnitTest.Fixtures.TestCaseVo")] + public static var clickMultiLinkedContainerTestDp:Array; + + public static var clickMultiLinkedContainerTestLoader:TestConfigurationLoader = new TestConfigurationLoader("../../test/testCases/ContainerTypeTests.xml", "clickMultiLinkedContainerTest"); + private var TestCanvas:Canvas = null; private var ItemsToRemove:Array; private var hostFormat:TextLayoutFormat; @@ -103,13 +154,16 @@ package UnitTest.Tests /** * Have a single TextLine on the canvas instead of a vellum container */ - [Test] - public function singleTextLine():void + [Test(dataProvider=singleTextLineDp)] + public function singleTextLine(testCaseVo:TestCaseVo):void { + //TODO: Piotr: Not sure what is for bitmapSnapshot but will invastigate soon + //TestData.bitmapSnapshot = Boolean(testCaseVo.bitmapSnapshot); + var cf:ElementFormat = new ElementFormat(); - cf.fontSize = 24 + cf.fontSize = 24; var fd:FontDescription = new FontDescription("Times New Roman") - cf.fontDescription = fd + cf.fontDescription = fd; var te:TextElement = new TextElement("A TextLine on the Canvas", cf); var tb:TextBlock = new TextBlock(); tb.content = te; @@ -126,13 +180,15 @@ package UnitTest.Tests /** * Have ten TextLines on the canvas instead of a vellum container */ - [Test] - public function tenTextLines():void + [Test(dataProvider=tenTextLinesDp)] + public function tenTextLines(testCaseVo:TestCaseVo):void { + TestData.bitmapSnapshot = testCaseVo.bitmapSnapshot; + for (var i:int = 0; i < 10; i++) { var cf:ElementFormat = new ElementFormat(); - cf.fontSize = 24 + cf.fontSize = 24; var fd:FontDescription = new FontDescription("Times New Roman") cf.fontDescription = fd var te:TextElement = new TextElement("TextLine " + i, cf); @@ -158,9 +214,9 @@ package UnitTest.Tests for (var i:int = 0; i < 100; i++) { var cf:ElementFormat = new ElementFormat(); - cf.fontSize = 2.4 - var fd:FontDescription = new FontDescription("Times New Roman") - cf.fontDescription = fd + cf.fontSize = 2.4; + var fd:FontDescription = new FontDescription("Times New Roman"); + cf.fontDescription = fd; var te:TextElement = new TextElement("TextLine " + i, cf); var tb:TextBlock = new TextBlock(); tb.content = te; @@ -175,19 +231,19 @@ package UnitTest.Tests System.gc(); //garbage collect at end so we can compare memory usage versus static lines } - [Test] - public function singleTextLineStatic():void + [Test(dataProvider=singleTextLineStaticDp)] + public function singleTextLineStatic(testCaseVo:TestCaseVo):void { - singleTextLine(); + singleTextLine(testCaseVo); TextLine(ItemsToRemove[0]).validity = TextLineValidity.STATIC; System.gc(); System.gc(); //garbage collect at end so we can compare memory usage versus static lines } - [Test] - public function tenTextLinesStatic():void + [Test(dataProvider=tenTextLinesStaticDp)] + public function tenTextLinesStatic(testCaseVo:TestCaseVo):void { - tenTextLines(); + tenTextLines(testCaseVo); for (var i:int = 0; i < ItemsToRemove.length; i++) { TextLine(ItemsToRemove[i]).validity = TextLineValidity.STATIC; @@ -208,12 +264,11 @@ package UnitTest.Tests System.gc(); //garbage collect at end so we can compare memory usage versus static lines } - [Test] - public function clickLinkedContainerTest():void + [Test(dataProvider=clickLinkedContainerTestDp)] + public function clickLinkedContainerTest(testCaseVo:TestCaseVo):void { - var posOfSelection:int = TestData.posOfSelection; + var posOfSelection:int = testCaseVo.posOfSelection; var format:TextLayoutFormat = new TextLayoutFormat(); - format = new TextLayoutFormat(); format.paddingLeft = 20; format.paddingRight = 20; format.paddingTop = 20; @@ -255,22 +310,22 @@ package UnitTest.Tests var mouseX:Number = 0; var mouseY:Number = 0; - if (TestData.id == "clickLeftToLinkedContainer") + if (testCaseVo.id == "clickLeftToLinkedContainer") { mouseX = bounds.x - 1; mouseY = tl.y; } - else if (TestData.id == "clickRightToLinkedContainer") + else if (testCaseVo.id == "clickRightToLinkedContainer") { mouseX = bounds.x + 1; mouseY = tl.y; } - else if (TestData.id == "clickTopLinkedContainer") + else if (testCaseVo.id == "clickTopLinkedContainer") { mouseX = bounds.x; mouseY = tl.y - 1; } - else if (TestData.id == "clickBottomLinkedContainer") + else if (testCaseVo.id == "clickBottomLinkedContainer") { mouseX = bounds.x; mouseY = tl.y + 1; @@ -294,8 +349,8 @@ package UnitTest.Tests /** * linked containers, check if attribute changed after texts insertion */ - [Test] - public function checkContainerAttributesAfterTextInsertion():void + [Test(dataProvider=checkContainerAttributesAfterTextInsertionDp)] + public function checkContainerAttributesAfterTextInsertion(testCaseVo:TestCaseVo):void { var textFlow:TextFlow = TextConverter.importToFlow(markup, TextConverter.TEXT_LAYOUT_FORMAT); textFlow.flowComposer = new StandardFlowComposer(); @@ -324,7 +379,6 @@ package UnitTest.Tests editManager.setFocus(); var format:TextLayoutFormat = new TextLayoutFormat(); - format = new TextLayoutFormat(); format.paddingLeft = 20; format.paddingRight = 20; format.paddingTop = 20; @@ -347,11 +401,11 @@ package UnitTest.Tests var firstContEnd:int = firstContStart + firstContLen; //get the insertion position - if (TestData.id == "insertionEndOf1stContainer") + if (testCaseVo.id == "insertionEndOf1stContainer") { editManager.selectRange(firstContEnd - 1, firstContEnd - 1); } - else if (TestData.id == "insertionBeginOf2ndContainer") + else if (testCaseVo.id == "insertionBeginOf2ndContainer") { editManager.selectRange(firstContEnd, firstContEnd); } @@ -477,12 +531,11 @@ package UnitTest.Tests posOfSelection2 == editManager2.activePosition); } - [Test] - public function clickMultiLinkedContainerTest():void + [Test(dataProvider=clickMultiLinkedContainerTestDp)] + public function clickMultiLinkedContainerTest(testCaseVo:TestCaseVo):void { - var posOfSelection:int = TestData.posOfSelection; + var posOfSelection:int = testCaseVo.posOfSelection; var format:TextLayoutFormat = new TextLayoutFormat(); - format = new TextLayoutFormat(); format.paddingLeft = 20; format.paddingRight = 20; format.paddingTop = 20; @@ -535,22 +588,22 @@ package UnitTest.Tests var bounds:Rectangle = tl.getAtomBounds(adjustedPosOfSelection); var mouseX:Number = 0; var mouseY:Number = 0; - if (TestData.id == "clickLeftToMultiLinkedContainer") + if (testCaseVo.id == "clickLeftToMultiLinkedContainer") { mouseX = bounds.x - 1; mouseY = tl.y; } - else if (TestData.id == "clickRightToMultiLinkedContainer") + else if (testCaseVo.id == "clickRightToMultiLinkedContainer") { mouseX = bounds.x + 1; mouseY = tl.y; } - else if (TestData.id == "clickTopMultiLinkedContainer") + else if (testCaseVo.id == "clickTopMultiLinkedContainer") { mouseX = bounds.x; mouseY = tl.y - 1; } - else if (TestData.id == "clickBottomMultiLinkedContainer") + else if (testCaseVo.id == "clickBottomMultiLinkedContainer") { mouseX = bounds.x; mouseY = tl.y + 1; @@ -577,8 +630,7 @@ package UnitTest.Tests public function draggingSelectioinMultiFlows():void { //create the first text flow, import texts from markups, and assign flow composer to a container - var flow_1:TextFlow = new TextFlow(); - flow_1 = TextConverter.importToFlow(markup, TextConverter.TEXT_LAYOUT_FORMAT); + var flow_1:TextFlow = TextConverter.importToFlow(markup, TextConverter.TEXT_LAYOUT_FORMAT); flow_1.flowComposer = new StandardFlowComposer(); var container_1:Sprite = new Sprite(); var controller_1:ContainerController = new ContainerController(container_1, 300, 250); @@ -643,8 +695,7 @@ package UnitTest.Tests } //create the second text flow, import texts from markups, and assign flow composer to a container - var flow_2:TextFlow = new TextFlow(); - flow_2 = TextConverter.importToFlow(markup, TextConverter.TEXT_LAYOUT_FORMAT); + var flow_2:TextFlow = TextConverter.importToFlow(markup, TextConverter.TEXT_LAYOUT_FORMAT); flow_2.flowComposer = new StandardFlowComposer(); //Create EditManager to manage edting changes in TextFlow @@ -776,10 +827,8 @@ package UnitTest.Tests var tl2:TextLine = tfl2.getTextLine(); var bounds2:Rectangle = tl2.getAtomBounds(adjustedPosOfSelection2); - var mouseX:Number = 0; - var mouseY:Number = 0; - mouseX = bounds1.x; - mouseY = tl1.y; + var mouseX:Number = bounds1.x; + var mouseY:Number = tl1.y; // mouse down in first container editManager1.setFocus(); @@ -806,7 +855,6 @@ package UnitTest.Tests public function addRemoveMulitiLinkedContainerTest():void { var format:TextLayoutFormat = new TextLayoutFormat(); - format = new TextLayoutFormat(); format.paddingLeft = 20; format.paddingRight = 20; format.paddingTop = 20; @@ -1069,7 +1117,6 @@ package UnitTest.Tests var beforeLastVisibleLine3:int = beforePosition3[1]; var position3:int = textFlow.textLength - 1; - var pos_start_container3:int = controller1.textLength + controller2.textLength; if (TestData.id == "dragScrollingTest") { editManager.selectRange(position3 - 20, position3); @@ -1089,8 +1136,8 @@ package UnitTest.Tests } - [Test] - public function navigateByLineTest():void + [Test(dataProvider=navigateByLineTestDp)] + public function navigateByLineTest(testCaseVo:TestCaseVo):void { var textFlow:TextFlow = TextConverter.importToFlow(markup, TextConverter.TEXT_LAYOUT_FORMAT); textFlow.flowComposer = new StandardFlowComposer(); @@ -1126,22 +1173,22 @@ package UnitTest.Tests //try to use previousLine to get to first container and nextLine to get to third container var posSecondControllerBegin:int = controller2.absoluteStart; var posSecondControllerEnd:int = posSecondControllerBegin + controller2.textLength; - if (TestData.id == "navigateByPreviousLine") + if (testCaseVo.id == "navigateByPreviousLine") { //to get the selection range at beginning of second container then previousLine should go to the first container editManager.selectRange(posSecondControllerBegin, posSecondControllerBegin + 10); } - else if (TestData.id == "navigateByNextLine") + else if (testCaseVo.id == "navigateByNextLine") { //to get the selection range at end of second container then nextLine should go to the third container editManager.selectRange(posSecondControllerEnd - 10, posSecondControllerEnd); } var selRange:SelectionState = editManager.getSelectionState(); - if (TestData.id == "navigateByPreviousLine") + if (testCaseVo.id == "navigateByPreviousLine") { NavigationUtil.previousLine(selRange, true); } - else if (TestData.id == "navigateByNextLine") + else if (testCaseVo.id == "navigateByNextLine") { NavigationUtil.nextLine(selRange, true); }
