mirror of
https://github.com/wxWidgets/Phoenix.git
synced 2026-03-15 21:20:07 +01:00
unittest updates and new test modules
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxPython/Phoenix/trunk@69095 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
10
unittests/imp_unittest.py
Normal file
10
unittests/imp_unittest.py
Normal file
@@ -0,0 +1,10 @@
|
||||
import sys
|
||||
|
||||
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
|
||||
sys.modules['unittest'] = unittest2
|
||||
|
||||
else:
|
||||
import unittest
|
||||
@@ -18,15 +18,8 @@ print "wx.version:", wx.version()
|
||||
print "pid:", os.getpid()
|
||||
#print "executable:", sys.executable; raw_input("Press Enter...")
|
||||
|
||||
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
|
||||
|
||||
import imp_unittest, unittest
|
||||
|
||||
args = sys.argv[:1] + 'discover -p test_*.py -s unittests -t .'.split() + sys.argv[1:]
|
||||
unittest.main( argv=args )
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import unittest2
|
||||
import imp_unittest, unittest
|
||||
import wx
|
||||
##import os; print 'PID:', os.getpid(); raw_input('Ready to start, press enter...')
|
||||
|
||||
@@ -6,7 +6,7 @@ import warnings
|
||||
|
||||
#---------------------------------------------------------------------------
|
||||
|
||||
class App(unittest2.TestCase):
|
||||
class App(unittest.TestCase):
|
||||
|
||||
def test_App(self):
|
||||
app = wx.App()
|
||||
@@ -47,7 +47,7 @@ class App(unittest2.TestCase):
|
||||
# wx.PySimpleApp is supposed to be deprecated, make sure it is.
|
||||
with warnings.catch_warnings():
|
||||
warnings.simplefilter("error")
|
||||
with self.assertRaises(DeprecationWarning):
|
||||
with self.assertRaises(wx.wxPyDeprecationWarning):
|
||||
app = wx.PySimpleApp()
|
||||
|
||||
|
||||
@@ -71,4 +71,4 @@ class App(unittest2.TestCase):
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
unittest2.main()
|
||||
unittest.main()
|
||||
|
||||
24
unittests/test_apptraits.py
Normal file
24
unittests/test_apptraits.py
Normal file
@@ -0,0 +1,24 @@
|
||||
import imp_unittest, unittest
|
||||
import wtc
|
||||
import wx
|
||||
|
||||
#---------------------------------------------------------------------------
|
||||
|
||||
class AppTraitsTests(wtc.WidgetTestCase):
|
||||
|
||||
def test_AppTraits(self):
|
||||
t = self.app.GetTraits()
|
||||
self.assertTrue(t is not None)
|
||||
|
||||
v = t.GetToolkitVersion()
|
||||
self.assertTrue( len(v) == 3)
|
||||
|
||||
t.HasStderr()
|
||||
t.IsUsingUniversalWidgets()
|
||||
|
||||
|
||||
#---------------------------------------------------------------------------
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
unittest.main()
|
||||
@@ -1,13 +1,13 @@
|
||||
import unittest2
|
||||
import imp_unittest, unittest
|
||||
import wx
|
||||
|
||||
|
||||
#---------------------------------------------------------------------------
|
||||
|
||||
class ArrayInt(unittest2.TestCase):
|
||||
class ArrayInt(unittest.TestCase):
|
||||
|
||||
if hasattr(wx, 'testArrayIntTypemap'):
|
||||
def test_ArrayStringTypemaps(self):
|
||||
def test_ArrayIntTypemaps(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
|
||||
@@ -24,4 +24,4 @@ class ArrayInt(unittest2.TestCase):
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
unittest2.main()
|
||||
unittest.main()
|
||||
|
||||
@@ -1,10 +1,10 @@
|
||||
import unittest2
|
||||
import imp_unittest, unittest
|
||||
import wx
|
||||
|
||||
|
||||
#---------------------------------------------------------------------------
|
||||
|
||||
class ArrayString(unittest2.TestCase):
|
||||
class ArrayString(unittest.TestCase):
|
||||
|
||||
if hasattr(wx, 'testArrayStringTypemap'):
|
||||
def test_ArrayStringTypemaps(self):
|
||||
@@ -28,4 +28,4 @@ class ArrayString(unittest2.TestCase):
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
unittest2.main()
|
||||
unittest.main()
|
||||
|
||||
70
unittests/test_bitmap.py
Normal file
70
unittests/test_bitmap.py
Normal file
@@ -0,0 +1,70 @@
|
||||
import imp_unittest, unittest
|
||||
import wtc
|
||||
import wx
|
||||
import os
|
||||
|
||||
pngFile = os.path.join(os.path.dirname(__file__), 'toucan.png')
|
||||
|
||||
#---------------------------------------------------------------------------
|
||||
|
||||
class BitmapTests(wtc.WidgetTestCase):
|
||||
|
||||
def test_BitmapCtors(self):
|
||||
b1 = wx.Bitmap()
|
||||
self.assertTrue( not b1.IsOk() )
|
||||
b2 = wx.Bitmap(5, 10, 32)
|
||||
self.assertTrue( b2.IsOk() )
|
||||
b3 = wx.Bitmap(wx.Size(5,10), 32)
|
||||
self.assertTrue( b3.IsOk() )
|
||||
b4 = wx.Bitmap((5,10), 32)
|
||||
self.assertTrue( b4.IsOk() )
|
||||
b5 = wx.Bitmap(pngFile)
|
||||
self.assertTrue( b5.IsOk() )
|
||||
img = wx.Image(pngFile)
|
||||
b6 = wx.Bitmap(img)
|
||||
self.assertTrue( b6.IsOk() )
|
||||
|
||||
|
||||
def test_Bitmap__nonzero__(self):
|
||||
b1 = wx.Bitmap()
|
||||
self.assertTrue( not b1.IsOk() )
|
||||
b2 = wx.Bitmap(5, 10, 24)
|
||||
self.assertTrue( b2.IsOk() )
|
||||
self.assertTrue( b2.__nonzero__() == b2.IsOk() )
|
||||
|
||||
# check that the __nonzero__ method can be used with if satements
|
||||
nzcheck = False
|
||||
if b2:
|
||||
nzcheck = True
|
||||
self.assertTrue(nzcheck)
|
||||
nzcheck = False
|
||||
if not b1:
|
||||
nzcheck = True
|
||||
self.assertTrue(nzcheck)
|
||||
|
||||
|
||||
def test_BitmapNullBitmap(self):
|
||||
# just make sure this one exists
|
||||
wx.NullBitmap
|
||||
self.assertTrue(not wx.NullBitmap.IsOk())
|
||||
|
||||
|
||||
def test_BitmapSetMaskColour(self):
|
||||
b5 = wx.Bitmap(pngFile)
|
||||
b5.SetMaskColour(wx.Colour(1,2,3))
|
||||
b5.SetMaskColour('black')
|
||||
|
||||
|
||||
def test_BitmapMask(self):
|
||||
b5 = wx.Bitmap(pngFile)
|
||||
m = wx.Mask()
|
||||
m = wx.Mask(b5, 4)
|
||||
m = wx.Mask(b5)
|
||||
m = wx.Mask(b5, wx.Colour(1,2,3))
|
||||
|
||||
|
||||
#---------------------------------------------------------------------------
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
unittest.main()
|
||||
28
unittests/test_bmpbuttn.py
Normal file
28
unittests/test_bmpbuttn.py
Normal file
@@ -0,0 +1,28 @@
|
||||
import imp_unittest, unittest
|
||||
import wtc
|
||||
import wx
|
||||
import os
|
||||
|
||||
pngFile = os.path.join(os.path.dirname(__file__), 'toucan.png')
|
||||
|
||||
#---------------------------------------------------------------------------
|
||||
|
||||
class BitmapButtonTests(wtc.WidgetTestCase):
|
||||
|
||||
def test_BitmapButtonCtor(self):
|
||||
bmp = wx.Bitmap(pngFile)
|
||||
btn = wx.BitmapButton(self.frame, -1, bmp)
|
||||
|
||||
|
||||
def test_BitmapButtonDefaultCtor(self):
|
||||
bmp = wx.Bitmap(pngFile)
|
||||
btn = wx.BitmapButton()
|
||||
btn.Create(self.frame, -1, bmp)
|
||||
|
||||
|
||||
|
||||
#---------------------------------------------------------------------------
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
unittest.main()
|
||||
36
unittests/test_brush.py
Normal file
36
unittests/test_brush.py
Normal file
@@ -0,0 +1,36 @@
|
||||
import imp_unittest, unittest
|
||||
import wtc
|
||||
import wx
|
||||
import os
|
||||
|
||||
pngFile = os.path.join(os.path.dirname(__file__), 'toucan.png')
|
||||
|
||||
#---------------------------------------------------------------------------
|
||||
|
||||
class BrushTests(wtc.WidgetTestCase):
|
||||
|
||||
def test_BrushCtors(self):
|
||||
b = wx.Brush()
|
||||
b = wx.Brush(wx.Colour(1,2,3), wx.BRUSHSTYLE_SOLID)
|
||||
bmp = wx.Bitmap(pngFile)
|
||||
b = wx.Brush(bmp)
|
||||
copy = wx.Brush(b)
|
||||
|
||||
|
||||
def test_BrushOperators(self):
|
||||
b1 = wx.Brush(wx.Colour(1,2,3), wx.BRUSHSTYLE_SOLID)
|
||||
b2 = wx.Brush(wx.Colour(1,2,3), wx.BRUSHSTYLE_SOLID)
|
||||
b3 = wx.Brush(wx.Colour(4,5,6), wx.BRUSHSTYLE_SOLID)
|
||||
|
||||
self.assertTrue(b1 == b2)
|
||||
self.assertTrue(b2 != b3)
|
||||
self.assertFalse(b1 != b2)
|
||||
self.assertFalse(b2 == b3)
|
||||
|
||||
|
||||
|
||||
#---------------------------------------------------------------------------
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
unittest.main()
|
||||
43
unittests/test_button.py
Normal file
43
unittests/test_button.py
Normal file
@@ -0,0 +1,43 @@
|
||||
import imp_unittest, unittest
|
||||
import wtc
|
||||
import wx
|
||||
import os
|
||||
|
||||
pngFile = os.path.join(os.path.dirname(__file__), 'toucan.png')
|
||||
|
||||
#---------------------------------------------------------------------------
|
||||
|
||||
class ButtonTests(wtc.WidgetTestCase):
|
||||
|
||||
def test_ButtonCtors(self):
|
||||
btn = wx.Button(self.frame, label='label')
|
||||
btn = wx.Button(self.frame, -1, 'label', (10,10), (100,-1), wx.BU_LEFT)
|
||||
bmp = wx.Bitmap(pngFile)
|
||||
btn.SetBitmap(bmp)
|
||||
|
||||
def test_ButtonProperties(self):
|
||||
btn = wx.Button(self.frame, label='label')
|
||||
|
||||
# do the properties exist?
|
||||
btn.AuthNeeded
|
||||
btn.Bitmap
|
||||
btn.BitmapCurrent
|
||||
btn.BitmapDisabled
|
||||
btn.BitmapFocus
|
||||
btn.BitmapLabel
|
||||
btn.BitmapMargins
|
||||
btn.BitmapPressed
|
||||
btn.Label
|
||||
|
||||
|
||||
def test_ButtonDefaultCtor(self):
|
||||
btn = wx.Button()
|
||||
btn.Create(self.frame, -1, 'button label')
|
||||
|
||||
|
||||
|
||||
#---------------------------------------------------------------------------
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
unittest.main()
|
||||
37
unittests/test_choice.py
Normal file
37
unittests/test_choice.py
Normal file
@@ -0,0 +1,37 @@
|
||||
import imp_unittest, unittest
|
||||
import wtc
|
||||
import wx
|
||||
|
||||
#---------------------------------------------------------------------------
|
||||
|
||||
class ChoiceTests(wtc.WidgetTestCase):
|
||||
|
||||
def test_ChoiceCtors(self):
|
||||
c = wx.Choice(self.frame, choices="one two three four".split())
|
||||
c = wx.Choice(self.frame, -1, wx.Point(10,10), wx.Size(80,-1),
|
||||
"one two three four".split(), 0)
|
||||
c = wx.Choice(self.frame, -1, (10,10), (80,-1), "one two three four".split(), 0)
|
||||
|
||||
self.assertTrue(c.GetCount() == 4)
|
||||
|
||||
|
||||
def test_ChoiceDefaultCtor(self):
|
||||
c = wx.Choice()
|
||||
c.Create(self.frame, choices="one two three four".split())
|
||||
|
||||
|
||||
def test_ChoiceProperties(self):
|
||||
c = wx.Choice(self.frame, choices="one two three four".split())
|
||||
|
||||
# do the properties exist?
|
||||
c.Columns
|
||||
c.Count
|
||||
c.CurrentSelection
|
||||
c.Selection
|
||||
|
||||
|
||||
#---------------------------------------------------------------------------
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
unittest.main()
|
||||
35
unittests/test_collpane.py
Normal file
35
unittests/test_collpane.py
Normal file
@@ -0,0 +1,35 @@
|
||||
import imp_unittest, unittest
|
||||
import wtc
|
||||
import wx
|
||||
|
||||
#---------------------------------------------------------------------------
|
||||
|
||||
class CollapsiblePaneTests(wtc.WidgetTestCase):
|
||||
|
||||
def test_CollPaneCtors(self):
|
||||
c = wx.CollapsiblePane(self.frame, label='label')
|
||||
c = wx.CollapsiblePane(self.frame, -1, 'label', (12, 34), (45, 67))
|
||||
|
||||
c.Collapse()
|
||||
c.Expand()
|
||||
c.IsCollapsed()
|
||||
c.IsExpanded()
|
||||
|
||||
|
||||
def test_CollPaneDefaultCtor(self):
|
||||
c = wx.CollapsiblePane()
|
||||
c.Create(self.frame)
|
||||
|
||||
|
||||
def test_CollPaneProperties(self):
|
||||
c = wx.CollapsiblePane(self.frame)
|
||||
|
||||
# do the properties exist?
|
||||
c.Pane
|
||||
|
||||
|
||||
#---------------------------------------------------------------------------
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
unittest.main()
|
||||
@@ -1,10 +1,10 @@
|
||||
import unittest2
|
||||
import imp_unittest, unittest
|
||||
import wx
|
||||
|
||||
|
||||
#---------------------------------------------------------------------------
|
||||
|
||||
class Colour(unittest2.TestCase):
|
||||
class Colour(unittest.TestCase):
|
||||
def setUp(self):
|
||||
if hasattr(wx, 'InitializeStockLists'):
|
||||
wx.InitializeStockLists() # switch to wx.App once we have that class working
|
||||
@@ -52,4 +52,4 @@ class Colour(unittest2.TestCase):
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
unittest2.main()
|
||||
unittest.main()
|
||||
|
||||
@@ -1,10 +1,10 @@
|
||||
import unittest2
|
||||
import imp_unittest, unittest
|
||||
import wx
|
||||
|
||||
|
||||
#---------------------------------------------------------------------------
|
||||
|
||||
class Events(unittest2.TestCase):
|
||||
class Events(unittest.TestCase):
|
||||
|
||||
# Test the constructors to make sure the classes are not abstract, except
|
||||
# for wx.Event
|
||||
@@ -144,4 +144,4 @@ class Events(unittest2.TestCase):
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
unittest2.main()
|
||||
unittest.main()
|
||||
|
||||
@@ -1,10 +1,10 @@
|
||||
import unittest2
|
||||
import imp_unittest, unittest
|
||||
import wx
|
||||
|
||||
|
||||
#---------------------------------------------------------------------------
|
||||
|
||||
class Point(unittest2.TestCase):
|
||||
class Point(unittest.TestCase):
|
||||
|
||||
def test_default_ctor(self):
|
||||
p = wx.Point()
|
||||
@@ -86,7 +86,7 @@ class Point(unittest2.TestCase):
|
||||
#---------------------------------------------------------------------------
|
||||
|
||||
|
||||
class Size(unittest2.TestCase):
|
||||
class Size(unittest.TestCase):
|
||||
|
||||
def test_default_ctor(self):
|
||||
s = wx.Size()
|
||||
@@ -203,7 +203,7 @@ class Size(unittest2.TestCase):
|
||||
#---------------------------------------------------------------------------
|
||||
|
||||
|
||||
class RealPoint(unittest2.TestCase):
|
||||
class RealPoint(unittest.TestCase):
|
||||
|
||||
def test_default_ctor(self):
|
||||
p = wx.RealPoint()
|
||||
@@ -228,7 +228,7 @@ class RealPoint(unittest2.TestCase):
|
||||
|
||||
#---------------------------------------------------------------------------
|
||||
|
||||
class Rect(unittest2.TestCase):
|
||||
class Rect(unittest.TestCase):
|
||||
|
||||
def test_default_ctor(self):
|
||||
r = wx.Rect()
|
||||
@@ -272,4 +272,4 @@ class Rect(unittest2.TestCase):
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
unittest2.main()
|
||||
unittest.main()
|
||||
|
||||
@@ -1,10 +1,10 @@
|
||||
import unittest2
|
||||
import imp_unittest, unittest
|
||||
import wx
|
||||
|
||||
|
||||
#---------------------------------------------------------------------------
|
||||
|
||||
class Point2D(unittest2.TestCase):
|
||||
class Point2D(unittest.TestCase):
|
||||
|
||||
def test_default_ctor(self):
|
||||
p = wx.Point2D()
|
||||
@@ -21,7 +21,7 @@ class Point2D(unittest2.TestCase):
|
||||
|
||||
|
||||
|
||||
class Rect2D(unittest2.TestCase):
|
||||
class Rect2D(unittest.TestCase):
|
||||
|
||||
def test_default_ctor(self):
|
||||
r = wx.Rect2D()
|
||||
@@ -42,5 +42,5 @@ class Rect2D(unittest2.TestCase):
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
unittest2.main()
|
||||
unittest.main()
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
import unittest2
|
||||
import imp_unittest, unittest
|
||||
import wx
|
||||
|
||||
#---------------------------------------------------------------------------
|
||||
|
||||
class MouseState(unittest2.TestCase):
|
||||
class MouseState(unittest.TestCase):
|
||||
|
||||
def test_MouseState(self):
|
||||
ms = wx.MouseState()
|
||||
@@ -28,4 +28,4 @@ class MouseState(unittest2.TestCase):
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
unittest2.main()
|
||||
unittest.main()
|
||||
|
||||
@@ -1,11 +1,11 @@
|
||||
import sys
|
||||
import unittest2
|
||||
import imp_unittest, unittest
|
||||
import wx
|
||||
##import os; print 'PID:', os.getpid(); raw_input('Ready to start, press enter...')
|
||||
|
||||
#---------------------------------------------------------------------------
|
||||
|
||||
class PyEvents(unittest2.TestCase):
|
||||
class PyEvents(unittest.TestCase):
|
||||
|
||||
def test_PyEvent(self):
|
||||
id = wx.NewId()
|
||||
@@ -97,4 +97,4 @@ class PyEvents(unittest2.TestCase):
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
unittest2.main()
|
||||
unittest.main()
|
||||
|
||||
@@ -1,10 +1,10 @@
|
||||
|
||||
import unittest2
|
||||
import imp_unittest, unittest
|
||||
import wx
|
||||
|
||||
#---------------------------------------------------------------------------
|
||||
|
||||
class String(unittest2.TestCase):
|
||||
class String(unittest.TestCase):
|
||||
|
||||
if hasattr(wx, 'testStringTypemap'):
|
||||
def test_StringTypemaps(self):
|
||||
@@ -59,4 +59,4 @@ class String(unittest2.TestCase):
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
unittest2.main()
|
||||
unittest.main()
|
||||
|
||||
84
unittests/test_window.py
Normal file
84
unittests/test_window.py
Normal file
@@ -0,0 +1,84 @@
|
||||
import imp_unittest, unittest
|
||||
import wtc
|
||||
import wx
|
||||
|
||||
#---------------------------------------------------------------------------
|
||||
|
||||
class WindowTests(wtc.WidgetTestCase):
|
||||
|
||||
def test_SimpleWindowCtor(self):
|
||||
w = wx.Window(self.frame, -1, (10,10), (50,50),
|
||||
wx.BORDER_SIMPLE|wx.VSCROLL)
|
||||
self.assertTrue(w.GetWindowStyle() == wx.BORDER_SIMPLE|wx.VSCROLL)
|
||||
self.assertTrue(w.Parent is self.frame)
|
||||
|
||||
# Just test that these properties exist for now. More tests can be
|
||||
# added later to ensure that they work correctly.
|
||||
w.AcceleratorTable
|
||||
w.AutoLayout
|
||||
w.BackgroundColour
|
||||
w.BackgroundStyle
|
||||
w.EffectiveMinSize
|
||||
w.BestSize
|
||||
w.BestVirtualSize
|
||||
w.Border
|
||||
w.Caret
|
||||
w.CharHeight
|
||||
w.CharWidth
|
||||
w.Children
|
||||
w.ClientAreaOrigin
|
||||
w.ClientRect
|
||||
w.ClientSize
|
||||
w.Constraints
|
||||
w.ContainingSizer
|
||||
w.Cursor
|
||||
w.DefaultAttributes
|
||||
w.DropTarget
|
||||
w.EventHandler
|
||||
w.ExtraStyle
|
||||
w.Font
|
||||
w.ForegroundColour
|
||||
w.GrandParent
|
||||
w.TopLevelParent
|
||||
w.Handle
|
||||
w.HelpText
|
||||
w.Id
|
||||
w.Label
|
||||
w.LayoutDirection
|
||||
w.MaxHeight
|
||||
w.MaxSize
|
||||
w.MaxWidth
|
||||
w.MinHeight
|
||||
w.MinSize
|
||||
w.MinWidth
|
||||
w.Name
|
||||
w.Parent
|
||||
w.Position
|
||||
w.Rect
|
||||
w.ScreenPosition
|
||||
w.ScreenRect
|
||||
w.Size
|
||||
w.Sizer
|
||||
w.ThemeEnabled
|
||||
w.ToolTip
|
||||
w.UpdateClientRect
|
||||
w.UpdateRegion
|
||||
w.Validator
|
||||
w.VirtualSize
|
||||
w.WindowStyle
|
||||
w.WindowStyleFlag
|
||||
w.WindowVariant
|
||||
w.Shown
|
||||
w.Enabled
|
||||
w.TopLevel
|
||||
w.MinClientSize
|
||||
w.MaxClientSize
|
||||
|
||||
|
||||
|
||||
|
||||
#---------------------------------------------------------------------------
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
unittest.main()
|
||||
21
unittests/test_windowid.py
Normal file
21
unittests/test_windowid.py
Normal file
@@ -0,0 +1,21 @@
|
||||
import imp_unittest, unittest
|
||||
import wx
|
||||
|
||||
|
||||
#---------------------------------------------------------------------------
|
||||
|
||||
class IdManagerTest(unittest.TestCase):
|
||||
|
||||
def test_idManager(self):
|
||||
id = wx.IdManager.ReserveId(5)
|
||||
self.assertTrue(id != wx.ID_NONE)
|
||||
|
||||
wx.IdManager.UnreserveId(id, 5)
|
||||
|
||||
|
||||
|
||||
#---------------------------------------------------------------------------
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
unittest.main()
|
||||
@@ -1,11 +1,11 @@
|
||||
import sys
|
||||
import unittest2
|
||||
import imp_unittest, unittest
|
||||
import wx
|
||||
##import os; print 'PID:', os.getpid(); raw_input('Ready to start, press enter...')
|
||||
|
||||
#---------------------------------------------------------------------------
|
||||
|
||||
class WindowList(unittest2.TestCase):
|
||||
class WindowList(unittest.TestCase):
|
||||
def setUp(self):
|
||||
self.app = wx.App()
|
||||
self.frames = list()
|
||||
@@ -44,4 +44,4 @@ class WindowList(unittest2.TestCase):
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
unittest2.main()
|
||||
unittest.main()
|
||||
|
||||
BIN
unittests/toucan.png
Normal file
BIN
unittests/toucan.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 21 KiB |
25
unittests/wtc.py
Normal file
25
unittests/wtc.py
Normal file
@@ -0,0 +1,25 @@
|
||||
import imp_unittest, unittest
|
||||
import wx
|
||||
|
||||
#---------------------------------------------------------------------------
|
||||
|
||||
class WidgetTestCase(unittest.TestCase):
|
||||
"""
|
||||
A testcase that will create an app and frame for various widget test
|
||||
modules to use. They can inherit from this class to save some work. This
|
||||
is also good for test cases that need to have an application object
|
||||
created.
|
||||
"""
|
||||
def setUp(self):
|
||||
self.app = wx.App()
|
||||
self.frame = wx.Frame(None, title='WTC: '+self.__class__.__name__)
|
||||
self.frame.Show()
|
||||
|
||||
def tearDown(self):
|
||||
wx.CallAfter(self.frame.Close)
|
||||
self.app.MainLoop()
|
||||
del self.app
|
||||
|
||||
#---------------------------------------------------------------------------
|
||||
|
||||
|
||||
Reference in New Issue
Block a user