diff --git a/unittests/lib_pubsub_provider_expect.py b/unittests/lib_pubsub_provider_expect.py index d3b87d2c..d1a55939 100644 --- a/unittests/lib_pubsub_provider_expect.py +++ b/unittests/lib_pubsub_provider_expect.py @@ -22,7 +22,7 @@ class test_import_export_no_change2: Sub topic 1 of root topic. Docs rely on one blank line for topic doc, and indentation for each argument doc. """ - + def msgDataSpec(arg1, arg2=None): """ - arg1: some multiline doc diff --git a/unittests/lib_pubsub_provider_my_import_topics.py b/unittests/lib_pubsub_provider_my_import_topics.py index d7dff4ec..965b6f26 100644 --- a/unittests/lib_pubsub_provider_my_import_topics.py +++ b/unittests/lib_pubsub_provider_my_import_topics.py @@ -1,14 +1,14 @@ class root_topic1: 'docs for root_topic1' - + def msgDataSpec(): pass - + class sub_topic11: 'docs for sub_topic11' - + class root_topic2: - 'docs for root_topic2' + 'docs for root_topic2' class sub_topic21: 'docs for sub_topic21' diff --git a/unittests/process_script.py b/unittests/process_script.py index 07f5e864..210b105a 100644 --- a/unittests/process_script.py +++ b/unittests/process_script.py @@ -5,5 +5,5 @@ if '--stdout' in sys.argv: if '--echo' in sys.argv: text = raw_input() print("I read '%s'" % text) - + sys.exit(0) diff --git a/unittests/test_aboutdlg.py b/unittests/test_aboutdlg.py index 32c7458d..3856a4cf 100644 --- a/unittests/test_aboutdlg.py +++ b/unittests/test_aboutdlg.py @@ -15,9 +15,9 @@ class aboutdlg_Tests(wtc.WidgetTestCase): info.SetDescription('This is a very goofy application') info.SetCopyright('(c) by Goofy Enterprises, Inc.') info.SetLicence('free-for-all') - return info + return info + - def test_aboutdlgNative(self): if not 'wxMSW' in wx.PlatformInfo: info = self._makeInfo() diff --git a/unittests/test_accel.py b/unittests/test_accel.py index 86f6b38a..ac4b6125 100644 --- a/unittests/test_accel.py +++ b/unittests/test_accel.py @@ -6,7 +6,7 @@ import wx class accel_Tests(wtc.WidgetTestCase): - + def test_accelFlags(self): wx.ACCEL_ALT wx.ACCEL_CTRL @@ -18,7 +18,7 @@ class accel_Tests(wtc.WidgetTestCase): def test_accelNullObj(self): wx.NullAcceleratorTable self.assertTrue( not wx.NullAcceleratorTable.IsOk() ) - + def test_accelEntry1(self): 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.GetKeyCode() == ord('A')) self.assertTrue(entry.GetCommand() == 123) - + def test_accelEntry2(self): entry = wx.AcceleratorEntry(wx.ACCEL_CTRL, ord('A'), 123) self.assertTrue(entry.IsOk()) self.assertTrue(entry.Flags == wx.ACCEL_CTRL) self.assertTrue(entry.KeyCode == ord('A')) self.assertTrue(entry.Command == 123) - - - + + + def test_accelTable1(self): tbl = wx.AcceleratorTable([ wx.AcceleratorEntry(wx.ACCEL_ALT, ord('X'), 123), 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) ]) self.frame.SetAcceleratorTable(tbl) - + def test_accelTable2(self): tbl = wx.AcceleratorTable([ (wx.ACCEL_ALT, ord('X'), 123), (wx.ACCEL_CTRL, ord('H'), 234), @@ -51,7 +51,7 @@ class accel_Tests(wtc.WidgetTestCase): (wx.ACCEL_NORMAL, wx.WXK_F3, 456) ]) self.frame.SetAcceleratorTable(tbl) - + #--------------------------------------------------------------------------- diff --git a/unittests/test_affinematrix2d.py b/unittests/test_affinematrix2d.py index 56d4e773..b928e133 100644 --- a/unittests/test_affinematrix2d.py +++ b/unittests/test_affinematrix2d.py @@ -14,8 +14,8 @@ class affinematrix2d_Tests(wtc.WidgetTestCase): self.assertTrue(len(values) == 2) self.assertTrue(isinstance(values[0], wx.Matrix2D)) self.assertTrue(isinstance(values[1], wx.Point2D)) - - + + #--------------------------------------------------------------------------- if __name__ == '__main__': diff --git a/unittests/test_animate.py b/unittests/test_animate.py index 1e75f31c..2283aebe 100644 --- a/unittests/test_animate.py +++ b/unittests/test_animate.py @@ -25,7 +25,7 @@ class animate_Tests(wtc.WidgetTestCase): anictrl = wx.adv.AnimationCtrl(self.frame, anim=ani) anictrl.Play() self.waitFor(500) - + #--------------------------------------------------------------------------- if __name__ == '__main__': diff --git a/unittests/test_app.py b/unittests/test_app.py index 981a6886..4cb5ffe9 100644 --- a/unittests/test_app.py +++ b/unittests/test_app.py @@ -7,10 +7,10 @@ import warnings #--------------------------------------------------------------------------- class App(unittest.TestCase): - + def test_App(self): app = wx.App() - + def test_App_OnInit(self): class MyApp(wx.App): def OnInit(self): @@ -36,13 +36,13 @@ class App(unittest.TestCase): app = MyApp() app.MainLoop() self.assertTrue(app.onExit_called) - + def test_version(self): v = wx.version() wx.VERSION wx.VERSION_STRING wx.__version__ - + def test_PySimpleApp(self): # wx.PySimpleApp is supposed to be deprecated, make sure it is. with warnings.catch_warnings(): @@ -50,7 +50,7 @@ class App(unittest.TestCase): with self.assertRaises(wx.wxPyDeprecationWarning): app = wx.PySimpleApp() - + def test_CallAfter(self): class MyApp(wx.App): def OnInit(self): @@ -62,11 +62,11 @@ class App(unittest.TestCase): def doAfter(self, a, b, c): self.callAfter_called = True self.frame.Close() - + app = MyApp() app.MainLoop() self.assertTrue(app.callAfter_called) - + #--------------------------------------------------------------------------- diff --git a/unittests/test_apptrait.py b/unittests/test_apptrait.py index 205f4a9a..9686dc5a 100644 --- a/unittests/test_apptrait.py +++ b/unittests/test_apptrait.py @@ -5,18 +5,18 @@ import wx #--------------------------------------------------------------------------- class AppTraitsTests(wtc.WidgetTestCase): - + def test_AppTraits(self): t = self.app.GetTraits() self.assertTrue(t is not None) - + v = t.GetToolkitVersion() self.assertTrue( len(v) == 3) - + t.HasStderr() t.IsUsingUniversalWidgets() - - + + #--------------------------------------------------------------------------- diff --git a/unittests/test_arrayint.py b/unittests/test_arrayint.py index 5201cb83..af27d3e6 100644 --- a/unittests/test_arrayint.py +++ b/unittests/test_arrayint.py @@ -5,7 +5,7 @@ import wx #--------------------------------------------------------------------------- class ArrayInt(unittest.TestCase): - + if hasattr(wx, 'testArrayIntTypemap'): def test_ArrayIntTypemaps(self): # 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 seqTuple = (1,2,3,4.5,6.7) self.assertEqual(wx.testArrayIntTypemap(seqTuple), [1,2,3,4,6]) - + def test_ArrayIntTypemapErrors(self): # test error conditions with self.assertRaises(TypeError): wx.testArrayIntTypemap([1,2,3, "baditem", ["listitem"]]) - + #--------------------------------------------------------------------------- diff --git a/unittests/test_arraystring.py b/unittests/test_arraystring.py index 4f250aa4..bb7a80c9 100644 --- a/unittests/test_arraystring.py +++ b/unittests/test_arraystring.py @@ -12,7 +12,7 @@ else: class ArrayString(unittest.TestCase): - + if hasattr(wx, 'testArrayStringTypemap'): def test_ArrayStringTypemaps(self): # 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']) seqTuple = ('a', alt('b'), 'hello world') self.assertEqual(wx.testArrayStringTypemap(seqTuple), ['a', 'b', 'hello world']) - + def test_ArrayStringTypemapErrors(self): # test error conditions with self.assertRaises(TypeError): @@ -29,7 +29,7 @@ class ArrayString(unittest.TestCase): wx.testArrayStringTypemap(alt("ALT sequence")) with self.assertRaises(TypeError): wx.testArrayStringTypemap(["list", "with", "non-string", "items", 123]) - + #--------------------------------------------------------------------------- diff --git a/unittests/test_artprov.py b/unittests/test_artprov.py index 106e6327..777bf624 100644 --- a/unittests/test_artprov.py +++ b/unittests/test_artprov.py @@ -16,66 +16,66 @@ class artprov_Tests(wtc.WidgetTestCase): wx.ART_BUTTON wx.ART_LIST wx.ART_OTHER - wx.ART_ADD_BOOKMARK - wx.ART_DEL_BOOKMARK - wx.ART_HELP_SIDE_PANEL - wx.ART_HELP_SETTINGS - wx.ART_HELP_BOOK - wx.ART_HELP_FOLDER - wx.ART_HELP_PAGE - wx.ART_GO_BACK - wx.ART_GO_FORWARD - wx.ART_GO_UP - wx.ART_GO_DOWN - wx.ART_GO_TO_PARENT - wx.ART_GO_HOME - wx.ART_GOTO_FIRST - wx.ART_GOTO_LAST - wx.ART_FILE_OPEN - wx.ART_FILE_SAVE - wx.ART_FILE_SAVE_AS - wx.ART_PRINT - wx.ART_HELP - wx.ART_TIP - wx.ART_REPORT_VIEW - wx.ART_LIST_VIEW - wx.ART_NEW_DIR - wx.ART_HARDDISK - wx.ART_FLOPPY - wx.ART_CDROM - wx.ART_REMOVABLE - wx.ART_FOLDER - wx.ART_FOLDER_OPEN - wx.ART_GO_DIR_UP - wx.ART_EXECUTABLE_FILE - wx.ART_NORMAL_FILE - wx.ART_TICK_MARK - wx.ART_CROSS_MARK - wx.ART_ERROR - wx.ART_QUESTION - wx.ART_WARNING - wx.ART_INFORMATION - wx.ART_MISSING_IMAGE - wx.ART_COPY - wx.ART_CUT - wx.ART_PASTE - wx.ART_DELETE - wx.ART_NEW - wx.ART_UNDO - wx.ART_REDO - wx.ART_PLUS - wx.ART_MINUS - wx.ART_CLOSE - wx.ART_QUIT - wx.ART_FIND - wx.ART_FIND_AND_REPLACE - - + wx.ART_ADD_BOOKMARK + wx.ART_DEL_BOOKMARK + wx.ART_HELP_SIDE_PANEL + wx.ART_HELP_SETTINGS + wx.ART_HELP_BOOK + wx.ART_HELP_FOLDER + wx.ART_HELP_PAGE + wx.ART_GO_BACK + wx.ART_GO_FORWARD + wx.ART_GO_UP + wx.ART_GO_DOWN + wx.ART_GO_TO_PARENT + wx.ART_GO_HOME + wx.ART_GOTO_FIRST + wx.ART_GOTO_LAST + wx.ART_FILE_OPEN + wx.ART_FILE_SAVE + wx.ART_FILE_SAVE_AS + wx.ART_PRINT + wx.ART_HELP + wx.ART_TIP + wx.ART_REPORT_VIEW + wx.ART_LIST_VIEW + wx.ART_NEW_DIR + wx.ART_HARDDISK + wx.ART_FLOPPY + wx.ART_CDROM + wx.ART_REMOVABLE + wx.ART_FOLDER + wx.ART_FOLDER_OPEN + wx.ART_GO_DIR_UP + wx.ART_EXECUTABLE_FILE + wx.ART_NORMAL_FILE + wx.ART_TICK_MARK + wx.ART_CROSS_MARK + wx.ART_ERROR + wx.ART_QUESTION + wx.ART_WARNING + wx.ART_INFORMATION + wx.ART_MISSING_IMAGE + wx.ART_COPY + wx.ART_CUT + wx.ART_PASTE + wx.ART_DELETE + wx.ART_NEW + wx.ART_UNDO + wx.ART_REDO + wx.ART_PLUS + wx.ART_MINUS + wx.ART_CLOSE + wx.ART_QUIT + wx.ART_FIND + wx.ART_FIND_AND_REPLACE + + def test_artprovGetBitmap(self): bmp = wx.ArtProvider.GetBitmap(wx.ART_QUESTION, wx.ART_TOOLBAR) self.assertTrue(isinstance(bmp, wx.Bitmap)) - + #--------------------------------------------------------------------------- if __name__ == '__main__': diff --git a/unittests/test_asserts.py b/unittests/test_asserts.py index 94cdcda3..f062c630 100644 --- a/unittests/test_asserts.py +++ b/unittests/test_asserts.py @@ -34,8 +34,8 @@ class asserts_Tests(wtc.WidgetTestCase): wx.GetApp().SetAssertMode(wx.APP_ASSERT_EXCEPTION) with self.assertRaises(wx.wxAssertionError): wx.NullBitmap.ConvertToImage() - - + + #--------------------------------------------------------------------------- diff --git a/unittests/test_bannerwindow.py b/unittests/test_bannerwindow.py index b83e264d..399f5825 100644 --- a/unittests/test_bannerwindow.py +++ b/unittests/test_bannerwindow.py @@ -13,13 +13,13 @@ class bannerwindow_Tests(wtc.WidgetTestCase): def test_bannerwindow1(self): banner = wx.adv.BannerWindow(self.frame, dir=wx.LEFT) banner.SetBitmap(wx.Bitmap(pngFile)) - + def test_bannerwindow2(self): banner = wx.adv.BannerWindow(self.frame, dir=wx.LEFT) banner.SetText('Message Title', 'The message itself: blah, blah, blah') banner.SetGradient('white', 'blue') - - + + #--------------------------------------------------------------------------- if __name__ == '__main__': diff --git a/unittests/test_bitmap.py b/unittests/test_bitmap.py index dd141174..1f9aba32 100644 --- a/unittests/test_bitmap.py +++ b/unittests/test_bitmap.py @@ -15,7 +15,7 @@ def makeBuf(w, h, bpp=1, init=0): class BitmapTests(wtc.WidgetTestCase): - + def test_BitmapCtor1(self): b1 = wx.Bitmap() self.assertTrue( not b1.IsOk() ) @@ -46,13 +46,13 @@ class BitmapTests(wtc.WidgetTestCase): # wx.EmptyBitmap is supposed to be deprecated, make sure it is. import warnings with warnings.catch_warnings(): - warnings.simplefilter("error") + warnings.simplefilter("error") with self.assertRaises(wx.wxPyDeprecationWarning): b7 = wx.EmptyBitmap(5,10, 32) self.assertTrue( b7.IsOk() ) - - - + + + def test_Bitmap__nonzero__(self): b1 = wx.Bitmap() self.assertTrue( not b1.IsOk() ) @@ -73,19 +73,19 @@ class BitmapTests(wtc.WidgetTestCase): nzcheck = True self.assertTrue(nzcheck) - + def test_BitmapNullBitmap(self): # just make sure this one exists wx.NullBitmap self.assertTrue(not wx.NullBitmap.IsOk()) - + def test_BitmapSetMaskColour(self): b5 = wx.Bitmap(pngFile) b5.SetMaskColour(wx.Colour(1,2,3)) b5.SetMaskColour('black') - - + + def test_BitmapMask(self): img = wx.Image(pngFile) img = img.ConvertToMono(0,0,0) @@ -93,8 +93,8 @@ class BitmapTests(wtc.WidgetTestCase): m = wx.Mask() m = wx.Mask(bmp) m = wx.Mask(bmp, wx.Colour(1,2,3)) - - + + @unittest.skipIf('wxGTK' in wx.PlatformInfo, 'wxMask constructor using palette index not supported on wxGTK') def test_BitmapMaskWithPalette(self): img = wx.Image(pngFile) @@ -111,7 +111,7 @@ class BitmapTests(wtc.WidgetTestCase): wx.BitmapBufferFormat_RGBA wx.BitmapBufferFormat_RGB32 wx.BitmapBufferFormat_ARGB32 - + def test_bitmapSetSize(self): b1 = wx.Bitmap(1,1) b1.SetSize((20,30)) @@ -119,57 +119,57 @@ class BitmapTests(wtc.WidgetTestCase): self.assertTrue(b1.Size == (20,30)) b1.Size = (25,35) self.assertTrue(b1.GetSize() == (25,35)) - + def test_bitmapHandle(self): b1 = wx.Bitmap(1,1) b1.Handle b1.GetHandle() - - + + def test_bitmapCopyFromBuffer1(self): w = h = 10 buf = makeBuf(w,h,3) bmp = wx.Bitmap(w,h,24) bmp.CopyFromBuffer(buf, wx.BitmapBufferFormat_RGB) - + def test_bitmapCopyFromBuffer2(self): w = h = 10 buf = makeBuf(w,h,4) bmp = wx.Bitmap(w,h,32) bmp.CopyFromBuffer(buf, wx.BitmapBufferFormat_RGBA) - + def test_bitmapCopyFromBuffer3(self): w = h = 10 buf = makeBuf(w,h,4) bmp = wx.Bitmap(w,h,32) bmp.CopyFromBuffer(buf, wx.BitmapBufferFormat_ARGB32) - - + + def test_bitmapCopyToBuffer1(self): w = h = 10 buf = makeBuf(w,h,3) bmp = wx.Bitmap(w,h,24) bmp.CopyToBuffer(buf, wx.BitmapBufferFormat_RGB) - + def test_bitmapCopyToBuffer2(self): w = h = 10 buf = makeBuf(w,h,4) bmp = wx.Bitmap(w,h,32) bmp.CopyToBuffer(buf, wx.BitmapBufferFormat_RGBA) - + def test_bitmapCopyToBuffer3(self): w = h = 10 buf = makeBuf(w,h,4) bmp = wx.Bitmap(w,h,32) bmp.CopyToBuffer(buf, wx.BitmapBufferFormat_ARGB32) - - + + def test_bitmapBufferFactory1(self): w = h = 10 buf = makeBuf(w,h,3, 111) bmp = wx.Bitmap.FromBuffer(w, h, buf) self.assertTrue(bmp.IsOk()) - + def test_bitmapBufferFactory2(self): w = h = 10 buf = makeBuf(w,h,3, 111) @@ -205,7 +205,7 @@ class BitmapTests(wtc.WidgetTestCase): bmp = wx.Bitmap.FromBuffer(w, h, buf) self.assertTrue(bmp.IsOk()) 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) ) @@ -220,7 +220,7 @@ class BitmapTests(wtc.WidgetTestCase): self.assertTrue(bmp.IsOk()) - + #--------------------------------------------------------------------------- diff --git a/unittests/test_bmpbuttn.py b/unittests/test_bmpbuttn.py index 47e84d5d..ea8db33d 100644 --- a/unittests/test_bmpbuttn.py +++ b/unittests/test_bmpbuttn.py @@ -8,19 +8,19 @@ pngFile = os.path.join(os.path.dirname(__file__), 'toucan.png') #--------------------------------------------------------------------------- class BitmapButtonTests(wtc.WidgetTestCase): - + def test_BitmapButtonCtor(self): bmp = wx.Bitmap(pngFile) btn = wx.BitmapButton(self.frame, -1, bmp) - + def test_BitmapButtonDefaultCtor(self): bmp = wx.Bitmap(pngFile) btn = wx.BitmapButton() btn.Create(self.frame, -1, bmp) - - - + + + #--------------------------------------------------------------------------- diff --git a/unittests/test_bmpcbox.py b/unittests/test_bmpcbox.py index fe687741..fead671c 100644 --- a/unittests/test_bmpcbox.py +++ b/unittests/test_bmpcbox.py @@ -16,33 +16,33 @@ class bmpcbox_Tests(wtc.WidgetTestCase): def test_bmpcbox1(self): pnl = wx.Panel(self.frame) - + bcb = wx.adv.BitmapComboBox(pnl) for idx, name in enumerate(imgFiles): bmp = wx.Bitmap(name) bcb.Append(os.path.basename(name), bmp) - + bcb.GetItemBitmap(0) bcb.SetItemBitmap(0, wx.NullBitmap) - + bcb.SetClientObject(2, "Hello") self.assertEqual(bcb.GetClientObject(2), "Hello") - + bcb.SetClientData(2, "Bye") self.assertEqual(bcb.GetClientData(2), "Bye") def test_bmpcbox2(self): pnl = wx.Panel(self.frame) - + bcb = wx.adv.BitmapComboBox(pnl) for idx, name in enumerate(imgFiles): bmp = wx.Bitmap(name) bcb.Append(os.path.basename(name), bmp, str(idx)) - + self.assertEqual(bcb.GetClientData(2), "2") - - + + #--------------------------------------------------------------------------- if __name__ == '__main__': diff --git a/unittests/test_bookctrl.py b/unittests/test_bookctrl.py index 889c9c28..d6849abc 100644 --- a/unittests/test_bookctrl.py +++ b/unittests/test_bookctrl.py @@ -8,15 +8,15 @@ class panel_Tests(wtc.WidgetTestCase): def test_bookctrl1(self): wx.BK_DEFAULT - wx.BK_TOP - wx.BK_BOTTOM - wx.BK_LEFT - wx.BK_RIGHT + wx.BK_TOP + wx.BK_BOTTOM + wx.BK_LEFT + wx.BK_RIGHT wx.BK_HITTEST_NOWHERE - wx.BK_HITTEST_ONICON + wx.BK_HITTEST_ONICON wx.BK_HITTEST_ONLABEL - wx.BK_HITTEST_ONITEM - wx.BK_HITTEST_ONPAGE + wx.BK_HITTEST_ONITEM + wx.BK_HITTEST_ONPAGE def test_bookctrl2(self): @@ -26,8 +26,8 @@ class panel_Tests(wtc.WidgetTestCase): wx.wxEVT_COMMAND_BOOKCTRL_PAGE_CHANGING wx.EVT_BOOKCTRL_PAGE_CHANGED wx.EVT_BOOKCTRL_PAGE_CHANGING - - + + #--------------------------------------------------------------------------- diff --git a/unittests/test_brush.py b/unittests/test_brush.py index 1b2e334f..6f19e0ec 100644 --- a/unittests/test_brush.py +++ b/unittests/test_brush.py @@ -8,48 +8,48 @@ pngFile = os.path.join(os.path.dirname(__file__), 'toucan.png') #--------------------------------------------------------------------------- class BrushTests(wtc.WidgetTestCase): - + def test_BrushCtors(self): b = wx.Brush() b = wx.Brush(wx.Colour(1,2,3), wx.BRUSHSTYLE_SOLID) bmp = wx.Bitmap(pngFile) b = wx.Brush(bmp) copy = wx.Brush(b) - - + + def test_BrushOperators(self): b1 = wx.Brush(wx.Colour(1,2,3), wx.BRUSHSTYLE_SOLID) b2 = wx.Brush(wx.Colour(1,2,3), wx.BRUSHSTYLE_SOLID) b3 = wx.Brush(wx.Colour(4,5,6), wx.BRUSHSTYLE_SOLID) - + self.assertTrue(b1 == b2) self.assertTrue(b2 != b3) self.assertFalse(b1 != b2) self.assertFalse(b2 == b3) - - + + def test_nonzero(self): b = wx.Brush(wx.Colour(1,2,3), wx.BRUSHSTYLE_SOLID) if not b: self.fail("__nonzero__ should have avoided this branch") if wx.NullBrush: self.fail("__nonzero__ should have avoided this branch") - - + + def test_StockBrushesExist(self): wx.BLUE_BRUSH - wx.GREEN_BRUSH + wx.GREEN_BRUSH wx.YELLOW_BRUSH wx.WHITE_BRUSH wx.BLACK_BRUSH - wx.GREY_BRUSH - wx.MEDIUM_GREY_BRUSH + wx.GREY_BRUSH + wx.MEDIUM_GREY_BRUSH wx.LIGHT_GREY_BRUSH wx.TRANSPARENT_BRUSH wx.CYAN_BRUSH wx.RED_BRUSH wx.NullBrush - + def test_StockBrushesInitialized(self): self.assertTrue(wx.BLUE_BRUSH.IsOk()) @@ -57,7 +57,7 @@ class BrushTests(wtc.WidgetTestCase): self.assertTrue(wx.YELLOW_BRUSH.IsOk()) self.assertTrue(wx.WHITE_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.LIGHT_GREY_BRUSH.IsOk()) self.assertTrue(wx.TRANSPARENT_BRUSH.IsOk()) @@ -68,8 +68,8 @@ class BrushTests(wtc.WidgetTestCase): def test_brushOldStyleNames(self): b = wx.Brush(wx.RED, wx.SOLID) - - + + #--------------------------------------------------------------------------- diff --git a/unittests/test_busyinfo.py b/unittests/test_busyinfo.py index 52be5274..042628d8 100644 --- a/unittests/test_busyinfo.py +++ b/unittests/test_busyinfo.py @@ -10,8 +10,8 @@ class busyinfo_Tests(wtc.WidgetTestCase): busy = wx.BusyInfo('This is a busy info message') self.waitFor(250) del busy - - + + #--------------------------------------------------------------------------- if __name__ == '__main__': diff --git a/unittests/test_button.py b/unittests/test_button.py index ebb832cf..77e7b5e9 100644 --- a/unittests/test_button.py +++ b/unittests/test_button.py @@ -8,7 +8,7 @@ pngFile = os.path.join(os.path.dirname(__file__), 'toucan.png') #--------------------------------------------------------------------------- class ButtonTests(wtc.WidgetTestCase): - + def test_ButtonCtors(self): btn = wx.Button(self.frame, label='label') btn = wx.Button(self.frame, -1, 'label', (10,10), (100,-1), wx.BU_LEFT) @@ -17,7 +17,7 @@ class ButtonTests(wtc.WidgetTestCase): def test_ButtonProperties(self): btn = wx.Button(self.frame, label='label') - + # do the properties exist? btn.AuthNeeded btn.Bitmap @@ -28,14 +28,14 @@ class ButtonTests(wtc.WidgetTestCase): btn.BitmapMargins btn.BitmapPressed btn.Label - - + + def test_ButtonDefaultCtor(self): btn = wx.Button() btn.Create(self.frame, -1, 'button label') - - - + + + #--------------------------------------------------------------------------- diff --git a/unittests/test_calctrl.py b/unittests/test_calctrl.py index f382d2e5..4b7ce3d5 100644 --- a/unittests/test_calctrl.py +++ b/unittests/test_calctrl.py @@ -10,7 +10,7 @@ class calctrl_Tests(wtc.WidgetTestCase): def test_calctrl1(self): evt = wx.adv.CalendarEvent() attr = wx.adv.CalendarDateAttr() - + wx.adv.CAL_SUNDAY_FIRST wx.adv.CAL_MONDAY_FIRST wx.adv.CAL_SHOW_HOLIDAYS @@ -19,20 +19,20 @@ class calctrl_Tests(wtc.WidgetTestCase): wx.adv.CAL_SEQUENTIAL_MONTH_SELECTION wx.adv.CAL_SHOW_SURROUNDING_WEEKS wx.adv.CAL_SHOW_WEEK_NUMBERS - + wx.adv.CAL_HITTEST_NOWHERE - wx.adv.CAL_HITTEST_HEADER - wx.adv.CAL_HITTEST_DAY + wx.adv.CAL_HITTEST_HEADER + wx.adv.CAL_HITTEST_DAY wx.adv.CAL_HITTEST_INCMONTH wx.adv.CAL_HITTEST_DECMONTH wx.adv.CAL_HITTEST_SURROUNDING_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): cal = wx.adv.CalendarCtrl(self.frame, date=wx.DateTime.Today()) @@ -40,8 +40,8 @@ class calctrl_Tests(wtc.WidgetTestCase): def test_calctrl3(self): cal = wx.adv.CalendarCtrl() cal.Create(self.frame, date=wx.DateTime.Today()) - - + + def test_genericcalctrl2(self): cal = wx.adv.GenericCalendarCtrl(self.frame, date=wx.DateTime.Today()) @@ -49,9 +49,9 @@ class calctrl_Tests(wtc.WidgetTestCase): def test_genericcalctrl3(self): cal = wx.adv.GenericCalendarCtrl() cal.Create(self.frame, date=wx.DateTime.Today()) - - - + + + #--------------------------------------------------------------------------- if __name__ == '__main__': diff --git a/unittests/test_caret.py b/unittests/test_caret.py index 1778da96..f4c6ad6c 100644 --- a/unittests/test_caret.py +++ b/unittests/test_caret.py @@ -14,7 +14,7 @@ class caret_Tests(wtc.WidgetTestCase): c.Move((50,50)) c.Show() self.waitFor(300) - + def test_caret2(self): pnl = wx.Window(self.frame) c = wx.Caret() @@ -24,8 +24,8 @@ class caret_Tests(wtc.WidgetTestCase): c.Move(50,50) c.Show() self.waitFor(300) - - + + #--------------------------------------------------------------------------- if __name__ == '__main__': diff --git a/unittests/test_checkbox.py b/unittests/test_checkbox.py index 94d4c042..d6f122ac 100644 --- a/unittests/test_checkbox.py +++ b/unittests/test_checkbox.py @@ -5,18 +5,18 @@ import wx #--------------------------------------------------------------------------- class checkbox_Tests(wtc.WidgetTestCase): - + def test_checkboxCtors(self): 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): c = wx.CheckBox() c.Create(self.frame, label="checkbox") - - + + #--------------------------------------------------------------------------- diff --git a/unittests/test_checklst.py b/unittests/test_checklst.py index e8279140..90687505 100644 --- a/unittests/test_checklst.py +++ b/unittests/test_checklst.py @@ -5,13 +5,13 @@ import wx #--------------------------------------------------------------------------- class CheckListBoxTests(wtc.WidgetTestCase): - + def test_CheckBoxCtors(self): 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), - "one two three four".split(),) - - + "one two three four".split(),) + + def test_CheckListBoxDefaultCtor(self): c = wx.CheckListBox() 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.SetChecked)) self.assertTrue(callable(c.SetCheckedStrings)) - + def test_pyMethods2(self): c = wx.CheckListBox(self.frame, choices="one two three four".split()) c.SetCheckedItems([1,3]) @@ -30,7 +30,7 @@ class CheckListBoxTests(wtc.WidgetTestCase): c.SetCheckedStrings(['one', 'two']) self.assertTrue(set(c.GetCheckedStrings()) == set(['one', 'two'])) self.assertTrue(set(c.GetCheckedItems()) == set([0,1])) - + def test_pyProperties(self): c = wx.CheckListBox(self.frame, choices="one two three four".split()) c.SetCheckedItems([1,3]) @@ -38,14 +38,14 @@ class CheckListBoxTests(wtc.WidgetTestCase): c.CheckedItems = [2] self.assertTrue(set(c.CheckedItems) == set([2])) - + c.SetCheckedStrings(['one', 'two']) self.assertTrue(set(c.CheckedStrings) == set(['one', 'two'])) - c.CheckedStrings = ['three'] + c.CheckedStrings = ['three'] self.assertTrue(set(c.GetCheckedItems()) == set([2])) - - + + #--------------------------------------------------------------------------- diff --git a/unittests/test_choicdlg.py b/unittests/test_choicdlg.py index 3a60c110..e1208bfe 100644 --- a/unittests/test_choicdlg.py +++ b/unittests/test_choicdlg.py @@ -11,11 +11,11 @@ class choicdlg_Tests(wtc.WidgetTestCase): choices="one two three four five".split()) d.SetSelection(2) d.Destroy() - + def test_choicdlgSingleFunc(self): wx.GetSingleChoice - - + + def test_choicdlgMulti(self): d = wx.MultiChoiceDialog(self.frame, 'message', 'caption', choices="one two three four five".split()) @@ -23,8 +23,8 @@ class choicdlg_Tests(wtc.WidgetTestCase): s = d.GetSelections() #self.assertEqual(s, [2,4]) the internal list isn't updated right away, can't test this here d.Destroy() - - + + #--------------------------------------------------------------------------- if __name__ == '__main__': diff --git a/unittests/test_choice.py b/unittests/test_choice.py index b41846c2..dd9ee3aa 100644 --- a/unittests/test_choice.py +++ b/unittests/test_choice.py @@ -5,31 +5,31 @@ import wx #--------------------------------------------------------------------------- class ChoiceTests(wtc.WidgetTestCase): - + def test_ChoiceCtors(self): c = wx.Choice(self.frame, choices="one two three four".split()) - c = wx.Choice(self.frame, -1, wx.Point(10,10), wx.Size(80,-1), + c = wx.Choice(self.frame, -1, wx.Point(10,10), wx.Size(80,-1), "one two three four".split(), 0) c = wx.Choice(self.frame, -1, (10,10), (80,-1), "one two three four".split(), 0) - + self.assertTrue(c.GetCount() == 4) - - + + def test_ChoiceDefaultCtor(self): c = wx.Choice() c.Create(self.frame, choices="one two three four".split()) - + def test_ChoiceProperties(self): c = wx.Choice(self.frame, choices="one two three four".split()) - + # do the properties exist? c.Columns c.Count c.CurrentSelection c.Selection - - + + #--------------------------------------------------------------------------- diff --git a/unittests/test_choicebk.py b/unittests/test_choicebk.py index 4e59ff71..fdde2ac7 100644 --- a/unittests/test_choicebk.py +++ b/unittests/test_choicebk.py @@ -7,30 +7,30 @@ import wx class choicebk_Tests(wtc.WidgetTestCase): def test_choicebk1(self): - wx.CHB_DEFAULT - wx.CHB_TOP - wx.CHB_BOTTOM - wx.CHB_LEFT - wx.CHB_RIGHT + wx.CHB_DEFAULT + wx.CHB_TOP + wx.CHB_BOTTOM + wx.CHB_LEFT + wx.CHB_RIGHT wx.CHB_ALIGN_MASK wx.wxEVT_COMMAND_CHOICEBOOK_PAGE_CHANGED wx.wxEVT_COMMAND_CHOICEBOOK_PAGE_CHANGING wx.EVT_CHOICEBOOK_PAGE_CHANGED wx.EVT_CHOICEBOOK_PAGE_CHANGING - + def test_choicebk2(self): book = wx.Choicebook() book.Create(self.frame) - - + + def test_choicebk3(self): book = wx.Choicebook(self.frame) book.AddPage(wx.Panel(book), 'one') book.AddPage(wx.Panel(book), 'two') - - + + #--------------------------------------------------------------------------- if __name__ == '__main__': diff --git a/unittests/test_clipbrd.py b/unittests/test_clipbrd.py index f4415ac6..3819eea4 100644 --- a/unittests/test_clipbrd.py +++ b/unittests/test_clipbrd.py @@ -12,33 +12,33 @@ class clipbrd_Tests(wtc.WidgetTestCase): if wx.TheClipboard.Open(): wx.TheClipboard.SetData(data1) wx.TheClipboard.Close() - - # paste + + # paste data2 = wx.TextDataObject() if wx.TheClipboard.Open(): wx.TheClipboard.GetData(data2) wx.TheClipboard.Close() - + self.assertEqual(data2.GetText(), 'This is some data.') self.assertEqual(data2.Text, 'This is some data.') - - + + def test_clpbrd2(self): # same, but with the context manager - + # copy data1 = wx.TextDataObject('This is some data.') with wx.TheClipboard as cb: cb.SetData(data1) - - # paste + + # paste data2 = wx.TextDataObject() with wx.TheClipboard as cb: wx.TheClipboard.GetData(data2) - + self.assertEqual(data2.GetText(), 'This is some data.') self.assertEqual(data2.Text, 'This is some data.') - + #--------------------------------------------------------------------------- if __name__ == '__main__': diff --git a/unittests/test_clntdatactnr.py b/unittests/test_clntdatactnr.py index 70359d0a..b3461e4d 100644 --- a/unittests/test_clntdatactnr.py +++ b/unittests/test_clntdatactnr.py @@ -11,8 +11,8 @@ class clntdatactnr_Tests(wtc.WidgetTestCase): data.SetClientData("This is a test") val = data.GetClientData() self.assertEqual(val, "This is a test") - - + + #--------------------------------------------------------------------------- if __name__ == '__main__': diff --git a/unittests/test_cmdproc.py b/unittests/test_cmdproc.py index 01cc8b37..1e204f46 100644 --- a/unittests/test_cmdproc.py +++ b/unittests/test_cmdproc.py @@ -16,10 +16,10 @@ class cmdproc_Tests(wtc.WidgetTestCase): return True def Undo(self): return True - + cmd = MyCommand(name='TestCommand') - - + + def test_cmdproc3(self): class MyCommand(wx.Command): def __init__(self, *args, **kw): @@ -33,34 +33,34 @@ class cmdproc_Tests(wtc.WidgetTestCase): return True def CanUndo(self): return True - + cmdproc = wx.CommandProcessor() for name in 'one two three four five'.split(): cmd = MyCommand(name=name) cmdproc.Submit(cmd) - + cmds = cmdproc.GetCommands() self.assertEqual(len(cmds), 5) self.assertEqual([x.value for x in cmds], [True]*5) self.assertTrue(cmdproc.CanUndo()) self.assertFalse(cmdproc.CanRedo()) - + cmdproc.Undo() cmdproc.Undo() self.assertEqual([x.value for x in cmds], [True]*3 + [False]*2) - + self.assertTrue(cmdproc.CanRedo()) cmdproc.Redo() cmdproc.Redo() self.assertEqual([x.value for x in cmds], [True]*5) - + cmdproc.Undo() cmdproc.Undo() cmdproc.Submit(MyCommand(name='NewCmd')) self.assertEqual(len(cmds), 4) - - + + #--------------------------------------------------------------------------- if __name__ == '__main__': diff --git a/unittests/test_cmndata.py b/unittests/test_cmndata.py index c09ea859..d2435261 100644 --- a/unittests/test_cmndata.py +++ b/unittests/test_cmndata.py @@ -6,27 +6,27 @@ import six #--------------------------------------------------------------------------- class cmndata_tests(wtc.WidgetTestCase): - + def test_cmndataClassConstructors(self): psdd1 = wx.PageSetupDialogData() pd1 = wx.PrintData() pdd1 = wx.PrintDialogData() - + psdd2 = wx.PageSetupDialogData(pd1) psdd3 = wx.PageSetupDialogData(psdd2) - + pd2 = wx.PrintData(pd1) - + pdd2 = wx.PrintDialogData(pdd1) pdd3 = wx.PrintDialogData(pd1) - - - + + + def test_cppMethods(self): pd = wx.PrintData() data = pd.GetPrivData() pd.SetPrivData(data) - + # property for the same methods data = pd.PrivData pd.PrivData = data @@ -36,7 +36,7 @@ class cmndata_tests(wtc.WidgetTestCase): psdd = wx.PageSetupDialogData() pd = wx.PrintData() pdd = wx.PrintDialogData() - + if six.PY3: psdd.__bool__() pd.__bool__() @@ -45,7 +45,7 @@ class cmndata_tests(wtc.WidgetTestCase): psdd.__nonzero__() pd.__nonzero__() pdd.__nonzero__() - + #--------------------------------------------------------------------------- diff --git a/unittests/test_collpane.py b/unittests/test_collpane.py index 43aa3d96..e55bf035 100644 --- a/unittests/test_collpane.py +++ b/unittests/test_collpane.py @@ -5,29 +5,29 @@ import wx #--------------------------------------------------------------------------- class CollapsiblePaneTests(wtc.WidgetTestCase): - + def test_CollPaneCtors(self): c = wx.CollapsiblePane(self.frame, label='label') c = wx.CollapsiblePane(self.frame, -1, 'label', (12, 34), (45, 67)) - + c.Collapse() c.Expand() c.IsCollapsed() c.IsExpanded() - - + + def test_CollPaneDefaultCtor(self): c = wx.CollapsiblePane() c.Create(self.frame) - + def test_CollPaneProperties(self): c = wx.CollapsiblePane(self.frame) - + # do the properties exist? c.Pane - - + + #--------------------------------------------------------------------------- diff --git a/unittests/test_colordlg.py b/unittests/test_colordlg.py index cecd671f..3fcaef9f 100644 --- a/unittests/test_colordlg.py +++ b/unittests/test_colordlg.py @@ -10,11 +10,11 @@ class colordlg_Tests(wtc.WidgetTestCase): data = wx.ColourData() dlg = wx.ColourDialog(self.frame, data) dlg.Destroy() - + def test_colordlg2(self): wx.GetColourFromUser - - + + #--------------------------------------------------------------------------- if __name__ == '__main__': diff --git a/unittests/test_colour.py b/unittests/test_colour.py index 3dffa44e..5ad7bd87 100644 --- a/unittests/test_colour.py +++ b/unittests/test_colour.py @@ -5,23 +5,23 @@ from unittests import wtc #--------------------------------------------------------------------------- class Colour(wtc.WidgetTestCase): - + def test_default_ctor(self): c = wx.Colour() self.assertTrue(not c.IsOk()) self.assertTrue(c.Get() == (-1,-1,-1,255)) - + def test_rgb_ctor(self): c = wx.Colour(1,2,3) self.assertTrue(c.Get(False) == (1,2,3)) - + def test_rgba_ctor(self): c = wx.Colour(1,2,3,4) self.assertTrue(c.Get() == (1,2,3,4)) - + def test_copy_ctor(self): c1 = wx.Colour(1,2,3,4) c2 = wx.Colour(c1) @@ -33,8 +33,8 @@ class Colour(wtc.WidgetTestCase): def test_GetPixel(self): c1 = wx.Colour(1,2,3,4) p = c1.GetPixel() - - + + if hasattr(wx, 'testColourTypeMap'): def test_ColourTypemaps(self): c = wx.testColourTypeMap('red') @@ -51,8 +51,8 @@ class Colour(wtc.WidgetTestCase): self.assertTrue(c.Get() == (1, 2, 3, 0xff)) c = wx.testColourTypeMap( (1,2,3,4) ) self.assertTrue(c.Get() == (1, 2, 3, 4)) - - + + #--------------------------------------------------------------------------- diff --git a/unittests/test_combo.py b/unittests/test_combo.py index a3266904..039357c2 100644 --- a/unittests/test_combo.py +++ b/unittests/test_combo.py @@ -10,7 +10,7 @@ class combo_Tests(wtc.WidgetTestCase): def test_comboConstants(self): wx.CC_SPECIAL_DCLICK wx.CC_STD_BUTTON - + wx.ComboCtrlFeatures wx.ComboCtrlFeatures.MovableButton wx.ComboCtrlFeatures.BitmapButton @@ -20,8 +20,8 @@ class combo_Tests(wtc.WidgetTestCase): wx.ComboCtrlFeatures.PaintWritable wx.ComboCtrlFeatures.Borderless wx.ComboCtrlFeatures.All - - + + def test_combo1(self): ns = self.execSample('combo/combo1.py') frame = ns.TestFrame(self.frame) @@ -29,9 +29,9 @@ class combo_Tests(wtc.WidgetTestCase): frame.cc.SetValueByUser('Item-25') self.waitFor(100) frame.cc.Popup() - self.waitFor(100) + self.waitFor(100) frame.Close() - + #--------------------------------------------------------------------------- diff --git a/unittests/test_combobox.py b/unittests/test_combobox.py index 6c1308ca..9cb77e8b 100644 --- a/unittests/test_combobox.py +++ b/unittests/test_combobox.py @@ -5,16 +5,16 @@ import wx #--------------------------------------------------------------------------- class ComboBoxTests(wtc.WidgetTestCase): - + def test_ComboBoxCtors(self): 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) c = wx.ComboBox(self.frame, -1, "", (10,10), (80,-1), "one two three four".split(), 0) - + self.assertTrue(c.GetCount() == 4) - - + + def test_ComboBoxDefaultCtor(self): c = wx.ComboBox() c.Create(self.frame, value="value", choices="one two three four".split()) @@ -31,9 +31,9 @@ class ComboBoxTests(wtc.WidgetTestCase): def test_comboboxTextSelection(self): 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)) - + #--------------------------------------------------------------------------- diff --git a/unittests/test_commandlinkbutton.py b/unittests/test_commandlinkbutton.py index e58f31bf..05578e01 100644 --- a/unittests/test_commandlinkbutton.py +++ b/unittests/test_commandlinkbutton.py @@ -20,7 +20,7 @@ class commandlinkbutton_Tests(wtc.WidgetTestCase): b.Label b.MainLabel b.Note - + #--------------------------------------------------------------------------- if __name__ == '__main__': diff --git a/unittests/test_config.py b/unittests/test_config.py index 7cbe3311..a026f199 100644 --- a/unittests/test_config.py +++ b/unittests/test_config.py @@ -8,7 +8,7 @@ cfgFilename = os.path.join(os.path.dirname(__file__), 'cfgtest') #--------------------------------------------------------------------------- class ConfigTests(wtc.WidgetTestCase): - + def writeStuff(self, cfg): cfg.SetPath('/one/two/three') cfg.Write('key', 'value') @@ -26,12 +26,12 @@ class ConfigTests(wtc.WidgetTestCase): del cfg if os.path.exists(name): os.remove(name) - - + + def test_Config2(self): null = wx.LogNull() name = cfgFilename + '_2' - + cfg = wx.Config('unittest_ConfigTests', localFilename=name) self.writeStuff(cfg) @@ -41,7 +41,7 @@ class ConfigTests(wtc.WidgetTestCase): self.assertTrue(cfg.GetPath() == '/one/two/three') del changer self.assertTrue(cfg.GetPath() == '/before') - + del cfg if os.path.exists(name): os.remove(name) @@ -50,7 +50,7 @@ class ConfigTests(wtc.WidgetTestCase): def test_Config3(self): null = wx.LogNull() name = cfgFilename + '_3' - + cfg = wx.Config('unittest_ConfigTests', localFilename=name) self.writeStuff(cfg) @@ -59,16 +59,16 @@ class ConfigTests(wtc.WidgetTestCase): with wx.ConfigPathChanger(cfg, '/one/two/three/'): self.assertTrue(cfg.GetPath() == '/one/two/three') self.assertTrue(cfg.GetPath() == '/before') - + del cfg if os.path.exists(name): os.remove(name) - def test_Config4(self): + def test_Config4(self): null = wx.LogNull() name = cfgFilename + '_4' - + cfg0 = wx.Config('unittest_ConfigTests', localFilename=name) wx.Config.Set(cfg0) @@ -76,7 +76,7 @@ class ConfigTests(wtc.WidgetTestCase): #self.assertTrue(cfg is cfg0) self.writeStuff(cfg) del cfg - + cfg = wx.Config.Get() cfg.SetPath('/one/two/three') self.assertTrue(cfg.GetPath() == '/one/two/three') @@ -96,13 +96,13 @@ class ConfigTests(wtc.WidgetTestCase): def test_Config5(self): null = wx.LogNull() name = cfgFilename + '_5' - + cfg = wx.Config('unittest_ConfigTests', localFilename=name) cfg.SetPath('/zero') cfg.Write('key1', 'value') cfg.Write('key2', 'value') cfg.Write('key3', 'value') - + cfg.SetPath('/one') cfg.Write('key1', 'value') cfg.Write('key2', 'value') @@ -119,7 +119,7 @@ class ConfigTests(wtc.WidgetTestCase): cfg.Write('key3', 'value') cfg.Flush() - + cfg.SetPath('/') count = 0 more, group, index = cfg.GetFirstGroup() @@ -127,7 +127,7 @@ class ConfigTests(wtc.WidgetTestCase): count += 1 more, group, index = cfg.GetNextGroup(index) self.assertEqual(count, 4) - + cfg.SetPath('/two') count = 0 more, entry, index = cfg.GetFirstEntry() @@ -135,7 +135,7 @@ class ConfigTests(wtc.WidgetTestCase): count += 1 more, entry, index = cfg.GetNextEntry(index) self.assertEqual(count, 3) - + del cfg if os.path.exists(name): os.remove(name) @@ -144,13 +144,13 @@ class ConfigTests(wtc.WidgetTestCase): def test_Config6(self): null = wx.LogNull() name = cfgFilename + '_6' - + cfg = wx.FileConfig('unittest_ConfigTests', localFilename=name) cfg.SetPath('/zero') cfg.Write('key1', 'value') cfg.Write('key2', 'value') cfg.Write('key3', 'value') - + cfg.SetPath('/one') cfg.Write('key1', 'value') cfg.Write('key2', 'value') @@ -167,7 +167,7 @@ class ConfigTests(wtc.WidgetTestCase): cfg.Write('key3', 'value') cfg.Flush() - + cfg.SetPath('/') count = 0 more, group, index = cfg.GetFirstGroup() @@ -175,7 +175,7 @@ class ConfigTests(wtc.WidgetTestCase): count += 1 more, group, index = cfg.GetNextGroup(index) self.assertEqual(count, 4) - + cfg.SetPath('/two') count = 0 more, entry, index = cfg.GetFirstEntry() @@ -183,11 +183,11 @@ class ConfigTests(wtc.WidgetTestCase): count += 1 more, entry, index = cfg.GetNextEntry(index) self.assertEqual(count, 3) - + del cfg if os.path.exists(name): os.remove(name) - + #--------------------------------------------------------------------------- diff --git a/unittests/test_control.py b/unittests/test_control.py index 30638649..f0e235f8 100644 --- a/unittests/test_control.py +++ b/unittests/test_control.py @@ -5,17 +5,17 @@ import wx #--------------------------------------------------------------------------- class ControlTests(wtc.WidgetTestCase): - + def test_ControlCtors(self): c = wx.Control(self.frame) c = wx.Control(self.frame, -1, wx.Point(10,10), wx.Size(80,-1)) - - + + def test_ControlDefaultCtor(self): c = wx.Control() c.Create(self.frame) - + #--------------------------------------------------------------------------- diff --git a/unittests/test_cshelp.py b/unittests/test_cshelp.py index bb4e4600..11a33317 100644 --- a/unittests/test_cshelp.py +++ b/unittests/test_cshelp.py @@ -9,7 +9,7 @@ class cshelp_Tests(wtc.WidgetTestCase): def test_cshelp1(self): provider = wx.SimpleHelpProvider() wx.HelpProvider.Set(provider) - + pnl = wx.Panel(self.frame) pnl.SetHelpText("HelpMe!") cBtn = wx.ContextHelpButton(pnl) @@ -17,18 +17,18 @@ class cshelp_Tests(wtc.WidgetTestCase): # Make sure we haven't borked the magic ID assert cBtn.GetId() == wx.ID_CONTEXT_HELP - + def test_cshelp2(self): wx.wxEVT_HELP wx.wxEVT_DETAILED_HELP - + wx.EVT_HELP wx.EVT_HELP_RANGE wx.EVT_DETAILED_HELP wx.EVT_DETAILED_HELP_RANGE - - - + + + #--------------------------------------------------------------------------- if __name__ == '__main__': diff --git a/unittests/test_cursor.py b/unittests/test_cursor.py index 5aa0d46e..8295b70e 100644 --- a/unittests/test_cursor.py +++ b/unittests/test_cursor.py @@ -10,7 +10,7 @@ curFile = os.path.join(os.path.dirname(__file__), 'horse.cur') #--------------------------------------------------------------------------- class CursorTests(wtc.WidgetTestCase): - + def test_CursorCtors(self): # stock c = wx.Cursor(wx.CURSOR_HAND) @@ -19,7 +19,7 @@ class CursorTests(wtc.WidgetTestCase): # from file c = wx.Cursor(curFile, wx.BITMAP_TYPE_CUR) self.assertTrue(c.IsOk()) - + # from image img = wx.Image(pngFile) img.SetOption(wx.IMAGE_OPTION_CUR_HOTSPOT_X, 1) @@ -30,7 +30,7 @@ class CursorTests(wtc.WidgetTestCase): # copy c2 = wx.Cursor(c) self.assertTrue(c2.IsOk()) - + def test_CursorStockIDsExist(self): wx.CURSOR_ARROW @@ -62,8 +62,8 @@ class CursorTests(wtc.WidgetTestCase): wx.CURSOR_DEFAULT wx.CURSOR_COPY_ARROW wx.CURSOR_ARROWWAIT - - + + def test_Cursor__nonzero__(self): c1 = wx.Cursor() self.assertTrue( not c1.IsOk() ) @@ -85,13 +85,13 @@ class CursorTests(wtc.WidgetTestCase): nzcheck = True self.assertTrue(nzcheck) - + def test_NullCursor(self): # just make sure this one exists wx.NullCursor self.assertTrue(not wx.NullCursor.IsOk()) - + def test_StockCursorsExist(self): wx.STANDARD_CURSOR wx.HOURGLASS_CURSOR @@ -101,8 +101,8 @@ class CursorTests(wtc.WidgetTestCase): self.assertTrue(wx.STANDARD_CURSOR.IsOk()) self.assertTrue(wx.HOURGLASS_CURSOR.IsOk()) self.assertTrue(wx.CROSS_CURSOR.IsOk()) - - + + #--------------------------------------------------------------------------- diff --git a/unittests/test_dataobj.py b/unittests/test_dataobj.py index 5a1c45d4..d65ab338 100644 --- a/unittests/test_dataobj.py +++ b/unittests/test_dataobj.py @@ -11,16 +11,16 @@ pngFile = os.path.join(os.path.dirname(__file__), 'toucan.png') #--------------------------------------------------------------------------- class DataObjTests(wtc.WidgetTestCase): - + def test_DataFormat(self): fmt1 = wx.DataFormat('my custom format') fmt2 = wx.DataFormat(wx.DF_TEXT) self.assertTrue(fmt1 != fmt2) fmt3 = wx.DataFormat(wx.DF_TEXT) self.assertTrue(fmt2 == fmt3) - - - + + + def test_DataFormatIDsExist(self): wx.DF_INVALID wx.DF_TEXT @@ -44,37 +44,37 @@ class DataObjTests(wtc.WidgetTestCase): wx.DF_MAX - + def test_DataObjectGetAllFormats(self): class MyDataObject(wx.DataObject): def __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)] - + def GetAllFormats(self, d): return self.myFormats - + def GetFormatCount(self, d): return len(self.myFormats) - + data = MyDataObject() if hasattr(data, '_testGetAllFormats'): data._testGetAllFormats() - + # 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): class MyDataObject(wx.DataObject): def __init__(self, value=''): wx.DataObject.__init__(self) - self.myFormats = [wx.DataFormat(wx.DF_TEXT)] + self.myFormats = [wx.DataFormat(wx.DF_TEXT)] self.myData = wtc.mybytes(value) - + def GetAllFormats(self, d): - return self.myFormats + return self.myFormats def GetFormatCount(self, d): - return len(self.myFormats) + return len(self.myFormats) def GetPreferredFormat(self, d): return self.myFormats[0] @@ -84,82 +84,82 @@ class DataObjTests(wtc.WidgetTestCase): # a null character at the end for our custom format using # wx.DF_TEXT. return len(self.myData)+1 - + def GetDataHere(self, format, buf): # copy our local data value to buf assert isinstance(buf, memoryview) assert len(buf) == len(self.myData)+1 buf[:] = (self.myData + b'\0') # add the extra byte return True - + def SetData(self, format, buf): # copy from buf to our local data value assert isinstance(buf, memoryview) self.myData = buf.tobytes() if self.myData[-1] in [b'\0', 0]: # strip off the extra byte at the end - self.myData = self.myData[:-1] + self.myData = self.myData[:-1] return True - + # copy data1 = MyDataObject('This is some data.') if wx.TheClipboard.Open(): wx.TheClipboard.SetData(data1) wx.TheClipboard.Close() - - # paste + + # paste data2 = MyDataObject() if wx.TheClipboard.Open(): wx.TheClipboard.GetData(data2) wx.TheClipboard.Close() - + self.assertEqual(data1.myData, data2.myData) - - + + def test_DataObject2(self): # More-or-less a duplicate of the above, but with a custom data format class MyDataObject(wx.DataObject): def __init__(self, value=''): wx.DataObject.__init__(self) - self.myFormats = [wx.DataFormat("My Custom DataFormat")] + self.myFormats = [wx.DataFormat("My Custom DataFormat")] self.myData = wtc.mybytes(value) - + def GetAllFormats(self, d): - return self.myFormats + return self.myFormats def GetFormatCount(self, d): - return len(self.myFormats) + return len(self.myFormats) def GetPreferredFormat(self, d): return self.myFormats[0] def GetDataSize(self, format): return len(self.myData) - + def GetDataHere(self, format, buf): # copy our local data value to buf assert isinstance(buf, memoryview) buf[:] = self.myData return True - + def SetData(self, format, buf): # copy from buf to our local data value assert isinstance(buf, memoryview) self.myData = buf.tobytes() return True - + # copy data1 = MyDataObject('This is some data.') if wx.TheClipboard.Open(): wx.TheClipboard.SetData(data1) wx.TheClipboard.Close() - - # paste + + # paste data2 = MyDataObject() if wx.TheClipboard.Open(): wx.TheClipboard.GetData(data2) wx.TheClipboard.Close() - + self.assertEqual(data1.myData, data2.myData) - - + + def test_DataObjectSimple1(self): df = wx.DataFormat(wx.DF_TEXT) dobj = wx.DataObjectSimple(df) @@ -167,50 +167,50 @@ class DataObjTests(wtc.WidgetTestCase): self.assertTrue(dobj.GetFormat() == df) self.assertTrue(dobj.GetAllFormats()[0] == df) - + # 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): class MyDataObject(wx.DataObjectSimple): def __init__(self, value=''): wx.DataObjectSimple.__init__(self) self.SetFormat(wx.DataFormat(wx.DF_TEXT)) self.myData = wtc.mybytes(value) - + def GetDataSize(self): # See notes above about the need for a null terminator when # using wx.DF_TEXT on Windows. return len(self.myData)+1 - + def GetDataHere(self, buf): # copy our local data value to buf assert isinstance(buf, memoryview) buf[:] = (self.myData + b'\0') return True - + def SetData(self, buf): # copy from buf to our local data value assert isinstance(buf, memoryview) self.myData = buf.tobytes() if self.myData[-1] in [b'\0', 0]: - self.myData = self.myData[:-1] + self.myData = self.myData[:-1] return True - + # copy data1 = MyDataObject('This is some data.') if wx.TheClipboard.Open(): wx.TheClipboard.SetData(data1) wx.TheClipboard.Close() - - # paste + + # paste data2 = MyDataObject() if wx.TheClipboard.Open(): wx.TheClipboard.GetData(data2) wx.TheClipboard.Close() - + self.assertEqual(data1.myData, data2.myData) - - + + def test_DataObjectSimple3(self): # More-or-less a duplicate of the above, but with a custom data format class MyDataObject(wx.DataObjectSimple): @@ -218,37 +218,37 @@ class DataObjTests(wtc.WidgetTestCase): wx.DataObjectSimple.__init__(self) self.SetFormat(wx.DataFormat("My Custom Data Format")) self.myData = wtc.mybytes(value) - + def GetDataSize(self): return len(self.myData) - + def GetDataHere(self, buf): # copy our local data value to buf assert isinstance(buf, memoryview) buf[:] = self.myData return True - + def SetData(self, buf): # copy from buf to our local data value assert isinstance(buf, memoryview) self.myData = buf.tobytes() return True - + # copy data1 = MyDataObject('This is some data.') if wx.TheClipboard.Open(): wx.TheClipboard.SetData(data1) wx.TheClipboard.Close() - - # paste + + # paste data2 = MyDataObject() if wx.TheClipboard.Open(): wx.TheClipboard.GetData(data2) wx.TheClipboard.Close() - + self.assertEqual(data1.myData, data2.myData) - - + + def test_CustomDataObject(self): import pickle data1 = list(range(10)) @@ -256,9 +256,9 @@ class DataObjTests(wtc.WidgetTestCase): obj.SetData(pickle.dumps(data1)) data2 = pickle.loads(obj.GetData().tobytes()) self.assertEqual(data1, data2) - - - + + + def test_DataObjectComposite(self): do = wx.DataObjectComposite() df1 = wx.DataFormat("data type 1") @@ -267,20 +267,20 @@ class DataObjTests(wtc.WidgetTestCase): d2 = wx.CustomDataObject(df2) do.Add(d1, True) do.Add(d2) - + self.assertTrue(do.GetPreferredFormat() == df1) d3 = do.GetObject(df2) self.assertTrue(isinstance(d3, wx.CustomDataObject)) self.assertTrue(d3 is d2) - + def test_BitmapDataObject(self): do = wx.BitmapDataObject() do.Bitmap = wx.Bitmap(pngFile) self.assertTrue(do.GetBitmap().IsOk()) self.assertTrue(do.Bitmap.IsOk()) - - + + def test_TextDataObject(self): data = "This is some data" do = wx.TextDataObject(data) @@ -288,33 +288,33 @@ class DataObjTests(wtc.WidgetTestCase): self.assertEqual(do.Text, data) self.assertAlmostEqual(do.GetTextLength(), len(data), delta=1) self.assertAlmostEqual(do.TextLength, len(data), delta=1) - - - def test_TextDataObjectClipboard(self): + + + def test_TextDataObjectClipboard(self): # copy text = 'This is some MORE data.' data1 = wx.TextDataObject(text) if wx.TheClipboard.Open(): wx.TheClipboard.SetData(data1) wx.TheClipboard.Close() - - # paste + + # paste data2 = wx.TextDataObject() if wx.TheClipboard.Open(): wx.TheClipboard.GetData(data2) wx.TheClipboard.Close() - + self.assertEqual(text, data2.Text) - + def test_URLDataObject(self): url = 'http://wxPython.org/' do = wx.URLDataObject() do.URL = url self.assertEqual(do.GetURL(), url) self.assertEqual(do.URL, url) - - + + def test_FileDataObject(self): do = wx.FileDataObject() do.AddFile('filename1') @@ -326,15 +326,15 @@ class DataObjTests(wtc.WidgetTestCase): self.assertTrue(names[0] == 'filename1') self.assertTrue(names == do.Filenames) - + def test_HTMLDataObject(self): data = "This is some data" do = wx.HTMLDataObject(data) self.assertEqual(do.GetHTML(), data) self.assertEqual(do.HTML, data) - - + + #--------------------------------------------------------------------------- diff --git a/unittests/test_dataview.py b/unittests/test_dataview.py index a34d6ebe..931772f8 100644 --- a/unittests/test_dataview.py +++ b/unittests/test_dataview.py @@ -15,11 +15,11 @@ class dataview_Tests(wtc.WidgetTestCase): def test_dataviewItem1(self): dvi = dv.DataViewItem() self.assertFalse(dvi) - + def test_dataviewItem2(self): dvi = dv.DataViewItem(12345) self.assertTrue(dvi) - + def test_dataviewItem3(self): dvi1 = dv.DataViewItem(111) dvi2 = dv.DataViewItem(222) @@ -31,7 +31,7 @@ class dataview_Tests(wtc.WidgetTestCase): dvi2 = dv.DataViewItem(111) self.assertTrue(dvi1 == dvi2) self.assertFalse(dvi1 != dvi2) - + def test_dataviewItem5(self): self.assertFalse(dv.NullDataViewItem) @@ -43,7 +43,7 @@ class dataview_Tests(wtc.WidgetTestCase): self.assertTrue(int(dvi2.ID) == 222) 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 if six.PY3: assert type(n) is int @@ -54,7 +54,7 @@ class dataview_Tests(wtc.WidgetTestCase): self.assertTrue(int(dvi.GetID()) == n) - + #------------------------------------------------------- def test_dataviewItemAttr1(self): a = dv.DataViewItemAttr() @@ -62,8 +62,8 @@ class dataview_Tests(wtc.WidgetTestCase): self.assertFalse(a.HasColour()) self.assertFalse(a.HasFont()) self.assertFalse(a.HasBackgroundColour()) - - + + def test_dataviewItemAttr2(self): a = dv.DataViewItemAttr() a.Colour = wx.BLACK @@ -75,8 +75,8 @@ class dataview_Tests(wtc.WidgetTestCase): self.assertTrue(a.HasBackgroundColour()) self.assertTrue(a.GetBold()) self.assertTrue(a.GetItalic()) - - + + #------------------------------------------------------- def test_dataviewIconText1(self): dit = dv.DataViewIconText() @@ -90,54 +90,54 @@ class dataview_Tests(wtc.WidgetTestCase): dit = dv.DataViewIconText('Smile!', icon) dit.Icon dit.Text - - + + #------------------------------------------------------- def test_dataviewModelNotifier1(self): with self.assertRaises(TypeError): n = dv.DataViewModelNotifier() - - + + def test_dataviewModelNotifier2(self): class MyNotifier(dv.DataViewModelNotifier): def Cleared(self): return True - + def ItemAdded(self, parent, item): return True def ItemChanged(self, item): return True def ItemDeleted(self, parent, item): return True def ItemsAdded(self, parent, items): return True def ItemsChanged(self, items): return True def ItemsDeleted(self, parent, items): return True - + def Resort(self): pass def ValueChanged(self, item, col): return True - + n = MyNotifier() - - + + #------------------------------------------------------- def test_dataviewRenderer01(self): with self.assertRaises(TypeError): r = dv.DataViewRenderer() - - + + 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. - with self.assertRaises(TypeError): + with self.assertRaises(TypeError): class MyRenderer(dv.DataViewRenderer): def GetValue(self): return "value" def SetValue(self, value): return True - + r = MyRenderer() - - + + def test_dataviewRenderer03(self): r = dv.DataViewTextRenderer() - + def test_dataviewRenderer04(self): r = dv.DataViewIconTextRenderer() - + def test_dataviewRenderer05(self): r = dv.DataViewProgressRenderer() @@ -152,28 +152,28 @@ class dataview_Tests(wtc.WidgetTestCase): def test_dataviewRenderer09(self): r = dv.DataViewBitmapRenderer() - + def test_dataviewRenderer10(self): with self.assertRaises(TypeError): r = dv.DataViewCustomRenderer() - + def test_dataviewRenderer11(self): class MyCustomRenderer(dv.DataViewCustomRenderer): def GetValue(self): return "value" def SetValue(self, value): return True def GetSize(self): return wx.Size(100, 25) def Render(self, cell, dc, state): return True - + r = MyCustomRenderer() - + def test_dataviewRenderer12(self): r = dv.DataViewChoiceRenderer("one two three".split()) - - + + #------------------------------------------------------- def test_dataviewColumn(self): - r = dv.DataViewIconTextRenderer() + r = dv.DataViewIconTextRenderer() # create c = dv.DataViewColumn('title', r, 0) # test that properties exist @@ -184,15 +184,15 @@ class dataview_Tests(wtc.WidgetTestCase): c.Alignment c.Flags c.SortOrder - + self.myYield() - + #------------------------------------------------------- def test_dataviewModel1(self): with self.assertRaises(TypeError): m = dv.DataViewModel() - - + + def test_dataviewModel2(self): class MyModel(dv.DataViewModel): def GetChildren(self, item, children): return 0 @@ -202,65 +202,65 @@ class dataview_Tests(wtc.WidgetTestCase): def GetValue(self, item, col): return 'value' def IsContainer(self, item) : return False def SetValue(self, value, item, col): return True - + m = MyModel() - + #------------------------------------------------------- def test_dataviewIndexListModel1(self): with self.assertRaises(TypeError): m = dv.DataViewIndexListModel() - + def test_dataviewIndexListModel2(self): class MyModel(dv.DataViewIndexListModel): def GetCount(self): return 0 def GetRow(self, item): return 0 def GetValueByRow(self, row, col): return 'value' def SetValueByRow(self, value, row, col): return True - + m = MyModel() - + def test_dataviewVirtualListModel1(self): with self.assertRaises(TypeError): m = dv.DataViewVirtualListModel() - + def test_dataviewVirtualModel2(self): class MyModel(dv.DataViewVirtualListModel): def GetCount(self): return 0 def GetRow(self, item): return 0 def GetValueByRow(self, row, col): return 'value' def SetValueByRow(self, value, row, col): return True - + m = MyModel() - - + + #------------------------------------------------------- def test_dataviewCtrl1(self): - + class MyModel(dv.DataViewIndexListModel): - def GetCount(self): + def GetCount(self): return 50 - + def GetColumnCount(self): return 10 - - def GetValueByRow(self, row, col): + + def GetValueByRow(self, row, col): return 'value(%d, %d)' (row, col) - - def SetValueByRow(self, value, row, col): + + def SetValueByRow(self, value, row, col): return True - + def GetColumnType(self, col): return 'string' - - + + dvc = dv.DataViewCtrl(self.frame, style=dv.DV_ROW_LINES|dv.DV_VERT_RULES|dv.DV_MULTIPLE) model = MyModel() count1 = model.GetRefCount() dvc.AssociateModel(model) count2 = model.GetRefCount() - + # The reference count should still be 1 because the model was # DecRef'ed when it's ownership transfered to C++ in the # AssociateModel call @@ -275,7 +275,7 @@ class dataview_Tests(wtc.WidgetTestCase): # Destroying the 2nd view should drop the refcount again dvc2.Destroy() self.assertEqual(model.GetRefCount(), 1) - + # And since ownership has been transferred, deleting this reference # to the model should not cause any problems. del model @@ -285,20 +285,20 @@ class dataview_Tests(wtc.WidgetTestCase): dvc.AppendTextColumn("three", 3, 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) - + self.frame.SendSizeEvent() dvc.Refresh() self.myYield() - + #------------------------------------------------------- def test_dataviewListCtrl1(self): dlc = dv.DataViewListCtrl() dlc.Create(self.frame) self.doListCtrlTest(dlc) - - + + def test_dataviewListCtrl2(self): dlc = dv.DataViewListCtrl(self.frame) self.doListCtrlTest(dlc) @@ -309,13 +309,13 @@ class dataview_Tests(wtc.WidgetTestCase): dlc.AppendTextColumn(label) col = dv.DataViewColumn('five', dv.DataViewBitmapRenderer(), 4) dlc.AppendColumn(col) - + bmp = wx.Bitmap(pngFile) for n in range(50): rowdata = ['%s-%02d' % (s, n) for s in "one two three four".split()] rowdata.append(bmp) dlc.AppendItem(rowdata) - + self.frame.SendSizeEvent() dlc.Refresh() self.myYield() @@ -327,21 +327,21 @@ class dataview_Tests(wtc.WidgetTestCase): item, col = dlc.HitTest((10,50)) self.assertTrue(isinstance(item, dv.DataViewItem)) self.assertTrue(isinstance(col, dv.DataViewColumn) or col is None) - + #------------------------------------------------------- # DataViewTreeCtrl - - + + def test_dataviewTreeCtrl1(self): dtc = dv.DataViewTreeCtrl() dtc.Create(self.frame) self.doTreeCtrlTest(dtc) - - + + def test_dataviewTreeCtrl2(self): dtc = dv.DataViewTreeCtrl(self.frame) self.doTreeCtrlTest(dtc) - + def doTreeCtrlTest(self, dvtc): isz = (16,16) @@ -366,7 +366,7 @@ class dataview_Tests(wtc.WidgetTestCase): last, "item %d-%s-%d" % (x, chr(ord("a")+y), z), fileidx) dvtc.ExpandAncestors(item) - + self.frame.SendSizeEvent() dvtc.Refresh() self.myYield() @@ -377,22 +377,22 @@ class dataview_Tests(wtc.WidgetTestCase): dv.DVC_DEFAULT_RENDERER_SIZE dv.DVC_DEFAULT_WIDTH dv.DVC_TOGGLE_DEFAULT_WIDTH - dv.DVC_DEFAULT_MINWIDTH + dv.DVC_DEFAULT_MINWIDTH dv.DVR_DEFAULT_ALIGNMENT dv.DATAVIEW_CELL_INERT dv.DATAVIEW_CELL_ACTIVATABLE dv.DATAVIEW_CELL_EDITABLE dv.DATAVIEW_CELL_SELECTED - dv.DATAVIEW_CELL_PRELIT + dv.DATAVIEW_CELL_PRELIT dv.DATAVIEW_CELL_INSENSITIVE - dv.DATAVIEW_CELL_FOCUSED + dv.DATAVIEW_CELL_FOCUSED dv.DATAVIEW_COL_RESIZABLE dv.DATAVIEW_COL_SORTABLE dv.DATAVIEW_COL_REORDERABLE - dv.DATAVIEW_COL_HIDDEN - + dv.DATAVIEW_COL_HIDDEN + dv.DV_SINGLE dv.DV_MULTIPLE dv.DV_NO_HEADER @@ -400,11 +400,11 @@ class dataview_Tests(wtc.WidgetTestCase): dv.DV_VERT_RULES dv.DV_ROW_LINES dv.DV_VARIABLE_LINE_HEIGHT - + def test_dataviewEvt1(self): evt = dv.DataViewEvent() - + evt.GetItem evt.SetItem evt.GetColumn @@ -434,7 +434,7 @@ class dataview_Tests(wtc.WidgetTestCase): evt.GetDragFlags evt.SetDropEffect evt.GetDropEffect - + def test_dataviewEvt2(self): 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_ITEM_BEGIN_DRAG; 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.EVT_DATAVIEW_SELECTION_CHANGED - dv.EVT_DATAVIEW_ITEM_ACTIVATED - dv.EVT_DATAVIEW_ITEM_COLLAPSED - dv.EVT_DATAVIEW_ITEM_EXPANDED - dv.EVT_DATAVIEW_ITEM_COLLAPSING - dv.EVT_DATAVIEW_ITEM_EXPANDING - dv.EVT_DATAVIEW_ITEM_START_EDITING - dv.EVT_DATAVIEW_ITEM_EDITING_STARTED - dv.EVT_DATAVIEW_ITEM_EDITING_DONE - dv.EVT_DATAVIEW_ITEM_VALUE_CHANGED - dv.EVT_DATAVIEW_ITEM_CONTEXT_MENU - dv.EVT_DATAVIEW_COLUMN_HEADER_CLICK + + dv.EVT_DATAVIEW_SELECTION_CHANGED + dv.EVT_DATAVIEW_ITEM_ACTIVATED + dv.EVT_DATAVIEW_ITEM_COLLAPSED + dv.EVT_DATAVIEW_ITEM_EXPANDED + dv.EVT_DATAVIEW_ITEM_COLLAPSING + dv.EVT_DATAVIEW_ITEM_EXPANDING + dv.EVT_DATAVIEW_ITEM_START_EDITING + dv.EVT_DATAVIEW_ITEM_EDITING_STARTED + dv.EVT_DATAVIEW_ITEM_EDITING_DONE + dv.EVT_DATAVIEW_ITEM_VALUE_CHANGED + dv.EVT_DATAVIEW_ITEM_CONTEXT_MENU + dv.EVT_DATAVIEW_COLUMN_HEADER_CLICK dv.EVT_DATAVIEW_COLUMN_HEADER_RIGHT_CLICK - dv.EVT_DATAVIEW_COLUMN_SORTED - dv.EVT_DATAVIEW_COLUMN_REORDERED - dv.EVT_DATAVIEW_ITEM_BEGIN_DRAG - dv.EVT_DATAVIEW_ITEM_DROP_POSSIBLE - dv.EVT_DATAVIEW_ITEM_DROP - dv.EVT_DATAVIEW_CACHE_HINT - - - - + dv.EVT_DATAVIEW_COLUMN_SORTED + dv.EVT_DATAVIEW_COLUMN_REORDERED + dv.EVT_DATAVIEW_ITEM_BEGIN_DRAG + dv.EVT_DATAVIEW_ITEM_DROP_POSSIBLE + dv.EVT_DATAVIEW_ITEM_DROP + dv.EVT_DATAVIEW_CACHE_HINT + + + + #--------------------------------------------------------------------------- if __name__ == '__main__': diff --git a/unittests/test_datectrl.py b/unittests/test_datectrl.py index d2eb932c..9621030a 100644 --- a/unittests/test_datectrl.py +++ b/unittests/test_datectrl.py @@ -9,19 +9,19 @@ class datectrl_Tests(wtc.WidgetTestCase): def test_datectrl1(self): dp = wx.adv.DatePickerCtrl(self.frame, dt=wx.DateTime.Now()) - + def test_datectrl2(self): dp = wx.adv.DatePickerCtrl() dp.Create(self.frame, dt=wx.DateTime.Now()) - + def test_genericdatectrl1(self): dp = wx.adv.GenericDatePickerCtrl(self.frame, dt=wx.DateTime.Now()) - + def test_genericdatectrl2(self): dp = wx.adv.GenericDatePickerCtrl() dp.Create(self.frame, dt=wx.DateTime.Now()) - + #--------------------------------------------------------------------------- if __name__ == '__main__': diff --git a/unittests/test_dateevt.py b/unittests/test_dateevt.py index b2ea2206..1e592b77 100644 --- a/unittests/test_dateevt.py +++ b/unittests/test_dateevt.py @@ -11,14 +11,14 @@ class dateevt_Tests(wtc.WidgetTestCase): evt = wx.adv.DateEvent() evt.GetDate() evt.Date - + def test_dateevt2(self): wx.adv.wxEVT_DATE_CHANGED wx.adv.wxEVT_TIME_CHANGED wx.adv.EVT_DATE_CHANGED wx.adv.EVT_TIME_CHANGED - + #--------------------------------------------------------------------------- if __name__ == '__main__': diff --git a/unittests/test_dc.py b/unittests/test_dc.py index bd6f75f8..72eb7645 100644 --- a/unittests/test_dc.py +++ b/unittests/test_dc.py @@ -9,7 +9,7 @@ pngFile = os.path.join(os.path.dirname(__file__), 'toucan.png') #--------------------------------------------------------------------------- class dc_Tests(wtc.WidgetTestCase): - + def test_ConstantsExist(self): wx.CLEAR wx.XOR @@ -27,7 +27,7 @@ class dc_Tests(wtc.WidgetTestCase): wx.NAND wx.OR wx.SET - + wx.FLOOD_SURFACE wx.FLOOD_BORDER @@ -36,9 +36,9 @@ class dc_Tests(wtc.WidgetTestCase): wx.MM_LOMETRIC wx.MM_TWIPS wx.MM_POINTS - - - + + + def test_FontMetrics(self): fm = wx.FontMetrics() fm.height @@ -47,8 +47,8 @@ class dc_Tests(wtc.WidgetTestCase): fm.internalLeading fm.externalLeading fm.averageWidth - - + + def test_DCClipper(self): dc = wx.ClientDC(self.frame) 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) c = wx.DCClipper(dc, r) del c - + def test_DCBrushChanger(self): dc = wx.ClientDC(self.frame) @@ -81,8 +81,8 @@ class dc_Tests(wtc.WidgetTestCase): del c c = wx.DCTextColourChanger(dc, 'blue') del c - - + + def test_DCFontChanger(self): dc = wx.ClientDC(self.frame) font = wx.FFont(12, wx.FONTFAMILY_SWISS) @@ -91,40 +91,40 @@ class dc_Tests(wtc.WidgetTestCase): del c c = wx.DCFontChanger(dc, font) del c - - + + def test_NativeHandle(self): dc = wx.MemoryDC(wx.Bitmap(10,10)) h = dc.GetHandle() self.assertTrue(h is not None) self.assertNotEqual(int(h), 0) - + def test_NativeWinHandle(self): dc = wx.ClientDC(self.frame) with warnings.catch_warnings(): - warnings.simplefilter("error") + warnings.simplefilter("error") with self.assertRaises(wx.wxPyDeprecationWarning): try: h = dc.GetHDC() except NotImplementedError: pass - - + + def test_NativeGTKHandle(self): dc = wx.ClientDC(self.frame) with warnings.catch_warnings(): - warnings.simplefilter("error") + warnings.simplefilter("error") with self.assertRaises(wx.wxPyDeprecationWarning): try: h = dc.GetGdkDrawable() except NotImplementedError: pass - + def test_NativeMacHandle(self): dc = wx.MemoryDC(wx.Bitmap(10,10)) with warnings.catch_warnings(): - warnings.simplefilter("error") + warnings.simplefilter("error") with self.assertRaises(wx.wxPyDeprecationWarning): try: h = dc.GetCGContext() @@ -163,7 +163,7 @@ class dc_Tests(wtc.WidgetTestCase): dc = wx.ClientDC(self.frame) bmp = wx.Bitmap(pngFile) dc.DrawLabel("toucan", bmp, (10,10, 200, 100)) - + values = dc.GetPartialTextExtents("Hello") self.assertTrue(type(values) == list) self.assertTrue(len(values) == 5) @@ -173,8 +173,8 @@ class dc_Tests(wtc.WidgetTestCase): 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([(15,15), (35,15), (35,35), (35,15), (15,15)]) - - + + #--------------------------------------------------------------------------- diff --git a/unittests/test_dcDrawLists.py b/unittests/test_dcDrawLists.py index 268c15de..9e35e5ea 100644 --- a/unittests/test_dcDrawLists.py +++ b/unittests/test_dcDrawLists.py @@ -7,7 +7,7 @@ try: haveNumpy = True except ImportError: haveNumpy = False - + #--------------------------------------------------------------------------- w = 600 @@ -146,13 +146,13 @@ class dcDrawLists_Tests(wtc.WidgetTestCase): dc.SetPen(wx.Pen("BLACK", 1)) pens = makeRandomPens() - + dc.DrawPointList(makeRandomPoints()) dc.DrawPointList(makeRandomPoints(), wx.Pen("RED", 1)) dc.DrawPointList(makeRandomPoints(), pens) del dc - - + + @unittest.skipIf(not haveNumpy, "Numpy required for this test") def test_dcDrawPointArray(self): pnl = wx.Panel(self.frame) @@ -161,27 +161,27 @@ class dcDrawLists_Tests(wtc.WidgetTestCase): dc.SetPen(wx.Pen("BLACK", 1)) pens = makeRandomPens() - + dc.DrawPointList(np.array(makeRandomPoints())) dc.DrawPointList(np.array(makeRandomPoints()), wx.Pen("RED", 1)) dc.DrawPointList(np.array(makeRandomPoints()), pens) del dc - + def test_dcDrawLineLists(self): pnl = wx.Panel(self.frame) self.frame.SetSize((w,h)) dc = wx.ClientDC(pnl) dc.SetPen(wx.Pen("BLACK", 1)) - + pens = makeRandomPens() - + dc.DrawLineList(makeRandomLines()) dc.DrawLineList(makeRandomLines(), wx.Pen("RED", 2)) dc.DrawLineList(makeRandomLines(), pens) del dc - - + + def test_dcDrawRectangleLists(self): pnl = wx.Panel(self.frame) self.frame.SetSize((w,h)) @@ -191,14 +191,14 @@ class dcDrawLists_Tests(wtc.WidgetTestCase): pens = makeRandomPens() brushes = makeRandomBrushes() - + dc.DrawRectangleList(makeRandomRectangles()) dc.DrawRectangleList(makeRandomRectangles(),pens) dc.DrawRectangleList(makeRandomRectangles(),pens[0],brushes) dc.DrawRectangleList(makeRandomRectangles(),pens,brushes[0]) dc.DrawRectangleList(makeRandomRectangles(),None,brushes) del dc - + @unittest.skipIf(not haveNumpy, "Numpy required for this test") def test_dcDrawRectangleArray(self): @@ -210,15 +210,15 @@ class dcDrawLists_Tests(wtc.WidgetTestCase): pens = makeRandomPens() brushes = makeRandomBrushes() - + dc.DrawRectangleList(np.array(makeRandomRectangles())) dc.DrawRectangleList(np.array(makeRandomRectangles()),pens) dc.DrawRectangleList(np.array(makeRandomRectangles()),pens[0],brushes) dc.DrawRectangleList(np.array(makeRandomRectangles()),pens,brushes[0]) dc.DrawRectangleList(np.array(makeRandomRectangles()),None,brushes) del dc - - + + def test_dcDrawElipseLists(self): pnl = wx.Panel(self.frame) self.frame.SetSize((w,h)) @@ -228,15 +228,15 @@ class dcDrawLists_Tests(wtc.WidgetTestCase): pens = makeRandomPens() brushes = makeRandomBrushes() - + dc.DrawEllipseList(makeRandomRectangles()) dc.DrawEllipseList(makeRandomRectangles(),pens) dc.DrawEllipseList(makeRandomRectangles(),pens[0],brushes) dc.DrawEllipseList(makeRandomRectangles(),pens,brushes[0]) dc.DrawEllipseList(makeRandomRectangles(),None,brushes) del dc - - + + def test_dcDrawPloygonLists(self): pnl = wx.Panel(self.frame) self.frame.SetSize((w,h)) @@ -247,7 +247,7 @@ class dcDrawLists_Tests(wtc.WidgetTestCase): pens = makeRandomPens() brushes = makeRandomBrushes() polygons = makeRandomPolygons() - + dc.DrawPolygonList(polygons) dc.DrawPolygonList(polygons, pens) dc.DrawPolygonList(polygons, pens[0],brushes) @@ -255,23 +255,23 @@ class dcDrawLists_Tests(wtc.WidgetTestCase): dc.DrawPolygonList(polygons, None,brushes) del dc - + def test_dcDrawTextLists(self): pnl = wx.Panel(self.frame) self.frame.SetSize((w,h)) dc = wx.ClientDC(pnl) dc.SetBackgroundMode(wx.SOLID) - + points = makeRandomPoints() fore = makeRandomColors() back = makeRandomColors() texts = makeRandomText() - + dc.DrawTextList(texts, points, fore, back) del dc - - - + + + #--------------------------------------------------------------------------- if __name__ == '__main__': diff --git a/unittests/test_dcbuffer.py b/unittests/test_dcbuffer.py index 7ee69558..628bf10f 100644 --- a/unittests/test_dcbuffer.py +++ b/unittests/test_dcbuffer.py @@ -6,7 +6,7 @@ import sys #--------------------------------------------------------------------------- class BufferedDCTests(wtc.WidgetTestCase): - + def test_0_CheckKeepReference(self): # 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 @@ -16,14 +16,14 @@ class BufferedDCTests(wtc.WidgetTestCase): bmp = wx.Bitmap(1,1) cdc_cnt1 = sys.getrefcount(cdc) bmp_cnt1 = sys.getrefcount(bmp) - + dc = wx.BufferedDC(cdc, bmp) - + cdc_cnt2 = sys.getrefcount(cdc) bmp_cnt2 = sys.getrefcount(bmp) - + del dc - + cdc_cnt3 = sys.getrefcount(cdc) bmp_cnt3 = sys.getrefcount(bmp) @@ -31,15 +31,15 @@ class BufferedDCTests(wtc.WidgetTestCase): self.assertTrue(cdc_cnt3 == cdc_cnt1) self.assertTrue(bmp_cnt2 == bmp_cnt1 + 1) self.assertTrue(bmp_cnt3 == bmp_cnt1) - - - + + + def test_BufferedDCDefaultCtor(self): dc = wx.BufferedDC() dc.Init(None, wx.Bitmap(25,25)) dc.DrawLine(0,0, 50,50) - - + + def test_BufferedDCCtors(self): dc = wx.BufferedDC(wx.ClientDC(self.frame), wx.Size(100,100)) dc.DrawLine(0,0, 50,50) @@ -48,7 +48,7 @@ class BufferedDCTests(wtc.WidgetTestCase): dc = wx.BufferedDC(None, wx.Bitmap(100,100)) dc.DrawLine(0,0, 50,50) - + def test_BufferedPaintDC(self): class TestPanel(wx.Panel): def __init__(self, *args, **kw): @@ -57,12 +57,12 @@ class BufferedDCTests(wtc.WidgetTestCase): self.Bind(wx.EVT_PAINT, self.onPaint) self.bmp = wx.Bitmap(100,100) self.onPaintCalled = False - + def onPaint(self, evt): dc = wx.BufferedPaintDC(self, self.bmp) dc.DrawLine(0,0, 50,50) self.onPaintCalled = True - + panel = TestPanel(self.frame) self.frame.SendSizeEvent() panel.Refresh() @@ -70,7 +70,7 @@ class BufferedDCTests(wtc.WidgetTestCase): self.waitFor(200) self.assertTrue(panel.onPaintCalled == True) - + def test_AutoBufferedPaintDC(self): class TestPanel(wx.Panel): def __init__(self, *args, **kw): @@ -78,12 +78,12 @@ class BufferedDCTests(wtc.WidgetTestCase): self.SetBackgroundStyle(wx.BG_STYLE_PAINT) self.Bind(wx.EVT_PAINT, self.onPaint) self.onPaintCalled = False - + def onPaint(self, evt): dc = wx.AutoBufferedPaintDC(self) dc.DrawLine(0,0, 50,50) self.onPaintCalled = True - + panel = TestPanel(self.frame) self.frame.SendSizeEvent() panel.Refresh() @@ -91,7 +91,7 @@ class BufferedDCTests(wtc.WidgetTestCase): self.waitFor(200) self.assertTrue(panel.onPaintCalled == True) - + def test_BufferedDCConstantsExist(self): wx.BUFFER_VIRTUAL_AREA wx.BUFFER_CLIENT_AREA diff --git a/unittests/test_dcclient.py b/unittests/test_dcclient.py index f97bbaa5..b237caea 100644 --- a/unittests/test_dcclient.py +++ b/unittests/test_dcclient.py @@ -6,16 +6,16 @@ import sys #--------------------------------------------------------------------------- class ClientDCTests(wtc.WidgetTestCase): - + def test_ClientDC(self): dc = wx.ClientDC(self.frame) dc.DrawLine(0,0, 50,50) - + def test_WindowDC(self): dc = wx.WindowDC(self.frame) dc.DrawLine(0,0, 50,50) - - + + def test_PaintDC(self): class TestPanel(wx.Panel): def __init__(self, *args, **kw): @@ -23,12 +23,12 @@ class ClientDCTests(wtc.WidgetTestCase): #self.SetBackgroundStyle(wx.BG_STYLE_PAINT) self.Bind(wx.EVT_PAINT, self.onPaint) self.onPaintCalled = False - + def onPaint(self, evt): dc = wx.PaintDC(self) dc.DrawLine(0,0, 50,50) self.onPaintCalled = True - + panel = TestPanel(self.frame) self.frame.SendSizeEvent() panel.Refresh() @@ -36,7 +36,7 @@ class ClientDCTests(wtc.WidgetTestCase): self.waitFor(200) self.assertTrue(panel.onPaintCalled == True) - + #--------------------------------------------------------------------------- diff --git a/unittests/test_dcgraph.py b/unittests/test_dcgraph.py index 55924354..373972cb 100644 --- a/unittests/test_dcgraph.py +++ b/unittests/test_dcgraph.py @@ -6,31 +6,31 @@ import sys #--------------------------------------------------------------------------- class dcgraph_tests(wtc.WidgetTestCase): - + def test_GCDC1(self): dc = wx.ClientDC(self.frame) gdc = wx.GCDC(dc) - - + + def test_GCDC2(self): bmp = wx.Bitmap(25,25) dc = wx.MemoryDC(bmp) gdc = wx.GCDC(dc) - + @unittest.skipIf('wxGTK' in wx.PlatformInfo, 'PrinterDC not supported on wxGTK') def test_GCDC3(self): dc = wx.PrinterDC(wx.PrintData()) gdc = wx.GCDC(dc) - - + + def test_GCDC4(self): bmp = wx.Bitmap(25,25) dc = wx.MemoryDC(bmp) ctx = wx.GraphicsContext.Create(dc) gdc = wx.GCDC(ctx) del gdc - + #--------------------------------------------------------------------------- diff --git a/unittests/test_dcmemory.py b/unittests/test_dcmemory.py index a26b2073..fd2b0bdf 100644 --- a/unittests/test_dcmemory.py +++ b/unittests/test_dcmemory.py @@ -6,26 +6,26 @@ import sys #--------------------------------------------------------------------------- class MemoryDCTests(wtc.WidgetTestCase): - + def test_MemoryDC1(self): bmp = wx.Bitmap(250,250) dc = wx.MemoryDC() dc.SelectObject(bmp) dc.DrawLine(0,0, 50,50) - + def test_MemoryDC2(self): bmp = wx.Bitmap(250,250) dc = wx.MemoryDC(bmp) dc.DrawLine(0,0, 50,50) - + def test_MemoryDC3(self): cdc = wx.ClientDC(self.frame) dc = wx.MemoryDC(cdc) bmp = wx.Bitmap(250,250) dc.SelectObject(bmp) dc.DrawLine(0,0, 50,50) - + #--------------------------------------------------------------------------- diff --git a/unittests/test_dcmirror.py b/unittests/test_dcmirror.py index ec814621..05f7df34 100644 --- a/unittests/test_dcmirror.py +++ b/unittests/test_dcmirror.py @@ -6,7 +6,7 @@ import sys #--------------------------------------------------------------------------- class MirrorDCTests(wtc.WidgetTestCase): - + def test_MirrorDC1(self): cdc = wx.ClientDC(self.frame) dc = wx.MirrorDC(cdc, True) diff --git a/unittests/test_dcprint.py b/unittests/test_dcprint.py index 2ba77829..6a329caf 100644 --- a/unittests/test_dcprint.py +++ b/unittests/test_dcprint.py @@ -6,13 +6,13 @@ import sys #--------------------------------------------------------------------------- class dcprint_tests(wtc.WidgetTestCase): - + @unittest.skipIf('wxGTK' in wx.PlatformInfo, 'PrinterDC not supported on wxGTK') def test_PrinterDC1(self): dc = wx.PrinterDC(wx.PrintData()) dc.DrawLine(0,0, 50,50) - - + + #--------------------------------------------------------------------------- diff --git a/unittests/test_dcps.py b/unittests/test_dcps.py index 87f4dab2..e20c4393 100644 --- a/unittests/test_dcps.py +++ b/unittests/test_dcps.py @@ -9,7 +9,7 @@ fileName = os.path.join(os.path.dirname(__file__), 'dcpstest.svg') #--------------------------------------------------------------------------- class dcps_tests(wtc.WidgetTestCase): - + def test_PostscriptDC1(self): pd = wx.PrintData() pd.SetPrintMode(wx.PRINT_MODE_FILE) @@ -25,7 +25,7 @@ class dcps_tests(wtc.WidgetTestCase): del dc os.remove(fileName) - + #--------------------------------------------------------------------------- diff --git a/unittests/test_dcscreen.py b/unittests/test_dcscreen.py index ddacfb70..2af8b436 100644 --- a/unittests/test_dcscreen.py +++ b/unittests/test_dcscreen.py @@ -7,7 +7,7 @@ import sys class ScreenDCTests(wtc.WidgetTestCase): - + def test_ScreenDC1(self): dc = wx.ScreenDC() dc.DrawLine(0,0, 50,50) diff --git a/unittests/test_dcsvg.py b/unittests/test_dcsvg.py index 4d739095..fa68eb08 100644 --- a/unittests/test_dcsvg.py +++ b/unittests/test_dcsvg.py @@ -9,12 +9,12 @@ fileName = 'svgtest.svg' #--------------------------------------------------------------------------- class SvgDCTests(wtc.WidgetTestCase): - + def test_SvgDC1(self): dc = wx.SVGFileDC(fileName) dc.DrawLine(0,0, 50,50) del dc - + os.remove(fileName) #--------------------------------------------------------------------------- diff --git a/unittests/test_deadobj.py b/unittests/test_deadobj.py index 628b5beb..be43016a 100644 --- a/unittests/test_deadobj.py +++ b/unittests/test_deadobj.py @@ -13,7 +13,7 @@ class deadobj_Tests(wtc.WidgetTestCase): # is still safe to call methods of that window object. p = wx.Panel(self.frame) self.assertTrue(True if p else False) - + p.Destroy() self.assertFalse(True if p else False) @@ -31,8 +31,8 @@ class deadobj_Tests(wtc.WidgetTestCase): # the test environment. if 'wxMSW' not in wx.PlatformInfo: self.assertFalse(True if f else False) - - + + def test_deadobjException(self): # There should be a RuntimeError exception if we try to use an object # after it's C++ parts have been detroyed. @@ -40,8 +40,8 @@ class deadobj_Tests(wtc.WidgetTestCase): p.Destroy() with self.assertRaises(RuntimeError): p.IsShown() - - + + #--------------------------------------------------------------------------- diff --git a/unittests/test_debug.py b/unittests/test_debug.py index 08717fff..efc39723 100644 --- a/unittests/test_debug.py +++ b/unittests/test_debug.py @@ -10,7 +10,7 @@ class debug_Tests(wtc.WidgetTestCase): wx.Abort wx.Trap wx.DisableAsserts - + #--------------------------------------------------------------------------- if __name__ == '__main__': diff --git a/unittests/test_defs.py b/unittests/test_defs.py index d40a5063..b8435587 100644 --- a/unittests/test_defs.py +++ b/unittests/test_defs.py @@ -13,7 +13,7 @@ class defs_Tests(wtc.WidgetTestCase): self.assertEqual(wx.INT64_MIN, (-9223372036854775807)-1) self.assertEqual(wx.INT64_MAX, 9223372036854775807) self.assertEqual(wx.UINT64_MAX, 0xFFFFFFFFFFFFFFFF) - + def test_constants2(self): # These constants needed some special tweaking. Make sure it # was done right. diff --git a/unittests/test_dialog.py b/unittests/test_dialog.py index 6f42c593..911e4484 100644 --- a/unittests/test_dialog.py +++ b/unittests/test_dialog.py @@ -7,7 +7,7 @@ import wx class dialog_Tests(wtc.WidgetTestCase): def runDialog(self, dlg): - # Add some buttons + # Add some buttons ok = wx.Button(dlg, wx.ID_OK, pos=(10,10)) cancel = wx.Button(dlg, wx.ID_CANCEL, pos=(100,10)) @@ -19,14 +19,14 @@ class dialog_Tests(wtc.WidgetTestCase): val = dlg.ShowModal() dlg.Destroy() self.assertTrue(val == wx.ID_OK) - self.myYield() - - + self.myYield() + + def test_dialogDefaultCtor(self): dlg = wx.Dialog() dlg.Create(None, title='dialog') self.runDialog(dlg) - + def test_dialog1(self): # with parent dlg = wx.Dialog(self.frame, title='Hello') @@ -36,14 +36,14 @@ class dialog_Tests(wtc.WidgetTestCase): # without parent dlg = wx.Dialog(None, title='World') self.runDialog(dlg) - + def test_dialogTextSizer(self): dlg = wx.Dialog(self.frame, title='Hello') s = dlg.CreateTextSizer("This is a test.\nThis is only a test.\nHello World") self.assertTrue(isinstance(s, wx.Sizer)) self.assertTrue(len(s.Children) == 3) self.runDialog(dlg) - + #--------------------------------------------------------------------------- diff --git a/unittests/test_dirctrl.py b/unittests/test_dirctrl.py index ea2ff726..cec413e1 100644 --- a/unittests/test_dirctrl.py +++ b/unittests/test_dirctrl.py @@ -9,19 +9,19 @@ class dirctrl_Tests(wtc.WidgetTestCase): def test_dirctrlCtor(self): d = wx.GenericDirCtrl(self.frame) - + def test_dirctrlDefaultCtor(self): d = wx.GenericDirCtrl() d.Create(self.frame) - - + + def test_dirctrlFlags(self): wx.DIRCTRL_DIR_ONLY wx.DIRCTRL_SELECT_FIRST wx.DIRCTRL_3D_INTERNAL wx.DIRCTRL_EDIT_LABELS wx.DIRCTRL_MULTIPLE - + #--------------------------------------------------------------------------- if __name__ == '__main__': diff --git a/unittests/test_dirdlg.py b/unittests/test_dirdlg.py index ea99eea9..ba17c2ed 100644 --- a/unittests/test_dirdlg.py +++ b/unittests/test_dirdlg.py @@ -6,11 +6,11 @@ import wx class dirdlg_Tests(wtc.WidgetTestCase): - + def test_dirdlg(self): dlg = wx.DirDialog(self.frame, 'message') dlg.Destroy() - + #--------------------------------------------------------------------------- diff --git a/unittests/test_display.py b/unittests/test_display.py index 34c62a57..94a468e8 100644 --- a/unittests/test_display.py +++ b/unittests/test_display.py @@ -6,7 +6,7 @@ import wx #--------------------------------------------------------------------------- class display_Tests(wtc.WidgetTestCase): - + def test_display(self): d = wx.Display() r = d.GetClientArea() @@ -18,7 +18,7 @@ class display_Tests(wtc.WidgetTestCase): vm = m[0] self.assertTrue(isinstance(vm, wx.VideoMode)) self.assertTrue(vm.IsOk()) - + #--------------------------------------------------------------------------- diff --git a/unittests/test_dnd.py b/unittests/test_dnd.py index 8bbb0406..cf80cc75 100644 --- a/unittests/test_dnd.py +++ b/unittests/test_dnd.py @@ -21,27 +21,27 @@ class dnd_Tests(wtc.WidgetTestCase): wx.DragMove wx.DragLink wx.DragCancel - + def test_dndDropTarget(self): class MyTarget(wx.DropTarget): def OnData(self, x, y, defResult): self.GetData() return defResult - + dt = MyTarget() dt.DefaultAction self.frame.SetDropTarget(dt) - - + + def test_dndDropSource(self): ds = wx.DropSource(self.frame) if 'wxGTK' in wx.PlatformInfo: ds.SetIcon(wx.DragCopy, wx.Icon(icoFile)) else: ds.SetCursor(wx.DragCopy, wx.Cursor(curFile, wx.BITMAP_TYPE_CUR)) - - + + #--------------------------------------------------------------------------- if __name__ == '__main__': diff --git a/unittests/test_dragimag.py b/unittests/test_dragimag.py index f8448947..0281182c 100644 --- a/unittests/test_dragimag.py +++ b/unittests/test_dragimag.py @@ -15,13 +15,13 @@ class dragimag_Tests(wtc.WidgetTestCase): def test_dragimag2(self): di = wx.DragImage(wx.Bitmap(pngFile)) - + def test_dragimag3(self): di = wx.DragImage(wx.Icon(icoFile)) - + def test_dragimag4(self): di = wx.DragImage("Some draggable text") - + def test_dragimag5(self): ctrl = wx.TreeCtrl(self.frame) root = ctrl.AddRoot('root item') @@ -39,13 +39,13 @@ class dragimag_Tests(wtc.WidgetTestCase): def test_genericdragimag2(self): di = wx.GenericDragImage(wx.Bitmap(pngFile)) - + def test_genericdragimag3(self): di = wx.GenericDragImage(wx.Icon(icoFile)) - + def test_genericdragimag4(self): di = wx.GenericDragImage("Some draggable text") - + def test_genericdragimag5(self): ctrl = wx.TreeCtrl(self.frame) root = ctrl.AddRoot('root item') @@ -56,7 +56,7 @@ class dragimag_Tests(wtc.WidgetTestCase): ctrl.AppendColumn('hello') idx = ctrl.InsertItem(0, "a list item") di = wx.GenericDragImage(ctrl, idx) - + #--------------------------------------------------------------------------- if __name__ == '__main__': diff --git a/unittests/test_editlbox.py b/unittests/test_editlbox.py index ae3e4f4d..849141b9 100644 --- a/unittests/test_editlbox.py +++ b/unittests/test_editlbox.py @@ -8,10 +8,10 @@ import wx.adv class editlbox_Tests(wtc.WidgetTestCase): def test_editlbox1(self): - wx.adv.EL_ALLOW_NEW - wx.adv.EL_ALLOW_EDIT - wx.adv.EL_ALLOW_DELETE - wx.adv.EL_NO_REORDER + wx.adv.EL_ALLOW_NEW + wx.adv.EL_ALLOW_EDIT + wx.adv.EL_ALLOW_DELETE + wx.adv.EL_NO_REORDER wx.adv.EL_DEFAULT_STYLE def test_editlbox2(self): @@ -20,7 +20,7 @@ class editlbox_Tests(wtc.WidgetTestCase): elb.SetStrings(strings) self.assertEqual(strings, elb.GetStrings()) self.assertEqual(strings, elb.Strings) - + def test_editlbox3(self): elb = wx.adv.EditableListBox() elb.Create(self.frame, label="EditableListBox") @@ -28,8 +28,8 @@ class editlbox_Tests(wtc.WidgetTestCase): elb.SetStrings(strings) self.assertEqual(strings, elb.GetStrings()) self.assertEqual(strings, elb.Strings) - - + + #--------------------------------------------------------------------------- if __name__ == '__main__': diff --git a/unittests/test_event.py b/unittests/test_event.py index 1b94f9ac..28f42478 100644 --- a/unittests/test_event.py +++ b/unittests/test_event.py @@ -5,15 +5,15 @@ import wx #--------------------------------------------------------------------------- class Events(unittest.TestCase): - + # Test the constructors to make sure the classes are not abstract, except # for wx.Event - + def test_Event_ctor(self): with self.assertRaises(TypeError): # it's an abstract class, so it can't be instantiated evt = wx.Event() - + def test_CommandEvent_ctor(self): evt = wx.CommandEvent() @@ -127,8 +127,8 @@ class Events(unittest.TestCase): def test_WindowDestroyEvent_ctor(self): evt = wx.WindowDestroyEvent() - - + + def test_eventBinding(self): class Frame(wx.Frame): def __init__(self, *args, **kw): @@ -144,8 +144,8 @@ class Events(unittest.TestCase): frm.SetSize((200,100)) #app.MainLoop() self.assertTrue(frm.gotEvent) - - + + def test_DropFilesEvent_tweaks(self): evt = wx.DropFilesEvent(123, 'one two three four five'.split()) self.assertTrue(evt.NumberOfFiles == 5) @@ -161,8 +161,8 @@ class Events(unittest.TestCase): wx.EVT_CATEGORY_TIMER wx.EVT_CATEGORY_THREAD wx.EVT_CATEGORY_ALL - - + + def test_evtHandlerSubclass(self): class MyEvtHandler(wx.EvtHandler): def __init__(self, **kwds): @@ -170,8 +170,8 @@ class Events(unittest.TestCase): eh = MyEvtHandler() eh.Destroy() - - + + #--------------------------------------------------------------------------- diff --git a/unittests/test_fdrepdlg.py b/unittests/test_fdrepdlg.py index b13db4a3..8232af7a 100644 --- a/unittests/test_fdrepdlg.py +++ b/unittests/test_fdrepdlg.py @@ -14,17 +14,17 @@ class fdrepdlg_Tests(wtc.WidgetTestCase): wx.FR_NOUPDOWN wx.FR_NOMATCHCASE wx.FR_NOWHOLEWORD - + def test_fdrepdlgDlg(self): data = wx.FindReplaceData() data.SetFindString('find string') data.SetReplaceString('replace') self.assertEqual(data.FindString, 'find string') - + dlg = wx.FindReplaceDialog(self.frame, data, 'Find Stuff') dlg.GetData() dlg.Destroy() - + #--------------------------------------------------------------------------- if __name__ == '__main__': diff --git a/unittests/test_filectrl.py b/unittests/test_filectrl.py index a7100f1a..9189048c 100644 --- a/unittests/test_filectrl.py +++ b/unittests/test_filectrl.py @@ -9,16 +9,16 @@ class filectrl_Tests(wtc.WidgetTestCase): def test_filectrl1(self): fc = wx.FileCtrl(self.frame) - + def test_filectrl2(self): fc = wx.FileCtrl() fc.Create(self.frame) - + def test_filectrl3(self): - wx.FC_OPEN - wx.FC_SAVE - wx.FC_MULTIPLE - wx.FC_NOSHOWHIDDEN + wx.FC_OPEN + wx.FC_SAVE + wx.FC_MULTIPLE + wx.FC_NOSHOWHIDDEN wx.FC_DEFAULT_STYLE wx.wxEVT_FILECTRL_SELECTIONCHANGED @@ -30,15 +30,15 @@ class filectrl_Tests(wtc.WidgetTestCase): wx.EVT_FILECTRL_FOLDERCHANGED wx.EVT_FILECTRL_FILTERCHANGED wx.FileCtrlEvent - - + + def test_filectrl4(self): fc = wx.FileCtrl(self.frame, defaultDirectory=os.path.dirname(__file__), defaultFilename=os.path.basename(__file__), style=wx.FC_OPEN) self.waitFor(50) - + self.assertEqual(fc.GetFilename(), os.path.basename(__file__)) self.assertEqual(fc.GetPath(), os.path.abspath(__file__)) self.assertEqual(fc.Filename, os.path.basename(__file__)) @@ -51,13 +51,13 @@ class filectrl_Tests(wtc.WidgetTestCase): defaultFilename=os.path.basename(__file__), style=wx.FC_OPEN|wx.FC_MULTIPLE) self.waitFor(50) - + self.assertEqual(fc.GetFilenames(), [os.path.basename(__file__)]) self.assertEqual(fc.GetPaths(), [os.path.abspath(__file__)]) self.assertEqual(fc.Filenames, [os.path.basename(__file__)]) self.assertEqual(fc.Paths, [os.path.abspath(__file__)]) - - + + #--------------------------------------------------------------------------- if __name__ == '__main__': diff --git a/unittests/test_filedlg.py b/unittests/test_filedlg.py index e2a1b6fb..7a50c280 100644 --- a/unittests/test_filedlg.py +++ b/unittests/test_filedlg.py @@ -15,13 +15,13 @@ class filedlg_Tests(wtc.WidgetTestCase): wx.FD_MULTIPLE wx.FD_CHANGE_DIR wx.FD_PREVIEW - + def test_filedlg(self): # a typical use case dlg = wx.FileDialog(self.frame, 'message', os.getcwd(), "", wildcard="Python source (*.py)|*.py") dlg.Destroy() - + def test_filedlgProperties(self): dlg = wx.FileDialog(None) dlg.Directory @@ -34,7 +34,7 @@ class filedlg_Tests(wtc.WidgetTestCase): dlg.Filenames dlg.Paths dlg.Destroy() - + def test_filedlgTweaks(self): dlg = wx.FileDialog(None, style=wx.FD_MULTIPLE) f = dlg.GetFilenames() @@ -42,7 +42,7 @@ class filedlg_Tests(wtc.WidgetTestCase): self.assertTrue(isinstance(f, list)) self.assertTrue(isinstance(p, list)) dlg.Destroy() - + #--------------------------------------------------------------------------- diff --git a/unittests/test_filehistory.py b/unittests/test_filehistory.py index 4cd50f1c..8a8440e5 100644 --- a/unittests/test_filehistory.py +++ b/unittests/test_filehistory.py @@ -10,25 +10,25 @@ class filehistory_Tests(wtc.WidgetTestCase): fh = wx.FileHistory() for fn in "one two three four".split(): fh.AddFileToHistory(fn) - + self.assertEqual(fh.GetCount(), 4) self.assertEqual(fh.Count, 4) self.assertEqual(fh.GetHistoryFile(1), 'three') # they are in LIFO order m = wx.Menu() fh.AddFilesToMenu(m) - + def test_filehistory2(self): fh = wx.FileHistory() for fn in "one two three four".split(): fh.AddFileToHistory(fn) - + menu1 = wx.Menu() menu2 = wx.Menu() fh.UseMenu(menu1) fh.UseMenu(menu2) fh.AddFilesToMenu() - + lst = fh.GetMenus() self.assertTrue(isinstance(lst, wx.FileHistoryMenuList)) self.assertTrue(len(lst) == 2) @@ -37,7 +37,7 @@ class filehistory_Tests(wtc.WidgetTestCase): self.assertTrue(isinstance(lst[1], wx.Menu)) self.assertTrue(lst[0] is menu1) self.assertTrue(lst[1] is menu2) - + #--------------------------------------------------------------------------- if __name__ == '__main__': diff --git a/unittests/test_filesys.py b/unittests/test_filesys.py index d5bada50..1f733eba 100644 --- a/unittests/test_filesys.py +++ b/unittests/test_filesys.py @@ -9,7 +9,7 @@ import os class filesys_Tests(wtc.WidgetTestCase): 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.FSFile wx.FileSystemHandler @@ -21,16 +21,16 @@ class filesys_Tests(wtc.WidgetTestCase): def test_filesys02(self): wx.FileSystem.AddHandler(wx.ArchiveFSHandler()) - + def test_filesys03(self): wx.FileSystem.AddHandler(wx.InternetFSHandler()) def test_filesys04(self): wx.FileSystem.AddHandler(wx.MemoryFSHandler()) - + # TODO: Add more tests. - + #--------------------------------------------------------------------------- diff --git a/unittests/test_font.py b/unittests/test_font.py index 75552846..74e28140 100644 --- a/unittests/test_font.py +++ b/unittests/test_font.py @@ -8,23 +8,23 @@ import os class font_Tests(wtc.WidgetTestCase): def test_fontFlags(self): - wx.FONTFAMILY_DEFAULT - wx.FONTFAMILY_DECORATIVE - wx.FONTFAMILY_ROMAN - wx.FONTFAMILY_SCRIPT - wx.FONTFAMILY_SWISS + wx.FONTFAMILY_DEFAULT + wx.FONTFAMILY_DECORATIVE + wx.FONTFAMILY_ROMAN + wx.FONTFAMILY_SCRIPT + wx.FONTFAMILY_SWISS wx.FONTFAMILY_MODERN wx.FONTFAMILY_TELETYPE - wx.FONTFAMILY_UNKNOWN - - wx.FONTSTYLE_NORMAL + wx.FONTFAMILY_UNKNOWN + + wx.FONTSTYLE_NORMAL wx.FONTSTYLE_ITALIC wx.FONTSTYLE_SLANT wx.FONTWEIGHT_NORMAL wx.FONTWEIGHT_LIGHT wx.FONTWEIGHT_BOLD - + wx.FONTSIZE_XX_SMALL wx.FONTSIZE_X_SMALL wx.FONTSIZE_SMALL @@ -32,17 +32,17 @@ class font_Tests(wtc.WidgetTestCase): wx.FONTSIZE_LARGE wx.FONTSIZE_X_LARGE wx.FONTSIZE_XX_LARGE - - wx.FONTFLAG_DEFAULT - wx.FONTFLAG_ITALIC - wx.FONTFLAG_SLANT - wx.FONTFLAG_LIGHT - wx.FONTFLAG_BOLD - wx.FONTFLAG_ANTIALIASED - wx.FONTFLAG_NOT_ANTIALIASED - wx.FONTFLAG_UNDERLINED - wx.FONTFLAG_STRIKETHROUGH - + + wx.FONTFLAG_DEFAULT + wx.FONTFLAG_ITALIC + wx.FONTFLAG_SLANT + wx.FONTFLAG_LIGHT + wx.FONTFLAG_BOLD + wx.FONTFLAG_ANTIALIASED + wx.FONTFLAG_NOT_ANTIALIASED + wx.FONTFLAG_UNDERLINED + wx.FONTFLAG_STRIKETHROUGH + wx.FONTENCODING_SYSTEM wx.FONTENCODING_DEFAULT wx.FONTENCODING_ISO8859_1 @@ -142,22 +142,22 @@ class font_Tests(wtc.WidgetTestCase): wx.FONTENCODING_BIG5 wx.FONTENCODING_SHIFT_JIS wx.FONTENCODING_EUC_KR - - + + def test_fontFlagsOld(self): - wx.DEFAULT - wx.DECORATIVE - wx.ROMAN - wx.SCRIPT - wx.SWISS - wx.MODERN - wx.TELETYPE - wx.NORMAL - wx.LIGHT - wx.BOLD - wx.NORMAL - wx.ITALIC - wx.SLANT + wx.DEFAULT + wx.DECORATIVE + wx.ROMAN + wx.SCRIPT + wx.SWISS + wx.MODERN + wx.TELETYPE + wx.NORMAL + wx.LIGHT + wx.BOLD + wx.NORMAL + wx.ITALIC + wx.SLANT def test_font(self): @@ -170,17 +170,17 @@ class font_Tests(wtc.WidgetTestCase): # this ctor was removed #f7 = wx.Font(18, wx.FONTFAMILY_SWISS, wx.FONTFLAG_BOLD|wx.FONTFLAG_ITALIC) - + def test_fontFontinfo1(self): fi1 = wx.FontInfo().Family(wx.FONTFAMILY_ROMAN).Bold().Italic().Underlined().Strikethrough() fi2 = wx.FontInfo(12).FaceName('Ariel').Light().Encoding(wx.FONTENCODING_ISO8859_1) fi3 = wx.FontInfo((8,12)).AllFlags(wx.FONTFLAG_BOLD|wx.FONTFLAG_ITALIC) - - + + def test_fontFontinfo2(self): f1 = wx.Font(wx.FontInfo(12).Family(wx.FONTFAMILY_SWISS).Italic()) - - + + def test_fontOk(self): f1 = wx.Font() 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) self.assertTrue(f1 == f2) self.assertTrue(f1 != f3) - - + + def test_fontProperties(self): f = wx.FFont(18, wx.FONTFAMILY_SWISS) f.Encoding @@ -229,8 +229,8 @@ class font_Tests(wtc.WidgetTestCase): def test_fontOldStyleNames(self): f = wx.Font(8, wx.SWISS, wx.NORMAL, wx.NORMAL) - - + + #--------------------------------------------------------------------------- diff --git a/unittests/test_fontdlg.py b/unittests/test_fontdlg.py index 500a9a84..cdf354ce 100644 --- a/unittests/test_fontdlg.py +++ b/unittests/test_fontdlg.py @@ -13,18 +13,18 @@ class fontdlg_Tests(wtc.WidgetTestCase): data.SetInitialFont(wx.FFont(15, wx.FONTFAMILY_MODERN)) self.assertTrue(data.InitialFont.Family == wx.FONTFAMILY_MODERN or data.InitialFont.Family == wx.FONTFAMILY_TELETYPE) - + data.SetInitialFont(wx.FFont(15, wx.FONTFAMILY_SWISS)) self.assertEqual(data.InitialFont.Family, wx.FONTFAMILY_SWISS) dlg = wx.FontDialog(self.frame, data) # TODO: find a safe way to test ShowModal on native dialogs dlg.Destroy() - - + + def test_fontdlg2(self): wx.GetFontFromUser - + #--------------------------------------------------------------------------- if __name__ == '__main__': diff --git a/unittests/test_fontenum.py b/unittests/test_fontenum.py index 1d449bee..b1cde359 100644 --- a/unittests/test_fontenum.py +++ b/unittests/test_fontenum.py @@ -12,15 +12,15 @@ class fontenum_Tests(wtc.WidgetTestCase): enc = wx.FontEnumerator.GetEncodings() self.assertTrue(isinstance(enc, list)) self.assertTrue(len(enc) > 0) - + def test_fontenum2(self): faces = wx.FontEnumerator.GetFacenames() self.assertTrue(isinstance(faces, list)) self.assertTrue(len(faces) > 0) - + fw_faces = wx.FontEnumerator.GetFacenames(fixedWidthOnly=True) self.assertTrue(len(fw_faces) < len(faces)) - + def test_fontenum3(self): class MyFontEnumerator(wx.FontEnumerator): @@ -28,14 +28,14 @@ class fontenum_Tests(wtc.WidgetTestCase): wx.FontEnumerator.__init__(self) self.my_faces = list() self.my_enc = list() - + def OnFacename(self, name): self.my_faces.append(name) return len(self.my_faces) < 5 # quit when we've got 5 def OnFontEncoding(self, facename, encoding): self.my_enc.append( (facename, encoding) ) return len(self.my_enc) < 5 # quit when we've got 5 - + mfe = MyFontEnumerator() mfe.EnumerateFacenames() 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': mfe.EnumerateEncodings() self.assertTrue(len(mfe.my_enc) > 0 and len(mfe.my_enc) <= 5) - + #--------------------------------------------------------------------------- if __name__ == '__main__': diff --git a/unittests/test_fontmap.py b/unittests/test_fontmap.py index 0edfa474..637d96e9 100644 --- a/unittests/test_fontmap.py +++ b/unittests/test_fontmap.py @@ -9,7 +9,7 @@ class fontmap_Tests(wtc.WidgetTestCase): def test_fontmap1(self): fm = wx.FontMapper.Get() self.assertTrue(fm is not None) - + def test_fontmap2(self): names = wx.FontMapper.GetAllEncodingNames(wx.FONTENCODING_SYSTEM) names = wx.FontMapper.GetAllEncodingNames(wx.FONTENCODING_ISO8859_1) @@ -18,8 +18,8 @@ class fontmap_Tests(wtc.WidgetTestCase): fm = wx.FontMapper.Get() enc = fm.CharsetToEncoding('ISO-8859-1') self.assertEqual(enc, wx.FONTENCODING_ISO8859_1) - - + + #--------------------------------------------------------------------------- if __name__ == '__main__': diff --git a/unittests/test_fontutil.py b/unittests/test_fontutil.py index afab1f71..92625945 100644 --- a/unittests/test_fontutil.py +++ b/unittests/test_fontutil.py @@ -11,12 +11,12 @@ class fontutil_Tests(wtc.WidgetTestCase): f1 = wx.FFont(12, wx.FONTFAMILY_SWISS) i1 = f1.GetNativeFontInfo() st = i1.ToString() - + i2 = wx.NativeFontInfo() i2.FromString(st) f2 = wx.Font(i2) self.assertTrue(f1 == f2) - + def test_fontutilProperties(self): nfi = wx.NativeFontInfo() nfi.InitFromFont(wx.NORMAL_FONT) @@ -30,7 +30,7 @@ class fontutil_Tests(wtc.WidgetTestCase): nfi.Weight - + #--------------------------------------------------------------------------- diff --git a/unittests/test_frame.py b/unittests/test_frame.py index ea9fa20e..533608f2 100644 --- a/unittests/test_frame.py +++ b/unittests/test_frame.py @@ -8,8 +8,8 @@ import os class frame_Tests(wtc.WidgetTestCase): def test_frameStyles(self): - wx.FRAME_NO_TASKBAR - wx.FRAME_TOOL_WINDOW + wx.FRAME_NO_TASKBAR + wx.FRAME_TOOL_WINDOW wx.FRAME_FLOAT_ON_PARENT wx.FRAME_SHAPED diff --git a/unittests/test_fswatcher.py b/unittests/test_fswatcher.py index ddece917..0daea970 100644 --- a/unittests/test_fswatcher.py +++ b/unittests/test_fswatcher.py @@ -8,14 +8,14 @@ import os class fswatcher_Tests(wtc.WidgetTestCase): def test_fswatcher1(self): - + evtLoop = self.app.GetTraits().CreateEventLoop() activator = wx.EventLoopActivator(evtLoop) # automatically restores the old one watcher = wx.FileSystemWatcher() watcher.Add(os.getcwd()) watcher.Bind(wx.EVT_FSWATCHER, lambda evt: None) - - + + #--------------------------------------------------------------------------- if __name__ == '__main__': diff --git a/unittests/test_gauge.py b/unittests/test_gauge.py index ee9ea88d..06e88da5 100644 --- a/unittests/test_gauge.py +++ b/unittests/test_gauge.py @@ -10,17 +10,17 @@ class gauge_Tests(wtc.WidgetTestCase): def test_gauge(self): g1 = wx.Gauge(self.frame) g2 = wx.Gauge(self.frame, range=1000, style=wx.GA_VERTICAL) - + def test_gaugeProperties(self): g = wx.Gauge(self.frame) - + g.BezelFace g.Range g.ShadowWidth g.Value - - - + + + #--------------------------------------------------------------------------- diff --git a/unittests/test_gbsizer.py b/unittests/test_gbsizer.py index 126badbe..113c544c 100644 --- a/unittests/test_gbsizer.py +++ b/unittests/test_gbsizer.py @@ -23,14 +23,14 @@ class gbsizer_Tests(wtc.WidgetTestCase): self.assertTrue(p1.Row == 5 and p1.Col == 6) self.assertTrue(p1 == wx.GBPosition(5,6)) self.assertTrue(p1 != wx.GBPosition(3,4)) - + def test_gbsizer_pos3(self): p1 = wx.GBPosition(3,4) self.assertTrue(p1 == (3,4)) self.assertTrue(p1.Get() == (3,4)) p1.Set(5,6) self.assertTrue(p1 == (5,6)) - + def test_gbsizer_pos4(self): p1 = wx.GBPosition(3,4) r,c = p1 @@ -38,8 +38,8 @@ class gbsizer_Tests(wtc.WidgetTestCase): p1[0] = 5 p1[1] = 6 self.assertTrue((p1.row, p1.col) == (5,6)) - - + + 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 == wx.GBSpan(5,6)) self.assertTrue(s1 != wx.GBSpan(3,4)) - + def test_gbsizer_span3(self): s1 = wx.GBSpan(3,4) self.assertTrue(s1 == (3,4)) self.assertTrue(s1.Get() == (3,4)) s1.Set(5,6) self.assertTrue(s1 == (5,6)) - + def test_gbsizer_span4(self): s1 = wx.GBSpan(3,4) r,c = s1 @@ -74,7 +74,7 @@ class gbsizer_Tests(wtc.WidgetTestCase): s1[0] = 5 s1[1] = 6 self.assertTrue((s1.rowspan, s1.colspan) == (5,6)) - + def test_gbsizer_sizer1(self): @@ -105,7 +105,7 @@ class gbsizer_Tests(wtc.WidgetTestCase): self.assertTrue(items[1].IsSizer()) self.assertTrue(items[2].IsSpacer()) self.assertTrue(items[0].Border == 5) - + #--------------------------------------------------------------------------- diff --git a/unittests/test_gdicmn.py b/unittests/test_gdicmn.py index d7b7fa41..71847797 100644 --- a/unittests/test_gdicmn.py +++ b/unittests/test_gdicmn.py @@ -5,28 +5,28 @@ import wx #--------------------------------------------------------------------------- class Point(unittest.TestCase): - + def test_default_ctor(self): p = wx.Point() self.assertTrue(p == (0,0)) - + def test_xy_ctor(self): p = wx.Point(123,456) - + def test_RealPoint_ctor(self): p = wx.Point(wx.RealPoint(1.2, 2.9)) self.assertTrue(p == (1,2)) - + def test_copy_ctor(self): p1 = wx.Point(3,4) p2 = wx.Point(p1) self.assertTrue(p1 is not p2) self.assertTrue(p1 == p2) - + def test_bogus_ctor1(self): with self.assertRaises(TypeError): p = wx.Point('fiddle-fadle') - + def test_bogus_ctor2(self): with self.assertRaises(TypeError): p = wx.Point(1,2,3) @@ -34,13 +34,13 @@ class Point(unittest.TestCase): def test_DefaultPosition(self): wx.DefaultPosition self.assertTrue(wx.DefaultPosition == (-1,-1)) - + def test_FullySpecified(self): p = wx.Point(1,2) self.assertTrue(p.IsFullySpecified()) p = wx.Point(-1,2) self.assertTrue(not p.IsFullySpecified()) - + def test_xy(self): p = wx.Point(2, 3) self.assertTrue(p.x == 2 and p.y == 3) @@ -48,12 +48,12 @@ class Point(unittest.TestCase): p.y += 2 self.assertTrue(p.x == 3 and p.y == 5) self.assertTrue(p == (3,5)) - + def test_Get(self): p = wx.Point(5,6) self.assertTrue(type(p.Get()) == tuple) self.assertTrue(p.Get() == (5,6)) - + def test_operators(self): p1 = wx.Point(100, 500) p2 = wx.Point(50, 100) @@ -78,8 +78,8 @@ class Point(unittest.TestCase): self.assertFalse(p1 != p2) self.assertFalse(p1 == p3) self.assertTrue(p1 != p3) - - + + def test_magic(self): p = wx.Point(5,6) self.assertTrue(str(p) == "(5, 6)") @@ -92,7 +92,7 @@ class Point(unittest.TestCase): self.assertTrue(p == (6,8)) with self.assertRaises(IndexError): p[2] - + def test_math(self): p = wx.Point(4,6) p1 = p + wx.Point(4,2) @@ -101,89 +101,89 @@ class Point(unittest.TestCase): p4 = p / 2 p5 = p - wx.Point(4,2) p6 = -p - + self.assertTrue(isinstance(p1, wx.Point)) self.assertTrue(isinstance(p2, wx.Point)) self.assertTrue(isinstance(p3, wx.Point)) self.assertTrue(isinstance(p4, wx.Point)) self.assertTrue(isinstance(p5, wx.Point)) self.assertTrue(isinstance(p6, wx.Point)) - + self.assertEqual(p1, (8,8)) self.assertEqual(p2, (8,8)) self.assertEqual(p3, (8,12)) self.assertEqual(p4, (2,3)) self.assertEqual(p5, (0,4)) self.assertEqual(p6, (-4,-6)) - - - + + + #--------------------------------------------------------------------------- class Size(unittest.TestCase): - + def test_default_ctor(self): s = wx.Size() self.assertTrue(s == (0,0)) - + def test_wh_ctor(self): s = wx.Size(100,200) - + def test_copy_ctor(self): s1 = wx.Size(100,200) s2 = wx.Size(s1) self.assertTrue(s1 is not s2) - self.assertTrue(s1 == s2) - + self.assertTrue(s1 == s2) + def test_bogus_ctor(self): with self.assertRaises(TypeError): s = wx.Size("aa", "bb") - + def test_DecBy(self): s = wx.Size(100,100) s.DecBy(wx.Point(5,5)) self.assertTrue(s == (95,95)) s.DecBy(wx.Size(5,5)) - self.assertTrue(s == (90,90)) + self.assertTrue(s == (90,90)) s.DecBy(5,5) - self.assertTrue(s == (85,85)) + self.assertTrue(s == (85,85)) s.DecBy(5) - self.assertTrue(s == (80,80)) + self.assertTrue(s == (80,80)) s.DecBy( (5,5) ) - self.assertTrue(s == (75,75)) - - + self.assertTrue(s == (75,75)) + + def test_IncBy(self): s = wx.Size(50,50) s.IncBy(wx.Point(5,5)) self.assertTrue(s == (55,55)) s.IncBy(wx.Size(5,5)) - self.assertTrue(s == (60,60)) + self.assertTrue(s == (60,60)) s.IncBy(5,5) - self.assertTrue(s == (65,65)) + self.assertTrue(s == (65,65)) s.IncBy(5) - self.assertTrue(s == (70,70)) + self.assertTrue(s == (70,70)) s.IncBy( (5,5) ) - self.assertTrue(s == (75,75)) - + self.assertTrue(s == (75,75)) + def test_DecTo(self): s = wx.Size(5, 15) s.DecTo( (10,10) ) self.assertTrue(s == (5,10)) - + def test_IncTo(self): s = wx.Size(5, 15) s.IncTo( (10,10) ) self.assertTrue(s == (10,15)) - + def test_properties(self): s = wx.Size(23,34) self.assertTrue(s.width == 23 and s.height == 34) s.width += 1 s.height += 1 self.assertTrue(s == (24,35)) - + def test_operators(self): s1 = wx.Size(100,200) s2 = wx.Size(30,40) @@ -198,11 +198,11 @@ class Size(unittest.TestCase): s = s1 + s2 s = s1 - s2 s = s1 / 5 - + def test_DefaultSize(self): ds = wx.DefaultSize self.assertTrue(ds == (-1,-1)) - + def test_GetSet(self): s = wx.Size(100,200) t = s.Get() @@ -210,17 +210,17 @@ class Size(unittest.TestCase): self.assertTrue(t == (100,200)) s.Set(5,10) self.assertTrue(s.Get() == (5,10)) - + def test_SetDefaults(self): s = wx.Size(50, -1) s.SetDefaults( (25,25) ) self.assertTrue(s == (50,25)) - + def test_FullySpecified(self): self.assertTrue(wx.Size(40,50).IsFullySpecified()) self.assertTrue(not wx.Size(-1,50).IsFullySpecified()) self.assertTrue(not wx.Size(40,-1).IsFullySpecified()) - + def test_magic(self): s = wx.Size(5,6) self.assertTrue(str(s) == "(5, 6)") @@ -233,41 +233,41 @@ class Size(unittest.TestCase): self.assertTrue(s == (6,8)) with self.assertRaises(IndexError): s[2] - - + + #--------------------------------------------------------------------------- - - + + class RealPoint(unittest.TestCase): - + def test_default_ctor(self): p = wx.RealPoint() - + def test_xy_ctor(self): p = wx.RealPoint(12.3, 34.5) - + def test_Point_ctor(self): p = wx.RealPoint(wx.Point(3,5)) p = wx.RealPoint( (3,5) ) - + def test_copy_ctor(self): p1 = wx.RealPoint(12.3, 45.6) p2 = wx.RealPoint(p1) - + def test_properties(self): p = wx.RealPoint(12.3, 45.6) p.x += 2 p.y += 2 - - + + #--------------------------------------------------------------------------- - + class Rect(unittest.TestCase): - + def test_default_ctor(self): r = wx.Rect() - + def test_xywh_ctor(self): 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) self.assertTrue(r1 == r2) self.assertTrue(r2 == (1,2,3,4)) - + def test_possize_ctor(self): r = wx.Rect(wx.Point(10,10), wx.Size(100,100)) self.assertTrue(r.width == 100 and r.height == 100) self.assertTrue(r.x == 10 and r.y == 10) self.assertTrue(r == wx.Rect(pos=(10,10), size=(100,100))) - + def test_tlbr_ctor(self): # 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 @@ -297,12 +297,12 @@ class Rect(unittest.TestCase): r = wx.Rect(wx.Size(50,100)) self.assertTrue(r.width == 50 and r.height == 100) self.assertTrue(r.x == 0 and r.y == 0) - - + + # TODO: more tests! - - - + + + #--------------------------------------------------------------------------- class intersectRect_Tests(wtc.WidgetTestCase): @@ -311,15 +311,15 @@ class intersectRect_Tests(wtc.WidgetTestCase): r2 = wx.Rect(50,50,10,10) r3 = wx.IntersectRect(r1, r2) self.assertEqual(r3, None) - + def test_intersectRect02(self): r1 = wx.Rect(0,0,55,55) r2 = wx.Rect(50,50,10,10) r3 = wx.IntersectRect(r1, r2) self.assertEqual(r3, wx.Rect(50,50,5,5)) - - - + + + #--------------------------------------------------------------------------- if __name__ == '__main__': diff --git a/unittests/test_geometry.py b/unittests/test_geometry.py index 9086a7a6..8433fb2d 100644 --- a/unittests/test_geometry.py +++ b/unittests/test_geometry.py @@ -5,42 +5,41 @@ import wx #--------------------------------------------------------------------------- class Point2D(unittest.TestCase): - + def test_default_ctor(self): p = wx.Point2D() - + def test_xy_ctor(self): p = wx.Point2D(12.3, 45.6) - + def test_copy_ctor(self): p1 = wx.Point2D(1.23, 4.56) p2 = wx.Point2D(p1) self.assertTrue(p1 == p2) self.assertTrue(p1 is not p2) self.assertTrue(p1 == (1.23, 4.56)) - - + + class Rect2D(unittest.TestCase): def test_default_ctor(self): r = wx.Rect2D() - + def test_xywh_ctor(self): r = wx.Rect2D(.5, .5, 100.1, 99.2) - + def test_copy_ctor(self): r1 = wx.Rect2D(.5, .5, 100.1, 99.2) r2 = wx.Rect2D(r1) self.assertTrue(r1 == r2) self.assertTrue(r1 is not r2) self.assertTrue(r1 == (.5, .5, 100.1, 99.2)) - - - + + + #--------------------------------------------------------------------------- if __name__ == '__main__': unittest.main() - \ No newline at end of file diff --git a/unittests/test_glcanvas.py b/unittests/test_glcanvas.py index d09a70da..917d6ef6 100644 --- a/unittests/test_glcanvas.py +++ b/unittests/test_glcanvas.py @@ -26,12 +26,12 @@ class glcanvas_Tests(wtc.WidgetTestCase): wx.glcanvas.WX_GL_MIN_ACCUM_ALPHA wx.glcanvas.WX_GL_SAMPLE_BUFFERS wx.glcanvas.WX_GL_SAMPLES - + def test_glcanvas2(self): cvs = wx.glcanvas.GLCanvas(self.frame) ctx = wx.glcanvas.GLContext(cvs) - + def test_glcanvas3(self): attribs = [wx.glcanvas.WX_GL_DEPTH_SIZE, 32, @@ -39,14 +39,14 @@ class glcanvas_Tests(wtc.WidgetTestCase): 0] cvs = wx.glcanvas.GLCanvas(self.frame, attribList=attribs) - + def test_glcanvas4(self): attribs = [wx.glcanvas.WX_GL_DEPTH_SIZE, 32, wx.glcanvas.WX_GL_DOUBLEBUFFER, 0] wx.glcanvas.GLCanvas.IsDisplaySupported(attribs) - - + + #--------------------------------------------------------------------------- diff --git a/unittests/test_graphics.py b/unittests/test_graphics.py index 0b24e292..26cb520d 100644 --- a/unittests/test_graphics.py +++ b/unittests/test_graphics.py @@ -22,7 +22,7 @@ class graphics_Tests(wtc.WidgetTestCase): img = wx.Image(100,100) gc = wx.GraphicsContext.Create(img) self.assertTrue(gc.IsOk()) - + def test_gcCreateBitmap(self): self.waitFor(50) gc = wx.GraphicsContext.Create(self.frame) @@ -31,7 +31,7 @@ class graphics_Tests(wtc.WidgetTestCase): gb = gc.CreateBitmap(bmp) self.assertTrue(gb.IsOk()) self.assertTrue(isinstance(gb, wx.GraphicsBitmap)) - + img = wx.Image(100,100) gb = gc.CreateBitmapFromImage(img) self.assertTrue(gb.IsOk()) @@ -39,7 +39,7 @@ class graphics_Tests(wtc.WidgetTestCase): if 'wxGTK' not in wx.PlatformInfo: gb = gc.CreateSubBitmap(gb, 5, 5, 25, 25) self.assertTrue(gb.IsOk()) - + img = gb.ConvertToImage() self.assertTrue(img.IsOk()) @@ -56,7 +56,7 @@ class graphics_Tests(wtc.WidgetTestCase): gf = gc.CreateFont(wx.NORMAL_FONT) self.assertTrue(gf.IsOk()) self.assertTrue(isinstance(gf, wx.GraphicsFont)) - + gf = gc.CreateFont(15, 'Courier') self.assertTrue(gf.IsOk()) @@ -74,90 +74,90 @@ class graphics_Tests(wtc.WidgetTestCase): p = gc.CreatePath() self.assertTrue(p.IsOk()) self.assertTrue(isinstance(p, wx.GraphicsPath)) - + def test_gcCreateMatrix(self): self.waitFor(50) gc = wx.GraphicsContext.Create(self.frame) m = gc.CreateMatrix() self.assertTrue(m.IsOk()) self.assertTrue(isinstance(m, wx.GraphicsMatrix)) - + values = m.Get() self.assertTrue(len(values) == 6) - + dx, dy = m.TransformDistance(5,6) x,y = m.TransformPoint(7,8) - - + + def test_gcTextExtents(self): self.waitFor(50) gc = wx.GraphicsContext.Create(self.frame) gf = gc.CreateFont(wx.NORMAL_FONT) gc.SetFont(gf) - + ext = gc.GetPartialTextExtents("Hello") self.assertEqual(len(ext), 5) - + w, h, d, e = gc.GetFullTextExtent("Hello") w, h = gc.GetTextExtent("Hello") - - - + + + def test_gcStrokeLines1(self): self.waitFor(50) gc = wx.GraphicsContext.Create(self.frame) gc.SetPen(wx.Pen('blue', 2)) - - points = [ wx.Point2D(5,5), - wx.Point2D(50,5), - wx.Point2D(50,50), - wx.Point2D(5,5), - ] + + points = [ wx.Point2D(5,5), + wx.Point2D(50,5), + wx.Point2D(50,50), + wx.Point2D(5,5), + ] gc.StrokeLines(points) def test_gcStrokeLines2(self): self.waitFor(50) gc = wx.GraphicsContext.Create(self.frame) 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) - + def test_gcStrokeLines3(self): self.waitFor(50) gc = wx.GraphicsContext.Create(self.frame) gc.SetPen(wx.Pen('blue', 2)) - + 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) def test_gcDrawLines(self): self.waitFor(50) gc = wx.GraphicsContext.Create(self.frame) 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) - - + + def test_gcGradientStops(self): self.waitFor(50) gs1 = wx.GraphicsGradientStop('red', 0.25) gs2 = wx.GraphicsGradientStop('green', 0.50) gs3 = wx.GraphicsGradientStop('blue', 0.90) - + gs1.Colour gs1.Position - + stops = wx.GraphicsGradientStops() stops.Add(gs1) stops.Add(gs2) stops.Add('white', 0.75) stops.Add(gs3) - + self.assertEqual(len(stops), 6) # 2 existing, plus 4 added gs = stops[2] self.assertTrue(gs.Position == 0.5) - + gc = wx.GraphicsContext.Create(self.frame) b = gc.CreateLinearGradientBrush(0,0, 500, 100, stops) @@ -169,7 +169,7 @@ class graphics_Tests(wtc.WidgetTestCase): wx.NullGraphicsMatrix wx.NullGraphicsPath - + #--------------------------------------------------------------------------- diff --git a/unittests/test_grid.py b/unittests/test_grid.py index ba15ac7c..84a36bea 100644 --- a/unittests/test_grid.py +++ b/unittests/test_grid.py @@ -6,8 +6,8 @@ import wx.grid #--------------------------------------------------------------------------- - - + + class grid_Tests(wtc.WidgetTestCase): # 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): c1 = wx.grid.GridCellCoords() c2 = wx.grid.GridCellCoords(5,10) - - + + def test_grid02(self): r = wx.grid.GridCellAutoWrapStringRenderer() - + def test_grid03(self): r = wx.grid.GridCellBoolRenderer() - + def test_grid04(self): r = wx.grid.GridCellDateTimeRenderer() def test_grid05(self): r = wx.grid.GridCellEnumRenderer() - + def test_grid06(self): r = wx.grid.GridCellFloatRenderer() - + def test_grid07(self): r = wx.grid.GridCellNumberRenderer() - + def test_grid08(self): r = wx.grid.GridCellStringRenderer() - + def test_grid09(self): class MyRenderer(wx.grid.GridCellRenderer): def Clone(self): return MyRenderer() - + def Draw(self, grid, attr, dc, rect, row, col, isSelected): pass def GetBestSize(self, grid, attr, dc, row, col): return (80,20) - + r = MyRenderer() - - - + + + def test_grid10(self): e = wx.grid.GridCellAutoWrapStringEditor() - + def test_grid11(self): e = wx.grid.GridCellBoolEditor() - + def test_grid12(self): e = wx.grid.GridCellChoiceEditor('one two three'.split()) - + def test_grid13(self): e = wx.grid.GridCellEnumEditor() - + def test_grid14(self): e = wx.grid.GridCellTextEditor() @@ -77,26 +77,26 @@ class grid_Tests(wtc.WidgetTestCase): def test_grid16(self): e = wx.grid.GridCellNumberEditor() - + def test_grid17(self): class MyEditor(wx.grid.GridCellEditor): def Clone(self): return MyEditor() - def BeginEdit(self, row, col, grid): pass - def Create(self, parent, id, evtHandler): pass - def EndEdit(self, row, col, grid, oldval): return None - def ApplyEdit(self, row, col, grid): pass - def Reset(self): pass + def BeginEdit(self, row, col, grid): pass + def Create(self, parent, id, evtHandler): pass + def EndEdit(self, row, col, grid, oldval): return None + def ApplyEdit(self, row, col, grid): pass + def Reset(self): pass def GetValue(self): return "" - + e = MyEditor() return e - + def test_grid17a(self): e = self.test_grid17() e.GetControl e.SetControl - - + + def test_grid18(self): a = wx.grid.GridCellAttr() a.DecRef() @@ -119,7 +119,7 @@ class grid_Tests(wtc.WidgetTestCase): a.GetSize() a.GetOverflow() a.GetKind() - + a.DecRef() @@ -132,12 +132,12 @@ class grid_Tests(wtc.WidgetTestCase): wx.grid.GridCellAttr.Merged - def test_grid20(self): + def test_grid20(self): class MyRenderer(wx.grid.GridCornerHeaderRenderer): def DrawBorder(self, grid, dc, rect): pass r = MyRenderer() - + def test_grid21(self): class MyRenderer(wx.grid.GridHeaderLabelsRenderer): def DrawBorder(self, grid, dc, rect): @@ -146,62 +146,62 @@ class grid_Tests(wtc.WidgetTestCase): pass r = MyRenderer() - def test_grid22(self): + def test_grid22(self): class MyRenderer(wx.grid.GridRowHeaderRenderer): def DrawBorder(self, grid, dc, rect): pass def DrawLabel(self, grid, dc, value, rect, horizAlign, vertAlign, textOrientation): pass r = MyRenderer() - - def test_grid23(self): + + def test_grid23(self): class MyRenderer(wx.grid.GridColumnHeaderRenderer): def DrawBorder(self, grid, dc, rect): pass def DrawLabel(self, grid, dc, value, rect, horizAlign, vertAlign, textOrientation): pass r = MyRenderer() - - def test_grid24(self): + + def test_grid24(self): r = wx.grid.GridRowHeaderRendererDefault() - - def test_grid25(self): + + def test_grid25(self): r = wx.grid.GridColumnHeaderRendererDefault() - - def test_grid26(self): + + def test_grid26(self): r = wx.grid.GridCornerHeaderRendererDefault() - - - + + + def test_grid27(self): p = wx.grid.GridCellAttrProvider() - - def test_grid28(self): + + def test_grid28(self): class MyTable(wx.grid.GridTableBase): def GetNumberRows(self): return 1 def GetNumberCols(self): return 1 def GetValue(self, row, col): return "" def SetValue(self, row, col, value): pass t = MyTable() - - - def test_grid29(self): + + + def test_grid29(self): t = wx.grid.GridStringTable() - + def test_grid30(self): m = wx.grid.GridTableMessage() - - def test_grid31(self): + + def test_grid31(self): m = wx.grid.GridSizesInfo() - - def test_grid32(self): + + def test_grid32(self): g = wx.grid.Grid(self.frame) g.CreateGrid(10,5) - + def test_grid33(self): g = wx.grid.Grid(self.frame) g.CreateGrid(10,5) @@ -209,18 +209,18 @@ class grid_Tests(wtc.WidgetTestCase): g.SetCellValue(1,2, 'hello') g.SetCellValue((2,2), 'world') del ul - - def test_grid34(self): + + def test_grid34(self): g = wx.grid.Grid(self.frame) g.CreateGrid(10,5) with wx.grid.GridUpdateLocker(g): g.SetCellValue(1,2, 'hello') g.SetCellValue((2,2), 'world') - - + + def test_grid35(self): e = wx.grid.GridEvent() - + def test_grid36(self): e = wx.grid.GridSizeEvent() @@ -252,7 +252,7 @@ class grid_Tests(wtc.WidgetTestCase): wx.grid.wxEVT_GRID_COL_MOVE wx.grid.wxEVT_GRID_COL_SORT wx.grid.wxEVT_GRID_TABBING - + def test_grid40(self): wx.grid.EVT_GRID_CELL_LEFT_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_SORT wx.grid.EVT_GRID_TABBING - + wx.grid.EVT_GRID_CMD_CELL_LEFT_CLICK wx.grid.EVT_GRID_CMD_CELL_RIGHT_CLICK 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_SORT wx.grid.EVT_GRID_CMD_TABBING - + def test_grid41(self): wx.grid.Grid.SetCellHighlightPenWidth # Does it exist - - + + #--------------------------------------------------------------------------- if __name__ == '__main__': diff --git a/unittests/test_headercol.py b/unittests/test_headercol.py index 60f12249..98a03480 100644 --- a/unittests/test_headercol.py +++ b/unittests/test_headercol.py @@ -12,13 +12,13 @@ class headercol_Tests(wtc.WidgetTestCase): def test_headercolCtor1(self): hc = wx.HeaderColumnSimple('title', 80, wx.ALIGN_RIGHT, wx.COL_RESIZABLE) - + def test_headercolCtor2(self): bmp = wx.Bitmap(pngFile) hc = wx.HeaderColumnSimple(bmp, flags=wx.COL_RESIZABLE) hc.Bitmap - + def test_headercolProperties(self): hc = wx.HeaderColumnSimple('title', 80, wx.ALIGN_RIGHT, wx.COL_RESIZABLE) # normal properties @@ -34,25 +34,25 @@ class headercol_Tests(wtc.WidgetTestCase): hc.Hidden = True self.assertTrue(hc.Hidden == hc.IsHidden()) self.assertTrue(hc.Shown == hc.IsShown()) - - + + def test_headercolConstants(self): wx.COL_WIDTH_DEFAULT wx.COL_WIDTH_AUTOSIZE - wx.COL_RESIZABLE - wx.COL_SORTABLE - wx.COL_REORDERABLE - wx.COL_HIDDEN + wx.COL_RESIZABLE + wx.COL_SORTABLE + wx.COL_REORDERABLE + wx.COL_HIDDEN wx.COL_DEFAULT_FLAGS - + def test_headercolAbsClass1(self): with self.assertRaises(TypeError): hc = wx.HeaderColumn() - + def test_headercolAbsClass2(self): with self.assertRaises(TypeError): hc = wx.SettableHeaderColumn() - + #--------------------------------------------------------------------------- diff --git a/unittests/test_headerctrl.py b/unittests/test_headerctrl.py index b96340d1..5bbff011 100644 --- a/unittests/test_headerctrl.py +++ b/unittests/test_headerctrl.py @@ -10,7 +10,7 @@ class headerctrl_Tests(wtc.WidgetTestCase): wx.HD_ALLOW_REORDER wx.HD_ALLOW_HIDE wx.HD_DEFAULT_STYLE - + wx.wxEVT_COMMAND_HEADER_CLICK wx.wxEVT_COMMAND_HEADER_RIGHT_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_END_REORDER wx.wxEVT_COMMAND_HEADER_DRAGGING_CANCELLED - + wx.EVT_HEADER_CLICK wx.EVT_HEADER_RIGHT_CLICK wx.EVT_HEADER_MIDDLE_CLICK @@ -38,22 +38,22 @@ class headerctrl_Tests(wtc.WidgetTestCase): wx.EVT_HEADER_BEGIN_REORDER wx.EVT_HEADER_END_REORDER wx.EVT_HEADER_DRAGGING_CANCELLED - - + + def test_headerctrl2(self): with self.assertRaises(TypeError): hc = wx.HeaderCtrl(self.frame) - + def test_headerctrl3(self): hc = wx.HeaderCtrlSimple() hc.Create(self.frame) - + def test_headerctrl4(self): hc = wx.HeaderCtrlSimple(self.frame) - + col = wx.HeaderColumnSimple("Hello") hc.AppendColumn(col) - + col = wx.HeaderColumnSimple("World") hc.AppendColumn(col) diff --git a/unittests/test_help.py b/unittests/test_help.py index 8ead13ec..14aeffa4 100644 --- a/unittests/test_help.py +++ b/unittests/test_help.py @@ -10,7 +10,7 @@ class help_Tests(wtc.WidgetTestCase): #hc = wx.HelpController() pass - + #--------------------------------------------------------------------------- if __name__ == '__main__': diff --git a/unittests/test_helpctrl.py b/unittests/test_helpctrl.py index b61b4fd3..c2a99bad 100644 --- a/unittests/test_helpctrl.py +++ b/unittests/test_helpctrl.py @@ -15,10 +15,10 @@ class helpctrl_Tests(wtc.WidgetTestCase): hc.AddBook(os.path.join(helpPath, 'testing.hhp')) hc.AddBook(os.path.join(helpPath, 'another.hhp')) hc.SetShouldPreventAppExit(False) - + hc.DisplayContents() self.myYield() - + #--------------------------------------------------------------------------- if __name__ == '__main__': diff --git a/unittests/test_helpdata.py b/unittests/test_helpdata.py index bcd8285a..8937df42 100644 --- a/unittests/test_helpdata.py +++ b/unittests/test_helpdata.py @@ -9,14 +9,14 @@ class helpdata_Tests(wtc.WidgetTestCase): def test_helpdata1(self): obj = wx.html.HtmlBookRecord("file", "path", "title", "start") - + def test_helpdata2(self): obj = wx.html.HtmlHelpDataItem() - + def test_helpdata3(self): obj = wx.html.HtmlHelpData() - - + + def test_helpdata4(self): wx.html.HF_TOOLBAR, wx.html.HF_CONTENTS, @@ -60,7 +60,7 @@ class helpdata_Tests(wtc.WidgetTestCase): wx.html.ID_HTML_SEARCHBUTTON, wx.html.ID_HTML_SEARCHCHOICE, wx.html.ID_HTML_COUNTINFO - + #--------------------------------------------------------------------------- if __name__ == '__main__': diff --git a/unittests/test_helpdlg.py b/unittests/test_helpdlg.py index 6bbc2041..f8bfa361 100644 --- a/unittests/test_helpdlg.py +++ b/unittests/test_helpdlg.py @@ -16,10 +16,10 @@ class helpdlg_Tests(wtc.WidgetTestCase): data.AddBook(os.path.join(helpPath, 'another.hhp')) dlg = wx.html.HtmlHelpDialog(data) dlg.Create(self.frame) - + self.myYield() dlg.Destroy() - + #--------------------------------------------------------------------------- if __name__ == '__main__': diff --git a/unittests/test_helpext.py b/unittests/test_helpext.py index 46578ba5..9c838ad4 100644 --- a/unittests/test_helpext.py +++ b/unittests/test_helpext.py @@ -9,7 +9,7 @@ class helpext_Tests(wtc.WidgetTestCase): def test_helpext1(self): hc = wx.adv.ExtHelpController() - + #--------------------------------------------------------------------------- if __name__ == '__main__': diff --git a/unittests/test_helpfrm.py b/unittests/test_helpfrm.py index a8bf5c42..99aec0ed 100644 --- a/unittests/test_helpfrm.py +++ b/unittests/test_helpfrm.py @@ -14,16 +14,16 @@ class helpfrm_Tests(wtc.WidgetTestCase): data = wx.html.HtmlHelpData() data.AddBook(os.path.join(helpPath, 'testing.hhp')) data.AddBook(os.path.join(helpPath, 'another.hhp')) - + hc = wx.html.HtmlHelpController() frm = wx.html.HtmlHelpFrame(data) frm.SetController(hc) frm.Create(self.frame, -1) frm.Show() - + self.myYield() frm.Close() - + #--------------------------------------------------------------------------- if __name__ == '__main__': diff --git a/unittests/test_helpwnd.py b/unittests/test_helpwnd.py index 35f61a2e..76f92d49 100644 --- a/unittests/test_helpwnd.py +++ b/unittests/test_helpwnd.py @@ -21,8 +21,8 @@ class helpwnd_Tests(wtc.WidgetTestCase): self.frame.SendSizeEvent() self.waitFor(50) - - + + #--------------------------------------------------------------------------- if __name__ == '__main__': diff --git a/unittests/test_htmlcell.py b/unittests/test_htmlcell.py index 746832c2..7ec11ed2 100644 --- a/unittests/test_htmlcell.py +++ b/unittests/test_htmlcell.py @@ -13,26 +13,26 @@ class htmlcell_Tests(wtc.WidgetTestCase): def test_htmlcell2(self): obj = wx.html.HtmlSelection() - + def test_htmlcell3(self): obj = wx.html.HtmlRenderingState() - + def test_htmlcell4(self): obj = wx.html.HtmlRenderingInfo() - + def test_htmlcell5(self): obj = wx.html.HtmlContainerCell(None) - + def test_htmlcell6(self): obj = wx.html.HtmlLinkInfo() - + def test_htmlcell7(self): obj = wx.html.HtmlColourCell(wx.BLACK) - + def test_htmlcell8(self): hw = wx.html.HtmlWindow(self.frame) obj = wx.html.HtmlWidgetCell(hw) - + #--------------------------------------------------------------------------- if __name__ == '__main__': diff --git a/unittests/test_htmldefs.py b/unittests/test_htmldefs.py index f3b483d9..eae33ebe 100644 --- a/unittests/test_htmldefs.py +++ b/unittests/test_htmldefs.py @@ -37,36 +37,36 @@ class htmldefs_Tests(wtc.WidgetTestCase): wx.html.HTML_URL_PAGE wx.html.HTML_URL_IMAGE 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_AFTER + wx.html.HTML_FIND_NEAREST_AFTER wx.html.HTML_SCRIPT_NORMAL wx.html.HTML_SCRIPT_SUB wx.html.HTML_SCRIPT_SUP - + #--------------------------------------------------------------------------- if __name__ == '__main__': diff --git a/unittests/test_htmllbox.py b/unittests/test_htmllbox.py index 3ca3d126..5263fd5c 100644 --- a/unittests/test_htmllbox.py +++ b/unittests/test_htmllbox.py @@ -13,16 +13,16 @@ class htmllbox_Tests(wtc.WidgetTestCase): def test_htmllbox2(self): lb = wx.html.SimpleHtmlListBox() lb.Create(self.frame, choices=['one', 'two', 'three']) - + def test_htmllbox3(self): class MyHtmlListBox(wx.html.HtmlListBox): def OnGetItem(self, n): return 'this is item %d' % n - + lb = MyHtmlListBox(self.frame) lb.SetItemCount(15) - - + + #--------------------------------------------------------------------------- if __name__ == '__main__': diff --git a/unittests/test_htmlpars.py b/unittests/test_htmlpars.py index 3b218bb8..f3201947 100644 --- a/unittests/test_htmlpars.py +++ b/unittests/test_htmlpars.py @@ -12,17 +12,17 @@ class htmlpars_Tests(wtc.WidgetTestCase): def __init__(self): wx.html.HtmlTagHandler.__init__(self) self.test = None - + def GetSupportedTags(self): return 'FOO,BAR' - + def HandleTag(self, tag): self.test = tag.GetTagName() - + wx.html.HtmlWinParser_AddTagHandler(myTagHandler) self.myYield() - - + + #--------------------------------------------------------------------------- if __name__ == '__main__': diff --git a/unittests/test_htmlprint.py b/unittests/test_htmlprint.py index 6f0d3a7c..79624d84 100644 --- a/unittests/test_htmlprint.py +++ b/unittests/test_htmlprint.py @@ -7,19 +7,19 @@ import wx.html class htmlprint_Tests(wtc.WidgetTestCase): - def test_htmlprint1(self): + def test_htmlprint1(self): size = (100,100) bmp = wx.Bitmap(*size) dc = wx.MemoryDC(bmp) - + obj = wx.html.HtmlDCRenderer() obj.SetDC(dc) obj.SetSize(*size) obj.SetHtmlText('

Hello World

') - + obj.Render(0,0, []) - - + + #--------------------------------------------------------------------------- if __name__ == '__main__': diff --git a/unittests/test_htmlwin.py b/unittests/test_htmlwin.py index 8604d685..855adac9 100644 --- a/unittests/test_htmlwin.py +++ b/unittests/test_htmlwin.py @@ -12,7 +12,7 @@ class htmlwin_Tests(wtc.WidgetTestCase): def test_htmlwin1(self): obj = wx.html.HtmlWindow(self.frame) - + def test_htmlwin2(self): obj = wx.html.HtmlWindow() obj.Create(self.frame) @@ -22,16 +22,16 @@ class htmlwin_Tests(wtc.WidgetTestCase): obj.LoadFile(os.path.join(helpPath, 'main.htm')) self.frame.SendSizeEvent() self.myYield() - - + + def test_htmlwin4(self): noLog = wx.LogNull() obj = wx.html.HtmlWindow(self.frame) obj.LoadPage('http://www.google.com/') self.frame.SendSizeEvent() self.myYield() - - + + def test_htmlwin5(self): obj = wx.html.HtmlWindow(self.frame) obj.SetPage("Hello, world!") @@ -42,8 +42,8 @@ class htmlwin_Tests(wtc.WidgetTestCase): obj = wx.html.HtmlWindow(self.frame) self.frame.SendSizeEvent() self.myYield() - - + + #--------------------------------------------------------------------------- if __name__ == '__main__': diff --git a/unittests/test_htmlwinpars.py b/unittests/test_htmlwinpars.py index 379d5966..318300b5 100644 --- a/unittests/test_htmlwinpars.py +++ b/unittests/test_htmlwinpars.py @@ -9,7 +9,7 @@ class htmlwinpars_Tests(wtc.WidgetTestCase): def test_htmlwinpars1(self): obj = wx.html.HtmlWinParser() - + #--------------------------------------------------------------------------- if __name__ == '__main__': diff --git a/unittests/test_hyperlink.py b/unittests/test_hyperlink.py index 7dab2cc3..42211636 100644 --- a/unittests/test_hyperlink.py +++ b/unittests/test_hyperlink.py @@ -9,23 +9,23 @@ class hyperlink_Tests(wtc.WidgetTestCase): def test_hyperlink1(self): w = wx.adv.HyperlinkCtrl(self.frame, label='label', url='http://wxPython.org') - + def test_hyperlink2(self): w = wx.adv.HyperlinkCtrl() w.Create(self.frame, label='label', url='http://wxPython.org') - + def test_hyperlink3(self): evt = wx.adv.HyperlinkCtrl(self.frame, 123, 'url') - + wx.adv.HL_CONTEXTMENU wx.adv.HL_ALIGN_LEFT wx.adv.HL_ALIGN_RIGHT wx.adv.HL_ALIGN_CENTRE wx.adv.HL_DEFAULT_STYLE - + wx.adv.wxEVT_COMMAND_HYPERLINK wx.adv.EVT_HYPERLINK - + #--------------------------------------------------------------------------- if __name__ == '__main__': diff --git a/unittests/test_icon.py b/unittests/test_icon.py index 0d299113..4ba58f28 100644 --- a/unittests/test_icon.py +++ b/unittests/test_icon.py @@ -13,23 +13,23 @@ class icon_Tests(wtc.WidgetTestCase): def test_icon1(self): i1 = wx.Icon(icoFile) i2 = wx.Icon(i1) - + def test_icon2(self): i = wx.Icon() i.CopyFromBitmap(wx.Bitmap(pngFile)) - + def test_icon3(self): i = wx.Icon(icoFile) i.Depth i.Width i.Height i.Handle - + i.SetDepth(32) i.SetWidth(32) i.SetHeight(32) - - + + #--------------------------------------------------------------------------- diff --git a/unittests/test_iconbndl.py b/unittests/test_iconbndl.py index f244fa0e..88294ffa 100644 --- a/unittests/test_iconbndl.py +++ b/unittests/test_iconbndl.py @@ -15,24 +15,24 @@ class iconbndl_Tests(wtc.WidgetTestCase): ib.AddIcon(icoFile) ib.AddIcon(wx.Icon(icoFile)) i = ib.GetIcon() - + def test_iconbndl2(self): ib = wx.IconBundle(icoFile) ib2 = wx.IconBundle(ib) - - + + def test_iconbndl3(self): ib = wx.IconBundle(wx.Icon(icoFile)) - + def test_iconbndl4(self): ib = wx.IconBundle() ib.Icon ib.IconCount - + wx.NullIconBundle - - + + #--------------------------------------------------------------------------- diff --git a/unittests/test_iconloc.py b/unittests/test_iconloc.py index 3a7dd732..57944dc6 100644 --- a/unittests/test_iconloc.py +++ b/unittests/test_iconloc.py @@ -18,7 +18,7 @@ class iconloc_Tests(wtc.WidgetTestCase): loc = wx.IconLocation() loc.SetFileName(icoFile) i = wx.Icon(loc) - + #--------------------------------------------------------------------------- diff --git a/unittests/test_image.py b/unittests/test_image.py index ea5494d4..5a3f6d4a 100644 --- a/unittests/test_image.py +++ b/unittests/test_image.py @@ -17,13 +17,13 @@ def makeBuf(w, h, bpp=1, init=0): class image_Tests(wtc.WidgetTestCase): - + def test_imageCtor1(self): img = wx.Image() self.assertTrue(not img.IsOk()) img.Create(100,100) self.assertTrue(img.IsOk()) - + def test_imageCtor2(self): img = wx.Image(100,100) self.assertTrue(img.IsOk()) @@ -59,7 +59,7 @@ class image_Tests(wtc.WidgetTestCase): buf = makeBuf(w,h,3) with self.assertRaises(ValueError): # should be an exception here because the buffer is the wrong size - img = wx.Image((w, h+1), buf) + img = wx.Image((w, h+1), buf) def test_imageCtor5b(self): w = h = 10 @@ -99,7 +99,7 @@ class image_Tests(wtc.WidgetTestCase): img.SetData(buf) self.assertTrue(img.IsOk()) self.assertTrue(img.GetRed(1,1) == 2) - + def test_imageSetData2(self): w = h = 10 img = wx.Image(1,1) @@ -114,7 +114,7 @@ class image_Tests(wtc.WidgetTestCase): buf = makeBuf(w,h, init=2) img.SetAlpha(buf) self.assertTrue(img.IsOk()) - self.assertTrue(img.GetRed(1,1) == 0) + self.assertTrue(img.GetRed(1,1) == 0) self.assertTrue(img.GetAlpha(1,1) == 2) def test_imageGetData(self): @@ -142,7 +142,7 @@ class image_Tests(wtc.WidgetTestCase): self.assertEqual(1, img.GetRed(0,0)) self.assertEqual(2, img.GetGreen(0,0)) self.assertEqual(3, img.GetBlue(0,0)) - + def test_imageGetAlphaDataBuffer(self): w = h = 10 img = wx.Image(w, h) @@ -156,8 +156,8 @@ class image_Tests(wtc.WidgetTestCase): self.assertEqual(1, img.GetAlpha(0,0)) self.assertEqual(2, img.GetAlpha(1,0)) self.assertEqual(3, img.GetAlpha(2,0)) - - + + def test_imageSetDataBuffer1(self): w = h = 10 img = wx.Image(w,h) @@ -169,7 +169,7 @@ class image_Tests(wtc.WidgetTestCase): self.assertEqual(1, img.GetRed(0,0)) self.assertEqual(2, img.GetGreen(0,0)) self.assertEqual(3, img.GetBlue(0,0)) - + def test_imageSetDataBuffer2(self): w = h = 10 img = wx.Image(1,1) @@ -194,7 +194,7 @@ class image_Tests(wtc.WidgetTestCase): self.assertEqual(2, img.GetAlpha(1,0)) self.assertEqual(3, img.GetAlpha(2,0)) - + def test_imageNestedClasses(self): rgb = wx.Image.RGBValue(1,2,3) self.assertEqual(rgb.red, 1) @@ -203,7 +203,7 @@ class image_Tests(wtc.WidgetTestCase): rgb.red = 4 rgb.green = 5 rgb.blue = 6 - + hsv = wx.Image.HSVValue(1.1, 1.2, 1.3) self.assertEqual(hsv.hue, 1.1) self.assertEqual(hsv.saturation, 1.2) @@ -220,8 +220,8 @@ class image_Tests(wtc.WidgetTestCase): self.assertEqual(rgb.red, 1) self.assertEqual(rgb.green, 2) self.assertEqual(rgb.blue, 3) - - + + def test_imageProperties(self): img = wx.Image(pngFile) self.assertTrue(img.IsOk()) @@ -243,7 +243,7 @@ class image_Tests(wtc.WidgetTestCase): self.assertTrue(img.IsOk()) r, g, b = img.FindFirstUnusedColour() r, g, b = img.GetOrFindMaskColour() - + #--------------------------------------------------------------------------- diff --git a/unittests/test_imaglist.py b/unittests/test_imaglist.py index a4849610..c1ba33bf 100644 --- a/unittests/test_imaglist.py +++ b/unittests/test_imaglist.py @@ -14,18 +14,18 @@ class image_Tests(wtc.WidgetTestCase): w, h = bmp.GetSize() i = wx.ImageList(w, h) i.Add(bmp) - - + + def test_imaglistConstants(self): wx.IMAGE_LIST_NORMAL wx.IMAGE_LIST_SMALL wx.IMAGE_LIST_STATE - wx.IMAGELIST_DRAW_NORMAL + wx.IMAGELIST_DRAW_NORMAL wx.IMAGELIST_DRAW_TRANSPARENT - wx.IMAGELIST_DRAW_SELECTED - wx.IMAGELIST_DRAW_FOCUSED + wx.IMAGELIST_DRAW_SELECTED + wx.IMAGELIST_DRAW_FOCUSED + - #--------------------------------------------------------------------------- diff --git a/unittests/test_infobar.py b/unittests/test_infobar.py index bfe6e348..fdc400bc 100644 --- a/unittests/test_infobar.py +++ b/unittests/test_infobar.py @@ -12,7 +12,7 @@ class infobar_Tests(wtc.WidgetTestCase): def test_infobarDefaultCtor(self): ib = wx.InfoBar() ib.Create(self.frame) - + def test_infobar1(self): ib = wx.InfoBar(self.frame) ib.ShowMessage("hello world") @@ -27,7 +27,7 @@ class infobar_Tests(wtc.WidgetTestCase): self.myYield() ib.RemoveButton(wx.ID_SAVE) ib.Dismiss() - + #--------------------------------------------------------------------------- diff --git a/unittests/test_intl.py b/unittests/test_intl.py index 2f12701c..98f15470 100644 --- a/unittests/test_intl.py +++ b/unittests/test_intl.py @@ -30,8 +30,8 @@ class intl_Tests(wtc.WidgetTestCase): loc = wx.Locale(wx.LANGUAGE_SPANISH) st = loc.GetString('Next') self.assertEqual(st, 'Siguiente') - - + + def test_intlConstants(self): # just a few of them to make sure the file is included properly wx.LANGUAGE_AFRIKAANS @@ -39,7 +39,7 @@ class intl_Tests(wtc.WidgetTestCase): wx.LANGUAGE_AMHARIC - + #--------------------------------------------------------------------------- diff --git a/unittests/test_joystick.py b/unittests/test_joystick.py index d2bc2040..a85ea290 100644 --- a/unittests/test_joystick.py +++ b/unittests/test_joystick.py @@ -15,7 +15,7 @@ class joystick_Tests(wtc.WidgetTestCase): wx.JOY_BUTTON2 wx.JOY_BUTTON3 wx.JOY_BUTTON4 - + wx.wxEVT_JOY_BUTTON_DOWN wx.wxEVT_JOY_BUTTON_UP wx.wxEVT_JOY_MOVE @@ -27,11 +27,11 @@ class joystick_Tests(wtc.WidgetTestCase): wx.EVT_JOY_ZMOVE wx.EVT_JOYSTICK_EVENTS - + def test_joystick2(self): - j = wx.adv.Joystick() - - + j = wx.adv.Joystick() + + #--------------------------------------------------------------------------- if __name__ == '__main__': diff --git a/unittests/test_kbdstate.py b/unittests/test_kbdstate.py index f0a27b04..fdf04c6a 100644 --- a/unittests/test_kbdstate.py +++ b/unittests/test_kbdstate.py @@ -5,16 +5,16 @@ import wx #--------------------------------------------------------------------------- class KeyboardState(unittest.TestCase): - + def test_KeyboardState(self): ks = wx.KeyboardState(False, True, False, True) ks.controlDown ks.shiftDown ks.altDown ks.cmdDown - - - + + + #--------------------------------------------------------------------------- diff --git a/unittests/test_layout.py b/unittests/test_layout.py index 3fda8ed2..3efdcff6 100644 --- a/unittests/test_layout.py +++ b/unittests/test_layout.py @@ -12,16 +12,16 @@ class layout_Tests(wtc.WidgetTestCase): frame = self.frame panel = wx.Panel(frame) panel.BackgroundColour = 'blue' - + lc = wx.LayoutConstraints() lc.top.SameAs(frame, wx.Top, 10) lc.left.SameAs(frame, wx.Left, 10) lc.bottom.SameAs(frame, wx.Bottom, 10) lc.right.PercentOf(frame, wx.Right, 50) - + panel.SetConstraints(lc) - - + + #--------------------------------------------------------------------------- diff --git a/unittests/test_laywin.py b/unittests/test_laywin.py index 3b4320ac..d274254a 100644 --- a/unittests/test_laywin.py +++ b/unittests/test_laywin.py @@ -15,26 +15,26 @@ class laywin_Tests(wtc.WidgetTestCase): wx.adv.LAYOUT_LEFT wx.adv.LAYOUT_RIGHT wx.adv.LAYOUT_BOTTOM - + wx.adv.wxEVT_QUERY_LAYOUT_INFO wx.adv.wxEVT_CALCULATE_LAYOUT wx.adv.EVT_QUERY_LAYOUT_INFO wx.adv.EVT_CALCULATE_LAYOUT - - + + def test_laywin2(self): la = wx.adv.LayoutAlgorithm() la.LayoutFrame(self.frame) - + def test_laywin3(self): w = wx.adv.SashLayoutWindow(self.frame) def test_laywin4(self): evt = wx.adv.QueryLayoutInfoEvent() - + def test_laywin5(self): evt = wx.adv.CalculateLayoutEvent() - + #--------------------------------------------------------------------------- if __name__ == '__main__': diff --git a/unittests/test_lib_agw_advancedsplash.py b/unittests/test_lib_agw_advancedsplash.py index 178fe9e7..19ab2d19 100644 --- a/unittests/test_lib_agw_advancedsplash.py +++ b/unittests/test_lib_agw_advancedsplash.py @@ -10,9 +10,9 @@ pngFile = os.path.join(os.path.dirname(__file__), 'toucan.png') #--------------------------------------------------------------------------- class lib_agw_advancedsplash_Tests(wtc.WidgetTestCase): - + def test_lib_agw_advancedsplashCtor(self): - splash = AS.AdvancedSplash(self.frame, -1, bitmap=wx.Bitmap(pngFile), + splash = AS.AdvancedSplash(self.frame, -1, bitmap=wx.Bitmap(pngFile), agwStyle=AS.AS_TIMEOUT|AS.AS_CENTER_ON_SCREEN, timeout=250) self.waitFor(300) @@ -24,8 +24,8 @@ class lib_agw_advancedsplash_Tests(wtc.WidgetTestCase): AS.AS_TIMEOUT AS.AS_NOTIMEOUT AS.AS_SHADOW_BITMAP - - + + #--------------------------------------------------------------------------- if __name__ == '__main__': diff --git a/unittests/test_lib_agw_aquabutton.py b/unittests/test_lib_agw_aquabutton.py index 5a75b646..2269562e 100644 --- a/unittests/test_lib_agw_aquabutton.py +++ b/unittests/test_lib_agw_aquabutton.py @@ -10,7 +10,7 @@ pngFile = os.path.join(os.path.dirname(__file__), 'toucan.png') #--------------------------------------------------------------------------- class lib_agw_aquabutton_Tests(wtc.WidgetTestCase): - + def test_lib_agw_aquabuttonCtor(self): # Initialize AquaButton 1 (with image) @@ -20,7 +20,7 @@ class lib_agw_aquabutton_Tests(wtc.WidgetTestCase): btn2 = AB.AquaButton(self.frame, -1, None, "Hello World!") btn3 = AB.AquaToggleButton(self.frame, -1, None, 'Toggle') - + def test_lib_agw_aquabuttonMethods(self): # Initialize AquaButton 2 (no image) @@ -40,7 +40,7 @@ class lib_agw_aquabutton_Tests(wtc.WidgetTestCase): btn3 = AB.AquaToggleButton(self.frame, -1, None, 'Toggle') btn3.SetToggle(True) self.assertTrue(btn3.GetToggle()) - + #--------------------------------------------------------------------------- diff --git a/unittests/test_lib_agw_aui.py b/unittests/test_lib_agw_aui.py index cf83884a..a3c2f510 100644 --- a/unittests/test_lib_agw_aui.py +++ b/unittests/test_lib_agw_aui.py @@ -8,13 +8,13 @@ import wx.lib.agw.aui as aui #--------------------------------------------------------------------------- class lib_agw_aui_Tests(wtc.WidgetTestCase): - + def test_lib_agw_auiCtor(self): self._mgr = aui.AuiManager() # tell AuiManager to manage this frame self._mgr.SetManagedWindow(self.frame) - + pane = wx.Panel() self._mgr.AddPane(pane, aui.AuiPaneInfo().Name("pane1").Caption("A pane") .CenterPane()) @@ -43,7 +43,7 @@ class lib_agw_aui_additional_Tests(wtc.WidgetTestCase): tb.AddSimpleTool(-1, "Check 1", tb_bmp1, "Check 1", aui.ITEM_CHECK) tb.AddSimpleTool(-1, "Radio 1", tb_bmp1, "Radio 1", aui.ITEM_RADIO) tb.AddSeparator() - + # prepare a few custom overflow elements for the toolbars' overflow buttons prepend_items, append_items = [], [] @@ -97,7 +97,7 @@ class lib_agw_aui_additional_Tests(wtc.WidgetTestCase): # ----------- aui.AuiBaseTabCtrlId """ Base window identifier for AuiTabCtrl. """ - + aui.AUI_NB_TOP """ With this style, tabs are drawn along the top of the notebook. """ aui.AUI_NB_LEFT @@ -150,14 +150,14 @@ class lib_agw_aui_additional_Tests(wtc.WidgetTestCase): """ Tab navigation order by last access time. """ aui.AUI_NB_NO_TAB_FOCUS """ Don't draw tab focus rectangle. """ - + aui.AUI_NB_DEFAULT_STYLE """ Default `AuiNotebook` style. """ - + # -------------------------- # # - FrameManager Constants - # # -------------------------- # - + # Docking Styles aui.AUI_DOCK_NONE """ No docking direction. """ @@ -175,7 +175,7 @@ class lib_agw_aui_additional_Tests(wtc.WidgetTestCase): """ Centre docking direction. """ aui.AUI_DOCK_NOTEBOOK_PAGE """ Automatic AuiNotebooks docking style. """ - + # Floating/Dragging Styles aui.AUI_MGR_ALLOW_FLOATING """ Allow floating of panes. """ @@ -217,11 +217,11 @@ class lib_agw_aui_additional_Tests(wtc.WidgetTestCase): aui.AUI_MGR_AUTONB_NO_CAPTION """ Panes that merge into an automatic notebook will not have the pane caption visible. """ - - + + aui.AUI_MGR_DEFAULT """ Default `AuiManager` style. """ - + # Panes Customization aui.AUI_DOCKART_SASH_SIZE """ Customizes the sash size. """ @@ -263,16 +263,16 @@ class lib_agw_aui_additional_Tests(wtc.WidgetTestCase): """ Draw a sash grip on the sash. """ aui.AUI_DOCKART_HINT_WINDOW_COLOUR """ Customizes the hint window background colour (currently light blue). """ - + # Caption Gradient Type aui.AUI_GRADIENT_NONE """ No gradient on the captions. """ aui.AUI_GRADIENT_VERTICAL - + """ Vertical gradient on the captions. """ aui.AUI_GRADIENT_HORIZONTAL """ Horizontal gradient on the captions. """ - + # Pane Button State aui.AUI_BUTTON_STATE_NORMAL """ Normal button state. """ @@ -286,7 +286,7 @@ class lib_agw_aui_additional_Tests(wtc.WidgetTestCase): """ Hidden button state. """ aui.AUI_BUTTON_STATE_CHECKED """ Checked button state. """ - + # Pane minimize mode aui.AUI_MINIMIZE_POS_SMART """ Minimizes the pane on the closest tool bar. """ @@ -310,7 +310,7 @@ class lib_agw_aui_additional_Tests(wtc.WidgetTestCase): """ Displays the caption horizontally. """ aui.AUI_MINIMIZE_CAPT_MASK """ Mask to filter the caption flags. """ - + # Button kind aui.AUI_BUTTON_CLOSE """ Shows a close button on the pane. """ @@ -350,7 +350,7 @@ class lib_agw_aui_additional_Tests(wtc.WidgetTestCase): """ Shows a custom button on the pane. """ aui.AUI_BUTTON_CUSTOM9 """ Shows a custom button on the pane. """ - + # Pane Insert Level aui.AUI_INSERT_PANE """ Level for inserting a pane. """ @@ -358,11 +358,11 @@ class lib_agw_aui_additional_Tests(wtc.WidgetTestCase): """ Level for inserting a row. """ aui.AUI_INSERT_DOCK """ Level for inserting a dock. """ - + # ------------------------ # # - AuiToolBar Constants - # # ------------------------ # - + aui.ITEM_CONTROL """ The item in the AuiToolBar is a control. """ aui.ITEM_LABEL @@ -379,15 +379,15 @@ class lib_agw_aui_additional_Tests(wtc.WidgetTestCase): """ The item in the AuiToolBar is a toolbar radio item. """ aui.ID_RESTORE_FRAME """ Identifier for restoring a minimized pane. """ - + aui.BUTTON_DROPDOWN_WIDTH """ Width of the drop-down button in AuiToolBar. """ - + aui.DISABLED_TEXT_GREY_HUE """ Hue text colour for the disabled text in AuiToolBar. """ aui.DISABLED_TEXT_COLOUR """ Text colour for the disabled text in AuiToolBar. """ - + aui.AUI_TB_TEXT """ Shows the text in the toolbar buttons; by default only icons are shown. """ aui.AUI_TB_NO_TOOLTIPS @@ -407,14 +407,14 @@ class lib_agw_aui_additional_Tests(wtc.WidgetTestCase): """ Don't draw a gradient background on the toolbar. """ aui.AUI_TB_CLOCKWISE aui.AUI_TB_COUNTERCLOCKWISE - + aui.AUI_TB_HORZ_TEXT """ Combination of ``AUI_TB_HORZ_LAYOUT`` and ``AUI_TB_TEXT``. """ aui.AUI_TB_VERT_TEXT - + aui.AUI_TB_DEFAULT_STYLE """ `AuiToolBar` default style. """ - + # AuiToolBar settings aui.AUI_TBART_SEPARATOR_SIZE """ Separator size in AuiToolBar. """ @@ -422,7 +422,7 @@ class lib_agw_aui_additional_Tests(wtc.WidgetTestCase): """ Gripper size in AuiToolBar. """ aui.AUI_TBART_OVERFLOW_SIZE """ Overflow button size in AuiToolBar. """ - + # AuiToolBar text orientation aui.AUI_TBTOOL_TEXT_LEFT """ Text in AuiToolBar items is aligned left. """ @@ -430,22 +430,22 @@ class lib_agw_aui_additional_Tests(wtc.WidgetTestCase): """ Text in AuiToolBar items is aligned right. """ aui.AUI_TBTOOL_TEXT_TOP """ Text in AuiToolBar items is aligned top. """ - aui.AUI_TBTOOL_TEXT_BOTTOM + aui.AUI_TBTOOL_TEXT_BOTTOM """ Text in AuiToolBar items is aligned bottom. """ - + # AuiToolBar tool orientation aui.AUI_TBTOOL_HORIZONTAL aui.AUI_TBTOOL_VERT_CLOCKWISE aui.AUI_TBTOOL_VERT_COUNTERCLOCKWISE - + # ------------------------------- # # - AuiSwitcherDialog Constants - # # ------------------------------- # - + aui.SWITCHER_TEXT_MARGIN_X aui.SWITCHER_TEXT_MARGIN_Y - + #--------------------------------------------------------------------------- if __name__ == '__main__': diff --git a/unittests/test_lib_agw_aui_dockart.py b/unittests/test_lib_agw_aui_dockart.py index a27b4eaa..e4759058 100644 --- a/unittests/test_lib_agw_aui_dockart.py +++ b/unittests/test_lib_agw_aui_dockart.py @@ -8,10 +8,10 @@ import wx.lib.agw.aui.dockart as da #--------------------------------------------------------------------------- class lib_agw_aui_dockart_Tests(wtc.WidgetTestCase): - + def test_lib_agw_aui_dockartCtor(self): da.ModernDockArt(self.frame) - + #--------------------------------------------------------------------------- if __name__ == '__main__': diff --git a/unittests/test_lib_agw_aui_tabart.py b/unittests/test_lib_agw_aui_tabart.py index 380d1d44..8cca45b2 100644 --- a/unittests/test_lib_agw_aui_tabart.py +++ b/unittests/test_lib_agw_aui_tabart.py @@ -8,7 +8,7 @@ import wx.lib.agw.aui.tabart as ta #--------------------------------------------------------------------------- class lib_agw_aui_tabart_Tests(wtc.WidgetTestCase): - + def test_lib_agw_aui_tabartCtor(self): ta.AuiCommandCapture() ta.AuiDefaultTabArt() @@ -17,7 +17,7 @@ class lib_agw_aui_tabart_Tests(wtc.WidgetTestCase): ta.FF2TabArt() ta.VC71TabArt() ta.VC8TabArt() - + #--------------------------------------------------------------------------- if __name__ == '__main__': diff --git a/unittests/test_lib_agw_aui_utilities.py b/unittests/test_lib_agw_aui_utilities.py index 4836b313..2d4687a3 100644 --- a/unittests/test_lib_agw_aui_utilities.py +++ b/unittests/test_lib_agw_aui_utilities.py @@ -8,24 +8,24 @@ import wx.lib.agw.aui.aui_utilities as auiu #--------------------------------------------------------------------------- class lib_agw_aui_utilities_Tests(wtc.WidgetTestCase): - + def test_lib_agw_aui_utilititiesCtor(self): auiu.StepColour(auiu.GetBaseColour(), 60) auiu.LightContrastColour(wx.RED) - + auiu.LightColour(wx.RED, 50) dc = wx.GCDC() auiu.ChopText(dc, "a little test text", 10) - + button_dropdown_bits = b"\xe0\xf1\xfb" bmp = auiu.BitmapFromBits(button_dropdown_bits, 5, 3, wx.BLACK) - + auiu.MakeDisabledBitmap(bmp) - - - + + + #--------------------------------------------------------------------------- if __name__ == '__main__': diff --git a/unittests/test_lib_agw_balloontip.py b/unittests/test_lib_agw_balloontip.py index 473634a2..a91ce60a 100644 --- a/unittests/test_lib_agw_balloontip.py +++ b/unittests/test_lib_agw_balloontip.py @@ -6,8 +6,8 @@ import wx.lib.agw.balloontip as BT #--------------------------------------------------------------------------- -class lib_agw_balloontip_Tests(wtc.WidgetTestCase): - +class lib_agw_balloontip_Tests(wtc.WidgetTestCase): + def test_lib_agw_balloontipCtor(self): tip = BT.BalloonTip(toptitle='Balloon', message='Hello wxPython', shape=BT.BT_ROUNDED, tipstyle=BT.BT_BUTTON) @@ -15,7 +15,7 @@ class lib_agw_balloontip_Tests(wtc.WidgetTestCase): def test_lib_agw_balloontipMethods(self): tip = BT.BalloonTip(toptitle='Balloon', message='Hello wxPython', shape=BT.BT_ROUNDED, tipstyle=BT.BT_BUTTON) - + self.assertTrue(tip.GetBalloonShape() == BT.BT_ROUNDED) self.assertTrue(tip.GetBalloonTipStyle() == BT.BT_BUTTON) @@ -30,8 +30,8 @@ class lib_agw_balloontip_Tests(wtc.WidgetTestCase): BT.BT_LEAVE BT.BT_CLICK BT.BT_BUTTON - - + + #--------------------------------------------------------------------------- if __name__ == '__main__': diff --git a/unittests/test_lib_agw_buttonpanel.py b/unittests/test_lib_agw_buttonpanel.py index 0fcf5d5c..40b096d2 100644 --- a/unittests/test_lib_agw_buttonpanel.py +++ b/unittests/test_lib_agw_buttonpanel.py @@ -7,15 +7,15 @@ import wx.lib.agw.buttonpanel as BP #--------------------------------------------------------------------------- class lib_agw_buttonpanel_Tests(wtc.WidgetTestCase): - - + + def test_lib_agw_buttonpanelCtor(self): bar = BP.ButtonPanel(self.frame, -1, 'sample text') btn = BP.ButtonInfo(bar, wx.NewId(), wx.ArtProvider.GetBitmap(wx.ART_INFORMATION, wx.ART_OTHER, (32, 32)), text='Button 1') bar.AddButton(btn) - + def test_lib_agw_buttonpanelMethods(self): bar = BP.ButtonPanel(self.frame, -1, 'sample text') btn = BP.ButtonInfo(bar, wx.NewId(), @@ -30,12 +30,12 @@ class lib_agw_buttonpanel_Tests(wtc.WidgetTestCase): self.assertTrue(bar.IsStandard()) self.assertTrue(not bar.IsVertical()) - + def test_lib_agw_buttonpanelConstantsExist(self): # ButtonPanel agwStyle BP.BP_DEFAULT_STYLE BP.BP_USE_GRADIENT - + # ButtonPanel alignments BP.BP_ALIGN_LEFT BP.BP_ALIGN_RIGHT @@ -50,7 +50,7 @@ class lib_agw_buttonpanel_Tests(wtc.WidgetTestCase): BP.BP_GRADIENT_NONE BP.BP_GRADIENT_VERTICAL BP.BP_GRADIENT_HORIZONTAL - + #--------------------------------------------------------------------------- if __name__ == '__main__': diff --git a/unittests/test_lib_agw_cubecolourdialog.py b/unittests/test_lib_agw_cubecolourdialog.py index 573a4fc9..1e936f3f 100644 --- a/unittests/test_lib_agw_cubecolourdialog.py +++ b/unittests/test_lib_agw_cubecolourdialog.py @@ -7,7 +7,7 @@ import wx.lib.agw.cubecolourdialog as CCD #--------------------------------------------------------------------------- class lib_agw_cubecolourdialog_Tests(wtc.WidgetTestCase): - + def test_lib_agw_cubecolourdialogCtor(self): colourData = wx.ColourData() colourData.SetColour(wx.RED) @@ -23,7 +23,7 @@ class lib_agw_cubecolourdialog_Tests(wtc.WidgetTestCase): self.assertTrue(dlg.GetAGWWindowStyleFlag() > 0) colour = dlg.GetRGBAColour() - self.assertEqual(colour, wx.Colour('blue')) + self.assertEqual(colour, wx.Colour('blue')) ccd_colour = CCD.Colour(wx.Colour(colour)) html = CCD.rgb2html(ccd_colour) @@ -32,7 +32,7 @@ class lib_agw_cubecolourdialog_Tests(wtc.WidgetTestCase): def test_lib_agw_cubecolourdialogConstantsExist(self): # CubeColourDialog agwStyle CCD.CCD_SHOW_ALPHA - + #--------------------------------------------------------------------------- if __name__ == '__main__': diff --git a/unittests/test_lib_agw_customtreectrl.py b/unittests/test_lib_agw_customtreectrl.py index e80ee5c9..f71265ff 100644 --- a/unittests/test_lib_agw_customtreectrl.py +++ b/unittests/test_lib_agw_customtreectrl.py @@ -14,7 +14,7 @@ class lib_agw_customtreectrl_Tests(wtc.WidgetTestCase): self.assertEqual(tree.GetAGWWindowStyleFlag(), CT.TR_DEFAULT_STYLE) self.assertEqual(tree.GetCount(), 0) self.assertEqual(tree.GetRootItem(), None) - + def test_lib_agw_customtreectrlTreeItem(self): tree = CT.CustomTreeCtrl(self.frame) root = tree.AddRoot('root item') @@ -24,7 +24,7 @@ class lib_agw_customtreectrl_Tests(wtc.WidgetTestCase): r = tree.GetRootItem() self.assertTrue(r is root) self.assertTrue(r == root) - + child = tree.AppendItem(root, 'child item') self.assertTrue(child is not root) self.assertTrue(child != root) @@ -37,7 +37,7 @@ class lib_agw_customtreectrl_Tests(wtc.WidgetTestCase): self.assertTrue(v == value) tree.SetItemData(root, None) self.assertTrue(tree.GetItemData(root) is None) - + def test_lib_agw_customtreectrlTreeItemPyData(self): # ensure that the "Py" versions works as the normal one value = 'Some Python Object' @@ -49,7 +49,7 @@ class lib_agw_customtreectrl_Tests(wtc.WidgetTestCase): self.assertTrue(v == value) tree.SetItemPyData(root, None) self.assertTrue(tree.GetItemPyData(root) is None) - + def test_lib_agw_customtreectrlGetSelections(self): tree = CT.CustomTreeCtrl(self.frame, agwStyle=CT.TR_MULTIPLE) root = tree.AddRoot('root item') @@ -59,12 +59,12 @@ class lib_agw_customtreectrl_Tests(wtc.WidgetTestCase): tree.SelectItem(c2) self.assertTrue(tree.IsSelected(c1)) self.assertTrue(tree.IsSelected(c2)) - + sel = tree.GetSelections() self.assertTrue(isinstance(sel, list)) self.assertTrue(len(sel) == 2) self.assertTrue(isinstance(sel[0], CT.GenericTreeItem)) - + def test_lib_agw_customtreectrlItemCheck(self): tree = CT.CustomTreeCtrl(self.frame) @@ -76,7 +76,7 @@ class lib_agw_customtreectrl_Tests(wtc.WidgetTestCase): tree.CheckItem(c1) tree.CheckItem(c2) - + self.assertTrue(tree.IsItemChecked(c1)) self.assertTrue(tree.IsItemChecked(c2)) @@ -86,7 +86,7 @@ class lib_agw_customtreectrl_Tests(wtc.WidgetTestCase): tree.CheckItem(c1) tree.CheckItem(c2) - + self.assertTrue(not tree.IsItemChecked(c1)) self.assertTrue(tree.IsItemChecked(c2)) @@ -111,57 +111,57 @@ class lib_agw_customtreectrl_Tests(wtc.WidgetTestCase): self.assertEqual(len(tree.GetChildren()), 3) else: self.assertEqual(len(tree.GetChildren()), 0) - + def test_lib_agw_customtreectrlConstantsExist(self): - CT.TR_NO_BUTTONS - CT.TR_SINGLE - CT.TR_HAS_BUTTONS - CT.TR_NO_LINES - CT.TR_LINES_AT_ROOT - CT.TR_DEFAULT_STYLE - CT.TR_TWIST_BUTTONS - CT.TR_MULTIPLE - CT.TR_EXTENDED + CT.TR_NO_BUTTONS + CT.TR_SINGLE + CT.TR_HAS_BUTTONS + CT.TR_NO_LINES + CT.TR_LINES_AT_ROOT + CT.TR_DEFAULT_STYLE + CT.TR_TWIST_BUTTONS + CT.TR_MULTIPLE + CT.TR_EXTENDED CT.TR_HAS_VARIABLE_ROW_HEIGHT - CT.TR_EDIT_LABELS - CT.TR_ROW_LINES - CT.TR_HIDE_ROOT - CT.TR_FULL_ROW_HIGHLIGHT - CT.TR_AUTO_CHECK_CHILD - CT.TR_AUTO_TOGGLE_CHILD - CT.TR_AUTO_CHECK_PARENT - CT.TR_ALIGN_WINDOWS - CT.TR_ALIGN_WINDOWS_RIGHT - CT.TR_ELLIPSIZE_LONG_ITEMS + CT.TR_EDIT_LABELS + CT.TR_ROW_LINES + CT.TR_HIDE_ROOT + CT.TR_FULL_ROW_HIGHLIGHT + CT.TR_AUTO_CHECK_CHILD + CT.TR_AUTO_TOGGLE_CHILD + CT.TR_AUTO_CHECK_PARENT + CT.TR_ALIGN_WINDOWS + CT.TR_ALIGN_WINDOWS_RIGHT + CT.TR_ELLIPSIZE_LONG_ITEMS CT.TR_TOOLTIP_ON_LONG_ITEMS - CT.TreeItemIcon_Normal - CT.TreeItemIcon_Selected - CT.TreeItemIcon_Expanded + CT.TreeItemIcon_Normal + CT.TreeItemIcon_Selected + CT.TreeItemIcon_Expanded CT.TreeItemIcon_SelectedExpanded - CT.TreeItemIcon_Checked + CT.TreeItemIcon_Checked CT.TreeItemIcon_NotChecked CT.TreeItemIcon_Undetermined - CT.TreeItemIcon_Flagged + CT.TreeItemIcon_Flagged CT.TreeItemIcon_NotFlagged - CT.TREE_HITTEST_ABOVE - CT.TREE_HITTEST_BELOW - CT.TREE_HITTEST_NOWHERE - CT.TREE_HITTEST_ONITEMBUTTON - CT.TREE_HITTEST_ONITEMICON - CT.TREE_HITTEST_ONITEMINDENT - CT.TREE_HITTEST_ONITEMLABEL - CT.TREE_HITTEST_ONITEM - CT.TREE_HITTEST_ONITEMRIGHT - CT.TREE_HITTEST_TOLEFT - CT.TREE_HITTEST_TORIGHT + CT.TREE_HITTEST_ABOVE + CT.TREE_HITTEST_BELOW + CT.TREE_HITTEST_NOWHERE + CT.TREE_HITTEST_ONITEMBUTTON + CT.TREE_HITTEST_ONITEMICON + CT.TREE_HITTEST_ONITEMINDENT + CT.TREE_HITTEST_ONITEMLABEL + CT.TREE_HITTEST_ONITEM + CT.TREE_HITTEST_ONITEMRIGHT + CT.TREE_HITTEST_TOLEFT + CT.TREE_HITTEST_TORIGHT CT.TREE_HITTEST_ONITEMUPPERPART CT.TREE_HITTEST_ONITEMLOWERPART CT.TREE_HITTEST_ONITEMCHECKICON CT.TREE_HITTEST_ONITEM - + def test_lib_agw_customtreectrlEventsExist(self): CT.wxEVT_TREE_BEGIN_DRAG CT.wxEVT_TREE_BEGIN_RDRAG @@ -179,40 +179,40 @@ class lib_agw_customtreectrl_Tests(wtc.WidgetTestCase): CT.wxEVT_TREE_KEY_DOWN CT.wxEVT_TREE_ITEM_ACTIVATED CT.wxEVT_TREE_ITEM_RIGHT_CLICK - CT.wxEVT_TREE_ITEM_MIDDLE_CLICK + CT.wxEVT_TREE_ITEM_MIDDLE_CLICK CT.wxEVT_TREE_END_DRAG - CT.wxEVT_TREE_STATE_IMAGE_CLICK + CT.wxEVT_TREE_STATE_IMAGE_CLICK CT.wxEVT_TREE_ITEM_GETTOOLTIP CT.wxEVT_TREE_ITEM_MENU CT.wxEVT_TREE_ITEM_CHECKING CT.wxEVT_TREE_ITEM_CHECKED CT.wxEVT_TREE_ITEM_HYPERLINK - - CT.EVT_TREE_BEGIN_DRAG + + CT.EVT_TREE_BEGIN_DRAG CT.EVT_TREE_BEGIN_LABEL_EDIT - CT.EVT_TREE_BEGIN_RDRAG - CT.EVT_TREE_DELETE_ITEM - CT.EVT_TREE_END_DRAG - CT.EVT_TREE_END_LABEL_EDIT - CT.EVT_TREE_GET_INFO - CT.EVT_TREE_ITEM_ACTIVATED - CT.EVT_TREE_ITEM_CHECKED - CT.EVT_TREE_ITEM_CHECKING - CT.EVT_TREE_ITEM_COLLAPSED + CT.EVT_TREE_BEGIN_RDRAG + CT.EVT_TREE_DELETE_ITEM + CT.EVT_TREE_END_DRAG + CT.EVT_TREE_END_LABEL_EDIT + CT.EVT_TREE_GET_INFO + CT.EVT_TREE_ITEM_ACTIVATED + CT.EVT_TREE_ITEM_CHECKED + CT.EVT_TREE_ITEM_CHECKING + CT.EVT_TREE_ITEM_COLLAPSED CT.EVT_TREE_ITEM_COLLAPSING - CT.EVT_TREE_ITEM_EXPANDED - CT.EVT_TREE_ITEM_EXPANDING + CT.EVT_TREE_ITEM_EXPANDED + CT.EVT_TREE_ITEM_EXPANDING CT.EVT_TREE_ITEM_GETTOOLTIP - CT.EVT_TREE_ITEM_HYPERLINK - CT.EVT_TREE_ITEM_MENU + CT.EVT_TREE_ITEM_HYPERLINK + CT.EVT_TREE_ITEM_MENU CT.EVT_TREE_ITEM_MIDDLE_CLICK CT.EVT_TREE_ITEM_RIGHT_CLICK - CT.EVT_TREE_KEY_DOWN - CT.EVT_TREE_SEL_CHANGED - CT.EVT_TREE_SEL_CHANGING - CT.EVT_TREE_SET_INFO + CT.EVT_TREE_KEY_DOWN + CT.EVT_TREE_SEL_CHANGED + CT.EVT_TREE_SEL_CHANGING + CT.EVT_TREE_SET_INFO CT.EVT_TREE_STATE_IMAGE_CLICK - + #--------------------------------------------------------------------------- if __name__ == '__main__': diff --git a/unittests/test_lib_agw_flatmenu.py b/unittests/test_lib_agw_flatmenu.py index 7ae7d956..f666c296 100644 --- a/unittests/test_lib_agw_flatmenu.py +++ b/unittests/test_lib_agw_flatmenu.py @@ -31,44 +31,44 @@ class lib_agw_flatmenu_Tests(wtc.WidgetTestCase): self._popUpMenu.AppendSeparator() - + def test_lib_agw_flatmenuOpen(self): def CreateLongPopupMenu(self): popMenu = FM.FlatMenu() sub = FM.FlatMenu() - + #----------------------------------------------- # Flat Menu test #----------------------------------------------- - + for ii in range(30): if ii == 0: menuItem = FM.FlatMenuItem(popMenu, wx.ID_ANY, "Menu Item #%ld"%(ii+1), "", wx.ITEM_NORMAL, sub) popMenu.AppendItem(menuItem) - + for k in range(5): - + menuItem = FM.FlatMenuItem(sub, wx.ID_ANY, "Sub Menu Item #%ld"%(k+1)) sub.AppendItem(menuItem) - + else: - + menuItem = FM.FlatMenuItem(popMenu, wx.ID_ANY, "Menu Item #%ld"%(ii+1)) popMenu.AppendItem(menuItem) - + return popMenu popMenu = CreateLongPopupMenu(self) - + fPt = self.frame.GetPosition() popMenu.Popup(wx.Point(fPt.x, fPt.y), self.frame) popMenu.Dismiss(True, True) - + # Clear the capture since the test won't do a normal shudown of the flatmenu cap = wx.Window.GetCapture() if cap: cap.ReleaseMouse() - + def test_lib_agw_flatmenuConstantsExist(self): @@ -84,7 +84,7 @@ class lib_agw_flatmenu_Tests(wtc.WidgetTestCase): FM.EVT_FLAT_MENU_ITEM_MOUSE_OVER FM.EVT_FLAT_MENU_SELECTED - + #--------------------------------------------------------------------------- if __name__ == '__main__': diff --git a/unittests/test_lib_agw_flatnotebook.py b/unittests/test_lib_agw_flatnotebook.py index 0a05f665..13ca70a0 100644 --- a/unittests/test_lib_agw_flatnotebook.py +++ b/unittests/test_lib_agw_flatnotebook.py @@ -49,7 +49,7 @@ class lib_agw_flatnotebook_Tests(wtc.WidgetTestCase): nb.DeleteAllPages() self.assertEqual(nb.GetPageCount(), 0) - + nb = FNB.FlatNotebook(self.frame) p1 = wx.Panel(nb) nb.AddPage(p1, "Page1") @@ -70,43 +70,43 @@ class lib_agw_flatnotebook_Tests(wtc.WidgetTestCase): nb.EnableTab(0, False) self.assertTrue(nb.GetEnabled(0) == False) - + def test_lib_agw_flatnotebookConstantsExist(self): - FNB.FNB_VC71 - FNB.FNB_FANCY_TABS - FNB.FNB_TABS_BORDER_SIMPLE - FNB.FNB_NO_X_BUTTON - FNB.FNB_NO_NAV_BUTTONS + FNB.FNB_VC71 + FNB.FNB_FANCY_TABS + FNB.FNB_TABS_BORDER_SIMPLE + FNB.FNB_NO_X_BUTTON + FNB.FNB_NO_NAV_BUTTONS FNB.FNB_MOUSE_MIDDLE_CLOSES_TABS - FNB.FNB_BOTTOM - FNB.FNB_NODRAG - FNB.FNB_VC8 - FNB.FNB_X_ON_TAB - FNB.FNB_BACKGROUND_GRADIENT - FNB.FNB_COLOURFUL_TABS - FNB.FNB_DCLICK_CLOSES_TABS - FNB.FNB_SMART_TABS - FNB.FNB_DROPDOWN_TABS_LIST - FNB.FNB_ALLOW_FOREIGN_DND - FNB.FNB_HIDE_ON_SINGLE_TAB - FNB.FNB_DEFAULT_STYLE - FNB.FNB_FF2 - FNB.FNB_NO_TAB_FOCUS - FNB.FNB_RIBBON_TABS - FNB.FNB_HIDE_TABS - FNB.FNB_NAV_BUTTONS_WHEN_NEEDED + FNB.FNB_BOTTOM + FNB.FNB_NODRAG + FNB.FNB_VC8 + FNB.FNB_X_ON_TAB + FNB.FNB_BACKGROUND_GRADIENT + FNB.FNB_COLOURFUL_TABS + FNB.FNB_DCLICK_CLOSES_TABS + FNB.FNB_SMART_TABS + FNB.FNB_DROPDOWN_TABS_LIST + FNB.FNB_ALLOW_FOREIGN_DND + FNB.FNB_HIDE_ON_SINGLE_TAB + FNB.FNB_DEFAULT_STYLE + FNB.FNB_FF2 + FNB.FNB_NO_TAB_FOCUS + FNB.FNB_RIBBON_TABS + FNB.FNB_HIDE_TABS + FNB.FNB_NAV_BUTTONS_WHEN_NEEDED def test_lib_agw_flatnotebookEvents(self): - FNB.EVT_FLATNOTEBOOK_PAGE_CHANGED - FNB.EVT_FLATNOTEBOOK_PAGE_CHANGING - FNB.EVT_FLATNOTEBOOK_PAGE_CLOSED - FNB.EVT_FLATNOTEBOOK_PAGE_CLOSING - FNB.EVT_FLATNOTEBOOK_PAGE_CONTEXT_MENU - FNB.EVT_FLATNOTEBOOK_PAGE_DROPPED + FNB.EVT_FLATNOTEBOOK_PAGE_CHANGED + FNB.EVT_FLATNOTEBOOK_PAGE_CHANGING + FNB.EVT_FLATNOTEBOOK_PAGE_CLOSED + FNB.EVT_FLATNOTEBOOK_PAGE_CLOSING + FNB.EVT_FLATNOTEBOOK_PAGE_CONTEXT_MENU + FNB.EVT_FLATNOTEBOOK_PAGE_DROPPED FNB.EVT_FLATNOTEBOOK_PAGE_DROPPED_FOREIGN - + #--------------------------------------------------------------------------- if __name__ == '__main__': diff --git a/unittests/test_lib_agw_floatspin.py b/unittests/test_lib_agw_floatspin.py index bf59360e..15fb24a7 100644 --- a/unittests/test_lib_agw_floatspin.py +++ b/unittests/test_lib_agw_floatspin.py @@ -7,7 +7,7 @@ import wx.lib.agw.floatspin as FS #--------------------------------------------------------------------------- class lib_agw_floatspin_Tests(wtc.WidgetTestCase): - + def test_lib_agw_floatspinCtor(self): floatspin = FS.FloatSpin(self.frame, min_val=0, max_val=1, increment=0.01, value=0.1, agwStyle=FS.FS_LEFT) @@ -39,25 +39,25 @@ class lib_agw_floatspin_Tests(wtc.WidgetTestCase): self.assertEqual(floatspin.GetMin(), 0) self.assertEqual(floatspin.GetMax(), 1) self.assertEqual(floatspin.GetIncrement(), FS.FixedPoint(str(0.01), 20)) - - + + def test_lib_agw_floatspinConstantsExist(self): FS.DEFAULT_PRECISION FS.FS_CENTRE FS.FS_LEFT FS.FS_READONLY - FS.FS_RIGHT + FS.FS_RIGHT def test_lib_agw_floatspinEvents(self): FS.EVT_FLOATSPIN FS.wxEVT_FLOATSPIN - + def test_lib_agw_floatspin_fixedpoint(self): f1 = FS.FixedPoint(20) f2 = FS.FixedPoint(30) f3 = FS.FixedPoint("20", 20) f4 = FS.FixedPoint("20", 20) - + self.assertEqual(f1, 20) self.assertEqual(f2, 30) self.assertEqual(f3, f4) diff --git a/unittests/test_lib_agw_fmcustomizedlg.py b/unittests/test_lib_agw_fmcustomizedlg.py index 887eb0a6..b319fba0 100644 --- a/unittests/test_lib_agw_fmcustomizedlg.py +++ b/unittests/test_lib_agw_fmcustomizedlg.py @@ -15,13 +15,13 @@ class lib_agw_fmcustomizedlg_Tests(wtc.WidgetTestCase): fileMenu = FM.FlatMenu() styleMenu = FM.FlatMenu() - + self._mtb.Append(fileMenu, "&File") self._mtb.Append(styleMenu, "&Style") - + # above is to excersize OrderedDict - self._dlg = FDLG.FMCustomizeDlg(self._mtb) - + self._dlg = FDLG.FMCustomizeDlg(self._mtb) + #--------------------------------------------------------------------------- if __name__ == '__main__': diff --git a/unittests/test_lib_agw_foldpanelbar.py b/unittests/test_lib_agw_foldpanelbar.py index e4ec6fa1..a893a8b5 100644 --- a/unittests/test_lib_agw_foldpanelbar.py +++ b/unittests/test_lib_agw_foldpanelbar.py @@ -7,21 +7,21 @@ import wx.lib.agw.foldpanelbar as FPB #--------------------------------------------------------------------------- class lib_agw_foldpanelbar_Tests(wtc.WidgetTestCase): - + def test_lib_agw_foldpanelbarCtor(self): panel_bar = FPB.FoldPanelBar(self.frame, -1, agwStyle=FPB.FPB_VERTICAL) - + fold_panel = panel_bar.AddFoldPanel("Thing") thing = wx.TextCtrl(fold_panel, -1, size=(400, -1), style=wx.TE_MULTILINE) - + panel_bar.AddFoldPanelWindow(fold_panel, thing) def test_lib_agw_foldpanelbarMethods(self): panel_bar = FPB.FoldPanelBar(self.frame, -1, agwStyle=FPB.FPB_VERTICAL) - + fold_panel = panel_bar.AddFoldPanel("Thing") thing = wx.TextCtrl(fold_panel, -1, size=(400, -1), style=wx.TE_MULTILINE) - + panel_bar.AddFoldPanelWindow(fold_panel, thing) # Some methods tests... @@ -38,7 +38,7 @@ class lib_agw_foldpanelbar_Tests(wtc.WidgetTestCase): panel_bar.Collapse(foldpanel) self.assertTrue(not foldpanel.IsExpanded()) - + def test_lib_agw_foldpanelbarConstantsExist(self): FPB.CAPTIONBAR_FILLED_RECTANGLE FPB.CAPTIONBAR_GRADIENT_H @@ -65,7 +65,7 @@ class lib_agw_foldpanelbar_Tests(wtc.WidgetTestCase): def test_lib_agw_foldpanelbarEvents(self): FPB.EVT_CAPTIONBAR FPB.wxEVT_CAPTIONBAR - + #--------------------------------------------------------------------------- if __name__ == '__main__': diff --git a/unittests/test_lib_agw_fourwaysplitter.py b/unittests/test_lib_agw_fourwaysplitter.py index c232e2f4..f7dd7339 100644 --- a/unittests/test_lib_agw_fourwaysplitter.py +++ b/unittests/test_lib_agw_fourwaysplitter.py @@ -7,13 +7,13 @@ import wx.lib.agw.fourwaysplitter as FWS #--------------------------------------------------------------------------- class lib_agw_fourwaysplitter_Tests(wtc.WidgetTestCase): - + def test_lib_agw_fourwaysplitterCtor(self): - splitter = FWS.FourWaySplitter(self.frame, -1, agwStyle=wx.SP_LIVE_UPDATE) + splitter = FWS.FourWaySplitter(self.frame, -1, agwStyle=wx.SP_LIVE_UPDATE) def test_lib_agw_fourwaysplitterMethods(self): - splitter = FWS.FourWaySplitter(self.frame, -1, agwStyle=wx.SP_LIVE_UPDATE) + splitter = FWS.FourWaySplitter(self.frame, -1, agwStyle=wx.SP_LIVE_UPDATE) panels = [] # Put in some coloured panels... @@ -24,7 +24,7 @@ class lib_agw_fourwaysplitter_Tests(wtc.WidgetTestCase): splitter.AppendWindow(panel) panels.append(panel) - + # Some methods tests... for index in range(4): self.assertEqual(splitter.GetWindow(index), panels[index]) @@ -38,11 +38,11 @@ class lib_agw_fourwaysplitter_Tests(wtc.WidgetTestCase): self.assertEqual(splitter.GetWindow(0), window) splitter.SetExpanded(0) - + for index in range(1, 4): self.assertTrue(not splitter.GetWindow(index).IsShown()) - - + + def test_lib_agw_fourwaysplitterConstantsExist(self): FWS.FLAG_CHANGED FWS.FLAG_PRESSED @@ -54,7 +54,7 @@ class lib_agw_fourwaysplitter_Tests(wtc.WidgetTestCase): def test_lib_agw_fourwaysplitterEvents(self): FWS.EVT_SPLITTER_SASH_POS_CHANGED FWS.EVT_SPLITTER_SASH_POS_CHANGING - + #--------------------------------------------------------------------------- if __name__ == '__main__': diff --git a/unittests/test_lib_agw_genericmessagedialog.py b/unittests/test_lib_agw_genericmessagedialog.py index 45dbcfea..82a66aad 100644 --- a/unittests/test_lib_agw_genericmessagedialog.py +++ b/unittests/test_lib_agw_genericmessagedialog.py @@ -7,7 +7,7 @@ import wx.lib.agw.genericmessagedialog as GMD #--------------------------------------------------------------------------- class lib_agw_genericmessagedialog_Tests(wtc.WidgetTestCase): - + def test_lib_agw_genericmessagedialogCtor(self): dlg = GMD.GenericMessageDialog(self.frame, 'Hello World', 'A Nice Message Box', agwStyle=wx.ICON_INFORMATION|wx.OK) @@ -22,14 +22,14 @@ class lib_agw_genericmessagedialog_Tests(wtc.WidgetTestCase): custom = 'GetCustom%sLabel()'%kind self.assertEqual(eval('dlg.%s'%default), eval('dlg.%s'%custom)) - + self.assertTrue(not dlg.HasCustomBitmaps()) self.assertTrue(not dlg.GetExtendedMessage()) dlg.SetExtendedMessage('An extended message') self.assertEqual(dlg.GetFullMessage(), '%s\n\n%s'%(dlg.GetMessage(), dlg.GetExtendedMessage())) - + def test_lib_agw_genericmessagedialogConstantsExist(self): GMD.BUTTON_SIZER_FLAGS GMD.GMD_DEFAULT diff --git a/unittests/test_lib_agw_gradientbutton.py b/unittests/test_lib_agw_gradientbutton.py index 881c8233..72d4d21d 100644 --- a/unittests/test_lib_agw_gradientbutton.py +++ b/unittests/test_lib_agw_gradientbutton.py @@ -10,7 +10,7 @@ pngFile = os.path.join(os.path.dirname(__file__), 'toucan.png') #--------------------------------------------------------------------------- class lib_agw_gradientbutton_Tests(wtc.WidgetTestCase): - + def test_lib_agw_gradientbuttonCtor(self): # Initialize GradientButton 1 (with image) @@ -18,7 +18,7 @@ class lib_agw_gradientbutton_Tests(wtc.WidgetTestCase): btn1 = GB.GradientButton(self.frame, -1, bitmap, "GradientButton") # Initialize GradientButton 2 (no image) btn2 = GB.GradientButton(self.frame, -1, None, "Hello World!") - + def test_lib_agw_gradientbuttonMethods(self): # Initialize AquaButton 2 (no image) @@ -30,7 +30,7 @@ class lib_agw_gradientbutton_Tests(wtc.WidgetTestCase): btn2.SetTopStartColour(wx.Colour('grey')) btn2.SetBottomStartColour(wx.WHITE) btn2.SetPressedBottomColour(wx.BLACK) - + #--------------------------------------------------------------------------- diff --git a/unittests/test_lib_agw_hyperlink.py b/unittests/test_lib_agw_hyperlink.py index b70159d6..b4bff62e 100644 --- a/unittests/test_lib_agw_hyperlink.py +++ b/unittests/test_lib_agw_hyperlink.py @@ -7,7 +7,7 @@ import wx.lib.agw.hyperlink as HL #--------------------------------------------------------------------------- class lib_agw_hyperlink_Tests(wtc.WidgetTestCase): - + def test_lib_agw_hyperlinkCtor(self): link = HL.HyperLinkCtrl(self.frame, -1, 'wxPython Main Page', pos=(100, 100), URL='http://www.wxpython.org/') @@ -32,7 +32,7 @@ class lib_agw_hyperlink_Tests(wtc.WidgetTestCase): self.assertEqual(link.GetURL(), url) - + def test_lib_agw_hyperlinkEvents(self): HL.EVT_HYPERLINK_LEFT HL.EVT_HYPERLINK_MIDDLE diff --git a/unittests/test_lib_agw_hypertreelist.py b/unittests/test_lib_agw_hypertreelist.py index 432a97db..c9b4014f 100644 --- a/unittests/test_lib_agw_hypertreelist.py +++ b/unittests/test_lib_agw_hypertreelist.py @@ -13,7 +13,7 @@ class lib_agw_hypertreelist_Tests(wtc.WidgetTestCase): tree = HTL.HyperTreeList(self.frame) self.assertEqual(tree.GetAGWWindowStyleFlag(), CT.TR_DEFAULT_STYLE) self.assertEqual(tree.GetRootItem(), None) - + def test_lib_agw_hypertreelistTreeItem(self): tree = HTL.HyperTreeList(self.frame) tree.AddColumn("First column") @@ -25,7 +25,7 @@ class lib_agw_hypertreelist_Tests(wtc.WidgetTestCase): r = tree.GetRootItem() self.assertTrue(r is root) self.assertTrue(r == root) - + child = tree.AppendItem(root, 'child item') self.assertTrue(child is not root) self.assertTrue(child != root) @@ -34,20 +34,20 @@ class lib_agw_hypertreelist_Tests(wtc.WidgetTestCase): tree = HTL.HyperTreeList(self.frame) tree.AddColumn("First column") tree.AddColumn("Second column") - + self.assertEqual(tree.GetColumnCount(), 2) tree.RemoveColumn(0) self.assertEqual(tree.GetColumnCount(), 1) self.assertEqual(tree.GetColumnWidth(0), HTL._DEFAULT_COL_WIDTH) - + tree.AddColumn("Second column") tree.SetColumnShown(1, False) self.assertTrue(not tree.IsColumnShown(1)) - + tree.SetColumnEditable(0, True) self.assertTrue(tree.IsColumnEditable(0)) - + def test_lib_agw_hypertreelistConstantsExist(self): HTL.TR_ALIGN_WINDOWS HTL.TR_AUTO_CHECK_CHILD @@ -77,7 +77,7 @@ class lib_agw_hypertreelist_Tests(wtc.WidgetTestCase): HTL.EVT_TREE_ITEM_CHECKING HTL.EVT_TREE_ITEM_HYPERLINK - + #--------------------------------------------------------------------------- if __name__ == '__main__': diff --git a/unittests/test_lib_agw_infobar.py b/unittests/test_lib_agw_infobar.py index 9ec91350..b0b94c42 100644 --- a/unittests/test_lib_agw_infobar.py +++ b/unittests/test_lib_agw_infobar.py @@ -10,7 +10,7 @@ class lib_agw_infobar_Tests(wtc.WidgetTestCase): def test_lib_agw_infobarCtor(self): ib = IB.InfoBar(self.frame) - + def test_lib_agw_infobar1(self): ib = IB.InfoBar(self.frame) ib.ShowMessage("hello world") @@ -25,7 +25,7 @@ class lib_agw_infobar_Tests(wtc.WidgetTestCase): self.myYield() ib.RemoveButton(wx.ID_SAVE) ib.Dismiss() - + #--------------------------------------------------------------------------- diff --git a/unittests/test_lib_agw_knobctrl.py b/unittests/test_lib_agw_knobctrl.py index 3ff2e781..813f23b5 100644 --- a/unittests/test_lib_agw_knobctrl.py +++ b/unittests/test_lib_agw_knobctrl.py @@ -7,7 +7,7 @@ import wx.lib.agw.knobctrl as KC #--------------------------------------------------------------------------- class lib_agw_knobctrl_Tests(wtc.WidgetTestCase): - + def test_lib_agw_knobctrlCtor(self): knobctrl = KC.KnobCtrl(self.frame, size=(100, 100)) @@ -29,7 +29,7 @@ class lib_agw_knobctrl_Tests(wtc.WidgetTestCase): self.assertEqual(knobctrl.GetMinValue(), 0) self.assertEqual(knobctrl.GetMaxValue(), 150) - + def test_lib_agw_knobctrlConstantsExist(self): KC.KC_BUFFERED_DC diff --git a/unittests/test_lib_agw_labelbook.py b/unittests/test_lib_agw_labelbook.py index 062bf7b3..2922cfa7 100644 --- a/unittests/test_lib_agw_labelbook.py +++ b/unittests/test_lib_agw_labelbook.py @@ -14,7 +14,7 @@ class lib_agw_labelbook_Tests(wtc.WidgetTestCase): book = LB.FlatImageBook(self.frame) self.assertEqual(book.GetPageCount(), 0) - + def test_lib_agw_labelbookPages(self): nb = LB.LabelBook(self.frame) p1 = wx.Panel(nb) @@ -22,7 +22,7 @@ class lib_agw_labelbook_Tests(wtc.WidgetTestCase): p2 = wx.Panel(nb) nb.AddPage(p2, "Page2") nb.SetSelection(0) - + nb = LB.FlatImageBook(self.frame) p1 = wx.Panel(nb) nb.AddPage(p1, "Page1") @@ -39,7 +39,7 @@ class lib_agw_labelbook_Tests(wtc.WidgetTestCase): for style in [LB.INB_LEFT, LB.INB_RIGHT]: nb.SetAGWWindowStyleFlag(style) - + nb = LB.FlatImageBook(self.frame) p1 = wx.Panel(nb) nb.AddPage(p1, "Page1") @@ -56,7 +56,7 @@ class lib_agw_labelbook_Tests(wtc.WidgetTestCase): p2 = wx.Panel(nb) nb.AddPage(p2, "Page2") nb.DeleteAllPages() - + nb = LB.FlatImageBook(self.frame) p1 = wx.Panel(nb) nb.AddPage(p1, "Page1") @@ -65,7 +65,7 @@ class lib_agw_labelbook_Tests(wtc.WidgetTestCase): for index in range(nb.GetPageCount()-1, -1, -1): nb.DeletePage(index) - + def test_lib_agw_labelbookConstantsExist(self): LB.INB_BOTTOM LB.INB_LEFT @@ -85,7 +85,7 @@ class lib_agw_labelbook_Tests(wtc.WidgetTestCase): LB.INB_DEFAULT_STYLE self.assertEqual(LB.INB_DEFAULT_STYLE, LB.INB_BORDER | LB.INB_TOP | LB.INB_USE_PIN_BUTTON) - + LB.INB_TAB_AREA_BACKGROUND_COLOUR LB.INB_ACTIVE_TAB_COLOUR LB.INB_TABS_BORDER_COLOUR @@ -109,7 +109,7 @@ class lib_agw_labelbook_Tests(wtc.WidgetTestCase): self.assertEqual(LB.EVT_IMAGENOTEBOOK_PAGE_CHANGED, wx.EVT_NOTEBOOK_PAGE_CHANGED) self.assertEqual(LB.EVT_IMAGENOTEBOOK_PAGE_CHANGING, wx.EVT_NOTEBOOK_PAGE_CHANGING) - + #--------------------------------------------------------------------------- if __name__ == '__main__': diff --git a/unittests/test_lib_agw_multidirdialog.py b/unittests/test_lib_agw_multidirdialog.py index d85904c8..5f0feea8 100644 --- a/unittests/test_lib_agw_multidirdialog.py +++ b/unittests/test_lib_agw_multidirdialog.py @@ -7,7 +7,7 @@ import wx.lib.agw.multidirdialog as MDD #--------------------------------------------------------------------------- class lib_agw_multidirdialog_Tests(wtc.WidgetTestCase): - + def test_lib_agw_multidirdialogCtor(self): dlg = MDD.MultiDirDialog(self.frame, title="Custom MultiDirDialog", agwStyle=MDD.DD_MULTIPLE|MDD.DD_DIR_MUST_EXIST) @@ -17,18 +17,18 @@ class lib_agw_multidirdialog_Tests(wtc.WidgetTestCase): agwStyle=MDD.DD_MULTIPLE|MDD.DD_DIR_MUST_EXIST) self.assertTrue(isinstance(dlg.GetPaths(), list)) - + # it looks like the generic dir ctrl may start out with an item # selected, so allow for that here self.assertTrue(len(dlg.GetPaths()) in [0,1]) - - + + def test_lib_agw_multidirdialogConstantsExist(self): MDD.DD_DEFAULT_STYLE MDD.DD_DIR_MUST_EXIST MDD.DD_MULTIPLE MDD.DD_NEW_DIR_BUTTON - + #--------------------------------------------------------------------------- diff --git a/unittests/test_lib_agw_peakmeter.py b/unittests/test_lib_agw_peakmeter.py index 27a21ec5..02105e2a 100644 --- a/unittests/test_lib_agw_peakmeter.py +++ b/unittests/test_lib_agw_peakmeter.py @@ -37,7 +37,7 @@ class lib_agw_peakmeter_Tests(wtc.WidgetTestCase): self.assertTrue(peak.GetAGWWindowStyleFlag() & PM.PM_HORIZONTAL == 0) self.assertEqual(peak.GetRangeValue(), (1, 10, 20)) - + def test_lib_agw_peakmeterConstantsExist(self): PM.BAND_DEFAULT PM.BAND_PERCENT @@ -46,7 +46,7 @@ class lib_agw_peakmeter_Tests(wtc.WidgetTestCase): PM.GRID_INCREASEBY PM.LEDS_DEFAULT PM.PM_HORIZONTAL - PM.PM_VERTICAL + PM.PM_VERTICAL #--------------------------------------------------------------------------- diff --git a/unittests/test_lib_agw_persist_persistencemanager.py b/unittests/test_lib_agw_persist_persistencemanager.py index 88b162b5..2ccd1ff7 100644 --- a/unittests/test_lib_agw_persist_persistencemanager.py +++ b/unittests/test_lib_agw_persist_persistencemanager.py @@ -21,47 +21,47 @@ class lib_agw_persist_persistencemanager_Tests(wtc.WidgetTestCase): self._persistMgr = PM.PersistenceManager.Get() self._persistMgr.SetManagerStyle(PM.PM_SAVE_RESTORE_AUI_PERSPECTIVES) self._persistMgr.SetPersistenceFile(self._configFile1) - + # give the frame a Name for below self.frame.SetName('PersistTestFrame') cb = wx.CheckBox(self.frame, name='PersistCheck') cb.persistValue = True cb.SetValue(False) - + self._persistMgr.RegisterAndRestoreAll(self.frame) - + self._persistMgr.SaveAndUnregister() - + def test_persistencemanagerRestore(self): self._persistMgr = PM.PersistenceManager.Get() self._persistMgr.SetPersistenceFile(self._configFile1) - + # give the frame a Name for below self.frame.SetName('PersistTestFrame') - + self._persistMgr.RegisterAndRestoreAll(self.frame) - + self.assertEqual(self._persistMgr.HasRestored(), True, "Persistence should be there, as it was created in CTOR test.") def test_persistencemanagerPersistValue(self): self._persistMgr = PM.PersistenceManager.Get() - self._persistMgr.SetManagerStyle(PM.PM_SAVE_RESTORE_AUI_PERSPECTIVES) + self._persistMgr.SetManagerStyle(PM.PM_SAVE_RESTORE_AUI_PERSPECTIVES) self._persistMgr.SetPersistenceFile(self._configFile1) - + # give the frame a Name for below self.frame.SetName('PersistTestFrame') cb = wx.CheckBox(self.frame, name='PersistCheck') - cb.persistValue = True - + cb.persistValue = True + self._persistMgr.RegisterAndRestoreAll(self.frame) - + self.assertEqual(self._persistMgr.HasRestored(), True, "Persistence should be there, as it was created in CTOR test.") self.assertEqual(cb.GetValue(), False, "Should be False as set in CTOR test") - + def test_persistencemanagerZZZZCleanup(self): # Just clean up the test file used by the other tests... @@ -77,246 +77,246 @@ class lib_agw_persist_persistencemanager_Tests(wtc.WidgetTestCase): PM.PM_PERSIST_CONTROL_VALUE PM.PM_RESTORE_CAPTION_FROM_CODE PM.PM_DEFAULT_STYLE - - + + # String constants used by BookHandler - + PM.PERSIST_BOOK_KIND PM.PERSIST_BOOK_SELECTION - + # To save and restore wx.lib.agw.aui.AuiNotebook perspectives PM.PERSIST_BOOK_AGW_AUI_PERSPECTIVE - + # ----------------------------------------------------------------------------------- # # String constants used by TreebookHandler - + PM.PERSIST_TREEBOOK_KIND - + # this key contains the indices of all expanded nodes in the tree book # separated by PERSIST_SEP PM.PERSIST_TREEBOOK_EXPANDED_BRANCHES PM.PERSIST_SEP - + # ----------------------------------------------------------------------------------- # # String constants used by TLWHandler - + # we use just "Window" to keep configuration files and such short, there # should be no confusion with wx.Window itself as we don't have persistent # windows, just persistent controls which have their own specific kind strings - + PM.PERSIST_TLW_KIND - + # Names for various persistent options PM.PERSIST_TLW_X PM.PERSIST_TLW_Y PM.PERSIST_TLW_W PM.PERSIST_TLW_H - + PM.PERSIST_TLW_MAXIMIZED PM.PERSIST_TLW_ICONIZED - + # To save and restore wx.aui and wx.lib.agw.aui perspectives PM.PERSIST_AGW_AUI_PERSPECTIVE PM.PERSIST_AUI_PERSPECTIVE - + PM.PERSIST_AUIPERSPECTIVE_KIND - + # ----------------------------------------------------------------------------------- # # String constants used by CheckBoxHandler - + PM.PERSIST_CHECKBOX_KIND PM.PERSIST_CHECKBOX_3STATE PM.PERSIST_CHECKBOX - + # ----------------------------------------------------------------------------------- # # String constants used by ListBoxHandler - + PM.PERSIST_LISTBOX_KIND PM.PERSIST_LISTBOX_SELECTIONS - + # ----------------------------------------------------------------------------------- # # String constants used by ListCtrlHandler - + PM.PERSIST_LISTCTRL_KIND PM.PERSIST_LISTCTRL_COLWIDTHS - + # ----------------------------------------------------------------------------------- # # String constants used by CheckListBoxHandler - + PM.PERSIST_CHECKLISTBOX_KIND PM.PERSIST_CHECKLIST_CHECKED PM.PERSIST_CHECKLIST_SELECTIONS - + # ----------------------------------------------------------------------------------- # # String constants used by ChoiceComboHandler - + PM.PERSIST_CHOICECOMBO_KIND PM.PERSIST_CHOICECOMBO_SELECTION - + # ----------------------------------------------------------------------------------- # # String constants used by RadioBoxHandler - + PM.PERSIST_RADIOBOX_KIND PM.PERSIST_RADIOBOX_SELECTION - + # ----------------------------------------------------------------------------------- # # String constants used by RadioButtonHandler - + PM.PERSIST_RADIOBUTTON_KIND PM.PERSIST_RADIOBUTTON_VALUE - + # ----------------------------------------------------------------------------------- # # String constants used by ScrolledWindowHandler - + PM.PERSIST_SCROLLEDWINDOW_KIND PM.PERSIST_SCROLLEDWINDOW_POS_H PM.PERSIST_SCROLLEDWINDOW_POS_V - + # ----------------------------------------------------------------------------------- # # String constants used by SliderHandler - + PM.PERSIST_SLIDER_KIND PM.PERSIST_SLIDER_VALUE - + # ----------------------------------------------------------------------------------- # # String constants used by SpinHandler - + PM.PERSIST_SPIN_KIND PM.PERSIST_SPIN_VALUE - + # ----------------------------------------------------------------------------------- # # String constants used by SplitterHandler - + PM.PERSIST_SPLITTER_KIND PM.PERSIST_SPLITTER_POSITION - + # ----------------------------------------------------------------------------------- # # String constants used by TextCtrlHandler - + PM.PERSIST_TEXTCTRL_KIND PM.PERSIST_TEXTCTRL_VALUE - + # ----------------------------------------------------------------------------------- # # String constants used by ToggleButtonHandler - + PM.PERSIST_TOGGLEBUTTON_KIND PM.PERSIST_TOGGLEBUTTON_TOGGLED - + # ----------------------------------------------------------------------------------- # # String constants used by TreeCtrlHandler - + PM.PERSIST_TREECTRL_KIND PM.PERSIST_TREECTRL_CHECKED_ITEMS PM.PERSIST_TREECTRL_EXPANSION PM.PERSIST_TREECTRL_SELECTIONS - + # ----------------------------------------------------------------------------------- # # String constants used by TreeListCtrlHandler - + PM.PERSIST_TREELISTCTRL_KIND PM.PERSIST_TREELISTCTRL_COLWIDTHS - + # ----------------------------------------------------------------------------------- # # String constants used by CalendarCtrlHandler - + PM.PERSIST_CALENDAR_KIND PM.PERSIST_CALENDAR_DATE - + # ----------------------------------------------------------------------------------- # # String constants used by CollapsiblePaneHandler - + PM.PERSIST_COLLAPSIBLE_KIND PM.PERSIST_COLLAPSIBLE_STATE - + # ----------------------------------------------------------------------------------- # # String constants used by DatePickerHandler - + PM.PERSIST_DATEPICKER_KIND PM.PERSIST_DATEPICKER_DATE - + # ----------------------------------------------------------------------------------- # # String constants used by MediaCtrlHandler - + PM.PERSIST_MEDIA_KIND - + PM.PERSIST_MEDIA_POS PM.PERSIST_MEDIA_VOLUME PM.PERSIST_MEDIA_RATE - + # ----------------------------------------------------------------------------------- # # String constants used by ColourPickerHandler - + PM.PERSIST_COLOURPICKER_KIND PM.PERSIST_COLOURPICKER_COLOUR - + # ----------------------------------------------------------------------------------- # # String constants used by FileDirPickerHandler - + PM.PERSIST_FILEDIRPICKER_KIND PM.PERSIST_FILEDIRPICKER_PATH - + # ----------------------------------------------------------------------------------- # # String constants used by FontPickerHandler - + PM.PERSIST_FONTPICKER_KIND PM.PERSIST_FONTPICKER_FONT - + # ----------------------------------------------------------------------------------- # # String constants used by FileHistoryHandler - + PM.PERSIST_FILEHISTORY_KIND PM.PERSIST_FILEHISTORY_PATHS - + # ----------------------------------------------------------------------------------- # # String constants used by FindReplaceHandler - + PM.PERSIST_FINDREPLACE_KIND PM.PERSIST_FINDREPLACE_FLAGS PM.PERSIST_FINDREPLACE_SEARCH PM.PERSIST_FINDREPLACE_REPLACE - + # ----------------------------------------------------------------------------------- # # String constants used by FontDialogHandler - + PM.PERSIST_FONTDIALOG_KIND PM.PERSIST_FONTDIALOG_EFFECTS PM.PERSIST_FONTDIALOG_SYMBOLS PM.PERSIST_FONTDIALOG_COLOUR PM.PERSIST_FONTDIALOG_FONT PM.PERSIST_FONTDIALOG_HELP - + # ----------------------------------------------------------------------------------- # # String constants used by ColourDialogHandler - + PM.PERSIST_COLOURDIALOG_KIND PM.PERSIST_COLOURDIALOG_COLOUR PM.PERSIST_COLOURDIALOG_CHOOSEFULL PM.PERSIST_COLOURDIALOG_CUSTOMCOLOURS - + # ----------------------------------------------------------------------------------- # # String constants used by ChoiceDialogHandler - + PM.PERSIST_CHOICEDIALOG_KIND PM.PERSIST_CHOICEDIALOG_SELECTIONS - + # ----------------------------------------------------------------------------------- # # String constants used by MenuBarHandler - + PM.PERSIST_MENUBAR_KIND PM.PERSIST_MENUBAR_CHECKRADIO_ITEMS - + # ----------------------------------------------------------------------------------- # # String constants used by ToolBarHandler - + PM.PERSIST_TOOLBAR_KIND PM.PERSIST_TOOLBAR_CHECKRADIO_ITEMS - + # ----------------------------------------------------------------------------------- # # String constants used by FoldPanelBarHandler - + PM.PERSIST_FOLDPANELBAR_KIND PM.PERSIST_FOLDPANELBAR_EXPANDED - + #--------------------------------------------------------------------------- if __name__ == '__main__': diff --git a/unittests/test_lib_agw_piectrl.py b/unittests/test_lib_agw_piectrl.py index c1120ea6..fa996814 100644 --- a/unittests/test_lib_agw_piectrl.py +++ b/unittests/test_lib_agw_piectrl.py @@ -36,7 +36,7 @@ class lib_agw_piectrl_Tests(wtc.WidgetTestCase): self.assertEqual(part2.GetValue(), 200) self.assertEqual(mypie.GetRotationAngle(), 0) - + #--------------------------------------------------------------------------- diff --git a/unittests/test_lib_agw_pybusyinfo.py b/unittests/test_lib_agw_pybusyinfo.py index 1cef38e6..0cc24176 100644 --- a/unittests/test_lib_agw_pybusyinfo.py +++ b/unittests/test_lib_agw_pybusyinfo.py @@ -14,12 +14,12 @@ class lib_agw_pybusyinfo_Tests(wtc.WidgetTestCase): wx.Yield() self.assertTrue(busy._infoFrame.IsShown()) - + for indx in range(5): wx.MilliSleep(10) del busy - + #--------------------------------------------------------------------------- diff --git a/unittests/test_lib_agw_pycollapsiblepane.py b/unittests/test_lib_agw_pycollapsiblepane.py index bbf2709b..ad67139b 100644 --- a/unittests/test_lib_agw_pycollapsiblepane.py +++ b/unittests/test_lib_agw_pycollapsiblepane.py @@ -7,7 +7,7 @@ import wx.lib.agw.pycollapsiblepane as PCP #--------------------------------------------------------------------------- class lib_agw_pycollapsiblepane_Tests(wtc.WidgetTestCase): - + def test_lib_agw_pycollapsiblepaneCtor(self): pane = PCP.PyCollapsiblePane(self.frame, label='Some Data', style=wx.CP_DEFAULT_STYLE|wx.CP_NO_TLW_RESIZE) @@ -26,7 +26,7 @@ class lib_agw_pycollapsiblepane_Tests(wtc.WidgetTestCase): self.assertEqual(pane.GetLabel(), 'Some Data') self.assertTrue(pane.IsCollapsed()) self.assertTrue(not pane.IsExpanded()) - + pane.Expand() self.assertTrue(pane.IsExpanded()) @@ -39,7 +39,7 @@ class lib_agw_pycollapsiblepane_Tests(wtc.WidgetTestCase): def test_lib_agw_pycollapsiblepaneEvents(self): PCP.EVT_COLLAPSIBLEPANE_CHANGED - + #--------------------------------------------------------------------------- diff --git a/unittests/test_lib_agw_pygauge.py b/unittests/test_lib_agw_pygauge.py index 4d3b14d1..4b2f35f6 100644 --- a/unittests/test_lib_agw_pygauge.py +++ b/unittests/test_lib_agw_pygauge.py @@ -7,7 +7,7 @@ import wx.lib.agw.pygauge as PG #--------------------------------------------------------------------------- class lib_agw_pygauge_Tests(wtc.WidgetTestCase): - + def test_lib_agw_pygaugeCtor(self): gauge = PG.PyGauge(self.frame, style=wx.GA_HORIZONTAL) @@ -26,9 +26,9 @@ class lib_agw_pygauge_Tests(wtc.WidgetTestCase): self.assertEqual(gauge.GetBarColour(), wx.Colour('red')) self.assertEqual(gauge.GetBackgroundColour(), wx.Colour('white')) self.assertEqual(gauge.GetBorderColour(), wx.Colour('black')) - + self.assertEqual(gauge.GetRange(), 120) - + #--------------------------------------------------------------------------- diff --git a/unittests/test_lib_agw_pyprogress.py b/unittests/test_lib_agw_pyprogress.py index 0b4819cd..d834d3a5 100644 --- a/unittests/test_lib_agw_pyprogress.py +++ b/unittests/test_lib_agw_pyprogress.py @@ -7,13 +7,13 @@ import wx.lib.agw.pyprogress as PP #--------------------------------------------------------------------------- class lib_agw_pyprogress_Tests(wtc.WidgetTestCase): - + def test_lib_agw_pyprogressCtor(self): dlg = PP.PyProgress(self.frame, -1, 'PyProgress Example', 'An Informative Message', agwStyle=wx.PD_APP_MODAL|wx.PD_ELAPSED_TIME) dlg.Destroy() - + def test_lib_agw_pyprogressMethods(self): dlg = PP.PyProgress(self.frame, -1, 'PyProgress Example', 'An Informative Message', @@ -43,4 +43,4 @@ class lib_agw_pyprogress_Tests(wtc.WidgetTestCase): if __name__ == '__main__': unittest.main() - + diff --git a/unittests/test_lib_agw_ribbonbar.py b/unittests/test_lib_agw_ribbonbar.py index b95ac8e2..3e27c5a3 100644 --- a/unittests/test_lib_agw_ribbonbar.py +++ b/unittests/test_lib_agw_ribbonbar.py @@ -35,14 +35,14 @@ def CreateBitmap(xpm): return bmp class lib_agw_ribbon_Tests(wtc.WidgetTestCase): - + def test_lib_agw_ribbonCtor(self): rib = RB.RibbonBar(self.frame, wx.ID_ANY, agwStyle=RB.RIBBON_BAR_DEFAULT_STYLE|RB.RIBBON_BAR_SHOW_PANEL_EXT_BUTTONS) home = RB.RibbonPage(rib, wx.ID_ANY, "Examples", CreateBitmap("ribbon")) toolbar_panel = RB.RibbonPanel(home, wx.ID_ANY, "Toolbar", wx.NullBitmap, wx.DefaultPosition, wx.DefaultSize, agwStyle=RB.RIBBON_PANEL_NO_AUTO_MINIMISE) - + toolbar = RB.RibbonToolBar(toolbar_panel, wx.ID_ANY) toolbar.AddTool(wx.ID_ANY, CreateBitmap("align_left")) toolbar.AddTool(wx.ID_ANY, CreateBitmap("align_center")) @@ -50,7 +50,7 @@ class lib_agw_ribbon_Tests(wtc.WidgetTestCase): toolbar.AddHybridTool(wx.ID_NEW, wx.ArtProvider.GetBitmap(wx.ART_NEW, wx.ART_OTHER, wx.Size(16, 15))) toolbar.AddSeparator() toolbar.AddDropdownTool(wx.ID_UNDO, wx.ArtProvider.GetBitmap(wx.ART_UNDO, wx.ART_OTHER, wx.Size(16, 15))) - + def test_lib_agw_ribbonControlCtor(self): rib = RB.RibbonBar(self.frame, wx.ID_ANY, agwStyle=RB.RIBBON_BAR_DEFAULT_STYLE|RB.RIBBON_BAR_SHOW_PANEL_EXT_BUTTONS) RB.RibbonControl(rib) @@ -67,7 +67,7 @@ class lib_agw_ribbon_Tests(wtc.WidgetTestCase): def test_lib_agw_ribbonPanelCtor(self): rib = RB.RibbonBar(self.frame, wx.ID_ANY, agwStyle=RB.RIBBON_BAR_DEFAULT_STYLE|RB.RIBBON_BAR_SHOW_PANEL_EXT_BUTTONS) - page = RB.RibbonPage(rib, wx.ID_ANY, "Appearance") + page = RB.RibbonPage(rib, wx.ID_ANY, "Appearance") RB.RibbonPanel(page) def test_lib_agw_ribbonArtProviders(self): @@ -76,7 +76,7 @@ class lib_agw_ribbon_Tests(wtc.WidgetTestCase): rib.SetArtProvider(RB.RibbonAUIArtProvider()) rib.SetArtProvider(RB.RibbonMSWArtProvider()) rib.SetArtProvider(RB.RibbonOSXArtProvider()) - + def test_lib_agw_ribbonEvents(self): RB.EVT_RIBBONBAR_PAGE_CHANGED RB.EVT_RIBBONBAR_PAGE_CHANGING @@ -102,7 +102,7 @@ class lib_agw_ribbon_Tests(wtc.WidgetTestCase): RB.RIBBON_BAR_SHOW_PANEL_EXT_BUTTONS RB.RIBBON_BAR_SHOW_PANEL_MINIMISE_BUTTONS RB.RIBBON_BAR_ALWAYS_SHOW_TABS - + def test_lib_agw_pyprogressConstantsExists(self): RB.RIBBON_ART_TAB_SEPARATION_SIZE RB.RIBBON_ART_PAGE_BORDER_LEFT_SIZE @@ -203,8 +203,8 @@ class lib_agw_ribbon_Tests(wtc.WidgetTestCase): RB.RIBBON_ART_TOOL_ACTIVE_BACKGROUND_TOP_COLOUR RB.RIBBON_ART_TOOL_ACTIVE_BACKGROUND_TOP_GRADIENT_COLOUR RB.RIBBON_ART_TOOL_ACTIVE_BACKGROUND_COLOUR - RB.RIBBON_ART_TOOL_ACTIVE_BACKGROUND_GRADIENT_COLOUR - + RB.RIBBON_ART_TOOL_ACTIVE_BACKGROUND_GRADIENT_COLOUR + # RibbonScrollButtonStyle RB.RIBBON_SCROLL_BTN_LEFT RB.RIBBON_SCROLL_BTN_RIGHT @@ -219,13 +219,13 @@ class lib_agw_ribbon_Tests(wtc.WidgetTestCase): RB.RIBBON_SCROLL_BTN_FOR_TABS RB.RIBBON_SCROLL_BTN_FOR_PAGE RB.RIBBON_SCROLL_BTN_FOR_MASK - + # RibbonButtonKind RB.RIBBON_BUTTON_NORMAL RB.RIBBON_BUTTON_DROPDOWN RB.RIBBON_BUTTON_HYBRID RB.RIBBON_BUTTON_TOGGLE - + # RibbonButtonBarButtonState RB.RIBBON_BUTTONBAR_BUTTON_SMALL RB.RIBBON_BUTTONBAR_BUTTON_MEDIUM @@ -246,8 +246,8 @@ class lib_agw_ribbon_Tests(wtc.WidgetTestCase): RB.RIBBON_GALLERY_BUTTON_HOVERED RB.RIBBON_GALLERY_BUTTON_ACTIVE RB.RIBBON_GALLERY_BUTTON_DISABLED - - + + RB.RIBBON_BAR_SHOW_PAGE_LABELS RB.RIBBON_BAR_SHOW_PAGE_ICONS RB.RIBBON_BAR_FLOW_HORIZONTAL @@ -257,7 +257,7 @@ class lib_agw_ribbon_Tests(wtc.WidgetTestCase): RB.RIBBON_BAR_ALWAYS_SHOW_TABS RB.RIBBON_BAR_DEFAULT_STYLE RB.RIBBON_BAR_FOLDBAR_STYLE - + RB.RIBBON_TOOLBAR_TOOL_FIRST RB.RIBBON_TOOLBAR_TOOL_LAST RB.RIBBON_TOOLBAR_TOOL_POSITION_MASK @@ -270,18 +270,18 @@ class lib_agw_ribbon_Tests(wtc.WidgetTestCase): RB.RIBBON_TOOLBAR_TOOL_DISABLED RB.RIBBON_TOOLBAR_TOOL_TOGGLED RB.RIBBON_TOOLBAR_TOOL_STATE_MASK - + RB.RIBBON_PANEL_NO_AUTO_MINIMISE RB.RIBBON_PANEL_EXT_BUTTON RB.RIBBON_PANEL_MINIMISE_BUTTON RB.RIBBON_PANEL_STRETCH RB.RIBBON_PANEL_FLEXIBLE - + RB.RIBBON_PANEL_DEFAULT_STYLE #--------------------------------------------------------------------------- if __name__ == '__main__': unittest.main() - + diff --git a/unittests/test_lib_agw_rulerctrl.py b/unittests/test_lib_agw_rulerctrl.py index 51521009..f66c75c4 100644 --- a/unittests/test_lib_agw_rulerctrl.py +++ b/unittests/test_lib_agw_rulerctrl.py @@ -7,7 +7,7 @@ import wx.lib.agw.rulerctrl as RC #--------------------------------------------------------------------------- class lib_agw_rulerctrl_Tests(wtc.WidgetTestCase): - + def test_lib_agw_rulerctrlCtor(self): ruler = RC.RulerCtrl(self.frame, -1, orient=wx.HORIZONTAL, style=wx.SUNKEN_BORDER) @@ -16,7 +16,7 @@ class lib_agw_rulerctrl_Tests(wtc.WidgetTestCase): # Some methods tests... self.assertEqual(ruler.GetFormat(), RC.RealFormat) - + def test_lib_agw_rulerctrlEvents(self): RC.EVT_INDICATOR_CHANGED RC.EVT_INDICATOR_CHANGING diff --git a/unittests/test_lib_agw_shapedbutton.py b/unittests/test_lib_agw_shapedbutton.py index 0a7756ed..97fa6a16 100644 --- a/unittests/test_lib_agw_shapedbutton.py +++ b/unittests/test_lib_agw_shapedbutton.py @@ -14,17 +14,17 @@ pngFile = os.path.join(os.path.dirname(__file__), 'toucan.png') #--------------------------------------------------------------------------- class lib_agw_shapedbuttons_Tests(wtc.WidgetTestCase): - + @unittest.skipIf(skipIt, 'Requires PIL') def test_lib_agw_shapedbutton1(self): - + btn = SB.SButton(self.frame, label='label') btn = SB.SButton(self.frame, -1, 'label', (10,10), (100,-1)) - + bmp = wx.Bitmap(pngFile) btn = SB.SBitmapButton(self.frame, -1, bitmap=bmp) btn = SB.SBitmapTextButton(self.frame, -1, label='label', bitmap=bmp) - + btn.SetBitmapFocus(bmp) btn.SetBitmapDisabled(bmp) btn.SetBitmapSelected(bmp) @@ -34,10 +34,10 @@ class lib_agw_shapedbuttons_Tests(wtc.WidgetTestCase): self.assertTrue(btn.GetValue()) self.assertEqual(btn.GetBitmapLabel(), bmp) - + @unittest.skipIf(skipIt, 'Requires PIL') def test_lib_agw_shapedbutton2(self): - + btn = SB.SButton(self.frame, label='label') btn.SetEllipseAxis(2.0, 1.0) @@ -45,8 +45,8 @@ class lib_agw_shapedbuttons_Tests(wtc.WidgetTestCase): btn = SB.SBitmapButton(self.frame, -1, bitmap=bmp) btn.SetEllipseAxis(2.0, 1.0) self.assertEqual(btn.GetEllipseAxis(), (2.0, 1.0)) - - + + #--------------------------------------------------------------------------- diff --git a/unittests/test_lib_agw_shortcuteditor.py b/unittests/test_lib_agw_shortcuteditor.py index b12adfa3..ef751576 100644 --- a/unittests/test_lib_agw_shortcuteditor.py +++ b/unittests/test_lib_agw_shortcuteditor.py @@ -7,14 +7,14 @@ import wx.lib.agw.shortcuteditor as SE #--------------------------------------------------------------------------- class lib_agw_shortcuteditor_Tests(wtc.WidgetTestCase): - + def test_lib_agw_rulerctrlCtor(self): dlg = SE.ShortcutEditor(self.frame) - + def test_lib_agw_shortcuteditorEvents(self): SE.EVT_SHORTCUT_CHANGING - SE.EVT_SHORTCUT_CHANGED - + SE.EVT_SHORTCUT_CHANGED + #--------------------------------------------------------------------------- diff --git a/unittests/test_lib_agw_speedmeter.py b/unittests/test_lib_agw_speedmeter.py index 2e4295c5..cbc99276 100644 --- a/unittests/test_lib_agw_speedmeter.py +++ b/unittests/test_lib_agw_speedmeter.py @@ -32,69 +32,69 @@ class lib_agw_speedmeter_Tests(wtc.WidgetTestCase): # Set The Region Of Existence Of SpeedMeter (Always In Radians!!!!) spW.SetAngleRange(-pi/6, 7*pi/6) - self.assertEqual(spW.GetAngleRange(), [-pi/6, 7*pi/6]) - + self.assertEqual(spW.GetAngleRange(), [-pi/6, 7*pi/6]) + # Create The Intervals That Will Divide Our SpeedMeter In Sectors intervals = range(0, 201, 20) spW.SetIntervals(intervals) self.assertEqual(spW.GetIntervals(), intervals) - + # Assign The Same Colours To All Sectors (We Simulate A Car Control For Speed) # Usually This Is Black colours = [wx.BLACK]*10 spW.SetIntervalColours(colours) self.assertEqual(spW.GetIntervalColours(), colours) - + # Assign The Ticks: Here They Are Simply The String Equivalent Of The Intervals ticks = [str(interval) for interval in intervals] spW.SetTicks(ticks) self.assertEqual(spW.GetTicks(), ticks) - + # Set The Ticks/Tick Markers Colour spW.SetTicksColour(wx.WHITE) self.assertEqual(spW.GetTicksColour(), wx.WHITE) - + # We Want To Draw 5 Secondary Tickis Between The Principal Ticks spW.SetNumberOfSecondaryTicks(5) self.assertEqual(spW.GetNumberOfSecondaryTicks(), 5) - + # Set The Font For The Ticks Markers tf = wx.Font(7, wx.FONTFAMILY_SWISS, wx.FONTSTYLE_NORMAL, wx.FONTWEIGHT_NORMAL) spW.SetTicksFont(tf) self.assertEqual(spW.GetTicksFont(), ([tf], 7)) - + # Set The Text In The Center Of SpeedMeter spW.SetMiddleText("Km/h") self.assertEqual(spW.GetMiddleText(), "Km/h") - + # Assign The Colour To The Center Text spW.SetMiddleTextColour(wx.WHITE) self.assertEqual(spW.GetMiddleTextColour(), wx.WHITE) - + # Assign A Font To The Center Text mf = wx.Font(8, wx.FONTFAMILY_SWISS, wx.FONTSTYLE_NORMAL, wx.FONTWEIGHT_BOLD) spW.SetMiddleTextFont(mf) self.assertEqual(spW.GetMiddleTextFont(), (mf, 8)) - + # Set The Colour For The Hand Indicator hc = wx.Colour(255, 50, 0) spW.SetHandColour(hc) self.assertEqual(spW.GetHandColour(), hc) - + # Do Not Draw The External (Container) Arc. Drawing The External Arc May # Sometimes Create Uglier Controls. Try To Comment This Line And See It # For Yourself! spW.DrawExternalArc(False) - + # Set The Current Value For The SpeedMeter spW.SetSpeedValue(44) self.assertEqual(spW.GetSpeedValue(), 44) - + def test_lib_agw_speedmeterSizerLayout(self): panel = wx.Panel(self.frame, -1) fgSizer = wx.FlexGridSizer(rows=2, cols=3, vgap=2, hgap=5) panel.SetSizer(fgSizer) - + panel1 = wx.Panel(panel, -1, style=wx.SUNKEN_BORDER) fgSizer.Add(panel1, 1, wx.EXPAND) @@ -125,8 +125,8 @@ class lib_agw_speedmeter_Tests(wtc.WidgetTestCase): SM.SM_MOUSE_TRACK SM.SM_NORMAL_DC SM.SM_ROTATE_TEXT - - + + #--------------------------------------------------------------------------- if __name__ == '__main__': diff --git a/unittests/test_lib_agw_supertooltip.py b/unittests/test_lib_agw_supertooltip.py index 41beacdc..211f6c38 100644 --- a/unittests/test_lib_agw_supertooltip.py +++ b/unittests/test_lib_agw_supertooltip.py @@ -7,7 +7,7 @@ import wx.lib.agw.supertooltip as STT #--------------------------------------------------------------------------- class lib_agw_supertooltip_Tests(wtc.WidgetTestCase): - + def test_lib_agw_supertooltipCtor(self): STT.SuperToolTip("a simple test message") diff --git a/unittests/test_lib_agw_thumbnailctrl.py b/unittests/test_lib_agw_thumbnailctrl.py index ee3f3468..78774027 100644 --- a/unittests/test_lib_agw_thumbnailctrl.py +++ b/unittests/test_lib_agw_thumbnailctrl.py @@ -7,7 +7,7 @@ import wx.lib.agw.thumbnailctrl as TNC #--------------------------------------------------------------------------- class lib_agw_thumbnailctrl_Tests(wtc.WidgetTestCase): - + def test_lib_agw_thumbnailctrlCtor(self): tnc = TNC.ThumbnailCtrl(self.frame, -1, imagehandler=TNC.NativeImageHandler) diff --git a/unittests/test_lib_agw_toasterbox.py b/unittests/test_lib_agw_toasterbox.py index 309201dd..9a0257f9 100644 --- a/unittests/test_lib_agw_toasterbox.py +++ b/unittests/test_lib_agw_toasterbox.py @@ -7,12 +7,12 @@ import wx.lib.agw.toasterbox as TB #--------------------------------------------------------------------------- class lib_agw_toasterbox_Tests(wtc.WidgetTestCase): - + def test_lib_agw_toasterboxCtor(self): windowstyle = TB.TB_CAPTION tbstyle = TB.TB_COMPLEX closingstyle = TB.TB_ONCLICK - + tb = TB.ToasterBox(self.frame, tbstyle, windowstyle, closingstyle, scrollType=TB.TB_SCR_TYPE_FADE) tb.Play() @@ -28,8 +28,8 @@ class lib_agw_toasterbox_Tests(wtc.WidgetTestCase): TB.TB_SCR_TYPE_UD TB.TB_SCR_TYPE_DU TB.TB_SCR_TYPE_FADE - - + + #--------------------------------------------------------------------------- diff --git a/unittests/test_lib_agw_ultimatelistctrl.py b/unittests/test_lib_agw_ultimatelistctrl.py index 1a5a2015..bf979412 100644 --- a/unittests/test_lib_agw_ultimatelistctrl.py +++ b/unittests/test_lib_agw_ultimatelistctrl.py @@ -7,7 +7,7 @@ import wx.lib.agw.ultimatelistctrl as ULC #--------------------------------------------------------------------------- class lib_agw_ultimatelistctrl_Tests(wtc.WidgetTestCase): - + def test_lib_agw_ultimatelistctrlCtorReport(self): ulc = ULC.UltimateListCtrl(self.frame, agwStyle=wx.LC_REPORT) @@ -88,7 +88,7 @@ class lib_agw_ultimatelistctrl_Tests(wtc.WidgetTestCase): #wx.EVT_LIST_FOOTER_RIGHT_CLICK #wx.EVT_LIST_ITEM_LEFT_CLICK #wx.EVT_LIST_END_DRAG - + #--------------------------------------------------------------------------- if __name__ == '__main__': diff --git a/unittests/test_lib_agw_xlsgrid.py b/unittests/test_lib_agw_xlsgrid.py index e35f1c1f..a6782ba0 100644 --- a/unittests/test_lib_agw_xlsgrid.py +++ b/unittests/test_lib_agw_xlsgrid.py @@ -15,7 +15,7 @@ class lib_agw_xlsgrid_Tests(wtc.WidgetTestCase): @unittest.skipIf(skipIt, 'Requires xlrd') def test_lib_agw_xlsgridCtor(self): xg = XG.XLSGrid(self.frame) - + #--------------------------------------------------------------------------- if __name__ == '__main__': diff --git a/unittests/test_lib_agw_zoombar.py b/unittests/test_lib_agw_zoombar.py index ad5b01ac..cceebcad 100644 --- a/unittests/test_lib_agw_zoombar.py +++ b/unittests/test_lib_agw_zoombar.py @@ -7,13 +7,13 @@ import wx.lib.agw.zoombar as ZB #--------------------------------------------------------------------------- class lib_agw_zoombar_Tests(wtc.WidgetTestCase): - + def test_lib_agw_zoombarCtor(self): zb = ZB.ZoomBar(self.frame) def test_lib_agw_thumbnailctrlEvents(self): ZB.EVT_ZOOMBAR - + #--------------------------------------------------------------------------- diff --git a/unittests/test_lib_busy.py b/unittests/test_lib_busy.py index d1de5dab..c9c88887 100644 --- a/unittests/test_lib_busy.py +++ b/unittests/test_lib_busy.py @@ -10,33 +10,33 @@ delay = 100 #--------------------------------------------------------------------------- class lib_busy_Tests(wtc.WidgetTestCase): - - def test_lib_busy1(self): + + def test_lib_busy1(self): with BusyInfo("short message...", self.frame): wx.MilliSleep(delay*2) wx.MilliSleep(delay) self.myYield() - - def test_lib_busy2(self): + + def test_lib_busy2(self): with BusyInfo("This is my longer short message. Please be patient...", self.frame): wx.MilliSleep(delay*2) wx.MilliSleep(delay) self.myYield() - def test_lib_busy3(self): + def test_lib_busy3(self): busy = BusyInfo("Without using the context manager...", self.frame) wx.MilliSleep(delay*2) del busy wx.MilliSleep(delay) self.myYield() - - def test_lib_busy4(self): + + def test_lib_busy4(self): with BusyInfo("Without using the parent window..."): wx.MilliSleep(delay*2) wx.MilliSleep(delay) self.myYield() - - def test_lib_busy5(self): + + def test_lib_busy5(self): message = """A long message with line breaks: Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim @@ -49,10 +49,10 @@ laborum.""" wx.MilliSleep(delay*2) wx.MilliSleep(delay) self.myYield() - - - - + + + + #--------------------------------------------------------------------------- diff --git a/unittests/test_lib_buttons.py b/unittests/test_lib_buttons.py index 8fd769e4..d6f4af6e 100644 --- a/unittests/test_lib_buttons.py +++ b/unittests/test_lib_buttons.py @@ -9,16 +9,16 @@ pngFile = os.path.join(os.path.dirname(__file__), 'toucan.png') #--------------------------------------------------------------------------- class lib_buttons_Tests(wtc.WidgetTestCase): - + def test_lib_buttons1(self): - + btn = buttons.GenButton(self.frame, label='label') btn = buttons.GenButton(self.frame, -1, 'label', (10,10), (100,-1), wx.BU_LEFT) - + bmp = wx.Bitmap(pngFile) btn = buttons.GenBitmapButton(self.frame, bitmap=bmp) btn = buttons.GenBitmapTextButton(self.frame, label='label', bitmap=bmp) - + btn.SetBitmapFocus(bmp) btn.SetBitmapDisabled(bmp) btn.SetBitmapSelected(bmp) @@ -28,17 +28,17 @@ class lib_buttons_Tests(wtc.WidgetTestCase): self.assertTrue(btn.GetValue()) self.assertEqual(btn.GetBitmapLabel(), bmp) - - + + def test_lib_buttons2(self): - + btn = buttons.ThemedGenButton(self.frame, label='label') btn = buttons.ThemedGenButton(self.frame, -1, 'label', (10,10), (100,-1), wx.BU_LEFT) - + bmp = wx.Bitmap(pngFile) btn = buttons.ThemedGenBitmapButton(self.frame, bitmap=bmp) btn = buttons.ThemedGenBitmapTextButton(self.frame, label='label', bitmap=bmp) - + btn.SetBitmapFocus(bmp) btn.SetBitmapDisabled(bmp) btn.SetBitmapSelected(bmp) @@ -48,9 +48,9 @@ class lib_buttons_Tests(wtc.WidgetTestCase): self.assertTrue(btn.GetValue()) self.assertEqual(btn.GetBitmapLabel(), bmp) - - - + + + #--------------------------------------------------------------------------- diff --git a/unittests/test_lib_colourdb.py b/unittests/test_lib_colourdb.py index 1dfae1e2..d4aacc4c 100644 --- a/unittests/test_lib_colourdb.py +++ b/unittests/test_lib_colourdb.py @@ -15,13 +15,13 @@ class lib_colourdb_Tests(wtc.WidgetTestCase): self.assertTrue(wx.TheColourDatabase.Find('NAVY').IsOk()) self.assertTrue(wx.TheColourDatabase.Find('GREY93').IsOk()) self.assertTrue(wx.TheColourDatabase.Find('MEDIUMPURPLE1').IsOk()) - + self.assertEqual(wx.TheColourDatabase.Find('ORANGERED1'), wx.Colour(255, 69, 0, 255)) self.assertIn(wx.TheColourDatabase.FindName(wx.Colour(255, 69, 0)), ['ORANGE RED', 'ORANGERED']) - + #--------------------------------------------------------------------------- if __name__ == '__main__': diff --git a/unittests/test_lib_colourselect.py b/unittests/test_lib_colourselect.py index 871e520f..d982e8ff 100644 --- a/unittests/test_lib_colourselect.py +++ b/unittests/test_lib_colourselect.py @@ -8,18 +8,18 @@ import wx.lib.colourselect class lib_colourselect_Tests(wtc.WidgetTestCase): def test_lib_colourselect1(self): - + btn = wx.lib.colourselect.ColourSelect(self.frame, -1, "Choose...", wx.WHITE) - + self.assertEqual(btn.GetColour(), wx.Colour('white')) btn.SetValue(wx.RED) self.assertEqual(btn.GetColour(), wx.Colour('red')) - + btn.SetValue('black') self.assertEqual(btn.GetColour(), wx.BLACK) - - + + #--------------------------------------------------------------------------- diff --git a/unittests/test_lib_expando.py b/unittests/test_lib_expando.py index f609a866..9c010288 100644 --- a/unittests/test_lib_expando.py +++ b/unittests/test_lib_expando.py @@ -11,18 +11,18 @@ class lib_expando_Tests(wtc.WidgetTestCase): pnl = wx.Panel(self.frame) w = wx.lib.expando.ExpandoTextCtrl(pnl, value="This is a test", pos=(10,10)) bs1 = w.GetSize() - + w.AppendText("\nThis is a New Label") bs2 = w.GetSize() - + self.assertEqual(w.GetValue(), "This is a test\nThis is a New Label") - + # All we can test here is that we have more lines than we started # with, since different platforms may wrap at different spots in the # string. self.assertGreaterEqual(w.GetNumberOfLines(), 2) self.assertGreater(bs2.height, bs1.height) - + #--------------------------------------------------------------------------- if __name__ == '__main__': diff --git a/unittests/test_lib_fancytext.py b/unittests/test_lib_fancytext.py index eabfe5e9..8f0497de 100644 --- a/unittests/test_lib_fancytext.py +++ b/unittests/test_lib_fancytext.py @@ -7,25 +7,25 @@ import wx.lib.fancytext as FT #--------------------------------------------------------------------------- test_str = ('' 'some |23 textwith subscript' - ' some other text') + ' some other text') class lib_fancytext_Tests(wtc.WidgetTestCase): def test_lib_fancytext_DateCtor(self): sft = FT.StaticFancyText(self.frame, -1, "text to test", wx.Brush("light grey", wx.BRUSHSTYLE_SOLID)) - + def test_lib_fancytext_Methods(self): self.frame.Bind(wx.EVT_PAINT, self.OnPaint) - + FT.RenderToBitmap(test_str, background=None, enclose=True) def OnPaint(self, evt): - dc = wx.PaintDC(self.frame) + dc = wx.PaintDC(self.frame) FT.GetExtent(test_str, dc=dc, enclose=True) FT.GetFullExtent(test_str, dc=dc, enclose=True) - FT.RenderToDC(test_str, dc, 0, 10, enclose=True) - + FT.RenderToDC(test_str, dc, 0, 10, enclose=True) + #--------------------------------------------------------------------------- if __name__ == '__main__': diff --git a/unittests/test_lib_floatcanvas_bbox.py b/unittests/test_lib_floatcanvas_bbox.py index f1b11410..0ff1cbe3 100644 --- a/unittests/test_lib_floatcanvas_bbox.py +++ b/unittests/test_lib_floatcanvas_bbox.py @@ -22,10 +22,10 @@ class testCreator(wtc.WidgetTestCase): def testShape(self): B = BBox((0,0,5,5)) self.failUnless(B.shape == (2,2)) - + def testShape2(self): self.failUnlessRaises(ValueError, BBox, (0,0,5) ) - + def testShape3(self): self.failUnlessRaises(ValueError, BBox, (0,0,5,6,7) ) @@ -33,7 +33,7 @@ class testCreator(wtc.WidgetTestCase): A = N.array(((4,5),(10,12)), N.float_) B = BBox(A) self.failUnless(isinstance(B, BBox)) - + def testMinMax(self): self.failUnlessRaises(ValueError, BBox, (0,0,-1,6) ) @@ -70,62 +70,62 @@ class testAsBBox(wtc.WidgetTestCase): B = (((0,0),(5,5))) C = asBBox(B) self.failIf(B is C) - + def testPassArray(self): # Different data type A = N.array( (((0,0),(5,5))) ) C = asBBox(A) self.failIf(A is C) - + def testPassArray2(self): # same data type -- should be a view A = N.array( (((0,0),(5,5))), N.float_ ) C = asBBox(A) A[0,0] = -10 self.failUnless(C[0,0] == A[0,0]) - + class testIntersect(wtc.WidgetTestCase): def testSame(self): B = BBox(((-23.5, 456),(56, 532.0))) C = BBox(((-23.5, 456),(56, 532.0))) self.failUnless(B.Overlaps(C) ) - + def testUpperLeft(self): B = BBox( ( (5, 10),(15, 25) ) ) C = BBox( ( (0, 12),(10, 32.0) ) ) self.failUnless(B.Overlaps(C) ) - + def testUpperRight(self): B = BBox( ( (5, 10),(15, 25) ) ) C = BBox( ( (12, 12),(25, 32.0) ) ) self.failUnless(B.Overlaps(C) ) - + def testLowerRight(self): B = BBox( ( (5, 10),(15, 25) ) ) C = BBox( ( (12, 5),(25, 15) ) ) self.failUnless(B.Overlaps(C) ) - + def testLowerLeft(self): B = BBox( ( (5, 10),(15, 25) ) ) C = BBox( ( (-10, 5),(8.5, 15) ) ) self.failUnless(B.Overlaps(C) ) - + def testBelow(self): B = BBox( ( (5, 10),(15, 25) ) ) C = BBox( ( (-10, 5),(8.5, 9.2) ) ) self.failIf(B.Overlaps(C) ) - + def testAbove(self): B = BBox( ( (5, 10),(15, 25) ) ) C = BBox( ( (-10, 25.001),(8.5, 32) ) ) self.failIf(B.Overlaps(C) ) - + def testLeft(self): B = BBox( ( (5, 10),(15, 25) ) ) C = BBox( ( (4, 8),(4.95, 32) ) ) self.failIf(B.Overlaps(C) ) - + def testRight(self): B = BBox( ( (5, 10),(15, 25) ) ) C = BBox( ( (17.1, 8),(17.95, 32) ) ) @@ -135,32 +135,32 @@ class testIntersect(wtc.WidgetTestCase): B = BBox( ( (-15, -25),(-5, -10) ) ) C = BBox( ( (-12, -22), (-6, -8) ) ) self.failUnless(B.Overlaps(C) ) - + def testOutside(self): B = BBox( ( (-15, -25),(-5, -10) ) ) C = BBox( ( (-17, -26), (3, 0) ) ) self.failUnless(B.Overlaps(C) ) - + def testTouch(self): B = BBox( ( (5, 10),(15, 25) ) ) C = BBox( ( (15, 8),(17.95, 32) ) ) self.failUnless(B.Overlaps(C) ) - + def testCorner(self): B = BBox( ( (5, 10),(15, 25) ) ) C = BBox( ( (15, 25),(17.95, 32) ) ) self.failUnless(B.Overlaps(C) ) - + def testZeroSize(self): B = BBox( ( (5, 10),(15, 25) ) ) C = BBox( ( (15, 25),(15, 25) ) ) self.failUnless(B.Overlaps(C) ) - + def testZeroSize2(self): B = BBox( ( (5, 10),(5, 10) ) ) C = BBox( ( (15, 25),(15, 25) ) ) self.failIf(B.Overlaps(C) ) - + def testZeroSize3(self): B = BBox( ( (5, 10),(5, 10) ) ) C = BBox( ( (0, 8),(10, 12) ) ) @@ -178,31 +178,31 @@ class testEquality(wtc.WidgetTestCase): B = BBox( ( (1.0, 2.0), (5.0, 10.0) ) ) C = BBox( ( (1.0, 2.0), (5.0, 10.0) ) ) self.failUnless(B == C) - + def testIdentical(self): B = BBox( ( (1.0, 2.0), (5.0, 10.0) ) ) self.failUnless(B == B) - + def testNotSame(self): B = BBox( ( (1.0, 2.0), (5.0, 10.0) ) ) C = BBox( ( (1.0, 2.0), (5.0, 10.1) ) ) self.failIf(B == C) - + def testWithArray(self): B = BBox( ( (1.0, 2.0), (5.0, 10.0) ) ) C = N.array( ( (1.0, 2.0), (5.0, 10.0) ) ) self.failUnless(B == C) - + def testWithArray2(self): B = BBox( ( (1.0, 2.0), (5.0, 10.0) ) ) C = N.array( ( (1.0, 2.0), (5.0, 10.0) ) ) self.failUnless(C == B) - + def testWithArray2(self): B = BBox( ( (1.0, 2.0), (5.0, 10.0) ) ) C = N.array( ( (1.01, 2.0), (5.0, 10.0) ) ) self.failIf(C == B) - + class testInside(wtc.WidgetTestCase): def testSame(self): B = BBox( ( (1.0, 2.0), (5.0, 10.0) ) ) @@ -223,37 +223,37 @@ class testInside(wtc.WidgetTestCase): B = BBox( ( (5, 10),(15, 25) ) ) C = BBox( ( (0, 12),(10, 32.0) ) ) self.failIf(B.Inside(C) ) - + def testUpperRight(self): B = BBox( ( (5, 10),(15, 25) ) ) C = BBox( ( (12, 12),(25, 32.0) ) ) self.failIf(B.Inside(C) ) - + def testLowerRight(self): B = BBox( ( (5, 10),(15, 25) ) ) C = BBox( ( (12, 5),(25, 15) ) ) self.failIf(B.Inside(C) ) - + def testLowerLeft(self): B = BBox( ( (5, 10),(15, 25) ) ) C = BBox( ( (-10, 5),(8.5, 15) ) ) self.failIf(B.Inside(C) ) - + def testBelow(self): B = BBox( ( (5, 10),(15, 25) ) ) C = BBox( ( (-10, 5),(8.5, 9.2) ) ) self.failIf(B.Inside(C) ) - + def testAbove(self): B = BBox( ( (5, 10),(15, 25) ) ) C = BBox( ( (-10, 25.001),(8.5, 32) ) ) self.failIf(B.Inside(C) ) - + def testLeft(self): B = BBox( ( (5, 10),(15, 25) ) ) C = BBox( ( (4, 8),(4.95, 32) ) ) self.failIf(B.Inside(C) ) - + def testRight(self): B = BBox( ( (5, 10),(15, 25) ) ) C = BBox( ( (17.1, 8),(17.95, 32) ) ) @@ -269,37 +269,37 @@ class testPointInside(wtc.WidgetTestCase): B = BBox( ( (5, 10),(15, 25) ) ) P = (4, 30) self.failIf(B.PointInside(P)) - + def testUpperRight(self): B = BBox( ( (5, 10),(15, 25) ) ) P = (16, 30) self.failIf(B.PointInside(P)) - + def testLowerRight(self): B = BBox( ( (5, 10),(15, 25) ) ) P = (16, 4) self.failIf(B.PointInside(P)) - + def testLowerLeft(self): B = BBox( ( (5, 10),(15, 25) ) ) P = (-10, 5) self.failIf(B.PointInside(P)) - + def testBelow(self): B = BBox( ( (5, 10),(15, 25) ) ) P = (10, 5) self.failIf(B.PointInside(P)) - + def testAbove(self): B = BBox( ( (5, 10),(15, 25) ) ) P = ( 10, 25.001) self.failIf(B.PointInside(P)) - + def testLeft(self): B = BBox( ( (5, 10),(15, 25) ) ) P = (4, 12) self.failIf(B.PointInside(P)) - + def testRight(self): B = BBox( ( (5, 10),(15, 25) ) ) P = (17.1, 12.3) @@ -377,7 +377,7 @@ class testFromPoints(wtc.WidgetTestCase): (65, -23), (-0.0001, 23.432), ] - B = fromPoints(Pts) + B = fromPoints(Pts) self.failUnless(B[0,0] == -4.32 and B[0,1] == -23.0 and B[1,0] == 65.0 and @@ -425,10 +425,10 @@ class testWidthHeight(wtc.WidgetTestCase): def testSetW(self): self.failUnlessRaises(AttributeError, self.attemptSetWidth) - + def testSetH(self): self.failUnlessRaises(AttributeError, self.attemptSetHeight) - + class testCenter(wtc.WidgetTestCase): B = BBox( ( (1.0, 2.0), (5.0, 10.0) ) ) def testCenter(self): @@ -439,7 +439,7 @@ class testCenter(wtc.WidgetTestCase): def testSetCenter(self): self.failUnlessRaises(AttributeError, self.attemptSetCenter) - + class testBBarray(wtc.WidgetTestCase): BBarray = N.array( ( ((-23.5, 456), (56, 532.0)), @@ -461,27 +461,27 @@ class testNullBBox(wtc.WidgetTestCase): def testValues(self): self.failUnless( N.alltrue(N.isnan(self.B1)) ) - + def testIsNull(self): self.failUnless( self.B1.IsNull ) def testEquals(self): self.failUnless( (self.B1 == self.B2) == True ) - + def testNotEquals(self): self.failUnless ( (self.B1 == self.B3) == False, - "NotEquals failed for\n%s,\n %s:%s"%(self.B1, self.B3, (self.B1 == self.B3)) ) + "NotEquals failed for\n%s,\n %s:%s"%(self.B1, self.B3, (self.B1 == self.B3)) ) def testNotEquals2(self): self.failUnless ( (self.B3 == self.B1) == False, - "NotEquals failed for\n%s,\n %s:%s"%(self.B3, self.B1, (self.B3 == self.B1)) ) - + "NotEquals failed for\n%s,\n %s:%s"%(self.B3, self.B1, (self.B3 == self.B1)) ) + def testMerge(self): C = self.B1.copy() C.Merge(self.B3) self.failUnless( C == self.B3, "merge failed, got: %s"%C ) - + def testOverlaps(self): self.failUnless( self.B1.Overlaps(self.B3) == False) @@ -497,21 +497,21 @@ class testInfBBox(wtc.WidgetTestCase): def testValues(self): self.failUnless( N.alltrue(N.isinf(self.B1)) ) - + # def testIsNull(self): # self.failUnless( self.B1.IsNull ) def testEquals(self): self.failUnless( (self.B1 == self.B2) == True ) - + def testNotEquals(self): self.failUnless ( (self.B1 == self.B3) == False, - "NotEquals failed for\n%s,\n %s:%s"%(self.B1, self.B3, (self.B1 == self.B3)) ) + "NotEquals failed for\n%s,\n %s:%s"%(self.B1, self.B3, (self.B1 == self.B3)) ) def testNotEquals2(self): self.failUnless ( (self.B3 == self.B1) == False, - "NotEquals failed for\n%s,\n %s:%s"%(self.B3, self.B1, (self.B3 == self.B1)) ) - + "NotEquals failed for\n%s,\n %s:%s"%(self.B3, self.B1, (self.B3 == self.B1)) ) + def testMerge(self): C = self.B1.copy() C.Merge(self.B3) @@ -529,7 +529,7 @@ class testInfBBox(wtc.WidgetTestCase): def testOverlaps2(self): self.failUnless( self.B3.Overlaps(self.B1) == True) - + def testOverlaps3(self): self.failUnless( self.B1.Overlaps(self.B3) == True) @@ -538,21 +538,21 @@ class testInfBBox(wtc.WidgetTestCase): def testOverlaps5(self): self.failUnless( self.NB.Overlaps(self.B1) == True) - + class testSides(wtc.WidgetTestCase): B = BBox( ( (1.0, 2.0), (5.0, 10.0) ) ) def testLeft(self): - self.failUnless( self.B.Left == 1.0 ) + self.failUnless( self.B.Left == 1.0 ) def testRight(self): - self.failUnless( self.B.Right == 5.0 ) + self.failUnless( self.B.Right == 5.0 ) def testBottom(self): - self.failUnless( self.B.Bottom == 2.0 ) + self.failUnless( self.B.Bottom == 2.0 ) def testTop(self): - self.failUnless( self.B.Top == 10.0 ) + self.failUnless( self.B.Top == 10.0 ) + - #--------------------------------------------------------------------------- if __name__ == '__main__': diff --git a/unittests/test_lib_floatcanvas_floatcanvas.py b/unittests/test_lib_floatcanvas_floatcanvas.py index 2f5db646..2c8dd0e5 100644 --- a/unittests/test_lib_floatcanvas_floatcanvas.py +++ b/unittests/test_lib_floatcanvas_floatcanvas.py @@ -20,131 +20,131 @@ class lib_floatcanvas_floatcanvas_Tests(wtc.WidgetTestCase): def test_lib_floatcanvas_fc_arc(self): fccanvas = fc.FloatCanvas(self.frame) - + obj = fc.Arc((10, 10), (20, 20), (5, 5)) - + fccanvas.AddObject(obj) def test_lib_floatcanvas_fc_arrow(self): fccanvas = fc.FloatCanvas(self.frame) - + obj = fc.Arrow((10, 10), 10, 10) - + fccanvas.AddObject(obj) def test_lib_floatcanvas_fc_arrowline(self): fccanvas = fc.FloatCanvas(self.frame) - + obj = fc.ArrowLine((10, 10)) - + fccanvas.AddObject(obj) - + def test_lib_floatcanvas_fc_bitmap(self): fccanvas = fc.FloatCanvas(self.frame) - + bmp = wx.Bitmap(pngFile) obj = fc.Bitmap(bmp, (2, 2)) - + fccanvas.AddObject(obj) def test_lib_floatcanvas_fc_circle(self): fccanvas = fc.FloatCanvas(self.frame) - + obj = fc.Circle((2, 2), 2) - + fccanvas.AddObject(obj) def test_lib_floatcanvas_fc_line(self): fccanvas = fc.FloatCanvas(self.frame) - + obj = fc.Line((2, 2)) - + fccanvas.AddObject(obj) def test_lib_floatcanvas_fc_point(self): fccanvas = fc.FloatCanvas(self.frame) - + obj = fc.Point((2, 2)) - + fccanvas.AddObject(obj) def test_lib_floatcanvas_fc_pointset(self): fccanvas = fc.FloatCanvas(self.frame) - + obj = fc.PointSet((2, 2)) - + fccanvas.AddObject(obj) def test_lib_floatcanvas_fc_polygon(self): fccanvas = fc.FloatCanvas(self.frame) - + obj = fc.Polygon((2, 2)) - + fccanvas.AddObject(obj) def test_lib_floatcanvas_fc_rectangle(self): fccanvas = fc.FloatCanvas(self.frame) - + obj = fc.Rectangle((2, 2), (2, 2)) - + fccanvas.AddObject(obj) def test_lib_floatcanvas_fc_recteclips(self): fccanvas = fc.FloatCanvas(self.frame) - + obj = fc.RectEllipse((2, 2), (2, 2)) - + fccanvas.AddObject(obj) def test_lib_floatcanvas_fc_scaledbitmap(self): fccanvas = fc.FloatCanvas(self.frame) - + bmp = wx.Bitmap(pngFile) obj = fc.ScaledBitmap(bmp, (2, 2), 100) - + fccanvas.AddObject(obj) def test_lib_floatcanvas_fc_scaledbitmap2(self): fccanvas = fc.FloatCanvas(self.frame) - + bmp = wx.Bitmap(pngFile) obj = fc.ScaledBitmap2(bmp, (2, 2), 100) - + fccanvas.AddObject(obj) def test_lib_floatcanvas_fc_scaledtext(self): fccanvas = fc.FloatCanvas(self.frame) - + obj = fc.ScaledText("some text", (2, 2), 100) - + fccanvas.AddObject(obj) def test_lib_floatcanvas_fc_scaledtextbox(self): fccanvas = fc.FloatCanvas(self.frame) - + obj = fc.ScaledTextBox("some text", (2, 2), 100) - + fccanvas.AddObject(obj) def test_lib_floatcanvas_fc_spline(self): fccanvas = fc.FloatCanvas(self.frame) - + obj = fc.Spline((2, 2)) - + fccanvas.AddObject(obj) def test_lib_floatcanvas_fc_squarepoint(self): fccanvas = fc.FloatCanvas(self.frame) - + obj = fc.SquarePoint((2, 2)) - + fccanvas.AddObject(obj) def test_lib_floatcanvas_fc_text(self): fccanvas = fc.FloatCanvas(self.frame) - + obj = fc.Text("some text", (2, 2)) - + fccanvas.AddObject(obj) def test_lib_floatcanvas_floatcanvasEvents(self): @@ -162,10 +162,10 @@ class lib_floatcanvas_floatcanvas_Tests(wtc.WidgetTestCase): fc.EVT_FC_RIGHT_DCLICK fc.EVT_FC_MOTION fc.EVT_FC_MOUSEWHEEL - + fc.EVT_FC_ENTER_OBJECT fc.EVT_FC_LEAVE_OBJECT - + #--------------------------------------------------------------------------- if __name__ == '__main__': diff --git a/unittests/test_lib_imagebrowser.py b/unittests/test_lib_imagebrowser.py index ad5a63c6..27e85b56 100644 --- a/unittests/test_lib_imagebrowser.py +++ b/unittests/test_lib_imagebrowser.py @@ -12,19 +12,19 @@ class imagebrowser_Tests(wtc.WidgetTestCase): # a typical use case dlg = ib.ImageDialog(self.frame, set_dir=os.getcwd()) dlg.Destroy() - + def test_imagebrowserDlgGetters(self): dlg = ib.ImageDialog(None) dlg.GetFile() dlg.GetDirectory() dlg.Destroy() - + def test_imagebrowserDlgChangeTypes(self): dlg = ib.ImageDialog(None) dlg.ChangeFileTypes((("GIF (*.gif)", "*.gif"), ("PNG (*.png)", "*.png"))) dlg.Destroy() - + #--------------------------------------------------------------------------- diff --git a/unittests/test_lib_imageutils.py b/unittests/test_lib_imageutils.py index 97da88c3..7174d8a1 100644 --- a/unittests/test_lib_imageutils.py +++ b/unittests/test_lib_imageutils.py @@ -8,14 +8,14 @@ import wx.lib.imageutils class lib_imageutils_Tests(wtc.WidgetTestCase): def test_lib_imageutils1(self): - + base = wx.Colour(100, 120, 140) white = wx.lib.imageutils.stepColour(base, 200) black = wx.lib.imageutils.stepColour(base, 0) self.assertEqual(white, wx.WHITE) self.assertEqual(black, wx.BLACK) - + #--------------------------------------------------------------------------- if __name__ == '__main__': diff --git a/unittests/test_lib_intctrl.py b/unittests/test_lib_intctrl.py index 6d288d7e..027101a6 100644 --- a/unittests/test_lib_intctrl.py +++ b/unittests/test_lib_intctrl.py @@ -15,7 +15,7 @@ class IntCtrlTests(wtc.WidgetTestCase): t3.ChangeValue(16) self.assertTrue(not t3.IsInBounds()) - + #--------------------------------------------------------------------------- diff --git a/unittests/test_lib_langlistctrl.py b/unittests/test_lib_langlistctrl.py index 2fbb17dc..fb0d408f 100644 --- a/unittests/test_lib_langlistctrl.py +++ b/unittests/test_lib_langlistctrl.py @@ -8,12 +8,12 @@ import wx.lib.langlistctrl as lc class langlistctrl_Tests(wtc.WidgetTestCase): def test_langlistctrlCtor(self): - theList = lc.LanguageListCtrl(self.frame, filter=lc.LC_ONLY, - only=(wx.LANGUAGE_ENGLISH, - wx.LANGUAGE_FRENCH), + theList = lc.LanguageListCtrl(self.frame, filter=lc.LC_ONLY, + only=(wx.LANGUAGE_ENGLISH, + wx.LANGUAGE_FRENCH), select=wx.LANGUAGE_ENGLISH) - + #--------------------------------------------------------------------------- diff --git a/unittests/test_lib_masked.py b/unittests/test_lib_masked.py index 7f960f8d..b577141f 100644 --- a/unittests/test_lib_masked.py +++ b/unittests/test_lib_masked.py @@ -6,20 +6,20 @@ import wx.lib.masked as m #--------------------------------------------------------------------------- class MaskedComboBoxTests(wtc.WidgetTestCase): - + def test_ComboBoxCtors(self): c = m.ComboBox(self.frame, value='value', choices="one two three four".split()) - c = m.ComboBox(self.frame, -1, 'value', wx.Point(10,10), wx.Size(80,-1), + c = m.ComboBox(self.frame, -1, 'value', wx.Point(10,10), wx.Size(80,-1), "one two three four".split(), 0) c = m.ComboBox(self.frame, -1, "", (10,10), (80,-1), "one two three four".split(), 0) - + self.assertTrue(c.GetCount() == 4) - + #def test_ComboBoxDefaultCtor(self): #c = m.PreMaskedComboBox(self.frame) #c.Create(self.frame, value="value", choices="one two three four".split()) - - + + #--------------------------------------------------------------------------- class MaskedTextCtrlTests(wtc.WidgetTestCase): @@ -35,11 +35,11 @@ class MaskedTextCtrlTests(wtc.WidgetTestCase): #def test_textctrlDefaultCtor(self): #t = m.TextCtrl() #t.Create(self.frame) - - + + def test_textctrlProperties(self): t = m.TextCtrl(self.frame) - + t.DefaultStyle t.NumberOfLines t.Hint @@ -49,7 +49,7 @@ class MaskedTextCtrlTests(wtc.WidgetTestCase): t.StringSelection t.Value - + #--------------------------------------------------------------------------- @@ -65,11 +65,11 @@ class MaskedNumCtrlTests(wtc.WidgetTestCase): #def test_numctrlDefaultCtor(self): #t = m.TextCtrl() #t.Create(self.frame) - - + + def test_numctrlProperties(self): t = m.NumCtrl(self.frame) - + t.DefaultStyle t.NumberOfLines t.Hint @@ -79,7 +79,7 @@ class MaskedNumCtrlTests(wtc.WidgetTestCase): t.StringSelection t.Value - + #--------------------------------------------------------------------------- @@ -94,7 +94,7 @@ class MaskedTimeCtrlTests(wtc.WidgetTestCase): #def test_numctrlDefaultCtor(self): #t = m.TextCtrl() #t.Create(self.frame) - + def test_timectrlIsValid(self): t = m.TimeCtrl(self.frame, -1, "18:25:18") @@ -108,7 +108,7 @@ class MaskedTimeCtrlTests(wtc.WidgetTestCase): def test_timectrlProperties(self): t = m.TimeCtrl(self.frame) - + t.DefaultStyle t.NumberOfLines t.Hint @@ -118,7 +118,7 @@ class MaskedTimeCtrlTests(wtc.WidgetTestCase): t.StringSelection t.Value - + #--------------------------------------------------------------------------- class MaskedIpAddrCtrlTests(wtc.WidgetTestCase): @@ -132,11 +132,11 @@ class MaskedIpAddrCtrlTests(wtc.WidgetTestCase): #def test_ipaddrctrlDefaultCtor(self): #t = m.IpAddrCtrl() #t.Create(self.frame) - - + + def test_ipaddrctrlProperties(self): t = m.IpAddrCtrl(self.frame) - + t.DefaultStyle t.NumberOfLines t.Hint @@ -146,7 +146,7 @@ class MaskedIpAddrCtrlTests(wtc.WidgetTestCase): t.StringSelection t.Value - + #--------------------------------------------------------------------------- diff --git a/unittests/test_lib_mixins_inspection.py b/unittests/test_lib_mixins_inspection.py index f2965d4f..fea951e5 100644 --- a/unittests/test_lib_mixins_inspection.py +++ b/unittests/test_lib_mixins_inspection.py @@ -5,10 +5,10 @@ import wx.lib.mixins.inspection as wit #--------------------------------------------------------------------------- class wit_TestCase(unittest.TestCase): - + def test_App(self): app = wit.InspectableApp() - + def test_App_OnInit(self): class MyApp(wit.InspectableApp): def OnInit(self): @@ -29,8 +29,8 @@ class wit_TestCase(unittest.TestCase): self.assertTrue(app.onInit_called) - - + + #--------------------------------------------------------------------------- diff --git a/unittests/test_lib_pdfviewer_pdfviewer.py b/unittests/test_lib_pdfviewer_pdfviewer.py index 710efa1d..f1a5d009 100644 --- a/unittests/test_lib_pdfviewer_pdfviewer.py +++ b/unittests/test_lib_pdfviewer_pdfviewer.py @@ -8,7 +8,7 @@ try: from wx.lib.pdfviewer import pdfViewer, pdfButtonPanel havePyPDF = True except ImportError: - havePyPDF = False # Assume neither PyMuPDF nor PyPDF2 found + havePyPDF = False # Assume neither PyMuPDF nor PyPDF2 found dataDir = os.path.join(os.path.dirname(__file__), "data") samplePdf = os.path.join(dataDir, "sample.pdf") diff --git a/unittests/test_lib_pubsub_defaultlog.py b/unittests/test_lib_pubsub_defaultlog.py index d039614e..6d952568 100644 --- a/unittests/test_lib_pubsub_defaultlog.py +++ b/unittests/test_lib_pubsub_defaultlog.py @@ -16,7 +16,7 @@ from six import StringIO class lib_pubsub_DefaultLog(wtc.PubsubTestCase): - + def testNotifications(self): capture = StringIO() logger = notification.useNotifyByWriteFile(capture) @@ -25,11 +25,10 @@ class lib_pubsub_DefaultLog(wtc.PubsubTestCase): self.pub.subscribe(listener, 'testNotifications') block() - + #--------------------------------------------------------------------------- if __name__ == '__main__': unittest.main() - - \ No newline at end of file + diff --git a/unittests/test_lib_pubsub_notify2.py b/unittests/test_lib_pubsub_notify2.py index b131217b..58f3a811 100644 --- a/unittests/test_lib_pubsub_notify2.py +++ b/unittests/test_lib_pubsub_notify2.py @@ -15,8 +15,8 @@ from unittests import wtc #--------------------------------------------------------------------------- -class lib_pubsub_Notify2(wtc.PubsubTestCase): - +class lib_pubsub_Notify2(wtc.PubsubTestCase): + def test0_NotificationTopics(self): from wx.lib.pubsub.utils.notification import useNotifyByPubsubMessage topicMgr = self.pub.getDefaultTopicMgr() @@ -24,9 +24,9 @@ class lib_pubsub_Notify2(wtc.PubsubTestCase): assert not topicMgr.getTopic('pubsub', okIfNone=True) useNotifyByPubsubMessage() assert topicMgr.getTopic('pubsub') - + assert topicMgr.getTopic('pubsub').hasSubtopic() - + pubsubTopicNames = [obj.getName() for obj in topicMgr.getTopic('pubsub').getSubtopics()] self.assertEqual( set( pubsubTopicNames ), @@ -34,7 +34,7 @@ class lib_pubsub_Notify2(wtc.PubsubTestCase): 'pubsub.subscribe', 'pubsub.unsubscribe', 'pubsub.newTopic', 'pubsub.delTopic']) ) - + #--------------------------------------------------------------------------- diff --git a/unittests/test_lib_pubsub_notify3.py b/unittests/test_lib_pubsub_notify3.py index a6549955..2077f0cb 100644 --- a/unittests/test_lib_pubsub_notify3.py +++ b/unittests/test_lib_pubsub_notify3.py @@ -14,12 +14,12 @@ from difflib import ndiff, unified_diff, context_diff #--------------------------------------------------------------------------- - + class lib_pubsub_NotifyFlagChanges(wtc.PubsubTestCase): def testFlagChanges(self): savedFlags = self.pub.getNotificationFlags() - + self.pub.setNotificationFlags(all=True, sendMessage=False, deadListener=False) flags = self.pub.getNotificationFlags() assert not flags['sendMessage'] @@ -28,7 +28,7 @@ class lib_pubsub_NotifyFlagChanges(wtc.PubsubTestCase): assert flags['delTopic'] assert flags['subscribe'] assert flags['unsubscribe'] - + self.pub.setNotificationFlags(subscribe=False, deadListener=True) flags = self.pub.getNotificationFlags() assert not flags['sendMessage'] @@ -37,7 +37,7 @@ class lib_pubsub_NotifyFlagChanges(wtc.PubsubTestCase): assert flags['delTopic'] assert flags['deadListener'] assert flags['unsubscribe'] - + self.pub.setNotificationFlags(all=False, subscribe=True, unsubscribe=True) flags = self.pub.getNotificationFlags() assert not flags['sendMessage'] @@ -46,10 +46,10 @@ class lib_pubsub_NotifyFlagChanges(wtc.PubsubTestCase): assert not flags['delTopic'] assert flags['subscribe'] assert flags['unsubscribe'] - + self.pub.setNotificationFlags(** savedFlags) - - + + #--------------------------------------------------------------------------- diff --git a/unittests/test_lib_resizewidget.py b/unittests/test_lib_resizewidget.py index 1734c8d4..f65f555e 100644 --- a/unittests/test_lib_resizewidget.py +++ b/unittests/test_lib_resizewidget.py @@ -9,17 +9,17 @@ class lib_resizewidget_Tests(wtc.WidgetTestCase): def test_lib_resizewidget(self): rw1 = RW.ResizeWidget(self.frame) - + def test_lib_resizewidget_Constants(self): RW.RW_FILL RW.RW_FILL2 RW.RW_LENGTH RW.RW_PEN RW.RW_THICKNESS - + RW.EVT_RW_LAYOUT_NEEDED - - + + #--------------------------------------------------------------------------- if __name__ == '__main__': diff --git a/unittests/test_lib_scrolledpanel.py b/unittests/test_lib_scrolledpanel.py index 2d206035..acdab8d7 100644 --- a/unittests/test_lib_scrolledpanel.py +++ b/unittests/test_lib_scrolledpanel.py @@ -18,15 +18,15 @@ class lib_scrolledpanel_Tests(wtc.WidgetTestCase): pnl.SetSizer(vbox) - pnl.SetupScrolling(scroll_x=True, scroll_y=False) + pnl.SetupScrolling(scroll_x=True, scroll_y=False) self.assertEqual(pnl.GetScrollPixelsPerUnit(), (20, 0)) - - pnl.SetupScrolling(scroll_x=False, scroll_y=True) + + pnl.SetupScrolling(scroll_x=False, scroll_y=True) self.assertEqual(pnl.GetScrollPixelsPerUnit(), (0, 20)) - pnl.SetupScrolling(scroll_x=True, scroll_y=True, rate_x=10, rate_y=50) + pnl.SetupScrolling(scroll_x=True, scroll_y=True, rate_x=10, rate_y=50) self.assertEqual(pnl.GetScrollPixelsPerUnit(), (10, 50)) - + #--------------------------------------------------------------------------- if __name__ == '__main__': diff --git a/unittests/test_lib_sized_controls.py b/unittests/test_lib_sized_controls.py index 3f488132..1131ee98 100644 --- a/unittests/test_lib_sized_controls.py +++ b/unittests/test_lib_sized_controls.py @@ -10,12 +10,12 @@ import wx.lib.sized_controls as sc class sizedFrame_Tests(wtc.WidgetTestCase): def test_frameStyles(self): - wx.FRAME_NO_TASKBAR - wx.FRAME_TOOL_WINDOW + wx.FRAME_NO_TASKBAR + wx.FRAME_TOOL_WINDOW wx.FRAME_FLOAT_ON_PARENT wx.FRAME_SHAPED - - + + def test_frameCtors(self): f = sc.SizedFrame(None) f.Show() @@ -36,8 +36,8 @@ class sizedFrame_Tests(wtc.WidgetTestCase): # f.Show() # f.MacGetTopLevelWindowRef() # f.Close() - - + + def test_frameProperties(self): f = sc.SizedFrame(None) f.Show() @@ -48,7 +48,7 @@ class sizedFrame_Tests(wtc.WidgetTestCase): f.TmpDefaultItem f.OSXModified f.MacMetalAppearance - + f.Close() @@ -58,7 +58,7 @@ class sizedFrame_Tests(wtc.WidgetTestCase): class sizedDialog_Tests(wtc.WidgetTestCase): def runDialog(self, dlg): - # Add some buttons + # Add some buttons ok = wx.Button(dlg.GetContentsPane(), wx.ID_OK, pos=(10,10)) cancel = wx.Button(dlg.GetContentsPane(), wx.ID_CANCEL, pos=(100,10)) @@ -70,14 +70,14 @@ class sizedDialog_Tests(wtc.WidgetTestCase): val = dlg.ShowModal() dlg.Destroy() self.assertTrue(val == wx.ID_OK) - self.myYield() - - + self.myYield() + + #def test_dialogDefaultCtor(self): # dlg = sc.SizedDialog() # dlg.Create(None, title='dialog') # self.runDialog(dlg) - + def test_dialog1(self): # with parent dlg = sc.SizedDialog(self.frame, title='Hello') @@ -87,15 +87,15 @@ class sizedDialog_Tests(wtc.WidgetTestCase): # without parent dlg = sc.SizedDialog(None, title='World') self.runDialog(dlg) - + def test_dialogTextSizer(self): dlg = sc.SizedDialog(self.frame, title='Hello') s = dlg.CreateTextSizer("This is a test.\nThis is only a test.\nHello World") self.assertTrue(isinstance(s, wx.Sizer)) self.assertTrue(len(s.Children) == 3) self.runDialog(dlg) - - + + #--------------------------------------------------------------------------- @@ -107,8 +107,8 @@ class sizedPanel_Tests(wtc.WidgetTestCase): #def test_panelDefaultCtor(self): # p = sc.SizedPanel() # p.Create(self.frame) - - + + #--------------------------------------------------------------------------- @@ -120,8 +120,8 @@ class sizedScrolledPanel_Tests(wtc.WidgetTestCase): #def test_panelDefaultCtor(self): # p = sc.SizedScrolledPanel() # p.Create(self.frame) - - + + #--------------------------------------------------------------------------- if __name__ == '__main__': diff --git a/unittests/test_lib_splitter.py b/unittests/test_lib_splitter.py index 2e4d4664..088e8d07 100644 --- a/unittests/test_lib_splitter.py +++ b/unittests/test_lib_splitter.py @@ -9,7 +9,7 @@ class splitter_Tests(wtc.WidgetTestCase): def test_splitterCtor(self): splitter = sp.MultiSplitterWindow(self.frame, style=wx.SP_LIVE_UPDATE) - + def test_splitterMulti(self): splitter = sp.MultiSplitterWindow(self.frame, style=wx.SP_LIVE_UPDATE) @@ -21,10 +21,10 @@ class splitter_Tests(wtc.WidgetTestCase): p = wx.Panel(self.frame) splitter.AppendWindow(p, 180) - + splitter.SetOrientation(wx.VERTICAL) self.assertEqual(splitter.GetOrientation(), wx.VERTICAL) - + splitter.SetOrientation(wx.HORIZONTAL) self.assertEqual(splitter.GetOrientation(), wx.HORIZONTAL) diff --git a/unittests/test_lib_statbmp.py b/unittests/test_lib_statbmp.py index 81b6851e..810b59c6 100644 --- a/unittests/test_lib_statbmp.py +++ b/unittests/test_lib_statbmp.py @@ -12,14 +12,14 @@ class lib_statbmp_Tests(wtc.WidgetTestCase): bmp = wx.ArtProvider.GetBitmap(wx.ART_INFORMATION, wx.ART_OTHER, (32, 32)) w = wx.lib.statbmp.GenStaticBitmap(pnl, -1, bitmap=bmp, pos=(10,10)) bs1 = w.GetEffectiveMinSize() - + bmp2 = wx.ArtProvider.GetBitmap(wx.ART_INFORMATION, wx.ART_OTHER, (64, 64)) w.SetBitmap(bmp2) bs2 = w.GetEffectiveMinSize() - + self.assertEqual(w.GetBitmap(), bmp2) self.assertTrue(bs2.height > bs1.height) - + #--------------------------------------------------------------------------- if __name__ == '__main__': diff --git a/unittests/test_lib_stattext.py b/unittests/test_lib_stattext.py index fa74fa47..0a4f892f 100644 --- a/unittests/test_lib_stattext.py +++ b/unittests/test_lib_stattext.py @@ -11,15 +11,15 @@ class lib_stattext_Tests(wtc.WidgetTestCase): pnl = wx.Panel(self.frame) w = wx.lib.stattext.GenStaticText(pnl, label="This is a test", pos=(10,10)) bs1 = w.GetEffectiveMinSize() - + w.SetLabel("This is a New Label") w.SetFont(wx.FFont(16, wx.FONTFAMILY_ROMAN)) bs2 = w.GetEffectiveMinSize() - + self.assertEqual(w.GetLabel(), "This is a New Label") self.assertEqual(w.Label, "This is a New Label") self.assertTrue(bs2.height > bs1.height) - + #--------------------------------------------------------------------------- if __name__ == '__main__': diff --git a/unittests/test_lib_throbber.py b/unittests/test_lib_throbber.py index 1b673b6c..256c4909 100644 --- a/unittests/test_lib_throbber.py +++ b/unittests/test_lib_throbber.py @@ -16,11 +16,11 @@ class lib_throbber_Tests(wtc.WidgetTestCase): for i in throbImages.index if i not in ['eclouds', 'logo']] w = th.Throbber(pnl, -1, images, size=(36, 36)) - + def test_lib_throbber_Events(self): th.EVT_UPDATE_THROBBER - - + + #--------------------------------------------------------------------------- if __name__ == '__main__': diff --git a/unittests/test_lib_ticker.py b/unittests/test_lib_ticker.py index 69243b6a..b2498245 100644 --- a/unittests/test_lib_ticker.py +++ b/unittests/test_lib_ticker.py @@ -8,12 +8,12 @@ class lib_ticker_Tests(wtc.WidgetTestCase): def test_lib_ticker(self): self.ticker = Ticker(self.frame) - + txt = 'a nice ticker text' self.ticker.SetText(txt) self.assertEqual(self.ticker.GetText(), txt) - - + + #--------------------------------------------------------------------------- if __name__ == '__main__': diff --git a/unittests/test_listbook.py b/unittests/test_listbook.py index 413daaeb..95a7143e 100644 --- a/unittests/test_listbook.py +++ b/unittests/test_listbook.py @@ -7,29 +7,29 @@ import wx class listbook_Tests(wtc.WidgetTestCase): def test_listbook1(self): - wx.LB_DEFAULT - wx.LB_TOP - wx.LB_BOTTOM - wx.LB_LEFT - wx.LB_RIGHT + wx.LB_DEFAULT + wx.LB_TOP + wx.LB_BOTTOM + wx.LB_LEFT + wx.LB_RIGHT wx.LB_ALIGN_MASK wx.wxEVT_COMMAND_LISTBOOK_PAGE_CHANGED wx.wxEVT_COMMAND_LISTBOOK_PAGE_CHANGING wx.EVT_LISTBOOK_PAGE_CHANGED wx.EVT_LISTBOOK_PAGE_CHANGING - + def test_listbook2(self): book = wx.Listbook() book.Create(self.frame) - - + + def test_listbook3(self): book = wx.Listbook(self.frame) book.AddPage(wx.Panel(book), 'one') book.AddPage(wx.Panel(book), 'two') - + #--------------------------------------------------------------------------- if __name__ == '__main__': diff --git a/unittests/test_listbox.py b/unittests/test_listbox.py index d8d160b4..9d6be9c9 100644 --- a/unittests/test_listbox.py +++ b/unittests/test_listbox.py @@ -5,22 +5,22 @@ import wx #--------------------------------------------------------------------------- class listbox_Tests(wtc.WidgetTestCase): - + def test_ComboBoxCtors(self): c = wx.ListBox(self.frame, choices="one two three four".split()) - c = wx.ListBox(self.frame, -1, wx.Point(10,10), wx.Size(80,-1), + c = wx.ListBox(self.frame, -1, wx.Point(10,10), wx.Size(80,-1), "one two three four".split(), 0) c = wx.ListBox(self.frame, -1, (10,10), (80,-1), "one two three four".split(), 0) - + self.assertTrue(c.GetCount() == 4) - - + + def test_ComboBoxDefaultCtor(self): c = wx.ListBox() c.Create(self.frame, choices="one two three four".split()) - - + + #--------------------------------------------------------------------------- diff --git a/unittests/test_listctrl.py b/unittests/test_listctrl.py index 172df2be..f327259f 100644 --- a/unittests/test_listctrl.py +++ b/unittests/test_listctrl.py @@ -36,27 +36,27 @@ class listctrl_Tests(wtc.WidgetTestCase): wx.wxEVT_COMMAND_LIST_COL_DRAGGING wx.wxEVT_COMMAND_LIST_COL_END_DRAG wx.wxEVT_COMMAND_LIST_ITEM_FOCUSED - - wx.EVT_LIST_BEGIN_DRAG - wx.EVT_LIST_BEGIN_RDRAG - wx.EVT_LIST_BEGIN_LABEL_EDIT - wx.EVT_LIST_END_LABEL_EDIT - wx.EVT_LIST_DELETE_ITEM - wx.EVT_LIST_DELETE_ALL_ITEMS - wx.EVT_LIST_ITEM_SELECTED - wx.EVT_LIST_ITEM_DESELECTED - wx.EVT_LIST_KEY_DOWN - wx.EVT_LIST_INSERT_ITEM - wx.EVT_LIST_COL_CLICK - wx.EVT_LIST_ITEM_RIGHT_CLICK - wx.EVT_LIST_ITEM_MIDDLE_CLICK - wx.EVT_LIST_ITEM_ACTIVATED - wx.EVT_LIST_CACHE_HINT - wx.EVT_LIST_COL_RIGHT_CLICK - wx.EVT_LIST_COL_BEGIN_DRAG - wx.EVT_LIST_COL_DRAGGING - wx.EVT_LIST_COL_END_DRAG - wx.EVT_LIST_ITEM_FOCUSED + + wx.EVT_LIST_BEGIN_DRAG + wx.EVT_LIST_BEGIN_RDRAG + wx.EVT_LIST_BEGIN_LABEL_EDIT + wx.EVT_LIST_END_LABEL_EDIT + wx.EVT_LIST_DELETE_ITEM + wx.EVT_LIST_DELETE_ALL_ITEMS + wx.EVT_LIST_ITEM_SELECTED + wx.EVT_LIST_ITEM_DESELECTED + wx.EVT_LIST_KEY_DOWN + wx.EVT_LIST_INSERT_ITEM + wx.EVT_LIST_COL_CLICK + wx.EVT_LIST_ITEM_RIGHT_CLICK + wx.EVT_LIST_ITEM_MIDDLE_CLICK + wx.EVT_LIST_ITEM_ACTIVATED + wx.EVT_LIST_CACHE_HINT + wx.EVT_LIST_COL_RIGHT_CLICK + wx.EVT_LIST_COL_BEGIN_DRAG + wx.EVT_LIST_COL_DRAGGING + wx.EVT_LIST_COL_END_DRAG + wx.EVT_LIST_ITEM_FOCUSED def test_listctrlEvent(self): @@ -90,12 +90,12 @@ class listctrl_Tests(wtc.WidgetTestCase): def test_listctrlConstants(self): wx.LC_VRULES wx.LC_HRULES - + wx.LC_ICON wx.LC_SMALL_ICON wx.LC_LIST wx.LC_REPORT - + wx.LC_ALIGN_TOP wx.LC_ALIGN_LEFT wx.LC_AUTOARRANGE @@ -106,7 +106,7 @@ class listctrl_Tests(wtc.WidgetTestCase): wx.LC_SINGLE_SEL wx.LC_SORT_ASCENDING wx.LC_SORT_DESCENDING - + wx.LC_MASK_TYPE wx.LC_MASK_ALIGN wx.LC_MASK_SORT @@ -118,7 +118,7 @@ class listctrl_Tests(wtc.WidgetTestCase): wx.LIST_SET_ITEM wx.LIST_MASK_WIDTH wx.LIST_MASK_FORMAT - + wx.LIST_STATE_DONTCARE wx.LIST_STATE_DROPHILITED wx.LIST_STATE_FOCUSED @@ -129,7 +129,7 @@ class listctrl_Tests(wtc.WidgetTestCase): wx.LIST_STATE_INUSE wx.LIST_STATE_PICKED wx.LIST_STATE_SOURCE - + wx.LIST_HITTEST_ABOVE wx.LIST_HITTEST_BELOW wx.LIST_HITTEST_NOWHERE @@ -140,14 +140,14 @@ class listctrl_Tests(wtc.WidgetTestCase): wx.LIST_HITTEST_TOLEFT wx.LIST_HITTEST_TORIGHT wx.LIST_HITTEST_ONITEM - + wx.LIST_GETSUBITEMRECT_WHOLEITEM - wx.LIST_NEXT_ABOVE - wx.LIST_NEXT_ALL - wx.LIST_NEXT_BELOW - wx.LIST_NEXT_LEFT - wx.LIST_NEXT_RIGHT + wx.LIST_NEXT_ABOVE + wx.LIST_NEXT_ALL + wx.LIST_NEXT_BELOW + wx.LIST_NEXT_LEFT + wx.LIST_NEXT_RIGHT wx.LIST_ALIGN_DEFAULT wx.LIST_ALIGN_LEFT @@ -157,7 +157,7 @@ class listctrl_Tests(wtc.WidgetTestCase): wx.LIST_FORMAT_LEFT wx.LIST_FORMAT_RIGHT wx.LIST_FORMAT_CENTRE - wx.LIST_FORMAT_CENTER + wx.LIST_FORMAT_CENTER wx.LIST_AUTOSIZE wx.LIST_AUTOSIZE_USEHEADER @@ -170,11 +170,11 @@ class listctrl_Tests(wtc.WidgetTestCase): wx.LIST_FIND_DOWN wx.LIST_FIND_LEFT wx.LIST_FIND_RIGHT - - - + + + #--------------------------------------------------------------------------- diff --git a/unittests/test_log.py b/unittests/test_log.py index a9c55d16..60591dcb 100644 --- a/unittests/test_log.py +++ b/unittests/test_log.py @@ -5,7 +5,7 @@ import wx #--------------------------------------------------------------------------- class log_Tests(wtc.WidgetTestCase): - + def test_log(self): class MyLog(wx.Log): @@ -13,16 +13,16 @@ class log_Tests(wtc.WidgetTestCase): wx.Log.__init__(self) self.messageLogged = False self.messages = list() - + def DoLogText(self, message): self.messageLogged = True self.messages.append(message) - + log = MyLog() old = wx.Log.SetActiveTarget(log) wx.LogMessage("This is a test") self.assertTrue(log.messageLogged) - + #--------------------------------------------------------------------------- diff --git a/unittests/test_longlong.py b/unittests/test_longlong.py index 05054d7d..cb953855 100644 --- a/unittests/test_longlong.py +++ b/unittests/test_longlong.py @@ -8,19 +8,19 @@ class longlong_Tests(unittest.TestCase): def test_longlong(self): val1 = 2**50 # make a big value - + # setting the timespan's seconds property will use the mapped type # code to convert to a wxLongLong... ts = wx.TimeSpan(hours=0, min=0, sec=val1) - + # ...and fetching it from the timespan will use the mapped type to # convert back from a wxLongLong to a Python object... val2 = ts.GetSeconds() - + # ...which we can compare with the original. self.assertTrue(val1 == val2) - - + + #--------------------------------------------------------------------------- diff --git a/unittests/test_mdi.py b/unittests/test_mdi.py index cc9a558a..81ff6a32 100644 --- a/unittests/test_mdi.py +++ b/unittests/test_mdi.py @@ -9,7 +9,7 @@ class mdi_Tests(wtc.WidgetTestCase): def test_mdiParentFrame1(self): f = wx.MDIParentFrame(None, title="MDI Parent") f.Close() - + def test_mdiParentFrame2(self): f = wx.MDIParentFrame() f.Create(None, title="MDI Parent") @@ -20,14 +20,14 @@ class mdi_Tests(wtc.WidgetTestCase): cw = f.GetClientWindow() self.assertTrue(isinstance(cw, wx.MDIClientWindow)) f.Close() - - + + def test_mdiChildFrame1(self): f = wx.MDIParentFrame(None, title="MDI Parent") f.SetMenuBar(wx.MenuBar()) c = wx.MDIChildFrame(f, title="MDI Child") f.Close() - + def test_mdiChildFrame2(self): f = wx.MDIParentFrame(None, title="MDI Parent") f.SetMenuBar(wx.MenuBar()) diff --git a/unittests/test_mediactrl.py b/unittests/test_mediactrl.py index bfab2c6d..67dc7803 100644 --- a/unittests/test_mediactrl.py +++ b/unittests/test_mediactrl.py @@ -11,26 +11,26 @@ class mediactrl_Tests(wtc.WidgetTestCase): wx.media.MEDIASTATE_STOPPED wx.media.MEDIASTATE_PAUSED wx.media.MEDIASTATE_PLAYING - wx.media.MEDIACTRLPLAYERCONTROLS_NONE - wx.media.MEDIACTRLPLAYERCONTROLS_STEP + wx.media.MEDIACTRLPLAYERCONTROLS_NONE + wx.media.MEDIACTRLPLAYERCONTROLS_STEP wx.media.MEDIACTRLPLAYERCONTROLS_VOLUME - wx.media.MEDIACTRLPLAYERCONTROLS_DEFAULT - + wx.media.MEDIACTRLPLAYERCONTROLS_DEFAULT + wx.media.MEDIABACKEND_DIRECTSHOW - wx.media.MEDIABACKEND_MCI - wx.media.MEDIABACKEND_QUICKTIME - wx.media.MEDIABACKEND_GSTREAMER + wx.media.MEDIABACKEND_MCI + wx.media.MEDIABACKEND_QUICKTIME + wx.media.MEDIABACKEND_GSTREAMER wx.media.MEDIABACKEND_REALPLAYER - wx.media.MEDIABACKEND_WMP10 - + wx.media.MEDIABACKEND_WMP10 + def test_mediactrl2(self): mc = wx.media.MediaCtrl() mc.Create(self.frame) - + def test_mediactrl3(self): mc = wx.media.MediaCtrl(self.frame) - - + + def test_mediactrl4(self): evt = wx.media.MediaEvent() @@ -42,14 +42,14 @@ class mediactrl_Tests(wtc.WidgetTestCase): wx.media.wxEVT_MEDIA_STATECHANGED wx.media.wxEVT_MEDIA_PLAY wx.media.wxEVT_MEDIA_PAUSE - + wx.media.EVT_MEDIA_LOADED wx.media.EVT_MEDIA_STOP wx.media.EVT_MEDIA_FINISHED wx.media.EVT_MEDIA_STATECHANGED wx.media.EVT_MEDIA_PLAY wx.media.EVT_MEDIA_PAUSE - + #--------------------------------------------------------------------------- if __name__ == '__main__': diff --git a/unittests/test_menu.py b/unittests/test_menu.py index 55d1bf01..bacc326a 100644 --- a/unittests/test_menu.py +++ b/unittests/test_menu.py @@ -14,7 +14,7 @@ class menu_Tests(wtc.WidgetTestCase): for label in "one two three four".split(): m.Append(-1, label) return m - + def makeMenuWithSubmenu(self): m = self.makeMenu() m.AppendSeparator() @@ -22,18 +22,18 @@ class menu_Tests(wtc.WidgetTestCase): m.Append(-1, 'submenu', m2) return m - + def test_menu1(self): m = self.makeMenu() items = m.GetMenuItems() self.assertTrue(len(items) == 4) self.assertTrue(isinstance(items[0], wx.MenuItem)) - + def test_menu2(self): m = self.makeMenuWithSubmenu() items = m.GetMenuItems() self.assertTrue(len(items) == 6) - + def test_menu3(self): m = self.makeMenuWithSubmenu() items = [] @@ -69,20 +69,20 @@ class menu_Tests(wtc.WidgetTestCase): mb.Append(m, label) menu = m item = menu.FindItemByPosition(0) - + i, m = mb.FindItem(item.GetId()) self.assertTrue(i is item) self.assertTrue(m is menu) i = mb.FindItemById(item.GetId()) self.assertTrue(i is item) - + i, m = menu.FindItem(item.GetId()) self.assertTrue(i is item) self.assertTrue(m is menu) i = menu.FindItemById(item.GetId()) self.assertTrue(i is item) - - + + #--------------------------------------------------------------------------- diff --git a/unittests/test_menuitem.py b/unittests/test_menuitem.py index 1d321257..1fefef50 100644 --- a/unittests/test_menuitem.py +++ b/unittests/test_menuitem.py @@ -13,8 +13,8 @@ class menuitem_Tests(wtc.WidgetTestCase): m1 = wx.MenuItem() m2 = wx.MenuItem(None, -1, "Menu Item", "Help text", wx.ITEM_NORMAL) m2.SetBitmap(wx.Bitmap(pngFile)) - - + + def test_menuitemProperties(self): m = wx.MenuItem() m.BackgroundColour @@ -32,15 +32,15 @@ class menuitem_Tests(wtc.WidgetTestCase): m.SubMenu m.Text m.TextColour - - + + def test_menuitemKinds(self): wx.ITEM_CHECK wx.ITEM_DROPDOWN wx.ITEM_NORMAL wx.ITEM_RADIO wx.ITEM_SEPARATOR - + #--------------------------------------------------------------------------- diff --git a/unittests/test_mimetype.py b/unittests/test_mimetype.py index 05cd14a2..c5703073 100644 --- a/unittests/test_mimetype.py +++ b/unittests/test_mimetype.py @@ -13,25 +13,25 @@ class mimetype_Tests(wtc.WidgetTestCase): ft.GetMimeType() ft.GetIcon() - def test_mimetype2(self): + def test_mimetype2(self): ft = wx.TheMimeTypesManager.GetFileTypeFromMimeType('image/png') if ft: ft.GetExtensions() ft.GetMimeType() ft.GetIcon() - def test_mimetype3(self): + def test_mimetype3(self): fti = wx.FileTypeInfo('mime', 'open', 'print', 'desc', 'ext1') fti.AddExtension('ext2') - fti.AddExtension('ext3') + fti.AddExtension('ext3') self.assertEqual(fti.GetMimeType(), 'mime') self.assertEqual(fti.GetOpenCommand(), 'open') self.assertEqual(fti.GetPrintCommand(), 'print') self.assertEqual(fti.GetDescription(), 'desc') self.assertEqual(fti.GetExtensions(), ['ext1', 'ext2', 'ext3']) self.assertEqual(fti.GetExtensionsCount(), 3) - - def test_mimetype4(self): + + def test_mimetype4(self): fti = wx.FileTypeInfo(['mime', 'open', 'print', 'desc', 'ext1', 'ext2', 'ext3']) self.assertEqual(fti.GetMimeType(), 'mime') self.assertEqual(fti.GetOpenCommand(), 'open') @@ -48,8 +48,8 @@ class mimetype_Tests(wtc.WidgetTestCase): self.assertTrue(isinstance(info, tuple)) self.assertTrue(len(info) == 3) self.assertTrue(isinstance(info[0], wx.Icon)) - - + + #--------------------------------------------------------------------------- if __name__ == '__main__': diff --git a/unittests/test_minifram.py b/unittests/test_minifram.py index d960ec08..b2666bb5 100644 --- a/unittests/test_minifram.py +++ b/unittests/test_minifram.py @@ -10,11 +10,11 @@ class minifram_Tests(wtc.WidgetTestCase): f = wx.MiniFrame() f.Create(self.frame, title="Hello") f.Show() - + def test_minifram2(self): f = wx.MiniFrame(self.frame, title="Hello") f.Show() - + #--------------------------------------------------------------------------- if __name__ == '__main__': diff --git a/unittests/test_modalhook.py b/unittests/test_modalhook.py index 583e8b93..466071f3 100644 --- a/unittests/test_modalhook.py +++ b/unittests/test_modalhook.py @@ -11,23 +11,23 @@ class modalhook_Tests(wtc.WidgetTestCase): def __init__(self): wx.ModalDialogHook.__init__(self) self.counter = 0 - + def Enter(self, dialog): self.counter += 1 return wx.ID_OK - + def Exit(self, dialog): self.counter += 1 # not called because Enter didn't return wx.ID_NONE - + myHook = MyModalDialogHook() myHook.Register() - + wx.MessageBox("This should be auto-dismissed...", style=wx.OK|wx.CANCEL) self.assertEqual(myHook.counter, 1) - + myHook.Unregister() - - + + #--------------------------------------------------------------------------- if __name__ == '__main__': diff --git a/unittests/test_mousemanager.py b/unittests/test_mousemanager.py index 40412dd4..2d77feb6 100644 --- a/unittests/test_mousemanager.py +++ b/unittests/test_mousemanager.py @@ -4,7 +4,7 @@ import wx import sys # Is it just this module or the whole test suite being run? -runningStandalone = False +runningStandalone = False #--------------------------------------------------------------------------- @@ -30,24 +30,24 @@ class mousemanager_Tests(wtc.WidgetTestCase): pass def MouseClickCancelled(self, item): pass - + pnl = wx.Panel(self.frame) self.frame.SendSizeEvent() # make sure it fills the frame - + mm = MyMEM(pnl) self.waitFor(100) - + uia = wx.UIActionSimulator() uia.MouseMove(pnl.ClientToScreen((10,10))) self.waitFor(100) uia.MouseClick() self.waitFor(100) - + self.assertTrue(hasattr(mm, 'hitTest')) self.assertTrue(hasattr(mm, 'mouseClicked')) - + del mm - + #--------------------------------------------------------------------------- if __name__ == '__main__': diff --git a/unittests/test_mousestate.py b/unittests/test_mousestate.py index d177c1a7..3cf4146f 100644 --- a/unittests/test_mousestate.py +++ b/unittests/test_mousestate.py @@ -4,7 +4,7 @@ import wx #--------------------------------------------------------------------------- class MouseState(unittest.TestCase): - + def test_MouseState(self): ms = wx.MouseState() @@ -21,9 +21,9 @@ class MouseState(unittest.TestCase): ms.aux1IsDown ms.aux2IsDown ms.Position - - - + + + #--------------------------------------------------------------------------- diff --git a/unittests/test_msgdlg.py b/unittests/test_msgdlg.py index 23ebec6b..ee3808c5 100644 --- a/unittests/test_msgdlg.py +++ b/unittests/test_msgdlg.py @@ -6,15 +6,15 @@ import wx class msgdlg_Tests(wtc.WidgetTestCase): - + def test_msgdlg1(self): dlg = wx.MessageDialog(None, 'Message', 'Caption') dlg.Destroy() - + def test_msgdlg2(self): dlg = wx.MessageDialog(self.frame, 'Message', 'Caption') dlg.Destroy() - + def test_msgdlg3(self): dlg = wx.MessageDialog(None, 'Message', 'Caption') dlg.SetExtendedMessage('extended') @@ -28,7 +28,7 @@ class msgdlg_Tests(wtc.WidgetTestCase): def test_msgdlg3(self): wx.MessageBox - + def test_msgdlgProperties(self): dlg = wx.MessageDialog(None, 'Message', 'Caption') dlg.CancelLabel @@ -42,7 +42,7 @@ class msgdlg_Tests(wtc.WidgetTestCase): dlg.OKLabel dlg.YesLabel dlg.Destroy() - + def test_msgdlgIconConstants(self): wx.ICON_EXCLAMATION wx.ICON_HAND @@ -57,13 +57,13 @@ class msgdlg_Tests(wtc.WidgetTestCase): wx.CallLater(250, dlg.EndModal, wx.ID_OK) dlg.ShowModal() dlg.Destroy() - + def test_gmsgdlg2(self): dlg = wx.GenericMessageDialog(self.frame, 'Message', 'Caption') wx.CallLater(250, dlg.EndModal, wx.ID_OK) dlg.ShowModal() dlg.Destroy() - + def test_gmsgdlg3(self): dlg = wx.GenericMessageDialog(None, 'Message', 'Caption') dlg.SetExtendedMessage('extended') @@ -76,7 +76,7 @@ class msgdlg_Tests(wtc.WidgetTestCase): wx.CallLater(250, dlg.EndModal, wx.ID_OK) dlg.ShowModal() dlg.Destroy() - + #--------------------------------------------------------------------------- diff --git a/unittests/test_notebook.py b/unittests/test_notebook.py index 7ebbaf79..3c45d99c 100644 --- a/unittests/test_notebook.py +++ b/unittests/test_notebook.py @@ -12,31 +12,31 @@ class notebook_Tests(wtc.WidgetTestCase): def test_notebookDefaultCtor(self): nb = wx.Notebook() nb.Create(self.frame) - + def test_notebookStyles(self): wx.NB_DEFAULT - wx.NB_TOP - wx.NB_BOTTOM - wx.NB_LEFT - wx.NB_RIGHT - - wx.NB_FIXEDWIDTH - wx.NB_MULTILINE + wx.NB_TOP + wx.NB_BOTTOM + wx.NB_LEFT + wx.NB_RIGHT + + wx.NB_FIXEDWIDTH + wx.NB_MULTILINE wx.NB_NOPAGETHEME - wx.NB_FLAT - + wx.NB_FLAT + wx.NB_HITTEST_NOWHERE - wx.NB_HITTEST_ONICON + wx.NB_HITTEST_ONICON wx.NB_HITTEST_ONLABEL - wx.NB_HITTEST_ONITEM - wx.NB_HITTEST_ONPAGE + wx.NB_HITTEST_ONITEM + wx.NB_HITTEST_ONPAGE def test_notebookEventTypes(self): wx.wxEVT_COMMAND_NOTEBOOK_PAGE_CHANGED wx.wxEVT_COMMAND_NOTEBOOK_PAGE_CHANGING - wx.EVT_NOTEBOOK_PAGE_CHANGED - wx.EVT_NOTEBOOK_PAGE_CHANGING - + wx.EVT_NOTEBOOK_PAGE_CHANGED + wx.EVT_NOTEBOOK_PAGE_CHANGING + def test_notebookPages(self): nb = wx.Notebook(self.frame, style=wx.NB_BOTTOM) p1 = wx.Panel(nb) @@ -44,7 +44,7 @@ class notebook_Tests(wtc.WidgetTestCase): p2 = wx.Panel(nb) nb.AddPage(p2, "Page2") nb.SetSelection(0) - + #--------------------------------------------------------------------------- diff --git a/unittests/test_notifmsg.py b/unittests/test_notifmsg.py index a3d569b5..d85324fc 100644 --- a/unittests/test_notifmsg.py +++ b/unittests/test_notifmsg.py @@ -12,8 +12,8 @@ class notifmsg_Tests(wtc.WidgetTestCase): nf.Show() self.waitFor(300) nf.Close() - - + + #--------------------------------------------------------------------------- if __name__ == '__main__': diff --git a/unittests/test_odcombo.py b/unittests/test_odcombo.py index e3bcf021..c60dcd95 100644 --- a/unittests/test_odcombo.py +++ b/unittests/test_odcombo.py @@ -19,48 +19,48 @@ class odcombo_Tests(wtc.WidgetTestCase): class MyODCombo(wx.adv.OwnerDrawnComboBox): def __init__(self, *args, **kw): wx.adv.OwnerDrawnComboBox.__init__(self, *args, **kw) - + self._OnDrawBackground_Called = False self._OnDrawItem_Called = False self._OnMeasureItem_Called = False self._OnMeasureItemWidth_Called = False - + def OnDrawBackground(self, dc, rect, item, flags): self._OnDrawBackground_Called = True wx.adv.OwnerDrawnComboBox.OnDrawBackground(self, dc, rect, item, flags) - + def OnDrawItem(self, dc, rect, item, flags): self._OnDrawItem_Called = True wx.adv.OwnerDrawnComboBox.OnDrawItem(self, dc, rect, item, flags) - + def OnMeasureItem(self, item): self._OnMeasureItem_Called = True return wx.adv.OwnerDrawnComboBox.OnMeasureItem(self, item) - + def OnMeasureItemWidth(self, item): self._OnMeasureItemWidth_Called = True return wx.adv.OwnerDrawnComboBox.OnMeasureItemWidth(self, item) - - + + pnl = wx.Panel(self.frame) cb = MyODCombo(pnl, pos=(10,10)) cb.Append("one two three four".split()) cb.SetSelection(2) self.assertEqual(cb.GetSelection(), 2) self.assertEqual(cb.GetString(1), 'two') - + self.waitFor(100) cb.Popup() - self.waitFor(100) + self.waitFor(100) cb.Dismiss() self.myYield() - + self.assertTrue(cb._OnDrawBackground_Called) self.assertTrue(cb._OnDrawItem_Called) self.assertTrue(cb._OnMeasureItemWidth_Called) self.assertTrue(cb._OnMeasureItem_Called) - - + + #--------------------------------------------------------------------------- if __name__ == '__main__': diff --git a/unittests/test_overlay.py b/unittests/test_overlay.py index 7970c1a7..d2228876 100644 --- a/unittests/test_overlay.py +++ b/unittests/test_overlay.py @@ -13,8 +13,8 @@ class overlay_Tests(wtc.WidgetTestCase): odc.Clear() del odc o.Reset() - - + + #--------------------------------------------------------------------------- if __name__ == '__main__': diff --git a/unittests/test_panel.py b/unittests/test_panel.py index 01921180..5e7edd0a 100644 --- a/unittests/test_panel.py +++ b/unittests/test_panel.py @@ -12,8 +12,8 @@ class panel_Tests(wtc.WidgetTestCase): def test_panelDefaultCtor(self): p = wx.Panel() p.Create(self.frame) - - + + #--------------------------------------------------------------------------- diff --git a/unittests/test_pen.py b/unittests/test_pen.py index c06aafea..c15305d1 100644 --- a/unittests/test_pen.py +++ b/unittests/test_pen.py @@ -16,7 +16,7 @@ class pen_Tests(wtc.WidgetTestCase): p.SetStyle(wx.PENSTYLE_SOLID) self.assertTrue(p.IsOk()) - + def test_penCtor2(self): p = wx.Pen(wx.BLUE) self.assertTrue(p.IsOk()) @@ -25,7 +25,7 @@ class pen_Tests(wtc.WidgetTestCase): p = wx.Pen('blue') self.assertTrue(p.IsOk()) self.assertTrue(p.GetColour() == wx.BLUE) - + p = wx.Pen('#0000FF') self.assertTrue(p.IsOk()) self.assertTrue(p.GetColour() == wx.BLUE) @@ -36,8 +36,8 @@ class pen_Tests(wtc.WidgetTestCase): p2 = wx.Pen(p1) self.assertTrue( p1 is not p2) self.assertTrue( p1 == p2) - - + + def test_penNull(self): wx.NullPen self.assertTrue(not wx.NullPen.IsOk()) @@ -49,8 +49,8 @@ class pen_Tests(wtc.WidgetTestCase): if p: test = True self.assertTrue(test) - - + + def test_penStock(self): for p in [wx.RED_PEN, wx.BLUE_PEN, wx.CYAN_PEN, wx.GREEN_PEN, wx.YELLOW_PEN, wx.BLACK_PEN, wx.WHITE_PEN, @@ -63,12 +63,12 @@ class pen_Tests(wtc.WidgetTestCase): def test_penDashes(self): p = wx.Pen() p.Style = wx.PENSTYLE_USER_DASH - p.Width = 1 + p.Width = 1 dashes = [1,2,2,1] p.SetDashes(dashes) d = p.GetDashes() self.assertTrue(d == dashes) - + def test_penProperties(self): p = wx.Pen(wx.BLUE) @@ -79,8 +79,8 @@ class pen_Tests(wtc.WidgetTestCase): p.Stipple p.Style p.Width - - + + def test_penConstants(self): wx.PENSTYLE_INVALID wx.PENSTYLE_SOLID @@ -117,7 +117,7 @@ class pen_Tests(wtc.WidgetTestCase): p = wx.Pen('red', 1, wx.STIPPLE) - + #--------------------------------------------------------------------------- diff --git a/unittests/test_pi_import.py b/unittests/test_pi_import.py index 765bf396..9d0943fa 100644 --- a/unittests/test_pi_import.py +++ b/unittests/test_pi_import.py @@ -10,7 +10,7 @@ class PIImportTest(unittest.TestCase): things like autocomplete lists and call tips. They are essentially just Python code with stubs for all the classes and other things that are in the extension modules and that are not easily introspected. - + This test case ensures that the code in the pi files is valid by trying to run the file with a new instance of Python. """ @@ -20,9 +20,9 @@ class PIImportTest(unittest.TestCase): dirname = os.path.dirname(wx.__file__) os.chdir(dirname) - sp = subprocess.Popen('%s %s' % (sys.executable, filename), + sp = subprocess.Popen('%s %s' % (sys.executable, filename), shell=True, - stdout=subprocess.PIPE, + stdout=subprocess.PIPE, stderr=subprocess.STDOUT) stdout, stderr = sp.communicate() os.chdir(cwd) @@ -30,11 +30,11 @@ class PIImportTest(unittest.TestCase): # stdout will likely contain a traceback or some other indication of # the failure, so use it as the assert message for the unittest. self.assertEqual(sp.returncode, 0, stdout) - - + + def test_core_pi(self): self.runPI('core.pi') - + def test_adv_pi(self): self.runPI('adv.pi') @@ -43,10 +43,10 @@ class PIImportTest(unittest.TestCase): def test_html_pi(self): self.runPI('html.pi') - + def test_html2_pi(self): self.runPI('html2.pi') - + def test_dataview_pi(self): self.runPI('dataview.pi') @@ -61,10 +61,10 @@ class PIImportTest(unittest.TestCase): - + #--------------------------------------------------------------------------- if __name__ == '__main__': unittest.main() - + diff --git a/unittests/test_pickers.py b/unittests/test_pickers.py index 905411b9..45f33a2e 100644 --- a/unittests/test_pickers.py +++ b/unittests/test_pickers.py @@ -11,40 +11,40 @@ class pickers_Tests(wtc.WidgetTestCase): self.assertTrue(p.GetColour() == wx.Colour(0, 0, 0xff)) def test_pickersColourConstants(self): - wx.CLRP_USE_TEXTCTRL - wx.CLRP_DEFAULT_STYLE - wx.CLRP_SHOW_LABEL + wx.CLRP_USE_TEXTCTRL + wx.CLRP_DEFAULT_STYLE + wx.CLRP_SHOW_LABEL wx.wxEVT_COMMAND_COLOURPICKER_CHANGED wx.EVT_COLOURPICKER_CHANGED wx.ColourPickerEvent - - + + def test_pickersFile(self): p = wx.FilePickerCtrl(self.frame, path='/tmp', wildcard='*.foo') self.assertTrue(p.Path == '/tmp') - - def test_pickersFileConstants(self): - wx.FLP_OPEN - wx.FLP_SAVE - wx.FLP_OVERWRITE_PROMPT - wx.FLP_FILE_MUST_EXIST - wx.FLP_CHANGE_DIR - wx.FLP_SMALL - wx.FLP_USE_TEXTCTRL - wx.FLP_DEFAULT_STYLE - wx.DIRP_DIR_MUST_EXIST - wx.DIRP_CHANGE_DIR - wx.DIRP_SMALL - wx.DIRP_USE_TEXTCTRL - wx.DIRP_DEFAULT_STYLE + def test_pickersFileConstants(self): + wx.FLP_OPEN + wx.FLP_SAVE + wx.FLP_OVERWRITE_PROMPT + wx.FLP_FILE_MUST_EXIST + wx.FLP_CHANGE_DIR + wx.FLP_SMALL + wx.FLP_USE_TEXTCTRL + wx.FLP_DEFAULT_STYLE + + wx.DIRP_DIR_MUST_EXIST + wx.DIRP_CHANGE_DIR + wx.DIRP_SMALL + wx.DIRP_USE_TEXTCTRL + wx.DIRP_DEFAULT_STYLE wx.wxEVT_COMMAND_FILEPICKER_CHANGED wx.wxEVT_COMMAND_DIRPICKER_CHANGED wx.EVT_FILEPICKER_CHANGED wx.EVT_DIRPICKER_CHANGED wx.FileDirPickerEvent - + def test_pickersDir(self): p = wx.DirPickerCtrl(self.frame, path='/tmp') @@ -52,17 +52,17 @@ class pickers_Tests(wtc.WidgetTestCase): def test_pickersFont(self): p = wx.FontPickerCtrl(self.frame, font=wx.NORMAL_FONT) - + def test_pickersFontConstatnt(self): - wx.FNTP_FONTDESC_AS_LABEL - wx.FNTP_USEFONT_FOR_LABEL - wx.FONTBTN_DEFAULT_STYLE - wx.FNTP_USE_TEXTCTRL - wx.FNTP_DEFAULT_STYLE + wx.FNTP_FONTDESC_AS_LABEL + wx.FNTP_USEFONT_FOR_LABEL + wx.FONTBTN_DEFAULT_STYLE + wx.FNTP_USE_TEXTCTRL + wx.FNTP_DEFAULT_STYLE wx.wxEVT_COMMAND_FONTPICKER_CHANGED; wx.EVT_FONTPICKER_CHANGED wx.FontPickerEvent - + #--------------------------------------------------------------------------- diff --git a/unittests/test_platinfo.py b/unittests/test_platinfo.py index 295ba16e..d2cd73b3 100644 --- a/unittests/test_platinfo.py +++ b/unittests/test_platinfo.py @@ -12,8 +12,8 @@ class platinfo_Tests(wtc.WidgetTestCase): pi.GetArchitecture() pi.GetOperatingSystemId() pi.GetPortId() - - + + def test_platinfoProperties(self): pi = wx.PlatformInformation.Get() @@ -35,7 +35,7 @@ class platinfo_Tests(wtc.WidgetTestCase): pi.ToolkitMajorVersion pi.ToolkitMinorVersion - + def test_platinfoFlags(self): wx.OS_UNKNOWN wx.OS_MAC_OS @@ -56,7 +56,7 @@ class platinfo_Tests(wtc.WidgetTestCase): wx.OS_UNIX wx.OS_DOS wx.OS_OS2 - + wx.PORT_UNKNOWN wx.PORT_BASE wx.PORT_MSW @@ -68,7 +68,7 @@ class platinfo_Tests(wtc.WidgetTestCase): wx.PORT_COCOA wx.PORT_WINCE wx.PORT_DFB - + wx.ARCH_INVALID wx.ARCH_32 wx.ARCH_64 @@ -79,7 +79,7 @@ class platinfo_Tests(wtc.WidgetTestCase): wx.ENDIAN_LITTLE wx.ENDIAN_PDP wx.ENDIAN_MAX - + #--------------------------------------------------------------------------- diff --git a/unittests/test_popupwin.py b/unittests/test_popupwin.py index 24c25797..636267dc 100644 --- a/unittests/test_popupwin.py +++ b/unittests/test_popupwin.py @@ -12,16 +12,16 @@ class popupwin_Tests(wtc.WidgetTestCase): p.Show() wx.CallAfter(p.Destroy) self.myYield() - + def test_popupwinDefaultCtor(self): p = wx.PopupWindow() p.Create(self.frame) - + def test_popuptranswinCtor(self): p = wx.PopupTransientWindow(self.frame, wx.BORDER_SIMPLE) p.Popup() p.Dismiss() - + #--------------------------------------------------------------------------- diff --git a/unittests/test_position.py b/unittests/test_position.py index bb3fba7c..e5f49616 100644 --- a/unittests/test_position.py +++ b/unittests/test_position.py @@ -8,28 +8,28 @@ class position_Tests(wtc.WidgetTestCase): def test_positionCtors(self): p = wx.Position() - self.assertTrue(p == (0,0)) + self.assertTrue(p == (0,0)) self.assertTrue(p != (9,9)) p2 = wx.Position(2, 3) - self.assertTrue(p2.Get() == (2,3)) - + self.assertTrue(p2.Get() == (2,3)) + def test_positionCopyCtor(self): p1 = wx.Position(3,4) p2 = wx.Position(p1) self.assertTrue(p1 is not p2) self.assertTrue(p1 == p2) - + def test_positionProperties1(self): p = wx.Position() p.Row p.Col - + def test_positionProperties2(self): p = wx.Position() p.Row = 11 p.Col = 12 self.assertTrue(p.Get() == (11, 12)) - + def test_positionMath1(self): p1 = wx.Position(3,4) p2 = wx.Position(1,1) @@ -37,7 +37,7 @@ class position_Tests(wtc.WidgetTestCase): self.assertTrue(p1 == (2,3)) p1 += p2 self.assertTrue(p1 == (3,4)) - + def test_positionMath2(self): p1 = wx.Position(3,4) p2 = wx.Position(1,1) @@ -46,8 +46,8 @@ class position_Tests(wtc.WidgetTestCase): p4 = p3 - p2 self.assertTrue(p4 == (3,4)) self.assertTrue(p4 == p1) - - + + #--------------------------------------------------------------------------- diff --git a/unittests/test_power.py b/unittests/test_power.py index 94423386..60a4ddf9 100644 --- a/unittests/test_power.py +++ b/unittests/test_power.py @@ -16,21 +16,21 @@ class power_Tests(wtc.WidgetTestCase): wx.BATTERY_CRITICAL_STATE wx.BATTERY_SHUTDOWN_STATE wx.BATTERY_UNKNOWN_STATE - + wx.wxEVT_POWER_SUSPENDING wx.wxEVT_POWER_SUSPENDED wx.wxEVT_POWER_SUSPEND_CANCEL wx.wxEVT_POWER_RESUME - + wx.EVT_POWER_SUSPENDING wx.EVT_POWER_SUSPENDED wx.EVT_POWER_SUSPEND_CANCEL wx.EVT_POWER_RESUME - + wx.PowerEvent - - - + + + #--------------------------------------------------------------------------- if __name__ == '__main__': diff --git a/unittests/test_preferences.py b/unittests/test_preferences.py index 2e8ac170..ba9944cf 100644 --- a/unittests/test_preferences.py +++ b/unittests/test_preferences.py @@ -18,7 +18,7 @@ class preferences_Tests(wtc.WidgetTestCase): box.Add(cb2, 0, wx.ALL, 5) self.Sizer = wx.BoxSizer() self.Sizer.Add(box, 0, wx.ALL, 10) - + class MyPrefsPage(wx.PreferencesPage): def GetName(self): return 'MyPrefsPage' @@ -26,15 +26,15 @@ class preferences_Tests(wtc.WidgetTestCase): return wx.ArtProvider.GetBitmap(wx.ART_HELP, wx.ART_TOOLBAR, (32,32)) def CreateWindow(self, parent): return MyPrefsPanel(parent) - + prefEd = wx.PreferencesEditor() page1 = MyPrefsPage() page2 = MyPrefsPage() prefEd.AddPage(page1) prefEd.AddPage(page2) prefEd.Show(self.frame) - - + + #--------------------------------------------------------------------------- if __name__ == '__main__': diff --git a/unittests/test_printdlg.py b/unittests/test_printdlg.py index ad8e9b95..20568595 100644 --- a/unittests/test_printdlg.py +++ b/unittests/test_printdlg.py @@ -12,13 +12,13 @@ class printdlg_Tests(wtc.WidgetTestCase): def test_printdlg1(self): dlg = wx.PrintDialog(self.frame) dlg.Destroy() - - + + def test_printdlg2(self): dlg = wx.PageSetupDialog(self.frame) dlg.Destroy() - - + + #--------------------------------------------------------------------------- if __name__ == '__main__': diff --git a/unittests/test_printfw.py b/unittests/test_printfw.py index f02c29af..e39c420f 100644 --- a/unittests/test_printfw.py +++ b/unittests/test_printfw.py @@ -10,8 +10,8 @@ class printfw_Tests(wtc.WidgetTestCase): # TODO: We need to figure out some way to unittest wx.PrintPreview # and wx.Printout... In the meantime see samples/printing/printing.py pass - - + + def test_printfw2(self): wx.PREVIEW_PRINT wx.PREVIEW_NEXT @@ -22,28 +22,28 @@ class printfw_Tests(wtc.WidgetTestCase): wx.PRINTER_NO_ERROR wx.PRINTER_CANCELLED wx.PRINTER_ERROR - - wx.PREVIEW_PRINT - wx.PREVIEW_PREVIOUS - wx.PREVIEW_NEXT - wx.PREVIEW_ZOOM - wx.PREVIEW_FIRST - wx.PREVIEW_LAST - wx.PREVIEW_GOTO - wx.PREVIEW_DEFAULT - - wx.ID_PREVIEW_CLOSE - wx.ID_PREVIEW_NEXT - wx.ID_PREVIEW_PREVIOUS - wx.ID_PREVIEW_PRINT - wx.ID_PREVIEW_ZOOM - wx.ID_PREVIEW_FIRST - wx.ID_PREVIEW_LAST - wx.ID_PREVIEW_GOTO - wx.ID_PREVIEW_ZOOM_IN - wx.ID_PREVIEW_ZOOM_OUT - + wx.PREVIEW_PRINT + wx.PREVIEW_PREVIOUS + wx.PREVIEW_NEXT + wx.PREVIEW_ZOOM + wx.PREVIEW_FIRST + wx.PREVIEW_LAST + wx.PREVIEW_GOTO + wx.PREVIEW_DEFAULT + + wx.ID_PREVIEW_CLOSE + wx.ID_PREVIEW_NEXT + wx.ID_PREVIEW_PREVIOUS + wx.ID_PREVIEW_PRINT + wx.ID_PREVIEW_ZOOM + wx.ID_PREVIEW_FIRST + wx.ID_PREVIEW_LAST + wx.ID_PREVIEW_GOTO + wx.ID_PREVIEW_ZOOM_IN + wx.ID_PREVIEW_ZOOM_OUT + + #--------------------------------------------------------------------------- if __name__ == '__main__': diff --git a/unittests/test_process.py b/unittests/test_process.py index f6fdce9a..f8d3963d 100644 --- a/unittests/test_process.py +++ b/unittests/test_process.py @@ -9,7 +9,7 @@ testscript = os.path.join(os.path.dirname(__file__), 'process_script.py') class process_Tests(wtc.WidgetTestCase): - def test_process1(self): + def test_process1(self): # wx.Execute and wx.Process can only launch app bundles on OSX!! It's # a good thing we have the subprocess module that can be used instead. if 'wxMac' not in wx.PlatformInfo: @@ -17,18 +17,18 @@ class process_Tests(wtc.WidgetTestCase): pid = p.GetPid() - def test_process2(self): + def test_process2(self): self.flag = False def onEndProcess(evt): self.flag = True - + if 'wxMac' not in wx.PlatformInfo: p = wx.Process(self.frame) - self.frame.Bind(wx.EVT_END_PROCESS, onEndProcess) + self.frame.Bind(wx.EVT_END_PROCESS, onEndProcess) wx.Execute('%s %s' % (sys.executable, testscript), callback=p) self.waitFor(1000) self.assertTrue(self.flag) - + # TODO: When the stream classes are wrapped add tests for writing to and # reading from the process diff --git a/unittests/test_progdlg.py b/unittests/test_progdlg.py index fa2ea029..e0998df0 100644 --- a/unittests/test_progdlg.py +++ b/unittests/test_progdlg.py @@ -8,7 +8,7 @@ import sys class progdlg_Tests(wtc.WidgetTestCase): @unittest.skipIf(sys.platform.startswith("win"), "not running on Windows") - def test_progdlg1(self): + def test_progdlg1(self): max = 50 dlg = wx.GenericProgressDialog("Progress dialog example", "An informative message", @@ -21,13 +21,13 @@ class progdlg_Tests(wtc.WidgetTestCase): while keepGoing and count < max: count += 1 #wx.MilliSleep(250) - self.myYield() + self.myYield() (keepGoing, skip) = dlg.Update(count) dlg.Destroy() - + @unittest.skipIf(sys.platform.startswith("win"), "not running on Windows") - def test_progdlg2(self): + def test_progdlg2(self): max = 50 dlg = wx.ProgressDialog("Progress dialog example", "An informative message", @@ -40,11 +40,11 @@ class progdlg_Tests(wtc.WidgetTestCase): while keepGoing and count < max: count += 1 #wx.MilliSleep(250) - self.myYield() + self.myYield() (keepGoing, skip) = dlg.Update(count) dlg.Destroy() - + #--------------------------------------------------------------------------- diff --git a/unittests/test_propgridmanager.py b/unittests/test_propgridmanager.py index f173d250..d29d3c40 100644 --- a/unittests/test_propgridmanager.py +++ b/unittests/test_propgridmanager.py @@ -9,7 +9,7 @@ class propgridmanager_Tests(wtc.WidgetTestCase): # TODO: Remove this test and add real ones. def test_propgridmanager1(self): self.fail("Unit tests for propgridmanager not implemented yet.") - + #--------------------------------------------------------------------------- if __name__ == '__main__': diff --git a/unittests/test_pyevent.py b/unittests/test_pyevent.py index 9726f1ab..ebd5cbe1 100644 --- a/unittests/test_pyevent.py +++ b/unittests/test_pyevent.py @@ -7,8 +7,8 @@ import wx #--------------------------------------------------------------------------- class PyEvents(unittest.TestCase): - - def test_PyEvent(self): + + def test_PyEvent(self): id = wx.NewId() typ = wx.NewEventType() evt = wx.PyEvent(id, typ) @@ -20,10 +20,10 @@ class PyEvents(unittest.TestCase): self.assertTrue(evt.newAttr == evt2.newAttr) self.assertTrue(evt.Id == evt2.Id) self.assertTrue(evt.EventType == evt2.EventType) - - - def test_PyCommandEvent(self): + + + def test_PyCommandEvent(self): id = wx.NewId() typ = wx.NewEventType() evt = wx.PyCommandEvent(id, typ) @@ -36,7 +36,7 @@ class PyEvents(unittest.TestCase): self.assertTrue(evt.Id == evt2.Id) self.assertTrue(evt.EventType == evt2.EventType) - + def test_PyEvtCloneRefCounts(self): # Since we're doing some funky stuff under the covers with Clone, make # sure that the reference counts on everything (before and after) @@ -49,7 +49,7 @@ class PyEvents(unittest.TestCase): rc3 = sys.getrefcount(evt1) self.assertTrue(rc1 == rc2 == rc3) self.assertTrue(evt1.attr == evt2.attr) - + def test_CppClone(self): # test what happens when Clone is called from C++ @@ -58,8 +58,8 @@ class PyEvents(unittest.TestCase): evt1.attr = 'testCppClone' evt2 = wx.testCppClone(evt1) self.assertTrue(evt1.attr == evt2.attr) - - + + @unittest.skip('not testing refcounts for now, needs checking...') def test_CppCloneRefCounts(self): # Since we're doing some funky stuff under the covers with Clone, make @@ -75,18 +75,18 @@ class PyEvents(unittest.TestCase): self.assertTrue(rc1 == rc2 == rc3) self.assertTrue(evt1.attr == evt2.attr) - - - - + + + + class MyPyEvent(wx.PyEvent): def __init__(self, *args, **kw): wx.PyEvent.__init__(self, *args, **kw) self.one = 1 self.two = 2 self.three = 3 - + class MyPyCommandEvent(wx.PyCommandEvent): def __init__(self, *args, **kw): wx.PyEvent.__init__(self, *args, **kw) @@ -95,13 +95,13 @@ class MyPyCommandEvent(wx.PyCommandEvent): self.three = 3 - + class SendingPyEvents(wtc.WidgetTestCase): - def test_PyEventDerivedClone(self): + def test_PyEventDerivedClone(self): evt1 = MyPyEvent(id=123) evt1.four = 4 evt2 = evt1.Clone() - + self.assertEqual(evt2.GetId(), 123) self.assertEqual(evt2.one, 1) self.assertEqual(evt2.two, 2) @@ -111,11 +111,11 @@ class SendingPyEvents(wtc.WidgetTestCase): self.assertTrue(evt1 is not evt2) - def test_PyCommandEventDerivedClone(self): + def test_PyCommandEventDerivedClone(self): evt1 = MyPyCommandEvent(id=123) evt1.four = 4 evt2 = evt1.Clone() - + self.assertEqual(evt2.GetId(), 123) self.assertEqual(evt2.one, 1) self.assertEqual(evt2.two, 2) @@ -123,11 +123,11 @@ class SendingPyEvents(wtc.WidgetTestCase): self.assertEqual(evt2.four, 4) self.assertTrue(isinstance(evt2, MyPyCommandEvent)) self.assertTrue(evt1 is not evt2) - - + + def test_PyEventDerivedProcessEvent(self): self.flag = False - + def evtHandlerFunction(evt): self.assertEqual(evt.GetId(), 123) self.assertEqual(evt.one, 1) @@ -136,7 +136,7 @@ class SendingPyEvents(wtc.WidgetTestCase): self.assertEqual(evt.four, 4) self.assertTrue(isinstance(evt, MyPyEvent)) self.flag = True - + testType = wx.NewEventType() EVT_TEST = wx.PyEventBinder(testType) self.frame.Bind(EVT_TEST, evtHandlerFunction) @@ -144,11 +144,11 @@ class SendingPyEvents(wtc.WidgetTestCase): evt.four = 4 self.frame.GetEventHandler().ProcessEvent(evt) self.assertTrue(self.flag) - + def test_PyEventDerivedPostEvent(self): self.flag = False - + def evtHandlerFunction(evt): self.assertEqual(evt.GetId(), 123) self.assertEqual(evt.one, 1) @@ -157,7 +157,7 @@ class SendingPyEvents(wtc.WidgetTestCase): self.assertEqual(evt.four, 4) self.assertTrue(isinstance(evt, MyPyEvent)) self.flag = True - + testType = wx.NewEventType() EVT_TEST = wx.PyEventBinder(testType) self.frame.Bind(EVT_TEST, evtHandlerFunction) @@ -168,8 +168,8 @@ class SendingPyEvents(wtc.WidgetTestCase): self.myYield() self.assertTrue(self.flag) - - + + #--------------------------------------------------------------------------- diff --git a/unittests/test_radiobox.py b/unittests/test_radiobox.py index 6bfcde03..39629778 100644 --- a/unittests/test_radiobox.py +++ b/unittests/test_radiobox.py @@ -14,19 +14,19 @@ class radiobox_Tests(wtc.WidgetTestCase): r = wx.RadioBox() r.Create(self.frame, label='Label', choices='one two three four'.split(), majorDimension=2, style=wx.RA_SPECIFY_ROWS) - + def test_radioboxTweaks(self): r = wx.RadioBox(self.frame, label='Label', choices='one two three four'.split(), majorDimension=2) r.SetItemLabel(0, 'ZERO') self.assertTrue(r.GetItemLabel(0) == 'ZERO') - + r.Enable(False) r.Enable(True) r.EnableItem(1, False) r.ShowItem(2, False) - - + + #--------------------------------------------------------------------------- diff --git a/unittests/test_radiobut.py b/unittests/test_radiobut.py index 1101938a..c6b452c3 100644 --- a/unittests/test_radiobut.py +++ b/unittests/test_radiobut.py @@ -5,15 +5,15 @@ import wx #--------------------------------------------------------------------------- class radiobut_Tests(wtc.WidgetTestCase): - + def test_radiobutCtors(self): b = wx.RadioButton(self.frame, -1, 'radiobutton', wx.Point(10,10), wx.Size(80,-1)) b = wx.RadioButton(self.frame, label='radiobutton', style=wx.RB_GROUP) - + def test_radiobutDefaultCtor(self): b = wx.RadioButton() b.Create(self.frame, label="radiobutton") - + def test_radiobutValue(self): b = wx.RadioButton(self.frame, label='radiobutton', style=wx.RB_GROUP) b1 = wx.RadioButton(self.frame, label='radiobutton1') @@ -23,8 +23,8 @@ class radiobut_Tests(wtc.WidgetTestCase): b.Value = True self.assertTrue(b.GetValue() == True) self.assertTrue(b1.GetValue() == False) - - + + #--------------------------------------------------------------------------- diff --git a/unittests/test_rawbmp.py b/unittests/test_rawbmp.py index 817a293e..e5d6af05 100644 --- a/unittests/test_rawbmp.py +++ b/unittests/test_rawbmp.py @@ -12,7 +12,7 @@ class rawbmp_Tests(wtc.WidgetTestCase): green = 20 blue = 30 alpha = 128 - + bmp = wx.Bitmap(DIM, DIM, 32) pixelData = wx.AlphaPixelData(bmp) self.assertTrue(pixelData) diff --git a/unittests/test_rearrangectrl.py b/unittests/test_rearrangectrl.py index 60be0834..39878b0f 100644 --- a/unittests/test_rearrangectrl.py +++ b/unittests/test_rearrangectrl.py @@ -23,23 +23,23 @@ class rearrangectrl_Tests(wtc.WidgetTestCase): def test_rearrangectrl3(self): rc = wx.RearrangeCtrl(self.frame, order=[0,1,2], items=['one', 'two', 'three']) - + def test_rearrangectrl4(self): rc = wx.RearrangeCtrl() rc.Create(self.frame, order=[1,2,0], items=['one', 'two', 'three']) def test_rearrangectrl5(self): - rd = wx.RearrangeDialog(self.frame, 'message', 'title', + rd = wx.RearrangeDialog(self.frame, 'message', 'title', order=[0,1,2], items=['one', 'two', 'three']) rd.Destroy() - + def test_rearrangectrl6(self): rd = wx.RearrangeDialog() - rd.Create(self.frame, 'message', 'title', + rd.Create(self.frame, 'message', 'title', order=[0,1,2], items=['one', 'two', 'three']) rd.Destroy() - + #--------------------------------------------------------------------------- if __name__ == '__main__': diff --git a/unittests/test_region.py b/unittests/test_region.py index 46e453e9..558410c5 100644 --- a/unittests/test_region.py +++ b/unittests/test_region.py @@ -8,7 +8,7 @@ pngFile = os.path.join(os.path.dirname(__file__), 'toucan.png') #--------------------------------------------------------------------------- class region_Tests(wtc.WidgetTestCase): - + def test_regionCtors(self): r = wx.Region() r = wx.Region(10, 10, 100, 100) @@ -19,8 +19,8 @@ class region_Tests(wtc.WidgetTestCase): bmp = wx.Bitmap(pngFile) r = wx.Region(bmp) r = wx.Region(bmp, 'black') - - + + def test_regionIterator1(self): region = wx.Region([(10,10), (100, 100), (10, 100)]) iterator = wx.RegionIterator(region) @@ -32,7 +32,7 @@ class region_Tests(wtc.WidgetTestCase): count += 1 self.assertTrue(count > 0) - + def test_regionIterator2(self): region = wx.Region([(10,10), (100, 100), (10, 100)]) count = 0 @@ -50,7 +50,7 @@ class region_Tests(wtc.WidgetTestCase): region.Contains(wx.Point(10,20)) region.Contains(wx.Rect(10,20,4,4)) region.Subtract(wx.Rect(10,20,4,4)) - + #--------------------------------------------------------------------------- diff --git a/unittests/test_renderer.py b/unittests/test_renderer.py index 1b4be4d7..ef13e09f 100644 --- a/unittests/test_renderer.py +++ b/unittests/test_renderer.py @@ -7,19 +7,19 @@ import wx class renderer_Tests(wtc.WidgetTestCase): # TODO: Expand these tests, this is really minimal currently - + def test_renderer1(self): dc = wx.ClientDC(self.frame) r = wx.RendererNative.Get() r.DrawCheckBox(self.frame, dc, (10,10, 40,20)) - + def test_renderer2(self): sp = wx.SplitterRenderParams(5, 5, False) def test_renderer3(self): hbp = wx.HeaderButtonParams() - - + + #--------------------------------------------------------------------------- if __name__ == '__main__': diff --git a/unittests/test_ribbon_art.py b/unittests/test_ribbon_art.py index 8d34e2b0..7404eef4 100644 --- a/unittests/test_ribbon_art.py +++ b/unittests/test_ribbon_art.py @@ -107,7 +107,7 @@ class ribbon_art_Tests(wtc.WidgetTestCase): wx.ribbon.RIBBON_ART_TOOL_ACTIVE_BACKGROUND_COLOUR wx.ribbon.RIBBON_ART_TOOL_ACTIVE_BACKGROUND_GRADIENT_COLOUR - + def test_ribbon_art2(self): wx.ribbon.RIBBON_SCROLL_BTN_LEFT wx.ribbon.RIBBON_SCROLL_BTN_RIGHT @@ -127,7 +127,7 @@ class ribbon_art_Tests(wtc.WidgetTestCase): wx.ribbon.RIBBON_BUTTON_DROPDOWN wx.ribbon.RIBBON_BUTTON_HYBRID wx.ribbon.RIBBON_BUTTON_TOGGLE - + wx.ribbon.RIBBON_BUTTONBAR_BUTTON_SMALL wx.ribbon.RIBBON_BUTTONBAR_BUTTON_MEDIUM wx.ribbon.RIBBON_BUTTONBAR_BUTTON_LARGE @@ -147,8 +147,8 @@ class ribbon_art_Tests(wtc.WidgetTestCase): wx.ribbon.RIBBON_GALLERY_BUTTON_HOVERED, wx.ribbon.RIBBON_GALLERY_BUTTON_ACTIVE, wx.ribbon.RIBBON_GALLERY_BUTTON_DISABLED - - + + def test_ribbon_art3(self): art = wx.ribbon.RibbonMSWArtProvider() diff --git a/unittests/test_richmsgdlg.py b/unittests/test_richmsgdlg.py index 1cf80c8a..93311bd3 100644 --- a/unittests/test_richmsgdlg.py +++ b/unittests/test_richmsgdlg.py @@ -11,13 +11,13 @@ class richmsgdlg_Tests(wtc.WidgetTestCase): wx.CallLater(250, dlg.EndModal, wx.ID_OK) dlg.ShowModal() dlg.Destroy() - + def test_richmsgdlg2(self): dlg = wx.RichMessageDialog(self.frame, 'Message', 'Caption') wx.CallLater(250, dlg.EndModal, wx.ID_OK) dlg.ShowModal() dlg.Destroy() - + def test_richmsgdlg3(self): dlg = wx.RichMessageDialog(None, 'Message', 'Caption') dlg.SetExtendedMessage('extended') @@ -34,11 +34,11 @@ class richmsgdlg_Tests(wtc.WidgetTestCase): self.assertEqual(dlg.GetDetailedText(), "Detailed Text") self.assertEqual(dlg.CheckBoxText, "Checkbox") self.assertEqual(dlg.DetailedText, "Detailed Text") - + wx.CallLater(250, dlg.EndModal, wx.ID_OK) dlg.ShowModal() dlg.Destroy() - + #--------------------------------------------------------------------------- if __name__ == '__main__': diff --git a/unittests/test_richtextbuffer.py b/unittests/test_richtextbuffer.py index e6f0ee64..9171ed52 100644 --- a/unittests/test_richtextbuffer.py +++ b/unittests/test_richtextbuffer.py @@ -23,7 +23,7 @@ class richtextbuffer_Tests(wtc.WidgetTestCase): wx.richtext.RICHTEXT_DRAW_SELECTED wx.richtext.RICHTEXT_DRAW_PRINT wx.richtext.RICHTEXT_DRAW_GUIDELINES - + wx.richtext.RICHTEXT_FORMATTED wx.richtext.RICHTEXT_UNFORMATTED wx.richtext.RICHTEXT_CACHE_SIZE @@ -37,19 +37,19 @@ class richtextbuffer_Tests(wtc.WidgetTestCase): wx.richtext.RICHTEXT_SETSTYLE_SPECIFY_LEVEL wx.richtext.RICHTEXT_SETSTYLE_RESET wx.richtext.RICHTEXT_SETSTYLE_REMOVE - - wx.richtext.RICHTEXT_SETPROPERTIES_NONE - wx.richtext.RICHTEXT_SETPROPERTIES_WITH_UNDO + + wx.richtext.RICHTEXT_SETPROPERTIES_NONE + wx.richtext.RICHTEXT_SETPROPERTIES_WITH_UNDO wx.richtext.RICHTEXT_SETPROPERTIES_PARAGRAPHS_ONLY wx.richtext.RICHTEXT_SETPROPERTIES_CHARACTERS_ONLY - wx.richtext.RICHTEXT_SETPROPERTIES_RESET - wx.richtext.RICHTEXT_SETPROPERTIES_REMOVE - + wx.richtext.RICHTEXT_SETPROPERTIES_RESET + wx.richtext.RICHTEXT_SETPROPERTIES_REMOVE + wx.richtext.RICHTEXT_INSERT_NONE wx.richtext.RICHTEXT_INSERT_WITH_PREVIOUS_PARAGRAPH_STYLE wx.richtext.RICHTEXT_INSERT_INTERACTIVE wx.richtext.TEXT_ATTR_KEEP_FIRST_PARA_STYLE - + wx.richtext.RICHTEXT_HITTEST_NONE wx.richtext.RICHTEXT_HITTEST_BEFORE wx.richtext.RICHTEXT_HITTEST_AFTER @@ -72,11 +72,11 @@ class richtextbuffer_Tests(wtc.WidgetTestCase): wx.richtext.TEXT_BOX_ATTR_POSITION_ABSOLUTE wx.richtext.TEXT_BOX_ATTR_POSITION_MASK - + def test_richtextbuffer02(self): tad = wx.richtext.TextAttrDimension() - - + + def test_richtextbuffer03(self): tad = wx.richtext.TextAttrDimension(123, wx.richtext.TEXT_ATTR_UNITS_TENTHS_MM) self.assertTrue(tad.IsValid()) @@ -84,50 +84,50 @@ class richtextbuffer_Tests(wtc.WidgetTestCase): tad.ValueMM tad.Units - + def test_richtextbuffer04(self): tads = wx.richtext.TextAttrDimensions() tads.Left.Value = 123 tads.Left.IsValid() - + def test_richtextbuffer05(self): tas = wx.richtext.TextAttrSize() tas.SetWidth(wx.richtext.TextAttrDimension(123)) assert tas.Width.IsValid() assert tas.Width.Value == 123 - + def test_richtextbuffer06(self): c = wx.richtext.TextAttrDimensionConverter(123) - - + + def test_richtextbuffer07(self): - wx.richtext.TEXT_BOX_ATTR_BORDER_NONE - wx.richtext.TEXT_BOX_ATTR_BORDER_SOLID - wx.richtext.TEXT_BOX_ATTR_BORDER_DOTTED - wx.richtext.TEXT_BOX_ATTR_BORDER_DASHED - wx.richtext.TEXT_BOX_ATTR_BORDER_DOUBLE - wx.richtext.TEXT_BOX_ATTR_BORDER_GROOVE - wx.richtext.TEXT_BOX_ATTR_BORDER_RIDGE - wx.richtext.TEXT_BOX_ATTR_BORDER_INSET - wx.richtext.TEXT_BOX_ATTR_BORDER_OUTSET - wx.richtext.TEXT_BOX_ATTR_BORDER_STYLE - wx.richtext.TEXT_BOX_ATTR_BORDER_COLOUR - wx.richtext.TEXT_BOX_ATTR_BORDER_THIN - wx.richtext.TEXT_BOX_ATTR_BORDER_MEDIUM - wx.richtext.TEXT_BOX_ATTR_BORDER_THICK - wx.richtext.TEXT_BOX_ATTR_FLOAT_NONE - wx.richtext.TEXT_BOX_ATTR_FLOAT_LEFT - wx.richtext.TEXT_BOX_ATTR_FLOAT_RIGHT - wx.richtext.TEXT_BOX_ATTR_CLEAR_NONE - wx.richtext.TEXT_BOX_ATTR_CLEAR_LEFT - wx.richtext.TEXT_BOX_ATTR_CLEAR_RIGHT - wx.richtext.TEXT_BOX_ATTR_CLEAR_BOTH - wx.richtext.TEXT_BOX_ATTR_COLLAPSE_NONE - wx.richtext.TEXT_BOX_ATTR_COLLAPSE_FULL + wx.richtext.TEXT_BOX_ATTR_BORDER_NONE + wx.richtext.TEXT_BOX_ATTR_BORDER_SOLID + wx.richtext.TEXT_BOX_ATTR_BORDER_DOTTED + wx.richtext.TEXT_BOX_ATTR_BORDER_DASHED + wx.richtext.TEXT_BOX_ATTR_BORDER_DOUBLE + wx.richtext.TEXT_BOX_ATTR_BORDER_GROOVE + wx.richtext.TEXT_BOX_ATTR_BORDER_RIDGE + wx.richtext.TEXT_BOX_ATTR_BORDER_INSET + wx.richtext.TEXT_BOX_ATTR_BORDER_OUTSET + wx.richtext.TEXT_BOX_ATTR_BORDER_STYLE + wx.richtext.TEXT_BOX_ATTR_BORDER_COLOUR + wx.richtext.TEXT_BOX_ATTR_BORDER_THIN + wx.richtext.TEXT_BOX_ATTR_BORDER_MEDIUM + wx.richtext.TEXT_BOX_ATTR_BORDER_THICK + wx.richtext.TEXT_BOX_ATTR_FLOAT_NONE + wx.richtext.TEXT_BOX_ATTR_FLOAT_LEFT + wx.richtext.TEXT_BOX_ATTR_FLOAT_RIGHT + wx.richtext.TEXT_BOX_ATTR_CLEAR_NONE + wx.richtext.TEXT_BOX_ATTR_CLEAR_LEFT + wx.richtext.TEXT_BOX_ATTR_CLEAR_RIGHT + wx.richtext.TEXT_BOX_ATTR_CLEAR_BOTH + wx.richtext.TEXT_BOX_ATTR_COLLAPSE_NONE + wx.richtext.TEXT_BOX_ATTR_COLLAPSE_FULL wx.richtext.TEXT_BOX_ATTR_VERTICAL_ALIGNMENT_NONE - wx.richtext.TEXT_BOX_ATTR_VERTICAL_ALIGNMENT_TOP + wx.richtext.TEXT_BOX_ATTR_VERTICAL_ALIGNMENT_TOP wx.richtext.TEXT_BOX_ATTR_VERTICAL_ALIGNMENT_CENTRE wx.richtext.TEXT_BOX_ATTR_VERTICAL_ALIGNMENT_BOTTOM @@ -137,41 +137,41 @@ class richtextbuffer_Tests(wtc.WidgetTestCase): def test_richtextbuffer09(self): - b = wx.richtext.TextAttrBorders() + b = wx.richtext.TextAttrBorders() b.Left b.Right b.Top b.Bottom - - + + def test_richtextbuffer10(self): ba = wx.richtext.TextBoxAttr() - - + + def test_richtextbuffer11(self): t1 = wx.richtext.RichTextAttr() t2 = wx.richtext.RichTextAttr(t1) t3 = wx.richtext.RichTextAttr(wx.TextAttr()) - - + + def test_richtextbuffer12(self): p = wx.richtext.RichTextProperties() p.SetProperty('foo', 'bar') p.SetProperty('num', 123) self.assertEqual(p.GetProperty('foo'), 'bar') - + def test_richtextbuffer13(self): t = wx.richtext.RichTextFontTable() - - + + def test_richtextbuffer14a(self): r1 = wx.richtext.RichTextRange() r2 = wx.richtext.RichTextRange(111, 222) r3 = wx.richtext.RichTextRange(r2) r3.Start r3.End - + def test_richtextbuffer14b(self): wx.richtext.RICHTEXT_ALL wx.richtext.RICHTEXT_NONE @@ -183,21 +183,21 @@ class richtextbuffer_Tests(wtc.WidgetTestCase): end = r[1] self.assertEqual(start, 111) self.assertEqual(end, 222) - + def test_richtextbuffer14d(self): r = wx.richtext.RichTextRange(111, 222) start, end = r.Get() self.assertEqual(start, 111) self.assertEqual(end, 222) - + def test_richtextbuffer14e(self): r = wx.richtext.RichTextRange() self.assertEqual(r.Get(), (0,0)) r[0] = 111 r[1] = 222 self.assertEqual(r.Get(), (111,222)) - - + + def test_richtextbuffer15(self): s1 = wx.richtext.RichTextSelection() s2 = wx.richtext.RichTextSelection(s1) @@ -205,22 +205,22 @@ class richtextbuffer_Tests(wtc.WidgetTestCase): def test_richtextbuffer16(self): c = wx.richtext.RichTextDrawingContext(None) - + def test_richtextbuffer17(self): with self.assertRaises(TypeError): o1 = wx.richtext.RichTextObject() # It's an ABC - + def test_richtextbuffer18(self): with self.assertRaises(TypeError): o1 = wx.richtext.RichTextCompositeObject() # It's an ABC - + def test_richtextbuffer19(self): o1 = wx.richtext.RichTextParagraphLayoutBox() - + def test_richtextbuffer20(self): o1 = wx.richtext.RichTextBox() - + def test_richtextbuffer21(self): o1 = wx.richtext.RichTextField() @@ -230,22 +230,22 @@ class richtextbuffer_Tests(wtc.WidgetTestCase): def test_richtextbuffer23(self): o1 = wx.richtext.RichTextFieldTypeStandard() - + def test_richtextbuffer24(self): o1 = wx.richtext.RichTextFieldTypeStandard('foo', 'bar') def test_richtextbuffer25(self): o1 = wx.richtext.RichTextLine(None) - + def test_richtextbuffer26(self): o1 = wx.richtext.RichTextLineList() - + def test_richtextbuffer27(self): o1 = wx.richtext.RichTextParagraph() - + def test_richtextbuffer28(self): o1 = wx.richtext.RichTextPlainText() - + def test_richtextbuffer29(self): o1 = wx.richtext.RichTextPlainText('some text') @@ -261,7 +261,7 @@ class richtextbuffer_Tests(wtc.WidgetTestCase): def test_richtextbuffer33(self): o1 = wx.richtext.RichTextImage() o2 = wx.richtext.RichTextImage(o1) - + def test_richtextbuffer34(self): o1 = wx.richtext.RichTextBuffer() @@ -289,7 +289,7 @@ class richtextbuffer_Tests(wtc.WidgetTestCase): - + #--------------------------------------------------------------------------- if __name__ == '__main__': diff --git a/unittests/test_richtextctrl.py b/unittests/test_richtextctrl.py index 0515b117..f253d11a 100644 --- a/unittests/test_richtextctrl.py +++ b/unittests/test_richtextctrl.py @@ -15,19 +15,19 @@ class richtextctrl_Tests(wtc.WidgetTestCase): wx.richtext.RE_READONLY wx.richtext.RE_MULTILINE wx.richtext.RE_CENTER_CARET - wx.richtext.RE_CENTRE_CARET + wx.richtext.RE_CENTRE_CARET wx.richtext.RICHTEXT_SHIFT_DOWN wx.richtext.RICHTEXT_CTRL_DOWN wx.richtext.RICHTEXT_ALT_DOWN wx.richtext.RICHTEXT_EX_NO_GUIDELINES - + def test_richtextctrl2(self): info = wx.richtext.RichTextContextMenuPropertiesInfo() obj = wx.richtext.RichTextParagraph() info.AddItem('Name', obj) - - + + def test_richtextctrl3(self): rtc = wx.richtext.RichTextCtrl(self.frame) @@ -35,7 +35,7 @@ class richtextctrl_Tests(wtc.WidgetTestCase): def test_richtextctrl4(self): rtc = wx.richtext.RichTextCtrl() rtc.Create(self.frame) - + def test_richtextctrl5(self): rtc = wx.richtext.RichTextCtrl(self.frame) @@ -48,7 +48,7 @@ class richtextctrl_Tests(wtc.WidgetTestCase): def test_richtextctrl6(self): rtc = wx.richtext.RichTextCtrl(self.frame) rtc.SetValue('Hello World') - + rtc.SetSelection(2, 6) sel = rtc.GetSelection() self.assertIsInstance(sel, wx.richtext.RichTextSelection) @@ -78,54 +78,54 @@ class richtextctrl_Tests(wtc.WidgetTestCase): wx.richtext.EVT_RICHTEXT_SELECTION_CHANGED wx.richtext.EVT_RICHTEXT_BUFFER_RESET wx.richtext.EVT_RICHTEXT_FOCUS_OBJECT_CHANGED - - - + + + def test_richtextctrl8(self): import wx.richtext as rt - + rtc = rt.RichTextCtrl(self.frame, style=wx.VSCROLL|wx.HSCROLL|wx.NO_BORDER); - + rtc.Freeze() rtc.BeginSuppressUndo() - + rtc.BeginParagraphSpacing(0, 20) - + rtc.BeginAlignment(wx.TEXT_ALIGNMENT_CENTRE) rtc.BeginBold() - + rtc.BeginFontSize(14) rtc.WriteText("Welcome to wxRichTextCtrl, a wxWidgets control for editing and presenting styled text and images") rtc.EndFontSize() rtc.Newline() - + rtc.BeginItalic() rtc.WriteText("by Julian Smart") rtc.EndItalic() - + rtc.EndBold() - + rtc.Newline() rtc.WriteImage(wx.Image(toucanFile)) - + rtc.EndAlignment() - + rtc.Newline() rtc.Newline() - + rtc.WriteText("What can you do with this thing? ") rtc.WriteImage(wx.Image(smileFile)) rtc.WriteText(" Well, you can change text ") - + rtc.BeginTextColour((255, 0, 0)) rtc.WriteText("colour, like this red bit.") rtc.EndTextColour() - + rtc.BeginTextColour((0, 0, 255)) rtc.WriteText(" And this blue bit.") rtc.EndTextColour() - + rtc.WriteText(" Naturally you can make things ") rtc.BeginBold() rtc.WriteText("bold ") @@ -136,109 +136,109 @@ class richtextctrl_Tests(wtc.WidgetTestCase): rtc.BeginUnderline() rtc.WriteText("or underlined.") rtc.EndUnderline() - + rtc.BeginFontSize(14) rtc.WriteText(" Different font sizes on the same line is allowed, too.") rtc.EndFontSize() - + rtc.WriteText(" Next we'll show an indented paragraph.") - + rtc.BeginLeftIndent(60) rtc.Newline() - + rtc.WriteText("It was in January, the most down-trodden month of an Edinburgh winter. An attractive woman came into the cafe, which is nothing remarkable.") rtc.EndLeftIndent() - + rtc.Newline() - + rtc.WriteText("Next, we'll show a first-line indent, achieved using BeginLeftIndent(100, -40).") - + rtc.BeginLeftIndent(100, -40) rtc.Newline() - + rtc.WriteText("It was in January, the most down-trodden month of an Edinburgh winter. An attractive woman came into the cafe, which is nothing remarkable.") rtc.EndLeftIndent() - + rtc.Newline() - + rtc.WriteText("Numbered bullets are possible, again using sub-indents:") - + rtc.BeginNumberedBullet(1, 100, 60) rtc.Newline() - + rtc.WriteText("This is my first item. Note that wxRichTextCtrl doesn't automatically do numbering, but this will be added later.") rtc.EndNumberedBullet() - + rtc.BeginNumberedBullet(2, 100, 60) rtc.Newline() - + rtc.WriteText("This is my second item.") rtc.EndNumberedBullet() - + rtc.Newline() - + rtc.WriteText("The following paragraph is right-indented:") - + rtc.BeginRightIndent(200) rtc.Newline() - + rtc.WriteText("It was in January, the most down-trodden month of an Edinburgh winter. An attractive woman came into the cafe, which is nothing remarkable.") rtc.EndRightIndent() - + rtc.Newline() - + rtc.WriteText("The following paragraph is right-aligned with 1.5 line spacing:") - + rtc.BeginAlignment(wx.TEXT_ALIGNMENT_RIGHT) rtc.BeginLineSpacing(wx.TEXT_ATTR_LINE_SPACING_HALF) rtc.Newline() - + rtc.WriteText("It was in January, the most down-trodden month of an Edinburgh winter. An attractive woman came into the cafe, which is nothing remarkable.") rtc.EndLineSpacing() rtc.EndAlignment() - + rtc.Newline() rtc.WriteText("Other notable features of wxRichTextCtrl include:") - + rtc.BeginSymbolBullet('*', 100, 60) rtc.Newline() rtc.WriteText("Compatibility with wxTextCtrl API") rtc.EndSymbolBullet() - + rtc.BeginSymbolBullet('*', 100, 60) rtc.Newline() rtc.WriteText("Easy stack-based BeginXXX()...EndXXX() style setting in addition to SetStyle()") rtc.EndSymbolBullet() - + rtc.BeginSymbolBullet('*', 100, 60) rtc.Newline() rtc.WriteText("XML loading and saving") rtc.EndSymbolBullet() - + rtc.BeginSymbolBullet('*', 100, 60) rtc.Newline() rtc.WriteText("Undo/Redo, with batching option and Undo suppressing") rtc.EndSymbolBullet() - + rtc.BeginSymbolBullet('*', 100, 60) rtc.Newline() rtc.WriteText("Clipboard copy and paste") rtc.EndSymbolBullet() - + rtc.BeginSymbolBullet('*', 100, 60) rtc.Newline() rtc.WriteText("wxRichTextStyleSheet with named character and paragraph styles, and control for applying named styles") rtc.EndSymbolBullet() - + rtc.BeginSymbolBullet('*', 100, 60) rtc.Newline() rtc.WriteText("A design that can easily be extended to other content types, ultimately with text boxes, tables, controls, and so on") rtc.EndSymbolBullet() - + rtc.Newline() - + rtc.WriteText("Note: this sample content was generated programmatically from within the MyFrame constructor in the demo. The images were loaded from inline XPMs. Enjoy wxRichTextCtrl!") - + rtc.Newline() rtc.Newline() rtc.BeginFontSize(12) @@ -249,7 +249,7 @@ class richtextctrl_Tests(wtc.WidgetTestCase): rtc.Newline() rtc.WriteText("I find some of the RichTextCtrl method names, as used above, to be misleading. Some character styles are stacked in the RichTextCtrl, and they are removed in the reverse order from how they are added, regardless of the method called. Allow me to demonstrate what I mean.") rtc.Newline() - + rtc.WriteText('Start with plain text. ') rtc.BeginBold() rtc.WriteText('BeginBold() makes it bold. ') @@ -260,7 +260,7 @@ class richtextctrl_Tests(wtc.WidgetTestCase): rtc.EndItalic() rtc.WriteText('EndItalic() takes us back to plain text. ') rtc.Newline() - + rtc.WriteText('Start with plain text. ') rtc.BeginBold() rtc.WriteText('BeginBold() makes it bold. ') @@ -271,17 +271,17 @@ class richtextctrl_Tests(wtc.WidgetTestCase): rtc.EndUnderline() rtc.WriteText('EndUnderline() takes us back to plain text. ') rtc.Newline() - + rtc.WriteText('According to Julian, this functions "as expected" because of the way the RichTextCtrl is written. ') rtc.Newline() - + rtc.EndParagraphSpacing() - + rtc.EndSuppressUndo() rtc.Thaw() - - - + + + #--------------------------------------------------------------------------- if __name__ == '__main__': diff --git a/unittests/test_richtextformatdlg.py b/unittests/test_richtextformatdlg.py index a1d9a840..de2ce09c 100644 --- a/unittests/test_richtextformatdlg.py +++ b/unittests/test_richtextformatdlg.py @@ -8,12 +8,12 @@ import wx.richtext class richtextformatdlg_Tests(wtc.WidgetTestCase): def test_richtextformatdlg1(self): - wx.richtext.RICHTEXT_FORMAT_FONT - wx.richtext.RICHTEXT_FORMAT_TABS - wx.richtext.RICHTEXT_FORMAT_STYLE_EDITOR - wx.richtext.RICHTEXT_FORMAT_BULLETS + wx.richtext.RICHTEXT_FORMAT_FONT + wx.richtext.RICHTEXT_FORMAT_TABS + wx.richtext.RICHTEXT_FORMAT_STYLE_EDITOR + wx.richtext.RICHTEXT_FORMAT_BULLETS wx.richtext.RICHTEXT_FORMAT_INDENTS_SPACING - + def test_richtextformatdlg2(self): dlg = wx.richtext.RichTextFormattingDialog( diff --git a/unittests/test_richtexthtml.py b/unittests/test_richtexthtml.py index c2ba5a78..7c1dd7fc 100644 --- a/unittests/test_richtexthtml.py +++ b/unittests/test_richtexthtml.py @@ -11,9 +11,9 @@ class richtexthtml_Tests(wtc.WidgetTestCase): handler = wx.richtext.RichTextHTMLHandler() wx.richtext.RichTextBuffer.AddHandler(handler) - - - + + + #--------------------------------------------------------------------------- if __name__ == '__main__': diff --git a/unittests/test_richtextprint.py b/unittests/test_richtextprint.py index e9ed20f1..f13a2b32 100644 --- a/unittests/test_richtextprint.py +++ b/unittests/test_richtextprint.py @@ -14,19 +14,19 @@ class richtextprint_Tests(wtc.WidgetTestCase): wx.richtext.RICHTEXT_PAGE_LEFT wx.richtext.RICHTEXT_PAGE_CENTRE wx.richtext.RICHTEXT_PAGE_RIGHT - - + + def test_richtextprint2(self): hfd = wx.richtext.RichTextHeaderFooterData() - - + + def test_richtextprint3(self): p = wx.richtext.RichTextPrintout() - - + + def test_richtextprint4(self): p = wx.richtext.RichTextPrinting() - + #--------------------------------------------------------------------------- if __name__ == '__main__': diff --git a/unittests/test_richtextstyledlg.py b/unittests/test_richtextstyledlg.py index 76ae3d1d..c6c95eff 100644 --- a/unittests/test_richtextstyledlg.py +++ b/unittests/test_richtextstyledlg.py @@ -7,36 +7,36 @@ import wx.richtext class richtextstyledlg_Tests(wtc.WidgetTestCase): - - def test_richtextstyledlg1(self): - wx.richtext.RICHTEXT_ORGANISER_DELETE_STYLES - wx.richtext.RICHTEXT_ORGANISER_CREATE_STYLES - wx.richtext.RICHTEXT_ORGANISER_APPLY_STYLES - wx.richtext.RICHTEXT_ORGANISER_EDIT_STYLES - wx.richtext.RICHTEXT_ORGANISER_RENAME_STYLES - wx.richtext.RICHTEXT_ORGANISER_OK_CANCEL - wx.richtext.RICHTEXT_ORGANISER_RENUMBER - wx.richtext.RICHTEXT_ORGANISER_SHOW_CHARACTER - wx.richtext.RICHTEXT_ORGANISER_SHOW_PARAGRAPH - wx.richtext.RICHTEXT_ORGANISER_SHOW_LIST - wx.richtext.RICHTEXT_ORGANISER_SHOW_BOX - wx.richtext.RICHTEXT_ORGANISER_SHOW_ALL + + def test_richtextstyledlg1(self): + wx.richtext.RICHTEXT_ORGANISER_DELETE_STYLES + wx.richtext.RICHTEXT_ORGANISER_CREATE_STYLES + wx.richtext.RICHTEXT_ORGANISER_APPLY_STYLES + wx.richtext.RICHTEXT_ORGANISER_EDIT_STYLES + wx.richtext.RICHTEXT_ORGANISER_RENAME_STYLES + wx.richtext.RICHTEXT_ORGANISER_OK_CANCEL + wx.richtext.RICHTEXT_ORGANISER_RENUMBER + wx.richtext.RICHTEXT_ORGANISER_SHOW_CHARACTER + wx.richtext.RICHTEXT_ORGANISER_SHOW_PARAGRAPH + wx.richtext.RICHTEXT_ORGANISER_SHOW_LIST + wx.richtext.RICHTEXT_ORGANISER_SHOW_BOX + wx.richtext.RICHTEXT_ORGANISER_SHOW_ALL wx.richtext.RICHTEXT_ORGANISER_ORGANISE wx.richtext.RICHTEXT_ORGANISER_BROWSE wx.richtext.RICHTEXT_ORGANISER_BROWSE_NUMBERING - def test_richtextstyledlg2(self): + def test_richtextstyledlg2(self): sheet = wx.richtext.RichTextStyleSheet() rtc = wx.richtext.RichTextCtrl(self.frame) - + dlg = wx.richtext.RichTextStyleOrganiserDialog( wx.richtext.RICHTEXT_ORGANISER_ORGANISE, sheet, rtc, self.frame) dlg.Destroy() - def test_richtextstyledlg3(self): + def test_richtextstyledlg3(self): sheet = wx.richtext.RichTextStyleSheet() rtc = wx.richtext.RichTextCtrl(self.frame) @@ -45,7 +45,7 @@ class richtextstyledlg_Tests(wtc.WidgetTestCase): sheet, rtc, self.frame) dlg.Destroy() - + #--------------------------------------------------------------------------- if __name__ == '__main__': diff --git a/unittests/test_richtextstyles.py b/unittests/test_richtextstyles.py index ef85ac78..0c52c48e 100644 --- a/unittests/test_richtextstyles.py +++ b/unittests/test_richtextstyles.py @@ -19,7 +19,7 @@ class richtextstyles_Tests(wtc.WidgetTestCase): def test_richtextstyles03(self): with self.assertRaises(TypeError): sdef = wx.richtext.RichTextStyleDefinition() - + def test_richtextstyles04(self): sdef = wx.richtext.RichTextParagraphStyleDefinition() @@ -40,7 +40,7 @@ class richtextstyles_Tests(wtc.WidgetTestCase): wx.richtext.RichTextStyleListBox.RICHTEXT_STYLE_CHARACTER wx.richtext.RichTextStyleListBox.RICHTEXT_STYLE_LIST wx.richtext.RichTextStyleListBox.RICHTEXT_STYLE_BOX - + def test_richtextstyles6(self): ctrl = wx.richtext.RichTextStyleComboCtrl(self.frame) @@ -62,7 +62,7 @@ class richtextstyles_Tests(wtc.WidgetTestCase): def test_richtextstyles10(self): sdef = wx.richtext.RichTextStyleSheet() - + #--------------------------------------------------------------------------- if __name__ == '__main__': diff --git a/unittests/test_richtextsymboldlg.py b/unittests/test_richtextsymboldlg.py index 48b1f452..6b64d7d0 100644 --- a/unittests/test_richtextsymboldlg.py +++ b/unittests/test_richtextsymboldlg.py @@ -11,7 +11,7 @@ class richtextsymboldlg_Tests(wtc.WidgetTestCase): dlg = wx.richtext.SymbolPickerDialog('', '', '', self.frame) dlg.Show() dlg.Destroy() - + def test_richtextsymboldlg2(self): dlg = wx.richtext.SymbolPickerDialog() diff --git a/unittests/test_richtextxml.py b/unittests/test_richtextxml.py index 7810cdef..ba0c2268 100644 --- a/unittests/test_richtextxml.py +++ b/unittests/test_richtextxml.py @@ -11,7 +11,7 @@ class richtextxml_Tests(wtc.WidgetTestCase): handler = wx.richtext.RichTextXMLHandler() wx.richtext.RichTextBuffer.AddHandler(handler) - + #--------------------------------------------------------------------------- if __name__ == '__main__': diff --git a/unittests/test_richtooltip.py b/unittests/test_richtooltip.py index 69760ca1..c01a0362 100644 --- a/unittests/test_richtooltip.py +++ b/unittests/test_richtooltip.py @@ -25,8 +25,8 @@ class richtooltip_Tests(wtc.WidgetTestCase): tt.SetTimeout(200) tt.ShowFor(self.frame) self.waitFor(300) - - + + #--------------------------------------------------------------------------- if __name__ == '__main__': diff --git a/unittests/test_sashwin.py b/unittests/test_sashwin.py index 5648f798..cc95bdfe 100644 --- a/unittests/test_sashwin.py +++ b/unittests/test_sashwin.py @@ -20,16 +20,16 @@ class sashwin_Tests(wtc.WidgetTestCase): wx.adv.SASH_NONE wx.adv.SASH_STATUS_OK wx.adv.SASH_STATUS_OUT_OF_RANGE - + wx.adv.wxEVT_SASH_DRAGGED wx.adv.EVT_SASH_DRAGGED - + def test_sashwin2(self): sw = wx.adv.SashWindow(self.frame) def test_sashwin3(self): evt = wx.adv.SashEvent() - + #--------------------------------------------------------------------------- if __name__ == '__main__': diff --git a/unittests/test_scrolbar.py b/unittests/test_scrolbar.py index 1cf2ef56..ed95ea9d 100644 --- a/unittests/test_scrolbar.py +++ b/unittests/test_scrolbar.py @@ -10,13 +10,13 @@ class scrolbar_Tests(wtc.WidgetTestCase): w = wx.ScrollBar(self.frame) w = wx.ScrollBar(self.frame, style=wx.SB_VERTICAL) self.assertTrue(w.IsVertical()) - + def test_scrolbarDefaultCtor(self): w = wx.ScrollBar() w.Create(self.frame) - - + + def test_scrolbarProperties(self): w = wx.ScrollBar(self.frame) w.PageSize @@ -46,7 +46,7 @@ class scrolbar_Tests(wtc.WidgetTestCase): wx.EVT_COMMAND_SCROLL_THUMBTRACK wx.EVT_COMMAND_SCROLL_THUMBRELEASE wx.EVT_COMMAND_SCROLL_CHANGED - + #--------------------------------------------------------------------------- diff --git a/unittests/test_scrolwin.py b/unittests/test_scrolwin.py index 29136535..0ae1df53 100644 --- a/unittests/test_scrolwin.py +++ b/unittests/test_scrolwin.py @@ -9,7 +9,7 @@ class scrolwin_Tests(wtc.WidgetTestCase): def commonBits(self, w): vsize = 750 rate = 20 - + w.SetSize(self.frame.GetClientSize()) w.EnableScrolling(True, True) w.ShowScrollbars(wx.SHOW_SB_ALWAYS, wx.SHOW_SB_ALWAYS) @@ -25,17 +25,17 @@ class scrolwin_Tests(wtc.WidgetTestCase): # also test the Point overloads self.assertEqual(w.CalcScrolledPosition( (0,0) ), (-3*rate,-3*rate)) # pixels self.assertEqual(w.CalcUnscrolledPosition( (0,0) ),(3*rate,3*rate)) # pixels - + def test_scrolwinCtor(self): w = wx.ScrolledWindow(self.frame) self.commonBits(w) - + def test_scrolwinDefaultCtor(self): w = wx.ScrolledWindow() w.Create(self.frame) self.commonBits(w) - + def test_scrolcvsCtor(self): w = wx.ScrolledCanvas(self.frame) self.commonBits(w) @@ -44,9 +44,9 @@ class scrolwin_Tests(wtc.WidgetTestCase): w = wx.ScrolledCanvas() w.Create(self.frame) self.commonBits(w) - + def test_scrolwinOnDraw(self): - + class MyScrolledWin(wx.ScrolledWindow): def __init__(self, *args, **kw): wx.ScrolledWindow.__init__(self, *args, **kw) @@ -56,14 +56,14 @@ class scrolwin_Tests(wtc.WidgetTestCase): sz = dc.GetSize() dc.SetPen(wx.Pen('blue', 3)) dc.DrawLine(0, 0, sz.width, sz.height) - + w = MyScrolledWin(self.frame) self.commonBits(w) w.Refresh() self.myUpdate(w) self.waitFor(100) self.assertTrue(w.flag) # True if OnDraw was called - + #--------------------------------------------------------------------------- diff --git a/unittests/test_settings.py b/unittests/test_settings.py index 12fbd6b2..14beb6d9 100644 --- a/unittests/test_settings.py +++ b/unittests/test_settings.py @@ -47,7 +47,7 @@ class settings_Tests(wtc.WidgetTestCase): wx.SYS_COLOUR_MENUBAR wx.SYS_COLOUR_LISTBOXTEXT wx.SYS_COLOUR_LISTBOXHIGHLIGHTTEXT - + wx.SYS_COLOUR_DESKTOP wx.SYS_COLOUR_3DFACE wx.SYS_COLOUR_3DSHADOW @@ -55,7 +55,7 @@ class settings_Tests(wtc.WidgetTestCase): wx.SYS_COLOUR_3DHIGHLIGHT wx.SYS_COLOUR_3DHILIGHT wx.SYS_COLOUR_FRAMEBK - + wx.SYS_MOUSE_BUTTONS wx.SYS_BORDER_X wx.SYS_BORDER_Y @@ -97,27 +97,27 @@ class settings_Tests(wtc.WidgetTestCase): wx.SYS_CAN_DRAW_FRAME_DECORATIONS wx.SYS_CAN_ICONIZE_FRAME - wx.SYS_TABLET_PRESENT + wx.SYS_TABLET_PRESENT wx.SYS_SCREEN_NONE - + wx.SYS_SCREEN_TINY - wx.SYS_SCREEN_PDA - wx.SYS_SCREEN_SMALL + wx.SYS_SCREEN_PDA + wx.SYS_SCREEN_SMALL wx.SYS_SCREEN_DESKTOP def test_settingsGetFont(self): f = wx.SystemSettings.GetFont(wx.SYS_SYSTEM_FONT) self.assertTrue(isinstance(f, wx.Font)) - + def test_settingsGetColour(self): c = wx.SystemSettings.GetColour(wx.SYS_COLOUR_WINDOW) self.assertTrue(isinstance(c, wx.Colour)) - + def test_settingsGetMetric(self): m = wx.SystemSettings.GetMetric(wx.SYS_BORDER_X) - + #--------------------------------------------------------------------------- if __name__ == '__main__': diff --git a/unittests/test_sizer.py b/unittests/test_sizer.py index 9f0f0642..abd0a36f 100644 --- a/unittests/test_sizer.py +++ b/unittests/test_sizer.py @@ -8,16 +8,16 @@ class sizer_Tests(wtc.WidgetTestCase): def test_sizerBox(self): bs = wx.BoxSizer() - + def test_sizerStatBox(self): sbs1 = wx.StaticBoxSizer(wx.StaticBox(self.frame, label='label'), wx.VERTICAL) sbs2 = wx.StaticBoxSizer(wx.HORIZONTAL, self.frame, 'label') - + def test_sizerGrid(self): gs1 = wx.GridSizer(4, 5, 6) gs2 = wx.GridSizer(4, (5,6)) gs3 = wx.GridSizer(cols=4, hgap=5, vgap=6) - + def test_sizerFlexGrid(self): fgs1 = wx.FlexGridSizer(4, 5, 6) fgs2 = wx.FlexGridSizer(4, (5,6)) @@ -31,33 +31,33 @@ class sizer_Tests(wtc.WidgetTestCase): fgs.AddGrowableCol(3, 2) fgs.AddGrowableRow(2) fgs.RemoveGrowableRow(2) - + self.frame.SetSizer(fgs) self.frame.Layout() - + widths = fgs.GetColWidths() heights = fgs.GetRowHeights() self.assertEqual(4, len(widths)) self.assertEqual(5, len(heights)) - - + + def test_sizer2(self): s = wx.BoxSizer(wx.VERTICAL) s.Add(wx.Panel(self.frame)) s2 = wx.BoxSizer() s.Add(s2) self.frame.SetSizer(s) - + def test_sizerUserData(self): bs = wx.BoxSizer() si = bs.Add(wx.Panel(self.frame), userData="MyData") self.assertTrue(si.GetUserData() == "MyData") - + def test_sizerFlags(self): bs = wx.BoxSizer() - bs.Add(wx.Panel(self.frame), + bs.Add(wx.Panel(self.frame), wx.SizerFlags(2).Border(wx.ALL, 5).Align(wx.ALIGN_RIGHT)) - + def test_sizerAddMany(self): bs = wx.BoxSizer() bs.AddMany([ wx.Panel(self.frame), # item w/o tuple @@ -87,7 +87,7 @@ class sizer_Tests(wtc.WidgetTestCase): bs.Add(w, h, wx.SizerFlags(1)) bs.Add( (w, h), wx.SizerFlags(2) ) bs.Add(wx.Size(w,h), wx.SizerFlags(3)) - + def test_sizerSpacers3(self): bs = wx.BoxSizer() w = 5 @@ -132,8 +132,8 @@ class sizer_Tests(wtc.WidgetTestCase): self.assertTrue(bs) bs.Destroy() self.assertFalse(bs) - - + + #--------------------------------------------------------------------------- diff --git a/unittests/test_slider.py b/unittests/test_slider.py index f1f1a567..83700818 100644 --- a/unittests/test_slider.py +++ b/unittests/test_slider.py @@ -13,17 +13,17 @@ class slider_Tests(wtc.WidgetTestCase): def test_sliderDefaultCtor(self): s = wx.Slider() s.Create(self.frame) - + def test_sliderRange(self): - s = wx.Slider(self.frame) + s = wx.Slider(self.frame) s.SetRange(25, 75) self.assertTrue(s.GetRange() == (25, 75)) self.assertTrue(s.GetMin() == 25) self.assertTrue(s.GetMax() == 75) self.assertTrue(s.Range == (25, 75)) - + def test_sliderRange2(self): - s = wx.Slider(self.frame) + s = wx.Slider(self.frame) s.SetMin(25) s.SetMax(75) self.assertTrue(s.GetRange() == (25, 75)) @@ -31,7 +31,7 @@ class slider_Tests(wtc.WidgetTestCase): self.assertTrue(s.GetMax() == 75) self.assertTrue(s.Range == (25, 75)) - + def test_sliderFlags(self): wx.SL_HORIZONTAL wx.SL_VERTICAL @@ -49,7 +49,7 @@ class slider_Tests(wtc.WidgetTestCase): wx.SL_LABELS def test_sliderProperties(self): - s = wx.Slider(self.frame) + s = wx.Slider(self.frame) s.LineSize s.Max s.Min @@ -60,7 +60,7 @@ class slider_Tests(wtc.WidgetTestCase): s.TickFreq s.Value s.Range - + #--------------------------------------------------------------------------- diff --git a/unittests/test_snglinst.py b/unittests/test_snglinst.py index 72db295e..e4029de7 100644 --- a/unittests/test_snglinst.py +++ b/unittests/test_snglinst.py @@ -9,13 +9,13 @@ class snglinst_Tests(wtc.WidgetTestCase): def test_snglinstCtor(self): si = wx.SingleInstanceChecker('PhoenixUnitTests') si.IsAnotherRunning() - + def test_snglinstDefaultCtor(self): si = wx.SingleInstanceChecker() si.Create('PhoenixUnitTests') si.IsAnotherRunning() - - + + #--------------------------------------------------------------------------- diff --git a/unittests/test_sound.py b/unittests/test_sound.py index 22919de7..596c3693 100644 --- a/unittests/test_sound.py +++ b/unittests/test_sound.py @@ -14,12 +14,12 @@ class sound_Tests(wtc.WidgetTestCase): wx.adv.SOUND_SYNC wx.adv.SOUND_ASYNC wx.adv.SOUND_LOOP - + def test_sound2(self): sound = wx.adv.Sound(wavFile) self.assertTrue(sound.IsOk()) rv = sound.Play(wx.adv.SOUND_SYNC) - + @unittest.skipIf(sys.platform == 'darwin', 'CreateFromBuffer not implemented on Mac') def test_sound3(self): sound = wx.adv.Sound() @@ -32,7 +32,7 @@ class sound_Tests(wtc.WidgetTestCase): def test_sound4(self): rv = wx.adv.Sound.PlaySound(wavFile, wx.adv.SOUND_SYNC) - + #--------------------------------------------------------------------------- if __name__ == '__main__': diff --git a/unittests/test_spinbutt.py b/unittests/test_spinbutt.py index 6edd24b8..7758b9db 100644 --- a/unittests/test_spinbutt.py +++ b/unittests/test_spinbutt.py @@ -8,7 +8,7 @@ class spinbutt_Tests(wtc.WidgetTestCase): def test_spinbuttCtor(self): sb = wx.SpinButton(self.frame) - + def test_spinbuttDefaultCtor(self): sb = wx.SpinButton() sb.Create(self.frame) @@ -19,7 +19,7 @@ class spinbutt_Tests(wtc.WidgetTestCase): sb.Min sb.Value sb.Range - + def test_spinctrlPropertiesInAction(self): sb = wx.SpinButton(self.frame) sb.Max = 75 @@ -29,11 +29,11 @@ class spinbutt_Tests(wtc.WidgetTestCase): self.assertTrue(sb.GetRange() == (25, 75)) self.assertTrue(sb.Range == (25, 75)) self.assertTrue(sb.GetValue() == 50) - - + + def test_spinbuttOther(self): wx.SpinEvent - + wx.EVT_SPIN_UP wx.EVT_SPIN_DOWN wx.EVT_SPIN @@ -45,8 +45,8 @@ class spinbutt_Tests(wtc.WidgetTestCase): wx.SP_VERTICAL wx.SP_ARROW_KEYS wx.SP_WRAP - - + + #--------------------------------------------------------------------------- diff --git a/unittests/test_spinctrl.py b/unittests/test_spinctrl.py index 2249e587..92fbc66a 100644 --- a/unittests/test_spinctrl.py +++ b/unittests/test_spinctrl.py @@ -9,7 +9,7 @@ class spinctrl_Tests(wtc.WidgetTestCase): def test_spinctrlCtor(self): sp = wx.SpinCtrl(self.frame) sp = wx.SpinCtrl(self.frame, value='123') - + def test_spinctrlDefaultCtor(self): sp = wx.SpinCtrl() sp.Create(self.frame) @@ -19,15 +19,15 @@ class spinctrl_Tests(wtc.WidgetTestCase): sp.Max sp.Min sp.Value - + def test_spinctrlDoubleCtor(self): sp = wx.SpinCtrlDouble(self.frame) sp = wx.SpinCtrlDouble(self.frame, value='123') - + def test_spinctrlDoubleDefaultCtor(self): sp = wx.SpinCtrlDouble() sp.Create(self.frame) - + def test_spinctrlDoubleProperties(self): sp = wx.SpinCtrlDouble(self.frame) sp.Max @@ -35,15 +35,15 @@ class spinctrl_Tests(wtc.WidgetTestCase): sp.Value sp.Digits sp.Increment - + def test_spinctrlOther(self): wx.SpinDoubleEvent wx.EVT_SPINCTRL wx.EVT_SPINCTRLDOUBLE wx.wxEVT_COMMAND_SPINCTRL_UPDATED wx.wxEVT_COMMAND_SPINCTRLDOUBLE_UPDATED - - + + #--------------------------------------------------------------------------- diff --git a/unittests/test_splash.py b/unittests/test_splash.py index 6e89f9bd..598a28da 100644 --- a/unittests/test_splash.py +++ b/unittests/test_splash.py @@ -19,14 +19,14 @@ class splash_Tests(wtc.WidgetTestCase): wx.adv.SPLASH_CENTER_ON_PARENT wx.adv.SPLASH_CENTER_ON_SCREEN wx.adv.SPLASH_NO_CENTER - - + + def test_splash2(self): - splash = wx.adv.SplashScreen(wx.Bitmap(pngFile), + splash = wx.adv.SplashScreen(wx.Bitmap(pngFile), wx.adv.SPLASH_TIMEOUT|wx.adv.SPLASH_CENTRE_ON_SCREEN, 250, self.frame) self.waitFor(300) - + #--------------------------------------------------------------------------- if __name__ == '__main__': diff --git a/unittests/test_splitter.py b/unittests/test_splitter.py index d1dc1ed7..bcb9d1fb 100644 --- a/unittests/test_splitter.py +++ b/unittests/test_splitter.py @@ -8,11 +8,11 @@ class splitter_Tests(wtc.WidgetTestCase): def test_splitterCtor(self): sw = wx.SplitterWindow(self.frame) - + def test_splitterDefaultCtor(self): sw = wx.SplitterWindow() sw.Create(self.frame) - + def test_splitterSplits(self): sw = wx.SplitterWindow(self.frame) sw.SplitHorizontally(wx.Window(sw), wx.Window(sw)) @@ -23,7 +23,7 @@ class splitter_Tests(wtc.WidgetTestCase): def test_splitterProperties(self): sw = wx.SplitterWindow(self.frame) - + # just checks if they exist sw.MinimumPaneSize sw.SashGravity @@ -33,8 +33,8 @@ class splitter_Tests(wtc.WidgetTestCase): sw.Window1 sw.Window2 sw.SashInvisible - - + + def test_splitterFlags(self): wx.SP_NOBORDER wx.SP_THIN_SASH @@ -52,14 +52,14 @@ class splitter_Tests(wtc.WidgetTestCase): wx.wxEVT_COMMAND_SPLITTER_SASH_POS_CHANGING wx.wxEVT_COMMAND_SPLITTER_DOUBLECLICKED wx.wxEVT_COMMAND_SPLITTER_UNSPLIT - + wx.EVT_SPLITTER_SASH_POS_CHANGED wx.EVT_SPLITTER_SASH_POS_CHANGING wx.EVT_SPLITTER_DOUBLECLICKED wx.EVT_SPLITTER_UNSPLIT wx.EVT_SPLITTER_DCLICK - - + + #--------------------------------------------------------------------------- diff --git a/unittests/test_srchctrl.py b/unittests/test_srchctrl.py index 69e33439..61efde5c 100644 --- a/unittests/test_srchctrl.py +++ b/unittests/test_srchctrl.py @@ -12,32 +12,32 @@ class srchctrl_Tests(wtc.WidgetTestCase): def test_srchctrlDefaultCtor(self): t = wx.SearchCtrl() t.Create(self.frame) - + def test_srchctrlProperties(self): t = wx.SearchCtrl(self.frame) t.Menu t.SearchButtonVisible t.CancelButtonVisible t.DescriptiveText - + # these are grafted-on methods, just make sure that they are there t.SetSearchBitmap t.SetSearchMenuBitmap t.SetCancelBitmap - + def test_srchctrlEventBinding(self): t = wx.SearchCtrl(self.frame) self.frame.Bind(wx.EVT_SEARCHCTRL_CANCEL_BTN, lambda e: None, t) self.frame.Bind(wx.EVT_SEARCHCTRL_SEARCH_BTN, lambda e: None, t) - + def test_srchctrlGetSetValue(self): t = wx.SearchCtrl(self.frame) t.SetValue('Hello') self.assertEqual(t.GetValue(), 'Hello') self.assertEqual(t.Value, 'Hello') - - + + def test_srchctrlHasTextCtrlMethods(self): # Just ensure that the common TextCtrl methods are present. This is # done because although the C++ class either derives from wxTextCtrl @@ -57,9 +57,9 @@ class srchctrl_Tests(wtc.WidgetTestCase): t.AppendText t.WriteText t.ChangeValue - - - + + + #--------------------------------------------------------------------------- diff --git a/unittests/test_statbmp.py b/unittests/test_statbmp.py index e2d3ba01..b480daf7 100644 --- a/unittests/test_statbmp.py +++ b/unittests/test_statbmp.py @@ -15,23 +15,23 @@ class statbmp_Tests(wtc.WidgetTestCase): bmp = wx.Bitmap(pngFile) sb = wx.StaticBitmap(self.frame, -1, bmp) sb = wx.StaticBitmap(self.frame, label=bmp) - - + + def test_statbmpDefaultCtor(self): bmp = wx.Bitmap(pngFile) sb = wx.StaticBitmap() sb.Create(self.frame, -1, bmp) - + def test_statbmpProperties(self): bmp = wx.Bitmap(pngFile) sb = wx.StaticBitmap(self.frame, label=bmp) - + sb.Bitmap sb.Bitmap = wx.Bitmap(pngFile2) - + #sb.Icon # TODO: this asserts if SetIcon hasn't been called - + #--------------------------------------------------------------------------- diff --git a/unittests/test_statbox.py b/unittests/test_statbox.py index 5989f338..bc02406a 100644 --- a/unittests/test_statbox.py +++ b/unittests/test_statbox.py @@ -12,8 +12,8 @@ class statbox_Tests(wtc.WidgetTestCase): def test_statboxDefaultCtor(self): s = wx.StaticBox() s.Create(self.frame, label='StaticBox') - - + + #--------------------------------------------------------------------------- diff --git a/unittests/test_statline.py b/unittests/test_statline.py index 740305ff..3099d0f7 100644 --- a/unittests/test_statline.py +++ b/unittests/test_statline.py @@ -9,13 +9,13 @@ class statline_Tests(wtc.WidgetTestCase): def test_statlineCtor(self): sl = wx.StaticLine(self.frame) sl = wx.StaticLine(self.frame, style=wx.LI_VERTICAL) - - + + def test_statlineDefaultCtor(self): sl = wx.StaticLine() sl.Create(self.frame, style=wx.LI_VERTICAL) - - + + #--------------------------------------------------------------------------- diff --git a/unittests/test_stattext.py b/unittests/test_stattext.py index 82d4e68a..c08d8b7c 100644 --- a/unittests/test_stattext.py +++ b/unittests/test_stattext.py @@ -16,14 +16,14 @@ class stattext_Tests(wtc.WidgetTestCase): def test_stattextCtor(self): t = wx.StaticText(self.frame, -1, "static text label") t = wx.StaticText(self.frame, label='label', style=wx.ST_NO_AUTORESIZE) - - + + def test_stattextDefaultCtor(self): t = wx.StaticText() t.Create(self.frame) - - + + #--------------------------------------------------------------------------- diff --git a/unittests/test_statusbar.py b/unittests/test_statusbar.py index 5fce5fc8..2de90b29 100644 --- a/unittests/test_statusbar.py +++ b/unittests/test_statusbar.py @@ -19,8 +19,8 @@ class statusbar_Tests(wtc.WidgetTestCase): def test_statusbarCtor(self): - sb = wx.StatusBar(self.frame) - + sb = wx.StatusBar(self.frame) + def test_statusbarDefaultCtor(self): sb = wx.StatusBar() sb.Create(self.frame) @@ -50,13 +50,13 @@ class statusbar_Tests(wtc.WidgetTestCase): sb.SetFieldsCount(num) self.sbCreated = True return sb - + frm = MyFrame(self.frame) frm.CreateStatusBar() self.assertTrue(frm.sbCreated) frm.Show() - + def test_statusbarStatusBarPane(self): sb = self.frame.CreateStatusBar(number=2) pane = sb.GetField(0) @@ -64,44 +64,44 @@ class statusbar_Tests(wtc.WidgetTestCase): pane.Width pane.Style pane.Text - - + + def test_statusbarWidths1(self): sb = wx.StatusBar(self.frame) sb.SetFieldsCount(3) sb.SetStatusWidths([200, -1, 100]) self.frame.SetStatusBar(sb) - + self.frame.SendSizeEvent() self.myYield() - + widths = [sb.GetStatusWidth(i) for i in range(sb.GetFieldsCount())] self.assertEqual(widths, [200, -1, 100]) - - + + def test_statusbarWidths2(self): sb = self.frame.CreateStatusBar(3) self.frame.SetStatusWidths([200, -1, 100]) - + self.frame.SendSizeEvent() self.myYield() - + widths = [sb.GetStatusWidth(i) for i in range(sb.GetFieldsCount())] self.assertEqual(widths, [200, -1, 100]) - - + + def test_statusbarWidths3(self): sb = wx.StatusBar(self.frame) sb.SetFieldsCount(3, [200, -1, 100]) self.frame.SetStatusBar(sb) - + self.frame.SendSizeEvent() self.myYield() - + widths = [sb.GetStatusWidth(i) for i in range(sb.GetFieldsCount())] self.assertEqual(widths, [200, -1, 100]) - - + + def test_statusbarGetFielRect(self): # Test that GetFieldRect has been tweaked to be compatible with Classic sb = self.frame.CreateStatusBar(3) @@ -117,14 +117,14 @@ class statusbar_Tests(wtc.WidgetTestCase): styles = [wx.SB_NORMAL, wx.SB_FLAT, wx.SB_RAISED, wx.SB_SUNKEN] sb.SetStatusStyles(styles) self.frame.SetStatusBar(sb) - + self.frame.SendSizeEvent() self.myYield() - + current = [sb.GetStatusStyle(i) for i in range(sb.GetFieldsCount())] self.assertEqual(current, styles) - - + + #--------------------------------------------------------------------------- diff --git a/unittests/test_stc.py b/unittests/test_stc.py index 95272b05..f66ee00c 100644 --- a/unittests/test_stc.py +++ b/unittests/test_stc.py @@ -34,13 +34,13 @@ class stc_Tests(wtc.WidgetTestCase): def test_stcDefaultCtor(self): ed = stc.StyledTextCtrl() ed.Create(self.frame) - + def test_stcStyleTextCtrl1(self): ed = stc.StyledTextCtrl(self.frame) ed.SetText(text) ed.EmptyUndoBuffer() ed.GotoPos(0) - + ed.SetMarginType(1, stc.STC_MARGIN_SYMBOL) ed.MarkerDefine(0, stc.STC_MARK_ROUNDRECT, "#CCFF00", "RED") ed.MarkerDefine(1, stc.STC_MARK_CIRCLE, "FOREST GREEN", "SIENNA") @@ -52,7 +52,7 @@ class stc_Tests(wtc.WidgetTestCase): ed.MarkerAdd(4, 3) ed.MarkerAdd(5, 0) - + def test_stcStyleTextCtrl2(self): ed = stc.StyledTextCtrl(self.frame) ed.SetText(text) @@ -64,7 +64,7 @@ class stc_Tests(wtc.WidgetTestCase): ed.IndicatorSetStyle(1, stc.STC_INDIC_DIAGONAL) ed.IndicatorSetForeground(1, wx.BLUE) ed.IndicatorSetStyle(2, stc.STC_INDIC_STRIKE) - ed.IndicatorSetForeground(2, wx.RED) + ed.IndicatorSetForeground(2, wx.RED) ed.StartStyling(100, stc.STC_INDICS_MASK) ed.SetStyling(10, stc.STC_INDIC0_MASK) ed.SetStyling(8, stc.STC_INDIC1_MASK) @@ -76,7 +76,7 @@ class stc_Tests(wtc.WidgetTestCase): ed.SetText(text) ed.EmptyUndoBuffer() ed.GotoPos(0) - + ed.StyleSetSpec(stc.STC_STYLE_DEFAULT, "size:%d,face:%s" % (pb, face3)) ed.StyleClearAll() ed.StyleSetSpec(1, "size:%d,bold,face:%s,fore:#0000FF" % (pb, face1)) @@ -85,15 +85,15 @@ class stc_Tests(wtc.WidgetTestCase): ed.StyleSetSpec(4, "face:%s,size:%d" % (face1, pb-1)) ed.StyleSetSpec(5, "back:#FFF0F0") ed.StartStyling(80, 0xff) - ed.SetStyling(6, 1) + ed.SetStyling(6, 1) ed.StartStyling(100, 0xff) ed.SetStyling(20, 2) ed.StartStyling(180, 0xff) ed.SetStyling(4, 3) ed.SetStyling(2, 0) ed.SetStyling(10, 4) - - + + def test_stcStyleTextCtrl5(self): ed = stc.StyledTextCtrl(self.frame) ed.SetText(text) @@ -103,7 +103,7 @@ class stc_Tests(wtc.WidgetTestCase): ed.SetMarginType(0, stc.STC_MARGIN_NUMBER) ed.SetMarginWidth(0, 22) ed.StyleSetSpec(stc.STC_STYLE_LINENUMBER, "size:%d,face:%s" % (pb-2, face1)) - + def test_stcStyleTextCtrl6(self): ed = stc.StyledTextCtrl(self.frame) @@ -113,15 +113,15 @@ class stc_Tests(wtc.WidgetTestCase): textbytes = ed.GetStyledText(100,150) self.assertTrue(isinstance(textbytes, memoryview)) - + pointer = ed.GetCharacterPointer() self.assertTrue(isinstance(pointer, memoryview)) - + line, pos = ed.GetCurLine() self.assertTrue(len(line) != 0) self.assertTrue(isinstance(pos, int)) - - + + def test_stcStyleTextCtrl8(self): ed = stc.StyledTextCtrl(self.frame) ed.SetText(text) @@ -130,17 +130,17 @@ class stc_Tests(wtc.WidgetTestCase): raw = ed.GetLineRaw(5) self.assertTrue(isinstance(raw, bytes)) - + ed.AddTextRaw(b"some new text") - - - + + + def test_stcStyleTextCtrlConstantsExist(self): # This is not even close to the full set of constants in the module, # but just a represenative few to help ensure that the code # generation is continuing to do what it is supposed to be doing. stc.STC_P_DEFAULT - stc.STC_P_DECORATOR + stc.STC_P_DECORATOR stc.STC_KEY_DOWN stc.STC_MARK_CIRCLE stc.STC_MARGIN_NUMBER @@ -151,11 +151,11 @@ class stc_Tests(wtc.WidgetTestCase): stc.STC_CMD_REDO stc.STC_CMD_LINEENDEXTEND stc.STC_CMD_PARADOWN - - + + def test_stcEvent(self): evt = stc.StyledTextEvent(stc.wxEVT_STC_CHANGE) - + def test_stcEventConstantsExist(self): stc.wxEVT_STC_CHANGE stc.wxEVT_STC_STYLENEEDED @@ -189,7 +189,7 @@ class stc_Tests(wtc.WidgetTestCase): stc.wxEVT_STC_AUTOCOMP_CANCELLED stc.wxEVT_STC_AUTOCOMP_CHAR_DELETED stc.wxEVT_STC_HOTSPOT_RELEASE_CLICK - + def test_stcEventBinderssExist(self): stc.EVT_STC_CHANGE stc.EVT_STC_STYLENEEDED @@ -243,9 +243,9 @@ class stc_Tests(wtc.WidgetTestCase): t.AppendText t.WriteText t.ChangeValue - - - + + + #--------------------------------------------------------------------------- diff --git a/unittests/test_stdpaths.py b/unittests/test_stdpaths.py index 1ef92ea3..02b8eafb 100644 --- a/unittests/test_stdpaths.py +++ b/unittests/test_stdpaths.py @@ -25,8 +25,8 @@ class stdpaths_Tests(wtc.WidgetTestCase): sp.GetUserLocalDataDir() sp.SetInstallPrefix('/opt/foo') sp.GetLocalizedResourcesDir('fr') - - + + #--------------------------------------------------------------------------- diff --git a/unittests/test_stockgdi.py b/unittests/test_stockgdi.py index 09de26cc..44826ffe 100644 --- a/unittests/test_stockgdi.py +++ b/unittests/test_stockgdi.py @@ -12,7 +12,7 @@ class stockgdi_Tests(wtc.WidgetTestCase): wx.SMALL_FONT, wx.SWISS_FONT, wx.ITALIC_FONT, - + wx.BLACK_DASHED_PEN, wx.BLACK_PEN, wx.BLUE_PEN, @@ -52,21 +52,21 @@ class stockgdi_Tests(wtc.WidgetTestCase): wx.STANDARD_CURSOR, ]: self.assertTrue(item.IsOk()) - + def test_stockgdi2(self): wx.TheFontList wx.ThePenList wx.TheBrushList wx.TheColourDatabase - + def test_stockgdi3(self): b = wx.StockGDI.GetBrush(wx.StockGDI.BRUSH_GREEN) clr = wx.StockGDI.GetColour(wx.StockGDI.COLOUR_YELLOW) cur = wx.StockGDI.GetCursor(wx.StockGDI.CURSOR_HOURGLASS) p = wx.StockGDI.GetPen(wx.StockGDI.PEN_RED) f = wx.StockGDI.instance().GetFont(wx.StockGDI.FONT_NORMAL) - + #--------------------------------------------------------------------------- diff --git a/unittests/test_stockitem.py b/unittests/test_stockitem.py index 751eb41a..83f857c7 100644 --- a/unittests/test_stockitem.py +++ b/unittests/test_stockitem.py @@ -9,7 +9,7 @@ class stockitem_Tests(wtc.WidgetTestCase): # TODO: Remove this test and add real ones. def test_stockitem1(self): self.fail("Unit tests for stockitem not implemented yet.") - + #--------------------------------------------------------------------------- if __name__ == '__main__': diff --git a/unittests/test_stopwatch.py b/unittests/test_stopwatch.py index 98f029bb..6675f07b 100644 --- a/unittests/test_stopwatch.py +++ b/unittests/test_stopwatch.py @@ -11,8 +11,8 @@ class stopwatch_Tests(wtc.WidgetTestCase): self.waitFor(1000) t = sw.Time() self.assertTrue(t > 900) - - + + #--------------------------------------------------------------------------- if __name__ == '__main__': diff --git a/unittests/test_stream.py b/unittests/test_stream.py index 19404c85..e19042d5 100644 --- a/unittests/test_stream.py +++ b/unittests/test_stream.py @@ -15,16 +15,16 @@ class stream_Tests(wtc.WidgetTestCase): def test_inputStreamParam(self): # This tests being able to pass a Python file-like object to a # wrapped function expecting a wxInputStream. - + # First, load the image data into a StringIO object with open(pngFile, 'rb') as f: stream = FileLikeObject(f.read()) - - + + # Then use it to create a wx.Image img = wx.Image(stream) self.assertTrue(img.IsOk()) - + def test_outputStreamParam(self): # This tests being able to pass a Python file-like object to a # wrapped function expecting a wxOutputStream. @@ -33,13 +33,13 @@ class stream_Tests(wtc.WidgetTestCase): stream = FileLikeObject() image.SaveFile(stream, wx.BITMAP_TYPE_PNG) del image - - stream = FileLikeObject(stream.getvalue()) + + stream = FileLikeObject(stream.getvalue()) image = wx.Image(stream) self.assertTrue(image.IsOk()) - - - + + + #--------------------------------------------------------------------------- diff --git a/unittests/test_string.py b/unittests/test_string.py index 300501da..e75dc2bf 100644 --- a/unittests/test_string.py +++ b/unittests/test_string.py @@ -5,56 +5,56 @@ from unittests import wtc #--------------------------------------------------------------------------- - + class String(unittest.TestCase): - + if hasattr(wx, 'testStringTypemap'): - if not six.PY3: + if not six.PY3: def test_StringTypemapsPy2(self): utf = '\xc3\xa9l\xc3\xa9phant' # utf-8 string uni = utf.decode('utf-8') # convert to unicode iso = uni.encode('iso-8859-1') # make a string with a different encoding - - + + # wx.testStringTypemap() will accept a parameter that # is a Unicode object or an 'ascii' or 'utf-8' string object, # which will then be converted to a wxString. The return # value is a Unicode object that has been converted from a # wxString that is a copy of the wxString created for the # parameter. - + # ascii result = wx.testStringTypemap('hello') self.assertTrue(type(result) == unicode) self.assertTrue(result == unicode('hello')) - + # unicode should pass through unmodified result = wx.testStringTypemap(uni) self.assertTrue(result == uni) - + # utf-8 is converted result = wx.testStringTypemap(utf) self.assertTrue(result == uni) - + # can't auto-convert this with self.assertRaises(UnicodeDecodeError): result = wx.testStringTypemap(iso) - + # utf-16-be val = "\x00\xe9\x00l\x00\xe9\x00p\x00h\x00a\x00n\x00t" with self.assertRaises(UnicodeDecodeError): result = wx.testStringTypemap(val) result = wx.testStringTypemap( val.decode('utf-16-be')) self.assertTrue(result == uni) - + # utf-32-be val = "\x00\x00\x00\xe9\x00\x00\x00l\x00\x00\x00\xe9\x00\x00\x00p\x00\x00\x00h\x00\x00\x00a\x00\x00\x00n\x00\x00\x00t" with self.assertRaises(UnicodeDecodeError): result = wx.testStringTypemap(val) result = wx.testStringTypemap(val.decode('utf-32-be')) self.assertTrue(result == uni) - + # utf-8 with BOM #val = "\xef\xbb\xbfHello" #result = wx.testStringTypemap(val) @@ -65,25 +65,25 @@ class String(unittest.TestCase): utf = b'\xc3\xa9l\xc3\xa9phant' # utf-8 bytes uni = utf.decode('utf-8') # convert to unicode iso = uni.encode('iso-8859-1') # make a string with a different encoding - + # ascii result = wx.testStringTypemap(b'hello') self.assertTrue(type(result) == str) self.assertTrue(result == 'hello') - + # unicode should pass through unmodified result = wx.testStringTypemap(uni) self.assertTrue(result == uni) - + # utf-8 is converted result = wx.testStringTypemap(utf) self.assertTrue(result == uni) - + # can't auto-convert this with self.assertRaises(UnicodeDecodeError): result = wx.testStringTypemap(iso) - - + + #--------------------------------------------------------------------------- diff --git a/unittests/test_sysopt.py b/unittests/test_sysopt.py index dcab3cb7..9f96bb1c 100644 --- a/unittests/test_sysopt.py +++ b/unittests/test_sysopt.py @@ -13,7 +13,7 @@ class sysopt_Tests(wtc.WidgetTestCase): wx.SystemOptions.GetOptionInt(opt) wx.SystemOptions.SetOption(opt, 123) wx.SystemOptions.SetOption(opt, val) - + #--------------------------------------------------------------------------- if __name__ == '__main__': diff --git a/unittests/test_taskbar.py b/unittests/test_taskbar.py index 4b2756dc..20751271 100644 --- a/unittests/test_taskbar.py +++ b/unittests/test_taskbar.py @@ -16,15 +16,15 @@ class taskbar_Tests(wtc.WidgetTestCase): self.assertTrue(icon.IsOk()) icon.Destroy() self.myYield() - - + + def test_taskbar2(self): wx.adv.TBI_DOCK wx.adv.TBI_CUSTOM_STATUSITEM wx.adv.TBI_DEFAULT_TYPE - + wx.adv.TaskBarIconEvent - + wx.adv.wxEVT_TASKBAR_MOVE wx.adv.wxEVT_TASKBAR_LEFT_DOWN wx.adv.wxEVT_TASKBAR_LEFT_UP @@ -35,7 +35,7 @@ class taskbar_Tests(wtc.WidgetTestCase): wx.adv.wxEVT_TASKBAR_CLICK wx.adv.wxEVT_TASKBAR_BALLOON_TIMEOUT wx.adv.wxEVT_TASKBAR_BALLOON_CLICK - + #--------------------------------------------------------------------------- if __name__ == '__main__': diff --git a/unittests/test_textctrl.py b/unittests/test_textctrl.py index 76209f67..c5e30bc8 100644 --- a/unittests/test_textctrl.py +++ b/unittests/test_textctrl.py @@ -32,16 +32,16 @@ class textctrl_Tests(wtc.WidgetTestCase): t = wx.TextCtrl(self.frame, style=wx.TE_READONLY) t = wx.TextCtrl(self.frame, style=wx.TE_PASSWORD) t = wx.TextCtrl(self.frame, style=wx.TE_MULTILINE) - + def test_textctrlDefaultCtor(self): t = wx.TextCtrl() t.Create(self.frame) - - + + def test_textctrlProperties(self): t = wx.TextCtrl(self.frame) - + t.DefaultStyle t.NumberOfLines t.Hint @@ -56,7 +56,7 @@ class textctrl_Tests(wtc.WidgetTestCase): ta = wx.TextAttr() ta2 = wx.TextAttr(ta) ta3 = wx.TextAttr('black', 'white', wx.NORMAL_FONT, wx.TEXT_ALIGNMENT_RIGHT) - + def test_textctrlTextAttrProperties(self): ta = wx.TextAttr() diff --git a/unittests/test_textdlg.py b/unittests/test_textdlg.py index 226e995a..b8d4e19f 100644 --- a/unittests/test_textdlg.py +++ b/unittests/test_textdlg.py @@ -11,13 +11,13 @@ class textdlg_Tests(wtc.WidgetTestCase): dlg.SetValue("Hello") self.assertEqual(dlg.Value, "Hello") dlg.Destroy() - + def test_textdlg2(self): dlg = wx.PasswordEntryDialog(None, "Message", "Caption", "Value") dlg.SetValue("Hello") self.assertEqual(dlg.Value, "Hello") dlg.Destroy() - + #--------------------------------------------------------------------------- if __name__ == '__main__': diff --git a/unittests/test_tglbtn.py b/unittests/test_tglbtn.py index e85c2536..cef0a53b 100644 --- a/unittests/test_tglbtn.py +++ b/unittests/test_tglbtn.py @@ -8,23 +8,23 @@ pngFile = os.path.join(os.path.dirname(__file__), 'toucan.png') #--------------------------------------------------------------------------- class tglbtn_Tests(wtc.WidgetTestCase): - + def test_tglbtnCtors(self): btn = wx.ToggleButton(self.frame, label='label') btn = wx.ToggleButton(self.frame, -1, 'label', (10,10), (100,-1), wx.BU_LEFT) bmp = wx.Bitmap(pngFile) btn.SetBitmap(bmp) - - + + def test_ButtonDefaultCtor(self): btn = wx.ToggleButton() btn.Create(self.frame, -1, 'button label') - - + + def test_ButtonDefaultEvt(self): wx.wxEVT_COMMAND_TOGGLEBUTTON_CLICKED wx.EVT_TOGGLEBUTTON - + #--------------------------------------------------------------------------- diff --git a/unittests/test_timectrl.py b/unittests/test_timectrl.py index 213ec4b3..d91b7917 100644 --- a/unittests/test_timectrl.py +++ b/unittests/test_timectrl.py @@ -15,8 +15,8 @@ class timectrl_Tests(wtc.WidgetTestCase): tc.SetTime(12, 34, 59) h, m, s = tc.GetTime() self.assertEqual( (h, m, s), (12, 34, 59) ) - - + + #--------------------------------------------------------------------------- if __name__ == '__main__': diff --git a/unittests/test_timer.py b/unittests/test_timer.py index c2fa56c7..1e29147c 100644 --- a/unittests/test_timer.py +++ b/unittests/test_timer.py @@ -5,11 +5,11 @@ import wx #--------------------------------------------------------------------------- class timer_Tests(wtc.WidgetTestCase): - + def onTimerEvt(self, *evt): self.flag = True - + def test_timerOwner1(self): t = wx.Timer(self.frame) self.flag = False @@ -25,18 +25,18 @@ class timer_Tests(wtc.WidgetTestCase): self.frame.Bind(wx.EVT_TIMER, self.onTimerEvt, t) t.Start(1000, wx.TIMER_ONE_SHOT) # timer will not have expired yet by this time, so flag shouldn't be set - self.waitFor(500) + self.waitFor(500) self.assertFalse(self.flag) - - + + def test_timerPyTimer(self): t = wx.PyTimer(self.onTimerEvt) self.flag = False t.Start(250, wx.TIMER_ONE_SHOT) self.waitFor(500) self.assertTrue(self.flag) - - + + def test_timerDerivedClass(self): class MyTimer(wx.Timer): def __init__(self): @@ -49,12 +49,12 @@ class timer_Tests(wtc.WidgetTestCase): t.Start(250, wx.TIMER_ONE_SHOT) self.waitFor(500) self.assertTrue(t.flag) - - + + def onCallLater(self): self.flag = True return 1234 - + def test_timerCallLater1(self): # simple CallLater usage wx.CallLater(150, self.onCallLater) @@ -73,9 +73,9 @@ class timer_Tests(wtc.WidgetTestCase): cl.Restart() self.waitFor(500) self.assertTrue(self.flag) - - + + #--------------------------------------------------------------------------- diff --git a/unittests/test_tipdlg.py b/unittests/test_tipdlg.py index 9ceaad46..d8d812b7 100644 --- a/unittests/test_tipdlg.py +++ b/unittests/test_tipdlg.py @@ -15,19 +15,19 @@ class tipdlg_Tests(wtc.WidgetTestCase): wx.CallLater(150, self.closeDialogs) wx.adv.ShowTip(self.frame, tp) self.myYield() - - + + def test_tipdlg2(self): class MyTipProvider(wx.adv.TipProvider): def GetTip(self): return "This is my tip" - + wx.CallLater(150, self.closeDialogs) wx.adv.ShowTip(self.frame, MyTipProvider(0)) self.myYield() - - + + #--------------------------------------------------------------------------- if __name__ == '__main__': diff --git a/unittests/test_tipwin.py b/unittests/test_tipwin.py index 50e3d3cf..56e02d8e 100644 --- a/unittests/test_tipwin.py +++ b/unittests/test_tipwin.py @@ -14,8 +14,8 @@ class tipwin_Tests(wtc.WidgetTestCase): self.waitFor(100) w.Close() - - + + #--------------------------------------------------------------------------- diff --git a/unittests/test_toolbar.py b/unittests/test_toolbar.py index e0a6dda1..fb79d6d0 100644 --- a/unittests/test_toolbar.py +++ b/unittests/test_toolbar.py @@ -17,14 +17,14 @@ class toolbar_Tests(wtc.WidgetTestCase): wx.TOOL_STYLE_BUTTON wx.TOOL_STYLE_SEPARATOR wx.TOOL_STYLE_CONTROL - + wx.TB_HORIZONTAL wx.TB_VERTICAL wx.TB_TOP wx.TB_LEFT wx.TB_BOTTOM wx.TB_RIGHT - + wx.TB_3DBUTTONS wx.TB_FLAT wx.TB_DOCKABLE @@ -45,7 +45,7 @@ class toolbar_Tests(wtc.WidgetTestCase): tools = [] for bmp in bmps: tool = tb.AddTool(-1, 'label', bmp) - self.assertTrue(isinstance(tool, wx.ToolBarToolBase)) + self.assertTrue(isinstance(tool, wx.ToolBarToolBase)) tools.append(tool) tb.Realize() return tools @@ -53,17 +53,17 @@ class toolbar_Tests(wtc.WidgetTestCase): def test_toolbar1(self): tb = wx.ToolBar(self.frame) - self._populateToolBar(tb) + self._populateToolBar(tb) self.frame.SetToolBar(tb) def test_toolbar2(self): tb = self.frame.CreateToolBar() - self._populateToolBar(tb) + self._populateToolBar(tb) def test_toolbarClientData1(self): tb = self.frame.CreateToolBar() - tools = self._populateToolBar(tb) + tools = self._populateToolBar(tb) # testing client data via the tool object tool = tools[0] data = "Hobo Joe Is Cool" @@ -79,7 +79,7 @@ class toolbar_Tests(wtc.WidgetTestCase): def test_toolbarClientData2(self): tb = self.frame.CreateToolBar() assert isinstance(tb, wx.ToolBar) - tools = self._populateToolBar(tb) + tools = self._populateToolBar(tb) # testing client data via the toolbar toolId = tools[0].GetId() data = "Hobo Joe Is Cool" @@ -90,9 +90,9 @@ class toolbar_Tests(wtc.WidgetTestCase): def test_toolbarTools1(self): tb = self.frame.CreateToolBar() - tools = self._populateToolBar(tb) + tools = self._populateToolBar(tb) tool = tools[0] - + # Tool properties tool.Bitmap tool.ClientData @@ -111,14 +111,14 @@ class toolbar_Tests(wtc.WidgetTestCase): def test_toolbarTools2(self): tb = self.frame.CreateToolBar() - tools = self._populateToolBar(tb) + tools = self._populateToolBar(tb) tool = tools[0] self.assertEqual(tool.GetToolBar(), tb) - + tool = tb.FindById(tools[1].GetId()) self.assertEqual(tool.GetToolBar(), tb) - - + + #--------------------------------------------------------------------------- diff --git a/unittests/test_toolbook.py b/unittests/test_toolbook.py index 6d750d4e..e18588ee 100644 --- a/unittests/test_toolbook.py +++ b/unittests/test_toolbook.py @@ -16,18 +16,18 @@ class toolbook_Tests(wtc.WidgetTestCase): def test_toolbook1(self): wx.TBK_BUTTONBAR wx.TBK_HORZ_LAYOUT - + wx.wxEVT_COMMAND_TOOLBOOK_PAGE_CHANGED wx.wxEVT_COMMAND_TOOLBOOK_PAGE_CHANGING wx.EVT_TOOLBOOK_PAGE_CHANGED wx.EVT_TOOLBOOK_PAGE_CHANGING - + def test_toolbook2(self): book = wx.Toolbook() book.Create(self.frame) - - + + def test_toolbook3(self): book = wx.Toolbook(self.frame) @@ -45,7 +45,7 @@ class toolbook_Tests(wtc.WidgetTestCase): self.myYield() - + #--------------------------------------------------------------------------- if __name__ == '__main__': diff --git a/unittests/test_tooltip.py b/unittests/test_tooltip.py index ee511388..1259696b 100644 --- a/unittests/test_tooltip.py +++ b/unittests/test_tooltip.py @@ -7,21 +7,21 @@ import os #--------------------------------------------------------------------------- class tooltip_Tests(wtc.WidgetTestCase): - + def test_tooltip(self): tip = wx.ToolTip('help message') self.frame.SetToolTip(tip) tip.Tip tip.Window tip.Tip = 'new help message' - + def test_tooltipStatics(self): wx.ToolTip.Enable(True) wx.ToolTip.SetAutoPop(2000) wx.ToolTip.SetDelay(2000) wx.ToolTip.SetMaxWidth(500) wx.ToolTip.SetReshow(2000) - + #--------------------------------------------------------------------------- diff --git a/unittests/test_translation.py b/unittests/test_translation.py index ce4e651a..5561fa6b 100644 --- a/unittests/test_translation.py +++ b/unittests/test_translation.py @@ -9,7 +9,7 @@ class translation_Tests(wtc.WidgetTestCase): def test_translation1(self): ldr = wx.FileTranslationsLoader() wx.GetTranslation('hello') - + #--------------------------------------------------------------------------- if __name__ == '__main__': diff --git a/unittests/test_treebook.py b/unittests/test_treebook.py index 877a477e..8507b4c1 100644 --- a/unittests/test_treebook.py +++ b/unittests/test_treebook.py @@ -11,25 +11,25 @@ class treebook_Tests(wtc.WidgetTestCase): wx.wxEVT_COMMAND_TREEBOOK_PAGE_CHANGING wx.wxEVT_COMMAND_TREEBOOK_NODE_COLLAPSED wx.wxEVT_COMMAND_TREEBOOK_NODE_EXPANDED - + wx.EVT_TREEBOOK_PAGE_CHANGED wx.EVT_TREEBOOK_PAGE_CHANGING; wx.EVT_TREEBOOK_NODE_COLLAPSED; wx.EVT_TREEBOOK_NODE_EXPANDED; - + def test_treebook2(self): book = wx.Treebook() book.Create(self.frame) - - + + def test_treebook3(self): book = wx.Treebook(self.frame) book.AddPage(wx.Panel(book), 'one') book.AddPage(wx.Panel(book), 'two') book.AddSubPage(wx.Panel(book), 'three') - + #--------------------------------------------------------------------------- if __name__ == '__main__': diff --git a/unittests/test_treectrl.py b/unittests/test_treectrl.py index 178d6e96..a1750481 100644 --- a/unittests/test_treectrl.py +++ b/unittests/test_treectrl.py @@ -8,12 +8,12 @@ class treectrl_Tests(wtc.WidgetTestCase): def test_treectrlCtor(self): t = wx.TreeCtrl(self.frame) - + def test_treectrlDefaultCtor(self): t = wx.TreeCtrl() t.Create(self.frame) - - + + def test_treectrlTreeItemId(self): tree = wx.TreeCtrl(self.frame) root = tree.AddRoot('root item') @@ -23,7 +23,7 @@ class treectrl_Tests(wtc.WidgetTestCase): r = tree.GetRootItem() self.assertTrue(r is not root) self.assertTrue(r == root) - + child = tree.AppendItem(root, 'child item') self.assertTrue(child is not root) self.assertTrue(child != root) @@ -37,27 +37,27 @@ class treectrl_Tests(wtc.WidgetTestCase): self.assertTrue(v == value) tree.SetItemData(root, None) self.assertTrue(tree.GetItemData(root) is None) - - + + def test_treectrlTreeItemPyData(self): # ensure that the "Py" versions raise deprecation warnings value = 'Some Python Object' tree = wx.TreeCtrl(self.frame) root = tree.AddRoot('root item') tree.SetItemData(root, value) - + import warnings with warnings.catch_warnings(): - warnings.simplefilter("error") + warnings.simplefilter("error") with self.assertRaises(wx.wxPyDeprecationWarning): tree.SetItemPyData(root, value) - + with warnings.catch_warnings(): - warnings.simplefilter("error") + warnings.simplefilter("error") with self.assertRaises(wx.wxPyDeprecationWarning): tree.GetItemPyData(root) - + def test_treectrlGetSelections(self): tree = wx.TreeCtrl(self.frame, style=wx.TR_MULTIPLE) root = tree.AddRoot('root item') @@ -67,14 +67,14 @@ class treectrl_Tests(wtc.WidgetTestCase): tree.SelectItem(c2) self.assertTrue(tree.IsSelected(c1)) self.assertTrue(tree.IsSelected(c2)) - + sel = tree.GetSelections() self.assertTrue(isinstance(sel, list)) self.assertTrue(len(sel) == 2) self.assertTrue(isinstance(sel[0], wx.TreeItemId)) - - - + + + def test_treectrlGetFirstNext(self): tree = wx.TreeCtrl(self.frame) root = tree.AddRoot('root item') @@ -82,20 +82,20 @@ class treectrl_Tests(wtc.WidgetTestCase): c2 = tree.AppendItem(root, 'c2') c3 = tree.AppendItem(root, 'c3') c4 = tree.AppendItem(root, 'c4') - + children = [] item, cookie = tree.GetFirstChild(root) while item: children.append(item) item, cookie = tree.GetNextChild(root, cookie) - + self.assertEqual(len(children), 4) self.assertEqual(children[0], c1) self.assertEqual(children[1], c2) self.assertEqual(children[2], c3) self.assertEqual(children[3], c4) - - + + def test_treectrlConstantsExist(self): wx.TR_NO_BUTTONS @@ -111,13 +111,13 @@ class treectrl_Tests(wtc.WidgetTestCase): wx.TR_FULL_ROW_HIGHLIGHT wx.TR_DEFAULT_STYLE wx.TR_TWIST_BUTTONS - wx.TreeItemIcon_Normal - wx.TreeItemIcon_Selected - wx.TreeItemIcon_Expanded - wx.TreeItemIcon_SelectedExpanded - wx.TREE_ITEMSTATE_NONE - wx.TREE_ITEMSTATE_NEXT - wx.TREE_ITEMSTATE_PREV + wx.TreeItemIcon_Normal + wx.TreeItemIcon_Selected + wx.TreeItemIcon_Expanded + wx.TreeItemIcon_SelectedExpanded + wx.TREE_ITEMSTATE_NONE + wx.TREE_ITEMSTATE_NEXT + wx.TREE_ITEMSTATE_PREV wx.TREE_HITTEST_ABOVE wx.TREE_HITTEST_BELOW wx.TREE_HITTEST_NOWHERE @@ -132,8 +132,8 @@ class treectrl_Tests(wtc.WidgetTestCase): wx.TREE_HITTEST_ONITEMUPPERPART wx.TREE_HITTEST_ONITEMLOWERPART wx.TREE_HITTEST_ONITEM - - + + def test_treeEventsExist(self): wx.wxEVT_COMMAND_TREE_BEGIN_DRAG wx.wxEVT_COMMAND_TREE_BEGIN_RDRAG @@ -156,29 +156,29 @@ class treectrl_Tests(wtc.WidgetTestCase): wx.wxEVT_COMMAND_TREE_STATE_IMAGE_CLICK wx.wxEVT_COMMAND_TREE_ITEM_GETTOOLTIP wx.wxEVT_COMMAND_TREE_ITEM_MENU - - wx.EVT_TREE_BEGIN_DRAG - wx.EVT_TREE_BEGIN_RDRAG - wx.EVT_TREE_BEGIN_LABEL_EDIT - wx.EVT_TREE_END_LABEL_EDIT - wx.EVT_TREE_DELETE_ITEM - wx.EVT_TREE_GET_INFO - wx.EVT_TREE_SET_INFO - wx.EVT_TREE_ITEM_EXPANDED - wx.EVT_TREE_ITEM_EXPANDING - wx.EVT_TREE_ITEM_COLLAPSED - wx.EVT_TREE_ITEM_COLLAPSING - wx.EVT_TREE_SEL_CHANGED - wx.EVT_TREE_SEL_CHANGING - wx.EVT_TREE_KEY_DOWN - wx.EVT_TREE_ITEM_ACTIVATED - wx.EVT_TREE_ITEM_RIGHT_CLICK - wx.EVT_TREE_ITEM_MIDDLE_CLICK - wx.EVT_TREE_END_DRAG - wx.EVT_TREE_STATE_IMAGE_CLICK - wx.EVT_TREE_ITEM_GETTOOLTIP - wx.EVT_TREE_ITEM_MENU - + + wx.EVT_TREE_BEGIN_DRAG + wx.EVT_TREE_BEGIN_RDRAG + wx.EVT_TREE_BEGIN_LABEL_EDIT + wx.EVT_TREE_END_LABEL_EDIT + wx.EVT_TREE_DELETE_ITEM + wx.EVT_TREE_GET_INFO + wx.EVT_TREE_SET_INFO + wx.EVT_TREE_ITEM_EXPANDED + wx.EVT_TREE_ITEM_EXPANDING + wx.EVT_TREE_ITEM_COLLAPSED + wx.EVT_TREE_ITEM_COLLAPSING + wx.EVT_TREE_SEL_CHANGED + wx.EVT_TREE_SEL_CHANGING + wx.EVT_TREE_KEY_DOWN + wx.EVT_TREE_ITEM_ACTIVATED + wx.EVT_TREE_ITEM_RIGHT_CLICK + wx.EVT_TREE_ITEM_MIDDLE_CLICK + wx.EVT_TREE_END_DRAG + wx.EVT_TREE_STATE_IMAGE_CLICK + wx.EVT_TREE_ITEM_GETTOOLTIP + wx.EVT_TREE_ITEM_MENU + #--------------------------------------------------------------------------- if __name__ == '__main__': diff --git a/unittests/test_treelist.py b/unittests/test_treelist.py index 35172fc1..ce459a50 100644 --- a/unittests/test_treelist.py +++ b/unittests/test_treelist.py @@ -9,46 +9,46 @@ class treelist_Tests(wtc.WidgetTestCase): def test_treelist1(self): - wx.dataview.TL_SINGLE - wx.dataview.TL_MULTIPLE - wx.dataview.TL_CHECKBOX - wx.dataview.TL_3STATE - wx.dataview.TL_USER_3STATE - wx.dataview.TL_DEFAULT_STYLE - wx.dataview.TL_STYLE_MASK - - wx.dataview.EVT_TREELIST_SELECTION_CHANGED - wx.dataview.EVT_TREELIST_ITEM_EXPANDING + wx.dataview.TL_SINGLE + wx.dataview.TL_MULTIPLE + wx.dataview.TL_CHECKBOX + wx.dataview.TL_3STATE + wx.dataview.TL_USER_3STATE + wx.dataview.TL_DEFAULT_STYLE + wx.dataview.TL_STYLE_MASK + + wx.dataview.EVT_TREELIST_SELECTION_CHANGED + wx.dataview.EVT_TREELIST_ITEM_EXPANDING wx.dataview.EVT_TREELIST_ITEM_EXPANDED - wx.dataview.EVT_TREELIST_ITEM_CHECKED + wx.dataview.EVT_TREELIST_ITEM_CHECKED wx.dataview.EVT_TREELIST_ITEM_ACTIVATED wx.dataview.EVT_TREELIST_ITEM_CONTEXT_MENU - wx.dataview.EVT_TREELIST_COLUMN_SORTED + wx.dataview.EVT_TREELIST_COLUMN_SORTED wx.dataview.wxEVT_COMMAND_TREELIST_SELECTION_CHANGED - wx.dataview.wxEVT_COMMAND_TREELIST_ITEM_EXPANDING - wx.dataview.wxEVT_COMMAND_TREELIST_ITEM_EXPANDED - wx.dataview.wxEVT_COMMAND_TREELIST_ITEM_CHECKED - wx.dataview.wxEVT_COMMAND_TREELIST_ITEM_ACTIVATED + wx.dataview.wxEVT_COMMAND_TREELIST_ITEM_EXPANDING + wx.dataview.wxEVT_COMMAND_TREELIST_ITEM_EXPANDED + wx.dataview.wxEVT_COMMAND_TREELIST_ITEM_CHECKED + wx.dataview.wxEVT_COMMAND_TREELIST_ITEM_ACTIVATED wx.dataview.wxEVT_COMMAND_TREELIST_ITEM_CONTEXT_MENU - wx.dataview.wxEVT_COMMAND_TREELIST_COLUMN_SORTED + wx.dataview.wxEVT_COMMAND_TREELIST_COLUMN_SORTED def _populateTree(self, tlc): assert isinstance(tlc, wx.dataview.TreeListCtrl) tlc.AppendColumn('Column 1') tlc.AppendColumn('Column 2', align=wx.ALIGN_RIGHT) - + # use the hidden root as the parent of the visible root - root = tlc.AppendItem(tlc.GetRootItem(), 'My Root') + root = tlc.AppendItem(tlc.GetRootItem(), 'My Root') tlc.SetItemText(root, 1, 'root col 2') - + for x in range(3): item = tlc.AppendItem(root, 'item %d' % (x+1)) tlc.SetItemText(item, 1, 'item col 2') - + return root - - + + def test_treelist2(self): tlc = wx.dataview.TreeListCtrl(self.frame) @@ -58,37 +58,37 @@ class treelist_Tests(wtc.WidgetTestCase): self.assertTrue(isinstance(s, list)) self.assertEqual(s, []) - tlc.Select(root) + tlc.Select(root) self.assertEqual(tlc.GetItemText(root), tlc.GetItemText(tlc.GetSelection())) - + s = tlc.GetSelections() self.assertTrue(isinstance(s, list)) self.assertEqual(len(s), 1) self.assertTrue(isinstance(s[0], wx.dataview.TreeListItem)) - - + + def test_treelist3(self): tlc = wx.dataview.TreeListCtrl(self.frame, style=wx.dataview.TL_MULTIPLE) root = self._populateTree(tlc) - tlc.Select(root) + tlc.Select(root) tlc.Select(tlc.GetFirstChild(root)) s = tlc.GetSelections() self.assertTrue(isinstance(s, list)) self.assertEqual(len(s), 2) - - + + def test_treelist4(self): tlc = wx.dataview.TreeListCtrl(self.frame, style=wx.dataview.TL_MULTIPLE) root = self._populateTree(tlc) - + # test if embedded DataViewCtrl is returned as the correct type dvc = tlc.GetChildren()[0] self.assertTrue(hasattr(dvc, 'IsTopLevel')) self.assertEqual(dvc.__class__.__module__, 'wx._dataview') - - - + + + #--------------------------------------------------------------------------- if __name__ == '__main__': diff --git a/unittests/test_uiaction.py b/unittests/test_uiaction.py index 67e85a5d..0fa79ca1 100644 --- a/unittests/test_uiaction.py +++ b/unittests/test_uiaction.py @@ -16,17 +16,17 @@ class MouseEventsPanel(wx.Panel): eventBinders = [eventBinders] for binder in eventBinders: self.Bind(binder, self.onMouseEvent) - + def onMouseEvent(self, evt): self.events.append( (evt.EventType, evt.Position) ) print( (evt.EventType, evt.Position) ) evt.Skip() - - + + class uiaction_MouseTests(wtc.WidgetTestCase): - + def cmp(self, info, evtType, pos): if isinstance(evtType, tuple): if info[0] not in evtType: @@ -40,16 +40,16 @@ class uiaction_MouseTests(wtc.WidgetTestCase): if abs(info[1].y - pos[1]) > 1: return False return True - + def setUp(self): super(uiaction_MouseTests, self).setUp() self.frame.WarpPointer(-10,-10) - - + + def test_uiactionMouseMotion(self): p = MouseEventsPanel(self.frame, wx.EVT_MOTION) self.myYield() - + uia = wx.UIActionSimulator() uia.MouseMove(p.ClientToScreen((1,1))); self.waitFor(WAIT) uia.MouseMove(p.ClientToScreen((5,5))); self.waitFor(WAIT) @@ -61,12 +61,12 @@ class uiaction_MouseTests(wtc.WidgetTestCase): self.assertTrue(self.cmp(p.events[0], wx.wxEVT_MOTION, (1,1))) self.assertTrue(self.cmp(p.events[1], wx.wxEVT_MOTION, (5,5))) self.assertTrue(self.cmp(p.events[2], wx.wxEVT_MOTION, (10,10))) - - + + def test_uiactionMouseLeftDownUp(self): p = MouseEventsPanel(self.frame, [wx.EVT_LEFT_DOWN, wx.EVT_LEFT_UP]) self.myYield() - + uia = wx.UIActionSimulator() uia.MouseMove(p.ClientToScreen((10,10))); self.waitFor(WAIT) uia.MouseDown(); self.waitFor(WAIT) @@ -76,12 +76,12 @@ class uiaction_MouseTests(wtc.WidgetTestCase): self.assertTrue(len(p.events) == 2) self.assertTrue(self.cmp(p.events[0], wx.wxEVT_LEFT_DOWN, (10,10))) self.assertTrue(self.cmp(p.events[1], wx.wxEVT_LEFT_UP, (10,10))) - - + + def test_uiactionMouseRightDownUp(self): p = MouseEventsPanel(self.frame, [wx.EVT_RIGHT_DOWN, wx.EVT_RIGHT_UP]) self.myYield() - + uia = wx.UIActionSimulator() uia.MouseMove(p.ClientToScreen((10,10))); self.waitFor(WAIT) uia.MouseDown(wx.MOUSE_BTN_RIGHT); self.waitFor(WAIT) @@ -91,12 +91,12 @@ class uiaction_MouseTests(wtc.WidgetTestCase): self.assertTrue(len(p.events) == 2) self.assertTrue(self.cmp(p.events[0], wx.wxEVT_RIGHT_DOWN, (10,10))) self.assertTrue(self.cmp(p.events[1], wx.wxEVT_RIGHT_UP, (10,10))) - + def test_uiactionMouseLeftClick(self): p = MouseEventsPanel(self.frame, [wx.EVT_LEFT_DOWN, wx.EVT_LEFT_UP]) self.myYield() - + uia = wx.UIActionSimulator() uia.MouseMove(p.ClientToScreen((10,10))); self.waitFor(WAIT) uia.MouseClick(); self.waitFor(WAIT) @@ -110,7 +110,7 @@ class uiaction_MouseTests(wtc.WidgetTestCase): def test_uiactionMouseLeftDClick(self): p = MouseEventsPanel(self.frame, [wx.EVT_LEFT_DOWN, wx.EVT_LEFT_UP, wx.EVT_LEFT_DCLICK]) self.myYield() - + uia = wx.UIActionSimulator() uia.MouseMove(p.ClientToScreen((10,10))); self.waitFor(WAIT) uia.MouseDblClick(); self.waitFor(WAIT) @@ -125,27 +125,27 @@ class uiaction_MouseTests(wtc.WidgetTestCase): def test_uiactionMouseDD(self): p = MouseEventsPanel(self.frame, [wx.EVT_MOTION, wx.EVT_LEFT_DOWN, wx.EVT_LEFT_UP]) - + x1, y1 = p.ClientToScreen((10,10)) x2 = x1 + 20 y2 = y1 + 20 - + uia = wx.UIActionSimulator() uia.MouseDragDrop(x1,y1, x2,y2); self.waitFor(WAIT) self.waitFor(WAIT) - self.assertEqual(len(p.events), 4) + self.assertEqual(len(p.events), 4) self.assertTrue(self.cmp(p.events[0], wx.wxEVT_MOTION, (10,10))) self.assertTrue(self.cmp(p.events[1], wx.wxEVT_LEFT_DOWN, (10,10))) self.assertTrue(self.cmp(p.events[2], wx.wxEVT_MOTION, (30,30))) self.assertTrue(self.cmp(p.events[3], wx.wxEVT_LEFT_UP, (30,30))) - - + + #--------------------------------------------------------------------------- class uiaction_KeyboardTests(wtc.WidgetTestCase): - + def setUp(self): super(uiaction_KeyboardTests, self).setUp() pnl = wx.Panel(self.frame) @@ -154,7 +154,7 @@ class uiaction_KeyboardTests(wtc.WidgetTestCase): self.tc.SetFocus() self.waitFor(WAIT) - + def test_uiactionKeyboardKeyDownUp(self): uia = wx.UIActionSimulator() for c in "This is a test": @@ -165,9 +165,9 @@ class uiaction_KeyboardTests(wtc.WidgetTestCase): if c.isupper(): uia.KeyUp(wx.WXK_SHIFT); self.waitFor(WAIT) self.waitFor(WAIT*2) - + self.assertEqual(self.tc.GetValue(), "This is a test") - + @unittest.skipIf(sys.platform == 'darwin', 'wx.UIActionSimulator.Char needs work...') def test_uiactionKeyboardChar(self): @@ -176,19 +176,19 @@ class uiaction_KeyboardTests(wtc.WidgetTestCase): mod = wx.MOD_NONE if c.isupper(): mod = wx.MOD_SHIFT - uia.Char(ord(c), mod); + uia.Char(ord(c), mod); self.waitFor(WAIT) self.waitFor(WAIT*2) - + self.assertEqual(self.tc.GetValue(), "This is a test") - @unittest.skipIf(sys.platform == 'darwin', 'wx.UIActionSimulator.Text needs work...') + @unittest.skipIf(sys.platform == 'darwin', 'wx.UIActionSimulator.Text needs work...') def test_uiactionKeyboardText(self): uia = wx.UIActionSimulator() uia.Text("This is a test") self.waitFor(WAIT*2) - + self.assertEqual(self.tc.GetValue(), "This is a test") diff --git a/unittests/test_unichar.py b/unittests/test_unichar.py index 44dca5a5..8580ffbe 100644 --- a/unittests/test_unichar.py +++ b/unittests/test_unichar.py @@ -9,7 +9,7 @@ class unichar_Tests(wtc.WidgetTestCase): # TODO: Remove this test and add real ones. def test_unichar1(self): self.fail("Unit tests for unichar not implemented yet.") - + #--------------------------------------------------------------------------- if __name__ == '__main__': diff --git a/unittests/test_utils.py b/unittests/test_utils.py index 83ebe9f9..06f55721 100644 --- a/unittests/test_utils.py +++ b/unittests/test_utils.py @@ -7,7 +7,7 @@ import os #--------------------------------------------------------------------------- class utils_Tests(wtc.WidgetTestCase): - + def test_utilsWindowDisabler(self): wd = wx.WindowDisabler() self.assertTrue(not self.frame.IsEnabled()) @@ -15,14 +15,14 @@ class utils_Tests(wtc.WidgetTestCase): wd = wx.WindowDisabler(self.frame) self.assertTrue( self.frame.IsEnabled()) - + def test_utilsBusyCursor(self): self.assertTrue(not wx.IsBusy()) bc = wx.BusyCursor() self.assertTrue( wx.IsBusy()) del bc self.assertTrue(not wx.IsBusy()) - + def test_utilsBusyCursor2(self): self.assertTrue(not wx.IsBusy()) wx.BeginBusyCursor() @@ -33,7 +33,7 @@ class utils_Tests(wtc.WidgetTestCase): def test_utilsBusyCursor3(self): with wx.BusyCursor(): self.myYield() - + def test_utilsSomeOtherStuff(self): wx.GetBatteryState() wx.GetPowerType() @@ -48,8 +48,8 @@ class utils_Tests(wtc.WidgetTestCase): wx.GetUserId() wx.GetOsDescription() - - def test_utilsVersionInfo(self): + + def test_utilsVersionInfo(self): vi = wx.GetLibraryVersionInfo() assert isinstance(vi, wx.VersionInfo) vi.ToString() @@ -60,9 +60,9 @@ class utils_Tests(wtc.WidgetTestCase): vi.Description vi.Name vi.VersionString - - - + + + #--------------------------------------------------------------------------- diff --git a/unittests/test_validate.py b/unittests/test_validate.py index e760e095..e26b205d 100644 --- a/unittests/test_validate.py +++ b/unittests/test_validate.py @@ -10,25 +10,25 @@ class MyValidator(wx.Validator): def __init__(self, startingValue=""): wx.Validator.__init__(self) self.value = startingValue - + def Clone(self): return MyValidator(self.value) - + def TransferToWindow(self): self.GetWindow().SetValue(self.value) return True - + def TransferFromWindow(self): - self.value = self.Window.Value # test using the properties + self.value = self.Window.Value # test using the properties return True - + def Validate(self, parent): value = self.GetWindow().GetValue() return value in ["", "hello", "world"] class validate_Tests(wtc.WidgetTestCase): - + def setUp(self): super(validate_Tests, self).setUp() self.pnl = wx.Panel(self.frame) @@ -36,8 +36,8 @@ class validate_Tests(wtc.WidgetTestCase): self.frame.SendSizeEvent() validator = MyValidator("hello") self.tc.SetValidator(validator) - - + + def test_validateTransfer(self): self.assertTrue(self.tc.Value == "") self.pnl.TransferDataToWindow() @@ -46,12 +46,12 @@ class validate_Tests(wtc.WidgetTestCase): self.pnl.TransferDataFromWindow() v = self.tc.GetValidator() self.assertTrue(v.value == "world") - - - + + + def test_validateDefault(self): wx.DefaultValidator - + #--------------------------------------------------------------------------- diff --git a/unittests/test_valtext.py b/unittests/test_valtext.py index 02a53df9..ba902a2f 100644 --- a/unittests/test_valtext.py +++ b/unittests/test_valtext.py @@ -9,7 +9,7 @@ class valtext_Tests(wtc.WidgetTestCase): # TODO: Remove this test and add real ones. def test_valtext1(self): self.fail("Unit tests for valtext not implemented yet.") - + #--------------------------------------------------------------------------- if __name__ == '__main__': diff --git a/unittests/test_variant.py b/unittests/test_variant.py index 3212fb26..36c59391 100644 --- a/unittests/test_variant.py +++ b/unittests/test_variant.py @@ -13,8 +13,8 @@ class variant_Tests(wtc.WidgetTestCase): n = wx.testVariantTypemap(123) self.assertTrue(isinstance(n, six.integer_types)) self.assertEqual(n, 123) - - + + @unittest.skipIf(not hasattr(wx, 'testVariantTypemap'), '') def test_variant2(self): s = wx.testVariantTypemap("Hello") @@ -27,7 +27,7 @@ class variant_Tests(wtc.WidgetTestCase): d2 = wx.testVariantTypemap(d1) self.assertEqual(d1, d2) - + #--------------------------------------------------------------------------- if __name__ == '__main__': diff --git a/unittests/test_vidmode.py b/unittests/test_vidmode.py index 9b11e2f6..8fd52c42 100644 --- a/unittests/test_vidmode.py +++ b/unittests/test_vidmode.py @@ -5,7 +5,7 @@ import wx #--------------------------------------------------------------------------- class vidmode_Tests(wtc.WidgetTestCase): - + def test_vidmode(self): vm = wx.VideoMode() vm = wx.VideoMode(1024, 768, 32) @@ -15,7 +15,7 @@ class vidmode_Tests(wtc.WidgetTestCase): def test_defaultVidmode(self): wx.DefaultVideoMode # just testing that it exists - + #--------------------------------------------------------------------------- diff --git a/unittests/test_virtualOverride.py b/unittests/test_virtualOverride.py index b68943c8..af8562a4 100644 --- a/unittests/test_virtualOverride.py +++ b/unittests/test_virtualOverride.py @@ -19,7 +19,7 @@ class MyTestPanel(wx.Panel): def __init__(self, *args, **kw): wx.Panel.__init__(self, *args, **kw) self.methodCalled = False - + def AddChild(self, child): self.methodCalled = True if 1: @@ -36,9 +36,9 @@ class virtualOverride_Tests(wtc.WidgetTestCase): b = wx.Button(p, -1, "Hello, I am a button") self.assertTrue(p.methodCalled) self.assertTrue(len(p.Children) == count+1) - - + + #--------------------------------------------------------------------------- diff --git a/unittests/test_vlbox.py b/unittests/test_vlbox.py index 09641949..eb7054ee 100644 --- a/unittests/test_vlbox.py +++ b/unittests/test_vlbox.py @@ -13,20 +13,20 @@ class vlbox_Tests(wtc.WidgetTestCase): def test_vlbox2(self): with self.assertRaises(TypeError): lb = wx.VListBox(self.frame) - - + + def test_vlbox3(self): panel = wx.Panel(self.frame) self.frame.SendSizeEvent() - + lb = MyVListBox(panel, pos=(10,10), size=(100,150), style=wx.BORDER_THEME) lb.data = ['zero', 'one two', 'three four', 'five six', 'seven eight', 'nine ten'] lb.SetItemCount(len(lb.data)) self.waitFor(100) - + # check the ItemCount property self.assertEqual(len(lb.data), lb.ItemCount) - + # check that the overridden virtuals were called self.assertTrue(len(lb.drawItemCalls) > 0) self.assertTrue(len(lb.drawBackgroundCalls) > 0) @@ -39,19 +39,19 @@ class vlbox_Tests(wtc.WidgetTestCase): self.assertEqual(lb.GetSelection(), 2) self.assertTrue(lb.IsSelected(2)) self.assertFalse(lb.IsSelected(3)) - - + + def test_vlbox4(self): panel = wx.Panel(self.frame) self.frame.SendSizeEvent() - - lb = MyVListBox(panel, pos=(10,10), size=(100,150), + + lb = MyVListBox(panel, pos=(10,10), size=(100,150), style=wx.BORDER_SIMPLE|wx.LB_MULTIPLE) lb.data = ['zero', 'one', 'two', 'three', 'four', 'five', 'six', 'seven', 'eight', 'nine', 'ten'] lb.SetItemCount(len(lb.data)) self.waitFor(50) - + lb.Select(2) lb.Select(5) lb.Select(7) @@ -61,17 +61,17 @@ class vlbox_Tests(wtc.WidgetTestCase): self.assertTrue(lb.IsSelected(2)) self.assertTrue(lb.IsSelected(8)) self.assertFalse(lb.IsSelected(3)) - + sel = list() idx, cookie = lb.GetFirstSelected() while idx != wx.NOT_FOUND: sel.append(idx) idx, cookie = lb.GetNextSelected(cookie) - + self.assertEqual(sel, [2,5,7,8]) - - - + + + class MyVListBox(wx.VListBox): def __init__(self, *args, **kw): wx.VListBox.__init__(self, *args, **kw) @@ -80,7 +80,7 @@ class MyVListBox(wx.VListBox): self.drawBackgroundCalls = list() self.drawSeparatorCalls = list() self.measureItemCalls = list() - + # overridable methods def OnDrawItem(self, dc, rect, idx): self.drawItemCalls.append(idx) @@ -90,7 +90,7 @@ class MyVListBox(wx.VListBox): color = 'white' dc.SetTextForeground(color) dc.DrawLabel(self.data[idx], rect) - + def OnDrawBackground(self, dc, rect, idx): self.drawBackgroundCalls.append(idx) assert isinstance(dc, wx.DC) @@ -102,7 +102,7 @@ class MyVListBox(wx.VListBox): dc.SetPen(wx.Pen(color, 1)) dc.SetBrush(wx.Brush(color)) dc.DrawRectangle(rect) - + def OnDrawSeparator(self, dc, rect, idx): self.drawSeparatorCalls.append(idx) if idx == 0: @@ -120,8 +120,8 @@ class MyVListBox(wx.VListBox): #dc = wx.ClientDC(self) w, h = self.GetTextExtent(self.data[idx]) return h + 6 - - + + #--------------------------------------------------------------------------- if __name__ == '__main__': diff --git a/unittests/test_vscroll.py b/unittests/test_vscroll.py index 9a08dd0a..3f7f5909 100644 --- a/unittests/test_vscroll.py +++ b/unittests/test_vscroll.py @@ -9,40 +9,40 @@ class vscroll_Tests(wtc.WidgetTestCase): def test_vscroll_VScrolledWindow1(self): with self.assertRaises(TypeError): w = wx.VScrolledWindow(self.frame) - + def test_vscroll_VScrolledWindow2(self): class MyScrolledWindow(wx.VScrolledWindow): def OnGetRowHeight(self, row): return 25 - + w = MyScrolledWindow(self.frame) w.SetRowCount(100) - + def test_vscroll_HScrolledWindow1(self): with self.assertRaises(TypeError): w = wx.HScrolledWindow(self.frame) - + def test_vscroll_HScrolledWindow2(self): class MyScrolledWindow(wx.HScrolledWindow): def OnGetColumnWidth(self, row): return 80 - + w = MyScrolledWindow(self.frame) w.SetColumnCount(100) - - + + def test_vscroll_HVScrolledWindow1(self): with self.assertRaises(TypeError): w = wx.HVScrolledWindow(self.frame) - + def test_vscroll_HVScrolledWindow2(self): class MyScrolledWindow(wx.HVScrolledWindow): def OnGetRowHeight(self, row): return 25 def OnGetColumnWidth(self, row): return 80 - + w = MyScrolledWindow(self.frame) w.SetRowCount(100) w.SetColumnCount(100) diff --git a/unittests/test_wacky_ints.py b/unittests/test_wacky_ints.py index 0c794305..59cc062e 100644 --- a/unittests/test_wacky_ints.py +++ b/unittests/test_wacky_ints.py @@ -11,7 +11,7 @@ class wacky_ints_Tests(unittest.TestCase): def test_wacky1(self): n = wx.testSizetTypemap(123456) self.assertEqual(n, 123456) - + @unittest.skipIf(not hasattr(wx, 'testIntPtrTypemap'), '') def test_wacky2(self): n = wx.testIntPtrTypemap(123456) @@ -22,7 +22,7 @@ class wacky_ints_Tests(unittest.TestCase): n = wx.testUIntPtrTypemap(123456) self.assertEqual(n, 123456) - + #--------------------------------------------------------------------------- if __name__ == '__main__': diff --git a/unittests/test_webkit.py b/unittests/test_webkit.py index a07d53be..3241d319 100644 --- a/unittests/test_webkit.py +++ b/unittests/test_webkit.py @@ -13,11 +13,11 @@ class webkit_Tests(wtc.WidgetTestCase): def test_webkit01(self): wk = wx.webkit.WebKitCtrl() wk.Create(self.frame) - + @unittest.skipIf(sys.platform != 'darwin', 'WebKit only implemented on Mac') def test_webkit02(self): wk = wx.webkit.WebKitCtrl(self.frame) - + @unittest.skipIf(sys.platform != 'darwin', 'WebKit only implemented on Mac') def test_webkit03(self): wk = wx.webkit.WebKitCtrl(self.frame, -1, "http://wxpython.org") @@ -26,7 +26,7 @@ class webkit_Tests(wtc.WidgetTestCase): @unittest.skipIf(sys.platform != 'darwin', 'WebKit only implemented on Mac') def test_webkit04(self): e = wx.webkit.WebKitBeforeLoadEvent() - + @unittest.skipIf(sys.platform != 'darwin', 'WebKit only implemented on Mac') def test_webkit05(self): e = wx.webkit.WebKitStateChangedEvent() @@ -50,27 +50,27 @@ class webkit_Tests(wtc.WidgetTestCase): wx.webkit.WEBKIT_NAV_RELOAD wx.webkit.WEBKIT_NAV_FORM_RESUBMITTED wx.webkit.WEBKIT_NAV_OTHER - + wx.webkit.wxEVT_WEBKIT_STATE_CHANGED wx.webkit.wxEVT_WEBKIT_BEFORE_LOAD wx.webkit.wxEVT_WEBKIT_NEW_WINDOW - + wx.webkit.EVT_WEBKIT_STATE_CHANGED wx.webkit.EVT_WEBKIT_BEFORE_LOAD wx.webkit.EVT_WEBKIT_NEW_WINDOW - - + + @unittest.skipIf(sys.platform != 'darwin', 'WebKit only implemented on Mac') def test_webkit08(self): wx.webkit.wxEVT_WEBKIT_STATE_CHANGED wx.webkit.wxEVT_WEBKIT_BEFORE_LOAD wx.webkit.wxEVT_WEBKIT_NEW_WINDOW - + wx.webkit.EVT_WEBKIT_STATE_CHANGED wx.webkit.EVT_WEBKIT_BEFORE_LOAD wx.webkit.EVT_WEBKIT_NEW_WINDOW - + #--------------------------------------------------------------------------- if __name__ == '__main__': diff --git a/unittests/test_webview.py b/unittests/test_webview.py index a364a9c4..0a07e640 100644 --- a/unittests/test_webview.py +++ b/unittests/test_webview.py @@ -10,7 +10,7 @@ class webview_Tests(wtc.WidgetTestCase): def test_webview1(self): wv = webview.WebView.New() wv.Create(self.frame) - + def test_webview2(self): wv = webview.WebView.New(self.frame) @@ -24,8 +24,8 @@ class webview_Tests(wtc.WidgetTestCase): self.assertTrue(isinstance(h, list)) if len(h): self.assertTrue(isinstance(h[0], webview.WebViewHistoryItem)) - - + + def test_webview5(self): webview.WEBVIEW_ZOOM_TINY webview.WEBVIEW_ZOOM_SMALL @@ -54,7 +54,7 @@ class webview_Tests(wtc.WidgetTestCase): webview.WebViewBackendDefault webview.WebViewBackendIE webview.WebViewBackendWebKit - + def test_webview6(self): webview.wxEVT_COMMAND_WEBVIEW_NAVIGATING @@ -63,15 +63,15 @@ class webview_Tests(wtc.WidgetTestCase): webview.wxEVT_COMMAND_WEBVIEW_ERROR webview.wxEVT_COMMAND_WEBVIEW_NEWWINDOW webview.wxEVT_COMMAND_WEBVIEW_TITLE_CHANGED - + webview.EVT_WEBVIEW_NAVIGATING webview.EVT_WEBVIEW_NAVIGATED webview.EVT_WEBVIEW_LOADED webview.EVT_WEBVIEW_ERROR webview.EVT_WEBVIEW_NEWWINDOW webview.EVT_WEBVIEW_TITLE_CHANGED - - + + #--------------------------------------------------------------------------- diff --git a/unittests/test_window.py b/unittests/test_window.py index ec977a24..747e89cb 100644 --- a/unittests/test_window.py +++ b/unittests/test_window.py @@ -6,7 +6,7 @@ import six #--------------------------------------------------------------------------- class WindowTests(wtc.WidgetTestCase): - + def test_SimpleWindowCtor(self): w = wx.Window(self.frame, -1, (10,10), (50,50), wx.BORDER_NONE) self.assertEqual(w.GetWindowStyleFlag(), wx.BORDER_NONE) @@ -16,80 +16,80 @@ class WindowTests(wtc.WidgetTestCase): w = wx.Window(self.frame, -1, (10,10), (50,50)) hdl = w.GetHandle() self.assertTrue(isinstance(hdl, six.integer_types)) - - + + def test_windowProperties(self): w = wx.Window(self.frame, -1, (10,10), (50,50)) # Just test that these properties exist for now. More tests can be # added later to ensure that they work correctly. - w.AcceleratorTable - w.AutoLayout - w.BackgroundColour - w.BackgroundStyle - w.EffectiveMinSize - w.BestSize - w.BestVirtualSize - w.Border - w.Caret - w.CharHeight - w.CharWidth - w.Children - w.ClientAreaOrigin - w.ClientRect - w.ClientSize - w.Constraints - w.ContainingSizer - w.Cursor - w.DefaultAttributes - w.DropTarget - w.EventHandler - w.ExtraStyle - w.Font - w.ForegroundColour - w.GrandParent - w.TopLevelParent - w.Handle - w.HelpText - w.Id - w.Label - w.LayoutDirection - w.MaxHeight - w.MaxSize - w.MaxWidth - w.MinHeight - w.MinSize - w.MinWidth - w.Name - w.Parent - w.Position - w.Rect - w.ScreenPosition - w.ScreenRect - w.Size - w.Sizer - w.ThemeEnabled - w.ToolTip - w.UpdateClientRect - w.UpdateRegion - w.Validator - w.VirtualSize - w.WindowStyle - w.WindowStyleFlag - w.WindowVariant - w.Shown - w.Enabled - w.TopLevel - w.MinClientSize - w.MaxClientSize + w.AcceleratorTable + w.AutoLayout + w.BackgroundColour + w.BackgroundStyle + w.EffectiveMinSize + w.BestSize + w.BestVirtualSize + w.Border + w.Caret + w.CharHeight + w.CharWidth + w.Children + w.ClientAreaOrigin + w.ClientRect + w.ClientSize + w.Constraints + w.ContainingSizer + w.Cursor + w.DefaultAttributes + w.DropTarget + w.EventHandler + w.ExtraStyle + w.Font + w.ForegroundColour + w.GrandParent + w.TopLevelParent + w.Handle + w.HelpText + w.Id + w.Label + w.LayoutDirection + w.MaxHeight + w.MaxSize + w.MaxWidth + w.MinHeight + w.MinSize + w.MinWidth + w.Name + w.Parent + w.Position + w.Rect + w.ScreenPosition + w.ScreenRect + w.Size + w.Sizer + w.ThemeEnabled + w.ToolTip + w.UpdateClientRect + w.UpdateRegion + w.Validator + w.VirtualSize + w.WindowStyle + w.WindowStyleFlag + w.WindowVariant + w.Shown + w.Enabled + w.TopLevel + w.MinClientSize + w.MaxClientSize def test_windowFunctions(self): wx.FindWindowById wx.FindWindowByName wx.FindWindowByLabel - + self.assertEqual(wx.FindWindowById(self.frame.GetId()), self.frame) - + def test_windowCoordConvFunctions(self): w = wx.Window(self.frame, -1, (10,10), (50,50)) a = w.ClientToScreen(0, 0) diff --git a/unittests/test_windowid.py b/unittests/test_windowid.py index 8fc2edff..1146c786 100644 --- a/unittests/test_windowid.py +++ b/unittests/test_windowid.py @@ -5,15 +5,15 @@ import wx #--------------------------------------------------------------------------- class IdManagerTest(unittest.TestCase): - + def test_idManager(self): id = wx.IdManager.ReserveId(5) self.assertTrue(id != wx.ID_NONE) - + wx.IdManager.UnreserveId(id, 5) - - - + + + #--------------------------------------------------------------------------- diff --git a/unittests/test_windowlist.py b/unittests/test_windowlist.py index d6a874ca..ff672142 100644 --- a/unittests/test_windowlist.py +++ b/unittests/test_windowlist.py @@ -26,30 +26,30 @@ class WindowList(wtc.WidgetTestCase): #unittest.TestCase): wx.CallAfter(_closeAll) self.app.MainLoop() del self.app - - - def test_WindowList_GetTLW1(self): + + + def test_WindowList_GetTLW1(self): TLWs = wx.GetTopLevelWindows() #self.assertEqual(len(TLWs), 6) # 1 created in the base class plus 5 here - # since TLWs delay destroying themselves there may be more than 6 of them here - # when we're running the whole test suite, so we have to comment out that + # since TLWs delay destroying themselves there may be more than 6 of them here + # when we're running the whole test suite, so we have to comment out that # assert... - + for tlw in TLWs: self.assertTrue(isinstance(tlw, wx.TopLevelWindow)) - + def test_WindowList_GetChildren(self): children = self.frames[0].GetChildren() self.assertEqual(len(children), 0) children = self.frames[4].GetChildren() self.assertEqual(len(children), 5) - + def test_WindowList_repr(self): TLWs = wx.GetTopLevelWindows() self.assertTrue(repr(TLWs).startswith("WindowList:")) - - + + #--------------------------------------------------------------------------- diff --git a/unittests/test_wizard.py b/unittests/test_wizard.py index d13bd4ad..eea99ca2 100644 --- a/unittests/test_wizard.py +++ b/unittests/test_wizard.py @@ -17,46 +17,46 @@ class MySimpleWizPage(wx.adv.WizardPageSimple): sizer.Add(st, 0, wx.ALIGN_CENTER) sizer.Add(wx.StaticLine(self), 0, wx.EXPAND) self.SetSizer(sizer) - + class wizard_Tests(wtc.WidgetTestCase): def test_wizard1(self): wx.adv.WIZARD_EX_HELPBUTTON - wx.adv.WIZARD_VALIGN_TOP + wx.adv.WIZARD_VALIGN_TOP wx.adv.WIZARD_VALIGN_CENTRE wx.adv.WIZARD_VALIGN_BOTTOM - wx.adv.WIZARD_HALIGN_LEFT + wx.adv.WIZARD_HALIGN_LEFT wx.adv.WIZARD_HALIGN_CENTRE - wx.adv.WIZARD_HALIGN_RIGHT - wx.adv.WIZARD_TILE + wx.adv.WIZARD_HALIGN_RIGHT + wx.adv.WIZARD_TILE def test_wizard2(self): - # Create the wizard + # Create the wizard bmp = wx.Bitmap(pngFile) wiz = wx.adv.Wizard(self.frame, title="Test Wizard 2", bitmap=bmp) - + # create the pages pages = [] for i in range(5): pages.append(MySimpleWizPage(wiz, str(i+1))) - + # set the next/prev pages for idx, p in enumerate(pages): p.SetNext(pages[idx+1] if idx < len(pages)-1 else None) p.SetPrev(pages[idx-1] if idx > 0 else None) - + wiz.FitToPage(pages[0]) wx.CallLater(100, self._autoPilot, wiz) wiz.RunWizard(pages[0]) wiz.Destroy() - + def test_wizard3(self): # Same as above but use the Chain function to connect the pages bmp = wx.Bitmap(pngFile) wiz = wx.adv.Wizard(self.frame, title="Test Wizard 2", bitmap=bmp) - + pages = [] for i in range(5): pages.append(MySimpleWizPage(wiz, str(i+1))) @@ -65,29 +65,29 @@ class wizard_Tests(wtc.WidgetTestCase): wx.adv.WizardPageSimple.Chain(pages[1], pages[2]) wx.adv.WizardPageSimple.Chain(pages[2], pages[3]) wx.adv.WizardPageSimple.Chain(pages[3], pages[4]) - + wiz.FitToPage(pages[0]) wx.CallLater(100, self._autoPilot, wiz) wiz.RunWizard(pages[0]) wiz.Destroy() - - + + def _autoPilot(self, wiz): # simulate clicking the next button until the wizard closes if not wiz or not wiz.GetCurrentPage(): return - + # There seems to be a problem with stacking CallLaters while running # the unittests, so for now just cancel and return. wiz.EndModal(wx.ID_CANCEL) return - + #btn = wiz.FindWindowById(wx.ID_FORWARD) #evt = wx.CommandEvent(wx.EVT_BUTTON.typeId, wx.ID_FORWARD) #evt.SetEventObject(btn) #wx.PostEvent(btn, evt) #wx.CallLater(100, self._autoPilot, wiz) - + #--------------------------------------------------------------------------- if __name__ == '__main__': diff --git a/unittests/test_wrapsizer.py b/unittests/test_wrapsizer.py index 2f5cb0be..8d494c0b 100644 --- a/unittests/test_wrapsizer.py +++ b/unittests/test_wrapsizer.py @@ -12,7 +12,7 @@ class wrapsizer_Tests(wtc.WidgetTestCase): ws.Add(wx.Panel(self.frame)) ws.Add(wx.Panel(self.frame)) - + #--------------------------------------------------------------------------- diff --git a/unittests/test_wxdatetime.py b/unittests/test_wxdatetime.py index 4dc78ae6..6b4f5e3a 100644 --- a/unittests/test_wxdatetime.py +++ b/unittests/test_wxdatetime.py @@ -27,7 +27,7 @@ class datetime_Tests(wtc.WidgetTestCase): d2 = wx.DateTime.FromJDN(12345.67) d3 = wx.DateTime.FromTimeT(int(time.time())) d4 = wx.DateTime.FromDMY(1, wx.DateTime.Mar, 2012, 8, 15, 45, 123) - + def test_datetime3(self): d1 = wx.DateTime.Today() d2 = wx.DateTime.Now() @@ -42,7 +42,7 @@ class datetime_Tests(wtc.WidgetTestCase): d2 = wx.DateTime.Now() span = d2 - d1 self.assertTrue(isinstance(span, wx.TimeSpan)) - + def test_datetimeGetAmPm(self): am, pm = wx.DateTime.GetAmPmStrings() if six.PY3: @@ -51,29 +51,29 @@ class datetime_Tests(wtc.WidgetTestCase): base = unicode self.assertTrue(isinstance(am, base) and am != "") self.assertTrue(isinstance(pm, base) and pm != "") - - + + def test_datetimeProperties(self): d1 = wx.DateTime.Today() - d1.day - d1.month - d1.year - d1.hour - d1.minute - d1.second - d1.millisecond - d1.JDN - d1.DayOfYear - d1.JulianDayNumber - d1.LastMonthDay - d1.MJD - d1.ModifiedJulianDayNumber - d1.RataDie - d1.Ticks - d1.WeekOfMonth - d1.WeekOfYear - - + d1.day + d1.month + d1.year + d1.hour + d1.minute + d1.second + d1.millisecond + d1.JDN + d1.DayOfYear + d1.JulianDayNumber + d1.LastMonthDay + d1.MJD + d1.ModifiedJulianDayNumber + d1.RataDie + d1.Ticks + d1.WeekOfMonth + d1.WeekOfYear + + def test_datetimeConvertFromPyDatetime(self): dt = datetime.datetime(2012, 3, 1, 8, 15, 45) d = wx.DateTime(dt) @@ -101,27 +101,27 @@ class datetime_Tests(wtc.WidgetTestCase): self.assertTrue(isinstance(tm, wx.DateTime.Tm)) self.assertTrue(tm.IsValid()) tm.msec - tm.sec - tm.min + tm.sec + tm.min tm.hour tm.mday tm.yday - tm.mon + tm.mon tm.year def test_datetimeSet(self): d1 = wx.DateTime.Now() tm = d1.GetTm() - + d2 = wx.DateTime() d2.SetTm(tm) self.assertTrue(d1 == d2) - + d3 = wx.DateTime() d3.Set(tm.mday, tm.mon, tm.year, tm.hour, tm.min, tm.sec, tm.msec) self.assertTrue(d1 == d3) - + def test_datetimeFormatParse(self): d = wx.DateTime(1, wx.DateTime.Mar, 2012, 8, 15, 45) @@ -141,32 +141,32 @@ class datetime_Tests(wtc.WidgetTestCase): self.assertTrue(isinstance(pd, datetime.datetime)) self.assertEqual(d1, d2) - - def test_datetimeParseDate1(self): + + def test_datetimeParseDate1(self): d = wx.DateTime() val = d.ParseDate('bogus') self.assertEqual(val, -1) - def test_datetimeParseDate2(self): + def test_datetimeParseDate2(self): d = wx.DateTime() val = d.ParseDate('10/25/2015') self.assertEqual(val, 10) self.assertEqual(d.year, 2015) self.assertEqual(d.month, wx.DateTime.Oct) self.assertEqual(d.day, 25) - - def test_datetimeParseDate3(self): + + def test_datetimeParseDate3(self): d = wx.DateTime() val = d.ParseDate('10/25/2015 non-date text') self.assertEqual(val, 13) - def test_datetimeParseDateTime1(self): + def test_datetimeParseDateTime1(self): d = wx.DateTime() val = d.ParseDateTime('bogus') self.assertEqual(val, -1) - def test_datetimeParseDateTime2(self): + def test_datetimeParseDateTime2(self): d = wx.DateTime() val = d.ParseDateTime('10/25/2015 12:25') self.assertEqual(val, 16) @@ -176,13 +176,13 @@ class datetime_Tests(wtc.WidgetTestCase): self.assertEqual(d.hour, 12) self.assertEqual(d.minute, 25) - def test_datetimeParseDateTime3(self): + def test_datetimeParseDateTime3(self): d = wx.DateTime() val = d.ParseDateTime('10/25/2015 12:25 non-date text') self.assertEqual(val, 16) - def test_datetimeParseTime1(self): + def test_datetimeParseTime1(self): d = wx.DateTime() val = d.ParseTime('12:25') self.assertEqual(val, 5) @@ -190,7 +190,7 @@ class datetime_Tests(wtc.WidgetTestCase): self.assertEqual(d.minute, 25) - def test_datetimeParseRfc822Date(self): + def test_datetimeParseRfc822Date(self): d = wx.DateTime() rfc822str = 'Wed, 25 Feb 2015 13:34:45 -0800' import email.utils as eu @@ -223,10 +223,10 @@ class datetime_Tests(wtc.WidgetTestCase): self.assertEqual(d.year, 2015) self.assertEqual(d.month, wx.DateTime.Oct) self.assertEqual(d.day, 11) - - - - + + + + diff --git a/unittests/test_xml.py b/unittests/test_xml.py index 36b0abe1..d75a258d 100644 --- a/unittests/test_xml.py +++ b/unittests/test_xml.py @@ -15,8 +15,8 @@ class xml_Tests(wtc.WidgetTestCase): node.AddChild(root) root.AddAttribute('name1', 'value1') root.AddAttribute(xml.XmlAttribute('name2', 'value2')) - - + + def test_xml2(self): xml.XML_ELEMENT_NODE xml.XML_ATTRIBUTE_NODE @@ -31,11 +31,11 @@ class xml_Tests(wtc.WidgetTestCase): xml.XML_DOCUMENT_FRAG_NODE xml.XML_NOTATION_NODE xml.XML_HTML_DOCUMENT_NODE - + xml.XML_NO_INDENTATION xml.XMLDOC_NONE xml.XMLDOC_KEEP_WHITESPACE_NODES - + #--------------------------------------------------------------------------- diff --git a/unittests/test_xrc.py b/unittests/test_xrc.py index c1065a1c..16eebcc2 100644 --- a/unittests/test_xrc.py +++ b/unittests/test_xrc.py @@ -9,24 +9,24 @@ xrcFile = os.path.join(os.path.dirname(__file__), 'xrctest.xrc') #--------------------------------------------------------------------------- class xrc_Tests(wtc.WidgetTestCase): - + def checkXmlRes(self, xmlres): assert isinstance(xmlres, xrc.XmlResource) f = xmlres.LoadFrame(self.frame, 'MainFrame') - self.assertNotEqual(f, None) + self.assertNotEqual(f, None) f.Show() self.myYield() - + id = xrc.XRCID('MainPanel') self.assertTrue(id != -1) self.assertTrue(isinstance(id, int)) - + ctrl = xrc.XRCCTRL(f, 'TitleText') self.assertTrue(ctrl != None) self.assertTrue(isinstance(ctrl, wx.StaticText)) - - + + def test_xrc1(self): xmlres = xrc.XmlResource(xrcFile) self.checkXmlRes(xmlres) @@ -46,13 +46,13 @@ class xrc_Tests(wtc.WidgetTestCase): def test_xrc4(self): xmlres = xrc.XmlResource(xrcFile) p = xmlres.LoadObjectRecursively(self.frame, 'MainPanel', 'wxPanel') - self.assertNotEqual(p, None) + self.assertNotEqual(p, None) self.frame.SendSizeEvent() self.myYield() - - #--------------------------------------------------------------------------- + + #--------------------------------------------------------------------------- # Tests for custom handlers - + # This test does not allow for 2-phase create or creating the instance of # the resource before filling it with widgets or etc. See also the next # test and try to keep the two of them in sync as much as possible. @@ -61,8 +61,8 @@ class xrc_Tests(wtc.WidgetTestCase): 400,250 - This is a test - + This is a test + 200,100 @@ -72,14 +72,14 @@ class xrc_Tests(wtc.WidgetTestCase): ''' - + # this is the class that will be created for the resource class MyCustomPanel(wx.Panel): def __init__(self, parent, id, pos, size, style, name): wx.Panel.__init__(self, parent, id, pos, size, style, name) - + # This is the little bit of customization that we do for this - # silly example. + # silly example. self.Bind(wx.EVT_SIZE, self.OnSize) t = wx.StaticText(self, -1, "MyCustomPanel") f = t.GetFont() @@ -87,7 +87,7 @@ class xrc_Tests(wtc.WidgetTestCase): f.SetPointSize(f.GetPointSize()+2) t.SetFont(f) self.t = t - + def OnSize(self, evt): sz = self.GetSize() w, h = self.t.GetTextExtent(self.t.GetLabel()) @@ -103,15 +103,15 @@ class xrc_Tests(wtc.WidgetTestCase): self.AddStyle("wxWS_EX_VALIDATE_RECURSIVELY", wx.WS_EX_VALIDATE_RECURSIVELY) self.AddStyle("wxCLIP_CHILDREN", wx.CLIP_CHILDREN) self.AddWindowStyles() - + def CanHandle(self, node): return self.IsOfClass(node, "MyCustomPanel") - + def DoCreateResource(self): # Ensure that the instance hasn't been created yet (since # we're not using 2-phase create) assert self.GetInstance() is None - + # Now create the object panel = MyCustomPanel(self.GetParentAsWindow(), self.GetID(), @@ -122,34 +122,34 @@ class xrc_Tests(wtc.WidgetTestCase): ) self.SetupWindow(panel) self.CreateChildren(panel) - return panel - + return panel + # now load it xmlres = xrc.XmlResource() - xmlres.InsertHandler( MyCustomPanelXmlHandler() ) + xmlres.InsertHandler( MyCustomPanelXmlHandler() ) success = xmlres.LoadFromString(resource) - + f = xmlres.LoadFrame(self.frame, 'MainFrame') - self.assertNotEqual(f, None) + self.assertNotEqual(f, None) f.Show() self.myYield() panel = xrc.XRCCTRL(f, 'MyPanel') - self.assertNotEqual(panel, None) + self.assertNotEqual(panel, None) self.assertTrue(isinstance(panel, MyCustomPanel)) - + # This test shows how to do basically the same as above while still # allowing the instance to be created before loading the content. - + def test_xrc6(self): resource = b''' 400,250 - This is a test - + This is a test + 200,100 @@ -159,7 +159,7 @@ class xrc_Tests(wtc.WidgetTestCase): ''' - + # this is the class that will be created for the resource class MyCustomPanel(wx.Panel): def __init__(self): @@ -174,7 +174,7 @@ class xrc_Tests(wtc.WidgetTestCase): f.SetPointSize(f.GetPointSize()+2) t.SetFont(f) self.t = t - + def OnSize(self, evt): sz = self.GetSize() w, h = self.t.GetTextExtent(self.t.GetLabel()) @@ -190,16 +190,16 @@ class xrc_Tests(wtc.WidgetTestCase): self.AddStyle("wxWS_EX_VALIDATE_RECURSIVELY", wx.WS_EX_VALIDATE_RECURSIVELY) self.AddStyle("wxCLIP_CHILDREN", wx.CLIP_CHILDREN) self.AddWindowStyles() - + def CanHandle(self, node): return self.IsOfClass(node, "MyCustomPanel") - + def DoCreateResource(self): panel = self.GetInstance() if panel is None: # if not, then create the instance (but not the window) panel = MyCustomPanel() - + # Now create the UI object panel.Create(self.GetParentAsWindow(), self.GetID(), @@ -210,30 +210,30 @@ class xrc_Tests(wtc.WidgetTestCase): ) self.SetupWindow(panel) self.CreateChildren(panel) - return panel - + return panel + # now load it xmlres = xrc.XmlResource() - xmlres.InsertHandler( MyCustomPanelXmlHandler() ) + xmlres.InsertHandler( MyCustomPanelXmlHandler() ) success = xmlres.LoadFromString(resource) - + f = xmlres.LoadFrame(self.frame, 'MainFrame') - self.assertNotEqual(f, None) + self.assertNotEqual(f, None) f.Show() self.myYield() panel = xrc.XRCCTRL(f, 'MyPanel') - self.assertNotEqual(panel, None) + self.assertNotEqual(panel, None) self.assertTrue(isinstance(panel, MyCustomPanel)) - - - - #--------------------------------------------------------------------------- + + + + #--------------------------------------------------------------------------- # Tests for the Subclass Factory def test_xrc7(self): resource = b''' - + 200,100 @@ -242,22 +242,22 @@ class xrc_Tests(wtc.WidgetTestCase): ''' - - + + # now load it xmlres = xrc.XmlResource() success = xmlres.LoadFromString(resource) - + panel = xmlres.LoadPanel(self.frame, "MyPanel") self.frame.SendSizeEvent() self.myYield() - self.assertNotEqual(panel, None) + self.assertNotEqual(panel, None) from unittests import xrcfactorytest self.assertTrue(isinstance(panel, xrcfactorytest.MyCustomPanel)) - - - + + + #--------------------------------------------------------------------------- diff --git a/unittests/wtc.py b/unittests/wtc.py index 17ffb1f4..53408674 100644 --- a/unittests/wtc.py +++ b/unittests/wtc.py @@ -37,7 +37,7 @@ class WidgetTestCase(unittest.TestCase): # helper methods - + def myYield(self, eventsToProcess=wx.EVT_CATEGORY_ALL): """ Since the tests are usually run before MainLoop is called then we @@ -57,8 +57,8 @@ class WidgetTestCase(unittest.TestCase): if 'wxOSX' in wx.PlatformInfo: wx.MilliSleep(40) # a little more than 1/30, just in case window.Update() - - + + def closeDialogs(self): """ Close dialogs by calling their EndModal method @@ -80,8 +80,8 @@ class WidgetTestCase(unittest.TestCase): if intervals <= 0: break intervals -= 1 - - + + def myExecfile(self, filename, ns): if not six.PY3: execfile(filename, ns) @@ -89,16 +89,16 @@ class WidgetTestCase(unittest.TestCase): with open(filename, 'r') as f: source = f.read() exec(source, ns) - - + + def execSample(self, name): ns = Namespace() - samplesDir = os.path.abspath(os.path.join(os.path.dirname(__file__), '../samples')) + samplesDir = os.path.abspath(os.path.join(os.path.dirname(__file__), '../samples')) self.myExecfile(os.path.join(samplesDir, name), ns.dict()) return ns - - - + + + #--------------------------------------------------------------------------- class Namespace(object): @@ -119,15 +119,15 @@ def mybytes(text): class PubsubTestCase(unittest.TestCase): """ A testcase specifically to test wx.lib.pubsub, as pub is a singleton - the tearDown removes it from sys.modules to force a reinitialization on + the tearDown removes it from sys.modules to force a reinitialization on each test. """ def setUp(self): - from wx.lib.pubsub import pub - + from wx.lib.pubsub import pub + self.pub = pub - self.assertEqual(pub, self.pub) + self.assertEqual(pub, self.pub) def tearDown(self): self.pub.unsubAll() @@ -139,9 +139,9 @@ class PubsubTestCase(unittest.TestCase): if topicMgr.getTopic('pubsub'): topicMgr.delTopic('pubsub') except: - pass + pass del self.pub - + if 'wx.lib.pubsub.pub' in sys.modules.keys(): del sys.modules['wx.lib.pubsub.pub'] diff --git a/unittests/xrcfactorytest.py b/unittests/xrcfactorytest.py index e086e6ab..1ce34b77 100644 --- a/unittests/xrcfactorytest.py +++ b/unittests/xrcfactorytest.py @@ -8,12 +8,12 @@ class MyCustomPanel(wx.Panel): # the Create step is done by XRC. self.Bind(wx.EVT_WINDOW_CREATE, self.OnCreate) self.Bind(wx.EVT_SIZE, self.OnSize) - - + + def OnCreate(self, evt): # This is the little bit of customization that we do for this # silly example. It could just as easily have been done in - # the resource. We do it in the EVT_WINDOW_CREATE handler + # the resource. We do it in the EVT_WINDOW_CREATE handler # because the window doesn't really exist yet in the __init__. if self is evt.GetEventObject(): t = wx.StaticText(self, -1, "MyCustomPanel") @@ -32,4 +32,4 @@ class MyCustomPanel(wx.Panel): sz = self.GetSize() w, h = self.t.GetTextExtent(self.t.GetLabel()) self.t.SetPosition(((sz.width-w)/2, (sz.height-h)/2)) - +