Skip to content

Commit

Permalink
Merge pull request wxWidgets#2071 from swt2c/test_fixes_2021
Browse files Browse the repository at this point in the history
Fix a bunch of test issues on GTK and OSX, plus a few non-test bugs
  • Loading branch information
swt2c authored Jan 9, 2022
2 parents 2236943 + d6beca1 commit 43ad05a
Show file tree
Hide file tree
Showing 26 changed files with 242 additions and 226 deletions.
3 changes: 3 additions & 0 deletions etg/grid.py
Original file line number Diff line number Diff line change
Expand Up @@ -690,6 +690,7 @@ def fixEditorClass(name):
EVT_GRID_LABEL_RIGHT_DCLICK = wx.PyEventBinder( wxEVT_GRID_LABEL_RIGHT_DCLICK )
EVT_GRID_ROW_SIZE = wx.PyEventBinder( wxEVT_GRID_ROW_SIZE )
EVT_GRID_COL_SIZE = wx.PyEventBinder( wxEVT_GRID_COL_SIZE )
EVT_GRID_COL_AUTO_SIZE = wx.PyEventBinder( wxEVT_GRID_COL_AUTO_SIZE )
EVT_GRID_RANGE_SELECTING = wx.PyEventBinder( wxEVT_GRID_RANGE_SELECTING )
EVT_GRID_RANGE_SELECTED = wx.PyEventBinder( wxEVT_GRID_RANGE_SELECTED )
EVT_GRID_CELL_CHANGING = wx.PyEventBinder( wxEVT_GRID_CELL_CHANGING )
Expand All @@ -714,6 +715,7 @@ def fixEditorClass(name):
EVT_GRID_CMD_LABEL_RIGHT_DCLICK = wx.PyEventBinder( wxEVT_GRID_LABEL_RIGHT_DCLICK, 1 )
EVT_GRID_CMD_ROW_SIZE = wx.PyEventBinder( wxEVT_GRID_ROW_SIZE, 1 )
EVT_GRID_CMD_COL_SIZE = wx.PyEventBinder( wxEVT_GRID_COL_SIZE, 1 )
EVT_GRID_CMD_COL_AUTO_SIZE = wx.PyEventBinder( wxEVT_GRID_COL_AUTO_SIZE, 1 )
EVT_GRID_CMD_RANGE_SELECTING = wx.PyEventBinder( wxEVT_GRID_RANGE_SELECTING, 1 )
EVT_GRID_CMD_RANGE_SELECTED = wx.PyEventBinder( wxEVT_GRID_RANGE_SELECTED, 1 )
EVT_GRID_CMD_CELL_CHANGING = wx.PyEventBinder( wxEVT_GRID_CELL_CHANGING, 1 )
Expand All @@ -730,6 +732,7 @@ def fixEditorClass(name):
# Just for compatibility, remove them in a future release
EVT_GRID_RANGE_SELECT = EVT_GRID_RANGE_SELECTED
EVT_GRID_CMD_RANGE_SELECT = EVT_GRID_CMD_RANGE_SELECTED
wxEVT_GRID_RANGE_SELECT = wxEVT_GRID_RANGE_SELECTED
""")

Expand Down
1 change: 1 addition & 0 deletions etg/notifmsg.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ def run():

c = module.find('wxNotificationMessage')
assert isinstance(c, etgtools.ClassDef)
c.mustHaveApp()

# take care of some methods only available on MSW
c.find('UseTaskBarIcon').setCppCode("""\
Expand Down
2 changes: 1 addition & 1 deletion unittests/test_cmndata.py
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ def test_nonzero(self):
def test_PD_PaperSize(self):
pd = wx.PrintData()
pd.GetPaperSize()
pd.SetPaperSize( wx.Size(8.5*300, 11*300) )
pd.SetPaperSize( wx.Size(int(8.5*300), 11*300) )
pd.PaperSize


Expand Down
4 changes: 2 additions & 2 deletions unittests/test_filectrl.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ def test_filectrl4(self):
defaultDirectory=os.path.dirname(__file__),
defaultFilename=os.path.basename(__file__),
style=wx.FC_OPEN)
self.waitFor(100)
self.waitFor(300)

self.assertEqual(fc.GetFilename(), os.path.basename(__file__))
self.assertEqual(fc.GetPath(), os.path.abspath(__file__))
Expand All @@ -50,7 +50,7 @@ def test_filectrl5(self):
defaultDirectory=os.path.dirname(__file__),
defaultFilename=os.path.basename(__file__),
style=wx.FC_OPEN|wx.FC_MULTIPLE)
self.waitFor(100)
self.waitFor(300)

