19 lines
525 B
TypeScript
19 lines
525 B
TypeScript
|
|
import assert from 'node:assert/strict'
|
||
|
|
import test from 'node:test'
|
||
|
|
|
||
|
|
import { relativePointerPosition } from '../public/browser-touchpad-math.js'
|
||
|
|
|
||
|
|
test('trackpad movement is relative to the current pointer position',()=>{
|
||
|
|
assert.deepEqual(
|
||
|
|
relativePointerPosition({x:320,y:180},40,-20,2,2,1.35,1440,900),
|
||
|
|
{x:428,y:126},
|
||
|
|
)
|
||
|
|
})
|
||
|
|
|
||
|
|
test('relative trackpad movement stays inside the remote screen',()=>{
|
||
|
|
assert.deepEqual(
|
||
|
|
relativePointerPosition({x:1430,y:5},100,-100,1,1,1.35,1440,900),
|
||
|
|
{x:1439,y:0},
|
||
|
|
)
|
||
|
|
})
|