Your logic is correct.  I just looked at last night's run.  It failed for
me along with 11 other tests.  I automatically run with the -failures
option and there it passed.  I generally don't spend too much time looking
at tests that don't fail twice.

It looks like the issue is that the prior test
(ArrayCollection_Method_itemUpdated
) shares the same array.  The ready() method creates a new
ArrayCollection, but from the same source array which gets modified in
that prior test.  I think I would probably fix both tests to clone() the
array.

On 5/18/13 7:31 PM, "Justin Mclean" <[email protected]> wrote:

>Hi,
>
>I just noticed that one the of ArrayCollection test
>(ArrayCollection_Method_itemUpdated_contains) was failing. At first I
>though it was due to a recent changes I made to the collection classes
>but looks like it's an existing (unreported?) SDK issue.
>
>If I run the code below compiled with Apache Flex develop branch the
>array collection length is 3 after the itemUpdated and 4 before - the
>mustella test is expecting 4 and fails. Both Adobe Flex 4.6 and Apache
>Flex 4.9.1 give 4 in both cases.
>
>When the array is filtered you are left with jersey numbers 12, 12, 21
>and 34. Changing playerC's jersey number to 80 (from 12) and updating the
>item should then filter it out of the collection leaving you with a total
>3 items.
>
>Anyone confirm that my logic is correct and that the test is currently
>wrong?
>
>Here's the code:
>
><?xml version="1.0" encoding="utf-8"?>
><mx:Application xmlns:mx="http://www.adobe.com/2006/mxml";
>layout="vertical" initialize="init()">
>       <mx:Script>
>               <![CDATA[
>                       import mx.collections.ArrayCollection;
>                       import mx.collections.Sort;
>                       
>                       import spark.collections.SortField;
>                               
>                       [Bindable] public var ac:ArrayCollection;
>                       
>                       public var players:Array=[
>                               
> {team:"TeamOne",jerseyNumber:80,lastName:"PlayerA",firstName:"Aa"},
>                               {team:"TeamTwo",jerseyNumber:7, 
> lastName:"PlayerB",firstName:"Bb"},
>                               {team:"TeamOne",jerseyNumber:12, 
> lastName:"PlayerC",firstName:"Cc"},
>                               
> {team:"TeamOne",jerseyNumber:21,lastName:"PlayerD",firstName:"Dd"},
>                               {team:"TeamThree",jerseyNumber:34, 
> lastName:"PlayerE",firstName:"Ee"},
>                               {team:"TeamOne",jerseyNumber:12, 
> lastName:"PlayerF",firstName:"Ff"},
>                               {team:"TeamTwo",jerseyNumber:7, 
> lastName:"PlayerG",firstName:"Gg"},
>                       ];
>                       
>                       private function init():void {
>                               ac = new ArrayCollection(players);
>                               var s:Sort = new Sort();
>                               var f:SortField = new SortField("jerseyNumber");
>                               ac.filterFunction = function 
> (item:Object):Boolean
>                               {
>                                       return item.jerseyNumber >= 12 && 
> item.jerseyNumber <= 34;
>                               }
>                               s.fields = [f];
>                               ac.sort = s;
>                               ac.refresh();
>                               
>                               trace(ac.length); // should be 4
>
>                               var oldValue:Number = players[2].jerseyNumber;
>                               players[2].jerseyNumber = 80;           
>                               ac.itemUpdated(players[2], 'jerseyNumber', 
> oldValue, 80);
>                               
>                               trace(ac.length); // should be 3 test expects 4
>                       } 
>       ]]>
>       </mx:Script>    
>
></mx:Application>
>
>Thanks,
>Justin

Reply via email to