Commit 7089f235 authored by Kazuhiko Shiozaki's avatar Kazuhiko Shiozaki

add a test for resizing a monochrome tiff image.

parent 033e6d63
......@@ -48,6 +48,7 @@
import unittest
import time
import StringIO
from subprocess import Popen, PIPE
from cgi import FieldStorage
import ZPublisher.HTTPRequest
......@@ -265,7 +266,6 @@ class TestDocument(TestDocumentMixin):
image = Image.open(filename)
image_size = image.size
except ImportError:
from subprocess import Popen, PIPE
identify_output = Popen(['identify', filename],
stdout=PIPE).communicate()[0]
image_size = tuple(map(lambda x:int(x),
......@@ -1344,6 +1344,15 @@ class TestDocument(TestDocumentMixin):
self.assertEquals('Image', document.getPortalType())
self.assertEquals('ERP5 is a free software\n\n', document.asText())
def test_MonochromeImageResize(self):
upload_file = makeFileUpload('monochrome_sample.tiff')
document = self.portal.portal_contributions.newContent(file=upload_file)
self.assertEquals('Image', document.getPortalType())
resized_image = document.convert(format='png', display='small')[1]
identify_output = Popen(['identify', '-verbose', '-'], stdin=PIPE, stdout=PIPE).communicate(resized_image)[0]
self.assertFalse('1-bit' in identify_output)
self.assertEquals('ERP5 is a free software\n\n', document.asText())
def test_Base_showFoundText(self):
# Create document with good content
document = self.portal.document_module.newContent(portal_type='Drawing')
......
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