Merge branch 'main' into dialogue_highlight
This commit is contained in:
@@ -22,10 +22,12 @@ from __future__ import annotations
|
||||
|
||||
import pytest
|
||||
|
||||
from PyQt5.QtCore import QPoint, QPointF, Qt
|
||||
from PyQt5.QtGui import QWheelEvent
|
||||
from PyQt5.QtCore import QEvent, QPoint, QPointF, Qt
|
||||
from PyQt5.QtGui import QKeyEvent, QWheelEvent
|
||||
from PyQt5.QtWidgets import QWidget
|
||||
|
||||
from novelwriter.extensions.modified import NComboBox, NDoubleSpinBox, NSpinBox
|
||||
from novelwriter.extensions.modified import NComboBox, NDialog, NDoubleSpinBox, NSpinBox
|
||||
from novelwriter.types import QtModNone, QtRejected
|
||||
|
||||
from tests.tools import SimpleDialog
|
||||
|
||||
@@ -47,6 +49,21 @@ class MockWheelEvent(QWheelEvent):
|
||||
return
|
||||
|
||||
|
||||
@pytest.mark.gui
|
||||
def testExtModified_NDialog(qtbot, monkeypatch):
|
||||
"""Test the NDialog class."""
|
||||
widget = QWidget()
|
||||
dialog = NDialog(widget)
|
||||
assert dialog.parent() is widget
|
||||
|
||||
dialog.softDelete()
|
||||
assert dialog.parent() is None
|
||||
|
||||
with qtbot.waitSignal(dialog.rejected, timeout=1000):
|
||||
dialog.keyPressEvent(QKeyEvent(QEvent.Type.KeyPress, Qt.Key.Key_Escape, QtModNone))
|
||||
assert dialog.result() == QtRejected
|
||||
|
||||
|
||||
@pytest.mark.gui
|
||||
def testExtModified_NComboBox(qtbot, monkeypatch):
|
||||
"""Test the NComboBox class."""
|
||||
|
||||
@@ -152,6 +152,4 @@ def testToolDictionaries_Main(qtbot, monkeypatch, nwGUI, fncPath):
|
||||
"Additional dictionaries found: 2"
|
||||
)
|
||||
|
||||
# Close
|
||||
nwDicts._doClose()
|
||||
# qtbot.stop()
|
||||
|
||||
@@ -25,6 +25,7 @@ import pytest
|
||||
from PyQt5.QtWidgets import QAction
|
||||
|
||||
from novelwriter import SHARED
|
||||
from novelwriter.enum import nwDocInsert
|
||||
from novelwriter.tools.lipsum import GuiLipsum
|
||||
|
||||
from tests.tools import C, buildTestProject
|
||||
@@ -62,7 +63,8 @@ def testToolLipsum_Main(qtbot, monkeypatch, nwGUI, projPath, mockRnd):
|
||||
with monkeypatch.context() as mp:
|
||||
mp.setattr(GuiLipsum, "exec", lambda *a: None)
|
||||
mp.setattr(GuiLipsum, "lipsumText", "FooBar")
|
||||
nwGUI.mainMenu.aLipsumText.activate(QAction.Trigger)
|
||||
with qtbot.waitSignal(nwGUI.docEditor.textChanged):
|
||||
nwGUI.docEditor.insertText(nwDocInsert.LIPSUM)
|
||||
assert nwGUI.docEditor.getText() == "### New Scene\n\nFooBar"
|
||||
|
||||
# qtbot.stop()
|
||||
|
||||
Reference in New Issue
Block a user