more tests

This commit is contained in:
John Cupitt 2014-09-15 13:58:31 +01:00
parent 24ff40e9be
commit a82fa01781
3 changed files with 22 additions and 4 deletions

8
TODO
View File

@ -1,11 +1,13 @@
- python:
- try
- draw_circle() etc. should copy() the image before writing, and
return the copy
python test_arithmetic.py -v TestArithmetic.test_histfind
accidental segvs are too easy otherwise :(
segv
draw.c should declare arg as VIPS_ARGUMENT_REQUIRED_INPUT_OUTPUT
maybe?
- could import like this:

View File

@ -262,7 +262,7 @@ vips_hough_circle_class_init( VipsHoughClass *class )
static void
vips_hough_circle_init( VipsHoughCircle *hough_circle )
{
hough_circle->scale = 3;
hough_circle->scale = 1;
hough_circle->min_radius = 10;
hough_circle->max_radius = 20;
}

View File

@ -342,5 +342,21 @@ class TestArithmetic(unittest.TestCase):
self.assertAlmostEqualObjects(hist.getpoint(0,0), [0])
self.assertAlmostEqualObjects(hist.getpoint(1,0), [50000])
def test_histfind_ndim(self):
im = Vips.Image.black(100, 100) + [1, 2, 3]
for fmt in noncomplex_formats:
hist = im.cast(fmt).hist_find_ndim()
self.assertAlmostEqualObjects(hist.getpoint(0,0)[0], 10000)
self.assertAlmostEqualObjects(hist.getpoint(5,5)[5], 0)
hist = im.cast(fmt).hist_find_ndim(bins = 1)
self.assertAlmostEqualObjects(hist.getpoint(0,0)[0], 10000)
self.assertEqual(hist.width, 1)
self.assertEqual(hist.height, 1)
self.assertEqual(hist.bands, 1)
if __name__ == '__main__':
unittest.main()