flex-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Alex Harui <aha...@adobe.com>
Subject Re: git commit: [flex-sdk] [refs/heads/develop] - FLEX-34854 FLEX-34884 Adding unit test to make sure that the changes in FLEX-34854 haven't changed anything about findItem.
Date Thu, 16 Jul 2015 19:20:04 GMT
Hi Mihai, 

We have seen mustella test failures that appear to be related to your
changes.  Can you take a look?


     [java] =====================================================
     [java] 	Failed:
     [java] =====================================================
     [java] LangPacks/Japanese/tests/runtimeErrorTests
JA_RTE_Sort_FindCondition Failed
AssertMethodValue%20%28method%20cannot%20be%20shown%29%28body%3Astep%201%29
%20%20method%20returned%20Error%20%231063%3A%20Argument%20count%20mismatch%
20on%20runtimeErrorTests/cmpFn%28%29.%20Expected%202%2C%20got%203.%2C%20exp
ected%20%u691C%u7D22%u57FA%u6E96%u306B%u306F%u3001%27field1%27%20%u306B%u30
44%u305F%u308B%u3059%u3079%u3066%u306E%u30BD%u30FC%u30C8%u30D5%u30A3%u30FC%
u30EB%u30C9%u304C%u542B%u307E%u308C%u3066%u3044%u308B%u5FC5%u8981%u304C%u30
42%u308A%u307E%u3059%u3002
     [java] LangPacks/Japanese/tests/runtimeErrorTests
JA_RTE_Sort_FindRestriction Failed
AssertMethodValue%20%28method%20cannot%20be%20shown%29%28body%3Astep%201%29
%20%20method%20returned%20Error%20%231063%3A%20Argument%20count%20mismatch%
20on%20runtimeErrorTests/cmpFn%28%29.%20Expected%202%2C%20got%203.%2C%20exp
ected%20%u691C%u7D22%u6761%u4EF6%u306B%u306F%u3001%u6700%u4F4E%201%20%u3064
%u306E%u30BD%u30FC%u30C8%u30D5%u30A3%u30FC%u30EB%u30C9%u5024%u304C%u542B%u3
07E%u308C%u3066%u3044%u308B%u5FC5%u8981%u304C%u3042%u308A%u307E%u3059
     [java] gumbo/components/DataGrid/Integrations/DataGrid_layout_test001
listCollection_getItemIndex_afterSort Failed AssertMethodValue (method
cannot be shown)(body:step 2)  method returned 3, expected -1
     [java] 
resources/ResourceManager/Methods/ResourceManager_Methods_loadResourceModul
e RTL_Method_loadResourceModule_SameLocaleSameBundle Failed
AssertMethodValue (method cannot be shown)(body:step 11)  method returned
null, expected Shut down
     [java] 
spark/collections/Sort/Other/SF_module_sparkButtonBar_global_tester
SortField_module_sparkButtonBar_localeStyle_global_test1 Failed
SetProperty, propertyName = globalLocal(setup:step 3)  Timeout waiting for
change from NVModule.child.globalSort
     [java] spark/collections/Sort/Other/SF_module_sparkButtonBar_tester
SortField_module_sparkButtonBar_localeStyle_classSelector_test22 Failed
AssertStyleValue(body:step 1)  NVModule.child.classSort.locale ru-RU !=
ja-JP
     [java] spark/collections/Sort/Other/SF_module_sparkButtonBar_tester
SortField_module_sparkButtonBar_localeStyle_IDSelector_test23 Failed
AssertStyleValue(body:step 1)  NVModule.child.idSortField.locale ru-RU !=
fr-CA
     [java] spark/collections/Sort/Methods/SF_sort_findItem_tester
SortField_findItem_field_error_test21 Failed AssertMethodValue (method
cannot be shown)(body:step 2)  method returned noError, expected Error:
Find criteria must contain all sort fields leading up to  age .
     [java] spark/collections/Sort/Methods/SF_sort_findItem_tester
