Update tests

This commit is contained in:
Veronica Berglyd Olsen
2024-10-27 02:22:39 +02:00
parent a1a58f51b1
commit bf478a6706
3 changed files with 18 additions and 41 deletions
+18 -3
View File
@@ -1251,8 +1251,6 @@ def testFmtToken_Dialogue(mockGUI):
CONFIG.dialogStyle = 3
CONFIG.altDialogOpen = "::"
CONFIG.altDialogClose = "::"
CONFIG.dialogLine = "\u2013"
CONFIG.narratorBreak = "\u2013"
project = NWProject()
tokens = BareTokenizer(project)
@@ -1305,7 +1303,24 @@ def testFmtToken_Dialogue(mockGUI):
BlockFmt.NONE
)]
# Dialogue line
CONFIG.dialogLine = "\u2013"
tokens.setDialogueHighlight(True)
tokens._text = "\u2013 Dialogue line without narrator break.\n"
tokens.tokenizeText()
assert tokens._blocks == [(
BlockTyp.TEXT, "",
"\u2013 Dialogue line without narrator break.",
[
(0, TextFmt.COL_B, "dialog"),
(39, TextFmt.COL_E, ""),
],
BlockFmt.NONE
)]
# Dialogue line with narrator break
CONFIG.narratorBreak = "\u2013"
tokens.setDialogueHighlight(True)
tokens._text = "\u2013 Dialogue with a narrator break, \u2013he said,\u2013 see?\n"
tokens.tokenizeText()
assert tokens._blocks == [(
@@ -1314,7 +1329,7 @@ def testFmtToken_Dialogue(mockGUI):
[
(0, TextFmt.COL_B, "dialog"),
(34, TextFmt.COL_E, ""),
(44, TextFmt.COL_B, "dialog"),
(43, TextFmt.COL_B, "dialog"),
(49, TextFmt.COL_E, ""),
],
BlockFmt.NONE