You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@flex.apache.org by mi...@apache.org on 2015/07/24 20:08:53 UTC

[1/3] git commit: [flex-sdk] [refs/heads/develop] - FLEX-34854 Changes while investigating a mustella failure (probably) introduced by the changes to this ticket: added a new unit test, corrections to comments, optimizing object initializations and remov

Repository: flex-sdk
Updated Branches:
  refs/heads/develop a722cf981 -> e32044cdb


FLEX-34854
Changes while investigating a mustella failure (probably) introduced by the changes to this ticket: added a new unit test, corrections to comments, optimizing object initializations and removing unused variables.


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

Branch: refs/heads/develop
Commit: 390e65958eb340fa42f9ccc8fece419fd88639bd
Parents: a722cf9
Author: Mihai Chira <mi...@apache.org>
Authored: Fri Jul 24 11:23:03 2015 +0200
Committer: Mihai Chira <mi...@apache.org>
Committed: Fri Jul 24 11:23:03 2015 +0200

----------------------------------------------------------------------
 .../projects/framework/tests/SortField_Tests.as | 22 ------------
 .../tests/spark/skins/spark/SortField_Tests.as  | 37 ++++++++++++++++++++
 .../as3/src/mustella/ExcludeFileLocation.as     |  7 +---
 .../as3/src/mustella/IncludeFileLocation.as     |  2 +-
 .../as3/src/mustella/IncludeListTextFile.as     |  2 +-
 mustella/as3/src/mustella/TestCase.as           |  2 +-
 6 files changed, 41 insertions(+), 31 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/flex-sdk/blob/390e6595/frameworks/projects/framework/tests/SortField_Tests.as
----------------------------------------------------------------------
diff --git a/frameworks/projects/framework/tests/SortField_Tests.as b/frameworks/projects/framework/tests/SortField_Tests.as
deleted file mode 100644
index 3cd3871..0000000
--- a/frameworks/projects/framework/tests/SortField_Tests.as
+++ /dev/null
@@ -1,22 +0,0 @@
-package {
-    import mx.collections.SortField;
-
-    import org.flexunit.asserts.assertFalse;
-
-    public class SortField_Tests {
-        private var _sut:SortField;
-
-        [Test]
-        public function fix_mustella_failure_due_to_FLEX_34852():void
-        {
-            //given
-            _sut = new SortField("someField");
-
-            //when
-            var emptyObjectHasASortField:Boolean = _sut.objectHasSortField({});
-
-            //then
-            assertFalse(emptyObjectHasASortField);
-        }
-    }
-}

http://git-wip-us.apache.org/repos/asf/flex-sdk/blob/390e6595/frameworks/projects/spark/tests/spark/skins/spark/SortField_Tests.as
----------------------------------------------------------------------
diff --git a/frameworks/projects/spark/tests/spark/skins/spark/SortField_Tests.as b/frameworks/projects/spark/tests/spark/skins/spark/SortField_Tests.as
new file mode 100644
index 0000000..1c5824f
--- /dev/null
+++ b/frameworks/projects/spark/tests/spark/skins/spark/SortField_Tests.as
@@ -0,0 +1,37 @@
+package spark.skins.spark {
+    import org.flexunit.asserts.assertEquals;
+    import org.flexunit.asserts.assertFalse;
+
+    import spark.collections.SortField;
+
+    public class SortField_Tests {
+        private var _sut:SortField;
+
+        [Test]
+        public function fix_mustella_failure_due_to_FLEX_34852():void
+        {
+            //given
+            _sut = new SortField("someField");
+
+            //when
+            const emptyObject:Object = {};
+            var emptyObjectHasASortField:Boolean = _sut.objectHasSortField(emptyObject);
+
+            //then
+            assertFalse(emptyObjectHasASortField);
+        }
+
+        [Test]
+        public function locale_setting_and_retrieving_work():void
+        {
+            //given
+            _sut = new SortField("someField");
+
+            //when
+            _sut.setStyle("locale", "ru-RU");
+
+            //then
+            assertEquals("ru-RU", _sut.getStyle("locale"));
+        }
+    }
+}

