diff --git a/tests/test_mask.py b/tests/test_mask.py index e5ae03e..19698d5 100644 --- a/tests/test_mask.py +++ b/tests/test_mask.py @@ -1,4 +1,6 @@ +import cv2 import numpy as np +import pytest from PIL import Image, ImageDraw from adetailer.mask import dilate_erode, has_intersection, is_all_black, offset @@ -78,6 +80,24 @@ def test_is_all_black_2(): assert not is_all_black(img) +def test_is_all_black_rgb_image_pil(): + img = Image.new("RGB", (10, 10), color="red") + assert not is_all_black(img) + + img = Image.new("RGBA", (10, 10), color="red") + assert not is_all_black(img) + + +def test_is_all_black_rgb_image_numpy(): + img = np.full((10, 10, 4), 127, dtype=np.uint8) + with pytest.raises(cv2.error): + is_all_black(img) + + img = np.full((4, 10, 10), 0.5, dtype=np.float32) + with pytest.raises(cv2.error): + is_all_black(img) + + def test_has_intersection_1(): arr1 = np.array( [ diff --git a/tests/test_ultralytics.py b/tests/test_ultralytics.py index 1a75d7a..c772607 100644 --- a/tests/test_ultralytics.py +++ b/tests/test_ultralytics.py @@ -11,8 +11,10 @@ from adetailer.ultralytics import ultralytics_predict "face_yolov8n.pt", "face_yolov8n_v2.pt", "face_yolov8s.pt", + "face_yolov9c.pt", "hand_yolov8n.pt", "hand_yolov8s.pt", + "hand_yolov9c.pt", "person_yolov8n-seg.pt", "person_yolov8s-seg.pt", "person_yolov8m-seg.pt",