You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@flex.apache.org by pi...@apache.org on 2014/11/03 21:50:48 UTC

[06/44] git commit: [flex-tlf] [refs/heads/tables] - Add FactoryImportTest.as and FlowModelTest.as

Add FactoryImportTest.as and FlowModelTest.as


Project: http://git-wip-us.apache.org/repos/asf/flex-tlf/repo
Commit: http://git-wip-us.apache.org/repos/asf/flex-tlf/commit/7961f332
Tree: http://git-wip-us.apache.org/repos/asf/flex-tlf/tree/7961f332
Diff: http://git-wip-us.apache.org/repos/asf/flex-tlf/diff/7961f332

Branch: refs/heads/tables
Commit: 7961f3323e965e10bbff8947affddab8936c5f95
Parents: c105912
Author: piotrz <pi...@gmail.com>
Authored: Sun Oct 12 23:12:35 2014 +0200
Committer: piotrz <pi...@gmail.com>
Committed: Sun Oct 12 23:12:35 2014 +0200

----------------------------------------------------------------------
 automation_tests/src/AllTestsSuite.as           |    4 +
 automation_tests/src/MinimalTestsSuite.as       |    4 +-
 .../src/UnitTest/Tests/FactoryImportTest.as     |  250 +--
 .../src/UnitTest/Tests/FloatTest.as             |   84 -
 .../src/UnitTest/Tests/FlowModelTest.as         | 1920 +++++++++---------
 5 files changed, 1101 insertions(+), 1161 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/flex-tlf/blob/7961f332/automation_tests/src/AllTestsSuite.as
----------------------------------------------------------------------
diff --git a/automation_tests/src/AllTestsSuite.as b/automation_tests/src/AllTestsSuite.as
index a13ac01..f6f8045 100644
--- a/automation_tests/src/AllTestsSuite.as
+++ b/automation_tests/src/AllTestsSuite.as
@@ -33,7 +33,9 @@ package
     import UnitTest.Tests.CrossContainerTest;
     import UnitTest.Tests.ElementOperationTest;
     import UnitTest.Tests.EventOverrideTest;
+    import UnitTest.Tests.FactoryImportTest;
     import UnitTest.Tests.FloatTest;
+    import UnitTest.Tests.FlowModelTest;
     import UnitTest.Tests.OperationTest;
     import UnitTest.Tests.ScrollingTest;
 
@@ -41,6 +43,7 @@ package
     [RunWith("org.flexunit.runners.Suite")]
     public dynamic class AllTestsSuite
     {
+        public var factoryImportTest:FactoryImportTest;
         public var accessibilityMethodsTest:AccessibilityMethodsTest;
         public var allChartAttributeTest:AllCharAttributeTest;
         public var allContAttirbuteTest:AllContAttributeTest;
@@ -58,6 +61,7 @@ package
         public var crossContainerTest:CrossContainerTest;
         public var elementOperationTest:ElementOperationTest;
         public var eventOverrideTest:EventOverrideTest;
+        public var flowModelTest:FlowModelTest;
     }
 
 }

http://git-wip-us.apache.org/repos/asf/flex-tlf/blob/7961f332/automation_tests/src/MinimalTestsSuite.as
----------------------------------------------------------------------
diff --git a/automation_tests/src/MinimalTestsSuite.as b/automation_tests/src/MinimalTestsSuite.as
index 3122012..93ef569 100644
--- a/automation_tests/src/MinimalTestsSuite.as
+++ b/automation_tests/src/MinimalTestsSuite.as
@@ -19,13 +19,13 @@
 package
 {
 
-    import UnitTest.Tests.AccessibilityMethodsTest;
+    import UnitTest.Tests.FactoryImportTest;
 
     [Suite]
     [RunWith("org.flexunit.runners.Suite")]
     public dynamic class MinimalTestsSuite
     {
-        public var accessibilityMethodsTest:AccessibilityMethodsTest;
+        public var factoryImportTest:FactoryImportTest;
     }
 
 }

