v0.44.1: Preferences headings stay bold under the app's style sheet
The headings were set with setFont, which the app's own style sheet (theme.apply_theme) overrides on re-polish — bold in a bare dialog, plain in the running app. A style sheet on the heading itself wins. The test now applies the theme first, as the app does.
This commit is contained in:
@@ -161,14 +161,19 @@ def _prefs_dialog(prefs):
|
||||
|
||||
class TestHeadings:
|
||||
def test_bold_and_two_px_larger(self, qapp, tmp_path):
|
||||
dialog = _prefs_dialog(Preferences(tmp_path))
|
||||
from lintunes import theme
|
||||
prefs = Preferences(tmp_path)
|
||||
theme.apply_theme(QApplication.instance(), prefs) # as the app runs
|
||||
dialog = _prefs_dialog(prefs)
|
||||
dialog.show()
|
||||
text_px = QFontInfo(QApplication.font()).pixelSize()
|
||||
headings = dialog.findChildren(QLabel, "prefs-heading")
|
||||
assert {h.text() for h in headings} >= {"Interface", "Visualizer",
|
||||
"Colors", "Last.fm"}
|
||||
for heading in headings:
|
||||
assert heading.font().bold()
|
||||
assert heading.font().pixelSize() == text_px + 2
|
||||
assert QFontInfo(heading.font()).pixelSize() == text_px + 2
|
||||
dialog.close()
|
||||
|
||||
def test_the_boxes_contents_stay_plain(self, qapp, tmp_path):
|
||||
dialog = _prefs_dialog(Preferences(tmp_path))
|
||||
|
||||
Reference in New Issue
Block a user