| <?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 |
| horizontalGap and verticalGap. |
| ======================================================== |
| --> |
| |
| |
| <TestCase testID="rowCountColumnCount_changeGapSize_test1" keywords="[TileLayout,rowCount,columnCount]" description="3 items on a line, increase horizontalGap so only 2 items 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, 'height', 48)" /> |
| <RunCode code="application.setPropsOnGroupElements(application.box1.group1, 'width', 25)" waitTarget="box1.group1" waitEvent="updateComplete" /> |
| <SetProperty target="box1.group1.layout" propertyName="horizontalGap" value="7" waitTarget="box1.group1" waitEvent="updateComplete" /> |
| <AssertPropertyValue target="box1.group1.layout" propertyName="rowCount" value="1" /> |
| <AssertPropertyValue target="box1.group1.layout" propertyName="columnCount" value="3" /> |
| <SetProperty target="box1.group1.layout" propertyName="horizontalGap" value="8" waitTarget="box1.group1" waitEvent="updateComplete" /> |
| <AssertPropertyValue target="box1.group1.layout" propertyName="rowCount" value="2" /> |
| <AssertPropertyValue target="box1.group1.layout" propertyName="columnCount" value="2" /> |
| </body> |
| </TestCase> |
| |
| <TestCase testID="rowCountColumnCount_changeGapSize_test2" keywords="[TileLayout,rowCount,columnCount]" description="Repeat, increasing horizontalGap 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, 3)" /> |
| <RunCode code="application.setPropsOnGroupElements(application.box1.group1, 'height', 48)" /> |
| <RunCode code="application.setPropsOnGroupElements(application.box1.group1, 'width', 25)" waitTarget="box1.group1" waitEvent="updateComplete" /> |
| <SetProperty target="box1.group1.layout" propertyName="horizontalGap" value="70" waitTarget="box1.group1" waitEvent="updateComplete" /> |
| <AssertPropertyValue target="box1.group1.layout" propertyName="rowCount" value="2" /> |
| <AssertPropertyValue target="box1.group1.layout" propertyName="columnCount" value="2" /> |
| <SetProperty target="box1.group1.layout" propertyName="horizontalGap" value="73" waitTarget="box1.group1" waitEvent="updateComplete" /> |
| <AssertPropertyValue target="box1.group1.layout" propertyName="rowCount" value="3" /> |
| <AssertPropertyValue target="box1.group1.layout" propertyName="columnCount" value="1" /> |
| </body> |
| </TestCase> |
| |
| <TestCase testID="rowCountColumnCount_changeGapSize_test3" keywords="[TileLayout,rowCount,columnCount]" description="3 items in a column, increase verticalGap so some items move to a new column." > |
| <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, 'height', 25)" /> |
| <RunCode code="application.setPropsOnGroupElements(application.box1.group1, 'width', 25)" waitTarget="box1.group1" waitEvent="updateComplete" /> |
| <SetProperty target="box1.group1.layout" propertyName="verticalGap" value="37" waitTarget="box1.group1" waitEvent="updateComplete" /> |
| <AssertPropertyValue target="box1.group1.layout" propertyName="rowCount" value="3" /> |
| <AssertPropertyValue target="box1.group1.layout" propertyName="columnCount" value="3" /> |
| <SetProperty target="box1.group1.layout" propertyName="verticalGap" value="38" waitTarget="box1.group1" waitEvent="updateComplete" /> |
| <AssertPropertyValue target="box1.group1.layout" propertyName="rowCount" value="2" /> |
| <AssertPropertyValue target="box1.group1.layout" propertyName="columnCount" value="5" /> |
| </body> |
| </TestCase> |
| |
| <TestCase testID="rowCountColumnCount_changeGapSize_test4" keywords="[TileLayout,rowCount,columnCount]" description="3 items in a column, increase verticalGap so only 2 items fit in a column." > |
| <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', 50)" /> |
| <RunCode code="application.setPropsOnGroupElements(application.box1.group1, 'height', 50)" waitTarget="box1.group1" waitEvent="updateComplete" /> |
| <SetProperty target="box1.group1.layout" propertyName="verticalGap" value="93" 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> |
| |
| </testCases> |
| </UnitTester> |