blob: 5be6af4cec1ffdeb606cb2b0ffe679391a9a2340 [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/Canvas/Integration/" xmlns:mx="http://www.adobe.com/2006/mxml" xmlns="*" testSWF="ConstraintBasedLayout_CanvasPanel.mxml">
<mx:Script>
<![CDATA[
import comps.PercentageCanvasComp;
import mx.containers.utilityClasses.ConstraintColumn;
import mx.containers.utilityClasses.ConstraintRow;
import mx.containers.Canvas;
import mx.controls.Button;
public static function init(o:DisplayObject):void
{
}
]]>
</mx:Script>
<mx:Metadata>
<![CDATA[
[Mixin]
]]>
</mx:Metadata>
<testCases>
<TestCase testID="constraintColumnsRows_nestedPercentCanvas_mxml" keywords="[constraintColumns, constraintRows, MXML, Canvas, Application]"
description="Verify the constraintColumns and constraintRows properties are correct in nested layouts">
<body>
<AssertPropertyValue target="canvas1" propertyName="height" value="300" />
<AssertPropertyValue target="canvas1" propertyName="width" value="310" />
<AssertPropertyValue target="canvas1.constraintColumns.0" propertyName="width"
valueExpression="value=Math.round(application.canvas1.width * .3)" />
<AssertPropertyValue target="canvas1.constraintColumns.1" propertyName="width"
valueExpression="value=Math.round(application.canvas1.width * .5)" />
<AssertPropertyValue target="canvas1.constraintRows.0" propertyName="height"
valueExpression="value=Math.round(application.canvas1.height * .25)" />
<AssertPropertyValue target="canvas1.constraintRows.1" propertyName="height"
valueExpression="value=Math.round(application.canvas1.height * .45)" />
</body>
</TestCase>
<TestCase testID="constraintColumnsRows_nestedContentCanvas_mxml" keywords="[constraintColumns, constraintRows, MXML, Canvas, Application]"
description="Verify the constraintColumns and constraintRows properties are correct in nested layouts">
<body>
<AssertPropertyValue target="canvas2" propertyName="height" value="370" />
<AssertPropertyValue target="canvas2" propertyName="width" value="400" />
<AssertPropertyValue target="canvas2.constraintColumns.0" propertyName="width"
value="135" />
<AssertPropertyValue target="canvas2.constraintColumns.1" propertyName="width"
value="240" />
<AssertPropertyValue target="canvas2.constraintRows.0" propertyName="height"
value="90" />
<AssertPropertyValue target="canvas2.constraintRows.1" propertyName="height"
value="45" />
</body>
</TestCase>
<TestCase testID="constraintColumnsRows_nestedFixedPanel_mxml" keywords="[constraintColumns, constraintRows, MXML, Panel, Application]"
description="Verify the constraintColumns and constraintRows properties are correct in nested layouts">
<body>
<AssertPropertyValue target="fixedPanel" propertyName="height" value="300" />
<AssertPropertyValue target="fixedPanel" propertyName="width" value="280" />
<AssertPropertyValue target="fixedPanel.constraintColumns.0" propertyName="width"
value="100" />
<AssertPropertyValue target="fixedPanel.constraintColumns.1" propertyName="width"
value="100" />
<AssertPropertyValue target="fixedPanel.constraintRows.0" propertyName="height"
value="100" />
<AssertPropertyValue target="fixedPanel.constraintRows.1" propertyName="height"
value="100" />
</body>
</TestCase>
<TestCase testID="constraintColumns_nestedPercentCanvas_resize" keywords="[constraintColumns, constraintRows, MXML, Canvas, Application]"
description="Verify the constraintColumns and constraintRows properties are correct in nested layouts">
<body>
<SetProperty target="constraintColumns.0" propertyName="width" value="450" waitEvent="updateComplete" waitTarget="" />
<AssertPropertyValue target="canvas1" propertyName="height" value="300" />
<AssertPropertyValue target="canvas1" propertyName="width" value="410" />
<AssertPropertyValue target="canvas1.constraintColumns.0" propertyName="width"
valueExpression="value=Math.round(application.canvas1.width * .3)" />
<AssertPropertyValue target="canvas1.constraintColumns.1" propertyName="width"
valueExpression="value=Math.round(application.canvas1.width * .5)" />
<AssertPropertyValue target="canvas1.constraintRows.0" propertyName="height"
valueExpression="value=Math.round(application.canvas1.height * .25)" />
<AssertPropertyValue target="canvas1.constraintRows.1" propertyName="height"
valueExpression="value=Math.round(application.canvas1.height * .45)" />
</body>
</TestCase>
<TestCase testID="constraintRows_nestedContentCanvas_resize" keywords="[constraintColumns, constraintRows, MXML, Canvas, Application]"
description="Verify the constraintColumns and constraintRows properties are correct in nested layouts">
<setup>
<SetProperty target="constraintColumns.0" propertyName="width" value="350" waitEvent="updateComplete" waitTarget="" />
</setup>
<body>
<SetProperty target="app_row2" propertyName="height" value="300" waitEvent="updateComplete" waitTarget="" />
<AssertPropertyValue target="canvas2" propertyName="height" value="270" />
<AssertPropertyValue target="canvas2" propertyName="width" value="400" />
<AssertPropertyValue target="canvas2.constraintColumns.0" propertyName="width"
value="135" />
<AssertPropertyValue target="canvas2.constraintColumns.1" propertyName="width"
value="240" />
<AssertPropertyValue target="canvas2.constraintRows.0" propertyName="height"
value="90" />
<AssertPropertyValue target="canvas2.constraintRows.1" propertyName="height"
value="45" />
</body>
</TestCase>
<TestCase testID="constraintColumnsRows_nestedFixedPanel_resize" keywords="[constraintColumns, constraintRows, MXML, Panel, Application]"
description="Verify the constraintColumns and constraintRows properties are correct in nested layouts">
<setup>
<SetProperty target="app_row2" propertyName="height" value="400" waitEvent="updateComplete" waitTarget="" />
</setup>
<body>
<SetProperty target="app_col2" propertyName="width" value="400" waitEvent="updateComplete" waitTarget="" />
<AssertPropertyValue target="fixedPanel" propertyName="height" value="300" />
<AssertPropertyValue target="fixedPanel" propertyName="width" value="380" />
<AssertPropertyValue target="fixedPanel.constraintColumns.0" propertyName="width"
value="100" />
<AssertPropertyValue target="fixedPanel.constraintColumns.1" propertyName="width"
value="100" />
<AssertPropertyValue target="fixedPanel.constraintRows.0" propertyName="height"
value="100" />
<AssertPropertyValue target="fixedPanel.constraintRows.1" propertyName="height"
value="100" />
</body>
</TestCase>
<TestCase testID="constraintColumnsRows_nestedPercentCanvas_resize" keywords="[constraintColumns, constraintRows, MXML, Canvas, Application]"
description="Verify the constraintColumns and constraintRows properties are correct in nested layouts">
<setup>
<ResetComponent target="canvas1" className="comps.PercentageRowColumnCanvasComp" waitEvent="updateComplete" waitTarget="canvas1" />
</setup>
<body>
<SetProperty target="canvas1" propertyName="width" value="200" waitEvent="updateComplete" waitTarget="canvas1" />
<SetStyle target="canvas1" styleName="horizontalCenter" value="app_col1:10" waitEvent="updateComplete" waitTarget="canvas1" />
<AssertPropertyValue target="canvas1" propertyName="width" value="200" />
<AssertPropertyValue target="canvas1" propertyName="x" value="85" />
</body>
</TestCase>
<TestCase testID="constraintColumnsRows_nestedContentCanvas_resize" keywords="[constraintColumns, constraintRows, MXML, Canvas, Application]"
description="Verify the constraintColumns and constraintRows properties are correct in nested layouts">
<setup>
<ResetComponent target="canvas2" className="comps.ContentRowColumnCanvasComp" waitEvent="updateComplete" waitTarget="canvas2" />
</setup>
<body>
<SetProperty target="canvas2" propertyName="height" value="200" waitEvent="updateComplete" waitTarget="canvas2" />
<SetStyle target="canvas2" styleName="verticalCenter" value="app_row2:15" waitEvent="updateComplete" waitTarget="canvas2" />
<AssertPropertyValue target="canvas2" propertyName="height" value="200" />
<AssertPropertyValue target="canvas2" propertyName="y" value="395" />
</body>
</TestCase>
</testCases>
</UnitTester>