The proof card owns its final PNG, keeps its parent locked until the seller answers, enters the queue first, and shares one machine with the parent. The board no longer assigns a machine at payment; the puller records it. A stalled print file times out with a card warning and a retry, finished orders sort by completion, and finals are stored as PNG. The original download carries the order number (items 0.1, 0.4 to 0.7 and 0.9).
28 lines
907 B
Python
28 lines
907 B
Python
"""Final artwork acceptance is based on PNG bytes, alpha and 300 DPI metadata."""
|
|
import io
|
|
import unittest
|
|
|
|
from PIL import Image
|
|
|
|
from app.printpng_validate import final_png_issue
|
|
|
|
|
|
def png(mode='RGBA', dpi=(300, 300)):
|
|
out = io.BytesIO()
|
|
Image.new(mode, (3, 3), (0, 0, 0, 0) if mode == 'RGBA' else (0, 0, 0)).save(out, 'PNG', dpi=dpi)
|
|
return out.getvalue()
|
|
|
|
|
|
class FinalPngTests(unittest.TestCase):
|
|
def test_accepts_only_rgba_300dpi_png(self):
|
|
self.assertIsNone(final_png_issue(png()))
|
|
self.assertIn('precisa ser PNG', final_png_issue(b'%PDF-1.7'))
|
|
self.assertIn('transparência', final_png_issue(png('RGB')))
|
|
self.assertIn('300 DPI', final_png_issue(png(dpi=(72, 72))))
|
|
self.assertIn('300 DPI', final_png_issue(png(dpi=(300, 150))))
|
|
self.assertIn('incompleto', final_png_issue(png()[:50]))
|
|
|
|
|
|
if __name__ == '__main__':
|
|
unittest.main()
|