diff --git a/unittests/test_lib_stattext.py b/unittests/test_lib_stattext.py new file mode 100644 index 00000000..b79c124d --- /dev/null +++ b/unittests/test_lib_stattext.py @@ -0,0 +1,26 @@ +import imp_unittest, unittest +import wtc +import wx +import wx.lib.stattext + +#--------------------------------------------------------------------------- + +class lib_stattext_Tests(wtc.WidgetTestCase): + + def test_lib_stattext1(self): + pnl = wx.Panel(self.frame) + w = wx.lib.stattext.GenStaticText(pnl, label="This is a test", pos=(10,10)) + bs1 = w.GetEffectiveMinSize() + + w.SetLabel("This is a New Label") + w.SetFont(wx.FFont(16, wx.FONTFAMILY_ROMAN)) + bs2 = w.GetEffectiveMinSize() + + self.assertEqual(w.GetLabel(), "This is a New Label") + self.assertEqual(w.Label, "This is a New Label") + self.assertTrue(bs2.height > bs1.height) + +#--------------------------------------------------------------------------- + +if __name__ == '__main__': + unittest.main() diff --git a/wx/lib/stattext.py b/wx/lib/stattext.py index 076a996e..08da4434 100644 --- a/wx/lib/stattext.py +++ b/wx/lib/stattext.py @@ -7,9 +7,9 @@ # Author: Robin Dunn # # Created: 8-July-2002 -# RCS-ID: $Id$ # Copyright: (c) 2002 by Total Control Software # Licence: wxWindows license +# Tags: phoenix-port, unittest #---------------------------------------------------------------------- # 12/12/2003 - Jeff Grimmett (grimmtooth@softhome.net) # @@ -27,17 +27,17 @@ if wx.Platform == "__WXMAC__": #---------------------------------------------------------------------- -class GenStaticText(wx.PyControl): +class GenStaticText(wx.Control): labelDelta = 1 def __init__(self, parent, ID=-1, label="", pos=wx.DefaultPosition, size=wx.DefaultSize, style=0, name="genstattext"): - wx.PyControl.__init__(self, parent, ID, pos, size, style|wx.NO_BORDER, + wx.Control.__init__(self, parent, ID, pos, size, style|wx.NO_BORDER, wx.DefaultValidator, name) - wx.PyControl.SetLabel(self, label) # don't check wx.ST_NO_AUTORESIZE yet + wx.Control.SetLabel(self, label) # don't check wx.ST_NO_AUTORESIZE yet self.InheritAttributes() self.SetInitialSize(size) @@ -55,7 +55,7 @@ class GenStaticText(wx.PyControl): Sets the static text label and updates the control's size to exactly fit the label unless the control has wx.ST_NO_AUTORESIZE flag. """ - wx.PyControl.SetLabel(self, label) + wx.Control.SetLabel(self, label) style = self.GetWindowStyleFlag() self.InvalidateBestSize() if not style & wx.ST_NO_AUTORESIZE: @@ -68,7 +68,7 @@ class GenStaticText(wx.PyControl): Sets the static text font and updates the control's size to exactly fit the label unless the control has wx.ST_NO_AUTORESIZE flag. """ - wx.PyControl.SetFont(self, font) + wx.Control.SetFont(self, font) style = self.GetWindowStyleFlag() self.InvalidateBestSize() if not style & wx.ST_NO_AUTORESIZE: @@ -103,15 +103,13 @@ class GenStaticText(wx.PyControl): def Enable(self, enable=True): """Overridden Enable() method to properly refresh the widget. """ - - wx.PyControl.Enable(self, enable) + wx.Control.Enable(self, enable) self.Refresh() def Disable(self): """Overridden Disable() method to properly refresh the widget. """ - - wx.PyControl.Disable(self) + wx.Control.Disable(self) self.Refresh()