Commit 95e44f4e authored by Jérome Perrin's avatar Jérome Perrin

when a new image is uploaded, reset the image size information



git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@22935 20353a03-c40f-0410-a6d1-a30d3c3de9de
parent 7b324b49
......@@ -489,6 +489,12 @@ class Image(File, OFSImage):
return (height, width)
return None
def _setFile(self, *args, **kw):
"""set the file content and reset image information.
"""
File._setFile(self, *args, **kw)
self._update_image_info()
#
# FTP/WebDAV support
#
......
......@@ -1202,6 +1202,15 @@ class TestERP5Base(ERP5TypeTestCase):
self.assertEquals('\xff', image_data[0])
self.assertEquals('\xd8', image_data[1])
def test_ImageSize(self):
image = self.portal.newContent(portal_type='Image', id='test_image')
image.edit(file=self.makeImageFileUpload('erp5_logo.png'))
self.assertEquals(320, image.getWidth())
self.assertEquals(250, image.getHeight())
image.edit(file=self.makeImageFileUpload('erp5_logo_small.png'))
self.assertEquals(160, image.getWidth())
self.assertEquals(125, image.getHeight())
def test_Person_getCareerStartDate(self):
# Person_getCareerStartDate scripts returns the date when an employee
# started to work for an employer
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment