- 고른 내역 행을 차수 하나의 놓을 행부터 복사 - 수량·단가금액·명칭규격 고르기, 설계변경 상단/하단, 행 금액 다시 셈 - 내역서 도구줄과 연차 화면에 단추 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
47 lines
2.2 KiB
Python
47 lines
2.2 KiB
Python
"""연차 데이타 복사 옵션: 덮어쓰기·열 삽입·복사내용 게이트·상단(당초) 값·끝 행 넘침."""
|
|
|
|
from test_est_rea_parity import run
|
|
|
|
|
|
def test_overwrite_copies_chosen_groups_and_recalculates_amounts():
|
|
result = run(
|
|
"math",
|
|
"""(()=>{
|
|
const p=EstNative.empty();
|
|
p.tables.EstMainDat=[{Code:'A',Name:'a',Size:'s',GN:2,NU:10,GU:5},{Code:'B',Name:'b',GN:3,NU:1,GU:1},
|
|
{Code:'C',Name:'c',GN:1,NU:7,GU:0,GN_:4,Name_:'c0'}];
|
|
p.annual=[{name:'1차',formula:'[기준]'},{name:'2차',formula:'[기준]',rows:[]}];
|
|
const n=EstAnnualCopy.apply(p,{sources:[0,2],target:1,year:0,insert:false,name:false,gn:true,cost:false});
|
|
const r=p.annual[0].rows;
|
|
const q=structuredClone(p);
|
|
const m=EstAnnualCopy.apply(q,{sources:[2],target:2,year:1,insert:false,name:true,gn:true,cost:true,top:true});
|
|
const over=EstAnnualCopy.apply(structuredClone(p),{sources:[0,1,2],target:2,year:0,name:true,gn:true,cost:true});
|
|
return {n,len:r.length,first:r[0],row1:[r[1].Name,r[1].GN,r[1].NC,r[1].GC,r[1].TC],row2:[r[2].Name,r[2].GN,r[2].NC],
|
|
top:[q.annual[1].rows[2].Name,q.annual[1].rows[2].GN,q.annual[1].rows[2].NC],m,over,
|
|
parse:EstAnnualCopy.parse('1-3, 5')};
|
|
})()""",
|
|
)
|
|
assert result["n"] == 2
|
|
assert result["first"] is None
|
|
assert result["row1"] == ["b", 2, 2, 2, 4]
|
|
assert result["row2"] == ["c", 1, 7]
|
|
assert result["top"] == ["c0", 4, 28]
|
|
assert result["m"] == 1
|
|
assert result["over"] == 1
|
|
assert result["parse"] == [0, 1, 2, 4]
|
|
|
|
|
|
def test_insert_mode_shifts_main_and_every_loaded_year():
|
|
result = run(
|
|
"math",
|
|
"""(()=>{
|
|
const p=EstNative.empty();
|
|
p.tables.EstMainDat=[{Name:'a',GN:1,NU:1},{Name:'b',GN:1,NU:1}];
|
|
p.annual=[{name:'1차',formula:'[기준]'},{name:'2차',formula:'[기준]',rows:[{Name:'x'},{Name:'y'}]}];
|
|
EstAnnualCopy.apply(p,{sources:[1],target:1,year:0,insert:true,name:true,gn:true,cost:true});
|
|
return {main:p.tables.EstMainDat.map(r=>r.Name??null),y1:p.annual[0].rows.map(r=>r?.Name??null),
|
|
y2:p.annual[1].rows.map(r=>r?.Name??null)};
|
|
})()""",
|
|
)
|
|
assert result == {"main": ["a", None, "b"], "y1": [None, "b"], "y2": ["x", None, "y"]}
|