Update tests
This commit is contained in:
@@ -783,10 +783,6 @@ def testGuiEditor_BlockFormatting(qtbot, monkeypatch, nwGUI, nwMinimal, ipsumTex
|
|||||||
mp.setattr(QTextBlock, "isValid", lambda *a, **k: False)
|
mp.setattr(QTextBlock, "isValid", lambda *a, **k: False)
|
||||||
assert nwGUI.docEditor._formatBlock(nwDocAction.BLOCK_TXT) is False
|
assert nwGUI.docEditor._formatBlock(nwDocAction.BLOCK_TXT) is False
|
||||||
|
|
||||||
# Empty Block
|
|
||||||
assert nwGUI.docEditor.setCursorLine(1) is True
|
|
||||||
assert nwGUI.docEditor._formatBlock(nwDocAction.BLOCK_TXT) is False
|
|
||||||
|
|
||||||
# Keyword
|
# Keyword
|
||||||
assert nwGUI.docEditor.replaceText("@pov: Jane\n\n") is True
|
assert nwGUI.docEditor.replaceText("@pov: Jane\n\n") is True
|
||||||
assert nwGUI.docEditor.setCursorPosition(5) is True
|
assert nwGUI.docEditor.setCursorPosition(5) is True
|
||||||
|
|||||||
@@ -116,6 +116,16 @@ def testGuiMenu_EditFormat(qtbot, monkeypatch, nwGUI, nwLipsum):
|
|||||||
fmtStr = "#### Pellentesque nec erat ut nulla posuere commodo."
|
fmtStr = "#### Pellentesque nec erat ut nulla posuere commodo."
|
||||||
assert nwGUI.docEditor.getText()[39:91] == fmtStr
|
assert nwGUI.docEditor.getText()[39:91] == fmtStr
|
||||||
|
|
||||||
|
# Title Format
|
||||||
|
nwGUI.mainMenu.aFmtTitle.activate(QAction.Trigger)
|
||||||
|
fmtStr = "#! Pellentesque nec erat ut nulla posuere commodo."
|
||||||
|
assert nwGUI.docEditor.getText()[39:89] == fmtStr
|
||||||
|
|
||||||
|
# Unnumbered Chapter
|
||||||
|
nwGUI.mainMenu.aFmtUnNum.activate(QAction.Trigger)
|
||||||
|
fmtStr = "##! Pellentesque nec erat ut nulla posuere commodo."
|
||||||
|
assert nwGUI.docEditor.getText()[39:90] == fmtStr
|
||||||
|
|
||||||
# Clear Format
|
# Clear Format
|
||||||
nwGUI.mainMenu.aFmtNoFormat.activate(QAction.Trigger)
|
nwGUI.mainMenu.aFmtNoFormat.activate(QAction.Trigger)
|
||||||
assert nwGUI.docEditor.getText()[39:86] == cleanText
|
assert nwGUI.docEditor.getText()[39:86] == cleanText
|
||||||
@@ -314,10 +324,6 @@ def testGuiMenu_EditFormat(qtbot, monkeypatch, nwGUI, nwLipsum):
|
|||||||
assert nwGUI.docEditor.setCursorPosition(17)
|
assert nwGUI.docEditor.setCursorPosition(17)
|
||||||
assert not nwGUI.docEditor._formatBlock(nwDocAction.BLOCK_TXT)
|
assert not nwGUI.docEditor._formatBlock(nwDocAction.BLOCK_TXT)
|
||||||
|
|
||||||
# Cannot Format Empty Line
|
|
||||||
assert nwGUI.docEditor.setCursorPosition(13)
|
|
||||||
assert not nwGUI.docEditor._formatBlock(nwDocAction.BLOCK_TXT)
|
|
||||||
|
|
||||||
# Invalid Action
|
# Invalid Action
|
||||||
assert nwGUI.docEditor.setCursorPosition(30)
|
assert nwGUI.docEditor.setCursorPosition(30)
|
||||||
assert not nwGUI.docEditor._formatBlock(nwDocAction.NO_ACTION)
|
assert not nwGUI.docEditor._formatBlock(nwDocAction.NO_ACTION)
|
||||||
|
|||||||
Reference in New Issue
Block a user