| <?xml version="1.0" encoding="utf-8"?> |
| <!-- |
| |
| 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. |
| |
| --> |
| <UnitTester |
| testDir="mx/collections/AsyncListView/methods/" |
| xmlns:mx="http://www.adobe.com/2006/mxml" |
| xmlns="*" |
| xmlns:assets="assets.*" |
| testSWF="AsyncListView_App1.mxml"> |
| |
| <!-- this set of lines form a template that must be in each unit test --> |
| <mx:Script> |
| <![CDATA[ |
| public static function init(o:DisplayObject):void |
| { |
| } |
| ]]> |
| </mx:Script> |
| <mx:Metadata> |
| <![CDATA[ |
| [Mixin] |
| ]]> |
| </mx:Metadata> |
| <!-- end of set of lines that must be in each unit test --> |
| |
| <mx:Script> |
| <![CDATA[ |
| |
| import assets.*; |
| import mx.collections.*; |
| import mx.core.FlexGlobals; |
| |
| public var savedObject:Object; |
| |
| ]]> |
| </mx:Script> |
| |
| <testCases> |
| |
| <!-- |
| All we do is pass the itemUpdated() call to the list. We literally do nothing else, so it will only |
| be tested lightly here. |
| |
| public function setup( responseDelay:int = 500, |
| numItems:int = 100, |
| numPreloadedPages:int = 0, |
| pageSize:int = 1, |
| mode:String = 'manual', |
| failureProbability:int = 0, |
| createPendingItemFunction:Boolean = true, |
| createFailedItemFunction:Boolean = true):void{ |
| --> |
| |
| <TestCase testID="itemUpdated_test1" keywords="[AsyncListView,itemUpdated]" description="Update the server (simulator), then tell the AsyncListView that it was updated." > |
| <setup> |
| <ResetComponent target="obj1" className="assets.PagedDataComp1" waitEvent="updateComplete" /> |
| <RunCode code="FlexGlobals.topLevelApplication.obj1.setup(0,3)" waitTarget="obj1.theList.dataGroup" waitEvent="updateComplete" /> |
| <RunCode code="savedObject = FlexGlobals.topLevelApplication.obj1.alv.getItemAt(0)" /> |
| </setup> |
| <body> |
| <RunCode code="FlexGlobals.topLevelApplication.obj1.items.receiveItem(0)" waitTarget="obj1.theList.dataGroup" waitEvent="updateComplete" /> |
| <RunCode code="FlexGlobals.topLevelApplication.obj1.items.source[0].info = 'changed item'" /> |
| <RunCode code="FlexGlobals.topLevelApplication.obj1.alv.itemUpdated(FlexGlobals.topLevelApplication.obj1.alv.getItemAt(0), 'info', 'item 0 present', 'changed item')" waitTarget="obj1.theList.dataGroup" waitEvent="updateComplete" /> |
| <AssertMethodValue method="value = FlexGlobals.topLevelApplication.obj1.alv.getItemAt(0).info" value="changed item" /> |
| <AssertMethodValue method="value = FlexGlobals.topLevelApplication.obj1.alv.getItemIndex(FlexGlobals.topLevelApplication.obj1.alv.getItemAt(0))" value="0" /> |
| <AssertMethodValue method="value = FlexGlobals.topLevelApplication.obj1.theList.dataGroup.getElementAt(0).nameLabel.text" value="changed item" /> |
| <AssertPropertyValue target="obj1.alv" propertyName="length" value="3" /> |
| </body> |
| </TestCase> |
| |
| |
| |
| </testCases> |
| </UnitTester> |