http://git-wip-us.apache.org/repos/asf/flex-tlf/blob/7961f332/automation_tests/src/UnitTest/Tests/FactoryImportTest.as
----------------------------------------------------------------------
diff --git a/automation_tests/src/UnitTest/Tests/FactoryImportTest.as b/automation_tests/src/UnitTest/Tests/FactoryImportTest.as
index 17e2220..b8bb3dc 100644
--- a/automation_tests/src/UnitTest/Tests/FactoryImportTest.as
+++ b/automation_tests/src/UnitTest/Tests/FactoryImportTest.as
@@ -18,132 +18,134 @@
 ////////////////////////////////////////////////////////////////////////////////
 package UnitTest.Tests
 {
-	import UnitTest.ExtendedClasses.TestSuiteExtended;
-	import UnitTest.ExtendedClasses.VellumTestCase;
-	import UnitTest.Fixtures.FileRepository;
-	import UnitTest.Fixtures.TestConfig;
-	
-	import flash.display.*;
-	import flash.geom.Rectangle;
-	import flash.text.engine.TextLine;
-	
-	import flashx.textLayout.conversion.ITextImporter;
-	import flashx.textLayout.conversion.TextConverter;
-	import flashx.textLayout.elements.FlowLeafElement;
-	import flashx.textLayout.elements.InlineGraphicElement;
-	import flashx.textLayout.elements.TextFlow;
-	import flashx.textLayout.factory.TextFlowTextLineFactory;
-	
-	import mx.containers.Canvas;
+    import UnitTest.ExtendedClasses.VellumTestCase;
+    import UnitTest.Fixtures.FileRepository;
+    import UnitTest.Fixtures.TestConfig;
 
-    import org.flexunit.asserts.fail;
+    import flash.display.*;
+    import flash.geom.Rectangle;
+    import flash.text.engine.TextLine;
+
+    import flashx.textLayout.conversion.ITextImporter;
+    import flashx.textLayout.conversion.TextConverter;
+    import flashx.textLayout.elements.FlowLeafElement;
+    import flashx.textLayout.elements.InlineGraphicElement;
+    import flashx.textLayout.elements.TextFlow;
+    import flashx.textLayout.factory.TextFlowTextLineFactory;
 
+    import mx.containers.Canvas;
+
+    import org.flexunit.asserts.fail;
 
     public class FactoryImportTest extends VellumTestCase
-	{
-		private var ItemsToRemove:Array;
-		private var TestCanvas:Canvas = null;
-		private var fileForFactory:String;
-		private var flowFromXML:TextFlow;
-
-		public function FactoryImportTest(fileToImport:String, testID:String, testConfig:TestConfig, testCaseXML:XML=null)
-		{
-			super ("doThis", testID, testConfig, testCaseXML);
-			containerType = "custom";
-			fileForFactory = fileToImport;
-
-			// Note: These must correspond to a Watson product area (case-sensitive)
-			metaData.productArea = "Import/Export";
-		}
-
-		public function doThis():void
-		{
-			var xmlRoot:XML = FileRepository.getFileAsXML(baseURL,"../../test/testFiles/markup/tlf/" + fileForFactory);
-			if (!xmlRoot)
-			{
-				fail("File not loaded -- timeout?");
-				return;
-			}
-			var parser:ITextImporter = testDataImportParser;
-			flowFromXML = parser.importToFlow(xmlRoot);
-			processInlines(flowFromXML);
-			buildVellumFactory();
-			//TestCanvas.rawChildren.addChild(_rslt);
-		}
-
-		public static function suiteFromXML(testListXML:XML, testConfig:TestConfig, ts:TestSuiteExtended):void
- 		{
- 			var testCaseClass:Class = FactoryImportTest;
- 			VellumTestCase.suiteFromXML(testCaseClass, testListXML, testConfig, ts);
- 		}
-
-		override public function setUpTest() : void
-		{
-			cleanUpTestApp();
-			ItemsToRemove = [];
-			TestDisplayObject = testApp.getDisplayObject();
-			if (TestDisplayObject)
-			{
-				TestCanvas = Canvas(TestDisplayObject);
-			}
-			else
-			{
-				fail ("Did not get a blank canvas to work with");
-			}
-		}
-
-		private static function getExtension(fileName:String):String
-		{
-			var dotPos:int = fileName.lastIndexOf(".");
-			if (dotPos >= 0)
-				return fileName.substring(dotPos + 1);
-			return fileName;
-		}
-
-		protected function get testDataImportParser():ITextImporter
-		{
-			var extension:String = getExtension(fileForFactory);
-			if (extension == "xml")
-				extension = TextConverter.TEXT_LAYOUT_FORMAT;
-			else if (extension == "txt")
-				extension = TextConverter.PLAIN_TEXT_FORMAT;
-			return TextConverter.getImporter(extension);
-		}
-		
-		private function processInlines(textFlow:TextFlow):void
-		{
-			for (var leaf:FlowLeafElement = textFlow.getFirstLeaf(); leaf; leaf = leaf.getNextLeaf())
-			{
-				if (leaf is InlineGraphicElement /* && InlineGraphicElement(leaf).source == null */)
-				{
-					var ilg:InlineGraphicElement = InlineGraphicElement(leaf);
-
-					// Create a filler inline, simple filled rect
-					var displayObject:Sprite = new Sprite();
-					var g:Graphics = displayObject.graphics;
-					g.beginFill(0xFF0000);
-					g.drawRect(0, 0, Number(ilg.width), Number(ilg.height));
-					g.endFill();
-					ilg.source = displayObject;
-				}
-			}
-		}
-
-		public function callback(dispObj:DisplayObject):void
-		{
-			TestCanvas.rawChildren.addChild(dispObj);
-
-			if(dispObj is TextLine)
-			{
-				ItemsToRemove.push (dispObj as TextLine);
-			}
-		}
-		/** use the vellum factory via the callback */
-		public function buildVellumFactory():void //DisplayObject
-		{
-			var factory:TextFlowTextLineFactory = new TextFlowTextLineFactory();
-			factory.compositionBounds = new Rectangle(0, 0, TestCanvas.width, TestCanvas.height);
-			factory.createTextLines(callback,flowFromXML);
-		}
-	}
+    {
+        private var ItemsToRemove:Array;
+        private var TestCanvas:Canvas = null;
+        private var fileForFactory:String;
+        private var flowFromXML:TextFlow;
+
+        public function FactoryImportTest()
+        {
+            super("", "EventOverrideTest", TestConfig.getInstance());
+
+            containerType = "custom";
+            fileForFactory = "simple.xml";
+
+            metaData = {};
+            // Note: These must correspond to a Watson product area (case-sensitive)
+            metaData.productArea = "Import/Export";
+        }
+
+        [Before]
+        override public function setUpTest():void
+        {
+            cleanUpTestApp();
+            ItemsToRemove = [];
+            TestDisplayObject = testApp.getDisplayObject();
+            if (TestDisplayObject)
+            {
+                TestCanvas = Canvas(TestDisplayObject);
+            }
+            else
+            {
+                fail("Did not get a blank canvas to work with");
+            }
+        }
+
+        [After]
+        override public function tearDownTest():void
+        {
+            super.tearDownTest();
+        }
+
+        [Test]
+        public function importTest():void
+        {
+            var xmlRoot:XML = FileRepository.getFileAsXML(baseURL, "../../test/testFiles/markup/tlf/" + fileForFactory);
+            if (!xmlRoot)
+            {
+                fail("File not loaded -- timeout?");
+                return;
+            }
+            var parser:ITextImporter = testDataImportParser;
+            flowFromXML = parser.importToFlow(xmlRoot);
+            processInlines(flowFromXML);
+            buildVellumFactory();
+        }
+
+        private static function getExtension(fileName:String):String
+        {
+            var dotPos:int = fileName.lastIndexOf(".");
+            if (dotPos >= 0)
+                return fileName.substring(dotPos + 1);
+            return fileName;
+        }
+
+        protected function get testDataImportParser():ITextImporter
+        {
+            var extension:String = getExtension(fileForFactory);
+            if (extension == "xml")
+                extension = TextConverter.TEXT_LAYOUT_FORMAT;
+            else if (extension == "txt")
+                extension = TextConverter.PLAIN_TEXT_FORMAT;
+            return TextConverter.getImporter(extension);
+        }
+
+        private function processInlines(textFlow:TextFlow):void
+        {
+            for (var leaf:FlowLeafElement = textFlow.getFirstLeaf(); leaf; leaf = leaf.getNextLeaf())
+            {
+                if (leaf is InlineGraphicElement /* && InlineGraphicElement(leaf).source == null */)
+                {
+                    var ilg:InlineGraphicElement = InlineGraphicElement(leaf);
+
+                    // Create a filler inline, simple filled rect
+                    var displayObject:Sprite = new Sprite();
+                    var g:Graphics = displayObject.graphics;
+                    g.beginFill(0xFF0000);
+                    g.drawRect(0, 0, Number(ilg.width), Number(ilg.height));
+                    g.endFill();
+                    ilg.source = displayObject;
+                }
+            }
+        }
+
+        private function callback(dispObj:DisplayObject):void
+        {
+            TestCanvas.rawChildren.addChild(dispObj);
+
+            if (dispObj is TextLine)
+            {
+                ItemsToRemove.push(dispObj as TextLine);
+            }
+        }
+
+        /** use the vellum factory via the callback */
+        private function buildVellumFactory():void //DisplayObject
+        {
+            var factory:TextFlowTextLineFactory = new TextFlowTextLineFactory();
+            factory.compositionBounds = new Rectangle(0, 0, TestCanvas.width, TestCanvas.height);
+            factory.createTextLines(callback, flowFromXML);
+        }
+    }
 }

