Minor improvements to existing tests to increase coverage
This commit is contained in:
+54
-4
@@ -40,6 +40,7 @@ def testConfigSetDataPath(tmpConf, nwTemp):
|
||||
def testConfigSetWinSize(tmpConf, nwTemp, nwRef):
|
||||
refConf = path.join(nwRef, "novelwriter.conf")
|
||||
testConf = path.join(tmpConf.confPath, "novelwriter.conf")
|
||||
tmpConf.guiScale = 1.0
|
||||
|
||||
assert tmpConf.confPath == nwTemp
|
||||
assert tmpConf.setWinSize(1105, 655)
|
||||
@@ -58,10 +59,17 @@ def testConfigSetTreeColWidths(tmpConf, nwTemp, nwRef):
|
||||
testConf = path.join(tmpConf.confPath, "novelwriter.conf")
|
||||
|
||||
assert tmpConf.confPath == nwTemp
|
||||
assert tmpConf.setTreeColWidths([0, 0, 0])
|
||||
assert tmpConf.confChanged
|
||||
tmpConf.guiScale = 1.0
|
||||
|
||||
assert tmpConf.setTreeColWidths([10, 20, 30])
|
||||
assert tmpConf.treeColWidth == [10, 20, 30]
|
||||
assert tmpConf.setTreeColWidths([120, 30, 50])
|
||||
|
||||
assert tmpConf.setProjColWidths([10, 20, 30])
|
||||
assert tmpConf.projColWidth == [10, 20, 30]
|
||||
assert tmpConf.setProjColWidths([140, 55, 140])
|
||||
|
||||
assert tmpConf.confChanged
|
||||
assert tmpConf.saveConfig()
|
||||
|
||||
assert cmpFiles(testConf, refConf, [2])
|
||||
@@ -73,12 +81,31 @@ def testConfigSetPanePos(tmpConf, nwTemp, nwRef):
|
||||
testConf = path.join(tmpConf.confPath, "novelwriter.conf")
|
||||
|
||||
assert tmpConf.confPath == nwTemp
|
||||
assert tmpConf.setMainPanePos([0, 0])
|
||||
assert tmpConf.confChanged
|
||||
|
||||
tmpConf.guiScale = 2.0
|
||||
assert tmpConf.setMainPanePos([200, 700])
|
||||
assert tmpConf.mainPanePos == [100, 350]
|
||||
assert tmpConf.getMainPanePos() == [200, 700]
|
||||
|
||||
assert tmpConf.setDocPanePos([300, 300])
|
||||
assert tmpConf.docPanePos == [150, 150]
|
||||
assert tmpConf.getDocPanePos() == [300, 300]
|
||||
|
||||
assert tmpConf.setViewPanePos([400, 250])
|
||||
assert tmpConf.viewPanePos == [200, 125]
|
||||
assert tmpConf.getViewPanePos() == [400, 250]
|
||||
|
||||
assert tmpConf.setOutlinePanePos([400, 250])
|
||||
assert tmpConf.outlnPanePos == [200, 125]
|
||||
assert tmpConf.getOutlinePanePos() == [400, 250]
|
||||
|
||||
tmpConf.guiScale = 1.0
|
||||
assert tmpConf.setMainPanePos([300, 800])
|
||||
assert tmpConf.setDocPanePos([400, 400])
|
||||
assert tmpConf.setViewPanePos([500, 150])
|
||||
assert tmpConf.setOutlinePanePos([500, 150])
|
||||
|
||||
assert tmpConf.confChanged
|
||||
assert tmpConf.saveConfig()
|
||||
|
||||
assert cmpFiles(testConf, refConf, [2])
|
||||
@@ -90,14 +117,37 @@ def testConfigFlags(tmpConf, nwTemp, nwRef):
|
||||
testConf = path.join(tmpConf.confPath, "novelwriter.conf")
|
||||
|
||||
assert tmpConf.confPath == nwTemp
|
||||
|
||||
assert not tmpConf.setShowRefPanel(False)
|
||||
assert tmpConf.setShowRefPanel(True)
|
||||
|
||||
assert not tmpConf.setViewComments(False)
|
||||
assert not tmpConf.viewComments
|
||||
assert tmpConf.setViewComments(True)
|
||||
|
||||
assert not tmpConf.setViewSynopsis(False)
|
||||
assert not tmpConf.viewSynopsis
|
||||
assert tmpConf.setViewSynopsis(True)
|
||||
|
||||
assert tmpConf.confChanged
|
||||
assert tmpConf.saveConfig()
|
||||
|
||||
assert cmpFiles(testConf, refConf, [2])
|
||||
assert not tmpConf.confChanged
|
||||
|
||||
@pytest.mark.core
|
||||
def testTextSizes(tmpConf, nwTemp, nwRef):
|
||||
assert tmpConf.confPath == nwTemp
|
||||
|
||||
tmpConf.guiScale = 2.0
|
||||
assert tmpConf.getTextWidth() == 1200
|
||||
assert tmpConf.getTextMargin() == 80
|
||||
assert tmpConf.getTabWidth() == 80
|
||||
assert tmpConf.getFocusWidth() == 1600
|
||||
tmpConf.guiScale = 1.0
|
||||
|
||||
assert not tmpConf.confChanged
|
||||
|
||||
@pytest.mark.core
|
||||
def testConfigErrors(tmpConf):
|
||||
nonPath = path.join("somewhere", "over", "the", "rainbow")
|
||||
|
||||
Reference in New Issue
Block a user