mirror of
https://github.com/wxWidgets/Phoenix.git
synced 2025-12-16 09:40:07 +01:00
Fix setting IntCtrl to None wrongly raising
This commit is contained in:
@@ -15,6 +15,13 @@ class IntCtrlTests(wtc.WidgetTestCase):
|
||||
t3.ChangeValue(16)
|
||||
self.assertTrue(not t3.IsInBounds())
|
||||
|
||||
def test_canSetValueToNone(self):
|
||||
t1 = IC.IntCtrl(self.frame, allow_none=True, value=None)
|
||||
assert t1.GetValue() is None
|
||||
t2 = IC.IntCtrl(self.frame, allow_none=True)
|
||||
t2.SetValue(None)
|
||||
assert t2.GetValue() is None
|
||||
|
||||
|
||||
#---------------------------------------------------------------------------
|
||||
|
||||
|
||||
@@ -804,10 +804,10 @@ class IntCtrl(wx.TextCtrl):
|
||||
Colors text with oob_color if current value exceeds bounds
|
||||
set for control.
|
||||
"""
|
||||
if not self.IsInBounds(value):
|
||||
self.SetForegroundColour(self.__oob_color)
|
||||
else:
|
||||
if value is None or self.IsInBounds(value):
|
||||
self.SetForegroundColour(self.__default_color)
|
||||
else:
|
||||
self.SetForegroundColour(self.__oob_color)
|
||||
self.Refresh()
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user