Make the item class non-dynamic, and cache formatting vars in editor

This commit is contained in:
Veronica Berglyd Olsen
2022-11-11 17:09:03 +01:00
parent b05028e3c9
commit 612034f6be
5 changed files with 80 additions and 57 deletions
+3 -3
View File
@@ -133,11 +133,11 @@ def testCoreItem_Setters(mockGUI, mockRnd, fncPath):
theItem.setExpanded("What?")
assert theItem.isExpanded is False
theItem.setExpanded("True")
assert theItem.isExpanded is True
assert theItem.isExpanded is False
theItem.setExpanded(True)
assert theItem.isExpanded is True
# Exported
# Active
theItem.setActive(8)
assert theItem.isActive is False
theItem.setActive(None)
@@ -147,7 +147,7 @@ def testCoreItem_Setters(mockGUI, mockRnd, fncPath):
theItem.setActive("What?")
assert theItem.isActive is False
theItem.setActive("True")
assert theItem.isActive is True
assert theItem.isActive is False
theItem.setActive(True)
assert theItem.isActive is True
+6 -6
View File
@@ -432,19 +432,19 @@ def testGuiMain_Editing(qtbot, monkeypatch, nwGUI, projPath, tstPaths, mockRnd):
qtbot.keyClick(nwGUI.docEditor, Qt.Key_Return, delay=KEY_DELAY)
# Insert spaces before and after quotes
nwGUI.mainConf.fmtPadBefore = "\u201d"
nwGUI.mainConf.fmtPadAfter = "\u201c"
nwGUI.docEditor._typPadBefore = "\u201d"
nwGUI.docEditor._typPadAfter = "\u201c"
for c in "Some \"double quoted text with spaces padded\".":
qtbot.keyClick(nwGUI.docEditor, c, delay=KEY_DELAY)
qtbot.keyClick(nwGUI.docEditor, Qt.Key_Return, delay=KEY_DELAY)
qtbot.keyClick(nwGUI.docEditor, Qt.Key_Return, delay=KEY_DELAY)
nwGUI.mainConf.fmtPadBefore = ""
nwGUI.mainConf.fmtPadAfter = ""
nwGUI.docEditor._typPadBefore = ""
nwGUI.docEditor._typPadAfter = ""
# Insert spaces before colon, but ignore tags and synopsis
nwGUI.mainConf.fmtPadBefore = ":"
nwGUI.docEditor._typPadBefore = ":"
for c in "@object: NoSpaceAdded":
qtbot.keyClick(nwGUI.docEditor, c, delay=KEY_DELAY)
@@ -466,7 +466,7 @@ def testGuiMain_Editing(qtbot, monkeypatch, nwGUI, projPath, tstPaths, mockRnd):
qtbot.keyClick(nwGUI.docEditor, Qt.Key_Return, delay=KEY_DELAY)
qtbot.keyClick(nwGUI.docEditor, Qt.Key_Return, delay=KEY_DELAY)
nwGUI.mainConf.fmtPadBefore = ""
nwGUI.docEditor._typPadBefore = ""
# Indent and Align
# ================