Update tests

This commit is contained in:
Veronica Berglyd Olsen
2024-02-10 15:49:49 +01:00
parent 9c1bdef9ad
commit c3e6b4e10a
3 changed files with 30 additions and 3 deletions
+3 -3
View File
@@ -782,9 +782,9 @@ class GuiMainMenu(QMenuBar):
)
# Format > Ignore Text
self.aFmtComment = self.fmtMenu.addAction(self.tr("Toggle Ignore Text"))
self.aFmtComment.setShortcut("Ctrl+Shift+D")
self.aFmtComment.triggered.connect(
self.aFmtIgnore = self.fmtMenu.addAction(self.tr("Toggle Ignore Text"))
self.aFmtIgnore.setShortcut("Ctrl+Shift+D")
self.aFmtIgnore.triggered.connect(
lambda: self.requestDocAction.emit(nwDocAction.BLOCK_IGN)
)
+8
View File
@@ -452,6 +452,14 @@ def testCoreToken_MetaFormat(mockGUI):
tokens.tokenizeText()
assert tokens.allMarkdown[-1] == "% A comment\n\n"
# Ignore Text
tokens._text = "%~ Some text\n"
tokens.tokenizeText()
assert tokens._tokens == [
(Tokenizer.T_EMPTY, 0, "", [], Tokenizer.A_NONE),
]
assert tokens.allMarkdown[-1] == "\n"
# Synopsis
tokens._text = "%synopsis: The synopsis\n"
tokens.tokenizeText()
+19
View File
@@ -579,6 +579,11 @@ def testGuiEditor_Actions(qtbot, nwGUI, projPath, ipsumText, mockRnd):
assert nwGUI.docEditor.docAction(nwDocAction.BLOCK_COM) is True
assert nwGUI.docEditor.getText() == "#### Scene Title\n\n% Scene text.\n\n"
# Ignore Text
nwGUI.docEditor.setCursorPosition(20)
assert nwGUI.docEditor.docAction(nwDocAction.BLOCK_IGN) is True
assert nwGUI.docEditor.getText() == "#### Scene Title\n\n%~ Scene text.\n\n"
# Text
nwGUI.docEditor.setCursorPosition(20)
assert nwGUI.docEditor.docAction(nwDocAction.BLOCK_TXT) is True
@@ -1202,6 +1207,20 @@ def testGuiEditor_BlockFormatting(qtbot, monkeypatch, nwGUI, projPath, ipsumText
assert nwGUI.docEditor.getText() == "Some text\n\n"
assert nwGUI.docEditor.getCursorPosition() == 4
# Toggle Ignore Text w/Space
nwGUI.docEditor.replaceText("%~ Some text\n\n")
nwGUI.docEditor.setCursorPosition(5)
assert nwGUI.docEditor._formatBlock(nwDocAction.BLOCK_IGN) is True
assert nwGUI.docEditor.getText() == "Some text\n\n"
assert nwGUI.docEditor.getCursorPosition() == 2
# Toggle Ignore Text wo/Space
nwGUI.docEditor.replaceText("%~Some text\n\n")
nwGUI.docEditor.setCursorPosition(5)
assert nwGUI.docEditor._formatBlock(nwDocAction.BLOCK_IGN) is True
assert nwGUI.docEditor.getText() == "Some text\n\n"
assert nwGUI.docEditor.getCursorPosition() == 3
# Header 1
nwGUI.docEditor.replaceText("Some text\n\n")
nwGUI.docEditor.setCursorPosition(5)