@@ -1,5 +1,5 @@
|
||||
<?xml version='1.0' encoding='utf-8'?>
|
||||
<novelWriterXML appVersion="0.8.0rc1" hexVersion="0x000800c1" fileVersion="1.1" timeStamp="2020-06-05 21:07:51">
|
||||
<novelWriterXML appVersion="0.9.0rc1" hexVersion="0x000900c1" fileVersion="1.1" timeStamp="2020-06-18 22:17:32">
|
||||
<project>
|
||||
<name>New Project</name>
|
||||
<title></title>
|
||||
@@ -11,9 +11,9 @@
|
||||
<doBackup>True</doBackup>
|
||||
<spellCheck>False</spellCheck>
|
||||
<autoOutline>True</autoOutline>
|
||||
<lastEdited>None</lastEdited>
|
||||
<lastEdited>31489056e0916</lastEdited>
|
||||
<lastViewed>None</lastViewed>
|
||||
<lastWordCount>0</lastWordCount>
|
||||
<lastWordCount>59</lastWordCount>
|
||||
<autoReplace/>
|
||||
<titleFormat>
|
||||
<title>%title%</title>
|
||||
@@ -41,14 +41,14 @@
|
||||
<type>ROOT</type>
|
||||
<class>NOVEL</class>
|
||||
<status>New</status>
|
||||
<expanded>False</expanded>
|
||||
<expanded>True</expanded>
|
||||
</item>
|
||||
<item handle="25fc0e7096fc6" order="0" parent="73475cb40a568">
|
||||
<name>New Chapter</name>
|
||||
<type>FOLDER</type>
|
||||
<class>NOVEL</class>
|
||||
<status>New</status>
|
||||
<expanded>False</expanded>
|
||||
<expanded>True</expanded>
|
||||
</item>
|
||||
<item handle="31489056e0916" order="0" parent="25fc0e7096fc6">
|
||||
<name>Just a Page</name>
|
||||
@@ -57,9 +57,9 @@
|
||||
<status>Note</status>
|
||||
<exported>False</exported>
|
||||
<layout>PAGE</layout>
|
||||
<charCount>0</charCount>
|
||||
<wordCount>0</wordCount>
|
||||
<paraCount>0</paraCount>
|
||||
<charCount>331</charCount>
|
||||
<wordCount>59</wordCount>
|
||||
<paraCount>2</paraCount>
|
||||
<cursorPos>0</cursorPos>
|
||||
</item>
|
||||
<item handle="44cb730c42048" order="1" parent="None">
|
||||
|
||||
+147
-2
@@ -127,6 +127,11 @@ def testMainWindows(qtbot, nwTempGUI, nwRef, nwTemp):
|
||||
nwGUI.treeView.newTreeItem(nwItemType.FILE, None)
|
||||
assert nwGUI.openSelectedItem()
|
||||
|
||||
# Add Some Text
|
||||
nwGUI.docEditor.replaceText("Hello World!")
|
||||
assert nwGUI.docEditor.getText() == "Hello World!"
|
||||
nwGUI.docEditor.replaceText("")
|
||||
|
||||
# Type something into the document
|
||||
nwGUI.setFocus(2)
|
||||
for c in "# Main Location":
|
||||
@@ -359,6 +364,7 @@ def testItemEditor(qtbot, nwTempGUI, nwRef, nwTemp):
|
||||
# Create new, save, open project
|
||||
nwGUI.theProject.projTree.setSeed(42)
|
||||
assert nwGUI.newProject(nwTempGUI, True)
|
||||
assert nwGUI.openDocument("31489056e0916")
|
||||
|
||||
itemEdit = GuiItemEditor(nwGUI, nwGUI.theProject, "31489056e0916")
|
||||
qtbot.addWidget(itemEdit)
|
||||
@@ -375,7 +381,6 @@ def testItemEditor(qtbot, nwTempGUI, nwRef, nwTemp):
|
||||
|
||||
itemEdit.editExport.setChecked(False)
|
||||
assert not itemEdit.editExport.isChecked()
|
||||
|
||||
itemEdit._doSave()
|
||||
|
||||
itemEdit = GuiItemEditor(nwGUI, nwGUI.theProject, "31489056e0916")
|
||||
@@ -383,9 +388,16 @@ def testItemEditor(qtbot, nwTempGUI, nwRef, nwTemp):
|
||||
assert itemEdit.editName.text() == "Just a Page"
|
||||
assert itemEdit.editStatus.currentData() == "Note"
|
||||
assert itemEdit.editLayout.currentData() == nwItemLayout.PAGE
|
||||
|
||||
itemEdit._doClose()
|
||||
|
||||
# Check that the header is updated
|
||||
nwGUI.docEditor.updateDocTitle("31489056e0916")
|
||||
assert nwGUI.docEditor.docHeader.theTitle.text() == "Novel › New Chapter › Just a Page"
|
||||
assert not nwGUI.docEditor.setCursorLine("where?")
|
||||
assert nwGUI.docEditor.setCursorLine(2)
|
||||
qtbot.wait(stepDelay)
|
||||
assert nwGUI.docEditor.getCursorPosition() == 9
|
||||
|
||||
qtbot.wait(stepDelay)
|
||||
assert nwGUI.saveProject()
|
||||
qtbot.wait(stepDelay)
|
||||
@@ -611,3 +623,136 @@ def testSplitTool(qtbot, nwTempGUI, nwLipsum, nwRef, nwTemp):
|
||||
|
||||
# qtbot.stopForInteraction()
|
||||
nwGUI.closeMain()
|
||||
|
||||
@pytest.mark.gui
|
||||
def testDocAction(qtbot, nwTempGUI, nwLipsum, nwRef, nwTemp):
|
||||
|
||||
nwGUI = nw.main(["--testmode","--config=%s" % nwTempGUI, "--data=%s" % nwTemp])
|
||||
qtbot.addWidget(nwGUI)
|
||||
nwGUI.show()
|
||||
qtbot.waitForWindowShown(nwGUI)
|
||||
qtbot.wait(stepDelay)
|
||||
|
||||
nwGUI.theProject.projTree.setSeed(42)
|
||||
assert nwGUI.openProject(nwLipsum)
|
||||
qtbot.wait(stepDelay)
|
||||
|
||||
# CUT = 3
|
||||
# COPY = 4
|
||||
# PASTE = 5
|
||||
# SEL_ALL = 12
|
||||
# SEL_PARA = 13
|
||||
# FIND = 14
|
||||
# REPLACE = 15
|
||||
# GO_NEXT = 16
|
||||
# GO_PREV = 17
|
||||
# REPL_NEXT = 18
|
||||
|
||||
# Split By Chapter
|
||||
assert nwGUI.openDocument("4c4f28287af27")
|
||||
assert nwGUI.docEditor.setCursorPosition(30)
|
||||
|
||||
cleanText = nwGUI.docEditor.getText()[27:74]
|
||||
|
||||
# Bold
|
||||
assert nwGUI.passDocumentAction(nwDocAction.BOLD)
|
||||
assert nwGUI.docEditor.getText()[27:78] == "**Pellentesque** nec erat ut nulla posuere commodo."
|
||||
qtbot.wait(stepDelay)
|
||||
assert nwGUI.passDocumentAction(nwDocAction.BOLD)
|
||||
assert nwGUI.docEditor.getText()[27:74] == cleanText
|
||||
qtbot.wait(stepDelay)
|
||||
|
||||
# Italic
|
||||
assert nwGUI.passDocumentAction(nwDocAction.ITALIC)
|
||||
assert nwGUI.docEditor.getText()[27:76] == "*Pellentesque* nec erat ut nulla posuere commodo."
|
||||
qtbot.wait(stepDelay)
|
||||
assert nwGUI.passDocumentAction(nwDocAction.ITALIC)
|
||||
assert nwGUI.docEditor.getText()[27:74] == cleanText
|
||||
qtbot.wait(stepDelay)
|
||||
|
||||
# Bold-Italic
|
||||
assert nwGUI.passDocumentAction(nwDocAction.BOLDITALIC)
|
||||
assert nwGUI.docEditor.getText()[27:80] == "***Pellentesque*** nec erat ut nulla posuere commodo."
|
||||
qtbot.wait(stepDelay)
|
||||
assert nwGUI.passDocumentAction(nwDocAction.BOLDITALIC)
|
||||
assert nwGUI.docEditor.getText()[27:74] == cleanText
|
||||
qtbot.wait(stepDelay)
|
||||
|
||||
# Strikethrough
|
||||
assert nwGUI.passDocumentAction(nwDocAction.STRIKE)
|
||||
assert nwGUI.docEditor.getText()[27:78] == "~~Pellentesque~~ nec erat ut nulla posuere commodo."
|
||||
qtbot.wait(stepDelay)
|
||||
assert nwGUI.passDocumentAction(nwDocAction.STRIKE)
|
||||
assert nwGUI.docEditor.getText()[27:74] == cleanText
|
||||
qtbot.wait(stepDelay)
|
||||
|
||||
# Should get us back to plain
|
||||
assert nwGUI.passDocumentAction(nwDocAction.BOLD)
|
||||
qtbot.wait(stepDelay)
|
||||
assert nwGUI.passDocumentAction(nwDocAction.ITALIC)
|
||||
qtbot.wait(stepDelay)
|
||||
assert nwGUI.passDocumentAction(nwDocAction.ITALIC)
|
||||
qtbot.wait(stepDelay)
|
||||
assert nwGUI.passDocumentAction(nwDocAction.BOLD)
|
||||
assert nwGUI.docEditor.getText()[27:74] == cleanText
|
||||
qtbot.wait(stepDelay)
|
||||
|
||||
# Equivalent of the above
|
||||
assert nwGUI.passDocumentAction(nwDocAction.BOLDITALIC)
|
||||
qtbot.wait(stepDelay)
|
||||
assert nwGUI.passDocumentAction(nwDocAction.ITALIC)
|
||||
qtbot.wait(stepDelay)
|
||||
assert nwGUI.passDocumentAction(nwDocAction.BOLD)
|
||||
assert nwGUI.docEditor.getText()[27:74] == cleanText
|
||||
qtbot.wait(stepDelay)
|
||||
|
||||
# Double Quotes
|
||||
assert nwGUI.passDocumentAction(nwDocAction.D_QUOTE)
|
||||
assert nwGUI.docEditor.getText()[27:76] == "“Pellentesque” nec erat ut nulla posuere commodo."
|
||||
qtbot.wait(stepDelay)
|
||||
assert nwGUI.passDocumentAction(nwDocAction.UNDO)
|
||||
assert nwGUI.docEditor.getText()[27:74] == cleanText
|
||||
qtbot.wait(stepDelay)
|
||||
|
||||
# Single Quotes
|
||||
assert nwGUI.passDocumentAction(nwDocAction.S_QUOTE)
|
||||
assert nwGUI.docEditor.getText()[27:76] == "‘Pellentesque’ nec erat ut nulla posuere commodo."
|
||||
qtbot.wait(stepDelay)
|
||||
assert nwGUI.passDocumentAction(nwDocAction.UNDO)
|
||||
assert nwGUI.docEditor.getText()[27:74] == cleanText
|
||||
qtbot.wait(stepDelay)
|
||||
|
||||
# Block Formats
|
||||
assert nwGUI.docEditor.setCursorPosition(30)
|
||||
assert nwGUI.passDocumentAction(nwDocAction.BLOCK_H1)
|
||||
assert nwGUI.docEditor.getText()[27:76] == "# Pellentesque nec erat ut nulla posuere commodo."
|
||||
qtbot.wait(stepDelay)
|
||||
assert nwGUI.passDocumentAction(nwDocAction.BLOCK_H2)
|
||||
assert nwGUI.docEditor.getText()[27:77] == "## Pellentesque nec erat ut nulla posuere commodo."
|
||||
qtbot.wait(stepDelay)
|
||||
assert nwGUI.passDocumentAction(nwDocAction.BLOCK_H3)
|
||||
assert nwGUI.docEditor.getText()[27:78] == "### Pellentesque nec erat ut nulla posuere commodo."
|
||||
qtbot.wait(stepDelay)
|
||||
assert nwGUI.passDocumentAction(nwDocAction.BLOCK_H4)
|
||||
assert nwGUI.docEditor.getText()[27:79] == "#### Pellentesque nec erat ut nulla posuere commodo."
|
||||
qtbot.wait(stepDelay)
|
||||
assert nwGUI.passDocumentAction(nwDocAction.BLOCK_TXT)
|
||||
assert nwGUI.docEditor.getText()[27:74] == cleanText
|
||||
qtbot.wait(stepDelay)
|
||||
assert nwGUI.passDocumentAction(nwDocAction.BLOCK_COM)
|
||||
assert nwGUI.docEditor.getText()[27:76] == "% Pellentesque nec erat ut nulla posuere commodo."
|
||||
qtbot.wait(stepDelay)
|
||||
assert nwGUI.passDocumentAction(nwDocAction.BLOCK_TXT)
|
||||
assert nwGUI.docEditor.getText()[27:74] == cleanText
|
||||
qtbot.wait(stepDelay)
|
||||
|
||||
# Undo/Redo
|
||||
assert nwGUI.passDocumentAction(nwDocAction.UNDO)
|
||||
assert nwGUI.docEditor.getText()[27:76] == "% Pellentesque nec erat ut nulla posuere commodo."
|
||||
qtbot.wait(stepDelay)
|
||||
assert nwGUI.passDocumentAction(nwDocAction.REDO)
|
||||
assert nwGUI.docEditor.getText()[27:74] == cleanText
|
||||
qtbot.wait(stepDelay)
|
||||
|
||||
# qtbot.stopForInteraction()
|
||||
nwGUI.closeMain()
|
||||
|
||||
Reference in New Issue
Block a user