Update Qt namespace flags
This commit is contained in:
@@ -26,13 +26,14 @@ from pathlib import Path
|
||||
from datetime import datetime
|
||||
from pytestqt.qtbot import QtBot
|
||||
|
||||
from PyQt5.QtCore import QPoint, Qt
|
||||
from PyQt5.QtCore import QPoint
|
||||
from PyQt5.QtWidgets import QAction, QFileDialog, QMenu
|
||||
|
||||
from novelwriter import CONFIG, SHARED
|
||||
from novelwriter.enum import nwItemClass
|
||||
from novelwriter.constants import nwFiles
|
||||
from novelwriter.tools.welcome import GuiWelcome
|
||||
from novelwriter.types import QtMouseLeft
|
||||
|
||||
|
||||
@pytest.mark.gui
|
||||
@@ -100,19 +101,19 @@ def testToolWelcome_Open(qtbot: QtBot, monkeypatch, nwGUI, fncPath):
|
||||
|
||||
# Single click item
|
||||
assert tabOpen.selectedPath.text() == "Path: /stuff/project_two"
|
||||
qtbot.mouseClick(vPort, Qt.MouseButton.LeftButton, pos=posTwo, delay=10)
|
||||
qtbot.mouseClick(vPort, QtMouseLeft, pos=posTwo, delay=10)
|
||||
assert tabOpen.selectedPath.text() == "Path: /stuff/project_one"
|
||||
|
||||
# Double click item
|
||||
qtbot.mouseClick(vPort, Qt.MouseButton.LeftButton, pos=posTwo, delay=10)
|
||||
qtbot.mouseClick(vPort, QtMouseLeft, pos=posTwo, delay=10)
|
||||
with monkeypatch.context() as mp:
|
||||
mp.setattr(welcome, "close", lambda *a: None)
|
||||
with qtbot.waitSignal(welcome.openProjectRequest, timeout=5000) as signal:
|
||||
qtbot.mouseDClick(vPort, Qt.MouseButton.LeftButton, pos=posTwo, delay=10)
|
||||
qtbot.mouseDClick(vPort, QtMouseLeft, pos=posTwo, delay=10)
|
||||
assert signal.args and signal.args[0] == Path("/stuff/project_one")
|
||||
|
||||
# Press open button
|
||||
qtbot.mouseClick(vPort, Qt.MouseButton.LeftButton, pos=posTwo, delay=10)
|
||||
qtbot.mouseClick(vPort, QtMouseLeft, pos=posTwo, delay=10)
|
||||
with monkeypatch.context() as mp:
|
||||
mp.setattr(welcome, "close", lambda *a: None)
|
||||
with qtbot.waitSignal(welcome.openProjectRequest, timeout=5000) as signal:
|
||||
@@ -128,7 +129,7 @@ def testToolWelcome_Open(qtbot: QtBot, monkeypatch, nwGUI, fncPath):
|
||||
return obj
|
||||
return None
|
||||
|
||||
qtbot.mouseClick(vPort, Qt.MouseButton.LeftButton, pos=posOne, delay=10)
|
||||
qtbot.mouseClick(vPort, QtMouseLeft, pos=posOne, delay=10)
|
||||
ctxMenu = getMenuForPos(posOne)
|
||||
assert isinstance(ctxMenu, QMenu)
|
||||
assert ctxMenu.actions()[0].text() == "Open Project"
|
||||
|
||||
@@ -25,15 +25,15 @@ import pytest
|
||||
|
||||
from pathlib import Path
|
||||
|
||||
from tools import buildTestProject
|
||||
from mocked import causeOSError
|
||||
from tools import buildTestProject
|
||||
|
||||
from PyQt5.QtCore import Qt
|
||||
from PyQt5.QtWidgets import QAction, QFileDialog
|
||||
|
||||
from novelwriter import SHARED
|
||||
from novelwriter.constants import nwFiles
|
||||
from novelwriter.tools.writingstats import GuiWritingStats
|
||||
from novelwriter.types import QtMouseLeft
|
||||
|
||||
|
||||
@pytest.mark.gui
|
||||
@@ -97,11 +97,11 @@ def testToolWritingStats_Main(qtbot, monkeypatch, nwGUI, projPath, tstPaths):
|
||||
monkeypatch.setattr(QFileDialog, "getSaveFileName", lambda *a, **k: ("", ""))
|
||||
assert not sessLog._saveData(sessLog.FMT_CSV)
|
||||
assert not sessLog._saveData(sessLog.FMT_JSON)
|
||||
assert not sessLog._saveData(None)
|
||||
assert not sessLog._saveData(None) # type: ignore
|
||||
|
||||
# Make the save succeed
|
||||
monkeypatch.setattr(QFileDialog, "getSaveFileName", lambda ss, tt, pp, options: (pp, ""))
|
||||
sessLog.listBox.sortByColumn(sessLog.C_TIME, 0)
|
||||
sessLog.listBox.sortByColumn(sessLog.C_TIME, 0) # type: ignore
|
||||
|
||||
assert sessLog.novelWords.text() == "{:n}".format(600)
|
||||
assert sessLog.notesWords.text() == "{:n}".format(275)
|
||||
@@ -156,7 +156,7 @@ def testToolWritingStats_Main(qtbot, monkeypatch, nwGUI, projPath, tstPaths):
|
||||
# ============
|
||||
|
||||
# No Novel Files
|
||||
qtbot.mouseClick(sessLog.incNovel, Qt.LeftButton)
|
||||
qtbot.mouseClick(sessLog.incNovel, QtMouseLeft)
|
||||
assert sessLog._saveData(sessLog.FMT_JSON)
|
||||
|
||||
jsonStats = tstPaths.tmpDir / "sessionStats.json"
|
||||
@@ -201,8 +201,8 @@ def testToolWritingStats_Main(qtbot, monkeypatch, nwGUI, projPath, tstPaths):
|
||||
]
|
||||
|
||||
# No Note Files
|
||||
qtbot.mouseClick(sessLog.incNovel, Qt.LeftButton)
|
||||
qtbot.mouseClick(sessLog.incNotes, Qt.LeftButton)
|
||||
qtbot.mouseClick(sessLog.incNovel, QtMouseLeft)
|
||||
qtbot.mouseClick(sessLog.incNotes, QtMouseLeft)
|
||||
assert sessLog._saveData(sessLog.FMT_JSON)
|
||||
|
||||
jsonStats = tstPaths.tmpDir / "sessionStats.json"
|
||||
@@ -247,8 +247,8 @@ def testToolWritingStats_Main(qtbot, monkeypatch, nwGUI, projPath, tstPaths):
|
||||
]
|
||||
|
||||
# No Negative Entries
|
||||
qtbot.mouseClick(sessLog.incNotes, Qt.LeftButton)
|
||||
qtbot.mouseClick(sessLog.hideNegative, Qt.LeftButton)
|
||||
qtbot.mouseClick(sessLog.incNotes, QtMouseLeft)
|
||||
qtbot.mouseClick(sessLog.hideNegative, QtMouseLeft)
|
||||
assert sessLog._saveData(sessLog.FMT_JSON)
|
||||
|
||||
# qtbot.stop()
|
||||
@@ -279,8 +279,8 @@ def testToolWritingStats_Main(qtbot, monkeypatch, nwGUI, projPath, tstPaths):
|
||||
]
|
||||
|
||||
# Un-hide Zero Entries
|
||||
qtbot.mouseClick(sessLog.hideNegative, Qt.LeftButton)
|
||||
qtbot.mouseClick(sessLog.hideZeros, Qt.LeftButton)
|
||||
qtbot.mouseClick(sessLog.hideNegative, QtMouseLeft)
|
||||
qtbot.mouseClick(sessLog.hideZeros, QtMouseLeft)
|
||||
assert sessLog._saveData(sessLog.FMT_JSON)
|
||||
|
||||
jsonStats = tstPaths.tmpDir / "sessionStats.json"
|
||||
@@ -333,7 +333,7 @@ def testToolWritingStats_Main(qtbot, monkeypatch, nwGUI, projPath, tstPaths):
|
||||
]
|
||||
|
||||
# Group by Day
|
||||
qtbot.mouseClick(sessLog.groupByDay, Qt.LeftButton)
|
||||
qtbot.mouseClick(sessLog.groupByDay, QtMouseLeft)
|
||||
assert sessLog._saveData(sessLog.FMT_JSON)
|
||||
|
||||
jsonStats = tstPaths.tmpDir / "sessionStats.json"
|
||||
|
||||
Reference in New Issue
Block a user