| <?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/filters/ShaderFilter/Methods/" xmlns:mx="http://www.adobe.com/2006/mxml" xmlns="*" testSWF="ShaderFilterApp2.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 flash.display.Shader; |
| import spark.filters.ShaderFilter; |
| import mx.core.Application; |
| ]]> |
| </mx:Script> |
| |
| <testCases> |
| |
| <TestCase testID="constructor_test1" keywords="[ShaderFilter,shader]" description="Create a ShaderFilter with no parameters." > |
| <setup> |
| <ResetComponent target="img1" className="mx.controls.Image" waitEvent="updateComplete" /> |
| <RunCode code="application.sf1 = new spark.filters.ShaderFilter()" /> |
| <SetProperty target="sf1" propertyName="shader" valueExpression="value = new application.FloatShaderClass()" /> |
| <SetProperty target="sf1" propertyName="theFloat" value="0.5" /> |
| <SetProperty target="img1" propertyName="filters" valueExpression="value=[application.sf1]" /> |
| <SetProperty target="img1" propertyName="source" value="../../../../../Assets/Images/blackrect.jpg" /> |
| <SetProperty target="img1" propertyName="width" value="100" /> |
| <SetProperty target="img1" propertyName="height" value="100" waitEvent="updateComplete" /> |
| </setup> |
| <body> |
| <Pause timeout="200" /> |
| <AssertMethodValue method="value=application.img1.filters[0].shader is Shader" value="true" /> |
| <AssertMethodValue method="value=application.img1.filters[0].shader.data.name" value="FloatR" /> |
| <AssertMethodValue method="value=application.img1.filters[0].theFloat" valueExpression="value='0.5'" /> |
| <CompareBitmap url="../Methods/Baselines/$testID.png" target="img1" /> |
| </body> |
| </TestCase> |
| |
| <TestCase testID="constructor_test2" keywords="[ShaderFilter,shader]" description="Create a ShaderFilter with the shader parameter." > |
| <setup> |
| <ResetComponent target="img1" className="mx.controls.Image" waitEvent="updateComplete" /> |
| <RunCode code="application.sf1 = new spark.filters.ShaderFilter(new application.FloatShaderClass())" /> |
| <SetProperty target="sf1" propertyName="theFloat" value="0.5" /> |
| <SetProperty target="img1" propertyName="filters" valueExpression="value=[application.sf1]" /> |
| <SetProperty target="img1" propertyName="source" value="../../../../../Assets/Images/blackrect.jpg" /> |
| <SetProperty target="img1" propertyName="width" value="100" /> |
| <SetProperty target="img1" propertyName="height" value="100" waitEvent="updateComplete" /> |
| </setup> |
| <body> |
| <Pause timeout="200" /> |
| <AssertMethodValue method="value=application.img1.filters[0].shader is Shader" value="true" /> |
| <AssertMethodValue method="value=application.img1.filters[0].shader.data.name" value="FloatR" /> |
| <AssertMethodValue method="value=application.img1.filters[0].theFloat" valueExpression="value='0.5'" /> |
| <CompareBitmap url="../Methods/Baselines/$testID.png" target="img1" /> |
| </body> |
| </TestCase> |
| |
| </testCases> |
| </UnitTester> |