feat: a PNG that records 200 DPI or more offers its own size, Manter, and the Prumo says if it was kept (Rodada 5, A1)

The Site reads the pHYs chunk of a loose art; at 200 DPI or more the
size in the file is the default width and a Manter button sits before
the table sizes (also when the art is turned 90 degrees). The source
carries saved_width_cm and saved_dpi, used only by the Prumo report.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
Cauê Faleiros
2026-11-30 11:11:21 -03:00
parent 7e33e6fb1d
commit 7fc091a1bd
8 changed files with 121 additions and 4 deletions

View File

@@ -37,6 +37,30 @@ class PrumoReportTests(unittest.TestCase):
self.assertIn('Prumo levou 41 s', text)
self.assertNotIn('Prumo levou 341 s', text)
def test_saved_png_size_says_whether_the_customer_kept_it(self):
order = self.order()
item = order['snapshot']['items'][0]
item['production']['sources'] = [
{'width_cm': '28.0', 'length_cm': '35.2',
'saved_width_cm': '28.0', 'saved_dpi': 300},
{'width_cm': '20', 'length_cm': '25',
'saved_width_cm': '15', 'saved_dpi': 240},
]
text = '\n'.join(report(order, {'u1': {'name': 'arte.pdf'}}))
self.assertIn('Arte 1: tamanho lido do arquivo 28,0 × 35,2 cm (300 DPI), mantido', text)
self.assertIn('Arte 2: tamanho lido do arquivo 15,0 × 18,8 cm (240 DPI), '
'alterado pelo cliente para 20,0 cm', text)
# Turned 90°: the art's own width is the length along the film.
item['production']['sources'] = [
{'width_cm': '35.2', 'length_cm': '28.0', 'rotation_degrees': 90,
'saved_width_cm': '28.0', 'saved_dpi': 300}]
text = '\n'.join(report(order, {'u1': {'name': 'arte.pdf'}}))
self.assertIn('Arte 1: tamanho lido do arquivo 28,0 × 35,2 cm (300 DPI), mantido', text)
def test_without_a_saved_png_size_no_line_is_added(self):
text = '\n'.join(report(self.order(), {'u1': {'name': 'arte.pdf'}}))
self.assertNotIn('tamanho lido do arquivo', text)
def test_without_a_claim_time_the_generation_line_is_hidden(self):
order = self.order()
del order['print_files'][0]['claimed_at']