Update tests
This commit is contained in:
@@ -22,10 +22,12 @@ from __future__ import annotations
|
|||||||
|
|
||||||
import pytest
|
import pytest
|
||||||
|
|
||||||
from PyQt5.QtCore import QPoint, QPointF, Qt
|
from PyQt5.QtCore import QEvent, QPoint, QPointF, Qt
|
||||||
from PyQt5.QtGui import QWheelEvent
|
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
|
from tests.tools import SimpleDialog
|
||||||
|
|
||||||
@@ -47,6 +49,21 @@ class MockWheelEvent(QWheelEvent):
|
|||||||
return
|
return
|
||||||
|
|
||||||
|
|
||||||
|
@pytest.mark.gui
|
||||||
|
def testExtModified_NDialog(qtbot, monkeypatch):
|
||||||
|
"""Test the QDialog 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
|
@pytest.mark.gui
|
||||||
def testExtModified_NComboBox(qtbot, monkeypatch):
|
def testExtModified_NComboBox(qtbot, monkeypatch):
|
||||||
"""Test the NComboBox class."""
|
"""Test the NComboBox class."""
|
||||||
|
|||||||
@@ -152,6 +152,4 @@ def testToolDictionaries_Main(qtbot, monkeypatch, nwGUI, fncPath):
|
|||||||
"Additional dictionaries found: 2"
|
"Additional dictionaries found: 2"
|
||||||
)
|
)
|
||||||
|
|
||||||
# Close
|
|
||||||
nwDicts._doClose()
|
|
||||||
# qtbot.stop()
|
# qtbot.stop()
|
||||||
|
|||||||
Reference in New Issue
Block a user