blob: add73a77922fe936757d4d32288fda4bceb29302 [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="mx/effects/MaskEffect/Methods/"
xmlns:mx="http://www.adobe.com/2006/mxml"
xmlns="*"
testSWF="../SWFs/MaskEffect_Main.mxml">
<!-- this set of lines form a template that must be in each unit test -->
<mx:Script>
<![CDATA[
import mx.effects.MaskEffect;
import mx.events.TweenEvent;
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 -->
<testCases>
<!-- Construtor -->
<TestCase testID="MaskEffect_Constructor_Empty" keywords="[MaskEffect, method, constructor]" description="Try to initialize the constructor with an empty arg.">
<body>
<RunCode code="application.testEffect = new MaskEffect();"/>
</body>
</TestCase>
<TestCase testID="MaskEffect_Constructor_Null" keywords="[MaskEffect, method, constructor]" description="Try to initialize the constructor with the null arg.">
<body>
<RunCode code="application.testEffect = new MaskEffect(null);"/>
</body>
</TestCase>
<TestCase testID="MaskEffect_Constructor_Object" keywords="[MaskEffect, method, constructor]" description="Try to initialize the constructor with an object.">
<body>
<RunCode code="application.testEffect = new MaskEffect(application.testImage);" />
</body>
</TestCase>
<TestCase testID="MaskEffect_resume" keywords="[MaskEffect, Methods, resume]" description="Test the resume() method.">
<setup>
<RunCode code="application.ResetImage()"/>
<RunCode code="application.ResetEffectScale(0, 1, 0, 1)"/>
<SetProperty target="testEffect" propertyName="duration" value="1000"/>
<RunCode code="application.testEffect.play()"/>
<Pause timeout="500"/>
<RunCode code="application.testEffect.pause()"/>
<Pause timeout="1000"/>
</setup>
<body>
<RunCode code="application.testEffect.resume()" waitTarget="testEffect" waitEvent="effectEnd"/>
</body>
</TestCase>
<TestCase testID="MaskEffect_pause" keywords="[MaskEffect, Methods, pause]" description="Test the pause() method.">
<setup>
<RunCode code="application.ResetImage()"/>
<RunCode code="application.ResetEffectScale(0, 1, 0, 1)"/>
<SetProperty target="testEffect" propertyName="duration" value="1000"/>
<RunCode code="application.testEffect.play()"/>
<Pause timeout="500"/>
</setup>
<body>
<RunCode code="application.testEffect.pause()"/>
<Pause timeout="700"/>
<AssertNoEvent target="testEffect" eventName="effectEnd" eventClass="mx.effects.EffectEvent"/>
</body>
</TestCase>
<TestCase testID="MaskEffect_play" keywords="[MaskEffect, Methods, play]" description="Test the play() method.">
<setup>
<RunCode code="application.ResetImage()"/>
<RunCode code="application.ResetEffectScale(0, 1, 0, 1)"/>
</setup>
<body>
<RunCode code="application.testEffect.play()" waitTarget="testEffect" waitEvent="effectEnd"/>
</body>
</TestCase>
<TestCase testID="MaskEffect_stop" keywords="[MaskEffect, Methods, stop]" description="Test the stop() method. Start, wait 500ms, then stop in mid-effect. Verify effectEnd">
<setup>
<RunCode code="application.ResetImage()"/>
<RunCode code="application.ResetEffectScale(0, 1, 0, 1)"/>
<SetProperty target="testEffect" propertyName="duration" value="1000"/>
</setup>
<body>
<RunCode code="application.testEffect.play()"/>
<Pause timeout="500"/>
<RunCode code="application.testEffect.stop()" waitTarget="testEffect" waitEvent="effectEnd"/>
</body>
</TestCase>
<TestCase testID="MaskEffect_reverse" keywords="[MaskEffect, Methods, reverse]" description="Test the reverse() method. Start, wait 500ms, then reverse in mid-effect.">
<setup>
<RunCode code="application.ResetImage()"/>
<RunCode code="application.ResetEffectScale(0, 1, 0, 1)"/>
<SetProperty target="testEffect" propertyName="duration" value="1000"/>
</setup>
<body>
<RunCode code="application.testEffect.play()"/>
<Pause timeout="500"/>
<RunCode code="application.testEffect.reverse()" waitTarget="testEffect" waitEvent="effectEnd"/>
<AssertPixelValue x="50" y="50" value="0xFFFFFF"/>
</body>
</TestCase>
<TestCase testID="MaskEffect_toString" keywords="[MaskEffect, Methods, toString]" description="Test the toString() method.">
<setup>
<RunCode code="application.ResetEffectDefault()"/>
</setup>
<body>
<AssertMethodValue method="value=application.testEffect.toString().replace('[', '').replace(']', '')" value="object MaskEffect"/>
</body>
</TestCase>
<TestCase testID="MaskEffect_hasEventListener_NoListener" keywords="[MaskEffect, Methods, hasEventListener]" description="Test the hasEventListener() method. Verify false is returned for no event.">
<setup>
<RunCode code="application.ResetEffectDefault()"/>
</setup>
<body>
<AssertMethodValue method="value=application.testEffect.hasEventListener('RANDOM');" value="false"/>
</body>
</TestCase>
</testCases>
</UnitTester>