self.assertEqual(fc.GetFilenames(), [os.path.basename(__file__)])
self.assertEqual(fc.GetPaths(), [os.path.abspath(__file__)])
Expand Down
9 changes: 6 additions & 3 deletions unittests/test_frame.py
Original file line number Diff line number Diff line change
Expand Up @@ -54,10 +54,13 @@ def test_frameRestore(self):
f = wx.Frame(self.frame, title="Title", pos=(50,50), size=(100,100))
f.Show()
f.Maximize()
self.myYield()
self.waitFor(100)
assert f.IsMaximized()
f.Restore()
self.myYield()
if 'wxGTK' in wx.PlatformInfo:
f.Maximize(False)
else:
f.Restore()
self.waitFor(100)
assert not f.IsMaximized()
f.Close()

Expand Down
1 change: 1 addition & 0 deletions unittests/test_gdicmn.py
Original file line number Diff line number Diff line change
Expand Up @@ -328,6 +328,7 @@ def test_properties(self):
p.y += 2


@unittest.skip("Fails: https://github.com/wxWidgets/Phoenix/issues/2070")
def test_GetIM(self):
# Test the immutable version returned by GetIM
obj = wx.RealPoint(1,2)
Expand Down
2 changes: 1 addition & 1 deletion unittests/test_glcanvas.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ def test_glcanvas2(self):


def test_glcanvas3(self):
attribs = [wx.glcanvas.WX_GL_DEPTH_SIZE, 32,
attribs = [wx.glcanvas.WX_GL_DEPTH_SIZE, 24,
wx.glcanvas.WX_GL_DOUBLEBUFFER,
0]
cvs = wx.glcanvas.GLCanvas(self.frame, attribList=attribs)
Expand Down
1 change: 1 addition & 0 deletions unittests/test_graphics.py
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ def OnPaint(self, evt):

panel = MyPanel(self.frame)
self.myUpdate(panel)
self.waitFor(100)
self.assertTrue(panel.painted)
self.assertTrue(panel.gcIsOk)

Expand Down
6 changes: 6 additions & 0 deletions unittests/test_grid.py
Original file line number Diff line number Diff line change
Expand Up @@ -250,7 +250,10 @@ def test_grid39(self):
wx.grid.wxEVT_GRID_LABEL_RIGHT_DCLICK
wx.grid.wxEVT_GRID_ROW_SIZE
wx.grid.wxEVT_GRID_COL_SIZE
wx.grid.wxEVT_GRID_COL_AUTO_SIZE
wx.grid.wxEVT_GRID_RANGE_SELECT
wx.grid.wxEVT_GRID_RANGE_SELECTING
wx.grid.wxEVT_GRID_RANGE_SELECTED
wx.grid.wxEVT_GRID_CELL_CHANGING
wx.grid.wxEVT_GRID_CELL_CHANGED
wx.grid.wxEVT_GRID_SELECT_CELL
Expand All @@ -273,7 +276,10 @@ def test_grid40(self):
wx.grid.EVT_GRID_LABEL_RIGHT_DCLICK
wx.grid.EVT_GRID_ROW_SIZE
wx.grid.EVT_GRID_COL_SIZE
wx.grid.EVT_GRID_COL_AUTO_SIZE
wx.grid.EVT_GRID_RANGE_SELECT
wx.grid.EVT_GRID_RANGE_SELECTING
wx.grid.EVT_GRID_RANGE_SELECTED
wx.grid.EVT_GRID_CELL_CHANGING
wx.grid.EVT_GRID_CELL_CHANGED
wx.grid.EVT_GRID_SELECT_CELL
Expand Down
4 changes: 2 additions & 2 deletions unittests/test_intl.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,8 @@ def test_intlLocale(self):
def test_intlGetString(self):
# This tests if we're able to pull translations from the wx message catalogs
loc = wx.Locale(wx.LANGUAGE_SPANISH)
st = loc.GetString('Next')
self.assertEqual(st, 'Siguiente')
st = loc.GetString('&Next')
self.assertEqual(st, '&Siguiente')


def test_intlConstants(self):
Expand Down
11 changes: 6 additions & 5 deletions unittests/test_lib_agw_thumbnailctrl.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
from unittests import wtc
import wx

import wx.lib.agw.scrolledthumbnail as ST
import wx.lib.agw.thumbnailctrl as TNC

#---------------------------------------------------------------------------
Expand All @@ -12,11 +13,11 @@ def test_lib_agw_thumbnailctrlCtor(self):
tnc = TNC.ThumbnailCtrl(self.frame, -1, imagehandler=TNC.NativeImageHandler)

def test_lib_agw_thumbnailctrlEvents(self):
TNC.EVT_THUMBNAILS_CAPTION_CHANGED
TNC.EVT_THUMBNAILS_DCLICK
TNC.EVT_THUMBNAILS_POINTED
TNC.EVT_THUMBNAILS_SEL_CHANGED
TNC.EVT_THUMBNAILS_THUMB_CHANGED
ST.EVT_THUMBNAILS_SEL_CHANGED
ST.EVT_THUMBNAILS_POINTED
ST.EVT_THUMBNAILS_DCLICK
ST.EVT_THUMBNAILS_THUMB_CHANGED
ST.EVT_THUMBNAILS_CHAR

#---------------------------------------------------------------------------

Expand Down
Loading

0 comments on commit 43ad05a

Please sign in to comment.