flex-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Justin Mclean <jus...@classsoftware.com>
Subject ArrayCollection Mustella test failing
Date Sun, 19 May 2013 02:31:44 GMT

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()">
			import mx.collections.ArrayCollection;
			import mx.collections.Sort;
			import spark.collections.SortField;
			[Bindable] public var ac:ArrayCollection;
			public var players:Array=[
				{team:"TeamTwo",jerseyNumber:7, lastName:"PlayerB",firstName:"Bb"},
				{team:"TeamOne",jerseyNumber:12, lastName:"PlayerC",firstName:"Cc"},
				{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;
				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


View raw message