blob: 4476b89d878fd68c141a96d7851ac2cd90052181 [file] [log] [blame]
<UnitTester testDir="components/Tree/Styles/"
xmlns:fx="http://ns.adobe.com/mxml/2009"
xmlns:mx="library://ns.adobe.com/flex/mx"
xmlns:s="library://ns.adobe.com/flex/spark"
xmlns="*"
testSWF="TreeMirroring_wireframe.mxml">
<!-- this set of lines form a template that must be in each unit test -->
<fx:Script>
<![CDATA[
public static function init(o:DisplayObject):void
{
}
]]>
</fx:Script>
<fx:Metadata>
<![CDATA[
[Mixin]
]]>
</fx:Metadata>
<!-- end of set of lines that must be in each unit test -->
<fx:Script>
<![CDATA[
{
import mx.core.FlexGlobals;
}
]]>
</fx:Script>
<testCases>
<TestCase testID="WF_mxTree_Mirroring_as_default" keywords="[Tree, Mirroring, rtl]" description="Test layoutDirection/direction set to rtl in AS on Tree">
<setup>
<ResetComponent target="tree_m1" className="comps.Custom_Tree_M" waitEvent="updateComplete"/>
</setup>
<body>
<RunCode code="FlexGlobals.topLevelApplication.setLdRTL()" />
<Pause timeout="20"/>
<AssertStyleValue target="tree_m1" styleName="layoutDirection" value="rtl"/>
<RunCode code="application.tree_m1.expandItem(application.tree_m1.dataProvider.children()[0], true, false)" waitEvent="updateComplete" waitTarget="tree_m1" />
<RunCode code="FlexGlobals.topLevelApplication.setDRTL()" />
<Pause timeout="20"/>
<AssertStyleValue target="tree_m1" styleName="direction" value="rtl"/>
<SetProperty target="tree_m1" propertyName="height" value="130" waitEvent="updateComplete" />
<SetProperty target="tree_m1" propertyName="width" value="130" waitEvent="updateComplete" />
<CompareBitmap target="tree_m1" url="../Styles/Baselines/$testID.png" numColorVariances="10" ignoreMaxColorVariance="true"/>
</body>
</TestCase>
<TestCase testID="WF_mxTree_Mirroring_default" keywords="[Tree, Mirroring, rtl]" description="Test layoutDirection/direction rtl on Tree">
<setup>
<ResetComponent target="tree_m1" className="comps.Custom_Tree_M" waitEvent="updateComplete"/>
</setup>
<body>
<AssertStyleValue target="tree_m1" styleName="layoutDirection" value="ltr"/>
<AssertStyleValue target="tree_m1" styleName="direction" value="ltr"/>
<SetStyle target="tree_m1" styleName="layoutDirection" value="rtl" waitEvent="updateComplete"/>
<AssertStyleValue target="tree_m1" styleName="layoutDirection" value="rtl"/>
<AssertStyleValue target="tree_m1" styleName="direction" value="ltr"/>
<RunCode code="application.tree_m1.expandItem(application.tree_m1.dataProvider.children()[1], true, false)" waitEvent="updateComplete" waitTarget="tree_m1" />
<SetProperty target="tree_m1" propertyName="height" value="130" waitEvent="updateComplete" />
<SetProperty target="tree_m1" propertyName="width" value="130" waitEvent="updateComplete" />
<CompareBitmap target="tree_m1" url="../Styles/Baselines/$testID_1.png" numColorVariances="10" ignoreMaxColorVariance="true"/>
<SetStyle target="tree_m1" styleName="direction" value="rtl" waitEvent="updateComplete"/>
<SetProperty target="tree_m1" propertyName="height" value="135" waitEvent="updateComplete" />
<SetProperty target="tree_m1" propertyName="width" value="135" waitEvent="updateComplete" />
<AssertStyleValue target="tree_m1" styleName="direction" value="rtl"/>
<AssertStyleValue target="tree_m1" styleName="layoutDirection" value="rtl"/>
<CompareBitmap target="tree_m1" url="../Styles/Baselines/$testID_2.png" numColorVariances="10" ignoreMaxColorVariance="true"/>
</body>
</TestCase>
<TestCase testID="WF_mxTree_Mirroring_mxml_default" keywords="[Tree, Mirroring, rtl]" description="Test layoutDirection/direction set to rtl in MXML on Tree">
<setup>
<ResetComponent target="tree_m2" className="comps.Custom_Tree_M_RTL" waitEvent="updateComplete"/>
</setup>
<body>
<AssertStyleValue target="tree_m2" styleName="layoutDirection" value="rtl"/>
<AssertStyleValue target="tree_m2" styleName="direction" value="rtl"/>
</body>
</TestCase>
<TestCase testID="WF_mxTree_Mirroring_mxml_changeDir" keywords="[Tree, Mirroring, rtl]" description="Test layoutDirection set to ltr at runtime on Tree">
<setup>
<ResetComponent target="tree_m2" className="comps.Custom_Tree_M_RTL" waitEvent="updateComplete"/>
</setup>
<body>
<AssertStyleValue target="tree_m2" styleName="layoutDirection" value="rtl"/>
<AssertStyleValue target="tree_m2" styleName="direction" value="rtl"/>
<RunCode code="application.tree_m2.expandItem(application.tree_m2.dataProvider.children()[0], true, false)" waitEvent="updateComplete" waitTarget="tree_m2" />
<SetProperty target="tree_m2" propertyName="height" value="135" waitEvent="updateComplete" />
<SetProperty target="tree_m2" propertyName="width" value="135" waitEvent="updateComplete" />
<CompareBitmap target="tree_m2" url="../Styles/Baselines/$testID_1.png" numColorVariances="10" ignoreMaxColorVariance="true"/>
<SetStyle target="tree_m2" styleName="layoutDirection" value="ltr" waitEvent="updateComplete"/>
<SetStyle target="tree_m2" styleName="direction" value="ltr" waitEvent="updateComplete"/>
<AssertStyleValue target="tree_m2" styleName="layoutDirection" value="ltr"/>
<AssertStyleValue target="tree_m2" styleName="direction" value="ltr"/>
<SetProperty target="tree_m2" propertyName="height" value="130" waitEvent="updateComplete" />
<SetProperty target="tree_m2" propertyName="width" value="130" waitEvent="updateComplete" />
<CompareBitmap target="tree_m2" url="../Styles/Baselines/$testID_2.png" numColorVariances="10" ignoreMaxColorVariance="true"/>
</body>
</TestCase>
<TestCase testID="WF_mxTree_Mirroring_keyboard1" keywords="[Tree, Mirroring, rtl]" description="Test keyboard navigation with layoutDirection rtl on Tree">
<setup>
<ResetComponent target="tree_m1" className="comps.Custom_Tree_M" waitEvent="updateComplete"/>
<SetStyle target="tree_m1" styleName="layoutDirection" value="rtl" waitEvent="updateComplete"/>
</setup>
<body>
<DispatchKeyEvent keys="[TAB]" waitEvent="focusIn" waitTarget="tree_m1"/>
<RunCode code="application.tree_m1.expandItem(application.tree_m1.dataProvider.children()[0], true, false)" waitEvent="updateComplete" waitTarget="tree_m1" />
<DispatchKeyEvent keys="[DOWN]" />
<Pause timeout="100"/>
<DispatchKeyEvent keys="[DOWN]" />
<Pause timeout="100"/>
<AssertPropertyValue target="tree_m1" propertyName="selectedIndex" value="2"/>
</body>
</TestCase>
<TestCase testID="WF_mxTree_Mirroring_keyboard2" keywords="[Tree, Mirroring, rtl]" description="Test keyboard navigation with layoutDirection rtl on Tree">
<setup>
<ResetComponent target="tree_m1" className="comps.Custom_Tree_M" waitEvent="updateComplete"/>
<SetStyle target="tree_m1" styleName="layoutDirection" value="rtl" waitEvent="updateComplete"/>
</setup>
<body>
<DispatchKeyEvent keys="[TAB]" waitEvent="focusIn" waitTarget="tree_m1"/>
<RunCode code="application.tree_m1.expandItem(application.tree_m1.dataProvider.children()[1], true, false)" waitEvent="updateComplete" waitTarget="tree_m1" />
<SetProperty target="tree_m1" propertyName="selectedIndex" value="4" />
<DispatchKeyEvent keys="[UP]" />
<Pause timeout="100"/>
<DispatchKeyEvent keys="[UP]" />
<Pause timeout="100"/>
<AssertPropertyValue target="tree_m1" propertyName="selectedIndex" value="2"/>
</body>
</TestCase>
<TestCase testID="WF_mxTree_Mirroring_parentContainer1" keywords="[Tree, Mirroring, rtl]" description="Test setting layDirection on parentContainer of Tree">
<setup>
<ResetComponent target="myPanel3" className="comps.myCustomPanel_M" waitEvent="updateComplete"/>
<SetStyle target="myPanel3" styleName="layoutDirection" value="rtl" waitEvent="updateComplete"/>
</setup>
<body>
<AssertStyleValue target="myPanel3" styleName="layoutDirection" value="rtl"/>
<RunCode code="application.myPanel3.theTree.expandItem(application.myPanel3.theTree.dataProvider.children()[0], true, false)" waitEvent="updateComplete" waitTarget="myPanel3.theTree" />
<SetProperty target="myPanel3" propertyName="height" value="150" waitEvent="updateComplete" />
<SetProperty target="myPanel3" propertyName="width" value="180" waitEvent="updateComplete" />
<CompareBitmap target="myPanel3" url="../Styles/Baselines/$testID.png" numColorVariances="10" ignoreMaxColorVariance="true"/>
</body>
</TestCase>
<TestCase testID="WF_mxTree_Mirroring_parentContainer2" keywords="[Tree, Mirroring, rtl]" description="Test setting direction on parentContainer of Tree">
<setup>
<ResetComponent target="myPanel3" className="comps.myCustomPanel_M" waitEvent="updateComplete"/>
<SetStyle target="myPanel3" styleName="direction" value="rtl" waitEvent="updateComplete"/>
</setup>
<body>
<AssertStyleValue target="myPanel3" styleName="direction" value="rtl"/>
<RunCode code="application.myPanel3.theTree.expandItem(application.myPanel3.theTree.dataProvider.children()[1], true, false)" waitEvent="updateComplete" waitTarget="myPanel3.theTree" />
<SetProperty target="myPanel3" propertyName="height" value="160" waitEvent="updateComplete" />
<SetProperty target="myPanel3" propertyName="width" value="160" waitEvent="updateComplete" />
<CompareBitmap target="myPanel3" url="../Styles/Baselines/$testID_1.png" numColorVariances="10" ignoreMaxColorVariance="true"/>
</body>
</TestCase>
<TestCase testID="WF_mxTree_Mirroring_parentContainer3" keywords="[Tree, Mirroring, rtl]" description="Test setting layoutDirection/direction on parentContainer of Tree">
<setup>
<ResetComponent target="myPanel3" className="comps.myCustomPanel_M" waitEvent="updateComplete"/>
<SetStyle target="myPanel3" styleName="direction" value="rtl" waitEvent="updateComplete"/>
<SetStyle target="myPanel3" styleName="layoutDirection" value="rtl" waitEvent="updateComplete"/>
</setup>
<body>
<AssertStyleValue target="myPanel3" styleName="direction" value="rtl"/>
<AssertStyleValue target="myPanel3" styleName="layoutDirection" value="rtl"/>
<RunCode code="application.myPanel3.theTree.expandItem(application.myPanel3.theTree.dataProvider.children()[0], true, false)" waitEvent="updateComplete" waitTarget="myPanel3.theTree" />
<SetProperty target="myPanel3" propertyName="height" value="160" waitEvent="updateComplete" />
<SetProperty target="myPanel3" propertyName="width" value="160" waitEvent="updateComplete" />
<CompareBitmap target="myPanel3" url="../Styles/Baselines/$testID_1.png" numColorVariances="10" ignoreMaxColorVariance="true"/>
</body>
</TestCase>
<TestCase testID="WF_mxTree_Mirroring_parentContainer4" keywords="[Tree, Mirroring, rtl]" description="Test setting styles and layoutDirection/direction on parentContainer of Tree">
<setup>
<ResetComponent target="myPanel3" className="comps.myCustomPanel_M" waitEvent="updateComplete"/>
<SetStyle target="myPanel3" styleName="color" value="0x00DD00" waitEvent="updateComplete"/>
<SetStyle target="myPanel3" styleName="fontSize" value="14" waitEvent="updateComplete"/>
<SetStyle target="myPanel3" styleName="chromeColor" value="0x0000DD" waitEvent="updateComplete"/>
<SetStyle target="myPanel3" styleName="direction" value="rtl" waitEvent="updateComplete"/>
<SetStyle target="myPanel3" styleName="layoutDirection" value="rtl" waitEvent="updateComplete"/>
</setup>
<body>
<AssertStyleValue target="myPanel3" styleName="direction" value="rtl"/>
<AssertStyleValue target="myPanel3" styleName="layoutDirection" value="rtl"/>
<AssertStyleValue target="myPanel3" styleName="color" value="0x00DD00" />
<AssertStyleValue target="myPanel3" styleName="fontSize" value="14" />
<AssertStyleValue target="myPanel3" styleName="chromeColor" value="0x0000DD" />
<RunCode code="application.myPanel3.theTree.expandItem(application.myPanel3.theTree.dataProvider.children()[0], true, false)" waitEvent="updateComplete" waitTarget="myPanel3.theTree" />
<SetProperty target="myPanel3" propertyName="height" value="160" waitEvent="updateComplete" />
<SetProperty target="myPanel3" propertyName="width" value="160" waitEvent="updateComplete" />
<CompareBitmap target="myPanel3" url="../Styles/Baselines/$testID_1.png" numColorVariances="10" ignoreMaxColorVariance="true"/>
</body>
</TestCase>
<TestCase testID="WF_mxTree_Mirroring_selectedIndex" keywords="[Tree, Mirroring, rtl]" description="Test selectedIndex with layoutDirection/direction rtl on Tree">
<setup>
<ResetComponent target="tree_m1" className="comps.Custom_Tree_M" waitEvent="updateComplete"/>
<SetStyle target="tree_m1" styleName="layoutDirection" value="rtl" waitEvent="updateComplete"/>
<SetStyle target="tree_m1" styleName="direction" value="rtl" waitEvent="updateComplete"/>
</setup>
<body>
<AssertStyleValue target="tree_m1" styleName="layoutDirection" value="rtl"/>
<AssertStyleValue target="tree_m1" styleName="direction" value="rtl"/>
<RunCode code="application.tree_m1.expandItem(application.tree_m1.dataProvider.children()[1], true, false)" waitEvent="updateComplete" waitTarget="tree_m1" />
<SetProperty target="tree_m1" propertyName="selectedIndex" value="2" />
<SetProperty target="tree_m1" propertyName="height" value="130" waitEvent="updateComplete" />
<SetProperty target="tree_m1" propertyName="width" value="130" waitEvent="updateComplete" />
<AssertPropertyValue target="tree_m1" propertyName="selectedIndex" value="2"/>
<CompareBitmap target="tree_m1" url="../Styles/Baselines/$testID.png"/>
</body>
</TestCase>
<TestCase testID="WF_mxTree_Mirroring_styles" keywords="[Tree, Mirroring, rtl]" description="Test styles with layoutDirection/direction rtl on Tree">
<setup>
<ResetComponent target="tree_m1" className="comps.Custom_Tree_M" waitEvent="updateComplete"/>
<SetStyle target="tree_m1" styleName="color" value="0x00FF00" waitEvent="updateComplete"/>
<SetStyle target="tree_m1" styleName="fontSize" value="16" waitEvent="updateComplete"/>
<SetStyle target="tree_m1" styleName="chromeColor" value="0xDD0000" waitEvent="updateComplete"/>
<SetStyle target="tree_m1" styleName="layoutDirection" value="rtl" waitEvent="updateComplete"/>
<SetStyle target="tree_m1" styleName="direction" value="rtl" waitEvent="updateComplete"/>
</setup>
<body>
<AssertStyleValue target="tree_m1" styleName="layoutDirection" value="rtl"/>
<AssertStyleValue target="tree_m1" styleName="direction" value="rtl"/>
<AssertStyleValue target="tree_m1" styleName="color" value="0x00FF00"/>
<AssertStyleValue target="tree_m1" styleName="fontSize" value="16"/>
<AssertStyleValue target="tree_m1" styleName="chromeColor" value="0xDD0000"/>
<AssertPropertyValue target="tree_m1" propertyName="selectedIndex" value="0"/>
<SetProperty target="tree_m1" propertyName="height" value="130" waitEvent="updateComplete" />
<SetProperty target="tree_m1" propertyName="width" value="130" waitEvent="updateComplete" />
<CompareBitmap target="tree_m1" url="../Styles/Baselines/$testID_1.png" numColorVariances="3" maxColorVariance="20"/>
<SetStyle target="tree_m1" styleName="layoutDirection" value="ltr" waitEvent="updateComplete"/>
<SetStyle target="tree_m1" styleName="direction" value="ltr" waitEvent="updateComplete"/>
<AssertStyleValue target="tree_m1" styleName="layoutDirection" value="ltr"/>
<AssertStyleValue target="tree_m1" styleName="direction" value="ltr"/>
<AssertStyleValue target="tree_m1" styleName="color" value="0x00FF00"/>
<AssertStyleValue target="tree_m1" styleName="fontSize" value="16"/>
<AssertStyleValue target="tree_m1" styleName="chromeColor" value="0xDD0000"/>
<SetProperty target="tree_m1" propertyName="height" value="135" waitEvent="updateComplete" />
<SetProperty target="tree_m1" propertyName="width" value="135" waitEvent="updateComplete" />
<CompareBitmap target="tree_m1" url="../Styles/Baselines/$testID_3.png" numColorVariances="3" maxColorVariance="20"/>
</body>
</TestCase>
</testCases>
</UnitTester>