blob: 8259e844c35e9992cf006802231ff855a8e86f58 [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/Box/Methods/" xmlns:mx="http://www.adobe.com/2006/mxml" xmlns="*" testSWF="Box_Basic.mxml">
<!-- this set of lines Box 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.controls.Button;
import mx.containers.*;
public var myP:Panel;
public function addChildToBox():void
{
var bt:Button= new Button();
bt.label="Hello";
application.myCustomBox.myBox.addChild(bt);
}
public function removeChildFromBox():void
{
application.myCustomBox.myBox.removeChildAt(1);
}
public function removeChildOfBox():void
{
application.myCustomBox.myBox.removeChild(myP);
}
public function addChildAtToBox():void
{
var bt:Button= new Button();
bt.label="MyButton";
application.myCustomBox.myBox.addChildAt(bt,1);
}
public function addContainer():void
{
myP = new Panel();
myP.percentWidth=100; myP.percentHeight=100;
application.myCustomBox.myBox.addChild(myP);
}
public function removeAllChildrenOfBox():void
{
application.myCustomBox.myBox.
removeAllChildren();
}
]]>
</mx:Script>
<testCases>
<TestCase testID="Box_method_addChild" keywords="[Box, addChild]" description="To verify the method Box addChild">
<setup>
<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 ="myCustomBox.myBox" propertyName="numChildren" value="20" />
</body>
</TestCase>
<TestCase testID="Box_method_addChildAt" keywords="[Box, addChild]" description="To verify the method Box removeChildAt">
<setup>
<ResetComponent target="myCustomBox" className="CustomBox" waitEvent="updateComplete" waitTarget="myCustomBox"/>
<RunCode code="addChildAtToBox()"/>
<WaitForEffectsToEnd />
</setup>
<body>
<AssertPropertyValue target="myCustomBox.myBox" propertyName="numChildren" value="13" />
<AssertPropertyValue target="myCustomBox.myBox.getChildAt(2)" propertyName="label" value="" />
</body>
</TestCase>
<TestCase testID="Box_method_addChildAt2" keywords="[Box, addChildAt]" description="To verify the method Box removeChildAt">
<setup>
<ResetComponent target="myCustomBox" className="CustomBox" waitEvent="updateComplete" waitTarget="myCustomBox"/>
<RunCode code="addChildAtToBox()"/>
<WaitForEffectsToEnd />
</setup>
<body>
<AssertPropertyValue target="myCustomBox.myBox.getChildAt(2)" propertyName="label" value="" />
<AssertPropertyValue target="myCustomBox.myBox" propertyName="numChildren" value="13" />
</body>
</TestCase>
<TestCase testID="Box_method_removeChildAt" keywords="[Box, removeChildAt]" description="To verify the method Box removeChildAt">
<setup>
<ResetComponent target="myCustomBox" className="CustomBox" waitEvent="updateComplete" waitTarget="myCustomBox"/>
<RunCode code="removeChildFromBox()"/>
<WaitForEffectsToEnd />
</setup>
<body>
<AssertPropertyValue target="myCustomBox.myBox" propertyName="numChildren" value="11" />
</body>
</TestCase>
<TestCase testID="Box_method_removeAll" keywords="[Box, removeAll]" description="To verify the method Box removeAll">
<setup>
<ResetComponent target="myCustomBox" className="CustomBox" waitEvent="updateComplete" waitTarget="myCustomBox"/>
<RunCode code="removeAllChildrenOfBox()"/>
<WaitForEffectsToEnd />
</setup>
<body>
<AssertPropertyValue target="myCustomBox.myBox" propertyName="numChildren" value="0" />
</body>
</TestCase>
<TestCase testID="Box_method_removeAllElements" keywords="[Box, removeAllElements]" description="removing all elements via IVisualElementContainer's removeAllElements() method">
<setup>
<ResetComponent target="myCustomBox" className="CustomBox" waitEvent="updateComplete" waitTarget="myCustomBox"/>
<RunCode code="addChildToBox()"/>
<RunCode code="addChildToBox()"/>
<WaitForEffectsToEnd />
<AssertMethodValue method="application.myCustomBox.myBox.removeAllElements()" />
<WaitForEffectsToEnd />
</setup>
<body>
<AssertPropertyValue target="myCustomBox.myBox" propertyName="numChildren" value="0" />
<AssertPropertyValue target="myCustomBox.myBox" propertyName="numElements" value="0" />
</body>
</TestCase>
</testCases>
</UnitTester>