blob: 77b7972c5b684b87e0edadd7542da606de8426ae [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 rowCount and columnCount while changing columnWidth
and rowHeight.
========================================================
-->
<TestCase testID="rowCountColumnCount_changeColWidthRowHeight_test1" keywords="[TileLayout,rowCount,columnCount]" description="3 items on one line, increase columnWidth until only 2 items fit." >
<setup>
<ResetComponent target="box1" className="Assets::Box1" waitEvent="updateComplete" />
</setup>
<body>
<RunCode code="application.addItemsToGroup(application.box1.group1, 5)" />
<RunCode code="application.setPropsOnGroupElements(application.box1.group1, 'width', 25)" />
<RunCode code="application.setPropsOnGroupElements(application.box1.group1, 'height', 25)" waitTarget="box1.group1" waitEvent="updateComplete" />
<SetProperty target="box1.group1.layout" propertyName="columnWidth" value="30" waitTarget="box1.group1" waitEvent="updateComplete" />
<CompareBitmap url="../properties/baselines/$testID.png" target="box1" />
<AssertPropertyValue target="box1.group1.layout" propertyName="rowCount" value="3" />
<AssertPropertyValue target="box1.group1.layout" propertyName="columnCount" value="2" />
</body>
</TestCase>
<TestCase testID="rowCountColumnCount_changeColWidthRowHeight_test2" keywords="[TileLayout,rowCount,columnCount]" description="Repeat, increasing columnWidth until only 1 item fits on a line." >
<setup>
<ResetComponent target="box1" className="Assets::Box1" waitEvent="updateComplete" />
</setup>
<body>
<RunCode code="application.addItemsToGroup(application.box1.group1, 5)" />
<RunCode code="application.setPropsOnGroupElements(application.box1.group1, 'width', 25)" />
<RunCode code="application.setPropsOnGroupElements(application.box1.group1, 'height', 25)" waitTarget="box1.group1" waitEvent="updateComplete" />
<SetProperty target="box1.group1.layout" propertyName="columnWidth" value="91" waitTarget="box1.group1" waitEvent="updateComplete" />
<CompareBitmap url="../properties/baselines/$testID.png" target="box1" />
<AssertPropertyValue target="box1.group1.layout" propertyName="rowCount" value="5" />
<AssertPropertyValue target="box1.group1.layout" propertyName="columnCount" value="1" />
</body>
</TestCase>
<TestCase testID="rowCountColumnCount_changeColWidthRowHeight_test3" keywords="[TileLayout,rowCount,columnCount]" description="2 items on one line, decrease columnWidth unti 3 items to fit." >
<setup>
<ResetComponent target="box1" className="Assets::Box1" waitEvent="updateComplete" />
</setup>
<body>
<RunCode code="application.addItemsToGroup(application.box1.group1, 3)" />
<RunCode code="application.setPropsOnGroupElements(application.box1.group1, 'width', 25)" />
<RunCode code="application.setPropsOnGroupElements(application.box1.group1, 'height', 25)" waitTarget="box1.group1" waitEvent="updateComplete" />
<SetProperty target="box1.group1.layout" propertyName="columnWidth" value="13" waitTarget="box1.group1" waitEvent="updateComplete" />
<CompareBitmap url="../properties/baselines/$testID.png" target="box1" />
<AssertPropertyValue target="box1.group1.layout" propertyName="rowCount" value="1" />
<AssertPropertyValue target="box1.group1.layout" propertyName="columnCount" value="3" />
</body>
</TestCase>
<TestCase testID="rowCountColumnCount_changeColWidthRowHeight_test4" keywords="[TileLayout,rowCount,columnCount]" description="3 rows, increase rowHeight until there are only 2." >
<setup>
<ResetComponent target="box1" className="Assets::Box1" waitEvent="updateComplete" />
</setup>
<body>
<RunCode code="application.addItemsToGroup(application.box1.group1, 9)" />
<RunCode code="application.setPropsOnGroupElements(application.box1.group1, 'width', 25)" />
<RunCode code="application.setPropsOnGroupElements(application.box1.group1, 'height', 25)" waitTarget="box1.group1" waitEvent="updateComplete" />
<SetProperty target="box1.group1.layout" propertyName="rowHeight" value="53" waitTarget="box1.group1" waitEvent="updateComplete" />
<CompareBitmap url="../properties/baselines/$testID.png" target="box1" />
<AssertPropertyValue target="box1.group1.layout" propertyName="rowCount" value="2" />
<AssertPropertyValue target="box1.group1.layout" propertyName="columnCount" value="5" />
</body>
</TestCase>
<TestCase testID="rowCountColumnCount_changeColWidthRowHeight_test5" keywords="[TileLayout,rowCount,columnCount]" description="Repeat, increasing rowHeight until there is only 1 row." >
<setup>
<ResetComponent target="box1" className="Assets::Box1" waitEvent="updateComplete" />
</setup>
<body>
<RunCode code="application.addItemsToGroup(application.box1.group1, 9)" />
<RunCode code="application.setPropsOnGroupElements(application.box1.group1, 'width', 25)" />
<RunCode code="application.setPropsOnGroupElements(application.box1.group1, 'height', 25)" waitTarget="box1.group1" waitEvent="updateComplete" />
<SetProperty target="box1.group1.layout" propertyName="rowHeight" value="180" waitTarget="box1.group1" waitEvent="updateComplete" />
<CompareBitmap url="../properties/baselines/$testID.png" target="box1" />
<AssertPropertyValue target="box1.group1.layout" propertyName="rowCount" value="1" />
<AssertPropertyValue target="box1.group1.layout" propertyName="columnCount" value="9" />
</body>
</TestCase>
<TestCase testID="rowCountColumnCount_changeColWidthRowHeight_test6" keywords="[TileLayout,rowCount,columnCount]" description="2 columns, decrease rowHeight until there is 1." >
<setup>
<ResetComponent target="box1" className="Assets::Box1" waitEvent="updateComplete" />
</setup>
<body>
<RunCode code="application.addItemsToGroup(application.box1.group1, 3)" />
<RunCode code="application.setPropsOnGroupElements(application.box1.group1, 'width', 25)" />
<RunCode code="application.setPropsOnGroupElements(application.box1.group1, 'height', 25)" waitTarget="box1.group1" waitEvent="updateComplete" />
<SetProperty target="box1.group1.layout" propertyName="rowHeight" value="12" waitTarget="box1.group1" waitEvent="updateComplete" />
<CompareBitmap url="../properties/baselines/$testID.png" target="box1" />
<AssertPropertyValue target="box1.group1.layout" propertyName="rowCount" value="3" />
<AssertPropertyValue target="box1.group1.layout" propertyName="columnCount" value="1" />
</body>
</TestCase>
</testCases>
</UnitTester>