mirror of
https://github.com/mofeng-git/One-KVM.git
synced 2026-09-12 10:34:24 +08:00
test: 更新报告格式
This commit is contained in:
@@ -163,7 +163,7 @@ class Reporter:
|
||||
"",
|
||||
f"- 运行编号:`{run_id}`",
|
||||
"- 测试设备:",
|
||||
f"- 视频设备:{markdown_inline(self.user_video_device())}",
|
||||
f"- 视频设备:{self.user_video_device()}",
|
||||
f"- HID 设备:{markdown_inline(self.user_hid_backend())}",
|
||||
f"- HTTP 延迟:{markdown_inline(self.user_http_latency())}",
|
||||
"",
|
||||
@@ -249,7 +249,9 @@ class Reporter:
|
||||
continue
|
||||
device = str(case.get("device") or "未知设备")
|
||||
by_device.setdefault(device, []).append(format_video_case(case))
|
||||
return ";".join(f"{device}:{', '.join(items)}" for device, items in by_device.items()) or "无数据"
|
||||
return ";".join(
|
||||
f"{markdown_code(device)}({'、'.join(items)})" for device, items in by_device.items()
|
||||
) or "无数据"
|
||||
|
||||
def user_hid_backend(self) -> str:
|
||||
config = self.find_result("hid_msd_config")
|
||||
@@ -589,19 +591,30 @@ def display_name(name: str) -> str:
|
||||
|
||||
|
||||
def format_video_case(case: dict[str, Any]) -> str:
|
||||
fmt = str(case.get("fmt") or "").lower()
|
||||
fmt = format_video_codec(case.get("fmt"))
|
||||
resolution = format_resolution(case)
|
||||
fps = format_fps_value(case.get("fps"))
|
||||
return " ".join(part for part in (f"{resolution}@{fps}" if resolution and fps else resolution or fps, fmt) if part)
|
||||
|
||||
|
||||
def format_video_latency_params(case: dict[str, Any], output_mode: str) -> str:
|
||||
fmt = str(case.get("fmt") or "").lower()
|
||||
output = output_mode.lower() if output_mode else "unknown"
|
||||
fmt = format_video_codec(case.get("fmt"))
|
||||
output = format_video_codec(output_mode) if output_mode else "UNKNOWN"
|
||||
resolution = format_resolution(case)
|
||||
fps = format_fps_value(case.get("fps"))
|
||||
input_part = " ".join(part for part in (f"{resolution}@{fps}" if resolution and fps else resolution or fps, fmt) if part)
|
||||
return f"{input_part}-->{output}" if input_part else output
|
||||
return f"{input_part} → {output}" if input_part else output
|
||||
|
||||
|
||||
def format_video_codec(value: Any) -> str:
|
||||
codec = str(value or "").strip()
|
||||
normalized = codec.lower().replace(".", "").replace("-", "").replace("_", "")
|
||||
names = {
|
||||
"h264": "H.264",
|
||||
"h265": "H.265",
|
||||
"mjpeg": "MJPEG",
|
||||
}
|
||||
return names.get(normalized, codec.upper())
|
||||
|
||||
|
||||
def format_resolution(case: dict[str, Any]) -> str:
|
||||
@@ -659,6 +672,10 @@ def markdown_inline(value: str) -> str:
|
||||
return str(value).replace("\n", " | ").replace("`", "'")
|
||||
|
||||
|
||||
def markdown_code(value: str) -> str:
|
||||
return f"`{markdown_inline(value)}`"
|
||||
|
||||
|
||||
def markdown_table_cell(value: str) -> str:
|
||||
return markdown_inline(value).replace("|", "\\|")
|
||||
|
||||
|
||||
Reference in New Issue
Block a user