2
0
Эх сурвалжийг харах

Merge pull request #13016 from gero3/UnitTestsAnimationAction

Add unit test for clipTime in AnimationAtion
Mr.doob 7 жил өмнө
parent
commit
570bb8b1ba

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

@@ -16,9 +16,9 @@ function createAnimation(){
 
 	var mixer = new AnimationMixer(new Object3D());
 	var track = new NumberKeyframeTrack( ".rotation[x]", [ 0, 1000 ], [ 0, 360 ] );
-	var clip = new AnimationClip( "clip1", 1000, [track] );
+	var clip = new AnimationClip( "clip1", 1000, [track] );
 
-	var animationAction = new AnimationAction( mixer, clip );
+	var animationAction = new AnimationAction( mixer, clip );
 	return { mixer :mixer,track:track,clip:clip,animationAction:animationAction};
 
 }
@@ -189,7 +189,26 @@ export default QUnit.module( 'Animation', () => {
 			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." );
+			assert.ok( animationAction.isRunning(), "When an animation is in fourth 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 stays not running anymore." );
+			
+		} );
+
+		QUnit.test( "setLoop LoopPingPong", ( assert ) => {
+	
+			var {mixer,animationAction} = createAnimation();
+			animationAction.setLoop(LoopPingPong,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.ok( animationAction.isRunning(), "When an animation is in fourth 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 stays not running anymore." );