fix(B07 CAD): 서버가 만든 표 선 색 · 굵기 · id 비면 기본값 — 놓기 · 업데이트 · 다시 열기 한 곳 (43-6)

- TableEntity.fromJson: lineColor 비면 자동색 #fff · lineWidth 비면 1 · id 비면 새 id(면적산출 → 도면 표 변환 답에 세 칸이 없음 → 저장 JSON 선 색 빠지던 흠 E2)
- 시험 aislo-table-bridge.test.ts 에 선 색 없는 표 놓기 · 저장 JSON 선 색 · 다시 읽기

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01UoSr2sqvYtBf1dtQdus88s
This commit is contained in:
2026-10-05 00:26:53 +09:00
co-authored by Claude Opus 5.5
parent 31a753b7fd
commit b1dbd9c3cb
2 changed files with 27 additions and 3 deletions
@@ -351,9 +351,11 @@ export class TableEntity implements Entity {
data.cells,
data.style
);
table.id = jsonEntity.id;
table.lineColor = jsonEntity.lineColor;
table.lineWidth = jsonEntity.lineWidth;
// 서버가 만든 표(면적산출 → 도면 · M02 41장)는 id · 선 색 · 굵기가 없을 수 있다 — 비면 새 표의
// 기본값(선 색 = 자동색 `#fff` · 바탕 따라 흰/검정)으로 채운다. 놓기 · [업데이트] · 다시 열기가 모두 여기를 지난다.
table.id = jsonEntity.id || table.id;
table.lineColor = jsonEntity.lineColor || table.lineColor;
table.lineWidth = jsonEntity.lineWidth ?? table.lineWidth;
table.lineDash = jsonEntity.lineDash;
return table;
}
@@ -77,6 +77,28 @@ describe('표 놓기(PLACETABLE)', () => {
});
});
describe('선 색 없는 표(서버 표 변환 답 · 43-6)', () => {
it('id · 선 색 · 굵기가 없으면 기본값(자동색 #fff · 1 · 새 id)으로 채워 놓고 저장 JSON 에도 남음', async () => {
const json = await table('T8').toJson();
if (!json) throw new Error('표 JSON 없음');
const { id: _id, lineColor: _color, lineWidth: _width, layerId: _layer, ...bare } = json;
await handleTableMessage(
{ type: AISLO_PLACE_TABLE_MESSAGE, entity: bare as typeof json, link: 'T8' },
vi.fn()
);
const pending = getPendingTable();
expect(pending?.lineColor).toBe('#fff');
expect(pending?.lineWidth).toBe(1);
const placed = tableAt(pending as TableEntity, new Point(0, 0), layer.id);
placed.lineColor = pending?.lineColor ?? '';
const saved = await placed.toJson();
expect(saved?.lineColor).toBe('#fff');
const back = await TableEntity.fromJson(bare as typeof json);
expect(back.id).toBeTruthy();
expect(back.lineColor).toBe('#fff');
});
});
describe('표 칸 갈기(update-table)', () => {
it('연결이 같은 표의 칸만 갈고 자리 · 크기는 그대로 · 되돌리기 한 걸음', () => {
const linked = table('T1');