(elapsed: number, frameCount: number)
| 328 | |
| 329 | it('smooths pointer velocity consistently across frame rates', () => { |
| 330 | const getVelocityAfterMoving = (elapsed: number, frameCount: number) => { |
| 331 | const testEditor = new TestEditor({}) |
| 332 | try { |
| 333 | for (let i = 1; i <= frameCount; i++) { |
| 334 | testEditor.pointerMove((10 * i) / frameCount, (10 * i) / frameCount) |
| 335 | testEditor.inputs.updatePointerVelocity(elapsed) |
| 336 | } |
| 337 | return testEditor.inputs.getPointerVelocity().toJson() |
| 338 | } finally { |
| 339 | testEditor.dispose() |
| 340 | } |
| 341 | } |
| 342 | |
| 343 | expect(getVelocityAfterMoving(16, 1)).toCloselyMatchObject({ |
| 344 | x: 0.3125, |
no test coverage detected
searching dependent graphs…