Files
Aislo/B08_DesignDetail/openwebcad/test/tools/eraser/eraser.test.ts
T
eomsangdonandClaude Fable 5 2a248ff742 refactor(B07,B08): 도면 코드 B08_DesignDetail 이동 + 수량 슬롯 B07_Quantity 확보
- B07_wf4_DesignDetail(8파일+openwebcad) -> B08_DesignDetail로 git mv (이력 보존)
- B08_wf5_Quantity -> B07_Quantity (구 수량 백업 zip 보관 폴더)
- 파생 문자열 일괄 전환: /b07-cad -> /b08-cad 정적 서빙, CAD 레이어 b07-* -> b08-*,
  postMessage aislo:b07:* -> aislo:b08:*, 패키지명 aislo-b08-cad, CSS .b08-*,
  라우트 키/슬러그(B08_DESIGN_DETAIL/b08-design-detail, B07_QUANTITY/b07-quantity)
- 상세설계 워크플로우 stage 4 -> 5 (확정/무효화 전이 3곳), 확정 완료 시 B09로 이동
- WORKFLOW_STEP_ROUTES 순서 재배열: index4=수량(B07), index5=상세설계(B08)
- [임시] B08 이동 테스트 버튼 제거, openwebcad dist 재빌드
- 주석 의미 정렬: 수량 인계 주석 B08->B07, 도면 참조 B07->B08

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
2026-08-08 10:10:10 +09:00

51 lines
2.1 KiB
TypeScript

import {Point} from '@flatten-js/core'; /* eslint-disable @typescript-eslint/no-explicit-any */
import {expect, test} from 'vitest';
import type {ArcJsonData} from '../../../src/entities/ArcEntity';
import {EntityName, type JsonEntity} from '../../../src/entities/Entity';
import type {LineJsonData} from '../../../src/entities/LineEntity';
import {pointDistance} from '../../../src/helpers/distance-between-points';
import {getEntities} from '../../../src/state';
import {initApplication} from '../../helpers/init-application';
import {replayRecording} from '../../helpers/replay-recording';
import {CANVAS_HEIGHT} from "../../helpers/tests.consts";
import eraserRecording from './eraser.recording.json';
test('Draw circle and line and erase part of circle', async () => {
const inputController = initApplication();
replayRecording(inputController, eraserRecording);
const entities = getEntities();
expect(entities).toHaveLength(2);
const lineEntity = entities[0];
expect(lineEntity.getType()).toBe(EntityName.Line);
const lineJson = (await lineEntity.toJson()) as JsonEntity<LineJsonData>;
expect(lineJson.lineColor).toBe('#fff');
expect(lineJson.lineWidth).toBe(1);
expect(lineJson.type).toBe('Line');
expect(lineJson.shapeData.startPoint.x).toBe(473);
expect(lineJson.shapeData.startPoint.y).toBe(CANVAS_HEIGHT - 148);
expect(lineJson.shapeData.endPoint.x).toBe(473);
expect(lineJson.shapeData.endPoint.y).toBe(CANVAS_HEIGHT - 698);
const arcEntity = entities[1];
expect(arcEntity.getType()).toBe(EntityName.Arc);
const arcJson = (await arcEntity.toJson()) as JsonEntity<ArcJsonData>;
expect(arcJson.lineColor).toBe('#fff');
expect(arcJson.lineWidth).toBe(1);
expect(arcJson.type).toBe('Arc');
expect(arcJson.shapeData.center.x).toBe(266);
expect(arcJson.shapeData.center.y).toBe(CANVAS_HEIGHT - 402);
const radius = pointDistance(
new Point(266, CANVAS_HEIGHT - 402),
new Point(542, CANVAS_HEIGHT - 441)
);
expect(arcJson.shapeData.radius).toBeCloseTo(radius, 5);
expect(arcJson.shapeData.startAngle).toBeCloseTo(0.7338182524767606, 5);
expect(arcJson.shapeData.endAngle).toBeCloseTo(-0.7338182524767606, 5);
});