feat: the site's third-round corrections on acceptance, DPI and the final file
Residue and thin strokes can be accepted on ready sheets and loose art, with the consent and its time kept on the order. The resolution rule is 96/200 DPI, and a final file must be a transparent 300 DPI PNG. The art score leaves the customer's cart and buy box (Dropstar, 2026-11-05).
This commit is contained in:
@@ -62,25 +62,43 @@ class GradeCheckTests(unittest.TestCase):
|
||||
self.assertEqual(grade_check.pdf_dpi(handle.name), 300)
|
||||
|
||||
def test_grades_follow_the_site(self):
|
||||
# 57 cm is 22.44 in: 6059 px is 270 DPI, grade 90; 3366 px is 150 DPI, grade 50.
|
||||
# 57 cm is 22.44 in: the new clean threshold is 200 DPI.
|
||||
files = FakeFiles({'a.png': encoded('PNG', (6059, 100)), 'b.jpg': encoded('JPEG', (3366, 100)),
|
||||
'tall.png': encoded('PNG', (100, 2362)), 'x.cdr': b'CDR'})
|
||||
rows = {n: {'name': n, 'size': 1} for n in files.blobs}
|
||||
# A sheet takes the worst sheet's grade.
|
||||
self.assertEqual(grade_check.item_grade(files, item('sheet', 0, [('a.png', 57, 0)]), rows), 90)
|
||||
self.assertEqual(grade_check.item_grade(files, item('sheet', 0, [('a.png', 57, 0), ('b.jpg', 57, 0)]), rows), 50)
|
||||
self.assertEqual(grade_check.item_grade(files, item('sheet', 0, [('a.png', 57, 0)]), rows), 100)
|
||||
self.assertEqual(grade_check.item_grade(files, item('sheet', 0, [('a.png', 57, 0), ('b.jpg', 57, 0)]), rows), 75)
|
||||
# Artworks average; a rotated one is measured along its height.
|
||||
self.assertEqual(grade_check.item_grade(files, item('artwork', 0, [('a.png', 57, 0), ('b.jpg', 57, 0)]), rows), 70)
|
||||
self.assertEqual(grade_check.item_grade(files, item('artwork', 0, [('a.png', 57, 0), ('b.jpg', 57, 0)]), rows), 88)
|
||||
self.assertEqual(grade_check.item_grade(files, item('artwork', 0, [('tall.png', 20, 90)]), rows), 100)
|
||||
self.assertIsNone(grade_check.item_grade(files, item('sheet', 0, [('x.cdr', 57, 0)]), rows))
|
||||
# What the cart claims is checked, with a point or two of rounding.
|
||||
claim = lambda g, src: grade_check.mismatch(files, [item('sheet', g, src)], rows)
|
||||
self.assertIsNone(claim(90, [('a.png', 57, 0)]))
|
||||
self.assertIsNone(claim(92, [('a.png', 57, 0)]))
|
||||
self.assertEqual(claim(100, [('a.png', 57, 0)]), 'Nota 100 maior que a do arquivo (90)')
|
||||
self.assertIsNone(claim(100, [('a.png', 57, 0)]))
|
||||
self.assertIsNone(claim(77, [('b.jpg', 57, 0)]))
|
||||
self.assertEqual(claim(100, [('b.jpg', 57, 0)]), 'Nota 100 maior que a do arquivo (75)')
|
||||
self.assertEqual(claim(40, [('x.cdr', 57, 0)]), 'Nota não conferida no servidor')
|
||||
self.assertIsNone(claim(0, [('x.cdr', 57, 0)]))
|
||||
|
||||
def test_resolution_boundaries_and_consent(self):
|
||||
width = lambda dpi: int(dpi * 57 / 2.54) + 1
|
||||
files = FakeFiles({f'{dpi}.png': encoded('PNG', (width(dpi), 20))
|
||||
for dpi in (95, 96, 199, 200, 287, 293)})
|
||||
rows = {name: {'name': name, 'size': 1} for name in files.blobs}
|
||||
def issue(dpi, status='ok', acknowledged=False):
|
||||
spec = item('sheet', 0, [(f'{dpi}.png', 57, 0)])
|
||||
spec.update(quality_status=status, quality_acknowledged=acknowledged)
|
||||
return grade_check.resolution_issue(files, [spec], rows)
|
||||
self.assertIn('abaixo do mínimo', issue(95))
|
||||
self.assertIn('confirme a ressalva', issue(96))
|
||||
self.assertIn('confirme a ressalva', issue(199))
|
||||
self.assertIsNone(issue(96, 'warning', True))
|
||||
self.assertIsNone(issue(199, 'warning', True))
|
||||
for dpi in (200, 287, 293):
|
||||
self.assertIsNone(issue(dpi), dpi)
|
||||
self.assertEqual(grade_check.grade_of(dpi), 100)
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
unittest.main()
|
||||
|
||||
Reference in New Issue
Block a user