You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@flex.apache.org by jm...@apache.org on 2015/11/18 05:21:47 UTC

[32/47] git commit: [flex-sdk] [refs/heads/develop] - FLEX-34119 moving the unit test to where it can be executed part of 'ant test'

FLEX-34119 moving the unit test to where it can be executed part of 'ant test'


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

Branch: refs/heads/develop
Commit: 2b4d9dfffb13742db9ec4894c1e2c6ab1664cf29
Parents: 254c25a
Author: Mihai Chira <mi...@apache.org>
Authored: Tue Mar 10 13:22:56 2015 +0100
Committer: Erik de Bruin <er...@ixsoftware.nl>
Committed: Fri Mar 20 09:51:22 2015 +0100

----------------------------------------------------------------------
 ...rarchicalCollectionViewCursor_Basics_Test.as | 262 +++++++++++++++++++
 ...rarchicalCollectionViewCursor_Basics_Test.as | 262 -------------------
 2 files changed, 262 insertions(+), 262 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/flex-sdk/blob/2b4d9dff/frameworks/projects/advancedgrids/tests/mx/collections/HierarchicalCollectionViewCursor_Basics_Test.as
----------------------------------------------------------------------
diff --git a/frameworks/projects/advancedgrids/tests/mx/collections/HierarchicalCollectionViewCursor_Basics_Test.as b/frameworks/projects/advancedgrids/tests/mx/collections/HierarchicalCollectionViewCursor_Basics_Test.as
new file mode 100644
index 0000000..c2bd0cb
--- /dev/null
+++ b/frameworks/projects/advancedgrids/tests/mx/collections/HierarchicalCollectionViewCursor_Basics_Test.as
@@ -0,0 +1,262 @@
+////////////////////////////////////////////////////////////////////////////////
+//
+//  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 mx.collections
+{
+    import flash.events.UncaughtErrorEvent;
+
+import flashx.textLayout.debug.assert;
+
+import mx.collections.ArrayCollection;
+    import mx.collections.CursorBookmark;
+    import mx.collections.HierarchicalCollectionView;
+    import mx.collections.HierarchicalCollectionViewCursor;
+    import mx.core.FlexGlobals;
+    
+    import spark.components.WindowedApplication;
+    
+    import org.flexunit.asserts.assertEquals;
+
+    public class HierarchicalCollectionViewCursor_Basics_Test
+	{
+		private static var _utils:HierarchicalCollectionViewTestUtils = new HierarchicalCollectionViewTestUtils();
+		private static var _currentHierarchy:HierarchicalCollectionView;
+		private static var _noErrorsThrown:Boolean = true;
+		private var _level0:ArrayCollection;
+		
+		private var _sut:HierarchicalCollectionViewCursor;
+		
+		[BeforeClass]
+		public static function setUpBeforeClass():void
+		{
+            if(FlexGlobals.topLevelApplication is WindowedApplication)
+			    (FlexGlobals.topLevelApplication as WindowedApplication).loaderInfo.uncaughtErrorEvents.addEventListener(UncaughtErrorEvent.UNCAUGHT_ERROR, handleUncaughtClientError);
+		}
+		
+		[AfterClass]
+		public static function tearDownAfterClass():void
+		{
+            if(FlexGlobals.topLevelApplication is WindowedApplication)
+			    (FlexGlobals.topLevelApplication as WindowedApplication).loaderInfo.uncaughtErrorEvents.removeEventListener(UncaughtErrorEvent.UNCAUGHT_ERROR, handleUncaughtClientError);
+		}
+		
+		[Before]
+		public function setUp():void
+		{
+            _currentHierarchy = generateHierarchyViewWithOpenNodes();
+            _level0 = _utils.getRoot(_currentHierarchy) as ArrayCollection;
+            _sut = _currentHierarchy.createCursor() as HierarchicalCollectionViewCursor;
+
+			_noErrorsThrown = true;
+		}
+		
+		[After]
+		public function tearDown():void
+		{
+			_sut = null;
+            _currentHierarchy = null;
+            _level0 = null;
+		}
+
+
+
+        [Test]
+        public function testMovingAround():void
+        {
+            //given
+            var lastCompany:DataNode = _level0.getItemAt(_level0.length - 1) as DataNode;
+            var firstCompany:DataNode = _level0.getItemAt(0) as DataNode;
+            var firstLocation:DataNode = firstCompany.children.getItemAt(0) as DataNode;
+            var secondLocation:DataNode = firstCompany.children.getItemAt(1) as DataNode;
+            var firstDepartment:DataNode = firstLocation.children.getItemAt(0) as DataNode;
+            var secondDepartment:DataNode = firstLocation.children.getItemAt(1) as DataNode;
+
+            //when
+            _sut.moveNext();
+
+            //then
+            assertEquals(firstLocation, _sut.current);
+
+            //when
+            _sut.moveNext();
+
+            //then
+            assertEquals(firstDepartment, _sut.current);
+
+            //when
+            _sut.moveNext();
+
+            //then
+            assertEquals(secondDepartment, _sut.current);
+
+            //when
+            _sut.movePrevious();
+
+            //then
+            assertEquals(firstDepartment, _sut.current);
+
+            //when
+            _sut.moveToLast();
+
+            //then
+            assertEquals(lastCompany, _sut.current);
+
+            //when
+            _sut.seek(new CursorBookmark(4));
+
+            //then
+            assertEquals(secondLocation, _sut.current);
+        }
+
+        [Test]
+        public function testCollectionChangeInRootDoesNotChangeCurrent():void
+        {
+            //given
+            var lastCompany:DataNode = _level0.getItemAt(_level0.length - 1) as DataNode;
+
+            //when
+            _sut.moveToLast();
+
+            var newFirstCompany:DataNode = _utils.createSimpleNode("[INS] Company");
+            _level0.addItemAt(newFirstCompany, 0);
+
+            var newLastCompany:DataNode = _utils.createSimpleNode("[INS] Company");
+            _level0.addItemAt(newLastCompany, _level0.length);
+
+            //then
+            assertEquals(lastCompany, _sut.current);
+
+            //when
+            _sut.moveToLast();
+
+            //then
+            assertEquals(newLastCompany, _sut.current);
+        }
+
+        [Test]
+        public function testRemovingCurrentMiddleItemChangesCurrentToNextItem():void
+        {
+            //given
+            var firstCompany:DataNode = _level0.getItemAt(0) as DataNode;
+            var secondLocation:DataNode = firstCompany.children.getItemAt(1) as DataNode;
+            var thirdDepartmentOfSecondLocation:DataNode = secondLocation.children.getItemAt(2) as DataNode;
+
+            _sut.seek(new CursorBookmark(6)); //Company(1)->Location(2)->Department(2)
+
+            //when
+            secondLocation.children.removeItemAt(1);
+
+            //then
+            assertEquals(thirdDepartmentOfSecondLocation, _sut.current);
+        }
+
+        [Test]
+        public function testRemovingPreviousSiblingOfCurrentMiddleItemDoesNotChangeCurrent():void
+        {
+            //given
+            var firstCompany:DataNode = _level0.getItemAt(0) as DataNode;
+            var secondLocation:DataNode = firstCompany.children.getItemAt(1) as DataNode;
+            var secondDepartmentOfSecondLocation:DataNode = secondLocation.children.getItemAt(1) as DataNode;
+
+            //when
+            _sut.seek(new CursorBookmark(6)); //Company(1)->Location(2)->Department(2)
+
+            //then
+            assertEquals(secondDepartmentOfSecondLocation, _sut.current);
+
+            //when
+            secondLocation.children.removeItemAt(0);
+
+            //then
+            assertEquals(secondDepartmentOfSecondLocation, _sut.current);
+        }
+
+        [Test]
+        public function testRemovingCurrentFirstItemChangesCurrentToNextItem():void
+        {
+            //given
+            var firstCompany:DataNode = _level0.getItemAt(0) as DataNode;
+            var secondCompany:DataNode = _level0.getItemAt(1) as DataNode;
+
+            //initial assumption
+            assertEquals(firstCompany, _sut.current);
+
+            //when
+            _level0.removeItemAt(0);
+
+            //then
+            assertEquals(secondCompany, _sut.current);
+        }
+
+        [Test]
+        public function testRemovingSiblingOfCurrentFirstItemDoesNotChangeCurrent():void
+        {
+            //given
+            var firstCompany:DataNode = _level0.getItemAt(0) as DataNode;
+            var firstLocation:DataNode = firstCompany.children.getItemAt(0) as DataNode;
+
+            //when
+            _sut.seek(new CursorBookmark(1)); //Company(1)->Location(1)
+
+            //then
+            assertEquals(firstLocation, _sut.current);
+
+            //when
+            firstCompany.children.removeItemAt(1);
+
+            //then
+            assertEquals(firstLocation, _sut.current);
+        }
+		
+		
+		private static function handleUncaughtClientError(event:UncaughtErrorEvent):void
+		{
+			event.preventDefault();
+			event.stopImmediatePropagation();
+			_noErrorsThrown = false;
+			
+			trace("\n" + event.error);
+			_utils.printHCollectionView(_currentHierarchy);
+		}
+
+		
+		private static function generateHierarchyViewWithOpenNodes():HierarchicalCollectionView
+		{
+			return _utils.generateOpenHierarchyFromRootList(_utils.generateHierarchySourceFromString(HIERARCHY_STRING));
+		}
+
+		private static const HIERARCHY_STRING:String = (<![CDATA[
+			Company(1)
+			Company(1)->Location(1)
+			Company(1)->Location(1)->Department(1)
+			Company(1)->Location(1)->Department(2)
+			Company(1)->Location(2)
+			Company(1)->Location(2)->Department(1)
+			Company(1)->Location(2)->Department(2)
+			Company(1)->Location(2)->Department(3)
+			Company(1)->Location(3)
+			Company(2)
+			Company(2)->Location(1)
+			Company(2)->Location(2)
+			Company(2)->Location(2)->Department(1)
+			Company(2)->Location(3)
+			Company(3)
+		]]>).toString();
+	}
+}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/flex-sdk/blob/2b4d9dff/frameworks/tests/unitTests/mx/collections/HierarchicalCollectionViewCursor_Basics_Test.as
----------------------------------------------------------------------
diff --git a/frameworks/tests/unitTests/mx/collections/HierarchicalCollectionViewCursor_Basics_Test.as b/frameworks/tests/unitTests/mx/collections/HierarchicalCollectionViewCursor_Basics_Test.as
deleted file mode 100644
index c2bd0cb..0000000
--- a/frameworks/tests/unitTests/mx/collections/HierarchicalCollectionViewCursor_Basics_Test.as
+++ /dev/null
@@ -1,262 +0,0 @@
-////////////////////////////////////////////////////////////////////////////////
-//
-//  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 mx.collections
-{
-    import flash.events.UncaughtErrorEvent;
-
-import flashx.textLayout.debug.assert;
-
-import mx.collections.ArrayCollection;
-    import mx.collections.CursorBookmark;
-    import mx.collections.HierarchicalCollectionView;
-    import mx.collections.HierarchicalCollectionViewCursor;
-    import mx.core.FlexGlobals;
-    
-    import spark.components.WindowedApplication;
-    
-    import org.flexunit.asserts.assertEquals;
-
-    public class HierarchicalCollectionViewCursor_Basics_Test
-	{
-		private static var _utils:HierarchicalCollectionViewTestUtils = new HierarchicalCollectionViewTestUtils();
-		private static var _currentHierarchy:HierarchicalCollectionView;
-		private static var _noErrorsThrown:Boolean = true;
-		private var _level0:ArrayCollection;
-		
-		private var _sut:HierarchicalCollectionViewCursor;
-		
-		[BeforeClass]
-		public static function setUpBeforeClass():void
-		{
-            if(FlexGlobals.topLevelApplication is WindowedApplication)
-			    (FlexGlobals.topLevelApplication as WindowedApplication).loaderInfo.uncaughtErrorEvents.addEventListener(UncaughtErrorEvent.UNCAUGHT_ERROR, handleUncaughtClientError);
-		}
-		
-		[AfterClass]
-		public static function tearDownAfterClass():void
-		{
-            if(FlexGlobals.topLevelApplication is WindowedApplication)
-			    (FlexGlobals.topLevelApplication as WindowedApplication).loaderInfo.uncaughtErrorEvents.removeEventListener(UncaughtErrorEvent.UNCAUGHT_ERROR, handleUncaughtClientError);
-		}
-		
-		[Before]
-		public function setUp():void
-		{
-            _currentHierarchy = generateHierarchyViewWithOpenNodes();
-            _level0 = _utils.getRoot(_currentHierarchy) as ArrayCollection;
-            _sut = _currentHierarchy.createCursor() as HierarchicalCollectionViewCursor;
-
-			_noErrorsThrown = true;
-		}
-		
-		[After]
-		public function tearDown():void
-		{
-			_sut = null;
-            _currentHierarchy = null;
-            _level0 = null;
-		}
-
-
-
-        [Test]
-        public function testMovingAround():void
-        {
-            //given
-            var lastCompany:DataNode = _level0.getItemAt(_level0.length - 1) as DataNode;
-            var firstCompany:DataNode = _level0.getItemAt(0) as DataNode;
-            var firstLocation:DataNode = firstCompany.children.getItemAt(0) as DataNode;
-            var secondLocation:DataNode = firstCompany.children.getItemAt(1) as DataNode;
-            var firstDepartment:DataNode = firstLocation.children.getItemAt(0) as DataNode;
-            var secondDepartment:DataNode = firstLocation.children.getItemAt(1) as DataNode;
-
-            //when
-            _sut.moveNext();
-
-            //then
-            assertEquals(firstLocation, _sut.current);
-
-            //when
-            _sut.moveNext();
-
-            //then
-            assertEquals(firstDepartment, _sut.current);
-
-            //when
-            _sut.moveNext();
-
-            //then
-            assertEquals(secondDepartment, _sut.current);
-
-            //when
-            _sut.movePrevious();
-
-            //then
-            assertEquals(firstDepartment, _sut.current);
-
-            //when
-            _sut.moveToLast();
-
-            //then
-            assertEquals(lastCompany, _sut.current);
-
-            //when
-            _sut.seek(new CursorBookmark(4));
-
-            //then
-            assertEquals(secondLocation, _sut.current);
-        }
-
-        [Test]
-        public function testCollectionChangeInRootDoesNotChangeCurrent():void
-        {
-            //given
-            var lastCompany:DataNode = _level0.getItemAt(_level0.length - 1) as DataNode;
-
-            //when
-            _sut.moveToLast();
-
-            var newFirstCompany:DataNode = _utils.createSimpleNode("[INS] Company");
-            _level0.addItemAt(newFirstCompany, 0);
-
-            var newLastCompany:DataNode = _utils.createSimpleNode("[INS] Company");
-            _level0.addItemAt(newLastCompany, _level0.length);
-
-            //then
-            assertEquals(lastCompany, _sut.current);
-
-            //when
-            _sut.moveToLast();
-
-            //then
-            assertEquals(newLastCompany, _sut.current);
-        }
-
-        [Test]
-        public function testRemovingCurrentMiddleItemChangesCurrentToNextItem():void
-        {
-            //given
-            var firstCompany:DataNode = _level0.getItemAt(0) as DataNode;
-            var secondLocation:DataNode = firstCompany.children.getItemAt(1) as DataNode;
-            var thirdDepartmentOfSecondLocation:DataNode = secondLocation.children.getItemAt(2) as DataNode;
-
-            _sut.seek(new CursorBookmark(6)); //Company(1)->Location(2)->Department(2)
-
-            //when
-            secondLocation.children.removeItemAt(1);
-
-            //then
-            assertEquals(thirdDepartmentOfSecondLocation, _sut.current);
-        }
-
-        [Test]
-        public function testRemovingPreviousSiblingOfCurrentMiddleItemDoesNotChangeCurrent():void
-        {
-            //given
-            var firstCompany:DataNode = _level0.getItemAt(0) as DataNode;
-            var secondLocation:DataNode = firstCompany.children.getItemAt(1) as DataNode;
-            var secondDepartmentOfSecondLocation:DataNode = secondLocation.children.getItemAt(1) as DataNode;
-
-            //when
-            _sut.seek(new CursorBookmark(6)); //Company(1)->Location(2)->Department(2)
-
-            //then
-            assertEquals(secondDepartmentOfSecondLocation, _sut.current);
-
-            //when
-            secondLocation.children.removeItemAt(0);
-
-            //then
-            assertEquals(secondDepartmentOfSecondLocation, _sut.current);
-        }
-
-        [Test]
-        public function testRemovingCurrentFirstItemChangesCurrentToNextItem():void
-        {
-            //given
-            var firstCompany:DataNode = _level0.getItemAt(0) as DataNode;
-            var secondCompany:DataNode = _level0.getItemAt(1) as DataNode;
-
-            //initial assumption
-            assertEquals(firstCompany, _sut.current);
-
-            //when
-            _level0.removeItemAt(0);
-
-            //then
-            assertEquals(secondCompany, _sut.current);
-        }
-
-        [Test]
-        public function testRemovingSiblingOfCurrentFirstItemDoesNotChangeCurrent():void
-        {
-            //given
-            var firstCompany:DataNode = _level0.getItemAt(0) as DataNode;
-            var firstLocation:DataNode = firstCompany.children.getItemAt(0) as DataNode;
-
-            //when
-            _sut.seek(new CursorBookmark(1)); //Company(1)->Location(1)
-
-            //then
-            assertEquals(firstLocation, _sut.current);
-
-            //when
-            firstCompany.children.removeItemAt(1);
-
-            //then
-            assertEquals(firstLocation, _sut.current);
-        }
-		
-		
-		private static function handleUncaughtClientError(event:UncaughtErrorEvent):void
-		{
-			event.preventDefault();
-			event.stopImmediatePropagation();
-			_noErrorsThrown = false;
-			
-			trace("\n" + event.error);
-			_utils.printHCollectionView(_currentHierarchy);
-		}
-
-		
-		private static function generateHierarchyViewWithOpenNodes():HierarchicalCollectionView
-		{
-			return _utils.generateOpenHierarchyFromRootList(_utils.generateHierarchySourceFromString(HIERARCHY_STRING));
-		}
-
-		private static const HIERARCHY_STRING:String = (<![CDATA[
-			Company(1)
-			Company(1)->Location(1)
-			Company(1)->Location(1)->Department(1)
-			Company(1)->Location(1)->Department(2)
-			Company(1)->Location(2)
-			Company(1)->Location(2)->Department(1)
-			Company(1)->Location(2)->Department(2)
-			Company(1)->Location(2)->Department(3)
-			Company(1)->Location(3)
-			Company(2)
-			Company(2)->Location(1)
-			Company(2)->Location(2)
-			Company(2)->Location(2)->Department(1)
-			Company(2)->Location(3)
-			Company(3)
-		]]>).toString();
-	}
-}
\ No newline at end of file