Add shopping red packet detection tests and sample image

- Implemented a test script for shopping red packet detection using pixel analysis and OCR.
- Created a sample image to simulate a shopping red packet for testing purposes.
- Added functions to test pixel detection, coordinate definitions, and OCR keyword matching.
- Included detailed print statements for test results and summaries.
This commit is contained in:
Your Name committed 2026-01-08 20:37:49 +08:00
1 parent b3011dd9ce
commit fb0c07c91a
30 files changed
+1269 -319

No files matched your search

+12 -7
View File
@@ -5,47 +5,52 @@
"""
import sys
import os
sys.path.insert(0, os.path.dirname(__file__))
def test_delays():
"""测试延迟设置是否正确"""
print("=== 测试延迟设置 ===")
# 检查代码中是否包含正确的延迟调用
with open('douyin/other/douyin_yanghao.py', 'r', encoding='utf-8') as f:
with open("douyin/other/douyin_yanghao.py", "r", encoding="utf-8") as f:
content = f.read()
# 检查点击爱心前的延迟
if 'analyser.operation.delay(1.0) # 点击前延迟1秒' in content:
if "analyser.operation.delay(1.0) # 点击前延迟1秒" in content:
print("✅ 爱心点击前延迟1秒 - 正确")
else:
print("❌ 爱心点击前延迟未找到")
# 检查点击爱心后的延迟
if 'analyser.operation.delay(1.0) # 点击后延迟1秒' in content:
if "analyser.operation.delay(1.0) # 点击后延迟1秒" in content:
print("✅ 爱心点击后延迟1秒 - 正确")
else:
print("❌ 爱心点击后延迟未找到")
# 检查点击收藏前的延迟
if content.count('analyser.operation.delay(1.0) # 点击前延迟1秒') >= 2:
if content.count("analyser.operation.delay(1.0) # 点击前延迟1秒") >= 2:
print("✅ 收藏点击前延迟1秒 - 正确")
else:
print("❌ 收藏点击前延迟未找到")
# 检查点击收藏后的延迟
if content.count('analyser.operation.delay(1.0) # 点击后延迟1秒') >= 2:
if content.count("analyser.operation.delay(1.0) # 点击后延迟1秒") >= 2:
print("✅ 收藏点击后延迟1秒 - 正确")
else:
print("❌ 收藏点击后延迟未找到")
# 检查推荐页流程的延迟
if content.count('analyser.operation.delay(1.0)') >= 4: # 2个点击延迟 + 2个推荐页延迟
if (
content.count("analyser.operation.delay(1.0)") >= 4
): # 2个点击延迟 + 2个推荐页延迟
print("✅ 推荐页流程延迟1秒 - 正确")
else:
print("❌ 推荐页流程延迟不完整")
print("\n=== 延迟设置验证完成 ===")
if __name__ == "__main__":
test_delays()
test_delays()