Files
Aislo/B07_DesignDetail/openwebcad/test/tools/eraser/eraser.test.ts
T
eomsangdonandClaude Fable 5 6e195afb69 feat(B07,B08): 워크플로 순서 교환 — 상세설계를 수량산출 앞으로
횡단설계(B06) 다음을 상세설계 → 수량산출 → 설계도서 순으로 재배열하고,
폴더 번호가 흐름과 일치하도록 이름을 맞바꾼다.

- B08_DesignDetail → B07_DesignDetail, B07_Quantity → B08_Quantity
  (파일 접두어·식별자·라우트·locale 키 전량 스왑)
- STAGE_KEYS 4=DESIGN_DETAIL, 5=QUANTITY 스왑 + 라우터 stage 리터럴 교체
- CAD 마운트 /b08-cad → /b07-cad (main.py·vite proxy·iframe URL),
  openwebcad Toolbar 라벨 B07로 수정 후 재빌드
- 유지: openwebcad postMessage 프로토콜 aislo:b08:*·패키지명(내부 식별자)
- 기존 프로젝트 storage 폴더 rename + project_manifest 갱신,
  DB project_workflow_stages stage_no 4↔5 행 스왑 완료

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
2026-08-29 16:16:46 +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);
});