Menu.py

Go to the documentation of this file.
00001 # Menu test module  
00002 # (c) 2005 Werner Mayer
00003 #
00004 
00005 #***************************************************************************
00006 #*   (c) Werner Mayer <werner.wm.mayer@gmx.de> 2005                        *
00007 #*                                                                         *
00008 #*   This file is part of the FreeCAD CAx development system.              *
00009 #*                                                                         *
00010 #*   This program is free software; you can redistribute it and/or modify  *
00011 #*   it under the terms of the GNU Lesser General Public License (LGPL)    *
00012 #*   as published by the Free Software Foundation; either version 2 of     *
00013 #*   the License, or (at your option) any later version.                   *
00014 #*   for detail see the LICENCE text file.                                 *
00015 #*                                                                         *
00016 #*   FreeCAD is distributed in the hope that it will be useful,            *
00017 #*   but WITHOUT ANY WARRANTY; without even the implied warranty of        *
00018 #*   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the         *
00019 #*   GNU Library General Public License for more details.                  *
00020 #*                                                                         *
00021 #*   You should have received a copy of the GNU Library General Public     *
00022 #*   License along with FreeCAD; if not, write to the Free Software        *
00023 #*   Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  *
00024 #*   USA                                                                   *
00025 #*                                                                         *
00026 #*   Werner Mayer 2005                                                     *
00027 #***************************************************************************/
00028 
00029 import FreeCAD, os, unittest, FreeCADGui
00030 
00031 
00032 #---------------------------------------------------------------------------
00033 # define the functions to test the FreeCAD base code
00034 #---------------------------------------------------------------------------
00035 
00036 #def suite():
00037 #    suite = unittest.TestSuite()
00038 #    suite.addTest(DocTestCase("DocumentProperties"))
00039 #    suite.addTest(DocTestCase("DocumentLabels"))
00040 #    suite.addTest(DocTestCase("DocumentSaveAndRestore"))
00041 #    return suite
00042 
00043 
00044 class MenuCreateCases(unittest.TestCase):
00045 
00046     def setUp(self):
00047         FreeCAD.Console.PrintLog ('Setup Test menu...\n')
00048         list = ["Test_TestAll","Test_TestDoc","Test_TestBase","Test_TestWork"]
00049         w = FreeCADGui.getWorkbench('TestWorkbench')
00050         w.appendMenu("TestMenu",list)
00051 
00052     def testMenu(self):
00053         # check menu for items
00054         FreeCAD.Console.PrintLog ('Checking Test menu...\n')
00055         w = FreeCADGui.getWorkbench('TestWorkbench')
00056         list = w.listMenus()
00057         self.b = False
00058         for i in list:
00059           if i == 'TestMenu': self.b=True
00060         self.failUnless(self.b==True,"Test menu not found")
00061 
00062     def tearDown(self):
00063       if self.b == True:
00064         FreeCAD.Console.PrintLog ('Test menu successfully added\n')
00065       else:
00066         FreeCAD.Console.PrintLog ('Adding Test menu failed\n')
00067 
00068 
00069 class MenuDeleteCases(unittest.TestCase):
00070 
00071     def setUp(self):
00072         FreeCAD.Console.PrintLog ('Remove Test menu...\n')
00073         w = FreeCADGui.getWorkbench('TestWorkbench')
00074         w.removeMenu("TestMenu")
00075 
00076     def testMenu(self):
00077         # check menu for items
00078         FreeCAD.Console.PrintLog ('Checking Test menu...\n')
00079         w = FreeCADGui.getWorkbench('TestWorkbench')
00080         list = w.listMenus()
00081         self.b = True
00082         for i in list:
00083           if i == 'TestMenu': self.b=False
00084         self.failUnless(self.b==True,"Test menu still added")
00085 
00086     def tearDown(self):
00087       if self.b == True:
00088         FreeCAD.Console.PrintLog ('Test menu successfully removed\n')
00089       else:
00090         FreeCAD.Console.PrintLog ('Removing Test menu failed\n')
00091 

Generated on Wed Nov 23 19:00:22 2011 for FreeCAD by  doxygen 1.6.1