diff --git a/B07_DesignDetail/openwebcad/src/main.tsx b/B07_DesignDetail/openwebcad/src/main.tsx index abf4f4d7b..9e4b392d7 100644 --- a/B07_DesignDetail/openwebcad/src/main.tsx +++ b/B07_DesignDetail/openwebcad/src/main.tsx @@ -174,9 +174,8 @@ function initApplication() { startDrawLoop(screenCanvasDrawController, 0); - const lineToolActor = new Actor(TOOL_STATE_MACHINES[Tool.LINE]); - lineToolActor.start(); - setActiveToolActor(lineToolActor); + // 오토캐드처럼 「명령:」 쉼(선택 도구)으로 시작 + setActiveToolActor(new Actor(TOOL_STATE_MACHINES[Tool.SELECT])); } } diff --git a/resources/tester/cad/prompt-frame.test.ts b/resources/tester/cad/prompt-frame.test.ts index 986366abc..e5005bf8b 100644 --- a/resources/tester/cad/prompt-frame.test.ts +++ b/resources/tester/cad/prompt-frame.test.ts @@ -3,6 +3,7 @@ * 설계 `docs/raw/조사/2026-10-15_337_CAD오토캐드조작_설계.md` 2 장 · 6-3 가 줄. * 실행: cd B07_DesignDetail/openwebcad && npx vitest run --dir ../../resources/tester/cad prompt-frame */ +import { readFileSync } from "node:fs"; import { beforeEach, describe, expect, it, vi } from "vitest"; vi.mock("react-toastify", () => ({ @@ -21,6 +22,7 @@ import { remember, renderPrompt, } from "../../../B07_DesignDetail/openwebcad/src/commands/prompt"; +import { TOOL_STATE_MACHINES } from "../../../B07_DesignDetail/openwebcad/src/commands/registry"; import { getLastCommandId, runCommandInput, @@ -418,6 +420,24 @@ describe("엔진 v2 — loopFrom · when · mode · next · escCommits · undo }); describe("쉼 · 명령 이름 · 별칭(2-5 ⑨ · 2-17 · N18)", () => { + it("앱 시작 = 쉼(선택 도구) — main.tsx 가 켜는 도구 · 「l ⏎」 = 첫 번째 점 지정", () => { + const main = readFileSync( + new URL("../../../B07_DesignDetail/openwebcad/src/main.tsx", import.meta.url), + "utf8", + ); + const started = [...main.matchAll(/TOOL_STATE_MACHINES\[Tool\.(\w+)\]/g)].map((m) => m[1]); + expect(started).toEqual(["SELECT"]); + start(TOOL_STATE_MACHINES[Tool.SELECT]); + expect(activeTool()).toBe(Tool.SELECT); + const idle = promptLine(); + expect(idle).not.toBe("첫 번째 점 지정:"); + typeEnter("l"); + expect(activeTool()).toBe(Tool.LINE); + expect(promptLine()).toBe("첫 번째 점 지정:"); + key("Escape"); + expect(promptLine()).toBe(idle); + }); + it("딱 맞음만 — R · LE · CIR · SE = 알 수 없는 명령 · l = LINE · ed = TEXTEDIT", () => { for (const text of ["r", "le", "cir", "se"]) { type(text);