blob: f57ec4cf33e7718ef2b94a7961c9a2050b28c747 [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/LinkBar/Events/" xmlns:mx="http://www.adobe.com/2006/mxml" xmlns="*" testSWF="LinkBar_Basic.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
{
}
public function addData(bool:int):void
{
application.lb.dataProvider = myDP;
}
public function addObjData():void
{
application.lb.dataProvider = iconDP;
}
public function changeDP(node:int, bool:String):void
{
myDP.node[node].@enabled = bool;
}
public function resizeLinkBar():void
{
application.lb.width=300;
application.lb.height=300;
}
[Bindable]
public var iconDP:Array= [{label:"Toys", icon:"dinosaur"},{label:"Dinosaur", icon: "dinosaur"}];
]]>
</mx:Script>
<mx:Metadata>
<![CDATA[
[Mixin]
]]>
</mx:Metadata>
<!-- end of set of lines that must be in each unit test -->
<mx:Script>
<![CDATA[
import mx.controls.LinkBar;
import mx.styles.StyleManager;
import mx.managers.SystemManager;
import mx.events.ListEvent;
[Bindable]
private var myDP:Array=[{label:"Italy", data:"ITALY"},{label:"England", data:"ENGLAND"},{label:"Slovenia", data:"SLOVENIA"}];
]]>
</mx:Script>
<testCases>
<TestCase testID="LinkBar_Event_focusIn" description="LinkBar foucsIn event." keywords="[event, focusIn, LinkBar]">
<setup>
<ResetComponent target="lb" className="mx.controls.LinkBar" waitEvent="updateComplete" waitTarget="lb" />
<RunCode code="addData(0);" waitEvent="updateComplete" waitTarget="lb"/>
</setup>
<body>
<DispatchKeyEvent keys="[TAB,TAB,TAB, SPACE]" />
<AssertEvent target="lb" eventName="focusIn" eventClass="flash.events::FocusEvent" />
</body>
</TestCase>
<TestCase testID="LinkBar_Event_focusOut" description="LinkBar foucsOut event." keywords="[event, focusOut, LinkBar]">
<setup>
<ResetComponent target="lb" className="mx.controls.LinkBar" waitEvent="updateComplete" waitTarget="lb" />
<RunCode code="addData(0);" waitEvent="updateComplete" waitTarget="lb"/>
</setup>
<body>
<DispatchKeyEvent keys="[TAB,TAB,TAB]" />
<AssertEvent target="lb" eventName="focusIn" eventClass="flash.events::FocusEvent" />
</body>
</TestCase>
<TestCase testID="LinkBar_Event_hide" description="LinkBar hide event." keywords="[event, hide, LinkBar]">
<setup>
<ResetComponent target="lb" className="mx.controls.LinkBar" waitEvent="updateComplete" waitTarget="lb" />
<RunCode code="addData(0);" waitEvent="updateComplete" waitTarget="lb"/>
</setup>
<body>
<SetProperty target="lb" propertyName="visible" value="false"/>
<AssertEvent target="lb" eventName="hide" eventClass="mx.events::FlexEvent" />
</body>
</TestCase>
<TestCase testID="LinkBar_Event_show" description="LinkBar show event." keywords="[event, show, LinkBar]">
<setup>
<ResetComponent target="lb" className="mx.controls.LinkBar" waitEvent="updateComplete" waitTarget="lb" />
<RunCode code="addData(0);" waitEvent="updateComplete" waitTarget="lb"/>
</setup>
<body>
<SetProperty target="lb" propertyName="visible" value="false"/>
<SetProperty target="lb" propertyName="visible" value="true"/>
<AssertEvent target="lb" eventName="show" eventClass="mx.events::FlexEvent" />
</body>
</TestCase>
<TestCase testID="LinkBar_Event_move" description="LinkBar move event." keywords="[event, move, LinkBar]">
<setup>
<ResetComponent target="lb" className="mx.controls.LinkBar" waitEvent="updateComplete" waitTarget="lb" />
<RunCode code="addData(0);" waitEvent="updateComplete" waitTarget="lb"/>
</setup>
<body>
<RunCode code="application.lb.move(10,10)"/>
<AssertEvent target="lb" eventName="move" eventClass="mx.events::MoveEvent" />
</body>
</TestCase>
<TestCase testID="LinkBar_Event_resize" description="LinkBar resize event." keywords="[event, resize, LinkBar]">
<setup>
<ResetComponent target="lb" className="mx.controls.LinkBar" waitEvent="updateComplete" waitTarget="lb" />
<RunCode code="addData(0);" waitEvent="updateComplete" waitTarget="lb"/>
</setup>
<body>
<RunCode code="resizeLinkBar();"/>
<AssertEvent target="lb" eventName="resize" eventClass="mx.events::ResizeEvent" />
</body>
</TestCase>
<TestCase testID="LinkBar_Event_initialize" description="LinkBar initialize event." keywords="[event, initialize, LinkBar]">
<setup>
<ResetComponent target="lb" className="mx.controls.LinkBar" waitEvent="updateComplete" waitTarget="lb" />
<RunCode code="addData(0);" waitEvent="updateComplete" waitTarget="lb"/>
</setup>
<body>
<AssertPropertyValue target="ti" propertyName="text" value="LinkBar Initalize"/>
</body>
</TestCase>
<TestCase testID="LinkBar_Event_mouseUp" description="LinkBar mouseUp event." keywords="[event, mouseUp, LinkBar]">
<setup>
<ResetComponent target="lb" className="mx.controls.LinkBar" waitEvent="updateComplete" waitTarget="lb" />
<RunCode code="addData(0);" waitEvent="updateComplete" waitTarget="lb"/>
</setup>
<body>
<DispatchMouseEvent target="lb" type="mouseOver" localX="22" localY="5" />
<DispatchMouseEvent target="lb" type="mouseDown" localX="22" localY="5" />
<DispatchMouseEvent target="lb" type="mouseUp" localX="22" localY="5" />
<AssertEvent target="lb" eventName="mouseUp" eventClass="flash.events::MouseEvent" timeout="5000" />
</body>
</TestCase>
<TestCase testID="LinkBar_Event_mouseDown" description="LinkBar mouseDown event." keywords="[event, mouseUp, LinkBar]">
<setup>
<ResetComponent target="lb" className="mx.controls.LinkBar" waitEvent="updateComplete" waitTarget="lb" />
<RunCode code="addData(0);" waitEvent="updateComplete" waitTarget="lb"/>
</setup>
<body>
<DispatchMouseEvent target="lb" type="mouseDown" localX="22" localY="5" />
<AssertEvent target="lb" eventName="mouseDown" eventClass="flash.events::MouseEvent" timeout="5000" />
</body>
</TestCase>
<TestCase testID="LinkBar_Event_mouseMove" description="LinkBar Move event." keywords="[event, mouseMove, LinkBar]">
<setup>
<ResetComponent target="lb" className="mx.controls.LinkBar" waitEvent="updateComplete" waitTarget="lb" />
<RunCode code="addData(0);" waitEvent="updateComplete" waitTarget="lb"/>
</setup>
<body>
<DispatchMouseEvent target="lb" type="mouseOver" localX="12" localY="5" />
<DispatchMouseEvent target="lb" type="mouseMove" localX="22" localY="5" />
<AssertEvent target="lb" eventName="mouseMove" eventClass="flash.events::MouseEvent" timeout="5000" />
</body>
</TestCase>
<TestCase testID="LinkBar_Event_click" description="LinkBar click event." keywords="[event, click, LinkBar]">
<setup>
<ResetComponent target="lb" className="mx.controls.LinkBar" waitEvent="updateComplete" waitTarget="lb" />
<RunCode code="addData(0);" waitEvent="updateComplete" waitTarget="lb"/>
</setup>
<body>
<DispatchMouseClickEvent target="lb" localX="22" localY="5" />
<AssertEvent target="lb" eventName="mouseDown" eventClass="flash.events::MouseEvent" timeout="5000" />
</body>
</TestCase>
<TestCase testID="LinkBar_Event_keyUp" description="LinkBar click event." keywords="[event, keyUp, LinkBar]">
<setup>
<ResetComponent target="lb" className="mx.controls.LinkBar" waitEvent="updateComplete" waitTarget="lb" />
<RunCode code="addData(0);" waitEvent="updateComplete" waitTarget="lb"/>
</setup>
<body>
<DispatchKeyEvent keys="[TAB, TAB, TAB, TAB, SPACE]" />
<AssertEvent target="lb" numExpectedEvents="2" eventName="keyUp" eventClass="flash.events::KeyboardEvent" timeout="5000" />
</body>
</TestCase>
<TestCase testID="LinkBar_Event_keyDown" description="LinkBar click event." keywords="[event, keyDown, LinkBar]">
<setup>
<ResetComponent target="lb" className="mx.controls.LinkBar" waitEvent="updateComplete" waitTarget="lb" />
<RunCode code="addData(0);" waitEvent="updateComplete" waitTarget="lb"/>
</setup>
<body>
<DispatchKeyEvent keys="[TAB,TAB, TAB, TAB, SPACE]" />
<AssertEvent target="lb" numExpectedEvents="2" eventName="keyDown" eventClass="flash.events::KeyboardEvent" timeout="5000" />
</body>
</TestCase>
<TestCase testID="LinkBar_Event_creationComplete" description="LinkBar creationComplete event." keywords="[event, creationComplete, LinkBar]">
<setup>
<ResetComponent target="lb" className="mx.controls.LinkBar" waitEvent="updateComplete" waitTarget="lb" />
<ResetComponent target="ti" className="mx.controls.TextInput" waitEvent="updateComplete" waitTarget="ti" />
</setup>
<body>
<AssertPropertyValue target="ti2" propertyName="text" value="creationComplete executed."/>
</body>
</TestCase>
</testCases>
</UnitTester>