Fix warnings in tests
This commit is contained in:
@@ -398,7 +398,7 @@ def testCoreBuildSettings_Collection(monkeypatch, mockGUI, fncPath: Path, mockRn
|
|||||||
buildTwo.setName("Build Two")
|
buildTwo.setName("Build Two")
|
||||||
buildIDTwo = buildTwo.buildID
|
buildIDTwo = buildTwo.buildID
|
||||||
|
|
||||||
# Check that we can extract infor about the builds
|
# Check that we can extract info about the builds
|
||||||
builds.setBuild(buildTwo)
|
builds.setBuild(buildTwo)
|
||||||
assert len(builds) == 2
|
assert len(builds) == 2
|
||||||
assert buildsFile.exists()
|
assert buildsFile.exists()
|
||||||
|
|||||||
@@ -41,7 +41,9 @@ def testDlgAbout_NWDialog(qtbot, monkeypatch, nwGUI):
|
|||||||
msgAbout = SHARED.findTopLevelWidget(GuiAbout)
|
msgAbout = SHARED.findTopLevelWidget(GuiAbout)
|
||||||
assert isinstance(msgAbout, GuiAbout)
|
assert isinstance(msgAbout, GuiAbout)
|
||||||
|
|
||||||
assert msgAbout.txtCredits.document().characterCount() > 100
|
document = msgAbout.txtCredits.document()
|
||||||
|
assert document is not None
|
||||||
|
assert document.characterCount() > 100
|
||||||
|
|
||||||
with monkeypatch.context() as mp:
|
with monkeypatch.context() as mp:
|
||||||
mp.setattr("novelwriter.config.Config.assetPath", lambda *a: Path("whatever"))
|
mp.setattr("novelwriter.config.Config.assetPath", lambda *a: Path("whatever"))
|
||||||
|
|||||||
@@ -96,6 +96,7 @@ def testDlgPreferences_Actions(qtbot, monkeypatch, nwGUI):
|
|||||||
|
|
||||||
# Check Navigation
|
# Check Navigation
|
||||||
vBar = prefs.mainForm.verticalScrollBar()
|
vBar = prefs.mainForm.verticalScrollBar()
|
||||||
|
assert vBar is not None
|
||||||
old = -1
|
old = -1
|
||||||
with qtbot.waitSignal(vBar.valueChanged) as value:
|
with qtbot.waitSignal(vBar.valueChanged) as value:
|
||||||
prefs.sidebar.button(1).click()
|
prefs.sidebar.button(1).click()
|
||||||
@@ -119,12 +120,16 @@ def testDlgPreferences_Actions(qtbot, monkeypatch, nwGUI):
|
|||||||
# Check Save Button
|
# Check Save Button
|
||||||
prefs.show()
|
prefs.show()
|
||||||
with qtbot.waitSignal(prefs.newPreferencesReady) as signal:
|
with qtbot.waitSignal(prefs.newPreferencesReady) as signal:
|
||||||
prefs.buttonBox.button(QtDialogSave).click()
|
button = prefs.buttonBox.button(QtDialogSave)
|
||||||
|
assert button is not None
|
||||||
|
button.click()
|
||||||
assert signal.args == [False, False, False, False]
|
assert signal.args == [False, False, False, False]
|
||||||
|
|
||||||
# Check Close Button
|
# Check Close Button
|
||||||
prefs.show()
|
prefs.show()
|
||||||
prefs.buttonBox.button(QtDialogCancel).click()
|
button = prefs.buttonBox.button(QtDialogCancel)
|
||||||
|
assert button is not None
|
||||||
|
button.click()
|
||||||
assert prefs.isHidden() is True
|
assert prefs.isHidden() is True
|
||||||
|
|
||||||
# Close Using Escape Key
|
# Close Using Escape Key
|
||||||
@@ -313,7 +318,9 @@ def testDlgPreferences_Settings(qtbot, monkeypatch, nwGUI, fncPath, tstPaths):
|
|||||||
with monkeypatch.context() as mp:
|
with monkeypatch.context() as mp:
|
||||||
mp.setattr(QFontDatabase, "families", lambda *a: ["TestFont"])
|
mp.setattr(QFontDatabase, "families", lambda *a: ["TestFont"])
|
||||||
with qtbot.waitSignal(prefs.newPreferencesReady) as signal:
|
with qtbot.waitSignal(prefs.newPreferencesReady) as signal:
|
||||||
prefs.buttonBox.button(QtDialogSave).click()
|
button = prefs.buttonBox.button(QtDialogSave)
|
||||||
|
assert button is not None
|
||||||
|
button.click()
|
||||||
assert signal.args == [True, True, True, True]
|
assert signal.args == [True, True, True, True]
|
||||||
|
|
||||||
# Check Settings
|
# Check Settings
|
||||||
|
|||||||
@@ -441,6 +441,9 @@ def testGuiEditor_ContextMenu(monkeypatch, qtbot, nwGUI, projPath, mockRnd):
|
|||||||
ctxMenu.deleteLater()
|
ctxMenu.deleteLater()
|
||||||
|
|
||||||
# Copy Text
|
# Copy Text
|
||||||
|
clipboard = QApplication.clipboard()
|
||||||
|
assert clipboard is not None
|
||||||
|
|
||||||
ctxMenu = getMenuForPos(docEditor, 31, True)
|
ctxMenu = getMenuForPos(docEditor, 31, True)
|
||||||
assert ctxMenu is not None
|
assert ctxMenu is not None
|
||||||
assert docEditor.textCursor().selectedText() == "text"
|
assert docEditor.textCursor().selectedText() == "text"
|
||||||
@@ -448,14 +451,14 @@ def testGuiEditor_ContextMenu(monkeypatch, qtbot, nwGUI, projPath, mockRnd):
|
|||||||
assert actions == [
|
assert actions == [
|
||||||
"Cut", "Copy", "Paste", "Select All", "Select Word", "Select Paragraph"
|
"Cut", "Copy", "Paste", "Select All", "Select Word", "Select Paragraph"
|
||||||
]
|
]
|
||||||
QApplication.clipboard().clear()
|
clipboard.clear()
|
||||||
ctxMenu.actions()[1].trigger()
|
ctxMenu.actions()[1].trigger()
|
||||||
assert QApplication.clipboard().text(QClipboard.Mode.Clipboard) == "text"
|
assert clipboard.text(QClipboard.Mode.Clipboard) == "text"
|
||||||
|
|
||||||
# Cut Text
|
# Cut Text
|
||||||
QApplication.clipboard().clear()
|
clipboard.clear()
|
||||||
ctxMenu.actions()[0].trigger()
|
ctxMenu.actions()[0].trigger()
|
||||||
assert QApplication.clipboard().text(QClipboard.Mode.Clipboard) == "text"
|
assert clipboard.text(QClipboard.Mode.Clipboard) == "text"
|
||||||
assert "text" not in docEditor.getText()
|
assert "text" not in docEditor.getText()
|
||||||
|
|
||||||
# Paste Text
|
# Paste Text
|
||||||
@@ -572,7 +575,9 @@ def testGuiEditor_Actions(qtbot, nwGUI, projPath, ipsumText, mockRnd):
|
|||||||
# Select/Cut/Copy/Paste/Undo/Redo
|
# Select/Cut/Copy/Paste/Undo/Redo
|
||||||
# ===============================
|
# ===============================
|
||||||
|
|
||||||
QApplication.clipboard().clear()
|
clipboard = QApplication.clipboard()
|
||||||
|
assert clipboard is not None
|
||||||
|
clipboard.clear()
|
||||||
|
|
||||||
# Select All
|
# Select All
|
||||||
assert docEditor.docAction(nwDocAction.SEL_ALL) is True
|
assert docEditor.docAction(nwDocAction.SEL_ALL) is True
|
||||||
@@ -624,7 +629,7 @@ def testGuiEditor_Actions(qtbot, nwGUI, projPath, ipsumText, mockRnd):
|
|||||||
assert newPara[5] == ipsumText[4]
|
assert newPara[5] == ipsumText[4]
|
||||||
assert newPara[6] == ipsumText[2]
|
assert newPara[6] == ipsumText[2]
|
||||||
|
|
||||||
QApplication.clipboard().clear()
|
clipboard.clear()
|
||||||
|
|
||||||
# Emphasis/Undo/Redo
|
# Emphasis/Undo/Redo
|
||||||
# ==================
|
# ==================
|
||||||
|
|||||||
@@ -91,18 +91,19 @@ def testGuiViewer_Main(qtbot, monkeypatch, nwGUI, prjLipsum):
|
|||||||
docViewer.setTextCursor(cursor)
|
docViewer.setTextCursor(cursor)
|
||||||
docViewer._makeSelection(QTextCursor.SelectionType.WordUnderCursor)
|
docViewer._makeSelection(QTextCursor.SelectionType.WordUnderCursor)
|
||||||
|
|
||||||
qClip = QApplication.clipboard()
|
clipboard = QApplication.clipboard()
|
||||||
qClip.clear()
|
assert clipboard is not None
|
||||||
|
clipboard.clear()
|
||||||
|
|
||||||
# Cut
|
# Cut
|
||||||
assert docViewer.docAction(nwDocAction.CUT) is True
|
assert docViewer.docAction(nwDocAction.CUT) is True
|
||||||
assert qClip.text() == "laoreet"
|
assert clipboard.text() == "laoreet"
|
||||||
qClip.clear()
|
clipboard.clear()
|
||||||
|
|
||||||
# Copy
|
# Copy
|
||||||
assert docViewer.docAction(nwDocAction.COPY) is True
|
assert docViewer.docAction(nwDocAction.COPY) is True
|
||||||
assert qClip.text() == "laoreet"
|
assert clipboard.text() == "laoreet"
|
||||||
qClip.clear()
|
clipboard.clear()
|
||||||
|
|
||||||
# Select Paragraph
|
# Select Paragraph
|
||||||
assert docViewer.docAction(nwDocAction.SEL_PARA) is True
|
assert docViewer.docAction(nwDocAction.SEL_PARA) is True
|
||||||
|
|||||||
@@ -1148,7 +1148,9 @@ def testGuiProjTree_ContextMenu(qtbot, monkeypatch, nwGUI, projPath, mockRnd):
|
|||||||
def getTransformSubMenu(menu: QMenu) -> list[str]:
|
def getTransformSubMenu(menu: QMenu) -> list[str]:
|
||||||
for action in menu.actions():
|
for action in menu.actions():
|
||||||
if action.text() == "Transform ...":
|
if action.text() == "Transform ...":
|
||||||
return [x.text() for x in action.menu().actions() if x.text()]
|
submenu = action.menu()
|
||||||
|
assert submenu is not None
|
||||||
|
return [x.text() for x in submenu.actions() if x.text()]
|
||||||
return []
|
return []
|
||||||
|
|
||||||
# Context Menu on Document File Item
|
# Context Menu on Document File Item
|
||||||
|
|||||||
@@ -95,7 +95,9 @@ def testToolManuscriptBuild_Main(
|
|||||||
assert (fncPath / "TestBuild").with_suffix(nwLabels.BUILD_EXT[fmt]).exists()
|
assert (fncPath / "TestBuild").with_suffix(nwLabels.BUILD_EXT[fmt]).exists()
|
||||||
lastFmt = fmt
|
lastFmt = fmt
|
||||||
|
|
||||||
manus._dialogButtonClicked(manus.buttonBox.button(QtDialogClose))
|
button = manus.buttonBox.button(QtDialogClose)
|
||||||
|
assert button is not None
|
||||||
|
manus._dialogButtonClicked(button)
|
||||||
manus.deleteLater()
|
manus.deleteLater()
|
||||||
|
|
||||||
assert build.lastBuildName == "TestBuild"
|
assert build.lastBuildName == "TestBuild"
|
||||||
@@ -150,5 +152,7 @@ def testToolManuscriptBuild_Main(
|
|||||||
assert lastUrl.startswith("file://")
|
assert lastUrl.startswith("file://")
|
||||||
|
|
||||||
# Finish
|
# Finish
|
||||||
manus._dialogButtonClicked(manus.buttonBox.button(QtDialogClose))
|
button = manus.buttonBox.button(QtDialogClose)
|
||||||
|
assert button is not None
|
||||||
|
manus._dialogButtonClicked(button)
|
||||||
# qtbot.stop()
|
# qtbot.stop()
|
||||||
|
|||||||
@@ -67,7 +67,9 @@ def testToolManuscript_Init(monkeypatch, qtbot, nwGUI, projPath, mockRnd):
|
|||||||
# Build a preview
|
# Build a preview
|
||||||
manus.buildList.clearSelection()
|
manus.buildList.clearSelection()
|
||||||
manus.buildList.setCurrentRow(0)
|
manus.buildList.setCurrentRow(0)
|
||||||
with qtbot.waitSignal(manus.docPreview.document().contentsChanged):
|
document = manus.docPreview.document()
|
||||||
|
assert document is not None
|
||||||
|
with qtbot.waitSignal(document.contentsChanged):
|
||||||
manus.btnPreview.click()
|
manus.btnPreview.click()
|
||||||
assert manus.docPreview.toPlainText().strip() == allText
|
assert manus.docPreview.toPlainText().strip() == allText
|
||||||
|
|
||||||
@@ -113,7 +115,9 @@ def testToolManuscript_Builds(qtbot, nwGUI, projPath):
|
|||||||
|
|
||||||
with qtbot.waitSignal(bSettings.newSettingsReady, timeout=5000):
|
with qtbot.waitSignal(bSettings.newSettingsReady, timeout=5000):
|
||||||
bSettings.newSettingsReady.connect(_testNewSettingsReady)
|
bSettings.newSettingsReady.connect(_testNewSettingsReady)
|
||||||
bSettings.buttonBox.button(QtDialogSave).click()
|
button = bSettings.buttonBox.button(QtDialogSave)
|
||||||
|
assert button is not None
|
||||||
|
button.click()
|
||||||
|
|
||||||
assert isinstance(build, BuildSettings)
|
assert isinstance(build, BuildSettings)
|
||||||
assert build.name == "Test Build"
|
assert build.name == "Test Build"
|
||||||
@@ -132,7 +136,9 @@ def testToolManuscript_Builds(qtbot, nwGUI, projPath):
|
|||||||
|
|
||||||
with qtbot.waitSignal(bSettings.newSettingsReady, timeout=5000):
|
with qtbot.waitSignal(bSettings.newSettingsReady, timeout=5000):
|
||||||
bSettings.newSettingsReady.connect(_testNewSettingsReady)
|
bSettings.newSettingsReady.connect(_testNewSettingsReady)
|
||||||
bSettings.buttonBox.button(QtDialogApply).click() # Should leave the dialog open
|
button = bSettings.buttonBox.button(QtDialogApply)
|
||||||
|
assert button is not None
|
||||||
|
button.click() # Should leave the dialog open
|
||||||
|
|
||||||
assert isinstance(build, BuildSettings)
|
assert isinstance(build, BuildSettings)
|
||||||
assert build.name == "Test Build"
|
assert build.name == "Test Build"
|
||||||
@@ -210,7 +216,9 @@ def testToolManuscript_Features(monkeypatch, qtbot, nwGUI, projPath, mockRnd):
|
|||||||
manus._builds.setBuild(build)
|
manus._builds.setBuild(build)
|
||||||
|
|
||||||
manus.buildList.setCurrentRow(0)
|
manus.buildList.setCurrentRow(0)
|
||||||
with qtbot.waitSignal(manus.docPreview.document().contentsChanged):
|
document = manus.docPreview.document()
|
||||||
|
assert document is not None
|
||||||
|
with qtbot.waitSignal(document.contentsChanged):
|
||||||
manus.btnPreview.click()
|
manus.btnPreview.click()
|
||||||
assert manus.docPreview.toPlainText().strip() != ""
|
assert manus.docPreview.toPlainText().strip() != ""
|
||||||
|
|
||||||
@@ -304,7 +312,9 @@ def testToolManuscript_Print(monkeypatch, qtbot, nwGUI, projPath):
|
|||||||
manus.loadContent()
|
manus.loadContent()
|
||||||
|
|
||||||
manus.buildList.setCurrentRow(0)
|
manus.buildList.setCurrentRow(0)
|
||||||
with qtbot.waitSignal(manus.docPreview.document().contentsChanged):
|
document = manus.docPreview.document()
|
||||||
|
assert document is not None
|
||||||
|
with qtbot.waitSignal(document.contentsChanged):
|
||||||
manus.btnPreview.click()
|
manus.btnPreview.click()
|
||||||
assert manus.docPreview.toPlainText().strip() != ""
|
assert manus.docPreview.toPlainText().strip() != ""
|
||||||
|
|
||||||
|
|||||||
@@ -51,13 +51,19 @@ def testToolBuildSettings_Init(qtbot, nwGUI, projPath, mockRnd):
|
|||||||
bSettings.loadContent()
|
bSettings.loadContent()
|
||||||
|
|
||||||
# Flip through pages
|
# Flip through pages
|
||||||
bSettings.sidebar._group.button(bSettings.OPT_FORMATTING + 1).click()
|
button = bSettings.sidebar._group.button(bSettings.OPT_FORMATTING + 1)
|
||||||
|
assert button is not None
|
||||||
|
button.click()
|
||||||
assert isinstance(bSettings.toolStack.currentWidget(), _FormattingTab)
|
assert isinstance(bSettings.toolStack.currentWidget(), _FormattingTab)
|
||||||
|
|
||||||
bSettings.sidebar._group.button(bSettings.OPT_HEADINGS).click()
|
button = bSettings.sidebar._group.button(bSettings.OPT_HEADINGS)
|
||||||
|
assert button is not None
|
||||||
|
button.click()
|
||||||
assert isinstance(bSettings.toolStack.currentWidget(), _HeadingsTab)
|
assert isinstance(bSettings.toolStack.currentWidget(), _HeadingsTab)
|
||||||
|
|
||||||
bSettings.sidebar._group.button(bSettings.OPT_FILTERS).click()
|
button = bSettings.sidebar._group.button(bSettings.OPT_FILTERS)
|
||||||
|
assert button is not None
|
||||||
|
button.click()
|
||||||
assert isinstance(bSettings.toolStack.currentWidget(), _FilterTab)
|
assert isinstance(bSettings.toolStack.currentWidget(), _FilterTab)
|
||||||
|
|
||||||
# Check dialog buttons
|
# Check dialog buttons
|
||||||
@@ -72,7 +78,9 @@ def testToolBuildSettings_Init(qtbot, nwGUI, projPath, mockRnd):
|
|||||||
# Capture Apply button
|
# Capture Apply button
|
||||||
with qtbot.waitSignal(bSettings.newSettingsReady, timeout=5000):
|
with qtbot.waitSignal(bSettings.newSettingsReady, timeout=5000):
|
||||||
bSettings.newSettingsReady.connect(_testNewSettingsReady)
|
bSettings.newSettingsReady.connect(_testNewSettingsReady)
|
||||||
bSettings._dialogButtonClicked(bSettings.buttonBox.button(QtDialogApply))
|
button = bSettings.buttonBox.button(QtDialogApply)
|
||||||
|
assert button is not None
|
||||||
|
bSettings._dialogButtonClicked(button)
|
||||||
|
|
||||||
assert triggered
|
assert triggered
|
||||||
|
|
||||||
@@ -81,7 +89,9 @@ def testToolBuildSettings_Init(qtbot, nwGUI, projPath, mockRnd):
|
|||||||
|
|
||||||
with qtbot.waitSignal(bSettings.newSettingsReady, timeout=5000):
|
with qtbot.waitSignal(bSettings.newSettingsReady, timeout=5000):
|
||||||
bSettings.newSettingsReady.connect(_testNewSettingsReady)
|
bSettings.newSettingsReady.connect(_testNewSettingsReady)
|
||||||
bSettings._dialogButtonClicked(bSettings.buttonBox.button(QtDialogSave))
|
button = bSettings.buttonBox.button(QtDialogSave)
|
||||||
|
assert button is not None
|
||||||
|
bSettings._dialogButtonClicked(button)
|
||||||
|
|
||||||
assert triggered
|
assert triggered
|
||||||
|
|
||||||
@@ -98,7 +108,9 @@ def testToolBuildSettings_Init(qtbot, nwGUI, projPath, mockRnd):
|
|||||||
assert triggered
|
assert triggered
|
||||||
|
|
||||||
# Finish
|
# Finish
|
||||||
bSettings._dialogButtonClicked(bSettings.buttonBox.button(QtDialogClose))
|
button = bSettings.buttonBox.button(QtDialogClose)
|
||||||
|
assert button is not None
|
||||||
|
bSettings._dialogButtonClicked(button)
|
||||||
# qtbot.stop()
|
# qtbot.stop()
|
||||||
|
|
||||||
|
|
||||||
@@ -129,7 +141,9 @@ def testToolBuildSettings_Filter(qtbot, nwGUI, projPath, mockRnd):
|
|||||||
bSettings.loadContent()
|
bSettings.loadContent()
|
||||||
|
|
||||||
filterTab = bSettings.optTabSelect
|
filterTab = bSettings.optTabSelect
|
||||||
bSettings.sidebar._group.button(bSettings.OPT_FILTERS).click()
|
button = bSettings.sidebar._group.button(bSettings.OPT_FILTERS)
|
||||||
|
assert button is not None
|
||||||
|
button.click()
|
||||||
assert bSettings.toolStack.currentWidget() is filterTab
|
assert bSettings.toolStack.currentWidget() is filterTab
|
||||||
|
|
||||||
# Check content
|
# Check content
|
||||||
@@ -308,7 +322,9 @@ def testToolBuildSettings_Filter(qtbot, nwGUI, projPath, mockRnd):
|
|||||||
]
|
]
|
||||||
|
|
||||||
# Finish
|
# Finish
|
||||||
bSettings._dialogButtonClicked(bSettings.buttonBox.button(QtDialogClose))
|
button = bSettings.buttonBox.button(QtDialogClose)
|
||||||
|
assert button is not None
|
||||||
|
bSettings._dialogButtonClicked(button)
|
||||||
# qtbot.stop()
|
# qtbot.stop()
|
||||||
|
|
||||||
|
|
||||||
@@ -339,7 +355,9 @@ def testToolBuildSettings_Headings(qtbot, nwGUI):
|
|||||||
bSettings.loadContent()
|
bSettings.loadContent()
|
||||||
|
|
||||||
headTab = bSettings.optTabHeadings
|
headTab = bSettings.optTabHeadings
|
||||||
bSettings.sidebar._group.button(bSettings.OPT_HEADINGS).click()
|
button = bSettings.sidebar._group.button(bSettings.OPT_HEADINGS)
|
||||||
|
assert button is not None
|
||||||
|
button.click()
|
||||||
assert bSettings.toolStack.currentWidget() is headTab
|
assert bSettings.toolStack.currentWidget() is headTab
|
||||||
|
|
||||||
# Check initial values
|
# Check initial values
|
||||||
@@ -478,7 +496,9 @@ def testToolBuildSettings_Headings(qtbot, nwGUI):
|
|||||||
assert build.getBool("headings.hideSection") is True
|
assert build.getBool("headings.hideSection") is True
|
||||||
|
|
||||||
# Finish
|
# Finish
|
||||||
bSettings._dialogButtonClicked(bSettings.buttonBox.button(QtDialogClose))
|
button = bSettings.buttonBox.button(QtDialogClose)
|
||||||
|
assert button is not None
|
||||||
|
bSettings._dialogButtonClicked(button)
|
||||||
# qtbot.stop()
|
# qtbot.stop()
|
||||||
|
|
||||||
|
|
||||||
@@ -501,7 +521,9 @@ def testToolBuildSettings_FormatTextContent(qtbot, nwGUI):
|
|||||||
bSettings.loadContent()
|
bSettings.loadContent()
|
||||||
|
|
||||||
fmtTab = bSettings.optTabFormatting
|
fmtTab = bSettings.optTabFormatting
|
||||||
bSettings.sidebar._group.button(bSettings.OPT_FORMATTING + 1).click()
|
button = bSettings.sidebar._group.button(bSettings.OPT_FORMATTING + 1)
|
||||||
|
assert button is not None
|
||||||
|
button.click()
|
||||||
assert bSettings.toolStack.currentWidget() is fmtTab
|
assert bSettings.toolStack.currentWidget() is fmtTab
|
||||||
|
|
||||||
# Check initial values
|
# Check initial values
|
||||||
@@ -538,7 +560,9 @@ def testToolBuildSettings_FormatTextContent(qtbot, nwGUI):
|
|||||||
assert build.getBool("text.addNoteHeadings") is True
|
assert build.getBool("text.addNoteHeadings") is True
|
||||||
|
|
||||||
# Finish
|
# Finish
|
||||||
bSettings._dialogButtonClicked(bSettings.buttonBox.button(QtDialogClose))
|
button = bSettings.buttonBox.button(QtDialogClose)
|
||||||
|
assert button is not None
|
||||||
|
bSettings._dialogButtonClicked(button)
|
||||||
# qtbot.stop()
|
# qtbot.stop()
|
||||||
|
|
||||||
|
|
||||||
@@ -563,7 +587,9 @@ def testToolBuildSettings_FormatTextFormat(monkeypatch, qtbot, nwGUI):
|
|||||||
bSettings.loadContent()
|
bSettings.loadContent()
|
||||||
|
|
||||||
fmtTab = bSettings.optTabFormatting
|
fmtTab = bSettings.optTabFormatting
|
||||||
bSettings.sidebar._group.button(bSettings.OPT_FORMATTING + 2).click()
|
button = bSettings.sidebar._group.button(bSettings.OPT_FORMATTING + 2)
|
||||||
|
assert button is not None
|
||||||
|
button.click()
|
||||||
assert bSettings.toolStack.currentWidget() is fmtTab
|
assert bSettings.toolStack.currentWidget() is fmtTab
|
||||||
|
|
||||||
# Check initial values
|
# Check initial values
|
||||||
@@ -610,7 +636,9 @@ def testToolBuildSettings_FormatTextFormat(monkeypatch, qtbot, nwGUI):
|
|||||||
assert fmtTab._textFont == font
|
assert fmtTab._textFont == font
|
||||||
|
|
||||||
# Finish
|
# Finish
|
||||||
bSettings._dialogButtonClicked(bSettings.buttonBox.button(QtDialogClose))
|
button = bSettings.buttonBox.button(QtDialogClose)
|
||||||
|
assert button is not None
|
||||||
|
bSettings._dialogButtonClicked(button)
|
||||||
# qtbot.stop()
|
# qtbot.stop()
|
||||||
|
|
||||||
|
|
||||||
@@ -629,7 +657,9 @@ def testToolBuildSettings_FormatFirstLineIndent(monkeypatch, qtbot, nwGUI):
|
|||||||
bSettings.loadContent()
|
bSettings.loadContent()
|
||||||
|
|
||||||
fmtTab = bSettings.optTabFormatting
|
fmtTab = bSettings.optTabFormatting
|
||||||
bSettings.sidebar._group.button(bSettings.OPT_FORMATTING + 3).click()
|
button = bSettings.sidebar._group.button(bSettings.OPT_FORMATTING + 3)
|
||||||
|
assert button is not None
|
||||||
|
button.click()
|
||||||
assert bSettings.toolStack.currentWidget() is fmtTab
|
assert bSettings.toolStack.currentWidget() is fmtTab
|
||||||
|
|
||||||
# Check initial values
|
# Check initial values
|
||||||
@@ -650,7 +680,9 @@ def testToolBuildSettings_FormatFirstLineIndent(monkeypatch, qtbot, nwGUI):
|
|||||||
assert build.getBool("format.indentFirstPar") is True
|
assert build.getBool("format.indentFirstPar") is True
|
||||||
|
|
||||||
# Finish
|
# Finish
|
||||||
bSettings._dialogButtonClicked(bSettings.buttonBox.button(QtDialogClose))
|
button = bSettings.buttonBox.button(QtDialogClose)
|
||||||
|
assert button is not None
|
||||||
|
bSettings._dialogButtonClicked(button)
|
||||||
# qtbot.stop()
|
# qtbot.stop()
|
||||||
|
|
||||||
|
|
||||||
@@ -674,7 +706,9 @@ def testToolBuildSettings_FormatPageLayout(monkeypatch, qtbot, nwGUI):
|
|||||||
bSettings.loadContent()
|
bSettings.loadContent()
|
||||||
|
|
||||||
fmtTab = bSettings.optTabFormatting
|
fmtTab = bSettings.optTabFormatting
|
||||||
bSettings.sidebar._group.button(bSettings.OPT_FORMATTING + 4).click()
|
button = bSettings.sidebar._group.button(bSettings.OPT_FORMATTING + 4)
|
||||||
|
assert button is not None
|
||||||
|
button.click()
|
||||||
assert bSettings.toolStack.currentWidget() is fmtTab
|
assert bSettings.toolStack.currentWidget() is fmtTab
|
||||||
|
|
||||||
# Check initial values
|
# Check initial values
|
||||||
@@ -704,7 +738,9 @@ def testToolBuildSettings_FormatPageLayout(monkeypatch, qtbot, nwGUI):
|
|||||||
assert fmtTab.rightMargin.value() == 1.5
|
assert fmtTab.rightMargin.value() == 1.5
|
||||||
|
|
||||||
# Finish
|
# Finish
|
||||||
bSettings._dialogButtonClicked(bSettings.buttonBox.button(QtDialogClose))
|
button = bSettings.buttonBox.button(QtDialogClose)
|
||||||
|
assert button is not None
|
||||||
|
bSettings._dialogButtonClicked(button)
|
||||||
# qtbot.stop()
|
# qtbot.stop()
|
||||||
|
|
||||||
|
|
||||||
@@ -728,7 +764,9 @@ def testToolBuildSettings_FormatOutput(qtbot, nwGUI):
|
|||||||
bSettings.loadContent()
|
bSettings.loadContent()
|
||||||
|
|
||||||
fmtTab = bSettings.optTabFormatting
|
fmtTab = bSettings.optTabFormatting
|
||||||
bSettings.sidebar._group.button(bSettings.OPT_FORMATTING + 5).click()
|
button = bSettings.sidebar._group.button(bSettings.OPT_FORMATTING + 5)
|
||||||
|
assert button is not None
|
||||||
|
button.click()
|
||||||
assert bSettings.toolStack.currentWidget() is fmtTab
|
assert bSettings.toolStack.currentWidget() is fmtTab
|
||||||
|
|
||||||
# Check initial values
|
# Check initial values
|
||||||
@@ -769,5 +807,7 @@ def testToolBuildSettings_FormatOutput(qtbot, nwGUI):
|
|||||||
assert fmtTab.odtPageHeader.text() == nwHeadFmt.DOC_AUTO
|
assert fmtTab.odtPageHeader.text() == nwHeadFmt.DOC_AUTO
|
||||||
|
|
||||||
# Finish
|
# Finish
|
||||||
bSettings._dialogButtonClicked(bSettings.buttonBox.button(QtDialogClose))
|
button = bSettings.buttonBox.button(QtDialogClose)
|
||||||
|
assert button is not None
|
||||||
|
bSettings._dialogButtonClicked(button)
|
||||||
# qtbot.stop()
|
# qtbot.stop()
|
||||||
|
|||||||
@@ -125,14 +125,37 @@ def testToolWritingStats_Export(qtbot, monkeypatch, nwGUI, projPath, tstPaths):
|
|||||||
assert sessLog.notesWords.text() == "{:n}".format(275)
|
assert sessLog.notesWords.text() == "{:n}".format(275)
|
||||||
assert sessLog.totalWords.text() == "{:n}".format(875)
|
assert sessLog.totalWords.text() == "{:n}".format(875)
|
||||||
|
|
||||||
assert sessLog.listBox.topLevelItem(0).text(sessLog.C_COUNT) == "{:n}".format(1)
|
item = sessLog.listBox.topLevelItem(0)
|
||||||
assert sessLog.listBox.topLevelItem(1).text(sessLog.C_COUNT) == "{:n}".format(-200)
|
assert item is not None
|
||||||
assert sessLog.listBox.topLevelItem(2).text(sessLog.C_COUNT) == "{:n}".format(300)
|
assert item.text(sessLog.C_COUNT) == "{:n}".format(1)
|
||||||
assert sessLog.listBox.topLevelItem(3).text(sessLog.C_COUNT) == "{:n}".format(-120)
|
|
||||||
assert sessLog.listBox.topLevelItem(4).text(sessLog.C_COUNT) == "{:n}".format(-20)
|
item = sessLog.listBox.topLevelItem(1)
|
||||||
assert sessLog.listBox.topLevelItem(5).text(sessLog.C_COUNT) == "{:n}".format(40)
|
assert item is not None
|
||||||
assert sessLog.listBox.topLevelItem(6).text(sessLog.C_COUNT) == "{:n}".format(-400)
|
assert item.text(sessLog.C_COUNT) == "{:n}".format(-200)
|
||||||
assert sessLog.listBox.topLevelItem(7).text(sessLog.C_COUNT) == "{:n}".format(200)
|
|
||||||
|
item = sessLog.listBox.topLevelItem(2)
|
||||||
|
assert item is not None
|
||||||
|
assert item.text(sessLog.C_COUNT) == "{:n}".format(300)
|
||||||
|
|
||||||
|
item = sessLog.listBox.topLevelItem(3)
|
||||||
|
assert item is not None
|
||||||
|
assert item.text(sessLog.C_COUNT) == "{:n}".format(-120)
|
||||||
|
|
||||||
|
item = sessLog.listBox.topLevelItem(4)
|
||||||
|
assert item is not None
|
||||||
|
assert item.text(sessLog.C_COUNT) == "{:n}".format(-20)
|
||||||
|
|
||||||
|
item = sessLog.listBox.topLevelItem(5)
|
||||||
|
assert item is not None
|
||||||
|
assert item.text(sessLog.C_COUNT) == "{:n}".format(40)
|
||||||
|
|
||||||
|
item = sessLog.listBox.topLevelItem(6)
|
||||||
|
assert item is not None
|
||||||
|
assert item.text(sessLog.C_COUNT) == "{:n}".format(-400)
|
||||||
|
|
||||||
|
item = sessLog.listBox.topLevelItem(7)
|
||||||
|
assert item is not None
|
||||||
|
assert item.text(sessLog.C_COUNT) == "{:n}".format(200)
|
||||||
|
|
||||||
assert sessLog._saveData(sessLog.FMT_CSV)
|
assert sessLog._saveData(sessLog.FMT_CSV)
|
||||||
assert sessLog._saveData(sessLog.FMT_JSON)
|
assert sessLog._saveData(sessLog.FMT_JSON)
|
||||||
@@ -205,14 +228,37 @@ def testToolWritingStats_Filters(qtbot, monkeypatch, nwGUI, projPath, tstPaths):
|
|||||||
sessLog.populateGUI()
|
sessLog.populateGUI()
|
||||||
sessLog.listBox.sortByColumn(sessLog.C_TIME, Qt.SortOrder.AscendingOrder)
|
sessLog.listBox.sortByColumn(sessLog.C_TIME, Qt.SortOrder.AscendingOrder)
|
||||||
|
|
||||||
assert sessLog.listBox.topLevelItem(0).text(sessLog.C_COUNT) == "{:n}".format(1)
|
item = sessLog.listBox.topLevelItem(0)
|
||||||
assert sessLog.listBox.topLevelItem(1).text(sessLog.C_COUNT) == "{:n}".format(-200)
|
assert item is not None
|
||||||
assert sessLog.listBox.topLevelItem(2).text(sessLog.C_COUNT) == "{:n}".format(300)
|
assert item.text(sessLog.C_COUNT) == "{:n}".format(1)
|
||||||
assert sessLog.listBox.topLevelItem(3).text(sessLog.C_COUNT) == "{:n}".format(-120)
|
|
||||||
assert sessLog.listBox.topLevelItem(4).text(sessLog.C_COUNT) == "{:n}".format(-20)
|
item = sessLog.listBox.topLevelItem(1)
|
||||||
assert sessLog.listBox.topLevelItem(5).text(sessLog.C_COUNT) == "{:n}".format(40)
|
assert item is not None
|
||||||
assert sessLog.listBox.topLevelItem(6).text(sessLog.C_COUNT) == "{:n}".format(-400)
|
assert item.text(sessLog.C_COUNT) == "{:n}".format(-200)
|
||||||
assert sessLog.listBox.topLevelItem(7).text(sessLog.C_COUNT) == "{:n}".format(200)
|
|
||||||
|
item = sessLog.listBox.topLevelItem(2)
|
||||||
|
assert item is not None
|
||||||
|
assert item.text(sessLog.C_COUNT) == "{:n}".format(300)
|
||||||
|
|
||||||
|
item = sessLog.listBox.topLevelItem(3)
|
||||||
|
assert item is not None
|
||||||
|
assert item.text(sessLog.C_COUNT) == "{:n}".format(-120)
|
||||||
|
|
||||||
|
item = sessLog.listBox.topLevelItem(4)
|
||||||
|
assert item is not None
|
||||||
|
assert item.text(sessLog.C_COUNT) == "{:n}".format(-20)
|
||||||
|
|
||||||
|
item = sessLog.listBox.topLevelItem(5)
|
||||||
|
assert item is not None
|
||||||
|
assert item.text(sessLog.C_COUNT) == "{:n}".format(40)
|
||||||
|
|
||||||
|
item = sessLog.listBox.topLevelItem(6)
|
||||||
|
assert item is not None
|
||||||
|
assert item.text(sessLog.C_COUNT) == "{:n}".format(-400)
|
||||||
|
|
||||||
|
item = sessLog.listBox.topLevelItem(7)
|
||||||
|
assert item is not None
|
||||||
|
assert item.text(sessLog.C_COUNT) == "{:n}".format(200)
|
||||||
|
|
||||||
# No Novel Files
|
# No Novel Files
|
||||||
qtbot.mouseClick(sessLog.incNovel, QtMouseLeft)
|
qtbot.mouseClick(sessLog.incNovel, QtMouseLeft)
|
||||||
@@ -222,14 +268,37 @@ def testToolWritingStats_Filters(qtbot, monkeypatch, nwGUI, projPath, tstPaths):
|
|||||||
with open(jsonStats, mode="r", encoding="utf-8") as inFile:
|
with open(jsonStats, mode="r", encoding="utf-8") as inFile:
|
||||||
jsonData = json.loads(inFile.read())
|
jsonData = json.loads(inFile.read())
|
||||||
|
|
||||||
assert sessLog.listBox.topLevelItem(0).text(sessLog.C_COUNT) == "{:n}".format(1)
|
item = sessLog.listBox.topLevelItem(0)
|
||||||
assert sessLog.listBox.topLevelItem(1).text(sessLog.C_COUNT) == "{:n}".format(-100)
|
assert item is not None
|
||||||
assert sessLog.listBox.topLevelItem(2).text(sessLog.C_COUNT) == "{:n}".format(150)
|
assert item.text(sessLog.C_COUNT) == "{:n}".format(1)
|
||||||
assert sessLog.listBox.topLevelItem(3).text(sessLog.C_COUNT) == "{:n}".format(-60)
|
|
||||||
assert sessLog.listBox.topLevelItem(4).text(sessLog.C_COUNT) == "{:n}".format(-10)
|
item = sessLog.listBox.topLevelItem(1)
|
||||||
assert sessLog.listBox.topLevelItem(5).text(sessLog.C_COUNT) == "{:n}".format(20)
|
assert item is not None
|
||||||
assert sessLog.listBox.topLevelItem(6).text(sessLog.C_COUNT) == "{:n}".format(-200)
|
assert item.text(sessLog.C_COUNT) == "{:n}".format(-100)
|
||||||
assert sessLog.listBox.topLevelItem(7).text(sessLog.C_COUNT) == "{:n}".format(100)
|
|
||||||
|
item = sessLog.listBox.topLevelItem(2)
|
||||||
|
assert item is not None
|
||||||
|
assert item.text(sessLog.C_COUNT) == "{:n}".format(150)
|
||||||
|
|
||||||
|
item = sessLog.listBox.topLevelItem(3)
|
||||||
|
assert item is not None
|
||||||
|
assert item.text(sessLog.C_COUNT) == "{:n}".format(-60)
|
||||||
|
|
||||||
|
item = sessLog.listBox.topLevelItem(4)
|
||||||
|
assert item is not None
|
||||||
|
assert item.text(sessLog.C_COUNT) == "{:n}".format(-10)
|
||||||
|
|
||||||
|
item = sessLog.listBox.topLevelItem(5)
|
||||||
|
assert item is not None
|
||||||
|
assert item.text(sessLog.C_COUNT) == "{:n}".format(20)
|
||||||
|
|
||||||
|
item = sessLog.listBox.topLevelItem(6)
|
||||||
|
assert item is not None
|
||||||
|
assert item.text(sessLog.C_COUNT) == "{:n}".format(-200)
|
||||||
|
|
||||||
|
item = sessLog.listBox.topLevelItem(7)
|
||||||
|
assert item is not None
|
||||||
|
assert item.text(sessLog.C_COUNT) == "{:n}".format(100)
|
||||||
|
|
||||||
assert jsonData == [
|
assert jsonData == [
|
||||||
{
|
{
|
||||||
@@ -268,14 +337,37 @@ def testToolWritingStats_Filters(qtbot, monkeypatch, nwGUI, projPath, tstPaths):
|
|||||||
with open(jsonStats, mode="r", encoding="utf-8") as inFile:
|
with open(jsonStats, mode="r", encoding="utf-8") as inFile:
|
||||||
jsonData = json.load(inFile)
|
jsonData = json.load(inFile)
|
||||||
|
|
||||||
assert sessLog.listBox.topLevelItem(0).text(sessLog.C_COUNT) == "{:n}".format(1)
|
item = sessLog.listBox.topLevelItem(0)
|
||||||
assert sessLog.listBox.topLevelItem(1).text(sessLog.C_COUNT) == "{:n}".format(-100)
|
assert item is not None
|
||||||
assert sessLog.listBox.topLevelItem(2).text(sessLog.C_COUNT) == "{:n}".format(150)
|
assert item.text(sessLog.C_COUNT) == "{:n}".format(1)
|
||||||
assert sessLog.listBox.topLevelItem(3).text(sessLog.C_COUNT) == "{:n}".format(-60)
|
|
||||||
assert sessLog.listBox.topLevelItem(4).text(sessLog.C_COUNT) == "{:n}".format(-10)
|
item = sessLog.listBox.topLevelItem(1)
|
||||||
assert sessLog.listBox.topLevelItem(5).text(sessLog.C_COUNT) == "{:n}".format(20)
|
assert item is not None
|
||||||
assert sessLog.listBox.topLevelItem(6).text(sessLog.C_COUNT) == "{:n}".format(-200)
|
assert item.text(sessLog.C_COUNT) == "{:n}".format(-100)
|
||||||
assert sessLog.listBox.topLevelItem(7).text(sessLog.C_COUNT) == "{:n}".format(100)
|
|
||||||
|
item = sessLog.listBox.topLevelItem(2)
|
||||||
|
assert item is not None
|
||||||
|
assert item.text(sessLog.C_COUNT) == "{:n}".format(150)
|
||||||
|
|
||||||
|
item = sessLog.listBox.topLevelItem(3)
|
||||||
|
assert item is not None
|
||||||
|
assert item.text(sessLog.C_COUNT) == "{:n}".format(-60)
|
||||||
|
|
||||||
|
item = sessLog.listBox.topLevelItem(4)
|
||||||
|
assert item is not None
|
||||||
|
assert item.text(sessLog.C_COUNT) == "{:n}".format(-10)
|
||||||
|
|
||||||
|
item = sessLog.listBox.topLevelItem(5)
|
||||||
|
assert item is not None
|
||||||
|
assert item.text(sessLog.C_COUNT) == "{:n}".format(20)
|
||||||
|
|
||||||
|
item = sessLog.listBox.topLevelItem(6)
|
||||||
|
assert item is not None
|
||||||
|
assert item.text(sessLog.C_COUNT) == "{:n}".format(-200)
|
||||||
|
|
||||||
|
item = sessLog.listBox.topLevelItem(7)
|
||||||
|
assert item is not None
|
||||||
|
assert item.text(sessLog.C_COUNT) == "{:n}".format(100)
|
||||||
|
|
||||||
assert jsonData == [
|
assert jsonData == [
|
||||||
{
|
{
|
||||||
@@ -314,10 +406,21 @@ def testToolWritingStats_Filters(qtbot, monkeypatch, nwGUI, projPath, tstPaths):
|
|||||||
with open(jsonStats, mode="r", encoding="utf-8") as inFile:
|
with open(jsonStats, mode="r", encoding="utf-8") as inFile:
|
||||||
jsonData = json.load(inFile)
|
jsonData = json.load(inFile)
|
||||||
|
|
||||||
assert sessLog.listBox.topLevelItem(0).text(sessLog.C_COUNT) == "{:n}".format(1)
|
item = sessLog.listBox.topLevelItem(0)
|
||||||
assert sessLog.listBox.topLevelItem(1).text(sessLog.C_COUNT) == "{:n}".format(300)
|
assert item is not None
|
||||||
assert sessLog.listBox.topLevelItem(2).text(sessLog.C_COUNT) == "{:n}".format(40)
|
assert item.text(sessLog.C_COUNT) == "{:n}".format(1)
|
||||||
assert sessLog.listBox.topLevelItem(3).text(sessLog.C_COUNT) == "{:n}".format(200)
|
|
||||||
|
item = sessLog.listBox.topLevelItem(1)
|
||||||
|
assert item is not None
|
||||||
|
assert item.text(sessLog.C_COUNT) == "{:n}".format(300)
|
||||||
|
|
||||||
|
item = sessLog.listBox.topLevelItem(2)
|
||||||
|
assert item is not None
|
||||||
|
assert item.text(sessLog.C_COUNT) == "{:n}".format(40)
|
||||||
|
|
||||||
|
item = sessLog.listBox.topLevelItem(3)
|
||||||
|
assert item is not None
|
||||||
|
assert item.text(sessLog.C_COUNT) == "{:n}".format(200)
|
||||||
|
|
||||||
assert jsonData == [
|
assert jsonData == [
|
||||||
{
|
{
|
||||||
@@ -344,16 +447,45 @@ def testToolWritingStats_Filters(qtbot, monkeypatch, nwGUI, projPath, tstPaths):
|
|||||||
with open(jsonStats, mode="r", encoding="utf-8") as inFile:
|
with open(jsonStats, mode="r", encoding="utf-8") as inFile:
|
||||||
jsonData = json.load(inFile)
|
jsonData = json.load(inFile)
|
||||||
|
|
||||||
assert sessLog.listBox.topLevelItem(0).text(sessLog.C_COUNT) == "{:n}".format(1)
|
item = sessLog.listBox.topLevelItem(0)
|
||||||
assert sessLog.listBox.topLevelItem(1).text(sessLog.C_COUNT) == "{:n}".format(0)
|
assert item is not None
|
||||||
assert sessLog.listBox.topLevelItem(2).text(sessLog.C_COUNT) == "{:n}".format(-200)
|
assert item.text(sessLog.C_COUNT) == "{:n}".format(1)
|
||||||
assert sessLog.listBox.topLevelItem(3).text(sessLog.C_COUNT) == "{:n}".format(300)
|
|
||||||
assert sessLog.listBox.topLevelItem(4).text(sessLog.C_COUNT) == "{:n}".format(-120)
|
item = sessLog.listBox.topLevelItem(1)
|
||||||
assert sessLog.listBox.topLevelItem(5).text(sessLog.C_COUNT) == "{:n}".format(-20)
|
assert item is not None
|
||||||
assert sessLog.listBox.topLevelItem(6).text(sessLog.C_COUNT) == "{:n}".format(40)
|
assert item.text(sessLog.C_COUNT) == "{:n}".format(0)
|
||||||
assert sessLog.listBox.topLevelItem(7).text(sessLog.C_COUNT) == "{:n}".format(-400)
|
|
||||||
assert sessLog.listBox.topLevelItem(8).text(sessLog.C_COUNT) == "{:n}".format(200)
|
item = sessLog.listBox.topLevelItem(2)
|
||||||
assert sessLog.listBox.topLevelItem(9).text(sessLog.C_COUNT) == "{:n}".format(0)
|
assert item is not None
|
||||||
|
assert item.text(sessLog.C_COUNT) == "{:n}".format(-200)
|
||||||
|
|
||||||
|
item = sessLog.listBox.topLevelItem(3)
|
||||||
|
assert item is not None
|
||||||
|
assert item.text(sessLog.C_COUNT) == "{:n}".format(300)
|
||||||
|
|
||||||
|
item = sessLog.listBox.topLevelItem(4)
|
||||||
|
assert item is not None
|
||||||
|
assert item.text(sessLog.C_COUNT) == "{:n}".format(-120)
|
||||||
|
|
||||||
|
item = sessLog.listBox.topLevelItem(5)
|
||||||
|
assert item is not None
|
||||||
|
assert item.text(sessLog.C_COUNT) == "{:n}".format(-20)
|
||||||
|
|
||||||
|
item = sessLog.listBox.topLevelItem(6)
|
||||||
|
assert item is not None
|
||||||
|
assert item.text(sessLog.C_COUNT) == "{:n}".format(40)
|
||||||
|
|
||||||
|
item = sessLog.listBox.topLevelItem(7)
|
||||||
|
assert item is not None
|
||||||
|
assert item.text(sessLog.C_COUNT) == "{:n}".format(-400)
|
||||||
|
|
||||||
|
item = sessLog.listBox.topLevelItem(8)
|
||||||
|
assert item is not None
|
||||||
|
assert item.text(sessLog.C_COUNT) == "{:n}".format(200)
|
||||||
|
|
||||||
|
item = sessLog.listBox.topLevelItem(9)
|
||||||
|
assert item is not None
|
||||||
|
assert item.text(sessLog.C_COUNT) == "{:n}".format(0)
|
||||||
|
|
||||||
assert jsonData == [
|
assert jsonData == [
|
||||||
{
|
{
|
||||||
@@ -390,9 +522,15 @@ def testToolWritingStats_Filters(qtbot, monkeypatch, nwGUI, projPath, tstPaths):
|
|||||||
]
|
]
|
||||||
|
|
||||||
# Toggle Idle Time
|
# Toggle Idle Time
|
||||||
assert sessLog.listBox.topLevelItem(7).text(sessLog.C_IDLE) == "4 %"
|
item = sessLog.listBox.topLevelItem(7)
|
||||||
|
assert item is not None
|
||||||
|
assert item.text(sessLog.C_IDLE) == "4 %"
|
||||||
|
|
||||||
qtbot.mouseClick(sessLog.showIdleTime, QtMouseLeft)
|
qtbot.mouseClick(sessLog.showIdleTime, QtMouseLeft)
|
||||||
assert sessLog.listBox.topLevelItem(7).text(sessLog.C_IDLE) == "00:01:10"
|
|
||||||
|
item = sessLog.listBox.topLevelItem(7)
|
||||||
|
assert item is not None
|
||||||
|
assert item.text(sessLog.C_IDLE) == "00:01:10"
|
||||||
|
|
||||||
# Group by Day
|
# Group by Day
|
||||||
qtbot.mouseClick(sessLog.groupByDay, QtMouseLeft)
|
qtbot.mouseClick(sessLog.groupByDay, QtMouseLeft)
|
||||||
@@ -402,14 +540,37 @@ def testToolWritingStats_Filters(qtbot, monkeypatch, nwGUI, projPath, tstPaths):
|
|||||||
with open(jsonStats, mode="r", encoding="utf-8") as inFile:
|
with open(jsonStats, mode="r", encoding="utf-8") as inFile:
|
||||||
jsonData = json.load(inFile)
|
jsonData = json.load(inFile)
|
||||||
|
|
||||||
assert sessLog.listBox.topLevelItem(0).text(sessLog.C_COUNT) == "{:n}".format(1)
|
item = sessLog.listBox.topLevelItem(0)
|
||||||
assert sessLog.listBox.topLevelItem(1).text(sessLog.C_COUNT) == "{:n}".format(-200)
|
assert item is not None
|
||||||
assert sessLog.listBox.topLevelItem(2).text(sessLog.C_COUNT) == "{:n}".format(180)
|
assert item.text(sessLog.C_COUNT) == "{:n}".format(1)
|
||||||
assert sessLog.listBox.topLevelItem(3).text(sessLog.C_COUNT) == "{:n}".format(-20)
|
|
||||||
assert sessLog.listBox.topLevelItem(4).text(sessLog.C_COUNT) == "{:n}".format(40)
|
item = sessLog.listBox.topLevelItem(1)
|
||||||
assert sessLog.listBox.topLevelItem(5).text(sessLog.C_COUNT) == "{:n}".format(-400)
|
assert item is not None
|
||||||
assert sessLog.listBox.topLevelItem(6).text(sessLog.C_COUNT) == "{:n}".format(200)
|
assert item.text(sessLog.C_COUNT) == "{:n}".format(-200)
|
||||||
assert sessLog.listBox.topLevelItem(7).text(sessLog.C_COUNT) == "{:n}".format(0)
|
|
||||||
|
item = sessLog.listBox.topLevelItem(2)
|
||||||
|
assert item is not None
|
||||||
|
assert item.text(sessLog.C_COUNT) == "{:n}".format(180)
|
||||||
|
|
||||||
|
item = sessLog.listBox.topLevelItem(3)
|
||||||
|
assert item is not None
|
||||||
|
assert item.text(sessLog.C_COUNT) == "{:n}".format(-20)
|
||||||
|
|
||||||
|
item = sessLog.listBox.topLevelItem(4)
|
||||||
|
assert item is not None
|
||||||
|
assert item.text(sessLog.C_COUNT) == "{:n}".format(40)
|
||||||
|
|
||||||
|
item = sessLog.listBox.topLevelItem(5)
|
||||||
|
assert item is not None
|
||||||
|
assert item.text(sessLog.C_COUNT) == "{:n}".format(-400)
|
||||||
|
|
||||||
|
item = sessLog.listBox.topLevelItem(6)
|
||||||
|
assert item is not None
|
||||||
|
assert item.text(sessLog.C_COUNT) == "{:n}".format(200)
|
||||||
|
|
||||||
|
item = sessLog.listBox.topLevelItem(7)
|
||||||
|
assert item is not None
|
||||||
|
assert item.text(sessLog.C_COUNT) == "{:n}".format(0)
|
||||||
|
|
||||||
assert jsonData == [
|
assert jsonData == [
|
||||||
{
|
{
|
||||||
|
|||||||
+3
-1
@@ -241,5 +241,7 @@ class SimpleDialog(QDialog):
|
|||||||
|
|
||||||
def addWidget(self, widget: QWidget) -> None:
|
def addWidget(self, widget: QWidget) -> None:
|
||||||
self._widget = widget
|
self._widget = widget
|
||||||
self.layout().addWidget(widget)
|
layout = self.layout()
|
||||||
|
assert layout is not None
|
||||||
|
layout.addWidget(widget)
|
||||||
return
|
return
|
||||||
|
|||||||
Reference in New Issue
Block a user