blob: 37b88798a4f24d0eab07d254a2a81841b993521c [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="gumbo/layout/TileLayout/properties/" xmlns:mx="http://www.adobe.com/2006/mxml" xmlns="*" testSWF="TileLayoutApp1.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.*;
]]>
</mx:Script>
<testCases>
<!--
========================================================
Test setting paddingLeft, paddingRight, paddingTop and paddingBottom to various values.
========================================================
-->
<TestCase testID="paddingLeft_default" keywords="[TileLayout,paddingLeft]" description="Defaults to 0." >
<body>
<AssertMethodValue method="value = new TileLayout().paddingLeft" value="0" />
</body>
</TestCase>
<TestCase testID="paddingRight_default" keywords="[TileLayout,paddingRight]" description="Defaults to 0." >
<body>
<AssertMethodValue method="value = new TileLayout().paddingRight" value="0" />
</body>
</TestCase>
<TestCase testID="paddingTop_default" keywords="[TileLayout,paddingTop]" description="Defaults to 0." >
<body>
<AssertMethodValue method="value = new TileLayout().paddingTop" value="0" />
</body>
</TestCase>
<TestCase testID="paddingBottom_default" keywords="[TileLayout,paddingBottom]" description="Defaults to 0." >
<body>
<AssertMethodValue method="value = new TileLayout().paddingBottom" value="0" />
</body>
</TestCase>
<TestCase testID="paddingTop_setAtRuntime" keywords="[TileLayout,paddingTop]" description="Set paddingtop to 20." >
<setup>
<ResetComponent target="box2" className="Assets::Box2" waitEvent="updateComplete" />
</setup>
<body>
<RunCode code="application.resetTheBindingTileLayout2()" />
<SetProperty target="box2.group1" propertyName="layout" valueExpression="value = application.theBindingTileLayout2" />
<RunCode code="application.addItemsToGroup(application.box2.group1, 2)" />
<SetProperty propertyName="paddingTop" target="box2.group1.layout" value="20" waitTarget="box2.group1.getElementAt(0)"
waitEvent="updateComplete" />
<AssertPropertyValue target="box2.group1.getElementAt(0)" propertyName="y" value="20.5" />
</body>
</TestCase>
<TestCase testID="paddingLeft_setAtRuntime" keywords="[TileLayout,paddingLeft]" description="Set paddingLeft to 15." >
<setup>
<ResetComponent target="box2" className="Assets::Box2" waitEvent="updateComplete" />
</setup>
<body>
<RunCode code="application.resetTheBindingTileLayout2()" />
<SetProperty target="box2.group1" propertyName="layout" valueExpression="value = application.theBindingTileLayout2" />
<RunCode code="application.addItemsToGroup(application.box2.group1, 2)" />
<SetProperty propertyName="paddingLeft" target="box2.group1.layout" value="15" waitTarget="box2.group1.getElementAt(0)"
waitEvent="updateComplete" />
<AssertPropertyValue target="box2.group1.getElementAt(0)" propertyName="x" value="15.5" />
</body>
</TestCase>
<TestCase testID="paddingBottom_setAtRuntime" keywords="[TileLayout,paddingBottom]" description="Set paddingBottom to 10." >
<setup>
<ResetComponent target="box2" className="Assets::Box2" waitEvent="updateComplete" />
</setup>
<body>
<RunCode code="application.resetTheBindingTileLayout2()" />
<SetProperty target="box2.group1" propertyName="layout" valueExpression="value = application.theBindingTileLayout2" />
<RunCode code="application.addItemsToGroup(application.box2.group1, 2)" />
<SetProperty propertyName="paddingBottom" target="box2.group1.layout" value="10" waitTarget="box2.group1.getElementAt(0)"
waitEvent="updateComplete" />
<AssertPropertyValue target="box2.group1" propertyName="height" value="122" />
</body>
</TestCase>
<TestCase testID="paddingRight_setAtRuntime" keywords="[TileLayout,paddingRight]" description="Set paddingRight to 5." >
<setup>
<ResetComponent target="box2" className="Assets::Box2" waitEvent="updateComplete" />
</setup>
<body>
<RunCode code="application.resetTheBindingTileLayout2()" />
<SetProperty target="box2.group1" propertyName="layout" valueExpression="value = application.theBindingTileLayout2" />
<RunCode code="application.addItemsToGroup(application.box2.group1, 2)" />
<SetProperty propertyName="paddingRight" target="box2.group1.layout" value="5" waitTarget="box2.group1.getElementAt(0)"
waitEvent="updateComplete" />
<AssertPropertyValue target="box2.group1" propertyName="width" value="295" />
</body>
</TestCase>
<TestCase testID="paddingTop_MXML" keywords="[TileLayout,paddingTop]" description="Set paddingtop to 22." >
<body>
<AssertPropertyValue target="box3.getElementAt(0)" propertyName="y" value="22" />
</body>
</TestCase>
<TestCase testID="paddingLeft_MXML" keywords="[TileLayout,paddingLeft]" description="Set paddingLeft to 20." >
<body>
<AssertPropertyValue target="box3.getElementAt(0)" propertyName="x" value="20" />
</body>
</TestCase>
<TestCase testID="paddingBottom_MXML" keywords="[TileLayout,paddingBottom]" description="Set paddingBottom to 12." >
<body>
<AssertPropertyValue target="box3" propertyName="height" value="77" />
</body>
</TestCase>
<TestCase testID="paddingRight_MXML" keywords="[TileLayout,paddingRight]" description="Set paddingRight to 20." >
<body>
<AssertPropertyValue target="box3" propertyName="width" value="232" />
</body>
</TestCase>
</testCases>
</UnitTester>