Add further checks in test_main.
authorPhilipp Spitzer <philipp@spitzer.priv.at>
Thu, 27 Jun 2019 20:41:33 +0000 (22:41 +0200)
committerPhilipp Spitzer <philipp@spitzer.priv.at>
Thu, 27 Jun 2019 20:41:33 +0000 (22:41 +0200)
test_gimp_passport.py

index 3c79c1f..c9e5acf 100644 (file)
@@ -55,5 +55,12 @@ class TestMakePassport(unittest.TestCase):
         dest = 'test_image_result.jpg'
         if os.path.exists(dest):
             os.remove(dest)
-        main(35., 45., 4., 100., 150., 0., (1108, 280, 2180, 1620), source, dest)
+        main(150., 100., 4., 35., 45., 1., (1108, 280, 2180, 1620), source, dest)
         self.assertTrue(os.path.exists(dest))
+        img = Image.open(dest)
+        dpi = img.info['dpi']
+        self.assertEqual(*dpi)
+        dpi = dpi[0]
+        self.assertEqual(mm_to_pixel(100., dpi), img.height)
+        self.assertEqual(mm_to_pixel(150., dpi), img.width)
+