| <?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="components/DataGridColumn/Properties/" xmlns:mx="http://www.adobe.com/2006/mxml" xmlns="*" testSWF="DataGridColumn_Binding.mxml"> |
| |
| <!-- |
| http://livedocs.adobe.com/labs/flex3/langref/mx/controls/dataGridClasses/DataGridColumn.html |
| Data binding properties include: |
| itemRenderer, headerRenderer, nullItemRenderer, |
| dataTipFunction, labelFunction, sortCompareFunction, |
| width, minWidth, headerText, dataTipField |
| --> |
| |
| <mx:Script> |
| <![CDATA[ |
| |
| import mx.controls.dataGridClasses.DataGridColumn; |
| import MyCustomRenderer_CheckBox; |
| import MyCustomRenderer_NumericStepper; |
| |
| public static function init(o:DisplayObject):void |
| { |
| } |
| |
| [Bindable] |
| private var funk:Function = getDataTip2; |
| |
| private function getDataTip2(item:Object):String { |
| return "qwertyuiop" |
| } |
| |
| [Bindable] |
| private var labelFunk:Function = getLabelFunction2; |
| |
| |
| private function getLabelFunction2(dg:Object, col:DataGridColumn):String { |
| return "fe fi fo fum"; |
| } |
| |
| |
| [Bindable] |
| private var sortFunk:Function = getSortFunction2; |
| |
| private function getSortFunction2(obj1:Object, obj2:Object):int { |
| return 0; |
| } |
| |
| public var cbFac:ClassFactory = new ClassFactory(MyCustomRenderer_CheckBox); |
| |
| [Bindable] |
| public var currentItemRenderer:IFactory = cbFac; |
| public var currentNullItemRenderer:IFactory = cbFac; |
| |
| |
| public var canvasFacBlue:ClassFactory = new ClassFactory(MyHeaderRenderer_Blue); |
| |
| [Bindable] |
| public var currentHeaderRenderer:IFactory = canvasFacBlue; |
| |
| ]]> |
| </mx:Script> |
| |
| <mx:Metadata> |
| <![CDATA[ |
| [Mixin] |
| ]]> |
| </mx:Metadata> |
| |
| |
| <testCases> |
| |
| <TestCase testID="datagridcolumn_headerText_binding" keywords="[DataGridColumn, headerText, columns, Binding]"> |
| <body> |
| <SetProperty target="tester1" propertyName="text" value="Full Name"/> |
| <AssertPropertyValue target="dgc0" propertyName="headerText" value="Full Name" /> |
| </body> |
| </TestCase> |
| |
| |
| <TestCase testID="datagridcolumn_minWidth" keywords="[DataGridColumn, width, minWidth, columns, Binding]"> |
| <body> |
| <SetProperty target="tester1" propertyName="minWidth" value="80"/> |
| <AssertPropertyValue target="dgc0" propertyName="minWidth" value="80" /> |
| </body> |
| </TestCase> |
| |
| <TestCase testID="datagridcolumn_width" keywords="[DataGridColumn, width, columns, Binding]"> |
| <body> |
| <SetProperty target="tester1" propertyName="width" value="120"/> |
| <AssertPropertyValue target="dgc0" propertyName="width" value="120" /> |
| </body> |
| </TestCase> |
| |
| |
| <TestCase testID="datagridcolumn_dataTipField" keywords="[DataGridColumn, dataTip, dataTipField, columns, Binding]"> |
| <body> |
| <SetProperty target="tester2" propertyName="text" value="myDataTip2"/> |
| <AssertPropertyValue target="dgc0" propertyName="dataTipField" value="myDataTip2" /> |
| </body> |
| </TestCase> |
| |
| <TestCase testID="datagridcolumn_dataTipFunction" keywords="[DataGridColumn, dataTip, dataTipFunction, columns, Binding]"> |
| <body> |
| <DispatchMouseClickEvent target="func2"/> |
| <AssertPropertyValue target="dgc1" propertyName="dataTipFunction" value="{funk}"/> |
| </body> |
| </TestCase> |
| |
| <TestCase testID="datagridcolumn_labelFunction" keywords="[DataGridColumn, labelFunction, columns, Binding]"> |
| <body> |
| <DispatchMouseClickEvent target="lfunc2"/> |
| <AssertPropertyValue target="dgc3" propertyName="labelFunction" value="{labelFunk}"/> |
| </body> |
| </TestCase> |
| |
| <TestCase testID="datagridcolumn_sortCompareFunction" keywords="[DataGridColumn, sortCompareFunction, columns, Binding]"> |
| <body> |
| <DispatchMouseClickEvent target="sfunc2"/> |
| <AssertPropertyValue target="dgc4" propertyName="sortCompareFunction" value="{sortFunk}"/> |
| </body> |
| </TestCase> |
| |
| |
| <TestCase testID="datagridcolumn_itemRenderer" keywords="[DataGridColumn, itemRenderer, columns, Binding]"> |
| <body> |
| <DispatchMouseClickEvent target="irfunc2"/> |
| <AssertPropertyValue target="dgc5" propertyName="itemRenderer" value="{currentItemRenderer}"/> |
| </body> |
| </TestCase> |
| |
| <TestCase testID="datagridcolumn_nullItemRenderer" keywords="[DataGridColumn, nullItemRenderer, columns, Binding]"> |
| <body> |
| <DispatchMouseClickEvent target="nullIRfunc1"/> |
| <DispatchMouseClickEvent target="nullIRfunc2"/> |
| <AssertPropertyValue target="dgc2" propertyName="nullItemRenderer" value="{currentNullItemRenderer}"/> |
| </body> |
| </TestCase> |
| |
| <TestCase testID="datagridcolumn_headerRenderer" keywords="[DataGridColumn, headerRenderer, columns, Binding]"> |
| <body> |
| <DispatchMouseClickEvent target="hrChangeBlue"/> |
| <AssertPropertyValue target="dgc3" propertyName="headerRenderer" value="{currentHeaderRenderer}"/> |
| </body> |
| </TestCase> |
| </testCases> |
| </UnitTester> |