| <?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="gumbo/components/List/methods/" xmlns:fx="http://ns.adobe.com/mxml/2009" xmlns:mx="library://ns.adobe.com/flex/mx" xmlns:s="library://ns.adobe.com/flex/spark" xmlns:m="http://ns.adobe.com/mxml/2009" xmlns="*" testSWF="ListIcons.mxml"> |
| |
| <!-- this set of lines form a template that must be in each unit test --> |
| |
| <fx:Script> |
| <![CDATA[ |
| public static function init(o:DisplayObject):void |
| { |
| } |
| ]]> |
| </fx:Script> |
| |
| <fx:Metadata> |
| <![CDATA[ |
| [Mixin] |
| ]]> |
| </fx:Metadata> |
| <!-- end of set of lines that must be in each unit test --> |
| <fx:Script> |
| <![CDATA[ |
| import comps.*; |
| import spark.layouts.*; |
| import mx.collections.ArrayCollection; |
| ]]> |
| </fx:Script> |
| <testCases> |
| |
| <TestCase testID="CustomList_method_arrayCollection_setItemAt_icons" keywords="[List, method,arrayCollection,binding, setItemAt]" description=""> |
| <setup> |
| <ResetComponent target="list2" className="spark.components.List" waitEvent="updateComplete" /> |
| <SetStyle target="list2" styleName="skinClass" valueExpression="value=CustomIconListSkin" waitEvent="updateComplete" /> |
| |
| </setup> |
| <body> |
| <SetProperty target="list2" propertyName="dataProvider" valueExpression="value=application.createIconsAC()" waitEvent="updateComplete" waitTarget="list2.dataGroup"/> |
| |
| <SetProperty target="list2" propertyName="selectedIndex" value="2" waitEvent="valueCommit" waitTarget="list2"/> |
| <RunCode code="application.list2.dataProvider.setItemAt(application.objIcon,2);" waitEvent="collectionChange" waitTarget="list2.dataProvider" /> |
| <SetProperty target="list2" propertyName="height" value="200" waitEvent="updateComplete" /> |
| <SetProperty target="list2" propertyName="width" value="200" waitEvent="updateComplete" /> |
| <AssertMethodValue method="value=application.list2.selectedItem.label" value="1" /> |
| <AssertPropertyValue target = "list2.dataProvider" propertyName="length" value="10" /> |
| </body> |
| </TestCase> |
| <TestCase testID="CustomList_method_arrayCollection_addItemAt_icons" keywords="[List, method,arrayCollection,binding, addItemAt]" description=""> |
| <setup> |
| <ResetComponent target="list2" className="spark.components.List" waitEvent="updateComplete" /> |
| <SetStyle target="list2" styleName="skinClass" valueExpression="value=CustomIconListSkin" waitEvent="updateComplete" /> |
| </setup> |
| <body> |
| <SetProperty target="list2" propertyName="dataProvider" valueExpression="value=application.createIconsAC()" waitEvent="updateComplete" waitTarget="list2.dataGroup"/> |
| <RunCode code="application.list2.dataProvider.addItem(application.objIcon);" waitEvent="collectionChange" waitTarget="list2.dataProvider" /> |
| <SetProperty target="list2" propertyName="selectedIndex" value="10" waitEvent="valueCommit" waitTarget="list2"/> |
| <SetProperty target="list2" propertyName="height" value="200" waitEvent="updateComplete" /> |
| <SetProperty target="list2" propertyName="width" value="200" waitEvent="updateComplete" /> |
| <AssertMethodValue method="value=application.list2.selectedItem.label" value="1" /> |
| <AssertPropertyValue target = "list2.dataProvider" propertyName="length" value="11" /> |
| <CompareBitmap url="../methods/baselines/$testID.png" target="list2" /> |
| </body> |
| </TestCase> |
| <TestCase testID="CustomList_method_arrayCollection_addItem_icons" keywords="[List, method,arrayCollection,binding, addItem]" description=""> |
| <setup> |
| <ResetComponent target="list2" className="spark.components.List" waitEvent="updateComplete" /> |
| <SetStyle target="list2" styleName="skinClass" valueExpression="value=CustomIconListSkin" waitEvent="updateComplete" /> |
| </setup> |
| <body> |
| <SetProperty target="list2" propertyName="dataProvider" valueExpression="value=application.createIconsAC()" waitEvent="updateComplete" waitTarget="list2.dataGroup"/> |
| |
| <SetProperty target="list2" propertyName="selectedIndex" value="9" waitEvent="valueCommit" waitTarget="list2"/> |
| <AssertMethodValue method="value=application.list2.selectedItem.label" value="10" /> |
| <RunCode code="application.list2.dataProvider.addItem(application.objIcon);" waitEvent="collectionChange" waitTarget="list2.dataProvider" /> |
| <AssertPropertyValue target = "list2" propertyName="selectedIndex" value="9" /> |
| <SetProperty target="list2" propertyName="height" value="200" waitEvent="updateComplete" /> |
| <SetProperty target="list2" propertyName="width" value="200" waitEvent="updateComplete" /> |
| <AssertMethodValue method="value=application.list2.selectedItem.label" value="10" /> |
| <AssertPropertyValue target = "list2.dataProvider" propertyName="length" value="11" /> |
| <CompareBitmap url="../methods/baselines/$testID.png" target="list2" /> |
| </body> |
| </TestCase> |
| <TestCase testID="CustomList_method_arrayCollection_removeItem_icons" keywords="[List, method,arrayCollection,binding, removeItem]" description=""> |
| <setup> |
| <ResetComponent target="list2" className="spark.components.List" waitEvent="updateComplete" /> |
| <SetStyle target="list2" styleName="skinClass" valueExpression="value=CustomIconListSkin" waitEvent="updateComplete" /> |
| </setup> |
| <body> |
| <SetProperty target="list2" propertyName="dataProvider" valueExpression="value=application.createIconsAC()" waitEvent="updateComplete" waitTarget="list2.dataGroup"/> |
| <SetProperty target="list2" propertyName="selectedIndex" value="1" waitEvent="valueCommit" waitTarget="list2"/> |
| <SetProperty target="list2" propertyName="height" value="200" waitEvent="updateComplete" /> |
| <SetProperty target="list2" propertyName="width" value="200" waitEvent="updateComplete" /> |
| <AssertMethodValue method="value=application.list2.selectedItem.label" value="2" /> |
| <RunCode code="application.list2.dataProvider.removeItemAt(1);" waitEvent="updateComplete" waitTarget="list2.dataGroup" /> |
| <AssertPropertyValue target = "list2" propertyName="selectedIndex" value="-1" /> |
| |
| </body> |
| </TestCase> |
| <TestCase testID="CustomList_method_arrayCollection_removeItem_icons_last" keywords="[List, method,arrayCollection,binding, removeItem]" description=""> |
| <setup> |
| <ResetComponent target="list2" className="spark.components.List" waitEvent="updateComplete" /> |
| <SetStyle target="list2" styleName="skinClass" valueExpression="value=CustomIconListSkin" waitEvent="updateComplete" /> |
| </setup> |
| <body> |
| <SetProperty target="list2" propertyName="dataProvider" valueExpression="value=application.createIconsAC()" waitEvent="updateComplete" waitTarget="list2.dataGroup"/> |
| <SetProperty target="list2" propertyName="selectedIndex" value="9" waitEvent="valueCommit" waitTarget="list2"/> |
| <SetProperty target="list2" propertyName="height" value="200" waitEvent="updateComplete" /> |
| <SetProperty target="list2" propertyName="width" value="200" waitEvent="updateComplete" /> |
| <AssertMethodValue method="value=application.list2.selectedItem.label" value="10" /> |
| <RunCode code="application.list2.dataProvider.removeItemAt(9);" waitEvent="updateComplete" waitTarget="list2.dataGroup" /> |
| <AssertPropertyValue target = "list2" propertyName="selectedIndex" value="-1" /> |
| </body> |
| </TestCase> |
| <TestCase testID="CustomList_method_arrayCollection_removeAll_icons" keywords="[List, method,arrayCollection,binding, removeAll]" description=""> |
| <setup> |
| <ResetComponent target="list2" className="spark.components.List" waitEvent="updateComplete" /> |
| <SetStyle target="list2" styleName="skinClass" valueExpression="value=CustomIconListSkin" waitEvent="updateComplete" /> |
| </setup> |
| <body> |
| <SetProperty target="list2" propertyName="dataProvider" valueExpression="value=application.createIconsAC()" waitEvent="updateComplete" waitTarget="list2.dataGroup"/> |
| <SetProperty target="list2" propertyName="selectedIndex" value="9" waitEvent="valueCommit" waitTarget="list2"/> |
| <AssertMethodValue method="value=application.list2.selectedItem.label" value="10" /> |
| <RunCode code="application.list2.dataProvider.removeAll();" waitEvent="collectionChange" waitTarget="list2.dataProvider" /> |
| <SetProperty target="list2" propertyName="height" value="200" waitEvent="updateComplete" /> |
| <SetProperty target="list2" propertyName="width" value="200" waitEvent="updateComplete" /> |
| <AssertPropertyValue target = "list2" propertyName="selectedIndex" value="-1" /> |
| </body> |
| </TestCase> |
| <TestCase testID="CustomList_ms_method_arrayCollection_setItemAt_icons" keywords="[List, method,arrayCollection,binding, setItemAt]" description=""> |
| <setup> |
| <ResetComponent target="list2" className="spark.components.List" waitEvent="updateComplete" /> |
| <SetStyle target="list2" styleName="skinClass" valueExpression="value=CustomIconListSkin" waitEvent="updateComplete" /> |
| |
| </setup> |
| <body> |
| <SetProperty target="list2" propertyName="dataProvider" valueExpression="value=application.createIconsAC()" waitEvent="updateComplete" waitTarget="list2.dataGroup"/> |
| <SetProperty target="list2" propertyName="allowMultipleSelection" value="true" /> |
| <SetProperty target="list2" propertyName="requireSelection" value="true" /> |
| <SetProperty target="list2" propertyName="selectedIndices" valueExpression="value=new <int>[2]" waitEvent="valueCommit" waitTarget="list2"/> |
| <RunCode code="application.list2.dataProvider.setItemAt(application.objIcon,2);" waitEvent="collectionChange" waitTarget="list2.dataProvider" /> |
| <SetProperty target="list2" propertyName="height" value="150" waitEvent="updateComplete" /> |
| <SetProperty target="list2" propertyName="width" value="150" waitEvent="updateComplete" /> |
| <AssertMethodValue method="value=application.list2.selectedItem.label" value="1" /> |
| <AssertPropertyValue target = "list2.dataProvider" propertyName="length" value="10" /> |
| </body> |
| </TestCase> |
| |
| <TestCase testID="CustomList_ms_method_arrayCollection_addItemAt_icons" keywords="[List, method,arrayCollection,binding, addItemAt]" description=""> |
| <setup> |
| <ResetComponent target="list2" className="spark.components.List" waitEvent="updateComplete" /> |
| <SetStyle target="list2" styleName="skinClass" valueExpression="value=CustomIconListSkin" waitEvent="updateComplete" /> |
| <SetProperty target="list2" propertyName="allowMultipleSelection" value="true" /> |
| <SetProperty target="list2" propertyName="requireSelection" value="true" /> |
| |
| </setup> |
| <body> |
| <SetProperty target="list2" propertyName="dataProvider" valueExpression="value=application.createIconsAC()" waitEvent="updateComplete" waitTarget="list2.dataGroup"/> |
| <RunCode code="application.list2.dataProvider.addItem(application.objIcon);" waitEvent="collectionChange" waitTarget="list2.dataProvider" /> |
| <SetProperty target="list2" propertyName="selectedIndices" valueExpression="value=new <int>[10,0]" waitEvent="valueCommit" waitTarget="list2"/> |
| <SetProperty target="list2" propertyName="height" value="150" waitEvent="updateComplete" /> |
| <SetProperty target="list2" propertyName="width" value="150" waitEvent="updateComplete" /> |
| <AssertMethodValue method="value=application.list2.selectedItems[0].label" value="1" /> |
| <AssertPropertyValue target = "list2.dataProvider" propertyName="length" value="11" /> |
| |
| </body> |
| </TestCase> |
| |
| <TestCase testID="CustomList_ms_method_arrayCollection_addItem_icons" keywords="[List, method,arrayCollection,binding, addItem]" description=""> |
| <setup> |
| <ResetComponent target="list2" className="spark.components.List" waitEvent="updateComplete" /> |
| <SetStyle target="list2" styleName="skinClass" valueExpression="value=CustomIconListSkin" waitEvent="updateComplete" /> |
| <SetProperty target="list2" propertyName="allowMultipleSelection" value="true" /> |
| <SetProperty target="list2" propertyName="requireSelection" value="true" /> |
| |
| </setup> |
| <body> |
| <SetProperty target="list2" propertyName="dataProvider" valueExpression="value=application.createIconsAC()" waitEvent="updateComplete" waitTarget="list2.dataGroup"/> |
| |
| <SetProperty target="list2" propertyName="selectedIndices" valueExpression="value=new <int>[9,0]" waitEvent="valueCommit" waitTarget="list2"/> |
| <AssertMethodValue method="value=application.list2.selectedItem.label" value="10" /> |
| <RunCode code="application.list2.dataProvider.addItem(application.objIcon);" waitEvent="collectionChange" waitTarget="list2.dataProvider" /> |
| <AssertPropertyValue target = "list2" propertyName="selectedIndices" value="[9,0]" /> |
| <SetProperty target="list2" propertyName="height" value="150" waitEvent="updateComplete" /> |
| <SetProperty target="list2" propertyName="width" value="150" waitEvent="updateComplete" /> |
| <AssertMethodValue method="value=application.list2.selectedItem.label" value="10" /> |
| <AssertPropertyValue target = "list2.dataProvider" propertyName="length" value="11" /> |
| |
| </body> |
| </TestCase> |
| |
| <TestCase testID="CustomList_ms_method_arrayCollection_removeItem_icons" keywords="[List, method,arrayCollection,binding, removeItem]" description=""> |
| <setup> |
| <ResetComponent target="list2" className="spark.components.List" waitEvent="updateComplete" /> |
| <SetStyle target="list2" styleName="skinClass" valueExpression="value=CustomIconListSkin" waitEvent="updateComplete" /> |
| <SetProperty target="list2" propertyName="allowMultipleSelection" value="true" /> |
| <SetProperty target="list2" propertyName="requireSelection" value="true" /> |
| |
| </setup> |
| <body> |
| <SetProperty target="list2" propertyName="dataProvider" valueExpression="value=application.createIconsAC()" waitEvent="updateComplete" waitTarget="list2.dataGroup"/> |
| <SetProperty target="list2" propertyName="selectedIndices" valueExpression="value=new <int>[0,1]" waitEvent="valueCommit" waitTarget="list2"/> |
| <SetProperty target="list2" propertyName="height" value="150" waitEvent="updateComplete" /> |
| <SetProperty target="list2" propertyName="width" value="150" waitEvent="updateComplete" /> |
| <AssertMethodValue method="value=application.list2.selectedItems[1].label" value="2" /> |
| <RunCode code="application.list2.dataProvider.removeItemAt(1);" waitEvent="updateComplete" waitTarget="list2.dataGroup" /> |
| <AssertPropertyValue target = "list2" propertyName="selectedIndices" value="[0]" /> |
| |
| </body> |
| </TestCase> |
| |
| <TestCase testID="CustomList_ms_method_arrayCollection_removeItem_icons_last" keywords="[List, method,arrayCollection,binding, removeItem]" description=""> |
| <setup> |
| <ResetComponent target="list2" className="spark.components.List" waitEvent="updateComplete" /> |
| <SetStyle target="list2" styleName="skinClass" valueExpression="value=CustomIconListSkin" waitEvent="updateComplete" /> |
| <SetProperty target="list2" propertyName="allowMultipleSelection" value="true" /> |
| <SetProperty target="list2" propertyName="requireSelection" value="true" /> |
| |
| </setup> |
| <body> |
| <SetProperty target="list2" propertyName="dataProvider" valueExpression="value=application.createIconsAC()" waitEvent="updateComplete" waitTarget="list2.dataGroup"/> |
| <SetProperty target="list2" propertyName="selectedIndices" valueExpression="value=new <int>[0,9]" waitEvent="valueCommit" waitTarget="list2"/> |
| <SetProperty target="list2" propertyName="height" value="150" waitEvent="updateComplete" /> |
| <SetProperty target="list2" propertyName="width" value="150" waitEvent="updateComplete" /> |
| <AssertMethodValue method="value=application.list2.selectedItem.label" value="1" /> |
| <RunCode code="application.list2.dataProvider.removeItemAt(9);" waitEvent="updateComplete" waitTarget="list2.dataGroup" /> |
| <AssertPropertyValue target = "list2" propertyName="selectedIndices" value="[0]" /> |
| </body> |
| </TestCase> |
| |
| <TestCase testID="CustomList_ms_method_arrayCollection_removeAll_icons" keywords="[List, method,arrayCollection,binding, removeAll]" description=""> |
| <setup> |
| <ResetComponent target="list2" className="spark.components.List" waitEvent="updateComplete" /> |
| <SetStyle target="list2" styleName="skinClass" valueExpression="value=CustomIconListSkin" waitEvent="updateComplete" /> |
| <SetProperty target="list2" propertyName="allowMultipleSelection" value="true" /> |
| <SetProperty target="list2" propertyName="requireSelection" value="true" /> |
| |
| </setup> |
| <body> |
| <SetProperty target="list2" propertyName="dataProvider" valueExpression="value=application.createIconsAC()" waitEvent="updateComplete" waitTarget="list2.dataGroup"/> |
| <SetProperty target="list2" propertyName="selectedIndices" valueExpression="value=new <int>[9]" waitEvent="valueCommit" waitTarget="list2"/> |
| <AssertMethodValue method="value=application.list2.selectedItem.label" value="10" /> |
| <RunCode code="application.list2.dataProvider.removeAll();" waitEvent="collectionChange" waitTarget="list2.dataProvider" /> |
| <SetProperty target="list2" propertyName="height" value="150" waitEvent="updateComplete" /> |
| <SetProperty target="list2" propertyName="width" value="150" waitEvent="updateComplete" /> |
| <AssertPropertyValue target = "list2" propertyName="selectedIndex" value="-1" /> |
| </body> |
| </TestCase> |
| |
| </testCases> |
| |
| |
| </UnitTester> |