Test: Add test to validate correct XML output of Content attribute

This commit is contained in:
wmayer
2024-07-07 11:24:50 +02:00
committed by Chris Hennes
parent 6ac5370cc4
commit fa2741fd29

View File

@@ -22,7 +22,9 @@
# ***************************************************************************/
import FreeCAD, os, unittest, tempfile
from FreeCAD import Base
import math
import xml.etree.ElementTree as ET
# ---------------------------------------------------------------------------
# define the functions to test the FreeCAD Document code
@@ -635,6 +637,18 @@ class DocumentBasicCases(unittest.TestCase):
self.assertEqual(obj.Dictionary, {"Stored data": [3, 5, 7]})
def testContent(self):
test = self.Doc.addObject("App::FeaturePython", "Python")
types = Base.TypeId.getAllDerivedFrom("App::Property")
for type in types:
try:
test.addProperty(type.Name, type.Name.replace(":", "_"))
print("Add property type: {}".format(type.Name))
except Exception as e:
pass
root = ET.fromstring(test.Content)
self.assertEqual(root.tag, "Properties")
def tearDown(self):
# closing doc
FreeCAD.closeDocument("CreateTest")