You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@flex.apache.org by Alex Harui <ah...@adobe.com> on 2015/06/09 21:08:19 UTC

Re: git commit: [flex-sdk] [refs/heads/develop] - FLEX-34854 FLEX-34885 While trying to figure out whether ComplexFieldChangeWatcher should handle CollectionEventKind.UPDATE events, I stumbled on this bug. This is the unit test which demonstrates it (c...

Good luck.
-Alex

On 6/9/15, 1:25 AM, "Mihai Chira" <mi...@apache.org> wrote:

>Just want to make sure that everyone thinks this is a bug? I think it
>is because in mx.collections.ListCollectionView.handlePropertyChangeEvents
>it explicitly decides to call moveItemInView() if, among others,
>updateInfo.property is null or empty. But then it fails to remove the
>old item from the localIndex. If no one disagrees, I'll proceed to
>solve it.
>
>On 9 June 2015 at 10:21,  <mi...@apache.org> wrote:
>> Repository: flex-sdk
>> Updated Branches:
>>   refs/heads/develop 97e625a80 -> 2779ea9f3
>>
>>
>> FLEX-34854 FLEX-34885
>> While trying to figure out whether ComplexFieldChangeWatcher should
>>handle CollectionEventKind.UPDATE events, I stumbled on this bug. This
>>is the unit test which demonstrates it (currently fails, since the bug
>>is still there).
>>
>>
>> Project: http://git-wip-us.apache.org/repos/asf/flex-sdk/repo
>> Commit: http://git-wip-us.apache.org/repos/asf/flex-sdk/commit/2779ea9f
>> Tree: http://git-wip-us.apache.org/repos/asf/flex-sdk/tree/2779ea9f
>> Diff: http://git-wip-us.apache.org/repos/asf/flex-sdk/diff/2779ea9f
>>
>> Branch: refs/heads/develop
>> Commit: 2779ea9f32e8053edd3bc2620ccfbc37f52c3eba
>> Parents: 97e625a
>> Author: Mihai Chira <mi...@apache.org>
>> Authored: Tue Jun 9 10:21:18 2015 +0200
>> Committer: Mihai Chira <mi...@apache.org>
>> Committed: Tue Jun 9 10:21:18 2015 +0200
>>
>> ----------------------------------------------------------------------
>>  .../tests/ListCollectionView_Sort_Tests.as      | 39
>>+++++++++++++++++---
>>  1 file changed, 33 insertions(+), 6 deletions(-)
>> ----------------------------------------------------------------------
>>
>>
>> 
>>http://git-wip-us.apache.org/repos/asf/flex-sdk/blob/2779ea9f/frameworks/
>>projects/framework/tests/ListCollectionView_Sort_Tests.as
>> ----------------------------------------------------------------------
>> diff --git 
>>a/frameworks/projects/framework/tests/ListCollectionView_Sort_Tests.as
>>b/frameworks/projects/framework/tests/ListCollectionView_Sort_Tests.as
>> index 7024626..f21310e 100644
>> --- 
>>a/frameworks/projects/framework/tests/ListCollectionView_Sort_Tests.as
>> +++ 
>>b/frameworks/projects/framework/tests/ListCollectionView_Sort_Tests.as
>> @@ -360,6 +360,37 @@ package {
>>              assertRemoveAll();
>>          }
>>
>> +        [Test]
>> +        public function
>>test_marking_entire_item_as_updated_gets_the_old_object_out_of_the_list()
>>:void
>> +        {
>> +            //given
>> +            var from0To4:IList = generateVOs(5);
>> +            _sut.addAll(from0To4);
>> +
>> +            const sortByNameAscending:Sort = new Sort();
>> +            sortByNameAscending.fields = [new SortField("name", false,
>>false, false)];
>> +            _sut.sort = sortByNameAscending;
>> +            _sut.refresh(); //values["name"]: Object0, Object1,
>>Object2, Object3, Object4
>> +
>> +            //when
>> +            const removedItem:ListCollectionView_Sort_VO =
>>_sut.getItemAt(0) as ListCollectionView_Sort_VO;
>> +            const newItem:ListCollectionView_Sort_VO =
>>generateOneObject(0);
>> +            (_sut.list as ArrayList).source[0] = newItem;
>> +            _sut.itemUpdated(newItem, null, removedItem, newItem);
>> +
>> +            removedItem.name = "Object7"; //should make no difference
>> +            newItem.name = "Object9"; //should place it at the end of
>>the list
>> +
>> +            //then
>> +            const indexOfRemovedItem:int =
>>_sut.getItemIndex(removedItem);
>> +            assertEquals("the item should have been removed from the
>>list", -1, indexOfRemovedItem);
>> +            for(var i:int = 0; i < _sut.length; i++)
>> +            {
>> +                assertThat(_sut.getItemAt(i) != removedItem);
>> +            }
>> +            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
>>          {
>>              assertFieldValuesAre("index", indexes);
>> @@ -442,15 +473,11 @@ package {
>>      }
>>  }
>>
>> +[Bindable]
>>  dynamic class ListCollectionView_Sort_VO
>>  {
>> -    [Bindable]
>>      public var name:String;
>> -
>> -    [Bindable]
>>      public var address:ListCollectionView_Sort_AddressVO;
>> -
>> -    [Bindable]
>>      public var index:Number;
>>
>>      public function ListCollectionView_Sort_VO(index:Number,
>>namePrefix:String, streetPrefix:String)
>> @@ -461,9 +488,9 @@ dynamic class ListCollectionView_Sort_VO
>>      }
>>  }
>>
>> +[Bindable]
>>  class ListCollectionView_Sort_AddressVO
>>  {
>> -    [Bindable]
>>      public var street:String;
>>
>>      public function ListCollectionView_Sort_AddressVO(street:String)
>>


Re: git commit: [flex-sdk] [refs/heads/develop] - FLEX-34854 FLEX-34885 While trying to figure out whether ComplexFieldChangeWatcher should handle CollectionEventKind.UPDATE events, I stumbled on this bug. This is the unit test which demonstrates it (c...

Posted by Mihai Chira <mi...@gmail.com>.
Thanks, it's fixed (at least on the mx side).

On 9 June 2015 at 21:08, Alex Harui <ah...@adobe.com> wrote:
> Good luck.
> -Alex
>
> On 6/9/15, 1:25 AM, "Mihai Chira" <mi...@apache.org> wrote:
>
>>Just want to make sure that everyone thinks this is a bug? I think it
>>is because in mx.collections.ListCollectionView.handlePropertyChangeEvents
>>it explicitly decides to call moveItemInView() if, among others,
>>updateInfo.property is null or empty. But then it fails to remove the
>>old item from the localIndex. If no one disagrees, I'll proceed to
>>solve it.
>>
>>On 9 June 2015 at 10:21,  <mi...@apache.org> wrote:
>>> Repository: flex-sdk
>>> Updated Branches:
>>>   refs/heads/develop 97e625a80 -> 2779ea9f3
>>>
>>>
>>> FLEX-34854 FLEX-34885
>>> While trying to figure out whether ComplexFieldChangeWatcher should
>>>handle CollectionEventKind.UPDATE events, I stumbled on this bug. This
>>>is the unit test which demonstrates it (currently fails, since the bug
>>>is still there).
>>>
>>>
>>> Project: http://git-wip-us.apache.org/repos/asf/flex-sdk/repo
>>> Commit: http://git-wip-us.apache.org/repos/asf/flex-sdk/commit/2779ea9f
>>> Tree: http://git-wip-us.apache.org/repos/asf/flex-sdk/tree/2779ea9f
>>> Diff: http://git-wip-us.apache.org/repos/asf/flex-sdk/diff/2779ea9f
>>>
>>> Branch: refs/heads/develop
>>> Commit: 2779ea9f32e8053edd3bc2620ccfbc37f52c3eba
>>> Parents: 97e625a
>>> Author: Mihai Chira <mi...@apache.org>
>>> Authored: Tue Jun 9 10:21:18 2015 +0200
>>> Committer: Mihai Chira <mi...@apache.org>
>>> Committed: Tue Jun 9 10:21:18 2015 +0200
>>>
>>> ----------------------------------------------------------------------
>>>  .../tests/ListCollectionView_Sort_Tests.as      | 39
>>>+++++++++++++++++---
>>>  1 file changed, 33 insertions(+), 6 deletions(-)
>>> ----------------------------------------------------------------------
>>>
>>>
>>>
>>>http://git-wip-us.apache.org/repos/asf/flex-sdk/blob/2779ea9f/frameworks/
>>>projects/framework/tests/ListCollectionView_Sort_Tests.as
>>> ----------------------------------------------------------------------
>>> diff --git
>>>a/frameworks/projects/framework/tests/ListCollectionView_Sort_Tests.as
>>>b/frameworks/projects/framework/tests/ListCollectionView_Sort_Tests.as
>>> index 7024626..f21310e 100644
>>> ---
>>>a/frameworks/projects/framework/tests/ListCollectionView_Sort_Tests.as
>>> +++
>>>b/frameworks/projects/framework/tests/ListCollectionView_Sort_Tests.as
>>> @@ -360,6 +360,37 @@ package {
>>>              assertRemoveAll();
>>>          }
>>>
>>> +        [Test]
>>> +        public function
>>>test_marking_entire_item_as_updated_gets_the_old_object_out_of_the_list()
>>>:void
>>> +        {
>>> +            //given
>>> +            var from0To4:IList = generateVOs(5);
>>> +            _sut.addAll(from0To4);
>>> +
>>> +            const sortByNameAscending:Sort = new Sort();
>>> +            sortByNameAscending.fields = [new SortField("name", false,
>>>false, false)];
>>> +            _sut.sort = sortByNameAscending;
>>> +            _sut.refresh(); //values["name"]: Object0, Object1,
>>>Object2, Object3, Object4
>>> +
>>> +            //when
>>> +            const removedItem:ListCollectionView_Sort_VO =
>>>_sut.getItemAt(0) as ListCollectionView_Sort_VO;
>>> +            const newItem:ListCollectionView_Sort_VO =
>>>generateOneObject(0);
>>> +            (_sut.list as ArrayList).source[0] = newItem;
>>> +            _sut.itemUpdated(newItem, null, removedItem, newItem);
>>> +
>>> +            removedItem.name = "Object7"; //should make no difference
>>> +            newItem.name = "Object9"; //should place it at the end of
>>>the list
>>> +
>>> +            //then
>>> +            const indexOfRemovedItem:int =
>>>_sut.getItemIndex(removedItem);
>>> +            assertEquals("the item should have been removed from the
>>>list", -1, indexOfRemovedItem);
>>> +            for(var i:int = 0; i < _sut.length; i++)
>>> +            {
>>> +                assertThat(_sut.getItemAt(i) != removedItem);
>>> +            }
>>> +            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
>>>          {
>>>              assertFieldValuesAre("index", indexes);
>>> @@ -442,15 +473,11 @@ package {
>>>      }
>>>  }
>>>
>>> +[Bindable]
>>>  dynamic class ListCollectionView_Sort_VO
>>>  {
>>> -    [Bindable]
>>>      public var name:String;
>>> -
>>> -    [Bindable]
>>>      public var address:ListCollectionView_Sort_AddressVO;
>>> -
>>> -    [Bindable]
>>>      public var index:Number;
>>>
>>>      public function ListCollectionView_Sort_VO(index:Number,
>>>namePrefix:String, streetPrefix:String)
>>> @@ -461,9 +488,9 @@ dynamic class ListCollectionView_Sort_VO
>>>      }
>>>  }
>>>
>>> +[Bindable]
>>>  class ListCollectionView_Sort_AddressVO
>>>  {
>>> -    [Bindable]
>>>      public var street:String;
>>>
>>>      public function ListCollectionView_Sort_AddressVO(street:String)
>>>
>