Spreadsheet: [skip ci] issue #6840/#6844: add unit test

This commit is contained in:
wmayer
2022-05-08 21:29:56 +02:00
parent 24b6f06015
commit c1c06f4ccb

View File

@@ -1228,7 +1228,7 @@ class SpreadsheetCases(unittest.TestCase):
self.assertEqual(ss2.get("A3"), 4)
self.assertEqual(ss2.get("A4"), 4)
def testIssue6840(self):
def testIssue6844(self):
body = self.doc.addObject("App::FeaturePython", "Body")
body.addProperty("App::PropertyEnumeration", "Configuration")
body.Configuration = ["Item1", "Item2", "Item3"]
@@ -1247,6 +1247,23 @@ class SpreadsheetCases(unittest.TestCase):
self.doc.removeObject("Body")
sheet.clearAll()
def testIssue6840(self):
body = self.doc.addObject("App::FeaturePython", "Body")
body.addProperty("App::PropertyEnumeration", "Configuration")
body.Configuration = ["Item1", "Item2", "Item3"]
sheet = self.doc.addObject("Spreadsheet::Sheet", "Sheet")
sheet.addProperty("App::PropertyString", "A2")
sheet.A2 = "Item2"
sheet.addProperty("App::PropertyEnumeration", "body")
sheet.body = ["Item1", "Item2", "Item3"]
sheet.setExpression(".body.Enum", "cells[<<A2:|>>]")
sheet.setExpression(".cells.Bind.B1.ZZ1", "tuple(.cells; <<B>> + str(hiddenref(Body.Configuration) + 2); <<ZZ>> + str(hiddenref(Body.Configuration) + 2))")
self.doc.recompute()
self.doc.clearDocument()
def tearDown(self):
#closing doc
FreeCAD.closeDocument(self.doc.Name)