Merge branch 'main' into unicode_fix

This commit is contained in:
Veronica Berglyd Olsen
2025-07-09 12:49:08 +02:00
committed by GitHub
7 changed files with 126 additions and 32 deletions
+37 -5
View File
@@ -324,23 +324,55 @@ def testCoreStatus_Entries(mockGUI, mockRnd):
@pytest.mark.core
def testCoreStatus_RefreshIcons(mockGUIwithTheme, mockRnd):
"""Test refreshing the icons of the NWStatus class."""
def testCoreStatus_RefreshIcons_Theme(mockGUIwithTheme, mockRnd):
"""Test refreshing the icons with theme colours."""
nStatus = NWStatus(NWStatus.STATUS)
nStatus.add(None, "New", "default", "SQUARE", 0)
nStatus.add(None, "Note", "red", "CIRCLE", 0)
nStatus.add(None, "Draft", "yellow", "SQUARE", 0)
nStatus.add(None, "Finished", "green", "SQUARE", 0)
beforeIcons = [nStatus[statusKeys[i]].icon for i in range(4)]
iconsA = [nStatus[statusKeys[i]].icon for i in range(4)]
themeA = [nStatus[statusKeys[i]].theme for i in range(4)]
# Refreshing the icons should generate new ones
nStatus.refreshIcons()
afterIcons = [nStatus[statusKeys[i]].icon for i in range(4)]
iconsB = [nStatus[statusKeys[i]].icon for i in range(4)]
themeB = [nStatus[statusKeys[i]].theme for i in range(4)]
for before, after in zip(beforeIcons, afterIcons, strict=False):
for before, after in zip(iconsA, iconsB, strict=False):
assert before is not after
assert themeA == themeB
@pytest.mark.core
def testCoreStatus_RefreshIcons_Custom(mockGUIwithTheme, mockRnd):
"""Test refreshing the icons with custom colours."""
nStatus = NWStatus(NWStatus.STATUS)
nStatus.add(None, "New", "#707070", "SQUARE", 0)
nStatus.add(None, "Note", "#ff0000", "CIRCLE", 0)
nStatus.add(None, "Draft", "#ffff00", "SQUARE", 0)
nStatus.add(None, "Finished", "#00ff00", "SQUARE", 0)
iconsA = [nStatus[statusKeys[i]].icon for i in range(4)]
themeA = [nStatus[statusKeys[i]].theme for i in range(4)]
colorA = [nStatus[statusKeys[i]].color.getRgb() for i in range(4)]
# Refreshing the icons should generate new ones
nStatus.refreshIcons()
iconsB = [nStatus[statusKeys[i]].icon for i in range(4)]
themeB = [nStatus[statusKeys[i]].theme for i in range(4)]
colorB = [nStatus[statusKeys[i]].color.getRgb() for i in range(4)]
for before, after in zip(iconsA, iconsB, strict=False):
assert before is not after
# But they should have the same colour value (#2452)
assert themeA == [CUSTOM_COL, CUSTOM_COL, CUSTOM_COL, CUSTOM_COL]
assert themeB == [CUSTOM_COL, CUSTOM_COL, CUSTOM_COL, CUSTOM_COL]
assert colorA == colorB
@pytest.mark.core
def testCoreStatus_Pack(mockGUIwithTheme, mockRnd):
+13 -10
View File
@@ -273,14 +273,17 @@ def testDlgPreferences_Settings(qtbot, monkeypatch, nwGUI, fncPath, tstPaths):
# Text Highlighting
prefs.dialogStyle.setCurrentData(3, 0)
prefs.allowOpenDial.setChecked(False)
prefs.dialogLine.setText("")
prefs.narratorBreak.setCurrentData("", "")
prefs.narratorDialog.setCurrentData("", "")
prefs.altDialogOpen.setText("<")
prefs.altDialogClose.setText(">")
prefs.dialogLine.setText(nwUnicode.U_EMDASH)
prefs.narratorBreak.setCurrentData(nwUnicode.U_EMDASH, "")
prefs.narratorDialog.setCurrentData(nwUnicode.U_EMDASH, "")
prefs.altDialogOpen.setText("%") # Symbol also tests for #2455
prefs.altDialogClose.setText("%") # Symbol also tests for #2455
prefs.highlightEmph.setChecked(False)
prefs.showMultiSpaces.setChecked(False)
prefs._insertDialogLineSymbol(nwUnicode.U_ENDASH)
assert prefs.dialogLine.text() == f"{nwUnicode.U_ENDASH} {nwUnicode.U_EMDASH}"
assert CONFIG.dialogStyle == 2
assert CONFIG.allowOpenDial is True
assert CONFIG.dialogLine == ""
@@ -404,11 +407,11 @@ def testDlgPreferences_Settings(qtbot, monkeypatch, nwGUI, fncPath, tstPaths):
# Text Highlighting
assert CONFIG.dialogStyle == 3
assert CONFIG.allowOpenDial is False
assert CONFIG.dialogLine == ""
assert CONFIG.narratorBreak == ""
assert CONFIG.narratorDialog == ""
assert CONFIG.altDialogOpen == "<"
assert CONFIG.altDialogClose == ">"
assert CONFIG.dialogLine == f"{nwUnicode.U_ENDASH}{nwUnicode.U_EMDASH}"
assert CONFIG.narratorBreak == nwUnicode.U_EMDASH
assert CONFIG.narratorDialog == nwUnicode.U_EMDASH
assert CONFIG.altDialogOpen == "%"
assert CONFIG.altDialogClose == "%"
assert CONFIG.highlightEmph is False
assert CONFIG.showMultiSpaces is False