diff --git a/tests/artwork_browser_test.mjs b/tests/artwork_browser_test.mjs index 408f35c..dbcfc55 100644 --- a/tests/artwork_browser_test.mjs +++ b/tests/artwork_browser_test.mjs @@ -153,9 +153,18 @@ try{ assert.deepEqual(await evaluate(`({shown:!$('tipoEnvio').hidden, on:[...document.querySelectorAll('#tipoEnvio .cam.on')].map(b=>b.dataset.tipo)})`), {shown:true,on:['folha']}); - await evaluate(`(()=>{const f=new File(['x'],'oversize.cdr');Object.defineProperty(f,'size',{value:128*1048576+1});sel([f]);})()`); - assert.equal(await evaluate(`folhas.length===0 && $('recusa').textContent.includes('128 MB')`),true, - 'files beyond the scanner limit are rejected before browser analysis'); + await evaluate(`(()=>{const f=new File(['x'],'oversize.cdr');Object.defineProperty(f,'size',{value:5*1073741824+1});sel([f]);})()`); + assert.equal(await evaluate(`folhas.length===0 && $('recusa').textContent.includes('5 GB')`),true, + 'files beyond the 5 GB upload limit are rejected before browser analysis'); + // A multi-GB sheet is the normal order: graded from the pixel size in its + // header, never decoded. 6732 x 35433 px across 57 cm is 3 m at 300 DPI. + await evaluate(`(()=>{const h=new Uint8Array(33);h.set([0x89,0x50,0x4E,0x47,0x0D,0x0A,0x1A,0x0A,0,0,0,13,0x49,0x48,0x44,0x52]); + const v=new DataView(h.buffer);v.setUint32(16,6732);v.setUint32(20,35433);h.set([8,6,0,0,0],24); + const f=new File([h],'folha-grande.png');Object.defineProperty(f,'size',{value:3*1073741824});sel([f]);})()`); + await waitFor(()=>evaluate(`folhas.length===1 && !!folhas[0].an`),'large sheet graded from its header'); + assert.deepEqual(await evaluate(`({grande:folhas[0].an.grande,dpi:folhas[0].an.dpi,alt:folhas[0].med.alt,preview:!!folhas[0].previewSrc})`), + {grande:true,dpi:300,alt:300,preview:false}); + await evaluate(`folhas=[];pintaFolha()`); await evaluate(`pickTipo('avulsa')`); assert.equal(await evaluate('modo'),'avulsa'); await evaluate('sendImage()');