blob: 8d81cb47eecb4fab081439a2020226fb0f681edc [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/components/DataGrid/Properties/"
xmlns:fx="http://ns.adobe.com/mxml/2009"
xmlns:mx="library://ns.adobe.com/flex/mx"
xmlns:s="library://ns.adobe.com/flex/spark"
xmlns="*"
testSWF="DataGrid_dataTips.mxml">
<!-- this set of lines form a template that must be in each unit test -->
<fx:Script>
<![CDATA[
public static function init(o:DisplayObject):void
{
}
]]>
</fx:Script>
<fx:Metadata>
<![CDATA[
[Mixin]
]]>
</fx:Metadata>
<!-- end of set of lines that must be in each unit test -->
<fx:Script>
<![CDATA[
{
import mx.core.FlexGlobals;
}
]]>
</fx:Script>
<testCases>
<TestCase testID="dataTip_columnHeader_test" keywords="[DataGrid, Property, showDataTips]" description="Test no dataTips on columnHeader if all headerText shows, with dataTips when headerText has ...">
<setup>
<ResetComponent target="dataGrid2" className="components.DataGrid_toolTip2" waitEvent="updateComplete" />
<WaitForEvent target="stage" eventName="enterFrame" numExpectedEvents="2"/>
</setup>
<body>
<RunCode code="FlexGlobals.topLevelApplication.dataGrid2.setFocus()" waitEvent="focusIn" waitTarget="dataGrid2"/>
<DispatchMouseEvent target="dataGrid2" stageX="82" stageY="274" type="rollOver"/>
<DispatchMouseEvent target="dataGrid2" stageX="82" stageY="274" type="mouseOver"/>
<CompareBitmap target="dataGrid2" url="../Properties/Baselines/$testID_notooltip.png"/>
<DispatchMouseEvent target="dataGrid2" stageX="122" stageY="274" type="rollOver" waitEvent="enterFrame" waitTarget="stage"/>
<DispatchMouseEvent target="dataGrid2" stageX="122" stageY="274" type="mouseOver"/>
<CompareBitmap target="dataGrid2" url="../Properties/Baselines/$testID.png"/>
</body>
</TestCase>
<TestCase testID="dataTip_dataTipField_test" keywords="[DataGrid, Property, showDataTips, dataTipField]" description="Test when dataTipField is set, dataTip value is from this item.dataTipField, not default dataField">
<setup>
<ResetComponent target="dataGrid2" className="components.DataGrid_toolTip2" waitEvent="updateComplete" />
<WaitForEvent target="stage" eventName="enterFrame" numExpectedEvents="2"/>
</setup>
<body>
<AssertPropertyValue propertyName="dataTipField" value="dtValue" target="dataGrid2.c1"/>
<DispatchMouseEvent target="dataGrid2" stageX="86" stageY="308" type="rollOver" waitEvent="enterFrame" waitTarget="stage"/>
<DispatchMouseEvent target="dataGrid2" stageX="86" stageY="308" type="mouseOver"/>
<CompareBitmap target="dataGrid2" url="../Properties/Baselines/$testID.png" numColorVariances="20" maxColorVariance="20" />
</body>
</TestCase>
<TestCase testID="dataTip_dataTipFunc_test" keywords="[DataGrid, Property, showDataTips, dataTipFunction]" description="Test dataTipFunction is used for dataTip instead of dataField, dataTipField">
<setup>
<ResetComponent target="dataGrid2" className="components.DataGrid_toolTip2" waitEvent="updateComplete" />
<WaitForEvent target="stage" eventName="enterFrame" numExpectedEvents="2"/>
</setup>
<body>
<AssertPropertyValue propertyName="dataTipField" value="dtValue" target="dataGrid2.c1"/>
<RunCode code="FlexGlobals.topLevelApplication.dataGrid2.setDataTipOnColumn1()" waitTarget="dataGrid" waitEvent="enterFrame"/>
<DispatchMouseEvent target="dataGrid2" stageX="86" stageY="308" type="rollOver" waitEvent="enterFrame" waitTarget="stage"/>
<DispatchMouseEvent target="dataGrid2" stageX="86" stageY="308" type="mouseOver"/>
<CompareBitmap target="dataGrid2" url="../Properties/Baselines/$testID.png" numColorVariances="20" maxColorVariance="20" />
</body>
</TestCase>
<TestCase testID="dataTip_wrappedContent_test001" keywords="[DataGrid, Property, showDataTips]" description="Test dataTip will show truncated text for cell when variableRowHeight=false">
<setup>
<ResetComponent target="dataGrid2" className="components.DataGrid_toolTip2" waitEvent="updateComplete" />
<WaitForEvent target="stage" eventName="enterFrame" numExpectedEvents="2"/>
</setup>
<body>
<DispatchMouseEvent target="dataGrid2" stageX="119" stageY="308" type="rollOver" waitEvent="enterFrame" waitTarget="stage"/>
<DispatchMouseEvent target="dataGrid2" stageX="119" stageY="308" type="mouseOver"/>
<CompareBitmap target="dataGrid2" url="../Properties/Baselines/$testID.png" numColorVariances="20" maxColorVariance="20" />
</body>
</TestCase>
<TestCase testID="dataTip_wrappedContent_test002" keywords="[DataGrid, Property, showDataTips]" description="Test dataTip will show long text for cell value when variableRowHeight=true">
<setup>
<ResetComponent target="dataGrid" className="components.DataGrid_toolTip" waitEvent="updateComplete" />
<WaitForEvent target="stage" eventName="enterFrame" numExpectedEvents="2"/>
</setup>
<body> <!--make second row visible-->
<RunCode code="FlexGlobals.topLevelApplication.dataGrid.ensureCellIsVisible(1,0)" waitEvent="enterFrame" waitTarget="stage"/>
<!-- mouse over the cell(1,0) to see the new tooltip-->
<DispatchMouseEvent target="dataGrid" stageX="20" stageY="145" type="rollOver" waitEvent="enterFrame" waitTarget="stage"/>
<DispatchMouseEvent target="dataGrid" stageX="20" stageY="145" type="mouseOver"/>
<CompareBitmap target="dataGrid" url="../Properties/Baselines/$testID.png" numColorVariances="20" maxColorVariance="20" />
</body>
</TestCase>
<TestCase testID="dataTip_showDataTips_false" keywords="[DataGrid, Property, showDataTips]" description="Test showDataTips=false,verify no tooltip">
<setup>
<ResetComponent target="dataGrid" className="components.DataGrid_toolTip" waitEvent="updateComplete" />
<SetProperty target="dataGrid" propertyName="showDataTips" value="false" />
<WaitForEvent target="stage" eventName="enterFrame" numExpectedEvents="2"/>
</setup>
<body> <!--make second row visible-->
<RunCode code="FlexGlobals.topLevelApplication.dataGrid.ensureCellIsVisible(1,0)" waitEvent="enterFrame" waitTarget="stage"/>
<!-- mouse over the cell(1,0) to see the new tooltip-->
<DispatchMouseEvent target="dataGrid" stageX="20" stageY="145" type="rollOver" waitEvent="enterFrame" waitTarget="stage"/>
<DispatchMouseEvent target="dataGrid" stageX="20" stageY="145" type="mouseOver"/>
<CompareBitmap target="dataGrid" url="../Properties/Baselines/$testID.png" numColorVariances="20" maxColorVariance="20" />
</body>
</TestCase>
<TestCase testID="dataTip_noContent_test001" keywords="[DataGrid, Property, showDataTips]" description="Test dataTip will be empty when no property value for the cell">
<setup>
<ResetComponent target="dataGrid" className="components.DataGrid_toolTip" waitEvent="updateComplete" />
<WaitForEvent target="stage" eventName="enterFrame" numExpectedEvents="2"/>
</setup>
<body>
<!-- cell(0,1) -->
<DispatchMouseEvent target="dataGrid" stageX="120" stageY="145" type="rollOver" waitEvent="enterFrame" waitTarget="stage"/>
<DispatchMouseEvent target="dataGrid" stageX="120" stageY="145" type="mouseOver"/>
<CompareBitmap target="dataGrid2" url="../Properties/Baselines/$testID.png" numColorVariances="20" maxColorVariance="20" />
</body>
</TestCase>
</testCases>
</UnitTester>