提交 cc8d54c1 编写于 作者: G gero3

add Test for setLoop (LoopOnce,LoopRepeat)

上级 8e6e4a65
......@@ -8,6 +8,7 @@ import { AnimationMixer } from '../../../../src/animation/AnimationMixer';
import { AnimationClip } from '../../../../src/animation/AnimationClip';
import { NumberKeyframeTrack } from '../../../../src/animation/tracks/NumberKeyframeTrack';
import { Object3D } from '../../../../src/core/Object3D';
import { LoopOnce, LoopRepeat, LoopPingPong } from '../../../../src/constants';
function createAnimation(){
......@@ -160,10 +161,38 @@ export default QUnit.module( 'Animation', () => {
} );
QUnit.todo( "setLoop", ( assert ) => {
assert.ok( false, "everything's gonna be alright" );
QUnit.test( "setLoop LoopOnce", ( assert ) => {
var {mixer,animationAction} = createAnimation();
animationAction.setLoop(LoopOnce);
animationAction.play();
assert.ok( animationAction.isRunning(), "When an animation is started, it is running." );
mixer.update(500);
assert.ok( animationAction.isRunning(), "When an animation is in the first loop, it is running." );
mixer.update(500);
assert.notOk( animationAction.isRunning(), "When an animation is ended, it is not running." );
mixer.update(500);
assert.notOk( animationAction.isRunning(), "When an animation is ended, it is not running." );
} );
QUnit.test( "setLoop LoopRepeat", ( assert ) => {
var {mixer,animationAction} = createAnimation();
animationAction.setLoop(LoopRepeat,3);
animationAction.play();
assert.ok( animationAction.isRunning(), "When an animation is started, it is running." );
mixer.update(500);
assert.ok( animationAction.isRunning(), "When an animation is in the first loop, it is running." );
mixer.update(1000);
assert.ok( animationAction.isRunning(), "When an animation is in second loop when in looprepeat 3 times, it is running." );
mixer.update(1000);
assert.ok( animationAction.isRunning(), "When an animation is in third loop when in looprepeat 3 times, it is running." );
mixer.update(1000);
assert.notOk( animationAction.isRunning(), "When an animation ended his third loop when in looprepeat 3 times, it is not running anymore." );
mixer.update(1000);
assert.notOk( animationAction.isRunning(), "When an animation ended his third loop when in looprepeat 3 times, it stays not running anymore." );
} );
QUnit.todo( "setEffectiveWeight", ( assert ) => {
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册