From 617192a6d98d8333811757d6b93baa2108f2af98 Mon Sep 17 00:00:00 2001 From: "Veronica K. B. Olsen" <1619840+vkbo@users.noreply.github.com> Date: Sun, 16 Aug 2020 11:20:15 +0200 Subject: [PATCH 1/3] set version to 0.12.1 --- docs/source/conf.py | 4 ++-- nw/__init__.py | 6 +++--- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/docs/source/conf.py b/docs/source/conf.py index b61862dd..1ae52da3 100644 --- a/docs/source/conf.py +++ b/docs/source/conf.py @@ -26,9 +26,9 @@ copyright = "2018-2020, Veronica Berglyd Olsen" author = "Veronica Berglyd Olsen" # The short X.Y version -version = "1.0" +version = "0.12.1" # The full version, including alpha/beta/rc tags -release = "1.0-beta1" +release = "0.12.1" # -- General configuration --------------------------------------------------- diff --git a/nw/__init__.py b/nw/__init__.py index 5367ed23..5ac300e4 100644 --- a/nw/__init__.py +++ b/nw/__init__.py @@ -41,9 +41,9 @@ __package__ = "nw" __author__ = "Veronica Berglyd Olsen" __copyright__ = "Copyright 2018–2020, Veronica Berglyd Olsen" __license__ = "GPLv3" -__version__ = "1.0-beta1" -__hexversion__ = "0x010000b1" -__date__ = "2020-08-23" +__version__ = "0.12.1" +__hexversion__ = "0x001201f0" +__date__ = "2020-08-16" __maintainer__ = "Veronica Berglyd Olsen" __email__ = "code@vkbo.net" __status__ = "Beta" From 8513e6a6c25c43da0b5910f9331734c5577ec230 Mon Sep 17 00:00:00 2001 From: "Veronica K. B. Olsen" <1619840+vkbo@users.noreply.github.com> Date: Sun, 16 Aug 2020 11:20:28 +0200 Subject: [PATCH 2/3] Updated changelog --- CHANGELOG.md | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 41a373ad..cc1cd2b9 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,6 +1,10 @@ # novelWriter ChangeLog -## Version 1.0 Beta 1 [2020-08-23] - Not Yet Released +## Version 0.12.1 [2020-08-16] + +**Bugfixes** + +* Some of the insert menu functions were broken due to a left-over comma in the insert source code converting the insert text from a string to a tuple. This is a quirk of the Python language and unfortunately not caught as a syntax error. Issue #409, PR #410. **Feature Improvements** From 6af156af3946836eb0e30968eb7068a3a7e8ebef Mon Sep 17 00:00:00 2001 From: "Veronica K. B. Olsen" <1619840+vkbo@users.noreply.github.com> Date: Sun, 16 Aug 2020 11:48:46 +0200 Subject: [PATCH 3/3] Added test for insert menu functionality --- sample/nwProject.nwx | 10 +++--- tests/conftest.py | 12 +++++++ tests/test_gui.py | 77 +++++++++++++++++++++++++++++++++++++++++++- 3 files changed, 93 insertions(+), 6 deletions(-) diff --git a/sample/nwProject.nwx b/sample/nwProject.nwx index 76458cfd..a1d6fe7f 100644 --- a/sample/nwProject.nwx +++ b/sample/nwProject.nwx @@ -1,13 +1,13 @@ - + Sample Project Sample Project Jane Smith Jay Doh - 677 - 122 - 32872 + 684 + 125 + 33351 False @@ -119,7 +119,7 @@ 1811 318 8 - 42 + 1880 Another Scene diff --git a/tests/conftest.py b/tests/conftest.py index 8c0d7ba2..7423d849 100644 --- a/tests/conftest.py +++ b/tests/conftest.py @@ -54,6 +54,18 @@ def nwTempSample(nwTemp): mkdir(sampleDir) return sampleDir +@pytest.fixture(scope="function") +def nwFuncTemp(nwTemp): + funcDir = path.join(nwTemp, "ftemp") + if path.isdir(funcDir): + shutil.rmtree(funcDir) + if not path.isdir(funcDir): + mkdir(funcDir) + yield funcDir + if path.isdir(funcDir): + shutil.rmtree(funcDir) + return + @pytest.fixture(scope="session") def nwRef(): testDir = path.dirname(__file__) diff --git a/tests/test_gui.py b/tests/test_gui.py index 77f92609..d6ac126b 100644 --- a/tests/test_gui.py +++ b/tests/test_gui.py @@ -9,12 +9,13 @@ from nwtools import cmpFiles from os import path from PyQt5.QtCore import Qt +from PyQt5.QtWidgets import QAction from nw.gui import ( GuiProjectSettings, GuiItemEditor, GuiAbout, GuiBuildNovel, GuiDocMerge, GuiDocSplit, GuiWritingStats, GuiProjectWizard ) -from nw.constants import nwItemType, nwItemLayout, nwItemClass, nwDocAction +from nw.constants import nwItemType, nwItemLayout, nwItemClass, nwDocAction, nwUnicode keyDelay = 2 stepDelay = 20 @@ -989,3 +990,77 @@ def testDocAction(qtbot, nwTempGUI, nwLipsum, nwRef, nwTemp): # qtbot.stopForInteraction() nwGUI.closeMain() + +@pytest.mark.gui +def testInsertMenu(qtbot, nwTempGUI, nwFuncTemp, nwTemp): + nwGUI = nw.main(["--testmode", "--config=%s" % nwTempGUI, "--data=%s" % nwTemp]) + qtbot.addWidget(nwGUI) + nwGUI.show() + qtbot.waitForWindowShown(nwGUI) + qtbot.wait(stepDelay) + + nwGUI.theProject.projTree.setSeed(42) + assert nwGUI.newProject({"projPath": nwFuncTemp}, True) + + assert nwGUI.treeView._getTreeItem("31489056e0916") is not None + + nwGUI.setFocus(1) + nwGUI.treeView.clearSelection() + nwGUI.treeView._getTreeItem("31489056e0916").setSelected(True) + nwGUI.treeView.newTreeItem(nwItemType.FILE, None) + assert nwGUI.openSelectedItem() + + # qtbot.stopForInteraction() + + nwGUI.mainMenu.aInsENDash.activate(QAction.Trigger) + assert nwGUI.docEditor.getText() == nwUnicode.U_ENDASH + nwGUI.docEditor.clear() + + nwGUI.mainMenu.aInsEMDash.activate(QAction.Trigger) + assert nwGUI.docEditor.getText() == nwUnicode.U_EMDASH + nwGUI.docEditor.clear() + + nwGUI.mainMenu.aInsEllipsis.activate(QAction.Trigger) + assert nwGUI.docEditor.getText() == nwUnicode.U_HELLIP + nwGUI.docEditor.clear() + + nwGUI.mainMenu.aInsQuoteLS.activate(QAction.Trigger) + assert nwGUI.docEditor.getText() == nwGUI.mainConf.fmtSingleQuotes[0] + nwGUI.docEditor.clear() + + nwGUI.mainMenu.aInsQuoteRS.activate(QAction.Trigger) + assert nwGUI.docEditor.getText() == nwGUI.mainConf.fmtSingleQuotes[1] + nwGUI.docEditor.clear() + + nwGUI.mainMenu.aInsQuoteLD.activate(QAction.Trigger) + assert nwGUI.docEditor.getText() == nwGUI.mainConf.fmtDoubleQuotes[0] + nwGUI.docEditor.clear() + + nwGUI.mainMenu.aInsQuoteRD.activate(QAction.Trigger) + assert nwGUI.docEditor.getText() == nwGUI.mainConf.fmtDoubleQuotes[1] + nwGUI.docEditor.clear() + + nwGUI.mainMenu.aInsHardBreak.activate(QAction.Trigger) + assert nwGUI.docEditor.getText() == " \n" + nwGUI.docEditor.clear() + + nwGUI.mainMenu.aInsNBSpace.activate(QAction.Trigger) + if nwGUI.mainConf.verQtValue >= 50900: + assert nwGUI.docEditor.getText() == nwUnicode.U_NBSP + else: + assert nwGUI.docEditor.getText() == " " + nwGUI.docEditor.clear() + + nwGUI.mainMenu.aInsThinSpace.activate(QAction.Trigger) + assert nwGUI.docEditor.getText() == nwUnicode.U_THNSP + nwGUI.docEditor.clear() + + nwGUI.mainMenu.aInsThinNBSpace.activate(QAction.Trigger) + if nwGUI.mainConf.verQtValue >= 50900: + assert nwGUI.docEditor.getText() == nwUnicode.U_THNBSP + else: + assert nwGUI.docEditor.getText() == " " + nwGUI.docEditor.clear() + + # qtbot.stopForInteraction() + nwGUI.closeMain()