Merge 2.6.1 release into main
This commit is contained in:
@@ -35,8 +35,8 @@ from novelwriter import CONFIG, SHARED
|
||||
from novelwriter.common import decodeMimeHandles
|
||||
from novelwriter.constants import nwKeyWords, nwUnicode
|
||||
from novelwriter.dialogs.editlabel import GuiEditLabel
|
||||
from novelwriter.enum import nwDocAction, nwDocInsert, nwItemClass, nwItemLayout, nwTrinary
|
||||
from novelwriter.gui.doceditor import GuiDocEditor
|
||||
from novelwriter.enum import nwDocAction, nwDocInsert, nwItemClass, nwItemLayout
|
||||
from novelwriter.gui.doceditor import GuiDocEditor, _TagAction
|
||||
from novelwriter.text.counting import standardCounter
|
||||
from novelwriter.types import (
|
||||
QtAlignJustify, QtAlignLeft, QtKeepAnchor, QtModCtrl, QtModNone,
|
||||
@@ -1699,21 +1699,22 @@ def testGuiEditor_Tags(qtbot, nwGUI, projPath, ipsumText, mockRnd):
|
||||
|
||||
# Empty Block
|
||||
docEditor.setCursorLine(2)
|
||||
assert docEditor._processTag() is nwTrinary.NEUTRAL
|
||||
assert docEditor._processTag() == _TagAction.NONE
|
||||
|
||||
# Not On Tag
|
||||
docEditor.setCursorLine(1)
|
||||
assert docEditor._processTag() is nwTrinary.NEUTRAL
|
||||
assert docEditor._processTag() == _TagAction.NONE
|
||||
|
||||
# On Tag Keyword
|
||||
docEditor.setCursorPosition(15)
|
||||
assert docEditor._processTag() is nwTrinary.NEUTRAL
|
||||
assert docEditor._processTag() == _TagAction.NONE
|
||||
|
||||
# On Known Tag, No Follow
|
||||
docEditor.setCursorPosition(22)
|
||||
assert docEditor._processTag(follow=False) is nwTrinary.POSITIVE
|
||||
assert docEditor._processTag(follow=False) == _TagAction.FOLLOW
|
||||
assert nwGUI.docViewer._docHandle is None
|
||||
|
||||
# qtbot.stop()
|
||||
# On Known Tag, Follow
|
||||
docEditor.setCursorPosition(22)
|
||||
position = QPointF(docEditor.cursorRect().center())
|
||||
@@ -1729,13 +1730,13 @@ def testGuiEditor_Tags(qtbot, nwGUI, projPath, ipsumText, mockRnd):
|
||||
# On Unknown Tag, Create It
|
||||
assert "0000000000011" not in SHARED.project.tree
|
||||
docEditor.setCursorPosition(28)
|
||||
assert docEditor._processTag(create=True) is nwTrinary.NEGATIVE
|
||||
assert docEditor._processTag(create=True) == _TagAction.CREATE
|
||||
assert "0000000000011" in SHARED.project.tree
|
||||
|
||||
# On Unknown Tag, Missing Root
|
||||
assert "0000000000012" not in SHARED.project.tree
|
||||
docEditor.setCursorPosition(42)
|
||||
assert docEditor._processTag(create=True) is nwTrinary.NEGATIVE
|
||||
assert docEditor._processTag(create=True) == _TagAction.CREATE
|
||||
oHandle = SHARED.project.tree.findRoot(nwItemClass.OBJECT)
|
||||
assert oHandle == "0000000000012"
|
||||
|
||||
@@ -1744,7 +1745,7 @@ def testGuiEditor_Tags(qtbot, nwGUI, projPath, ipsumText, mockRnd):
|
||||
assert oItem.itemParent == "0000000000012"
|
||||
|
||||
docEditor.setCursorPosition(47)
|
||||
assert docEditor._processTag() is nwTrinary.NEUTRAL
|
||||
assert docEditor._processTag() == _TagAction.NONE
|
||||
|
||||
# qtbot.stop()
|
||||
|
||||
|
||||
@@ -45,8 +45,8 @@ def testGuiMainMenu_Slots(qtbot, monkeypatch, nwGUI, projPath):
|
||||
with monkeypatch.context() as mp:
|
||||
openUrl = MagicMock()
|
||||
mp.setattr(QDesktopServices, "openUrl", openUrl)
|
||||
CONFIG.pdfDocs = projPath / "manual.pdf"
|
||||
CONFIG.pdfDocs.touch()
|
||||
CONFIG._manuals = {"manual": projPath / "manual.pdf"}
|
||||
CONFIG._manuals["manual"].touch()
|
||||
nwGUI.mainMenu._openUserManualFile()
|
||||
assert openUrl.called is True
|
||||
assert "manual.pdf" in openUrl.call_args[0][0].url()
|
||||
|
||||
@@ -25,7 +25,6 @@ import time
|
||||
import pytest
|
||||
|
||||
from novelwriter import CONFIG, SHARED
|
||||
from novelwriter.enum import nwTrinary
|
||||
|
||||
from tests.tools import C, buildTestProject
|
||||
|
||||
@@ -47,20 +46,20 @@ def testGuiStatusBar_Main(qtbot, monkeypatch, nwGUI, projPath, mockRnd):
|
||||
assert status._refTime == refTime
|
||||
|
||||
# Project Status
|
||||
status.setProjectStatus(nwTrinary.NEUTRAL)
|
||||
assert status.projIcon.state == nwTrinary.NEUTRAL
|
||||
status.setProjectStatus(nwTrinary.NEGATIVE)
|
||||
assert status.projIcon.state == nwTrinary.NEGATIVE
|
||||
status.setProjectStatus(nwTrinary.POSITIVE)
|
||||
assert status.projIcon.state == nwTrinary.POSITIVE
|
||||
status.setProjectStatus(None)
|
||||
assert status.projIcon.state is None
|
||||
status.setProjectStatus(False)
|
||||
assert status.projIcon.state is False
|
||||
status.setProjectStatus(True)
|
||||
assert status.projIcon.state is True
|
||||
|
||||
# Document Status
|
||||
status.setDocumentStatus(nwTrinary.NEUTRAL)
|
||||
assert status.docIcon.state == nwTrinary.NEUTRAL
|
||||
status.setDocumentStatus(nwTrinary.NEGATIVE)
|
||||
assert status.docIcon.state == nwTrinary.NEGATIVE
|
||||
status.setDocumentStatus(nwTrinary.POSITIVE)
|
||||
assert status.docIcon.state == nwTrinary.POSITIVE
|
||||
status.setDocumentStatus(None)
|
||||
assert status.docIcon.state is None
|
||||
status.setDocumentStatus(False)
|
||||
assert status.docIcon.state is False
|
||||
status.setDocumentStatus(True)
|
||||
assert status.docIcon.state is True
|
||||
|
||||
# Idle Status
|
||||
CONFIG.stopWhenIdle = False
|
||||
|
||||
Reference in New Issue
Block a user