blob: 39b7a5bc9f11b2867a5cfb7ad6d85017b021218a [file] [log] [blame]
<?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="components/HorizontalList/Properties/" xmlns:mx="http://www.adobe.com/2006/mxml" xmlns="*" testSWF="HorizontalList_ForDataProvider.mxml">
<!-- this set of lines form a template that must be in each unit test -->
<mx:Script>
<![CDATA[
import mx.controls.HorizontalList;
import mx.managers.SystemManager;
import mx.events.ListEvent;
import mx.collections.*;
public static function init(o:DisplayObject):void
{
}
[Bindable]
public var myDP:Array=[{label: "top"},{label: "file"},{label:"I am a Menu"},{label:"here goes Nothing"},{label:"aw, don't sell yourself short"},{label:"can you check me?"}];
[Bindable]
public var xmlObjE4X2:XML;
public function setXMLDP() : void
{
xmlObjE4X2= new XML("<topnode><node><label>Mailbox</label></node><node><label>Inbox</label></node><node><label>Old</label></node><node><label>Personal</label></node><node><label>Old</label></node></topnode>");
application.hl.labelField = "@label";
application.hl.dataProvider = xmlObjE4X2.topnode.node;
}
public function setXMLDP_AS() : void
{
application.hl.dataProvider = testXMLDP.topnode.node;
application.hl.labelField='@label';
}
[Bindable]
public var myCol:ArrayCollection;
public var myDPArray:Array = [{label: "menu 2"},{label: "mail"},{label:"inbox"},{label:"outbox"},{label:"you are a draft"},{label:"check me"},{label: "menu 1"},{label: "file"},{label:"I am a Menu"},{label:"here goes Nothing"},{label:"aw, don't sell yourself short"},{label:"can you check me?"}];
public function setArrayCollectionDP() : void
{
myCol = new ArrayCollection(myDPArray);
application.hl.dataProvider = myCol;
}
]]>
</mx:Script>
<mx:Metadata>
<![CDATA[
[Mixin]
]]>
</mx:Metadata>
<!-- end of set of lines that must be in each unit test -->
<mx:XML id="testXMLDP" format="e4x">
<topnode>
<node>
<label>"file"</label>
</node>
<node>
<label>"I am a Menu"</label>
</node>
<node>
<label>"here goes Nothing"</label>
</node>
<node>
<label>"aw, don't sell yourself short"</label>
</node>
<node>
<label>"can you check me?"</label>
</node>
</topnode>
</mx:XML>
<testCases>
<TestCase testID="ASObject_setInAS" description="Set an AS object as a dataProvider for HorizontalList in AS" keywords="[HorizontalList, dataProvider]">
<setup>
<RunCode code="application.hl.dataProvider = myDP;" waitEvent="updateComplete" waitTarget="hl" />
<DispatchKeyEvent keys="[TAB,TAB]" />
<DispatchKeyEvent key="TAB" waitTarget="hl" waitEvent="focusIn" />
</setup>
<body>
<DispatchKeyEvent key="RIGHT" waitTarget="hl" waitEvent="change" />
<DispatchKeyEvent keys="RIGHT" waitTarget="hl" waitEvent="change" />
<AssertEvent eventName="change" eventClass="mx.events::ListEvent" target="hl" />
<AssertEventPropertyValue propertyName="columnIndex" value="1" />
<AssertEventPropertyValue propertyName="rowIndex" value="0" />
</body>
</TestCase>
</testCases>
</UnitTester>