"""EST 테스트 앱 인쇄양식 파일(.pfot — 원본 mnuPrintFormatSave·Load) 읽기·쓰기.""" import json import subprocess from pathlib import Path import pytest ROOT = Path(__file__).resolve().parents[2] PFOT = Path("C:/Dasansoft/Est Plus 2/System/EstFormat") def test_pfot_round_trip_is_byte_identical_and_edits_apply(): if not (PFOT / "main.pfot").exists(): pytest.skip("installed EST print formats unavailable") code = r""" const P = require(process.cwd() + '/tools/est-test/print-format.cjs'), fs = require('fs'); const out = {}; for (const f of ['main.pfot', 'main(가로양식).pfot']) { const b = fs.readFileSync(process.argv[1] + '/' + f), rows = P.readFull(b); out[f] = [rows.length, P.write(b, rows).equals(b)]; } const b = fs.readFileSync(process.argv[1] + '/main.pfot'), rows = P.readFull(b); rows[1].Name2 = '원가계산서(수정)'; rows[1].Checked = 0; const again = P.read(P.write(b, rows)); out.edit = [again[1].Name2, again[1].Checked, again.length]; process.stdout.write(JSON.stringify(out)); """ out = json.loads( subprocess.check_output(["node", "-e", code, str(PFOT)], cwd=ROOT).decode("utf-8") ) assert out["main.pfot"] == [41, True] assert out["main(가로양식).pfot"][1] is True assert out["edit"] == ["원가계산서(수정)", 0, 41]