Files
Tunnel3D/tests/verify_wall_height.js

70 lines
3.1 KiB
JavaScript

const fs = require('fs');
const path = require('path');
const DxfParser = require(path.join(__dirname, '../dxf-parser.js'));
function testDirectApp(dxfPath, name) {
if (!fs.existsSync(dxfPath)) {
console.log(`[PASS SKIP] 도면 없음: ${dxfPath}`);
return;
}
const dxfText = fs.readFileSync(dxfPath, 'utf8');
const parser = new DxfParser();
const dxf = parser.parseSync(dxfText);
const appCode = fs.readFileSync(path.join(__dirname, '../app.js'), 'utf8');
global.window = {
current3DTunnelLength: 10,
current3DOpacity: 1.0,
current3DOuterOpacity: 1.0,
current3DViewMode: 'bird',
current3DTheme: 'dark',
current3DVisibility: {},
sectionParams: {},
ugData: { left: {}, right: {} },
addEventListener: () => {},
lastGeneratedLoops2D: [],
view2D: { zoom: 1, panX: 0, panY: 0 }
};
const mockCtx = {
fillRect: ()=>{}, strokeRect: ()=>{}, beginPath: ()=>{}, closePath: ()=>{},
moveTo: ()=>{}, lineTo: ()=>{}, stroke: ()=>{}, fill: ()=>{},
save: ()=>{}, restore: ()=>{}, setTransform: ()=>{}, fillText: ()=>{}
};
global.document = {
getElementById: () => ({
classList: { add: ()=>{}, remove: ()=>{} },
addEventListener: () => {},
value: '',
disabled: false,
getContext: () => mockCtx,
getBoundingClientRect: () => ({ width: 800, height: 600 })
}),
querySelectorAll: () => []
};
global.$ = (id) => global.document.getElementById(id);
global.Plotly = { react: () => {} };
eval(appCode);
extractParamsFromDXF(dxf, name);
const dL = window.ugData.left;
const dR = window.ugData.right;
const sp = window.sectionParams;
console.log(`\n======================================================`);
console.log(`[직접 검증 - app.js] ${name}:`);
console.log(` 포장 폭: 좌측=${sp.pavementLeftX}, 우측=${sp.pavementRightX}, 폭=${Math.round(sp.pavementRightX - sp.pavementLeftX)} mm`);
console.log(` 좌측 공동구: wh1=${dL.wh1}, wh2=${dL.wh2}, wh3=${dL.wh3} (합계=${dL.wh1+dL.wh2+dL.wh3} mm), 폭: ww1=${dL.ww1}, ww2=${dL.ww2}, ww3=${dL.ww3}`);
console.log(` 우측 공동구: wh1=${dR.wh1}, wh2=${dR.wh2}, wh3=${dR.wh3} (합계=${dR.wh1+dR.wh2+dR.wh3} mm), 폭: ww1=${dR.ww1}, ww2=${dR.ww2}, ww3=${dR.ww3}`);
console.log(` 배수제원: Ditch dw=${dL.dw}x${dL.dh}, 배수콘크리트 좌=${dL.bch} / 우=${dR.bch}, 유공관 Ø${dL.pipeD || 300}`);
console.log(` 뚜껑/내공: 뚜껑=${dR.lw}x${dR.lh}, 내공=${dR.vw1}x${dR.vh}`);
}
process.chdir('C:/Users/user/.gemini/tunnelsection/TunnelModeler3D');
testDirectApp('Test Sample/세종안성_서운1.dxf', '세종안성_서운1');
testDirectApp('Test Sample/안성구리3_고삼.dxf', '안성구리3_고삼');
testDirectApp('C:/Users/user/.gemini/antigravity/brain/9c348cd5-3f07-4ade-adba-e28b2709935f/scratch/wansan_out/wansan.dxf', '완산터널');
testDirectApp('C:/Users/user/.gemini/antigravity/brain/9c348cd5-3f07-4ade-adba-e28b2709935f/scratch/namhan_out/namhan.dxf', '남한산성터널');
testDirectApp('C:/Users/user/.gemini/antigravity/brain/9c348cd5-3f07-4ade-adba-e28b2709935f/scratch/banga_out/banga.dxf', '방아다리터널');