This commit is contained in:
Your Name
2026-09-07 10:07:47 +08:00
parent cf3fbdc5ef
commit d5164b7369
388 changed files with 19863 additions and 18720 deletions
+58 -11
View File
@@ -51,6 +51,52 @@ def application() -> QApplication:
return QApplication.instance() or QApplication([])
@pytest.mark.parametrize("width", [1114, 1320, 1494])
def test_visible_history_updates_grow_clinical_card_without_clipping(
application: QApplication,
queued_async: list[dict[str, Any]],
width: int,
) -> None:
page = ReceptionPage(DemoDoctorRepository(), PermissionSet(["*"]))
page.resize(width, 824)
page.show()
try:
application.processEvents()
page.detail_stack.setCurrentIndex(1)
for _ in range(8):
application.processEvents()
label = page.case_labels["present"]
clinical = page.clinical_info_group
initial_height = clinical.height()
initial_scroll_maximum = page.detail_scroll.verticalScrollBar().maximum()
history = (
"患者自述近期口干,睡眠较浅,日常饮食与作息较规律。\n"
"近一周已记录空腹血糖,复诊时携带记录与既往检查报告。\n"
"问诊记录包含当前不适、变化时间、生活习惯与既往用药,供医生核对。"
)
label.setText(history)
application.processEvents()
assert label.text() == history
assert label.height() >= label.heightForWidth(label.width())
label.setText("\n".join([history] * 5))
application.processEvents()
assert label.height() >= label.heightForWidth(label.width())
assert clinical.height() > initial_height
assert page.detail_scroll.verticalScrollBar().maximum() > initial_scroll_maximum
assert label.maximumHeight() > label.height()
expanded_height = clinical.height()
label.setText("无特殊不适。")
application.processEvents()
assert label.height() >= label.heightForWidth(label.width())
assert clinical.height() < expanded_height
finally:
page.close()
page.deleteLater()
application.processEvents()
@pytest.fixture
def immediate_async(monkeypatch: pytest.MonkeyPatch) -> None:
def run_immediately(
@@ -622,6 +668,7 @@ def test_queue_date_picker_filters_the_selected_day(
page = ReceptionPage(Repository(), PermissionSet([]))
page.show()
application.processEvents()
page.filter_disclosure.button.click()
page.queue_date_button.click()
calendar = page.queue_date_button.calendarWidget()
assert calendar.isVisible()
@@ -1036,14 +1083,14 @@ def test_medication_case_prioritizes_clinical_information_and_keeps_plain_summar
caption = medication.findChild(QLabel, "ReceptionCaseFieldCaption")
value = medication.findChild(QLabel, "ReceptionCaseFieldValue")
assert title is not None and title.font().pixelSize() == 18
assert caption is not None and caption.font().pixelSize() == 12
assert caption is not None and caption.font().pixelSize() == 13
assert value is not None and value.font().pixelSize() == 14
assert title.font().weight() >= 700
assert caption.font().weight() >= 600
assert value.font().weight() >= 700
assert title.palette().color(QPalette.ColorRole.WindowText).name() == "#17264d"
assert caption.palette().color(QPalette.ColorRole.WindowText).name() == "#617092"
assert value.palette().color(QPalette.ColorRole.WindowText).name() == "#253a83"
assert title.font().weight() == 600
assert caption.font().weight() == 400
assert value.font().weight() == 600
assert title.palette().color(QPalette.ColorRole.WindowText).name() == "#273244"
assert caption.palette().color(QPalette.ColorRole.WindowText).name() == "#5d6b80"
assert value.palette().color(QPalette.ColorRole.WindowText).name() == "#273244"
assert value.wordWrap()
assert value.textInteractionFlags() & Qt.TextInteractionFlag.TextSelectableByMouse
@@ -1135,7 +1182,7 @@ def test_queue_load_more_accumulates_to_total_boundary(
assert [call["page_no"] for call in calls] == [1, 2]
assert all(call["page_size"] == 15 for call in calls)
assert page.queue_list.count() == 22
assert page.queue_summary.text() == "已加载 22 / 共 22 位患者"
assert page.queue_summary.text() == "共 22 位患者"
assert not page._queue_has_more()
page.close()
application.processEvents()
@@ -1466,11 +1513,11 @@ def test_notify_assistant_is_a_visible_header_action_not_a_more_menu_item(
buttons = [
button
for button in (
page.complete_button,
page.notify_button,
page.history_button,
page.video_button,
page.more_button,
page.complete_button,
)
if button.isVisibleTo(page)
]
@@ -1688,8 +1735,8 @@ def test_reception_auto_loads_structured_ai_analysis_and_matches_reference_geome
assert page.ai_analysis_card.maximumHeight() > 520
assert page.ai_analysis_card.findChildren(QScrollArea) == []
assert left.height() == right.height()
assert 0 <= right.left() - left.right() - 1 <= 2
assert abs(left.width() * 5 - right.width() * 4) <= 10
assert right.left() - left.right() - 1 == 10
assert abs(left.width() / (left.width() + right.width()) - 0.425) < 0.01
assert page.ai_summary_label.width() <= page.ai_analysis_card.contentsRect().width()
assert page.ai_summary_label.minimumSizeHint().width() <= 48