Hi,
I was looking at the MX sorting test and why it was failing on Linux and as far
as I can can see I'm not sure it should even pass anywhere.
Here's the test:
<TestCase testID="MXSort">
<setup>
<RunCode code="myCollator=new
flash.globalization.Collator('en-US')" />
<RunCode
code="myArray.sort(myCollator.compare)"/>
<RunCode
code="application.sparkSortTests.sortArraycollectionMX()" />
</setup>
<body>
<AssertMethodValue
method="value=myArray.toString()"
valueExpression="value=application.sparkSortTests.myArrayCollection.toArray().toString()"
/>
</body>
</TestCase>
Here's the code that does the same as the test - it expects the two sorted
arrays to be in the same order but using 4.9.1 on OSX they are not, yet the
checkin test passes - any ideas?
<?xml version="1.0" encoding="utf-8"?>
<s:Application xmlns:fx="http://ns.adobe.com/mxml/2009"
xmlns:s="library://ns.adobe.com/flex/spark"
xmlns:mx="library://ns.adobe.com/flex/mx"
initialize="init(event)">
<fx:Declarations>
<mx:SortField id="myMXSortField"/>
<s:Sort id="myMXSort" fields="{[myMXSortField]}"/>
</fx:Declarations>
<fx:Script>
<![CDATA[
import flash.globalization.Collator;
import mx.collections.ArrayCollection;
import mx.events.FlexEvent;
public var myCollator:Collator = new
flash.globalization.Collator('en-US');
public var myArrayCollection:ArrayCollection =
new ArrayCollection(["cote", "côte", "coté",
"côté",
"海 (U+6D77)", "雨 (U+96E8)", "水
(U+6C34)", "川 (U+5DDD)"]);
public var myArray:Array =
["cote", "côte", "coté", "côté",
"海 (U+6D77)", "雨 (U+96E8)", "水
(U+6C34)", "川 (U+5DDD)"];
protected function init(event:FlexEvent):void
{
myArrayCollection.sort = myMXSort;
myArrayCollection.refresh();
trace(myArrayCollection.source.toString());
myArray.sort(myCollator.compare);
myArray.sort();
trace(myArray);
}
]]>
</fx:Script>
</s:Application>
Thanks,
Justin