62 lines
2.3 KiB
Python
62 lines
2.3 KiB
Python
|
|
"""Unit-Tests Renderer-Pipeline-Definitionen (PLAN.md §12, §36 Nr. 4–5)."""
|
|||
|
|
|
|||
|
|
from __future__ import annotations
|
|||
|
|
|
|||
|
|
from hms_renderer import (
|
|||
|
|
D3D11Pipeline,
|
|||
|
|
DevGLPipeline,
|
|||
|
|
build_compositor_pipeline,
|
|||
|
|
build_single_video_pipeline,
|
|||
|
|
gst_available,
|
|||
|
|
)
|
|||
|
|
|
|||
|
|
|
|||
|
|
def test_single_video_d3d11_uses_hardware_decoder_path() -> None:
|
|||
|
|
pipeline = build_single_video_pipeline("C:/clips/test.mp4", d3d11=True)
|
|||
|
|
assert "d3d11" in pipeline
|
|||
|
|
assert "d3d11videosink" in pipeline
|
|||
|
|
assert "fullscreen=true" in pipeline # randloses Vollbild (§3.3)
|
|||
|
|
assert "uridecodebin" in pipeline
|
|||
|
|
|
|||
|
|
|
|||
|
|
def test_single_video_devgl_marked_alternative() -> None:
|
|||
|
|
pipeline = build_single_video_pipeline("/tmp/test.mp4", d3d11=False)
|
|||
|
|
assert "d3d11" not in pipeline # Dev-Pfad darf D3D11 nicht still nutzen
|
|||
|
|
assert "glimagesink" in pipeline
|
|||
|
|
|
|||
|
|
|
|||
|
|
def test_compositor_d3d11_mixed_two_sources_on_gpu() -> None:
|
|||
|
|
pipeline = build_compositor_pipeline("a.mp4", "b.mp4", d3d11=True)
|
|||
|
|
# Zwei Quellen → Compositor → Ausgabe ohne CPU-Readback (§36 Nr. 5)
|
|||
|
|
assert pipeline.count("uridecodebin") == 2
|
|||
|
|
assert "d3d11compositor" in pipeline
|
|||
|
|
assert "d3d11convert" in pipeline
|
|||
|
|
assert "D3D11Memory" in pipeline # GPU-Residenz explizit angefordert
|
|||
|
|
assert "appsink" not in pipeline # kein CPU-Abgriff im Normalpfad
|
|||
|
|
assert "videoconvert" not in pipeline # kein Software-Farbkonverter
|
|||
|
|
|
|||
|
|
|
|||
|
|
def test_compositor_devgl_is_separate_path() -> None:
|
|||
|
|
pipeline = build_compositor_pipeline("a.mp4", "b.mp4", d3d11=False)
|
|||
|
|
assert "glvideomixer" in pipeline
|
|||
|
|
assert "d3d11" not in pipeline
|
|||
|
|
|
|||
|
|
|
|||
|
|
def test_d3d11_pipeline_splits_screen_for_two_videos() -> None:
|
|||
|
|
p = D3D11Pipeline(video_a="a.mp4", video_b="b.mp4", width=1920, height=1080)
|
|||
|
|
s = p.launch_string()
|
|||
|
|
assert "sink_0::width=960" in s # linke Hälfte
|
|||
|
|
assert "sink_1::width=960" in s # rechte Hälfte
|
|||
|
|
assert "width=1920,height=1080" in s # Master-Auflösung
|
|||
|
|
|
|||
|
|
|
|||
|
|
def test_devgl_pipeline_reduced_resolution() -> None:
|
|||
|
|
p = DevGLPipeline(video_a="a.mp4", video_b="b.mp4")
|
|||
|
|
assert p.width == 960 and p.height == 540 # Dev-Pfad kleiner, gekennzeichnet
|
|||
|
|
|
|||
|
|
|
|||
|
|
def test_gst_available_reflects_environment() -> None:
|
|||
|
|
# Im Entwicklungscontainer ist GStreamer nicht installiert → False.
|
|||
|
|
# Auf dem Windows-Ziel mit gebündelter Runtime → True. Kein Fake.
|
|||
|
|
assert isinstance(gst_available(), bool)
|