Files
FreeCAD/src/Mod/PartDesign/PartDesignTests/TestShapeBinder.py
T

51 lines
2.6 KiB
Python

#***************************************************************************
#* Copyright (c) 2011 Juergen Riegel <FreeCAD@juergen-riegel.net> *
#* *
#* This program is free software; you can redistribute it and/or modify *
#* it under the terms of the GNU Lesser General Public License (LGPL) *
#* as published by the Free Software Foundation; either version 2 of *
#* the License, or (at your option) any later version. *
#* for detail see the LICENCE text file. *
#* *
#* This program is distributed in the hope that it will be useful, *
#* but WITHOUT ANY WARRANTY; without even the implied warranty of *
#* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
#* GNU Library General Public License for more details. *
#* *
#* You should have received a copy of the GNU Library General Public *
#* License along with this program; if not, write to the Free Software *
#* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 *
#* USA *
#* *
#***************************************************************************
import unittest
import FreeCAD
class TestShapeBinder(unittest.TestCase):
def setUp(self):
self.Doc = FreeCAD.newDocument("PartDesignTestShapeBinder")
def testTwoBodyShapeBinderCase(self):
self.Body = self.Doc.addObject('PartDesign::Body','Body')
self.Box = self.Doc.addObject('PartDesign::AdditiveBox','Box')
self.Box.Length=1
self.Box.Width=1
self.Box.Height=1
self.Body.addObject(self.Box)
self.Doc.recompute()
self.Body001 = self.Doc.addObject('PartDesign::Body','Body001')
self.ShapeBinder = self.Doc.addObject('PartDesign::ShapeBinder','ShapeBinder')
self.ShapeBinder.Support = [(self.Box, 'Face1')]
self.Body001.addObject(self.ShapeBinder)
self.Doc.recompute()
self.assertIn('Box', self.ShapeBinder.OutList[0].Label)
self.assertIn('Body001', self.ShapeBinder.InList[0].Label)
def tearDown(self):
#closing doc
FreeCAD.closeDocument("PartDesignTestShapeBinder")
#print ("omit closing document for debugging")