35 lines
2.0 KiB
Python
35 lines
2.0 KiB
Python
from pathlib import Path
|
|
import sys
|
|
from unittest import mock
|
|
from PySide6.QtWidgets import QApplication
|
|
import wechat_gui_qt as qt
|
|
app = QApplication.instance() or QApplication([])
|
|
qt._register_bundled_fonts()
|
|
app.setStyle("Fusion")
|
|
app.setStyleSheet(qt.APP_QSS)
|
|
app.setFont(qt._ui_font(9))
|
|
with mock.patch.object(qt.QTimer, "singleShot"):
|
|
dialog = qt.ReviewAssistantPicker("168800000000001")
|
|
reason = "尚无可发送的私人微信会话。请在当前托管企微与此联系人建立单聊并产生一条消息,再刷新消息库。"
|
|
dialog._serial = 1
|
|
dialog._loaded({"ready": True, "account_id": "168800000000001", "_serial": 1,
|
|
"total": 3, "selectable_total": 1, "contact_total": 2,
|
|
"items": [
|
|
{"id": "M:10001", "name": "合成医疗助理(已建立私人微信单聊)", "identityLabel": "微信客户 · 联系编号 10001", "lastTime": "2026-09-17 09:08", "selectable": True},
|
|
{"id": "contact:wxid_synthetic_10002", "name": "合成医疗助理长备注:夜班值守与客户回访专用私人微信", "identityLabel": "微信通讯录 · wxid_synthetic_10002", "lastTime": "", "selectable": False, "unavailableReason": reason},
|
|
{"id": "contact:wxid_synthetic_10003", "name": "合成同名助理", "identityLabel": "微信通讯录 · wxid_synthetic_10003", "lastTime": "", "selectable": False, "unavailableReason": reason}
|
|
]})
|
|
dialog.show()
|
|
app.processEvents()
|
|
dialog.contacts.setCurrentRow(0)
|
|
app.processEvents()
|
|
path = Path(sys.argv[1])
|
|
assert dialog.grab().save(str(path))
|
|
print("logical size:", dialog.width(), dialog.height(), "DPR:", dialog.devicePixelRatioF())
|
|
print("list viewport:", dialog.contacts.viewport().width(), dialog.contacts.viewport().height(), "horizontal scroll max:", dialog.contacts.horizontalScrollBar().maximum())
|
|
for row in range(dialog.contacts.count()):
|
|
print("row", row, "height:", dialog.contacts.visualItemRect(dialog.contacts.item(row)).height())
|
|
assert dialog.contacts.horizontalScrollBar().maximum() == 0
|
|
assert dialog.choose.isEnabled()
|
|
dialog.reject()
|