Process pad before and after settings in Preferences (#1985)

This commit is contained in:
Veronica Berglyd Olsen
2024-07-21 19:06:45 +02:00
parent 7140788b48
commit 0d84653f7d
3 changed files with 42 additions and 11 deletions
+27 -6
View File
@@ -32,12 +32,12 @@ from PyQt5.QtGui import QColor, QDesktopServices, QFontDatabase
from novelwriter.common import (
NWConfigParser, checkBool, checkFloat, checkInt, checkIntTuple, checkPath,
checkString, checkStringNone, checkUuid, cssCol, describeFont, elide,
formatFileFilter, formatInt, formatTime, formatTimeStamp, formatVersion,
fuzzyTime, getFileSize, hexToInt, isHandle, isItemClass, isItemLayout,
isItemType, isListInstance, isTitleTag, jsonEncode, makeFileNameSafe,
minmax, numberToRoman, openExternalPath, readTextFile, simplified,
transferCase, xmlIndent, yesNo
checkString, checkStringNone, checkUuid, compact, cssCol, describeFont,
elide, formatFileFilter, formatInt, formatTime, formatTimeStamp,
formatVersion, fuzzyTime, getFileSize, hexToInt, isHandle, isItemClass,
isItemLayout, isItemType, isListInstance, isTitleTag, jsonEncode,
makeFileNameSafe, minmax, numberToRoman, openExternalPath, readTextFile,
simplified, transferCase, uniqueCompact, xmlIndent, yesNo
)
from tests.mocked import causeOSError
@@ -346,6 +346,27 @@ def testBaseCommon_simplified():
assert simplified("\tHello\n\r\tWorld") == "Hello World"
@pytest.mark.base
def testBaseCommon_compact():
"""Test the compact function."""
assert compact("! ! !") == "!!!"
assert compact("1\t2\t3") == "123"
assert compact("1\n2\n3") == "123"
assert compact("1\r2\r3") == "123"
assert compact("1\u00a02\u00a03") == "123"
@pytest.mark.base
def testBaseCommon_uniqueCompact():
"""Test the uniqueCompact function."""
assert uniqueCompact("! ! !") == "!"
assert uniqueCompact("1\t2\t3") == "123"
assert uniqueCompact("1\n2\n3") == "123"
assert uniqueCompact("1\r2\r3") == "123"
assert uniqueCompact("1\u00a02\u00a03") == "123"
assert uniqueCompact("3 2 1") == "123"
@pytest.mark.base
def testBaseCommon_elide():
"""Test the elide function."""