"""인쇄범위 쪽 고르기·인쇄양식목록 묶음 바꾸기.""" from test_est_rea_parity import run def test_pick_pages_and_messages(): result = run( "math", """(()=>{ const P=EstPrintRange.pick, err=(f)=>{try{f();return null}catch(e){return e.message}}; return {all:P(5,{mode:'range',from:0,to:0}),mid:P(5,{mode:'range',from:2,to:4}), cur:P(5,{mode:'current',current:9}), over:err(()=>P(5,{mode:'range',from:1,to:6})),rev:err(()=>P(5,{mode:'range',from:4,to:2}))}; })()""", ) assert result == { "all": [0, 1, 2, 3, 4], "mid": [1, 2, 3], "cur": [4], "over": "인쇄범위가 전체쪽수를 넘었습니다.", "rev": "시작페이지가 끝페이지보다 큽니다.", } def test_format_list_snapshot_replaces_print_tables_whole(): result = run( "math", """(()=>{ const a={printCatalog:[{Index:1,Checked:1}],printSettings:{form:'1'},printBatch:{checked:[1]}}; const snap=EstPrintRange.snapshot(a); const b={printCatalog:[{Index:2}],printFormat:[{Index:2}],printSettings:{form:'2'}}; EstPrintRange.apply(b,snap);a.printCatalog[0].Checked=0; return {cat:b.printCatalog,fmt:'printFormat' in b,set:b.printSettings,batch:b.printBatch}; })()""", ) assert result == { "cat": [{"Index": 1, "Checked": 1}], "fmt": False, "set": {"form": "1"}, "batch": {"checked": [1]}, }