Test cases changes

Slight adjustment of various test cases due to various API changes.
This commit is contained in:
Zheng, Lei
2019-07-13 21:38:16 +08:00
committed by wmayer
parent 88b5b2a845
commit de93446a1c
5 changed files with 84 additions and 27 deletions

View File

@@ -492,10 +492,17 @@ class SpreadsheetCases(unittest.TestCase):
sheet.set('A52', '=+(-1 + -1)')
self.doc.addObject("Part::Cylinder", "Cylinder")
self.doc.addObject("Part::Thickness", "Pipe")
# We cannot use Thickness, as this feature requires a source shape,
# otherwise it will cause recomputation failure. The new logic of
# App::Document will not continue recompute any dependent objects
# self.doc.addObject("Part::Thickness", "Pipe")
self.doc.addObject("Part::Box", "Box")
self.doc.Box.Length = 1
sheet.set('B1', '101')
sheet.set('A53', '=-(-(B1-1)/2)')
sheet.set('A54', '=-(Cylinder.Radius + Pipe.Value - 1"/2)')
sheet.set('A54', '=-(Cylinder.Radius + Box.Length - 1"/2)')
self.doc.recompute()
self.assertEqual(sheet.getContents("A1"), "=1 < 2 ? 3 : 4")
@@ -700,8 +707,11 @@ class SpreadsheetCases(unittest.TestCase):
sheet.setAlias('B1', 'alias1')
box = self.doc.addObject('Part::Box', 'Box')
box.setExpression('Length', 'Spreadsheet.alias1')
box2 = self.doc.addObject('Part::Box', 'Box')
box2.setExpression('Length', '<<Spreadsheet>>.alias1')
sheet.Label = "Params"
self.assertEqual(box.ExpressionEngine[0][1], "Params.alias1");
self.assertEqual(box.ExpressionEngine[0][1], "Spreadsheet.alias1");
self.assertEqual(box2.ExpressionEngine[0][1], "<<Params>>.alias1");
def testAlias(self):
""" Playing with aliases """
@@ -787,11 +797,11 @@ class SpreadsheetCases(unittest.TestCase):
index=sketch.addGeometry(Part.LineSegment(v(0,0,0),v(10,10,0)),False)
sketch.addConstraint(Sketcher.Constraint('Distance',index,14.0))
self.doc.recompute()
sketch.setExpression('Constraints[0]', u'Spreadsheet.Length')
sketch.setExpression('Constraints[0]', u'<<Spreadsheet>>.Length')
self.doc.recompute()
sheet.Label="Calc"
self.doc.recompute()
self.assertEqual(sketch.ExpressionEngine[0][1],'Calc.Length')
self.assertEqual(sketch.ExpressionEngine[0][1],'<<Calc>>.Length')
self.assertIn('Up-to-date',sketch.State)
def testCrossDocumentLinks(self):