http://git-wip-us.apache.org/repos/asf/flex-tlf/blob/7961f332/automation_tests/src/UnitTest/Tests/FloatTest.as
----------------------------------------------------------------------
diff --git a/automation_tests/src/UnitTest/Tests/FloatTest.as b/automation_tests/src/UnitTest/Tests/FloatTest.as
index da7a19a..2f105a6 100644
--- a/automation_tests/src/UnitTest/Tests/FloatTest.as
+++ b/automation_tests/src/UnitTest/Tests/FloatTest.as
@@ -104,90 +104,6 @@ package UnitTest.Tests
             _floatColor = 0xFF0000;
         }
 
-        /*
-         public static function suite(testConfig:TestConfig, ts:TestSuiteExtended):void
-         {
-         addTestCase(ts, testConfig, "atFlowStart");
-         addTestCase(ts, testConfig, "atFlowStartSpaceBefore");
-         addTestCase(ts, testConfig, "atParagraphStart");
-         addTestCase(ts, testConfig, "atParagraphStartSpaceBefore");
-         addTestCase(ts, testConfig, "atParagraphEnd");
-         addTestCase(ts, testConfig, "atLineStart");
-         addTestCase(ts, testConfig, "atLineMiddle");
-         addTestCase(ts, testConfig, "atLineEnd");
-         addTestCase(ts, testConfig, "stackedFloats");
-         addTestCase(ts, testConfig, "onTwoSidesSameLine");
-         addTestCase(ts, testConfig, "onTwoSidesSuccessiveLines");
-         ts.addTestDescriptor (new TestDescriptor (FloatTest,"fillsColumn", testConfig, null) );
-         ts.addTestDescriptor (new TestDescriptor (FloatTest,"noEmergencyBreakByFloat", testConfig, null) );
-         ts.addTestDescriptor (new TestDescriptor (FloatTest,"fillsColumnRecursion", testConfig, null) );
-         ts.addTestDescriptor (new TestDescriptor (FloatTest,"widerThanColumn", testConfig, null) );
-         ts.addTestDescriptor (new TestDescriptor (FloatTest,"widerThanColumnScroll", testConfig, null) );
-         ts.addTestDescriptor (new TestDescriptor (FloatTest,"contentHeightCheck", testConfig, null) );
-         ts.addTestDescriptor (new TestDescriptor (FloatTest,"noFloatsWithMeasureOrExplicit", testConfig, null) );
-         ts.addTestDescriptor (new TestDescriptor (FloatTest,"floatOnly", testConfig, null) );
-         ts.addTestDescriptor (new TestDescriptor (FloatTest,"noVJ", testConfig, null) );
-         ts.addTestDescriptor (new TestDescriptor (FloatTest,"verticalAlignMiddleFloatAtEnd", testConfig, null) );
-         ts.addTestDescriptor (new TestDescriptor (FloatTest,"verticalAlignMiddleTextAtEnd", testConfig, null) );
-         ts.addTestDescriptor (new TestDescriptor (FloatTest,"verticalAlignBottomFloatAtEnd", testConfig, null) );
-         ts.addTestDescriptor (new TestDescriptor (FloatTest,"verticalAlignBottomTextAtEnd", testConfig, null) );
-         ts.addTestDescriptor (new TestDescriptor (FloatTest,"verticalAlignBottomFloat2636122", testConfig, null) );
-         ts.addTestDescriptor (new TestDescriptor (FloatTest,"textAlignRightAtStart", testConfig, null) );
-         ts.addTestDescriptor (new TestDescriptor (FloatTest,"textAlignRightInMiddle", testConfig, null) );
-         ts.addTestDescriptor (new TestDescriptor (FloatTest,"leftIndent", testConfig, null) );
-         ts.addTestDescriptor (new TestDescriptor (FloatTest,"rightIndent", testConfig, null) );
-         ts.addTestDescriptor (new TestDescriptor (FloatTest,"leftBigIndent", testConfig, null) );
-         ts.addTestDescriptor (new TestDescriptor (FloatTest,"rightBigIndent", testConfig, null) );
-         ts.addTestDescriptor (new TestDescriptor (FloatTest,"clearOneAll", testConfig, null) );
-         ts.addTestDescriptor (new TestDescriptor (FloatTest,"clearTwoAll", testConfig, null) );
-         ts.addTestDescriptor (new TestDescriptor (FloatTest,"paddingAndMargins", testConfig, null) );
-         ts.addTestDescriptor (new TestDescriptor (FloatTest,"negativePaddingAndMargins", testConfig, null) );
-         ts.addTestDescriptor (new TestDescriptor (FloatTest,"rightIndentWithTab", testConfig, null) );
-         ts.addTestDescriptor (new TestDescriptor (FloatTest,"leftIndentWithTab", testConfig, null) );
-         ts.addTestDescriptor (new TestDescriptor (FloatTest,"hoistFailure", testConfig, null) );
-         ts.addTestDescriptor (new TestDescriptor (FloatTest,"clearNoPrecedingFloatAll", testConfig, null) );
-         ts.addTestDescriptor (new TestDescriptor (FloatTest,"stackedLeftFloats", testConfig, null) );
-         ts.addTestDescriptor (new TestDescriptor (FloatTest,"stackedRightFloats", testConfig, null) );
-         ts.addTestDescriptor (new TestDescriptor (FloatTest,"smallFloatBigText", testConfig, null) );
-         ts.addTestDescriptor (new TestDescriptor (FloatTest,"lineHeightIgnoredOnFloatingImages", testConfig, null) );
-         ts.addTestDescriptor (new TestDescriptor (FloatTest,"convertFloatToInline", testConfig, null) );
-         ts.addTestDescriptor (new TestDescriptor (FloatTest,"cursorByAnchor", testConfig, null) );
-         ts.addTestDescriptor (new TestDescriptor (FloatTest,"insertTextBeforeFloat", testConfig, null) );
-         ts.addTestDescriptor (new TestDescriptor (FloatTest,"atControllerEnd", testConfig, null) );
-         ts.addTestDescriptor (new TestDescriptor (FloatTest,"resizeControllerWithFloats", testConfig, null) );
-         ts.addTestDescriptor (new TestDescriptor (FloatTest,"textIndentAfterFloat", testConfig, null) );
-         ts.addTestDescriptor (new TestDescriptor (FloatTest,"composeAcrossControllers", testConfig, null) );
-         ts.addTestDescriptor (new TestDescriptor (FloatTest,"deleteAtStart", testConfig, null) );
-         ts.addTestDescriptor (new TestDescriptor (FloatTest,"measureWidth", testConfig, null) );
-         ts.addTestDescriptor (new TestDescriptor (FloatTest,"inlineWideAndFloat", testConfig, null) );
-         ts.addTestDescriptor (new TestDescriptor (FloatTest,"narrowColumnFloat", testConfig, null) );
-         ts.addTestDescriptor (new TestDescriptor (FloatTest,"infiniteLoop2769562", testConfig, null) );
-         ts.addTestDescriptor (new TestDescriptor (FloatTest, "verticalAlignInline", testConfig, null) );
-         ts.addTestDescriptor (new TestDescriptor (FloatTest, "pasteManyFloatsWithLoading", testConfig, null) );
-         ts.addTestDescriptor (new TestDescriptor (FloatTest,"contentBoundsWithFactoryComposition", testConfig, null) );
-         // We only need one version of these tests
-         if (testConfig.writingDirection[0] == BlockProgression.TB && testConfig.writingDirection[1] == Direction.LTR)
-         {
-         ts.addTestDescriptor (new TestDescriptor (FloatTest,"inlineAndFloat", testConfig, null) );
-         ts.addTestDescriptor (new TestDescriptor (FloatTest,"htmlImportTest", testConfig, null) );
-         ts.addTestDescriptor (new TestDescriptor (FloatTest,"overFlowAtStart", testConfig, null) );
-         ts.addTestDescriptor (new TestDescriptor (FloatTest,"caretOnEmptyInlineGraphic", testConfig, null) );
-         ts.addTestDescriptor (new TestDescriptor (FloatTest,"restartComposeFromStart", testConfig, null) );
-         ts.addTestDescriptor (new TestDescriptor (FloatTest,"convertInlineToFloat", testConfig, null) );
-
-         }
-         }
-
-         private static function addTestCase(ts:TestSuiteExtended, testConfig:TestConfig, methodName:String):void
-         {
-         //ts.addTestDescriptor (new TestDescriptor (MeasurementGridTest,methodName, testConfig, creationType, measureType, lineBreak) );
-         var testXML:XML = <TestCase>
-         <TestData name="methodName">{methodName}</TestData>
-         <TestData name="id">{methodName}</TestData>
-         </TestCase>;
-
-         ts.addTestDescriptor (new TestDescriptor (FloatTest,"callTestMethod", testConfig, testXML) );
-         }    */
         [BeforeClass]
         public static function setUpClass():void
         {