Add icon colour settings to themes and enforce them on all GUI icons
This commit is contained in:
@@ -185,13 +185,13 @@ def testExtModified_NClickableLabel(qtbot):
|
||||
|
||||
|
||||
@pytest.mark.gui
|
||||
def testExtModified_ToolButtons(qtbot):
|
||||
def testExtModified_ToolButtons(qtbot, mockGUI):
|
||||
"""Test the NIconToolButton and NIconToggleButton classes."""
|
||||
dialog = SimpleDialog(None)
|
||||
|
||||
size = QSize(16, 16)
|
||||
button1 = NIconToolButton(dialog, size, "add", "green")
|
||||
button2 = NIconToggleButton(dialog, size, "bullet")
|
||||
button1 = NIconToolButton(dialog, size, "add", "add")
|
||||
button2 = NIconToggleButton(dialog, size, "bullet", "action")
|
||||
|
||||
assert button1.iconSize() == size
|
||||
assert button2.iconSize() == size
|
||||
|
||||
@@ -421,36 +421,36 @@ def testGuiTheme_LoadIcons():
|
||||
# ==========
|
||||
|
||||
# Load an unknown icon
|
||||
qIcon = iconCache.getIcon("stuff")
|
||||
qIcon = iconCache.getIcon("stuff", "tool")
|
||||
assert isinstance(qIcon, QIcon)
|
||||
assert qIcon == iconCache._noIcon
|
||||
|
||||
# Load an icon, it is likely already cached
|
||||
qIcon = iconCache.getIcon("add")
|
||||
qIcon = iconCache.getIcon("add", "tool")
|
||||
assert isinstance(qIcon, QIcon)
|
||||
assert qIcon.isNull() is False
|
||||
|
||||
# Load it as a pixmap with a size
|
||||
# If this part of the test fails, you may need to set the
|
||||
# environment variable: QT_SCALE_FACTOR=1
|
||||
qPix = iconCache.getPixmap("add", (50, 50))
|
||||
qPix = iconCache.getPixmap("add", (50, 50), "tool")
|
||||
assert isinstance(qPix, QPixmap)
|
||||
assert qPix.isNull() is False
|
||||
assert qPix.width() == 50, "If this fails, make sure QT_SCALE_FACTOR=1"
|
||||
assert qPix.height() == 50, "If this fails, make sure QT_SCALE_FACTOR=1"
|
||||
|
||||
# Load app icon
|
||||
qIcon = iconCache.getIcon("novelwriter")
|
||||
qIcon = iconCache.getIcon("novelwriter", "tool")
|
||||
assert isinstance(qIcon, QIcon)
|
||||
assert qIcon != iconCache._noIcon
|
||||
|
||||
# Load mime icon
|
||||
qIcon = iconCache.getIcon("proj_nwx")
|
||||
qIcon = iconCache.getIcon("proj_nwx", "tool")
|
||||
assert isinstance(qIcon, QIcon)
|
||||
assert qIcon != iconCache._noIcon
|
||||
|
||||
# Toggle icon
|
||||
qIcon = iconCache.getToggleIcon("bullet", (24, 24))
|
||||
qIcon = iconCache.getToggleIcon("bullet", (24, 24), "tool")
|
||||
assert isinstance(qIcon, QIcon)
|
||||
assert qIcon != iconCache._noIcon
|
||||
pOn = qIcon.pixmap(24, 24, QIcon.Mode.Normal, QIcon.State.On)
|
||||
@@ -458,7 +458,7 @@ def testGuiTheme_LoadIcons():
|
||||
assert pOn != pOff
|
||||
|
||||
# Unknown toggle icon
|
||||
qIcon = iconCache.getToggleIcon("stuff", (24, 24))
|
||||
qIcon = iconCache.getToggleIcon("stuff", (24, 24), "tool")
|
||||
assert isinstance(qIcon, QIcon)
|
||||
assert qIcon == iconCache._noIcon
|
||||
|
||||
@@ -610,7 +610,7 @@ def testGuiTheme_CheckTheme(theme):
|
||||
parser = ConfigParser()
|
||||
parser.read(current.path, encoding="utf-8")
|
||||
|
||||
sections = ["Main", "Base", "Project", "Palette", "GUI", "Syntax"]
|
||||
sections = ["Main", "Base", "Project", "Icon", "Palette", "GUI", "Syntax"]
|
||||
assert sorted(parser.sections()) == sorted(sections)
|
||||
|
||||
structure = {
|
||||
@@ -625,6 +625,11 @@ def testGuiTheme_CheckTheme(theme):
|
||||
"root", "folder", "file", "title", "chapter", "scene", "note",
|
||||
"active", "inactive", "disabled",
|
||||
],
|
||||
"Icon": [
|
||||
"tool", "accept", "reject", "action", "altaction", "apply",
|
||||
"create", "destroy", "reset", "add", "change", "remove",
|
||||
"scformat", "mdformat", "systemio", "info", "warning", "error",
|
||||
],
|
||||
"Palette": [
|
||||
"window", "windowtext", "base", "alternatebase", "text",
|
||||
"tooltipbase", "tooltiptext", "button", "buttontext", "brighttext",
|
||||
|
||||
Reference in New Issue
Block a user