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 2016/03/23 13:03:21 UTC
[1/4] git commit: [flex-sdk] [refs/heads/develop] - FLEX-26808 Minor
refactoring while reading the code: asdocs improvements,
and adding missing semicolon.
Repository: flex-sdk
Updated Branches:
refs/heads/develop 2324f43f0 -> f543314c4
FLEX-26808
Minor refactoring while reading the code: asdocs improvements, and adding missing semicolon.
Project: http://git-wip-us.apache.org/repos/asf/flex-sdk/repo
Commit: http://git-wip-us.apache.org/repos/asf/flex-sdk/commit/74225ba2
Tree: http://git-wip-us.apache.org/repos/asf/flex-sdk/tree/74225ba2
Diff: http://git-wip-us.apache.org/repos/asf/flex-sdk/diff/74225ba2
Branch: refs/heads/develop
Commit: 74225ba2b3be288c944a898406a94b27f02e444d
Parents: 2324f43
Author: Mihai Chira <mi...@apache.org>
Authored: Wed Mar 23 12:17:59 2016 +0100
Committer: Mihai Chira <mi...@apache.org>
Committed: Wed Mar 23 12:17:59 2016 +0100
----------------------------------------------------------------------
frameworks/projects/spark/src/spark/components/Grid.as | 2 +-
.../src/spark/components/supportClasses/SkinnableComponent.as | 2 +-
frameworks/projects/spark/src/spark/utils/MouseEventUtil.as | 2 +-
3 files changed, 3 insertions(+), 3 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/flex-sdk/blob/74225ba2/frameworks/projects/spark/src/spark/components/Grid.as
----------------------------------------------------------------------
diff --git a/frameworks/projects/spark/src/spark/components/Grid.as b/frameworks/projects/spark/src/spark/components/Grid.as
index 78b2429..a489f31 100644
--- a/frameworks/projects/spark/src/spark/components/Grid.as
+++ b/frameworks/projects/spark/src/spark/components/Grid.as
@@ -4329,7 +4329,7 @@ public class Grid extends Group implements IDataGridElement, IDataProviderEnhanc
* Create and/or configure this Grid's GridViews. We're assuming that the
* Grid's viewFactory, columns and dataProvider are specified.
*
- * If GridVeiws are added or removed, a "gridViewsChanged" event is dispatched.
+ * If GridViews are added or removed, a "gridViewsChanged" event is dispatched.
*/
private function configureGridViews():void
{
http://git-wip-us.apache.org/repos/asf/flex-sdk/blob/74225ba2/frameworks/projects/spark/src/spark/components/supportClasses/SkinnableComponent.as
----------------------------------------------------------------------
diff --git a/frameworks/projects/spark/src/spark/components/supportClasses/SkinnableComponent.as b/frameworks/projects/spark/src/spark/components/supportClasses/SkinnableComponent.as
index 2a8c730..2fceebf 100644
--- a/frameworks/projects/spark/src/spark/components/supportClasses/SkinnableComponent.as
+++ b/frameworks/projects/spark/src/spark/components/supportClasses/SkinnableComponent.as
@@ -216,7 +216,7 @@ public class SkinnableComponent extends UIComponent
/**
* The instance of the skin class for this component instance.
- * This is a read-only property that gets set automomatically when Flex
+ * This is a read-only property that gets set automatically when Flex
* calls the <code>attachSkin()</code> method.
*
* @langversion 3.0
http://git-wip-us.apache.org/repos/asf/flex-sdk/blob/74225ba2/frameworks/projects/spark/src/spark/utils/MouseEventUtil.as
----------------------------------------------------------------------
diff --git a/frameworks/projects/spark/src/spark/utils/MouseEventUtil.as b/frameworks/projects/spark/src/spark/utils/MouseEventUtil.as
index 97fc04f..ca6f08c 100644
--- a/frameworks/projects/spark/src/spark/utils/MouseEventUtil.as
+++ b/frameworks/projects/spark/src/spark/utils/MouseEventUtil.as
@@ -118,7 +118,7 @@ package spark.utils
target.systemManager.deployMouseShields(false);
break;
}
- }
+ };
target.addEventListener(MouseEvent.MOUSE_DOWN, f);
target.addEventListener("removeHandler", f);
}
[4/4] git commit: [flex-sdk] [refs/heads/develop] - FLEX-26808 Adding
VectorUtil.toArrayInt() to convert a Vector to an Array (and a few unit tests
for it). This is useful for the unit testing we're doing for this ticket.
Posted by mi...@apache.org.
FLEX-26808
Adding VectorUtil.toArrayInt() to convert a Vector to an Array (and a few unit tests for it). This is useful for the unit testing we're doing for this ticket.
Project: http://git-wip-us.apache.org/repos/asf/flex-sdk/repo
Commit: http://git-wip-us.apache.org/repos/asf/flex-sdk/commit/f543314c
Tree: http://git-wip-us.apache.org/repos/asf/flex-sdk/tree/f543314c
Diff: http://git-wip-us.apache.org/repos/asf/flex-sdk/diff/f543314c
Branch: refs/heads/develop
Commit: f543314c4f2c5b962492cceca55a53d7718741fe
Parents: cd338fd
Author: Mihai Chira <mi...@apache.org>
Authored: Wed Mar 23 12:54:12 2016 +0100
Committer: Mihai Chira <mi...@apache.org>
Committed: Wed Mar 23 12:54:12 2016 +0100
----------------------------------------------------------------------
.../framework/src/mx/utils/VectorUtil.as | 11 ++++
.../framework/tests/mx/utils/VectorUtilTests.as | 55 ++++++++++++++++++++
2 files changed, 66 insertions(+)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/flex-sdk/blob/f543314c/frameworks/projects/framework/src/mx/utils/VectorUtil.as
----------------------------------------------------------------------
diff --git a/frameworks/projects/framework/src/mx/utils/VectorUtil.as b/frameworks/projects/framework/src/mx/utils/VectorUtil.as
index f909a7b..3e73895 100644
--- a/frameworks/projects/framework/src/mx/utils/VectorUtil.as
+++ b/frameworks/projects/framework/src/mx/utils/VectorUtil.as
@@ -26,5 +26,16 @@ package mx.utils {
{
return v && v.length ? v[0] : -1;
}
+
+ public static function toArrayInt(v:Vector.<int>):Array
+ {
+ var result:Array = [];
+ for (var i:int = 0; i < (v ? v.length : 0); i++)
+ {
+ result.push(v[i]);
+ }
+
+ return result;
+ }
}
}
http://git-wip-us.apache.org/repos/asf/flex-sdk/blob/f543314c/frameworks/projects/framework/tests/mx/utils/VectorUtilTests.as
----------------------------------------------------------------------
diff --git a/frameworks/projects/framework/tests/mx/utils/VectorUtilTests.as b/frameworks/projects/framework/tests/mx/utils/VectorUtilTests.as
index 2ef9ccd..674ec97 100644
--- a/frameworks/projects/framework/tests/mx/utils/VectorUtilTests.as
+++ b/frameworks/projects/framework/tests/mx/utils/VectorUtilTests.as
@@ -22,6 +22,12 @@ package mx.utils {
import org.flexunit.asserts.assertTrue;
public class VectorUtilTests {
+
+ //--------------------------------------------------------------------------
+ //
+ // getFirstItem()
+ //
+ //--------------------------------------------------------------------------
[Test]
public function test_empty_vector():void
{
@@ -93,5 +99,54 @@ package mx.utils {
assertStrictlyEquals(2, vector[1]);
assertEquals(3, VectorUtil.getFirstItem(vector));
}
+
+
+ //--------------------------------------------------------------------------
+ //
+ // toArrayInt()
+ //
+ //--------------------------------------------------------------------------
+ [Test]
+ public function test_toArrayInt_with_different_items():void
+ {
+ //given
+ var vector:Vector.<int> = new <int>[1, 2, 3];
+
+ //then
+ assertTrue(ArrayUtil.arraysMatch([1, 2, 3], VectorUtil.toArrayInt(vector)));
+ }
+
+ [Test]
+ public function test_toArrayInt_with_duplicate_items():void
+ {
+ //given
+ var vector:Vector.<int> = new <int>[2, 2, 3, 1];
+
+ //then
+ assertTrue(ArrayUtil.arraysMatch([2, 2, 3, 1], VectorUtil.toArrayInt(vector)));
+ }
+
+ [Test]
+ public function test_toArrayInt_with_0_items():void
+ {
+ //given
+ var vector:Vector.<int> = new <int>[];
+
+ //when
+ var result:Array = VectorUtil.toArrayInt(vector);
+
+ //then
+ assertEquals(0, result.length);
+ }
+
+ [Test]
+ public function test_toArrayInt_with_null():void
+ {
+ //when
+ var result:Array = VectorUtil.toArrayInt(null);
+
+ //then
+ assertEquals(0, result.length);
+ }
}
}
[3/4] git commit: [flex-sdk] [refs/heads/develop] - FLEX-34837 As
noticed in FLEX-26808,
if the dimensions are not specified the grid layout will not render its
GridViews. Test still passes.
Posted by mi...@apache.org.
FLEX-34837
As noticed in FLEX-26808, if the dimensions are not specified the grid layout will not render its GridViews. Test still passes.
Project: http://git-wip-us.apache.org/repos/asf/flex-sdk/repo
Commit: http://git-wip-us.apache.org/repos/asf/flex-sdk/commit/cd338fdf
Tree: http://git-wip-us.apache.org/repos/asf/flex-sdk/tree/cd338fdf
Diff: http://git-wip-us.apache.org/repos/asf/flex-sdk/diff/cd338fdf
Branch: refs/heads/develop
Commit: cd338fdf4a6232b32f8eb02d0174a461c2919ef8
Parents: ae65e68
Author: Mihai Chira <mi...@apache.org>
Authored: Wed Mar 23 12:23:42 2016 +0100
Committer: Mihai Chira <mi...@apache.org>
Committed: Wed Mar 23 12:23:42 2016 +0100
----------------------------------------------------------------------
.../spark/tests/spark/components/DataGrid_FLEX_34837_Tests.as | 2 ++
1 file changed, 2 insertions(+)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/flex-sdk/blob/cd338fdf/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
index ab59317..6c3f7ae 100644
--- a/frameworks/projects/spark/tests/spark/components/DataGrid_FLEX_34837_Tests.as
+++ b/frameworks/projects/spark/tests/spark/components/DataGrid_FLEX_34837_Tests.as
@@ -37,6 +37,8 @@ package spark.components {
public function setUp():void
{
_sut = new DataGrid();
+ _sut.width = 200;
+ _sut.height = 200;
}
[After]
[2/4] git commit: [flex-sdk] [refs/heads/develop] - FLEX-26808 Adding
unit test. For now we're just testing that Ctrl+Click deselects the
(selected) first item (test passes). Dragging behaviour will follow.
Posted by mi...@apache.org.
FLEX-26808
Adding unit test. For now we're just testing that Ctrl+Click deselects the (selected) first item (test passes). Dragging behaviour will follow.
Project: http://git-wip-us.apache.org/repos/asf/flex-sdk/repo
Commit: http://git-wip-us.apache.org/repos/asf/flex-sdk/commit/ae65e686
Tree: http://git-wip-us.apache.org/repos/asf/flex-sdk/tree/ae65e686
Diff: http://git-wip-us.apache.org/repos/asf/flex-sdk/diff/ae65e686
Branch: refs/heads/develop
Commit: ae65e686c6a5c04cace2326d786a5eb83fd4f7f8
Parents: 74225ba
Author: Mihai Chira <mi...@apache.org>
Authored: Wed Mar 23 12:21:26 2016 +0100
Committer: Mihai Chira <mi...@apache.org>
Committed: Wed Mar 23 12:21:26 2016 +0100
----------------------------------------------------------------------
.../components/DataGrid_FLEX_26808_Tests.as | 203 +++++++++++++++++++
1 file changed, 203 insertions(+)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/flex-sdk/blob/ae65e686/frameworks/projects/spark/tests/spark/components/DataGrid_FLEX_26808_Tests.as
----------------------------------------------------------------------
diff --git a/frameworks/projects/spark/tests/spark/components/DataGrid_FLEX_26808_Tests.as b/frameworks/projects/spark/tests/spark/components/DataGrid_FLEX_26808_Tests.as
new file mode 100644
index 0000000..f5912afd
--- /dev/null
+++ b/frameworks/projects/spark/tests/spark/components/DataGrid_FLEX_26808_Tests.as
@@ -0,0 +1,203 @@
+////////////////////////////////////////////////////////////////////////////////
+//
+// 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 flash.events.Event;
+ import flash.events.EventDispatcher;
+ import flash.events.MouseEvent;
+
+ 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.assertNull;
+ import org.flexunit.asserts.assertTrue;
+ import org.flexunit.async.Async;
+ import org.fluint.uiImpersonation.UIImpersonator;
+
+ import spark.components.gridClasses.GridColumn;
+ import spark.components.gridClasses.GridSelectionMode;
+ import spark.events.GridEvent;
+
+ public class DataGrid_FLEX_26808_Tests
+ {
+ private static const NO_ENTER_FRAMES_TO_ALLOW:int = 2;
+ private static const _finishNotifier:EventDispatcher = new EventDispatcher();
+ private static var noEnterFramesRemaining:int = NaN;
+ private var _sut:DataGridInspectable;
+ private var _firstObject:FLEX_26808_VO;
+
+ [Before]
+ public function setUp():void
+ {
+ _sut = new DataGridInspectable();
+
+ _sut.dragEnabled = true;
+ _sut.selectionMode = GridSelectionMode.MULTIPLE_ROWS;
+ _sut.columns = new ArrayCollection([new GridColumn("name")]);
+ _sut.width = 200;
+ _sut.height = 200;
+
+ const tenObjects:IList = generateVOs(10);
+ _firstObject = tenObjects.getItemAt(0) as FLEX_26808_VO;
+ const dataProvider:ListCollectionView = new ListCollectionView(tenObjects);
+ _sut.dataProvider = dataProvider;
+ }
+
+ [After]
+ public function tearDown():void
+ {
+ _sut = null;
+ noEnterFramesRemaining = NaN;
+ }
+
+ [Test(async, timeout=1000)]
+ public function test_ctrl_click_removes_selected_item():void
+ {
+ //when
+ UIImpersonator.addElement(_sut);
+
+ //then
+ assertNull(_sut.selectedItem);
+
+ noEnterFramesRemaining = NO_ENTER_FRAMES_TO_ALLOW;
+ UIImpersonator.testDisplay.addEventListener(Event.ENTER_FRAME, onEnterFrame);
+ Async.handleEvent(this, _finishNotifier, Event.COMPLETE, testSelectionAndDeselection, 800);
+ }
+
+ private function testSelectionAndDeselection(event:Event, passThroughData:Object):void
+ {
+ function onGridMouseDown(event:GridEvent):void
+ {
+ assertEquals(0, event.rowIndex);
+ assertTrue(event.ctrlKey);
+ }
+
+ //when
+ _sut.setSelectedIndex(0);
+
+ //then
+ assertEquals(_firstObject, _sut.selectedItem);
+
+ //given
+ const mouseDown:MouseEvent = new MouseEvent(MouseEvent.MOUSE_DOWN, true, false, 5, 5, null, true, false, false);
+ const mouseUp:MouseEvent = new MouseEvent(MouseEvent.MOUSE_UP, true, false, 5, 5, null, true, false, false);
+ _sut.addEventListener(GridEvent.GRID_MOUSE_DOWN, onGridMouseDown);
+
+ //when - Ctrl+Click on first item to deselect it
+ _sut.grid.dispatchEvent(mouseDown);
+ _sut.grid.dispatchEvent(mouseUp);
+
+ //then
+ assertEquals(1, _sut.commitInteractiveSelection_calls);
+ assertNull("The selection should have been removed due to Ctrl+Click!", _sut.selectedItem);
+ _sut.removeEventListener(GridEvent.GRID_MOUSE_DOWN, onGridMouseDown);
+ }
+
+ private static function onEnterFrame(event:Event):void
+ {
+ if(!--noEnterFramesRemaining)
+ {
+ UIImpersonator.testDisplay.removeEventListener(Event.ENTER_FRAME, onEnterFrame);
+ _finishNotifier.dispatchEvent(new Event(Event.COMPLETE));
+ }
+ }
+
+ 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_26808_VO
+ {
+ return new FLEX_26808_VO(i, "Object", "Street");
+ }
+ }
+}
+
+import spark.components.DataGrid;
+import spark.skins.spark.DataGridSkin;
+
+[Bindable]
+class FLEX_26808_VO
+{
+ public var name:String;
+ public var address:FLEX_26808_AddressVO;
+ public var index:Number;
+
+ public function FLEX_26808_VO(index:Number, namePrefix:String, streetPrefix:String)
+ {
+ this.index = index;
+ this.name = namePrefix + index;
+ this.address = new FLEX_26808_AddressVO(streetPrefix + index, Math.floor(index), new Date(2000 + Math.floor(index), Math.floor(index), 1, 0, 0, 0, 1));
+ }
+}
+
+[Bindable]
+class FLEX_26808_AddressVO
+{
+ public var street:String;
+ public var houseNumber:int;
+ public var dateMovedIn:Date;
+
+ public function FLEX_26808_AddressVO(street:String, houseNumber:int, dateMovedIn:Date)
+ {
+ this.street = street;
+ this.houseNumber = houseNumber;
+ this.dateMovedIn = dateMovedIn;
+ }
+}
+
+class DataGridInspectable extends DataGrid
+{
+ public function DataGridInspectable()
+ {
+ super();
+ this.setStyle("skinClass", DataGridSkin);
+ }
+
+ public var commitInteractiveSelection_calls:int = 0;
+
+ override protected function commitInteractiveSelection(selectionEventKind:String,
+ rowIndex:int,
+ columnIndex:int,
+ rowCount:int = 1,
+ columnCount:int = 1):Boolean
+
+ {
+ commitInteractiveSelection_calls++;
+ return super.commitInteractiveSelection(selectionEventKind, rowIndex, columnIndex, rowCount, columnCount);
+ }
+}
\ No newline at end of file