Fix fudai diagnostics and redpacket guard

This commit is contained in:
Your Name committed 2026-06-18 18:41:27 +08:00
1 parent cb74a23e81
commit 28709d2d97
11 files changed
+245 -4

No files matched your search

+15
View File
@@ -42,6 +42,7 @@ ICON_REGRESSION_CASES = [
("false_left_coupon_x162.png", False, None, None),
("false_no_fudai_light10.png", False, None, None),
("false_right_coupon_strip_x366.png", False, None, None),
("false_shopping_redpacket_left_x168.png", False, None, None),
]
@@ -177,6 +178,20 @@ class TestFudaiDetector:
assert elapsed_ms < 5.0
def test_redpacket_neighbor_detector_rejects_shopping_redpacket_entry(self):
sample = FIXTURE_DIR / "false_shopping_redpacket_left_x168.png"
if not sample.exists():
pytest.skip("fixture unavailable")
d = FudaiDetector(FakeAnalyser())
img = Image.open(sample).convert("RGB")
redpacket_like, info = d._has_redpacket_neighbor_widget(img, 168)
assert redpacket_like is True
assert info["white_ratio"] >= 0.35
assert info["pink_ratio"] >= 0.06
def test_current_icon_template_confirms_clean_countdown_sample(self):
sample = Path(
"artifacts/live_fudai_flow_20260618_0530_valid/snapshots/"