From 8087e8ad75d765bf77cc0c535a52efeb2eb25923 Mon Sep 17 00:00:00 2001 From: "Veronica K. B. Olsen" <1619840+vkbo@users.noreply.github.com> Date: Mon, 15 Feb 2021 16:48:12 +0100 Subject: [PATCH] Fix tests and a bug in GuiMain --- nw/guimain.py | 4 ++-- tests/reference/baseConfig_novelwriter.conf | 3 ++- tests/reference/guiPreferences_novelwriter.conf | 1 + tests/test_core/test_core_project.py | 2 +- tests/test_core/test_core_spell.py | 2 +- tests/test_gui/test_gui_mainmenu.py | 7 +++---- tests/test_gui/test_gui_preferences.py | 6 +++--- 7 files changed, 13 insertions(+), 12 deletions(-) diff --git a/nw/guimain.py b/nw/guimain.py index 618a95e5..dce85cbd 100644 --- a/nw/guimain.py +++ b/nw/guimain.py @@ -702,9 +702,9 @@ class GuiMain(QMainWindow): lastPath = self.mainConf.lastPath extFilter = [ self.tr("{0} ({1})").format(self.tr("Text files"), "*.txt"), - self.tr("{0} ({1})").format(self.tr("Markdown files")), + self.tr("{0} ({1})").format(self.tr("Markdown files"), "*.md"), self.tr("{0} ({1})").format(self.tr("novelWriter files"), "*.nwd"), - self.tr("{0} ({1})").format(self.tr("All files")), + self.tr("{0} ({1})").format(self.tr("All files"), "*.*"), ] dlgOpt = QFileDialog.Options() dlgOpt |= QFileDialog.DontUseNativeDialog diff --git a/tests/reference/baseConfig_novelwriter.conf b/tests/reference/baseConfig_novelwriter.conf index 1ab78ea7..4ec14a13 100644 --- a/tests/reference/baseConfig_novelwriter.conf +++ b/tests/reference/baseConfig_novelwriter.conf @@ -1,5 +1,5 @@ [Main] -timestamp = 2021-02-09 21:07:03 +timestamp = 2021-02-15 16:31:24 theme = default syntax = default_light icons = typicons_colour_light @@ -7,6 +7,7 @@ guidark = False guifont = guifontsize = 11 lastnotes = 0x0 +guilang = en-GB [Sizes] geometry = 1200, 650 diff --git a/tests/reference/guiPreferences_novelwriter.conf b/tests/reference/guiPreferences_novelwriter.conf index f440e00b..b7cf116c 100644 --- a/tests/reference/guiPreferences_novelwriter.conf +++ b/tests/reference/guiPreferences_novelwriter.conf @@ -7,6 +7,7 @@ guidark = True guifont = Sans guifontsize = 12 lastnotes = 0x0 +guilang = en-GB [Sizes] geometry = 1200, 650 diff --git a/tests/test_core/test_core_project.py b/tests/test_core/test_core_project.py index 09f6bbb8..863a824a 100644 --- a/tests/test_core/test_core_project.py +++ b/tests/test_core/test_core_project.py @@ -962,7 +962,7 @@ def testCoreProject_OrphanedFiles(dummyGUI, nwLipsum): # First Item with Meta Data oItem = theProject.projTree["636b6aa9b697b"] assert oItem is not None - assert oItem.itemName == "Recovered: Mars" + assert oItem.itemName == "[Recovered] Mars" assert oItem.itemHandle == "636b6aa9b697b" assert oItem.itemParent == "60bdf227455cc" assert oItem.itemClass == nwItemClass.WORLD diff --git a/tests/test_core/test_core_spell.py b/tests/test_core/test_core_spell.py index 388d754b..1788a833 100644 --- a/tests/test_core/test_core_spell.py +++ b/tests/test_core/test_core_spell.py @@ -168,6 +168,6 @@ def testCoreSpell_Simple(monkeypatch, tmpDir, tmpConf): assert "D_word" in wSuggest # List dictionaries - assert spChk.listDictionaries() == [("en", "English [%s]" % nwConst.SP_INTERNAL)] + assert spChk.listDictionaries() == [("en", "difflib")] # END Test testCoreSpell_Simple diff --git a/tests/test_gui/test_gui_mainmenu.py b/tests/test_gui/test_gui_mainmenu.py index 50305184..f66108d5 100644 --- a/tests/test_gui/test_gui_mainmenu.py +++ b/tests/test_gui/test_gui_mainmenu.py @@ -595,10 +595,9 @@ def testGuiMenu_Insert(qtbot, monkeypatch, nwGUI, fncDir, fncProj): nwGUI.mainMenu.aFileDetails.activate(QAction.Trigger) theBits = theMessage.split("
") - assert len(theBits) == 3 - assert theBits[0] == "File details for the currently open file" - assert theBits[1] == "Handle: 0e17daca5f3e1" - assert theBits[2] == "Location: %s" % os.path.join(fncProj, "content", "0e17daca5f3e1.nwd") + assert len(theBits) == 2 + assert theBits[0] == "The currently open file is saved in:" + assert theBits[1] == os.path.join(fncProj, "content", "0e17daca5f3e1.nwd") # qtbot.stopForInteraction() diff --git a/tests/test_gui/test_gui_preferences.py b/tests/test_gui/test_gui_preferences.py index fec382d8..266022ea 100644 --- a/tests/test_gui/test_gui_preferences.py +++ b/tests/test_gui/test_gui_preferences.py @@ -248,9 +248,9 @@ def testGuiPreferences_Main(qtbot, monkeypatch, fncDir, outDir, refDir): ignoreLines = [ 2, # Timestamp 9, # Release Notes - 12, 13, 14, 15, # Window sizes - 16, 17, 18, 19, # Window sizes - 7, 29, # Fonts (depends on system default) + 13, 14, 15, 16, # Window sizes + 17, 18, 19, 20, # Window sizes + 7, 30, 31, # Fonts (depends on system default) ] assert cmpFiles(testFile, compFile, ignoreLines)