Menu.py
Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029 import FreeCAD, os, unittest, FreeCADGui
00030
00031
00032
00033
00034
00035
00036
00037
00038
00039
00040
00041
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
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
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