Add menu entry and update tests

This commit is contained in:
Veronica Berglyd Olsen
2024-03-12 18:12:47 +01:00
parent 44721fc797
commit 1bd82954c2
7 changed files with 76 additions and 16 deletions
+15 -1
View File
@@ -1134,13 +1134,20 @@ def testGuiEditor_BlockFormatting(qtbot, monkeypatch, nwGUI, projPath, ipsumText
assert nwGUI.docEditor.getText() == "Title\n\n"
assert nwGUI.docEditor.getCursorPosition() == 2
# Strip Unnumbered CHapter
# Strip Unnumbered Chapter
nwGUI.docEditor.replaceText("##! Title\n\n")
nwGUI.docEditor.setCursorPosition(5)
assert nwGUI.docEditor._formatBlock(nwDocAction.BLOCK_TXT) is True
assert nwGUI.docEditor.getText() == "Title\n\n"
assert nwGUI.docEditor.getCursorPosition() == 1
# Strip Hard Scene
nwGUI.docEditor.replaceText("###! Title\n\n")
nwGUI.docEditor.setCursorPosition(6)
assert nwGUI.docEditor._formatBlock(nwDocAction.BLOCK_TXT) is True
assert nwGUI.docEditor.getText() == "Title\n\n"
assert nwGUI.docEditor.getCursorPosition() == 1
# Strip Text
nwGUI.docEditor.replaceText("Generic text\n\n")
nwGUI.docEditor.setCursorPosition(5)
@@ -1302,6 +1309,13 @@ def testGuiEditor_BlockFormatting(qtbot, monkeypatch, nwGUI, projPath, ipsumText
assert nwGUI.docEditor.getText() == "##! Some text\n\n"
assert nwGUI.docEditor.getCursorPosition() == 9
# Hard Scene
nwGUI.docEditor.replaceText("Some text\n\n")
nwGUI.docEditor.setCursorPosition(5)
assert nwGUI.docEditor._formatBlock(nwDocAction.BLOCK_HSC) is True
assert nwGUI.docEditor.getText() == "###! Some text\n\n"
assert nwGUI.docEditor.getCursorPosition() == 10
# Left Indent
nwGUI.docEditor.replaceText("Some text\n\n")
nwGUI.docEditor.setCursorPosition(5)
+5
View File
@@ -126,6 +126,11 @@ def testGuiMenu_EditFormat(qtbot, monkeypatch, nwGUI, prjLipsum):
fmtStr = "##! Pellentesque nec erat ut nulla posuere commodo."
assert nwGUI.docEditor.getText()[54:105] == fmtStr
# Hard Scene
nwGUI.mainMenu.aFmtHardSc.activate(QAction.Trigger)
fmtStr = "###! Pellentesque nec erat ut nulla posuere commodo."
assert nwGUI.docEditor.getText()[54:106] == fmtStr
# Clear Format
nwGUI.mainMenu.aFmtNoFormat.activate(QAction.Trigger)
assert nwGUI.docEditor.getText()[54:101] == cleanText