blob: e795b4fc1ce26405a9867482de98f7aeadc005ca [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/PopUpButton/Mirroring/" xmlns:mx="http://www.adobe.com/2006/mxml" xmlns="*" testSWF="PopUpButton_Mirroring_Basic.mxml">
<!-- this set of lines form a template that must be in each unit test -->
<mx:Script>
<![CDATA[
import mx.managers.SystemManager;
import mx.controls.*;
import mx.containers.*;
import mx.core.*;
import flash.events.*;
use namespace mx_internal;
private var myMenu:Menu;
public static function init(o:DisplayObject):void
{
}
private function setDP():void {
myMenu = new Menu();
var dp:Object = [{label: "New Folder"}, {label: "Sent Items"}, {label: "Inbox"}];
myMenu.dataProvider = dp;
application.myPopUpButton.popUp = myMenu;
}
]]>
</mx:Script>
<mx:Metadata>
<![CDATA[
[Mixin]
]]>
</mx:Metadata>
<!-- end of set of lines that must be in each unit test -->
<testCases>
<TestCase testID="PopUpButton_layout_rtl1" keywords="[Mirroring, PopUpButton]" description="layoutDirection is from application">
<setup>
<ResetComponent target="myPopUpButton" className="mx.controls.PopUpButton" waitEvent="updateComplete" waitTarget="myPopUpButton"/>
<SetProperty target="myPopUpButton" propertyName="label" value="My PopUpButton." waitEvent="updateComplete" waitTarget="myPopUpButton"/>
</setup>
<body>
<AssertPropertyValue target="myPopUpButton" propertyName="layoutDirection" value="rtl" />
<CompareBitmap target="myPopUpButton" url="../Mirroring/Baselines/$testID.png" numColorVariances="10" maxColorVariance="20"/>
</body>
</TestCase>
<TestCase testID="PopUpButton_layout_rtl2" keywords="[Mirroring, PopUpButton]" description="layoutDirection should still be same after setting a new dataprovider">
<setup>
<ResetComponent target="myPopUpButton" className="mx.controls.PopUpButton" waitEvent="updateComplete" waitTarget="myPopUpButton"/>
<SetProperty target="myPopUpButton" propertyName="label" value="My PopUpButton." waitEvent="updateComplete" waitTarget="myPopUpButton"/>
<RunCode code="setDP()" waitTarget="myPopUpButton" waitEvent="updateComplete"/>
</setup>
<body>
<AssertPropertyValue target="myPopUpButton" propertyName="layoutDirection" value="rtl" />
<CompareBitmap target="myPopUpButton" url="../Mirroring/Baselines/$testID.png" numColorVariances="10" maxColorVariance="20"/>
</body>
</TestCase>
<TestCase testID="PopUpButton_layout_rtl3" keywords="[Mirroring, PopUpButton]" description="verify drop down list when direction=rtl">
<setup>
<ResetComponent target="myPopUpButton" className="mx.controls.PopUpButton" waitEvent="updateComplete" waitTarget="myPopUpButton"/>
<SetProperty target="myPopUpButton" propertyName="label" value="My PopUpButton." waitEvent="updateComplete" waitTarget="myPopUpButton"/>
</setup>
<body>
<RunCode code="application.myPopUpButton.open()" waitTarget="myPopUpButton" waitEvent="open"/>
<AssertPropertyValue target="myPopUpButton" propertyName="layoutDirection" value="rtl" />
<CompareBitmap target="myPopUpButton" url="../Mirroring/Baselines/$testID.png" numColorVariances="10" maxColorVariance="20"/>
</body>
</TestCase>
<TestCase testID="PopUpButton_layout_rtl4" keywords="[Mirroring, PopUpButton]" description="verify layoutDirection update from rtl to ltr">
<setup>
<ResetComponent target="myPopUpButton" className="mx.controls.PopUpButton" waitEvent="updateComplete" waitTarget="myPopUpButton"/>
<SetProperty target="myPopUpButton" propertyName="label" value="My PopUpButton." waitEvent="updateComplete" waitTarget="myPopUpButton"/>
</setup>
<body>
<SetStyle target="myPopUpButton" styleName="layoutDirection" value="ltr" waitEvent="updateComplete"/>
<SetStyle target="myPopUpButton" styleName="direction" value="ltr" waitEvent="updateComplete"/>
<RunCode code="application.myPopUpButton.open()" waitTarget="myPopUpButton" waitEvent="open"/>
<AssertPropertyValue target="myPopUpButton" propertyName="layoutDirection" value="ltr" />
<CompareBitmap target="myPopUpButton" url="../Mirroring/Baselines/$testID.png" numColorVariances="10" maxColorVariance="20"/>
</body>
</TestCase>
<TestCase testID="PopUpButton_layout_rtl5" keywords="[Mirroring, PopUpButton]" description="verify layoutDirection when set to ltr, parent is rtl">
<setup>
<ResetComponent target="pubComp1" className="comps.PopUpButtonComp" waitEvent="updateComplete" waitTarget="pubComp1"/>
<SetProperty target="pubComp1" propertyName="label" value="My PopUpButton." waitEvent="updateComplete" waitTarget="pubComp1"/>
</setup>
<body>
<AssertPropertyValue target="pubComp1" propertyName="layoutDirection" value="ltr" />
<CompareBitmap target="pubComp1" url="../Mirroring/Baselines/$testID.png" numColorVariances="10" maxColorVariance="20"/>
</body>
</TestCase>
<TestCase testID="PopUpButton_layout_rtl6" keywords="[Mirroring, PopUpButton]" description="verify layoutDirection when set to rtl for custom PopupButton">
<setup>
<ResetComponent target="pubComp1" className="comps.PopUpButtonComp" waitEvent="updateComplete" waitTarget="pubComp1"/>
<SetProperty target="pubComp1" propertyName="layoutDirection" value="rtl" waitEvent="updateComplete" waitTarget="pubComp1"/>
<SetStyle target="pubComp1" styleName="direction" value="rtl" waitEvent="updateComplete" waitTarget="pubComp1"/>
</setup>
<body>
<AssertPropertyValue target="pubComp1" propertyName="layoutDirection" value="rtl" />
<CompareBitmap target="pubComp1" url="../Mirroring/Baselines/$testID.png" numColorVariances="10" maxColorVariance="20"/>
<DispatchMouseClickEvent target="pubComp1" localX="140" localY="8" waitEvent="open" waitTarget="pubComp1" />
<WaitForEffectsToEnd />
<DispatchMouseEvent type="mouseOver" target="pubComp1.popUp" localX="60" localY="5" />
<DispatchMouseEvent type="mouseMove" target="pubComp1.popUp" localX="55" localY="8" />
<DispatchMouseEvent type="mouseMove" target="pubComp1.popUp" localX="50" localY="4" />
<WaitForEffectsToEnd />
<CompareBitmap target="pubComp1.popUp" url="../Mirroring/Baselines/$testID_open.png" numColorVariances="10" maxColorVariance="20"/>
</body>
</TestCase>
<TestCase testID="PopUpButton_layout_rtl7" keywords="[Mirroring, PopUpButton]" description="verify layoutDirection when set to ltr, parent is rtl">
<setup>
<ResetComponent target="pubComp1" className="comps.PopUpButtonComp" waitEvent="updateComplete" waitTarget="pubComp1"/>
<SetProperty target="pubComp1" propertyName="label" value="My PopUpButton." waitEvent="updateComplete" waitTarget="pubComp1"/>
</setup>
<body>
<RunCode code="application.pubComp1.open()" waitTarget="pubComp1" waitEvent="open"/>
<AssertPropertyValue target="pubComp1" propertyName="layoutDirection" value="ltr" />
<CompareBitmap target="pubComp1" url="../Mirroring/Baselines/$testID.png" numColorVariances="10" maxColorVariance="20"/>
</body>
</TestCase>
<TestCase testID="PopUp_alignment_ltr" keywords="[Mirroring, PopUpButton]" description="verify layoutDirection when set to ltr,popup should align its parent based on ltr">
<setup>
<ResetComponent target="pubComp3" className="comps.PopUpButtonComp" waitEvent="updateComplete" waitTarget="pubComp3"/>
</setup>
<body>
<AssertPropertyValue target="pubComp3" propertyName="layoutDirection" value="ltr" />
<CompareBitmap target="pubComp3" url="../Mirroring/Baselines/$testID.png" numColorVariances="10" maxColorVariance="20"/>
<DispatchMouseClickEvent target="pubComp3" localX="140" localY="8" waitEvent="open" waitTarget="pubComp3" />
<WaitForEffectsToEnd />
<DispatchMouseEvent type="mouseOver" target="pubComp3.popUp" localX="60" localY="5" />
<DispatchMouseEvent type="mouseMove" target="pubComp3.popUp" localX="55" localY="8" />
<DispatchMouseEvent type="mouseMove" target="pubComp3.popUp" localX="50" localY="4" />
<WaitForEffectsToEnd />
<CompareBitmap target="pubComp3.popUp" url="../Mirroring/Baselines/$testID_open.png" numColorVariances="10" maxColorVariance="20"/>
<CompareBitmap target="box3" url="../Mirroring/Baselines/$testID_box3.png" numColorVariances="10" maxColorVariance="20"/>
</body>
</TestCase>
<TestCase testID="PopUp_alignment_rtl" keywords="[Mirroring, PopUpButton]" description="verify layoutDirection when set to rtl,popup should align its parent based on rtl">
<setup>
<ResetComponent target="pubComp4" className="comps.PopUpButtonComp" waitEvent="updateComplete" waitTarget="pubComp4"/>
</setup>
<body>
<AssertPropertyValue target="pubComp4" propertyName="layoutDirection" value="rtl" />
<CompareBitmap target="pubComp4" url="../Mirroring/Baselines/$testID.png" numColorVariances="10" maxColorVariance="20"/>
<DispatchMouseClickEvent target="pubComp4" localX="140" localY="8" waitEvent="open" waitTarget="pubComp4" />
<WaitForEffectsToEnd />
<DispatchMouseEvent type="mouseOver" target="pubComp4.popUp" localX="60" localY="5" />
<DispatchMouseEvent type="mouseMove" target="pubComp4.popUp" localX="55" localY="8" />
<DispatchMouseEvent type="mouseMove" target="pubComp4.popUp" localX="50" localY="4" />
<WaitForEffectsToEnd />
<CompareBitmap target="pubComp4.popUp" url="../Mirroring/Baselines/$testID_open.png" numColorVariances="10" maxColorVariance="20"/>
<CompareBitmap target="box4" url="../Mirroring/Baselines/$testID_box4.png" numColorVariances="10" maxColorVariance="20"/>
</body>
</TestCase>
</testCases>
</UnitTester>