basic tests
This commit is contained in:
parent
0b646ffcc7
commit
2590559e56
4
TODO
4
TODO
@ -1,8 +1,6 @@
|
||||
- save a 16-bit image to tiff with jpg compression ... should it autoconvert?
|
||||
|
||||
- add a set of tests for orientation
|
||||
|
||||
test autorotate flags on tiff and jpeg
|
||||
- test autorotate flags on tiff and jpeg
|
||||
|
||||
see https://github.com/jcupitt/libvips/issues/243
|
||||
|
||||
|
@ -176,15 +176,31 @@ class TestForeign(unittest.TestCase):
|
||||
if have_exif:
|
||||
# we need a copy of the image to set the new metadata on
|
||||
# otherwise we get caching problems
|
||||
x = Vips.Image.new_from_file(self.jpeg_file)
|
||||
x = x.copy()
|
||||
x.set_value("orientation", 2)
|
||||
x.write_to_file("test.jpg")
|
||||
x = Vips.Image.new_from_file("test.jpg")
|
||||
y = x.get_value("orientation")
|
||||
self.assertEqual(y, 2)
|
||||
|
||||
os.unlink("test.jpg")
|
||||
|
||||
x = Vips.Image.new_from_file(self.jpeg_file)
|
||||
x = x.copy()
|
||||
x.set_value("orientation", 2)
|
||||
x.write_to_file("test-12.jpg")
|
||||
|
||||
x = Vips.Image.new_from_file("test-12.jpg")
|
||||
y = x.get_value("orientation")
|
||||
self.assertEqual(y, 2)
|
||||
x.remove("orientation")
|
||||
x.write_to_file("test-13.jpg")
|
||||
x = Vips.Image.new_from_file("test-13.jpg")
|
||||
y = x.get_value("orientation")
|
||||
self.assertEqual(y, 1)
|
||||
os.unlink("test-12.jpg")
|
||||
os.unlink("test-13.jpg")
|
||||
|
||||
def test_png(self):
|
||||
x = Vips.type_find("VipsForeign", "pngload")
|
||||
if not x.is_instantiatable():
|
||||
@ -251,6 +267,24 @@ class TestForeign(unittest.TestCase):
|
||||
self.assertEqual(y, 2)
|
||||
os.unlink("test-11.tif")
|
||||
|
||||
# we need a copy of the image to set the new metadata on
|
||||
# otherwise we get caching problems
|
||||
x = Vips.Image.new_from_file(self.tiff_file)
|
||||
x = x.copy()
|
||||
x.set_value("orientation", 2)
|
||||
x.write_to_file("test-12.tif")
|
||||
|
||||
x = Vips.Image.new_from_file("test-12.tif")
|
||||
y = x.get_value("orientation")
|
||||
self.assertEqual(y, 2)
|
||||
x.remove("orientation")
|
||||
x.write_to_file("test-13.tif")
|
||||
x = Vips.Image.new_from_file("test-13.tif")
|
||||
y = x.get_value("orientation")
|
||||
self.assertEqual(y, 1)
|
||||
os.unlink("test-12.tif")
|
||||
os.unlink("test-13.tif")
|
||||
|
||||
def test_magickload(self):
|
||||
x = Vips.type_find("VipsForeign", "magickload")
|
||||
if not x.is_instantiatable():
|
||||
|
Loading…
Reference in New Issue
Block a user