blob: 80def9ccbfa8d3d90230bfbbe42d90132665d602 [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="components/Text/Properties/" xmlns:mx="http://www.adobe.com/2006/mxml" xmlns="*" testSWF="Text_main.mxml">
<!-- this set of lines form a template that must be in each unit test -->
<mx:Script>
<![CDATA[
[Bindable]
public var htmlData:String = "This is 14 point blue italic text.<br><b><font color='#ff0000' size='10'>This text is 10 point black, italic, and bold.</font></b>";
[Bindable]
public var htmlData1:String = "<b><font color='#ff0000' size='10'>This text is 10 point black, italic, and bold.</font></b>";
[Bindable]
public var resulthtmlData:String = "<TEXTFORMAT LEADING=\"2\"><P ALIGN=\"LEFT\"><FONT FACE=\"EmbeddedVerdana\" SIZE=\"10\" COLOR=\"#0B333C\" LETTERSPACING=\"0\" KERNING=\"0\">This is 14 point blue italic text.</FONT></P></TEXTFORMAT><TEXTFORMAT LEADING=\"2\"><P ALIGN=\"LEFT\"><FONT FACE=\"EmbeddedVerdana\" SIZE=\"10\" COLOR=\"#FF0000\" LETTERSPACING=\"0\" KERNING=\"0\"><B>This text is 10 point black, italic, and bold.</B></FONT></P></TEXTFORMAT>";
[Bindable]
public var plainText:String ="This text is 10 point black, italic, and bold.";
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 mx.controls.Text;
import mx.styles.StyleManager;
import mx.managers.SystemManager;
public function scriptFunction(a:String, b:int):String
{
return a + ":" + b.toString();
}
public var styleDecl:Object;
public var styleObj:Object;
public function validateThisUI():void{
application.myText.validateNow();
}
]]>
</mx:Script>
<testCases>
<TestCase testID="Checking_Default_Value_of_Property_x" keywords="[Text, showTextField, Inherited, Property]" description="Checking Default Value of Property x">
<setup>
<ResetComponent target="myText" className="mx.controls::Text" waitEvent="updateComplete" waitTarget="myText" />
<SetProperty target="myText" propertyName="text" value="Test Button" waitEvent="updateComplete" waitTarget="myText" />
</setup>
<body>
<AssertPropertyValue target="myText" propertyName="x" value="220" />
</body>
</TestCase>
<TestCase testID="Checking_MXML_Set_Value_of_Property_x" keywords="[Text, x, Inherited, Property]" description="Checking MXML set Value of Inherited Property x">
<setup>
<ResetComponent target="myText" className="mx.controls::Text" waitEvent="updateComplete" waitTarget="myText" />
<SetProperty target="myText" propertyName="text" value="Test Button" waitEvent="updateComplete" waitTarget="myText" />
<SetProperty target="myText" propertyName="x" value="40" waitEvent="updateComplete" waitTarget="myText" />
</setup>
<body>
<AssertPropertyValue target="myText" propertyName="x" value="40" />
</body>
</TestCase>
<TestCase testID="Checking_AS_Set_Value_of_Property_x" keywords="[Text, x, Inherited, Property]" description="Checking AS set Value of Inherited Property x">
<setup>
<ResetComponent target="myText" className="mx.controls::Text" waitEvent="updateComplete" waitTarget="myText"/>
<SetProperty target="myText" propertyName="text" value="Test Button" waitEvent="updateComplete" waitTarget="myText" />
<RunCode code="application.myText.x=40" waitEvent="updateComplete" waitTarget="myText"/>
</setup>
<body>
<AssertPropertyValue target="myText" propertyName="x" value="40" />
</body>
</TestCase>
<TestCase testID="Checking_Default_Value_of_Property_y" keywords="[Text, showTextField, Inherited, Property]" description="Checking Default Value of Property y">
<setup>
<ResetComponent target="myText" className="mx.controls::Text" waitEvent="updateComplete" waitTarget="myText" />
<SetProperty target="myText" propertyName="text" value="Test Button" waitEvent="updateComplete" waitTarget="myText" />
</setup>
<body>
<AssertPropertyValue target="myText" propertyName="y" value="24" />
</body>
</TestCase>
<TestCase testID="Checking_MXML_Set_Value_of_Property_y" keywords="[Text, y, Inherited, Property]" description="Checking MXML set Value of Inherited Property y">
<setup>
<ResetComponent target="myText" className="mx.controls::Text" waitEvent="updateComplete" waitTarget="myText" />
<SetProperty target="myText" propertyName="text" value="Test Button" waitEvent="updateComplete" waitTarget="myText" />
<SetProperty target="myText" propertyName="y" value="2" waitEvent="updateComplete" waitTarget="myText" />
</setup>
<body>
<AssertPropertyValue target="myText" propertyName="y" value="2" />
</body>
</TestCase>
<TestCase testID="Checking_AS_Set_Value_of_Property_y" keywords="[Text, y, Inherited, Property]" description="Checking AS set Value of Inherited Property y">
<setup>
<ResetComponent target="myText" className="mx.controls::Text" waitEvent="updateComplete" waitTarget="myText" />
<SetProperty target="myText" propertyName="text" value="Test Button" waitEvent="updateComplete" waitTarget="myText" />
<RunCode code="application.myText.y=3" waitEvent="updateComplete" waitTarget="myText"/>
</setup>
<body>
<AssertPropertyValue target="myText" propertyName="y" value="3" />
</body>
</TestCase>
<TestCase testID="Checking_Default_Value_of_Property_width" keywords="[Text, showTextField, Inherited, Property]" description="Checking Default Value of Property width">
<setup>
<ResetComponent target="myText" className="mx.controls::Text" waitEvent="updateComplete" waitTarget="myText" />
<SetProperty target="myText" propertyName="text" value="Test Button" waitEvent="updateComplete" waitTarget="myText" />
</setup>
<body>
<AssertPropertyValue target="myText" propertyName="width" value="59" />
</body>
</TestCase>
<TestCase testID="Checking_MXML_Set_Value_of_Property_width" keywords="[Text, width, Inherited, Property]" description="Checking MXML set Value of Inherited Property width">
<setup>
<ResetComponent target="myText" className="mx.controls::Text" />
<SetProperty target="myText" propertyName="text" value="Test Button" waitEvent="updateComplete" waitTarget="myText" />
<SetProperty target="myText" propertyName="width" value="40" waitEvent="updateComplete" waitTarget="myText" />
</setup>
<body>
<AssertPropertyValue target="myText" propertyName="width" value="40" />
</body>
</TestCase>
<TestCase testID="Checking_AS_Set_Value_of_Property_width" keywords="[Text, width, Inherited, Property]" description="Checking AS set Value of Inherited Property width">
<setup>
<ResetComponent target="myText" className="mx.controls::Text" />
<SetProperty target="myText" propertyName="text" value="Test Button" waitEvent="updateComplete" waitTarget="myText" />
<RunCode code="application.myText.width=40" waitEvent="updateComplete" waitTarget="myText"/>
</setup>
<body>
<AssertPropertyValue target="myText" propertyName="width" value="40" />
</body>
</TestCase>
<TestCase testID="Checking_Default_Value_of_Property_height" keywords="[Text, showTextField, Inherited, Property]" description="Checking Default Value of Property height">
<setup>
<ResetComponent target="myText" className="mx.controls::Text" waitEvent="updateComplete" waitTarget="myText" />
<SetProperty target="myText" propertyName="text" value="Test Button" waitEvent="updateComplete" waitTarget="myText" />
</setup>
<body>
<AssertPropertyValue target="myText" propertyName="height" value="20" />
</body>
</TestCase>
<TestCase testID="Checking_MXML_Set_Value_of_Property_height" keywords="[Text, height, Inherited, Property]" description="Checking MXML set Value of Inherited Property height">
<setup>
<ResetComponent target="myText" className="mx.controls::Text" />
<SetProperty target="myText" propertyName="text" value="Test Button" waitEvent="updateComplete" waitTarget="myText" />
<SetProperty target="myText" propertyName="height" value="40" waitEvent="updateComplete" waitTarget="myText" />
</setup>
<body>
<AssertPropertyValue target="myText" propertyName="height" value="40" />
</body>
</TestCase>
<TestCase testID="Checking_AS_Set_Value_of_Property_height" keywords="[Text, height, Inherited, Property]" description="Checking AS set Value of Inherited Property height">
<setup>
<ResetComponent target="myText" className="mx.controls::Text" />
<SetProperty target="myText" propertyName="text" value="Test Button" waitEvent="updateComplete" waitTarget="myText" />
<RunCode code="application.myText.height=40" waitEvent="updateComplete" waitTarget="myText"/>
</setup>
<body>
<AssertPropertyValue target="myText" propertyName="height" value="40" />
</body>
</TestCase>
<TestCase testID="Checking_MXML_Set_Value_of_Property_visible" keywords="[Text, visible, Inherited, Property]" description="Checking MXML set Value of Inherited Property visible using bitmap comparision">
<setup>
<ResetComponent target="myText" className="mx.controls::Text" />
<SetProperty target="myText" propertyName="text" value="Test Button" waitEvent="updateComplete" waitTarget="myText" />
<SetProperty target="myText" propertyName="visible" value="false" waitEvent="hide" waitTarget="myText" />
</setup>
<body>
<WaitForEffectsToEnd />
<CompareBitmap target="myText" url="../properties/baselines/visible_mxml_bm.png" timeout="5000" />
</body>
</TestCase>
<TestCase testID="Checking_AS_Set_Value_of_Property_visible" keywords="[Text, visible, Inherited, Property]" description="Checking AS set Value of Inherited Property visible using bitmap comparision">
<setup>
<ResetComponent target="myText" className="mx.controls::Text" />
<SetProperty target="myText" propertyName="text" value="Test Button" waitEvent="updateComplete" waitTarget="myText" />
<RunCode code="application.myText.visible=false" waitEvent="hide" waitTarget="myText" />
</setup>
<body>
<WaitForEffectsToEnd />
<CompareBitmap target="myText" url="../properties/baselines/visible_AS_bm.png" timeout="5000" />
</body>
</TestCase>
<TestCase testID="Checking_MXML_Set_Value_of_Property_toolTip" keywords="[Text, toolTip, Inherited, Property]" description="Checking MXML set Value of Inherited Property toolTip using bitmap comparision">
<setup>
<ResetComponent target="myText" className="mx.controls::Text" waitEvent="updateComplete" waitTarget="myText"/>
<SetProperty target="myText" propertyName="text" value="Test Button" waitEvent="updateComplete" waitTarget="myText" />
<SetProperty target="myText" propertyName="toolTip" value="My Text"/>
</setup>
<body>
<DispatchMouseEvent target="myText" type="mouseOver" localX="10" localY="10"/>
<AssertEvent target="myText" eventName="toolTipShow" eventClass="mx.events::ToolTipEvent" timeout="10000"/>
<AssertPropertyValue target="myText" propertyName="toolTip" value="My Text" />
<WaitForEffectsToEnd />
<CompareBitmap url="../properties/baselines/toolTip_mxml_bm.png" timeout="5000" />
</body>
</TestCase>
<TestCase testID="Checking_AS_Set_Value_of_Property_toolTip" keywords="[Text, toolTip, Inherited, Property]" description="Checking AS set Value of Inherited Property toolTip using bitmap comparision">
<setup>
<ResetComponent target="myText" className="mx.controls::Text" waitEvent="updateComplete" waitTarget="myText"/>
<SetProperty target="myText" propertyName="text" value="Test Button" waitEvent="updateComplete" waitTarget="myText" />
<RunCode code="application.myText.toolTip='My Text'"/>
</setup>
<body>
<DispatchMouseEvent target="myText" type="mouseOver" localX="10" localY="10"/>
<AssertEvent target="myText" eventName="toolTipShow" eventClass="mx.events::ToolTipEvent" timeout="10000"/>
<AssertPropertyValue target="myText" propertyName="toolTip" value="My Text" />
<WaitForEffectsToEnd />
<CompareBitmap url="../properties/baselines/toolTip_AS_bm.png" timeout="5000" />
</body>
</TestCase>
<TestCase testID="Checking_Default_Set_Value_of_Property_textWidth" keywords="[Text, textWidth, Inherited, Property]" description="Checking Default set Value of Inherited Property textWidth using bitmap comparision">
<setup>
<ResetComponent target="myText" className="mx.controls::Text" />
<SetProperty target="myText" propertyName="text" value="Test Button" waitEvent="updateComplete" waitTarget="myText" />
</setup>
<body>
<AssertPropertyValue target="myText" propertyName="textWidth" value="53.55" />
</body>
</TestCase>
<TestCase testID="Checking_Default_Set_Value_of_Property_textHeight" keywords="[Text, textHeight, Inherited, Property]" description="Checking Default set Value of Inherited Property textHeight using bitmap comparision">
<setup>
<ResetComponent target="myText" className="mx.controls::Text" />
<SetProperty target="myText" propertyName="text" value="Test Button" waitEvent="updateComplete" waitTarget="myText" />
</setup>
<body>
<AssertPropertyValue target="myText" propertyName="textHeight" value="15.55" />
</body>
</TestCase>
<TestCase testID="Checking_MXML_Set_Value_of_Property_textWidth" keywords="[Text, textWidth, Inherited, Property]" description="Checking MXML set Value of Inherited Property textWidth using bitmap comparision">
<setup>
<ResetComponent target="myText" className="mx.controls::Text" />
<SetStyle target="myText" styleName="fontSize" value="20" waitEvent="updateComplete" waitTarget="myText" />
<SetProperty target="myText" propertyName="text" value="Test Button" waitEvent="updateComplete" waitTarget="myText" />
<RunCode code="application.myText.validateNow()"/>
</setup>
<body>
<AssertPropertyValue target="myText" propertyName="textWidth" value="107.55" />
</body>
</TestCase>
<TestCase testID="Checking_MXML_Set_Value_of_Property_textHeight" keywords="[Text, textHeight, Inherited, Property]" description="Checking MXML set Value of Inherited Property textHeight using bitmap comparision">
<setup>
<ResetComponent target="myText" className="mx.controls::Text" />
<SetStyle target="myText" styleName="fontSize" value="20" waitEvent="updateComplete" waitTarget="myText" />
<SetProperty target="myText" propertyName="text" value="Test Button" waitEvent="updateComplete" waitTarget="myText" />
</setup>
<body>
<AssertPropertyValue target="myText" propertyName="textHeight" value="29.2" />
</body>
</TestCase>
<TestCase testID="Checking_Default_Value_of_Property_scaleX" keywords="[Text, showTextField, Inherited, Property]" description="Checking Default Value of Property scaleX">
<setup>
<ResetComponent target="myText" className="mx.controls::Text" waitEvent="updateComplete" waitTarget="myText" />
<SetProperty target="myText" propertyName="text" value="Test Button" waitEvent="updateComplete" waitTarget="myText" />
</setup>
<body>
<AssertPropertyValue target="myText" propertyName="scaleX" value="1" />
</body>
</TestCase>
<TestCase testID="Checking_MXML_Set_Value_of_Property_scaleX" keywords="[Text, scaleX, Inherited, Property]" description="Checking MXML set Value of Inherited Property scaleX">
<setup>
<ResetComponent target="myText" className="mx.controls::Text" />
<SetProperty target="myText" propertyName="text" value="Test Button" waitEvent="updateComplete" waitTarget="myText" />
<SetProperty target="myText" propertyName="scaleX" value="2" waitEvent="updateComplete" waitTarget="myText" />
</setup>
<body>
<AssertPropertyValue target="myText" propertyName="scaleX" value="2" />
</body>
</TestCase>
<TestCase testID="Checking_AS_Set_Value_of_Property_scaleX" keywords="[Text, scaleX, Inherited, Property]" description="Checking AS set Value of Inherited Property scaleX">
<setup>
<ResetComponent target="myText" className="mx.controls::Text" />
<SetProperty target="myText" propertyName="text" value="Test Button" waitEvent="updateComplete" waitTarget="myText" />
<RunCode code="application.myText.scaleX=3" waitEvent="updateComplete" waitTarget="myText"/>
</setup>
<body>
<AssertPropertyValue target="myText" propertyName="scaleX" value="3" />
</body>
</TestCase>
<TestCase testID="Checking_Default_Value_of_Property_scaleY" keywords="[Text, showTextField, Inherited, Property]" description="Checking Default Value of Property scaleY">
<setup>
<ResetComponent target="myText" className="mx.controls::Text" waitEvent="updateComplete" waitTarget="myText" />
<SetProperty target="myText" propertyName="text" value="Test Button" waitEvent="updateComplete" waitTarget="myText" />
</setup>
<body>
<AssertPropertyValue target="myText" propertyName="scaleY" value="1" />
</body>
</TestCase>
<TestCase testID="Checking_MXML_Set_Value_of_Property_scaleY" keywords="[Text, scaleY, Inherited, Property]" description="Checking MXML set Value of Inherited Property scaleY">
<setup>
<ResetComponent target="myText" className="mx.controls::Text" />
<SetProperty target="myText" propertyName="text" value="Test Button" waitEvent="updateComplete" waitTarget="myText" />
<SetProperty target="myText" propertyName="scaleY" value="2" waitEvent="updateComplete" waitTarget="myText" />
</setup>
<body>
<AssertPropertyValue target="myText" propertyName="scaleY" value="2" />
</body>
</TestCase>
<TestCase testID="Checking_AS_Set_Value_of_Property_scaleY" keywords="[Text, scaleY, Inherited, Property]" description="Checking AS set Value of Inherited Property scaleY">
<setup>
<ResetComponent target="myText" className="mx.controls::Text" />
<SetProperty target="myText" propertyName="text" value="Test Button" waitEvent="updateComplete" waitTarget="myText" />
<RunCode code="application.myText.scaleY=3" waitEvent="updateComplete" waitTarget="myText"/>
</setup>
<body>
<AssertPropertyValue target="myText" propertyName="scaleY" value="3" />
</body>
</TestCase>
</testCases>
</UnitTester>