Files
Phoenix/unittests/test_app.py
Robin Dunn 4219e02440 * move wxPen to etg/pen.py
* move wxBrush to etg/brush.py
* move wxBookCtrlBase and wxBookCtrlEvent to etg/bookctrl.py
* move wxBitmapButton to etg/bmpbuttn.py
* move wxArrayString MappedType and add wxArrayInt plus some unittests
* add checking for default values for pos and size parameters in fixWindowClass
* set out parameter flags for wxImageHistogram.FindFirstUnusedColour
* Restore layout constraints classes and related methods
* Create a MappedType for wxClientData
* update used of wxClientData in wx.CommandEvent
* Move wxControlWithItems, wxItemContainer and wxControlWithItems to etg/ctrlsub.py
* enable some Append, Insert and Set overloads in wxControlWithItems
* addGetterSetterProps: don't make setter-only properties
* addGetterSetterProps: ensure that the getter can be called with zero args
* addGetterSetterProps: ensure that the setter can be called with just 1 arg
* restore version checking code
* moved DC classes to other etg files to match interface file names.
* allow both overloads for wx.DC.GetTextExtent and GetMultiLineTextExtent by renaming 1
* add wx.DC.GetPartialTextExtents
* and some other stuff

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxPython/Phoenix/trunk@68975 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
2011-09-03 01:42:42 +00:00

75 lines
2.2 KiB
Python

import unittest2
import wxPhoenix as wx
##import os; print 'PID:', os.getpid(); raw_input('Ready to start, press enter...')
import warnings
#---------------------------------------------------------------------------
class App(unittest2.TestCase):
def test_App(self):
app = wx.App()
def test_App_OnInit(self):
class MyApp(wx.App):
def OnInit(self):
self.onInit_called = True
return True
app = MyApp()
self.assertTrue(app.onInit_called)
if 0:
def test_App_OnExit(self):
class MyApp(wx.App):
def OnInit(self):
self.onExit_called = False
self.f = wx.Frame(None)
self.f.Bind(wx.EVT_IDLE, self.OnIdle)
self.f.Show()
return True
def OnIdle(self, evt):
self.f.Close()
def OnExit(self):
self.onExit_called = True
return 0
app = MyApp()
app.MainLoop()
self.assertTrue(app.onExit_called)
def test_version(self):
v = wx.version()
wx.VERSION
wx.VERSION_STRING
wx.__version__
def test_PySimpleApp(self):
# wx.PySimpleApp is supposed to be deprecated, make sure it is.
with warnings.catch_warnings():
warnings.simplefilter("error")
with self.assertRaises(DeprecationWarning):
app = wx.PySimpleApp()
def test_CallAfter(self):
class MyApp(wx.App):
def OnInit(self):
self.callAfter_called = False
self.frame = wx.Frame(None, title="testing CallAfter")
self.frame.Show()
wx.CallAfter(self.doAfter, 1, 2, 3)
return True
def doAfter(self, a, b, c):
self.callAfter_called = True
self.frame.Close()
app = MyApp()
app.MainLoop()
self.assertTrue(app.callAfter_called)
#---------------------------------------------------------------------------
if __name__ == '__main__':
unittest2.main()