mirror of
https://github.com/wxWidgets/Phoenix.git
synced 2026-01-05 03:20:08 +01:00
Wait 300 milliseconds before tearDown to give the FlickerTLW's wx.CallLater
a chance to run, which avoids this exception:
wx/core.py, line 3096, in Notify
self.result = self.callable(*self.args, **self.kwargs)
RuntimeError: wrapped C/C++ object of type Filling has been deleted
Ensure that the Crust object's "lastsashpos" attribute is defined to avoid this exception:
wx/py/crust.py", line 150, in SaveSettings
if self.lastsashpos != -1:
AttributeError: 'Crust' object has no attribute 'lastsashpos'
This commit is contained in:
@@ -1,4 +1,5 @@
|
|||||||
import unittest
|
import unittest
|
||||||
|
import time
|
||||||
import wx
|
import wx
|
||||||
import wx.lib.mixins.inspection as wit
|
import wx.lib.mixins.inspection as wit
|
||||||
|
|
||||||
@@ -6,6 +7,26 @@ import wx.lib.mixins.inspection as wit
|
|||||||
|
|
||||||
class wit_TestCase(unittest.TestCase):
|
class wit_TestCase(unittest.TestCase):
|
||||||
|
|
||||||
|
def tearDown(self):
|
||||||
|
'''
|
||||||
|
OnClose can trigger:
|
||||||
|
AttributeError: 'Crust' object has no attribute 'lastsashpos'
|
||||||
|
so we'll ensure that the InspectionFrame's crust has that attr.
|
||||||
|
'''
|
||||||
|
windows = wx.GetTopLevelWindows()
|
||||||
|
for window in windows:
|
||||||
|
if type(window) == wx.lib.inspection.InspectionFrame:
|
||||||
|
if hasattr(window, 'crust'):
|
||||||
|
pass
|
||||||
|
if not hasattr(window.crust, 'lastsashpos'):
|
||||||
|
window.crust.lastsashpos = -1
|
||||||
|
|
||||||
|
# class _InspectionHighlighter's FlickerTLW method invokes
|
||||||
|
# wx.CallLater(300, self._Toggle, tlw),
|
||||||
|
# so let's give it a chance to run:
|
||||||
|
time.sleep(0.3)
|
||||||
|
super(wit_TestCase, self).tearDown()
|
||||||
|
|
||||||
def test_App(self):
|
def test_App(self):
|
||||||
app = wit.InspectableApp()
|
app = wit.InspectableApp()
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user