SortField_findItem_field_error_script_test22 Failed AssertMethodValue
(method cannot be shown)(body:step 2)  method returned noError, expected
Error: Find criteria must contain all sort fields leading up to  age .


Thanks,
-Alex

On 7/16/15, 11:38 AM, "mihaic@apache.org" <mihaic@apache.org> wrote:

>Repository: flex-sdk
>Updated Branches:
>  refs/heads/develop ece249f87 -> f14f5f8ae
>
>
>FLEX-34854 FLEX-34884
>Adding unit test to make sure that the changes in FLEX-34854 haven't
>changed anything about findItem.
>
>
>Project: http://git-wip-us.apache.org/repos/asf/flex-sdk/repo
>Commit: http://git-wip-us.apache.org/repos/asf/flex-sdk/commit/f14f5f8a
>Tree: http://git-wip-us.apache.org/repos/asf/flex-sdk/tree/f14f5f8a
>Diff: http://git-wip-us.apache.org/repos/asf/flex-sdk/diff/f14f5f8a
>
>Branch: refs/heads/develop
>Commit: f14f5f8aeef8d916dd3e5b25c06bedf69779a24a
>Parents: ece249f
>Author: Mihai Chira <mihaic@apache.org>
>Authored: Thu Jul 16 20:37:02 2015 +0200
>Committer: Mihai Chira <mihaic@apache.org>
>Committed: Thu Jul 16 20:37:02 2015 +0200
>
>----------------------------------------------------------------------
> .../framework/tests/FLEX_34854_Tests.as         |   9 -
> .../framework/tests/FLEX_34884_Tests.as         | 394 +++++++++++++++++++
> 2 files changed, 394 insertions(+), 9 deletions(-)
>----------------------------------------------------------------------
>
>
>http://git-wip-us.apache.org/repos/asf/flex-sdk/blob/f14f5f8a/frameworks/p
>rojects/framework/tests/FLEX_34854_Tests.as
>----------------------------------------------------------------------
>diff --git a/frameworks/projects/framework/tests/FLEX_34854_Tests.as
>b/frameworks/projects/framework/tests/FLEX_34854_Tests.as
>index 2eec5f6..803e8ab 100644
>--- a/frameworks/projects/framework/tests/FLEX_34854_Tests.as
>+++ b/frameworks/projects/framework/tests/FLEX_34854_Tests.as
>@@ -220,15 +220,6 @@ package {
>             assertEquals("the new item should have been moved to the end
>of the list", _sut.length - 1, _sut.getItemIndex(newItem));
>         }
> 
>-        private function assertIndexesAre(indexes:Array):void
>-        {
>-            assertEquals(indexes.length, _sut.length);
>-
>-            for(var i:int = 0; i < _sut.length; i++)
>-            {
>-                
>assertEquals(ListCollectionView_FLEX_34854_VO(_sut.getItemAt(i)).index,
>indexes[i]);
>-            }
>-        }
> 
> 
>         private static function generateVOs(no:int, reverse:Boolean =
>false):IList
>
>http://git-wip-us.apache.org/repos/asf/flex-sdk/blob/f14f5f8a/frameworks/p
>rojects/framework/tests/FLEX_34884_Tests.as
>----------------------------------------------------------------------
>diff --git a/frameworks/projects/framework/tests/FLEX_34884_Tests.as
>b/frameworks/projects/framework/tests/FLEX_34884_Tests.as
>new file mode 100644
>index 0000000..7bfe80c
>--- /dev/null
>+++ b/frameworks/projects/framework/tests/FLEX_34884_Tests.as
>@@ -0,0 +1,394 @@
>+/////////////////////////////////////////////////////////////////////////
>///////
>+//
>+//  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 {
>+    import mx.collections.ArrayList;
>+    import mx.collections.ComplexFieldChangeWatcher;
>+    import mx.collections.ComplexSortField;
>+    import mx.collections.IList;
>+    import mx.collections.ListCollectionView;
>+    import mx.collections.Sort;
>+    import mx.collections.SortField;
>+
>+    import org.flexunit.assertThat;
>+
>+    import org.flexunit.asserts.assertEquals;
>+
>+    public class FLEX_34884_Tests {
>+        private var _sut:ListCollectionView;
>+
>+        private static const MILLISECONDS_IN_A_SECOND:Number = 1000;
>+        private static const MILLISECONDS_IN_A_MINUTE:Number =
>MILLISECONDS_IN_A_SECOND * 60;
>+        private static const MILLISECONDS_IN_AN_HOUR:Number =
>MILLISECONDS_IN_A_MINUTE * 60;
>+        private static const MILLISECONDS_IN_A_DAY:Number =
>MILLISECONDS_IN_AN_HOUR * 24;
>+
>+        [Before]
>+        public function setUp():void
>+        {
>+            _sut = new ListCollectionView(new ArrayList());
>+        }
>+
>+        [After]
>+        public function tearDown():void
>+        {
>+            _sut = null;
>+        }
>+
>+        [Test]
>+        public function
>getItemIndex_finds_first_item_in_simple_sorted_non_filtered_list():void
>+        {
>+            //given
>+            var from0To4:IList = generateVOs(5);
>+            _sut.addAll(from0To4); //values: Object0, Object1, Object2,
>Object3, Object4
>+
>+            const sortByIndexAscending:Sort = new Sort();
>+            sortByIndexAscending.fields = [new SortField("index", false,
>false, true)];
>+            _sut.sort = sortByIndexAscending;
>+            _sut.refresh(); //values (unchanged): Object0, Object1,
>Object2, Object3, Object4
>+
>+            //when
>+            var item0:FLEX_34884_VO = from0To4.getItemAt(0) as
>FLEX_34884_VO;
>+            var item0Index:int = _sut.getItemIndex(item0);
>+
>+            //then
>+            assertEquals(0, item0Index);
>+        }
>+
>+        [Test]
>+        public function
>getItemIndex_finds_last_item_in_simple_descending_sorted_non_filtered_list
>():void
>+        {
>+            //given
>+            var from0To4:IList = generateVOs(5);
>+            _sut.addAll(from0To4); //values: Object0, Object1, Object2,
>Object3, Object4
>+
>+            const sortByIndexDescending:Sort = new Sort();
>+            sortByIndexDescending.fields = [new SortField("index",
>false, true, true)];
>+            _sut.sort = sortByIndexDescending;
>+            _sut.refresh(); //values: Object4, Object3, Object2,
>Object1, Object0
>+
>+            //when
>+            var item0:FLEX_34884_VO = from0To4.getItemAt(0) as
>FLEX_34884_VO;
>+            var item0Index:int = _sut.getItemIndex(item0);
>+
>+            //then
>+            assertEquals(_sut.length - 1, item0Index);
>+        }
>+
>+        [Test]
>+        public function
>getItemIndex_finds_second_to_last_item_in_simple_descending_sorted_non_fil
>tered_list():void
>+        {
>+            //given
>+            var from0To4:IList = generateVOs(5);
>+            _sut.addAll(from0To4); //values: Object0, Object1, Object2,
>Object3, Object4
>+
>+            const sortByIndexDescending:Sort = new Sort();
>+            sortByIndexDescending.fields = [new SortField("index",
>false, true, true)];
>+            _sut.sort = sortByIndexDescending;
>+            _sut.refresh(); //values: Object4, Object3, Object2,
>Object1, Object0
>+
>+            //when
>+            var item1:FLEX_34884_VO = from0To4.getItemAt(1) as
>FLEX_34884_VO;
>+            var item1Index:int = _sut.getItemIndex(item1);
>+
>+            //then
>+            assertEquals(_sut.length - 2, item1Index);
>+        }
>+
>+        [Test]
>+        public function
>getItemIndex_finds_second_to_last_item_in_simple_no_fields_non_unique_sort
>ed_list():void
>+        {
>+            //given
>+            var from0To4:IList = generateVOs(5);
>+            _sut.addAll(from0To4); //values: Object0, Object1, Object2,
>Object3, Object4
>+
>+            const emptySort:Sort = new Sort(null, null, false);
>+            _sut.sort = emptySort;
>+            _sut.refresh(); //values should be unchanged
>+
>+            //when
>+            var item1:FLEX_34884_VO = from0To4.getItemAt(1) as
>FLEX_34884_VO;
>+
>+            //then
>+            var item1Index:int = _sut.getItemIndex(item1);
>+            assertEquals(1, item1Index);
>+        }
>+
>+        [Test]
>+        public function
>getItemIndex_finds_second_to_last_item_in_simple_no_fields_unique_sorted_l
>ist():void
>+        {
>+            //given
>+            var from0To4:IList = generateVOs(5);
>+            _sut.addAll(from0To4); //values: Object0, Object1, Object2,
>Object3, Object4
>+
>+            const emptySort:Sort = new Sort(null, null, true);
>+            _sut.sort = emptySort;
>+            _sut.refresh(); //values should be unchanged
>+
>+            //when
>+            var item1:FLEX_34884_VO = from0To4.getItemAt(1) as
>FLEX_34884_VO;
>+
>+            //then
>+            var item1Index:int = _sut.getItemIndex(item1);
>+            assertEquals(1, item1Index);
>+        }
>+
>+        [Test]
>+        public function
>getItemIndex_finds_second_to_last_date_in_simple_no_fields_unique_sorted_l
>ist_of_dates():void
>+        {
>+            //given
>+            var yesterday:Date = new Date();
>+            yesterday.setTime(yesterday.getTime() -
>MILLISECONDS_IN_A_DAY);
>+
>+            var today:Date = new Date();
>+
>+            var tomorrow:Date = new Date();
>+            tomorrow.setTime(tomorrow.getTime() + MILLISECONDS_IN_A_DAY);
>+
>+            _sut.addItem(tomorrow);
>+            _sut.addItem(today);
>+            _sut.addItem(yesterday);
>+
>+            //when
>+            const emptySort:Sort = new Sort(null, null, true);
>+            _sut.sort = emptySort;
>+            _sut.refresh(); //values: yesterday, today, tomorrow
>+
>+            //then
>+            assertEquals(0, _sut.getItemIndex(yesterday));
>+            assertEquals(1, _sut.getItemIndex(today));
>+            assertEquals(2, _sut.getItemIndex(tomorrow));
>+        }
>+
>+        [Test]
>+        public function
>getItemIndex_finds_second_to_last_date_in_simple_no_fields_non_unique_sort
>ed_list_of_dates():void
>+        {
>+            //given
>+            var yesterday:Date = new Date();
>+            yesterday.setTime(yesterday.getTime() -
>MILLISECONDS_IN_A_DAY);
>+
>+            var today:Date = new Date();
>+
>+            var tomorrow:Date = new Date();
>+            tomorrow.setTime(tomorrow.getTime() + MILLISECONDS_IN_A_DAY);
>+
>+            _sut.addItem(tomorrow);
>+            _sut.addItem(today);
>+            _sut.addItem(yesterday);
>+            _sut.addItem(today);
>+
>+            //when
>+            const emptySort:Sort = new Sort(null, null, true);
>+            _sut.sort = emptySort;
>+            _sut.refresh(); //values: yesterday, today, today, tomorrow
>+
>+            //then
>+            assertEquals(0, _sut.getItemIndex(yesterday));
>+            var todayIndex:int = _sut.getItemIndex(today);
>+            assertThat(todayIndex == 1 || todayIndex == 2);
>+            assertEquals(3, _sut.getItemIndex(tomorrow));
>+        }
>+
>+        [Test]
>+        public function
>getItemIndex_finds_first_item_in_complex_sorted_non_filtered_list():void
>+        {
>+            //given
>+            var from0To4:IList = generateVOs(5);
>+            _sut.addAll(from0To4); //values[address.street]: Street0,
>Street1, Street2, Street3, Street4
>+
>+            const sortByIndexAscending:Sort = new Sort();
>+            sortByIndexAscending.fields = [new
>ComplexSortField("address.street", false, false, false)];
>+            _sut.sort = sortByIndexAscending;
>+            _sut.refresh(); //values[address.street] (unchanged):
>Street0, Street1, Street2, Street3, Street4
>+
>+            //when
>+            var item0:FLEX_34884_VO = from0To4.getItemAt(0) as
>FLEX_34884_VO;
>+            var item0Index:int = _sut.getItemIndex(item0);
>+
>+            //then
>+            assertEquals(0, item0Index);
>+        }
>+
>+        [Test]
>+        public function
>getItemIndex_finds_last_item_in_complex_descending_sorted_non_filtered_lis
>t():void
>+        {
>+            //given
>+            var from0To4:IList = generateVOs(5);
>+            _sut.addAll(from0To4); //values[address.street]: Street0,
>Street1, Street2, Street3, Street4
>+
>+            const sortByIndexDescending:Sort = new Sort();
>+            sortByIndexDescending.fields = [new
>ComplexSortField("address.street", false, true, false)];
>+            _sut.sort = sortByIndexDescending;
>+            _sut.refresh(); //values: Street4, Street3, Street2,
>Street1, Street0
>+
>+            //when
>+            var item0:FLEX_34884_VO = from0To4.getItemAt(0) as
>FLEX_34884_VO;
>+            var item0Index:int = _sut.getItemIndex(item0);
>+
>+            //then
>+            assertEquals(_sut.length - 1, item0Index);
>+        }
>+
>+        [Test]
>+        public function
>getItemIndex_finds_item_in_complex_descending_sorted_list_after_its_reposi
>tioned_due_to_its_sort_field_changing():void
>+        {
>+            //given
>+            var from0To4:IList = generateVOs(5);
>+            _sut.addAll(from0To4); //values[address.street]: Street0,
>Street1, Street2, Street3, Street4
>+
>+            const sortByIndexDescending:Sort = new Sort();
>+            sortByIndexDescending.fields = [new
>ComplexSortField("address.street", false, true, false)];
>+            _sut.sort = sortByIndexDescending;
>+            _sut.refresh(); //values: Street4, Street3, Street2,
>Street1, Street0
>+
>+            _sut.complexFieldWatcher = new ComplexFieldChangeWatcher();
>+
>+            //when
>+            var item0:FLEX_34884_VO = from0To4.getItemAt(0) as
>FLEX_34884_VO;
>+            var item999:FLEX_34884_VO = item0;
>+            item999.address.street = "Street999";
>+
>+            //then
>+            var item999Index:int = _sut.getItemIndex(item0);
>+            assertEquals(0, item999Index);
>+        }
>+
>+        [Test]
>+        public function
>getItemIndex_finds_item_in_complex_descending_sorted_list_after_its_reposi
>tioned_in_middle_due_to_its_sort_field_changing():void
>+        {
>+            //given
>+            var from0To4:IList = generateVOs(5);
>+            _sut.addAll(from0To4); //values[address.street]: Street0,
>Street1, Street2, Street3, Street4
>+
>+            const sortByIndexDescending:Sort = new Sort();
>+            sortByIndexDescending.fields = [new
>ComplexSortField("address.street", false, true, false)];
>+            _sut.sort = sortByIndexDescending;
>+            _sut.refresh(); //values[address.street]: Street4, Street3,
>Street2, Street1, Street0
>+
>+            _sut.complexFieldWatcher = new ComplexFieldChangeWatcher();
>+
>+            //when
>+            var item2:FLEX_34884_VO = from0To4.getItemAt(2) as
>FLEX_34884_VO;
>+            item2.address.street = "Street9"; //values[address.street]:
>Street9, Street4, Street3, Street1, Street0
>+
>+            var item0:FLEX_34884_VO = from0To4.getItemAt(0) as
>FLEX_34884_VO;
>+            item0.address.street = "Street2"; //values[address.street]:
>Street9, Street4, Street3, Street2, Street1
>+
>+            //then
>+            var street2Index:int = _sut.getItemIndex(item0);
>+            assertEquals(3, street2Index);
>+        }
>+
>+        [Test]
>+        public function
>getItemIndex_finds_newly_inserted_item_in_complex_descending_sorted_list()
>:void
>+        {
>+            //given
>+            var from0To4:IList = generateVOs(5);
>+            _sut.addAll(from0To4); //values[address.street]: Street0,
>Street1, Street2, Street3, Street4
>+
>+            const sortByIndexDescending:Sort = new Sort();
>+            sortByIndexDescending.fields = [new
>ComplexSortField("address.street", false, true, false)];
>+            _sut.sort = sortByIndexDescending;
>+            _sut.refresh(); //values[address.street]: Street4, Street3,
>Street2, Street1, Street0
>+
>+            _sut.complexFieldWatcher = new ComplexFieldChangeWatcher();
>+
>+            //when
>+            var newItem:FLEX_34884_VO = generateOneObject(9);
>+            _sut.addItemAt(newItem, _sut.length - 1);
>//values[address.street]: Street9, Street4, Street3, Street2, Street1,
>Street0
>+
>+            //then
>+            assertEquals(0, _sut.getItemIndex(newItem));
>+        }
>+
>+        [Test]
>+        public function
>getItemIndex_finds_newly_inserted_item_in_complex_descending_sorted_list_a
>fter_its_sort_field_changes():void
>+        {
>+            //given
>+            var from0To4:IList = generateVOs(5);
>+            _sut.addAll(from0To4); //values[address.street]: Street0,
>Street1, Street2, Street3, Street4
>+
>+            const sortByIndexDescending:Sort = new Sort();
>+            sortByIndexDescending.fields = [new
>ComplexSortField("address.street", false, true, false)];
>+            _sut.sort = sortByIndexDescending;
>+            _sut.refresh(); //values[address.street]: Street4, Street3,
>Street2, Street1, Street0
>+
>+            _sut.complexFieldWatcher = new ComplexFieldChangeWatcher();
>+
>+            //when
>+            var newItem:FLEX_34884_VO = generateOneObject(1);
>+            _sut.addItemAt(newItem, _sut.length - 1);
>//values[address.street]: Street4, Street3, Street2, Street1, Street1,
>Street0
>+
>+            newItem.address.street = "Street3";
>//values[address.street]: Street4, Street3, Street3, Street2, Street1,
>Street1, Street0
>+
>+            //then
>+            var newItemIndex:int = _sut.getItemIndex(newItem);
>+            assertThat(newItemIndex == 1 || newItemIndex == 2);
>+        }
>+
>+        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_34884_VO
>+        {
>+            return new FLEX_34884_VO(i, "Object", "Street");
>+        }
>+    }
>+}
>+
>+[Bindable]
>+class FLEX_34884_VO
>+{
>+    public var name:String;
>+    public var address:FLEX_34884_AddressVO;
>+    public var index:Number;
>+
>+    public function FLEX_34884_VO(index:Number, namePrefix:String,
>streetPrefix:String)
>+    {
>+        this.index = index;
>+        this.name = namePrefix + index;
>+        this.address = new FLEX_34884_AddressVO(streetPrefix + index);
>+    }
>+}
>+
>+[Bindable]
>+class FLEX_34884_AddressVO
>+{
>+    public var street:String;
>+
>+    public function FLEX_34884_AddressVO(street:String)
>+    {
>+        this.street = street;
>+    }
>+}
>\ No newline at end of file
>

Mime
View raw message