Add test coverage
This commit is contained in:
@@ -40,7 +40,7 @@ typeDelay = 1
|
|||||||
stepDelay = 20
|
stepDelay = 20
|
||||||
|
|
||||||
@pytest.mark.gui
|
@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.
|
"""Test the document editor.
|
||||||
"""
|
"""
|
||||||
# Block message box
|
# Block message box
|
||||||
|
|||||||
@@ -236,6 +236,47 @@ def testGuiMenu_EditFormat(qtbot, monkeypatch, nwGUI, nwLipsum):
|
|||||||
"Also text with “double” quotes which are “less tricky”.\n\n"
|
"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
|
# Test Invalid Document Action
|
||||||
assert not nwGUI.docEditor.docAction(nwDocAction.NO_ACTION)
|
assert not nwGUI.docEditor.docAction(nwDocAction.NO_ACTION)
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user