Add test coverage

This commit is contained in:
Veronica Berglyd Olsen
2021-05-23 15:04:26 +02:00
parent 729e97a95d
commit 2314777b4b
2 changed files with 42 additions and 1 deletions
+1 -1
View File
@@ -40,7 +40,7 @@ typeDelay = 1
stepDelay = 20
@pytest.mark.gui
def testGuiEditor_Main(qtbot, monkeypatch, nwGUI, fncDir, fncProj, refDir, outDir):
def testGuiEditor_Main(qtbot, monkeypatch, nwGUI, fncProj, refDir, outDir):
"""Test the document editor.
"""
# Block message box
+41
View File
@@ -236,6 +236,47 @@ def testGuiMenu_EditFormat(qtbot, monkeypatch, nwGUI, nwLipsum):
"Also text with “double” quotes which are “less tricky”.\n\n"
)
# Remove in-paragraph line breaks
nwGUI.docEditor.setText((
"### New Text\n\n"
"@char: Someone\n"
"@location: Somewhere\n\n"
"% Some comment ...\n\n"
"Here is some text\non multiple\nlines.\n\n"
"With another paragraph\nhere."
))
nwGUI.mainMenu.aFmtRmBreaks.activate(QAction.Trigger)
assert nwGUI.docEditor.getText() == (
"### New Text\n\n"
"@char: Someone\n"
"@location: Somewhere\n\n"
"% Some comment ...\n\n"
"Here is some text on multiple lines.\n\n"
"With another paragraph here.\n"
)
nwGUI.docEditor.setText((
"### New Text\n\n"
"@char: Someone\n"
"@location: Somewhere\n\n"
"% Some comment ...\n\n"
"Here is some text\non multiple\nlines.\n\n"
"With another paragraph\nhere."
))
theCursor = nwGUI.docEditor.textCursor()
theCursor.setPosition(74)
theCursor.movePosition(QTextCursor.Right, QTextCursor.KeepAnchor, 29)
nwGUI.docEditor.setTextCursor(theCursor)
nwGUI.mainMenu.aFmtRmBreaks.activate(QAction.Trigger)
assert nwGUI.docEditor.getText() == (
"### New Text\n\n"
"@char: Someone\n"
"@location: Somewhere\n\n"
"% Some comment ...\n\n"
"Here is some text on multiple lines.\n\n"
"With another paragraph\nhere."
)
# Test Invalid Document Action
assert not nwGUI.docEditor.docAction(nwDocAction.NO_ACTION)