http://git-wip-us.apache.org/repos/asf/flex-sdk/blob/390e6595/mustella/as3/src/mustella/ExcludeFileLocation.as
----------------------------------------------------------------------
diff --git a/mustella/as3/src/mustella/ExcludeFileLocation.as b/mustella/as3/src/mustella/ExcludeFileLocation.as
index 7b5ee20..ee5ce6f 100644
--- a/mustella/as3/src/mustella/ExcludeFileLocation.as
+++ b/mustella/as3/src/mustella/ExcludeFileLocation.as
@@ -123,8 +123,6 @@ public class ExcludeFileLocation
 
 		triedBrowser = true;
 
-		var currentOS:String = Capabilities.os;
-
 		var useFile:String = "http://localhost/" + excludeFile;
 
 		trace ("try excludes from here: " + useFile);
@@ -169,8 +167,6 @@ public class ExcludeFileLocation
 
 		trace ("excludes loadTryFile " + new Date().toString());
 
-		var currentOS:String = Capabilities.os;
-
 		var useFile:String;
 
 		useFile = mustellaTestDir +"/" + excludeFile;
@@ -212,7 +208,7 @@ public class ExcludeFileLocation
 		delimiter = new RegExp("\n", "g");
 		data = data.replace(delimiter, ",");
 
-		UnitTester.excludeList = new Object();
+		UnitTester.excludeList = {};
 		var items:Array = data.split(",");
 		var n:int = items.length;
 		for (var i:int = 0; i < n; i++)
@@ -220,7 +216,6 @@ public class ExcludeFileLocation
 			var s:String = items[i];
 			if (s.length)
 				UnitTester.excludeList[s] = 1;
-
 		}
 		
 		UnitTester.waitForExcludes = false;

http://git-wip-us.apache.org/repos/asf/flex-sdk/blob/390e6595/mustella/as3/src/mustella/IncludeFileLocation.as
----------------------------------------------------------------------
diff --git a/mustella/as3/src/mustella/IncludeFileLocation.as b/mustella/as3/src/mustella/IncludeFileLocation.as
index 4d41dfe..6517c27 100644
--- a/mustella/as3/src/mustella/IncludeFileLocation.as
+++ b/mustella/as3/src/mustella/IncludeFileLocation.as
@@ -83,7 +83,7 @@ public class IncludeFileLocation
 		delimiter = new RegExp("\n", "g");
 		data = data.replace(delimiter, ",");
 
-		UnitTester.includeList = new Object();
+		UnitTester.includeList = {};
 		var items:Array = data.split(",");
 		var n:int = items.length;
 		for (var i:int = 0; i < n; i++)

http://git-wip-us.apache.org/repos/asf/flex-sdk/blob/390e6595/mustella/as3/src/mustella/IncludeListTextFile.as
----------------------------------------------------------------------
diff --git a/mustella/as3/src/mustella/IncludeListTextFile.as b/mustella/as3/src/mustella/IncludeListTextFile.as
index 44a120f..7be8649 100644
--- a/mustella/as3/src/mustella/IncludeListTextFile.as
+++ b/mustella/as3/src/mustella/IncludeListTextFile.as
@@ -56,7 +56,7 @@ public class IncludeListTextFile
 		delimiter = new RegExp("\n", "g");
 		data = data.replace(delimiter, ",");
 
-		UnitTester.includeList = new Object();
+		UnitTester.includeList = {};
 		var items:Array = data.split(",");
 		var n:int = items.length;
 		for (var i:int = 0; i < n; i++)

http://git-wip-us.apache.org/repos/asf/flex-sdk/blob/390e6595/mustella/as3/src/mustella/TestCase.as
----------------------------------------------------------------------
diff --git a/mustella/as3/src/mustella/TestCase.as b/mustella/as3/src/mustella/TestCase.as
index 44884e4..db6e937 100644
--- a/mustella/as3/src/mustella/TestCase.as
+++ b/mustella/as3/src/mustella/TestCase.as
@@ -181,7 +181,7 @@ public class TestCase extends EventDispatcher
 	 *
 	 *  @param root The SystemManager
 	 *  @param timer The shared Timer;
-	 *  @param the UnitTester that contains these tests
+	 *  @param context the UnitTester that contains these tests
 	 */
 	public function runTest(root:DisplayObject, timer:Timer, context:UnitTester):Boolean
 	{


[3/3] git commit: [flex-sdk] [refs/heads/develop] - FLEX-34837 Added unit test which reproduces the bug from the DataGrid side. NOTE: this unit test works in IntelliJ - i.e. fails as expected -, but fails in the SDK with the message "UIImpersonator doesn

Posted by mi...@apache.org.
FLEX-34837
Added unit test which reproduces the bug from the DataGrid side.
NOTE: this unit test works in IntelliJ - i.e. fails as expected -, but fails in the SDK with the message "UIImpersonator doesn't work correctly!" because FlexUnit is not compiled for Flex projects (so UIImpersonator doesn't act as it does locally). When we release a new version of FlexUnit we can correct this.


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

Branch: refs/heads/develop
Commit: e32044cdb698f5da962c1f527e97f8cbe6f9f77a
Parents: e8e6e8c
Author: Mihai Chira <mi...@apache.org>
Authored: Fri Jul 24 20:05:18 2015 +0200
Committer: Mihai Chira <mi...@apache.org>
Committed: Fri Jul 24 20:05:18 2015 +0200

----------------------------------------------------------------------
 .../components/DataGrid_FLEX_34837_Tests.as     | 201 +++++++++++++++++++
 1 file changed, 201 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/flex-sdk/blob/e32044cd/frameworks/projects/spark/tests/spark/components/DataGrid_FLEX_34837_Tests.as
----------------------------------------------------------------------
diff --git a/frameworks/projects/spark/tests/spark/components/DataGrid_FLEX_34837_Tests.as b/frameworks/projects/spark/tests/spark/components/DataGrid_FLEX_34837_Tests.as
new file mode 100644
index 0000000..5696429
--- /dev/null
+++ b/frameworks/projects/spark/tests/spark/components/DataGrid_FLEX_34837_Tests.as
@@ -0,0 +1,201 @@
+////////////////////////////////////////////////////////////////////////////////
+//
+//  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 spark.components {
+    import mx.collections.ArrayCollection;
+    import mx.collections.ArrayList;
+    import mx.collections.IList;
+    import mx.collections.ListCollectionView;
+
+    import org.flexunit.asserts.assertEquals;
+    import org.flexunit.asserts.assertNotNull;
+    import org.fluint.uiImpersonation.UIImpersonator;
+
+    import spark.components.gridClasses.GridColumn;
+    import spark.formatters.DateTimeFormatter;
+
+    public class DataGrid_FLEX_34837_Tests {
+        private var _sut:DataGrid;
+
+        [Before]
+        public function setUp():void
+        {
+            _sut = new DataGrid();
+        }
+
+        [After]
+        public function tearDown():void
+        {
+            _sut = null;
+        }
+
+        [Test]
+        public function test_removing_selected_item_on_complex_field_sorted_grid_after_renaming_it():void
+        {
+            //given
+            var streetColumn:GridColumn = new GridColumn("address.street");
+            _sut.columns = new ArrayCollection([streetColumn]);
+
+            const tenObjects:IList = generateVOs(10);
+            const firstObject:FLEX_34837_VO = tenObjects.getItemAt(0) as FLEX_34837_VO;
+            const dataProvider:ListCollectionView = new ListCollectionView(tenObjects);
+
+            //when
+            UIImpersonator.addChild(_sut);
+            assertNotNull("UIImpersonator doesn't work correctly!", _sut.grid);
+            _sut.dataProvider = dataProvider;
+            _sut.sortByColumns(new <int>[0]); //sort by address.street
+            firstObject.address.street = "zzz"; //should move it at the end of the list
+
+            //then
+            assertEquals("The object should have moved to the end of the list!", dataProvider.length - 1, dataProvider.getItemIndex(firstObject));
+            dataProvider.removeItemAt(dataProvider.getItemIndex(firstObject)); //make sure there's no RTE
+            assertEquals("The item wasn't removed!", 9, dataProvider.length);
+        }
+
+        [Test]
+        public function test_removing_selected_item_on_complex_field_sorted_grid_with_formatter_after_renaming_it():void
+        {
+            //given
+            var dateColumn:GridColumn = new GridColumn("address.dateMovedIn");
+            var dateTimeFormatter:DateTimeFormatter = new DateTimeFormatter();
+            dateTimeFormatter.dateTimePattern = "MMMM"; //Full month name
+            dateColumn.formatter = dateTimeFormatter;
+
+            _sut.columns = new ArrayCollection([dateColumn]);
+
+            const tenObjects:IList = generateVOs(10);
+            const dataProvider:ListCollectionView = new ListCollectionView(tenObjects);
+
+            //when
+            UIImpersonator.addChild(_sut);
+            assertNotNull("UIImpersonator doesn't work correctly!", _sut.grid);
+            _sut.dataProvider = dataProvider;
+            _sut.sortByColumns(new <int>[0]); //sort by address.dateMovedIn, in effect by month name
+
+            //then
+            const aprilObject:FLEX_34837_VO = tenObjects.getItemAt(3) as FLEX_34837_VO;
+            assertEquals(0, dataProvider.getItemIndex(aprilObject));
+
+            //when
+            const septemberObject:FLEX_34837_VO = tenObjects.getItemAt(8) as FLEX_34837_VO;
+            septemberObject.address.dateMovedIn = new Date(2000, 3, 2); //"April"; should move it at the start of the list
+
+            const firstObject:FLEX_34837_VO = tenObjects.getItemAt(0) as FLEX_34837_VO;
+            firstObject.address.dateMovedIn = new Date(2000, 8, 2); //"September"; should move it at the end of the list
+
+            //then
+            assertEquals("The object should have moved to the end of the list!", dataProvider.length - 1, dataProvider.getItemIndex(firstObject));
+            dataProvider.removeItemAt(dataProvider.getItemIndex(firstObject)); //make sure there's no RTE
+            assertEquals("The item wasn't removed!", 9, dataProvider.length);
+        }
+
+        [Test]
+        public function test_removing_selected_item_on_multiple_field_sorted_grid_with_formatter_changed_after_first_sort_and_after_renaming():void
+        {
+            //given
+            var dateColumn:GridColumn = new GridColumn("address.dateMovedIn");
+            _sut.columns = new ArrayCollection([dateColumn]);
+
+            const tenObjects:IList = generateVOs(10);
+            const dataProvider:ListCollectionView = new ListCollectionView(tenObjects);
+
+            //when
+            UIImpersonator.addChild(_sut);
+            assertNotNull("UIImpersonator doesn't work correctly!", _sut.grid);
+            _sut.dataProvider = dataProvider;
+
+            var dateTimeFormatter:DateTimeFormatter = new DateTimeFormatter();
+            dateTimeFormatter.dateTimePattern = "MMMM"; //Full month name
+            dateColumn.formatter = dateTimeFormatter; //this should re-sort the items in the grid according to the month
+
+            _sut.sortByColumns(new <int>[0]); //sort by address.dateMovedIn
+
+            //then
+            const aprilObject:FLEX_34837_VO = tenObjects.getItemAt(3) as FLEX_34837_VO;
+            assertEquals(0, dataProvider.getItemIndex(aprilObject));
+
+            //when
+            const septemberObject:FLEX_34837_VO = tenObjects.getItemAt(8) as FLEX_34837_VO;
+            septemberObject.address.dateMovedIn = new Date(2000, 3, 2); //"April"; should move it at the start of the list
+
+            const firstObject:FLEX_34837_VO = tenObjects.getItemAt(0) as FLEX_34837_VO;
+            firstObject.address.dateMovedIn = new Date(2000, 8, 2); //"September"; should move it at the end of the list
+
+            //then
+            assertEquals("The object should have moved to the end of the list!", dataProvider.length - 1, dataProvider.getItemIndex(firstObject));
+            dataProvider.removeItemAt(dataProvider.getItemIndex(firstObject)); //make sure there's no RTE
+            assertEquals("The item wasn't removed!", 9, dataProvider.length);
+        }
+
+        private static function generateVOs(no:int, reverse:Boolean = false):IList
+        {
+            return generateObjects(no, reverse, generateOneObject);
+        }
+
+        private static function generateObjects(no:int, reverse:Boolean, generator:Function):IList
+        {
+            var result:Array = [];
+            for(var i:int = 0; i < no; i++)
+            {
+                result.push(generator(i));
+            }
+
+            if(reverse)
+                result.reverse();
+
+            return new ArrayList(result);
+        }
+
+        private static function generateOneObject(i:Number):FLEX_34837_VO
+        {
+            return new FLEX_34837_VO(i, "Object", "Street");
+        }
+    }
+}
+
+[Bindable]
+class FLEX_34837_VO
+{
+    public var name:String;
+    public var address:FLEX_34837_AddressVO;
+    public var index:Number;
+
+    public function FLEX_34837_VO(index:Number, namePrefix:String, streetPrefix:String)
+    {
+        this.index = index;
+        this.name = namePrefix + index;
+        this.address = new FLEX_34837_AddressVO(streetPrefix + index, Math.floor(index), new Date(2000 + Math.floor(index), Math.floor(index), 1, 0, 0, 0, 1));
+    }
+}
+
+[Bindable]
+class FLEX_34837_AddressVO
+{
+    public var street:String;
+    public var houseNumber:int;
+    public var dateMovedIn:Date;
+
+    public function FLEX_34837_AddressVO(street:String, houseNumber:int, dateMovedIn:Date)
+    {
+        this.street = street;
+        this.houseNumber = houseNumber;
+        this.dateMovedIn = dateMovedIn;
+    }
+}
\ No newline at end of file


[2/3] git commit: [flex-sdk] [refs/heads/develop] - FLEX-34854 Moved the test to a better package and added a header comment.

Posted by mi...@apache.org.
FLEX-34854
Moved the test to a better package and added a header comment.


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

Branch: refs/heads/develop
Commit: e8e6e8c5301a45c07c469078a76bcfd212870707
Parents: 390e659
Author: Mihai Chira <mi...@apache.org>
Authored: Fri Jul 24 11:41:09 2015 +0200
Committer: Mihai Chira <mi...@apache.org>
Committed: Fri Jul 24 11:41:09 2015 +0200

----------------------------------------------------------------------
 .../tests/spark/collections/SortField_Tests.as  | 56 ++++++++++++++++++++
 .../tests/spark/skins/spark/SortField_Tests.as  | 37 -------------
 2 files changed, 56 insertions(+), 37 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/flex-sdk/blob/e8e6e8c5/frameworks/projects/spark/tests/spark/collections/SortField_Tests.as
----------------------------------------------------------------------
diff --git a/frameworks/projects/spark/tests/spark/collections/SortField_Tests.as b/frameworks/projects/spark/tests/spark/collections/SortField_Tests.as
new file mode 100644
index 0000000..2fffc3b
--- /dev/null
+++ b/frameworks/projects/spark/tests/spark/collections/SortField_Tests.as
@@ -0,0 +1,56 @@
+////////////////////////////////////////////////////////////////////////////////
+//
+//  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 spark.collections {
+    import org.flexunit.asserts.assertEquals;
+    import org.flexunit.asserts.assertFalse;
+
+    import spark.collections.SortField;
+
+    public class SortField_Tests {
+        private var _sut:SortField;
+
+        [Test]
+        public function fix_mustella_failure_due_to_FLEX_34852():void
+        {
+            //given
+            _sut = new SortField("someField");
+
+            //when
+            const emptyObject:Object = {};
+            var emptyObjectHasASortField:Boolean = _sut.objectHasSortField(emptyObject);
+
+            //then
+            assertFalse(emptyObjectHasASortField);
+        }
+
+        [Test]
+        public function locale_setting_and_retrieving_work():void
+        {
+            //given
+            _sut = new SortField("someField");
+
+            //when
+            _sut.setStyle("locale", "ru-RU");
+
+            //then
+            assertEquals("ru-RU", _sut.getStyle("locale"));
+        }
+    }
+}

