Clean up the config class names and methods
This commit is contained in:
@@ -313,98 +313,98 @@ def testBaseConfig_SettersGetters(tmpConf, tmpDir, outDir, refDir):
|
||||
|
||||
# Window Size
|
||||
tmpConf.guiScale = 1.0
|
||||
assert tmpConf.setWinSize(1205, 655)
|
||||
assert not tmpConf.confChanged
|
||||
tmpConf.setWinSize(1205, 655)
|
||||
assert tmpConf.confChanged is False
|
||||
|
||||
tmpConf.guiScale = 2.0
|
||||
assert tmpConf.setWinSize(70, 70)
|
||||
tmpConf.setWinSize(70, 70)
|
||||
assert tmpConf.getWinSize() == [70, 70]
|
||||
assert tmpConf.winGeometry == [35, 35]
|
||||
|
||||
tmpConf.guiScale = 1.0
|
||||
assert tmpConf.setWinSize(70, 70)
|
||||
tmpConf.setWinSize(70, 70)
|
||||
assert tmpConf.getWinSize() == [70, 70]
|
||||
assert tmpConf.winGeometry == [70, 70]
|
||||
|
||||
assert tmpConf.setWinSize(1200, 650)
|
||||
tmpConf.setWinSize(1200, 650)
|
||||
|
||||
# Preferences Size
|
||||
tmpConf.guiScale = 2.0
|
||||
assert tmpConf.setPreferencesSize(70, 70)
|
||||
tmpConf.setPreferencesSize(70, 70)
|
||||
assert tmpConf.getPreferencesSize() == [70, 70]
|
||||
assert tmpConf.prefGeometry == [35, 35]
|
||||
|
||||
tmpConf.guiScale = 1.0
|
||||
assert tmpConf.setPreferencesSize(70, 70)
|
||||
tmpConf.setPreferencesSize(70, 70)
|
||||
assert tmpConf.getPreferencesSize() == [70, 70]
|
||||
assert tmpConf.prefGeometry == [70, 70]
|
||||
|
||||
assert tmpConf.setPreferencesSize(700, 615)
|
||||
tmpConf.setPreferencesSize(700, 615)
|
||||
|
||||
# Project Settings Tree Columns
|
||||
tmpConf.guiScale = 2.0
|
||||
assert tmpConf.setProjColWidths([10, 20, 30])
|
||||
tmpConf.setProjColWidths([10, 20, 30])
|
||||
assert tmpConf.getProjColWidths() == [10, 20, 30]
|
||||
assert tmpConf.projColWidth == [5, 10, 15]
|
||||
|
||||
tmpConf.guiScale = 1.0
|
||||
assert tmpConf.setProjColWidths([10, 20, 30])
|
||||
tmpConf.setProjColWidths([10, 20, 30])
|
||||
assert tmpConf.getProjColWidths() == [10, 20, 30]
|
||||
assert tmpConf.projColWidth == [10, 20, 30]
|
||||
|
||||
assert tmpConf.setProjColWidths([200, 60, 140])
|
||||
tmpConf.setProjColWidths([200, 60, 140])
|
||||
|
||||
# Main Pane Splitter
|
||||
tmpConf.guiScale = 2.0
|
||||
assert tmpConf.setMainPanePos([200, 700])
|
||||
tmpConf.setMainPanePos([200, 700])
|
||||
assert tmpConf.getMainPanePos() == [200, 700]
|
||||
assert tmpConf.mainPanePos == [100, 350]
|
||||
|
||||
tmpConf.guiScale = 1.0
|
||||
assert tmpConf.setMainPanePos([200, 700])
|
||||
tmpConf.setMainPanePos([200, 700])
|
||||
assert tmpConf.getMainPanePos() == [200, 700]
|
||||
assert tmpConf.mainPanePos == [200, 700]
|
||||
|
||||
assert tmpConf.setMainPanePos([300, 800])
|
||||
tmpConf.setMainPanePos([300, 800])
|
||||
|
||||
# Doc Pane Splitter
|
||||
tmpConf.guiScale = 2.0
|
||||
assert tmpConf.setDocPanePos([300, 300])
|
||||
tmpConf.setDocPanePos([300, 300])
|
||||
assert tmpConf.getDocPanePos() == [300, 300]
|
||||
assert tmpConf.docPanePos == [150, 150]
|
||||
|
||||
tmpConf.guiScale = 1.0
|
||||
assert tmpConf.setDocPanePos([300, 300])
|
||||
tmpConf.setDocPanePos([300, 300])
|
||||
assert tmpConf.getDocPanePos() == [300, 300]
|
||||
assert tmpConf.docPanePos == [300, 300]
|
||||
|
||||
assert tmpConf.setDocPanePos([400, 400])
|
||||
tmpConf.setDocPanePos([400, 400])
|
||||
|
||||
# View Pane Splitter
|
||||
tmpConf.guiScale = 2.0
|
||||
assert tmpConf.setViewPanePos([400, 250])
|
||||
tmpConf.setViewPanePos([400, 250])
|
||||
assert tmpConf.getViewPanePos() == [400, 250]
|
||||
assert tmpConf.viewPanePos == [200, 125]
|
||||
|
||||
tmpConf.guiScale = 1.0
|
||||
assert tmpConf.setViewPanePos([400, 250])
|
||||
tmpConf.setViewPanePos([400, 250])
|
||||
assert tmpConf.getViewPanePos() == [400, 250]
|
||||
assert tmpConf.viewPanePos == [400, 250]
|
||||
|
||||
assert tmpConf.setViewPanePos([500, 150])
|
||||
tmpConf.setViewPanePos([500, 150])
|
||||
|
||||
# Outline Pane Splitter
|
||||
tmpConf.guiScale = 2.0
|
||||
assert tmpConf.setOutlinePanePos([400, 250])
|
||||
tmpConf.setOutlinePanePos([400, 250])
|
||||
assert tmpConf.getOutlinePanePos() == [400, 250]
|
||||
assert tmpConf.outlnPanePos == [200, 125]
|
||||
|
||||
tmpConf.guiScale = 1.0
|
||||
assert tmpConf.setOutlinePanePos([400, 250])
|
||||
tmpConf.setOutlinePanePos([400, 250])
|
||||
assert tmpConf.getOutlinePanePos() == [400, 250]
|
||||
assert tmpConf.outlnPanePos == [400, 250]
|
||||
|
||||
assert tmpConf.setOutlinePanePos([500, 150])
|
||||
tmpConf.setOutlinePanePos([500, 150])
|
||||
|
||||
# Getters Only
|
||||
# ============
|
||||
@@ -424,17 +424,20 @@ def testBaseConfig_SettersGetters(tmpConf, tmpDir, outDir, refDir):
|
||||
# Flag Setters
|
||||
# ============
|
||||
|
||||
assert tmpConf.setShowRefPanel(False) is False
|
||||
tmpConf.setShowRefPanel(False)
|
||||
assert tmpConf.showRefPanel is False
|
||||
assert tmpConf.setShowRefPanel(True) is True
|
||||
tmpConf.setShowRefPanel(True)
|
||||
assert tmpConf.showRefPanel is True
|
||||
|
||||
assert tmpConf.setViewComments(False) is False
|
||||
tmpConf.setViewComments(False)
|
||||
assert tmpConf.viewComments is False
|
||||
assert tmpConf.setViewComments(True) is True
|
||||
tmpConf.setViewComments(True)
|
||||
assert tmpConf.viewComments is True
|
||||
|
||||
assert tmpConf.setViewSynopsis(False) is False
|
||||
tmpConf.setViewSynopsis(False)
|
||||
assert tmpConf.viewSynopsis is False
|
||||
assert tmpConf.setViewSynopsis(True) is True
|
||||
tmpConf.setViewSynopsis(True)
|
||||
assert tmpConf.viewSynopsis is True
|
||||
|
||||
# Check Final File
|
||||
# ================
|
||||
|
||||
@@ -395,7 +395,7 @@ def testCoreTools_NewSample(monkeypatch, fncPath, tmpConf, tmpPath, mockGUI):
|
||||
srcSample = tmpConf._appRoot / "sample"
|
||||
dstSample = tmpPath / "sample.zip"
|
||||
monkeypatch.setattr(
|
||||
"novelwriter.config.Config.getAssetPath", lambda *a: tmpPath / "sample.zip"
|
||||
"novelwriter.config.Config.assetPath", lambda *a: tmpPath / "sample.zip"
|
||||
)
|
||||
|
||||
# Cannot extract when the zip does not exist
|
||||
|
||||
@@ -48,7 +48,7 @@ def testDlgAbout_NWDialog(qtbot, monkeypatch, nwGUI):
|
||||
assert msgAbout.pageLicense.document().characterCount() > 100
|
||||
|
||||
with monkeypatch.context() as mp:
|
||||
mp.setattr("novelwriter.config.Config.getAssetPath", lambda *a: Path("whatever"))
|
||||
mp.setattr("novelwriter.config.Config.assetPath", lambda *a: Path("whatever"))
|
||||
msgAbout._fillNotesPage()
|
||||
assert msgAbout.pageNotes.toPlainText() == "Error loading release notes text ..."
|
||||
msgAbout._fillLicensePage()
|
||||
|
||||
@@ -132,8 +132,8 @@ def testGuiTheme_Theme(qtbot, monkeypatch, nwGUI, fncPath):
|
||||
# List Themes
|
||||
# ===========
|
||||
|
||||
shutil.copy(mainConf.getAssetPath("themes") / "default_dark.conf", fncPath / "themes")
|
||||
shutil.copy(mainConf.getAssetPath("themes") / "default.conf", fncPath / "themes")
|
||||
shutil.copy(mainConf.assetPath("themes") / "default_dark.conf", fncPath / "themes")
|
||||
shutil.copy(mainConf.assetPath("themes") / "default.conf", fncPath / "themes")
|
||||
|
||||
# Block the reading of the files
|
||||
with monkeypatch.context() as mp:
|
||||
@@ -199,8 +199,8 @@ def testGuiTheme_Syntax(qtbot, monkeypatch, nwGUI, fncPath):
|
||||
# List Themes
|
||||
# ===========
|
||||
|
||||
shutil.copy(mainConf.getAssetPath("syntax") / "default_dark.conf", fncPath / "syntax")
|
||||
shutil.copy(mainConf.getAssetPath("syntax") / "default_light.conf", fncPath / "syntax")
|
||||
shutil.copy(mainConf.assetPath("syntax") / "default_dark.conf", fncPath / "syntax")
|
||||
shutil.copy(mainConf.assetPath("syntax") / "default_light.conf", fncPath / "syntax")
|
||||
|
||||
# Block the reading of the files
|
||||
with monkeypatch.context() as mp:
|
||||
|
||||
Reference in New Issue
Block a user