blob: 5a99559f7a2974c5389814fa3c65b0011c45f496 [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/ColorPicker/events/" xmlns:mx="http://www.adobe.com/2006/mxml" xmlns="*" testSWF="ColorPicker_main.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 mx.controls.ColorPicker;
import mx.styles.StyleManager;
import mx.managers.SystemManager;
public function scriptFunction(a:String, b:int):String
{
return a + ":" + b.toString();
}
public var styleDecl:Object;
public var styleObj:Object;
]]>
</mx:Script>
<testCases>
<TestCase testID="Checking_Open_Event_of_ColorPicker" keywords="[ColorPicker, open, Event]" description="Ensure that open event gets triggered when a ColorPicker is opened.">
<setup>
<ResetComponent target="myColorPicker" className="mx.controls::ColorPicker" waitEvent="updateComplete" />
</setup>
<body>
<RunCode code="application.myColorPicker.open()" />
<AssertEvent target="myColorPicker" eventName="open" eventClass="mx.events::DropdownEvent" />
</body>
</TestCase>
<TestCase testID="Checking_Close_Event_of_ColorPicker" keywords="[ColorPicker, close, Event]" description="Ensure that close event gets triggered when a ColorPicker is closed.">
<setup>
<ResetComponent target="myColorPicker" className="mx.controls::ColorPicker" waitEvent="updateComplete" />
</setup>
<body>
<RunCode code="application.myColorPicker.open()" waitTarget="myColorPicker" waitEvent="open" />
<WaitForEffectsToEnd />
<RunCode code="application.myColorPicker.close()" />
<AssertEvent target="myColorPicker" eventName="close" eventClass="mx.events::DropdownEvent" />
</body>
</TestCase>
<TestCase testID="Checking_change_Event_of_ColorPicker" keywords="[ColorPicker, change, Event]" description="Ensure that change event gets triggered when a ColorPicker's color is changed.">
<setup>
<ResetComponent target="myColorPicker" className="mx.controls::ColorPicker" waitEvent="updateComplete" />
</setup>
<body>
<RunCode code="application.myColorPicker.open()" waitTarget="myColorPicker" waitEvent="open" />
<WaitForEffectsToEnd />
<DispatchMouseEvent target="myColorPicker.mx_internal:dropdown" type="mouseMove" localX="100" localY="100"/>
<DispatchMouseClickEvent target="myColorPicker.mx_internal:dropdown" localX="100" localY="100" waitEvent="close" waitTarget="myColorPicker" />
<AssertEvent target="myColorPicker" eventName="change" eventClass="mx.events::ColorPickerEvent" />
</body>
</TestCase>
<TestCase testID="Checking_itemRollOver_Event_of_ColorPicker" keywords="[ColorPicker, itemRollOver, Event]" description="Ensure that itemRollOver event gets triggered when a color in the swatch panel of the ColorPicker is rolledover.">
<setup>
<ResetComponent target="myColorPicker" className="mx.controls::ColorPicker" waitEvent="updateComplete" />
</setup>
<body>
<RunCode code="application.myColorPicker.open()" waitTarget="myColorPicker" waitEvent="open" />
<WaitForEffectsToEnd />
<DispatchMouseEvent target="myColorPicker.mx_internal:dropdown" type="mouseMove" localX="100" localY="100"/>
<AssertEvent target="myColorPicker" eventName="itemRollOver" eventClass="mx.events::ColorPickerEvent" />
<DispatchMouseClickEvent target="myColorPicker.mx_internal:dropdown" localX="100" localY="100" waitEvent="close" waitTarget="myColorPicker" />
</body>
</TestCase>
<TestCase testID="Checking_itemRollOut_Event_of_ColorPicker" keywords="[ColorPicker, itemRollOut, Event]" description="Ensure that itemRollOut event gets triggered when a color in the swatch panel of the ColorPicker is rolledout.">
<setup>
<ResetComponent target="myColorPicker" className="mx.controls::ColorPicker" waitEvent="updateComplete" />
</setup>
<body>
<RunCode code="application.myColorPicker.open()" waitTarget="myColorPicker" waitEvent="open" />
<WaitForEffectsToEnd />
<DispatchMouseEvent target="myColorPicker.mx_internal:dropdown" type="mouseMove" localX="100" localY="100"/>
<DispatchMouseEvent target="myColorPicker.mx_internal:dropdown" type="mouseMove" localX="120" localY="120"/>
<AssertEvent target="myColorPicker" eventName="itemRollOut" eventClass="mx.events::ColorPickerEvent" />
<DispatchMouseClickEvent target="myColorPicker.mx_internal:dropdown" localX="100" localY="100" waitEvent="close" waitTarget="myColorPicker" />
</body>
</TestCase>
<TestCase testID="Checking_Enter_Event_of_ColorPicker" keywords="[ColorPicker, enter, Event]" description="Ensure that enter event gets triggered when a color value is keyed in">
<setup>
<ResetComponent target="myColorPicker" className="mx.controls::ColorPicker" waitEvent="updateComplete" />
</setup>
<body>
<RunCode code="application.myColorPicker.open()" waitTarget="myColorPicker" waitEvent="open" />
<RunCode code="application.myColorPicker.mx_internal::dropdown.mx_internal::textInput.text = ''"/>
<Pause timeout="1" />
<DispatchKeyEvent char="FF0000" />
<DispatchKeyEvent key="ENTER"/>
<AssertPropertyValue target="myColorPicker" propertyName="selectedColor" value="0xff0000" />
</body>
</TestCase>
</testCases>
</UnitTester>