From de9b3fb4384ae333c91038e8ff3f79df9987a40a Mon Sep 17 00:00:00 2001 From: Bernd Hahnebach Date: Thu, 21 May 2020 23:54:12 +0200 Subject: [PATCH] FEM: unit test open doc obj, small improvements --- src/Mod/Fem/femtest/app/test_open.py | 24 +++++++++++++++--------- 1 file changed, 15 insertions(+), 9 deletions(-) diff --git a/src/Mod/Fem/femtest/app/test_open.py b/src/Mod/Fem/femtest/app/test_open.py index 335dea6266..1f99e84f54 100644 --- a/src/Mod/Fem/femtest/app/test_open.py +++ b/src/Mod/Fem/femtest/app/test_open.py @@ -77,19 +77,31 @@ class TestObjectOpen(unittest.TestCase): def test_femobjects_open_head( self ): - # FreeCAD --run-test "femtest.app.test_object.TestObjectCreate.test_femobjects_make" fcc_print("load master head document objects") + + # get a document with all FEM objects from .test_object import create_all_fem_objects_doc doc = create_all_fem_objects_doc(self.document) - # todo save and load the document + # save and load the document file_path = join(tempfile.gettempdir(), "all_objects_head.FCStd") doc.saveAs(file_path) self.document = FreeCAD.open(file_path) + # C++ objects + self.compare_cpp_objs(doc) + # FeaturePythons objects + self.compare_feature_pythons_class_app(doc) + # FeaturePythons view provider + self.compare_feature_pythons_class_gui(doc) + + # ******************************************************************************************** + def compare_cpp_objs( + self, + doc + ): from femtools.femutils import type_of_obj - # C++ objects self.assertEqual( "Fem::FemAnalysis", type_of_obj(doc.Analysis) @@ -98,12 +110,6 @@ class TestObjectOpen(unittest.TestCase): # Is just checking the type sufficient? # If there is a type there is at least a object with correct type ;-) - # FeaturePythons - # objects - self.compare_feature_pythons_class_app(doc) - # view provider - self.compare_feature_pythons_class_gui(doc) - # ******************************************************************************************** def compare_feature_pythons_class_app( self,