Test, FEM: Add new analysis test

Signed-off-by: Przemo Firszt <przemo@firszt.eu>
This commit is contained in:
Przemo Firszt
2015-07-24 11:26:26 +01:00
parent aaf1495fde
commit a70f1e2c27
2 changed files with 50 additions and 0 deletions

View File

@@ -71,6 +71,7 @@ SET(FemScripts_SRCS
convert2TetGen.py
ccxFrdReader.py
ccxInpWriter.py
TestFem.py
FemTools.py
MechanicalAnalysis.ui
MechanicalAnalysis.py

49
src/Mod/Fem/TestFem.py Normal file
View File

@@ -0,0 +1,49 @@
# Unit test for the FEM module
#***************************************************************************
#* Copyright (c) 2015 - FreeCAD Developers *
#* Author: Przemo Firszt <przemo@firszt.eu> *
#* *
#* This file is part of the FreeCAD CAx development system. *
#* *
#* 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. *
#* *
#* FreeCAD 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 FreeCAD; if not, write to the Free Software *
#* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 *
#* USA *
#* *
#***************************************************************************/
import FreeCAD
import unittest
class FemTest(unittest.TestCase):
def setUp(self):
try:
FreeCAD.setActiveDocument("FemTest")
except:
FreeCAD.newDocument("FemTest")
finally:
FreeCAD.setActiveDocument("FemTest")
def test_new_analysis(self):
FreeCAD.Console.PrintMessage('\nChecking FEM new analysis...\n')
import MechanicalAnalysis
analysis = MechanicalAnalysis.makeMechanicalAnalysis('MechanicalAnalysis')
self.failUnless(analysis, "FemTest of new analysis failed")
def tearDown(self):
FreeCAD.closeDocument("FemTest")
pass