diff --git a/tests/test_diff_motion_detector/test.py b/tests/test_diff_motion_detector/test.py index e468af8..86573e9 100644 --- a/tests/test_diff_motion_detector/test.py +++ b/tests/test_diff_motion_detector/test.py @@ -13,3 +13,41 @@ def test_set_background_successfully(self): background_image = cv2.imread('background.jpg') detector.setBackground(background_image) assert detector.getBackground() is not None + + # Tests that a binary image is returned successfully after the detection process + def test_return_binary_image_successfully(self): + detector = DiffMotionDetector() + background_image = cv2.imread('background.jpg') + foreground_image = cv2.imread('foreground.jpg') + detector.setBackground(background_image) + binary_image = detector.returnMask(foreground_image) + assert binary_image is not None + + # Tests that a background image is set and a binary image is returned successfully after the detection process + def test_set_background_and_return_binary_image_successfully(self): + detector = DiffMotionDetector() + background_image = cv2.imread('background.jpg') + foreground_image = cv2.imread('foreground.jpg') + detector.setBackground(background_image) + binary_image = detector.returnMask(foreground_image) + assert detector.getBackground() is not None and binary_image is not None + + # Tests that setting a None background image returns None + def test_set_none_background_image_and_return_none(self): + detector = DiffMotionDetector() + detector.setBackground(None) + assert detector.getBackground() is None + + # Tests that setting a None foreground image returns None + def test_set_none_foreground_image_and_return_none(self): + detector = DiffMotionDetector() + background_image = cv2.imread('background.jpg') + detector.setBackground(background_image) + binary_image = detector.returnMask(None) + assert binary_image is None + + # Tests that setting a None background image returns None after the detection process + def test_set_none_background_image_and_return_none_after_detection_process(self): + detector = DiffMotionDetector() + detector.setBackground(None) + assert detector.getBackground() is None