blob: 77bc0ea27de799c0ac8f1b29dd162c9d1beb33ed [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/Styles/" xmlns:mx="http://www.adobe.com/2006/mxml" xmlns="*" testSWF="LinkBar_InContainer.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 MyLinkBar;
import mx.styles.StyleManager;
import mx.managers.SystemManager;
import RedFocusRect;
import flash.display.BlendMode;
]]>
</mx:Script>
<testCases>
<TestCase testID="bottom_0" description="LinkBar style bottom=0" keywords="[styles, bottom, LinkBar]">
<setup>
<ResetComponent target="linkBar_1" className="MyLinkBar" waitEvent="updateComplete" waitTarget="linkBar_1" />
<SetStyle styleName="bottom" target="linkBar_1" value="0" waitEvent="updateComplete" waitTarget="linkBar_1" />
<SetProperty target="linkBar_1" propertyName="height" value="80" waitEvent="updateComplete" waitTarget="linkBar_1" />
</setup>
<body>
<AssertPropertyValue propertyName="y" target="linkBar_1" value="120" />
</body>
</TestCase>
<TestCase testID="bottom_20" description="LinkBar style bottom=20." keywords="[styles, bottom, LinkBar]">
<setup>
<ResetComponent target="linkBar_1" className="MyLinkBar" waitEvent="updateComplete" waitTarget="linkBar_1" />
<SetStyle styleName="bottom" target="linkBar_1" value="20" waitEvent="updateComplete" waitTarget="linkBar_1" />
<SetProperty target="linkBar_1" propertyName="height" value="80" waitEvent="updateComplete" waitTarget="linkBar_1" />
</setup>
<body>
<AssertPropertyValue propertyName="y" target="linkBar_1" value="100" />
</body>
</TestCase>
<TestCase testID="top_0" description="LinkBar style top=0" keywords="[styles, top, LinkBar]">
<setup>
<ResetComponent target="linkBar_1" className="MyLinkBar" waitEvent="updateComplete" waitTarget="linkBar_1" />
<SetStyle styleName="top" target="linkBar_1" value="0" waitEvent="updateComplete" waitTarget="linkBar_1" />
<SetProperty target="linkBar_1" propertyName="height" value="80" waitEvent="updateComplete" waitTarget="linkBar_1" />
</setup>
<body>
<AssertPropertyValue propertyName="y" target="linkBar_1" value="0" />
</body>
</TestCase>
<TestCase testID="top_20" description="LinkBar style top=20." keywords="[styles, top, LinkBar]">
<setup>
<ResetComponent target="linkBar_1" className="MyLinkBar" waitEvent="updateComplete" waitTarget="linkBar_1" />
<SetStyle styleName="top" target="linkBar_1" value="20" waitEvent="updateComplete" waitTarget="linkBar_1" />
<SetProperty target="linkBar_1" propertyName="height" value="80" waitEvent="updateComplete" waitTarget="linkBar_1" />
</setup>
<body>
<AssertPropertyValue propertyName="y" target="linkBar_1" value="20" />
</body>
</TestCase>
<TestCase testID="right_0" description="LinkBar style right=0" keywords="[styles, right, LinkBar]">
<setup>
<ResetComponent target="linkBar_1" className="MyLinkBar" waitEvent="updateComplete" waitTarget="linkBar_1" />
<SetStyle styleName="right" target="linkBar_1" value="0" waitEvent="updateComplete" waitTarget="linkBar_1" />
<SetProperty target="linkBar_1" propertyName="width" value="100" waitEvent="updateComplete" waitTarget="linkBar_1" />
</setup>
<body>
<AssertPropertyValue propertyName="x" target="linkBar_1" value="100" />
</body>
</TestCase>
<TestCase testID="right_20" description="LinkBar style right=20." keywords="[styles, right, LinkBar]">
<setup>
<ResetComponent target="linkBar_1" className="MyLinkBar" waitEvent="updateComplete" waitTarget="linkBar_1" />
<SetStyle styleName="right" target="linkBar_1" value="20" waitEvent="updateComplete" waitTarget="linkBar_1" />
<SetProperty target="linkBar_1" propertyName="width" value="100" waitEvent="updateComplete" waitTarget="linkBar_1" />
</setup>
<body>
<AssertPropertyValue propertyName="x" target="linkBar_1" value="80" />
</body>
</TestCase>
<TestCase testID="left_0" description="LinkBar style left=0" keywords="[styles, left, LinkBar]">
<setup>
<ResetComponent target="linkBar_1" className="MyLinkBar" waitEvent="updateComplete" waitTarget="linkBar_1" />
<SetStyle styleName="left" target="linkBar_1" value="0" waitEvent="updateComplete" waitTarget="linkBar_1" />
<SetProperty target="linkBar_1" propertyName="width" value="100" waitEvent="updateComplete" waitTarget="linkBar_1" />
</setup>
<body>
<AssertPropertyValue propertyName="x" target="linkBar_1" value="0" />
</body>
</TestCase>
<TestCase testID="left_20" description="LinkBar style left=20." keywords="[styles, left, LinkBar]">
<setup>
<ResetComponent target="linkBar_1" className="MyLinkBar" waitEvent="updateComplete" waitTarget="linkBar_1" />
<SetStyle styleName="left" target="linkBar_1" value="20" waitEvent="updateComplete" waitTarget="linkBar_1" />
<SetProperty target="linkBar_1" propertyName="width" value="100" waitEvent="updateComplete" waitTarget="linkBar_1" />
</setup>
<body>
<AssertPropertyValue propertyName="x" target="linkBar_1" value="20" />
</body>
</TestCase>
<TestCase testID="horizontalCenter_0" description="LinkBar style horizontalCenter=0" keywords="[styles, left, LinkBar]">
<setup>
<ResetComponent target="linkBar_1" className="MyLinkBar" waitEvent="updateComplete" waitTarget="linkBar_1" />
<SetStyle styleName="horizontalCenter" target="linkBar_1" value="0" waitEvent="updateComplete" waitTarget="linkBar_1" />
<SetProperty target="linkBar_1" propertyName="width" value="100" waitEvent="updateComplete" waitTarget="linkBar_1" />
</setup>
<body>
<AssertPropertyValue propertyName="x" target="linkBar_1" value="50" />
</body>
</TestCase>
<TestCase testID="horizontalCenter_positive" description="LinkBar style horizontalCenter=20." keywords="[styles, left, LinkBar]">
<setup>
<ResetComponent target="linkBar_1" className="MyLinkBar" waitEvent="updateComplete" waitTarget="linkBar_1" />
<SetStyle styleName="horizontalCenter" target="linkBar_1" value="20" waitEvent="updateComplete" waitTarget="linkBar_1" />
<SetProperty target="linkBar_1" propertyName="width" value="100" waitEvent="updateComplete" waitTarget="linkBar_1" />
</setup>
<body>
<AssertPropertyValue propertyName="x" target="linkBar_1" value="70" />
</body>
</TestCase>
<TestCase testID="horizontalCenter_negative" description="LinkBar style horizontalCenter=-20." keywords="[styles, left, LinkBar]">
<setup>
<ResetComponent target="linkBar_1" className="MyLinkBar" waitEvent="updateComplete" waitTarget="linkBar_1" />
<SetStyle styleName="horizontalCenter" target="linkBar_1" value="-20" waitEvent="updateComplete" waitTarget="linkBar_1" />
<SetProperty target="linkBar_1" propertyName="width" value="100" waitEvent="updateComplete" waitTarget="linkBar_1" />
</setup>
<body>
<AssertPropertyValue propertyName="x" target="linkBar_1" value="30" />
</body>
</TestCase>
<TestCase testID="verticalCenter_0" description="LinkBar style verticalCenter=0" keywords="[styles, left, LinkBar]">
<setup>
<ResetComponent target="linkBar_1" className="MyLinkBar" waitEvent="updateComplete" waitTarget="linkBar_1" />
<SetStyle styleName="verticalCenter" target="linkBar_1" value="0" waitEvent="updateComplete" waitTarget="linkBar_1" />
<SetProperty target="linkBar_1" propertyName="height" value="50" waitEvent="updateComplete" waitTarget="linkBar_1" />
</setup>
<body>
<AssertPropertyValue propertyName="y" target="linkBar_1" value="75" />
</body>
</TestCase>
<TestCase testID="verticalCenter_positive" description="LinkBar style verticalCenter=20." keywords="[styles, left, LinkBar]">
<setup>
<ResetComponent target="linkBar_1" className="MyLinkBar" waitEvent="updateComplete" waitTarget="linkBar_1" />
<SetStyle styleName="verticalCenter" target="linkBar_1" value="20" waitEvent="updateComplete" waitTarget="linkBar_1" />
<SetProperty target="linkBar_1" propertyName="height" value="50" waitEvent="updateComplete" waitTarget="linkBar_1" />
</setup>
<body>
<AssertPropertyValue propertyName="y" target="linkBar_1" value="95" />
</body>
</TestCase>
<TestCase testID="verticalCenter_negative" description="LinkBar style verticalCenter=-20." keywords="[styles, left, LinkBar]">
<setup>
<ResetComponent target="linkBar_1" className="MyLinkBar" waitEvent="updateComplete" waitTarget="linkBar_1" />
<SetStyle styleName="verticalCenter" target="linkBar_1" value="-20" waitEvent="updateComplete" waitTarget="linkBar_1" />
<SetProperty target="linkBar_1" propertyName="height" value="50" waitEvent="updateComplete" waitTarget="linkBar_1" />
</setup>
<body>
<AssertPropertyValue propertyName="y" target="linkBar_1" value="55" />
</body>
</TestCase>
<TestCase testID="focusThickness_0" description="LinkBar style focusThickness=0." keywords="[styles, focusThickness, LinkBar]">
<setup>
<ResetComponent target="linkBar_1" className="MyLinkBar" waitEvent="updateComplete" waitTarget="linkBar_1" />
<SetProperty target="linkBar_1" propertyName="height" value="50" waitEvent="updateComplete" waitTarget="linkBar_1"/>
<SetProperty target="linkBar_1" propertyName="width" value="100" waitEvent="updateComplete" waitTarget="linkBar_1"/>
<SetProperty target="canvas1" propertyName="height" value="70" waitEvent="updateComplete" waitTarget="canvas1"/>
<SetStyle styleName="verticalCenter" target="linkBar_1" value="0" waitEvent="updateComplete" waitTarget="linkBar_1" />
<SetStyle styleName="horizontalCenter" target="linkBar_1" value="0" waitEvent="updateComplete" waitTarget="linkBar_1" />
<SetStyle styleName="linkButtonStyleName" target="linkBar_1" value="customFocusThickness" waitEvent="updateComplete" waitTarget="linkBar_1" />
</setup>
<body>
<DispatchKeyEvent key="TAB" waitTarget="linkBar_1" waitEvent="focusIn" />
<WaitForEffectsToEnd />
<CompareBitmap numColorVariances="15" ignoreMaxColorVariance="true" target="canvas1" url="../Styles/baselines/focusThickness_0.png" timeout="5000" />
</body>
<cleanup>
<DispatchKeyEvent key="TAB" />
</cleanup>
</TestCase>
<TestCase testID="focusThickness_8" description="LinkBar style focusThickness=8." keywords="[styles, focusThickness, LinkBar]">
<setup>
<ResetComponent target="linkBar_1" className="MyLinkBar" waitEvent="updateComplete" waitTarget="linkBar_1" />
<SetProperty target="linkBar_1" propertyName="height" value="50" waitEvent="updateComplete" waitTarget="linkBar_1"/>
<SetProperty target="linkBar_1" propertyName="width" value="110" waitEvent="updateComplete" waitTarget="linkBar_1"/>
<SetProperty target="canvas1" propertyName="height" value="80" waitEvent="updateComplete" waitTarget="canvas1"/>
<SetStyle styleName="verticalCenter" target="linkBar_1" value="0" waitEvent="updateComplete" waitTarget="linkBar_1" />
<SetStyle styleName="horizontalCenter" target="linkBar_1" value="0" waitEvent="updateComplete" waitTarget="linkBar_1" />
<SetStyle styleName="linkButtonStyleName" target="linkBar_1" value="customFocusThickness2" waitEvent="updateComplete" waitTarget="linkBar_1" />
</setup>
<body>
<DispatchKeyEvent key="TAB" waitTarget="linkBar_1" waitEvent="focusIn" />
<WaitForEffectsToEnd />
<CompareBitmap numColorVariances="10" ignoreMaxColorVariance="true" target="canvas1" url="../Styles/baselines/focusThickness_8.png" timeout="5000" />
</body>
<cleanup>
<DispatchKeyEvent key="TAB" />
</cleanup>
</TestCase>
<TestCase testID="focusSkin_custom" description="LinkBar style focusSkin=RedFocusRect." keywords="[styles, focusThickness, LinkBar]">
<setup>
<ResetComponent target="linkBar_1" className="MyLinkBar" waitEvent="updateComplete" waitTarget="linkBar_1" />
<SetProperty target="linkBar_1" propertyName="height" value="50" waitEvent="updateComplete" waitTarget="linkBar_1"/>
<SetProperty target="linkBar_1" propertyName="width" value="100" waitEvent="updateComplete" waitTarget="linkBar_1"/>
<SetProperty target="canvas1" propertyName="height" value="70" waitEvent="updateComplete" waitTarget="canvas1"/>
<SetStyle styleName="verticalCenter" target="linkBar_1" value="0" waitEvent="updateComplete" waitTarget="linkBar_1" />
<SetStyle styleName="horizontalCenter" target="linkBar_1" value="0" waitEvent="updateComplete" waitTarget="linkBar_1" />
<SetStyle styleName="linkButtonStyleName" target="linkBar_1" value="customFocusSkin" waitEvent="updateComplete" waitTarget="linkBar_1" />
</setup>
<body>
<DispatchKeyEvent key="TAB" waitTarget="linkBar_1" waitEvent="focusIn" />
<WaitForEffectsToEnd />
<CompareBitmap numColorVariances="10" ignoreMaxColorVariance="true" target="canvas1" url="../Styles/baselines/focusSkin_custom.png" timeout="5000" />
</body>
<cleanup>
<DispatchKeyEvent key="TAB" />
</cleanup>
</TestCase>
<TestCase testID="focusBlend_screen" description="LinkBar style focusThickness=8." keywords="[styles, focusThickness, LinkBar]">
<setup>
<ResetComponent target="linkBar_1" className="MyLinkBar" waitEvent="updateComplete" waitTarget="linkBar_1" />
<SetProperty target="linkBar_1" propertyName="height" value="50" waitEvent="updateComplete" waitTarget="linkBar_1"/>
<SetProperty target="linkBar_1" propertyName="width" value="95" waitEvent="updateComplete" waitTarget="linkBar_1"/>
<SetProperty target="canvas1" propertyName="height" value="75" waitEvent="updateComplete" waitTarget="canvas1"/>
<SetStyle styleName="verticalCenter" target="linkBar_1" value="0" waitEvent="updateComplete" waitTarget="linkBar_1" />
<SetStyle styleName="horizontalCenter" target="linkBar_1" value="0" waitEvent="updateComplete" waitTarget="linkBar_1" />
<SetStyle styleName="linkButtonStyleName" target="linkBar_1" value="customFocusBlend" waitEvent="updateComplete" waitTarget="linkBar_1" />
</setup>
<body>
<DispatchKeyEvent key="TAB" waitTarget="linkBar_1" waitEvent="focusIn" />
<WaitForEffectsToEnd />
<CompareBitmap numColorVariances="10" ignoreMaxColorVariance="true" target="canvas1" url="../Styles/baselines/focusBlend_screen.png" timeout="5000" />
</body>
<cleanup>
<DispatchKeyEvent key="TAB" />
</cleanup>
</TestCase>
<TestCase testID="focusBlend_subtract" description="LinkBar style focusThickness=8." keywords="[styles, focusThickness, LinkBar]">
<setup>
<ResetComponent target="linkBar_1" className="MyLinkBar" waitEvent="updateComplete" waitTarget="linkBar_1" />
<SetProperty target="linkBar_1" propertyName="height" value="50" waitEvent="updateComplete" waitTarget="linkBar_1"/>
<SetProperty target="linkBar_1" propertyName="width" value="99" waitEvent="updateComplete" waitTarget="linkBar_1"/>
<SetProperty target="canvas1" propertyName="height" value="78" waitEvent="updateComplete" waitTarget="canvas1"/>
<SetStyle styleName="verticalCenter" target="linkBar_1" value="0" waitEvent="updateComplete" waitTarget="linkBar_1" />
<SetStyle styleName="horizontalCenter" target="linkBar_1" value="0" waitEvent="updateComplete" waitTarget="linkBar_1" />
<SetStyle styleName="linkButtonStyleName" target="linkBar_1" value="customFocusBlend2" waitEvent="updateComplete" waitTarget="linkBar_1" />
</setup>
<body>
<DispatchKeyEvent key="TAB" waitTarget="linkBar_1" waitEvent="focusIn" />
<WaitForEffectsToEnd />
<CompareBitmap numColorVariances="10" ignoreMaxColorVariance="true" target="canvas1" url="../Styles/baselines/focusBlend_subtract.png" timeout="5000" />
</body>
<cleanup>
<DispatchKeyEvent key="TAB" />
</cleanup>
</TestCase>
</testCases>
</UnitTester>