home *** CD-ROM | disk | FTP | other *** search
/ Maximum CD 2009 June / maximum-cd-2009-06.iso / DiscContents / digsby_setup.exe / lib / tests / unittests / menutests.pyo (.txt) < prev    next >
Encoding:
Python Compiled Bytecode  |  2009-02-26  |  1.6 KB  |  48 lines

  1. # Source Generated with Decompyle++
  2. # File: in.pyo (Python 2.5)
  3.  
  4. import unittest
  5. import util
  6. import struct
  7. import actionIDs
  8. import time
  9. import sys
  10. import wx
  11. popupActions = [
  12.     actionIDs.ShowBuddyList,
  13.     actionIDs.ShowMenuBar,
  14.     actionIDs.SetStatus,
  15.     actionIDs.SetStatusCustom]
  16.  
  17. class MenubarTestingSuite(unittest.TestCase):
  18.     
  19.     def setUp(self):
  20.         wx.GetApp().testing = True
  21.  
  22.     
  23.     def tearDown(self):
  24.         wx.GetApp().testing = False
  25.  
  26.     
  27.     def testHandlers(self):
  28.         app = wx.GetApp()
  29.         for action in dir(actionIDs):
  30.             app.event_fired = None
  31.             if action.startswith('__'):
  32.                 continue
  33.             
  34.             id = getattr(actionIDs, action, -1)
  35.             self.assert_(action != -1)
  36.             if isinstance(id, int) and not (id == wx.ID_EXIT) and id not in popupActions:
  37.                 print 'Firing handler for id=%r' % id
  38.                 app.fire_event_for_action(id)
  39.                 time.sleep(0.1)
  40.                 self.assert_(app.event_fired, 'No event fired for action %s' % action)
  41.                 continue
  42.         
  43.  
  44.  
  45. if __name__ == '__main__':
  46.     unittest.main()
  47.  
  48.