From 93ab9fd6615b2f7159a7aae3a78ec4d2c913e46f Mon Sep 17 00:00:00 2001 From: John Cupitt Date: Thu, 29 Jan 2015 14:13:51 +0000 Subject: [PATCH] oop, cache fix --- libvips/iofuncs/cache.c | 6 +++--- test/test_resample.py | 15 ++++++++------- 2 files changed, 11 insertions(+), 10 deletions(-) diff --git a/libvips/iofuncs/cache.c b/libvips/iofuncs/cache.c index 57ecba47..f275d82e 100644 --- a/libvips/iofuncs/cache.c +++ b/libvips/iofuncs/cache.c @@ -414,10 +414,10 @@ vips_object_equal_arg( VipsObject *object, */ if( !(argument_class->flags & VIPS_ARGUMENT_REQUIRED) && !vips_object_argument_isset( other, name ) ) - /* Optional and was not set on other ... can't be - * equal. + /* Optional and was not set on other ... we've found a + * difference! */ - return( NULL ); + return( object ); g_value_init( &v1, type ); g_value_init( &v2, type ); diff --git a/test/test_resample.py b/test/test_resample.py index 2e7e0cb0..0babd55d 100755 --- a/test/test_resample.py +++ b/test/test_resample.py @@ -62,16 +62,17 @@ class TestResample(unittest.TestCase): im = Vips.Image.new_from_file("images/IMG_4618.jpg") im2 = im.similarity(angle = 90) im3 = im.affine([0, -1, 1, 0]) + # rounding in calculating the affine transform from the angle stops this + # being exactly true + self.assertTrue((im2 - im3).abs().max() < 50) + + def test_similarity_scale(self): + im = Vips.Image.new_from_file("images/IMG_4618.jpg") + im2 = im.similarity(scale = 2) + im3 = im.affine([2, 0, 0, 2]) im2.write_to_file("im2.v") im3.write_to_file("im3.v") self.assertEqual((im2 - im3).abs().max(), 0) - #im = Vips.Image.new_from_file("images/IMG_4618.jpg") - #im2 = im.similarity(scale = 2) - #im3 = im.affine([2, 0, 0, 2]) - #im2.write_to_file("im2.v") - #im3.write_to_file("im3.v") - #self.assertEqual((im2 - im3).abs().max(), 0) - if __name__ == '__main__': unittest.main()