mirror of
https://github.com/wxWidgets/Phoenix.git
synced 2026-01-05 03:20:08 +01:00
Add wx.ModalDialogHook
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxPython/Phoenix/trunk@74117 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
34
unittests/test_modalhook.py
Normal file
34
unittests/test_modalhook.py
Normal file
@@ -0,0 +1,34 @@
|
||||
import imp_unittest, unittest
|
||||
import wtc
|
||||
import wx
|
||||
|
||||
#---------------------------------------------------------------------------
|
||||
|
||||
class modalhook_Tests(wtc.WidgetTestCase):
|
||||
|
||||
def test_modalhook1(self):
|
||||
class MyModalDialogHook(wx.ModalDialogHook):
|
||||
def __init__(self):
|
||||
wx.ModalDialogHook.__init__(self)
|
||||
self.counter = 0
|
||||
|
||||
def Enter(self, dialog):
|
||||
self.counter += 1
|
||||
return wx.ID_OK
|
||||
|
||||
def Exit(self, dialog):
|
||||
self.counter += 1 # not called because Enter didn't return wx.ID_NONE
|
||||
|
||||
myHook = MyModalDialogHook()
|
||||
myHook.Register()
|
||||
|
||||
wx.MessageBox("This should be auto-dismissed...", style=wx.OK|wx.CANCEL)
|
||||
self.assertEqual(myHook.counter, 1)
|
||||
|
||||
myHook.Unregister()
|
||||
|
||||
|
||||
#---------------------------------------------------------------------------
|
||||
|
||||
if __name__ == '__main__':
|
||||
unittest.main()
|
||||
Reference in New Issue
Block a user