Add test coverage of doc tools

This commit is contained in:
Veronica Berglyd Olsen
2022-10-10 16:35:13 +02:00
parent 747a1a212c
commit b96c1e9f09
7 changed files with 204 additions and 10 deletions
+1 -1
View File
@@ -110,7 +110,7 @@ class DocMerger:
if docText:
self._targetText.insert(0, docText)
status = outDoc.writeDocument("\n\n".join(self._targetText))
status = outDoc.writeDocument("\n\n".join(self._targetText) + "\n\n")
if not status:
self._error = outDoc.getError()
+2 -2
View File
@@ -176,7 +176,7 @@ class NWProject():
self._projTree.updateItemData(newItem.itemHandle)
return newItem.itemHandle
def writeNewFile(self, tHandle, hLevel, isDocument):
def writeNewFile(self, tHandle, hLevel, isDocument, addText=""):
"""Write content to a new document after it is created. This
will not run if the file exists and is not empty.
"""
@@ -191,7 +191,7 @@ class NWProject():
return False
hshText = "#"*minmax(hLevel, 1, 4)
newText = f"{hshText} {tItem.itemName}\n\n"
newText = f"{hshText} {tItem.itemName}\n\n{addText}"
if tItem.isNovelLike() and isDocument:
tItem.setLayout(nwItemLayout.DOCUMENT)
else: