- 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.
57 lines
1.7 KiB
Python
57 lines
1.7 KiB
Python
#!/usr/bin/env python3
|
|
# -*- coding: utf-8 -*-
|
|
"""
|
|
测试养号延迟修改
|
|
"""
|
|
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:
|
|
content = f.read()
|
|
|
|
# 检查点击爱心前的延迟
|
|
if "analyser.operation.delay(1.0) # 点击前延迟1秒" in content:
|
|
print("✅ 爱心点击前延迟1秒 - 正确")
|
|
else:
|
|
print("❌ 爱心点击前延迟未找到")
|
|
|
|
# 检查点击爱心后的延迟
|
|
if "analyser.operation.delay(1.0) # 点击后延迟1秒" in content:
|
|
print("✅ 爱心点击后延迟1秒 - 正确")
|
|
else:
|
|
print("❌ 爱心点击后延迟未找到")
|
|
|
|
# 检查点击收藏前的延迟
|
|
if content.count("analyser.operation.delay(1.0) # 点击前延迟1秒") >= 2:
|
|
print("✅ 收藏点击前延迟1秒 - 正确")
|
|
else:
|
|
print("❌ 收藏点击前延迟未找到")
|
|
|
|
# 检查点击收藏后的延迟
|
|
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个推荐页延迟
|
|
print("✅ 推荐页流程延迟1秒 - 正确")
|
|
else:
|
|
print("❌ 推荐页流程延迟不完整")
|
|
|
|
print("\n=== 延迟设置验证完成 ===")
|
|
|
|
|
|
if __name__ == "__main__":
|
|
test_delays()
|