From 24c20d9e25e3a0846d3fe0989cbf76e02702ddcf Mon Sep 17 00:00:00 2001 From: Robin Dunn Date: Thu, 16 Feb 2012 01:25:32 +0000 Subject: [PATCH] Add wx.EmptyBitmap for compatibility, but mark it as deprecated git-svn-id: https://svn.wxwidgets.org/svn/wx/wxPython/Phoenix/trunk@70614 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775 --- etg/bitmap.py | 9 ++++++++- unittests/test_bitmap.py | 11 +++++++++++ 2 files changed, 19 insertions(+), 1 deletion(-) diff --git a/etg/bitmap.py b/etg/bitmap.py index 63ea493e..5b740735 100644 --- a/etg/bitmap.py +++ b/etg/bitmap.py @@ -72,7 +72,14 @@ def run(): # TODO: The ctors and methods from Classic for converting to/from # buffer objects with raw bitmap access. - + + + # For compatibility: + module.addPyFunction('EmptyBitmap', '(width, height, depth=BITMAP_SCREEN_DEPTH)', + deprecated=True, + doc='A compatibility wrapper for the wx.Bitmap(width, height, depth) constructor', + body='return Bitmap(width, height, depth)') + #----------------------------------------------------------------- tools.doCommonTweaks(module) tools.runGenerators(module) diff --git a/unittests/test_bitmap.py b/unittests/test_bitmap.py index cdf63475..cc916663 100644 --- a/unittests/test_bitmap.py +++ b/unittests/test_bitmap.py @@ -23,6 +23,17 @@ class BitmapTests(wtc.WidgetTestCase): img = wx.Image(pngFile) b6 = wx.Bitmap(img) self.assertTrue( b6.IsOk() ) + + + def test_EmptyBitmapFactory(self): + # wx.EmptyBitmap is supposed to be deprecated, make sure it is. + import warnings + with warnings.catch_warnings(): + warnings.simplefilter("error") + with self.assertRaises(wx.wxPyDeprecationWarning): + b7 = wx.EmptyBitmap(5,10, 32) + self.assertTrue( b7.IsOk() ) + def test_Bitmap__nonzero__(self):