mirror of
https://github.com/wxWidgets/Phoenix.git
synced 2026-01-04 19:10:09 +01:00
- add a simple unittest
- force __allow_long to True on Py3
This commit is contained in:
23
unittests/test_lib_intctrl.py
Normal file
23
unittests/test_lib_intctrl.py
Normal file
@@ -0,0 +1,23 @@
|
||||
import imp_unittest, unittest
|
||||
import wtc
|
||||
import wx
|
||||
import wx.lib.intctrl as IC
|
||||
|
||||
#---------------------------------------------------------------------------
|
||||
|
||||
|
||||
class IntCtrlTests(wtc.WidgetTestCase):
|
||||
|
||||
def test_intctrlCtor(self):
|
||||
t1 = IC.IntCtrl(self.frame)
|
||||
t2 = IC.IntCtrl(self.frame, -1, 10)
|
||||
t3 = IC.IntCtrl(self.frame, value=32, min=32, max=72)
|
||||
t3.ChangeValue(16)
|
||||
self.assertTrue(not t3.IsInBounds())
|
||||
|
||||
|
||||
#---------------------------------------------------------------------------
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
unittest.main()
|
||||
@@ -4,7 +4,7 @@
|
||||
# Created: 01/16/2003
|
||||
# Copyright: (c) 2003 by Will Sadkin
|
||||
# License: wxWindows license
|
||||
# Tags: phoenix-port, py3-port
|
||||
# Tags: phoenix-port, py3-port, unittest
|
||||
#----------------------------------------------------------------------------
|
||||
# NOTE:
|
||||
# This was written to provide a standard integer edit control for wxPython.
|
||||
@@ -443,7 +443,10 @@ class IntCtrl(wx.TextCtrl):
|
||||
self.__default_color = wx.BLACK
|
||||
self.__oob_color = wx.RED
|
||||
self.__allow_none = 0
|
||||
self.__allow_long = 0
|
||||
if six.PY2:
|
||||
self.__allow_long = 0
|
||||
else:
|
||||
self.__allow_long = 1
|
||||
self.__oldvalue = None
|
||||
|
||||
if validator == wx.DefaultValidator:
|
||||
@@ -462,7 +465,10 @@ class IntCtrl(wx.TextCtrl):
|
||||
self.SetLimited(limited)
|
||||
self.SetColors(default_color, oob_color)
|
||||
self.SetNoneAllowed(allow_none)
|
||||
self.SetLongAllowed(allow_long)
|
||||
if six.PY2:
|
||||
self.SetLongAllowed(allow_long)
|
||||
else:
|
||||
self.SetLongAllowed(1)
|
||||
self.SetValue(value)
|
||||
self.__oldvalue = 0
|
||||
|
||||
|
||||
Reference in New Issue
Block a user