]> source.dussan.org Git - svg.js.git/commitdiff
Make the tests of timeToPos() and posToTime() easier to understand
authorRémi Tétreault <tetreault.remi@gmail.com>
Mon, 17 Oct 2016 19:58:34 +0000 (15:58 -0400)
committerRémi Tétreault <tetreault.remi@gmail.com>
Mon, 17 Oct 2016 19:58:34 +0000 (15:58 -0400)
spec/spec/fx.js

index e848862d51bed64d25a0378d075c97303391acd9..e71f449f339c7d5682a1d89ffaa694f4ccd1b36b 100644 (file)
@@ -39,7 +39,7 @@ describe('FX', function() {
 
   describe('timeToPos()', function() {
     it('converts a timestamp to a progress', function() {
-      expect(fx.timeToPos(fx.situation.start+fx.situation.duration/2)).toBe(0.5)
+      expect(fx.timeToPos( fx.situation.start + fx.situation.duration*0.5 )).toBe(0.5)
     })
 
     it('should take speed into consideration', function() {
@@ -47,17 +47,17 @@ describe('FX', function() {
 
       spd = 4
       fx.speed(spd)
-      expect(fx.timeToPos(fx.situation.start+(fx.situation.duration/spd)/2)).toBe(0.5)
+      expect(fx.timeToPos( fx.situation.start + (fx.situation.duration/spd)*0.5 )).toBe(0.5)
 
       spd = 0.5
       fx.speed(spd)
-      expect(fx.timeToPos(fx.situation.start+(fx.situation.duration/spd)/4)).toBe(0.25)
+      expect(fx.timeToPos( fx.situation.start + (fx.situation.duration/spd)*0.25 )).toBe(0.25)
     })
   })
 
   describe('posToTime()', function() {
     it('converts a progress to a timestamp', function() {
-      expect(fx.posToTime(0.5)).toBe(fx.situation.start+fx.situation.duration/2)
+      expect(fx.posToTime(0.5)).toBe( fx.situation.start + fx.situation.duration*0.5 )
     })
 
     it('should take speed into consideration', function() {
@@ -65,11 +65,11 @@ describe('FX', function() {
 
       spd = 4
       fx.speed(spd)
-      expect(fx.posToTime(0.5)).toBe(fx.situation.start+(fx.situation.duration/spd)/2)
+      expect(fx.posToTime(0.5)).toBe( fx.situation.start + (fx.situation.duration/spd)*0.5 )
 
       spd = 0.5
       fx.speed(spd)
-      expect(fx.posToTime(0.25)).toBe(fx.situation.start+(fx.situation.duration/spd)/4)
+      expect(fx.posToTime(0.25)).toBe( fx.situation.start + (fx.situation.duration/spd)*0.25 )
     })
   })