更新
This commit is contained in:
@@ -4,8 +4,8 @@ from types import SimpleNamespace
|
||||
from typing import Any
|
||||
|
||||
from PySide6.QtCore import QCoreApplication, QSettings
|
||||
from PySide6.QtGui import QPageSize
|
||||
from PySide6.QtWidgets import QApplication, QDialogButtonBox, QMessageBox
|
||||
from PySide6.QtGui import QPageSize, QRawFont
|
||||
from PySide6.QtWidgets import QApplication, QDialog, QDialogButtonBox, QMessageBox, QVBoxLayout
|
||||
|
||||
from doctor_workstation import app as app_module
|
||||
from doctor_workstation.app import ApplicationController
|
||||
@@ -17,6 +17,7 @@ from doctor_workstation.ui import widgets as widget_module
|
||||
from doctor_workstation.ui.login import LoginWindow
|
||||
from doctor_workstation.ui.pages.consultations import _video_payload
|
||||
from doctor_workstation.ui.shell import NAVIGATION
|
||||
from doctor_workstation.ui.theme import apply_theme
|
||||
from doctor_workstation.ui.widgets import (
|
||||
friendly_error,
|
||||
gender_text,
|
||||
@@ -47,6 +48,39 @@ def test_gender_text_maps_legacy_codes_and_preserves_labels() -> None:
|
||||
assert gender_text("未知标签") == "未知标签"
|
||||
|
||||
|
||||
def test_theme_resolves_real_chinese_glyphs() -> None:
|
||||
"""Guard packaged/offscreen builds against rendering every CJK glyph as tofu."""
|
||||
|
||||
application = QApplication.instance() or QApplication([])
|
||||
apply_theme(application)
|
||||
raw_font = QRawFont.fromFont(application.font())
|
||||
glyphs = raw_font.glyphIndexesForString("甄养堂医生工作站")
|
||||
|
||||
assert glyphs
|
||||
assert all(glyph > 0 for glyph in glyphs)
|
||||
assert len(set(glyphs)) > 1
|
||||
|
||||
|
||||
def test_theme_marks_dynamic_business_dialogs_and_semantic_buttons() -> None:
|
||||
application = QApplication.instance() or QApplication([])
|
||||
apply_theme(application)
|
||||
dialog = QDialog()
|
||||
buttons = QDialogButtonBox(
|
||||
QDialogButtonBox.StandardButton.Save | QDialogButtonBox.StandardButton.Cancel,
|
||||
parent=dialog,
|
||||
)
|
||||
QVBoxLayout(dialog).addWidget(buttons)
|
||||
|
||||
dialog.show()
|
||||
application.processEvents()
|
||||
|
||||
assert dialog.property("businessDialog") is True
|
||||
assert buttons.button(QDialogButtonBox.StandardButton.Save).property("variant") == "primary"
|
||||
assert buttons.button(QDialogButtonBox.StandardButton.Cancel).property("variant") == "secondary"
|
||||
dialog.close()
|
||||
application.processEvents()
|
||||
|
||||
|
||||
def test_navigation_requires_each_pages_actual_list_capability() -> None:
|
||||
assert {item.key: item.permissions for item in NAVIGATION} == {
|
||||
"reception": ("doctor.appointment/lists",),
|
||||
|
||||
Reference in New Issue
Block a user