From a70f1e2c2764ea08e4c1df1f8a7cc3846cb96024 Mon Sep 17 00:00:00 2001 From: Przemo Firszt Date: Fri, 24 Jul 2015 11:26:26 +0100 Subject: [PATCH] Test, FEM: Add new analysis test Signed-off-by: Przemo Firszt --- src/Mod/Fem/App/CMakeLists.txt | 1 + src/Mod/Fem/TestFem.py | 49 ++++++++++++++++++++++++++++++++++ 2 files changed, 50 insertions(+) create mode 100644 src/Mod/Fem/TestFem.py diff --git a/src/Mod/Fem/App/CMakeLists.txt b/src/Mod/Fem/App/CMakeLists.txt index c05643b058..3966246f82 100755 --- a/src/Mod/Fem/App/CMakeLists.txt +++ b/src/Mod/Fem/App/CMakeLists.txt @@ -71,6 +71,7 @@ SET(FemScripts_SRCS convert2TetGen.py ccxFrdReader.py ccxInpWriter.py + TestFem.py FemTools.py MechanicalAnalysis.ui MechanicalAnalysis.py diff --git a/src/Mod/Fem/TestFem.py b/src/Mod/Fem/TestFem.py new file mode 100644 index 0000000000..08c378759a --- /dev/null +++ b/src/Mod/Fem/TestFem.py @@ -0,0 +1,49 @@ +# Unit test for the FEM module + +#*************************************************************************** +#* Copyright (c) 2015 - FreeCAD Developers * +#* Author: Przemo Firszt * +#* * +#* 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