更新
This commit is contained in:
@@ -4,8 +4,16 @@ from types import SimpleNamespace
|
||||
from typing import Any
|
||||
|
||||
from PySide6.QtCore import QCoreApplication, QSettings
|
||||
from PySide6.QtGui import QPageSize, QRawFont
|
||||
from PySide6.QtWidgets import QApplication, QDialog, QDialogButtonBox, QMessageBox, QVBoxLayout
|
||||
from PySide6.QtGui import QFont, QPageSize, QRawFont
|
||||
from PySide6.QtWidgets import (
|
||||
QApplication,
|
||||
QDialog,
|
||||
QDialogButtonBox,
|
||||
QLabel,
|
||||
QMessageBox,
|
||||
QPushButton,
|
||||
QVBoxLayout,
|
||||
)
|
||||
|
||||
from doctor_workstation import app as app_module
|
||||
from doctor_workstation.app import ApplicationController
|
||||
@@ -54,12 +62,25 @@ def test_theme_resolves_real_chinese_glyphs() -> None:
|
||||
application = QApplication.instance() or QApplication([])
|
||||
apply_theme(application)
|
||||
raw_font = QRawFont.fromFont(application.font())
|
||||
assert raw_font.familyName() == "Noto Sans SC"
|
||||
assert not application.font().styleStrategy() & QFont.StyleStrategy.NoSubpixelAntialias
|
||||
assert application.font().hintingPreference() == QFont.HintingPreference.PreferDefaultHinting
|
||||
glyphs = raw_font.glyphIndexesForString("甄养堂医生工作站")
|
||||
|
||||
assert glyphs
|
||||
assert all(glyph > 0 for glyph in glyphs)
|
||||
assert len(set(glyphs)) > 1
|
||||
|
||||
# QSS must not override the resolved platform face on real controls.
|
||||
for widget in (QLabel("甄养堂医生工作站"), QPushButton("确认接诊")):
|
||||
widget.ensurePolished()
|
||||
resolved = QRawFont.fromFont(widget.font())
|
||||
assert resolved.familyName() == raw_font.familyName()
|
||||
assert all(glyph > 0 for glyph in resolved.glyphIndexesForString(widget.text()))
|
||||
assert not widget.font().styleStrategy() & QFont.StyleStrategy.NoSubpixelAntialias
|
||||
assert widget.font().hintingPreference() == QFont.HintingPreference.PreferDefaultHinting
|
||||
widget.close()
|
||||
|
||||
|
||||
def test_theme_marks_dynamic_business_dialogs_and_semantic_buttons() -> None:
|
||||
application = QApplication.instance() or QApplication([])
|
||||
|
||||
Reference in New Issue
Block a user