def test_femobjects_open_head(self): fcc_print("load master head document objects") # get a document with all FEM objects self.document = create_all_fem_objects_doc(self.document) # save and load the document file_path = join(tempfile.gettempdir(), "all_objects_head.FCStd") self.document.saveAs(file_path) FreeCAD.closeDocument(self.document.Name) self.document = FreeCAD.open(file_path) # FeaturePythons view provider self.compare_feature_pythons_class_gui(self.document)
def test_femobjects_open_de9b3fb438(self): # migration modules do not import on Python 2 thus this can not work if sys.version_info.major < 3: return # the number in method name is the FreeCAD commit the document was created with # https://github.com/FreeCAD/FreeCAD/commit/de9b3fb438 # the document was created by running the object create unit test # FreeCAD --run-test "femtest.app.test_object.TestObjectCreate.test_femobjects_make" fcc_print("load old document objects") FreeCAD.closeDocument( self.document.Name) # close the empty document from setUp first self.document = FreeCAD.open( join(self.test_file_dir, "all_objects_de9b3fb438.FCStd")) # FeaturePythons view provider self.compare_feature_pythons_class_gui(self.document)
def test_femobjects_open_de9b3fb438(self): # the number in method name is the FreeCAD commit the document was created with # https://github.com/FreeCAD/FreeCAD/commit/de9b3fb438 # the document was created by running the object create unit test # FreeCAD --run-test "femtest.app.test_object.TestObjectCreate.test_femobjects_make" fcc_print("load old document objects") FreeCAD.closeDocument( self.document.Name) # close the empty document from setUp first self.document = FreeCAD.open( join(self.test_file_dir, "all_objects_de9b3fb438.FCStd")) # FeaturePythons view provider self.compare_feature_pythons_class_gui(self.document) # standard name changed from femsolver.elmer.equations.flux import ViewProxy self.assertEqual(ViewProxy, self.document.Fluxsolver.ViewObject.Proxy.__class__)
def test_femobjects_open_head(self): fcc_print("load master head document objects") # get a document with all FEM objects self.document = create_all_fem_objects_doc(self.document) # save and load the document file_path = join(tempfile.gettempdir(), "all_objects_head.FCStd") self.document.saveAs(file_path) FreeCAD.closeDocument(self.document.Name) self.document = FreeCAD.open(file_path) # FeaturePythons view provider self.compare_feature_pythons_class_gui(self.document) # standard name changed from femsolver.elmer.equations.flux import ViewProxy self.assertEqual(ViewProxy, self.document.Flux.ViewObject.Proxy.__class__)
def test_00print(self): # since method name starts with 00 this will be run first # this test just prints a line with stars fcc_print("\n{0}\n{1} run FEM TestObjectOpen tests {2}\n{0}".format( 100 * "*", 10 * "*", 60 * "*"))
class TestObjectOpen(unittest.TestCase): fcc_print("import TestObjectOpen") # ******************************************************************************************** def setUp(self): # setUp is executed before every test doc_name = self.__class__.__name__ self.document = FreeCAD.newDocument(doc_name) self.test_file_dir = join(testtools.get_fem_test_home_dir(), "open") # ******************************************************************************************** def tearDown(self): # tearDown is executed after every test FreeCAD.closeDocument(self.document.Name) # ******************************************************************************************** def test_00print(self): # since method name starts with 00 this will be run first # this test just prints a line with stars fcc_print("\n{0}\n{1} run FEM TestObjectOpen tests {2}\n{0}".format( 100 * "*", 10 * "*", 60 * "*")) # ******************************************************************************************** def test_femobjects_open_head(self): fcc_print("load master head document objects") # get a document with all FEM objects self.document = create_all_fem_objects_doc(self.document) # save and load the document file_path = join(tempfile.gettempdir(), "all_objects_head.FCStd") self.document.saveAs(file_path) FreeCAD.closeDocument(self.document.Name) self.document = FreeCAD.open(file_path) # FeaturePythons view provider self.compare_feature_pythons_class_gui(self.document) # standard name changed from femsolver.elmer.equations.flux import ViewProxy self.assertEqual(ViewProxy, self.document.Flux.ViewObject.Proxy.__class__) # ******************************************************************************************** def test_femobjects_open_de9b3fb438(self): # the number in method name is the FreeCAD commit the document was created with # https://github.com/FreeCAD/FreeCAD/commit/de9b3fb438 # the document was created by running the object create unit test # FreeCAD --run-test "femtest.app.test_object.TestObjectCreate.test_femobjects_make" fcc_print("load old document objects") FreeCAD.closeDocument( self.document.Name) # close the empty document from setUp first self.document = FreeCAD.open( join(self.test_file_dir, "all_objects_de9b3fb438.FCStd")) # FeaturePythons view provider self.compare_feature_pythons_class_gui(self.document) # standard name changed from femsolver.elmer.equations.flux import ViewProxy self.assertEqual(ViewProxy, self.document.Fluxsolver.ViewObject.Proxy.__class__) # ******************************************************************************************** def compare_feature_pythons_class_gui(self, doc): # see comments at file end, the code was created by some python code from femviewprovider.view_constraint_bodyheatsource import VPConstraintBodyHeatSource self.assertEqual( VPConstraintBodyHeatSource, doc.ConstraintBodyHeatSource.ViewObject.Proxy.__class__) from femviewprovider.view_constraint_electrostaticpotential \ import VPConstraintElectroStaticPotential self.assertEqual( VPConstraintElectroStaticPotential, doc.ConstraintElectrostaticPotential.ViewObject.Proxy.__class__) from femviewprovider.view_constraint_flowvelocity import VPConstraintFlowVelocity self.assertEqual(VPConstraintFlowVelocity, doc.ConstraintFlowVelocity.ViewObject.Proxy.__class__) from femviewprovider.view_constraint_initialflowvelocity \ import VPConstraintInitialFlowVelocity self.assertEqual( VPConstraintInitialFlowVelocity, doc.ConstraintInitialFlowVelocity.ViewObject.Proxy.__class__) from femviewprovider.view_constraint_selfweight import VPConstraintSelfWeight self.assertEqual(VPConstraintSelfWeight, doc.ConstraintSelfWeight.ViewObject.Proxy.__class__) from femviewprovider.view_constraint_tie import VPConstraintTie self.assertEqual(VPConstraintTie, doc.ConstraintTie.ViewObject.Proxy.__class__) from femviewprovider.view_element_fluid1D import VPElementFluid1D self.assertEqual(VPElementFluid1D, doc.ElementFluid1D.ViewObject.Proxy.__class__) from femviewprovider.view_element_geometry1D import VPElementGeometry1D self.assertEqual(VPElementGeometry1D, doc.ElementGeometry1D.ViewObject.Proxy.__class__) from femviewprovider.view_element_geometry2D import VPElementGeometry2D self.assertEqual(VPElementGeometry2D, doc.ElementGeometry2D.ViewObject.Proxy.__class__) from femviewprovider.view_element_rotation1D import VPElementRotation1D self.assertEqual(VPElementRotation1D, doc.ElementRotation1D.ViewObject.Proxy.__class__) from femviewprovider.view_material_common import VPMaterialCommon self.assertEqual(VPMaterialCommon, doc.MaterialFluid.ViewObject.Proxy.__class__) from femviewprovider.view_material_common import VPMaterialCommon self.assertEqual(VPMaterialCommon, doc.MaterialSolid.ViewObject.Proxy.__class__) from femviewprovider.view_material_mechanicalnonlinear import VPMaterialMechanicalNonlinear self.assertEqual( VPMaterialMechanicalNonlinear, doc.MaterialMechanicalNonlinear.ViewObject.Proxy.__class__) from femviewprovider.view_material_reinforced import VPMaterialReinforced self.assertEqual(VPMaterialReinforced, doc.MaterialReinforced.ViewObject.Proxy.__class__) from femviewprovider.view_mesh_gmsh import VPMeshGmsh self.assertEqual(VPMeshGmsh, doc.MeshGmsh.ViewObject.Proxy.__class__) from femviewprovider.view_mesh_boundarylayer import VPMeshBoundaryLayer self.assertEqual(VPMeshBoundaryLayer, doc.MeshBoundaryLayer.ViewObject.Proxy.__class__) from femviewprovider.view_mesh_group import VPMeshGroup self.assertEqual(VPMeshGroup, doc.MeshGroup.ViewObject.Proxy.__class__) from femviewprovider.view_mesh_region import VPMeshRegion self.assertEqual(VPMeshRegion, doc.MeshRegion.ViewObject.Proxy.__class__) from femviewprovider.view_mesh_result import VPFemMeshResult self.assertEqual(VPFemMeshResult, doc.MeshResult.ViewObject.Proxy.__class__) from femviewprovider.view_result_mechanical import VPResultMechanical self.assertEqual(VPResultMechanical, doc.ResultMechanical.ViewObject.Proxy.__class__) from femviewprovider.view_solver_ccxtools import VPSolverCcxTools self.assertEqual(VPSolverCcxTools, doc.SolverCcxTools.ViewObject.Proxy.__class__) from femsolver.calculix.solver import ViewProxy self.assertEqual(ViewProxy, doc.SolverCalculix.ViewObject.Proxy.__class__) from femsolver.elmer.solver import ViewProxy self.assertEqual(ViewProxy, doc.SolverElmer.ViewObject.Proxy.__class__) from femsolver.z88.solver import ViewProxy self.assertEqual(ViewProxy, doc.SolverZ88.ViewObject.Proxy.__class__) from femsolver.elmer.equations.elasticity import ViewProxy self.assertEqual(ViewProxy, doc.Elasticity.ViewObject.Proxy.__class__) from femsolver.elmer.equations.electrostatic import ViewProxy self.assertEqual(ViewProxy, doc.Electrostatic.ViewObject.Proxy.__class__) from femsolver.elmer.equations.flow import ViewProxy self.assertEqual(ViewProxy, doc.Flow.ViewObject.Proxy.__class__) from femsolver.elmer.equations.heat import ViewProxy self.assertEqual(ViewProxy, doc.Heat.ViewObject.Proxy.__class__)