TestImageCropper package

Submodules

TestImageCropper.test_AutoDetect module

This module is responsible for testing the AutoDetect module.

TestImageCropper.test_AutoDetect.test_01()

This test feeds AutoDetect a test image and compares the result to the correct coordinates.

The test image contains a rotated calculator. The expected coordinates represent the screen. The difference between the actual en returned coordinates are compared with a tolerance, so everyting within that margin is accepted.

TestImageCropper.test_Crop module

This module is responsible for testing the Crop module.

TestImageCropper.test_Crop.assert_crop_straight(straight_image)
TestImageCropper.test_Crop.assert_crop_rotate(rotate_image)
TestImageCropper.test_Crop.test_crop_straight()
TestImageCropper.test_Crop.test_crop_45angle()
TestImageCropper.test_Crop.test_crop_vertical1()
TestImageCropper.test_Crop.test_crop_vertical2()
TestImageCropper.test_Crop.test_crop_wrong_contour1()
TestImageCropper.test_Crop.test_crop_wrong_contour2()

TestImageCropper.test_FixedDetect module

TestImageCropper.test_FixedDetect.assert_zero(cords)
TestImageCropper.test_FixedDetect.assert_twenty(cords)
TestImageCropper.test_FixedDetect.assert_forty_five(cords)
TestImageCropper.test_FixedDetect.test_zero()
TestImageCropper.test_FixedDetect.test_forty_five()
TestImageCropper.test_FixedDetect.test_twenty()

TestImageCropper.test_ManualDetect module

This module is responsible for testing the ManualDetect module.

TestImageCropper.test_ManualDetect.assert_straight_rectangle(straight_cords)

Asserts coordinates of a straight selection

TestImageCropper.test_ManualDetect.assert_rotated_rectangle(rotated_cords)

Asserts coordinates of a rotated selection

TestImageCropper.test_ManualDetect.assert_skewed_rectangle(skewed_cords)

Asserts coordinates of a skewed selection

TestImageCropper.test_ManualDetect.assert_max_input(nr_user_input)

Asserts userinput more than 3 inputs

TestImageCropper.test_ManualDetect.assert_min_input(nr_user_input)

Asserts userinput less than 3 inputs

TestImageCropper.test_ManualDetect.assert_misfit(misfit_error_code)

Asserts when userinput causes the cropped rectangle to be out of the area of image.

TestImageCropper.test_ManualDetect.test_horizontal()

Tests the ManualDetect with a straight rectangle.

A new ManualDetector object is created. The four mouse-clicks from the user are then imitated and coordinates are retrieved.

TestImageCropper.test_ManualDetect.test_rotated()

Tests the ManualDetect with a 45 degrees rotated rectangle.

A new ManualDetector object is created. The four mouse-clicks from the user are then imitated and coordinates are retrieved.

TestImageCropper.test_ManualDetect.test_vertical()

Tests the ManualDetect with a irregular rectangle.

When the manualdetect gets an irregular rectangle, it is supposed to transform it into a straight rectangle.

A new ManualDetector object is created. The four mouse-clicks from the user are then imitated and coordinates are retrieved.

TestImageCropper.test_ManualDetect.test_max_input()

Tests if the ManualDetect can process a maximum of 3 userinputs. This involves the click_and_detect function. The possibilty of clicking once or twice is not taken into account in this test. This test can/should? be added for completeness.

TestImageCropper.test_ManualDetect.test_min_input()

Tests if the ManualDetect can process less than 3 userinputs. This involves the manual_detect function.

TestImageCropper.test_ManualDetect.test_misfit()

Tests what happends when a drawn rectangle has a point outside the area of the image to process.

TestImageCropper.test_FixedDetectCompletelyOutOfBorder module

TestImageCropper.test_FixedDetectNegativeValues module

Module contents