feat: add play apps and layout tools

This commit is contained in:
2026-05-25 17:29:21 +09:00
parent f59522ffc4
commit 51e0099bea
46 changed files with 37152 additions and 119 deletions

View File

@@ -0,0 +1,86 @@
import assert from 'node:assert/strict';
import test from 'node:test';
import { duplicateShapeWithLabel } from '../../src/features/layout/draw/layoutDrawShapeUtils.ts';
test('duplicates a line with original label when no override is provided', () => {
const duplicated = duplicateShapeWithLabel(
{
id: 'line-1',
type: 'line',
x1: 10,
y1: 20,
x2: 10,
y2: 160,
orientation: 'vertical',
label: '기존',
},
'line-2',
);
assert.deepEqual(duplicated, {
id: 'line-2',
type: 'line',
x1: 34,
y1: 44,
x2: 34,
y2: 184,
orientation: 'vertical',
label: '기존',
});
});
test('duplicates a line with label override and offset', () => {
const duplicated = duplicateShapeWithLabel(
{
id: 'line-1',
type: 'line',
x1: 10,
y1: 20,
x2: 10,
y2: 160,
orientation: 'vertical',
label: '기존',
},
'line-2',
'복사본',
);
assert.deepEqual(duplicated, {
id: 'line-2',
type: 'line',
x1: 34,
y1: 44,
x2: 34,
y2: 184,
orientation: 'vertical',
label: '복사본',
});
});
test('duplicates a rect with label override and offset', () => {
const duplicated = duplicateShapeWithLabel(
{
id: 'rect-1',
type: 'rect',
x: 40,
y: 50,
width: 120,
height: 80,
label: '사각형',
fillColor: '#bfdbfe',
},
'rect-2',
'새 라벨',
);
assert.deepEqual(duplicated, {
id: 'rect-2',
type: 'rect',
x: 64,
y: 74,
width: 120,
height: 80,
label: '새 라벨',
fillColor: '#bfdbfe',
});
});