[FIX] base: correct unit test for compatibility with PIL 7.0
The unit test in `test_base_document_layout` does not pass with version 7.0.0 of PIL, which is loaded by default on Ubuntu 20.04. The reason is that the color obtained from the image is slightly different. This fix slightly relaxes the test (in fact we don't care about the exact color obtained in this test, we just want to make sure that it doesn't crash) opw-2342394 (original ticket) closes odoo/odoo#60071 X-original-commit: 99b3f0be1b322ee469871f9496527e8dc3e778bb Signed-off-by: Thomas Dieuzeide <tdi-odoo@users.noreply.github.com> Signed-off-by: Nicolas Galler <nicocrm@users.noreply.github.com>
This commit is contained in:
@@ -195,7 +195,7 @@ class TestBaseDocumentLayout(TestBaseDocumentLayoutHelpers):
|
||||
self.assertColors(doc_layout, self.company_imgs['sweden']['colors'])
|
||||
|
||||
def test_parse_company_colors_grayscale(self):
|
||||
"""Grayscale images with transparency"""
|
||||
"""Grayscale images with transparency - make sure the color extraction does not crash"""
|
||||
self.company.write({
|
||||
'primary_color': '#ff0080',
|
||||
'secondary_color': '#00ff00',
|
||||
@@ -205,7 +205,7 @@ class TestBaseDocumentLayout(TestBaseDocumentLayoutHelpers):
|
||||
with Image.open(os.path.join(dir_path, 'logo_ci.png'), 'r') as img:
|
||||
base64_img = image_to_base64(img, 'PNG')
|
||||
doc_layout.logo = base64_img
|
||||
self.assertEqual('#8d8d8d', doc_layout.primary_color)
|
||||
self.assertNotEqual(None, doc_layout.primary_color)
|
||||
|
||||
|
||||
# /!\ This case is NOT supported, and probably not supportable
|
||||
|
||||
Reference in New Issue
Block a user