diff --git a/build.xml b/build.xml new file mode 100644 index 0000000..1cffd0a --- /dev/null +++ b/build.xml @@ -0,0 +1,27 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/tippy/tests/test_basic_operations.py b/tippy/tests/test_basic_operations.py index c942939..296c1bf 100644 --- a/tippy/tests/test_basic_operations.py +++ b/tippy/tests/test_basic_operations.py @@ -7,11 +7,11 @@ Created on Nov 19, 2011 @email: julien@lengrand.fr ''' - import cv -import tippy.basic_operations as bo import unittest +import tippy.basic_operations as bo + class Test(unittest.TestCase): """ The class inherits from unittest @@ -20,8 +20,8 @@ class Test(unittest.TestCase): """ This method is called before each test """ - self.img_1c = cv.LoadImage("../data/tippy.jpg", cv.CV_LOAD_IMAGE_GRAYSCALE) # 1 channel image - self.img_3c = cv.LoadImage("../data/tippy.jpg", cv.CV_LOAD_IMAGE_COLOR) # 3 channel image + self.img_1c = cv.LoadImage("data/tippy.jpg", cv.CV_LOAD_IMAGE_GRAYSCALE) # 1 channel image + self.img_3c = cv.LoadImage("data/tippy.jpg", cv.CV_LOAD_IMAGE_COLOR) # 3 channel image self.img_fake_2c = cv.CreateImage((15, 15), cv.IPL_DEPTH_8U, 2) # 2 channels self.fake_img = 10 # non Image @@ -44,15 +44,15 @@ class Test(unittest.TestCase): self.assertEqual(img.depth, out_img.depth) self.assertEqual(cv.GetSize(img), cv.GetSize(out_img)) self.assertRaises(TypeError, lambda: bo.create_same_image(self.fake_img)) - + def test_mouse_point(self): # img test self.assertRaises(TypeError, lambda: bo.mouse_point(self.fake_img)) # name test - self.assertRaises(TypeError, lambda: bo.mouse_point(self.fake_name)) + self.assertRaises(TypeError, lambda: bo.mouse_point(self.img_3c, self.fake_name)) # mode test - self.assertRaises(TypeError, lambda: bo.mouse_point(self.fake_mode)) - self.assertRaises(ValueError, lambda: bo.mouse_point(self.false_mode)) + self.assertRaises(TypeError, lambda: bo.mouse_point(self.img_3c, mode=self.fake_mode)) + self.assertRaises(ValueError, lambda: bo.mouse_point(self.img_3c, mode=self.false_mode)) # TODO: How to test arguments that need user interaction? #if __name__ == "__main__": diff --git a/tippy/tests/test_display_operations.py b/tippy/tests/test_display_operations.py index e367b17..eadfd33 100644 --- a/tippy/tests/test_display_operations.py +++ b/tippy/tests/test_display_operations.py @@ -8,6 +8,7 @@ Created on Nov 24, 2011 ''' import unittest import cv + import tippy.display_operations as do class Test(unittest.TestCase): @@ -18,7 +19,7 @@ class Test(unittest.TestCase): """ This method is called before each test """ - self.img = cv.LoadImage("../data/tippy.jpg", cv.CV_LOAD_IMAGE_COLOR) # 3 channel image + self.img = cv.LoadImage("data/tippy.jpg", cv.CV_LOAD_IMAGE_COLOR) # 3 channel image self.fake_img = 10 # non Image def tearDown(self): diff --git a/tippy/tests/test_segmentation.py b/tippy/tests/test_segmentation.py index 2b59beb..b83b890 100644 --- a/tippy/tests/test_segmentation.py +++ b/tippy/tests/test_segmentation.py @@ -10,14 +10,12 @@ import cv import tippy.segmentations as se class Test(unittest.TestCase): - - def setUp(self): """ This method is called before each test """ - self.img_1c = cv.LoadImage("../data/tippy.jpg", cv.CV_LOAD_IMAGE_GRAYSCALE) # 1 channel image - self.img_3c = cv.LoadImage("../data/tippy.jpg", cv.CV_LOAD_IMAGE_COLOR) # 3 channel image + self.img_1c = cv.LoadImage("data/tippy.jpg", cv.CV_LOAD_IMAGE_GRAYSCALE) # 1 channel image + self.img_3c = cv.LoadImage("data/tippy.jpg", cv.CV_LOAD_IMAGE_COLOR) # 3 channel image self.img_16s = cv.CreateImage((15, 15), cv.IPL_DEPTH_16S, 1) # Non 8 bits image self.fake_img = 10 # non Image @@ -70,11 +68,11 @@ class Test(unittest.TestCase): self.assertRaises(ValueError, lambda: se.simple_region_growing(self.img_1c, self.seed, self.thres, self.other_conn)) # function result tests # 4-conn - img_gnu = cv.LoadImage("../data/gnu.jpg", cv.CV_LOAD_IMAGE_GRAYSCALE) # 1 channel image + img_gnu = cv.LoadImage("data/gnu.jpg", cv.CV_LOAD_IMAGE_GRAYSCALE) # 1 channel image out_img = se.simple_region_growing(img_gnu, seed=(70, 106), threshold=20) self.assertEqual(cv.CountNonZero(out_img), 584) # 8-conn - img_gnu = cv.LoadImage("../data/gnu.jpg", cv.CV_LOAD_IMAGE_GRAYSCALE) # 1 channel image + img_gnu = cv.LoadImage("data/gnu.jpg", cv.CV_LOAD_IMAGE_GRAYSCALE) # 1 channel image out_img = se.simple_region_growing(img_gnu, seed=(70, 106), threshold=20, conn=8) self.assertEqual(cv.CountNonZero(out_img), 627)