Index Updates (#840)
* Improve the index keyword checker function * Implement a more compact indented JSON encoder * Remove timestamp from reference, novel and note indices * Remove empty entries in reference index * Merge novel and note indices into a single file index
This commit is contained in:
committed by
GitHub
parent
e5c715695e
commit
c6973043e6
@@ -1175,7 +1175,7 @@ def testGuiEditor_Search(qtbot, monkeypatch, nwGUI, nwLipsum):
|
||||
qtbot.wait(stepDelay)
|
||||
|
||||
# Select the Word "est"
|
||||
assert nwGUI.docEditor.setCursorPosition(618)
|
||||
assert nwGUI.docEditor.setCursorPosition(630)
|
||||
nwGUI.docEditor._makeSelection(QTextCursor.WordUnderCursor)
|
||||
theCursor = nwGUI.docEditor.textCursor()
|
||||
assert theCursor.selectedText() == "est"
|
||||
@@ -1188,11 +1188,11 @@ def testGuiEditor_Search(qtbot, monkeypatch, nwGUI, nwLipsum):
|
||||
# Find Next by Enter
|
||||
monkeypatch.setattr(nwGUI.docEditor.docSearch.searchBox, "hasFocus", lambda: True)
|
||||
qtbot.keyClick(nwGUI.docEditor.docSearch.searchBox, Qt.Key_Return, delay=keyDelay)
|
||||
assert abs(nwGUI.docEditor.getCursorPosition() - 1272) < 3
|
||||
assert abs(nwGUI.docEditor.getCursorPosition() - 1284) < 3
|
||||
|
||||
# Find Next by Button
|
||||
qtbot.mouseClick(nwGUI.docEditor.docSearch.searchButton, Qt.LeftButton, delay=keyDelay)
|
||||
assert abs(nwGUI.docEditor.getCursorPosition() - 1486) < 3
|
||||
assert abs(nwGUI.docEditor.getCursorPosition() - 1498) < 3
|
||||
|
||||
# Activate Loop Search
|
||||
nwGUI.docEditor.docSearch.toggleLoop.activate(QAction.Trigger)
|
||||
@@ -1201,17 +1201,17 @@ def testGuiEditor_Search(qtbot, monkeypatch, nwGUI, nwLipsum):
|
||||
|
||||
# Find Next by Menu Search > Find Next
|
||||
nwGUI.mainMenu.aFindNext.activate(QAction.Trigger)
|
||||
assert abs(nwGUI.docEditor.getCursorPosition() - 620) < 3
|
||||
assert abs(nwGUI.docEditor.getCursorPosition() - 632) < 3
|
||||
|
||||
# Close Search
|
||||
nwGUI.docEditor.docSearch.cancelSearch.activate(QAction.Trigger)
|
||||
assert not nwGUI.docEditor.docSearch.isVisible()
|
||||
assert nwGUI.docEditor.docSearch.isVisible() is False
|
||||
assert nwGUI.docEditor.setCursorPosition(15)
|
||||
|
||||
# Toggle Search Again with Header Button
|
||||
qtbot.mouseClick(nwGUI.docEditor.docHeader.searchButton, Qt.LeftButton, delay=keyDelay)
|
||||
assert nwGUI.docEditor.docSearch.setSearchText("")
|
||||
assert nwGUI.docEditor.docSearch.isVisible()
|
||||
assert nwGUI.docEditor.docSearch.isVisible() is True
|
||||
|
||||
# Enable RegEx Search
|
||||
nwGUI.docEditor.docSearch.toggleRegEx.activate(QAction.Trigger)
|
||||
@@ -1226,13 +1226,13 @@ def testGuiEditor_Search(qtbot, monkeypatch, nwGUI, nwLipsum):
|
||||
# Set Valid RegEx
|
||||
assert nwGUI.docEditor.docSearch.setSearchText(r"\bSus")
|
||||
qtbot.mouseClick(nwGUI.docEditor.docSearch.searchButton, Qt.LeftButton, delay=keyDelay)
|
||||
assert abs(nwGUI.docEditor.getCursorPosition() - 196) < 3
|
||||
assert abs(nwGUI.docEditor.getCursorPosition() - 208) < 3
|
||||
|
||||
# Find Next and then Prev
|
||||
nwGUI.mainMenu.aFindNext.activate(QAction.Trigger)
|
||||
assert abs(nwGUI.docEditor.getCursorPosition() - 297) < 3
|
||||
assert abs(nwGUI.docEditor.getCursorPosition() - 309) < 3
|
||||
nwGUI.mainMenu.aFindPrev.activate(QAction.Trigger)
|
||||
assert abs(nwGUI.docEditor.getCursorPosition() - 196) < 3
|
||||
assert abs(nwGUI.docEditor.getCursorPosition() - 208) < 3
|
||||
|
||||
# Make RegEx Case Sensitive
|
||||
nwGUI.docEditor.docSearch.toggleCase.activate(QAction.Trigger)
|
||||
@@ -1241,9 +1241,9 @@ def testGuiEditor_Search(qtbot, monkeypatch, nwGUI, nwLipsum):
|
||||
|
||||
# Find Next (One Result)
|
||||
nwGUI.mainMenu.aFindNext.activate(QAction.Trigger)
|
||||
assert abs(nwGUI.docEditor.getCursorPosition() - 599) < 3
|
||||
assert abs(nwGUI.docEditor.getCursorPosition() - 611) < 3
|
||||
nwGUI.mainMenu.aFindNext.activate(QAction.Trigger)
|
||||
assert abs(nwGUI.docEditor.getCursorPosition() - 599) < 3
|
||||
assert abs(nwGUI.docEditor.getCursorPosition() - 611) < 3
|
||||
|
||||
# Trigger Replace
|
||||
nwGUI.mainMenu.aReplace.activate(QAction.Trigger)
|
||||
@@ -1261,14 +1261,14 @@ def testGuiEditor_Search(qtbot, monkeypatch, nwGUI, nwLipsum):
|
||||
|
||||
# Replace "Sus" with "Foo" via Menu
|
||||
nwGUI.mainMenu.aReplaceNext.activate(QAction.Trigger)
|
||||
assert nwGUI.docEditor.getText()[596:607] == "Foopendisse"
|
||||
assert nwGUI.docEditor.getText()[608:619] == "Foopendisse"
|
||||
|
||||
# Find Next to Loop File
|
||||
nwGUI.mainMenu.aFindNext.activate(QAction.Trigger)
|
||||
|
||||
# Replace "sus" with "foo" via Replace Button
|
||||
qtbot.mouseClick(nwGUI.docEditor.docSearch.replaceButton, Qt.LeftButton, delay=keyDelay)
|
||||
assert nwGUI.docEditor.getText()[193:201] == "foocipit"
|
||||
assert nwGUI.docEditor.getText()[205:213] == "foocipit"
|
||||
|
||||
# Revert Last Two Replaces
|
||||
assert nwGUI.docEditor.docAction(nwDocAction.UNDO)
|
||||
@@ -1282,7 +1282,7 @@ def testGuiEditor_Search(qtbot, monkeypatch, nwGUI, nwLipsum):
|
||||
|
||||
# Close Search and Select "est" Again
|
||||
nwGUI.docEditor.docSearch.cancelSearch.activate(QAction.Trigger)
|
||||
assert nwGUI.docEditor.setCursorPosition(618)
|
||||
assert nwGUI.docEditor.setCursorPosition(630)
|
||||
nwGUI.docEditor._makeSelection(QTextCursor.WordUnderCursor)
|
||||
theCursor = nwGUI.docEditor.textCursor()
|
||||
assert theCursor.selectedText() == "est"
|
||||
@@ -1299,9 +1299,9 @@ def testGuiEditor_Search(qtbot, monkeypatch, nwGUI, nwLipsum):
|
||||
|
||||
# Only One Match
|
||||
nwGUI.mainMenu.aFindNext.activate(QAction.Trigger)
|
||||
assert abs(nwGUI.docEditor.getCursorPosition() - 620) < 3
|
||||
assert abs(nwGUI.docEditor.getCursorPosition() - 632) < 3
|
||||
nwGUI.mainMenu.aFindNext.activate(QAction.Trigger)
|
||||
assert abs(nwGUI.docEditor.getCursorPosition() - 620) < 3
|
||||
assert abs(nwGUI.docEditor.getCursorPosition() - 632) < 3
|
||||
|
||||
# Enable Next Doc Search
|
||||
nwGUI.docEditor.docSearch.toggleProject.activate(QAction.Trigger)
|
||||
|
||||
@@ -54,35 +54,35 @@ def testGuiMenu_EditFormat(qtbot, monkeypatch, nwGUI, nwLipsum):
|
||||
|
||||
# Split By Chapter
|
||||
assert nwGUI.openDocument("4c4f28287af27") is True
|
||||
assert nwGUI.docEditor.setCursorPosition(30) is True
|
||||
assert nwGUI.docEditor.setCursorPosition(42) is True
|
||||
|
||||
cleanText = nwGUI.docEditor.getText()[27:74]
|
||||
cleanText = nwGUI.docEditor.getText()[39:86]
|
||||
|
||||
# Bold
|
||||
nwGUI.mainMenu.aFmtStrong.activate(QAction.Trigger)
|
||||
fmtStr = "**Pellentesque** nec erat ut nulla posuere commodo."
|
||||
assert nwGUI.docEditor.getText()[27:78] == fmtStr
|
||||
assert nwGUI.docEditor.getText()[39:90] == fmtStr
|
||||
qtbot.wait(stepDelay)
|
||||
nwGUI.mainMenu.aFmtStrong.activate(QAction.Trigger)
|
||||
assert nwGUI.docEditor.getText()[27:74] == cleanText
|
||||
assert nwGUI.docEditor.getText()[39:86] == cleanText
|
||||
qtbot.wait(stepDelay)
|
||||
|
||||
# Italic
|
||||
nwGUI.mainMenu.aFmtEmph.activate(QAction.Trigger)
|
||||
fmtStr = "_Pellentesque_ nec erat ut nulla posuere commodo."
|
||||
assert nwGUI.docEditor.getText()[27:76] == fmtStr
|
||||
assert nwGUI.docEditor.getText()[39:88] == fmtStr
|
||||
qtbot.wait(stepDelay)
|
||||
nwGUI.mainMenu.aFmtEmph.activate(QAction.Trigger)
|
||||
assert nwGUI.docEditor.getText()[27:74] == cleanText
|
||||
assert nwGUI.docEditor.getText()[39:86] == cleanText
|
||||
qtbot.wait(stepDelay)
|
||||
|
||||
# Strikethrough
|
||||
nwGUI.mainMenu.aFmtStrike.activate(QAction.Trigger)
|
||||
fmtStr = "~~Pellentesque~~ nec erat ut nulla posuere commodo."
|
||||
assert nwGUI.docEditor.getText()[27:78] == fmtStr
|
||||
assert nwGUI.docEditor.getText()[39:90] == fmtStr
|
||||
qtbot.wait(stepDelay)
|
||||
nwGUI.mainMenu.aFmtStrike.activate(QAction.Trigger)
|
||||
assert nwGUI.docEditor.getText()[27:74] == cleanText
|
||||
assert nwGUI.docEditor.getText()[39:86] == cleanText
|
||||
qtbot.wait(stepDelay)
|
||||
|
||||
# Should get us back to plain
|
||||
@@ -93,122 +93,122 @@ def testGuiMenu_EditFormat(qtbot, monkeypatch, nwGUI, nwLipsum):
|
||||
nwGUI.mainMenu.aFmtEmph.activate(QAction.Trigger)
|
||||
qtbot.wait(stepDelay)
|
||||
nwGUI.mainMenu.aFmtStrong.activate(QAction.Trigger)
|
||||
assert nwGUI.docEditor.getText()[27:74] == cleanText
|
||||
assert nwGUI.docEditor.getText()[39:86] == cleanText
|
||||
qtbot.wait(stepDelay)
|
||||
|
||||
# Double Quotes
|
||||
nwGUI.mainMenu.aFmtDQuote.activate(QAction.Trigger)
|
||||
fmtStr = "“Pellentesque” nec erat ut nulla posuere commodo."
|
||||
assert nwGUI.docEditor.getText()[27:76] == fmtStr
|
||||
assert nwGUI.docEditor.getText()[39:88] == fmtStr
|
||||
qtbot.wait(stepDelay)
|
||||
nwGUI.mainMenu.aEditUndo.activate(QAction.Trigger)
|
||||
assert nwGUI.docEditor.getText()[27:74] == cleanText
|
||||
assert nwGUI.docEditor.getText()[39:86] == cleanText
|
||||
qtbot.wait(stepDelay)
|
||||
|
||||
# Single Quotes
|
||||
nwGUI.mainMenu.aFmtSQuote.activate(QAction.Trigger)
|
||||
fmtStr = "‘Pellentesque’ nec erat ut nulla posuere commodo."
|
||||
assert nwGUI.docEditor.getText()[27:76] == fmtStr
|
||||
assert nwGUI.docEditor.getText()[39:88] == fmtStr
|
||||
qtbot.wait(stepDelay)
|
||||
nwGUI.mainMenu.aEditUndo.activate(QAction.Trigger)
|
||||
assert nwGUI.docEditor.getText()[27:74] == cleanText
|
||||
assert nwGUI.docEditor.getText()[39:86] == cleanText
|
||||
qtbot.wait(stepDelay)
|
||||
|
||||
# Block Formats
|
||||
# =============
|
||||
assert nwGUI.docEditor.setCursorPosition(30)
|
||||
assert nwGUI.docEditor.setCursorPosition(42)
|
||||
|
||||
# Header 1
|
||||
nwGUI.mainMenu.aFmtHead1.activate(QAction.Trigger)
|
||||
fmtStr = "# Pellentesque nec erat ut nulla posuere commodo."
|
||||
assert nwGUI.docEditor.getText()[27:76] == fmtStr
|
||||
assert nwGUI.docEditor.getText()[39:88] == fmtStr
|
||||
qtbot.wait(stepDelay)
|
||||
|
||||
# Header 2
|
||||
nwGUI.mainMenu.aFmtHead2.activate(QAction.Trigger)
|
||||
fmtStr = "## Pellentesque nec erat ut nulla posuere commodo."
|
||||
assert nwGUI.docEditor.getText()[27:77] == fmtStr
|
||||
assert nwGUI.docEditor.getText()[39:89] == fmtStr
|
||||
qtbot.wait(stepDelay)
|
||||
|
||||
# Header 3
|
||||
nwGUI.mainMenu.aFmtHead3.activate(QAction.Trigger)
|
||||
fmtStr = "### Pellentesque nec erat ut nulla posuere commodo."
|
||||
assert nwGUI.docEditor.getText()[27:78] == fmtStr
|
||||
assert nwGUI.docEditor.getText()[39:90] == fmtStr
|
||||
qtbot.wait(stepDelay)
|
||||
|
||||
# Header 4
|
||||
nwGUI.mainMenu.aFmtHead4.activate(QAction.Trigger)
|
||||
fmtStr = "#### Pellentesque nec erat ut nulla posuere commodo."
|
||||
assert nwGUI.docEditor.getText()[27:79] == fmtStr
|
||||
assert nwGUI.docEditor.getText()[39:91] == fmtStr
|
||||
qtbot.wait(stepDelay)
|
||||
|
||||
# Clear Format
|
||||
nwGUI.mainMenu.aFmtNoFormat.activate(QAction.Trigger)
|
||||
assert nwGUI.docEditor.getText()[27:74] == cleanText
|
||||
assert nwGUI.docEditor.getText()[39:86] == cleanText
|
||||
qtbot.wait(stepDelay)
|
||||
|
||||
# Comment On
|
||||
nwGUI.mainMenu.aFmtComment.activate(QAction.Trigger)
|
||||
fmtStr = "% Pellentesque nec erat ut nulla posuere commodo."
|
||||
assert nwGUI.docEditor.getText()[27:76] == fmtStr
|
||||
assert nwGUI.docEditor.getText()[39:88] == fmtStr
|
||||
qtbot.wait(stepDelay)
|
||||
|
||||
# Comment Off
|
||||
nwGUI.mainMenu.aFmtComment.activate(QAction.Trigger)
|
||||
assert nwGUI.docEditor.getText()[27:74] == cleanText
|
||||
assert nwGUI.docEditor.getText()[39:86] == cleanText
|
||||
qtbot.wait(stepDelay)
|
||||
|
||||
# Check comment with no space before text
|
||||
assert nwGUI.docEditor.setCursorPosition(27)
|
||||
assert nwGUI.docEditor.setCursorPosition(39)
|
||||
assert nwGUI.docEditor.insertText("%")
|
||||
fmtStr = "%Pellentesque nec erat ut nulla posuere commodo."
|
||||
assert nwGUI.docEditor.getText()[27:75] == fmtStr
|
||||
assert nwGUI.docEditor.getText()[39:87] == fmtStr
|
||||
qtbot.wait(stepDelay)
|
||||
|
||||
nwGUI.mainMenu.aFmtNoFormat.activate(QAction.Trigger)
|
||||
assert nwGUI.docEditor.getText()[27:74] == cleanText
|
||||
assert nwGUI.docEditor.getText()[39:86] == cleanText
|
||||
qtbot.wait(stepDelay)
|
||||
|
||||
# Undo/Redo
|
||||
nwGUI.mainMenu.aEditUndo.activate(QAction.Trigger)
|
||||
fmtStr = "%Pellentesque nec erat ut nulla posuere commodo."
|
||||
assert nwGUI.docEditor.getText()[27:75] == fmtStr
|
||||
assert nwGUI.docEditor.getText()[39:87] == fmtStr
|
||||
qtbot.wait(stepDelay)
|
||||
nwGUI.mainMenu.aEditRedo.activate(QAction.Trigger)
|
||||
assert nwGUI.docEditor.getText()[27:74] == cleanText
|
||||
assert nwGUI.docEditor.getText()[39:86] == cleanText
|
||||
qtbot.wait(stepDelay)
|
||||
|
||||
# Cut, Copy and Paste
|
||||
assert nwGUI.docEditor.setCursorPosition(27)
|
||||
assert nwGUI.docEditor.setCursorPosition(39)
|
||||
nwGUI.docEditor._makeSelection(QTextCursor.WordUnderCursor)
|
||||
|
||||
nwGUI.mainMenu.aEditCut.activate(QAction.Trigger)
|
||||
assert nwGUI.docEditor.getText()[27:77] == (
|
||||
assert nwGUI.docEditor.getText()[39:89] == (
|
||||
" nec erat ut nulla posuere commodo. Curabitur nisi"
|
||||
)
|
||||
|
||||
nwGUI.mainMenu.aEditPaste.activate(QAction.Trigger)
|
||||
assert nwGUI.docEditor.getText()[27:77] == (
|
||||
assert nwGUI.docEditor.getText()[39:89] == (
|
||||
"Pellentesque nec erat ut nulla posuere commodo. Cu"
|
||||
)
|
||||
|
||||
assert nwGUI.docEditor.setCursorPosition(27)
|
||||
assert nwGUI.docEditor.setCursorPosition(39)
|
||||
nwGUI.docEditor._makeSelection(QTextCursor.WordUnderCursor)
|
||||
|
||||
nwGUI.mainMenu.aEditCopy.activate(QAction.Trigger)
|
||||
assert nwGUI.docEditor.getText()[27:77] == (
|
||||
assert nwGUI.docEditor.getText()[39:89] == (
|
||||
"Pellentesque nec erat ut nulla posuere commodo. Cu"
|
||||
)
|
||||
|
||||
assert nwGUI.docEditor.setCursorPosition(27)
|
||||
assert nwGUI.docEditor.setCursorPosition(39)
|
||||
nwGUI.mainMenu.aEditPaste.activate(QAction.Trigger)
|
||||
assert nwGUI.docEditor.getText()[27:77] == (
|
||||
assert nwGUI.docEditor.getText()[39:89] == (
|
||||
"PellentesquePellentesque nec erat ut nulla posuere"
|
||||
)
|
||||
nwGUI.mainMenu.aEditUndo.activate(QAction.Trigger)
|
||||
|
||||
# Select Paragraph/All
|
||||
assert nwGUI.docEditor.setCursorPosition(30)
|
||||
assert nwGUI.docEditor.setCursorPosition(42)
|
||||
nwGUI.mainMenu.aSelectPar.activate(QAction.Trigger)
|
||||
theCursor = nwGUI.docEditor.textCursor()
|
||||
assert theCursor.selectedText() == (
|
||||
@@ -221,10 +221,10 @@ def testGuiMenu_EditFormat(qtbot, monkeypatch, nwGUI, nwLipsum):
|
||||
"nunc lacus, imperdiet nec posuere ac, interdum non lectus."
|
||||
)
|
||||
|
||||
assert nwGUI.docEditor.setCursorPosition(30)
|
||||
assert nwGUI.docEditor.setCursorPosition(42)
|
||||
nwGUI.mainMenu.aSelectAll.activate(QAction.Trigger)
|
||||
theCursor = nwGUI.docEditor.textCursor()
|
||||
assert len(theCursor.selectedText()) == 1883
|
||||
assert len(theCursor.selectedText()) == 1895
|
||||
|
||||
# Clear the Text
|
||||
nwGUI.docEditor.clear()
|
||||
@@ -388,7 +388,7 @@ def testGuiMenu_ContextMenus(qtbot, monkeypatch, nwGUI, nwLipsum):
|
||||
|
||||
# Editor Context Menu
|
||||
theCursor = nwGUI.docEditor.textCursor()
|
||||
theCursor.setPosition(100)
|
||||
theCursor.setPosition(112)
|
||||
nwGUI.docEditor.setTextCursor(theCursor)
|
||||
theRect = nwGUI.docEditor.cursorRect()
|
||||
|
||||
@@ -415,7 +415,7 @@ def testGuiMenu_ContextMenus(qtbot, monkeypatch, nwGUI, nwLipsum):
|
||||
assert nwGUI.viewDocument("4c4f28287af27")
|
||||
|
||||
theCursor = nwGUI.docViewer.textCursor()
|
||||
theCursor.setPosition(100)
|
||||
theCursor.setPosition(112)
|
||||
nwGUI.docViewer.setTextCursor(theCursor)
|
||||
theRect = nwGUI.docViewer.cursorRect()
|
||||
|
||||
|
||||
Reference in New Issue
Block a user