blob: becb9f2ba1d83f168dacbde996a62e88f1e6d34e [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="apollo/spark/components/Window/mirroring/" xmlns:mx="http://www.adobe.com/2006/mxml" xmlns="*" testSWF="window_mirroring_002.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.core.FlexGlobals;
import spark.components.Window;
import spark.components.Button;
import spark.components.CheckBox;
import mx.events.FlexEvent;
import comps.*;
public function addAButton():void
{
var b:Button=new Button();
b.name="testButton";
b.label="testButton";
b.y=500;
b.x=400;
if (FlexGlobals.topLevelApplication.windowObj!=null)
FlexGlobals.topLevelApplication.windowObj.addElement(b);
}
public var b:CheckBox=new CheckBox();
public function addCheckBox(t:Window, yPos:Number=100):void
{
b.label="checkbox";
var n:Number=t.numElements;
b.y=yPos;
t.addElementAt(b,n);
t.addEventListener("add",addListener);
}
public function addCheckBox2(t:Window, layoutDir:String):void
{
b.label="checkbox";
var n:Number=t.numElements;
b.y=100;
if (layoutDir!=null)
{
b.layoutDirection=layoutDir;
b.setStyle("direction",layoutDir);
}
t.addElementAt(b,n);
t.addEventListener("add",addListener);
}
public function addListener(e:FlexEvent):void
{
e.currentTarget.removeEventListener("add", addListener);
dispatchEvent(new FlexEvent("addChildComplete"));
}
]]>
</mx:Script>
<testCases>
<TestCase testID="Window_layoutDirection_style1" keywords="[Window,Mirroring]" description="Test Window UI without any content and layoutDirection=rtl">
<setup>
<RunCode code="FlexGlobals.topLevelApplication.closeAllChildWindow()"/>
<RunCode code="FlexGlobals.topLevelApplication.createAWindow()" waitTarget="" waitEvent="myWindowComplete" />
</setup>
<body>
<MyCompareBitmap target="myWin" url="../mirroring/baselines/$testID.png" mac_url="../mirroring/baselines/$testID_mac.png" />
<WaitForEvent target="stage" eventName="enterFrame" numExpectedEvents="2"/>
<RunCode code="FlexGlobals.topLevelApplication.closeAllChildWindow()"/>
</body>
</TestCase>
<TestCase testID="Window_layoutDirection_style2" keywords="[Window,Mirroring]" description="Test Window UI without any content, set a style with layoutDirection=ltr">
<setup>
<RunCode code="FlexGlobals.topLevelApplication.closeAllChildWindow()"/>
<RunCode code="FlexGlobals.topLevelApplication.createAWindow()" waitTarget="" waitEvent="myWindowComplete" />
</setup>
<body>
<RunCode code="FlexGlobals.topLevelApplication.myWin.styleName='testWindowStyle'"
waitTarget="myWin" waitEvent="updateComplete"/>
<!-- style set in the application precedes the one from styleName -->
<AssertStyleValue target="myWin" styleName="layoutDirection" value="rtl"/>
<MyCompareBitmap target="myWin" url="../mirroring/baselines/$testID.png" mac_url="../mirroring/baselines/$testID_mac.png" />
<WaitForEvent target="stage" eventName="enterFrame" numExpectedEvents="2"/>
<RunCode code="FlexGlobals.topLevelApplication.closeAllChildWindow()"/>
</body>
</TestCase>
<TestCase testID="Window_mirroring_addElement3" keywords="[Window,mirroring,update]" description="add an element without layoutDirection set, Window class selector has layoutDirection set">
<setup>
<RunCode code="FlexGlobals.topLevelApplication.closeAllChildWindow()"/>
<RunCode code="FlexGlobals.topLevelApplication.windowObj=FlexGlobals.topLevelApplication.createAWindowByClass(PlainWindow,'window1');" waitTarget="" waitEvent="myWindowComplete" />
</setup>
<body>
<RunCode code="addCheckBox2(FlexGlobals.topLevelApplication.windowObj,'rtl')" waitEvent="elementAdd" waitTarget="windowObj"/>
<MyCompareBitmap target="windowObj" numColorVariances="10" maxColorVariance="10" url="../mirroring/baselines/$testID.png" mac_url="../mirroring/baselines/$testID_mac.png" />
<WaitForEvent target="stage" eventName="enterFrame" numExpectedEvents="2"/>
<RunCode code="FlexGlobals.topLevelApplication.closeAllChildWindow()"/>
</body>
</TestCase>
<TestCase testID="Window_mirroring_addElement4" keywords="[Window,mirroring,update]" description="add an element without layoutDirection set">
<setup>
<RunCode code="FlexGlobals.topLevelApplication.closeAllChildWindow()"/>
<RunCode code="FlexGlobals.topLevelApplication.windowObj=FlexGlobals.topLevelApplication.createAWindowByClass(PlainWindow,'window1');" waitTarget="" waitEvent="myWindowComplete" />
</setup>
<body>
<RunCode code="addCheckBox2(FlexGlobals.topLevelApplication.windowObj,'ltr')" waitEvent="elementAdd" waitTarget="windowObj"/>
<MyCompareBitmap target="windowObj" numColorVariances="10" maxColorVariance="10" url="../mirroring/baselines/$testID.png" mac_url="../mirroring/baselines/$testID_mac.png" />
<WaitForEvent target="stage" eventName="enterFrame" numExpectedEvents="2"/>
<RunCode code="FlexGlobals.topLevelApplication.closeAllChildWindow()"/>
</body>
</TestCase>
</testCases>
</UnitTester>