http://git-wip-us.apache.org/repos/asf/flex-sdk/blob/e8e6e8c5/frameworks/projects/spark/tests/spark/skins/spark/SortField_Tests.as
----------------------------------------------------------------------
diff --git a/frameworks/projects/spark/tests/spark/skins/spark/SortField_Tests.as b/frameworks/projects/spark/tests/spark/skins/spark/SortField_Tests.as
deleted file mode 100644
index 1c5824f..0000000
--- a/frameworks/projects/spark/tests/spark/skins/spark/SortField_Tests.as
+++ /dev/null
@@ -1,37 +0,0 @@
-package spark.skins.spark {
-    import org.flexunit.asserts.assertEquals;
-    import org.flexunit.asserts.assertFalse;
-
-    import spark.collections.SortField;
-
-    public class SortField_Tests {
-        private var _sut:SortField;
-
-        [Test]
-        public function fix_mustella_failure_due_to_FLEX_34852():void
-        {
-            //given
-            _sut = new SortField("someField");
-
-            //when
-            const emptyObject:Object = {};
-            var emptyObjectHasASortField:Boolean = _sut.objectHasSortField(emptyObject);
-
-            //then
-            assertFalse(emptyObjectHasASortField);
-        }
-
-        [Test]
-        public function locale_setting_and_retrieving_work():void
-        {
-            //given
-            _sut = new SortField("someField");
-
-            //when
-            _sut.setStyle("locale", "ru-RU");
-
-            //then
-            assertEquals("ru-RU", _sut.getStyle("locale"));
-        }
-    }
-}