blob: ecd305adac97a6824074500df84e5077348d3c9b [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="gumbo/filters/ShaderFilter/Properties/" 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="shader_test1" keywords="[ShaderFilter,shader]" description="shader should be invalid if shader is not assigned yet." >
<setup>
<RunCode code="application.sf1 = new spark.filters.ShaderFilter()" />
</setup>
<body>
<AssertPropertyValue target="sf1" propertyName="shader" value="null" />
</body>
</TestCase>
<TestCase testID="shader_test2" keywords="[ShaderFilter,shader]" description="Set a ShaderFilter's shader in AS." >
<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="../Properties/Baselines/$testID.png" target="img1" />
</body>
</TestCase>
<TestCase testID="shader_test3" keywords="[ShaderFilter,shader]" description="Set a property before setting the shader (special case)." >
<setup>
<ResetComponent target="img1" className="mx.controls.Image" waitEvent="updateComplete" />
<RunCode code="application.sf1 = new spark.filters.ShaderFilter()" />
<SetProperty target="sf1" propertyName="increaseRed" value="1" />
<SetProperty target="sf1" propertyName="increaseGreen" value="1" />
<SetProperty target="sf1" propertyName="shader" valueExpression="value = new application.IncreaseChannelsClass()" />
<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" />
<CompareBitmap url="../Properties/Baselines/$testID.png" target="img1" />
</body>
</TestCase>
</testCases>
</UnitTester>