Various tweaks to theme, more code coverage

This commit is contained in:
Miguel Jacq 2025-11-06 11:47:00 +11:00
parent c3b83b0238
commit 7c3ec19748
Signed by: mig5
GPG key ID: 59B3F0C24135C6A9
17 changed files with 812 additions and 49 deletions

View file

@ -0,0 +1,23 @@
from bouquin.toolbar import ToolBar
def test_style_letter_button_handles_missing_widget(qtbot):
tb = ToolBar()
qtbot.addWidget(tb)
# Create a dummy action detached from toolbar to force widgetForAction->None
from PySide6.QtGui import QAction
act = QAction("X", tb)
# No crash and early return
tb._style_letter_button(act, "X")
def test_style_letter_button_sets_tooltip_and_accessible(qtbot):
tb = ToolBar()
qtbot.addWidget(tb)
# Use an existing action so widgetForAction returns a button
act = tb.actBold
tb._style_letter_button(act, "B", bold=True, tooltip="Bold")
btn = tb.widgetForAction(act)
assert btn.toolTip() == "Bold"
assert btn.accessibleName() == "Bold"