[Erp5-report] r31743 nicolas - /erp5/trunk/products/ERP5OOo/tests/testDms.py

nobody at svn.erp5.org nobody at svn.erp5.org
Thu Jan 14 12:35:41 CET 2010


Author: nicolas
Date: Thu Jan 14 12:35:38 2010
New Revision: 31743

URL: http://svn.erp5.org?rev=31743&view=rev
Log:
Enhance test to check image resizing support.
reviewed by romain

Modified:
    erp5/trunk/products/ERP5OOo/tests/testDms.py

Modified: erp5/trunk/products/ERP5OOo/tests/testDms.py
URL: http://svn.erp5.org/erp5/trunk/products/ERP5OOo/tests/testDms.py?rev=31743&r1=31742&r2=31743&view=diff
==============================================================================
--- erp5/trunk/products/ERP5OOo/tests/testDms.py [utf8] (original)
+++ erp5/trunk/products/ERP5OOo/tests/testDms.py [utf8] Thu Jan 14 12:35:38 2010
@@ -933,7 +933,7 @@
     image = self.portal.getDefaultModule(image_portal_type)\
           .newContent(portal_type=image_portal_type)
 
-    #edit content and publish it
+    # edit content and publish it
     upload_file = makeFileUpload('cmyk_sample.jpg')
     image.edit(reference=image_reference,
                version='001',
@@ -948,10 +948,26 @@
     mime_type, odt_archive = web_page.convert('odt')
     builder = OOoBuilder(odt_archive)
     image_count = builder._image_count
-    failure_message = 'Image is not embedded in ODF zipped archive'
-    #fetch image from zipped archive content then compare with EPR5 Image
+    failure_message = 'Expected image not found in ODF zipped archive'
+    # fetch image from zipped archive content then compare with ERP5 Image
     self.assertEquals(builder.extract('Pictures/%s.jpeg' % image_count),
                       image.getData(), failure_message)
+
+    # Continue the test with image resizing support
+    image_display = 'large'
+    # Add url parameters
+    html_content = '<p><img src="%s?display=%s&quality=75"/></p>' % \
+                                              (image_reference, image_display)
+    web_page.edit(text_content=html_content)
+    mime_type, odt_archive = web_page.convert('odt')
+    builder = OOoBuilder(odt_archive)
+    image_count = builder._image_count
+    # compute resized image for comparison
+    mime, converted_image = image.convert(format='jpeg', display=image_display)
+    # fetch image from zipped archive content
+    # then compare with resized ERP5 Image
+    self.assertEquals(builder.extract('Pictures/%s.jpeg' % image_count),
+                      converted_image, failure_message)
 
 class TestDocumentWithSecurity(ERP5TypeTestCase):
 




More information about the Erp5-report mailing list