更新
This commit is contained in:
@@ -10,6 +10,8 @@ from typing import Any
|
||||
os.environ.setdefault("QT_QPA_PLATFORM", "offscreen")
|
||||
|
||||
import pytest
|
||||
from PySide6.QtCore import QElapsedTimer
|
||||
from PySide6.QtTest import QTest
|
||||
from PySide6.QtWidgets import (
|
||||
QAbstractItemView,
|
||||
QApplication,
|
||||
@@ -398,12 +400,19 @@ def test_appointments_page_default_query_is_today_pending(
|
||||
page.refresh()
|
||||
application.processEvents()
|
||||
|
||||
completed = QElapsedTimer()
|
||||
completed.start()
|
||||
while page.table.rowCount() == 0 and completed.elapsed() < 2_000:
|
||||
QTest.qWait(10)
|
||||
|
||||
filters = page._query_filters()
|
||||
assert filters["status"] == 1
|
||||
assert filters["include_status_counts"] == 1
|
||||
assert filters["start_date"] == filters["end_date"]
|
||||
assert "diag_scope_relax" not in filters
|
||||
assert page.table.rowCount() >= 1
|
||||
page.close()
|
||||
application.processEvents()
|
||||
|
||||
|
||||
def test_demo_appointment_status_counts_respect_date_scope() -> None:
|
||||
@@ -464,8 +473,7 @@ def test_appointment_multiline_cells_receive_enough_row_height(
|
||||
assert appointment_text.count("\n") == 2
|
||||
assert "2026-08-11 14:30" in appointment_text
|
||||
required = 3 * max(16, page.table.fontMetrics().lineSpacing()) + 10
|
||||
assert 60 <= page.table.rowHeight(0) <= 66
|
||||
assert page.table.rowHeight(0) >= min(required, 66)
|
||||
assert page.table.rowHeight(0) >= required
|
||||
assert page.table.item(0, 4).toolTip() == appointment_text
|
||||
page.close()
|
||||
|
||||
@@ -854,9 +862,8 @@ def test_appointments_density_fits_four_rows_in_1366_shell_viewport(
|
||||
permissions=PermissionSet(["*"]),
|
||||
current_user={"id": 1001, "role_id": 1},
|
||||
)
|
||||
# 1366x768 shell minus its 179 px appointment rail, 26 px outer gutter,
|
||||
# and 62 px top bar leaves a 1161x680 page viewport.
|
||||
page.resize(1161, 680)
|
||||
# Approved shared chrome: 208 px rail, 76 px topbar, no outer gutter.
|
||||
page.resize(1158, 692)
|
||||
page.show()
|
||||
application.processEvents()
|
||||
rows = [
|
||||
@@ -886,10 +893,12 @@ def test_appointments_density_fits_four_rows_in_1366_shell_viewport(
|
||||
application.processEvents()
|
||||
|
||||
heights = [page.table.rowHeight(index) for index in range(page.table.rowCount())]
|
||||
# 与其余列表页一致的“面包屑 + 标题 + 副标题”页头。
|
||||
assert page.header.height() == 62
|
||||
assert page.filter_panel.height() <= 84
|
||||
assert all(60 <= height <= 66 for height in heights)
|
||||
# Compact title and folded filters leave more room for the patient queue.
|
||||
assert page.header.height() >= page.header.minimumSizeHint().height()
|
||||
assert page.header.height() <= 44
|
||||
assert page.filter_panel.isHidden()
|
||||
assert all(60 <= height <= 84 for height in heights)
|
||||
assert all(page.table.cellWidget(row, 4).height() >= page.table.cellWidget(row, 4).minimumSizeHint().height() for row in range(page.table.rowCount()))
|
||||
assert page.table.viewport().height() // max(heights) >= 4
|
||||
assert page.pager.isVisibleTo(page)
|
||||
assert page.content_layout.count() == 1
|
||||
|
||||
Reference in New Issue
Block a user