You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@royale.apache.org by gr...@apache.org on 2019/05/04 08:51:08 UTC

[royale-asjs] 03/03: almost forgot updated tests

This is an automated email from the ASF dual-hosted git repository.

gregdove pushed a commit to branch improvements/Language
in repository https://gitbox.apache.org/repos/asf/royale-asjs.git

commit 34abd8682973b1188125451bc357bd9b45fcbbaa
Author: greg-dove <gr...@gmail.com>
AuthorDate: Sat May 4 19:46:40 2019 +1200

    almost forgot updated tests
---
 .../royale/org/apache/royale/utils/Language.as     |  1 -
 .../UnitTests/src/main/royale/MyInitialView.mxml   |  4 ++
 .../royale/flexUnitTests/core/ArrayTesterTest.as   |  1 +
 .../royale/flexUnitTests/core/support/TestVO.as    | 64 +++++++++-----------
 .../flexUnitTests/github/GithubIssues2018.as       | 70 ++++++++++++++++++++++
 .../flexUnitTests/github/GithubIssues2019.as       | 65 ++++++++++++++++++++
 .../flexUnitTests/language/support/TestClass5.as   | 52 +++++-----------
 7 files changed, 184 insertions(+), 73 deletions(-)

diff --git a/frameworks/projects/Language/src/main/royale/org/apache/royale/utils/Language.as b/frameworks/projects/Language/src/main/royale/org/apache/royale/utils/Language.as
index 8f2298b..a7d8c19 100644
--- a/frameworks/projects/Language/src/main/royale/org/apache/royale/utils/Language.as
+++ b/frameworks/projects/Language/src/main/royale/org/apache/royale/utils/Language.as
@@ -672,7 +672,6 @@ class VectorSupport {
     /**
      *
      * @royaleignorecoercion Function
-     * @royalesuppressvectorindexcheck
      */
     public static function vectorElementCoercion(elementType:String, synthVectorClass:Object ):Function{
         if (synthVectorClass[VectorSupport.COERCE_ELEMENT]) return synthVectorClass[VectorSupport.COERCE_ELEMENT] as Function;
diff --git a/manualtests/UnitTests/src/main/royale/MyInitialView.mxml b/manualtests/UnitTests/src/main/royale/MyInitialView.mxml
index 8f72540..d927fe5 100644
--- a/manualtests/UnitTests/src/main/royale/MyInitialView.mxml
+++ b/manualtests/UnitTests/src/main/royale/MyInitialView.mxml
@@ -32,6 +32,10 @@ limitations under the License.
 		.body {
 			left:10px;
 			right:10px;
+			font-family: sans-serif;
+		}
+		.royale .Label {
+			white-space: pre-wrap !important;
 		}
 	</fx:Style>
 
diff --git a/manualtests/UnitTests/src/main/royale/flexUnitTests/core/ArrayTesterTest.as b/manualtests/UnitTests/src/main/royale/flexUnitTests/core/ArrayTesterTest.as
index ca42188..d038de6 100644
--- a/manualtests/UnitTests/src/main/royale/flexUnitTests/core/ArrayTesterTest.as
+++ b/manualtests/UnitTests/src/main/royale/flexUnitTests/core/ArrayTesterTest.as
@@ -135,6 +135,7 @@ package flexUnitTests.core
         [Test]
         public function testSortOn():void
         {
+            Assert.assertTrue("Parked, needs more work", true);
             
            /* Assert.assertEquals('unexpected starting state', 
                     'TestVO [aB]#0 [zz],TestVO [aA]#0 [aa],TestVO [aC]#1 [zz],TestVO [aa]#1 [aa],TestVO [ab]#-1 [zz],TestVO [ac]#-1 [aa],TestVO [zA]#0 [bb],TestVO [ZA]#0 [aa],TestVO [zA]#1 [bb],TestVO [ZA]#1 [aa],TestVO [zA]#-1 [bb],TestVO [zA]#-1 [aa],TestVO [AA]#0 [aa],TestVO [AA]#0 [zz]',
diff --git a/frameworks/projects/Core/src/main/royale/Vector.as b/manualtests/UnitTests/src/main/royale/flexUnitTests/core/support/TestVO.as
similarity index 55%
copy from frameworks/projects/Core/src/main/royale/Vector.as
copy to manualtests/UnitTests/src/main/royale/flexUnitTests/core/support/TestVO.as
index 8e307c7..9dd3244 100644
--- a/frameworks/projects/Core/src/main/royale/Vector.as
+++ b/manualtests/UnitTests/src/main/royale/flexUnitTests/core/support/TestVO.as
@@ -16,40 +16,32 @@
 //  limitations under the License.
 //
 ////////////////////////////////////////////////////////////////////////////////
-package {
-	public class Vector extends Array{
-		
-		private static var _staticInit:Boolean;
-		
-		private static function _init():void{
-			
-			var proto:Object = {
-			
-			}
-			
-			Vector['prototype'] = Array['protoype'];
-			_staticInit = true;
-		}
-		
-		public function Vector(initialValues:Array, type:String, fixed:Boolean) {
-			if (!_staticInit) _init();
-		}
-		
-	}
-	
-	
-	/*class Vector$Int extends Vector {
-	
-	
-	}
-	
-	class Vector$Uint extends Vector {
-	
-	
-	}
-	
-	class Vector$Number extends Vector {
-	
-	
-	}*/
+package flexUnitTests.core.support
+{
+    import org.apache.royale.events.EventDispatcher;
+    
+    [Bindable]
+    public class TestVO extends EventDispatcher
+    {
+        public function TestVO(field1:String, field2:int, field3:String)
+        {
+            this.field1 = field1;
+            this.field2 = field2;
+            this.field3 = field3;
+        }
+        
+        public var field1:String = '';
+        public var field2:int = 0;
+        public var field3:String = '';
+        
+        COMPILE::SWF
+        override public function toString():String{
+            return 'TestVO ['+field1+']#'+field2+' ['+field3+']';
+        }
+    
+        COMPILE::JS
+        public function toString():String{
+            return 'TestVO ['+field1+']#'+field2+' ['+field3+']';
+        }
+    }
 }
diff --git a/manualtests/UnitTests/src/main/royale/flexUnitTests/github/GithubIssues2018.as b/manualtests/UnitTests/src/main/royale/flexUnitTests/github/GithubIssues2018.as
new file mode 100644
index 0000000..f9cb7b3
--- /dev/null
+++ b/manualtests/UnitTests/src/main/royale/flexUnitTests/github/GithubIssues2018.as
@@ -0,0 +1,70 @@
+////////////////////////////////////////////////////////////////////////////////
+//
+//  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 flexUnitTests.github
+{
+    import flexunit.framework.Assert;
+    
+    /**
+     * @royalesuppresspublicvarwarning
+     */
+    public class GithubIssues2018
+    {
+        public static var isJS:Boolean;
+    
+        [BeforeClass]
+        public static function setUpBeforeClass():void
+        {
+            isJS = COMPILE::JS;
+        }
+        
+        [AfterClass]
+        public static function tearDownAfterClass():void
+        {
+        }
+        
+        
+        [Before]
+        public function setUp():void
+        {
+        }
+        
+        [After]
+        public function tearDown():void
+        {
+        }
+        
+        
+       
+        //example, postfix the test method with issue reference:
+        [Test]
+        public function testIssue_273():void
+        {
+            //https://github.com/apache/royale-asjs/issues/273
+            var a:Object = { a: int, b:uint, c:int, d:uint };
+            
+            //int
+            var test:* = new (Class(a.a))(-21.5);
+            Assert.assertEquals('unexpected coercion check', -21, test);
+            //uint
+            test = new (a.b as Class)(-21.5);
+            Assert.assertEquals('unexpected coercion check', 4294967275, test);
+
+        }
+    }
+}
diff --git a/manualtests/UnitTests/src/main/royale/flexUnitTests/github/GithubIssues2019.as b/manualtests/UnitTests/src/main/royale/flexUnitTests/github/GithubIssues2019.as
new file mode 100644
index 0000000..8ae9640
--- /dev/null
+++ b/manualtests/UnitTests/src/main/royale/flexUnitTests/github/GithubIssues2019.as
@@ -0,0 +1,65 @@
+////////////////////////////////////////////////////////////////////////////////
+//
+//  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 flexUnitTests.github
+{
+    import flexunit.framework.Assert;
+    
+    /**
+     * @royalesuppresspublicvarwarning
+     */
+    public class GithubIssues2019
+    {
+        public static var isJS:Boolean;
+        
+        [BeforeClass]
+        public static function setUpBeforeClass():void
+        {
+            isJS = COMPILE::JS;
+        }
+        
+        [AfterClass]
+        public static function tearDownAfterClass():void
+        {
+        }
+        
+        
+        [Before]
+        public function setUp():void
+        {
+        }
+        
+        [After]
+        public function tearDown():void
+        {
+        }
+        
+        
+        /*
+		// TEST METHODS
+		*/
+    
+        //example, postfix the test method with issue reference:
+        [Test]
+        public function placeholdertestIssue_999():void
+        {
+            //https://github.com/apache/royale-asjs/issues/#
+            Assert.assertTrue('replace me with a real issue', true)
+        }
+    }
+}
diff --git a/frameworks/projects/Core/src/main/royale/Vector.as b/manualtests/UnitTests/src/main/royale/flexUnitTests/language/support/TestClass5.as
similarity index 65%
rename from frameworks/projects/Core/src/main/royale/Vector.as
rename to manualtests/UnitTests/src/main/royale/flexUnitTests/language/support/TestClass5.as
index 8e307c7..e1d8ec1 100644
--- a/frameworks/projects/Core/src/main/royale/Vector.as
+++ b/manualtests/UnitTests/src/main/royale/flexUnitTests/language/support/TestClass5.as
@@ -16,40 +16,20 @@
 //  limitations under the License.
 //
 ////////////////////////////////////////////////////////////////////////////////
-package {
-	public class Vector extends Array{
-		
-		private static var _staticInit:Boolean;
-		
-		private static function _init():void{
-			
-			var proto:Object = {
-			
-			}
-			
-			Vector['prototype'] = Array['protoype'];
-			_staticInit = true;
-		}
-		
-		public function Vector(initialValues:Array, type:String, fixed:Boolean) {
-			if (!_staticInit) _init();
-		}
-		
-	}
-	
-	
-	/*class Vector$Int extends Vector {
-	
-	
-	}
-	
-	class Vector$Uint extends Vector {
-	
-	
-	}
-	
-	class Vector$Number extends Vector {
-	
-	
-	}*/
+package flexUnitTests.language.support
+{
+    
+    
+    public class TestClass5
+    {
+        //Note: do not change this test class unless you change the related tests to
+        //support any changes that might appear when testing reflection into it
+        
+        public function TestClass5()
+        {
+        
+        }
+        
+        
+    }
 }