| <?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/FTETextField/Methods/" 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:m="http://ns.adobe.com/mxml/2009" xmlns="*" testSWF="FTETextField_main.mxml"> |
| |
| <!-- this set of lines form a template that must be in each unit test --> |
| <fx:Script> |
| <![CDATA[ |
| import mx.core.*; |
| public var tf:TextFormat; |
| public var newTF:TextFormat=new TextFormat(); |
| public static function init(o:DisplayObject):void |
| { |
| } |
| |
| public function initTextFormat():void |
| { |
| newTF.size=16; |
| newTF.bullet=true; |
| newTF.italic=true; |
| newTF.underline=true; |
| } |
| ]]> |
| </fx:Script> |
| |
| <fx:Metadata> |
| <![CDATA[ |
| [Mixin] |
| ]]> |
| </fx:Metadata> |
| <!-- end of set of lines that must be in each unit test --> |
| |
| |
| |
| <fx:Script source="../SWFs/global.as" /> |
| <fx:Script> |
| <![CDATA[ |
| public const tlm0:String = "(flash.text::TextLineMetrics)#0\n ascent = 12\n descent = 3\n height = 15\n leading = 0\n width = 253\n x = 22"; |
| |
| public const tlm1:String = "(flash.text::TextLineMetrics)#0\n ascent = 12\n descent = 3\n height = 15\n leading = 0\n width = 93\n x = 22"; |
| public const tlm2:String = "(flash.text::TextLineMetrics)#0\n ascent = 12\n descent = 3\n height = 15\n leading = 0\n width = 83\n x = 22"; |
| public const tlm3:String = "(flash.text::TextLineMetrics)#0\n ascent = 12\n descent = 3\n height = 15\n leading = 0\n width = 70\n x = 22"; |
| |
| ]]> |
| </fx:Script> |
| |
| <testCases> |
| |
| <!-- ########## getLineMetrics() ########## --> |
| <TestCase testID="getLineMetrics" description="Make sure getLineMetrics() on a UITLFTextField" keywords="[FTETextField, getLineMetrics, method]"> |
| <setup> |
| <ResetComponent target="can" className="comps.FTECanvas" waitEvent="updateComplete"/> |
| <RunCode code="initTextField(FlexGlobals.topLevelApplication.can.fteTxt);" /> |
| <SetProperty target="can.fteTxt" propertyName="text" valueExpression="value=dummyTxt"/> |
| </setup> |
| <body> |
| <AssertMethodValue method="value = ObjectUtil.toString(FlexGlobals.topLevelApplication.can.fteTxt.getLineMetrics(0));" valueExpression="value=tlm0" /> |
| </body> |
| </TestCase> |
| <TestCase testID="getLineMetrics_wordWrap" description="Make sure getLineMetrics() on a UITLFTextField" keywords="[FTETextField, getLineMetrics, wordWrap, method]"> |
| <setup> |
| <ResetComponent target="can" className="comps.FTECanvas" waitEvent="updateComplete"/> |
| <RunCode code="initTextField(FlexGlobals.topLevelApplication.can.fteTxt);" /> |
| <SetProperty target="can.fteTxt" propertyName="wordWrap" value="true" /> |
| <SetProperty target="can.fteTxt" propertyName="text" valueExpression="value=dummyTxt"/> |
| </setup> |
| <body> |
| <AssertMethodValue method="value = ObjectUtil.toString(FlexGlobals.topLevelApplication.can.fteTxt.getLineMetrics(0));" valueExpression="value=tlm1" /> |
| <AssertMethodValue method="value = ObjectUtil.toString(FlexGlobals.topLevelApplication.can.fteTxt.getLineMetrics(1));" valueExpression="value=tlm2" /> |
| <AssertMethodValue method="value = ObjectUtil.toString(FlexGlobals.topLevelApplication.can.fteTxt.getLineMetrics(2));" valueExpression="value=tlm3" /> |
| </body> |
| </TestCase> |
| |
| |
| |
| <!-- ########## getTextFormat() ########## --> |
| <TestCase testID="getTextFormat" description="Make sure getTextFormat() on a UITLFTextField" keywords="[FTETextField, getTextFormat, method]"> |
| <setup> |
| <ResetComponent target="can" className="comps.FTECanvas" waitEvent="updateComplete"/> |
| <RunCode code="initTextField(FlexGlobals.topLevelApplication.can.fteTxt);" /> |
| <SetProperty target="can.fteTxt" propertyName="text" valueExpression="value=dummyTxt"/> |
| </setup> |
| <body> |
| <RunCode code="tf=FlexGlobals.topLevelApplication.can.fteTxt.getTextFormat()" /> |
| <AssertMethodValue method="value=tf.bold" valueExpression="value=false" /> |
| <AssertMethodValue method="value=tf.bullet" valueExpression="value=false" /> |
| |
| </body> |
| </TestCase> |
| |
| |
| <!-- ########## setTextFormat() ########## --> |
| <TestCase testID="setTextFormat" description="Make sure setTextFormat() on a UITLFTextField" keywords="[FTETextField, setTextFormat, method]"> |
| <setup> |
| <ResetComponent target="can" className="comps.FTECanvas" waitEvent="updateComplete"/> |
| <RunCode code="initTextField(FlexGlobals.topLevelApplication.can.fteTxt);" /> |
| <RunCode code="initTextFormat()" /> |
| <SetProperty target="can.fteTxt" propertyName="text" valueExpression="value=dummyTxt"/> |
| </setup> |
| <body> |
| <RunCode code="FlexGlobals.topLevelApplication.can.fteTxt.setTextFormat(newTF)" /> |
| <WaitForEvent target="stage" eventName="enterFrame" numExpectedEvents="2"/> |
| <RunCode code="tf=FlexGlobals.topLevelApplication.can.fteTxt.getTextFormat()" /> |
| <AssertMethodValue method="value=tf.size" valueExpression="value=newTF.size" /> |
| <AssertMethodValue method="value=tf.italic" valueExpression="value=newTF.italic" /> |
| <AssertMethodValue method="value=tf.underline" valueExpression="value=newTF.underline" /> |
| <AssertMethodValue method="value=tf.bullet" valueExpression="value=newTF.bullet" /> |
| </body> |
| </TestCase> |
| |
| |
| </testCases> |
| |
| </UnitTester> |