mirror of
https://github.com/wxWidgets/Phoenix.git
synced 2026-01-06 20:10:08 +01:00
* move wxPen to etg/pen.py
* move wxBrush to etg/brush.py * move wxBookCtrlBase and wxBookCtrlEvent to etg/bookctrl.py * move wxBitmapButton to etg/bmpbuttn.py * move wxArrayString MappedType and add wxArrayInt plus some unittests * add checking for default values for pos and size parameters in fixWindowClass * set out parameter flags for wxImageHistogram.FindFirstUnusedColour * Restore layout constraints classes and related methods * Create a MappedType for wxClientData * update used of wxClientData in wx.CommandEvent * Move wxControlWithItems, wxItemContainer and wxControlWithItems to etg/ctrlsub.py * enable some Append, Insert and Set overloads in wxControlWithItems * addGetterSetterProps: don't make setter-only properties * addGetterSetterProps: ensure that the getter can be called with zero args * addGetterSetterProps: ensure that the setter can be called with just 1 arg * restore version checking code * moved DC classes to other etg files to match interface file names. * allow both overloads for wx.DC.GetTextExtent and GetMultiLineTextExtent by renaming 1 * add wx.DC.GetPartialTextExtents * and some other stuff git-svn-id: https://svn.wxwidgets.org/svn/wx/wxPython/Phoenix/trunk@68975 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
@@ -21,6 +21,7 @@ if sys.version_info < (2,7):
|
||||
# The unittest2 package has back-ported most of the new features of the
|
||||
# unittest module in Python 2.7, you can get it at PyPI.
|
||||
import unittest2
|
||||
unittest = unittest2
|
||||
else:
|
||||
import unittest
|
||||
sys.modules['unittest2'] = unittest
|
||||
|
||||
@@ -39,6 +39,9 @@ class App(unittest2.TestCase):
|
||||
|
||||
def test_version(self):
|
||||
v = wx.version()
|
||||
wx.VERSION
|
||||
wx.VERSION_STRING
|
||||
wx.__version__
|
||||
|
||||
def test_PySimpleApp(self):
|
||||
# wx.PySimpleApp is supposed to be deprecated, make sure it is.
|
||||
|
||||
27
unittests/test_arrayint.py
Normal file
27
unittests/test_arrayint.py
Normal file
@@ -0,0 +1,27 @@
|
||||
import unittest2
|
||||
import wxPhoenix as wx
|
||||
|
||||
|
||||
#---------------------------------------------------------------------------
|
||||
|
||||
class ArrayInt(unittest2.TestCase):
|
||||
|
||||
if hasattr(wx, 'testArrayIntTypemap'):
|
||||
def test_ArrayStringTypemaps(self):
|
||||
# basic conversion of list or tuples of numbers
|
||||
seqList = [1,2,3,4.5,6.7]
|
||||
self.assertEqual(wx.testArrayIntTypemap(seqList), [1,2,3,4,6]) #floats are truncated to int
|
||||
seqTuple = (1,2,3,4.5,6.7)
|
||||
self.assertEqual(wx.testArrayIntTypemap(seqTuple), [1,2,3,4,6])
|
||||
|
||||
def test_ArrayIntTypemapErrors(self):
|
||||
# test error conditions
|
||||
with self.assertRaises(TypeError):
|
||||
wx.testArrayIntTypemap([1,2,3, "baditem", ["listitem"]])
|
||||
|
||||
|
||||
#---------------------------------------------------------------------------
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
unittest2.main()
|
||||
31
unittests/test_arraystring.py
Normal file
31
unittests/test_arraystring.py
Normal file
@@ -0,0 +1,31 @@
|
||||
import unittest2
|
||||
import wxPhoenix as wx
|
||||
|
||||
|
||||
#---------------------------------------------------------------------------
|
||||
|
||||
class ArrayString(unittest2.TestCase):
|
||||
|
||||
if hasattr(wx, 'testArrayStringTypemap'):
|
||||
def test_ArrayStringTypemaps(self):
|
||||
# basic conversion of list or tuples of strings
|
||||
seqList = ['a', u'b', 'hello world']
|
||||
self.assertEqual(wx.testArrayStringTypemap(seqList), seqList)
|
||||
seqTuple = ('a', u'b', 'hello world')
|
||||
self.assertEqual(wx.testArrayStringTypemap(seqTuple), list(seqTuple))
|
||||
|
||||
def test_ArrayStringTypemapErrors(self):
|
||||
# test error conditions
|
||||
with self.assertRaises(TypeError):
|
||||
wx.testArrayStringTypemap("STRING sequence")
|
||||
with self.assertRaises(TypeError):
|
||||
wx.testArrayStringTypemap(u"UNICODE sequence")
|
||||
with self.assertRaises(TypeError):
|
||||
wx.testArrayStringTypemap(["list", "with", "non-string", "items", 123])
|
||||
|
||||
|
||||
#---------------------------------------------------------------------------
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
unittest2.main()
|
||||
@@ -235,6 +235,12 @@ class Rect(unittest2.TestCase):
|
||||
|
||||
def test_xywh_ctor(self):
|
||||
r = wx.Rect(1, 2, 3, 4)
|
||||
|
||||
def test_kwargs_ctor(self):
|
||||
r1 = wx.Rect(x=1, y=2, width=3, height=4)
|
||||
r2 = wx.Rect(width=3, height=4, x=1, y=2)
|
||||
self.assertTrue(r1 == r2)
|
||||
self.assertTrue(r2 == (1,2,3,4))
|
||||
|
||||
def test_possize_ctor(self):
|
||||
r = wx.Rect(wx.Point(10,10), wx.Size(100,100))
|
||||
@@ -266,4 +272,4 @@ class Rect(unittest2.TestCase):
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
unittest2.main()
|
||||
unittest2.main()
|
||||
|
||||
Reference in New Issue
Block a user