flex-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From pio...@apache.org
Subject [1/2] git commit: [flex-tlf] [refs/heads/develop] - FLEX-34876 - Add unit test which reproducing the issue
Date Thu, 04 Jun 2015 08:59:13 GMT
Repository: flex-tlf
Updated Branches:
  refs/heads/develop e86e835a3 -> 9a20994bc


FLEX-34876 - Add unit test which reproducing the issue


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

Branch: refs/heads/develop
Commit: f4a26bde30af9572b0b3effea580652c92629f20
Parents: 8046398
Author: piotrz <piotrzarzycki21@gmail.com>
Authored: Thu Jun 4 10:58:33 2015 +0200
Committer: piotrz <piotrzarzycki21@gmail.com>
Committed: Thu Jun 4 10:58:33 2015 +0200

----------------------------------------------------------------------
 automation_tests/src/AllTestsSuite.as           |   2 +
 .../PasteWithMutliParagraph_FLEX_34876_Test.as  | 113 +++++++++++++++++++
 2 files changed, 115 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/flex-tlf/blob/f4a26bde/automation_tests/src/AllTestsSuite.as
----------------------------------------------------------------------
diff --git a/automation_tests/src/AllTestsSuite.as b/automation_tests/src/AllTestsSuite.as
index 933cb2c..8843dc1 100644
--- a/automation_tests/src/AllTestsSuite.as
+++ b/automation_tests/src/AllTestsSuite.as
@@ -48,6 +48,7 @@ package
     import UnitTest.Tests.MeasurementTest;
     import UnitTest.Tests.OperationTest;
     import UnitTest.Tests.ParagraphTest;
+    import UnitTest.Tests.PasteWithMutliParagraph_FLEX_34876_Test;
     import UnitTest.Tests.ScrollToRangeTest;
     import UnitTest.Tests.ScrollingTest;
     import UnitTest.Tests.SelectionTest;
@@ -110,6 +111,7 @@ package
         public var measurementTest:MeasurementTest;
         public var leadingTest:LeadingTest;
         public var scrollToRangeTest:ScrollToRangeTest;
+        public var pasteWithMultiParagraph:PasteWithMutliParagraph_FLEX_34876_Test;
     }
 
 }

http://git-wip-us.apache.org/repos/asf/flex-tlf/blob/f4a26bde/automation_tests/src/UnitTest/Tests/PasteWithMutliParagraph_FLEX_34876_Test.as
----------------------------------------------------------------------
diff --git a/automation_tests/src/UnitTest/Tests/PasteWithMutliParagraph_FLEX_34876_Test.as
b/automation_tests/src/UnitTest/Tests/PasteWithMutliParagraph_FLEX_34876_Test.as
new file mode 100644
index 0000000..e17ed4d
--- /dev/null
+++ b/automation_tests/src/UnitTest/Tests/PasteWithMutliParagraph_FLEX_34876_Test.as
@@ -0,0 +1,113 @@
+////////////////////////////////////////////////////////////////////////////////
+//
+//  Licensed to the Apache Software Foundation (ASF) under one or more
+//  contributor license agreements.  See the NOTICE file distributed with
+//  this work for additional information regarding copyright ownership.
+//  The ASF licenses this file to You under the Apache License, Version 2.0
+//  (the "License"); you may not use this file except in compliance with
+//  the License.  You may obtain a copy of the License at
+//
+//      http://www.apache.org/licenses/LICENSE-2.0
+//
+//  Unless required by applicable law or agreed to in writing, software
+//  distributed under the License is distributed on an "AS IS" BASIS,
+//  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+//  See the License for the specific language governing permissions and
+//  limitations under the License.
+//
+////////////////////////////////////////////////////////////////////////////////
+package UnitTest.Tests
+{
+    import UnitTest.ExtendedClasses.VellumTestCase;
+    import UnitTest.Fixtures.TestConfig;
+
+    import flash.text.engine.ContentElement;
+    import flash.text.engine.ElementFormat;
+    import flash.text.engine.TextBlock;
+    import flash.text.engine.TextLine;
+
+    import flashx.textLayout.compose.TextFlowLine;
+    import flashx.textLayout.conversion.TextConverter;
+    import flashx.textLayout.edit.EditManager;
+    import flashx.textLayout.edit.TextClipboard;
+    import flashx.textLayout.edit.TextScrap;
+    import flashx.textLayout.elements.ParagraphElement;
+    import flashx.textLayout.elements.SpanElement;
+    import flashx.textLayout.elements.TextFlow;
+    import flashx.textLayout.tlf_internal;
+
+    import org.flexunit.asserts.assertTrue;
+
+    use namespace tlf_internal;
+
+    [TestCase(order=44)]
+    public class PasteWithMutliParagraph_FLEX_34876_Test extends VellumTestCase
+    {
+        private const inputString:String = "line 1\nline 2\nline 3\nline 4\nline 5";
+        private const spanColor:uint = 0xFF0000;
+        private const spanFontSize:int = 20;
+
+        public function PasteWithMutliParagraph_FLEX_34876_Test()
+        {
+            super("", "PasteWithMutliParagraph_FLEX_34876_Test", TestConfig.getInstance());
+
+            metaData = {};
+        }
+
+        [Before]
+        override public function setUpTest():void
+        {
+            super.setUpTest();
+        }
+
+        [After]
+        public override function tearDownTest():void
+        {
+             super.tearDownTest();
+        }
+
+        [Test]
+        public function multiLinePasteElementFormatCheckTest():void
+        {
+            reproduceIssueFlex_34876();
+
+            var textFlowNumLines:int = SelManager.textFlow.flowComposer.numLines;
+            var textFlowLine:TextFlowLine = null;
+            var textLine:TextLine = null;
+            var textBlock:TextBlock = null;
+            var contentElement:ContentElement = null;
+            var elementFormat:ElementFormat = null;
+
+            for (var i:int = 0; i < textFlowNumLines; i++)
+            {
+                textFlowLine = SelManager.textFlow.flowComposer.getLineAt(i);
+                textLine = textFlowLine.getTextLine();
+                textBlock = textLine.textBlock;
+                contentElement = textBlock.content;
+                elementFormat = contentElement.elementFormat;
+
+                assertTrue("Text color for TextFlowLine was not applied correctly", elementFormat.color
== spanColor);
+                assertTrue("Font size for TextFlowLine was not applied correctly", elementFormat.fontSize
== spanFontSize);
+            }
+        }
+
+        private function reproduceIssueFlex_34876():void
+        {
+            setUpFlowForTest(new TextFlow());
+
+            var para:ParagraphElement = new ParagraphElement();
+            var span:SpanElement = new SpanElement();
+            span.color = spanColor;
+            span.fontSize = spanFontSize;
+
+            para.addChild(span);
+            SelManager.textFlow.addChild(para);
+            (SelManager.textFlow.interactionManager as EditManager).selectAll();
+
+            var multiLineScrap:TextScrap = TextClipboard.importToScrap(inputString, TextConverter.PLAIN_TEXT_FORMAT);
+
+            (SelManager.textFlow.interactionManager as EditManager).pasteTextScrap(multiLineScrap);
+
+        }
+    }
+}


Mime
View raw message