让 Finger 视频分析使用所选的力标定文件。

分析链不再在打开前拒绝标定,而是把文件作为 cal_path 交给 FingerRuntime,并用操作者确认的设备编号核对文件里的 SN。标定传递测试与对话框 SN 校验通过。
This commit is contained in:
ykcheungab
2026-10-08 15:12:08 +08:00
parent 7afd3169fd
commit 48624dec99
9 changed files with 246 additions and 16 deletions
@@ -736,3 +736,48 @@ def test_analysis_setup_reopens_the_prompt_after_the_first_pass(
assert block is not None
assert int(block["reference_frame"]) == 10
assert window.replay_ctl.available_result() is not None
def test_a_finger_calibration_file_must_name_the_same_device(qt_app, tmp_path):
"""A browsed Finger file is accepted only when the device id matches its SN."""
import cv2
clip = tmp_path / "clip.mp4"
writer = cv2.VideoWriter(str(clip), cv2.VideoWriter_fourcc(*"mp4v"), 10.0, (32, 24))
for _ in range(4):
writer.write(np.zeros((24, 32, 3), dtype=np.uint8))
writer.release()
facts = bare_video.probe(bare_video.resolve_video(clip))
catalog = scan_sensor_catalog()
finger = next(
(
entry
for entry in catalog.entries
if str(entry.product_family) == "finger"
and bare_video.setup_blocked_reason(entry) is None
),
None,
)
assert finger is not None, "the catalog has no startable Finger profile"
path = tmp_path / "DD02-14.json"
path.write_text(
json.dumps({"meta": {"sensor_type": "finger", "sn": "DD02-14"}}),
encoding="utf-8",
)
dialog = VideoAnalysisDialog(video=clip, facts=facts, catalog=catalog)
try:
assert dialog.select_profile(finger.ref)
dialog.select_calibration(path)
assert not dialog.device_edit.isHidden()
assert dialog.device_edit.text() == "DD02-14"
chosen = dialog.choice()
assert chosen is not None
assert chosen.calibration == path
assert chosen.device_id == "DD02-14"
dialog.device_edit.setText("OTHER")
assert dialog.choice() is None
assert dialog.note_label.text() == t(
"video_analysis.device_mismatch", sn="DD02-14"
)
finally:
dialog.deleteLater()