更新
This commit is contained in:
@@ -8,7 +8,7 @@ os.environ.setdefault("QT_QPA_PLATFORM", "offscreen")
|
||||
|
||||
import pytest
|
||||
from PySide6.QtCore import QDate
|
||||
from PySide6.QtWidgets import QApplication, QInputDialog
|
||||
from PySide6.QtWidgets import QApplication, QDialogButtonBox, QInputDialog, QLabel
|
||||
|
||||
from doctor_workstation.core import PermissionSet
|
||||
from doctor_workstation.services import DemoDoctorRepository
|
||||
@@ -21,6 +21,9 @@ from doctor_workstation.ui.pages.patients import (
|
||||
PatientProgressWorkspace,
|
||||
PatientsPage,
|
||||
_AppointmentDialog,
|
||||
_AssignDialog,
|
||||
_OrderDetailDialog,
|
||||
_OrderEditDialog,
|
||||
_PaymentDialog,
|
||||
_RefundDialog,
|
||||
)
|
||||
@@ -102,7 +105,7 @@ def test_shell_resolves_dynamic_menu_order_visibility_and_canonical_permissions(
|
||||
resolved = _resolve_navigation(menu, permissions, demo_mode=False)
|
||||
|
||||
assert [(item.key, title) for item, title in resolved] == [
|
||||
("patients", "患者工作区"),
|
||||
("patients", "接诊台"),
|
||||
("consultations", "问诊工作区"),
|
||||
]
|
||||
assert _resolve_navigation([], permissions, demo_mode=False) == []
|
||||
@@ -187,7 +190,7 @@ def test_patient_refresh_generation_ignores_late_results(
|
||||
application.processEvents()
|
||||
|
||||
assert workspace.table.rowCount() == 1
|
||||
assert workspace.table.item(0, 0).text().startswith("新结果")
|
||||
assert workspace.table.item(0, 1).text().startswith("新结果")
|
||||
workspace.close()
|
||||
|
||||
|
||||
@@ -371,6 +374,59 @@ def test_payment_and_refund_forms_expose_full_contract(
|
||||
application.processEvents()
|
||||
|
||||
|
||||
def test_patient_business_dialogs_expose_shared_visual_contract(
|
||||
application: QApplication,
|
||||
) -> None:
|
||||
detail = {
|
||||
"id": 81,
|
||||
"order_no": "ORDER-81",
|
||||
"patient_name": "鹿立核",
|
||||
"recipient_name": "鹿立核",
|
||||
"recipient_phone": "13800138000",
|
||||
"shipping_address": "北京市朝阳区测试路 8 号",
|
||||
"amount": 368,
|
||||
}
|
||||
dialogs = (
|
||||
_PaymentDialog(detail),
|
||||
_RefundDialog(detail),
|
||||
_AssignDialog(
|
||||
detail,
|
||||
[{"id": 7, "name": "陈医助", "department_name": "中医门诊"}],
|
||||
),
|
||||
_OrderDetailDialog(detail),
|
||||
_OrderEditDialog(detail),
|
||||
)
|
||||
|
||||
assert [dialog.objectName() for dialog in dialogs] == [
|
||||
"PatientPaymentDialog",
|
||||
"PatientRefundDialog",
|
||||
"PatientAssignDialog",
|
||||
"PatientOrderDetailDialog",
|
||||
"PatientOrderEditDialog",
|
||||
]
|
||||
assert all(dialog.property("businessDialog") is True for dialog in dialogs)
|
||||
assert all(
|
||||
any(label.property("dialogRole") == "title" for label in dialog.findChildren(QLabel))
|
||||
for dialog in dialogs
|
||||
)
|
||||
assert dialogs[0].findChild(QDialogButtonBox).button(
|
||||
QDialogButtonBox.StandardButton.Ok
|
||||
).property("variant") == "primary"
|
||||
assert dialogs[1].findChild(QDialogButtonBox).button(
|
||||
QDialogButtonBox.StandardButton.Ok
|
||||
).property("variant") == "danger"
|
||||
assert dialogs[2].findChild(QDialogButtonBox).button(
|
||||
QDialogButtonBox.StandardButton.Ok
|
||||
).property("variant") == "primary"
|
||||
assert dialogs[4].findChild(QDialogButtonBox).button(
|
||||
QDialogButtonBox.StandardButton.Ok
|
||||
).property("variant") == "primary"
|
||||
|
||||
for dialog in dialogs:
|
||||
dialog.close()
|
||||
application.processEvents()
|
||||
|
||||
|
||||
def test_out_of_order_mutation_successes_each_trigger_reconciliation(
|
||||
application: QApplication,
|
||||
monkeypatch: pytest.MonkeyPatch,
|
||||
@@ -525,12 +581,12 @@ def test_shell_uses_demo_session_menu_and_fits_minimum_window(
|
||||
) -> None:
|
||||
repository = DemoDoctorRepository()
|
||||
session = repository.login(repository.DEMO_ACCOUNT, repository.DEMO_PASSWORD)
|
||||
patient_menu = next(
|
||||
row for row in session.menu if row.get("perms") == "firstvisit.myPatient/lists"
|
||||
reception_menu = next(
|
||||
row for row in session.menu if row.get("perms") == "doctor.appointment/lists"
|
||||
)
|
||||
patient_menu["name"] = "患者中心"
|
||||
patient_menu["sort"] = 99
|
||||
session.menu = [patient_menu]
|
||||
reception_menu["name"] = "接诊台"
|
||||
reception_menu["sort"] = 99
|
||||
session.menu = [reception_menu]
|
||||
shell = ShellWindow(
|
||||
repository,
|
||||
{"session": session, "demo_mode": True},
|
||||
@@ -540,8 +596,8 @@ def test_shell_uses_demo_session_menu_and_fits_minimum_window(
|
||||
shell.show()
|
||||
application.processEvents()
|
||||
|
||||
assert list(shell.pages) == ["patients"]
|
||||
assert shell.nav_buttons["patients"].text().endswith("患者中心")
|
||||
assert list(shell.pages) == ["reception"]
|
||||
assert shell.nav_buttons["reception"].text().endswith("接诊台")
|
||||
assert shell.minimumWidth() == 1024
|
||||
assert shell.minimumHeight() == 640
|
||||
assert shell.size().width() == 1024
|
||||
@@ -556,3 +612,32 @@ def test_shell_uses_demo_session_menu_and_fits_minimum_window(
|
||||
}
|
||||
shell.close()
|
||||
application.processEvents()
|
||||
|
||||
|
||||
def test_patient_list_reference_geometry_and_row_actions(
|
||||
application: QApplication,
|
||||
immediate_async: None,
|
||||
) -> None:
|
||||
repository = DemoDoctorRepository()
|
||||
session = repository.login(repository.DEMO_ACCOUNT, repository.DEMO_PASSWORD)
|
||||
page = PatientsPage(repository, permissions=session.permissions, current_user=session.user)
|
||||
page.resize(1460, 820)
|
||||
page.show()
|
||||
application.processEvents()
|
||||
page.patient_workspace.refresh()
|
||||
application.processEvents()
|
||||
|
||||
workspace = page.patient_workspace
|
||||
assert all(
|
||||
button.minimumHeight() == 56 and button.maximumHeight() == 56
|
||||
for button in workspace.summary_buttons.values()
|
||||
)
|
||||
assert workspace.table.objectName() == "PatientTable"
|
||||
assert workspace.table.columnCount() == 10
|
||||
assert workspace.table.horizontalHeaderItem(9).text() == "操作"
|
||||
if workspace.table.rowCount():
|
||||
assert workspace.table.rowHeight(0) == 40
|
||||
assert workspace.table.cellWidget(0, 0) is not None
|
||||
assert workspace.table.cellWidget(0, 9) is not None
|
||||
page.close()
|
||||
application.processEvents()
|
||||
|
||||
Reference in New Issue
Block a user