Update and reorganise themes (#893)
* Drop the subfolders for GUI themes * Remove bundled font support * Add safe file read function * Allow loading themes from multiple locations * Clean up unused variables * Clean up icons class * Merge icon theme icons * Update icon theme class * Remove guiDark config setting * Fix tests * Fix handling of default theme * Update icon readmes * Add test for getGuiItem common function
This commit is contained in:
committed by
GitHub
parent
be3376272e
commit
15ec1496c5
@@ -29,12 +29,13 @@ from datetime import datetime
|
||||
from mock import causeOSError
|
||||
from tools import writeFile
|
||||
|
||||
from novelwriter.guimain import GuiMain
|
||||
from novelwriter.common import (
|
||||
checkString, checkInt, checkBool, checkHandle, isHandle, isTitleTag,
|
||||
isItemClass, isItemType, isItemLayout, hexToInt, formatInt,
|
||||
formatTimeStamp, formatTime, parseTimeStamp, splitVersionNumber,
|
||||
transferCase, fuzzyTime, numberToRoman, jsonEncode, makeFileNameSafe,
|
||||
sha256sum, NWConfigParser
|
||||
transferCase, fuzzyTime, numberToRoman, jsonEncode, readTextFile,
|
||||
makeFileNameSafe, sha256sum, getGuiItem, NWConfigParser
|
||||
)
|
||||
|
||||
|
||||
@@ -456,6 +457,24 @@ def testBaseCommon_JsonEncode():
|
||||
# END Test testBaseCommon_JsonEncode
|
||||
|
||||
|
||||
@pytest.mark.base
|
||||
def testBaseCommon_ReadTextFile(monkeypatch, fncDir, ipsumText):
|
||||
"""Test the readTextFile function.
|
||||
"""
|
||||
testText = "\n\n".join(ipsumText) + "\n"
|
||||
testFile = os.path.join(fncDir, "ipsum.txt")
|
||||
writeFile(testFile, testText)
|
||||
|
||||
assert readTextFile(os.path.join(fncDir, "not_a_file.txt")) == ""
|
||||
assert readTextFile(testFile) == testText
|
||||
|
||||
with monkeypatch.context() as mp:
|
||||
mp.setattr("builtins.open", causeOSError)
|
||||
assert readTextFile(testFile) == ""
|
||||
|
||||
# END Test testBaseCommon_ReadTextFile
|
||||
|
||||
|
||||
@pytest.mark.base
|
||||
def testBaseCommon_MakeFileNameSafe():
|
||||
"""Test the makeFileNameSafe function.
|
||||
@@ -508,6 +527,16 @@ def testBaseCommon_Sha256Sum(monkeypatch, fncDir, ipsumText):
|
||||
# END Test testBaseCommon_Sha256Sum
|
||||
|
||||
|
||||
@pytest.mark.base
|
||||
def testBaseCommon_GetGuiItem(nwGUI):
|
||||
"""Check the GUI item function.
|
||||
"""
|
||||
assert getGuiItem("gibberish") is None
|
||||
assert isinstance(getGuiItem("GuiMain"), GuiMain)
|
||||
|
||||
# END Test testBaseCommon_GetGuiItem
|
||||
|
||||
|
||||
@pytest.mark.base
|
||||
def testBaseCommon_NWConfigParser(fncDir):
|
||||
"""Test the NWConfigParser subclass.
|
||||
|
||||
Reference in New Issue
Block a user