mirror of
https://github.com/wxWidgets/Phoenix.git
synced 2026-01-05 03:20:08 +01:00
Trim trailing space unittests directory
This commit is contained in:
@@ -22,7 +22,7 @@ class test_import_export_no_change2:
|
|||||||
Sub topic 1 of root topic. Docs rely on one blank line for
|
Sub topic 1 of root topic. Docs rely on one blank line for
|
||||||
topic doc, and indentation for each argument doc.
|
topic doc, and indentation for each argument doc.
|
||||||
"""
|
"""
|
||||||
|
|
||||||
def msgDataSpec(arg1, arg2=None):
|
def msgDataSpec(arg1, arg2=None):
|
||||||
"""
|
"""
|
||||||
- arg1: some multiline doc
|
- arg1: some multiline doc
|
||||||
|
|||||||
@@ -1,14 +1,14 @@
|
|||||||
class root_topic1:
|
class root_topic1:
|
||||||
'docs for root_topic1'
|
'docs for root_topic1'
|
||||||
|
|
||||||
def msgDataSpec():
|
def msgDataSpec():
|
||||||
pass
|
pass
|
||||||
|
|
||||||
class sub_topic11:
|
class sub_topic11:
|
||||||
'docs for sub_topic11'
|
'docs for sub_topic11'
|
||||||
|
|
||||||
class root_topic2:
|
class root_topic2:
|
||||||
'docs for root_topic2'
|
'docs for root_topic2'
|
||||||
|
|
||||||
class sub_topic21:
|
class sub_topic21:
|
||||||
'docs for sub_topic21'
|
'docs for sub_topic21'
|
||||||
|
|||||||
@@ -5,5 +5,5 @@ if '--stdout' in sys.argv:
|
|||||||
if '--echo' in sys.argv:
|
if '--echo' in sys.argv:
|
||||||
text = raw_input()
|
text = raw_input()
|
||||||
print("I read '%s'" % text)
|
print("I read '%s'" % text)
|
||||||
|
|
||||||
sys.exit(0)
|
sys.exit(0)
|
||||||
|
|||||||
@@ -15,9 +15,9 @@ class aboutdlg_Tests(wtc.WidgetTestCase):
|
|||||||
info.SetDescription('This is a very goofy application')
|
info.SetDescription('This is a very goofy application')
|
||||||
info.SetCopyright('(c) by Goofy Enterprises, Inc.')
|
info.SetCopyright('(c) by Goofy Enterprises, Inc.')
|
||||||
info.SetLicence('free-for-all')
|
info.SetLicence('free-for-all')
|
||||||
return info
|
return info
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
def test_aboutdlgNative(self):
|
def test_aboutdlgNative(self):
|
||||||
if not 'wxMSW' in wx.PlatformInfo:
|
if not 'wxMSW' in wx.PlatformInfo:
|
||||||
info = self._makeInfo()
|
info = self._makeInfo()
|
||||||
|
|||||||
@@ -6,7 +6,7 @@ import wx
|
|||||||
|
|
||||||
class accel_Tests(wtc.WidgetTestCase):
|
class accel_Tests(wtc.WidgetTestCase):
|
||||||
|
|
||||||
|
|
||||||
def test_accelFlags(self):
|
def test_accelFlags(self):
|
||||||
wx.ACCEL_ALT
|
wx.ACCEL_ALT
|
||||||
wx.ACCEL_CTRL
|
wx.ACCEL_CTRL
|
||||||
@@ -18,7 +18,7 @@ class accel_Tests(wtc.WidgetTestCase):
|
|||||||
def test_accelNullObj(self):
|
def test_accelNullObj(self):
|
||||||
wx.NullAcceleratorTable
|
wx.NullAcceleratorTable
|
||||||
self.assertTrue( not wx.NullAcceleratorTable.IsOk() )
|
self.assertTrue( not wx.NullAcceleratorTable.IsOk() )
|
||||||
|
|
||||||
|
|
||||||
def test_accelEntry1(self):
|
def test_accelEntry1(self):
|
||||||
entry = wx.AcceleratorEntry(wx.ACCEL_CTRL, ord('A'), 123)
|
entry = wx.AcceleratorEntry(wx.ACCEL_CTRL, ord('A'), 123)
|
||||||
@@ -26,16 +26,16 @@ class accel_Tests(wtc.WidgetTestCase):
|
|||||||
self.assertTrue(entry.GetFlags() == wx.ACCEL_CTRL)
|
self.assertTrue(entry.GetFlags() == wx.ACCEL_CTRL)
|
||||||
self.assertTrue(entry.GetKeyCode() == ord('A'))
|
self.assertTrue(entry.GetKeyCode() == ord('A'))
|
||||||
self.assertTrue(entry.GetCommand() == 123)
|
self.assertTrue(entry.GetCommand() == 123)
|
||||||
|
|
||||||
def test_accelEntry2(self):
|
def test_accelEntry2(self):
|
||||||
entry = wx.AcceleratorEntry(wx.ACCEL_CTRL, ord('A'), 123)
|
entry = wx.AcceleratorEntry(wx.ACCEL_CTRL, ord('A'), 123)
|
||||||
self.assertTrue(entry.IsOk())
|
self.assertTrue(entry.IsOk())
|
||||||
self.assertTrue(entry.Flags == wx.ACCEL_CTRL)
|
self.assertTrue(entry.Flags == wx.ACCEL_CTRL)
|
||||||
self.assertTrue(entry.KeyCode == ord('A'))
|
self.assertTrue(entry.KeyCode == ord('A'))
|
||||||
self.assertTrue(entry.Command == 123)
|
self.assertTrue(entry.Command == 123)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
def test_accelTable1(self):
|
def test_accelTable1(self):
|
||||||
tbl = wx.AcceleratorTable([ wx.AcceleratorEntry(wx.ACCEL_ALT, ord('X'), 123),
|
tbl = wx.AcceleratorTable([ wx.AcceleratorEntry(wx.ACCEL_ALT, ord('X'), 123),
|
||||||
wx.AcceleratorEntry(wx.ACCEL_CTRL, ord('H'), 234),
|
wx.AcceleratorEntry(wx.ACCEL_CTRL, ord('H'), 234),
|
||||||
@@ -43,7 +43,7 @@ class accel_Tests(wtc.WidgetTestCase):
|
|||||||
wx.AcceleratorEntry(wx.ACCEL_NORMAL, wx.WXK_F3, 456)
|
wx.AcceleratorEntry(wx.ACCEL_NORMAL, wx.WXK_F3, 456)
|
||||||
])
|
])
|
||||||
self.frame.SetAcceleratorTable(tbl)
|
self.frame.SetAcceleratorTable(tbl)
|
||||||
|
|
||||||
def test_accelTable2(self):
|
def test_accelTable2(self):
|
||||||
tbl = wx.AcceleratorTable([ (wx.ACCEL_ALT, ord('X'), 123),
|
tbl = wx.AcceleratorTable([ (wx.ACCEL_ALT, ord('X'), 123),
|
||||||
(wx.ACCEL_CTRL, ord('H'), 234),
|
(wx.ACCEL_CTRL, ord('H'), 234),
|
||||||
@@ -51,7 +51,7 @@ class accel_Tests(wtc.WidgetTestCase):
|
|||||||
(wx.ACCEL_NORMAL, wx.WXK_F3, 456)
|
(wx.ACCEL_NORMAL, wx.WXK_F3, 456)
|
||||||
])
|
])
|
||||||
self.frame.SetAcceleratorTable(tbl)
|
self.frame.SetAcceleratorTable(tbl)
|
||||||
|
|
||||||
#---------------------------------------------------------------------------
|
#---------------------------------------------------------------------------
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -14,8 +14,8 @@ class affinematrix2d_Tests(wtc.WidgetTestCase):
|
|||||||
self.assertTrue(len(values) == 2)
|
self.assertTrue(len(values) == 2)
|
||||||
self.assertTrue(isinstance(values[0], wx.Matrix2D))
|
self.assertTrue(isinstance(values[0], wx.Matrix2D))
|
||||||
self.assertTrue(isinstance(values[1], wx.Point2D))
|
self.assertTrue(isinstance(values[1], wx.Point2D))
|
||||||
|
|
||||||
|
|
||||||
#---------------------------------------------------------------------------
|
#---------------------------------------------------------------------------
|
||||||
|
|
||||||
if __name__ == '__main__':
|
if __name__ == '__main__':
|
||||||
|
|||||||
@@ -25,7 +25,7 @@ class animate_Tests(wtc.WidgetTestCase):
|
|||||||
anictrl = wx.adv.AnimationCtrl(self.frame, anim=ani)
|
anictrl = wx.adv.AnimationCtrl(self.frame, anim=ani)
|
||||||
anictrl.Play()
|
anictrl.Play()
|
||||||
self.waitFor(500)
|
self.waitFor(500)
|
||||||
|
|
||||||
#---------------------------------------------------------------------------
|
#---------------------------------------------------------------------------
|
||||||
|
|
||||||
if __name__ == '__main__':
|
if __name__ == '__main__':
|
||||||
|
|||||||
@@ -7,10 +7,10 @@ import warnings
|
|||||||
#---------------------------------------------------------------------------
|
#---------------------------------------------------------------------------
|
||||||
|
|
||||||
class App(unittest.TestCase):
|
class App(unittest.TestCase):
|
||||||
|
|
||||||
def test_App(self):
|
def test_App(self):
|
||||||
app = wx.App()
|
app = wx.App()
|
||||||
|
|
||||||
def test_App_OnInit(self):
|
def test_App_OnInit(self):
|
||||||
class MyApp(wx.App):
|
class MyApp(wx.App):
|
||||||
def OnInit(self):
|
def OnInit(self):
|
||||||
@@ -36,13 +36,13 @@ class App(unittest.TestCase):
|
|||||||
app = MyApp()
|
app = MyApp()
|
||||||
app.MainLoop()
|
app.MainLoop()
|
||||||
self.assertTrue(app.onExit_called)
|
self.assertTrue(app.onExit_called)
|
||||||
|
|
||||||
def test_version(self):
|
def test_version(self):
|
||||||
v = wx.version()
|
v = wx.version()
|
||||||
wx.VERSION
|
wx.VERSION
|
||||||
wx.VERSION_STRING
|
wx.VERSION_STRING
|
||||||
wx.__version__
|
wx.__version__
|
||||||
|
|
||||||
def test_PySimpleApp(self):
|
def test_PySimpleApp(self):
|
||||||
# wx.PySimpleApp is supposed to be deprecated, make sure it is.
|
# wx.PySimpleApp is supposed to be deprecated, make sure it is.
|
||||||
with warnings.catch_warnings():
|
with warnings.catch_warnings():
|
||||||
@@ -50,7 +50,7 @@ class App(unittest.TestCase):
|
|||||||
with self.assertRaises(wx.wxPyDeprecationWarning):
|
with self.assertRaises(wx.wxPyDeprecationWarning):
|
||||||
app = wx.PySimpleApp()
|
app = wx.PySimpleApp()
|
||||||
|
|
||||||
|
|
||||||
def test_CallAfter(self):
|
def test_CallAfter(self):
|
||||||
class MyApp(wx.App):
|
class MyApp(wx.App):
|
||||||
def OnInit(self):
|
def OnInit(self):
|
||||||
@@ -62,11 +62,11 @@ class App(unittest.TestCase):
|
|||||||
def doAfter(self, a, b, c):
|
def doAfter(self, a, b, c):
|
||||||
self.callAfter_called = True
|
self.callAfter_called = True
|
||||||
self.frame.Close()
|
self.frame.Close()
|
||||||
|
|
||||||
app = MyApp()
|
app = MyApp()
|
||||||
app.MainLoop()
|
app.MainLoop()
|
||||||
self.assertTrue(app.callAfter_called)
|
self.assertTrue(app.callAfter_called)
|
||||||
|
|
||||||
#---------------------------------------------------------------------------
|
#---------------------------------------------------------------------------
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -5,18 +5,18 @@ import wx
|
|||||||
#---------------------------------------------------------------------------
|
#---------------------------------------------------------------------------
|
||||||
|
|
||||||
class AppTraitsTests(wtc.WidgetTestCase):
|
class AppTraitsTests(wtc.WidgetTestCase):
|
||||||
|
|
||||||
def test_AppTraits(self):
|
def test_AppTraits(self):
|
||||||
t = self.app.GetTraits()
|
t = self.app.GetTraits()
|
||||||
self.assertTrue(t is not None)
|
self.assertTrue(t is not None)
|
||||||
|
|
||||||
v = t.GetToolkitVersion()
|
v = t.GetToolkitVersion()
|
||||||
self.assertTrue( len(v) == 3)
|
self.assertTrue( len(v) == 3)
|
||||||
|
|
||||||
t.HasStderr()
|
t.HasStderr()
|
||||||
t.IsUsingUniversalWidgets()
|
t.IsUsingUniversalWidgets()
|
||||||
|
|
||||||
|
|
||||||
#---------------------------------------------------------------------------
|
#---------------------------------------------------------------------------
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -5,7 +5,7 @@ import wx
|
|||||||
#---------------------------------------------------------------------------
|
#---------------------------------------------------------------------------
|
||||||
|
|
||||||
class ArrayInt(unittest.TestCase):
|
class ArrayInt(unittest.TestCase):
|
||||||
|
|
||||||
if hasattr(wx, 'testArrayIntTypemap'):
|
if hasattr(wx, 'testArrayIntTypemap'):
|
||||||
def test_ArrayIntTypemaps(self):
|
def test_ArrayIntTypemaps(self):
|
||||||
# basic conversion of list or tuples of numbers
|
# basic conversion of list or tuples of numbers
|
||||||
@@ -13,12 +13,12 @@ class ArrayInt(unittest.TestCase):
|
|||||||
self.assertEqual(wx.testArrayIntTypemap(seqList), [1,2,3,4,6]) #floats are truncated to int
|
self.assertEqual(wx.testArrayIntTypemap(seqList), [1,2,3,4,6]) #floats are truncated to int
|
||||||
seqTuple = (1,2,3,4.5,6.7)
|
seqTuple = (1,2,3,4.5,6.7)
|
||||||
self.assertEqual(wx.testArrayIntTypemap(seqTuple), [1,2,3,4,6])
|
self.assertEqual(wx.testArrayIntTypemap(seqTuple), [1,2,3,4,6])
|
||||||
|
|
||||||
def test_ArrayIntTypemapErrors(self):
|
def test_ArrayIntTypemapErrors(self):
|
||||||
# test error conditions
|
# test error conditions
|
||||||
with self.assertRaises(TypeError):
|
with self.assertRaises(TypeError):
|
||||||
wx.testArrayIntTypemap([1,2,3, "baditem", ["listitem"]])
|
wx.testArrayIntTypemap([1,2,3, "baditem", ["listitem"]])
|
||||||
|
|
||||||
|
|
||||||
#---------------------------------------------------------------------------
|
#---------------------------------------------------------------------------
|
||||||
|
|
||||||
|
|||||||
@@ -12,7 +12,7 @@ else:
|
|||||||
|
|
||||||
|
|
||||||
class ArrayString(unittest.TestCase):
|
class ArrayString(unittest.TestCase):
|
||||||
|
|
||||||
if hasattr(wx, 'testArrayStringTypemap'):
|
if hasattr(wx, 'testArrayStringTypemap'):
|
||||||
def test_ArrayStringTypemaps(self):
|
def test_ArrayStringTypemaps(self):
|
||||||
# basic conversion of list or tuples of strings
|
# basic conversion of list or tuples of strings
|
||||||
@@ -20,7 +20,7 @@ class ArrayString(unittest.TestCase):
|
|||||||
self.assertEqual(wx.testArrayStringTypemap(seqList), ['a', 'b', 'hello world'])
|
self.assertEqual(wx.testArrayStringTypemap(seqList), ['a', 'b', 'hello world'])
|
||||||
seqTuple = ('a', alt('b'), 'hello world')
|
seqTuple = ('a', alt('b'), 'hello world')
|
||||||
self.assertEqual(wx.testArrayStringTypemap(seqTuple), ['a', 'b', 'hello world'])
|
self.assertEqual(wx.testArrayStringTypemap(seqTuple), ['a', 'b', 'hello world'])
|
||||||
|
|
||||||
def test_ArrayStringTypemapErrors(self):
|
def test_ArrayStringTypemapErrors(self):
|
||||||
# test error conditions
|
# test error conditions
|
||||||
with self.assertRaises(TypeError):
|
with self.assertRaises(TypeError):
|
||||||
@@ -29,7 +29,7 @@ class ArrayString(unittest.TestCase):
|
|||||||
wx.testArrayStringTypemap(alt("ALT sequence"))
|
wx.testArrayStringTypemap(alt("ALT sequence"))
|
||||||
with self.assertRaises(TypeError):
|
with self.assertRaises(TypeError):
|
||||||
wx.testArrayStringTypemap(["list", "with", "non-string", "items", 123])
|
wx.testArrayStringTypemap(["list", "with", "non-string", "items", 123])
|
||||||
|
|
||||||
|
|
||||||
#---------------------------------------------------------------------------
|
#---------------------------------------------------------------------------
|
||||||
|
|
||||||
|
|||||||
@@ -16,66 +16,66 @@ class artprov_Tests(wtc.WidgetTestCase):
|
|||||||
wx.ART_BUTTON
|
wx.ART_BUTTON
|
||||||
wx.ART_LIST
|
wx.ART_LIST
|
||||||
wx.ART_OTHER
|
wx.ART_OTHER
|
||||||
wx.ART_ADD_BOOKMARK
|
wx.ART_ADD_BOOKMARK
|
||||||
wx.ART_DEL_BOOKMARK
|
wx.ART_DEL_BOOKMARK
|
||||||
wx.ART_HELP_SIDE_PANEL
|
wx.ART_HELP_SIDE_PANEL
|
||||||
wx.ART_HELP_SETTINGS
|
wx.ART_HELP_SETTINGS
|
||||||
wx.ART_HELP_BOOK
|
wx.ART_HELP_BOOK
|
||||||
wx.ART_HELP_FOLDER
|
wx.ART_HELP_FOLDER
|
||||||
wx.ART_HELP_PAGE
|
wx.ART_HELP_PAGE
|
||||||
wx.ART_GO_BACK
|
wx.ART_GO_BACK
|
||||||
wx.ART_GO_FORWARD
|
wx.ART_GO_FORWARD
|
||||||
wx.ART_GO_UP
|
wx.ART_GO_UP
|
||||||
wx.ART_GO_DOWN
|
wx.ART_GO_DOWN
|
||||||
wx.ART_GO_TO_PARENT
|
wx.ART_GO_TO_PARENT
|
||||||
wx.ART_GO_HOME
|
wx.ART_GO_HOME
|
||||||
wx.ART_GOTO_FIRST
|
wx.ART_GOTO_FIRST
|
||||||
wx.ART_GOTO_LAST
|
wx.ART_GOTO_LAST
|
||||||
wx.ART_FILE_OPEN
|
wx.ART_FILE_OPEN
|
||||||
wx.ART_FILE_SAVE
|
wx.ART_FILE_SAVE
|
||||||
wx.ART_FILE_SAVE_AS
|
wx.ART_FILE_SAVE_AS
|
||||||
wx.ART_PRINT
|
wx.ART_PRINT
|
||||||
wx.ART_HELP
|
wx.ART_HELP
|
||||||
wx.ART_TIP
|
wx.ART_TIP
|
||||||
wx.ART_REPORT_VIEW
|
wx.ART_REPORT_VIEW
|
||||||
wx.ART_LIST_VIEW
|
wx.ART_LIST_VIEW
|
||||||
wx.ART_NEW_DIR
|
wx.ART_NEW_DIR
|
||||||
wx.ART_HARDDISK
|
wx.ART_HARDDISK
|
||||||
wx.ART_FLOPPY
|
wx.ART_FLOPPY
|
||||||
wx.ART_CDROM
|
wx.ART_CDROM
|
||||||
wx.ART_REMOVABLE
|
wx.ART_REMOVABLE
|
||||||
wx.ART_FOLDER
|
wx.ART_FOLDER
|
||||||
wx.ART_FOLDER_OPEN
|
wx.ART_FOLDER_OPEN
|
||||||
wx.ART_GO_DIR_UP
|
wx.ART_GO_DIR_UP
|
||||||
wx.ART_EXECUTABLE_FILE
|
wx.ART_EXECUTABLE_FILE
|
||||||
wx.ART_NORMAL_FILE
|
wx.ART_NORMAL_FILE
|
||||||
wx.ART_TICK_MARK
|
wx.ART_TICK_MARK
|
||||||
wx.ART_CROSS_MARK
|
wx.ART_CROSS_MARK
|
||||||
wx.ART_ERROR
|
wx.ART_ERROR
|
||||||
wx.ART_QUESTION
|
wx.ART_QUESTION
|
||||||
wx.ART_WARNING
|
wx.ART_WARNING
|
||||||
wx.ART_INFORMATION
|
wx.ART_INFORMATION
|
||||||
wx.ART_MISSING_IMAGE
|
wx.ART_MISSING_IMAGE
|
||||||
wx.ART_COPY
|
wx.ART_COPY
|
||||||
wx.ART_CUT
|
wx.ART_CUT
|
||||||
wx.ART_PASTE
|
wx.ART_PASTE
|
||||||
wx.ART_DELETE
|
wx.ART_DELETE
|
||||||
wx.ART_NEW
|
wx.ART_NEW
|
||||||
wx.ART_UNDO
|
wx.ART_UNDO
|
||||||
wx.ART_REDO
|
wx.ART_REDO
|
||||||
wx.ART_PLUS
|
wx.ART_PLUS
|
||||||
wx.ART_MINUS
|
wx.ART_MINUS
|
||||||
wx.ART_CLOSE
|
wx.ART_CLOSE
|
||||||
wx.ART_QUIT
|
wx.ART_QUIT
|
||||||
wx.ART_FIND
|
wx.ART_FIND
|
||||||
wx.ART_FIND_AND_REPLACE
|
wx.ART_FIND_AND_REPLACE
|
||||||
|
|
||||||
|
|
||||||
def test_artprovGetBitmap(self):
|
def test_artprovGetBitmap(self):
|
||||||
bmp = wx.ArtProvider.GetBitmap(wx.ART_QUESTION, wx.ART_TOOLBAR)
|
bmp = wx.ArtProvider.GetBitmap(wx.ART_QUESTION, wx.ART_TOOLBAR)
|
||||||
self.assertTrue(isinstance(bmp, wx.Bitmap))
|
self.assertTrue(isinstance(bmp, wx.Bitmap))
|
||||||
|
|
||||||
|
|
||||||
#---------------------------------------------------------------------------
|
#---------------------------------------------------------------------------
|
||||||
|
|
||||||
if __name__ == '__main__':
|
if __name__ == '__main__':
|
||||||
|
|||||||
@@ -34,8 +34,8 @@ class asserts_Tests(wtc.WidgetTestCase):
|
|||||||
wx.GetApp().SetAssertMode(wx.APP_ASSERT_EXCEPTION)
|
wx.GetApp().SetAssertMode(wx.APP_ASSERT_EXCEPTION)
|
||||||
with self.assertRaises(wx.wxAssertionError):
|
with self.assertRaises(wx.wxAssertionError):
|
||||||
wx.NullBitmap.ConvertToImage()
|
wx.NullBitmap.ConvertToImage()
|
||||||
|
|
||||||
|
|
||||||
#---------------------------------------------------------------------------
|
#---------------------------------------------------------------------------
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -13,13 +13,13 @@ class bannerwindow_Tests(wtc.WidgetTestCase):
|
|||||||
def test_bannerwindow1(self):
|
def test_bannerwindow1(self):
|
||||||
banner = wx.adv.BannerWindow(self.frame, dir=wx.LEFT)
|
banner = wx.adv.BannerWindow(self.frame, dir=wx.LEFT)
|
||||||
banner.SetBitmap(wx.Bitmap(pngFile))
|
banner.SetBitmap(wx.Bitmap(pngFile))
|
||||||
|
|
||||||
def test_bannerwindow2(self):
|
def test_bannerwindow2(self):
|
||||||
banner = wx.adv.BannerWindow(self.frame, dir=wx.LEFT)
|
banner = wx.adv.BannerWindow(self.frame, dir=wx.LEFT)
|
||||||
banner.SetText('Message Title', 'The message itself: blah, blah, blah')
|
banner.SetText('Message Title', 'The message itself: blah, blah, blah')
|
||||||
banner.SetGradient('white', 'blue')
|
banner.SetGradient('white', 'blue')
|
||||||
|
|
||||||
|
|
||||||
#---------------------------------------------------------------------------
|
#---------------------------------------------------------------------------
|
||||||
|
|
||||||
if __name__ == '__main__':
|
if __name__ == '__main__':
|
||||||
|
|||||||
@@ -15,7 +15,7 @@ def makeBuf(w, h, bpp=1, init=0):
|
|||||||
|
|
||||||
|
|
||||||
class BitmapTests(wtc.WidgetTestCase):
|
class BitmapTests(wtc.WidgetTestCase):
|
||||||
|
|
||||||
def test_BitmapCtor1(self):
|
def test_BitmapCtor1(self):
|
||||||
b1 = wx.Bitmap()
|
b1 = wx.Bitmap()
|
||||||
self.assertTrue( not b1.IsOk() )
|
self.assertTrue( not b1.IsOk() )
|
||||||
@@ -46,13 +46,13 @@ class BitmapTests(wtc.WidgetTestCase):
|
|||||||
# wx.EmptyBitmap is supposed to be deprecated, make sure it is.
|
# wx.EmptyBitmap is supposed to be deprecated, make sure it is.
|
||||||
import warnings
|
import warnings
|
||||||
with warnings.catch_warnings():
|
with warnings.catch_warnings():
|
||||||
warnings.simplefilter("error")
|
warnings.simplefilter("error")
|
||||||
with self.assertRaises(wx.wxPyDeprecationWarning):
|
with self.assertRaises(wx.wxPyDeprecationWarning):
|
||||||
b7 = wx.EmptyBitmap(5,10, 32)
|
b7 = wx.EmptyBitmap(5,10, 32)
|
||||||
self.assertTrue( b7.IsOk() )
|
self.assertTrue( b7.IsOk() )
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
def test_Bitmap__nonzero__(self):
|
def test_Bitmap__nonzero__(self):
|
||||||
b1 = wx.Bitmap()
|
b1 = wx.Bitmap()
|
||||||
self.assertTrue( not b1.IsOk() )
|
self.assertTrue( not b1.IsOk() )
|
||||||
@@ -73,19 +73,19 @@ class BitmapTests(wtc.WidgetTestCase):
|
|||||||
nzcheck = True
|
nzcheck = True
|
||||||
self.assertTrue(nzcheck)
|
self.assertTrue(nzcheck)
|
||||||
|
|
||||||
|
|
||||||
def test_BitmapNullBitmap(self):
|
def test_BitmapNullBitmap(self):
|
||||||
# just make sure this one exists
|
# just make sure this one exists
|
||||||
wx.NullBitmap
|
wx.NullBitmap
|
||||||
self.assertTrue(not wx.NullBitmap.IsOk())
|
self.assertTrue(not wx.NullBitmap.IsOk())
|
||||||
|
|
||||||
|
|
||||||
def test_BitmapSetMaskColour(self):
|
def test_BitmapSetMaskColour(self):
|
||||||
b5 = wx.Bitmap(pngFile)
|
b5 = wx.Bitmap(pngFile)
|
||||||
b5.SetMaskColour(wx.Colour(1,2,3))
|
b5.SetMaskColour(wx.Colour(1,2,3))
|
||||||
b5.SetMaskColour('black')
|
b5.SetMaskColour('black')
|
||||||
|
|
||||||
|
|
||||||
def test_BitmapMask(self):
|
def test_BitmapMask(self):
|
||||||
img = wx.Image(pngFile)
|
img = wx.Image(pngFile)
|
||||||
img = img.ConvertToMono(0,0,0)
|
img = img.ConvertToMono(0,0,0)
|
||||||
@@ -93,8 +93,8 @@ class BitmapTests(wtc.WidgetTestCase):
|
|||||||
m = wx.Mask()
|
m = wx.Mask()
|
||||||
m = wx.Mask(bmp)
|
m = wx.Mask(bmp)
|
||||||
m = wx.Mask(bmp, wx.Colour(1,2,3))
|
m = wx.Mask(bmp, wx.Colour(1,2,3))
|
||||||
|
|
||||||
|
|
||||||
@unittest.skipIf('wxGTK' in wx.PlatformInfo, 'wxMask constructor using palette index not supported on wxGTK')
|
@unittest.skipIf('wxGTK' in wx.PlatformInfo, 'wxMask constructor using palette index not supported on wxGTK')
|
||||||
def test_BitmapMaskWithPalette(self):
|
def test_BitmapMaskWithPalette(self):
|
||||||
img = wx.Image(pngFile)
|
img = wx.Image(pngFile)
|
||||||
@@ -111,7 +111,7 @@ class BitmapTests(wtc.WidgetTestCase):
|
|||||||
wx.BitmapBufferFormat_RGBA
|
wx.BitmapBufferFormat_RGBA
|
||||||
wx.BitmapBufferFormat_RGB32
|
wx.BitmapBufferFormat_RGB32
|
||||||
wx.BitmapBufferFormat_ARGB32
|
wx.BitmapBufferFormat_ARGB32
|
||||||
|
|
||||||
def test_bitmapSetSize(self):
|
def test_bitmapSetSize(self):
|
||||||
b1 = wx.Bitmap(1,1)
|
b1 = wx.Bitmap(1,1)
|
||||||
b1.SetSize((20,30))
|
b1.SetSize((20,30))
|
||||||
@@ -119,57 +119,57 @@ class BitmapTests(wtc.WidgetTestCase):
|
|||||||
self.assertTrue(b1.Size == (20,30))
|
self.assertTrue(b1.Size == (20,30))
|
||||||
b1.Size = (25,35)
|
b1.Size = (25,35)
|
||||||
self.assertTrue(b1.GetSize() == (25,35))
|
self.assertTrue(b1.GetSize() == (25,35))
|
||||||
|
|
||||||
def test_bitmapHandle(self):
|
def test_bitmapHandle(self):
|
||||||
b1 = wx.Bitmap(1,1)
|
b1 = wx.Bitmap(1,1)
|
||||||
b1.Handle
|
b1.Handle
|
||||||
b1.GetHandle()
|
b1.GetHandle()
|
||||||
|
|
||||||
|
|
||||||
def test_bitmapCopyFromBuffer1(self):
|
def test_bitmapCopyFromBuffer1(self):
|
||||||
w = h = 10
|
w = h = 10
|
||||||
buf = makeBuf(w,h,3)
|
buf = makeBuf(w,h,3)
|
||||||
bmp = wx.Bitmap(w,h,24)
|
bmp = wx.Bitmap(w,h,24)
|
||||||
bmp.CopyFromBuffer(buf, wx.BitmapBufferFormat_RGB)
|
bmp.CopyFromBuffer(buf, wx.BitmapBufferFormat_RGB)
|
||||||
|
|
||||||
def test_bitmapCopyFromBuffer2(self):
|
def test_bitmapCopyFromBuffer2(self):
|
||||||
w = h = 10
|
w = h = 10
|
||||||
buf = makeBuf(w,h,4)
|
buf = makeBuf(w,h,4)
|
||||||
bmp = wx.Bitmap(w,h,32)
|
bmp = wx.Bitmap(w,h,32)
|
||||||
bmp.CopyFromBuffer(buf, wx.BitmapBufferFormat_RGBA)
|
bmp.CopyFromBuffer(buf, wx.BitmapBufferFormat_RGBA)
|
||||||
|
|
||||||
def test_bitmapCopyFromBuffer3(self):
|
def test_bitmapCopyFromBuffer3(self):
|
||||||
w = h = 10
|
w = h = 10
|
||||||
buf = makeBuf(w,h,4)
|
buf = makeBuf(w,h,4)
|
||||||
bmp = wx.Bitmap(w,h,32)
|
bmp = wx.Bitmap(w,h,32)
|
||||||
bmp.CopyFromBuffer(buf, wx.BitmapBufferFormat_ARGB32)
|
bmp.CopyFromBuffer(buf, wx.BitmapBufferFormat_ARGB32)
|
||||||
|
|
||||||
|
|
||||||
def test_bitmapCopyToBuffer1(self):
|
def test_bitmapCopyToBuffer1(self):
|
||||||
w = h = 10
|
w = h = 10
|
||||||
buf = makeBuf(w,h,3)
|
buf = makeBuf(w,h,3)
|
||||||
bmp = wx.Bitmap(w,h,24)
|
bmp = wx.Bitmap(w,h,24)
|
||||||
bmp.CopyToBuffer(buf, wx.BitmapBufferFormat_RGB)
|
bmp.CopyToBuffer(buf, wx.BitmapBufferFormat_RGB)
|
||||||
|
|
||||||
def test_bitmapCopyToBuffer2(self):
|
def test_bitmapCopyToBuffer2(self):
|
||||||
w = h = 10
|
w = h = 10
|
||||||
buf = makeBuf(w,h,4)
|
buf = makeBuf(w,h,4)
|
||||||
bmp = wx.Bitmap(w,h,32)
|
bmp = wx.Bitmap(w,h,32)
|
||||||
bmp.CopyToBuffer(buf, wx.BitmapBufferFormat_RGBA)
|
bmp.CopyToBuffer(buf, wx.BitmapBufferFormat_RGBA)
|
||||||
|
|
||||||
def test_bitmapCopyToBuffer3(self):
|
def test_bitmapCopyToBuffer3(self):
|
||||||
w = h = 10
|
w = h = 10
|
||||||
buf = makeBuf(w,h,4)
|
buf = makeBuf(w,h,4)
|
||||||
bmp = wx.Bitmap(w,h,32)
|
bmp = wx.Bitmap(w,h,32)
|
||||||
bmp.CopyToBuffer(buf, wx.BitmapBufferFormat_ARGB32)
|
bmp.CopyToBuffer(buf, wx.BitmapBufferFormat_ARGB32)
|
||||||
|
|
||||||
|
|
||||||
def test_bitmapBufferFactory1(self):
|
def test_bitmapBufferFactory1(self):
|
||||||
w = h = 10
|
w = h = 10
|
||||||
buf = makeBuf(w,h,3, 111)
|
buf = makeBuf(w,h,3, 111)
|
||||||
bmp = wx.Bitmap.FromBuffer(w, h, buf)
|
bmp = wx.Bitmap.FromBuffer(w, h, buf)
|
||||||
self.assertTrue(bmp.IsOk())
|
self.assertTrue(bmp.IsOk())
|
||||||
|
|
||||||
def test_bitmapBufferFactory2(self):
|
def test_bitmapBufferFactory2(self):
|
||||||
w = h = 10
|
w = h = 10
|
||||||
buf = makeBuf(w,h,3, 111)
|
buf = makeBuf(w,h,3, 111)
|
||||||
@@ -205,7 +205,7 @@ class BitmapTests(wtc.WidgetTestCase):
|
|||||||
bmp = wx.Bitmap.FromBuffer(w, h, buf)
|
bmp = wx.Bitmap.FromBuffer(w, h, buf)
|
||||||
self.assertTrue(bmp.IsOk())
|
self.assertTrue(bmp.IsOk())
|
||||||
img = bmp.ConvertToImage()
|
img = bmp.ConvertToImage()
|
||||||
self.assertEqual( (img.GetRed(1,2), img.GetGreen(1,2), img.GetBlue(1,2)),
|
self.assertEqual( (img.GetRed(1,2), img.GetGreen(1,2), img.GetBlue(1,2)),
|
||||||
(10,20,30) )
|
(10,20,30) )
|
||||||
|
|
||||||
|
|
||||||
@@ -220,7 +220,7 @@ class BitmapTests(wtc.WidgetTestCase):
|
|||||||
self.assertTrue(bmp.IsOk())
|
self.assertTrue(bmp.IsOk())
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
#---------------------------------------------------------------------------
|
#---------------------------------------------------------------------------
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -8,19 +8,19 @@ pngFile = os.path.join(os.path.dirname(__file__), 'toucan.png')
|
|||||||
#---------------------------------------------------------------------------
|
#---------------------------------------------------------------------------
|
||||||
|
|
||||||
class BitmapButtonTests(wtc.WidgetTestCase):
|
class BitmapButtonTests(wtc.WidgetTestCase):
|
||||||
|
|
||||||
def test_BitmapButtonCtor(self):
|
def test_BitmapButtonCtor(self):
|
||||||
bmp = wx.Bitmap(pngFile)
|
bmp = wx.Bitmap(pngFile)
|
||||||
btn = wx.BitmapButton(self.frame, -1, bmp)
|
btn = wx.BitmapButton(self.frame, -1, bmp)
|
||||||
|
|
||||||
|
|
||||||
def test_BitmapButtonDefaultCtor(self):
|
def test_BitmapButtonDefaultCtor(self):
|
||||||
bmp = wx.Bitmap(pngFile)
|
bmp = wx.Bitmap(pngFile)
|
||||||
btn = wx.BitmapButton()
|
btn = wx.BitmapButton()
|
||||||
btn.Create(self.frame, -1, bmp)
|
btn.Create(self.frame, -1, bmp)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
#---------------------------------------------------------------------------
|
#---------------------------------------------------------------------------
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -16,33 +16,33 @@ class bmpcbox_Tests(wtc.WidgetTestCase):
|
|||||||
|
|
||||||
def test_bmpcbox1(self):
|
def test_bmpcbox1(self):
|
||||||
pnl = wx.Panel(self.frame)
|
pnl = wx.Panel(self.frame)
|
||||||
|
|
||||||
bcb = wx.adv.BitmapComboBox(pnl)
|
bcb = wx.adv.BitmapComboBox(pnl)
|
||||||
for idx, name in enumerate(imgFiles):
|
for idx, name in enumerate(imgFiles):
|
||||||
bmp = wx.Bitmap(name)
|
bmp = wx.Bitmap(name)
|
||||||
bcb.Append(os.path.basename(name), bmp)
|
bcb.Append(os.path.basename(name), bmp)
|
||||||
|
|
||||||
bcb.GetItemBitmap(0)
|
bcb.GetItemBitmap(0)
|
||||||
bcb.SetItemBitmap(0, wx.NullBitmap)
|
bcb.SetItemBitmap(0, wx.NullBitmap)
|
||||||
|
|
||||||
bcb.SetClientObject(2, "Hello")
|
bcb.SetClientObject(2, "Hello")
|
||||||
self.assertEqual(bcb.GetClientObject(2), "Hello")
|
self.assertEqual(bcb.GetClientObject(2), "Hello")
|
||||||
|
|
||||||
bcb.SetClientData(2, "Bye")
|
bcb.SetClientData(2, "Bye")
|
||||||
self.assertEqual(bcb.GetClientData(2), "Bye")
|
self.assertEqual(bcb.GetClientData(2), "Bye")
|
||||||
|
|
||||||
|
|
||||||
def test_bmpcbox2(self):
|
def test_bmpcbox2(self):
|
||||||
pnl = wx.Panel(self.frame)
|
pnl = wx.Panel(self.frame)
|
||||||
|
|
||||||
bcb = wx.adv.BitmapComboBox(pnl)
|
bcb = wx.adv.BitmapComboBox(pnl)
|
||||||
for idx, name in enumerate(imgFiles):
|
for idx, name in enumerate(imgFiles):
|
||||||
bmp = wx.Bitmap(name)
|
bmp = wx.Bitmap(name)
|
||||||
bcb.Append(os.path.basename(name), bmp, str(idx))
|
bcb.Append(os.path.basename(name), bmp, str(idx))
|
||||||
|
|
||||||
self.assertEqual(bcb.GetClientData(2), "2")
|
self.assertEqual(bcb.GetClientData(2), "2")
|
||||||
|
|
||||||
|
|
||||||
#---------------------------------------------------------------------------
|
#---------------------------------------------------------------------------
|
||||||
|
|
||||||
if __name__ == '__main__':
|
if __name__ == '__main__':
|
||||||
|
|||||||
@@ -8,15 +8,15 @@ class panel_Tests(wtc.WidgetTestCase):
|
|||||||
|
|
||||||
def test_bookctrl1(self):
|
def test_bookctrl1(self):
|
||||||
wx.BK_DEFAULT
|
wx.BK_DEFAULT
|
||||||
wx.BK_TOP
|
wx.BK_TOP
|
||||||
wx.BK_BOTTOM
|
wx.BK_BOTTOM
|
||||||
wx.BK_LEFT
|
wx.BK_LEFT
|
||||||
wx.BK_RIGHT
|
wx.BK_RIGHT
|
||||||
wx.BK_HITTEST_NOWHERE
|
wx.BK_HITTEST_NOWHERE
|
||||||
wx.BK_HITTEST_ONICON
|
wx.BK_HITTEST_ONICON
|
||||||
wx.BK_HITTEST_ONLABEL
|
wx.BK_HITTEST_ONLABEL
|
||||||
wx.BK_HITTEST_ONITEM
|
wx.BK_HITTEST_ONITEM
|
||||||
wx.BK_HITTEST_ONPAGE
|
wx.BK_HITTEST_ONPAGE
|
||||||
|
|
||||||
|
|
||||||
def test_bookctrl2(self):
|
def test_bookctrl2(self):
|
||||||
@@ -26,8 +26,8 @@ class panel_Tests(wtc.WidgetTestCase):
|
|||||||
wx.wxEVT_COMMAND_BOOKCTRL_PAGE_CHANGING
|
wx.wxEVT_COMMAND_BOOKCTRL_PAGE_CHANGING
|
||||||
wx.EVT_BOOKCTRL_PAGE_CHANGED
|
wx.EVT_BOOKCTRL_PAGE_CHANGED
|
||||||
wx.EVT_BOOKCTRL_PAGE_CHANGING
|
wx.EVT_BOOKCTRL_PAGE_CHANGING
|
||||||
|
|
||||||
|
|
||||||
#---------------------------------------------------------------------------
|
#---------------------------------------------------------------------------
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -8,48 +8,48 @@ pngFile = os.path.join(os.path.dirname(__file__), 'toucan.png')
|
|||||||
#---------------------------------------------------------------------------
|
#---------------------------------------------------------------------------
|
||||||
|
|
||||||
class BrushTests(wtc.WidgetTestCase):
|
class BrushTests(wtc.WidgetTestCase):
|
||||||
|
|
||||||
def test_BrushCtors(self):
|
def test_BrushCtors(self):
|
||||||
b = wx.Brush()
|
b = wx.Brush()
|
||||||
b = wx.Brush(wx.Colour(1,2,3), wx.BRUSHSTYLE_SOLID)
|
b = wx.Brush(wx.Colour(1,2,3), wx.BRUSHSTYLE_SOLID)
|
||||||
bmp = wx.Bitmap(pngFile)
|
bmp = wx.Bitmap(pngFile)
|
||||||
b = wx.Brush(bmp)
|
b = wx.Brush(bmp)
|
||||||
copy = wx.Brush(b)
|
copy = wx.Brush(b)
|
||||||
|
|
||||||
|
|
||||||
def test_BrushOperators(self):
|
def test_BrushOperators(self):
|
||||||
b1 = wx.Brush(wx.Colour(1,2,3), wx.BRUSHSTYLE_SOLID)
|
b1 = wx.Brush(wx.Colour(1,2,3), wx.BRUSHSTYLE_SOLID)
|
||||||
b2 = 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)
|
b3 = wx.Brush(wx.Colour(4,5,6), wx.BRUSHSTYLE_SOLID)
|
||||||
|
|
||||||
self.assertTrue(b1 == b2)
|
self.assertTrue(b1 == b2)
|
||||||
self.assertTrue(b2 != b3)
|
self.assertTrue(b2 != b3)
|
||||||
self.assertFalse(b1 != b2)
|
self.assertFalse(b1 != b2)
|
||||||
self.assertFalse(b2 == b3)
|
self.assertFalse(b2 == b3)
|
||||||
|
|
||||||
|
|
||||||
def test_nonzero(self):
|
def test_nonzero(self):
|
||||||
b = wx.Brush(wx.Colour(1,2,3), wx.BRUSHSTYLE_SOLID)
|
b = wx.Brush(wx.Colour(1,2,3), wx.BRUSHSTYLE_SOLID)
|
||||||
if not b:
|
if not b:
|
||||||
self.fail("__nonzero__ should have avoided this branch")
|
self.fail("__nonzero__ should have avoided this branch")
|
||||||
if wx.NullBrush:
|
if wx.NullBrush:
|
||||||
self.fail("__nonzero__ should have avoided this branch")
|
self.fail("__nonzero__ should have avoided this branch")
|
||||||
|
|
||||||
|
|
||||||
def test_StockBrushesExist(self):
|
def test_StockBrushesExist(self):
|
||||||
wx.BLUE_BRUSH
|
wx.BLUE_BRUSH
|
||||||
wx.GREEN_BRUSH
|
wx.GREEN_BRUSH
|
||||||
wx.YELLOW_BRUSH
|
wx.YELLOW_BRUSH
|
||||||
wx.WHITE_BRUSH
|
wx.WHITE_BRUSH
|
||||||
wx.BLACK_BRUSH
|
wx.BLACK_BRUSH
|
||||||
wx.GREY_BRUSH
|
wx.GREY_BRUSH
|
||||||
wx.MEDIUM_GREY_BRUSH
|
wx.MEDIUM_GREY_BRUSH
|
||||||
wx.LIGHT_GREY_BRUSH
|
wx.LIGHT_GREY_BRUSH
|
||||||
wx.TRANSPARENT_BRUSH
|
wx.TRANSPARENT_BRUSH
|
||||||
wx.CYAN_BRUSH
|
wx.CYAN_BRUSH
|
||||||
wx.RED_BRUSH
|
wx.RED_BRUSH
|
||||||
wx.NullBrush
|
wx.NullBrush
|
||||||
|
|
||||||
|
|
||||||
def test_StockBrushesInitialized(self):
|
def test_StockBrushesInitialized(self):
|
||||||
self.assertTrue(wx.BLUE_BRUSH.IsOk())
|
self.assertTrue(wx.BLUE_BRUSH.IsOk())
|
||||||
@@ -57,7 +57,7 @@ class BrushTests(wtc.WidgetTestCase):
|
|||||||
self.assertTrue(wx.YELLOW_BRUSH.IsOk())
|
self.assertTrue(wx.YELLOW_BRUSH.IsOk())
|
||||||
self.assertTrue(wx.WHITE_BRUSH.IsOk())
|
self.assertTrue(wx.WHITE_BRUSH.IsOk())
|
||||||
self.assertTrue(wx.BLACK_BRUSH.IsOk())
|
self.assertTrue(wx.BLACK_BRUSH.IsOk())
|
||||||
self.assertTrue(wx.GREY_BRUSH.IsOk())
|
self.assertTrue(wx.GREY_BRUSH.IsOk())
|
||||||
self.assertTrue(wx.MEDIUM_GREY_BRUSH.IsOk())
|
self.assertTrue(wx.MEDIUM_GREY_BRUSH.IsOk())
|
||||||
self.assertTrue(wx.LIGHT_GREY_BRUSH.IsOk())
|
self.assertTrue(wx.LIGHT_GREY_BRUSH.IsOk())
|
||||||
self.assertTrue(wx.TRANSPARENT_BRUSH.IsOk())
|
self.assertTrue(wx.TRANSPARENT_BRUSH.IsOk())
|
||||||
@@ -68,8 +68,8 @@ class BrushTests(wtc.WidgetTestCase):
|
|||||||
def test_brushOldStyleNames(self):
|
def test_brushOldStyleNames(self):
|
||||||
b = wx.Brush(wx.RED, wx.SOLID)
|
b = wx.Brush(wx.RED, wx.SOLID)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
#---------------------------------------------------------------------------
|
#---------------------------------------------------------------------------
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -10,8 +10,8 @@ class busyinfo_Tests(wtc.WidgetTestCase):
|
|||||||
busy = wx.BusyInfo('This is a busy info message')
|
busy = wx.BusyInfo('This is a busy info message')
|
||||||
self.waitFor(250)
|
self.waitFor(250)
|
||||||
del busy
|
del busy
|
||||||
|
|
||||||
|
|
||||||
#---------------------------------------------------------------------------
|
#---------------------------------------------------------------------------
|
||||||
|
|
||||||
if __name__ == '__main__':
|
if __name__ == '__main__':
|
||||||
|
|||||||
@@ -8,7 +8,7 @@ pngFile = os.path.join(os.path.dirname(__file__), 'toucan.png')
|
|||||||
#---------------------------------------------------------------------------
|
#---------------------------------------------------------------------------
|
||||||
|
|
||||||
class ButtonTests(wtc.WidgetTestCase):
|
class ButtonTests(wtc.WidgetTestCase):
|
||||||
|
|
||||||
def test_ButtonCtors(self):
|
def test_ButtonCtors(self):
|
||||||
btn = wx.Button(self.frame, label='label')
|
btn = wx.Button(self.frame, label='label')
|
||||||
btn = wx.Button(self.frame, -1, 'label', (10,10), (100,-1), wx.BU_LEFT)
|
btn = wx.Button(self.frame, -1, 'label', (10,10), (100,-1), wx.BU_LEFT)
|
||||||
@@ -17,7 +17,7 @@ class ButtonTests(wtc.WidgetTestCase):
|
|||||||
|
|
||||||
def test_ButtonProperties(self):
|
def test_ButtonProperties(self):
|
||||||
btn = wx.Button(self.frame, label='label')
|
btn = wx.Button(self.frame, label='label')
|
||||||
|
|
||||||
# do the properties exist?
|
# do the properties exist?
|
||||||
btn.AuthNeeded
|
btn.AuthNeeded
|
||||||
btn.Bitmap
|
btn.Bitmap
|
||||||
@@ -28,14 +28,14 @@ class ButtonTests(wtc.WidgetTestCase):
|
|||||||
btn.BitmapMargins
|
btn.BitmapMargins
|
||||||
btn.BitmapPressed
|
btn.BitmapPressed
|
||||||
btn.Label
|
btn.Label
|
||||||
|
|
||||||
|
|
||||||
def test_ButtonDefaultCtor(self):
|
def test_ButtonDefaultCtor(self):
|
||||||
btn = wx.Button()
|
btn = wx.Button()
|
||||||
btn.Create(self.frame, -1, 'button label')
|
btn.Create(self.frame, -1, 'button label')
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
#---------------------------------------------------------------------------
|
#---------------------------------------------------------------------------
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -10,7 +10,7 @@ class calctrl_Tests(wtc.WidgetTestCase):
|
|||||||
def test_calctrl1(self):
|
def test_calctrl1(self):
|
||||||
evt = wx.adv.CalendarEvent()
|
evt = wx.adv.CalendarEvent()
|
||||||
attr = wx.adv.CalendarDateAttr()
|
attr = wx.adv.CalendarDateAttr()
|
||||||
|
|
||||||
wx.adv.CAL_SUNDAY_FIRST
|
wx.adv.CAL_SUNDAY_FIRST
|
||||||
wx.adv.CAL_MONDAY_FIRST
|
wx.adv.CAL_MONDAY_FIRST
|
||||||
wx.adv.CAL_SHOW_HOLIDAYS
|
wx.adv.CAL_SHOW_HOLIDAYS
|
||||||
@@ -19,20 +19,20 @@ class calctrl_Tests(wtc.WidgetTestCase):
|
|||||||
wx.adv.CAL_SEQUENTIAL_MONTH_SELECTION
|
wx.adv.CAL_SEQUENTIAL_MONTH_SELECTION
|
||||||
wx.adv.CAL_SHOW_SURROUNDING_WEEKS
|
wx.adv.CAL_SHOW_SURROUNDING_WEEKS
|
||||||
wx.adv.CAL_SHOW_WEEK_NUMBERS
|
wx.adv.CAL_SHOW_WEEK_NUMBERS
|
||||||
|
|
||||||
wx.adv.CAL_HITTEST_NOWHERE
|
wx.adv.CAL_HITTEST_NOWHERE
|
||||||
wx.adv.CAL_HITTEST_HEADER
|
wx.adv.CAL_HITTEST_HEADER
|
||||||
wx.adv.CAL_HITTEST_DAY
|
wx.adv.CAL_HITTEST_DAY
|
||||||
wx.adv.CAL_HITTEST_INCMONTH
|
wx.adv.CAL_HITTEST_INCMONTH
|
||||||
wx.adv.CAL_HITTEST_DECMONTH
|
wx.adv.CAL_HITTEST_DECMONTH
|
||||||
wx.adv.CAL_HITTEST_SURROUNDING_WEEK
|
wx.adv.CAL_HITTEST_SURROUNDING_WEEK
|
||||||
wx.adv.CAL_HITTEST_WEEK
|
wx.adv.CAL_HITTEST_WEEK
|
||||||
|
|
||||||
wx.adv.CAL_BORDER_NONE
|
|
||||||
wx.adv.CAL_BORDER_SQUARE
|
|
||||||
wx.adv.CAL_BORDER_ROUND
|
|
||||||
|
|
||||||
|
wx.adv.CAL_BORDER_NONE
|
||||||
|
wx.adv.CAL_BORDER_SQUARE
|
||||||
|
wx.adv.CAL_BORDER_ROUND
|
||||||
|
|
||||||
|
|
||||||
def test_calctrl2(self):
|
def test_calctrl2(self):
|
||||||
cal = wx.adv.CalendarCtrl(self.frame, date=wx.DateTime.Today())
|
cal = wx.adv.CalendarCtrl(self.frame, date=wx.DateTime.Today())
|
||||||
|
|
||||||
@@ -40,8 +40,8 @@ class calctrl_Tests(wtc.WidgetTestCase):
|
|||||||
def test_calctrl3(self):
|
def test_calctrl3(self):
|
||||||
cal = wx.adv.CalendarCtrl()
|
cal = wx.adv.CalendarCtrl()
|
||||||
cal.Create(self.frame, date=wx.DateTime.Today())
|
cal.Create(self.frame, date=wx.DateTime.Today())
|
||||||
|
|
||||||
|
|
||||||
def test_genericcalctrl2(self):
|
def test_genericcalctrl2(self):
|
||||||
cal = wx.adv.GenericCalendarCtrl(self.frame, date=wx.DateTime.Today())
|
cal = wx.adv.GenericCalendarCtrl(self.frame, date=wx.DateTime.Today())
|
||||||
|
|
||||||
@@ -49,9 +49,9 @@ class calctrl_Tests(wtc.WidgetTestCase):
|
|||||||
def test_genericcalctrl3(self):
|
def test_genericcalctrl3(self):
|
||||||
cal = wx.adv.GenericCalendarCtrl()
|
cal = wx.adv.GenericCalendarCtrl()
|
||||||
cal.Create(self.frame, date=wx.DateTime.Today())
|
cal.Create(self.frame, date=wx.DateTime.Today())
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
#---------------------------------------------------------------------------
|
#---------------------------------------------------------------------------
|
||||||
|
|
||||||
if __name__ == '__main__':
|
if __name__ == '__main__':
|
||||||
|
|||||||
@@ -14,7 +14,7 @@ class caret_Tests(wtc.WidgetTestCase):
|
|||||||
c.Move((50,50))
|
c.Move((50,50))
|
||||||
c.Show()
|
c.Show()
|
||||||
self.waitFor(300)
|
self.waitFor(300)
|
||||||
|
|
||||||
def test_caret2(self):
|
def test_caret2(self):
|
||||||
pnl = wx.Window(self.frame)
|
pnl = wx.Window(self.frame)
|
||||||
c = wx.Caret()
|
c = wx.Caret()
|
||||||
@@ -24,8 +24,8 @@ class caret_Tests(wtc.WidgetTestCase):
|
|||||||
c.Move(50,50)
|
c.Move(50,50)
|
||||||
c.Show()
|
c.Show()
|
||||||
self.waitFor(300)
|
self.waitFor(300)
|
||||||
|
|
||||||
|
|
||||||
#---------------------------------------------------------------------------
|
#---------------------------------------------------------------------------
|
||||||
|
|
||||||
if __name__ == '__main__':
|
if __name__ == '__main__':
|
||||||
|
|||||||
@@ -5,18 +5,18 @@ import wx
|
|||||||
#---------------------------------------------------------------------------
|
#---------------------------------------------------------------------------
|
||||||
|
|
||||||
class checkbox_Tests(wtc.WidgetTestCase):
|
class checkbox_Tests(wtc.WidgetTestCase):
|
||||||
|
|
||||||
def test_checkboxCtors(self):
|
def test_checkboxCtors(self):
|
||||||
c = wx.CheckBox(self.frame, label="checkbox")
|
c = wx.CheckBox(self.frame, label="checkbox")
|
||||||
c = wx.CheckBox(self.frame, -1, "checkbox", wx.Point(10,10), wx.Size(80,-1))
|
c = wx.CheckBox(self.frame, -1, "checkbox", wx.Point(10,10), wx.Size(80,-1))
|
||||||
|
|
||||||
|
|
||||||
def test_checkboxDefaultCtor(self):
|
def test_checkboxDefaultCtor(self):
|
||||||
c = wx.CheckBox()
|
c = wx.CheckBox()
|
||||||
c.Create(self.frame, label="checkbox")
|
c.Create(self.frame, label="checkbox")
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
#---------------------------------------------------------------------------
|
#---------------------------------------------------------------------------
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -5,13 +5,13 @@ import wx
|
|||||||
#---------------------------------------------------------------------------
|
#---------------------------------------------------------------------------
|
||||||
|
|
||||||
class CheckListBoxTests(wtc.WidgetTestCase):
|
class CheckListBoxTests(wtc.WidgetTestCase):
|
||||||
|
|
||||||
def test_CheckBoxCtors(self):
|
def test_CheckBoxCtors(self):
|
||||||
c = wx.CheckListBox(self.frame, choices="one two three four".split())
|
c = wx.CheckListBox(self.frame, choices="one two three four".split())
|
||||||
c = wx.CheckListBox(self.frame, -1, wx.Point(10,10), wx.Size(80,-1),
|
c = wx.CheckListBox(self.frame, -1, wx.Point(10,10), wx.Size(80,-1),
|
||||||
"one two three four".split(),)
|
"one two three four".split(),)
|
||||||
|
|
||||||
|
|
||||||
def test_CheckListBoxDefaultCtor(self):
|
def test_CheckListBoxDefaultCtor(self):
|
||||||
c = wx.CheckListBox()
|
c = wx.CheckListBox()
|
||||||
c.Create(self.frame, choices="one two three four".split())
|
c.Create(self.frame, choices="one two three four".split())
|
||||||
@@ -22,7 +22,7 @@ class CheckListBoxTests(wtc.WidgetTestCase):
|
|||||||
self.assertTrue(callable(c.GetCheckedStrings))
|
self.assertTrue(callable(c.GetCheckedStrings))
|
||||||
self.assertTrue(callable(c.SetChecked))
|
self.assertTrue(callable(c.SetChecked))
|
||||||
self.assertTrue(callable(c.SetCheckedStrings))
|
self.assertTrue(callable(c.SetCheckedStrings))
|
||||||
|
|
||||||
def test_pyMethods2(self):
|
def test_pyMethods2(self):
|
||||||
c = wx.CheckListBox(self.frame, choices="one two three four".split())
|
c = wx.CheckListBox(self.frame, choices="one two three four".split())
|
||||||
c.SetCheckedItems([1,3])
|
c.SetCheckedItems([1,3])
|
||||||
@@ -30,7 +30,7 @@ class CheckListBoxTests(wtc.WidgetTestCase):
|
|||||||
c.SetCheckedStrings(['one', 'two'])
|
c.SetCheckedStrings(['one', 'two'])
|
||||||
self.assertTrue(set(c.GetCheckedStrings()) == set(['one', 'two']))
|
self.assertTrue(set(c.GetCheckedStrings()) == set(['one', 'two']))
|
||||||
self.assertTrue(set(c.GetCheckedItems()) == set([0,1]))
|
self.assertTrue(set(c.GetCheckedItems()) == set([0,1]))
|
||||||
|
|
||||||
def test_pyProperties(self):
|
def test_pyProperties(self):
|
||||||
c = wx.CheckListBox(self.frame, choices="one two three four".split())
|
c = wx.CheckListBox(self.frame, choices="one two three four".split())
|
||||||
c.SetCheckedItems([1,3])
|
c.SetCheckedItems([1,3])
|
||||||
@@ -38,14 +38,14 @@ class CheckListBoxTests(wtc.WidgetTestCase):
|
|||||||
|
|
||||||
c.CheckedItems = [2]
|
c.CheckedItems = [2]
|
||||||
self.assertTrue(set(c.CheckedItems) == set([2]))
|
self.assertTrue(set(c.CheckedItems) == set([2]))
|
||||||
|
|
||||||
c.SetCheckedStrings(['one', 'two'])
|
c.SetCheckedStrings(['one', 'two'])
|
||||||
self.assertTrue(set(c.CheckedStrings) == set(['one', 'two']))
|
self.assertTrue(set(c.CheckedStrings) == set(['one', 'two']))
|
||||||
|
|
||||||
c.CheckedStrings = ['three']
|
c.CheckedStrings = ['three']
|
||||||
self.assertTrue(set(c.GetCheckedItems()) == set([2]))
|
self.assertTrue(set(c.GetCheckedItems()) == set([2]))
|
||||||
|
|
||||||
|
|
||||||
#---------------------------------------------------------------------------
|
#---------------------------------------------------------------------------
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -11,11 +11,11 @@ class choicdlg_Tests(wtc.WidgetTestCase):
|
|||||||
choices="one two three four five".split())
|
choices="one two three four five".split())
|
||||||
d.SetSelection(2)
|
d.SetSelection(2)
|
||||||
d.Destroy()
|
d.Destroy()
|
||||||
|
|
||||||
def test_choicdlgSingleFunc(self):
|
def test_choicdlgSingleFunc(self):
|
||||||
wx.GetSingleChoice
|
wx.GetSingleChoice
|
||||||
|
|
||||||
|
|
||||||
def test_choicdlgMulti(self):
|
def test_choicdlgMulti(self):
|
||||||
d = wx.MultiChoiceDialog(self.frame, 'message', 'caption',
|
d = wx.MultiChoiceDialog(self.frame, 'message', 'caption',
|
||||||
choices="one two three four five".split())
|
choices="one two three four five".split())
|
||||||
@@ -23,8 +23,8 @@ class choicdlg_Tests(wtc.WidgetTestCase):
|
|||||||
s = d.GetSelections()
|
s = d.GetSelections()
|
||||||
#self.assertEqual(s, [2,4]) the internal list isn't updated right away, can't test this here
|
#self.assertEqual(s, [2,4]) the internal list isn't updated right away, can't test this here
|
||||||
d.Destroy()
|
d.Destroy()
|
||||||
|
|
||||||
|
|
||||||
#---------------------------------------------------------------------------
|
#---------------------------------------------------------------------------
|
||||||
|
|
||||||
if __name__ == '__main__':
|
if __name__ == '__main__':
|
||||||
|
|||||||
@@ -5,31 +5,31 @@ import wx
|
|||||||
#---------------------------------------------------------------------------
|
#---------------------------------------------------------------------------
|
||||||
|
|
||||||
class ChoiceTests(wtc.WidgetTestCase):
|
class ChoiceTests(wtc.WidgetTestCase):
|
||||||
|
|
||||||
def test_ChoiceCtors(self):
|
def test_ChoiceCtors(self):
|
||||||
c = wx.Choice(self.frame, choices="one two three four".split())
|
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),
|
c = wx.Choice(self.frame, -1, wx.Point(10,10), wx.Size(80,-1),
|
||||||
"one two three four".split(), 0)
|
"one two three four".split(), 0)
|
||||||
c = wx.Choice(self.frame, -1, (10,10), (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)
|
self.assertTrue(c.GetCount() == 4)
|
||||||
|
|
||||||
|
|
||||||
def test_ChoiceDefaultCtor(self):
|
def test_ChoiceDefaultCtor(self):
|
||||||
c = wx.Choice()
|
c = wx.Choice()
|
||||||
c.Create(self.frame, choices="one two three four".split())
|
c.Create(self.frame, choices="one two three four".split())
|
||||||
|
|
||||||
|
|
||||||
def test_ChoiceProperties(self):
|
def test_ChoiceProperties(self):
|
||||||
c = wx.Choice(self.frame, choices="one two three four".split())
|
c = wx.Choice(self.frame, choices="one two three four".split())
|
||||||
|
|
||||||
# do the properties exist?
|
# do the properties exist?
|
||||||
c.Columns
|
c.Columns
|
||||||
c.Count
|
c.Count
|
||||||
c.CurrentSelection
|
c.CurrentSelection
|
||||||
c.Selection
|
c.Selection
|
||||||
|
|
||||||
|
|
||||||
#---------------------------------------------------------------------------
|
#---------------------------------------------------------------------------
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -7,30 +7,30 @@ import wx
|
|||||||
class choicebk_Tests(wtc.WidgetTestCase):
|
class choicebk_Tests(wtc.WidgetTestCase):
|
||||||
|
|
||||||
def test_choicebk1(self):
|
def test_choicebk1(self):
|
||||||
wx.CHB_DEFAULT
|
wx.CHB_DEFAULT
|
||||||
wx.CHB_TOP
|
wx.CHB_TOP
|
||||||
wx.CHB_BOTTOM
|
wx.CHB_BOTTOM
|
||||||
wx.CHB_LEFT
|
wx.CHB_LEFT
|
||||||
wx.CHB_RIGHT
|
wx.CHB_RIGHT
|
||||||
wx.CHB_ALIGN_MASK
|
wx.CHB_ALIGN_MASK
|
||||||
|
|
||||||
wx.wxEVT_COMMAND_CHOICEBOOK_PAGE_CHANGED
|
wx.wxEVT_COMMAND_CHOICEBOOK_PAGE_CHANGED
|
||||||
wx.wxEVT_COMMAND_CHOICEBOOK_PAGE_CHANGING
|
wx.wxEVT_COMMAND_CHOICEBOOK_PAGE_CHANGING
|
||||||
wx.EVT_CHOICEBOOK_PAGE_CHANGED
|
wx.EVT_CHOICEBOOK_PAGE_CHANGED
|
||||||
wx.EVT_CHOICEBOOK_PAGE_CHANGING
|
wx.EVT_CHOICEBOOK_PAGE_CHANGING
|
||||||
|
|
||||||
|
|
||||||
def test_choicebk2(self):
|
def test_choicebk2(self):
|
||||||
book = wx.Choicebook()
|
book = wx.Choicebook()
|
||||||
book.Create(self.frame)
|
book.Create(self.frame)
|
||||||
|
|
||||||
|
|
||||||
def test_choicebk3(self):
|
def test_choicebk3(self):
|
||||||
book = wx.Choicebook(self.frame)
|
book = wx.Choicebook(self.frame)
|
||||||
book.AddPage(wx.Panel(book), 'one')
|
book.AddPage(wx.Panel(book), 'one')
|
||||||
book.AddPage(wx.Panel(book), 'two')
|
book.AddPage(wx.Panel(book), 'two')
|
||||||
|
|
||||||
|
|
||||||
#---------------------------------------------------------------------------
|
#---------------------------------------------------------------------------
|
||||||
|
|
||||||
if __name__ == '__main__':
|
if __name__ == '__main__':
|
||||||
|
|||||||
@@ -12,33 +12,33 @@ class clipbrd_Tests(wtc.WidgetTestCase):
|
|||||||
if wx.TheClipboard.Open():
|
if wx.TheClipboard.Open():
|
||||||
wx.TheClipboard.SetData(data1)
|
wx.TheClipboard.SetData(data1)
|
||||||
wx.TheClipboard.Close()
|
wx.TheClipboard.Close()
|
||||||
|
|
||||||
# paste
|
# paste
|
||||||
data2 = wx.TextDataObject()
|
data2 = wx.TextDataObject()
|
||||||
if wx.TheClipboard.Open():
|
if wx.TheClipboard.Open():
|
||||||
wx.TheClipboard.GetData(data2)
|
wx.TheClipboard.GetData(data2)
|
||||||
wx.TheClipboard.Close()
|
wx.TheClipboard.Close()
|
||||||
|
|
||||||
self.assertEqual(data2.GetText(), 'This is some data.')
|
self.assertEqual(data2.GetText(), 'This is some data.')
|
||||||
self.assertEqual(data2.Text, 'This is some data.')
|
self.assertEqual(data2.Text, 'This is some data.')
|
||||||
|
|
||||||
|
|
||||||
def test_clpbrd2(self):
|
def test_clpbrd2(self):
|
||||||
# same, but with the context manager
|
# same, but with the context manager
|
||||||
|
|
||||||
# copy
|
# copy
|
||||||
data1 = wx.TextDataObject('This is some data.')
|
data1 = wx.TextDataObject('This is some data.')
|
||||||
with wx.TheClipboard as cb:
|
with wx.TheClipboard as cb:
|
||||||
cb.SetData(data1)
|
cb.SetData(data1)
|
||||||
|
|
||||||
# paste
|
# paste
|
||||||
data2 = wx.TextDataObject()
|
data2 = wx.TextDataObject()
|
||||||
with wx.TheClipboard as cb:
|
with wx.TheClipboard as cb:
|
||||||
wx.TheClipboard.GetData(data2)
|
wx.TheClipboard.GetData(data2)
|
||||||
|
|
||||||
self.assertEqual(data2.GetText(), 'This is some data.')
|
self.assertEqual(data2.GetText(), 'This is some data.')
|
||||||
self.assertEqual(data2.Text, 'This is some data.')
|
self.assertEqual(data2.Text, 'This is some data.')
|
||||||
|
|
||||||
#---------------------------------------------------------------------------
|
#---------------------------------------------------------------------------
|
||||||
|
|
||||||
if __name__ == '__main__':
|
if __name__ == '__main__':
|
||||||
|
|||||||
@@ -11,8 +11,8 @@ class clntdatactnr_Tests(wtc.WidgetTestCase):
|
|||||||
data.SetClientData("This is a test")
|
data.SetClientData("This is a test")
|
||||||
val = data.GetClientData()
|
val = data.GetClientData()
|
||||||
self.assertEqual(val, "This is a test")
|
self.assertEqual(val, "This is a test")
|
||||||
|
|
||||||
|
|
||||||
#---------------------------------------------------------------------------
|
#---------------------------------------------------------------------------
|
||||||
|
|
||||||
if __name__ == '__main__':
|
if __name__ == '__main__':
|
||||||
|
|||||||
@@ -16,10 +16,10 @@ class cmdproc_Tests(wtc.WidgetTestCase):
|
|||||||
return True
|
return True
|
||||||
def Undo(self):
|
def Undo(self):
|
||||||
return True
|
return True
|
||||||
|
|
||||||
cmd = MyCommand(name='TestCommand')
|
cmd = MyCommand(name='TestCommand')
|
||||||
|
|
||||||
|
|
||||||
def test_cmdproc3(self):
|
def test_cmdproc3(self):
|
||||||
class MyCommand(wx.Command):
|
class MyCommand(wx.Command):
|
||||||
def __init__(self, *args, **kw):
|
def __init__(self, *args, **kw):
|
||||||
@@ -33,34 +33,34 @@ class cmdproc_Tests(wtc.WidgetTestCase):
|
|||||||
return True
|
return True
|
||||||
def CanUndo(self):
|
def CanUndo(self):
|
||||||
return True
|
return True
|
||||||
|
|
||||||
cmdproc = wx.CommandProcessor()
|
cmdproc = wx.CommandProcessor()
|
||||||
for name in 'one two three four five'.split():
|
for name in 'one two three four five'.split():
|
||||||
cmd = MyCommand(name=name)
|
cmd = MyCommand(name=name)
|
||||||
cmdproc.Submit(cmd)
|
cmdproc.Submit(cmd)
|
||||||
|
|
||||||
cmds = cmdproc.GetCommands()
|
cmds = cmdproc.GetCommands()
|
||||||
self.assertEqual(len(cmds), 5)
|
self.assertEqual(len(cmds), 5)
|
||||||
self.assertEqual([x.value for x in cmds], [True]*5)
|
self.assertEqual([x.value for x in cmds], [True]*5)
|
||||||
|
|
||||||
self.assertTrue(cmdproc.CanUndo())
|
self.assertTrue(cmdproc.CanUndo())
|
||||||
self.assertFalse(cmdproc.CanRedo())
|
self.assertFalse(cmdproc.CanRedo())
|
||||||
|
|
||||||
cmdproc.Undo()
|
cmdproc.Undo()
|
||||||
cmdproc.Undo()
|
cmdproc.Undo()
|
||||||
self.assertEqual([x.value for x in cmds], [True]*3 + [False]*2)
|
self.assertEqual([x.value for x in cmds], [True]*3 + [False]*2)
|
||||||
|
|
||||||
self.assertTrue(cmdproc.CanRedo())
|
self.assertTrue(cmdproc.CanRedo())
|
||||||
cmdproc.Redo()
|
cmdproc.Redo()
|
||||||
cmdproc.Redo()
|
cmdproc.Redo()
|
||||||
self.assertEqual([x.value for x in cmds], [True]*5)
|
self.assertEqual([x.value for x in cmds], [True]*5)
|
||||||
|
|
||||||
cmdproc.Undo()
|
cmdproc.Undo()
|
||||||
cmdproc.Undo()
|
cmdproc.Undo()
|
||||||
cmdproc.Submit(MyCommand(name='NewCmd'))
|
cmdproc.Submit(MyCommand(name='NewCmd'))
|
||||||
self.assertEqual(len(cmds), 4)
|
self.assertEqual(len(cmds), 4)
|
||||||
|
|
||||||
|
|
||||||
#---------------------------------------------------------------------------
|
#---------------------------------------------------------------------------
|
||||||
|
|
||||||
if __name__ == '__main__':
|
if __name__ == '__main__':
|
||||||
|
|||||||
@@ -6,27 +6,27 @@ import six
|
|||||||
#---------------------------------------------------------------------------
|
#---------------------------------------------------------------------------
|
||||||
|
|
||||||
class cmndata_tests(wtc.WidgetTestCase):
|
class cmndata_tests(wtc.WidgetTestCase):
|
||||||
|
|
||||||
def test_cmndataClassConstructors(self):
|
def test_cmndataClassConstructors(self):
|
||||||
psdd1 = wx.PageSetupDialogData()
|
psdd1 = wx.PageSetupDialogData()
|
||||||
pd1 = wx.PrintData()
|
pd1 = wx.PrintData()
|
||||||
pdd1 = wx.PrintDialogData()
|
pdd1 = wx.PrintDialogData()
|
||||||
|
|
||||||
psdd2 = wx.PageSetupDialogData(pd1)
|
psdd2 = wx.PageSetupDialogData(pd1)
|
||||||
psdd3 = wx.PageSetupDialogData(psdd2)
|
psdd3 = wx.PageSetupDialogData(psdd2)
|
||||||
|
|
||||||
pd2 = wx.PrintData(pd1)
|
pd2 = wx.PrintData(pd1)
|
||||||
|
|
||||||
pdd2 = wx.PrintDialogData(pdd1)
|
pdd2 = wx.PrintDialogData(pdd1)
|
||||||
pdd3 = wx.PrintDialogData(pd1)
|
pdd3 = wx.PrintDialogData(pd1)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
def test_cppMethods(self):
|
def test_cppMethods(self):
|
||||||
pd = wx.PrintData()
|
pd = wx.PrintData()
|
||||||
data = pd.GetPrivData()
|
data = pd.GetPrivData()
|
||||||
pd.SetPrivData(data)
|
pd.SetPrivData(data)
|
||||||
|
|
||||||
# property for the same methods
|
# property for the same methods
|
||||||
data = pd.PrivData
|
data = pd.PrivData
|
||||||
pd.PrivData = data
|
pd.PrivData = data
|
||||||
@@ -36,7 +36,7 @@ class cmndata_tests(wtc.WidgetTestCase):
|
|||||||
psdd = wx.PageSetupDialogData()
|
psdd = wx.PageSetupDialogData()
|
||||||
pd = wx.PrintData()
|
pd = wx.PrintData()
|
||||||
pdd = wx.PrintDialogData()
|
pdd = wx.PrintDialogData()
|
||||||
|
|
||||||
if six.PY3:
|
if six.PY3:
|
||||||
psdd.__bool__()
|
psdd.__bool__()
|
||||||
pd.__bool__()
|
pd.__bool__()
|
||||||
@@ -45,7 +45,7 @@ class cmndata_tests(wtc.WidgetTestCase):
|
|||||||
psdd.__nonzero__()
|
psdd.__nonzero__()
|
||||||
pd.__nonzero__()
|
pd.__nonzero__()
|
||||||
pdd.__nonzero__()
|
pdd.__nonzero__()
|
||||||
|
|
||||||
#---------------------------------------------------------------------------
|
#---------------------------------------------------------------------------
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -5,29 +5,29 @@ import wx
|
|||||||
#---------------------------------------------------------------------------
|
#---------------------------------------------------------------------------
|
||||||
|
|
||||||
class CollapsiblePaneTests(wtc.WidgetTestCase):
|
class CollapsiblePaneTests(wtc.WidgetTestCase):
|
||||||
|
|
||||||
def test_CollPaneCtors(self):
|
def test_CollPaneCtors(self):
|
||||||
c = wx.CollapsiblePane(self.frame, label='label')
|
c = wx.CollapsiblePane(self.frame, label='label')
|
||||||
c = wx.CollapsiblePane(self.frame, -1, 'label', (12, 34), (45, 67))
|
c = wx.CollapsiblePane(self.frame, -1, 'label', (12, 34), (45, 67))
|
||||||
|
|
||||||
c.Collapse()
|
c.Collapse()
|
||||||
c.Expand()
|
c.Expand()
|
||||||
c.IsCollapsed()
|
c.IsCollapsed()
|
||||||
c.IsExpanded()
|
c.IsExpanded()
|
||||||
|
|
||||||
|
|
||||||
def test_CollPaneDefaultCtor(self):
|
def test_CollPaneDefaultCtor(self):
|
||||||
c = wx.CollapsiblePane()
|
c = wx.CollapsiblePane()
|
||||||
c.Create(self.frame)
|
c.Create(self.frame)
|
||||||
|
|
||||||
|
|
||||||
def test_CollPaneProperties(self):
|
def test_CollPaneProperties(self):
|
||||||
c = wx.CollapsiblePane(self.frame)
|
c = wx.CollapsiblePane(self.frame)
|
||||||
|
|
||||||
# do the properties exist?
|
# do the properties exist?
|
||||||
c.Pane
|
c.Pane
|
||||||
|
|
||||||
|
|
||||||
#---------------------------------------------------------------------------
|
#---------------------------------------------------------------------------
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -10,11 +10,11 @@ class colordlg_Tests(wtc.WidgetTestCase):
|
|||||||
data = wx.ColourData()
|
data = wx.ColourData()
|
||||||
dlg = wx.ColourDialog(self.frame, data)
|
dlg = wx.ColourDialog(self.frame, data)
|
||||||
dlg.Destroy()
|
dlg.Destroy()
|
||||||
|
|
||||||
def test_colordlg2(self):
|
def test_colordlg2(self):
|
||||||
wx.GetColourFromUser
|
wx.GetColourFromUser
|
||||||
|
|
||||||
|
|
||||||
#---------------------------------------------------------------------------
|
#---------------------------------------------------------------------------
|
||||||
|
|
||||||
if __name__ == '__main__':
|
if __name__ == '__main__':
|
||||||
|
|||||||
@@ -5,23 +5,23 @@ from unittests import wtc
|
|||||||
#---------------------------------------------------------------------------
|
#---------------------------------------------------------------------------
|
||||||
|
|
||||||
class Colour(wtc.WidgetTestCase):
|
class Colour(wtc.WidgetTestCase):
|
||||||
|
|
||||||
def test_default_ctor(self):
|
def test_default_ctor(self):
|
||||||
c = wx.Colour()
|
c = wx.Colour()
|
||||||
self.assertTrue(not c.IsOk())
|
self.assertTrue(not c.IsOk())
|
||||||
self.assertTrue(c.Get() == (-1,-1,-1,255))
|
self.assertTrue(c.Get() == (-1,-1,-1,255))
|
||||||
|
|
||||||
|
|
||||||
def test_rgb_ctor(self):
|
def test_rgb_ctor(self):
|
||||||
c = wx.Colour(1,2,3)
|
c = wx.Colour(1,2,3)
|
||||||
self.assertTrue(c.Get(False) == (1,2,3))
|
self.assertTrue(c.Get(False) == (1,2,3))
|
||||||
|
|
||||||
|
|
||||||
def test_rgba_ctor(self):
|
def test_rgba_ctor(self):
|
||||||
c = wx.Colour(1,2,3,4)
|
c = wx.Colour(1,2,3,4)
|
||||||
self.assertTrue(c.Get() == (1,2,3,4))
|
self.assertTrue(c.Get() == (1,2,3,4))
|
||||||
|
|
||||||
|
|
||||||
def test_copy_ctor(self):
|
def test_copy_ctor(self):
|
||||||
c1 = wx.Colour(1,2,3,4)
|
c1 = wx.Colour(1,2,3,4)
|
||||||
c2 = wx.Colour(c1)
|
c2 = wx.Colour(c1)
|
||||||
@@ -33,8 +33,8 @@ class Colour(wtc.WidgetTestCase):
|
|||||||
def test_GetPixel(self):
|
def test_GetPixel(self):
|
||||||
c1 = wx.Colour(1,2,3,4)
|
c1 = wx.Colour(1,2,3,4)
|
||||||
p = c1.GetPixel()
|
p = c1.GetPixel()
|
||||||
|
|
||||||
|
|
||||||
if hasattr(wx, 'testColourTypeMap'):
|
if hasattr(wx, 'testColourTypeMap'):
|
||||||
def test_ColourTypemaps(self):
|
def test_ColourTypemaps(self):
|
||||||
c = wx.testColourTypeMap('red')
|
c = wx.testColourTypeMap('red')
|
||||||
@@ -51,8 +51,8 @@ class Colour(wtc.WidgetTestCase):
|
|||||||
self.assertTrue(c.Get() == (1, 2, 3, 0xff))
|
self.assertTrue(c.Get() == (1, 2, 3, 0xff))
|
||||||
c = wx.testColourTypeMap( (1,2,3,4) )
|
c = wx.testColourTypeMap( (1,2,3,4) )
|
||||||
self.assertTrue(c.Get() == (1, 2, 3, 4))
|
self.assertTrue(c.Get() == (1, 2, 3, 4))
|
||||||
|
|
||||||
|
|
||||||
#---------------------------------------------------------------------------
|
#---------------------------------------------------------------------------
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -10,7 +10,7 @@ class combo_Tests(wtc.WidgetTestCase):
|
|||||||
def test_comboConstants(self):
|
def test_comboConstants(self):
|
||||||
wx.CC_SPECIAL_DCLICK
|
wx.CC_SPECIAL_DCLICK
|
||||||
wx.CC_STD_BUTTON
|
wx.CC_STD_BUTTON
|
||||||
|
|
||||||
wx.ComboCtrlFeatures
|
wx.ComboCtrlFeatures
|
||||||
wx.ComboCtrlFeatures.MovableButton
|
wx.ComboCtrlFeatures.MovableButton
|
||||||
wx.ComboCtrlFeatures.BitmapButton
|
wx.ComboCtrlFeatures.BitmapButton
|
||||||
@@ -20,8 +20,8 @@ class combo_Tests(wtc.WidgetTestCase):
|
|||||||
wx.ComboCtrlFeatures.PaintWritable
|
wx.ComboCtrlFeatures.PaintWritable
|
||||||
wx.ComboCtrlFeatures.Borderless
|
wx.ComboCtrlFeatures.Borderless
|
||||||
wx.ComboCtrlFeatures.All
|
wx.ComboCtrlFeatures.All
|
||||||
|
|
||||||
|
|
||||||
def test_combo1(self):
|
def test_combo1(self):
|
||||||
ns = self.execSample('combo/combo1.py')
|
ns = self.execSample('combo/combo1.py')
|
||||||
frame = ns.TestFrame(self.frame)
|
frame = ns.TestFrame(self.frame)
|
||||||
@@ -29,9 +29,9 @@ class combo_Tests(wtc.WidgetTestCase):
|
|||||||
frame.cc.SetValueByUser('Item-25')
|
frame.cc.SetValueByUser('Item-25')
|
||||||
self.waitFor(100)
|
self.waitFor(100)
|
||||||
frame.cc.Popup()
|
frame.cc.Popup()
|
||||||
self.waitFor(100)
|
self.waitFor(100)
|
||||||
frame.Close()
|
frame.Close()
|
||||||
|
|
||||||
|
|
||||||
#---------------------------------------------------------------------------
|
#---------------------------------------------------------------------------
|
||||||
|
|
||||||
|
|||||||
@@ -5,16 +5,16 @@ import wx
|
|||||||
#---------------------------------------------------------------------------
|
#---------------------------------------------------------------------------
|
||||||
|
|
||||||
class ComboBoxTests(wtc.WidgetTestCase):
|
class ComboBoxTests(wtc.WidgetTestCase):
|
||||||
|
|
||||||
def test_ComboBoxCtors(self):
|
def test_ComboBoxCtors(self):
|
||||||
c = wx.ComboBox(self.frame, value='value', choices="one two three four".split())
|
c = wx.ComboBox(self.frame, value='value', choices="one two three four".split())
|
||||||
c = wx.ComboBox(self.frame, -1, 'value', wx.Point(10,10), wx.Size(80,-1),
|
c = wx.ComboBox(self.frame, -1, 'value', wx.Point(10,10), wx.Size(80,-1),
|
||||||
"one two three four".split(), 0)
|
"one two three four".split(), 0)
|
||||||
c = wx.ComboBox(self.frame, -1, "", (10,10), (80,-1), "one two three four".split(), 0)
|
c = wx.ComboBox(self.frame, -1, "", (10,10), (80,-1), "one two three four".split(), 0)
|
||||||
|
|
||||||
self.assertTrue(c.GetCount() == 4)
|
self.assertTrue(c.GetCount() == 4)
|
||||||
|
|
||||||
|
|
||||||
def test_ComboBoxDefaultCtor(self):
|
def test_ComboBoxDefaultCtor(self):
|
||||||
c = wx.ComboBox()
|
c = wx.ComboBox()
|
||||||
c.Create(self.frame, value="value", choices="one two three four".split())
|
c.Create(self.frame, value="value", choices="one two three four".split())
|
||||||
@@ -31,9 +31,9 @@ class ComboBoxTests(wtc.WidgetTestCase):
|
|||||||
|
|
||||||
def test_comboboxTextSelection(self):
|
def test_comboboxTextSelection(self):
|
||||||
c = wx.ComboBox(self.frame, value='value', choices="one two three four".split())
|
c = wx.ComboBox(self.frame, value='value', choices="one two three four".split())
|
||||||
c.SetTextSelection(2,4)
|
c.SetTextSelection(2,4)
|
||||||
self.assertEqual(c.GetTextSelection(), (2,4))
|
self.assertEqual(c.GetTextSelection(), (2,4))
|
||||||
|
|
||||||
#---------------------------------------------------------------------------
|
#---------------------------------------------------------------------------
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -20,7 +20,7 @@ class commandlinkbutton_Tests(wtc.WidgetTestCase):
|
|||||||
b.Label
|
b.Label
|
||||||
b.MainLabel
|
b.MainLabel
|
||||||
b.Note
|
b.Note
|
||||||
|
|
||||||
#---------------------------------------------------------------------------
|
#---------------------------------------------------------------------------
|
||||||
|
|
||||||
if __name__ == '__main__':
|
if __name__ == '__main__':
|
||||||
|
|||||||
@@ -8,7 +8,7 @@ cfgFilename = os.path.join(os.path.dirname(__file__), 'cfgtest')
|
|||||||
#---------------------------------------------------------------------------
|
#---------------------------------------------------------------------------
|
||||||
|
|
||||||
class ConfigTests(wtc.WidgetTestCase):
|
class ConfigTests(wtc.WidgetTestCase):
|
||||||
|
|
||||||
def writeStuff(self, cfg):
|
def writeStuff(self, cfg):
|
||||||
cfg.SetPath('/one/two/three')
|
cfg.SetPath('/one/two/three')
|
||||||
cfg.Write('key', 'value')
|
cfg.Write('key', 'value')
|
||||||
@@ -26,12 +26,12 @@ class ConfigTests(wtc.WidgetTestCase):
|
|||||||
del cfg
|
del cfg
|
||||||
if os.path.exists(name):
|
if os.path.exists(name):
|
||||||
os.remove(name)
|
os.remove(name)
|
||||||
|
|
||||||
|
|
||||||
def test_Config2(self):
|
def test_Config2(self):
|
||||||
null = wx.LogNull()
|
null = wx.LogNull()
|
||||||
name = cfgFilename + '_2'
|
name = cfgFilename + '_2'
|
||||||
|
|
||||||
cfg = wx.Config('unittest_ConfigTests', localFilename=name)
|
cfg = wx.Config('unittest_ConfigTests', localFilename=name)
|
||||||
self.writeStuff(cfg)
|
self.writeStuff(cfg)
|
||||||
|
|
||||||
@@ -41,7 +41,7 @@ class ConfigTests(wtc.WidgetTestCase):
|
|||||||
self.assertTrue(cfg.GetPath() == '/one/two/three')
|
self.assertTrue(cfg.GetPath() == '/one/two/three')
|
||||||
del changer
|
del changer
|
||||||
self.assertTrue(cfg.GetPath() == '/before')
|
self.assertTrue(cfg.GetPath() == '/before')
|
||||||
|
|
||||||
del cfg
|
del cfg
|
||||||
if os.path.exists(name):
|
if os.path.exists(name):
|
||||||
os.remove(name)
|
os.remove(name)
|
||||||
@@ -50,7 +50,7 @@ class ConfigTests(wtc.WidgetTestCase):
|
|||||||
def test_Config3(self):
|
def test_Config3(self):
|
||||||
null = wx.LogNull()
|
null = wx.LogNull()
|
||||||
name = cfgFilename + '_3'
|
name = cfgFilename + '_3'
|
||||||
|
|
||||||
cfg = wx.Config('unittest_ConfigTests', localFilename=name)
|
cfg = wx.Config('unittest_ConfigTests', localFilename=name)
|
||||||
self.writeStuff(cfg)
|
self.writeStuff(cfg)
|
||||||
|
|
||||||
@@ -59,16 +59,16 @@ class ConfigTests(wtc.WidgetTestCase):
|
|||||||
with wx.ConfigPathChanger(cfg, '/one/two/three/'):
|
with wx.ConfigPathChanger(cfg, '/one/two/three/'):
|
||||||
self.assertTrue(cfg.GetPath() == '/one/two/three')
|
self.assertTrue(cfg.GetPath() == '/one/two/three')
|
||||||
self.assertTrue(cfg.GetPath() == '/before')
|
self.assertTrue(cfg.GetPath() == '/before')
|
||||||
|
|
||||||
del cfg
|
del cfg
|
||||||
if os.path.exists(name):
|
if os.path.exists(name):
|
||||||
os.remove(name)
|
os.remove(name)
|
||||||
|
|
||||||
|
|
||||||
def test_Config4(self):
|
def test_Config4(self):
|
||||||
null = wx.LogNull()
|
null = wx.LogNull()
|
||||||
name = cfgFilename + '_4'
|
name = cfgFilename + '_4'
|
||||||
|
|
||||||
cfg0 = wx.Config('unittest_ConfigTests', localFilename=name)
|
cfg0 = wx.Config('unittest_ConfigTests', localFilename=name)
|
||||||
wx.Config.Set(cfg0)
|
wx.Config.Set(cfg0)
|
||||||
|
|
||||||
@@ -76,7 +76,7 @@ class ConfigTests(wtc.WidgetTestCase):
|
|||||||
#self.assertTrue(cfg is cfg0)
|
#self.assertTrue(cfg is cfg0)
|
||||||
self.writeStuff(cfg)
|
self.writeStuff(cfg)
|
||||||
del cfg
|
del cfg
|
||||||
|
|
||||||
cfg = wx.Config.Get()
|
cfg = wx.Config.Get()
|
||||||
cfg.SetPath('/one/two/three')
|
cfg.SetPath('/one/two/three')
|
||||||
self.assertTrue(cfg.GetPath() == '/one/two/three')
|
self.assertTrue(cfg.GetPath() == '/one/two/three')
|
||||||
@@ -96,13 +96,13 @@ class ConfigTests(wtc.WidgetTestCase):
|
|||||||
def test_Config5(self):
|
def test_Config5(self):
|
||||||
null = wx.LogNull()
|
null = wx.LogNull()
|
||||||
name = cfgFilename + '_5'
|
name = cfgFilename + '_5'
|
||||||
|
|
||||||
cfg = wx.Config('unittest_ConfigTests', localFilename=name)
|
cfg = wx.Config('unittest_ConfigTests', localFilename=name)
|
||||||
cfg.SetPath('/zero')
|
cfg.SetPath('/zero')
|
||||||
cfg.Write('key1', 'value')
|
cfg.Write('key1', 'value')
|
||||||
cfg.Write('key2', 'value')
|
cfg.Write('key2', 'value')
|
||||||
cfg.Write('key3', 'value')
|
cfg.Write('key3', 'value')
|
||||||
|
|
||||||
cfg.SetPath('/one')
|
cfg.SetPath('/one')
|
||||||
cfg.Write('key1', 'value')
|
cfg.Write('key1', 'value')
|
||||||
cfg.Write('key2', 'value')
|
cfg.Write('key2', 'value')
|
||||||
@@ -119,7 +119,7 @@ class ConfigTests(wtc.WidgetTestCase):
|
|||||||
cfg.Write('key3', 'value')
|
cfg.Write('key3', 'value')
|
||||||
|
|
||||||
cfg.Flush()
|
cfg.Flush()
|
||||||
|
|
||||||
cfg.SetPath('/')
|
cfg.SetPath('/')
|
||||||
count = 0
|
count = 0
|
||||||
more, group, index = cfg.GetFirstGroup()
|
more, group, index = cfg.GetFirstGroup()
|
||||||
@@ -127,7 +127,7 @@ class ConfigTests(wtc.WidgetTestCase):
|
|||||||
count += 1
|
count += 1
|
||||||
more, group, index = cfg.GetNextGroup(index)
|
more, group, index = cfg.GetNextGroup(index)
|
||||||
self.assertEqual(count, 4)
|
self.assertEqual(count, 4)
|
||||||
|
|
||||||
cfg.SetPath('/two')
|
cfg.SetPath('/two')
|
||||||
count = 0
|
count = 0
|
||||||
more, entry, index = cfg.GetFirstEntry()
|
more, entry, index = cfg.GetFirstEntry()
|
||||||
@@ -135,7 +135,7 @@ class ConfigTests(wtc.WidgetTestCase):
|
|||||||
count += 1
|
count += 1
|
||||||
more, entry, index = cfg.GetNextEntry(index)
|
more, entry, index = cfg.GetNextEntry(index)
|
||||||
self.assertEqual(count, 3)
|
self.assertEqual(count, 3)
|
||||||
|
|
||||||
del cfg
|
del cfg
|
||||||
if os.path.exists(name):
|
if os.path.exists(name):
|
||||||
os.remove(name)
|
os.remove(name)
|
||||||
@@ -144,13 +144,13 @@ class ConfigTests(wtc.WidgetTestCase):
|
|||||||
def test_Config6(self):
|
def test_Config6(self):
|
||||||
null = wx.LogNull()
|
null = wx.LogNull()
|
||||||
name = cfgFilename + '_6'
|
name = cfgFilename + '_6'
|
||||||
|
|
||||||
cfg = wx.FileConfig('unittest_ConfigTests', localFilename=name)
|
cfg = wx.FileConfig('unittest_ConfigTests', localFilename=name)
|
||||||
cfg.SetPath('/zero')
|
cfg.SetPath('/zero')
|
||||||
cfg.Write('key1', 'value')
|
cfg.Write('key1', 'value')
|
||||||
cfg.Write('key2', 'value')
|
cfg.Write('key2', 'value')
|
||||||
cfg.Write('key3', 'value')
|
cfg.Write('key3', 'value')
|
||||||
|
|
||||||
cfg.SetPath('/one')
|
cfg.SetPath('/one')
|
||||||
cfg.Write('key1', 'value')
|
cfg.Write('key1', 'value')
|
||||||
cfg.Write('key2', 'value')
|
cfg.Write('key2', 'value')
|
||||||
@@ -167,7 +167,7 @@ class ConfigTests(wtc.WidgetTestCase):
|
|||||||
cfg.Write('key3', 'value')
|
cfg.Write('key3', 'value')
|
||||||
|
|
||||||
cfg.Flush()
|
cfg.Flush()
|
||||||
|
|
||||||
cfg.SetPath('/')
|
cfg.SetPath('/')
|
||||||
count = 0
|
count = 0
|
||||||
more, group, index = cfg.GetFirstGroup()
|
more, group, index = cfg.GetFirstGroup()
|
||||||
@@ -175,7 +175,7 @@ class ConfigTests(wtc.WidgetTestCase):
|
|||||||
count += 1
|
count += 1
|
||||||
more, group, index = cfg.GetNextGroup(index)
|
more, group, index = cfg.GetNextGroup(index)
|
||||||
self.assertEqual(count, 4)
|
self.assertEqual(count, 4)
|
||||||
|
|
||||||
cfg.SetPath('/two')
|
cfg.SetPath('/two')
|
||||||
count = 0
|
count = 0
|
||||||
more, entry, index = cfg.GetFirstEntry()
|
more, entry, index = cfg.GetFirstEntry()
|
||||||
@@ -183,11 +183,11 @@ class ConfigTests(wtc.WidgetTestCase):
|
|||||||
count += 1
|
count += 1
|
||||||
more, entry, index = cfg.GetNextEntry(index)
|
more, entry, index = cfg.GetNextEntry(index)
|
||||||
self.assertEqual(count, 3)
|
self.assertEqual(count, 3)
|
||||||
|
|
||||||
del cfg
|
del cfg
|
||||||
if os.path.exists(name):
|
if os.path.exists(name):
|
||||||
os.remove(name)
|
os.remove(name)
|
||||||
|
|
||||||
#---------------------------------------------------------------------------
|
#---------------------------------------------------------------------------
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -5,17 +5,17 @@ import wx
|
|||||||
#---------------------------------------------------------------------------
|
#---------------------------------------------------------------------------
|
||||||
|
|
||||||
class ControlTests(wtc.WidgetTestCase):
|
class ControlTests(wtc.WidgetTestCase):
|
||||||
|
|
||||||
def test_ControlCtors(self):
|
def test_ControlCtors(self):
|
||||||
c = wx.Control(self.frame)
|
c = wx.Control(self.frame)
|
||||||
c = wx.Control(self.frame, -1, wx.Point(10,10), wx.Size(80,-1))
|
c = wx.Control(self.frame, -1, wx.Point(10,10), wx.Size(80,-1))
|
||||||
|
|
||||||
|
|
||||||
def test_ControlDefaultCtor(self):
|
def test_ControlDefaultCtor(self):
|
||||||
c = wx.Control()
|
c = wx.Control()
|
||||||
c.Create(self.frame)
|
c.Create(self.frame)
|
||||||
|
|
||||||
|
|
||||||
#---------------------------------------------------------------------------
|
#---------------------------------------------------------------------------
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -9,7 +9,7 @@ class cshelp_Tests(wtc.WidgetTestCase):
|
|||||||
def test_cshelp1(self):
|
def test_cshelp1(self):
|
||||||
provider = wx.SimpleHelpProvider()
|
provider = wx.SimpleHelpProvider()
|
||||||
wx.HelpProvider.Set(provider)
|
wx.HelpProvider.Set(provider)
|
||||||
|
|
||||||
pnl = wx.Panel(self.frame)
|
pnl = wx.Panel(self.frame)
|
||||||
pnl.SetHelpText("HelpMe!")
|
pnl.SetHelpText("HelpMe!")
|
||||||
cBtn = wx.ContextHelpButton(pnl)
|
cBtn = wx.ContextHelpButton(pnl)
|
||||||
@@ -17,18 +17,18 @@ class cshelp_Tests(wtc.WidgetTestCase):
|
|||||||
# Make sure we haven't borked the magic ID
|
# Make sure we haven't borked the magic ID
|
||||||
assert cBtn.GetId() == wx.ID_CONTEXT_HELP
|
assert cBtn.GetId() == wx.ID_CONTEXT_HELP
|
||||||
|
|
||||||
|
|
||||||
def test_cshelp2(self):
|
def test_cshelp2(self):
|
||||||
wx.wxEVT_HELP
|
wx.wxEVT_HELP
|
||||||
wx.wxEVT_DETAILED_HELP
|
wx.wxEVT_DETAILED_HELP
|
||||||
|
|
||||||
wx.EVT_HELP
|
wx.EVT_HELP
|
||||||
wx.EVT_HELP_RANGE
|
wx.EVT_HELP_RANGE
|
||||||
wx.EVT_DETAILED_HELP
|
wx.EVT_DETAILED_HELP
|
||||||
wx.EVT_DETAILED_HELP_RANGE
|
wx.EVT_DETAILED_HELP_RANGE
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
#---------------------------------------------------------------------------
|
#---------------------------------------------------------------------------
|
||||||
|
|
||||||
if __name__ == '__main__':
|
if __name__ == '__main__':
|
||||||
|
|||||||
@@ -10,7 +10,7 @@ curFile = os.path.join(os.path.dirname(__file__), 'horse.cur')
|
|||||||
#---------------------------------------------------------------------------
|
#---------------------------------------------------------------------------
|
||||||
|
|
||||||
class CursorTests(wtc.WidgetTestCase):
|
class CursorTests(wtc.WidgetTestCase):
|
||||||
|
|
||||||
def test_CursorCtors(self):
|
def test_CursorCtors(self):
|
||||||
# stock
|
# stock
|
||||||
c = wx.Cursor(wx.CURSOR_HAND)
|
c = wx.Cursor(wx.CURSOR_HAND)
|
||||||
@@ -19,7 +19,7 @@ class CursorTests(wtc.WidgetTestCase):
|
|||||||
# from file
|
# from file
|
||||||
c = wx.Cursor(curFile, wx.BITMAP_TYPE_CUR)
|
c = wx.Cursor(curFile, wx.BITMAP_TYPE_CUR)
|
||||||
self.assertTrue(c.IsOk())
|
self.assertTrue(c.IsOk())
|
||||||
|
|
||||||
# from image
|
# from image
|
||||||
img = wx.Image(pngFile)
|
img = wx.Image(pngFile)
|
||||||
img.SetOption(wx.IMAGE_OPTION_CUR_HOTSPOT_X, 1)
|
img.SetOption(wx.IMAGE_OPTION_CUR_HOTSPOT_X, 1)
|
||||||
@@ -30,7 +30,7 @@ class CursorTests(wtc.WidgetTestCase):
|
|||||||
# copy
|
# copy
|
||||||
c2 = wx.Cursor(c)
|
c2 = wx.Cursor(c)
|
||||||
self.assertTrue(c2.IsOk())
|
self.assertTrue(c2.IsOk())
|
||||||
|
|
||||||
|
|
||||||
def test_CursorStockIDsExist(self):
|
def test_CursorStockIDsExist(self):
|
||||||
wx.CURSOR_ARROW
|
wx.CURSOR_ARROW
|
||||||
@@ -62,8 +62,8 @@ class CursorTests(wtc.WidgetTestCase):
|
|||||||
wx.CURSOR_DEFAULT
|
wx.CURSOR_DEFAULT
|
||||||
wx.CURSOR_COPY_ARROW
|
wx.CURSOR_COPY_ARROW
|
||||||
wx.CURSOR_ARROWWAIT
|
wx.CURSOR_ARROWWAIT
|
||||||
|
|
||||||
|
|
||||||
def test_Cursor__nonzero__(self):
|
def test_Cursor__nonzero__(self):
|
||||||
c1 = wx.Cursor()
|
c1 = wx.Cursor()
|
||||||
self.assertTrue( not c1.IsOk() )
|
self.assertTrue( not c1.IsOk() )
|
||||||
@@ -85,13 +85,13 @@ class CursorTests(wtc.WidgetTestCase):
|
|||||||
nzcheck = True
|
nzcheck = True
|
||||||
self.assertTrue(nzcheck)
|
self.assertTrue(nzcheck)
|
||||||
|
|
||||||
|
|
||||||
def test_NullCursor(self):
|
def test_NullCursor(self):
|
||||||
# just make sure this one exists
|
# just make sure this one exists
|
||||||
wx.NullCursor
|
wx.NullCursor
|
||||||
self.assertTrue(not wx.NullCursor.IsOk())
|
self.assertTrue(not wx.NullCursor.IsOk())
|
||||||
|
|
||||||
|
|
||||||
def test_StockCursorsExist(self):
|
def test_StockCursorsExist(self):
|
||||||
wx.STANDARD_CURSOR
|
wx.STANDARD_CURSOR
|
||||||
wx.HOURGLASS_CURSOR
|
wx.HOURGLASS_CURSOR
|
||||||
@@ -101,8 +101,8 @@ class CursorTests(wtc.WidgetTestCase):
|
|||||||
self.assertTrue(wx.STANDARD_CURSOR.IsOk())
|
self.assertTrue(wx.STANDARD_CURSOR.IsOk())
|
||||||
self.assertTrue(wx.HOURGLASS_CURSOR.IsOk())
|
self.assertTrue(wx.HOURGLASS_CURSOR.IsOk())
|
||||||
self.assertTrue(wx.CROSS_CURSOR.IsOk())
|
self.assertTrue(wx.CROSS_CURSOR.IsOk())
|
||||||
|
|
||||||
|
|
||||||
#---------------------------------------------------------------------------
|
#---------------------------------------------------------------------------
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -11,16 +11,16 @@ pngFile = os.path.join(os.path.dirname(__file__), 'toucan.png')
|
|||||||
#---------------------------------------------------------------------------
|
#---------------------------------------------------------------------------
|
||||||
|
|
||||||
class DataObjTests(wtc.WidgetTestCase):
|
class DataObjTests(wtc.WidgetTestCase):
|
||||||
|
|
||||||
def test_DataFormat(self):
|
def test_DataFormat(self):
|
||||||
fmt1 = wx.DataFormat('my custom format')
|
fmt1 = wx.DataFormat('my custom format')
|
||||||
fmt2 = wx.DataFormat(wx.DF_TEXT)
|
fmt2 = wx.DataFormat(wx.DF_TEXT)
|
||||||
self.assertTrue(fmt1 != fmt2)
|
self.assertTrue(fmt1 != fmt2)
|
||||||
fmt3 = wx.DataFormat(wx.DF_TEXT)
|
fmt3 = wx.DataFormat(wx.DF_TEXT)
|
||||||
self.assertTrue(fmt2 == fmt3)
|
self.assertTrue(fmt2 == fmt3)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
def test_DataFormatIDsExist(self):
|
def test_DataFormatIDsExist(self):
|
||||||
wx.DF_INVALID
|
wx.DF_INVALID
|
||||||
wx.DF_TEXT
|
wx.DF_TEXT
|
||||||
@@ -44,37 +44,37 @@ class DataObjTests(wtc.WidgetTestCase):
|
|||||||
wx.DF_MAX
|
wx.DF_MAX
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
def test_DataObjectGetAllFormats(self):
|
def test_DataObjectGetAllFormats(self):
|
||||||
class MyDataObject(wx.DataObject):
|
class MyDataObject(wx.DataObject):
|
||||||
def __init__(self):
|
def __init__(self):
|
||||||
wx.DataObject.__init__(self)
|
wx.DataObject.__init__(self)
|
||||||
self.myFormats = [wx.DataFormat(wx.DF_TEXT),
|
self.myFormats = [wx.DataFormat(wx.DF_TEXT),
|
||||||
wx.DataFormat(wx.DF_UNICODETEXT)]
|
wx.DataFormat(wx.DF_UNICODETEXT)]
|
||||||
|
|
||||||
def GetAllFormats(self, d):
|
def GetAllFormats(self, d):
|
||||||
return self.myFormats
|
return self.myFormats
|
||||||
|
|
||||||
def GetFormatCount(self, d):
|
def GetFormatCount(self, d):
|
||||||
return len(self.myFormats)
|
return len(self.myFormats)
|
||||||
|
|
||||||
data = MyDataObject()
|
data = MyDataObject()
|
||||||
if hasattr(data, '_testGetAllFormats'):
|
if hasattr(data, '_testGetAllFormats'):
|
||||||
data._testGetAllFormats()
|
data._testGetAllFormats()
|
||||||
|
|
||||||
# TODO: Get this fixed! See https://groups.google.com/d/topic/wx-dev/wFxevpvbhvQ/discussion
|
# TODO: Get this fixed! See https://groups.google.com/d/topic/wx-dev/wFxevpvbhvQ/discussion
|
||||||
@unittest.skipIf(sys.platform == 'darwin', 'Using wx.DF_TEXT currently fails on Mac')
|
@unittest.skipIf(sys.platform == 'darwin', 'Using wx.DF_TEXT currently fails on Mac')
|
||||||
def test_DataObject(self):
|
def test_DataObject(self):
|
||||||
class MyDataObject(wx.DataObject):
|
class MyDataObject(wx.DataObject):
|
||||||
def __init__(self, value=''):
|
def __init__(self, value=''):
|
||||||
wx.DataObject.__init__(self)
|
wx.DataObject.__init__(self)
|
||||||
self.myFormats = [wx.DataFormat(wx.DF_TEXT)]
|
self.myFormats = [wx.DataFormat(wx.DF_TEXT)]
|
||||||
self.myData = wtc.mybytes(value)
|
self.myData = wtc.mybytes(value)
|
||||||
|
|
||||||
def GetAllFormats(self, d):
|
def GetAllFormats(self, d):
|
||||||
return self.myFormats
|
return self.myFormats
|
||||||
def GetFormatCount(self, d):
|
def GetFormatCount(self, d):
|
||||||
return len(self.myFormats)
|
return len(self.myFormats)
|
||||||
def GetPreferredFormat(self, d):
|
def GetPreferredFormat(self, d):
|
||||||
return self.myFormats[0]
|
return self.myFormats[0]
|
||||||
|
|
||||||
@@ -84,82 +84,82 @@ class DataObjTests(wtc.WidgetTestCase):
|
|||||||
# a null character at the end for our custom format using
|
# a null character at the end for our custom format using
|
||||||
# wx.DF_TEXT.
|
# wx.DF_TEXT.
|
||||||
return len(self.myData)+1
|
return len(self.myData)+1
|
||||||
|
|
||||||
def GetDataHere(self, format, buf):
|
def GetDataHere(self, format, buf):
|
||||||
# copy our local data value to buf
|
# copy our local data value to buf
|
||||||
assert isinstance(buf, memoryview)
|
assert isinstance(buf, memoryview)
|
||||||
assert len(buf) == len(self.myData)+1
|
assert len(buf) == len(self.myData)+1
|
||||||
buf[:] = (self.myData + b'\0') # add the extra byte
|
buf[:] = (self.myData + b'\0') # add the extra byte
|
||||||
return True
|
return True
|
||||||
|
|
||||||
def SetData(self, format, buf):
|
def SetData(self, format, buf):
|
||||||
# copy from buf to our local data value
|
# copy from buf to our local data value
|
||||||
assert isinstance(buf, memoryview)
|
assert isinstance(buf, memoryview)
|
||||||
self.myData = buf.tobytes()
|
self.myData = buf.tobytes()
|
||||||
if self.myData[-1] in [b'\0', 0]:
|
if self.myData[-1] in [b'\0', 0]:
|
||||||
# strip off the extra byte at the end
|
# strip off the extra byte at the end
|
||||||
self.myData = self.myData[:-1]
|
self.myData = self.myData[:-1]
|
||||||
return True
|
return True
|
||||||
|
|
||||||
# copy
|
# copy
|
||||||
data1 = MyDataObject('This is some data.')
|
data1 = MyDataObject('This is some data.')
|
||||||
if wx.TheClipboard.Open():
|
if wx.TheClipboard.Open():
|
||||||
wx.TheClipboard.SetData(data1)
|
wx.TheClipboard.SetData(data1)
|
||||||
wx.TheClipboard.Close()
|
wx.TheClipboard.Close()
|
||||||
|
|
||||||
# paste
|
# paste
|
||||||
data2 = MyDataObject()
|
data2 = MyDataObject()
|
||||||
if wx.TheClipboard.Open():
|
if wx.TheClipboard.Open():
|
||||||
wx.TheClipboard.GetData(data2)
|
wx.TheClipboard.GetData(data2)
|
||||||
wx.TheClipboard.Close()
|
wx.TheClipboard.Close()
|
||||||
|
|
||||||
self.assertEqual(data1.myData, data2.myData)
|
self.assertEqual(data1.myData, data2.myData)
|
||||||
|
|
||||||
|
|
||||||
def test_DataObject2(self):
|
def test_DataObject2(self):
|
||||||
# More-or-less a duplicate of the above, but with a custom data format
|
# More-or-less a duplicate of the above, but with a custom data format
|
||||||
class MyDataObject(wx.DataObject):
|
class MyDataObject(wx.DataObject):
|
||||||
def __init__(self, value=''):
|
def __init__(self, value=''):
|
||||||
wx.DataObject.__init__(self)
|
wx.DataObject.__init__(self)
|
||||||
self.myFormats = [wx.DataFormat("My Custom DataFormat")]
|
self.myFormats = [wx.DataFormat("My Custom DataFormat")]
|
||||||
self.myData = wtc.mybytes(value)
|
self.myData = wtc.mybytes(value)
|
||||||
|
|
||||||
def GetAllFormats(self, d):
|
def GetAllFormats(self, d):
|
||||||
return self.myFormats
|
return self.myFormats
|
||||||
def GetFormatCount(self, d):
|
def GetFormatCount(self, d):
|
||||||
return len(self.myFormats)
|
return len(self.myFormats)
|
||||||
def GetPreferredFormat(self, d):
|
def GetPreferredFormat(self, d):
|
||||||
return self.myFormats[0]
|
return self.myFormats[0]
|
||||||
def GetDataSize(self, format):
|
def GetDataSize(self, format):
|
||||||
return len(self.myData)
|
return len(self.myData)
|
||||||
|
|
||||||
def GetDataHere(self, format, buf):
|
def GetDataHere(self, format, buf):
|
||||||
# copy our local data value to buf
|
# copy our local data value to buf
|
||||||
assert isinstance(buf, memoryview)
|
assert isinstance(buf, memoryview)
|
||||||
buf[:] = self.myData
|
buf[:] = self.myData
|
||||||
return True
|
return True
|
||||||
|
|
||||||
def SetData(self, format, buf):
|
def SetData(self, format, buf):
|
||||||
# copy from buf to our local data value
|
# copy from buf to our local data value
|
||||||
assert isinstance(buf, memoryview)
|
assert isinstance(buf, memoryview)
|
||||||
self.myData = buf.tobytes()
|
self.myData = buf.tobytes()
|
||||||
return True
|
return True
|
||||||
|
|
||||||
# copy
|
# copy
|
||||||
data1 = MyDataObject('This is some data.')
|
data1 = MyDataObject('This is some data.')
|
||||||
if wx.TheClipboard.Open():
|
if wx.TheClipboard.Open():
|
||||||
wx.TheClipboard.SetData(data1)
|
wx.TheClipboard.SetData(data1)
|
||||||
wx.TheClipboard.Close()
|
wx.TheClipboard.Close()
|
||||||
|
|
||||||
# paste
|
# paste
|
||||||
data2 = MyDataObject()
|
data2 = MyDataObject()
|
||||||
if wx.TheClipboard.Open():
|
if wx.TheClipboard.Open():
|
||||||
wx.TheClipboard.GetData(data2)
|
wx.TheClipboard.GetData(data2)
|
||||||
wx.TheClipboard.Close()
|
wx.TheClipboard.Close()
|
||||||
|
|
||||||
self.assertEqual(data1.myData, data2.myData)
|
self.assertEqual(data1.myData, data2.myData)
|
||||||
|
|
||||||
|
|
||||||
def test_DataObjectSimple1(self):
|
def test_DataObjectSimple1(self):
|
||||||
df = wx.DataFormat(wx.DF_TEXT)
|
df = wx.DataFormat(wx.DF_TEXT)
|
||||||
dobj = wx.DataObjectSimple(df)
|
dobj = wx.DataObjectSimple(df)
|
||||||
@@ -167,50 +167,50 @@ class DataObjTests(wtc.WidgetTestCase):
|
|||||||
self.assertTrue(dobj.GetFormat() == df)
|
self.assertTrue(dobj.GetFormat() == df)
|
||||||
self.assertTrue(dobj.GetAllFormats()[0] == df)
|
self.assertTrue(dobj.GetAllFormats()[0] == df)
|
||||||
|
|
||||||
|
|
||||||
# TODO: Get this fixed! See https://groups.google.com/d/topic/wx-dev/wFxevpvbhvQ/discussion
|
# TODO: Get this fixed! See https://groups.google.com/d/topic/wx-dev/wFxevpvbhvQ/discussion
|
||||||
@unittest.skipIf(sys.platform == 'darwin', 'Using wx.DF_TEXT currently fails on Mac')
|
@unittest.skipIf(sys.platform == 'darwin', 'Using wx.DF_TEXT currently fails on Mac')
|
||||||
def test_DataObjectSimple2(self):
|
def test_DataObjectSimple2(self):
|
||||||
class MyDataObject(wx.DataObjectSimple):
|
class MyDataObject(wx.DataObjectSimple):
|
||||||
def __init__(self, value=''):
|
def __init__(self, value=''):
|
||||||
wx.DataObjectSimple.__init__(self)
|
wx.DataObjectSimple.__init__(self)
|
||||||
self.SetFormat(wx.DataFormat(wx.DF_TEXT))
|
self.SetFormat(wx.DataFormat(wx.DF_TEXT))
|
||||||
self.myData = wtc.mybytes(value)
|
self.myData = wtc.mybytes(value)
|
||||||
|
|
||||||
def GetDataSize(self):
|
def GetDataSize(self):
|
||||||
# See notes above about the need for a null terminator when
|
# See notes above about the need for a null terminator when
|
||||||
# using wx.DF_TEXT on Windows.
|
# using wx.DF_TEXT on Windows.
|
||||||
return len(self.myData)+1
|
return len(self.myData)+1
|
||||||
|
|
||||||
def GetDataHere(self, buf):
|
def GetDataHere(self, buf):
|
||||||
# copy our local data value to buf
|
# copy our local data value to buf
|
||||||
assert isinstance(buf, memoryview)
|
assert isinstance(buf, memoryview)
|
||||||
buf[:] = (self.myData + b'\0')
|
buf[:] = (self.myData + b'\0')
|
||||||
return True
|
return True
|
||||||
|
|
||||||
def SetData(self, buf):
|
def SetData(self, buf):
|
||||||
# copy from buf to our local data value
|
# copy from buf to our local data value
|
||||||
assert isinstance(buf, memoryview)
|
assert isinstance(buf, memoryview)
|
||||||
self.myData = buf.tobytes()
|
self.myData = buf.tobytes()
|
||||||
if self.myData[-1] in [b'\0', 0]:
|
if self.myData[-1] in [b'\0', 0]:
|
||||||
self.myData = self.myData[:-1]
|
self.myData = self.myData[:-1]
|
||||||
return True
|
return True
|
||||||
|
|
||||||
# copy
|
# copy
|
||||||
data1 = MyDataObject('This is some data.')
|
data1 = MyDataObject('This is some data.')
|
||||||
if wx.TheClipboard.Open():
|
if wx.TheClipboard.Open():
|
||||||
wx.TheClipboard.SetData(data1)
|
wx.TheClipboard.SetData(data1)
|
||||||
wx.TheClipboard.Close()
|
wx.TheClipboard.Close()
|
||||||
|
|
||||||
# paste
|
# paste
|
||||||
data2 = MyDataObject()
|
data2 = MyDataObject()
|
||||||
if wx.TheClipboard.Open():
|
if wx.TheClipboard.Open():
|
||||||
wx.TheClipboard.GetData(data2)
|
wx.TheClipboard.GetData(data2)
|
||||||
wx.TheClipboard.Close()
|
wx.TheClipboard.Close()
|
||||||
|
|
||||||
self.assertEqual(data1.myData, data2.myData)
|
self.assertEqual(data1.myData, data2.myData)
|
||||||
|
|
||||||
|
|
||||||
def test_DataObjectSimple3(self):
|
def test_DataObjectSimple3(self):
|
||||||
# More-or-less a duplicate of the above, but with a custom data format
|
# More-or-less a duplicate of the above, but with a custom data format
|
||||||
class MyDataObject(wx.DataObjectSimple):
|
class MyDataObject(wx.DataObjectSimple):
|
||||||
@@ -218,37 +218,37 @@ class DataObjTests(wtc.WidgetTestCase):
|
|||||||
wx.DataObjectSimple.__init__(self)
|
wx.DataObjectSimple.__init__(self)
|
||||||
self.SetFormat(wx.DataFormat("My Custom Data Format"))
|
self.SetFormat(wx.DataFormat("My Custom Data Format"))
|
||||||
self.myData = wtc.mybytes(value)
|
self.myData = wtc.mybytes(value)
|
||||||
|
|
||||||
def GetDataSize(self):
|
def GetDataSize(self):
|
||||||
return len(self.myData)
|
return len(self.myData)
|
||||||
|
|
||||||
def GetDataHere(self, buf):
|
def GetDataHere(self, buf):
|
||||||
# copy our local data value to buf
|
# copy our local data value to buf
|
||||||
assert isinstance(buf, memoryview)
|
assert isinstance(buf, memoryview)
|
||||||
buf[:] = self.myData
|
buf[:] = self.myData
|
||||||
return True
|
return True
|
||||||
|
|
||||||
def SetData(self, buf):
|
def SetData(self, buf):
|
||||||
# copy from buf to our local data value
|
# copy from buf to our local data value
|
||||||
assert isinstance(buf, memoryview)
|
assert isinstance(buf, memoryview)
|
||||||
self.myData = buf.tobytes()
|
self.myData = buf.tobytes()
|
||||||
return True
|
return True
|
||||||
|
|
||||||
# copy
|
# copy
|
||||||
data1 = MyDataObject('This is some data.')
|
data1 = MyDataObject('This is some data.')
|
||||||
if wx.TheClipboard.Open():
|
if wx.TheClipboard.Open():
|
||||||
wx.TheClipboard.SetData(data1)
|
wx.TheClipboard.SetData(data1)
|
||||||
wx.TheClipboard.Close()
|
wx.TheClipboard.Close()
|
||||||
|
|
||||||
# paste
|
# paste
|
||||||
data2 = MyDataObject()
|
data2 = MyDataObject()
|
||||||
if wx.TheClipboard.Open():
|
if wx.TheClipboard.Open():
|
||||||
wx.TheClipboard.GetData(data2)
|
wx.TheClipboard.GetData(data2)
|
||||||
wx.TheClipboard.Close()
|
wx.TheClipboard.Close()
|
||||||
|
|
||||||
self.assertEqual(data1.myData, data2.myData)
|
self.assertEqual(data1.myData, data2.myData)
|
||||||
|
|
||||||
|
|
||||||
def test_CustomDataObject(self):
|
def test_CustomDataObject(self):
|
||||||
import pickle
|
import pickle
|
||||||
data1 = list(range(10))
|
data1 = list(range(10))
|
||||||
@@ -256,9 +256,9 @@ class DataObjTests(wtc.WidgetTestCase):
|
|||||||
obj.SetData(pickle.dumps(data1))
|
obj.SetData(pickle.dumps(data1))
|
||||||
data2 = pickle.loads(obj.GetData().tobytes())
|
data2 = pickle.loads(obj.GetData().tobytes())
|
||||||
self.assertEqual(data1, data2)
|
self.assertEqual(data1, data2)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
def test_DataObjectComposite(self):
|
def test_DataObjectComposite(self):
|
||||||
do = wx.DataObjectComposite()
|
do = wx.DataObjectComposite()
|
||||||
df1 = wx.DataFormat("data type 1")
|
df1 = wx.DataFormat("data type 1")
|
||||||
@@ -267,20 +267,20 @@ class DataObjTests(wtc.WidgetTestCase):
|
|||||||
d2 = wx.CustomDataObject(df2)
|
d2 = wx.CustomDataObject(df2)
|
||||||
do.Add(d1, True)
|
do.Add(d1, True)
|
||||||
do.Add(d2)
|
do.Add(d2)
|
||||||
|
|
||||||
self.assertTrue(do.GetPreferredFormat() == df1)
|
self.assertTrue(do.GetPreferredFormat() == df1)
|
||||||
d3 = do.GetObject(df2)
|
d3 = do.GetObject(df2)
|
||||||
self.assertTrue(isinstance(d3, wx.CustomDataObject))
|
self.assertTrue(isinstance(d3, wx.CustomDataObject))
|
||||||
self.assertTrue(d3 is d2)
|
self.assertTrue(d3 is d2)
|
||||||
|
|
||||||
|
|
||||||
def test_BitmapDataObject(self):
|
def test_BitmapDataObject(self):
|
||||||
do = wx.BitmapDataObject()
|
do = wx.BitmapDataObject()
|
||||||
do.Bitmap = wx.Bitmap(pngFile)
|
do.Bitmap = wx.Bitmap(pngFile)
|
||||||
self.assertTrue(do.GetBitmap().IsOk())
|
self.assertTrue(do.GetBitmap().IsOk())
|
||||||
self.assertTrue(do.Bitmap.IsOk())
|
self.assertTrue(do.Bitmap.IsOk())
|
||||||
|
|
||||||
|
|
||||||
def test_TextDataObject(self):
|
def test_TextDataObject(self):
|
||||||
data = "This is some data"
|
data = "This is some data"
|
||||||
do = wx.TextDataObject(data)
|
do = wx.TextDataObject(data)
|
||||||
@@ -288,33 +288,33 @@ class DataObjTests(wtc.WidgetTestCase):
|
|||||||
self.assertEqual(do.Text, data)
|
self.assertEqual(do.Text, data)
|
||||||
self.assertAlmostEqual(do.GetTextLength(), len(data), delta=1)
|
self.assertAlmostEqual(do.GetTextLength(), len(data), delta=1)
|
||||||
self.assertAlmostEqual(do.TextLength, len(data), delta=1)
|
self.assertAlmostEqual(do.TextLength, len(data), delta=1)
|
||||||
|
|
||||||
|
|
||||||
def test_TextDataObjectClipboard(self):
|
def test_TextDataObjectClipboard(self):
|
||||||
# copy
|
# copy
|
||||||
text = 'This is some MORE data.'
|
text = 'This is some MORE data.'
|
||||||
data1 = wx.TextDataObject(text)
|
data1 = wx.TextDataObject(text)
|
||||||
if wx.TheClipboard.Open():
|
if wx.TheClipboard.Open():
|
||||||
wx.TheClipboard.SetData(data1)
|
wx.TheClipboard.SetData(data1)
|
||||||
wx.TheClipboard.Close()
|
wx.TheClipboard.Close()
|
||||||
|
|
||||||
# paste
|
# paste
|
||||||
data2 = wx.TextDataObject()
|
data2 = wx.TextDataObject()
|
||||||
if wx.TheClipboard.Open():
|
if wx.TheClipboard.Open():
|
||||||
wx.TheClipboard.GetData(data2)
|
wx.TheClipboard.GetData(data2)
|
||||||
wx.TheClipboard.Close()
|
wx.TheClipboard.Close()
|
||||||
|
|
||||||
self.assertEqual(text, data2.Text)
|
self.assertEqual(text, data2.Text)
|
||||||
|
|
||||||
|
|
||||||
def test_URLDataObject(self):
|
def test_URLDataObject(self):
|
||||||
url = 'http://wxPython.org/'
|
url = 'http://wxPython.org/'
|
||||||
do = wx.URLDataObject()
|
do = wx.URLDataObject()
|
||||||
do.URL = url
|
do.URL = url
|
||||||
self.assertEqual(do.GetURL(), url)
|
self.assertEqual(do.GetURL(), url)
|
||||||
self.assertEqual(do.URL, url)
|
self.assertEqual(do.URL, url)
|
||||||
|
|
||||||
|
|
||||||
def test_FileDataObject(self):
|
def test_FileDataObject(self):
|
||||||
do = wx.FileDataObject()
|
do = wx.FileDataObject()
|
||||||
do.AddFile('filename1')
|
do.AddFile('filename1')
|
||||||
@@ -326,15 +326,15 @@ class DataObjTests(wtc.WidgetTestCase):
|
|||||||
self.assertTrue(names[0] == 'filename1')
|
self.assertTrue(names[0] == 'filename1')
|
||||||
self.assertTrue(names == do.Filenames)
|
self.assertTrue(names == do.Filenames)
|
||||||
|
|
||||||
|
|
||||||
def test_HTMLDataObject(self):
|
def test_HTMLDataObject(self):
|
||||||
data = "<html><body>This is some data</body></html>"
|
data = "<html><body>This is some data</body></html>"
|
||||||
do = wx.HTMLDataObject(data)
|
do = wx.HTMLDataObject(data)
|
||||||
self.assertEqual(do.GetHTML(), data)
|
self.assertEqual(do.GetHTML(), data)
|
||||||
self.assertEqual(do.HTML, data)
|
self.assertEqual(do.HTML, data)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
#---------------------------------------------------------------------------
|
#---------------------------------------------------------------------------
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -15,11 +15,11 @@ class dataview_Tests(wtc.WidgetTestCase):
|
|||||||
def test_dataviewItem1(self):
|
def test_dataviewItem1(self):
|
||||||
dvi = dv.DataViewItem()
|
dvi = dv.DataViewItem()
|
||||||
self.assertFalse(dvi)
|
self.assertFalse(dvi)
|
||||||
|
|
||||||
def test_dataviewItem2(self):
|
def test_dataviewItem2(self):
|
||||||
dvi = dv.DataViewItem(12345)
|
dvi = dv.DataViewItem(12345)
|
||||||
self.assertTrue(dvi)
|
self.assertTrue(dvi)
|
||||||
|
|
||||||
def test_dataviewItem3(self):
|
def test_dataviewItem3(self):
|
||||||
dvi1 = dv.DataViewItem(111)
|
dvi1 = dv.DataViewItem(111)
|
||||||
dvi2 = dv.DataViewItem(222)
|
dvi2 = dv.DataViewItem(222)
|
||||||
@@ -31,7 +31,7 @@ class dataview_Tests(wtc.WidgetTestCase):
|
|||||||
dvi2 = dv.DataViewItem(111)
|
dvi2 = dv.DataViewItem(111)
|
||||||
self.assertTrue(dvi1 == dvi2)
|
self.assertTrue(dvi1 == dvi2)
|
||||||
self.assertFalse(dvi1 != dvi2)
|
self.assertFalse(dvi1 != dvi2)
|
||||||
|
|
||||||
def test_dataviewItem5(self):
|
def test_dataviewItem5(self):
|
||||||
self.assertFalse(dv.NullDataViewItem)
|
self.assertFalse(dv.NullDataViewItem)
|
||||||
|
|
||||||
@@ -43,7 +43,7 @@ class dataview_Tests(wtc.WidgetTestCase):
|
|||||||
self.assertTrue(int(dvi2.ID) == 222)
|
self.assertTrue(int(dvi2.ID) == 222)
|
||||||
|
|
||||||
def test_dataviewItem7(self):
|
def test_dataviewItem7(self):
|
||||||
# max integer size on platforms where long is 64-bit
|
# max integer size on platforms where long is 64-bit
|
||||||
n = 2**63 - 1
|
n = 2**63 - 1
|
||||||
if six.PY3:
|
if six.PY3:
|
||||||
assert type(n) is int
|
assert type(n) is int
|
||||||
@@ -54,7 +54,7 @@ class dataview_Tests(wtc.WidgetTestCase):
|
|||||||
self.assertTrue(int(dvi.GetID()) == n)
|
self.assertTrue(int(dvi.GetID()) == n)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
#-------------------------------------------------------
|
#-------------------------------------------------------
|
||||||
def test_dataviewItemAttr1(self):
|
def test_dataviewItemAttr1(self):
|
||||||
a = dv.DataViewItemAttr()
|
a = dv.DataViewItemAttr()
|
||||||
@@ -62,8 +62,8 @@ class dataview_Tests(wtc.WidgetTestCase):
|
|||||||
self.assertFalse(a.HasColour())
|
self.assertFalse(a.HasColour())
|
||||||
self.assertFalse(a.HasFont())
|
self.assertFalse(a.HasFont())
|
||||||
self.assertFalse(a.HasBackgroundColour())
|
self.assertFalse(a.HasBackgroundColour())
|
||||||
|
|
||||||
|
|
||||||
def test_dataviewItemAttr2(self):
|
def test_dataviewItemAttr2(self):
|
||||||
a = dv.DataViewItemAttr()
|
a = dv.DataViewItemAttr()
|
||||||
a.Colour = wx.BLACK
|
a.Colour = wx.BLACK
|
||||||
@@ -75,8 +75,8 @@ class dataview_Tests(wtc.WidgetTestCase):
|
|||||||
self.assertTrue(a.HasBackgroundColour())
|
self.assertTrue(a.HasBackgroundColour())
|
||||||
self.assertTrue(a.GetBold())
|
self.assertTrue(a.GetBold())
|
||||||
self.assertTrue(a.GetItalic())
|
self.assertTrue(a.GetItalic())
|
||||||
|
|
||||||
|
|
||||||
#-------------------------------------------------------
|
#-------------------------------------------------------
|
||||||
def test_dataviewIconText1(self):
|
def test_dataviewIconText1(self):
|
||||||
dit = dv.DataViewIconText()
|
dit = dv.DataViewIconText()
|
||||||
@@ -90,54 +90,54 @@ class dataview_Tests(wtc.WidgetTestCase):
|
|||||||
dit = dv.DataViewIconText('Smile!', icon)
|
dit = dv.DataViewIconText('Smile!', icon)
|
||||||
dit.Icon
|
dit.Icon
|
||||||
dit.Text
|
dit.Text
|
||||||
|
|
||||||
|
|
||||||
#-------------------------------------------------------
|
#-------------------------------------------------------
|
||||||
def test_dataviewModelNotifier1(self):
|
def test_dataviewModelNotifier1(self):
|
||||||
with self.assertRaises(TypeError):
|
with self.assertRaises(TypeError):
|
||||||
n = dv.DataViewModelNotifier()
|
n = dv.DataViewModelNotifier()
|
||||||
|
|
||||||
|
|
||||||
def test_dataviewModelNotifier2(self):
|
def test_dataviewModelNotifier2(self):
|
||||||
class MyNotifier(dv.DataViewModelNotifier):
|
class MyNotifier(dv.DataViewModelNotifier):
|
||||||
def Cleared(self): return True
|
def Cleared(self): return True
|
||||||
|
|
||||||
def ItemAdded(self, parent, item): return True
|
def ItemAdded(self, parent, item): return True
|
||||||
def ItemChanged(self, item): return True
|
def ItemChanged(self, item): return True
|
||||||
def ItemDeleted(self, parent, item): return True
|
def ItemDeleted(self, parent, item): return True
|
||||||
def ItemsAdded(self, parent, items): return True
|
def ItemsAdded(self, parent, items): return True
|
||||||
def ItemsChanged(self, items): return True
|
def ItemsChanged(self, items): return True
|
||||||
def ItemsDeleted(self, parent, items): return True
|
def ItemsDeleted(self, parent, items): return True
|
||||||
|
|
||||||
def Resort(self): pass
|
def Resort(self): pass
|
||||||
def ValueChanged(self, item, col): return True
|
def ValueChanged(self, item, col): return True
|
||||||
|
|
||||||
n = MyNotifier()
|
n = MyNotifier()
|
||||||
|
|
||||||
|
|
||||||
#-------------------------------------------------------
|
#-------------------------------------------------------
|
||||||
def test_dataviewRenderer01(self):
|
def test_dataviewRenderer01(self):
|
||||||
with self.assertRaises(TypeError):
|
with self.assertRaises(TypeError):
|
||||||
r = dv.DataViewRenderer()
|
r = dv.DataViewRenderer()
|
||||||
|
|
||||||
|
|
||||||
def test_dataviewRenderer02(self):
|
def test_dataviewRenderer02(self):
|
||||||
# This one can't be subclassed (that's what dv.DataViewCustomRenderer
|
# This one can't be subclassed (that's what dv.DataViewCustomRenderer
|
||||||
# is for) so make sure it raises an exception too.
|
# is for) so make sure it raises an exception too.
|
||||||
with self.assertRaises(TypeError):
|
with self.assertRaises(TypeError):
|
||||||
class MyRenderer(dv.DataViewRenderer):
|
class MyRenderer(dv.DataViewRenderer):
|
||||||
def GetValue(self): return "value"
|
def GetValue(self): return "value"
|
||||||
def SetValue(self, value): return True
|
def SetValue(self, value): return True
|
||||||
|
|
||||||
r = MyRenderer()
|
r = MyRenderer()
|
||||||
|
|
||||||
|
|
||||||
def test_dataviewRenderer03(self):
|
def test_dataviewRenderer03(self):
|
||||||
r = dv.DataViewTextRenderer()
|
r = dv.DataViewTextRenderer()
|
||||||
|
|
||||||
def test_dataviewRenderer04(self):
|
def test_dataviewRenderer04(self):
|
||||||
r = dv.DataViewIconTextRenderer()
|
r = dv.DataViewIconTextRenderer()
|
||||||
|
|
||||||
def test_dataviewRenderer05(self):
|
def test_dataviewRenderer05(self):
|
||||||
r = dv.DataViewProgressRenderer()
|
r = dv.DataViewProgressRenderer()
|
||||||
|
|
||||||
@@ -152,28 +152,28 @@ class dataview_Tests(wtc.WidgetTestCase):
|
|||||||
|
|
||||||
def test_dataviewRenderer09(self):
|
def test_dataviewRenderer09(self):
|
||||||
r = dv.DataViewBitmapRenderer()
|
r = dv.DataViewBitmapRenderer()
|
||||||
|
|
||||||
|
|
||||||
def test_dataviewRenderer10(self):
|
def test_dataviewRenderer10(self):
|
||||||
with self.assertRaises(TypeError):
|
with self.assertRaises(TypeError):
|
||||||
r = dv.DataViewCustomRenderer()
|
r = dv.DataViewCustomRenderer()
|
||||||
|
|
||||||
def test_dataviewRenderer11(self):
|
def test_dataviewRenderer11(self):
|
||||||
class MyCustomRenderer(dv.DataViewCustomRenderer):
|
class MyCustomRenderer(dv.DataViewCustomRenderer):
|
||||||
def GetValue(self): return "value"
|
def GetValue(self): return "value"
|
||||||
def SetValue(self, value): return True
|
def SetValue(self, value): return True
|
||||||
def GetSize(self): return wx.Size(100, 25)
|
def GetSize(self): return wx.Size(100, 25)
|
||||||
def Render(self, cell, dc, state): return True
|
def Render(self, cell, dc, state): return True
|
||||||
|
|
||||||
r = MyCustomRenderer()
|
r = MyCustomRenderer()
|
||||||
|
|
||||||
def test_dataviewRenderer12(self):
|
def test_dataviewRenderer12(self):
|
||||||
r = dv.DataViewChoiceRenderer("one two three".split())
|
r = dv.DataViewChoiceRenderer("one two three".split())
|
||||||
|
|
||||||
|
|
||||||
#-------------------------------------------------------
|
#-------------------------------------------------------
|
||||||
def test_dataviewColumn(self):
|
def test_dataviewColumn(self):
|
||||||
r = dv.DataViewIconTextRenderer()
|
r = dv.DataViewIconTextRenderer()
|
||||||
# create
|
# create
|
||||||
c = dv.DataViewColumn('title', r, 0)
|
c = dv.DataViewColumn('title', r, 0)
|
||||||
# test that properties exist
|
# test that properties exist
|
||||||
@@ -184,15 +184,15 @@ class dataview_Tests(wtc.WidgetTestCase):
|
|||||||
c.Alignment
|
c.Alignment
|
||||||
c.Flags
|
c.Flags
|
||||||
c.SortOrder
|
c.SortOrder
|
||||||
|
|
||||||
self.myYield()
|
self.myYield()
|
||||||
|
|
||||||
#-------------------------------------------------------
|
#-------------------------------------------------------
|
||||||
def test_dataviewModel1(self):
|
def test_dataviewModel1(self):
|
||||||
with self.assertRaises(TypeError):
|
with self.assertRaises(TypeError):
|
||||||
m = dv.DataViewModel()
|
m = dv.DataViewModel()
|
||||||
|
|
||||||
|
|
||||||
def test_dataviewModel2(self):
|
def test_dataviewModel2(self):
|
||||||
class MyModel(dv.DataViewModel):
|
class MyModel(dv.DataViewModel):
|
||||||
def GetChildren(self, item, children): return 0
|
def GetChildren(self, item, children): return 0
|
||||||
@@ -202,65 +202,65 @@ class dataview_Tests(wtc.WidgetTestCase):
|
|||||||
def GetValue(self, item, col): return 'value'
|
def GetValue(self, item, col): return 'value'
|
||||||
def IsContainer(self, item) : return False
|
def IsContainer(self, item) : return False
|
||||||
def SetValue(self, value, item, col): return True
|
def SetValue(self, value, item, col): return True
|
||||||
|
|
||||||
m = MyModel()
|
m = MyModel()
|
||||||
|
|
||||||
#-------------------------------------------------------
|
#-------------------------------------------------------
|
||||||
def test_dataviewIndexListModel1(self):
|
def test_dataviewIndexListModel1(self):
|
||||||
with self.assertRaises(TypeError):
|
with self.assertRaises(TypeError):
|
||||||
m = dv.DataViewIndexListModel()
|
m = dv.DataViewIndexListModel()
|
||||||
|
|
||||||
def test_dataviewIndexListModel2(self):
|
def test_dataviewIndexListModel2(self):
|
||||||
class MyModel(dv.DataViewIndexListModel):
|
class MyModel(dv.DataViewIndexListModel):
|
||||||
def GetCount(self): return 0
|
def GetCount(self): return 0
|
||||||
def GetRow(self, item): return 0
|
def GetRow(self, item): return 0
|
||||||
def GetValueByRow(self, row, col): return 'value'
|
def GetValueByRow(self, row, col): return 'value'
|
||||||
def SetValueByRow(self, value, row, col): return True
|
def SetValueByRow(self, value, row, col): return True
|
||||||
|
|
||||||
m = MyModel()
|
m = MyModel()
|
||||||
|
|
||||||
|
|
||||||
def test_dataviewVirtualListModel1(self):
|
def test_dataviewVirtualListModel1(self):
|
||||||
with self.assertRaises(TypeError):
|
with self.assertRaises(TypeError):
|
||||||
m = dv.DataViewVirtualListModel()
|
m = dv.DataViewVirtualListModel()
|
||||||
|
|
||||||
def test_dataviewVirtualModel2(self):
|
def test_dataviewVirtualModel2(self):
|
||||||
class MyModel(dv.DataViewVirtualListModel):
|
class MyModel(dv.DataViewVirtualListModel):
|
||||||
def GetCount(self): return 0
|
def GetCount(self): return 0
|
||||||
def GetRow(self, item): return 0
|
def GetRow(self, item): return 0
|
||||||
def GetValueByRow(self, row, col): return 'value'
|
def GetValueByRow(self, row, col): return 'value'
|
||||||
def SetValueByRow(self, value, row, col): return True
|
def SetValueByRow(self, value, row, col): return True
|
||||||
|
|
||||||
m = MyModel()
|
m = MyModel()
|
||||||
|
|
||||||
|
|
||||||
#-------------------------------------------------------
|
#-------------------------------------------------------
|
||||||
def test_dataviewCtrl1(self):
|
def test_dataviewCtrl1(self):
|
||||||
|
|
||||||
class MyModel(dv.DataViewIndexListModel):
|
class MyModel(dv.DataViewIndexListModel):
|
||||||
def GetCount(self):
|
def GetCount(self):
|
||||||
return 50
|
return 50
|
||||||
|
|
||||||
def GetColumnCount(self):
|
def GetColumnCount(self):
|
||||||
return 10
|
return 10
|
||||||
|
|
||||||
def GetValueByRow(self, row, col):
|
def GetValueByRow(self, row, col):
|
||||||
return 'value(%d, %d)' (row, col)
|
return 'value(%d, %d)' (row, col)
|
||||||
|
|
||||||
def SetValueByRow(self, value, row, col):
|
def SetValueByRow(self, value, row, col):
|
||||||
return True
|
return True
|
||||||
|
|
||||||
def GetColumnType(self, col):
|
def GetColumnType(self, col):
|
||||||
return 'string'
|
return 'string'
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
dvc = dv.DataViewCtrl(self.frame, style=dv.DV_ROW_LINES|dv.DV_VERT_RULES|dv.DV_MULTIPLE)
|
dvc = dv.DataViewCtrl(self.frame, style=dv.DV_ROW_LINES|dv.DV_VERT_RULES|dv.DV_MULTIPLE)
|
||||||
model = MyModel()
|
model = MyModel()
|
||||||
count1 = model.GetRefCount()
|
count1 = model.GetRefCount()
|
||||||
dvc.AssociateModel(model)
|
dvc.AssociateModel(model)
|
||||||
count2 = model.GetRefCount()
|
count2 = model.GetRefCount()
|
||||||
|
|
||||||
# The reference count should still be 1 because the model was
|
# The reference count should still be 1 because the model was
|
||||||
# DecRef'ed when it's ownership transfered to C++ in the
|
# DecRef'ed when it's ownership transfered to C++ in the
|
||||||
# AssociateModel call
|
# AssociateModel call
|
||||||
@@ -275,7 +275,7 @@ class dataview_Tests(wtc.WidgetTestCase):
|
|||||||
# Destroying the 2nd view should drop the refcount again
|
# Destroying the 2nd view should drop the refcount again
|
||||||
dvc2.Destroy()
|
dvc2.Destroy()
|
||||||
self.assertEqual(model.GetRefCount(), 1)
|
self.assertEqual(model.GetRefCount(), 1)
|
||||||
|
|
||||||
# And since ownership has been transferred, deleting this reference
|
# And since ownership has been transferred, deleting this reference
|
||||||
# to the model should not cause any problems.
|
# to the model should not cause any problems.
|
||||||
del model
|
del model
|
||||||
@@ -285,20 +285,20 @@ class dataview_Tests(wtc.WidgetTestCase):
|
|||||||
dvc.AppendTextColumn("three", 3, width=80, mode=dv.DATAVIEW_CELL_EDITABLE)
|
dvc.AppendTextColumn("three", 3, width=80, mode=dv.DATAVIEW_CELL_EDITABLE)
|
||||||
dvc.AppendTextColumn("four", 4, width=80, mode=dv.DATAVIEW_CELL_EDITABLE)
|
dvc.AppendTextColumn("four", 4, width=80, mode=dv.DATAVIEW_CELL_EDITABLE)
|
||||||
dvc.AppendTextColumn("five", 5, width=80, mode=dv.DATAVIEW_CELL_EDITABLE)
|
dvc.AppendTextColumn("five", 5, width=80, mode=dv.DATAVIEW_CELL_EDITABLE)
|
||||||
|
|
||||||
self.frame.SendSizeEvent()
|
self.frame.SendSizeEvent()
|
||||||
dvc.Refresh()
|
dvc.Refresh()
|
||||||
self.myYield()
|
self.myYield()
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
#-------------------------------------------------------
|
#-------------------------------------------------------
|
||||||
def test_dataviewListCtrl1(self):
|
def test_dataviewListCtrl1(self):
|
||||||
dlc = dv.DataViewListCtrl()
|
dlc = dv.DataViewListCtrl()
|
||||||
dlc.Create(self.frame)
|
dlc.Create(self.frame)
|
||||||
self.doListCtrlTest(dlc)
|
self.doListCtrlTest(dlc)
|
||||||
|
|
||||||
|
|
||||||
def test_dataviewListCtrl2(self):
|
def test_dataviewListCtrl2(self):
|
||||||
dlc = dv.DataViewListCtrl(self.frame)
|
dlc = dv.DataViewListCtrl(self.frame)
|
||||||
self.doListCtrlTest(dlc)
|
self.doListCtrlTest(dlc)
|
||||||
@@ -309,13 +309,13 @@ class dataview_Tests(wtc.WidgetTestCase):
|
|||||||
dlc.AppendTextColumn(label)
|
dlc.AppendTextColumn(label)
|
||||||
col = dv.DataViewColumn('five', dv.DataViewBitmapRenderer(), 4)
|
col = dv.DataViewColumn('five', dv.DataViewBitmapRenderer(), 4)
|
||||||
dlc.AppendColumn(col)
|
dlc.AppendColumn(col)
|
||||||
|
|
||||||
bmp = wx.Bitmap(pngFile)
|
bmp = wx.Bitmap(pngFile)
|
||||||
for n in range(50):
|
for n in range(50):
|
||||||
rowdata = ['%s-%02d' % (s, n) for s in "one two three four".split()]
|
rowdata = ['%s-%02d' % (s, n) for s in "one two three four".split()]
|
||||||
rowdata.append(bmp)
|
rowdata.append(bmp)
|
||||||
dlc.AppendItem(rowdata)
|
dlc.AppendItem(rowdata)
|
||||||
|
|
||||||
self.frame.SendSizeEvent()
|
self.frame.SendSizeEvent()
|
||||||
dlc.Refresh()
|
dlc.Refresh()
|
||||||
self.myYield()
|
self.myYield()
|
||||||
@@ -327,21 +327,21 @@ class dataview_Tests(wtc.WidgetTestCase):
|
|||||||
item, col = dlc.HitTest((10,50))
|
item, col = dlc.HitTest((10,50))
|
||||||
self.assertTrue(isinstance(item, dv.DataViewItem))
|
self.assertTrue(isinstance(item, dv.DataViewItem))
|
||||||
self.assertTrue(isinstance(col, dv.DataViewColumn) or col is None)
|
self.assertTrue(isinstance(col, dv.DataViewColumn) or col is None)
|
||||||
|
|
||||||
#-------------------------------------------------------
|
#-------------------------------------------------------
|
||||||
# DataViewTreeCtrl
|
# DataViewTreeCtrl
|
||||||
|
|
||||||
|
|
||||||
def test_dataviewTreeCtrl1(self):
|
def test_dataviewTreeCtrl1(self):
|
||||||
dtc = dv.DataViewTreeCtrl()
|
dtc = dv.DataViewTreeCtrl()
|
||||||
dtc.Create(self.frame)
|
dtc.Create(self.frame)
|
||||||
self.doTreeCtrlTest(dtc)
|
self.doTreeCtrlTest(dtc)
|
||||||
|
|
||||||
|
|
||||||
def test_dataviewTreeCtrl2(self):
|
def test_dataviewTreeCtrl2(self):
|
||||||
dtc = dv.DataViewTreeCtrl(self.frame)
|
dtc = dv.DataViewTreeCtrl(self.frame)
|
||||||
self.doTreeCtrlTest(dtc)
|
self.doTreeCtrlTest(dtc)
|
||||||
|
|
||||||
|
|
||||||
def doTreeCtrlTest(self, dvtc):
|
def doTreeCtrlTest(self, dvtc):
|
||||||
isz = (16,16)
|
isz = (16,16)
|
||||||
@@ -366,7 +366,7 @@ class dataview_Tests(wtc.WidgetTestCase):
|
|||||||
last, "item %d-%s-%d" % (x, chr(ord("a")+y), z),
|
last, "item %d-%s-%d" % (x, chr(ord("a")+y), z),
|
||||||
fileidx)
|
fileidx)
|
||||||
dvtc.ExpandAncestors(item)
|
dvtc.ExpandAncestors(item)
|
||||||
|
|
||||||
self.frame.SendSizeEvent()
|
self.frame.SendSizeEvent()
|
||||||
dvtc.Refresh()
|
dvtc.Refresh()
|
||||||
self.myYield()
|
self.myYield()
|
||||||
@@ -377,22 +377,22 @@ class dataview_Tests(wtc.WidgetTestCase):
|
|||||||
dv.DVC_DEFAULT_RENDERER_SIZE
|
dv.DVC_DEFAULT_RENDERER_SIZE
|
||||||
dv.DVC_DEFAULT_WIDTH
|
dv.DVC_DEFAULT_WIDTH
|
||||||
dv.DVC_TOGGLE_DEFAULT_WIDTH
|
dv.DVC_TOGGLE_DEFAULT_WIDTH
|
||||||
dv.DVC_DEFAULT_MINWIDTH
|
dv.DVC_DEFAULT_MINWIDTH
|
||||||
dv.DVR_DEFAULT_ALIGNMENT
|
dv.DVR_DEFAULT_ALIGNMENT
|
||||||
|
|
||||||
dv.DATAVIEW_CELL_INERT
|
dv.DATAVIEW_CELL_INERT
|
||||||
dv.DATAVIEW_CELL_ACTIVATABLE
|
dv.DATAVIEW_CELL_ACTIVATABLE
|
||||||
dv.DATAVIEW_CELL_EDITABLE
|
dv.DATAVIEW_CELL_EDITABLE
|
||||||
dv.DATAVIEW_CELL_SELECTED
|
dv.DATAVIEW_CELL_SELECTED
|
||||||
dv.DATAVIEW_CELL_PRELIT
|
dv.DATAVIEW_CELL_PRELIT
|
||||||
dv.DATAVIEW_CELL_INSENSITIVE
|
dv.DATAVIEW_CELL_INSENSITIVE
|
||||||
dv.DATAVIEW_CELL_FOCUSED
|
dv.DATAVIEW_CELL_FOCUSED
|
||||||
|
|
||||||
dv.DATAVIEW_COL_RESIZABLE
|
dv.DATAVIEW_COL_RESIZABLE
|
||||||
dv.DATAVIEW_COL_SORTABLE
|
dv.DATAVIEW_COL_SORTABLE
|
||||||
dv.DATAVIEW_COL_REORDERABLE
|
dv.DATAVIEW_COL_REORDERABLE
|
||||||
dv.DATAVIEW_COL_HIDDEN
|
dv.DATAVIEW_COL_HIDDEN
|
||||||
|
|
||||||
dv.DV_SINGLE
|
dv.DV_SINGLE
|
||||||
dv.DV_MULTIPLE
|
dv.DV_MULTIPLE
|
||||||
dv.DV_NO_HEADER
|
dv.DV_NO_HEADER
|
||||||
@@ -400,11 +400,11 @@ class dataview_Tests(wtc.WidgetTestCase):
|
|||||||
dv.DV_VERT_RULES
|
dv.DV_VERT_RULES
|
||||||
dv.DV_ROW_LINES
|
dv.DV_ROW_LINES
|
||||||
dv.DV_VARIABLE_LINE_HEIGHT
|
dv.DV_VARIABLE_LINE_HEIGHT
|
||||||
|
|
||||||
|
|
||||||
def test_dataviewEvt1(self):
|
def test_dataviewEvt1(self):
|
||||||
evt = dv.DataViewEvent()
|
evt = dv.DataViewEvent()
|
||||||
|
|
||||||
evt.GetItem
|
evt.GetItem
|
||||||
evt.SetItem
|
evt.SetItem
|
||||||
evt.GetColumn
|
evt.GetColumn
|
||||||
@@ -434,7 +434,7 @@ class dataview_Tests(wtc.WidgetTestCase):
|
|||||||
evt.GetDragFlags
|
evt.GetDragFlags
|
||||||
evt.SetDropEffect
|
evt.SetDropEffect
|
||||||
evt.GetDropEffect
|
evt.GetDropEffect
|
||||||
|
|
||||||
|
|
||||||
def test_dataviewEvt2(self):
|
def test_dataviewEvt2(self):
|
||||||
dv.wxEVT_COMMAND_DATAVIEW_SELECTION_CHANGED;
|
dv.wxEVT_COMMAND_DATAVIEW_SELECTION_CHANGED;
|
||||||
@@ -454,32 +454,32 @@ class dataview_Tests(wtc.WidgetTestCase):
|
|||||||
dv.wxEVT_COMMAND_DATAVIEW_COLUMN_REORDERED;
|
dv.wxEVT_COMMAND_DATAVIEW_COLUMN_REORDERED;
|
||||||
dv.wxEVT_COMMAND_DATAVIEW_ITEM_BEGIN_DRAG;
|
dv.wxEVT_COMMAND_DATAVIEW_ITEM_BEGIN_DRAG;
|
||||||
dv.wxEVT_COMMAND_DATAVIEW_ITEM_DROP_POSSIBLE;
|
dv.wxEVT_COMMAND_DATAVIEW_ITEM_DROP_POSSIBLE;
|
||||||
dv.wxEVT_COMMAND_DATAVIEW_ITEM_DROP;
|
dv.wxEVT_COMMAND_DATAVIEW_ITEM_DROP;
|
||||||
dv.wxEVT_COMMAND_DATAVIEW_CACHE_HINT;
|
dv.wxEVT_COMMAND_DATAVIEW_CACHE_HINT;
|
||||||
|
|
||||||
dv.EVT_DATAVIEW_SELECTION_CHANGED
|
dv.EVT_DATAVIEW_SELECTION_CHANGED
|
||||||
dv.EVT_DATAVIEW_ITEM_ACTIVATED
|
dv.EVT_DATAVIEW_ITEM_ACTIVATED
|
||||||
dv.EVT_DATAVIEW_ITEM_COLLAPSED
|
dv.EVT_DATAVIEW_ITEM_COLLAPSED
|
||||||
dv.EVT_DATAVIEW_ITEM_EXPANDED
|
dv.EVT_DATAVIEW_ITEM_EXPANDED
|
||||||
dv.EVT_DATAVIEW_ITEM_COLLAPSING
|
dv.EVT_DATAVIEW_ITEM_COLLAPSING
|
||||||
dv.EVT_DATAVIEW_ITEM_EXPANDING
|
dv.EVT_DATAVIEW_ITEM_EXPANDING
|
||||||
dv.EVT_DATAVIEW_ITEM_START_EDITING
|
dv.EVT_DATAVIEW_ITEM_START_EDITING
|
||||||
dv.EVT_DATAVIEW_ITEM_EDITING_STARTED
|
dv.EVT_DATAVIEW_ITEM_EDITING_STARTED
|
||||||
dv.EVT_DATAVIEW_ITEM_EDITING_DONE
|
dv.EVT_DATAVIEW_ITEM_EDITING_DONE
|
||||||
dv.EVT_DATAVIEW_ITEM_VALUE_CHANGED
|
dv.EVT_DATAVIEW_ITEM_VALUE_CHANGED
|
||||||
dv.EVT_DATAVIEW_ITEM_CONTEXT_MENU
|
dv.EVT_DATAVIEW_ITEM_CONTEXT_MENU
|
||||||
dv.EVT_DATAVIEW_COLUMN_HEADER_CLICK
|
dv.EVT_DATAVIEW_COLUMN_HEADER_CLICK
|
||||||
dv.EVT_DATAVIEW_COLUMN_HEADER_RIGHT_CLICK
|
dv.EVT_DATAVIEW_COLUMN_HEADER_RIGHT_CLICK
|
||||||
dv.EVT_DATAVIEW_COLUMN_SORTED
|
dv.EVT_DATAVIEW_COLUMN_SORTED
|
||||||
dv.EVT_DATAVIEW_COLUMN_REORDERED
|
dv.EVT_DATAVIEW_COLUMN_REORDERED
|
||||||
dv.EVT_DATAVIEW_ITEM_BEGIN_DRAG
|
dv.EVT_DATAVIEW_ITEM_BEGIN_DRAG
|
||||||
dv.EVT_DATAVIEW_ITEM_DROP_POSSIBLE
|
dv.EVT_DATAVIEW_ITEM_DROP_POSSIBLE
|
||||||
dv.EVT_DATAVIEW_ITEM_DROP
|
dv.EVT_DATAVIEW_ITEM_DROP
|
||||||
dv.EVT_DATAVIEW_CACHE_HINT
|
dv.EVT_DATAVIEW_CACHE_HINT
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
#---------------------------------------------------------------------------
|
#---------------------------------------------------------------------------
|
||||||
|
|
||||||
if __name__ == '__main__':
|
if __name__ == '__main__':
|
||||||
|
|||||||
@@ -9,19 +9,19 @@ class datectrl_Tests(wtc.WidgetTestCase):
|
|||||||
|
|
||||||
def test_datectrl1(self):
|
def test_datectrl1(self):
|
||||||
dp = wx.adv.DatePickerCtrl(self.frame, dt=wx.DateTime.Now())
|
dp = wx.adv.DatePickerCtrl(self.frame, dt=wx.DateTime.Now())
|
||||||
|
|
||||||
def test_datectrl2(self):
|
def test_datectrl2(self):
|
||||||
dp = wx.adv.DatePickerCtrl()
|
dp = wx.adv.DatePickerCtrl()
|
||||||
dp.Create(self.frame, dt=wx.DateTime.Now())
|
dp.Create(self.frame, dt=wx.DateTime.Now())
|
||||||
|
|
||||||
def test_genericdatectrl1(self):
|
def test_genericdatectrl1(self):
|
||||||
dp = wx.adv.GenericDatePickerCtrl(self.frame, dt=wx.DateTime.Now())
|
dp = wx.adv.GenericDatePickerCtrl(self.frame, dt=wx.DateTime.Now())
|
||||||
|
|
||||||
def test_genericdatectrl2(self):
|
def test_genericdatectrl2(self):
|
||||||
dp = wx.adv.GenericDatePickerCtrl()
|
dp = wx.adv.GenericDatePickerCtrl()
|
||||||
dp.Create(self.frame, dt=wx.DateTime.Now())
|
dp.Create(self.frame, dt=wx.DateTime.Now())
|
||||||
|
|
||||||
|
|
||||||
#---------------------------------------------------------------------------
|
#---------------------------------------------------------------------------
|
||||||
|
|
||||||
if __name__ == '__main__':
|
if __name__ == '__main__':
|
||||||
|
|||||||
@@ -11,14 +11,14 @@ class dateevt_Tests(wtc.WidgetTestCase):
|
|||||||
evt = wx.adv.DateEvent()
|
evt = wx.adv.DateEvent()
|
||||||
evt.GetDate()
|
evt.GetDate()
|
||||||
evt.Date
|
evt.Date
|
||||||
|
|
||||||
def test_dateevt2(self):
|
def test_dateevt2(self):
|
||||||
wx.adv.wxEVT_DATE_CHANGED
|
wx.adv.wxEVT_DATE_CHANGED
|
||||||
wx.adv.wxEVT_TIME_CHANGED
|
wx.adv.wxEVT_TIME_CHANGED
|
||||||
wx.adv.EVT_DATE_CHANGED
|
wx.adv.EVT_DATE_CHANGED
|
||||||
wx.adv.EVT_TIME_CHANGED
|
wx.adv.EVT_TIME_CHANGED
|
||||||
|
|
||||||
|
|
||||||
#---------------------------------------------------------------------------
|
#---------------------------------------------------------------------------
|
||||||
|
|
||||||
if __name__ == '__main__':
|
if __name__ == '__main__':
|
||||||
|
|||||||
@@ -9,7 +9,7 @@ pngFile = os.path.join(os.path.dirname(__file__), 'toucan.png')
|
|||||||
#---------------------------------------------------------------------------
|
#---------------------------------------------------------------------------
|
||||||
|
|
||||||
class dc_Tests(wtc.WidgetTestCase):
|
class dc_Tests(wtc.WidgetTestCase):
|
||||||
|
|
||||||
def test_ConstantsExist(self):
|
def test_ConstantsExist(self):
|
||||||
wx.CLEAR
|
wx.CLEAR
|
||||||
wx.XOR
|
wx.XOR
|
||||||
@@ -27,7 +27,7 @@ class dc_Tests(wtc.WidgetTestCase):
|
|||||||
wx.NAND
|
wx.NAND
|
||||||
wx.OR
|
wx.OR
|
||||||
wx.SET
|
wx.SET
|
||||||
|
|
||||||
wx.FLOOD_SURFACE
|
wx.FLOOD_SURFACE
|
||||||
wx.FLOOD_BORDER
|
wx.FLOOD_BORDER
|
||||||
|
|
||||||
@@ -36,9 +36,9 @@ class dc_Tests(wtc.WidgetTestCase):
|
|||||||
wx.MM_LOMETRIC
|
wx.MM_LOMETRIC
|
||||||
wx.MM_TWIPS
|
wx.MM_TWIPS
|
||||||
wx.MM_POINTS
|
wx.MM_POINTS
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
def test_FontMetrics(self):
|
def test_FontMetrics(self):
|
||||||
fm = wx.FontMetrics()
|
fm = wx.FontMetrics()
|
||||||
fm.height
|
fm.height
|
||||||
@@ -47,8 +47,8 @@ class dc_Tests(wtc.WidgetTestCase):
|
|||||||
fm.internalLeading
|
fm.internalLeading
|
||||||
fm.externalLeading
|
fm.externalLeading
|
||||||
fm.averageWidth
|
fm.averageWidth
|
||||||
|
|
||||||
|
|
||||||
def test_DCClipper(self):
|
def test_DCClipper(self):
|
||||||
dc = wx.ClientDC(self.frame)
|
dc = wx.ClientDC(self.frame)
|
||||||
c = wx.DCClipper(dc, wx.Rect(10,10,25,25))
|
c = wx.DCClipper(dc, wx.Rect(10,10,25,25))
|
||||||
@@ -60,7 +60,7 @@ class dc_Tests(wtc.WidgetTestCase):
|
|||||||
r = wx.Region(10,10,25,25)
|
r = wx.Region(10,10,25,25)
|
||||||
c = wx.DCClipper(dc, r)
|
c = wx.DCClipper(dc, r)
|
||||||
del c
|
del c
|
||||||
|
|
||||||
|
|
||||||
def test_DCBrushChanger(self):
|
def test_DCBrushChanger(self):
|
||||||
dc = wx.ClientDC(self.frame)
|
dc = wx.ClientDC(self.frame)
|
||||||
@@ -81,8 +81,8 @@ class dc_Tests(wtc.WidgetTestCase):
|
|||||||
del c
|
del c
|
||||||
c = wx.DCTextColourChanger(dc, 'blue')
|
c = wx.DCTextColourChanger(dc, 'blue')
|
||||||
del c
|
del c
|
||||||
|
|
||||||
|
|
||||||
def test_DCFontChanger(self):
|
def test_DCFontChanger(self):
|
||||||
dc = wx.ClientDC(self.frame)
|
dc = wx.ClientDC(self.frame)
|
||||||
font = wx.FFont(12, wx.FONTFAMILY_SWISS)
|
font = wx.FFont(12, wx.FONTFAMILY_SWISS)
|
||||||
@@ -91,40 +91,40 @@ class dc_Tests(wtc.WidgetTestCase):
|
|||||||
del c
|
del c
|
||||||
c = wx.DCFontChanger(dc, font)
|
c = wx.DCFontChanger(dc, font)
|
||||||
del c
|
del c
|
||||||
|
|
||||||
|
|
||||||
def test_NativeHandle(self):
|
def test_NativeHandle(self):
|
||||||
dc = wx.MemoryDC(wx.Bitmap(10,10))
|
dc = wx.MemoryDC(wx.Bitmap(10,10))
|
||||||
h = dc.GetHandle()
|
h = dc.GetHandle()
|
||||||
self.assertTrue(h is not None)
|
self.assertTrue(h is not None)
|
||||||
self.assertNotEqual(int(h), 0)
|
self.assertNotEqual(int(h), 0)
|
||||||
|
|
||||||
|
|
||||||
def test_NativeWinHandle(self):
|
def test_NativeWinHandle(self):
|
||||||
dc = wx.ClientDC(self.frame)
|
dc = wx.ClientDC(self.frame)
|
||||||
with warnings.catch_warnings():
|
with warnings.catch_warnings():
|
||||||
warnings.simplefilter("error")
|
warnings.simplefilter("error")
|
||||||
with self.assertRaises(wx.wxPyDeprecationWarning):
|
with self.assertRaises(wx.wxPyDeprecationWarning):
|
||||||
try:
|
try:
|
||||||
h = dc.GetHDC()
|
h = dc.GetHDC()
|
||||||
except NotImplementedError:
|
except NotImplementedError:
|
||||||
pass
|
pass
|
||||||
|
|
||||||
|
|
||||||
def test_NativeGTKHandle(self):
|
def test_NativeGTKHandle(self):
|
||||||
dc = wx.ClientDC(self.frame)
|
dc = wx.ClientDC(self.frame)
|
||||||
with warnings.catch_warnings():
|
with warnings.catch_warnings():
|
||||||
warnings.simplefilter("error")
|
warnings.simplefilter("error")
|
||||||
with self.assertRaises(wx.wxPyDeprecationWarning):
|
with self.assertRaises(wx.wxPyDeprecationWarning):
|
||||||
try:
|
try:
|
||||||
h = dc.GetGdkDrawable()
|
h = dc.GetGdkDrawable()
|
||||||
except NotImplementedError:
|
except NotImplementedError:
|
||||||
pass
|
pass
|
||||||
|
|
||||||
def test_NativeMacHandle(self):
|
def test_NativeMacHandle(self):
|
||||||
dc = wx.MemoryDC(wx.Bitmap(10,10))
|
dc = wx.MemoryDC(wx.Bitmap(10,10))
|
||||||
with warnings.catch_warnings():
|
with warnings.catch_warnings():
|
||||||
warnings.simplefilter("error")
|
warnings.simplefilter("error")
|
||||||
with self.assertRaises(wx.wxPyDeprecationWarning):
|
with self.assertRaises(wx.wxPyDeprecationWarning):
|
||||||
try:
|
try:
|
||||||
h = dc.GetCGContext()
|
h = dc.GetCGContext()
|
||||||
@@ -163,7 +163,7 @@ class dc_Tests(wtc.WidgetTestCase):
|
|||||||
dc = wx.ClientDC(self.frame)
|
dc = wx.ClientDC(self.frame)
|
||||||
bmp = wx.Bitmap(pngFile)
|
bmp = wx.Bitmap(pngFile)
|
||||||
dc.DrawLabel("toucan", bmp, (10,10, 200, 100))
|
dc.DrawLabel("toucan", bmp, (10,10, 200, 100))
|
||||||
|
|
||||||
values = dc.GetPartialTextExtents("Hello")
|
values = dc.GetPartialTextExtents("Hello")
|
||||||
self.assertTrue(type(values) == list)
|
self.assertTrue(type(values) == list)
|
||||||
self.assertTrue(len(values) == 5)
|
self.assertTrue(len(values) == 5)
|
||||||
@@ -173,8 +173,8 @@ class dc_Tests(wtc.WidgetTestCase):
|
|||||||
dc = wx.ClientDC(self.frame)
|
dc = wx.ClientDC(self.frame)
|
||||||
dc.DrawLines([wx.Point(5,5), wx.Point(25,5), wx.Point(25,25), wx.Point(25,5), wx.Point(5,5)])
|
dc.DrawLines([wx.Point(5,5), wx.Point(25,5), wx.Point(25,25), wx.Point(25,5), wx.Point(5,5)])
|
||||||
dc.DrawLines([(15,15), (35,15), (35,35), (35,15), (15,15)])
|
dc.DrawLines([(15,15), (35,15), (35,35), (35,15), (15,15)])
|
||||||
|
|
||||||
|
|
||||||
#---------------------------------------------------------------------------
|
#---------------------------------------------------------------------------
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -7,7 +7,7 @@ try:
|
|||||||
haveNumpy = True
|
haveNumpy = True
|
||||||
except ImportError:
|
except ImportError:
|
||||||
haveNumpy = False
|
haveNumpy = False
|
||||||
|
|
||||||
#---------------------------------------------------------------------------
|
#---------------------------------------------------------------------------
|
||||||
|
|
||||||
w = 600
|
w = 600
|
||||||
@@ -146,13 +146,13 @@ class dcDrawLists_Tests(wtc.WidgetTestCase):
|
|||||||
dc.SetPen(wx.Pen("BLACK", 1))
|
dc.SetPen(wx.Pen("BLACK", 1))
|
||||||
|
|
||||||
pens = makeRandomPens()
|
pens = makeRandomPens()
|
||||||
|
|
||||||
dc.DrawPointList(makeRandomPoints())
|
dc.DrawPointList(makeRandomPoints())
|
||||||
dc.DrawPointList(makeRandomPoints(), wx.Pen("RED", 1))
|
dc.DrawPointList(makeRandomPoints(), wx.Pen("RED", 1))
|
||||||
dc.DrawPointList(makeRandomPoints(), pens)
|
dc.DrawPointList(makeRandomPoints(), pens)
|
||||||
del dc
|
del dc
|
||||||
|
|
||||||
|
|
||||||
@unittest.skipIf(not haveNumpy, "Numpy required for this test")
|
@unittest.skipIf(not haveNumpy, "Numpy required for this test")
|
||||||
def test_dcDrawPointArray(self):
|
def test_dcDrawPointArray(self):
|
||||||
pnl = wx.Panel(self.frame)
|
pnl = wx.Panel(self.frame)
|
||||||
@@ -161,27 +161,27 @@ class dcDrawLists_Tests(wtc.WidgetTestCase):
|
|||||||
dc.SetPen(wx.Pen("BLACK", 1))
|
dc.SetPen(wx.Pen("BLACK", 1))
|
||||||
|
|
||||||
pens = makeRandomPens()
|
pens = makeRandomPens()
|
||||||
|
|
||||||
dc.DrawPointList(np.array(makeRandomPoints()))
|
dc.DrawPointList(np.array(makeRandomPoints()))
|
||||||
dc.DrawPointList(np.array(makeRandomPoints()), wx.Pen("RED", 1))
|
dc.DrawPointList(np.array(makeRandomPoints()), wx.Pen("RED", 1))
|
||||||
dc.DrawPointList(np.array(makeRandomPoints()), pens)
|
dc.DrawPointList(np.array(makeRandomPoints()), pens)
|
||||||
del dc
|
del dc
|
||||||
|
|
||||||
|
|
||||||
def test_dcDrawLineLists(self):
|
def test_dcDrawLineLists(self):
|
||||||
pnl = wx.Panel(self.frame)
|
pnl = wx.Panel(self.frame)
|
||||||
self.frame.SetSize((w,h))
|
self.frame.SetSize((w,h))
|
||||||
dc = wx.ClientDC(pnl)
|
dc = wx.ClientDC(pnl)
|
||||||
dc.SetPen(wx.Pen("BLACK", 1))
|
dc.SetPen(wx.Pen("BLACK", 1))
|
||||||
|
|
||||||
pens = makeRandomPens()
|
pens = makeRandomPens()
|
||||||
|
|
||||||
dc.DrawLineList(makeRandomLines())
|
dc.DrawLineList(makeRandomLines())
|
||||||
dc.DrawLineList(makeRandomLines(), wx.Pen("RED", 2))
|
dc.DrawLineList(makeRandomLines(), wx.Pen("RED", 2))
|
||||||
dc.DrawLineList(makeRandomLines(), pens)
|
dc.DrawLineList(makeRandomLines(), pens)
|
||||||
del dc
|
del dc
|
||||||
|
|
||||||
|
|
||||||
def test_dcDrawRectangleLists(self):
|
def test_dcDrawRectangleLists(self):
|
||||||
pnl = wx.Panel(self.frame)
|
pnl = wx.Panel(self.frame)
|
||||||
self.frame.SetSize((w,h))
|
self.frame.SetSize((w,h))
|
||||||
@@ -191,14 +191,14 @@ class dcDrawLists_Tests(wtc.WidgetTestCase):
|
|||||||
|
|
||||||
pens = makeRandomPens()
|
pens = makeRandomPens()
|
||||||
brushes = makeRandomBrushes()
|
brushes = makeRandomBrushes()
|
||||||
|
|
||||||
dc.DrawRectangleList(makeRandomRectangles())
|
dc.DrawRectangleList(makeRandomRectangles())
|
||||||
dc.DrawRectangleList(makeRandomRectangles(),pens)
|
dc.DrawRectangleList(makeRandomRectangles(),pens)
|
||||||
dc.DrawRectangleList(makeRandomRectangles(),pens[0],brushes)
|
dc.DrawRectangleList(makeRandomRectangles(),pens[0],brushes)
|
||||||
dc.DrawRectangleList(makeRandomRectangles(),pens,brushes[0])
|
dc.DrawRectangleList(makeRandomRectangles(),pens,brushes[0])
|
||||||
dc.DrawRectangleList(makeRandomRectangles(),None,brushes)
|
dc.DrawRectangleList(makeRandomRectangles(),None,brushes)
|
||||||
del dc
|
del dc
|
||||||
|
|
||||||
|
|
||||||
@unittest.skipIf(not haveNumpy, "Numpy required for this test")
|
@unittest.skipIf(not haveNumpy, "Numpy required for this test")
|
||||||
def test_dcDrawRectangleArray(self):
|
def test_dcDrawRectangleArray(self):
|
||||||
@@ -210,15 +210,15 @@ class dcDrawLists_Tests(wtc.WidgetTestCase):
|
|||||||
|
|
||||||
pens = makeRandomPens()
|
pens = makeRandomPens()
|
||||||
brushes = makeRandomBrushes()
|
brushes = makeRandomBrushes()
|
||||||
|
|
||||||
dc.DrawRectangleList(np.array(makeRandomRectangles()))
|
dc.DrawRectangleList(np.array(makeRandomRectangles()))
|
||||||
dc.DrawRectangleList(np.array(makeRandomRectangles()),pens)
|
dc.DrawRectangleList(np.array(makeRandomRectangles()),pens)
|
||||||
dc.DrawRectangleList(np.array(makeRandomRectangles()),pens[0],brushes)
|
dc.DrawRectangleList(np.array(makeRandomRectangles()),pens[0],brushes)
|
||||||
dc.DrawRectangleList(np.array(makeRandomRectangles()),pens,brushes[0])
|
dc.DrawRectangleList(np.array(makeRandomRectangles()),pens,brushes[0])
|
||||||
dc.DrawRectangleList(np.array(makeRandomRectangles()),None,brushes)
|
dc.DrawRectangleList(np.array(makeRandomRectangles()),None,brushes)
|
||||||
del dc
|
del dc
|
||||||
|
|
||||||
|
|
||||||
def test_dcDrawElipseLists(self):
|
def test_dcDrawElipseLists(self):
|
||||||
pnl = wx.Panel(self.frame)
|
pnl = wx.Panel(self.frame)
|
||||||
self.frame.SetSize((w,h))
|
self.frame.SetSize((w,h))
|
||||||
@@ -228,15 +228,15 @@ class dcDrawLists_Tests(wtc.WidgetTestCase):
|
|||||||
|
|
||||||
pens = makeRandomPens()
|
pens = makeRandomPens()
|
||||||
brushes = makeRandomBrushes()
|
brushes = makeRandomBrushes()
|
||||||
|
|
||||||
dc.DrawEllipseList(makeRandomRectangles())
|
dc.DrawEllipseList(makeRandomRectangles())
|
||||||
dc.DrawEllipseList(makeRandomRectangles(),pens)
|
dc.DrawEllipseList(makeRandomRectangles(),pens)
|
||||||
dc.DrawEllipseList(makeRandomRectangles(),pens[0],brushes)
|
dc.DrawEllipseList(makeRandomRectangles(),pens[0],brushes)
|
||||||
dc.DrawEllipseList(makeRandomRectangles(),pens,brushes[0])
|
dc.DrawEllipseList(makeRandomRectangles(),pens,brushes[0])
|
||||||
dc.DrawEllipseList(makeRandomRectangles(),None,brushes)
|
dc.DrawEllipseList(makeRandomRectangles(),None,brushes)
|
||||||
del dc
|
del dc
|
||||||
|
|
||||||
|
|
||||||
def test_dcDrawPloygonLists(self):
|
def test_dcDrawPloygonLists(self):
|
||||||
pnl = wx.Panel(self.frame)
|
pnl = wx.Panel(self.frame)
|
||||||
self.frame.SetSize((w,h))
|
self.frame.SetSize((w,h))
|
||||||
@@ -247,7 +247,7 @@ class dcDrawLists_Tests(wtc.WidgetTestCase):
|
|||||||
pens = makeRandomPens()
|
pens = makeRandomPens()
|
||||||
brushes = makeRandomBrushes()
|
brushes = makeRandomBrushes()
|
||||||
polygons = makeRandomPolygons()
|
polygons = makeRandomPolygons()
|
||||||
|
|
||||||
dc.DrawPolygonList(polygons)
|
dc.DrawPolygonList(polygons)
|
||||||
dc.DrawPolygonList(polygons, pens)
|
dc.DrawPolygonList(polygons, pens)
|
||||||
dc.DrawPolygonList(polygons, pens[0],brushes)
|
dc.DrawPolygonList(polygons, pens[0],brushes)
|
||||||
@@ -255,23 +255,23 @@ class dcDrawLists_Tests(wtc.WidgetTestCase):
|
|||||||
dc.DrawPolygonList(polygons, None,brushes)
|
dc.DrawPolygonList(polygons, None,brushes)
|
||||||
del dc
|
del dc
|
||||||
|
|
||||||
|
|
||||||
def test_dcDrawTextLists(self):
|
def test_dcDrawTextLists(self):
|
||||||
pnl = wx.Panel(self.frame)
|
pnl = wx.Panel(self.frame)
|
||||||
self.frame.SetSize((w,h))
|
self.frame.SetSize((w,h))
|
||||||
dc = wx.ClientDC(pnl)
|
dc = wx.ClientDC(pnl)
|
||||||
dc.SetBackgroundMode(wx.SOLID)
|
dc.SetBackgroundMode(wx.SOLID)
|
||||||
|
|
||||||
points = makeRandomPoints()
|
points = makeRandomPoints()
|
||||||
fore = makeRandomColors()
|
fore = makeRandomColors()
|
||||||
back = makeRandomColors()
|
back = makeRandomColors()
|
||||||
texts = makeRandomText()
|
texts = makeRandomText()
|
||||||
|
|
||||||
dc.DrawTextList(texts, points, fore, back)
|
dc.DrawTextList(texts, points, fore, back)
|
||||||
del dc
|
del dc
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
#---------------------------------------------------------------------------
|
#---------------------------------------------------------------------------
|
||||||
|
|
||||||
if __name__ == '__main__':
|
if __name__ == '__main__':
|
||||||
|
|||||||
@@ -6,7 +6,7 @@ import sys
|
|||||||
#---------------------------------------------------------------------------
|
#---------------------------------------------------------------------------
|
||||||
|
|
||||||
class BufferedDCTests(wtc.WidgetTestCase):
|
class BufferedDCTests(wtc.WidgetTestCase):
|
||||||
|
|
||||||
def test_0_CheckKeepReference(self):
|
def test_0_CheckKeepReference(self):
|
||||||
# We're using the KeepReference annotation for the dc and bitmap args
|
# We're using the KeepReference annotation for the dc and bitmap args
|
||||||
# to ensure that they will live as long as the DC does. This test will
|
# to ensure that they will live as long as the DC does. This test will
|
||||||
@@ -16,14 +16,14 @@ class BufferedDCTests(wtc.WidgetTestCase):
|
|||||||
bmp = wx.Bitmap(1,1)
|
bmp = wx.Bitmap(1,1)
|
||||||
cdc_cnt1 = sys.getrefcount(cdc)
|
cdc_cnt1 = sys.getrefcount(cdc)
|
||||||
bmp_cnt1 = sys.getrefcount(bmp)
|
bmp_cnt1 = sys.getrefcount(bmp)
|
||||||
|
|
||||||
dc = wx.BufferedDC(cdc, bmp)
|
dc = wx.BufferedDC(cdc, bmp)
|
||||||
|
|
||||||
cdc_cnt2 = sys.getrefcount(cdc)
|
cdc_cnt2 = sys.getrefcount(cdc)
|
||||||
bmp_cnt2 = sys.getrefcount(bmp)
|
bmp_cnt2 = sys.getrefcount(bmp)
|
||||||
|
|
||||||
del dc
|
del dc
|
||||||
|
|
||||||
cdc_cnt3 = sys.getrefcount(cdc)
|
cdc_cnt3 = sys.getrefcount(cdc)
|
||||||
bmp_cnt3 = sys.getrefcount(bmp)
|
bmp_cnt3 = sys.getrefcount(bmp)
|
||||||
|
|
||||||
@@ -31,15 +31,15 @@ class BufferedDCTests(wtc.WidgetTestCase):
|
|||||||
self.assertTrue(cdc_cnt3 == cdc_cnt1)
|
self.assertTrue(cdc_cnt3 == cdc_cnt1)
|
||||||
self.assertTrue(bmp_cnt2 == bmp_cnt1 + 1)
|
self.assertTrue(bmp_cnt2 == bmp_cnt1 + 1)
|
||||||
self.assertTrue(bmp_cnt3 == bmp_cnt1)
|
self.assertTrue(bmp_cnt3 == bmp_cnt1)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
def test_BufferedDCDefaultCtor(self):
|
def test_BufferedDCDefaultCtor(self):
|
||||||
dc = wx.BufferedDC()
|
dc = wx.BufferedDC()
|
||||||
dc.Init(None, wx.Bitmap(25,25))
|
dc.Init(None, wx.Bitmap(25,25))
|
||||||
dc.DrawLine(0,0, 50,50)
|
dc.DrawLine(0,0, 50,50)
|
||||||
|
|
||||||
|
|
||||||
def test_BufferedDCCtors(self):
|
def test_BufferedDCCtors(self):
|
||||||
dc = wx.BufferedDC(wx.ClientDC(self.frame), wx.Size(100,100))
|
dc = wx.BufferedDC(wx.ClientDC(self.frame), wx.Size(100,100))
|
||||||
dc.DrawLine(0,0, 50,50)
|
dc.DrawLine(0,0, 50,50)
|
||||||
@@ -48,7 +48,7 @@ class BufferedDCTests(wtc.WidgetTestCase):
|
|||||||
dc = wx.BufferedDC(None, wx.Bitmap(100,100))
|
dc = wx.BufferedDC(None, wx.Bitmap(100,100))
|
||||||
dc.DrawLine(0,0, 50,50)
|
dc.DrawLine(0,0, 50,50)
|
||||||
|
|
||||||
|
|
||||||
def test_BufferedPaintDC(self):
|
def test_BufferedPaintDC(self):
|
||||||
class TestPanel(wx.Panel):
|
class TestPanel(wx.Panel):
|
||||||
def __init__(self, *args, **kw):
|
def __init__(self, *args, **kw):
|
||||||
@@ -57,12 +57,12 @@ class BufferedDCTests(wtc.WidgetTestCase):
|
|||||||
self.Bind(wx.EVT_PAINT, self.onPaint)
|
self.Bind(wx.EVT_PAINT, self.onPaint)
|
||||||
self.bmp = wx.Bitmap(100,100)
|
self.bmp = wx.Bitmap(100,100)
|
||||||
self.onPaintCalled = False
|
self.onPaintCalled = False
|
||||||
|
|
||||||
def onPaint(self, evt):
|
def onPaint(self, evt):
|
||||||
dc = wx.BufferedPaintDC(self, self.bmp)
|
dc = wx.BufferedPaintDC(self, self.bmp)
|
||||||
dc.DrawLine(0,0, 50,50)
|
dc.DrawLine(0,0, 50,50)
|
||||||
self.onPaintCalled = True
|
self.onPaintCalled = True
|
||||||
|
|
||||||
panel = TestPanel(self.frame)
|
panel = TestPanel(self.frame)
|
||||||
self.frame.SendSizeEvent()
|
self.frame.SendSizeEvent()
|
||||||
panel.Refresh()
|
panel.Refresh()
|
||||||
@@ -70,7 +70,7 @@ class BufferedDCTests(wtc.WidgetTestCase):
|
|||||||
self.waitFor(200)
|
self.waitFor(200)
|
||||||
self.assertTrue(panel.onPaintCalled == True)
|
self.assertTrue(panel.onPaintCalled == True)
|
||||||
|
|
||||||
|
|
||||||
def test_AutoBufferedPaintDC(self):
|
def test_AutoBufferedPaintDC(self):
|
||||||
class TestPanel(wx.Panel):
|
class TestPanel(wx.Panel):
|
||||||
def __init__(self, *args, **kw):
|
def __init__(self, *args, **kw):
|
||||||
@@ -78,12 +78,12 @@ class BufferedDCTests(wtc.WidgetTestCase):
|
|||||||
self.SetBackgroundStyle(wx.BG_STYLE_PAINT)
|
self.SetBackgroundStyle(wx.BG_STYLE_PAINT)
|
||||||
self.Bind(wx.EVT_PAINT, self.onPaint)
|
self.Bind(wx.EVT_PAINT, self.onPaint)
|
||||||
self.onPaintCalled = False
|
self.onPaintCalled = False
|
||||||
|
|
||||||
def onPaint(self, evt):
|
def onPaint(self, evt):
|
||||||
dc = wx.AutoBufferedPaintDC(self)
|
dc = wx.AutoBufferedPaintDC(self)
|
||||||
dc.DrawLine(0,0, 50,50)
|
dc.DrawLine(0,0, 50,50)
|
||||||
self.onPaintCalled = True
|
self.onPaintCalled = True
|
||||||
|
|
||||||
panel = TestPanel(self.frame)
|
panel = TestPanel(self.frame)
|
||||||
self.frame.SendSizeEvent()
|
self.frame.SendSizeEvent()
|
||||||
panel.Refresh()
|
panel.Refresh()
|
||||||
@@ -91,7 +91,7 @@ class BufferedDCTests(wtc.WidgetTestCase):
|
|||||||
self.waitFor(200)
|
self.waitFor(200)
|
||||||
self.assertTrue(panel.onPaintCalled == True)
|
self.assertTrue(panel.onPaintCalled == True)
|
||||||
|
|
||||||
|
|
||||||
def test_BufferedDCConstantsExist(self):
|
def test_BufferedDCConstantsExist(self):
|
||||||
wx.BUFFER_VIRTUAL_AREA
|
wx.BUFFER_VIRTUAL_AREA
|
||||||
wx.BUFFER_CLIENT_AREA
|
wx.BUFFER_CLIENT_AREA
|
||||||
|
|||||||
@@ -6,16 +6,16 @@ import sys
|
|||||||
#---------------------------------------------------------------------------
|
#---------------------------------------------------------------------------
|
||||||
|
|
||||||
class ClientDCTests(wtc.WidgetTestCase):
|
class ClientDCTests(wtc.WidgetTestCase):
|
||||||
|
|
||||||
def test_ClientDC(self):
|
def test_ClientDC(self):
|
||||||
dc = wx.ClientDC(self.frame)
|
dc = wx.ClientDC(self.frame)
|
||||||
dc.DrawLine(0,0, 50,50)
|
dc.DrawLine(0,0, 50,50)
|
||||||
|
|
||||||
def test_WindowDC(self):
|
def test_WindowDC(self):
|
||||||
dc = wx.WindowDC(self.frame)
|
dc = wx.WindowDC(self.frame)
|
||||||
dc.DrawLine(0,0, 50,50)
|
dc.DrawLine(0,0, 50,50)
|
||||||
|
|
||||||
|
|
||||||
def test_PaintDC(self):
|
def test_PaintDC(self):
|
||||||
class TestPanel(wx.Panel):
|
class TestPanel(wx.Panel):
|
||||||
def __init__(self, *args, **kw):
|
def __init__(self, *args, **kw):
|
||||||
@@ -23,12 +23,12 @@ class ClientDCTests(wtc.WidgetTestCase):
|
|||||||
#self.SetBackgroundStyle(wx.BG_STYLE_PAINT)
|
#self.SetBackgroundStyle(wx.BG_STYLE_PAINT)
|
||||||
self.Bind(wx.EVT_PAINT, self.onPaint)
|
self.Bind(wx.EVT_PAINT, self.onPaint)
|
||||||
self.onPaintCalled = False
|
self.onPaintCalled = False
|
||||||
|
|
||||||
def onPaint(self, evt):
|
def onPaint(self, evt):
|
||||||
dc = wx.PaintDC(self)
|
dc = wx.PaintDC(self)
|
||||||
dc.DrawLine(0,0, 50,50)
|
dc.DrawLine(0,0, 50,50)
|
||||||
self.onPaintCalled = True
|
self.onPaintCalled = True
|
||||||
|
|
||||||
panel = TestPanel(self.frame)
|
panel = TestPanel(self.frame)
|
||||||
self.frame.SendSizeEvent()
|
self.frame.SendSizeEvent()
|
||||||
panel.Refresh()
|
panel.Refresh()
|
||||||
@@ -36,7 +36,7 @@ class ClientDCTests(wtc.WidgetTestCase):
|
|||||||
self.waitFor(200)
|
self.waitFor(200)
|
||||||
self.assertTrue(panel.onPaintCalled == True)
|
self.assertTrue(panel.onPaintCalled == True)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
#---------------------------------------------------------------------------
|
#---------------------------------------------------------------------------
|
||||||
|
|
||||||
|
|||||||
@@ -6,31 +6,31 @@ import sys
|
|||||||
#---------------------------------------------------------------------------
|
#---------------------------------------------------------------------------
|
||||||
|
|
||||||
class dcgraph_tests(wtc.WidgetTestCase):
|
class dcgraph_tests(wtc.WidgetTestCase):
|
||||||
|
|
||||||
def test_GCDC1(self):
|
def test_GCDC1(self):
|
||||||
dc = wx.ClientDC(self.frame)
|
dc = wx.ClientDC(self.frame)
|
||||||
gdc = wx.GCDC(dc)
|
gdc = wx.GCDC(dc)
|
||||||
|
|
||||||
|
|
||||||
def test_GCDC2(self):
|
def test_GCDC2(self):
|
||||||
bmp = wx.Bitmap(25,25)
|
bmp = wx.Bitmap(25,25)
|
||||||
dc = wx.MemoryDC(bmp)
|
dc = wx.MemoryDC(bmp)
|
||||||
gdc = wx.GCDC(dc)
|
gdc = wx.GCDC(dc)
|
||||||
|
|
||||||
|
|
||||||
@unittest.skipIf('wxGTK' in wx.PlatformInfo, 'PrinterDC not supported on wxGTK')
|
@unittest.skipIf('wxGTK' in wx.PlatformInfo, 'PrinterDC not supported on wxGTK')
|
||||||
def test_GCDC3(self):
|
def test_GCDC3(self):
|
||||||
dc = wx.PrinterDC(wx.PrintData())
|
dc = wx.PrinterDC(wx.PrintData())
|
||||||
gdc = wx.GCDC(dc)
|
gdc = wx.GCDC(dc)
|
||||||
|
|
||||||
|
|
||||||
def test_GCDC4(self):
|
def test_GCDC4(self):
|
||||||
bmp = wx.Bitmap(25,25)
|
bmp = wx.Bitmap(25,25)
|
||||||
dc = wx.MemoryDC(bmp)
|
dc = wx.MemoryDC(bmp)
|
||||||
ctx = wx.GraphicsContext.Create(dc)
|
ctx = wx.GraphicsContext.Create(dc)
|
||||||
gdc = wx.GCDC(ctx)
|
gdc = wx.GCDC(ctx)
|
||||||
del gdc
|
del gdc
|
||||||
|
|
||||||
#---------------------------------------------------------------------------
|
#---------------------------------------------------------------------------
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -6,26 +6,26 @@ import sys
|
|||||||
#---------------------------------------------------------------------------
|
#---------------------------------------------------------------------------
|
||||||
|
|
||||||
class MemoryDCTests(wtc.WidgetTestCase):
|
class MemoryDCTests(wtc.WidgetTestCase):
|
||||||
|
|
||||||
def test_MemoryDC1(self):
|
def test_MemoryDC1(self):
|
||||||
bmp = wx.Bitmap(250,250)
|
bmp = wx.Bitmap(250,250)
|
||||||
dc = wx.MemoryDC()
|
dc = wx.MemoryDC()
|
||||||
dc.SelectObject(bmp)
|
dc.SelectObject(bmp)
|
||||||
dc.DrawLine(0,0, 50,50)
|
dc.DrawLine(0,0, 50,50)
|
||||||
|
|
||||||
|
|
||||||
def test_MemoryDC2(self):
|
def test_MemoryDC2(self):
|
||||||
bmp = wx.Bitmap(250,250)
|
bmp = wx.Bitmap(250,250)
|
||||||
dc = wx.MemoryDC(bmp)
|
dc = wx.MemoryDC(bmp)
|
||||||
dc.DrawLine(0,0, 50,50)
|
dc.DrawLine(0,0, 50,50)
|
||||||
|
|
||||||
def test_MemoryDC3(self):
|
def test_MemoryDC3(self):
|
||||||
cdc = wx.ClientDC(self.frame)
|
cdc = wx.ClientDC(self.frame)
|
||||||
dc = wx.MemoryDC(cdc)
|
dc = wx.MemoryDC(cdc)
|
||||||
bmp = wx.Bitmap(250,250)
|
bmp = wx.Bitmap(250,250)
|
||||||
dc.SelectObject(bmp)
|
dc.SelectObject(bmp)
|
||||||
dc.DrawLine(0,0, 50,50)
|
dc.DrawLine(0,0, 50,50)
|
||||||
|
|
||||||
|
|
||||||
#---------------------------------------------------------------------------
|
#---------------------------------------------------------------------------
|
||||||
|
|
||||||
|
|||||||
@@ -6,7 +6,7 @@ import sys
|
|||||||
#---------------------------------------------------------------------------
|
#---------------------------------------------------------------------------
|
||||||
|
|
||||||
class MirrorDCTests(wtc.WidgetTestCase):
|
class MirrorDCTests(wtc.WidgetTestCase):
|
||||||
|
|
||||||
def test_MirrorDC1(self):
|
def test_MirrorDC1(self):
|
||||||
cdc = wx.ClientDC(self.frame)
|
cdc = wx.ClientDC(self.frame)
|
||||||
dc = wx.MirrorDC(cdc, True)
|
dc = wx.MirrorDC(cdc, True)
|
||||||
|
|||||||
@@ -6,13 +6,13 @@ import sys
|
|||||||
#---------------------------------------------------------------------------
|
#---------------------------------------------------------------------------
|
||||||
|
|
||||||
class dcprint_tests(wtc.WidgetTestCase):
|
class dcprint_tests(wtc.WidgetTestCase):
|
||||||
|
|
||||||
@unittest.skipIf('wxGTK' in wx.PlatformInfo, 'PrinterDC not supported on wxGTK')
|
@unittest.skipIf('wxGTK' in wx.PlatformInfo, 'PrinterDC not supported on wxGTK')
|
||||||
def test_PrinterDC1(self):
|
def test_PrinterDC1(self):
|
||||||
dc = wx.PrinterDC(wx.PrintData())
|
dc = wx.PrinterDC(wx.PrintData())
|
||||||
dc.DrawLine(0,0, 50,50)
|
dc.DrawLine(0,0, 50,50)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
#---------------------------------------------------------------------------
|
#---------------------------------------------------------------------------
|
||||||
|
|
||||||
|
|||||||
@@ -9,7 +9,7 @@ fileName = os.path.join(os.path.dirname(__file__), 'dcpstest.svg')
|
|||||||
#---------------------------------------------------------------------------
|
#---------------------------------------------------------------------------
|
||||||
|
|
||||||
class dcps_tests(wtc.WidgetTestCase):
|
class dcps_tests(wtc.WidgetTestCase):
|
||||||
|
|
||||||
def test_PostscriptDC1(self):
|
def test_PostscriptDC1(self):
|
||||||
pd = wx.PrintData()
|
pd = wx.PrintData()
|
||||||
pd.SetPrintMode(wx.PRINT_MODE_FILE)
|
pd.SetPrintMode(wx.PRINT_MODE_FILE)
|
||||||
@@ -25,7 +25,7 @@ class dcps_tests(wtc.WidgetTestCase):
|
|||||||
del dc
|
del dc
|
||||||
|
|
||||||
os.remove(fileName)
|
os.remove(fileName)
|
||||||
|
|
||||||
|
|
||||||
#---------------------------------------------------------------------------
|
#---------------------------------------------------------------------------
|
||||||
|
|
||||||
|
|||||||
@@ -7,7 +7,7 @@ import sys
|
|||||||
|
|
||||||
|
|
||||||
class ScreenDCTests(wtc.WidgetTestCase):
|
class ScreenDCTests(wtc.WidgetTestCase):
|
||||||
|
|
||||||
def test_ScreenDC1(self):
|
def test_ScreenDC1(self):
|
||||||
dc = wx.ScreenDC()
|
dc = wx.ScreenDC()
|
||||||
dc.DrawLine(0,0, 50,50)
|
dc.DrawLine(0,0, 50,50)
|
||||||
|
|||||||
@@ -9,12 +9,12 @@ fileName = 'svgtest.svg'
|
|||||||
#---------------------------------------------------------------------------
|
#---------------------------------------------------------------------------
|
||||||
|
|
||||||
class SvgDCTests(wtc.WidgetTestCase):
|
class SvgDCTests(wtc.WidgetTestCase):
|
||||||
|
|
||||||
def test_SvgDC1(self):
|
def test_SvgDC1(self):
|
||||||
dc = wx.SVGFileDC(fileName)
|
dc = wx.SVGFileDC(fileName)
|
||||||
dc.DrawLine(0,0, 50,50)
|
dc.DrawLine(0,0, 50,50)
|
||||||
del dc
|
del dc
|
||||||
|
|
||||||
os.remove(fileName)
|
os.remove(fileName)
|
||||||
|
|
||||||
#---------------------------------------------------------------------------
|
#---------------------------------------------------------------------------
|
||||||
|
|||||||
@@ -13,7 +13,7 @@ class deadobj_Tests(wtc.WidgetTestCase):
|
|||||||
# is still safe to call methods of that window object.
|
# is still safe to call methods of that window object.
|
||||||
p = wx.Panel(self.frame)
|
p = wx.Panel(self.frame)
|
||||||
self.assertTrue(True if p else False)
|
self.assertTrue(True if p else False)
|
||||||
|
|
||||||
p.Destroy()
|
p.Destroy()
|
||||||
self.assertFalse(True if p else False)
|
self.assertFalse(True if p else False)
|
||||||
|
|
||||||
@@ -31,8 +31,8 @@ class deadobj_Tests(wtc.WidgetTestCase):
|
|||||||
# the test environment.
|
# the test environment.
|
||||||
if 'wxMSW' not in wx.PlatformInfo:
|
if 'wxMSW' not in wx.PlatformInfo:
|
||||||
self.assertFalse(True if f else False)
|
self.assertFalse(True if f else False)
|
||||||
|
|
||||||
|
|
||||||
def test_deadobjException(self):
|
def test_deadobjException(self):
|
||||||
# There should be a RuntimeError exception if we try to use an object
|
# There should be a RuntimeError exception if we try to use an object
|
||||||
# after it's C++ parts have been detroyed.
|
# after it's C++ parts have been detroyed.
|
||||||
@@ -40,8 +40,8 @@ class deadobj_Tests(wtc.WidgetTestCase):
|
|||||||
p.Destroy()
|
p.Destroy()
|
||||||
with self.assertRaises(RuntimeError):
|
with self.assertRaises(RuntimeError):
|
||||||
p.IsShown()
|
p.IsShown()
|
||||||
|
|
||||||
|
|
||||||
#---------------------------------------------------------------------------
|
#---------------------------------------------------------------------------
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -10,7 +10,7 @@ class debug_Tests(wtc.WidgetTestCase):
|
|||||||
wx.Abort
|
wx.Abort
|
||||||
wx.Trap
|
wx.Trap
|
||||||
wx.DisableAsserts
|
wx.DisableAsserts
|
||||||
|
|
||||||
#---------------------------------------------------------------------------
|
#---------------------------------------------------------------------------
|
||||||
|
|
||||||
if __name__ == '__main__':
|
if __name__ == '__main__':
|
||||||
|
|||||||
@@ -13,7 +13,7 @@ class defs_Tests(wtc.WidgetTestCase):
|
|||||||
self.assertEqual(wx.INT64_MIN, (-9223372036854775807)-1)
|
self.assertEqual(wx.INT64_MIN, (-9223372036854775807)-1)
|
||||||
self.assertEqual(wx.INT64_MAX, 9223372036854775807)
|
self.assertEqual(wx.INT64_MAX, 9223372036854775807)
|
||||||
self.assertEqual(wx.UINT64_MAX, 0xFFFFFFFFFFFFFFFF)
|
self.assertEqual(wx.UINT64_MAX, 0xFFFFFFFFFFFFFFFF)
|
||||||
|
|
||||||
def test_constants2(self):
|
def test_constants2(self):
|
||||||
# These constants needed some special tweaking. Make sure it
|
# These constants needed some special tweaking. Make sure it
|
||||||
# was done right.
|
# was done right.
|
||||||
|
|||||||
@@ -7,7 +7,7 @@ import wx
|
|||||||
class dialog_Tests(wtc.WidgetTestCase):
|
class dialog_Tests(wtc.WidgetTestCase):
|
||||||
|
|
||||||
def runDialog(self, dlg):
|
def runDialog(self, dlg):
|
||||||
# Add some buttons
|
# Add some buttons
|
||||||
ok = wx.Button(dlg, wx.ID_OK, pos=(10,10))
|
ok = wx.Button(dlg, wx.ID_OK, pos=(10,10))
|
||||||
cancel = wx.Button(dlg, wx.ID_CANCEL, pos=(100,10))
|
cancel = wx.Button(dlg, wx.ID_CANCEL, pos=(100,10))
|
||||||
|
|
||||||
@@ -19,14 +19,14 @@ class dialog_Tests(wtc.WidgetTestCase):
|
|||||||
val = dlg.ShowModal()
|
val = dlg.ShowModal()
|
||||||
dlg.Destroy()
|
dlg.Destroy()
|
||||||
self.assertTrue(val == wx.ID_OK)
|
self.assertTrue(val == wx.ID_OK)
|
||||||
self.myYield()
|
self.myYield()
|
||||||
|
|
||||||
|
|
||||||
def test_dialogDefaultCtor(self):
|
def test_dialogDefaultCtor(self):
|
||||||
dlg = wx.Dialog()
|
dlg = wx.Dialog()
|
||||||
dlg.Create(None, title='dialog')
|
dlg.Create(None, title='dialog')
|
||||||
self.runDialog(dlg)
|
self.runDialog(dlg)
|
||||||
|
|
||||||
def test_dialog1(self):
|
def test_dialog1(self):
|
||||||
# with parent
|
# with parent
|
||||||
dlg = wx.Dialog(self.frame, title='Hello')
|
dlg = wx.Dialog(self.frame, title='Hello')
|
||||||
@@ -36,14 +36,14 @@ class dialog_Tests(wtc.WidgetTestCase):
|
|||||||
# without parent
|
# without parent
|
||||||
dlg = wx.Dialog(None, title='World')
|
dlg = wx.Dialog(None, title='World')
|
||||||
self.runDialog(dlg)
|
self.runDialog(dlg)
|
||||||
|
|
||||||
def test_dialogTextSizer(self):
|
def test_dialogTextSizer(self):
|
||||||
dlg = wx.Dialog(self.frame, title='Hello')
|
dlg = wx.Dialog(self.frame, title='Hello')
|
||||||
s = dlg.CreateTextSizer("This is a test.\nThis is only a test.\nHello World")
|
s = dlg.CreateTextSizer("This is a test.\nThis is only a test.\nHello World")
|
||||||
self.assertTrue(isinstance(s, wx.Sizer))
|
self.assertTrue(isinstance(s, wx.Sizer))
|
||||||
self.assertTrue(len(s.Children) == 3)
|
self.assertTrue(len(s.Children) == 3)
|
||||||
self.runDialog(dlg)
|
self.runDialog(dlg)
|
||||||
|
|
||||||
#---------------------------------------------------------------------------
|
#---------------------------------------------------------------------------
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -9,19 +9,19 @@ class dirctrl_Tests(wtc.WidgetTestCase):
|
|||||||
def test_dirctrlCtor(self):
|
def test_dirctrlCtor(self):
|
||||||
d = wx.GenericDirCtrl(self.frame)
|
d = wx.GenericDirCtrl(self.frame)
|
||||||
|
|
||||||
|
|
||||||
def test_dirctrlDefaultCtor(self):
|
def test_dirctrlDefaultCtor(self):
|
||||||
d = wx.GenericDirCtrl()
|
d = wx.GenericDirCtrl()
|
||||||
d.Create(self.frame)
|
d.Create(self.frame)
|
||||||
|
|
||||||
|
|
||||||
def test_dirctrlFlags(self):
|
def test_dirctrlFlags(self):
|
||||||
wx.DIRCTRL_DIR_ONLY
|
wx.DIRCTRL_DIR_ONLY
|
||||||
wx.DIRCTRL_SELECT_FIRST
|
wx.DIRCTRL_SELECT_FIRST
|
||||||
wx.DIRCTRL_3D_INTERNAL
|
wx.DIRCTRL_3D_INTERNAL
|
||||||
wx.DIRCTRL_EDIT_LABELS
|
wx.DIRCTRL_EDIT_LABELS
|
||||||
wx.DIRCTRL_MULTIPLE
|
wx.DIRCTRL_MULTIPLE
|
||||||
|
|
||||||
#---------------------------------------------------------------------------
|
#---------------------------------------------------------------------------
|
||||||
|
|
||||||
if __name__ == '__main__':
|
if __name__ == '__main__':
|
||||||
|
|||||||
@@ -6,11 +6,11 @@ import wx
|
|||||||
|
|
||||||
class dirdlg_Tests(wtc.WidgetTestCase):
|
class dirdlg_Tests(wtc.WidgetTestCase):
|
||||||
|
|
||||||
|
|
||||||
def test_dirdlg(self):
|
def test_dirdlg(self):
|
||||||
dlg = wx.DirDialog(self.frame, 'message')
|
dlg = wx.DirDialog(self.frame, 'message')
|
||||||
dlg.Destroy()
|
dlg.Destroy()
|
||||||
|
|
||||||
#---------------------------------------------------------------------------
|
#---------------------------------------------------------------------------
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -6,7 +6,7 @@ import wx
|
|||||||
#---------------------------------------------------------------------------
|
#---------------------------------------------------------------------------
|
||||||
|
|
||||||
class display_Tests(wtc.WidgetTestCase):
|
class display_Tests(wtc.WidgetTestCase):
|
||||||
|
|
||||||
def test_display(self):
|
def test_display(self):
|
||||||
d = wx.Display()
|
d = wx.Display()
|
||||||
r = d.GetClientArea()
|
r = d.GetClientArea()
|
||||||
@@ -18,7 +18,7 @@ class display_Tests(wtc.WidgetTestCase):
|
|||||||
vm = m[0]
|
vm = m[0]
|
||||||
self.assertTrue(isinstance(vm, wx.VideoMode))
|
self.assertTrue(isinstance(vm, wx.VideoMode))
|
||||||
self.assertTrue(vm.IsOk())
|
self.assertTrue(vm.IsOk())
|
||||||
|
|
||||||
#---------------------------------------------------------------------------
|
#---------------------------------------------------------------------------
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -21,27 +21,27 @@ class dnd_Tests(wtc.WidgetTestCase):
|
|||||||
wx.DragMove
|
wx.DragMove
|
||||||
wx.DragLink
|
wx.DragLink
|
||||||
wx.DragCancel
|
wx.DragCancel
|
||||||
|
|
||||||
|
|
||||||
def test_dndDropTarget(self):
|
def test_dndDropTarget(self):
|
||||||
class MyTarget(wx.DropTarget):
|
class MyTarget(wx.DropTarget):
|
||||||
def OnData(self, x, y, defResult):
|
def OnData(self, x, y, defResult):
|
||||||
self.GetData()
|
self.GetData()
|
||||||
return defResult
|
return defResult
|
||||||
|
|
||||||
dt = MyTarget()
|
dt = MyTarget()
|
||||||
dt.DefaultAction
|
dt.DefaultAction
|
||||||
self.frame.SetDropTarget(dt)
|
self.frame.SetDropTarget(dt)
|
||||||
|
|
||||||
|
|
||||||
def test_dndDropSource(self):
|
def test_dndDropSource(self):
|
||||||
ds = wx.DropSource(self.frame)
|
ds = wx.DropSource(self.frame)
|
||||||
if 'wxGTK' in wx.PlatformInfo:
|
if 'wxGTK' in wx.PlatformInfo:
|
||||||
ds.SetIcon(wx.DragCopy, wx.Icon(icoFile))
|
ds.SetIcon(wx.DragCopy, wx.Icon(icoFile))
|
||||||
else:
|
else:
|
||||||
ds.SetCursor(wx.DragCopy, wx.Cursor(curFile, wx.BITMAP_TYPE_CUR))
|
ds.SetCursor(wx.DragCopy, wx.Cursor(curFile, wx.BITMAP_TYPE_CUR))
|
||||||
|
|
||||||
|
|
||||||
#---------------------------------------------------------------------------
|
#---------------------------------------------------------------------------
|
||||||
|
|
||||||
if __name__ == '__main__':
|
if __name__ == '__main__':
|
||||||
|
|||||||
@@ -15,13 +15,13 @@ class dragimag_Tests(wtc.WidgetTestCase):
|
|||||||
|
|
||||||
def test_dragimag2(self):
|
def test_dragimag2(self):
|
||||||
di = wx.DragImage(wx.Bitmap(pngFile))
|
di = wx.DragImage(wx.Bitmap(pngFile))
|
||||||
|
|
||||||
def test_dragimag3(self):
|
def test_dragimag3(self):
|
||||||
di = wx.DragImage(wx.Icon(icoFile))
|
di = wx.DragImage(wx.Icon(icoFile))
|
||||||
|
|
||||||
def test_dragimag4(self):
|
def test_dragimag4(self):
|
||||||
di = wx.DragImage("Some draggable text")
|
di = wx.DragImage("Some draggable text")
|
||||||
|
|
||||||
def test_dragimag5(self):
|
def test_dragimag5(self):
|
||||||
ctrl = wx.TreeCtrl(self.frame)
|
ctrl = wx.TreeCtrl(self.frame)
|
||||||
root = ctrl.AddRoot('root item')
|
root = ctrl.AddRoot('root item')
|
||||||
@@ -39,13 +39,13 @@ class dragimag_Tests(wtc.WidgetTestCase):
|
|||||||
|
|
||||||
def test_genericdragimag2(self):
|
def test_genericdragimag2(self):
|
||||||
di = wx.GenericDragImage(wx.Bitmap(pngFile))
|
di = wx.GenericDragImage(wx.Bitmap(pngFile))
|
||||||
|
|
||||||
def test_genericdragimag3(self):
|
def test_genericdragimag3(self):
|
||||||
di = wx.GenericDragImage(wx.Icon(icoFile))
|
di = wx.GenericDragImage(wx.Icon(icoFile))
|
||||||
|
|
||||||
def test_genericdragimag4(self):
|
def test_genericdragimag4(self):
|
||||||
di = wx.GenericDragImage("Some draggable text")
|
di = wx.GenericDragImage("Some draggable text")
|
||||||
|
|
||||||
def test_genericdragimag5(self):
|
def test_genericdragimag5(self):
|
||||||
ctrl = wx.TreeCtrl(self.frame)
|
ctrl = wx.TreeCtrl(self.frame)
|
||||||
root = ctrl.AddRoot('root item')
|
root = ctrl.AddRoot('root item')
|
||||||
@@ -56,7 +56,7 @@ class dragimag_Tests(wtc.WidgetTestCase):
|
|||||||
ctrl.AppendColumn('hello')
|
ctrl.AppendColumn('hello')
|
||||||
idx = ctrl.InsertItem(0, "a list item")
|
idx = ctrl.InsertItem(0, "a list item")
|
||||||
di = wx.GenericDragImage(ctrl, idx)
|
di = wx.GenericDragImage(ctrl, idx)
|
||||||
|
|
||||||
#---------------------------------------------------------------------------
|
#---------------------------------------------------------------------------
|
||||||
|
|
||||||
if __name__ == '__main__':
|
if __name__ == '__main__':
|
||||||
|
|||||||
@@ -8,10 +8,10 @@ import wx.adv
|
|||||||
class editlbox_Tests(wtc.WidgetTestCase):
|
class editlbox_Tests(wtc.WidgetTestCase):
|
||||||
|
|
||||||
def test_editlbox1(self):
|
def test_editlbox1(self):
|
||||||
wx.adv.EL_ALLOW_NEW
|
wx.adv.EL_ALLOW_NEW
|
||||||
wx.adv.EL_ALLOW_EDIT
|
wx.adv.EL_ALLOW_EDIT
|
||||||
wx.adv.EL_ALLOW_DELETE
|
wx.adv.EL_ALLOW_DELETE
|
||||||
wx.adv.EL_NO_REORDER
|
wx.adv.EL_NO_REORDER
|
||||||
wx.adv.EL_DEFAULT_STYLE
|
wx.adv.EL_DEFAULT_STYLE
|
||||||
|
|
||||||
def test_editlbox2(self):
|
def test_editlbox2(self):
|
||||||
@@ -20,7 +20,7 @@ class editlbox_Tests(wtc.WidgetTestCase):
|
|||||||
elb.SetStrings(strings)
|
elb.SetStrings(strings)
|
||||||
self.assertEqual(strings, elb.GetStrings())
|
self.assertEqual(strings, elb.GetStrings())
|
||||||
self.assertEqual(strings, elb.Strings)
|
self.assertEqual(strings, elb.Strings)
|
||||||
|
|
||||||
def test_editlbox3(self):
|
def test_editlbox3(self):
|
||||||
elb = wx.adv.EditableListBox()
|
elb = wx.adv.EditableListBox()
|
||||||
elb.Create(self.frame, label="EditableListBox")
|
elb.Create(self.frame, label="EditableListBox")
|
||||||
@@ -28,8 +28,8 @@ class editlbox_Tests(wtc.WidgetTestCase):
|
|||||||
elb.SetStrings(strings)
|
elb.SetStrings(strings)
|
||||||
self.assertEqual(strings, elb.GetStrings())
|
self.assertEqual(strings, elb.GetStrings())
|
||||||
self.assertEqual(strings, elb.Strings)
|
self.assertEqual(strings, elb.Strings)
|
||||||
|
|
||||||
|
|
||||||
#---------------------------------------------------------------------------
|
#---------------------------------------------------------------------------
|
||||||
|
|
||||||
if __name__ == '__main__':
|
if __name__ == '__main__':
|
||||||
|
|||||||
@@ -5,15 +5,15 @@ import wx
|
|||||||
#---------------------------------------------------------------------------
|
#---------------------------------------------------------------------------
|
||||||
|
|
||||||
class Events(unittest.TestCase):
|
class Events(unittest.TestCase):
|
||||||
|
|
||||||
# Test the constructors to make sure the classes are not abstract, except
|
# Test the constructors to make sure the classes are not abstract, except
|
||||||
# for wx.Event
|
# for wx.Event
|
||||||
|
|
||||||
def test_Event_ctor(self):
|
def test_Event_ctor(self):
|
||||||
with self.assertRaises(TypeError):
|
with self.assertRaises(TypeError):
|
||||||
# it's an abstract class, so it can't be instantiated
|
# it's an abstract class, so it can't be instantiated
|
||||||
evt = wx.Event()
|
evt = wx.Event()
|
||||||
|
|
||||||
def test_CommandEvent_ctor(self):
|
def test_CommandEvent_ctor(self):
|
||||||
evt = wx.CommandEvent()
|
evt = wx.CommandEvent()
|
||||||
|
|
||||||
@@ -127,8 +127,8 @@ class Events(unittest.TestCase):
|
|||||||
|
|
||||||
def test_WindowDestroyEvent_ctor(self):
|
def test_WindowDestroyEvent_ctor(self):
|
||||||
evt = wx.WindowDestroyEvent()
|
evt = wx.WindowDestroyEvent()
|
||||||
|
|
||||||
|
|
||||||
def test_eventBinding(self):
|
def test_eventBinding(self):
|
||||||
class Frame(wx.Frame):
|
class Frame(wx.Frame):
|
||||||
def __init__(self, *args, **kw):
|
def __init__(self, *args, **kw):
|
||||||
@@ -144,8 +144,8 @@ class Events(unittest.TestCase):
|
|||||||
frm.SetSize((200,100))
|
frm.SetSize((200,100))
|
||||||
#app.MainLoop()
|
#app.MainLoop()
|
||||||
self.assertTrue(frm.gotEvent)
|
self.assertTrue(frm.gotEvent)
|
||||||
|
|
||||||
|
|
||||||
def test_DropFilesEvent_tweaks(self):
|
def test_DropFilesEvent_tweaks(self):
|
||||||
evt = wx.DropFilesEvent(123, 'one two three four five'.split())
|
evt = wx.DropFilesEvent(123, 'one two three four five'.split())
|
||||||
self.assertTrue(evt.NumberOfFiles == 5)
|
self.assertTrue(evt.NumberOfFiles == 5)
|
||||||
@@ -161,8 +161,8 @@ class Events(unittest.TestCase):
|
|||||||
wx.EVT_CATEGORY_TIMER
|
wx.EVT_CATEGORY_TIMER
|
||||||
wx.EVT_CATEGORY_THREAD
|
wx.EVT_CATEGORY_THREAD
|
||||||
wx.EVT_CATEGORY_ALL
|
wx.EVT_CATEGORY_ALL
|
||||||
|
|
||||||
|
|
||||||
def test_evtHandlerSubclass(self):
|
def test_evtHandlerSubclass(self):
|
||||||
class MyEvtHandler(wx.EvtHandler):
|
class MyEvtHandler(wx.EvtHandler):
|
||||||
def __init__(self, **kwds):
|
def __init__(self, **kwds):
|
||||||
@@ -170,8 +170,8 @@ class Events(unittest.TestCase):
|
|||||||
|
|
||||||
eh = MyEvtHandler()
|
eh = MyEvtHandler()
|
||||||
eh.Destroy()
|
eh.Destroy()
|
||||||
|
|
||||||
|
|
||||||
#---------------------------------------------------------------------------
|
#---------------------------------------------------------------------------
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -14,17 +14,17 @@ class fdrepdlg_Tests(wtc.WidgetTestCase):
|
|||||||
wx.FR_NOUPDOWN
|
wx.FR_NOUPDOWN
|
||||||
wx.FR_NOMATCHCASE
|
wx.FR_NOMATCHCASE
|
||||||
wx.FR_NOWHOLEWORD
|
wx.FR_NOWHOLEWORD
|
||||||
|
|
||||||
def test_fdrepdlgDlg(self):
|
def test_fdrepdlgDlg(self):
|
||||||
data = wx.FindReplaceData()
|
data = wx.FindReplaceData()
|
||||||
data.SetFindString('find string')
|
data.SetFindString('find string')
|
||||||
data.SetReplaceString('replace')
|
data.SetReplaceString('replace')
|
||||||
self.assertEqual(data.FindString, 'find string')
|
self.assertEqual(data.FindString, 'find string')
|
||||||
|
|
||||||
dlg = wx.FindReplaceDialog(self.frame, data, 'Find Stuff')
|
dlg = wx.FindReplaceDialog(self.frame, data, 'Find Stuff')
|
||||||
dlg.GetData()
|
dlg.GetData()
|
||||||
dlg.Destroy()
|
dlg.Destroy()
|
||||||
|
|
||||||
#---------------------------------------------------------------------------
|
#---------------------------------------------------------------------------
|
||||||
|
|
||||||
if __name__ == '__main__':
|
if __name__ == '__main__':
|
||||||
|
|||||||
@@ -9,16 +9,16 @@ class filectrl_Tests(wtc.WidgetTestCase):
|
|||||||
|
|
||||||
def test_filectrl1(self):
|
def test_filectrl1(self):
|
||||||
fc = wx.FileCtrl(self.frame)
|
fc = wx.FileCtrl(self.frame)
|
||||||
|
|
||||||
def test_filectrl2(self):
|
def test_filectrl2(self):
|
||||||
fc = wx.FileCtrl()
|
fc = wx.FileCtrl()
|
||||||
fc.Create(self.frame)
|
fc.Create(self.frame)
|
||||||
|
|
||||||
def test_filectrl3(self):
|
def test_filectrl3(self):
|
||||||
wx.FC_OPEN
|
wx.FC_OPEN
|
||||||
wx.FC_SAVE
|
wx.FC_SAVE
|
||||||
wx.FC_MULTIPLE
|
wx.FC_MULTIPLE
|
||||||
wx.FC_NOSHOWHIDDEN
|
wx.FC_NOSHOWHIDDEN
|
||||||
wx.FC_DEFAULT_STYLE
|
wx.FC_DEFAULT_STYLE
|
||||||
|
|
||||||
wx.wxEVT_FILECTRL_SELECTIONCHANGED
|
wx.wxEVT_FILECTRL_SELECTIONCHANGED
|
||||||
@@ -30,15 +30,15 @@ class filectrl_Tests(wtc.WidgetTestCase):
|
|||||||
wx.EVT_FILECTRL_FOLDERCHANGED
|
wx.EVT_FILECTRL_FOLDERCHANGED
|
||||||
wx.EVT_FILECTRL_FILTERCHANGED
|
wx.EVT_FILECTRL_FILTERCHANGED
|
||||||
wx.FileCtrlEvent
|
wx.FileCtrlEvent
|
||||||
|
|
||||||
|
|
||||||
def test_filectrl4(self):
|
def test_filectrl4(self):
|
||||||
fc = wx.FileCtrl(self.frame,
|
fc = wx.FileCtrl(self.frame,
|
||||||
defaultDirectory=os.path.dirname(__file__),
|
defaultDirectory=os.path.dirname(__file__),
|
||||||
defaultFilename=os.path.basename(__file__),
|
defaultFilename=os.path.basename(__file__),
|
||||||
style=wx.FC_OPEN)
|
style=wx.FC_OPEN)
|
||||||
self.waitFor(50)
|
self.waitFor(50)
|
||||||
|
|
||||||
self.assertEqual(fc.GetFilename(), os.path.basename(__file__))
|
self.assertEqual(fc.GetFilename(), os.path.basename(__file__))
|
||||||
self.assertEqual(fc.GetPath(), os.path.abspath(__file__))
|
self.assertEqual(fc.GetPath(), os.path.abspath(__file__))
|
||||||
self.assertEqual(fc.Filename, os.path.basename(__file__))
|
self.assertEqual(fc.Filename, os.path.basename(__file__))
|
||||||
@@ -51,13 +51,13 @@ class filectrl_Tests(wtc.WidgetTestCase):
|
|||||||
defaultFilename=os.path.basename(__file__),
|
defaultFilename=os.path.basename(__file__),
|
||||||
style=wx.FC_OPEN|wx.FC_MULTIPLE)
|
style=wx.FC_OPEN|wx.FC_MULTIPLE)
|
||||||
self.waitFor(50)
|
self.waitFor(50)
|
||||||
|
|
||||||
self.assertEqual(fc.GetFilenames(), [os.path.basename(__file__)])
|
self.assertEqual(fc.GetFilenames(), [os.path.basename(__file__)])
|
||||||
self.assertEqual(fc.GetPaths(), [os.path.abspath(__file__)])
|
self.assertEqual(fc.GetPaths(), [os.path.abspath(__file__)])
|
||||||
self.assertEqual(fc.Filenames, [os.path.basename(__file__)])
|
self.assertEqual(fc.Filenames, [os.path.basename(__file__)])
|
||||||
self.assertEqual(fc.Paths, [os.path.abspath(__file__)])
|
self.assertEqual(fc.Paths, [os.path.abspath(__file__)])
|
||||||
|
|
||||||
|
|
||||||
#---------------------------------------------------------------------------
|
#---------------------------------------------------------------------------
|
||||||
|
|
||||||
if __name__ == '__main__':
|
if __name__ == '__main__':
|
||||||
|
|||||||
@@ -15,13 +15,13 @@ class filedlg_Tests(wtc.WidgetTestCase):
|
|||||||
wx.FD_MULTIPLE
|
wx.FD_MULTIPLE
|
||||||
wx.FD_CHANGE_DIR
|
wx.FD_CHANGE_DIR
|
||||||
wx.FD_PREVIEW
|
wx.FD_PREVIEW
|
||||||
|
|
||||||
def test_filedlg(self):
|
def test_filedlg(self):
|
||||||
# a typical use case
|
# a typical use case
|
||||||
dlg = wx.FileDialog(self.frame, 'message', os.getcwd(), "",
|
dlg = wx.FileDialog(self.frame, 'message', os.getcwd(), "",
|
||||||
wildcard="Python source (*.py)|*.py")
|
wildcard="Python source (*.py)|*.py")
|
||||||
dlg.Destroy()
|
dlg.Destroy()
|
||||||
|
|
||||||
def test_filedlgProperties(self):
|
def test_filedlgProperties(self):
|
||||||
dlg = wx.FileDialog(None)
|
dlg = wx.FileDialog(None)
|
||||||
dlg.Directory
|
dlg.Directory
|
||||||
@@ -34,7 +34,7 @@ class filedlg_Tests(wtc.WidgetTestCase):
|
|||||||
dlg.Filenames
|
dlg.Filenames
|
||||||
dlg.Paths
|
dlg.Paths
|
||||||
dlg.Destroy()
|
dlg.Destroy()
|
||||||
|
|
||||||
def test_filedlgTweaks(self):
|
def test_filedlgTweaks(self):
|
||||||
dlg = wx.FileDialog(None, style=wx.FD_MULTIPLE)
|
dlg = wx.FileDialog(None, style=wx.FD_MULTIPLE)
|
||||||
f = dlg.GetFilenames()
|
f = dlg.GetFilenames()
|
||||||
@@ -42,7 +42,7 @@ class filedlg_Tests(wtc.WidgetTestCase):
|
|||||||
self.assertTrue(isinstance(f, list))
|
self.assertTrue(isinstance(f, list))
|
||||||
self.assertTrue(isinstance(p, list))
|
self.assertTrue(isinstance(p, list))
|
||||||
dlg.Destroy()
|
dlg.Destroy()
|
||||||
|
|
||||||
#---------------------------------------------------------------------------
|
#---------------------------------------------------------------------------
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -10,25 +10,25 @@ class filehistory_Tests(wtc.WidgetTestCase):
|
|||||||
fh = wx.FileHistory()
|
fh = wx.FileHistory()
|
||||||
for fn in "one two three four".split():
|
for fn in "one two three four".split():
|
||||||
fh.AddFileToHistory(fn)
|
fh.AddFileToHistory(fn)
|
||||||
|
|
||||||
self.assertEqual(fh.GetCount(), 4)
|
self.assertEqual(fh.GetCount(), 4)
|
||||||
self.assertEqual(fh.Count, 4)
|
self.assertEqual(fh.Count, 4)
|
||||||
self.assertEqual(fh.GetHistoryFile(1), 'three') # they are in LIFO order
|
self.assertEqual(fh.GetHistoryFile(1), 'three') # they are in LIFO order
|
||||||
m = wx.Menu()
|
m = wx.Menu()
|
||||||
fh.AddFilesToMenu(m)
|
fh.AddFilesToMenu(m)
|
||||||
|
|
||||||
|
|
||||||
def test_filehistory2(self):
|
def test_filehistory2(self):
|
||||||
fh = wx.FileHistory()
|
fh = wx.FileHistory()
|
||||||
for fn in "one two three four".split():
|
for fn in "one two three four".split():
|
||||||
fh.AddFileToHistory(fn)
|
fh.AddFileToHistory(fn)
|
||||||
|
|
||||||
menu1 = wx.Menu()
|
menu1 = wx.Menu()
|
||||||
menu2 = wx.Menu()
|
menu2 = wx.Menu()
|
||||||
fh.UseMenu(menu1)
|
fh.UseMenu(menu1)
|
||||||
fh.UseMenu(menu2)
|
fh.UseMenu(menu2)
|
||||||
fh.AddFilesToMenu()
|
fh.AddFilesToMenu()
|
||||||
|
|
||||||
lst = fh.GetMenus()
|
lst = fh.GetMenus()
|
||||||
self.assertTrue(isinstance(lst, wx.FileHistoryMenuList))
|
self.assertTrue(isinstance(lst, wx.FileHistoryMenuList))
|
||||||
self.assertTrue(len(lst) == 2)
|
self.assertTrue(len(lst) == 2)
|
||||||
@@ -37,7 +37,7 @@ class filehistory_Tests(wtc.WidgetTestCase):
|
|||||||
self.assertTrue(isinstance(lst[1], wx.Menu))
|
self.assertTrue(isinstance(lst[1], wx.Menu))
|
||||||
self.assertTrue(lst[0] is menu1)
|
self.assertTrue(lst[0] is menu1)
|
||||||
self.assertTrue(lst[1] is menu2)
|
self.assertTrue(lst[1] is menu2)
|
||||||
|
|
||||||
#---------------------------------------------------------------------------
|
#---------------------------------------------------------------------------
|
||||||
|
|
||||||
if __name__ == '__main__':
|
if __name__ == '__main__':
|
||||||
|
|||||||
@@ -9,7 +9,7 @@ import os
|
|||||||
class filesys_Tests(wtc.WidgetTestCase):
|
class filesys_Tests(wtc.WidgetTestCase):
|
||||||
|
|
||||||
def test_filesysClasses(self):
|
def test_filesysClasses(self):
|
||||||
# For now just test that the expected classes exist.
|
# For now just test that the expected classes exist.
|
||||||
wx.FileSystem
|
wx.FileSystem
|
||||||
wx.FSFile
|
wx.FSFile
|
||||||
wx.FileSystemHandler
|
wx.FileSystemHandler
|
||||||
@@ -21,16 +21,16 @@ class filesys_Tests(wtc.WidgetTestCase):
|
|||||||
|
|
||||||
def test_filesys02(self):
|
def test_filesys02(self):
|
||||||
wx.FileSystem.AddHandler(wx.ArchiveFSHandler())
|
wx.FileSystem.AddHandler(wx.ArchiveFSHandler())
|
||||||
|
|
||||||
def test_filesys03(self):
|
def test_filesys03(self):
|
||||||
wx.FileSystem.AddHandler(wx.InternetFSHandler())
|
wx.FileSystem.AddHandler(wx.InternetFSHandler())
|
||||||
|
|
||||||
def test_filesys04(self):
|
def test_filesys04(self):
|
||||||
wx.FileSystem.AddHandler(wx.MemoryFSHandler())
|
wx.FileSystem.AddHandler(wx.MemoryFSHandler())
|
||||||
|
|
||||||
|
|
||||||
# TODO: Add more tests.
|
# TODO: Add more tests.
|
||||||
|
|
||||||
#---------------------------------------------------------------------------
|
#---------------------------------------------------------------------------
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -8,23 +8,23 @@ import os
|
|||||||
class font_Tests(wtc.WidgetTestCase):
|
class font_Tests(wtc.WidgetTestCase):
|
||||||
|
|
||||||
def test_fontFlags(self):
|
def test_fontFlags(self):
|
||||||
wx.FONTFAMILY_DEFAULT
|
wx.FONTFAMILY_DEFAULT
|
||||||
wx.FONTFAMILY_DECORATIVE
|
wx.FONTFAMILY_DECORATIVE
|
||||||
wx.FONTFAMILY_ROMAN
|
wx.FONTFAMILY_ROMAN
|
||||||
wx.FONTFAMILY_SCRIPT
|
wx.FONTFAMILY_SCRIPT
|
||||||
wx.FONTFAMILY_SWISS
|
wx.FONTFAMILY_SWISS
|
||||||
wx.FONTFAMILY_MODERN
|
wx.FONTFAMILY_MODERN
|
||||||
wx.FONTFAMILY_TELETYPE
|
wx.FONTFAMILY_TELETYPE
|
||||||
wx.FONTFAMILY_UNKNOWN
|
wx.FONTFAMILY_UNKNOWN
|
||||||
|
|
||||||
wx.FONTSTYLE_NORMAL
|
wx.FONTSTYLE_NORMAL
|
||||||
wx.FONTSTYLE_ITALIC
|
wx.FONTSTYLE_ITALIC
|
||||||
wx.FONTSTYLE_SLANT
|
wx.FONTSTYLE_SLANT
|
||||||
|
|
||||||
wx.FONTWEIGHT_NORMAL
|
wx.FONTWEIGHT_NORMAL
|
||||||
wx.FONTWEIGHT_LIGHT
|
wx.FONTWEIGHT_LIGHT
|
||||||
wx.FONTWEIGHT_BOLD
|
wx.FONTWEIGHT_BOLD
|
||||||
|
|
||||||
wx.FONTSIZE_XX_SMALL
|
wx.FONTSIZE_XX_SMALL
|
||||||
wx.FONTSIZE_X_SMALL
|
wx.FONTSIZE_X_SMALL
|
||||||
wx.FONTSIZE_SMALL
|
wx.FONTSIZE_SMALL
|
||||||
@@ -32,17 +32,17 @@ class font_Tests(wtc.WidgetTestCase):
|
|||||||
wx.FONTSIZE_LARGE
|
wx.FONTSIZE_LARGE
|
||||||
wx.FONTSIZE_X_LARGE
|
wx.FONTSIZE_X_LARGE
|
||||||
wx.FONTSIZE_XX_LARGE
|
wx.FONTSIZE_XX_LARGE
|
||||||
|
|
||||||
wx.FONTFLAG_DEFAULT
|
wx.FONTFLAG_DEFAULT
|
||||||
wx.FONTFLAG_ITALIC
|
wx.FONTFLAG_ITALIC
|
||||||
wx.FONTFLAG_SLANT
|
wx.FONTFLAG_SLANT
|
||||||
wx.FONTFLAG_LIGHT
|
wx.FONTFLAG_LIGHT
|
||||||
wx.FONTFLAG_BOLD
|
wx.FONTFLAG_BOLD
|
||||||
wx.FONTFLAG_ANTIALIASED
|
wx.FONTFLAG_ANTIALIASED
|
||||||
wx.FONTFLAG_NOT_ANTIALIASED
|
wx.FONTFLAG_NOT_ANTIALIASED
|
||||||
wx.FONTFLAG_UNDERLINED
|
wx.FONTFLAG_UNDERLINED
|
||||||
wx.FONTFLAG_STRIKETHROUGH
|
wx.FONTFLAG_STRIKETHROUGH
|
||||||
|
|
||||||
wx.FONTENCODING_SYSTEM
|
wx.FONTENCODING_SYSTEM
|
||||||
wx.FONTENCODING_DEFAULT
|
wx.FONTENCODING_DEFAULT
|
||||||
wx.FONTENCODING_ISO8859_1
|
wx.FONTENCODING_ISO8859_1
|
||||||
@@ -142,22 +142,22 @@ class font_Tests(wtc.WidgetTestCase):
|
|||||||
wx.FONTENCODING_BIG5
|
wx.FONTENCODING_BIG5
|
||||||
wx.FONTENCODING_SHIFT_JIS
|
wx.FONTENCODING_SHIFT_JIS
|
||||||
wx.FONTENCODING_EUC_KR
|
wx.FONTENCODING_EUC_KR
|
||||||
|
|
||||||
|
|
||||||
def test_fontFlagsOld(self):
|
def test_fontFlagsOld(self):
|
||||||
wx.DEFAULT
|
wx.DEFAULT
|
||||||
wx.DECORATIVE
|
wx.DECORATIVE
|
||||||
wx.ROMAN
|
wx.ROMAN
|
||||||
wx.SCRIPT
|
wx.SCRIPT
|
||||||
wx.SWISS
|
wx.SWISS
|
||||||
wx.MODERN
|
wx.MODERN
|
||||||
wx.TELETYPE
|
wx.TELETYPE
|
||||||
wx.NORMAL
|
wx.NORMAL
|
||||||
wx.LIGHT
|
wx.LIGHT
|
||||||
wx.BOLD
|
wx.BOLD
|
||||||
wx.NORMAL
|
wx.NORMAL
|
||||||
wx.ITALIC
|
wx.ITALIC
|
||||||
wx.SLANT
|
wx.SLANT
|
||||||
|
|
||||||
|
|
||||||
def test_font(self):
|
def test_font(self):
|
||||||
@@ -170,17 +170,17 @@ class font_Tests(wtc.WidgetTestCase):
|
|||||||
# this ctor was removed
|
# this ctor was removed
|
||||||
#f7 = wx.Font(18, wx.FONTFAMILY_SWISS, wx.FONTFLAG_BOLD|wx.FONTFLAG_ITALIC)
|
#f7 = wx.Font(18, wx.FONTFAMILY_SWISS, wx.FONTFLAG_BOLD|wx.FONTFLAG_ITALIC)
|
||||||
|
|
||||||
|
|
||||||
def test_fontFontinfo1(self):
|
def test_fontFontinfo1(self):
|
||||||
fi1 = wx.FontInfo().Family(wx.FONTFAMILY_ROMAN).Bold().Italic().Underlined().Strikethrough()
|
fi1 = wx.FontInfo().Family(wx.FONTFAMILY_ROMAN).Bold().Italic().Underlined().Strikethrough()
|
||||||
fi2 = wx.FontInfo(12).FaceName('Ariel').Light().Encoding(wx.FONTENCODING_ISO8859_1)
|
fi2 = wx.FontInfo(12).FaceName('Ariel').Light().Encoding(wx.FONTENCODING_ISO8859_1)
|
||||||
fi3 = wx.FontInfo((8,12)).AllFlags(wx.FONTFLAG_BOLD|wx.FONTFLAG_ITALIC)
|
fi3 = wx.FontInfo((8,12)).AllFlags(wx.FONTFLAG_BOLD|wx.FONTFLAG_ITALIC)
|
||||||
|
|
||||||
|
|
||||||
def test_fontFontinfo2(self):
|
def test_fontFontinfo2(self):
|
||||||
f1 = wx.Font(wx.FontInfo(12).Family(wx.FONTFAMILY_SWISS).Italic())
|
f1 = wx.Font(wx.FontInfo(12).Family(wx.FONTFAMILY_SWISS).Italic())
|
||||||
|
|
||||||
|
|
||||||
def test_fontOk(self):
|
def test_fontOk(self):
|
||||||
f1 = wx.Font()
|
f1 = wx.Font()
|
||||||
f2 = wx.FFont(18, wx.FONTFAMILY_ROMAN)
|
f2 = wx.FFont(18, wx.FONTFAMILY_ROMAN)
|
||||||
@@ -198,8 +198,8 @@ class font_Tests(wtc.WidgetTestCase):
|
|||||||
f3 = wx.Font(wx.Size(12,12), wx.FONTFAMILY_ROMAN, wx.FONTSTYLE_NORMAL, wx.FONTWEIGHT_NORMAL, False)
|
f3 = wx.Font(wx.Size(12,12), wx.FONTFAMILY_ROMAN, wx.FONTSTYLE_NORMAL, wx.FONTWEIGHT_NORMAL, False)
|
||||||
self.assertTrue(f1 == f2)
|
self.assertTrue(f1 == f2)
|
||||||
self.assertTrue(f1 != f3)
|
self.assertTrue(f1 != f3)
|
||||||
|
|
||||||
|
|
||||||
def test_fontProperties(self):
|
def test_fontProperties(self):
|
||||||
f = wx.FFont(18, wx.FONTFAMILY_SWISS)
|
f = wx.FFont(18, wx.FONTFAMILY_SWISS)
|
||||||
f.Encoding
|
f.Encoding
|
||||||
@@ -229,8 +229,8 @@ class font_Tests(wtc.WidgetTestCase):
|
|||||||
def test_fontOldStyleNames(self):
|
def test_fontOldStyleNames(self):
|
||||||
f = wx.Font(8, wx.SWISS, wx.NORMAL, wx.NORMAL)
|
f = wx.Font(8, wx.SWISS, wx.NORMAL, wx.NORMAL)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
#---------------------------------------------------------------------------
|
#---------------------------------------------------------------------------
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -13,18 +13,18 @@ class fontdlg_Tests(wtc.WidgetTestCase):
|
|||||||
data.SetInitialFont(wx.FFont(15, wx.FONTFAMILY_MODERN))
|
data.SetInitialFont(wx.FFont(15, wx.FONTFAMILY_MODERN))
|
||||||
self.assertTrue(data.InitialFont.Family == wx.FONTFAMILY_MODERN or
|
self.assertTrue(data.InitialFont.Family == wx.FONTFAMILY_MODERN or
|
||||||
data.InitialFont.Family == wx.FONTFAMILY_TELETYPE)
|
data.InitialFont.Family == wx.FONTFAMILY_TELETYPE)
|
||||||
|
|
||||||
data.SetInitialFont(wx.FFont(15, wx.FONTFAMILY_SWISS))
|
data.SetInitialFont(wx.FFont(15, wx.FONTFAMILY_SWISS))
|
||||||
self.assertEqual(data.InitialFont.Family, wx.FONTFAMILY_SWISS)
|
self.assertEqual(data.InitialFont.Family, wx.FONTFAMILY_SWISS)
|
||||||
|
|
||||||
dlg = wx.FontDialog(self.frame, data)
|
dlg = wx.FontDialog(self.frame, data)
|
||||||
# TODO: find a safe way to test ShowModal on native dialogs
|
# TODO: find a safe way to test ShowModal on native dialogs
|
||||||
dlg.Destroy()
|
dlg.Destroy()
|
||||||
|
|
||||||
|
|
||||||
def test_fontdlg2(self):
|
def test_fontdlg2(self):
|
||||||
wx.GetFontFromUser
|
wx.GetFontFromUser
|
||||||
|
|
||||||
#---------------------------------------------------------------------------
|
#---------------------------------------------------------------------------
|
||||||
|
|
||||||
if __name__ == '__main__':
|
if __name__ == '__main__':
|
||||||
|
|||||||
@@ -12,15 +12,15 @@ class fontenum_Tests(wtc.WidgetTestCase):
|
|||||||
enc = wx.FontEnumerator.GetEncodings()
|
enc = wx.FontEnumerator.GetEncodings()
|
||||||
self.assertTrue(isinstance(enc, list))
|
self.assertTrue(isinstance(enc, list))
|
||||||
self.assertTrue(len(enc) > 0)
|
self.assertTrue(len(enc) > 0)
|
||||||
|
|
||||||
def test_fontenum2(self):
|
def test_fontenum2(self):
|
||||||
faces = wx.FontEnumerator.GetFacenames()
|
faces = wx.FontEnumerator.GetFacenames()
|
||||||
self.assertTrue(isinstance(faces, list))
|
self.assertTrue(isinstance(faces, list))
|
||||||
self.assertTrue(len(faces) > 0)
|
self.assertTrue(len(faces) > 0)
|
||||||
|
|
||||||
fw_faces = wx.FontEnumerator.GetFacenames(fixedWidthOnly=True)
|
fw_faces = wx.FontEnumerator.GetFacenames(fixedWidthOnly=True)
|
||||||
self.assertTrue(len(fw_faces) < len(faces))
|
self.assertTrue(len(fw_faces) < len(faces))
|
||||||
|
|
||||||
|
|
||||||
def test_fontenum3(self):
|
def test_fontenum3(self):
|
||||||
class MyFontEnumerator(wx.FontEnumerator):
|
class MyFontEnumerator(wx.FontEnumerator):
|
||||||
@@ -28,14 +28,14 @@ class fontenum_Tests(wtc.WidgetTestCase):
|
|||||||
wx.FontEnumerator.__init__(self)
|
wx.FontEnumerator.__init__(self)
|
||||||
self.my_faces = list()
|
self.my_faces = list()
|
||||||
self.my_enc = list()
|
self.my_enc = list()
|
||||||
|
|
||||||
def OnFacename(self, name):
|
def OnFacename(self, name):
|
||||||
self.my_faces.append(name)
|
self.my_faces.append(name)
|
||||||
return len(self.my_faces) < 5 # quit when we've got 5
|
return len(self.my_faces) < 5 # quit when we've got 5
|
||||||
def OnFontEncoding(self, facename, encoding):
|
def OnFontEncoding(self, facename, encoding):
|
||||||
self.my_enc.append( (facename, encoding) )
|
self.my_enc.append( (facename, encoding) )
|
||||||
return len(self.my_enc) < 5 # quit when we've got 5
|
return len(self.my_enc) < 5 # quit when we've got 5
|
||||||
|
|
||||||
mfe = MyFontEnumerator()
|
mfe = MyFontEnumerator()
|
||||||
mfe.EnumerateFacenames()
|
mfe.EnumerateFacenames()
|
||||||
self.assertTrue(len(mfe.my_faces) > 0 and len(mfe.my_faces) <= 5)
|
self.assertTrue(len(mfe.my_faces) > 0 and len(mfe.my_faces) <= 5)
|
||||||
@@ -43,7 +43,7 @@ class fontenum_Tests(wtc.WidgetTestCase):
|
|||||||
if sys.platform != 'darwin':
|
if sys.platform != 'darwin':
|
||||||
mfe.EnumerateEncodings()
|
mfe.EnumerateEncodings()
|
||||||
self.assertTrue(len(mfe.my_enc) > 0 and len(mfe.my_enc) <= 5)
|
self.assertTrue(len(mfe.my_enc) > 0 and len(mfe.my_enc) <= 5)
|
||||||
|
|
||||||
#---------------------------------------------------------------------------
|
#---------------------------------------------------------------------------
|
||||||
|
|
||||||
if __name__ == '__main__':
|
if __name__ == '__main__':
|
||||||
|
|||||||
@@ -9,7 +9,7 @@ class fontmap_Tests(wtc.WidgetTestCase):
|
|||||||
def test_fontmap1(self):
|
def test_fontmap1(self):
|
||||||
fm = wx.FontMapper.Get()
|
fm = wx.FontMapper.Get()
|
||||||
self.assertTrue(fm is not None)
|
self.assertTrue(fm is not None)
|
||||||
|
|
||||||
def test_fontmap2(self):
|
def test_fontmap2(self):
|
||||||
names = wx.FontMapper.GetAllEncodingNames(wx.FONTENCODING_SYSTEM)
|
names = wx.FontMapper.GetAllEncodingNames(wx.FONTENCODING_SYSTEM)
|
||||||
names = wx.FontMapper.GetAllEncodingNames(wx.FONTENCODING_ISO8859_1)
|
names = wx.FontMapper.GetAllEncodingNames(wx.FONTENCODING_ISO8859_1)
|
||||||
@@ -18,8 +18,8 @@ class fontmap_Tests(wtc.WidgetTestCase):
|
|||||||
fm = wx.FontMapper.Get()
|
fm = wx.FontMapper.Get()
|
||||||
enc = fm.CharsetToEncoding('ISO-8859-1')
|
enc = fm.CharsetToEncoding('ISO-8859-1')
|
||||||
self.assertEqual(enc, wx.FONTENCODING_ISO8859_1)
|
self.assertEqual(enc, wx.FONTENCODING_ISO8859_1)
|
||||||
|
|
||||||
|
|
||||||
#---------------------------------------------------------------------------
|
#---------------------------------------------------------------------------
|
||||||
|
|
||||||
if __name__ == '__main__':
|
if __name__ == '__main__':
|
||||||
|
|||||||
@@ -11,12 +11,12 @@ class fontutil_Tests(wtc.WidgetTestCase):
|
|||||||
f1 = wx.FFont(12, wx.FONTFAMILY_SWISS)
|
f1 = wx.FFont(12, wx.FONTFAMILY_SWISS)
|
||||||
i1 = f1.GetNativeFontInfo()
|
i1 = f1.GetNativeFontInfo()
|
||||||
st = i1.ToString()
|
st = i1.ToString()
|
||||||
|
|
||||||
i2 = wx.NativeFontInfo()
|
i2 = wx.NativeFontInfo()
|
||||||
i2.FromString(st)
|
i2.FromString(st)
|
||||||
f2 = wx.Font(i2)
|
f2 = wx.Font(i2)
|
||||||
self.assertTrue(f1 == f2)
|
self.assertTrue(f1 == f2)
|
||||||
|
|
||||||
def test_fontutilProperties(self):
|
def test_fontutilProperties(self):
|
||||||
nfi = wx.NativeFontInfo()
|
nfi = wx.NativeFontInfo()
|
||||||
nfi.InitFromFont(wx.NORMAL_FONT)
|
nfi.InitFromFont(wx.NORMAL_FONT)
|
||||||
@@ -30,7 +30,7 @@ class fontutil_Tests(wtc.WidgetTestCase):
|
|||||||
nfi.Weight
|
nfi.Weight
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
#---------------------------------------------------------------------------
|
#---------------------------------------------------------------------------
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -8,8 +8,8 @@ import os
|
|||||||
class frame_Tests(wtc.WidgetTestCase):
|
class frame_Tests(wtc.WidgetTestCase):
|
||||||
|
|
||||||
def test_frameStyles(self):
|
def test_frameStyles(self):
|
||||||
wx.FRAME_NO_TASKBAR
|
wx.FRAME_NO_TASKBAR
|
||||||
wx.FRAME_TOOL_WINDOW
|
wx.FRAME_TOOL_WINDOW
|
||||||
wx.FRAME_FLOAT_ON_PARENT
|
wx.FRAME_FLOAT_ON_PARENT
|
||||||
wx.FRAME_SHAPED
|
wx.FRAME_SHAPED
|
||||||
|
|
||||||
|
|||||||
@@ -8,14 +8,14 @@ import os
|
|||||||
class fswatcher_Tests(wtc.WidgetTestCase):
|
class fswatcher_Tests(wtc.WidgetTestCase):
|
||||||
|
|
||||||
def test_fswatcher1(self):
|
def test_fswatcher1(self):
|
||||||
|
|
||||||
evtLoop = self.app.GetTraits().CreateEventLoop()
|
evtLoop = self.app.GetTraits().CreateEventLoop()
|
||||||
activator = wx.EventLoopActivator(evtLoop) # automatically restores the old one
|
activator = wx.EventLoopActivator(evtLoop) # automatically restores the old one
|
||||||
watcher = wx.FileSystemWatcher()
|
watcher = wx.FileSystemWatcher()
|
||||||
watcher.Add(os.getcwd())
|
watcher.Add(os.getcwd())
|
||||||
watcher.Bind(wx.EVT_FSWATCHER, lambda evt: None)
|
watcher.Bind(wx.EVT_FSWATCHER, lambda evt: None)
|
||||||
|
|
||||||
|
|
||||||
#---------------------------------------------------------------------------
|
#---------------------------------------------------------------------------
|
||||||
|
|
||||||
if __name__ == '__main__':
|
if __name__ == '__main__':
|
||||||
|
|||||||
@@ -10,17 +10,17 @@ class gauge_Tests(wtc.WidgetTestCase):
|
|||||||
def test_gauge(self):
|
def test_gauge(self):
|
||||||
g1 = wx.Gauge(self.frame)
|
g1 = wx.Gauge(self.frame)
|
||||||
g2 = wx.Gauge(self.frame, range=1000, style=wx.GA_VERTICAL)
|
g2 = wx.Gauge(self.frame, range=1000, style=wx.GA_VERTICAL)
|
||||||
|
|
||||||
def test_gaugeProperties(self):
|
def test_gaugeProperties(self):
|
||||||
g = wx.Gauge(self.frame)
|
g = wx.Gauge(self.frame)
|
||||||
|
|
||||||
g.BezelFace
|
g.BezelFace
|
||||||
g.Range
|
g.Range
|
||||||
g.ShadowWidth
|
g.ShadowWidth
|
||||||
g.Value
|
g.Value
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
#---------------------------------------------------------------------------
|
#---------------------------------------------------------------------------
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -23,14 +23,14 @@ class gbsizer_Tests(wtc.WidgetTestCase):
|
|||||||
self.assertTrue(p1.Row == 5 and p1.Col == 6)
|
self.assertTrue(p1.Row == 5 and p1.Col == 6)
|
||||||
self.assertTrue(p1 == wx.GBPosition(5,6))
|
self.assertTrue(p1 == wx.GBPosition(5,6))
|
||||||
self.assertTrue(p1 != wx.GBPosition(3,4))
|
self.assertTrue(p1 != wx.GBPosition(3,4))
|
||||||
|
|
||||||
def test_gbsizer_pos3(self):
|
def test_gbsizer_pos3(self):
|
||||||
p1 = wx.GBPosition(3,4)
|
p1 = wx.GBPosition(3,4)
|
||||||
self.assertTrue(p1 == (3,4))
|
self.assertTrue(p1 == (3,4))
|
||||||
self.assertTrue(p1.Get() == (3,4))
|
self.assertTrue(p1.Get() == (3,4))
|
||||||
p1.Set(5,6)
|
p1.Set(5,6)
|
||||||
self.assertTrue(p1 == (5,6))
|
self.assertTrue(p1 == (5,6))
|
||||||
|
|
||||||
def test_gbsizer_pos4(self):
|
def test_gbsizer_pos4(self):
|
||||||
p1 = wx.GBPosition(3,4)
|
p1 = wx.GBPosition(3,4)
|
||||||
r,c = p1
|
r,c = p1
|
||||||
@@ -38,8 +38,8 @@ class gbsizer_Tests(wtc.WidgetTestCase):
|
|||||||
p1[0] = 5
|
p1[0] = 5
|
||||||
p1[1] = 6
|
p1[1] = 6
|
||||||
self.assertTrue((p1.row, p1.col) == (5,6))
|
self.assertTrue((p1.row, p1.col) == (5,6))
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
def test_gbsizer_span1(self):
|
def test_gbsizer_span1(self):
|
||||||
@@ -59,14 +59,14 @@ class gbsizer_Tests(wtc.WidgetTestCase):
|
|||||||
self.assertTrue(s1.Rowspan == 5 and s1.Colspan == 6)
|
self.assertTrue(s1.Rowspan == 5 and s1.Colspan == 6)
|
||||||
self.assertTrue(s1 == wx.GBSpan(5,6))
|
self.assertTrue(s1 == wx.GBSpan(5,6))
|
||||||
self.assertTrue(s1 != wx.GBSpan(3,4))
|
self.assertTrue(s1 != wx.GBSpan(3,4))
|
||||||
|
|
||||||
def test_gbsizer_span3(self):
|
def test_gbsizer_span3(self):
|
||||||
s1 = wx.GBSpan(3,4)
|
s1 = wx.GBSpan(3,4)
|
||||||
self.assertTrue(s1 == (3,4))
|
self.assertTrue(s1 == (3,4))
|
||||||
self.assertTrue(s1.Get() == (3,4))
|
self.assertTrue(s1.Get() == (3,4))
|
||||||
s1.Set(5,6)
|
s1.Set(5,6)
|
||||||
self.assertTrue(s1 == (5,6))
|
self.assertTrue(s1 == (5,6))
|
||||||
|
|
||||||
def test_gbsizer_span4(self):
|
def test_gbsizer_span4(self):
|
||||||
s1 = wx.GBSpan(3,4)
|
s1 = wx.GBSpan(3,4)
|
||||||
r,c = s1
|
r,c = s1
|
||||||
@@ -74,7 +74,7 @@ class gbsizer_Tests(wtc.WidgetTestCase):
|
|||||||
s1[0] = 5
|
s1[0] = 5
|
||||||
s1[1] = 6
|
s1[1] = 6
|
||||||
self.assertTrue((s1.rowspan, s1.colspan) == (5,6))
|
self.assertTrue((s1.rowspan, s1.colspan) == (5,6))
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
def test_gbsizer_sizer1(self):
|
def test_gbsizer_sizer1(self):
|
||||||
@@ -105,7 +105,7 @@ class gbsizer_Tests(wtc.WidgetTestCase):
|
|||||||
self.assertTrue(items[1].IsSizer())
|
self.assertTrue(items[1].IsSizer())
|
||||||
self.assertTrue(items[2].IsSpacer())
|
self.assertTrue(items[2].IsSpacer())
|
||||||
self.assertTrue(items[0].Border == 5)
|
self.assertTrue(items[0].Border == 5)
|
||||||
|
|
||||||
#---------------------------------------------------------------------------
|
#---------------------------------------------------------------------------
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -5,28 +5,28 @@ import wx
|
|||||||
#---------------------------------------------------------------------------
|
#---------------------------------------------------------------------------
|
||||||
|
|
||||||
class Point(unittest.TestCase):
|
class Point(unittest.TestCase):
|
||||||
|
|
||||||
def test_default_ctor(self):
|
def test_default_ctor(self):
|
||||||
p = wx.Point()
|
p = wx.Point()
|
||||||
self.assertTrue(p == (0,0))
|
self.assertTrue(p == (0,0))
|
||||||
|
|
||||||
def test_xy_ctor(self):
|
def test_xy_ctor(self):
|
||||||
p = wx.Point(123,456)
|
p = wx.Point(123,456)
|
||||||
|
|
||||||
def test_RealPoint_ctor(self):
|
def test_RealPoint_ctor(self):
|
||||||
p = wx.Point(wx.RealPoint(1.2, 2.9))
|
p = wx.Point(wx.RealPoint(1.2, 2.9))
|
||||||
self.assertTrue(p == (1,2))
|
self.assertTrue(p == (1,2))
|
||||||
|
|
||||||
def test_copy_ctor(self):
|
def test_copy_ctor(self):
|
||||||
p1 = wx.Point(3,4)
|
p1 = wx.Point(3,4)
|
||||||
p2 = wx.Point(p1)
|
p2 = wx.Point(p1)
|
||||||
self.assertTrue(p1 is not p2)
|
self.assertTrue(p1 is not p2)
|
||||||
self.assertTrue(p1 == p2)
|
self.assertTrue(p1 == p2)
|
||||||
|
|
||||||
def test_bogus_ctor1(self):
|
def test_bogus_ctor1(self):
|
||||||
with self.assertRaises(TypeError):
|
with self.assertRaises(TypeError):
|
||||||
p = wx.Point('fiddle-fadle')
|
p = wx.Point('fiddle-fadle')
|
||||||
|
|
||||||
def test_bogus_ctor2(self):
|
def test_bogus_ctor2(self):
|
||||||
with self.assertRaises(TypeError):
|
with self.assertRaises(TypeError):
|
||||||
p = wx.Point(1,2,3)
|
p = wx.Point(1,2,3)
|
||||||
@@ -34,13 +34,13 @@ class Point(unittest.TestCase):
|
|||||||
def test_DefaultPosition(self):
|
def test_DefaultPosition(self):
|
||||||
wx.DefaultPosition
|
wx.DefaultPosition
|
||||||
self.assertTrue(wx.DefaultPosition == (-1,-1))
|
self.assertTrue(wx.DefaultPosition == (-1,-1))
|
||||||
|
|
||||||
def test_FullySpecified(self):
|
def test_FullySpecified(self):
|
||||||
p = wx.Point(1,2)
|
p = wx.Point(1,2)
|
||||||
self.assertTrue(p.IsFullySpecified())
|
self.assertTrue(p.IsFullySpecified())
|
||||||
p = wx.Point(-1,2)
|
p = wx.Point(-1,2)
|
||||||
self.assertTrue(not p.IsFullySpecified())
|
self.assertTrue(not p.IsFullySpecified())
|
||||||
|
|
||||||
def test_xy(self):
|
def test_xy(self):
|
||||||
p = wx.Point(2, 3)
|
p = wx.Point(2, 3)
|
||||||
self.assertTrue(p.x == 2 and p.y == 3)
|
self.assertTrue(p.x == 2 and p.y == 3)
|
||||||
@@ -48,12 +48,12 @@ class Point(unittest.TestCase):
|
|||||||
p.y += 2
|
p.y += 2
|
||||||
self.assertTrue(p.x == 3 and p.y == 5)
|
self.assertTrue(p.x == 3 and p.y == 5)
|
||||||
self.assertTrue(p == (3,5))
|
self.assertTrue(p == (3,5))
|
||||||
|
|
||||||
def test_Get(self):
|
def test_Get(self):
|
||||||
p = wx.Point(5,6)
|
p = wx.Point(5,6)
|
||||||
self.assertTrue(type(p.Get()) == tuple)
|
self.assertTrue(type(p.Get()) == tuple)
|
||||||
self.assertTrue(p.Get() == (5,6))
|
self.assertTrue(p.Get() == (5,6))
|
||||||
|
|
||||||
def test_operators(self):
|
def test_operators(self):
|
||||||
p1 = wx.Point(100, 500)
|
p1 = wx.Point(100, 500)
|
||||||
p2 = wx.Point(50, 100)
|
p2 = wx.Point(50, 100)
|
||||||
@@ -78,8 +78,8 @@ class Point(unittest.TestCase):
|
|||||||
self.assertFalse(p1 != p2)
|
self.assertFalse(p1 != p2)
|
||||||
self.assertFalse(p1 == p3)
|
self.assertFalse(p1 == p3)
|
||||||
self.assertTrue(p1 != p3)
|
self.assertTrue(p1 != p3)
|
||||||
|
|
||||||
|
|
||||||
def test_magic(self):
|
def test_magic(self):
|
||||||
p = wx.Point(5,6)
|
p = wx.Point(5,6)
|
||||||
self.assertTrue(str(p) == "(5, 6)")
|
self.assertTrue(str(p) == "(5, 6)")
|
||||||
@@ -92,7 +92,7 @@ class Point(unittest.TestCase):
|
|||||||
self.assertTrue(p == (6,8))
|
self.assertTrue(p == (6,8))
|
||||||
with self.assertRaises(IndexError):
|
with self.assertRaises(IndexError):
|
||||||
p[2]
|
p[2]
|
||||||
|
|
||||||
def test_math(self):
|
def test_math(self):
|
||||||
p = wx.Point(4,6)
|
p = wx.Point(4,6)
|
||||||
p1 = p + wx.Point(4,2)
|
p1 = p + wx.Point(4,2)
|
||||||
@@ -101,89 +101,89 @@ class Point(unittest.TestCase):
|
|||||||
p4 = p / 2
|
p4 = p / 2
|
||||||
p5 = p - wx.Point(4,2)
|
p5 = p - wx.Point(4,2)
|
||||||
p6 = -p
|
p6 = -p
|
||||||
|
|
||||||
self.assertTrue(isinstance(p1, wx.Point))
|
self.assertTrue(isinstance(p1, wx.Point))
|
||||||
self.assertTrue(isinstance(p2, wx.Point))
|
self.assertTrue(isinstance(p2, wx.Point))
|
||||||
self.assertTrue(isinstance(p3, wx.Point))
|
self.assertTrue(isinstance(p3, wx.Point))
|
||||||
self.assertTrue(isinstance(p4, wx.Point))
|
self.assertTrue(isinstance(p4, wx.Point))
|
||||||
self.assertTrue(isinstance(p5, wx.Point))
|
self.assertTrue(isinstance(p5, wx.Point))
|
||||||
self.assertTrue(isinstance(p6, wx.Point))
|
self.assertTrue(isinstance(p6, wx.Point))
|
||||||
|
|
||||||
self.assertEqual(p1, (8,8))
|
self.assertEqual(p1, (8,8))
|
||||||
self.assertEqual(p2, (8,8))
|
self.assertEqual(p2, (8,8))
|
||||||
self.assertEqual(p3, (8,12))
|
self.assertEqual(p3, (8,12))
|
||||||
self.assertEqual(p4, (2,3))
|
self.assertEqual(p4, (2,3))
|
||||||
self.assertEqual(p5, (0,4))
|
self.assertEqual(p5, (0,4))
|
||||||
self.assertEqual(p6, (-4,-6))
|
self.assertEqual(p6, (-4,-6))
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
#---------------------------------------------------------------------------
|
#---------------------------------------------------------------------------
|
||||||
|
|
||||||
|
|
||||||
class Size(unittest.TestCase):
|
class Size(unittest.TestCase):
|
||||||
|
|
||||||
def test_default_ctor(self):
|
def test_default_ctor(self):
|
||||||
s = wx.Size()
|
s = wx.Size()
|
||||||
self.assertTrue(s == (0,0))
|
self.assertTrue(s == (0,0))
|
||||||
|
|
||||||
def test_wh_ctor(self):
|
def test_wh_ctor(self):
|
||||||
s = wx.Size(100,200)
|
s = wx.Size(100,200)
|
||||||
|
|
||||||
def test_copy_ctor(self):
|
def test_copy_ctor(self):
|
||||||
s1 = wx.Size(100,200)
|
s1 = wx.Size(100,200)
|
||||||
s2 = wx.Size(s1)
|
s2 = wx.Size(s1)
|
||||||
self.assertTrue(s1 is not s2)
|
self.assertTrue(s1 is not s2)
|
||||||
self.assertTrue(s1 == s2)
|
self.assertTrue(s1 == s2)
|
||||||
|
|
||||||
def test_bogus_ctor(self):
|
def test_bogus_ctor(self):
|
||||||
with self.assertRaises(TypeError):
|
with self.assertRaises(TypeError):
|
||||||
s = wx.Size("aa", "bb")
|
s = wx.Size("aa", "bb")
|
||||||
|
|
||||||
def test_DecBy(self):
|
def test_DecBy(self):
|
||||||
s = wx.Size(100,100)
|
s = wx.Size(100,100)
|
||||||
s.DecBy(wx.Point(5,5))
|
s.DecBy(wx.Point(5,5))
|
||||||
self.assertTrue(s == (95,95))
|
self.assertTrue(s == (95,95))
|
||||||
s.DecBy(wx.Size(5,5))
|
s.DecBy(wx.Size(5,5))
|
||||||
self.assertTrue(s == (90,90))
|
self.assertTrue(s == (90,90))
|
||||||
s.DecBy(5,5)
|
s.DecBy(5,5)
|
||||||
self.assertTrue(s == (85,85))
|
self.assertTrue(s == (85,85))
|
||||||
s.DecBy(5)
|
s.DecBy(5)
|
||||||
self.assertTrue(s == (80,80))
|
self.assertTrue(s == (80,80))
|
||||||
s.DecBy( (5,5) )
|
s.DecBy( (5,5) )
|
||||||
self.assertTrue(s == (75,75))
|
self.assertTrue(s == (75,75))
|
||||||
|
|
||||||
|
|
||||||
def test_IncBy(self):
|
def test_IncBy(self):
|
||||||
s = wx.Size(50,50)
|
s = wx.Size(50,50)
|
||||||
s.IncBy(wx.Point(5,5))
|
s.IncBy(wx.Point(5,5))
|
||||||
self.assertTrue(s == (55,55))
|
self.assertTrue(s == (55,55))
|
||||||
s.IncBy(wx.Size(5,5))
|
s.IncBy(wx.Size(5,5))
|
||||||
self.assertTrue(s == (60,60))
|
self.assertTrue(s == (60,60))
|
||||||
s.IncBy(5,5)
|
s.IncBy(5,5)
|
||||||
self.assertTrue(s == (65,65))
|
self.assertTrue(s == (65,65))
|
||||||
s.IncBy(5)
|
s.IncBy(5)
|
||||||
self.assertTrue(s == (70,70))
|
self.assertTrue(s == (70,70))
|
||||||
s.IncBy( (5,5) )
|
s.IncBy( (5,5) )
|
||||||
self.assertTrue(s == (75,75))
|
self.assertTrue(s == (75,75))
|
||||||
|
|
||||||
def test_DecTo(self):
|
def test_DecTo(self):
|
||||||
s = wx.Size(5, 15)
|
s = wx.Size(5, 15)
|
||||||
s.DecTo( (10,10) )
|
s.DecTo( (10,10) )
|
||||||
self.assertTrue(s == (5,10))
|
self.assertTrue(s == (5,10))
|
||||||
|
|
||||||
def test_IncTo(self):
|
def test_IncTo(self):
|
||||||
s = wx.Size(5, 15)
|
s = wx.Size(5, 15)
|
||||||
s.IncTo( (10,10) )
|
s.IncTo( (10,10) )
|
||||||
self.assertTrue(s == (10,15))
|
self.assertTrue(s == (10,15))
|
||||||
|
|
||||||
def test_properties(self):
|
def test_properties(self):
|
||||||
s = wx.Size(23,34)
|
s = wx.Size(23,34)
|
||||||
self.assertTrue(s.width == 23 and s.height == 34)
|
self.assertTrue(s.width == 23 and s.height == 34)
|
||||||
s.width += 1
|
s.width += 1
|
||||||
s.height += 1
|
s.height += 1
|
||||||
self.assertTrue(s == (24,35))
|
self.assertTrue(s == (24,35))
|
||||||
|
|
||||||
def test_operators(self):
|
def test_operators(self):
|
||||||
s1 = wx.Size(100,200)
|
s1 = wx.Size(100,200)
|
||||||
s2 = wx.Size(30,40)
|
s2 = wx.Size(30,40)
|
||||||
@@ -198,11 +198,11 @@ class Size(unittest.TestCase):
|
|||||||
s = s1 + s2
|
s = s1 + s2
|
||||||
s = s1 - s2
|
s = s1 - s2
|
||||||
s = s1 / 5
|
s = s1 / 5
|
||||||
|
|
||||||
def test_DefaultSize(self):
|
def test_DefaultSize(self):
|
||||||
ds = wx.DefaultSize
|
ds = wx.DefaultSize
|
||||||
self.assertTrue(ds == (-1,-1))
|
self.assertTrue(ds == (-1,-1))
|
||||||
|
|
||||||
def test_GetSet(self):
|
def test_GetSet(self):
|
||||||
s = wx.Size(100,200)
|
s = wx.Size(100,200)
|
||||||
t = s.Get()
|
t = s.Get()
|
||||||
@@ -210,17 +210,17 @@ class Size(unittest.TestCase):
|
|||||||
self.assertTrue(t == (100,200))
|
self.assertTrue(t == (100,200))
|
||||||
s.Set(5,10)
|
s.Set(5,10)
|
||||||
self.assertTrue(s.Get() == (5,10))
|
self.assertTrue(s.Get() == (5,10))
|
||||||
|
|
||||||
def test_SetDefaults(self):
|
def test_SetDefaults(self):
|
||||||
s = wx.Size(50, -1)
|
s = wx.Size(50, -1)
|
||||||
s.SetDefaults( (25,25) )
|
s.SetDefaults( (25,25) )
|
||||||
self.assertTrue(s == (50,25))
|
self.assertTrue(s == (50,25))
|
||||||
|
|
||||||
def test_FullySpecified(self):
|
def test_FullySpecified(self):
|
||||||
self.assertTrue(wx.Size(40,50).IsFullySpecified())
|
self.assertTrue(wx.Size(40,50).IsFullySpecified())
|
||||||
self.assertTrue(not wx.Size(-1,50).IsFullySpecified())
|
self.assertTrue(not wx.Size(-1,50).IsFullySpecified())
|
||||||
self.assertTrue(not wx.Size(40,-1).IsFullySpecified())
|
self.assertTrue(not wx.Size(40,-1).IsFullySpecified())
|
||||||
|
|
||||||
def test_magic(self):
|
def test_magic(self):
|
||||||
s = wx.Size(5,6)
|
s = wx.Size(5,6)
|
||||||
self.assertTrue(str(s) == "(5, 6)")
|
self.assertTrue(str(s) == "(5, 6)")
|
||||||
@@ -233,41 +233,41 @@ class Size(unittest.TestCase):
|
|||||||
self.assertTrue(s == (6,8))
|
self.assertTrue(s == (6,8))
|
||||||
with self.assertRaises(IndexError):
|
with self.assertRaises(IndexError):
|
||||||
s[2]
|
s[2]
|
||||||
|
|
||||||
|
|
||||||
#---------------------------------------------------------------------------
|
#---------------------------------------------------------------------------
|
||||||
|
|
||||||
|
|
||||||
class RealPoint(unittest.TestCase):
|
class RealPoint(unittest.TestCase):
|
||||||
|
|
||||||
def test_default_ctor(self):
|
def test_default_ctor(self):
|
||||||
p = wx.RealPoint()
|
p = wx.RealPoint()
|
||||||
|
|
||||||
def test_xy_ctor(self):
|
def test_xy_ctor(self):
|
||||||
p = wx.RealPoint(12.3, 34.5)
|
p = wx.RealPoint(12.3, 34.5)
|
||||||
|
|
||||||
def test_Point_ctor(self):
|
def test_Point_ctor(self):
|
||||||
p = wx.RealPoint(wx.Point(3,5))
|
p = wx.RealPoint(wx.Point(3,5))
|
||||||
p = wx.RealPoint( (3,5) )
|
p = wx.RealPoint( (3,5) )
|
||||||
|
|
||||||
def test_copy_ctor(self):
|
def test_copy_ctor(self):
|
||||||
p1 = wx.RealPoint(12.3, 45.6)
|
p1 = wx.RealPoint(12.3, 45.6)
|
||||||
p2 = wx.RealPoint(p1)
|
p2 = wx.RealPoint(p1)
|
||||||
|
|
||||||
def test_properties(self):
|
def test_properties(self):
|
||||||
p = wx.RealPoint(12.3, 45.6)
|
p = wx.RealPoint(12.3, 45.6)
|
||||||
p.x += 2
|
p.x += 2
|
||||||
p.y += 2
|
p.y += 2
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
#---------------------------------------------------------------------------
|
#---------------------------------------------------------------------------
|
||||||
|
|
||||||
class Rect(unittest.TestCase):
|
class Rect(unittest.TestCase):
|
||||||
|
|
||||||
def test_default_ctor(self):
|
def test_default_ctor(self):
|
||||||
r = wx.Rect()
|
r = wx.Rect()
|
||||||
|
|
||||||
def test_xywh_ctor(self):
|
def test_xywh_ctor(self):
|
||||||
r = wx.Rect(1, 2, 3, 4)
|
r = wx.Rect(1, 2, 3, 4)
|
||||||
|
|
||||||
@@ -276,13 +276,13 @@ class Rect(unittest.TestCase):
|
|||||||
r2 = wx.Rect(width=3, height=4, x=1, y=2)
|
r2 = wx.Rect(width=3, height=4, x=1, y=2)
|
||||||
self.assertTrue(r1 == r2)
|
self.assertTrue(r1 == r2)
|
||||||
self.assertTrue(r2 == (1,2,3,4))
|
self.assertTrue(r2 == (1,2,3,4))
|
||||||
|
|
||||||
def test_possize_ctor(self):
|
def test_possize_ctor(self):
|
||||||
r = wx.Rect(wx.Point(10,10), wx.Size(100,100))
|
r = wx.Rect(wx.Point(10,10), wx.Size(100,100))
|
||||||
self.assertTrue(r.width == 100 and r.height == 100)
|
self.assertTrue(r.width == 100 and r.height == 100)
|
||||||
self.assertTrue(r.x == 10 and r.y == 10)
|
self.assertTrue(r.x == 10 and r.y == 10)
|
||||||
self.assertTrue(r == wx.Rect(pos=(10,10), size=(100,100)))
|
self.assertTrue(r == wx.Rect(pos=(10,10), size=(100,100)))
|
||||||
|
|
||||||
def test_tlbr_ctor(self):
|
def test_tlbr_ctor(self):
|
||||||
# TODO: we have to use keyword args here since wx.Point has sequence
|
# TODO: we have to use keyword args here since wx.Point has sequence
|
||||||
# protocol methods then it can also match the typemap for wxSize and
|
# protocol methods then it can also match the typemap for wxSize and
|
||||||
@@ -297,12 +297,12 @@ class Rect(unittest.TestCase):
|
|||||||
r = wx.Rect(wx.Size(50,100))
|
r = wx.Rect(wx.Size(50,100))
|
||||||
self.assertTrue(r.width == 50 and r.height == 100)
|
self.assertTrue(r.width == 50 and r.height == 100)
|
||||||
self.assertTrue(r.x == 0 and r.y == 0)
|
self.assertTrue(r.x == 0 and r.y == 0)
|
||||||
|
|
||||||
|
|
||||||
# TODO: more tests!
|
# TODO: more tests!
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
#---------------------------------------------------------------------------
|
#---------------------------------------------------------------------------
|
||||||
|
|
||||||
class intersectRect_Tests(wtc.WidgetTestCase):
|
class intersectRect_Tests(wtc.WidgetTestCase):
|
||||||
@@ -311,15 +311,15 @@ class intersectRect_Tests(wtc.WidgetTestCase):
|
|||||||
r2 = wx.Rect(50,50,10,10)
|
r2 = wx.Rect(50,50,10,10)
|
||||||
r3 = wx.IntersectRect(r1, r2)
|
r3 = wx.IntersectRect(r1, r2)
|
||||||
self.assertEqual(r3, None)
|
self.assertEqual(r3, None)
|
||||||
|
|
||||||
def test_intersectRect02(self):
|
def test_intersectRect02(self):
|
||||||
r1 = wx.Rect(0,0,55,55)
|
r1 = wx.Rect(0,0,55,55)
|
||||||
r2 = wx.Rect(50,50,10,10)
|
r2 = wx.Rect(50,50,10,10)
|
||||||
r3 = wx.IntersectRect(r1, r2)
|
r3 = wx.IntersectRect(r1, r2)
|
||||||
self.assertEqual(r3, wx.Rect(50,50,5,5))
|
self.assertEqual(r3, wx.Rect(50,50,5,5))
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
#---------------------------------------------------------------------------
|
#---------------------------------------------------------------------------
|
||||||
|
|
||||||
if __name__ == '__main__':
|
if __name__ == '__main__':
|
||||||
|
|||||||
@@ -5,42 +5,41 @@ import wx
|
|||||||
#---------------------------------------------------------------------------
|
#---------------------------------------------------------------------------
|
||||||
|
|
||||||
class Point2D(unittest.TestCase):
|
class Point2D(unittest.TestCase):
|
||||||
|
|
||||||
def test_default_ctor(self):
|
def test_default_ctor(self):
|
||||||
p = wx.Point2D()
|
p = wx.Point2D()
|
||||||
|
|
||||||
def test_xy_ctor(self):
|
def test_xy_ctor(self):
|
||||||
p = wx.Point2D(12.3, 45.6)
|
p = wx.Point2D(12.3, 45.6)
|
||||||
|
|
||||||
def test_copy_ctor(self):
|
def test_copy_ctor(self):
|
||||||
p1 = wx.Point2D(1.23, 4.56)
|
p1 = wx.Point2D(1.23, 4.56)
|
||||||
p2 = wx.Point2D(p1)
|
p2 = wx.Point2D(p1)
|
||||||
self.assertTrue(p1 == p2)
|
self.assertTrue(p1 == p2)
|
||||||
self.assertTrue(p1 is not p2)
|
self.assertTrue(p1 is not p2)
|
||||||
self.assertTrue(p1 == (1.23, 4.56))
|
self.assertTrue(p1 == (1.23, 4.56))
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
class Rect2D(unittest.TestCase):
|
class Rect2D(unittest.TestCase):
|
||||||
|
|
||||||
def test_default_ctor(self):
|
def test_default_ctor(self):
|
||||||
r = wx.Rect2D()
|
r = wx.Rect2D()
|
||||||
|
|
||||||
def test_xywh_ctor(self):
|
def test_xywh_ctor(self):
|
||||||
r = wx.Rect2D(.5, .5, 100.1, 99.2)
|
r = wx.Rect2D(.5, .5, 100.1, 99.2)
|
||||||
|
|
||||||
def test_copy_ctor(self):
|
def test_copy_ctor(self):
|
||||||
r1 = wx.Rect2D(.5, .5, 100.1, 99.2)
|
r1 = wx.Rect2D(.5, .5, 100.1, 99.2)
|
||||||
r2 = wx.Rect2D(r1)
|
r2 = wx.Rect2D(r1)
|
||||||
self.assertTrue(r1 == r2)
|
self.assertTrue(r1 == r2)
|
||||||
self.assertTrue(r1 is not r2)
|
self.assertTrue(r1 is not r2)
|
||||||
self.assertTrue(r1 == (.5, .5, 100.1, 99.2))
|
self.assertTrue(r1 == (.5, .5, 100.1, 99.2))
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
#---------------------------------------------------------------------------
|
#---------------------------------------------------------------------------
|
||||||
|
|
||||||
|
|
||||||
if __name__ == '__main__':
|
if __name__ == '__main__':
|
||||||
unittest.main()
|
unittest.main()
|
||||||
|
|
||||||
@@ -26,12 +26,12 @@ class glcanvas_Tests(wtc.WidgetTestCase):
|
|||||||
wx.glcanvas.WX_GL_MIN_ACCUM_ALPHA
|
wx.glcanvas.WX_GL_MIN_ACCUM_ALPHA
|
||||||
wx.glcanvas.WX_GL_SAMPLE_BUFFERS
|
wx.glcanvas.WX_GL_SAMPLE_BUFFERS
|
||||||
wx.glcanvas.WX_GL_SAMPLES
|
wx.glcanvas.WX_GL_SAMPLES
|
||||||
|
|
||||||
|
|
||||||
def test_glcanvas2(self):
|
def test_glcanvas2(self):
|
||||||
cvs = wx.glcanvas.GLCanvas(self.frame)
|
cvs = wx.glcanvas.GLCanvas(self.frame)
|
||||||
ctx = wx.glcanvas.GLContext(cvs)
|
ctx = wx.glcanvas.GLContext(cvs)
|
||||||
|
|
||||||
|
|
||||||
def test_glcanvas3(self):
|
def test_glcanvas3(self):
|
||||||
attribs = [wx.glcanvas.WX_GL_DEPTH_SIZE, 32,
|
attribs = [wx.glcanvas.WX_GL_DEPTH_SIZE, 32,
|
||||||
@@ -39,14 +39,14 @@ class glcanvas_Tests(wtc.WidgetTestCase):
|
|||||||
0]
|
0]
|
||||||
cvs = wx.glcanvas.GLCanvas(self.frame, attribList=attribs)
|
cvs = wx.glcanvas.GLCanvas(self.frame, attribList=attribs)
|
||||||
|
|
||||||
|
|
||||||
def test_glcanvas4(self):
|
def test_glcanvas4(self):
|
||||||
attribs = [wx.glcanvas.WX_GL_DEPTH_SIZE, 32,
|
attribs = [wx.glcanvas.WX_GL_DEPTH_SIZE, 32,
|
||||||
wx.glcanvas.WX_GL_DOUBLEBUFFER,
|
wx.glcanvas.WX_GL_DOUBLEBUFFER,
|
||||||
0]
|
0]
|
||||||
wx.glcanvas.GLCanvas.IsDisplaySupported(attribs)
|
wx.glcanvas.GLCanvas.IsDisplaySupported(attribs)
|
||||||
|
|
||||||
|
|
||||||
#---------------------------------------------------------------------------
|
#---------------------------------------------------------------------------
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -22,7 +22,7 @@ class graphics_Tests(wtc.WidgetTestCase):
|
|||||||
img = wx.Image(100,100)
|
img = wx.Image(100,100)
|
||||||
gc = wx.GraphicsContext.Create(img)
|
gc = wx.GraphicsContext.Create(img)
|
||||||
self.assertTrue(gc.IsOk())
|
self.assertTrue(gc.IsOk())
|
||||||
|
|
||||||
def test_gcCreateBitmap(self):
|
def test_gcCreateBitmap(self):
|
||||||
self.waitFor(50)
|
self.waitFor(50)
|
||||||
gc = wx.GraphicsContext.Create(self.frame)
|
gc = wx.GraphicsContext.Create(self.frame)
|
||||||
@@ -31,7 +31,7 @@ class graphics_Tests(wtc.WidgetTestCase):
|
|||||||
gb = gc.CreateBitmap(bmp)
|
gb = gc.CreateBitmap(bmp)
|
||||||
self.assertTrue(gb.IsOk())
|
self.assertTrue(gb.IsOk())
|
||||||
self.assertTrue(isinstance(gb, wx.GraphicsBitmap))
|
self.assertTrue(isinstance(gb, wx.GraphicsBitmap))
|
||||||
|
|
||||||
img = wx.Image(100,100)
|
img = wx.Image(100,100)
|
||||||
gb = gc.CreateBitmapFromImage(img)
|
gb = gc.CreateBitmapFromImage(img)
|
||||||
self.assertTrue(gb.IsOk())
|
self.assertTrue(gb.IsOk())
|
||||||
@@ -39,7 +39,7 @@ class graphics_Tests(wtc.WidgetTestCase):
|
|||||||
if 'wxGTK' not in wx.PlatformInfo:
|
if 'wxGTK' not in wx.PlatformInfo:
|
||||||
gb = gc.CreateSubBitmap(gb, 5, 5, 25, 25)
|
gb = gc.CreateSubBitmap(gb, 5, 5, 25, 25)
|
||||||
self.assertTrue(gb.IsOk())
|
self.assertTrue(gb.IsOk())
|
||||||
|
|
||||||
img = gb.ConvertToImage()
|
img = gb.ConvertToImage()
|
||||||
self.assertTrue(img.IsOk())
|
self.assertTrue(img.IsOk())
|
||||||
|
|
||||||
@@ -56,7 +56,7 @@ class graphics_Tests(wtc.WidgetTestCase):
|
|||||||
gf = gc.CreateFont(wx.NORMAL_FONT)
|
gf = gc.CreateFont(wx.NORMAL_FONT)
|
||||||
self.assertTrue(gf.IsOk())
|
self.assertTrue(gf.IsOk())
|
||||||
self.assertTrue(isinstance(gf, wx.GraphicsFont))
|
self.assertTrue(isinstance(gf, wx.GraphicsFont))
|
||||||
|
|
||||||
gf = gc.CreateFont(15, 'Courier')
|
gf = gc.CreateFont(15, 'Courier')
|
||||||
self.assertTrue(gf.IsOk())
|
self.assertTrue(gf.IsOk())
|
||||||
|
|
||||||
@@ -74,90 +74,90 @@ class graphics_Tests(wtc.WidgetTestCase):
|
|||||||
p = gc.CreatePath()
|
p = gc.CreatePath()
|
||||||
self.assertTrue(p.IsOk())
|
self.assertTrue(p.IsOk())
|
||||||
self.assertTrue(isinstance(p, wx.GraphicsPath))
|
self.assertTrue(isinstance(p, wx.GraphicsPath))
|
||||||
|
|
||||||
def test_gcCreateMatrix(self):
|
def test_gcCreateMatrix(self):
|
||||||
self.waitFor(50)
|
self.waitFor(50)
|
||||||
gc = wx.GraphicsContext.Create(self.frame)
|
gc = wx.GraphicsContext.Create(self.frame)
|
||||||
m = gc.CreateMatrix()
|
m = gc.CreateMatrix()
|
||||||
self.assertTrue(m.IsOk())
|
self.assertTrue(m.IsOk())
|
||||||
self.assertTrue(isinstance(m, wx.GraphicsMatrix))
|
self.assertTrue(isinstance(m, wx.GraphicsMatrix))
|
||||||
|
|
||||||
values = m.Get()
|
values = m.Get()
|
||||||
self.assertTrue(len(values) == 6)
|
self.assertTrue(len(values) == 6)
|
||||||
|
|
||||||
dx, dy = m.TransformDistance(5,6)
|
dx, dy = m.TransformDistance(5,6)
|
||||||
x,y = m.TransformPoint(7,8)
|
x,y = m.TransformPoint(7,8)
|
||||||
|
|
||||||
|
|
||||||
def test_gcTextExtents(self):
|
def test_gcTextExtents(self):
|
||||||
self.waitFor(50)
|
self.waitFor(50)
|
||||||
gc = wx.GraphicsContext.Create(self.frame)
|
gc = wx.GraphicsContext.Create(self.frame)
|
||||||
gf = gc.CreateFont(wx.NORMAL_FONT)
|
gf = gc.CreateFont(wx.NORMAL_FONT)
|
||||||
gc.SetFont(gf)
|
gc.SetFont(gf)
|
||||||
|
|
||||||
ext = gc.GetPartialTextExtents("Hello")
|
ext = gc.GetPartialTextExtents("Hello")
|
||||||
self.assertEqual(len(ext), 5)
|
self.assertEqual(len(ext), 5)
|
||||||
|
|
||||||
w, h, d, e = gc.GetFullTextExtent("Hello")
|
w, h, d, e = gc.GetFullTextExtent("Hello")
|
||||||
w, h = gc.GetTextExtent("Hello")
|
w, h = gc.GetTextExtent("Hello")
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
def test_gcStrokeLines1(self):
|
def test_gcStrokeLines1(self):
|
||||||
self.waitFor(50)
|
self.waitFor(50)
|
||||||
gc = wx.GraphicsContext.Create(self.frame)
|
gc = wx.GraphicsContext.Create(self.frame)
|
||||||
gc.SetPen(wx.Pen('blue', 2))
|
gc.SetPen(wx.Pen('blue', 2))
|
||||||
|
|
||||||
points = [ wx.Point2D(5,5),
|
points = [ wx.Point2D(5,5),
|
||||||
wx.Point2D(50,5),
|
wx.Point2D(50,5),
|
||||||
wx.Point2D(50,50),
|
wx.Point2D(50,50),
|
||||||
wx.Point2D(5,5),
|
wx.Point2D(5,5),
|
||||||
]
|
]
|
||||||
gc.StrokeLines(points)
|
gc.StrokeLines(points)
|
||||||
|
|
||||||
def test_gcStrokeLines2(self):
|
def test_gcStrokeLines2(self):
|
||||||
self.waitFor(50)
|
self.waitFor(50)
|
||||||
gc = wx.GraphicsContext.Create(self.frame)
|
gc = wx.GraphicsContext.Create(self.frame)
|
||||||
gc.SetPen(wx.Pen('blue', 2))
|
gc.SetPen(wx.Pen('blue', 2))
|
||||||
points = [ (5,5), (50,5), wx.Point2D(50,50), (5,5) ]
|
points = [ (5,5), (50,5), wx.Point2D(50,50), (5,5) ]
|
||||||
gc.StrokeLines(points)
|
gc.StrokeLines(points)
|
||||||
|
|
||||||
def test_gcStrokeLines3(self):
|
def test_gcStrokeLines3(self):
|
||||||
self.waitFor(50)
|
self.waitFor(50)
|
||||||
gc = wx.GraphicsContext.Create(self.frame)
|
gc = wx.GraphicsContext.Create(self.frame)
|
||||||
gc.SetPen(wx.Pen('blue', 2))
|
gc.SetPen(wx.Pen('blue', 2))
|
||||||
|
|
||||||
with self.assertRaises(TypeError):
|
with self.assertRaises(TypeError):
|
||||||
points = [ (5,5), (50,5), 'not a point', (5,5) ]
|
points = [ (5,5), (50,5), 'not a point', (5,5) ]
|
||||||
gc.StrokeLines(points)
|
gc.StrokeLines(points)
|
||||||
|
|
||||||
def test_gcDrawLines(self):
|
def test_gcDrawLines(self):
|
||||||
self.waitFor(50)
|
self.waitFor(50)
|
||||||
gc = wx.GraphicsContext.Create(self.frame)
|
gc = wx.GraphicsContext.Create(self.frame)
|
||||||
gc.SetPen(wx.Pen('blue', 2))
|
gc.SetPen(wx.Pen('blue', 2))
|
||||||
points = [ (5,5), (50,5), wx.Point2D(50,50), (5,5) ]
|
points = [ (5,5), (50,5), wx.Point2D(50,50), (5,5) ]
|
||||||
gc.DrawLines(points)
|
gc.DrawLines(points)
|
||||||
|
|
||||||
|
|
||||||
def test_gcGradientStops(self):
|
def test_gcGradientStops(self):
|
||||||
self.waitFor(50)
|
self.waitFor(50)
|
||||||
gs1 = wx.GraphicsGradientStop('red', 0.25)
|
gs1 = wx.GraphicsGradientStop('red', 0.25)
|
||||||
gs2 = wx.GraphicsGradientStop('green', 0.50)
|
gs2 = wx.GraphicsGradientStop('green', 0.50)
|
||||||
gs3 = wx.GraphicsGradientStop('blue', 0.90)
|
gs3 = wx.GraphicsGradientStop('blue', 0.90)
|
||||||
|
|
||||||
gs1.Colour
|
gs1.Colour
|
||||||
gs1.Position
|
gs1.Position
|
||||||
|
|
||||||
stops = wx.GraphicsGradientStops()
|
stops = wx.GraphicsGradientStops()
|
||||||
stops.Add(gs1)
|
stops.Add(gs1)
|
||||||
stops.Add(gs2)
|
stops.Add(gs2)
|
||||||
stops.Add('white', 0.75)
|
stops.Add('white', 0.75)
|
||||||
stops.Add(gs3)
|
stops.Add(gs3)
|
||||||
|
|
||||||
self.assertEqual(len(stops), 6) # 2 existing, plus 4 added
|
self.assertEqual(len(stops), 6) # 2 existing, plus 4 added
|
||||||
gs = stops[2]
|
gs = stops[2]
|
||||||
self.assertTrue(gs.Position == 0.5)
|
self.assertTrue(gs.Position == 0.5)
|
||||||
|
|
||||||
gc = wx.GraphicsContext.Create(self.frame)
|
gc = wx.GraphicsContext.Create(self.frame)
|
||||||
b = gc.CreateLinearGradientBrush(0,0, 500, 100, stops)
|
b = gc.CreateLinearGradientBrush(0,0, 500, 100, stops)
|
||||||
|
|
||||||
@@ -169,7 +169,7 @@ class graphics_Tests(wtc.WidgetTestCase):
|
|||||||
wx.NullGraphicsMatrix
|
wx.NullGraphicsMatrix
|
||||||
wx.NullGraphicsPath
|
wx.NullGraphicsPath
|
||||||
|
|
||||||
|
|
||||||
#---------------------------------------------------------------------------
|
#---------------------------------------------------------------------------
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -6,8 +6,8 @@ import wx.grid
|
|||||||
|
|
||||||
#---------------------------------------------------------------------------
|
#---------------------------------------------------------------------------
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
class grid_Tests(wtc.WidgetTestCase):
|
class grid_Tests(wtc.WidgetTestCase):
|
||||||
|
|
||||||
# NOTE: Most of these tests simply check that the class exists and can be
|
# NOTE: Most of these tests simply check that the class exists and can be
|
||||||
@@ -19,56 +19,56 @@ class grid_Tests(wtc.WidgetTestCase):
|
|||||||
def test_grid01(self):
|
def test_grid01(self):
|
||||||
c1 = wx.grid.GridCellCoords()
|
c1 = wx.grid.GridCellCoords()
|
||||||
c2 = wx.grid.GridCellCoords(5,10)
|
c2 = wx.grid.GridCellCoords(5,10)
|
||||||
|
|
||||||
|
|
||||||
def test_grid02(self):
|
def test_grid02(self):
|
||||||
r = wx.grid.GridCellAutoWrapStringRenderer()
|
r = wx.grid.GridCellAutoWrapStringRenderer()
|
||||||
|
|
||||||
def test_grid03(self):
|
def test_grid03(self):
|
||||||
r = wx.grid.GridCellBoolRenderer()
|
r = wx.grid.GridCellBoolRenderer()
|
||||||
|
|
||||||
def test_grid04(self):
|
def test_grid04(self):
|
||||||
r = wx.grid.GridCellDateTimeRenderer()
|
r = wx.grid.GridCellDateTimeRenderer()
|
||||||
|
|
||||||
def test_grid05(self):
|
def test_grid05(self):
|
||||||
r = wx.grid.GridCellEnumRenderer()
|
r = wx.grid.GridCellEnumRenderer()
|
||||||
|
|
||||||
def test_grid06(self):
|
def test_grid06(self):
|
||||||
r = wx.grid.GridCellFloatRenderer()
|
r = wx.grid.GridCellFloatRenderer()
|
||||||
|
|
||||||
def test_grid07(self):
|
def test_grid07(self):
|
||||||
r = wx.grid.GridCellNumberRenderer()
|
r = wx.grid.GridCellNumberRenderer()
|
||||||
|
|
||||||
def test_grid08(self):
|
def test_grid08(self):
|
||||||
r = wx.grid.GridCellStringRenderer()
|
r = wx.grid.GridCellStringRenderer()
|
||||||
|
|
||||||
def test_grid09(self):
|
def test_grid09(self):
|
||||||
class MyRenderer(wx.grid.GridCellRenderer):
|
class MyRenderer(wx.grid.GridCellRenderer):
|
||||||
def Clone(self):
|
def Clone(self):
|
||||||
return MyRenderer()
|
return MyRenderer()
|
||||||
|
|
||||||
def Draw(self, grid, attr, dc, rect, row, col, isSelected):
|
def Draw(self, grid, attr, dc, rect, row, col, isSelected):
|
||||||
pass
|
pass
|
||||||
|
|
||||||
def GetBestSize(self, grid, attr, dc, row, col):
|
def GetBestSize(self, grid, attr, dc, row, col):
|
||||||
return (80,20)
|
return (80,20)
|
||||||
|
|
||||||
r = MyRenderer()
|
r = MyRenderer()
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
def test_grid10(self):
|
def test_grid10(self):
|
||||||
e = wx.grid.GridCellAutoWrapStringEditor()
|
e = wx.grid.GridCellAutoWrapStringEditor()
|
||||||
|
|
||||||
def test_grid11(self):
|
def test_grid11(self):
|
||||||
e = wx.grid.GridCellBoolEditor()
|
e = wx.grid.GridCellBoolEditor()
|
||||||
|
|
||||||
def test_grid12(self):
|
def test_grid12(self):
|
||||||
e = wx.grid.GridCellChoiceEditor('one two three'.split())
|
e = wx.grid.GridCellChoiceEditor('one two three'.split())
|
||||||
|
|
||||||
def test_grid13(self):
|
def test_grid13(self):
|
||||||
e = wx.grid.GridCellEnumEditor()
|
e = wx.grid.GridCellEnumEditor()
|
||||||
|
|
||||||
def test_grid14(self):
|
def test_grid14(self):
|
||||||
e = wx.grid.GridCellTextEditor()
|
e = wx.grid.GridCellTextEditor()
|
||||||
|
|
||||||
@@ -77,26 +77,26 @@ class grid_Tests(wtc.WidgetTestCase):
|
|||||||
|
|
||||||
def test_grid16(self):
|
def test_grid16(self):
|
||||||
e = wx.grid.GridCellNumberEditor()
|
e = wx.grid.GridCellNumberEditor()
|
||||||
|
|
||||||
def test_grid17(self):
|
def test_grid17(self):
|
||||||
class MyEditor(wx.grid.GridCellEditor):
|
class MyEditor(wx.grid.GridCellEditor):
|
||||||
def Clone(self): return MyEditor()
|
def Clone(self): return MyEditor()
|
||||||
def BeginEdit(self, row, col, grid): pass
|
def BeginEdit(self, row, col, grid): pass
|
||||||
def Create(self, parent, id, evtHandler): pass
|
def Create(self, parent, id, evtHandler): pass
|
||||||
def EndEdit(self, row, col, grid, oldval): return None
|
def EndEdit(self, row, col, grid, oldval): return None
|
||||||
def ApplyEdit(self, row, col, grid): pass
|
def ApplyEdit(self, row, col, grid): pass
|
||||||
def Reset(self): pass
|
def Reset(self): pass
|
||||||
def GetValue(self): return ""
|
def GetValue(self): return ""
|
||||||
|
|
||||||
e = MyEditor()
|
e = MyEditor()
|
||||||
return e
|
return e
|
||||||
|
|
||||||
def test_grid17a(self):
|
def test_grid17a(self):
|
||||||
e = self.test_grid17()
|
e = self.test_grid17()
|
||||||
e.GetControl
|
e.GetControl
|
||||||
e.SetControl
|
e.SetControl
|
||||||
|
|
||||||
|
|
||||||
def test_grid18(self):
|
def test_grid18(self):
|
||||||
a = wx.grid.GridCellAttr()
|
a = wx.grid.GridCellAttr()
|
||||||
a.DecRef()
|
a.DecRef()
|
||||||
@@ -119,7 +119,7 @@ class grid_Tests(wtc.WidgetTestCase):
|
|||||||
a.GetSize()
|
a.GetSize()
|
||||||
a.GetOverflow()
|
a.GetOverflow()
|
||||||
a.GetKind()
|
a.GetKind()
|
||||||
|
|
||||||
a.DecRef()
|
a.DecRef()
|
||||||
|
|
||||||
|
|
||||||
@@ -132,12 +132,12 @@ class grid_Tests(wtc.WidgetTestCase):
|
|||||||
wx.grid.GridCellAttr.Merged
|
wx.grid.GridCellAttr.Merged
|
||||||
|
|
||||||
|
|
||||||
def test_grid20(self):
|
def test_grid20(self):
|
||||||
class MyRenderer(wx.grid.GridCornerHeaderRenderer):
|
class MyRenderer(wx.grid.GridCornerHeaderRenderer):
|
||||||
def DrawBorder(self, grid, dc, rect):
|
def DrawBorder(self, grid, dc, rect):
|
||||||
pass
|
pass
|
||||||
r = MyRenderer()
|
r = MyRenderer()
|
||||||
|
|
||||||
def test_grid21(self):
|
def test_grid21(self):
|
||||||
class MyRenderer(wx.grid.GridHeaderLabelsRenderer):
|
class MyRenderer(wx.grid.GridHeaderLabelsRenderer):
|
||||||
def DrawBorder(self, grid, dc, rect):
|
def DrawBorder(self, grid, dc, rect):
|
||||||
@@ -146,62 +146,62 @@ class grid_Tests(wtc.WidgetTestCase):
|
|||||||
pass
|
pass
|
||||||
r = MyRenderer()
|
r = MyRenderer()
|
||||||
|
|
||||||
def test_grid22(self):
|
def test_grid22(self):
|
||||||
class MyRenderer(wx.grid.GridRowHeaderRenderer):
|
class MyRenderer(wx.grid.GridRowHeaderRenderer):
|
||||||
def DrawBorder(self, grid, dc, rect):
|
def DrawBorder(self, grid, dc, rect):
|
||||||
pass
|
pass
|
||||||
def DrawLabel(self, grid, dc, value, rect, horizAlign, vertAlign, textOrientation):
|
def DrawLabel(self, grid, dc, value, rect, horizAlign, vertAlign, textOrientation):
|
||||||
pass
|
pass
|
||||||
r = MyRenderer()
|
r = MyRenderer()
|
||||||
|
|
||||||
def test_grid23(self):
|
def test_grid23(self):
|
||||||
class MyRenderer(wx.grid.GridColumnHeaderRenderer):
|
class MyRenderer(wx.grid.GridColumnHeaderRenderer):
|
||||||
def DrawBorder(self, grid, dc, rect):
|
def DrawBorder(self, grid, dc, rect):
|
||||||
pass
|
pass
|
||||||
def DrawLabel(self, grid, dc, value, rect, horizAlign, vertAlign, textOrientation):
|
def DrawLabel(self, grid, dc, value, rect, horizAlign, vertAlign, textOrientation):
|
||||||
pass
|
pass
|
||||||
r = MyRenderer()
|
r = MyRenderer()
|
||||||
|
|
||||||
def test_grid24(self):
|
def test_grid24(self):
|
||||||
r = wx.grid.GridRowHeaderRendererDefault()
|
r = wx.grid.GridRowHeaderRendererDefault()
|
||||||
|
|
||||||
def test_grid25(self):
|
def test_grid25(self):
|
||||||
r = wx.grid.GridColumnHeaderRendererDefault()
|
r = wx.grid.GridColumnHeaderRendererDefault()
|
||||||
|
|
||||||
def test_grid26(self):
|
def test_grid26(self):
|
||||||
r = wx.grid.GridCornerHeaderRendererDefault()
|
r = wx.grid.GridCornerHeaderRendererDefault()
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
def test_grid27(self):
|
def test_grid27(self):
|
||||||
p = wx.grid.GridCellAttrProvider()
|
p = wx.grid.GridCellAttrProvider()
|
||||||
|
|
||||||
def test_grid28(self):
|
def test_grid28(self):
|
||||||
class MyTable(wx.grid.GridTableBase):
|
class MyTable(wx.grid.GridTableBase):
|
||||||
def GetNumberRows(self): return 1
|
def GetNumberRows(self): return 1
|
||||||
def GetNumberCols(self): return 1
|
def GetNumberCols(self): return 1
|
||||||
def GetValue(self, row, col): return ""
|
def GetValue(self, row, col): return ""
|
||||||
def SetValue(self, row, col, value): pass
|
def SetValue(self, row, col, value): pass
|
||||||
t = MyTable()
|
t = MyTable()
|
||||||
|
|
||||||
|
|
||||||
def test_grid29(self):
|
def test_grid29(self):
|
||||||
t = wx.grid.GridStringTable()
|
t = wx.grid.GridStringTable()
|
||||||
|
|
||||||
def test_grid30(self):
|
def test_grid30(self):
|
||||||
m = wx.grid.GridTableMessage()
|
m = wx.grid.GridTableMessage()
|
||||||
|
|
||||||
def test_grid31(self):
|
def test_grid31(self):
|
||||||
m = wx.grid.GridSizesInfo()
|
m = wx.grid.GridSizesInfo()
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
def test_grid32(self):
|
def test_grid32(self):
|
||||||
g = wx.grid.Grid(self.frame)
|
g = wx.grid.Grid(self.frame)
|
||||||
g.CreateGrid(10,5)
|
g.CreateGrid(10,5)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
def test_grid33(self):
|
def test_grid33(self):
|
||||||
g = wx.grid.Grid(self.frame)
|
g = wx.grid.Grid(self.frame)
|
||||||
g.CreateGrid(10,5)
|
g.CreateGrid(10,5)
|
||||||
@@ -209,18 +209,18 @@ class grid_Tests(wtc.WidgetTestCase):
|
|||||||
g.SetCellValue(1,2, 'hello')
|
g.SetCellValue(1,2, 'hello')
|
||||||
g.SetCellValue((2,2), 'world')
|
g.SetCellValue((2,2), 'world')
|
||||||
del ul
|
del ul
|
||||||
|
|
||||||
def test_grid34(self):
|
def test_grid34(self):
|
||||||
g = wx.grid.Grid(self.frame)
|
g = wx.grid.Grid(self.frame)
|
||||||
g.CreateGrid(10,5)
|
g.CreateGrid(10,5)
|
||||||
with wx.grid.GridUpdateLocker(g):
|
with wx.grid.GridUpdateLocker(g):
|
||||||
g.SetCellValue(1,2, 'hello')
|
g.SetCellValue(1,2, 'hello')
|
||||||
g.SetCellValue((2,2), 'world')
|
g.SetCellValue((2,2), 'world')
|
||||||
|
|
||||||
|
|
||||||
def test_grid35(self):
|
def test_grid35(self):
|
||||||
e = wx.grid.GridEvent()
|
e = wx.grid.GridEvent()
|
||||||
|
|
||||||
def test_grid36(self):
|
def test_grid36(self):
|
||||||
e = wx.grid.GridSizeEvent()
|
e = wx.grid.GridSizeEvent()
|
||||||
|
|
||||||
@@ -252,7 +252,7 @@ class grid_Tests(wtc.WidgetTestCase):
|
|||||||
wx.grid.wxEVT_GRID_COL_MOVE
|
wx.grid.wxEVT_GRID_COL_MOVE
|
||||||
wx.grid.wxEVT_GRID_COL_SORT
|
wx.grid.wxEVT_GRID_COL_SORT
|
||||||
wx.grid.wxEVT_GRID_TABBING
|
wx.grid.wxEVT_GRID_TABBING
|
||||||
|
|
||||||
def test_grid40(self):
|
def test_grid40(self):
|
||||||
wx.grid.EVT_GRID_CELL_LEFT_CLICK
|
wx.grid.EVT_GRID_CELL_LEFT_CLICK
|
||||||
wx.grid.EVT_GRID_CELL_RIGHT_CLICK
|
wx.grid.EVT_GRID_CELL_RIGHT_CLICK
|
||||||
@@ -275,7 +275,7 @@ class grid_Tests(wtc.WidgetTestCase):
|
|||||||
wx.grid.EVT_GRID_COL_MOVE
|
wx.grid.EVT_GRID_COL_MOVE
|
||||||
wx.grid.EVT_GRID_COL_SORT
|
wx.grid.EVT_GRID_COL_SORT
|
||||||
wx.grid.EVT_GRID_TABBING
|
wx.grid.EVT_GRID_TABBING
|
||||||
|
|
||||||
wx.grid.EVT_GRID_CMD_CELL_LEFT_CLICK
|
wx.grid.EVT_GRID_CMD_CELL_LEFT_CLICK
|
||||||
wx.grid.EVT_GRID_CMD_CELL_RIGHT_CLICK
|
wx.grid.EVT_GRID_CMD_CELL_RIGHT_CLICK
|
||||||
wx.grid.EVT_GRID_CMD_CELL_LEFT_DCLICK
|
wx.grid.EVT_GRID_CMD_CELL_LEFT_DCLICK
|
||||||
@@ -297,12 +297,12 @@ class grid_Tests(wtc.WidgetTestCase):
|
|||||||
wx.grid.EVT_GRID_CMD_COL_MOVE
|
wx.grid.EVT_GRID_CMD_COL_MOVE
|
||||||
wx.grid.EVT_GRID_CMD_COL_SORT
|
wx.grid.EVT_GRID_CMD_COL_SORT
|
||||||
wx.grid.EVT_GRID_CMD_TABBING
|
wx.grid.EVT_GRID_CMD_TABBING
|
||||||
|
|
||||||
|
|
||||||
def test_grid41(self):
|
def test_grid41(self):
|
||||||
wx.grid.Grid.SetCellHighlightPenWidth # Does it exist
|
wx.grid.Grid.SetCellHighlightPenWidth # Does it exist
|
||||||
|
|
||||||
|
|
||||||
#---------------------------------------------------------------------------
|
#---------------------------------------------------------------------------
|
||||||
|
|
||||||
if __name__ == '__main__':
|
if __name__ == '__main__':
|
||||||
|
|||||||
@@ -12,13 +12,13 @@ class headercol_Tests(wtc.WidgetTestCase):
|
|||||||
def test_headercolCtor1(self):
|
def test_headercolCtor1(self):
|
||||||
hc = wx.HeaderColumnSimple('title', 80, wx.ALIGN_RIGHT, wx.COL_RESIZABLE)
|
hc = wx.HeaderColumnSimple('title', 80, wx.ALIGN_RIGHT, wx.COL_RESIZABLE)
|
||||||
|
|
||||||
|
|
||||||
def test_headercolCtor2(self):
|
def test_headercolCtor2(self):
|
||||||
bmp = wx.Bitmap(pngFile)
|
bmp = wx.Bitmap(pngFile)
|
||||||
hc = wx.HeaderColumnSimple(bmp, flags=wx.COL_RESIZABLE)
|
hc = wx.HeaderColumnSimple(bmp, flags=wx.COL_RESIZABLE)
|
||||||
hc.Bitmap
|
hc.Bitmap
|
||||||
|
|
||||||
|
|
||||||
def test_headercolProperties(self):
|
def test_headercolProperties(self):
|
||||||
hc = wx.HeaderColumnSimple('title', 80, wx.ALIGN_RIGHT, wx.COL_RESIZABLE)
|
hc = wx.HeaderColumnSimple('title', 80, wx.ALIGN_RIGHT, wx.COL_RESIZABLE)
|
||||||
# normal properties
|
# normal properties
|
||||||
@@ -34,25 +34,25 @@ class headercol_Tests(wtc.WidgetTestCase):
|
|||||||
hc.Hidden = True
|
hc.Hidden = True
|
||||||
self.assertTrue(hc.Hidden == hc.IsHidden())
|
self.assertTrue(hc.Hidden == hc.IsHidden())
|
||||||
self.assertTrue(hc.Shown == hc.IsShown())
|
self.assertTrue(hc.Shown == hc.IsShown())
|
||||||
|
|
||||||
|
|
||||||
def test_headercolConstants(self):
|
def test_headercolConstants(self):
|
||||||
wx.COL_WIDTH_DEFAULT
|
wx.COL_WIDTH_DEFAULT
|
||||||
wx.COL_WIDTH_AUTOSIZE
|
wx.COL_WIDTH_AUTOSIZE
|
||||||
wx.COL_RESIZABLE
|
wx.COL_RESIZABLE
|
||||||
wx.COL_SORTABLE
|
wx.COL_SORTABLE
|
||||||
wx.COL_REORDERABLE
|
wx.COL_REORDERABLE
|
||||||
wx.COL_HIDDEN
|
wx.COL_HIDDEN
|
||||||
wx.COL_DEFAULT_FLAGS
|
wx.COL_DEFAULT_FLAGS
|
||||||
|
|
||||||
def test_headercolAbsClass1(self):
|
def test_headercolAbsClass1(self):
|
||||||
with self.assertRaises(TypeError):
|
with self.assertRaises(TypeError):
|
||||||
hc = wx.HeaderColumn()
|
hc = wx.HeaderColumn()
|
||||||
|
|
||||||
def test_headercolAbsClass2(self):
|
def test_headercolAbsClass2(self):
|
||||||
with self.assertRaises(TypeError):
|
with self.assertRaises(TypeError):
|
||||||
hc = wx.SettableHeaderColumn()
|
hc = wx.SettableHeaderColumn()
|
||||||
|
|
||||||
#---------------------------------------------------------------------------
|
#---------------------------------------------------------------------------
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -10,7 +10,7 @@ class headerctrl_Tests(wtc.WidgetTestCase):
|
|||||||
wx.HD_ALLOW_REORDER
|
wx.HD_ALLOW_REORDER
|
||||||
wx.HD_ALLOW_HIDE
|
wx.HD_ALLOW_HIDE
|
||||||
wx.HD_DEFAULT_STYLE
|
wx.HD_DEFAULT_STYLE
|
||||||
|
|
||||||
wx.wxEVT_COMMAND_HEADER_CLICK
|
wx.wxEVT_COMMAND_HEADER_CLICK
|
||||||
wx.wxEVT_COMMAND_HEADER_RIGHT_CLICK
|
wx.wxEVT_COMMAND_HEADER_RIGHT_CLICK
|
||||||
wx.wxEVT_COMMAND_HEADER_MIDDLE_CLICK
|
wx.wxEVT_COMMAND_HEADER_MIDDLE_CLICK
|
||||||
@@ -24,7 +24,7 @@ class headerctrl_Tests(wtc.WidgetTestCase):
|
|||||||
wx.wxEVT_COMMAND_HEADER_BEGIN_REORDER
|
wx.wxEVT_COMMAND_HEADER_BEGIN_REORDER
|
||||||
wx.wxEVT_COMMAND_HEADER_END_REORDER
|
wx.wxEVT_COMMAND_HEADER_END_REORDER
|
||||||
wx.wxEVT_COMMAND_HEADER_DRAGGING_CANCELLED
|
wx.wxEVT_COMMAND_HEADER_DRAGGING_CANCELLED
|
||||||
|
|
||||||
wx.EVT_HEADER_CLICK
|
wx.EVT_HEADER_CLICK
|
||||||
wx.EVT_HEADER_RIGHT_CLICK
|
wx.EVT_HEADER_RIGHT_CLICK
|
||||||
wx.EVT_HEADER_MIDDLE_CLICK
|
wx.EVT_HEADER_MIDDLE_CLICK
|
||||||
@@ -38,22 +38,22 @@ class headerctrl_Tests(wtc.WidgetTestCase):
|
|||||||
wx.EVT_HEADER_BEGIN_REORDER
|
wx.EVT_HEADER_BEGIN_REORDER
|
||||||
wx.EVT_HEADER_END_REORDER
|
wx.EVT_HEADER_END_REORDER
|
||||||
wx.EVT_HEADER_DRAGGING_CANCELLED
|
wx.EVT_HEADER_DRAGGING_CANCELLED
|
||||||
|
|
||||||
|
|
||||||
def test_headerctrl2(self):
|
def test_headerctrl2(self):
|
||||||
with self.assertRaises(TypeError):
|
with self.assertRaises(TypeError):
|
||||||
hc = wx.HeaderCtrl(self.frame)
|
hc = wx.HeaderCtrl(self.frame)
|
||||||
|
|
||||||
def test_headerctrl3(self):
|
def test_headerctrl3(self):
|
||||||
hc = wx.HeaderCtrlSimple()
|
hc = wx.HeaderCtrlSimple()
|
||||||
hc.Create(self.frame)
|
hc.Create(self.frame)
|
||||||
|
|
||||||
def test_headerctrl4(self):
|
def test_headerctrl4(self):
|
||||||
hc = wx.HeaderCtrlSimple(self.frame)
|
hc = wx.HeaderCtrlSimple(self.frame)
|
||||||
|
|
||||||
col = wx.HeaderColumnSimple("Hello")
|
col = wx.HeaderColumnSimple("Hello")
|
||||||
hc.AppendColumn(col)
|
hc.AppendColumn(col)
|
||||||
|
|
||||||
col = wx.HeaderColumnSimple("World")
|
col = wx.HeaderColumnSimple("World")
|
||||||
hc.AppendColumn(col)
|
hc.AppendColumn(col)
|
||||||
|
|
||||||
|
|||||||
@@ -10,7 +10,7 @@ class help_Tests(wtc.WidgetTestCase):
|
|||||||
#hc = wx.HelpController()
|
#hc = wx.HelpController()
|
||||||
pass
|
pass
|
||||||
|
|
||||||
|
|
||||||
#---------------------------------------------------------------------------
|
#---------------------------------------------------------------------------
|
||||||
|
|
||||||
if __name__ == '__main__':
|
if __name__ == '__main__':
|
||||||
|
|||||||
@@ -15,10 +15,10 @@ class helpctrl_Tests(wtc.WidgetTestCase):
|
|||||||
hc.AddBook(os.path.join(helpPath, 'testing.hhp'))
|
hc.AddBook(os.path.join(helpPath, 'testing.hhp'))
|
||||||
hc.AddBook(os.path.join(helpPath, 'another.hhp'))
|
hc.AddBook(os.path.join(helpPath, 'another.hhp'))
|
||||||
hc.SetShouldPreventAppExit(False)
|
hc.SetShouldPreventAppExit(False)
|
||||||
|
|
||||||
hc.DisplayContents()
|
hc.DisplayContents()
|
||||||
self.myYield()
|
self.myYield()
|
||||||
|
|
||||||
#---------------------------------------------------------------------------
|
#---------------------------------------------------------------------------
|
||||||
|
|
||||||
if __name__ == '__main__':
|
if __name__ == '__main__':
|
||||||
|
|||||||
@@ -9,14 +9,14 @@ class helpdata_Tests(wtc.WidgetTestCase):
|
|||||||
|
|
||||||
def test_helpdata1(self):
|
def test_helpdata1(self):
|
||||||
obj = wx.html.HtmlBookRecord("file", "path", "title", "start")
|
obj = wx.html.HtmlBookRecord("file", "path", "title", "start")
|
||||||
|
|
||||||
def test_helpdata2(self):
|
def test_helpdata2(self):
|
||||||
obj = wx.html.HtmlHelpDataItem()
|
obj = wx.html.HtmlHelpDataItem()
|
||||||
|
|
||||||
def test_helpdata3(self):
|
def test_helpdata3(self):
|
||||||
obj = wx.html.HtmlHelpData()
|
obj = wx.html.HtmlHelpData()
|
||||||
|
|
||||||
|
|
||||||
def test_helpdata4(self):
|
def test_helpdata4(self):
|
||||||
wx.html.HF_TOOLBAR,
|
wx.html.HF_TOOLBAR,
|
||||||
wx.html.HF_CONTENTS,
|
wx.html.HF_CONTENTS,
|
||||||
@@ -60,7 +60,7 @@ class helpdata_Tests(wtc.WidgetTestCase):
|
|||||||
wx.html.ID_HTML_SEARCHBUTTON,
|
wx.html.ID_HTML_SEARCHBUTTON,
|
||||||
wx.html.ID_HTML_SEARCHCHOICE,
|
wx.html.ID_HTML_SEARCHCHOICE,
|
||||||
wx.html.ID_HTML_COUNTINFO
|
wx.html.ID_HTML_COUNTINFO
|
||||||
|
|
||||||
#---------------------------------------------------------------------------
|
#---------------------------------------------------------------------------
|
||||||
|
|
||||||
if __name__ == '__main__':
|
if __name__ == '__main__':
|
||||||
|
|||||||
@@ -16,10 +16,10 @@ class helpdlg_Tests(wtc.WidgetTestCase):
|
|||||||
data.AddBook(os.path.join(helpPath, 'another.hhp'))
|
data.AddBook(os.path.join(helpPath, 'another.hhp'))
|
||||||
dlg = wx.html.HtmlHelpDialog(data)
|
dlg = wx.html.HtmlHelpDialog(data)
|
||||||
dlg.Create(self.frame)
|
dlg.Create(self.frame)
|
||||||
|
|
||||||
self.myYield()
|
self.myYield()
|
||||||
dlg.Destroy()
|
dlg.Destroy()
|
||||||
|
|
||||||
#---------------------------------------------------------------------------
|
#---------------------------------------------------------------------------
|
||||||
|
|
||||||
if __name__ == '__main__':
|
if __name__ == '__main__':
|
||||||
|
|||||||
@@ -9,7 +9,7 @@ class helpext_Tests(wtc.WidgetTestCase):
|
|||||||
|
|
||||||
def test_helpext1(self):
|
def test_helpext1(self):
|
||||||
hc = wx.adv.ExtHelpController()
|
hc = wx.adv.ExtHelpController()
|
||||||
|
|
||||||
#---------------------------------------------------------------------------
|
#---------------------------------------------------------------------------
|
||||||
|
|
||||||
if __name__ == '__main__':
|
if __name__ == '__main__':
|
||||||
|
|||||||
@@ -14,16 +14,16 @@ class helpfrm_Tests(wtc.WidgetTestCase):
|
|||||||
data = wx.html.HtmlHelpData()
|
data = wx.html.HtmlHelpData()
|
||||||
data.AddBook(os.path.join(helpPath, 'testing.hhp'))
|
data.AddBook(os.path.join(helpPath, 'testing.hhp'))
|
||||||
data.AddBook(os.path.join(helpPath, 'another.hhp'))
|
data.AddBook(os.path.join(helpPath, 'another.hhp'))
|
||||||
|
|
||||||
hc = wx.html.HtmlHelpController()
|
hc = wx.html.HtmlHelpController()
|
||||||
frm = wx.html.HtmlHelpFrame(data)
|
frm = wx.html.HtmlHelpFrame(data)
|
||||||
frm.SetController(hc)
|
frm.SetController(hc)
|
||||||
frm.Create(self.frame, -1)
|
frm.Create(self.frame, -1)
|
||||||
frm.Show()
|
frm.Show()
|
||||||
|
|
||||||
self.myYield()
|
self.myYield()
|
||||||
frm.Close()
|
frm.Close()
|
||||||
|
|
||||||
#---------------------------------------------------------------------------
|
#---------------------------------------------------------------------------
|
||||||
|
|
||||||
if __name__ == '__main__':
|
if __name__ == '__main__':
|
||||||
|
|||||||
@@ -21,8 +21,8 @@ class helpwnd_Tests(wtc.WidgetTestCase):
|
|||||||
|
|
||||||
self.frame.SendSizeEvent()
|
self.frame.SendSizeEvent()
|
||||||
self.waitFor(50)
|
self.waitFor(50)
|
||||||
|
|
||||||
|
|
||||||
#---------------------------------------------------------------------------
|
#---------------------------------------------------------------------------
|
||||||
|
|
||||||
if __name__ == '__main__':
|
if __name__ == '__main__':
|
||||||
|
|||||||
@@ -13,26 +13,26 @@ class htmlcell_Tests(wtc.WidgetTestCase):
|
|||||||
|
|
||||||
def test_htmlcell2(self):
|
def test_htmlcell2(self):
|
||||||
obj = wx.html.HtmlSelection()
|
obj = wx.html.HtmlSelection()
|
||||||
|
|
||||||
def test_htmlcell3(self):
|
def test_htmlcell3(self):
|
||||||
obj = wx.html.HtmlRenderingState()
|
obj = wx.html.HtmlRenderingState()
|
||||||
|
|
||||||
def test_htmlcell4(self):
|
def test_htmlcell4(self):
|
||||||
obj = wx.html.HtmlRenderingInfo()
|
obj = wx.html.HtmlRenderingInfo()
|
||||||
|
|
||||||
def test_htmlcell5(self):
|
def test_htmlcell5(self):
|
||||||
obj = wx.html.HtmlContainerCell(None)
|
obj = wx.html.HtmlContainerCell(None)
|
||||||
|
|
||||||
def test_htmlcell6(self):
|
def test_htmlcell6(self):
|
||||||
obj = wx.html.HtmlLinkInfo()
|
obj = wx.html.HtmlLinkInfo()
|
||||||
|
|
||||||
def test_htmlcell7(self):
|
def test_htmlcell7(self):
|
||||||
obj = wx.html.HtmlColourCell(wx.BLACK)
|
obj = wx.html.HtmlColourCell(wx.BLACK)
|
||||||
|
|
||||||
def test_htmlcell8(self):
|
def test_htmlcell8(self):
|
||||||
hw = wx.html.HtmlWindow(self.frame)
|
hw = wx.html.HtmlWindow(self.frame)
|
||||||
obj = wx.html.HtmlWidgetCell(hw)
|
obj = wx.html.HtmlWidgetCell(hw)
|
||||||
|
|
||||||
#---------------------------------------------------------------------------
|
#---------------------------------------------------------------------------
|
||||||
|
|
||||||
if __name__ == '__main__':
|
if __name__ == '__main__':
|
||||||
|
|||||||
@@ -37,36 +37,36 @@ class htmldefs_Tests(wtc.WidgetTestCase):
|
|||||||
wx.html.HTML_URL_PAGE
|
wx.html.HTML_URL_PAGE
|
||||||
wx.html.HTML_URL_IMAGE
|
wx.html.HTML_URL_IMAGE
|
||||||
wx.html.HTML_URL_OTHER
|
wx.html.HTML_URL_OTHER
|
||||||
|
|
||||||
wx.html.HTML_ALIGN_LEFT
|
|
||||||
wx.html.HTML_ALIGN_RIGHT
|
|
||||||
wx.html.HTML_ALIGN_JUSTIFY
|
|
||||||
wx.html.HTML_ALIGN_TOP
|
|
||||||
wx.html.HTML_ALIGN_BOTTOM
|
|
||||||
wx.html.HTML_ALIGN_CENTER
|
|
||||||
wx.html.HTML_CLR_FOREGROUND
|
|
||||||
wx.html.HTML_CLR_BACKGROUND
|
|
||||||
wx.html.HTML_CLR_TRANSPARENT_BACKGROUND
|
|
||||||
wx.html.HTML_UNITS_PIXELS
|
|
||||||
wx.html.HTML_UNITS_PERCENT
|
|
||||||
wx.html.HTML_INDENT_LEFT
|
|
||||||
wx.html.HTML_INDENT_RIGHT
|
|
||||||
wx.html.HTML_INDENT_TOP
|
|
||||||
wx.html.HTML_INDENT_BOTTOM
|
|
||||||
wx.html.HTML_INDENT_HORIZONTAL
|
|
||||||
wx.html.HTML_INDENT_VERTICAL
|
|
||||||
wx.html.HTML_INDENT_ALL
|
|
||||||
wx.html.HTML_COND_ISANCHOR
|
|
||||||
wx.html.HTML_COND_ISIMAGEMAP
|
|
||||||
wx.html.HTML_COND_USER
|
|
||||||
|
|
||||||
wx.html.HTML_FIND_EXACT
|
wx.html.HTML_ALIGN_LEFT
|
||||||
|
wx.html.HTML_ALIGN_RIGHT
|
||||||
|
wx.html.HTML_ALIGN_JUSTIFY
|
||||||
|
wx.html.HTML_ALIGN_TOP
|
||||||
|
wx.html.HTML_ALIGN_BOTTOM
|
||||||
|
wx.html.HTML_ALIGN_CENTER
|
||||||
|
wx.html.HTML_CLR_FOREGROUND
|
||||||
|
wx.html.HTML_CLR_BACKGROUND
|
||||||
|
wx.html.HTML_CLR_TRANSPARENT_BACKGROUND
|
||||||
|
wx.html.HTML_UNITS_PIXELS
|
||||||
|
wx.html.HTML_UNITS_PERCENT
|
||||||
|
wx.html.HTML_INDENT_LEFT
|
||||||
|
wx.html.HTML_INDENT_RIGHT
|
||||||
|
wx.html.HTML_INDENT_TOP
|
||||||
|
wx.html.HTML_INDENT_BOTTOM
|
||||||
|
wx.html.HTML_INDENT_HORIZONTAL
|
||||||
|
wx.html.HTML_INDENT_VERTICAL
|
||||||
|
wx.html.HTML_INDENT_ALL
|
||||||
|
wx.html.HTML_COND_ISANCHOR
|
||||||
|
wx.html.HTML_COND_ISIMAGEMAP
|
||||||
|
wx.html.HTML_COND_USER
|
||||||
|
|
||||||
|
wx.html.HTML_FIND_EXACT
|
||||||
wx.html.HTML_FIND_NEAREST_BEFORE
|
wx.html.HTML_FIND_NEAREST_BEFORE
|
||||||
wx.html.HTML_FIND_NEAREST_AFTER
|
wx.html.HTML_FIND_NEAREST_AFTER
|
||||||
wx.html.HTML_SCRIPT_NORMAL
|
wx.html.HTML_SCRIPT_NORMAL
|
||||||
wx.html.HTML_SCRIPT_SUB
|
wx.html.HTML_SCRIPT_SUB
|
||||||
wx.html.HTML_SCRIPT_SUP
|
wx.html.HTML_SCRIPT_SUP
|
||||||
|
|
||||||
#---------------------------------------------------------------------------
|
#---------------------------------------------------------------------------
|
||||||
|
|
||||||
if __name__ == '__main__':
|
if __name__ == '__main__':
|
||||||
|
|||||||
@@ -13,16 +13,16 @@ class htmllbox_Tests(wtc.WidgetTestCase):
|
|||||||
def test_htmllbox2(self):
|
def test_htmllbox2(self):
|
||||||
lb = wx.html.SimpleHtmlListBox()
|
lb = wx.html.SimpleHtmlListBox()
|
||||||
lb.Create(self.frame, choices=['one', 'two', 'three'])
|
lb.Create(self.frame, choices=['one', 'two', 'three'])
|
||||||
|
|
||||||
def test_htmllbox3(self):
|
def test_htmllbox3(self):
|
||||||
class MyHtmlListBox(wx.html.HtmlListBox):
|
class MyHtmlListBox(wx.html.HtmlListBox):
|
||||||
def OnGetItem(self, n):
|
def OnGetItem(self, n):
|
||||||
return 'this is item <b>%d</b>' % n
|
return 'this is item <b>%d</b>' % n
|
||||||
|
|
||||||
lb = MyHtmlListBox(self.frame)
|
lb = MyHtmlListBox(self.frame)
|
||||||
lb.SetItemCount(15)
|
lb.SetItemCount(15)
|
||||||
|
|
||||||
|
|
||||||
#---------------------------------------------------------------------------
|
#---------------------------------------------------------------------------
|
||||||
|
|
||||||
if __name__ == '__main__':
|
if __name__ == '__main__':
|
||||||
|
|||||||
@@ -12,17 +12,17 @@ class htmlpars_Tests(wtc.WidgetTestCase):
|
|||||||
def __init__(self):
|
def __init__(self):
|
||||||
wx.html.HtmlTagHandler.__init__(self)
|
wx.html.HtmlTagHandler.__init__(self)
|
||||||
self.test = None
|
self.test = None
|
||||||
|
|
||||||
def GetSupportedTags(self):
|
def GetSupportedTags(self):
|
||||||
return 'FOO,BAR'
|
return 'FOO,BAR'
|
||||||
|
|
||||||
def HandleTag(self, tag):
|
def HandleTag(self, tag):
|
||||||
self.test = tag.GetTagName()
|
self.test = tag.GetTagName()
|
||||||
|
|
||||||
wx.html.HtmlWinParser_AddTagHandler(myTagHandler)
|
wx.html.HtmlWinParser_AddTagHandler(myTagHandler)
|
||||||
self.myYield()
|
self.myYield()
|
||||||
|
|
||||||
|
|
||||||
#---------------------------------------------------------------------------
|
#---------------------------------------------------------------------------
|
||||||
|
|
||||||
if __name__ == '__main__':
|
if __name__ == '__main__':
|
||||||
|
|||||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user