| <?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/Canvas/Methods/" xmlns:mx="http://www.adobe.com/2006/mxml" xmlns="*" testSWF="FixedCanvas.mxml"> |
| |
| <mx:Script> |
| <![CDATA[ |
| |
| public static function init(o:DisplayObject):void |
| { |
| |
| } |
| |
| import mx.controls.Button; |
| import mx.containers.*; |
| public var myP:Panel; |
| public function addChildToCanvas():void |
| { |
| var bt:Button= new Button(); |
| bt.label="Hello"; |
| application.mainCanvas2.addChild(bt); |
| } |
| public function removeChildFromCanvas():void |
| { |
| application.mainCanvas2.removeChildAt(1); |
| } |
| public function removeChildOfCanvas():void |
| { |
| application.mainCanvas2.removeChild(myP); |
| } |
| public function addChildAtToCanvas():void |
| { |
| var bt:Button= new Button(); |
| bt.label="MyButton"; |
| application.mainCanvas2.addChildAt(bt,1); |
| } |
| public function addContainer():void |
| { |
| myP = new Panel(); |
| myP.percentWidth=100; myP.percentHeight=100; |
| application.mainCanvas2.addChild(myP); |
| } |
| public function removeAllChildrenOfCanvas():void |
| { |
| application.mainCanvas2. |
| removeAllChildren(); |
| } |
| ]]> |
| </mx:Script> |
| |
| <mx:Metadata> |
| <![CDATA[ |
| [Mixin] |
| ]]> |
| </mx:Metadata> |
| |
| <testCases> |
| <TestCase testID="Canvas_method_addChild" keywords="[Canvas, addChild]" description="To verify the method Canvas addChild"> |
| <setup> |
| <RunCode code="addChildToCanvas()"/> |
| <WaitForEffectsToEnd /> |
| <RunCode code="addContainer()"/> |
| <WaitForEffectsToEnd /> |
| <RunCode code="addChildToCanvas()"/> |
| <WaitForEffectsToEnd /> |
| <RunCode code="addContainer()"/> |
| <WaitForEffectsToEnd /> |
| <RunCode code="addChildToCanvas()"/> |
| <WaitForEffectsToEnd /> |
| <RunCode code="addContainer()"/> |
| <WaitForEffectsToEnd /> |
| <RunCode code="addChildToCanvas()"/> |
| <WaitForEffectsToEnd /> |
| <RunCode code="addContainer()"/> |
| <WaitForEffectsToEnd /> |
| </setup> |
| <body> |
| <AssertPropertyValue target ="mainCanvas2" propertyName="numChildren" value="9" /> |
| </body> |
| </TestCase> |
| <TestCase testID="Canvas_method_addChildAt" keywords="[Canvas, addChildAt]" description="To verify the method Canvas addChildAt"> |
| <setup> |
| |
| <RunCode code="addChildAtToCanvas()"/> |
| <WaitForEffectsToEnd /> |
| </setup> |
| <body> |
| |
| <AssertPropertyValue target="mainCanvas2.getChildAt(2)" propertyName="label" value="Hello" /> |
| <AssertPropertyValue target="mainCanvas2" propertyName="numChildren" value="10" /> |
| </body> |
| </TestCase> |
| <TestCase testID="Canvas_method_removeChildAt" keywords="[Canvas, removeChildAt]" description="To verify the method Canvas removeChildAt"> |
| <setup> |
| |
| <RunCode code="removeChildFromCanvas()"/> |
| <WaitForEffectsToEnd /> |
| </setup> |
| <body> |
| <AssertPropertyValue target="mainCanvas2" propertyName="numChildren" value="9" /> |
| |
| </body> |
| </TestCase> |
| |
| <TestCase testID="Canvas_method_removeAll" keywords="[Canvas, removeAll]" description="To verify the method Canvas removeAll"> |
| <setup> |
| |
| <RunCode code="removeAllChildrenOfCanvas()"/> |
| <WaitForEffectsToEnd /> |
| </setup> |
| <body> |
| <AssertPropertyValue target="mainCanvas2" propertyName="numChildren" value="0" /> |
| |
| </body> |
| </TestCase> |
| </testCases> |
| </UnitTester> |