Add warnings to deprecated CMS profile attributes

This commit is contained in:
Hugo 2019-01-28 09:01:02 +02:00
parent 80f69ad32e
commit e7eac4f80b
2 changed files with 14 additions and 2 deletions

View File

@ -309,7 +309,11 @@ class TestImageCms(PillowTestCase):
2: (False, False, True),
3: (False, False, True)
})
self.assertEqual(p.color_space, 'RGB')
# p.color_space
result = self.assert_warning(DeprecationWarning, getattr, p, "color_space")
self.assertEqual(result, 'RGB')
self.assertIsNone(p.colorant_table)
self.assertIsNone(p.colorant_table_out)
self.assertIsNone(p.colorimetric_intent)
@ -361,7 +365,11 @@ class TestImageCms(PillowTestCase):
(5000.722328847392,))
self.assertEqual(p.model,
'IEC 61966-2-1 Default RGB Colour Space - sRGB')
self.assertEqual(p.pcs, 'XYZ')
# p.pcs
result = self.assert_warning(DeprecationWarning, getattr, p, "pcs")
self.assertEqual(result, 'XYZ')
self.assertIsNone(p.perceptual_rendering_intent_gamut)
self.assertEqual(p.product_copyright,
'Copyright International Color Consortium, 2009')

View File

@ -1005,12 +1005,16 @@ cms_profile_getattr_rendering_intent(CmsProfileObject* self, void* closure)
static PyObject*
cms_profile_getattr_pcs(CmsProfileObject* self, void* closure)
{
PyErr_WarnEx(PyExc_DeprecationWarning,
"cms is deprecated. Use padded connection_space instead.", 1);
return PyUnicode_DecodeFSDefault(findICmode(cmsGetPCS(self->profile)));
}
static PyObject*
cms_profile_getattr_color_space(CmsProfileObject* self, void* closure)
{
PyErr_WarnEx(PyExc_DeprecationWarning,
"color_space is deprecated. Use padded xcolor_space instead.", 1);
return PyUnicode_DecodeFSDefault(findICmode(cmsGetColorSpace(self->profile)));
}