From 5a08f5b7bf42c8f04ef1c29796d0ac37e32ae79f Mon Sep 17 00:00:00 2001 From: jvoisin Date: Wed, 24 Oct 2018 20:19:36 +0200 Subject: [PATCH] Add a test for tiff lightweight cleaning --- tests/test_lightweigh_cleaning.py | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) diff --git a/tests/test_lightweigh_cleaning.py b/tests/test_lightweigh_cleaning.py index 5fd7ad6..a115f05 100644 --- a/tests/test_lightweigh_cleaning.py +++ b/tests/test_lightweigh_cleaning.py @@ -80,3 +80,27 @@ class TestLightWeightCleaning(unittest.TestCase): os.remove('./tests/data/clean.torrent') os.remove('./tests/data/clean.cleaned.torrent') + + def test_tiff(self): + shutil.copy('./tests/data/dirty.tiff', './tests/data/clean.tiff') + p = images.TiffParser('./tests/data/clean.tiff') + + meta = p.get_meta() + self.assertEqual(meta['ImageDescription'], 'OLYMPUS DIGITAL CAMERA ') + + p.lightweight_cleaning = True + ret = p.remove_all() + self.assertTrue(ret) + + p = images.TiffParser('./tests/data/clean.cleaned.tiff') + self.assertEqual(p.get_meta(), + { + 'Orientation': 'Horizontal (normal)', + 'ResolutionUnit': 'inches', + 'XResolution': 72, + 'YResolution': 72 + } + ) + + os.remove('./tests/data/clean.tiff') + os.remove('./tests/data/clean.cleaned.tiff')