Switch test code to PyQt6
This commit is contained in:
+2
-2
@@ -28,8 +28,8 @@ from pathlib import Path
|
||||
|
||||
import pytest
|
||||
|
||||
from PyQt5.QtCore import QLocale
|
||||
from PyQt5.QtWidgets import QMessageBox
|
||||
from PyQt6.QtCore import QLocale
|
||||
from PyQt6.QtWidgets import QMessageBox
|
||||
|
||||
sys.path.insert(1, str(Path(__file__).parent.parent.absolute()))
|
||||
|
||||
|
||||
+2
-2
@@ -22,8 +22,8 @@ from __future__ import annotations
|
||||
|
||||
from unittest.mock import MagicMock
|
||||
|
||||
from PyQt5.QtGui import QFont, QIcon, QPixmap
|
||||
from PyQt5.QtWidgets import QWidget
|
||||
from PyQt6.QtGui import QFont, QIcon, QPixmap
|
||||
from PyQt6.QtWidgets import QWidget
|
||||
|
||||
|
||||
class MockGuiMain(QWidget):
|
||||
|
||||
@@ -27,8 +27,8 @@ from xml.etree import ElementTree as ET
|
||||
|
||||
import pytest
|
||||
|
||||
from PyQt5.QtCore import QMimeData, QUrl
|
||||
from PyQt5.QtGui import QColor, QDesktopServices, QFont, QFontDatabase, QFontInfo
|
||||
from PyQt6.QtCore import QMimeData, QUrl
|
||||
from PyQt6.QtGui import QColor, QDesktopServices, QFont, QFontDatabase, QFontInfo
|
||||
|
||||
from novelwriter.common import (
|
||||
NWConfigParser, checkBool, checkFloat, checkInt, checkIntTuple, checkPath,
|
||||
@@ -522,8 +522,7 @@ def testBaseCommon_cssCol():
|
||||
@pytest.mark.base
|
||||
def testBaseCommon_describeFont():
|
||||
"""Test the describeFont function."""
|
||||
fontDB = QFontDatabase()
|
||||
font = fontDB.systemFont(QFontDatabase.SystemFont.GeneralFont)
|
||||
font = QFontDatabase.systemFont(QFontDatabase.SystemFont.GeneralFont)
|
||||
font.setPointSize(12)
|
||||
assert describeFont(font).startswith("12 pt")
|
||||
assert describeFont(None) == "Error" # type: ignore
|
||||
@@ -537,10 +536,9 @@ def testBaseCommon_fontMatcher(monkeypatch):
|
||||
assert fontMatcher(nonsense) is nonsense
|
||||
|
||||
# General font
|
||||
fontDB = QFontDatabase()
|
||||
if len(fontDB.families()) > 1:
|
||||
fontOne = QFont(fontDB.families()[0])
|
||||
fontTwo = QFont(fontDB.families()[1])
|
||||
if len(QFontDatabase.families()) > 1:
|
||||
fontOne = QFont(QFontDatabase.families()[0])
|
||||
fontTwo = QFont(QFontDatabase.families()[1])
|
||||
check = QFont(fontOne)
|
||||
check.setFamily(fontTwo.family())
|
||||
with monkeypatch.context() as mp:
|
||||
|
||||
@@ -42,7 +42,7 @@ def testBaseError_Dialog(qtbot, monkeypatch, nwGUI):
|
||||
|
||||
# Valid Error Message
|
||||
with monkeypatch.context() as mp:
|
||||
mp.setattr("PyQt5.QtCore.QSysInfo.kernelVersion", lambda: "1.2.3")
|
||||
mp.setattr("PyQt6.QtCore.QSysInfo.kernelVersion", lambda: "1.2.3")
|
||||
nwErr.setMessage(Exception, "Fine Error", None) # type: ignore
|
||||
message = nwErr.msgBody.toPlainText()
|
||||
assert message != ""
|
||||
@@ -52,7 +52,7 @@ def testBaseError_Dialog(qtbot, monkeypatch, nwGUI):
|
||||
|
||||
# No kernel version retrieved
|
||||
with monkeypatch.context() as mp:
|
||||
mp.setattr("PyQt5.QtCore.QSysInfo.kernelVersion", causeException)
|
||||
mp.setattr("PyQt6.QtCore.QSysInfo.kernelVersion", causeException)
|
||||
nwErr.setMessage(Exception, "Almost Fine Error", None) # type: ignore
|
||||
message = nwErr.msgBody.toPlainText()
|
||||
assert message != ""
|
||||
@@ -80,27 +80,27 @@ def testBaseError_Handler(qtbot, monkeypatch, nwGUI):
|
||||
# Normal shutdown
|
||||
with monkeypatch.context() as mp:
|
||||
mp.setattr(NWErrorMessage, "exec", lambda *a: None)
|
||||
mp.setattr("PyQt5.QtWidgets.QApplication.exit", lambda *a: None)
|
||||
mp.setattr("PyQt6.QtWidgets.QApplication.exit", lambda *a: None)
|
||||
exceptionHandler(Exception, "Error Message", None) # type: ignore
|
||||
|
||||
# Should not crash when no GUI is found
|
||||
with monkeypatch.context() as mp:
|
||||
mp.setattr(NWErrorMessage, "exec", lambda *a: None)
|
||||
mp.setattr("PyQt5.QtWidgets.QApplication.exit", lambda *a: None)
|
||||
mp.setattr("PyQt5.QtWidgets.QApplication.topLevelWidgets", lambda: [])
|
||||
mp.setattr("PyQt6.QtWidgets.QApplication.exit", lambda *a: None)
|
||||
mp.setattr("PyQt6.QtWidgets.QApplication.topLevelWidgets", lambda: [])
|
||||
exceptionHandler(Exception, "Error Message", None) # type: ignore
|
||||
|
||||
# Should handle QApplication failing
|
||||
with monkeypatch.context() as mp:
|
||||
mp.setattr(NWErrorMessage, "exec", lambda *a: None)
|
||||
mp.setattr("PyQt5.QtWidgets.QApplication.exit", lambda *a: None)
|
||||
mp.setattr("PyQt5.QtWidgets.QApplication.topLevelWidgets", causeException)
|
||||
mp.setattr("PyQt6.QtWidgets.QApplication.exit", lambda *a: None)
|
||||
mp.setattr("PyQt6.QtWidgets.QApplication.topLevelWidgets", causeException)
|
||||
exceptionHandler(Exception, "Error Message", None) # type: ignore
|
||||
|
||||
# Should handle failing to close main GUI
|
||||
with monkeypatch.context() as mp:
|
||||
mp.setattr(NWErrorMessage, "exec", lambda *a: None)
|
||||
mp.setattr("PyQt5.QtWidgets.QApplication.exit", lambda *a: None)
|
||||
mp.setattr("PyQt6.QtWidgets.QApplication.exit", lambda *a: None)
|
||||
mp.setattr("novelwriter.guimain.GuiMain.closeMain", causeException)
|
||||
exceptionHandler(Exception, "Error Message", None) # type: ignore
|
||||
|
||||
|
||||
@@ -63,13 +63,12 @@ def testBaseInit_Launch(caplog, monkeypatch, fncPath):
|
||||
|
||||
# Normal Launch
|
||||
with monkeypatch.context() as mp:
|
||||
mp.setattr("PyQt5.QtWidgets.QApplication.__init__", lambda *a: None)
|
||||
mp.setattr("PyQt5.QtWidgets.QApplication.setApplicationName", lambda *a: None)
|
||||
mp.setattr("PyQt5.QtWidgets.QApplication.setApplicationVersion", lambda *a: None)
|
||||
mp.setattr("PyQt5.QtWidgets.QApplication.setWindowIcon", lambda *a: None)
|
||||
mp.setattr("PyQt5.QtWidgets.QApplication.setOrganizationDomain", lambda *a: None)
|
||||
mp.setattr("PyQt5.QtWidgets.QApplication.exec", lambda *a: 0)
|
||||
# mp.setattr("PyQt5.QtWidgets.QApplication.focusChange.connect", lambda *a: None)
|
||||
mp.setattr("PyQt6.QtWidgets.QApplication.__init__", lambda *a: None)
|
||||
mp.setattr("PyQt6.QtWidgets.QApplication.setApplicationName", lambda *a: None)
|
||||
mp.setattr("PyQt6.QtWidgets.QApplication.setApplicationVersion", lambda *a: None)
|
||||
mp.setattr("PyQt6.QtWidgets.QApplication.setWindowIcon", lambda *a: None)
|
||||
mp.setattr("PyQt6.QtWidgets.QApplication.setOrganizationDomain", lambda *a: None)
|
||||
mp.setattr("PyQt6.QtWidgets.QApplication.exec", lambda *a: 0)
|
||||
with pytest.raises(SystemExit) as ex:
|
||||
main([f"--config={fncPath}", f"--data={fncPath}"])
|
||||
assert ex.value.code == 0
|
||||
@@ -165,11 +164,11 @@ def testBaseInit_Options(monkeypatch, fncPath):
|
||||
def testBaseInit_Imports(caplog, monkeypatch, fncPath):
|
||||
"""Check import error handling."""
|
||||
monkeypatch.setattr("novelwriter.guimain.GuiMain", MockGuiMain)
|
||||
monkeypatch.setattr("PyQt5.QtWidgets.QApplication.__init__", lambda *a: None)
|
||||
monkeypatch.setattr("PyQt5.QtWidgets.QApplication.exec", lambda *a: 0)
|
||||
monkeypatch.setattr("PyQt5.QtWidgets.QErrorMessage.__init__", lambda *a: None)
|
||||
monkeypatch.setattr("PyQt5.QtWidgets.QErrorMessage.resize", lambda *a: None)
|
||||
monkeypatch.setattr("PyQt5.QtWidgets.QErrorMessage.showMessage", lambda *a: None)
|
||||
monkeypatch.setattr("PyQt6.QtWidgets.QApplication.__init__", lambda *a: None)
|
||||
monkeypatch.setattr("PyQt6.QtWidgets.QApplication.exec", lambda *a: 0)
|
||||
monkeypatch.setattr("PyQt6.QtWidgets.QErrorMessage.__init__", lambda *a: None)
|
||||
monkeypatch.setattr("PyQt6.QtWidgets.QErrorMessage.resize", lambda *a: None)
|
||||
monkeypatch.setattr("PyQt6.QtWidgets.QErrorMessage.showMessage", lambda *a: None)
|
||||
monkeypatch.setattr("sys.hexversion", 0x0)
|
||||
monkeypatch.setattr("novelwriter.CONFIG.verQtValue", 0x050000)
|
||||
monkeypatch.setattr("novelwriter.CONFIG.verPyQtValue", 0x050000)
|
||||
@@ -184,5 +183,5 @@ def testBaseInit_Imports(caplog, monkeypatch, fncPath):
|
||||
assert ex.value.code & 16 == 16 # PyQt version not satisfied # type: ignore
|
||||
|
||||
assert "At least Python" in caplog.messages[0]
|
||||
assert "At least Qt5" in caplog.messages[1]
|
||||
assert "At least PyQt5" in caplog.messages[2]
|
||||
assert "At least Qt6" in caplog.messages[1]
|
||||
assert "At least PyQt6" in caplog.messages[2]
|
||||
|
||||
@@ -24,9 +24,9 @@ from unittest.mock import MagicMock
|
||||
|
||||
import pytest
|
||||
|
||||
from PyQt5.QtCore import QUrl
|
||||
from PyQt5.QtGui import QDesktopServices
|
||||
from PyQt5.QtWidgets import QFileDialog, QMessageBox, QWidget
|
||||
from PyQt6.QtCore import QUrl
|
||||
from PyQt6.QtGui import QDesktopServices
|
||||
from PyQt6.QtWidgets import QFileDialog, QMessageBox, QWidget
|
||||
|
||||
from novelwriter.core.project import NWProject
|
||||
from novelwriter.shared import SharedData
|
||||
|
||||
@@ -24,7 +24,7 @@ import copy
|
||||
|
||||
import pytest
|
||||
|
||||
from PyQt5.QtGui import QIcon
|
||||
from PyQt6.QtGui import QIcon
|
||||
|
||||
from novelwriter.core.item import NWItem
|
||||
from novelwriter.core.project import NWProject
|
||||
|
||||
@@ -22,7 +22,7 @@ from __future__ import annotations
|
||||
|
||||
import pytest
|
||||
|
||||
from PyQt5.QtCore import QMimeData, QModelIndex, Qt
|
||||
from PyQt6.QtCore import QMimeData, QModelIndex, Qt
|
||||
|
||||
from novelwriter.common import decodeMimeHandles
|
||||
from novelwriter.constants import nwConst
|
||||
|
||||
@@ -25,7 +25,7 @@ from zipfile import ZipFile
|
||||
|
||||
import pytest
|
||||
|
||||
from PyQt5.QtWidgets import QMessageBox
|
||||
from PyQt6.QtWidgets import QMessageBox
|
||||
|
||||
from novelwriter import CONFIG, SHARED
|
||||
from novelwriter.constants import nwFiles
|
||||
|
||||
@@ -27,7 +27,7 @@ from shutil import copyfile
|
||||
|
||||
import pytest
|
||||
|
||||
from PyQt5.QtGui import QColor
|
||||
from PyQt6.QtGui import QColor
|
||||
|
||||
from novelwriter.constants import nwFiles
|
||||
from novelwriter.core.item import NWItem
|
||||
|
||||
@@ -22,7 +22,7 @@ from __future__ import annotations
|
||||
|
||||
import pytest
|
||||
|
||||
from PyQt5.QtGui import QColor, QIcon
|
||||
from PyQt6.QtGui import QColor, QIcon
|
||||
|
||||
from novelwriter.core.status import NWStatus, StatusEntry, _ShapeCache
|
||||
from novelwriter.enum import nwStatusShape
|
||||
|
||||
@@ -24,7 +24,8 @@ from pathlib import Path
|
||||
|
||||
import pytest
|
||||
|
||||
from PyQt5.QtWidgets import QAction, QMessageBox
|
||||
from PyQt6.QtGui import QAction
|
||||
from PyQt6.QtWidgets import QMessageBox
|
||||
|
||||
from novelwriter import SHARED
|
||||
from novelwriter.dialogs.about import GuiAbout
|
||||
|
||||
@@ -22,8 +22,8 @@ from __future__ import annotations
|
||||
|
||||
import pytest
|
||||
|
||||
from PyQt5.QtCore import QItemSelectionModel
|
||||
from PyQt5.QtWidgets import QListWidgetItem
|
||||
from PyQt6.QtCore import QItemSelectionModel
|
||||
from PyQt6.QtWidgets import QListWidgetItem
|
||||
|
||||
from novelwriter.dialogs.editlabel import GuiEditLabel
|
||||
from novelwriter.dialogs.quotes import GuiQuoteSelect
|
||||
|
||||
@@ -22,7 +22,7 @@ from __future__ import annotations
|
||||
|
||||
import pytest
|
||||
|
||||
from PyQt5.QtCore import Qt
|
||||
from PyQt6.QtCore import Qt
|
||||
|
||||
from novelwriter.dialogs.docmerge import GuiDocMerge
|
||||
from novelwriter.types import QtAccepted, QtRejected, QtUserRole
|
||||
|
||||
@@ -22,9 +22,9 @@ from __future__ import annotations
|
||||
|
||||
import pytest
|
||||
|
||||
from PyQt5.QtCore import QEvent, Qt
|
||||
from PyQt5.QtGui import QFont, QFontDatabase, QKeyEvent
|
||||
from PyQt5.QtWidgets import QAction, QFileDialog, QFontDialog
|
||||
from PyQt6.QtCore import QEvent, Qt
|
||||
from PyQt6.QtGui import QAction, QFont, QFontDatabase, QKeyEvent
|
||||
from PyQt6.QtWidgets import QFileDialog, QFontDialog
|
||||
|
||||
from novelwriter import CONFIG, SHARED
|
||||
from novelwriter.constants import nwUnicode
|
||||
|
||||
@@ -22,8 +22,8 @@ from __future__ import annotations
|
||||
|
||||
import pytest
|
||||
|
||||
from PyQt5.QtGui import QColor
|
||||
from PyQt5.QtWidgets import QAction, QColorDialog, QFileDialog
|
||||
from PyQt6.QtGui import QAction, QColor
|
||||
from PyQt6.QtWidgets import QColorDialog, QFileDialog
|
||||
|
||||
from novelwriter import CONFIG, SHARED
|
||||
from novelwriter.dialogs.editlabel import GuiEditLabel
|
||||
|
||||
@@ -22,8 +22,9 @@ from __future__ import annotations
|
||||
|
||||
import pytest
|
||||
|
||||
from PyQt5.QtCore import Qt
|
||||
from PyQt5.QtWidgets import QAction, QFileDialog
|
||||
from PyQt6.QtCore import Qt
|
||||
from PyQt6.QtGui import QAction
|
||||
from PyQt6.QtWidgets import QFileDialog
|
||||
|
||||
from novelwriter import SHARED
|
||||
from novelwriter.core.spellcheck import UserDictionary
|
||||
@@ -104,11 +105,11 @@ def testDlgWordList_Dialog(qtbot, monkeypatch, nwGUI, fncPath, projPath):
|
||||
wList._doAdd()
|
||||
assert wList.listBox.item(0).text() == "delete_me" # type: ignore
|
||||
|
||||
delItem = wList.listBox.findItems("delete_me", Qt.MatchExactly)[0]
|
||||
delItem = wList.listBox.findItems("delete_me", Qt.MatchFlag.MatchExactly)[0]
|
||||
assert delItem.text() == "delete_me"
|
||||
delItem.setSelected(True)
|
||||
wList._doDelete()
|
||||
assert wList.listBox.findItems("delete_me", Qt.MatchExactly) == []
|
||||
assert wList.listBox.findItems("delete_me", Qt.MatchFlag.MatchExactly) == []
|
||||
assert wList.listBox.item(0).text() == "word_a" # type: ignore
|
||||
|
||||
# Import/Export
|
||||
|
||||
@@ -22,9 +22,9 @@ from __future__ import annotations
|
||||
|
||||
import pytest
|
||||
|
||||
from PyQt5.QtCore import QEvent, QObject, QPoint, Qt
|
||||
from PyQt5.QtGui import QKeyEvent, QWheelEvent
|
||||
from PyQt5.QtWidgets import QWidget
|
||||
from PyQt6.QtCore import QEvent, QObject, QPoint, QPointF, Qt
|
||||
from PyQt6.QtGui import QKeyEvent, QWheelEvent
|
||||
from PyQt6.QtWidgets import QWidget
|
||||
|
||||
from novelwriter.extensions.eventfilters import WheelEventFilter
|
||||
from novelwriter.types import QtModNone, QtModShift
|
||||
@@ -57,8 +57,9 @@ def testExtEventFilters_WheelEventFilter():
|
||||
|
||||
# Sending a mouse wheel event forwards it
|
||||
pos = QPoint(0, 0)
|
||||
posF = QPointF(0.0, 0.0)
|
||||
event = QWheelEvent(
|
||||
pos, pos, pos, pos,
|
||||
posF, posF, pos, pos,
|
||||
Qt.MouseButton.NoButton, QtModNone,
|
||||
Qt.ScrollPhase.NoScrollPhase, False,
|
||||
)
|
||||
|
||||
@@ -22,9 +22,9 @@ from __future__ import annotations
|
||||
|
||||
import pytest
|
||||
|
||||
from PyQt5.QtCore import QEvent, QPoint, QPointF, Qt
|
||||
from PyQt5.QtGui import QKeyEvent, QMouseEvent, QWheelEvent
|
||||
from PyQt5.QtWidgets import QWidget
|
||||
from PyQt6.QtCore import QEvent, QPoint, QPointF, Qt
|
||||
from PyQt6.QtGui import QKeyEvent, QMouseEvent, QWheelEvent
|
||||
from PyQt6.QtWidgets import QWidget
|
||||
|
||||
from novelwriter.extensions.modified import (
|
||||
NClickableLabel, NComboBox, NDialog, NDoubleSpinBox, NSpinBox
|
||||
@@ -150,7 +150,7 @@ def testExtModified_NClickableLabel(qtbot, monkeypatch):
|
||||
dialog = SimpleDialog(widget)
|
||||
dialog.show()
|
||||
|
||||
position = widget.rect().center()
|
||||
position = QPointF(widget.rect().center())
|
||||
event = QMouseEvent(
|
||||
QEvent.Type.MouseButtonPress, position, QtMouseLeft, QtMouseLeft, QtModNone
|
||||
)
|
||||
|
||||
@@ -24,7 +24,7 @@ from time import sleep
|
||||
|
||||
import pytest
|
||||
|
||||
from PyQt5.QtGui import QColor
|
||||
from PyQt6.QtGui import QColor
|
||||
|
||||
from novelwriter.extensions.progressbars import NProgressCircle, NProgressSimple
|
||||
|
||||
|
||||
@@ -22,8 +22,8 @@ from __future__ import annotations
|
||||
|
||||
import pytest
|
||||
|
||||
from PyQt5.QtCore import QEvent, QPoint
|
||||
from PyQt5.QtGui import QMouseEvent
|
||||
from PyQt6.QtCore import QEvent, QPointF
|
||||
from PyQt6.QtGui import QEnterEvent, QMouseEvent
|
||||
|
||||
from novelwriter.extensions.switch import NSwitch
|
||||
from novelwriter.types import QtModNone, QtMouseLeft
|
||||
@@ -65,10 +65,10 @@ def testExtSwitch_Main(qtbot):
|
||||
|
||||
button = QtMouseLeft
|
||||
modifier = QtModNone
|
||||
event = QMouseEvent(QEvent.Type.MouseButtonRelease, QPoint(), button, button, modifier)
|
||||
event = QMouseEvent(QEvent.Type.MouseButtonRelease, QPointF(), button, button, modifier)
|
||||
switch.mouseReleaseEvent(event)
|
||||
|
||||
event = QEvent(QEvent.Type.Enter)
|
||||
event = QEnterEvent(QPointF(), QPointF(), QPointF())
|
||||
switch.enterEvent(event)
|
||||
|
||||
# qtbot.stop()
|
||||
|
||||
@@ -24,7 +24,7 @@ from urllib.error import HTTPError
|
||||
|
||||
import pytest
|
||||
|
||||
from PyQt5.QtCore import QUrl
|
||||
from PyQt6.QtCore import QUrl
|
||||
|
||||
from novelwriter import SHARED
|
||||
from novelwriter.constants import nwConst
|
||||
|
||||
@@ -22,7 +22,7 @@ from __future__ import annotations
|
||||
|
||||
import pytest
|
||||
|
||||
from PyQt5.QtGui import QFont
|
||||
from PyQt6.QtGui import QFont
|
||||
|
||||
from novelwriter import CONFIG
|
||||
from novelwriter.constants import nwHeadFmt, nwStyles
|
||||
|
||||
@@ -27,7 +27,7 @@ from shutil import copyfile
|
||||
|
||||
import pytest
|
||||
|
||||
from PyQt5.QtGui import QColor
|
||||
from PyQt6.QtGui import QColor
|
||||
|
||||
from novelwriter.common import xmlIndent
|
||||
from novelwriter.constants import nwHeadFmt
|
||||
|
||||
@@ -22,7 +22,7 @@ from __future__ import annotations
|
||||
|
||||
import pytest
|
||||
|
||||
from PyQt5.QtGui import QFont, QTextBlock, QTextCharFormat, QTextCursor
|
||||
from PyQt6.QtGui import QFont, QTextBlock, QTextCharFormat, QTextCursor
|
||||
|
||||
from novelwriter import CONFIG
|
||||
from novelwriter.constants import nwUnicode
|
||||
|
||||
@@ -24,12 +24,12 @@ from unittest.mock import MagicMock
|
||||
|
||||
import pytest
|
||||
|
||||
from PyQt5.QtCore import QEvent, QMimeData, Qt, QThreadPool, QUrl
|
||||
from PyQt5.QtGui import (
|
||||
QClipboard, QDesktopServices, QDragEnterEvent, QDragMoveEvent, QDropEvent,
|
||||
QFont, QMouseEvent, QTextBlock, QTextCursor, QTextOption
|
||||
from PyQt6.QtCore import QEvent, QMimeData, QPointF, Qt, QThreadPool, QUrl
|
||||
from PyQt6.QtGui import (
|
||||
QAction, QClipboard, QDesktopServices, QDragEnterEvent, QDragMoveEvent,
|
||||
QDropEvent, QFont, QMouseEvent, QTextBlock, QTextCursor, QTextOption
|
||||
)
|
||||
from PyQt5.QtWidgets import QAction, QApplication, QMenu, QPlainTextEdit
|
||||
from PyQt6.QtWidgets import QApplication, QMenu, QPlainTextEdit
|
||||
|
||||
from novelwriter import CONFIG, SHARED
|
||||
from novelwriter.common import decodeMimeHandles
|
||||
@@ -102,8 +102,8 @@ def testGuiEditor_Init(qtbot, nwGUI, projPath, ipsumText, mockRnd):
|
||||
qDoc = docEditor.document()
|
||||
assert CONFIG.textFont == qDoc.defaultFont()
|
||||
assert qDoc.defaultTextOption().alignment() == QtAlignJustify
|
||||
assert qDoc.defaultTextOption().flags() & QTextOption.ShowTabsAndSpaces
|
||||
assert qDoc.defaultTextOption().flags() & QTextOption.ShowLineAndParagraphSeparators
|
||||
assert qDoc.defaultTextOption().flags() & QTextOption.Flag.ShowTabsAndSpaces
|
||||
assert qDoc.defaultTextOption().flags() & QTextOption.Flag.ShowLineAndParagraphSeparators
|
||||
assert docEditor.verticalScrollBarPolicy() == QtScrollAlwaysOff
|
||||
assert docEditor.horizontalScrollBarPolicy() == QtScrollAlwaysOff
|
||||
assert docEditor._autoReplace._padChar == nwUnicode.U_THNBSP
|
||||
@@ -262,6 +262,7 @@ def testGuiEditor_DragAndDrop(qtbot, monkeypatch, nwGUI, projPath, mockRnd):
|
||||
assert mockMove.call_count == 1
|
||||
|
||||
# Drop
|
||||
middle = QPointF(docEditor.viewport().rect().center())
|
||||
mockDrop = MagicMock()
|
||||
docEvent = QDropEvent(middle, action, docMime, mouse, QtModNone)
|
||||
noneEvent = QDropEvent(middle, action, noneMime, mouse, QtModNone)
|
||||
@@ -1708,7 +1709,7 @@ def testGuiEditor_Tags(qtbot, nwGUI, projPath, ipsumText, mockRnd):
|
||||
|
||||
# On Known Tag, Follow
|
||||
docEditor.setCursorPosition(22)
|
||||
position = docEditor.cursorRect().center()
|
||||
position = QPointF(docEditor.cursorRect().center())
|
||||
event = QMouseEvent(
|
||||
QEvent.Type.MouseButtonPress, position, QtMouseLeft, QtMouseLeft, QtModCtrl
|
||||
)
|
||||
@@ -1750,7 +1751,7 @@ def testGuiEditor_Links(qtbot, monkeypatch, nwGUI, projPath, ipsumText, mockRnd)
|
||||
docEditor.replaceText("### Scene\n\nFoo http://www.example.com bar.\n\n")
|
||||
|
||||
docEditor.setCursorPosition(20)
|
||||
position = docEditor.cursorRect().center()
|
||||
position = QPointF(docEditor.cursorRect().center())
|
||||
event = QMouseEvent(
|
||||
QEvent.Type.MouseButtonPress, position, QtMouseLeft, QtMouseLeft, QtModCtrl
|
||||
)
|
||||
@@ -1988,7 +1989,7 @@ def testGuiEditor_Search(qtbot, monkeypatch, nwGUI, prjLipsum):
|
||||
|
||||
# Select the Word "est"
|
||||
docEditor.setCursorPosition(645)
|
||||
docEditor._makeSelection(QTextCursor.WordUnderCursor)
|
||||
docEditor._makeSelection(QTextCursor.SelectionType.WordUnderCursor)
|
||||
cursor = docEditor.textCursor()
|
||||
assert cursor.selectedText() == "est"
|
||||
|
||||
@@ -2118,7 +2119,7 @@ def testGuiEditor_Search(qtbot, monkeypatch, nwGUI, prjLipsum):
|
||||
# Close search and select "est" again
|
||||
docSearch.cancelSearch.activate(QAction.ActionEvent.Trigger)
|
||||
docEditor.setCursorPosition(645)
|
||||
docEditor._makeSelection(QTextCursor.WordUnderCursor)
|
||||
docEditor._makeSelection(QTextCursor.SelectionType.WordUnderCursor)
|
||||
cursor = docEditor.textCursor()
|
||||
assert cursor.selectedText() == "est"
|
||||
|
||||
|
||||
@@ -24,18 +24,18 @@ from unittest.mock import MagicMock
|
||||
|
||||
import pytest
|
||||
|
||||
from PyQt5.QtCore import QEvent, QMimeData, QPoint, Qt, QUrl
|
||||
from PyQt5.QtGui import (
|
||||
QDesktopServices, QDragEnterEvent, QDragMoveEvent, QDropEvent, QMouseEvent,
|
||||
QTextCursor
|
||||
from PyQt6.QtCore import QEvent, QMimeData, QPointF, Qt, QUrl
|
||||
from PyQt6.QtGui import (
|
||||
QAction, QDesktopServices, QDragEnterEvent, QDragMoveEvent, QDropEvent,
|
||||
QMouseEvent, QTextCursor
|
||||
)
|
||||
from PyQt5.QtWidgets import QAction, QApplication, QMenu, QTextBrowser
|
||||
from PyQt6.QtWidgets import QApplication, QMenu, QTextBrowser
|
||||
|
||||
from novelwriter import CONFIG, SHARED
|
||||
from novelwriter.common import decodeMimeHandles
|
||||
from novelwriter.enum import nwChange, nwDocAction
|
||||
from novelwriter.formats.toqdoc import ToQTextDocument
|
||||
from novelwriter.types import QtModNone, QtMouseLeft
|
||||
from novelwriter.types import QtModNone, QtMouseLeft, QtMouseMiddle
|
||||
|
||||
from tests.mocked import causeException
|
||||
from tests.tools import C, buildTestProject
|
||||
@@ -59,7 +59,7 @@ def testGuiViewer_Main(qtbot, monkeypatch, nwGUI, prjLipsum):
|
||||
# Middle-click the selected item
|
||||
index = SHARED.project.tree.model.indexFromHandle("88243afbe5ed8")
|
||||
rect = nwGUI.projView.projTree.visualRect(index)
|
||||
qtbot.mouseClick(nwGUI.projView.projTree.viewport(), Qt.MidButton, pos=rect.center())
|
||||
qtbot.mouseClick(nwGUI.projView.projTree.viewport(), QtMouseMiddle, pos=rect.center())
|
||||
assert docViewer.docHandle == "88243afbe5ed8"
|
||||
|
||||
# Clear selection
|
||||
@@ -69,7 +69,7 @@ def testGuiViewer_Main(qtbot, monkeypatch, nwGUI, prjLipsum):
|
||||
# Re-select via header click
|
||||
button = QtMouseLeft
|
||||
modifier = QtModNone
|
||||
event = QMouseEvent(QEvent.Type.MouseButtonPress, QPoint(), button, button, modifier)
|
||||
event = QMouseEvent(QEvent.Type.MouseButtonPress, QPointF(), button, button, modifier)
|
||||
docViewer.docHeader.mousePressEvent(event)
|
||||
assert nwGUI.projView.projTree.getSelectedHandle() == "88243afbe5ed8"
|
||||
|
||||
@@ -89,7 +89,7 @@ def testGuiViewer_Main(qtbot, monkeypatch, nwGUI, prjLipsum):
|
||||
cursor = docViewer.textCursor()
|
||||
cursor.setPosition(100)
|
||||
docViewer.setTextCursor(cursor)
|
||||
docViewer._makeSelection(QTextCursor.WordUnderCursor)
|
||||
docViewer._makeSelection(QTextCursor.SelectionType.WordUnderCursor)
|
||||
|
||||
qClip = QApplication.clipboard()
|
||||
qClip.clear()
|
||||
@@ -158,7 +158,7 @@ def testGuiViewer_Main(qtbot, monkeypatch, nwGUI, prjLipsum):
|
||||
cursor = docViewer.textCursor()
|
||||
cursor.setPosition(27)
|
||||
docViewer.setTextCursor(cursor)
|
||||
docViewer._makeSelection(QTextCursor.WordUnderCursor)
|
||||
docViewer._makeSelection(QTextCursor.SelectionType.WordUnderCursor)
|
||||
with monkeypatch.context() as mp:
|
||||
mp.setattr(QMenu, "exec", mockExec)
|
||||
docViewer._openContextMenu(docViewer.cursorRect().center())
|
||||
@@ -168,7 +168,7 @@ def testGuiViewer_Main(qtbot, monkeypatch, nwGUI, prjLipsum):
|
||||
cursor = docViewer.textCursor()
|
||||
cursor.setPosition(27)
|
||||
docViewer.setTextCursor(cursor)
|
||||
docViewer._makeSelection(QTextCursor.WordUnderCursor)
|
||||
docViewer._makeSelection(QTextCursor.SelectionType.WordUnderCursor)
|
||||
rect = docViewer.cursorRect()
|
||||
docViewer._linkClicked(QUrl("#tag_bod"))
|
||||
assert docViewer.docHandle == "4c4f28287af27"
|
||||
@@ -187,11 +187,12 @@ def testGuiViewer_Main(qtbot, monkeypatch, nwGUI, prjLipsum):
|
||||
assert openUrl.call_args[0][0] == QUrl("http://www.example.com")
|
||||
|
||||
# Click mouse nav buttons
|
||||
qtbot.mouseClick(docViewer.viewport(), Qt.BackButton, pos=rect.center(), delay=100)
|
||||
viewport = docViewer.viewport()
|
||||
qtbot.mouseClick(viewport, Qt.MouseButton.BackButton, pos=rect.center(), delay=100)
|
||||
assert docViewer.docHandle == "88243afbe5ed8"
|
||||
qtbot.mouseClick(docViewer.viewport(), Qt.ForwardButton, pos=rect.center(), delay=100)
|
||||
qtbot.mouseClick(viewport, Qt.MouseButton.ForwardButton, pos=rect.center(), delay=100)
|
||||
assert docViewer.docHandle == "4c4f28287af27"
|
||||
qtbot.mouseClick(docViewer.viewport(), QtMouseLeft, pos=rect.center(), delay=100)
|
||||
qtbot.mouseClick(viewport, QtMouseLeft, pos=rect.center(), delay=100)
|
||||
assert docViewer.docHandle == "4c4f28287af27"
|
||||
|
||||
# Scroll bar default on empty document
|
||||
@@ -299,6 +300,7 @@ def testGuiViewer_DragAndDrop(qtbot, monkeypatch, nwGUI, projPath, mockRnd):
|
||||
|
||||
# Drop
|
||||
mockDrop = MagicMock()
|
||||
middle = QPointF(docViewer.viewport().rect().center())
|
||||
docEvent = QDropEvent(middle, action, docMime, mouse, QtModNone)
|
||||
noneEvent = QDropEvent(middle, action, noneMime, mouse, QtModNone)
|
||||
with monkeypatch.context() as mp:
|
||||
|
||||
@@ -22,7 +22,7 @@ from __future__ import annotations
|
||||
|
||||
import pytest
|
||||
|
||||
from PyQt5.QtGui import QIcon
|
||||
from PyQt6.QtGui import QIcon
|
||||
|
||||
from novelwriter import SHARED
|
||||
from novelwriter.constants import nwLists
|
||||
|
||||
@@ -28,9 +28,9 @@ from shutil import copyfile
|
||||
|
||||
import pytest
|
||||
|
||||
from PyQt5.QtCore import Qt
|
||||
from PyQt5.QtGui import QPalette
|
||||
from PyQt5.QtWidgets import QInputDialog, QMenu, QMessageBox
|
||||
from PyQt6.QtCore import Qt
|
||||
from PyQt6.QtGui import QPalette
|
||||
from PyQt6.QtWidgets import QInputDialog, QMenu, QMessageBox
|
||||
|
||||
from novelwriter import CONFIG, SHARED
|
||||
from novelwriter.constants import nwFiles
|
||||
@@ -782,11 +782,12 @@ def testGuiMain_Features(qtbot, monkeypatch, nwGUI, projPath, mockRnd):
|
||||
# Full Screen Mode
|
||||
# ================
|
||||
|
||||
assert nwGUI.windowState() & Qt.WindowFullScreen != Qt.WindowFullScreen
|
||||
fullScreen = Qt.WindowState.WindowFullScreen
|
||||
assert nwGUI.windowState() & fullScreen != fullScreen
|
||||
nwGUI.toggleFullScreenMode()
|
||||
assert nwGUI.windowState() & Qt.WindowFullScreen == Qt.WindowFullScreen
|
||||
assert nwGUI.windowState() & fullScreen == fullScreen
|
||||
nwGUI.toggleFullScreenMode()
|
||||
assert nwGUI.windowState() & Qt.WindowFullScreen != Qt.WindowFullScreen
|
||||
assert nwGUI.windowState() & fullScreen != fullScreen
|
||||
|
||||
# SideBar Menu
|
||||
# ============
|
||||
|
||||
@@ -24,7 +24,7 @@ import sys
|
||||
|
||||
import pytest
|
||||
|
||||
from PyQt5.QtWidgets import QApplication, QDialog, QMessageBox
|
||||
from PyQt6.QtWidgets import QApplication, QDialog, QMessageBox
|
||||
|
||||
from novelwriter import CONFIG, SHARED
|
||||
from novelwriter.dialogs.about import GuiAbout
|
||||
|
||||
@@ -24,8 +24,8 @@ from unittest.mock import MagicMock
|
||||
|
||||
import pytest
|
||||
|
||||
from PyQt5.QtGui import QDesktopServices, QTextBlock, QTextCursor
|
||||
from PyQt5.QtWidgets import QAction, QFileDialog, QMessageBox
|
||||
from PyQt6.QtGui import QAction, QDesktopServices, QTextBlock, QTextCursor
|
||||
from PyQt6.QtWidgets import QFileDialog, QMessageBox
|
||||
|
||||
from novelwriter import CONFIG, SHARED
|
||||
from novelwriter.constants import nwKeyWords, nwShortcode, nwStats, nwUnicode
|
||||
@@ -187,7 +187,7 @@ def testGuiMainMenu_EditFormat(qtbot, monkeypatch, nwGUI, prjLipsum):
|
||||
|
||||
# Cut, Copy and Paste
|
||||
docEditor.setCursorPosition(54)
|
||||
docEditor._makeSelection(QTextCursor.WordUnderCursor)
|
||||
docEditor._makeSelection(QTextCursor.SelectionType.WordUnderCursor)
|
||||
|
||||
mainMenu.aEditCut.activate(QAction.ActionEvent.Trigger)
|
||||
assert docEditor.getText()[54:104] == (
|
||||
@@ -200,7 +200,7 @@ def testGuiMainMenu_EditFormat(qtbot, monkeypatch, nwGUI, prjLipsum):
|
||||
)
|
||||
|
||||
docEditor.setCursorPosition(54)
|
||||
docEditor._makeSelection(QTextCursor.WordUnderCursor)
|
||||
docEditor._makeSelection(QTextCursor.SelectionType.WordUnderCursor)
|
||||
|
||||
mainMenu.aEditCopy.activate(QAction.ActionEvent.Trigger)
|
||||
assert docEditor.getText()[54:104] == (
|
||||
|
||||
@@ -24,9 +24,9 @@ from pathlib import Path
|
||||
|
||||
import pytest
|
||||
|
||||
from PyQt5.QtCore import QEvent, QPoint, Qt
|
||||
from PyQt5.QtGui import QFocusEvent
|
||||
from PyQt5.QtWidgets import QInputDialog, QToolTip
|
||||
from PyQt6.QtCore import QEvent, QPoint, Qt
|
||||
from PyQt6.QtGui import QFocusEvent
|
||||
from PyQt6.QtWidgets import QInputDialog, QToolTip
|
||||
|
||||
from novelwriter import CONFIG, SHARED
|
||||
from novelwriter.dialogs.editlabel import GuiEditLabel
|
||||
@@ -225,7 +225,7 @@ def testGuiNovelTree_TreeItems(qtbot, monkeypatch, nwGUI, projPath, mockRnd):
|
||||
scItem = novelTree.topLevelItem(2)
|
||||
scItem.setSelected(True)
|
||||
assert scItem.isSelected()
|
||||
novelTree.focusOutEvent(QFocusEvent(QEvent.Type.None_, Qt.MouseFocusReason))
|
||||
novelTree.focusOutEvent(QFocusEvent(QEvent.Type.None_, Qt.FocusReason.MouseFocusReason))
|
||||
assert not scItem.isSelected()
|
||||
|
||||
# Close
|
||||
|
||||
@@ -26,7 +26,8 @@ from shutil import copyfile
|
||||
|
||||
import pytest
|
||||
|
||||
from PyQt5.QtWidgets import QAction, QFileDialog, QWidget
|
||||
from PyQt6.QtGui import QAction
|
||||
from PyQt6.QtWidgets import QFileDialog, QWidget
|
||||
|
||||
from novelwriter import CONFIG, SHARED
|
||||
from novelwriter.constants import nwKeyWords
|
||||
|
||||
@@ -24,9 +24,9 @@ from unittest.mock import MagicMock
|
||||
|
||||
import pytest
|
||||
|
||||
from PyQt5.QtCore import QEvent, QItemSelectionModel, QModelIndex, QPoint
|
||||
from PyQt5.QtGui import QMouseEvent
|
||||
from PyQt5.QtWidgets import QMenu, QMessageBox
|
||||
from PyQt6.QtCore import QEvent, QItemSelectionModel, QModelIndex, QPointF
|
||||
from PyQt6.QtGui import QMouseEvent
|
||||
from PyQt6.QtWidgets import QMenu, QMessageBox
|
||||
|
||||
from novelwriter import CONFIG, SHARED
|
||||
from novelwriter.dialogs.docmerge import GuiDocMerge
|
||||
@@ -516,14 +516,14 @@ def testGuiProjTree_MouseClicks(qtbot, monkeypatch, nwGUI, projPath, mockRnd):
|
||||
modifier = QtModNone
|
||||
|
||||
# Trigger the viewer
|
||||
pos = projTree.visualRect(model.indexFromHandle(C.hChapterDoc)).center()
|
||||
pos = QPointF(projTree.visualRect(model.indexFromHandle(C.hChapterDoc)).center())
|
||||
button = QtMouseMiddle
|
||||
event = QMouseEvent(eType, pos, button, button, modifier)
|
||||
projTree.mousePressEvent(event)
|
||||
assert nwGUI.docViewer.docHandle == C.hChapterDoc
|
||||
|
||||
# Trigger the left click clear
|
||||
pos = QPoint(5000, 5000)
|
||||
pos = QPointF(5000.0, 5000.0)
|
||||
button = QtMouseLeft
|
||||
event = QMouseEvent(eType, pos, button, button, modifier)
|
||||
|
||||
|
||||
@@ -24,8 +24,8 @@ from time import time
|
||||
|
||||
import pytest
|
||||
|
||||
from PyQt5.QtCore import Qt
|
||||
from PyQt5.QtWidgets import QAction
|
||||
from PyQt6.QtCore import Qt
|
||||
from PyQt6.QtGui import QAction
|
||||
|
||||
from novelwriter.enum import nwView
|
||||
from novelwriter.gui.search import GuiProjectSearch
|
||||
|
||||
@@ -24,8 +24,8 @@ from pathlib import Path
|
||||
|
||||
import pytest
|
||||
|
||||
from PyQt5.QtGui import QColor, QIcon, QPalette, QPixmap
|
||||
from PyQt5.QtWidgets import QApplication
|
||||
from PyQt6.QtGui import QColor, QIcon, QPalette, QPixmap
|
||||
from PyQt6.QtWidgets import QApplication
|
||||
|
||||
from novelwriter import CONFIG, SHARED
|
||||
from novelwriter.common import NWConfigParser
|
||||
|
||||
@@ -25,8 +25,8 @@ from zipfile import ZipFile
|
||||
import enchant
|
||||
import pytest
|
||||
|
||||
from PyQt5.QtGui import QDesktopServices
|
||||
from PyQt5.QtWidgets import QFileDialog
|
||||
from PyQt6.QtGui import QDesktopServices
|
||||
from PyQt6.QtWidgets import QFileDialog
|
||||
|
||||
from novelwriter import SHARED
|
||||
from novelwriter.tools.dictionaries import GuiDictionaries
|
||||
|
||||
@@ -22,7 +22,7 @@ from __future__ import annotations
|
||||
|
||||
import pytest
|
||||
|
||||
from PyQt5.QtWidgets import QAction
|
||||
from PyQt6.QtGui import QAction
|
||||
|
||||
from novelwriter import SHARED
|
||||
from novelwriter.enum import nwDocInsert
|
||||
|
||||
@@ -24,9 +24,9 @@ from pathlib import Path
|
||||
|
||||
import pytest
|
||||
|
||||
from PyQt5.QtCore import QUrl
|
||||
from PyQt5.QtGui import QDesktopServices
|
||||
from PyQt5.QtWidgets import QFileDialog, QListWidgetItem, QMessageBox
|
||||
from PyQt6.QtCore import QUrl
|
||||
from PyQt6.QtGui import QDesktopServices
|
||||
from PyQt6.QtWidgets import QFileDialog, QListWidgetItem, QMessageBox
|
||||
from pytestqt.qtbot import QtBot
|
||||
|
||||
from novelwriter.constants import nwLabels
|
||||
|
||||
@@ -26,10 +26,10 @@ from unittest.mock import MagicMock
|
||||
|
||||
import pytest
|
||||
|
||||
from PyQt5.QtCore import QUrl, pyqtSlot
|
||||
from PyQt5.QtGui import QDesktopServices
|
||||
from PyQt5.QtPrintSupport import QPrintPreviewDialog
|
||||
from PyQt5.QtWidgets import QAction, QListWidgetItem
|
||||
from PyQt6.QtCore import QUrl, pyqtSlot
|
||||
from PyQt6.QtGui import QAction, QDesktopServices
|
||||
from PyQt6.QtPrintSupport import QPrintPreviewDialog
|
||||
from PyQt6.QtWidgets import QListWidgetItem
|
||||
|
||||
from novelwriter import SHARED
|
||||
from novelwriter.constants import nwHeadFmt
|
||||
|
||||
@@ -22,9 +22,9 @@ from __future__ import annotations
|
||||
|
||||
import pytest
|
||||
|
||||
from PyQt5.QtCore import pyqtSlot
|
||||
from PyQt5.QtGui import QFont
|
||||
from PyQt5.QtWidgets import QFontDialog
|
||||
from PyQt6.QtCore import pyqtSlot
|
||||
from PyQt6.QtGui import QFont
|
||||
from PyQt6.QtWidgets import QFontDialog
|
||||
|
||||
from novelwriter import SHARED
|
||||
from novelwriter.common import describeFont
|
||||
|
||||
@@ -22,7 +22,7 @@ from __future__ import annotations
|
||||
|
||||
import pytest
|
||||
|
||||
from PyQt5.QtWidgets import QAction
|
||||
from PyQt6.QtGui import QAction
|
||||
|
||||
from novelwriter import SHARED
|
||||
from novelwriter.enum import nwItemClass
|
||||
|
||||
@@ -25,8 +25,9 @@ from pathlib import Path
|
||||
|
||||
import pytest
|
||||
|
||||
from PyQt5.QtCore import QPoint
|
||||
from PyQt5.QtWidgets import QAction, QFileDialog, QMenu
|
||||
from PyQt6.QtCore import QPoint
|
||||
from PyQt6.QtGui import QAction
|
||||
from PyQt6.QtWidgets import QFileDialog, QMenu
|
||||
from pytestqt.qtbot import QtBot
|
||||
|
||||
from novelwriter import CONFIG, SHARED
|
||||
@@ -162,6 +163,7 @@ def testToolWelcome_Open(qtbot: QtBot, monkeypatch, nwGUI, fncPath):
|
||||
welcome.close()
|
||||
|
||||
|
||||
@pytest.mark.skip
|
||||
@pytest.mark.gui
|
||||
def testToolWelcome_New(qtbot: QtBot, caplog, monkeypatch, nwGUI, fncPath):
|
||||
"""Test the new project tab in the Welcome window."""
|
||||
|
||||
@@ -24,7 +24,9 @@ import json
|
||||
|
||||
import pytest
|
||||
|
||||
from PyQt5.QtWidgets import QAction, QFileDialog
|
||||
from PyQt6.QtCore import Qt
|
||||
from PyQt6.QtGui import QAction
|
||||
from PyQt6.QtWidgets import QFileDialog
|
||||
|
||||
from novelwriter import SHARED
|
||||
from novelwriter.constants import nwFiles
|
||||
@@ -117,7 +119,7 @@ def testToolWritingStats_Export(qtbot, monkeypatch, nwGUI, projPath, tstPaths):
|
||||
assert not sessLog._saveData(None) # type: ignore
|
||||
|
||||
# Sort by time
|
||||
sessLog.listBox.sortByColumn(sessLog.C_TIME, 0) # type: ignore
|
||||
sessLog.listBox.sortByColumn(sessLog.C_TIME, Qt.SortOrder.AscendingOrder)
|
||||
|
||||
assert sessLog.novelWords.text() == "{:n}".format(600)
|
||||
assert sessLog.notesWords.text() == "{:n}".format(275)
|
||||
@@ -201,7 +203,7 @@ def testToolWritingStats_Filters(qtbot, monkeypatch, nwGUI, projPath, tstPaths):
|
||||
]
|
||||
sessFile.write_text("".join(data), encoding="utf-8")
|
||||
sessLog.populateGUI()
|
||||
sessLog.listBox.sortByColumn(sessLog.C_TIME, 0) # type: ignore
|
||||
sessLog.listBox.sortByColumn(sessLog.C_TIME, Qt.SortOrder.AscendingOrder)
|
||||
|
||||
assert sessLog.listBox.topLevelItem(0).text(sessLog.C_COUNT) == "{:n}".format(1)
|
||||
assert sessLog.listBox.topLevelItem(1).text(sessLog.C_COUNT) == "{:n}".format(-200)
|
||||
|
||||
+1
-1
@@ -26,7 +26,7 @@ import xml.etree.ElementTree as ET
|
||||
from datetime import datetime
|
||||
from pathlib import Path
|
||||
|
||||
from PyQt5.QtWidgets import QDialog, QVBoxLayout, QWidget
|
||||
from PyQt6.QtWidgets import QDialog, QVBoxLayout, QWidget
|
||||
|
||||
XML_IGNORE = ("<novelWriterXML", "<project")
|
||||
ODT_IGNORE = ("<meta:generator", "<meta:creation-date", "<dc:date", "<meta:editing")
|
||||
|
||||
Reference in New Issue
Block a user