add some tests

This commit is contained in:
John Cupitt 2016-09-08 10:41:01 +01:00
parent 4ba083437a
commit d54df515b8
3 changed files with 29 additions and 2 deletions

View File

@ -41,7 +41,7 @@
- added VIPS_ROUND as well as VIPS_RINT
- resize/reduce*/shrink*/affine now round output size to nearest rather than
rounding down, thanks ioquatix
- better overlap support for google maps in dzsave
- better support for tile overlaps in google maps mode in dzsave
19/8/16 started 8.3.4
- better transparency handling in gifload, thanks diegocsandrim

View File

@ -438,6 +438,8 @@ vips_gsf_dir_new( VipsGsfDirectory *parent, const char *name )
(GsfOutfile *) parent->out,
name, TRUE );
g_assert( dir->out );
parent->children = g_slist_prepend( parent->children, dir );
return( dir );

View File

@ -579,7 +579,7 @@ class TestForeign(unittest.TestCase):
# test the overlap for equality
self.colour.dzsave("test", suffix = ".png")
# tes horizontal overlap ... expect 256 step, overlap 1
# test horizontal overlap ... expect 256 step, overlap 1
x = Vips.Image.new_from_file("test_files/10/0_0.png")
self.assertEqual(x.width, 255)
y = Vips.Image.new_from_file("test_files/10/1_0.png")
@ -626,6 +626,31 @@ class TestForeign(unittest.TestCase):
shutil.rmtree("test")
# google layout with overlap ... verify that we clip correctly
# with overlap 192 tile size 256, we should step by 64 pixels each time
# so 3x3 tiles exactly
self.colour.crop(0, 0, 384, 384).dzsave("test2", layout = "google",
overlap = 192, depth = "one")
# test bottom-right tile ... default is 256x256 tiles, overlap 0
x = Vips.Image.new_from_file("test2/0/2/2.jpg")
self.assertEqual(x.width, 256)
self.assertEqual(x.height, 256)
self.assertFalse(os.path.exists("test2/0/3/3.jpg"))
shutil.rmtree("test2")
self.colour.crop(0, 0, 385, 385).dzsave("test3", layout = "google",
overlap = 192, depth = "one")
# test bottom-right tile ... default is 256x256 tiles, overlap 0
x = Vips.Image.new_from_file("test3/0/3/3.jpg")
self.assertEqual(x.width, 256)
self.assertEqual(x.height, 256)
self.assertFalse(os.path.exists("test3/0/4/4.jpg"))
shutil.rmtree("test3")
# default zoomify layout
self.colour.dzsave("test", layout = "zoomify")