[Erp5-report] r31649 nicolas - /erp5/trunk/products/ERP5OOo/tests/testDms.py
nobody at svn.erp5.org
nobody at svn.erp5.org
Thu Jan 7 18:11:23 CET 2010
Author: nicolas
Date: Thu Jan 7 18:11:23 2010
New Revision: 31649
URL: http://svn.erp5.org?rev=31649&view=rev
Log:
Check HTML to ODT Conversion with embedded images, 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=31649&r1=31648&r2=31649&view=diff
==============================================================================
--- erp5/trunk/products/ERP5OOo/tests/testDms.py [utf8] (original)
+++ erp5/trunk/products/ERP5OOo/tests/testDms.py [utf8] Thu Jan 7 18:11:23 2010
@@ -56,6 +56,7 @@
from Products.ERP5Type.tests.ERP5TypeTestCase import ERP5TypeTestCase
from Products.ERP5Type.tests.utils import FileUpload
from Products.ERP5Type.tests.utils import DummyLocalizer
+from Products.ERP5OOo.OOoUtils import OOoBuilder
from AccessControl.SecurityManagement import newSecurityManager
from zLOG import LOG
from Products.ERP5.Document.Document import NotConvertedError
@@ -913,6 +914,44 @@
filename='test.pdf')
self.assertTrue(string_to_test in text_content)
+ def test_HTML_to_ODT_conversion_keep_related_image_list(self):
+ """This test create a Web Page and an Image.
+ HTML content of Web Page referred to that Image with it's reference.
+ Check that ODT conversion of Web Page embed image data.
+ """
+ # create web page
+ web_page_portal_type = 'Web Page'
+ web_page = self.portal.getDefaultModule(web_page_portal_type)\
+ .newContent(portal_type=web_page_portal_type)
+ image_reference = 'MY-TESTED-IMAGE'
+ # Target image with it reference only
+ html_content = '<p><img src="%s"/></p>' % image_reference
+ web_page.edit(text_content=html_content)
+
+ # Create image
+ image_portal_type = 'Image'
+ image = self.portal.getDefaultModule(image_portal_type)\
+ .newContent(portal_type=image_portal_type)
+
+ #edit content and publish it
+ upload_file = makeFileUpload('cmyk_sample.jpg')
+ image.edit(reference=image_reference,
+ version='001',
+ language='en',
+ file=upload_file)
+ image.publish()
+
+ transaction.commit()
+ self.tic()
+
+ # convert web_page into odt
+ 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
+ self.assertEquals(builder.extract('Pictures/%s.jpeg' % image_count),
+ image.getData(), failure_message)
class TestDocumentWithSecurity(ERP5TypeTestCase):
More information about the Erp5-report
mailing list