Fixed tests
This commit is contained in:
+11
-8
@@ -263,7 +263,7 @@ class GuiMain(QMainWindow):
|
|||||||
|
|
||||||
return True
|
return True
|
||||||
|
|
||||||
def newProject(self, projPath=None, forceNew=False):
|
def newProject(self, projData=None, forceNew=False):
|
||||||
"""Create new project with a few default files and folders.
|
"""Create new project with a few default files and folders.
|
||||||
The variable forceNew is used for testing.
|
The variable forceNew is used for testing.
|
||||||
"""
|
"""
|
||||||
@@ -275,15 +275,18 @@ class GuiMain(QMainWindow):
|
|||||||
)
|
)
|
||||||
return False
|
return False
|
||||||
|
|
||||||
projData = {}
|
if projData is None and self.mainConf.showGUI:
|
||||||
if projPath is None:
|
|
||||||
projData = self.newProjectDialog()
|
projData = self.newProjectDialog()
|
||||||
if projData is None:
|
|
||||||
return False
|
|
||||||
if "projPath" in projData:
|
|
||||||
projPath = projData["projPath"]
|
|
||||||
|
|
||||||
if projPath is None:
|
if projData is None:
|
||||||
|
return False
|
||||||
|
|
||||||
|
projPath = None
|
||||||
|
if "projPath" in projData:
|
||||||
|
projPath = projData["projPath"]
|
||||||
|
|
||||||
|
if projPath is None or projData is None:
|
||||||
|
logger.error("No projData or projPath set")
|
||||||
return False
|
return False
|
||||||
|
|
||||||
if path.isfile(path.join(projPath,self.theProject.projFile)) and not forceNew:
|
if path.isfile(path.join(projPath,self.theProject.projFile)) and not forceNew:
|
||||||
|
|||||||
+3
-3
@@ -27,7 +27,7 @@ def testMainWindows(qtbot, nwTempGUI, nwRef, nwTemp):
|
|||||||
|
|
||||||
# Create new, save, close project
|
# Create new, save, close project
|
||||||
nwGUI.theProject.projTree.setSeed(42)
|
nwGUI.theProject.projTree.setSeed(42)
|
||||||
assert nwGUI.newProject(nwTempGUI, True)
|
assert nwGUI.newProject({"projPath": nwTempGUI}, True)
|
||||||
assert nwGUI.saveProject()
|
assert nwGUI.saveProject()
|
||||||
assert nwGUI.closeProject()
|
assert nwGUI.closeProject()
|
||||||
|
|
||||||
@@ -274,7 +274,7 @@ def testProjectEditor(qtbot, nwTempGUI, nwRef, nwTemp):
|
|||||||
|
|
||||||
# Create new, save, open project
|
# Create new, save, open project
|
||||||
nwGUI.theProject.projTree.setSeed(42)
|
nwGUI.theProject.projTree.setSeed(42)
|
||||||
assert nwGUI.newProject(nwTempGUI, True)
|
assert nwGUI.newProject({"projPath": nwTempGUI}, True)
|
||||||
nwGUI.mainConf.backupPath = nwTempGUI
|
nwGUI.mainConf.backupPath = nwTempGUI
|
||||||
|
|
||||||
projEdit = GuiProjectSettings(nwGUI, nwGUI.theProject)
|
projEdit = GuiProjectSettings(nwGUI, nwGUI.theProject)
|
||||||
@@ -363,7 +363,7 @@ def testItemEditor(qtbot, nwTempGUI, nwRef, nwTemp):
|
|||||||
|
|
||||||
# Create new, save, open project
|
# Create new, save, open project
|
||||||
nwGUI.theProject.projTree.setSeed(42)
|
nwGUI.theProject.projTree.setSeed(42)
|
||||||
assert nwGUI.newProject(nwTempGUI, True)
|
assert nwGUI.newProject({"projPath": nwTempGUI}, True)
|
||||||
assert nwGUI.openDocument("31489056e0916")
|
assert nwGUI.openDocument("31489056e0916")
|
||||||
|
|
||||||
itemEdit = GuiItemEditor(nwGUI, nwGUI.theProject, "31489056e0916")
|
itemEdit = GuiItemEditor(nwGUI, nwGUI.theProject, "31489056e0916")
|
||||||
|
|||||||
@@ -26,7 +26,7 @@ def testProjectNew(nwTempProj,nwRef,nwTemp):
|
|||||||
projFile = path.join(nwTempProj,"nwProject.nwx")
|
projFile = path.join(nwTempProj,"nwProject.nwx")
|
||||||
refFile = path.join(nwRef,"proj","1_nwProject.nwx")
|
refFile = path.join(nwRef,"proj","1_nwProject.nwx")
|
||||||
assert theConf.initConfig(nwRef, nwTemp)
|
assert theConf.initConfig(nwRef, nwTemp)
|
||||||
assert theProject.newProject()
|
assert theProject.newProject({"projPath": nwTempProj})
|
||||||
assert theProject.setProjectPath(nwTempProj)
|
assert theProject.setProjectPath(nwTempProj)
|
||||||
assert theProject.saveProject()
|
assert theProject.saveProject()
|
||||||
assert theProject.closeProject()
|
assert theProject.closeProject()
|
||||||
|
|||||||
Reference in New Issue
Block a user