import {test} from 'node:test' import assert from 'node:assert/strict' import {cellAtPoint} from '../src/core/canvas.ts' test('页面滚动和画布偏移后仍准确定位格子',()=>{ assert.equal(cellAtPoint(125,345,{left:100,top:300,width:100,height:100},10,10),42) assert.equal(cellAtPoint(125,45,{left:100,top:0,width:100,height:100},10,10),42) assert.equal(cellAtPoint(125,-1,{left:100,top:0,width:100,height:100},10,10),null) })