From dc401278fb93711e518f918b3e757f88b19796f4 Mon Sep 17 00:00:00 2001 From: Veronica Berglyd Olsen <1619840+vkbo@users.noreply.github.com> Date: Sat, 29 Oct 2022 01:05:41 +0200 Subject: [PATCH] Update tests --- tests/test_gui/test_gui_doceditor.py | 4 ---- tests/test_gui/test_gui_mainmenu.py | 14 ++++++++++---- 2 files changed, 10 insertions(+), 8 deletions(-) diff --git a/tests/test_gui/test_gui_doceditor.py b/tests/test_gui/test_gui_doceditor.py index e2ba77ae..22a960c2 100644 --- a/tests/test_gui/test_gui_doceditor.py +++ b/tests/test_gui/test_gui_doceditor.py @@ -783,10 +783,6 @@ def testGuiEditor_BlockFormatting(qtbot, monkeypatch, nwGUI, nwMinimal, ipsumTex mp.setattr(QTextBlock, "isValid", lambda *a, **k: False) assert nwGUI.docEditor._formatBlock(nwDocAction.BLOCK_TXT) is False - # Empty Block - assert nwGUI.docEditor.setCursorLine(1) is True - assert nwGUI.docEditor._formatBlock(nwDocAction.BLOCK_TXT) is False - # Keyword assert nwGUI.docEditor.replaceText("@pov: Jane\n\n") is True assert nwGUI.docEditor.setCursorPosition(5) is True diff --git a/tests/test_gui/test_gui_mainmenu.py b/tests/test_gui/test_gui_mainmenu.py index e55e1039..f10514ad 100644 --- a/tests/test_gui/test_gui_mainmenu.py +++ b/tests/test_gui/test_gui_mainmenu.py @@ -116,6 +116,16 @@ def testGuiMenu_EditFormat(qtbot, monkeypatch, nwGUI, nwLipsum): fmtStr = "#### Pellentesque nec erat ut nulla posuere commodo." assert nwGUI.docEditor.getText()[39:91] == fmtStr + # Title Format + nwGUI.mainMenu.aFmtTitle.activate(QAction.Trigger) + fmtStr = "#! Pellentesque nec erat ut nulla posuere commodo." + assert nwGUI.docEditor.getText()[39:89] == fmtStr + + # Unnumbered Chapter + nwGUI.mainMenu.aFmtUnNum.activate(QAction.Trigger) + fmtStr = "##! Pellentesque nec erat ut nulla posuere commodo." + assert nwGUI.docEditor.getText()[39:90] == fmtStr + # Clear Format nwGUI.mainMenu.aFmtNoFormat.activate(QAction.Trigger) assert nwGUI.docEditor.getText()[39:86] == cleanText @@ -314,10 +324,6 @@ def testGuiMenu_EditFormat(qtbot, monkeypatch, nwGUI, nwLipsum): assert nwGUI.docEditor.setCursorPosition(17) assert not nwGUI.docEditor._formatBlock(nwDocAction.BLOCK_TXT) - # Cannot Format Empty Line - assert nwGUI.docEditor.setCursorPosition(13) - assert not nwGUI.docEditor._formatBlock(nwDocAction.BLOCK_TXT) - # Invalid Action assert nwGUI.docEditor.setCursorPosition(30) assert not nwGUI.docEditor._formatBlock(nwDocAction.NO_ACTION)