Add override flag for recomputes; set it in relevant tests with old files.

This commit is contained in:
bgbsww
2024-09-14 21:45:52 -04:00
committed by Yorik van Havre
parent a54f03f666
commit 0f53f2195d
14 changed files with 44 additions and 11 deletions

View File

@@ -42,7 +42,9 @@ from Tests.PathTestUtils import PathTestBase
class TestCAMSanity(PathTestBase):
@classmethod
def setUpClass(cls):
FreeCAD.ConfigSet("SuppressRecomputeRequiredDialog", "True")
cls.doc = FreeCAD.open(FreeCAD.getHomePath() + "/Mod/CAM/Tests/boxtest.fcstd")
FreeCAD.ConfigSet("SuppressRecomputeRequiredDialog", "")
cls.job = cls.doc.getObject("Job")
@classmethod

View File

@@ -52,7 +52,9 @@ class TestPathAdaptive(PathTestBase):
def initClass(cls):
# Open existing FreeCAD document with test geometry
cls.needsInit = False
FreeCAD.ConfigSet("SuppressRecomputeRequiredDialog", "True")
cls.doc = FreeCAD.open(FreeCAD.getHomePath() + "Mod/CAM/Tests/test_adaptive.fcstd")
FreeCAD.ConfigSet("SuppressRecomputeRequiredDialog", "")
# Create Job object, adding geometry objects from file opened above
cls.job = PathJob.Create("Job", [cls.doc.Fusion], None)

View File

@@ -35,7 +35,9 @@ else:
class TestPathDrillable(PathTestUtils.PathTestBase):
def setUp(self):
App.ConfigSet("SuppressRecomputeRequiredDialog", "True")
self.doc = App.open(App.getHomePath() + "/Mod/CAM/Tests/Drilling_1.FCStd")
App.ConfigSet("SuppressRecomputeRequiredDialog", "")
self.obj = self.doc.getObject("Pocket011")
def tearDown(self):

View File

@@ -84,7 +84,9 @@ def wireMarkers(wire):
class TestPathOpUtil(PathTestUtils.PathTestBase):
@classmethod
def setUpClass(cls):
FreeCAD.ConfigSet("SuppressRecomputeRequiredDialog", "True")
cls.doc = FreeCAD.openDocument(DOC)
FreeCAD.ConfigSet("SuppressRecomputeRequiredDialog", "")
@classmethod
def tearDownClass(cls):

View File

@@ -86,6 +86,8 @@ class TestFileNameGenerator(unittest.TestCase):
# cls.doc = FreeCAD.open(FreeCAD.getHomePath() + "/Mod/CAM/Tests/boxtest.fcstd")
# cls.job = cls.doc.getObject("Job")
FreeCAD.ConfigSet("SuppressRecomputeRequiredDialog", "True")
cls.testfile = FreeCAD.getHomePath() + "Mod/CAM/Tests/test_filenaming.fcstd"
cls.testfilepath, cls.testfilename = os.path.split(cls.testfile)
cls.testfilename, cls.ext = os.path.splitext(cls.testfilename)
@@ -98,6 +100,7 @@ class TestFileNameGenerator(unittest.TestCase):
@classmethod
def tearDownClass(cls):
FreeCAD.closeDocument(cls.doc.Name)
FreeCAD.ConfigSet("SuppressRecomputeRequiredDialog", "")
# def test010(self):
# self.job.PostProcessorOutputFile = ""
@@ -272,12 +275,14 @@ class TestFileNameGenerator(unittest.TestCase):
class TestResolvingPostProcessorName(unittest.TestCase):
@classmethod
def setUpClass(cls):
FreeCAD.ConfigSet("SuppressRecomputeRequiredDialog", "True")
cls.doc = FreeCAD.open(FreeCAD.getHomePath() + "/Mod/CAM/Tests/boxtest.fcstd")
cls.job = cls.doc.getObject("Job")
@classmethod
def tearDownClass(cls):
FreeCAD.closeDocument(cls.doc.Name)
FreeCAD.ConfigSet("SuppressRecomputeRequiredDialog", "")
def setUp(self):
pref = FreeCAD.ParamGet("User parameter:BaseApp/Preferences/Mod/CAM")
@@ -327,12 +332,14 @@ class TestPostProcessorFactory(unittest.TestCase):
@classmethod
def setUpClass(cls):
FreeCAD.ConfigSet("SuppressRecomputeRequiredDialog", "True")
cls.doc = FreeCAD.open(FreeCAD.getHomePath() + "/Mod/CAM/Tests/boxtest.fcstd")
cls.job = cls.doc.getObject("Job")
@classmethod
def tearDownClass(cls):
FreeCAD.closeDocument(cls.doc.Name)
FreeCAD.ConfigSet("SuppressRecomputeRequiredDialog", "")
def setUp(self):
pass
@@ -359,12 +366,14 @@ class TestPostProcessorClass(unittest.TestCase):
@classmethod
def setUpClass(cls):
FreeCAD.ConfigSet("SuppressRecomputeRequiredDialog", "True")
cls.doc = FreeCAD.open(FreeCAD.getHomePath() + "/Mod/CAM/Tests/boxtest.fcstd")
cls.job = cls.doc.getObject("Job")
@classmethod
def tearDownClass(cls):
FreeCAD.closeDocument(cls.doc.Name)
FreeCAD.ConfigSet("SuppressRecomputeRequiredDialog", "")
def setUp(self):
pass
@@ -603,8 +612,10 @@ class TestBuildPostList(unittest.TestCase):
@classmethod
def setUpClass(cls):
FreeCAD.ConfigSet("SuppressRecomputeRequiredDialog", "True")
cls.testfile = FreeCAD.getHomePath() + "Mod/CAM/Tests/test_filenaming.fcstd"
cls.doc = FreeCAD.open(cls.testfile)
FreeCAD.ConfigSet("SuppressRecomputeRequiredDialog", "")
cls.job = cls.doc.getObjectsByLabel("MainJob")[0]
@classmethod

