Files
hms-mediaengine/tests/unit/test_pipelines.py
T
HMS MediaEngine Agent 0922cc1d68 Phase 0: Repository-Initialisierung nach Bauplan v1.2
- Struktur gemäß §8 (Eigentumsgrenzen), PLAN.md als normative Basis
- Pflichtdokumente: STATUS.md, ERRORS.md, TEST_REPORT.md, CHANGELOG.md, ADRs
- ADR-0001 Python 3.13-Pin, ADR-0002 GStreamer 1.28.6-Pin (Windows),
  ADR-0003 IPC TCP+MessagePack v1
- Kernpakete: hms_protocol, hms_domain, hms_parameter, hms_artnet,
  hms_adaptive, hms_capabilities, hms_plugin_sdk
- Renderer-Spike: D3D11-Primärpfad + Dev-GL-Pfad (§36 Nr. 4-5)
- Control Core: FastAPI REST + WebSocket (§36 Nr. 9)
- Beispielplugins: Passthrough + Gaussian Blur (3 Adaptive-Quality-
  Varianten, HLSL/GLSL/GLES)
- Tools: Art-Net-Emulator, Fixture-Generator (Master32/Layer64-CSV),
  Capability-Probe
- JSON-Schemas: IPC, Plugin, Projekt, Cluster
- 121 Unit-/Integrationstests grün, Ruff grün

Gate 0 bleibt offen: Hardwaremessungen nur auf echter Windows-Referenz-
hardware gültig (§29.7, §33).
2026-09-11 00:36:59 +02:00

62 lines
2.3 KiB
Python
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
"""Unit-Tests Renderer-Pipeline-Definitionen (PLAN.md §12, §36 Nr. 45)."""
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)