提交 d7de0bec 编写于 作者: W Wouter Vanmontfort

Added test for AnimationMixer's stopAllAction().

上级 fd61ec3f
......@@ -4,6 +4,28 @@
/* global QUnit */
import { AnimationMixer } from '../../../../src/animation/AnimationMixer';
import { AnimationClip } from '../../../../src/animation/AnimationClip';
import { VectorKeyframeTrack } from '../../../../src/animation/tracks/VectorKeyframeTrack';
import { Object3D } from '../../../../src/core/Object3D'
import {
zero3,
one3,
two3
} from '../math/Constants.tests';
function getClips(pos1, pos2, scale1, scale2, dur) {
const clips = [];
let track = new VectorKeyframeTrack( ".scale", [ 0, dur ], [ scale1.x, scale1.y, scale1.z, scale2.x, scale2.y, scale2.z ] );
clips.push( new AnimationClip( "scale", dur, [ track ] ) );
track = new VectorKeyframeTrack( ".position", [ 0, dur ], [ pos1.x, pos1.y, pos1.z, pos2.x, pos2.y, pos2.z ] );
clips.push( new AnimationClip( "position", dur, [ track ] ) );
return clips;
}
export default QUnit.module( 'Animation', () => {
......@@ -36,9 +58,35 @@ export default QUnit.module( 'Animation', () => {
} );
QUnit.todo( "stopAllAction", ( assert ) => {
assert.ok( false, "everything's gonna be alright" );
QUnit.test( "stopAllAction", ( assert ) => {
const obj = new Object3D();
const animMixer = new AnimationMixer( obj );
const clips = getClips( zero3, one3, two3, one3, 1 );
const actionA = animMixer.clipAction( clips[ 0 ] );
const actionB = animMixer.clipAction( clips[ 1 ] );
actionA.play();
actionB.play();
animMixer.update( 0.1 );
animMixer.stopAllAction();
assert.ok(
!actionA.isRunning() &&
!actionB.isRunning(),
"All actions stopped" );
assert.ok(
obj.position.x == 0 &&
obj.position.y == 0 &&
obj.position.z == 0,
"Position reset as expected"
);
assert.ok(
obj.scale.x == 1 &&
obj.scale.y == 1 &&
obj.scale.z == 1,
"Scale reset as expected"
);
} );
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册