blob: 45216428b34b86602531950e6185d083f4e68bee [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="containers/DividedBox/Methods/" xmlns:mx="http://www.adobe.com/2006/mxml" xmlns="*" testSWF="DivBoxMain_spark.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.containers.*;
import mx.controls.Button;
import mx.styles.StyleManager;
import mx.managers.SystemManager;
import mx.containers.dividedBoxClasses.BoxDivider;
public function scriptFunction(a:String, b:int):String
{
return a + ":" + b.toString();
}
private function moveBoxDivider(div:BoxDivider):void
{
div.x = 35;
}
public var styleDecl:Object;
public var styleObj:Object;
public var myP:Panel;
public function addChildToBox():void
{
var bt:Button= new Button();
bt.label="Hello";
application.div.addChild(bt);
}
public function removeChildFromBox():void
{
application.div.removeChildAt(1);
}
public function removeChildOfBox():void
{
application.div.removeChild(myP);
}
public function addChildAtToBox():void
{
var bt:Button= new Button();
bt.label="MyButton";
application.div.addChildAt(bt,1);
}
public function addContainer():void
{
myP = new Panel();
myP.percentWidth=100; myP.percentHeight=100;
application.div.addChild(myP);
}
public function removeAllChildrenOfBox():void
{
application.div.removeAllChildren();
}
]]>
</mx:Script>
<testCases>
<TestCase testID="div_methods_moveDivider_spark" keywords="[DividedBox, methods, moveDivider]">
<setup>
<ResetComponent target="div" className="DivBoxComp_spark" waitTarget="div" waitEvent="updateComplete" />
<SetProperty target="div.myp" propertyName="width" value="30" waitEvent="updateComplete"/>
</setup>
<body>
<SetProperty target="div" propertyName="direction" value="horizontal" waitTarget="div" waitEvent="updateComplete" />
<RunCode code="addContainer()"/> <RunCode code="addContainer()"/>
<RunCode code="addContainer()"/> <RunCode code="addContainer()"/>
<RunCode code="addContainer()" waitTarget="div" waitEvent="updateComplete" />
<CompareBitmap target="div" url="../Methods/Baselines/divbox_movedivider_initial_spark.png"/>
<RunCode code="application.div.moveDivider(0,-100)" waitTarget="div" waitEvent="updateComplete" />
<CompareBitmap target="div" url="../Methods/Baselines/divbox_movedivider_back_spark.png"/>
<RunCode code="application.div.moveDivider(3,100)" waitTarget="div" waitEvent="updateComplete" />
<CompareBitmap target="div" url="../Methods/Baselines/divbox_movedivider_forward_spark.png"/>
</body>
</TestCase>
<TestCase testID="div_methods_getDividerAt_spark" keywords="[DividedBox, methods, getDividerAt]">
<setup>
<ResetComponent target="div" className="DivBoxComp_spark" waitEvent="updateComplete"/>
<SetProperty target="div" propertyName="direction" value="horizontal" waitTarget="div" waitEvent="updateComplete" />
</setup>
<body>
<RunCode code="addContainer()"/> <RunCode code="addContainer()"/>
<RunCode code="addContainer()"/> <RunCode code="addContainer()"/>
<RunCode code="moveBoxDivider(application.div.getDividerAt(0))" waitTarget="div" waitEvent="updateComplete" />
<CompareBitmap target="div" url="../Methods/Baselines/divbox_getDividerAt_spark.png"/>
</body>
</TestCase>
<TestCase testID="Box_method_addChild_spark" keywords="[Box, addChild]" description="To verify the method Box addChild">
<setup>
<ResetComponent target="div" className="DivBoxComp_spark" waitEvent="updateComplete" />
<AssertPropertyValue target ="div" propertyName="numChildren" value="2" />
<RunCode code="addChildToBox()"/>
<WaitForEffectsToEnd />
<RunCode code="addContainer()"/>
<WaitForEffectsToEnd />
<RunCode code="addChildToBox()"/>
<WaitForEffectsToEnd />
<RunCode code="addContainer()"/>
<WaitForEffectsToEnd />
<RunCode code="addChildToBox()"/>
<WaitForEffectsToEnd />
<RunCode code="addContainer()"/>
<WaitForEffectsToEnd />
<RunCode code="addChildToBox()"/>
<WaitForEffectsToEnd />
<RunCode code="addContainer()"/>
<WaitForEffectsToEnd />
</setup>
<body>
<AssertPropertyValue target ="div" propertyName="numChildren" value="10" />
</body>
</TestCase>
<TestCase testID="Box_method_addChildAt_spark" keywords="[Box, addChild]" description="To verify the method Box removeChildAt">
<setup>
<ResetComponent target="div" className="DivBoxComp_spark" waitEvent="updateComplete" waitTarget="div"/>
<RunCode code="addChildAtToBox()"/>
<WaitForEffectsToEnd />
</setup>
<body>
<AssertPropertyValue target="div" propertyName="numChildren" value="3" />
<AssertPropertyValue target="div.getChildAt(2)" propertyName="label" value="" />
</body>
</TestCase>
<TestCase testID="Box_method_removeChildAt_spark" keywords="[Box, removeChildAt]" description="To verify the method Box removeChildAt">
<setup>
<ResetComponent target="div" className="DivBoxComp_spark" waitEvent="updateComplete" waitTarget="div"/>
<RunCode code="removeChildFromBox()"/>
<WaitForEffectsToEnd />
</setup>
<body>
<AssertPropertyValue target="div" propertyName="numChildren" value="1" />
</body>
</TestCase>
<TestCase testID="Box_method_removeAll_spark" keywords="[Box, removeAll]" description="To verify the method Box removeAll">
<setup>
<ResetComponent target="div" className="DivBoxComp_spark" waitEvent="updateComplete" waitTarget="div"/>
<RunCode code="removeAllChildrenOfBox()"/>
<WaitForEffectsToEnd />
</setup>
<body>
<AssertPropertyValue target="div" propertyName="numChildren" value="0" />
<ResetComponent target="myDB" className="mx.containers.DividedBox" waitEvent="updateComplete" waitTarget="myDB"/>
<ResetComponent target="div" className="DivBoxComp_spark" waitTarget="div" waitEvent="updateComplete" />
<WaitForEffectsToEnd />
</body>
</TestCase>
</testCases>
</UnitTester>