A little refactoring to share dialog closing methods

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxPython/Phoenix/trunk@71219 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Robin Dunn
2012-04-17 17:01:29 +00:00
parent d398ada042
commit 7d0c892db5
3 changed files with 14 additions and 16 deletions

View File

@@ -16,20 +16,16 @@ class aboutdlg_Tests(wtc.WidgetTestCase):
info.SetCopyright('(c) by Goofy Enterprises, Inc.')
return info
def _closeDlg(self):
for w in wx.GetTopLevelWindows():
if isinstance(w, wx.Dialog):
w.EndModal(wx.ID_OK)
def test_aboutdlgNative(self):
if not 'wxMSW' in wx.PlatformInfo():
info = self._makeInfo()
wx.CallLater(250, self._closeDlg)
wx.CallLater(25, self.closeDialogs)
wx.adv.AboutBox(info, self.frame)
def test_aboutdlgGeneric(self):
info = self._makeInfo()
wx.CallLater(250, self._closeDlg)
wx.CallLater(25, self.closeDialogs)
wx.adv.GenericAboutBox(info, self.frame)

View File

@@ -12,7 +12,7 @@ class tipdlg_Tests(wtc.WidgetTestCase):
def test_tipdlg1(self):
tp = wx.adv.CreateFileTipProvider(tipFile, 0);
wx.CallLater(25, self._closeTipDialog)
wx.CallLater(25, self.closeDialogs)
wx.adv.ShowTip(self.frame, tp)
@@ -21,16 +21,10 @@ class tipdlg_Tests(wtc.WidgetTestCase):
def GetTip(self):
return "This is my tip"
wx.CallLater(25, self._closeTipDialog)
wx.CallLater(25, self.closeDialogs)
wx.adv.ShowTip(self.frame, MyTipProvider(0))
def _closeTipDialog(self):
#self.myYield()
for w in wx.GetTopLevelWindows():
if isinstance(w, wx.Dialog):
w.EndModal(wx.ID_CANCEL)
#---------------------------------------------------------------------------

View File

@@ -47,7 +47,15 @@ class WidgetTestCase(unittest.TestCase):
window.Update()
def closeDialogs(self):
"""
Close dialogs by calling their EndModal
"""
#self.myYield()
for w in wx.GetTopLevelWindows():
if isinstance(w, wx.Dialog):
w.EndModal(wx.ID_CANCEL)
#---------------------------------------------------------------------------