Extend testing
This commit is contained in:
@@ -3,8 +3,8 @@ import subprocess
|
|||||||
import pytest
|
import pytest
|
||||||
|
|
||||||
from facefusion.download import conditional_download
|
from facefusion.download import conditional_download
|
||||||
from facefusion.vision import calc_histogram_difference, count_trim_frame_total, count_video_frame_total, create_image_resolutions, create_video_resolutions, detect_image_resolution, detect_video_duration, detect_video_fps, detect_video_resolution, get_video_frame, match_frame_color, normalize_resolution, pack_resolution, read_image, restrict_image_resolution, restrict_trim_frame, restrict_video_fps, restrict_video_resolution, unpack_resolution
|
from facefusion.vision import calc_histogram_difference, count_trim_frame_total, count_video_frame_total, create_image_resolutions, create_video_resolutions, detect_image_resolution, detect_video_duration, detect_video_fps, detect_video_resolution, get_video_frame, match_frame_color, normalize_resolution, pack_resolution, read_image, restrict_image_resolution, restrict_trim_frame, restrict_video_fps, restrict_video_resolution, unpack_resolution, write_image
|
||||||
from .helper import get_test_example_file, get_test_examples_directory
|
from .helper import get_test_example_file, get_test_examples_directory, prepare_test_output_directory, get_test_output_file
|
||||||
|
|
||||||
|
|
||||||
@pytest.fixture(scope = 'module', autouse = True)
|
@pytest.fixture(scope = 'module', autouse = True)
|
||||||
@@ -16,6 +16,7 @@ def before_all() -> None:
|
|||||||
'https://github.com/facefusion/facefusion-assets/releases/download/examples-3.0.0/target-1080p.mp4'
|
'https://github.com/facefusion/facefusion-assets/releases/download/examples-3.0.0/target-1080p.mp4'
|
||||||
])
|
])
|
||||||
subprocess.run([ 'ffmpeg', '-i', get_test_example_file('target-240p.mp4'), '-vframes', '1', get_test_example_file('target-240p.jpg') ])
|
subprocess.run([ 'ffmpeg', '-i', get_test_example_file('target-240p.mp4'), '-vframes', '1', get_test_example_file('target-240p.jpg') ])
|
||||||
|
subprocess.run([ 'ffmpeg', '-i', get_test_example_file('target-240p.mp4'), '-vframes', '1', get_test_example_file('目标-240p.webp') ])
|
||||||
subprocess.run([ 'ffmpeg', '-i', get_test_example_file('target-1080p.mp4'), '-vframes', '1', get_test_example_file('target-1080p.jpg') ])
|
subprocess.run([ 'ffmpeg', '-i', get_test_example_file('target-1080p.mp4'), '-vframes', '1', get_test_example_file('target-1080p.jpg') ])
|
||||||
subprocess.run([ 'ffmpeg', '-i', get_test_example_file('target-240p.mp4'), '-vframes', '1', '-vf', 'hue=s=0', get_test_example_file('target-240p-0sat.jpg') ])
|
subprocess.run([ 'ffmpeg', '-i', get_test_example_file('target-240p.mp4'), '-vframes', '1', '-vf', 'hue=s=0', get_test_example_file('target-240p-0sat.jpg') ])
|
||||||
subprocess.run([ 'ffmpeg', '-i', get_test_example_file('target-240p.mp4'), '-vframes', '1', '-vf', 'transpose=0', get_test_example_file('target-240p-90deg.jpg') ])
|
subprocess.run([ 'ffmpeg', '-i', get_test_example_file('target-240p.mp4'), '-vframes', '1', '-vf', 'transpose=0', get_test_example_file('target-240p-90deg.jpg') ])
|
||||||
@@ -27,6 +28,25 @@ def before_all() -> None:
|
|||||||
subprocess.run([ 'ffmpeg', '-i', get_test_example_file('target-1080p.mp4'), '-vf', 'transpose=0', get_test_example_file('target-1080p-90deg.mp4') ])
|
subprocess.run([ 'ffmpeg', '-i', get_test_example_file('target-1080p.mp4'), '-vf', 'transpose=0', get_test_example_file('target-1080p-90deg.mp4') ])
|
||||||
|
|
||||||
|
|
||||||
|
@pytest.fixture(scope = 'function', autouse = True)
|
||||||
|
def before_each() -> None:
|
||||||
|
prepare_test_output_directory()
|
||||||
|
|
||||||
|
|
||||||
|
def test_read_image() -> None:
|
||||||
|
assert read_image(get_test_example_file('target-240p.jpg')).shape == (226, 426, 3)
|
||||||
|
assert read_image(get_test_example_file('目标-240p.webp')).shape == (226, 426, 3)
|
||||||
|
assert read_image('invalid') is None
|
||||||
|
|
||||||
|
|
||||||
|
@pytest.mark.skip()
|
||||||
|
def test_write_image() -> None:
|
||||||
|
vision_frame = read_image(get_test_example_file('target-240p.jpg'))
|
||||||
|
|
||||||
|
assert write_image(get_test_output_file('target-240p.jpg'), vision_frame) is True
|
||||||
|
assert write_image(get_test_output_file('目标-240p.webp'), vision_frame) is True
|
||||||
|
|
||||||
|
|
||||||
def test_detect_image_resolution() -> None:
|
def test_detect_image_resolution() -> None:
|
||||||
assert detect_image_resolution(get_test_example_file('target-240p.jpg')) == (426, 226)
|
assert detect_image_resolution(get_test_example_file('target-240p.jpg')) == (426, 226)
|
||||||
assert detect_image_resolution(get_test_example_file('target-240p-90deg.jpg')) == (226, 426)
|
assert detect_image_resolution(get_test_example_file('target-240p-90deg.jpg')) == (226, 426)
|
||||||
|
|||||||
Reference in New Issue
Block a user