[Erp5-report] r35272 nicolas - in /erp5/trunk/products/ERP5OOo/tests: ./ test_document/

nobody at svn.erp5.org nobody at svn.erp5.org
Wed May 12 20:07:51 CEST 2010


Author: nicolas
Date: Wed May 12 20:07:51 2010
New Revision: 35272

URL: http://svn.erp5.org?rev=35272&view=rev
Log:
Add Two test
  * To check convertionToBaseFormat of a TextDocument with data encoded into iso-8859-1
  * To check PDF.asText conversion with ocropus as backend (Image embedded inside PDF)

Added:
    erp5/trunk/products/ERP5OOo/tests/test_document/TEST-text-iso8859-1.txt   (with props)
    erp5/trunk/products/ERP5OOo/tests/test_document/TEST.Embedded.Image.pdf   (with props)
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=35272&r1=35271&r2=35272&view=diff
==============================================================================
--- erp5/trunk/products/ERP5OOo/tests/testDms.py [utf8] (original)
+++ erp5/trunk/products/ERP5OOo/tests/testDms.py [utf8] Wed May 12 20:07:51 2010
@@ -1662,6 +1662,32 @@
     web_page.edit()
     self.assertFalse(web_page.hasConversion(format='txt'))
 
+  def test_TextDocument_conversion_to_base_format(self):
+    """Check that any files is converted into utf-8
+    """
+    web_page_portal_type = 'Web Page'
+    module = self.portal.getDefaultModule(web_page_portal_type)
+    upload_file = makeFileUpload('TEST-text-iso8859-1.txt')
+    web_page = module.newContent(portal_type=web_page_portal_type,
+                                 file=upload_file)
+
+    text_content = web_page.getTextContent()
+    my_utf_eight_token = 'ùééàçèîà'
+    text_content = text_content.replace('\n', '\n%s\n' % my_utf_eight_token)
+    web_page.edit(text_content=text_content)
+    self.assertTrue(my_utf_eight_token in web_page.asStrippedHTML())
+    self.assertTrue(isinstance(web_page.asEntireHTML().decode('utf-8'), unicode))
+
+  def test_PDFDocument_asTextConversion(self):
+    """Test a PDF document with embedded images
+    To force usage of Ocropus portal_transform chain
+    """
+    portal_type = 'PDF'
+    module = self.portal.getDefaultModule(portal_type)
+    upload_file = makeFileUpload('TEST.Embedded.Image.pdf')
+    document = module.newContent(portal_type=portal_type, file=upload_file)
+    self.assertEquals(document.asText(), 'ERP5 is a free software.\n')
+
 class TestDocumentWithSecurity(TestDocumentMixin):
 
   username = 'yusei'

Added: erp5/trunk/products/ERP5OOo/tests/test_document/TEST-text-iso8859-1.txt
URL: http://svn.erp5.org/erp5/trunk/products/ERP5OOo/tests/test_document/TEST-text-iso8859-1.txt?rev=35272&view=auto
==============================================================================
--- erp5/trunk/products/ERP5OOo/tests/test_document/TEST-text-iso8859-1.txt (added)
+++ erp5/trunk/products/ERP5OOo/tests/test_document/TEST-text-iso8859-1.txt [utf8] Wed May 12 20:07:51 2010
@@ -1,0 +1,2 @@
+This is a web page encoded in iso-8859-1
+��

Propchange: erp5/trunk/products/ERP5OOo/tests/test_document/TEST-text-iso8859-1.txt
------------------------------------------------------------------------------
    svn:eol-style = native

Added: erp5/trunk/products/ERP5OOo/tests/test_document/TEST.Embedded.Image.pdf
URL: http://svn.erp5.org/erp5/trunk/products/ERP5OOo/tests/test_document/TEST.Embedded.Image.pdf?rev=35272&view=auto
==============================================================================
Binary file - no diff available.

Propchange: erp5/trunk/products/ERP5OOo/tests/test_document/TEST.Embedded.Image.pdf
------------------------------------------------------------------------------
    svn:mime-type = application/octet-stream




More information about the Erp5-report mailing list