Fix test script to match new code

Fix nullptr bug revealed by bad test script!
This commit is contained in:
WandererFan 2016-10-28 19:33:45 -04:00 committed by Yorik van Havre
parent 83d657985c
commit 73aea7140d
2 changed files with 9 additions and 3 deletions

View File

@ -150,7 +150,9 @@ void DrawViewSection::onChanged(const App::Property* prop)
}
if (prop == &SectionOrigin) {
App::DocumentObject* base = BaseView.getValue();
base->touch();
if (base != nullptr) {
base->touch();
}
}
}
DrawView::onChanged(prop);

View File

@ -47,9 +47,13 @@ class TechDrawTestCases(unittest.TestCase):
self.Anno = self.Doc.addObject('TechDraw::DrawViewAnnotation','TestAnno')
rc = self.Page.addView(self.Anno)
self.Sect = self.Doc.addObject('TechDraw::DrawViewSection','Section')
rc = self.Page.addView(self.Sect)
self.Sect.SectionOrigin = (1.0,1.0,1.0)
self.Sect.Source = self.Box
self.Sect.Direction = FreeCAD.Vector(-1.0,0.0,0.0)
self.Sect.BaseView = self.View
self.Sect.SectionDirection = "Right"
self.Sect.SectionOrigin = FreeCAD.Vector(1.0,1.0,1.0)
self.Sect.SectionNormal = FreeCAD.Vector(-1.0,0.0,0.0)
rc = self.Page.addView(self.Sect)
self.Doc.recompute()
self.failUnless(len(self.Page.Views) == 3)