@@ -0,0 +1,2068 @@
+#-------------------------------------------------------------------------------%0A# Copyright (c) 2011 Anton Golubkov.%0A# All rights reserved. This program and the accompanying materials%0A# are made available under the terms of the GNU Lesser Public License v2.1%0A# which accompanies this distribution, and is available at%0A# http://www.gnu.org/licenses/old-licenses/gpl-2.0.html%0A# %0A# Contributors:%0A#     Anton Golubkov - initial API and implementation%0A#-------------------------------------------------------------------------------%0A#!/usr/bin/python%0A# -*- coding: utf-8 -*-%0A%0Aimport unittest%0Aimport cv%0A%0Aimport os, sys%0Acmd_folder, f = os.path.split(os.path.dirname(os.path.abspath(__file__)))%0Aif cmd_folder not in sys.path:%0A    sys.path.insert(0, cmd_folder)%0A%0A%0Aimport ipf.ipfblock.findlines%0A%0Aclass TestFindLinesBlock(unittest.TestCase):%0A    def setUp(self):%0A        self.block = ipf.ipfblock.findlines.FindLines()%0A        self.block.properties%5B%22distance_resolution%22%5D.set_value(5)%0A        self.block.properties%5B%22angle_resolution%22%5D.set_value(0.1)%0A        self.block.properties%5B%22threshold%22%5D.set_value(70)%0A        self.block.properties%5B%22min_length%22%5D.set_value(140)%0A        self.block.properties%5B%22max_gap%22%5D.set_value(1)%0A        %0A        %0A    def test_zero_image(self):%0A        zero_image = cv.CreateImage( (0, 0), cv.IPL_DEPTH_8U, 1)%0A        self.block.input_ports%5B%22input_image%22%5D.pass_value(zero_image)%0A        self.block.process()%0A        output_array = self.block.output_ports%5B%22output_array%22%5D.get_value()%0A        self.assertTrue(output_array ==  %5B%5D)%0A        %0A    %0A    def test_find_lines(self):%0A        image = cv.LoadImage(%22files/test_adaptive_threshold.png%22)%0A        gray_image = cv.CreateImage(cv.GetSize(image), cv.IPL_DEPTH_8U, 1)%0A        cv.CvtColor(image, gray_image, cv.CV_RGB2GRAY)%0A        self.block.input_ports%5B%22input_image%22%5D.pass_value(gray_image)%0A        self.block.process()%0A        output_array = self.block.output_ports%5B%22output_array%22%5D.get_value()%0A        self.assertTrue(len(output_array) == 8)%0A        %0A%0A%0Aif __name__ == '__main__':%0A    unittest.main()%0A    %0A%0A

Add test case for FindLines block