Reenabling failing/crashing tests, with fixes

This commit is contained in:
wiredfool 2015-09-14 03:03:24 -07:00
parent b56d5ca403
commit 05348d4f8f
4 changed files with 12 additions and 7 deletions

View File

@ -1230,8 +1230,12 @@ def _save(im, fp, filename):
# Merge the ones that we have with (optional) more bits from
# the original file, e.g x,y resolution so that we can
# save(load('')) == original file.
legacy_ifd = {}
if hasattr(im, 'tag'):
legacy_ifd = im.tag.to_v2()
for k, v in itertools.chain(ifd.items(),
getattr(im, 'ifd', {}).items()):
getattr(im, 'tag_v2', {}).items(),
legacy_ifd.items()):
if k not in atts and k not in blocklist:
if isinstance(v, unicode if bytes is str else str):
atts[k] = v.encode('ascii', 'replace') + b"\0"

View File

@ -198,7 +198,7 @@ class TestFileLibTiff(LibTiffTestCase):
# UNDONE - libtiff defaults to writing in native endian, so
# on big endian, we'll get back mode = 'I;16B' here.
def xtest_big_endian(self):
def test_big_endian(self):
im = Image.open('Tests/images/16bit.MM.deflate.tif')
self.assertEqual(im.getpixel((0, 0)), 480)

View File

@ -308,10 +308,7 @@ class TestFileTiff(PillowTestCase):
self.assertEqual(im.mode, "L")
self.assert_image_similar(im, original, 7.3)
###
# UNDONE
### Segfaulting
def xtest_page_number_x_0(self):
def test_page_number_x_0(self):
# Issue 973
# Test TIFF with tag 297 (Page Number) having value of 0 0.
# The first number is the current page number.

View File

@ -775,7 +775,7 @@ PyImaging_LibTiffEncoderNew(PyObject* self, PyObject* args)
len, intav);
free(intav);
}
} else {
} else if (PyFloat_Check(PyTuple_GetItem(value,0))) {
TRACE((" %d elements, setting as floats \n", len));
floatav = malloc(sizeof(float)*len);
if (floatav) {
@ -787,6 +787,10 @@ PyImaging_LibTiffEncoderNew(PyObject* self, PyObject* args)
len, floatav);
free(floatav);
}
} else {
TRACE(("Unhandled type in tuple for key %d : %s \n",
(int)PyInt_AsLong(key),
PyBytes_AsString(PyObject_Str(value))));
}
}
} else {