Commit 66c11a7a authored by Tristan Cavelier's avatar Tristan Cavelier

update unit test img preconversion from web page content

The 75 is the default value is most cases, I changed to 64 to be sure.
A useful comment is also added.
parent 9c66146f
......@@ -40,7 +40,7 @@ class TestDocumentWithPreConversion(TestDocument):
def getTitle(self):
return "DMS with Preconversion"
def test_preConvertedEmbeddedImageInWebPageContent(self):
def test_preConvertedReferencedImageInWebPageContent(self):
# create an image
upload_file = makeFileUpload('cmyk_sample.jpg')
image = self.portal.image_module.newContent(portal_type='Image',
......@@ -51,17 +51,20 @@ class TestDocumentWithPreConversion(TestDocument):
image.publish()
self.tic()
# after a web page creation, the referenced images are found and should be pre converted
# with the parameters given in their src URL
web_page = self.portal.web_page_module.newContent(portal_type="Web Page")
web_page.setTextContent('''<b> test </b>
<img src="Embedded-XXX?format=png&display=large&quality=75"/>
<img src="Embedded-XXX?format=jpeg&display=large&quality=75"/>''')
<img src="Embedded-XXX?format=png&display=large&quality=64"/>
<img src="Embedded-XXX?format=jpeg&display=large&quality=64"/>''')
web_page.publish()
self.tic()
# check that referenced in Web Page's content image(s) is well converted
self.assertTrue(image.hasConversion(**{'format':'jpeg', 'display':'large', 'quality':75}))
self.assertTrue(image.hasConversion(**{'format':'png', 'display':'large', 'quality':75}))
self.assertSameSet(['Embedded-XXX?format=png&display=large&quality=75', \
'Embedded-XXX?format=jpeg&display=large&quality=75'],
self.assertTrue(image.hasConversion(**{'format':'jpeg', 'display':'large', 'quality':64}))
self.assertTrue(image.hasConversion(**{'format':'png', 'display':'large', 'quality':64}))
self.assertSameSet(['Embedded-XXX?format=png&display=large&quality=64', \
'Embedded-XXX?format=jpeg&display=large&quality=64'],
web_page.Base_extractImageUrlList())
def test_Base_isConvertible(self):
......
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