feat: Dropstar's answers of 23/10 that need nothing more from them
All checks were successful
Build and deploy / Validate source (push) Successful in 1m6s
Build and deploy / Integration suite on a real stack (push) Successful in 4m5s
Build and deploy / Secret scan and release gate (push) Successful in 9s
Build and deploy / Publish images (push) Successful in 2m6s
All checks were successful
Build and deploy / Validate source (push) Successful in 1m6s
Build and deploy / Integration suite on a real stack (push) Successful in 4m5s
Build and deploy / Secret scan and release gate (push) Successful in 9s
Build and deploy / Publish images (push) Successful in 2m6s
- JPG is refused in every product, at upload and by the server: it has no transparency, so the background prints and loose art packs as a box - a PDF over 150 MB says before payment that the Site cannot check it, as a file opened by hand does - every piece that is not square is tried both ways; the 1 cm rule left 19,5 x 18,5 cm standing, 2 to a row instead of 3 - a mirrored order (UV only) is flagged on its card and panel, and its print file's footer ends in ESPELHADO, in bold - print files are named DTF-23-item-1, and the order panel copies DTF-23-, so the code pasted into the folder's search finds them - the proof: up to 30 cm, from the thinnest lines, a piece of each different artwork, at most three per order, free - a file opened by hand costs R$ 2,00 more a metre by default, and the Site says so Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
@@ -122,7 +122,7 @@ try{
|
||||
encaixar=(pieces,width)=>{const result=original(pieces,width);
|
||||
if(pieces.some(p=>p.a))window.lastLayout={altura:result.altura,pos:result.pos.map(p=>({x:p.x,y:p.y,w:p.w,h:p.h,rot:p.rot}))};
|
||||
return result;};
|
||||
window.sendImage=async(type='image/jpeg',drop=false)=>{
|
||||
window.sendImage=async(type='image/png',drop=false)=>{
|
||||
const c=document.createElement('canvas');c.width=200;c.height=400;
|
||||
const ctx=c.getContext('2d');ctx.fillStyle='white';ctx.fillRect(0,0,200,400);
|
||||
ctx.fillStyle='#222';ctx.fillRect(85,20,20,360);ctx.fillRect(25,100,140,20);
|
||||
@@ -173,19 +173,24 @@ try{
|
||||
await evaluate(`folhas=[];pintaFolha()`);
|
||||
await evaluate(`pickTipo('avulsa')`);
|
||||
assert.equal(await evaluate('modo'),'avulsa');
|
||||
// A large JPG artwork cannot be read in parts: it is measured from its
|
||||
// JPG has no transparency: refused in loose artwork as in a sheet (Dropstar,
|
||||
// 2026-10-23), with the reason, before anything is read.
|
||||
await evaluate(`sel([new File(['x'],'arte.jpg',{type:'image/jpeg'})])`);
|
||||
assert.equal(await evaluate(`artes.length===0 && $('recusa').textContent.includes('JPG não dá para enviar')`),true);
|
||||
// A large WebP artwork cannot be read in parts: it is measured from its
|
||||
// header and placed as a full box, with the discount, instead of refused.
|
||||
await evaluate(`(()=>{const h=new Uint8Array(20);h.set([0xFF,0xD8,0xFF,0xC0,0,17,8,0x09,0x3A,0x09,0x3A,3]);
|
||||
const f=new File([h],'arte-grande.jpg');Object.defineProperty(f,'size',{value:400*1048576});sel([f]);})()`);
|
||||
await waitFor(()=>evaluate(`artes.length===1 && artes[0].semPrevia===true`),'large JPG artwork measured from its header');
|
||||
await evaluate(`(()=>{const h=new Uint8Array(30);h.set([0x52,0x49,0x46,0x46,0,0,0,0,0x57,0x45,0x42,0x50,0x56,0x50,0x38,0x58]);
|
||||
h.set([0x39,0x09,0x00,0x39,0x09,0x00],24);
|
||||
const f=new File([h],'arte-grande.webp');Object.defineProperty(f,'size',{value:400*1048576});sel([f]);})()`);
|
||||
await waitFor(()=>evaluate(`artes.length===1 && artes[0].semPrevia===true`),'large WebP artwork measured from its header');
|
||||
await fill('[data-cm]',20);
|
||||
await waitFor(()=>evaluate(`!!itemAtual?.production?.sources?.length`),'large JPG artwork packed');
|
||||
await waitFor(()=>evaluate(`!!itemAtual?.production?.sources?.length`),'large WebP artwork packed');
|
||||
assert.deepEqual(await evaluate(`({dpi:Math.round(dpiDe(artes[0])),src:!!artes[0].src,
|
||||
measurement:itemAtual.production.sources[0].measurement,note:$('lista').textContent.includes('Sem prévia')})`),
|
||||
{dpi:300,src:false,measurement:'file',note:true});
|
||||
await evaluate(`artes=[];pintaArtes()`);
|
||||
await evaluate('sendImage()');
|
||||
await waitFor(()=>evaluate(`artes.length===1 && !!artes[0].src`),'JPG artwork model');
|
||||
await waitFor(()=>evaluate(`artes.length===1 && !!artes[0].src`),'PNG artwork model');
|
||||
assert.deepEqual(await evaluate(`({mode:modo,sheets:folhas.length,width:artes[0].cm,quantity:artes[0].q})`),{mode:'avulsa',sheets:0,width:0,quantity:1});
|
||||
await fill('[data-cm]',20);await fill('[data-q]',6);
|
||||
let layout=await packed(6);
|
||||
@@ -251,6 +256,11 @@ try{
|
||||
assert.deepEqual(await evaluate(`(()=>{const a={};const r=encaixar(Array.from({length:8},()=>({w:30,h:10,img:null,a})),57);
|
||||
return {rot:[...new Set(r.pos.map(p=>p.rot))],altura:+r.altura.toFixed(2)}})()`),
|
||||
{rot:[90],altura:61.5});
|
||||
// Any piece that is not square is tried both ways (Dropstar, 2026-10-23):
|
||||
// 19,5 x 18,5 cm fits 2 to a row standing and 3 lying down.
|
||||
assert.deepEqual(await evaluate(`(()=>{const a={};const r=encaixar(Array.from({length:6},()=>({w:19.5,h:18.5,img:null,a})),57);
|
||||
return {rot:[...new Set(r.pos.map(p=>p.rot))],altura:+r.altura.toFixed(2)}})()`),
|
||||
{rot:[90],altura:40.5});
|
||||
await click('[data-rm]');
|
||||
assert.equal(await evaluate(`artes.length===0 && itemAtual===null && !cartPodeEnviar()`),true,
|
||||
'removed artwork cannot remain in the cart');
|
||||
@@ -408,6 +418,6 @@ try{
|
||||
console.log('Supplied image:',JSON.stringify(layout));
|
||||
}
|
||||
assert.deepEqual(errors,[]);
|
||||
console.log('PASS: JPG/PNG upload and drop, packed copies, 5 mm gaps, aspect ratio, live width/quantity/rotation/mirror, metres, ready-sheet pricing/repeats, residue and solid background stop the order, UV, stale renders, strict inline CSP.');
|
||||
console.log('PASS: PNG upload and drop, JPG refused, packed copies, 5 mm gaps, aspect ratio, live width/quantity/rotation/mirror, metres, ready-sheet pricing/repeats, residue and solid background stop the order, UV, stale renders, strict inline CSP.');
|
||||
}catch(error){console.error(error);if(stderr)console.error(stderr.slice(-1200));process.exitCode=1;}
|
||||
finally{ws?.close();chrome.kill();server.closeAllConnections();await new Promise(r=>server.close(r));}
|
||||
|
||||
@@ -220,7 +220,7 @@ try{
|
||||
await kanban.eval(`(()=>{const check=document.querySelector('[data-order="${oid}"] [data-confirm]');check.click();check.closest('form').requestSubmit();})()`);
|
||||
await waitFor(()=>kanban.eval(`board.orders.find(o=>o.id==='${oid}').version===2`),'final file approval');
|
||||
// Approved before the queue: already on this computer, in Recebidos.
|
||||
const early='pedido-'+await kanban.eval(`board.orders.find(o=>o.id==='${oid}').number`)+'-item-1';
|
||||
const early='DTF-'+await kanban.eval(`board.orders.find(o=>o.id==='${oid}').number`)+'-item-1';
|
||||
await kanban.eval('syncFolder(true)');
|
||||
await waitFor(async()=>(await savedFiles('Recebidos')).some(n=>n.startsWith(early)&&!n.endsWith('.baixando')),'final file saved in Recebidos',45000);
|
||||
assert.equal((await savedFiles()).some(n=>n.startsWith(early)),false);
|
||||
@@ -230,7 +230,7 @@ try{
|
||||
await waitFor(()=>kanban.eval(`board.orders.find(o=>o.id==='${oid}').state==='${state}'`),'transition '+state);
|
||||
if(state==='fil'){
|
||||
// Entering the queue saves its final file there, whole and named after the order.
|
||||
const prefix='pedido-'+await kanban.eval(`board.orders.find(o=>o.id==='${oid}').number`)+'-item-1';
|
||||
const prefix='DTF-'+await kanban.eval(`board.orders.find(o=>o.id==='${oid}').number`)+'-item-1';
|
||||
await waitFor(async()=>(await savedFiles()).some(n=>n.startsWith(prefix)&&!n.endsWith('.baixando')),'final file saved in the folder',45000);
|
||||
// Other orders the earlier suites left in the queue may still be coming
|
||||
// down: only once the round ends must no half-written file be left.
|
||||
|
||||
@@ -98,7 +98,7 @@ def run():
|
||||
early = client.call('/operator/queue/folder', {'early': True, 'held': [oid]}, operator=True)
|
||||
mine = [f for f in early['files'] if f['order'] == oid]
|
||||
assert [(f['upload_id'], f['state']) for f in mine] == [(str(row['upload_id']), 'rec')], early['files']
|
||||
assert mine[0]['name'].startswith('pedido-%d-item-1' % order['number']) and early['states'] == {oid: 'rec'}
|
||||
assert mine[0]['name'].startswith('DTF-%d-item-1' % order['number']) and early['states'] == {oid: 'rec'}
|
||||
late = client.call('/operator/queue/folder', {'early': False, 'held': []}, operator=True)
|
||||
assert not [f for f in late['files'] if f['order'] == oid] and late['states'] == {}
|
||||
client.call('/operator/queue/folder', {'early': True, 'held': []}, expected=401)
|
||||
|
||||
@@ -121,6 +121,20 @@ class PrintFileTests(unittest.TestCase):
|
||||
plain = io.BytesIO()
|
||||
self.assertEqual(render(spec, {0: (path, 'a.png')}, plain, 'test')['page_height_cm'], '10')
|
||||
|
||||
def test_a_mirrored_item_says_so_in_bold_at_the_end(self):
|
||||
from datetime import datetime, timezone
|
||||
from app.printfile import footer_commands
|
||||
from app.printjobs import file_prefix, footer
|
||||
spec = item([placement(0, 0, 20, 10, mirrored=True)], [source(20, 10, mirrored=True)], 10)
|
||||
job = {'snapshot': {'items': [spec, spec]}, 'number': 7, 'item_index': 1,
|
||||
'ordered_at': datetime(2026, 10, 23, 15, 0, tzinfo=timezone.utc)}
|
||||
line = footer(job, spec)
|
||||
self.assertEqual(line, 'DROPSTAR · Pedido DTF-7 · Item 2/2 · 23/10/2026 · 1,00 m · ESPELHADO')
|
||||
self.assertIn(b'/F1 18 Tf ( \xb7 ESPELHADO) Tj', footer_commands(line, (100, 80)))
|
||||
self.assertNotIn(b'ESPELHADO', footer_commands(footer(job, item([placement(0, 0, 20, 10)], [source(20, 10)], 10)), (100, 80)))
|
||||
# The files start with the code the Kanban copies.
|
||||
self.assertEqual(file_prefix(7, 1), 'DTF-7-item-2')
|
||||
|
||||
def test_jpeg_bytes_are_embedded_unchanged(self):
|
||||
path = self.save(quadrants(), 'a.jpg', quality=90)
|
||||
pdf, _ = self.render(item([placement(0, 0, 20, 10)], [source(20, 10)], 10), [path])
|
||||
|
||||
@@ -65,7 +65,7 @@ def run():
|
||||
# The print queue's files come named after their order, straight from storage.
|
||||
queued=customer.call('/operator/queue/finals',operator=True)['files']
|
||||
mine=[f for f in queued if urlopen(f['url']).read()==b'LOCAL FINAL VERSION ONE']
|
||||
assert len(mine)==1 and mine[0]['name'].startswith('pedido-%d-item-1-' % mine[0]['number']), queued
|
||||
assert len(mine)==1 and mine[0]['name'].startswith('DTF-%d-item-1-' % mine[0]['number']), queued
|
||||
customer.call('/operator/queue/finals',expected=401)
|
||||
version=move('imp',version);version=move('cor',version)
|
||||
customer.call('/customer/orders/'+oid+'/files/'+final['id']+'/download',expected=404)
|
||||
|
||||
Reference in New Issue
Block a user