From 30736a974956da4159780739702e4f133d0f6b10 Mon Sep 17 00:00:00 2001 From: umsangdon Date: Mon, 16 Nov 2026 21:28:46 +0900 Subject: [PATCH] =?UTF-8?q?fix(848-3):=20=EA=B0=80=EC=A0=B8=EC=98=A8=20?= =?UTF-8?q?=EA=B3=B5=EC=8B=9D=20=EC=A4=84=20=EC=88=98=EB=A7=8C=EC=9D=B8=20?= =?UTF-8?q?=EA=B2=B9=EB=B6=84=EC=88=98=EB=8F=84=20=EC=A4=84=20=EB=82=98?= =?UTF-8?q?=EB=88=94(=EB=91=90=20=EC=B8=B5=20=EC=95=88)=20=C2=B7=20?= =?UTF-8?q?=EC=B9=B8=20=ED=85=8C=EB=91=90=EB=A6=AC=20=ED=91=9C=EC=8B=9C?= =?UTF-8?q?=EA=B0=80=20=EA=B0=80=EC=A7=9C=20DOM=20=EC=8B=9C=ED=97=98?= =?UTF-8?q?=EC=97=90=EC=84=9C=EB=8F=84=20=EB=8F=8E?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - 산출근거 공식 묶음 — 기호 없는 식이라도 두 층 넘는 분수면 중간 줄 규칙으로(EST main 33 Q = (4.5 + 5.5) ÷ (2 × 0.35)) · 16 블록 × 엑셀 · 우리 두 판 겹분수 0 · 금액 · 문서 그대로 - markDiff = 클래스로만 찾음(matches 없는 가짜 DOM 시험 헬퍼) - 시험 test_848_3_import_frac(EST main 33 · 엑셀 북부청임도 43 · 옛 코드에서 실패 확인) Co-Authored-By: Claude Opus 5.5 --- A00_Common/line_stack_machine_ctl.ts | 3 +- A00_Common/line_stack_out.ts | 6 ++- resources/tester/test_848_3_import_frac.py | 44 ++++++++++++++++++++++ 3 files changed, 50 insertions(+), 3 deletions(-) create mode 100644 resources/tester/test_848_3_import_frac.py diff --git a/A00_Common/line_stack_machine_ctl.ts b/A00_Common/line_stack_machine_ctl.ts index 2df0e34e8..aad4d4dcb 100644 --- a/A00_Common/line_stack_machine_ctl.ts +++ b/A00_Common/line_stack_machine_ctl.ts @@ -77,7 +77,8 @@ export const diffOf = (src: Source | undefined): UiDiff | null => /** 칸 묶음 안 입력 · 고르기 · 이름 단추에 「바뀜」 상태 · 풍선(원래 값) */ export function markDiff(box: HTMLElement, diff: UiDiff | null, was?: string): void { - const nodes = box.matches(".ui-input, .ui-select, .ui-btn") ? [box] : [...box.querySelectorAll(".ui-input, .ui-select, .ui-btn.lstk-res")]; // prettier-ignore + const own = ["ui-input", "ui-select", "ui-btn"].some((c) => box.classList.contains(c)); + const nodes = own ? [box] : ["ui-input", "ui-select", "lstk-res"].flatMap((c) => [...box.querySelectorAll(`.${c}`)]); // prettier-ignore for (const n of nodes) { setUiDiff(n, diff); if (diff && was !== undefined) diff --git a/A00_Common/line_stack_out.ts b/A00_Common/line_stack_out.ts index e77d05e4e..e74038bcf 100644 --- a/A00_Common/line_stack_out.ts +++ b/A00_Common/line_stack_out.ts @@ -241,9 +241,11 @@ function rows( const v = vals[id]; const t = lines.get(id); const head = katexNode(symTex(alias[id] ?? id)); - if (t !== undefined && hasVar(t)) { + const tn = t === undefined ? null : nodeOf(t); + // 848-3 수만인 식도 두 층 넘는 분수면(가져온 공식 줄 `Q = (4.5 + 5.5) ÷ 2 ÷ 0.35` 꼴) 아래 줄 나눔 규칙으로 + if (t !== undefined && (hasVar(t) || (tn && fracDepth(tn) > 1))) { flush(); - const n = nodeOf(t)!; + const n = tn!; if (!machine && fracDepth(n) <= 1) { push({ h: formula(id, n, v, unit(id), vals, {}) }); continue; diff --git a/resources/tester/test_848_3_import_frac.py b/resources/tester/test_848_3_import_frac.py new file mode 100644 index 000000000..f97d9eb7d --- /dev/null +++ b/resources/tester/test_848_3_import_frac.py @@ -0,0 +1,44 @@ +"""848-3(조사 889b F) — 가져온 공식 줄의 수만인 겹분수도 산출근거에서 두 층 안(줄 나눔 규칙) · 금액 · 문서 그대로. + +짝 = `A00_Common/line_stack_out.ts` 공식 묶음(`block` — 수만인 식이 두 층 넘는 분수면 중간 줄 길) · +그리기 = 진짜 화면 코드를 가짜 DOM 으로(`helper_845_2_unit_show.cjs` 「전수」 · 기계 줄 = 위 · 아래 모두 봄). +견본 = EST main 33(석축헐기 Q = (4.5 + 5.5) ÷ 2 ÷ 0.35) · 엑셀 북부청임도 43 — 엑셀 · 우리 두 판. +""" + +import pytest + +from M02_MasterTemplete import M02_Doc_Copy as dc +from M02_MasterTemplete import M02_Doc_FromNative as fn +from M02_MasterTemplete import M02_Doc_Import as dim +from M02_MasterTemplete import M02_San_Xlsx as sx +from M02_MasterTemplete import M02_Sangeun_Imported as imp +from resources.tester import test_797_1a_import_flags as practice +from resources.tester import test_810_1_estx as e +from resources.tester import test_810_2_native_doc as t +from resources.tester import test_846_2_work_view as w2 + + +def _saved(kind: str, tag: str): + if kind == "엑셀": + p = practice.FILES[tag] + return fn.pack(sx.read(p.name, p.read_bytes()), p.name) + p = e.FILES[tag] + return fn.read(p.name, p.read_bytes()) + + +@pytest.mark.parametrize("kind,tag,no", [("EST", "main", 33), ("엑셀", "북부청임도", 43)]) +def test_가져온_식_겹분수_두_층_안(kind, tag, no): + p = (practice.FILES if kind == "엑셀" else e.FILES)[tag] + if not p or not p.exists(): + pytest.skip("견본 파일 없음") + sk = t.sk_of(fn.emit(_saved(kind, tag), no)) + doc = dim.derive(sk, None, t.whole()) + cases = [] + for basis in ("엑셀", "우리"): + sk2 = {**sk, imp.KEY: {**sk[imp.KEY], "단가기준": basis}} + cases.append( + {"키": basis, "문서": dim.view(doc, basis), "연결": dim.record(doc, sk2), "기계": True} + ) + got = w2._js({"할일": "전수", "문서들": dc.ml._norm(cases), "보기": []}) + assert [b for g in got for b in g["bad"] if b[0] == "겹분수"] == [] + assert all(g["같음"] for g in got)