Bläddra i källkod

Merge pull request #13024 from gero3/UnitTestsAnimationAction2

Add test for getMixer, getClip & getRoot
Mr.doob 7 år sedan
förälder
incheckning
7ef6ca4ad2
1 ändrade filer med 22 tillägg och 10 borttagningar
  1. 22 10
      test/unit/src/animation/AnimationAction.tests.js

+ 22 - 10
test/unit/src/animation/AnimationAction.tests.js

@@ -13,13 +13,19 @@ import { LoopOnce, LoopRepeat, LoopPingPong } from '../../../../src/constants';
 
 function createAnimation(){
 
-
-	var mixer = new AnimationMixer(new Object3D());
+	var root = new Object3D();
+	var mixer = new AnimationMixer(root);
 	var track = new NumberKeyframeTrack( ".rotation[x]", [ 0, 1000 ], [ 0, 360 ] );
 	var clip = new AnimationClip( "clip1", 1000, [track] );
 
-	var animationAction = new AnimationAction( mixer, clip );
-	return { mixer :mixer,track:track,clip:clip,animationAction:animationAction};
+	var animationAction = mixer.clipAction( clip );
+	return {
+		root: root,
+		mixer: mixer,
+		track: track,
+		clip: clip,
+		animationAction: animationAction
+	};
 
 }
 
@@ -298,21 +304,27 @@ export default QUnit.module( 'Animation', () => {
 
 		} );
 
-		QUnit.todo( "getMixer", ( assert ) => {
+		QUnit.test( "getMixer", ( assert ) => {
 
-			assert.ok( false, "everything's gonna be alright" );
+			var { mixer, animationAction } = createAnimation();
+			var mixer2 = animationAction.getMixer();
+			assert.equal( mixer, mixer2, "mixer should be returned by getMixer." );
 
 		} );
 
-		QUnit.todo( "getClip", ( assert ) => {
+		QUnit.test("getClip", (assert) => {
 
-			assert.ok( false, "everything's gonna be alright" );
+			var { clip, animationAction } = createAnimation();
+			var clip2 = animationAction.getClip();
+			assert.equal( clip, clip2, "clip should be returned by getClip." );
 
 		} );
 
-		QUnit.todo( "getRoot", ( assert ) => {
+		QUnit.test( "getRoot", ( assert ) => {
 
-			assert.ok( false, "everything's gonna be alright" );
+			var { root, animationAction } = createAnimation();
+			var root2 = animationAction.getRoot();
+			assert.equal(root, root2, "root should be returned by getRoot." );
 
 		} );