Add [NEW PAGE] page and [VSPACE] to Insert menu (#848)
* Add menu entries for inserting new page and vspace codes * Update tests
This commit is contained in:
committed by
GitHub
parent
97aebc5b84
commit
1bf584f9bf
@@ -464,7 +464,8 @@ def testGuiMenu_Insert(qtbot, monkeypatch, nwGUI, fncDir, fncProj):
|
||||
"""Test the Insert menu.
|
||||
"""
|
||||
# Block message box
|
||||
monkeypatch.setattr(QMessageBox, "question", lambda *args: QMessageBox.Yes)
|
||||
monkeypatch.setattr(QMessageBox, "question", lambda *a: QMessageBox.Yes)
|
||||
monkeypatch.setattr(QMessageBox, "critical", lambda *a: QMessageBox.Yes)
|
||||
|
||||
nwGUI.theProject.projTree.setSeed(42)
|
||||
assert nwGUI.newProject({"projPath": fncProj})
|
||||
@@ -641,6 +642,24 @@ def testGuiMenu_Insert(qtbot, monkeypatch, nwGUI, fncDir, fncProj):
|
||||
|
||||
nwGUI.docEditor.clear()
|
||||
|
||||
##
|
||||
# Insert Break or Space
|
||||
##
|
||||
|
||||
nwGUI.docEditor.setText("### Stuff\n")
|
||||
nwGUI.mainMenu.aInsNewPage.activate(QAction.Trigger)
|
||||
assert nwGUI.docEditor.getText() == "[NEW PAGE]\n### Stuff\n"
|
||||
|
||||
nwGUI.docEditor.setText("### Stuff\n")
|
||||
nwGUI.mainMenu.aInsVSpaceS.activate(QAction.Trigger)
|
||||
assert nwGUI.docEditor.getText() == "[VSPACE]\n### Stuff\n"
|
||||
|
||||
nwGUI.docEditor.setText("### Stuff\n")
|
||||
nwGUI.mainMenu.aInsVSpaceM.activate(QAction.Trigger)
|
||||
assert nwGUI.docEditor.getText() == "[VSPACE:2]\n### Stuff\n"
|
||||
|
||||
nwGUI.docEditor.clear()
|
||||
|
||||
##
|
||||
# Insert text from file
|
||||
##
|
||||
|
||||
@@ -36,6 +36,7 @@ def testGuiTheme_Main(qtbot, monkeypatch, nwMinimal, tmpDir):
|
||||
"""
|
||||
# Block message box
|
||||
monkeypatch.setattr(QMessageBox, "question", lambda *a: QMessageBox.Yes)
|
||||
monkeypatch.setattr(QMessageBox, "warning", lambda *a: QMessageBox.Yes)
|
||||
|
||||
nwGUI = nw.main(["--testmode", "--config=%s" % nwMinimal, "--data=%s" % tmpDir, nwMinimal])
|
||||
qtbot.addWidget(nwGUI)
|
||||
|
||||
Reference in New Issue
Block a user