feat(scene-editor): add persistent dockable tool workspaces
This commit is contained in:
@@ -0,0 +1,17 @@
|
||||
import test from 'node:test';
|
||||
import assert from 'node:assert/strict';
|
||||
import {fitWindow,resizeWindow,windowResizeEdges} from '../packages/ui-react/dist/windowGeometry.js';
|
||||
const bounds={width:1200,height:800}, r={left:200,top:100,width:600,height:400};
|
||||
test('all resize edges preserve the opposite anchor and remain within the viewport',()=>{
|
||||
for(const edge of windowResizeEdges) for(const dx of [-2000,-25,25,2000]) for(const dy of [-2000,-25,25,2000]){
|
||||
const v=resizeWindow(r,edge,dx,dy,bounds);
|
||||
assert.ok(v.width>=320&&v.height>=200);assert.ok(v.left>=8&&v.top>=8&&v.left+v.width<=1192&&v.top+v.height<=792);
|
||||
if(edge.includes('w'))assert.equal(v.left+v.width,r.left+r.width);else assert.equal(v.left,r.left);
|
||||
if(edge.includes('n'))assert.equal(v.top+v.height,r.top+r.height);else assert.equal(v.top,r.top);
|
||||
}
|
||||
});
|
||||
test('viewport shrink retains reachable header and fits small screens',()=>{
|
||||
const v=fitWindow({...r,left:1100,top:750},{width:280,height:180});
|
||||
assert.deepEqual(v,{left:8,top:8,width:264,height:164});
|
||||
assert.deepEqual(fitWindow(r,bounds),r);
|
||||
});
|
||||
Reference in New Issue
Block a user