| <?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="gumbo/layout/BasicLayout/integration/" xmlns:mx="http://www.adobe.com/2006/mxml" xmlns="*" testSWF="BasicLayout_default.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 spark.layouts.*; |
| import spark.components.Button; |
| private function configTest1():void |
| { |
| application.parentGroup.childBtn.x=100; |
| application.parentGroup.childBtn.y=200; |
| application.parentGroup.childBtn.includeInLayout="true"; |
| application.parentGroup.childBtn.top=100; |
| application.parentGroup.childBtn.bottom=150; |
| application.parentGroup.childBtn.minHeight=100; |
| |
| |
| var b:Button=new Button(); |
| b.x=200; |
| b.y=200; |
| b.label="child2"; |
| b.includeInLayout=false; |
| b.height=100;//so b.width isn't set |
| application.parentGroup.childBorder.width=300; |
| application.parentGroup.childBorder.height=200; |
| application.parentGroup.childBorder.includeInLayout=false; |
| application.parentGroup.childGroup.addElementAt(b,1); |
| |
| } |
| ]]> |
| </mx:Script> |
| |
| <testCases> |
| |
| <!-- |
| ======================================================== |
| includeInLayout |
| ======================================================== |
| --> |
| <TestCase testID="includeInLayout_default" keywords="[BasicLayout,intergration,constraints,measure]" description="verify includeInLayout=false, the element will be excluded when calculate parent container's size" > |
| <setup> |
| <ResetComponent target="parentGroup" className="comps.DefaultGroup" waitEvent="updateComplete" waitTarget="parentGroup"/> |
| |
| <SetProperty propertyName="includeInLayout" value="false" target="parentGroup.childBorder"/> |
| <SetProperty propertyName="width" value="300" target="parentGroup.childBorder" /> |
| <SetProperty propertyName="height" value="300" target="parentGroup.childBorder" waitEvent="updateComplete" waitTarget="parentGroup.childGroup"/> |
| |
| |
| </setup> |
| <body> |
| <!-- even childBorder is set, but includeInLayout=false, so will not be considered when calculate |
| childGroup's size, still use childBtn to measure the size |
| --> |
| <AssertPropertyValue propertyName="width" value="70" target="parentGroup.childGroup"/> |
| <AssertPropertyValue propertyName="height" value="21" target="parentGroup.childGroup"/> |
| <CompareBitmap url="../integration/baselines/$testID.png" numColorVariances="5" maxColorVariance="10" /> |
| </body> |
| </TestCase> |
| |
| <TestCase testID="includeInLayout_default2" keywords="[BasicLayout,intergration,constraints,measure]" description="verify includeInLayout=true, the element will be included when calculate parent container's size" > |
| <setup> |
| <ResetComponent target="parentGroup" className="comps.DefaultGroup" waitEvent="updateComplete" waitTarget="parentGroup"/> |
| |
| <SetProperty propertyName="width" value="300" target="parentGroup.childBorder" /> |
| <SetProperty propertyName="height" value="300" target="parentGroup.childBorder" /> |
| <SetProperty propertyName="includeInLayout" value="true" target="parentGroup.childBorder" waitEvent="updateComplete" waitTarget="parentGroup.childGroup"/> |
| </setup> |
| <body> |
| <!-- even childBorder is set, but includeInLayout=false, so will not be considered when calculate |
| childGroup's size, still use childBtn to measure the size |
| --> |
| <AssertPropertyValue propertyName="width" value="301" target="parentGroup.childGroup"/> |
| <AssertPropertyValue propertyName="height" value="301" target="parentGroup.childGroup"/> |
| <CompareBitmap url="../integration/baselines/$testID.png" numColorVariances="5" maxColorVariance="10" /> |
| </body> |
| </TestCase> |
| |
| |
| <TestCase testID="includeInLayout_default3" keywords="[BasicLayout,intergration,constraints,measure]" description="verify includeInLayout=false, the element will be excluded when calculate parent container's size" > |
| <setup> |
| <ResetComponent target="parentGroup" className="comps.DefaultGroup" waitEvent="updateComplete" waitTarget="parentGroup"/> |
| |
| <SetProperty propertyName="width" value="300" target="parentGroup.childBorder" /> |
| <SetProperty propertyName="height" value="300" target="parentGroup.childBorder" /> |
| |
| <SetProperty propertyName="includeInLayout" value="false" target="parentGroup.childBorder" waitEvent="updateComplete" waitTarget="parentGroup.childGroup"/> |
| |
| </setup> |
| <body> |
| <!-- even childGroup is set explicitly size, but includeInLayout=false, so parenGroup should only |
| use its child=parentChild to calculate the size |
| --> |
| <AssertPropertyValue propertyName="width" value="70" target="parentGroup"/> |
| <AssertPropertyValue propertyName="height" value="21" target="parentGroup"/> |
| <CompareBitmap url="../integration/baselines/$testID.png" numColorVariances="5" maxColorVariance="10"/> |
| </body> |
| </TestCase> |
| |
| |
| <TestCase testID="includeInLayout_default4" keywords="[BasicLayout,intergration,constraints,measure]" description="toggle includeInLayout value from false to true, verify the element will be included when calculate parent container's size" > |
| <setup> |
| <ResetComponent target="parentGroup" className="comps.DefaultGroup" waitEvent="updateComplete" waitTarget="parentGroup"/> |
| |
| <SetProperty propertyName="width" value="300" target="parentGroup.childGroup" /> |
| <SetProperty propertyName="height" value="300" target="parentGroup.childGroup" /> |
| <SetProperty propertyName="includeInLayout" value="false" target="parentGroup.childGroup" waitEvent="updateComplete" waitTarget="parentGroup.childGroup"/> |
| |
| </setup> |
| <body> |
| <!-- even childGroup is set explicitly size, but includeInLayout=false, so parenGroup should only |
| use its child=parentChild to calculate the size |
| --> |
| <AssertPropertyValue propertyName="width" value="70" target="parentGroup"/> |
| <AssertPropertyValue propertyName="height" value="21" target="parentGroup"/> |
| <!-- set newer size, includeInLayout=true --> |
| <SetProperty propertyName="width" value="400" target="parentGroup.childGroup" /> |
| <SetProperty propertyName="height" value="400" target="parentGroup.childGroup" /> |
| <SetProperty propertyName="includeInLayout" value="true" target="parentGroup.childGroup" waitEvent="updateComplete" waitTarget="parentGroup.childGroup"/> |
| <AssertPropertyValue propertyName="width" value="400" target="parentGroup"/> |
| <AssertPropertyValue propertyName="height" value="400" target="parentGroup"/> |
| |
| |
| |
| </body> |
| </TestCase> |
| <TestCase testID="includeInLayout_default5" keywords="[BasicLayout,intergration,constraints,measure]" description=" includeInLayout=false, verify the element will not be set preferred size by layout" > |
| <setup> |
| <ResetComponent target="parentGroup" className="comps.DefaultGroup" waitEvent="updateComplete" waitTarget="parentGroup"/> |
| |
| <SetProperty propertyName="width" value="300" target="parentGroup.childGroup" /> |
| <SetProperty propertyName="height" value="300" target="parentGroup.childGroup" /> |
| <RunCode code="configTest1()" waitEvent="updateComplete" waitTarget="parentGroup.childGroup"/> |
| |
| |
| </setup> |
| <body> |
| |
| <CompareBitmap url="../integration/baselines/$testID.png" numColorVariances="10" maxColorVariance="10" target="parentGroup"/> |
| |
| </body> |
| </TestCase> |
| |
| |
| </testCases> |
| </UnitTester> |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |