diff --git a/tests/test_core/test_core_tokenizer.py b/tests/test_core/test_core_tokenizer.py index d985306d..e3d16863 100644 --- a/tests/test_core/test_core_tokenizer.py +++ b/tests/test_core/test_core_tokenizer.py @@ -809,6 +809,15 @@ def testCoreToken_MetaFormat(mockGUI): ] assert tokens.allMarkdown[-1] == "@pov: Bod\n@plot: Main\n@location: Europe\n\n" + # Ignored keywords + tokens._text = "@pov: Bod\n@plot: Main\n@location: Europe\n" + tokens.setIgnoredKeywords("@plot, @location") + tokens.tokenizeText() + assert tokens._tokens == [ + (Tokenizer.T_KEYWORD, 0, "pov: Bod", [], Tokenizer.A_NONE), + (Tokenizer.T_EMPTY, 0, "", [], Tokenizer.A_NONE), + ] + # END Test testCoreToken_MetaFormat diff --git a/tests/test_tools/test_tools_manussettings.py b/tests/test_tools/test_tools_manussettings.py index 13fc49d6..45f97358 100644 --- a/tests/test_tools/test_tools_manussettings.py +++ b/tests/test_tools/test_tools_manussettings.py @@ -479,10 +479,11 @@ def testBuildSettings_Content(qtbot: QtBot, nwGUI: GuiMain): """Test the Content Tab of the GuiBuildSettings dialog.""" build = BuildSettings() + build.setValue("text.includeBodyText", False) build.setValue("text.includeSynopsis", False) build.setValue("text.includeComments", False) build.setValue("text.includeKeywords", False) - build.setValue("text.includeBodyText", False) + build.setValue("text.ignoredKeywords", "") build.setValue("text.addNoteHeadings", False) @@ -496,28 +497,35 @@ def testBuildSettings_Content(qtbot: QtBot, nwGUI: GuiMain): assert bSettings.toolStack.currentWidget() is contTab # Check initial values + assert contTab.incBodyText.isChecked() is False assert contTab.incSynopsis.isChecked() is False assert contTab.incComments.isChecked() is False assert contTab.incKeywords.isChecked() is False - assert contTab.incBodyText.isChecked() is False + assert contTab.ignoredKeywords.text() == "" assert contTab.addNoteHead.isChecked() is False - # Toggle all + # Toggle switches + contTab.incBodyText.setChecked(True) contTab.incSynopsis.setChecked(True) contTab.incComments.setChecked(True) contTab.incKeywords.setChecked(True) - contTab.incBodyText.setChecked(True) contTab.addNoteHead.setChecked(True) + # Test cleanup of ignored keywords + contTab.ignoredKeywords.setText("@stuff, @pizza, @object") # First two are invalid + contTab._updateIgnoredKeywords("@custom") # Adding a new should trigger cleanup + assert contTab.ignoredKeywords.text() in ("@custom, @object", "@object, @custom") + # Save values contTab.saveContent() + assert build.getBool("text.includeBodyText") is True assert build.getBool("text.includeSynopsis") is True assert build.getBool("text.includeComments") is True assert build.getBool("text.includeKeywords") is True - assert build.getBool("text.includeBodyText") is True + assert build.getStr("text.ignoredKeywords") in ("@custom, @object", "@object, @custom") assert build.getBool("text.addNoteHeadings") is True