mirror of
https://github.com/wxWidgets/Phoenix.git
synced 2025-12-16 09:40:07 +01:00
phoenix-port and unittest for wx.lib.stattext
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxPython/Phoenix/trunk@72064 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
26
unittests/test_lib_stattext.py
Normal file
26
unittests/test_lib_stattext.py
Normal file
@@ -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()
|
||||
@@ -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()
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user