Fix warnings in tests
This commit is contained in:
@@ -441,6 +441,9 @@ def testGuiEditor_ContextMenu(monkeypatch, qtbot, nwGUI, projPath, mockRnd):
|
||||
ctxMenu.deleteLater()
|
||||
|
||||
# Copy Text
|
||||
clipboard = QApplication.clipboard()
|
||||
assert clipboard is not None
|
||||
|
||||
ctxMenu = getMenuForPos(docEditor, 31, True)
|
||||
assert ctxMenu is not None
|
||||
assert docEditor.textCursor().selectedText() == "text"
|
||||
@@ -448,14 +451,14 @@ def testGuiEditor_ContextMenu(monkeypatch, qtbot, nwGUI, projPath, mockRnd):
|
||||
assert actions == [
|
||||
"Cut", "Copy", "Paste", "Select All", "Select Word", "Select Paragraph"
|
||||
]
|
||||
QApplication.clipboard().clear()
|
||||
clipboard.clear()
|
||||
ctxMenu.actions()[1].trigger()
|
||||
assert QApplication.clipboard().text(QClipboard.Mode.Clipboard) == "text"
|
||||
assert clipboard.text(QClipboard.Mode.Clipboard) == "text"
|
||||
|
||||
# Cut Text
|
||||
QApplication.clipboard().clear()
|
||||
clipboard.clear()
|
||||
ctxMenu.actions()[0].trigger()
|
||||
assert QApplication.clipboard().text(QClipboard.Mode.Clipboard) == "text"
|
||||
assert clipboard.text(QClipboard.Mode.Clipboard) == "text"
|
||||
assert "text" not in docEditor.getText()
|
||||
|
||||
# Paste Text
|
||||
@@ -572,7 +575,9 @@ def testGuiEditor_Actions(qtbot, nwGUI, projPath, ipsumText, mockRnd):
|
||||
# Select/Cut/Copy/Paste/Undo/Redo
|
||||
# ===============================
|
||||
|
||||
QApplication.clipboard().clear()
|
||||
clipboard = QApplication.clipboard()
|
||||
assert clipboard is not None
|
||||
clipboard.clear()
|
||||
|
||||
# Select All
|
||||
assert docEditor.docAction(nwDocAction.SEL_ALL) is True
|
||||
@@ -624,7 +629,7 @@ def testGuiEditor_Actions(qtbot, nwGUI, projPath, ipsumText, mockRnd):
|
||||
assert newPara[5] == ipsumText[4]
|
||||
assert newPara[6] == ipsumText[2]
|
||||
|
||||
QApplication.clipboard().clear()
|
||||
clipboard.clear()
|
||||
|
||||
# Emphasis/Undo/Redo
|
||||
# ==================
|
||||
|
||||
Reference in New Issue
Block a user