| <?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/List/Styles/" xmlns:mx="http://www.adobe.com/2006/mxml" xmlns="*" testSWF="ListMain_spark.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 mx.styles.StyleManager; |
| import mx.managers.SystemManager; |
| |
| public function addItems():void |
| { |
| for(var i:int=0;i<15;i++) |
| { |
| var obj:Object={slno:i,name:"Rooney"+i,age:20+i} |
| application.mybox.mylist.dataProvider.addItem(obj); |
| } |
| } |
| public function setAIcolors():void |
| { |
| application.mybox.mylist.setStyle("alternatingItemColors",[0xFFCC00,0x00FF00]); |
| } |
| public function setBg():void |
| { |
| application.mybox.mylist.setStyle("backgroundColor",0xFF0000); |
| } |
| public function setFF():void |
| { |
| application.mybox.mylist.setStyle("fontFamily","EmbeddedArial"); |
| } |
| ]]> |
| </mx:Script> |
| |
| <testCases> |
| <TestCase testID="Spark_style_backgroundColor_string" keywords="[List, scrollcontrolbase, styles, backgroundColor, string]"> |
| <setup> |
| <ResetComponent target="mybox" className="ListComp" waitEvent="updateComplete" waitTarget="mybox"/> |
| </setup> |
| <body> |
| <SetStyle target="mybox.mylist" styleName="backgroundColor" value="red" waitEvent="updateComplete" |
| waitTarget="mybox.mylist"/> |
| <CompareBitmap numColorVariances="7" maxColorVariance="20" target="mybox" url="../Styles/Baselines/list_scrollcontrolbase_backgroundColor_spark.png" /> |
| </body> |
| </TestCase> |
| |
| <TestCase testID="Spark_style_color_string" keywords="[List, scrollcontrolbase, styles, color, string]"> |
| <setup> |
| <ResetComponent target="mybox" className="ListComp" waitEvent="updateComplete" waitTarget="mybox"/> |
| <!--<SetStyle target="mybox.mylist" styleName="borderStyle" value="solid" waitTarget="mybox.mylist" waitEvent="updateComplete"/>--> |
| <RunCode code="addItems()" waitTarget="mybox.mylist" waitEvent="updateComplete"/> |
| </setup> |
| <body> |
| <SetStyle target="mybox.mylist" styleName="color" value="#008000" waitTarget="mybox.mylist" waitEvent="updateComplete"/> |
| <CompareBitmap numColorVariances="7" maxColorVariance="20" target="mybox" url="../Styles/Baselines/list_scrollcontrolbase_color_string_spark.png" /> |
| </body> |
| </TestCase> |
| <TestCase testID="Spark_style_color_0x" keywords="[List, scrollcontrolbase, styles, color, 0x]"> |
| <setup> |
| <ResetComponent target="mybox" className="ListComp" waitEvent="updateComplete" waitTarget="mybox"/> |
| <SetStyle target="mybox.mylist" styleName="color" value="0xCCCCCC" waitTarget="mybox.mylist" waitEvent="updateComplete"/> |
| </setup> |
| <body> |
| <SetStyle target="mybox.mylist" styleName="color" value="0xFFCC00" waitTarget="mybox.mylist" waitEvent="updateComplete"/> |
| <CompareBitmap numColorVariances="7" maxColorVariance="20" target="mybox" url="../Styles/Baselines/list_scrollcontrolbase_color_0x_spark.png" /> |
| </body> |
| </TestCase> |
| <TestCase testID="Spark_style_color_hash" keywords="[List, scrollcontrolbase, styles, color, hash]"> |
| <setup> |
| <ResetComponent target="mybox" className="ListComp" waitEvent="updateComplete" waitTarget="mybox"/> |
| <SetStyle target="mybox.mylist" styleName="color" value="0xCCCCCC" waitTarget="mybox.mylist" waitEvent="updateComplete"/> |
| </setup> |
| <body> |
| <SetStyle target="mybox.mylist" styleName="color" value="#FF0000" waitTarget="mybox.mylist" waitEvent="updateComplete"/> |
| <CompareBitmap numColorVariances="7" maxColorVariance="20" target="mybox" url="../Styles/Baselines/list_scrollcontrolbase_color_hash_spark.png" /> |
| </body> |
| </TestCase> |
| <TestCase testID="Spark_style_fontFamily_mxml" keywords="[List, scrollcontrolbase, styles, fontFamily, mxml]"> |
| <setup> |
| <ResetComponent target="mybox" className="ListComp" waitEvent="updateComplete" waitTarget="mybox"/> |
| </setup> |
| <body> |
| <SetStyle target="mybox.mylist" styleName="fontFamily" value="EmbeddedArial" waitTarget="mybox.mylist" waitEvent="updateComplete"/> |
| <CompareBitmap numColorVariances="7" maxColorVariance="20" target="mybox" url="../Styles/Baselines/list_scrollcontrolbase_fontfamily_arial_spark.png" /> |
| </body> |
| </TestCase> |
| <TestCase testID="Spark_style_fontFamily_AS" keywords="[List, scrollcontrolbase, styles, fontFamily, AS]"> |
| <setup> |
| <ResetComponent target="mybox" className="ListComp" waitEvent="updateComplete" waitTarget="mybox"/> |
| <RunCode code="setFF()"/> |
| |
| </setup> |
| <body> |
| <SetProperty target="mybox.mylist" propertyName="selectedIndex" value= "2" waitEvent="updateComplete" /> |
| <WaitForEffectsToEnd/> |
| <CompareBitmap numColorVariances="7" maxColorVariance="20" target="mybox" url="../Styles/Baselines/list_scrollcontrolbase_fontfamily_arial_as_spark.png" /> |
| </body> |
| </TestCase> |
| <TestCase testID="Spark_style_fontWeight" keywords="[List, scrollcontrolbase, styles, fontWeight]"> |
| <setup> |
| <ResetComponent target="mybox" className="ListComp" waitEvent="updateComplete" waitTarget="mybox"/> |
| <SetStyle target="mybox.mylist" styleName="fontWeight" value="bold" waitTarget="mybox.mylist" waitEvent="updateComplete"/> |
| </setup> |
| <body> |
| <CompareBitmap numColorVariances="7" maxColorVariance="20" target="mybox" url="../Styles/Baselines/list_scrollcontrolbase_fontweight_bold_spark.png" /> |
| </body> |
| </TestCase> |
| <TestCase testID="Spark_style_fontStyle" keywords="[List, scrollcontrolbase, styles, fontStyle]"> |
| <setup> |
| <ResetComponent target="mybox" className="ListComp" waitEvent="updateComplete" waitTarget="mybox"/> |
| <SetStyle target="mybox.mylist" styleName="fontStyle" value="italic" waitTarget="mybox.mylist" waitEvent="updateComplete"/> |
| </setup> |
| <body> |
| <CompareBitmap numColorVariances="7" maxColorVariance="20" target="mybox" url="../Styles/Baselines/list_scrollcontrolbase_fontstyle_italic_spark.png" /> |
| </body> |
| </TestCase> |
| <TestCase testID="Spark_style_fontSize" keywords="[List, scrollcontrolbase, styles, fontSize]"> |
| <setup> |
| <ResetComponent target="mybox" className="ListComp" waitEvent="updateComplete" waitTarget="mybox"/> |
| <SetStyle target="mybox.mylist" styleName="fontSize" value="16" waitTarget="mybox.mylist" waitEvent="updateComplete"/> |
| </setup> |
| <body> |
| <CompareBitmap numColorVariances="7" maxColorVariance="20" target="mybox" url="../Styles/Baselines/list_scrollcontrolbase_fontsize_16_spark.png" /> |
| </body> |
| </TestCase> |
| |
| <TestCase testID="Spark_style_textDecoration" keywords="[List, scrollcontrolbase, styles, testDecoration]" > |
| <setup> |
| <ResetComponent target="mybox" className="ListComp" waitEvent="updateComplete" waitTarget="mybox"/> |
| </setup> |
| <body> |
| <SetStyle target="mybox.mylist" styleName="textDecoration" value="underline" waitTarget="mybox.mylist" waitEvent="updateComplete"/> |
| <CompareBitmap numColorVariances="10" maxColorVariance="20" target="mybox" url="../Styles/Baselines/list_scrollcontrolbase_textdecoration_underline_spark.png" /> |
| </body> |
| </TestCase> |
| </testCases> |
| </UnitTester> |