Update tests
This commit is contained in:
@@ -782,9 +782,9 @@ class GuiMainMenu(QMenuBar):
|
|||||||
)
|
)
|
||||||
|
|
||||||
# Format > Ignore Text
|
# Format > Ignore Text
|
||||||
self.aFmtComment = self.fmtMenu.addAction(self.tr("Toggle Ignore Text"))
|
self.aFmtIgnore = self.fmtMenu.addAction(self.tr("Toggle Ignore Text"))
|
||||||
self.aFmtComment.setShortcut("Ctrl+Shift+D")
|
self.aFmtIgnore.setShortcut("Ctrl+Shift+D")
|
||||||
self.aFmtComment.triggered.connect(
|
self.aFmtIgnore.triggered.connect(
|
||||||
lambda: self.requestDocAction.emit(nwDocAction.BLOCK_IGN)
|
lambda: self.requestDocAction.emit(nwDocAction.BLOCK_IGN)
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|||||||
@@ -452,6 +452,14 @@ def testCoreToken_MetaFormat(mockGUI):
|
|||||||
tokens.tokenizeText()
|
tokens.tokenizeText()
|
||||||
assert tokens.allMarkdown[-1] == "% A comment\n\n"
|
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
|
# Synopsis
|
||||||
tokens._text = "%synopsis: The synopsis\n"
|
tokens._text = "%synopsis: The synopsis\n"
|
||||||
tokens.tokenizeText()
|
tokens.tokenizeText()
|
||||||
|
|||||||
@@ -579,6 +579,11 @@ def testGuiEditor_Actions(qtbot, nwGUI, projPath, ipsumText, mockRnd):
|
|||||||
assert nwGUI.docEditor.docAction(nwDocAction.BLOCK_COM) is True
|
assert nwGUI.docEditor.docAction(nwDocAction.BLOCK_COM) is True
|
||||||
assert nwGUI.docEditor.getText() == "#### Scene Title\n\n% Scene text.\n\n"
|
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
|
# Text
|
||||||
nwGUI.docEditor.setCursorPosition(20)
|
nwGUI.docEditor.setCursorPosition(20)
|
||||||
assert nwGUI.docEditor.docAction(nwDocAction.BLOCK_TXT) is True
|
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.getText() == "Some text\n\n"
|
||||||
assert nwGUI.docEditor.getCursorPosition() == 4
|
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
|
# Header 1
|
||||||
nwGUI.docEditor.replaceText("Some text\n\n")
|
nwGUI.docEditor.replaceText("Some text\n\n")
|
||||||
nwGUI.docEditor.setCursorPosition(5)
|
nwGUI.docEditor.setCursorPosition(5)
|
||||||
|
|||||||
Reference in New Issue
Block a user