From 7a1266f584e1056f53f85ff0c44e80c39f04196c Mon Sep 17 00:00:00 2001 From: Nicolas Delaby <nicolas@nexedi.com> Date: Wed, 12 May 2010 18:07:51 +0000 Subject: [PATCH] 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) git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@35272 20353a03-c40f-0410-a6d1-a30d3c3de9de --- product/ERP5OOo/tests/testDms.py | 26 ++++++++++++++++++ .../test_document/TEST-text-iso8859-1.txt | 2 ++ .../test_document/TEST.Embedded.Image.pdf | Bin 0 -> 5829 bytes 3 files changed, 28 insertions(+) create mode 100644 product/ERP5OOo/tests/test_document/TEST-text-iso8859-1.txt create mode 100644 product/ERP5OOo/tests/test_document/TEST.Embedded.Image.pdf diff --git a/product/ERP5OOo/tests/testDms.py b/product/ERP5OOo/tests/testDms.py index de30b7e523..776cf841e9 100644 --- a/product/ERP5OOo/tests/testDms.py +++ b/product/ERP5OOo/tests/testDms.py @@ -1662,6 +1662,32 @@ style=3D'color:black'>05D65812<o:p></o:p></span></p> 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' diff --git a/product/ERP5OOo/tests/test_document/TEST-text-iso8859-1.txt b/product/ERP5OOo/tests/test_document/TEST-text-iso8859-1.txt new file mode 100644 index 0000000000..524a1d0cf1 --- /dev/null +++ b/product/ERP5OOo/tests/test_document/TEST-text-iso8859-1.txt @@ -0,0 +1,2 @@ +This is a web page encoded in iso-8859-1 +éèàùôâïî diff --git a/product/ERP5OOo/tests/test_document/TEST.Embedded.Image.pdf b/product/ERP5OOo/tests/test_document/TEST.Embedded.Image.pdf new file mode 100644 index 0000000000000000000000000000000000000000..2bbe41986356c4a8fc1b42f5cde7084dfb435254 GIT binary patch literal 5829 zcmb7I3p~?p``>JH7_rG5a%d)U-g(Ytwvi~zM5HjoG#f)9^-$zYIyiKYloE1CDmg?% zMWG&*&JO87gh*2Uzv-!`_j&*S_x=2@{kHpeU)ObChx@+n&wcN!?M$~d!W)y|+O20= z8(J^7o`e(7IJCeo7;b5ab>#2^BZAOGfWySva(NLPA=Z}X8^NJ-*aCmfnl<q72qDKe z1Riyq*h6ILzR_ploN=Iwjz$}1(ou$vGBbv#R3_?1t-{n*F%%pnvmt$^OQ9<x<5Rjq z`Z7an{fv01qrK)jgg?|-+5SScjnFu^DX=1CuS1g!x(5w<oTAtY=kWdi@&dex0)va< z5xtn<MZzT(>F=Of(V-lyhm&70haG`+jr5BU_3cA^136fCuD>W9oGBW+j>8QMia?Wz zXsiu4BHWoHqzOVo1$+)a0u6|10-iwV8tTjDVCkG4TsDVkXY+Fg=rq=k{D005i9|5_ zdoC6qFTMgH*4x_Kg1}%92n>8ci%&r`5JXH&^Z*0}9+)Hy28F`l5)$H)GH@9gX}GlX zGFf@VGFhaov@}8yfn2VDLZM{jl#~?}l;ssr3L+z52rvc;lY+sd6qZRZQ}}<=;tdc| z5<~`*AYcqg3<-u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