View File

@@ -54,7 +54,9 @@ class TestPathProfile(PathTestBase):
def initClass(cls):
# Open existing FreeCAD document with test geometry
cls.needsInit = False
FreeCAD.ConfigSet("SuppressRecomputeRequiredDialog", "True")
cls.doc = FreeCAD.open(FreeCAD.getHomePath() + "Mod/CAM/Tests/test_profile.fcstd")
FreeCAD.ConfigSet("SuppressRecomputeRequiredDialog", "")
# Create Job object, adding geometry objects from file opened above
cls.job = PathJob.Create("Job", [cls.doc.Body], None)

View File

@@ -31,9 +31,11 @@ from Tests.PathTestUtils import PathTestBase
class TestPathToolController(PathTestBase):
def setUp(self):
self.doc = FreeCAD.newDocument("TestPathToolController")
FreeCAD.ConfigSet("SuppressRecomputeRequiredDialog", "True")
def tearDown(self):
FreeCAD.closeDocument(self.doc.Name)
FreeCAD.ConfigSet("SuppressRecomputeRequiredDialog", "")
def createTool(self, name="t1", diameter=1.75):
attrs = {

View File

@@ -389,10 +389,10 @@ void PropertyPartShape::Restore(Base::XMLReader &reader)
}
}
} else if(owner && !owner->getDocument()->testStatus(App::Document::PartialDoc)) {
// Toponaming 09/2024: Original code has a whole infrastructure of document parameters we aren't bring in:
// Toponaming 09/2024: Original code has an infrastructure for document parameters we aren't bringing in:
// if(App::DocumentParams::getWarnRecomputeOnRestore()) {
// However, this warning appears on all files without element maps, and is now superceded by a user dialog
// after loading that is triggered by any addRecomputeObject()
// However, this warning appeared on all files without element maps, and is now superseded by a user dialog
// after loading that is triggered by any call to addRecomputeObject()
// FC_WARN("Pending recompute for generating element map: " << owner->getFullName());
owner->getDocument()->addRecomputeObject(owner);
}

View File

@@ -34,8 +34,10 @@ FIXTURE_PATH = pathlib.Path(__file__).parent / "Fixtures"
class TestInvoluteGear(unittest.TestCase):
def setUp(self):
self.Doc = FreeCAD.newDocument("PartDesignTestInvoluteGear")
FreeCAD.ConfigSet("SuppressRecomputeRequiredDialog", "True")
def tearDown(self):
FreeCAD.ConfigSet("SuppressRecomputeRequiredDialog", "")
FreeCAD.closeDocument(self.Doc.Name)
def testDefaultGearProfile(self):

View File

@@ -29,6 +29,7 @@ App = FreeCAD
class TestMultiTransform(unittest.TestCase):
def setUp(self):
self.Doc = FreeCAD.newDocument("PartDesignTestMultiTransform")
FreeCAD.ConfigSet("SuppressRecomputeRequiredDialog", "True")
def testMultiTransform(self):
self.Body = self.Doc.addObject('PartDesign::Body','Body')
@@ -132,5 +133,6 @@ class TestMultiTransform(unittest.TestCase):
def tearDown(self):
#closing doc
FreeCAD.closeDocument("PartDesignTestMultiTransform")
FreeCAD.ConfigSet("SuppressRecomputeRequiredDialog", "")
#print ("omit closing document for debugging")