From 5adf21e87a6b1085dd6f34d927329345ee27d4da Mon Sep 17 00:00:00 2001 From: Veronica Berglyd Olsen <1619840+vkbo@users.noreply.github.com> Date: Thu, 29 Sep 2022 14:25:42 +0200 Subject: [PATCH] Add integration test coverage of insert spaces issue --- .../guiEditor_Main_Final_0e17daca5f3e1.nwd | 8 ++++ .../guiEditor_Main_Final_nwProject.nwx | 14 +++---- tests/test_gui/test_gui_guimain.py | 38 +++++++++++++++++++ 3 files changed, 53 insertions(+), 7 deletions(-) diff --git a/tests/reference/guiEditor_Main_Final_0e17daca5f3e1.nwd b/tests/reference/guiEditor_Main_Final_0e17daca5f3e1.nwd index 67886bc1..aabfe562 100644 --- a/tests/reference/guiEditor_Main_Final_0e17daca5f3e1.nwd +++ b/tests/reference/guiEditor_Main_Final_0e17daca5f3e1.nwd @@ -27,6 +27,14 @@ This is another paragraph of much longer nonsense text. It is in fact 1 very ver ‘Full line single quoted text.’ +Some “ double quoted text with spaces padded ”. + +@object: NoSpaceAdded + +% synopsis: No space before this colon. + +Add space before this colon : See? + “Tab-indented text” >“Paragraph-indented text” diff --git a/tests/reference/guiEditor_Main_Final_nwProject.nwx b/tests/reference/guiEditor_Main_Final_nwProject.nwx index 1111c579..d4dbfd2e 100644 --- a/tests/reference/guiEditor_Main_Final_nwProject.nwx +++ b/tests/reference/guiEditor_Main_Final_nwProject.nwx @@ -1,5 +1,5 @@ - + New Project @@ -15,8 +15,8 @@ True 0e17daca5f3e1 None - 126 - 99 + 142 + 115 27 @@ -85,10 +85,10 @@ New True DOCUMENT - 612 - 95 - 10 - 768 + 693 + 111 + 12 + 917 Plot diff --git a/tests/test_gui/test_gui_guimain.py b/tests/test_gui/test_gui_guimain.py index cbc37dc7..4eab5fb0 100644 --- a/tests/test_gui/test_gui_guimain.py +++ b/tests/test_gui/test_gui_guimain.py @@ -340,6 +340,9 @@ def testGuiMain_Editing(qtbot, monkeypatch, nwGUI, fncProj, refDir, outDir): qtbot.keyClick(nwGUI.docEditor, Qt.Key_Return, delay=keyDelay) qtbot.keyClick(nwGUI.docEditor, Qt.Key_Return, delay=keyDelay) + # Auto-Replace + # ============ + for c in ( "This is another paragraph of much longer nonsense text. " "It is in fact 1 very very NONSENSICAL nonsense text! " @@ -373,6 +376,41 @@ def testGuiMain_Editing(qtbot, monkeypatch, nwGUI, fncProj, refDir, outDir): qtbot.keyClick(nwGUI.docEditor, Qt.Key_Return, delay=keyDelay) qtbot.keyClick(nwGUI.docEditor, Qt.Key_Return, delay=keyDelay) + # Insert spaces before and after quotes + nwGUI.mainConf.fmtPadBefore = "\u201d" + nwGUI.mainConf.fmtPadAfter = "\u201c" + + for c in "Some \"double quoted text with spaces padded\".": + qtbot.keyClick(nwGUI.docEditor, c, delay=typeDelay) + qtbot.keyClick(nwGUI.docEditor, Qt.Key_Return, delay=keyDelay) + qtbot.keyClick(nwGUI.docEditor, Qt.Key_Return, delay=keyDelay) + + nwGUI.mainConf.fmtPadBefore = "" + nwGUI.mainConf.fmtPadAfter = "" + + # Insert spaces before colon, but ignore tags and synopsis + nwGUI.mainConf.fmtPadBefore = ":" + + for c in "@object: NoSpaceAdded": + qtbot.keyClick(nwGUI.docEditor, c, delay=typeDelay) + qtbot.keyClick(nwGUI.docEditor, Qt.Key_Return, delay=keyDelay) + qtbot.keyClick(nwGUI.docEditor, Qt.Key_Return, delay=keyDelay) + + for c in "% synopsis: No space before this colon.": + qtbot.keyClick(nwGUI.docEditor, c, delay=typeDelay) + qtbot.keyClick(nwGUI.docEditor, Qt.Key_Return, delay=keyDelay) + qtbot.keyClick(nwGUI.docEditor, Qt.Key_Return, delay=keyDelay) + + for c in "Add space before this colon: See?": + qtbot.keyClick(nwGUI.docEditor, c, delay=typeDelay) + qtbot.keyClick(nwGUI.docEditor, Qt.Key_Return, delay=keyDelay) + qtbot.keyClick(nwGUI.docEditor, Qt.Key_Return, delay=keyDelay) + + nwGUI.mainConf.fmtPadBefore = "" + + # Indent and Align + # ================ + for c in "\t\"Tab-indented text\"": qtbot.keyClick(nwGUI.docEditor, c, delay=typeDelay) qtbot.keyClick(nwGUI.docEditor, Qt.Key_Return, delay=keyDelay)