diff --git a/unittests/process_test.py b/unittests/process_test.py new file mode 100644 index 00000000..de98bf85 --- /dev/null +++ b/unittests/process_test.py @@ -0,0 +1,3 @@ +import sys +print 'process_test' +sys.exit(0) diff --git a/unittests/test_checkbox.py b/unittests/test_checkbox.py index 7ed858a7..7e5be411 100644 --- a/unittests/test_checkbox.py +++ b/unittests/test_checkbox.py @@ -4,14 +4,14 @@ import wx #--------------------------------------------------------------------------- -class CheckBoxTests(wtc.WidgetTestCase): +class checkbox_Tests(wtc.WidgetTestCase): - def test_CheckBoxCtors(self): + def test_checkboxCtors(self): c = wx.CheckBox(self.frame, label="checkbox") c = wx.CheckBox(self.frame, -1, "checkbox", wx.Point(10,10), wx.Size(80,-1)) - def test_CheckBoxDefaultCtor(self): + def test_checkboxDefaultCtor(self): c = wx.CheckBox() c.Create(self.frame, label="checkbox") diff --git a/unittests/test_process.py b/unittests/test_process.py new file mode 100644 index 00000000..16d50ae3 --- /dev/null +++ b/unittests/test_process.py @@ -0,0 +1,34 @@ +import imp_unittest, unittest +import wtc +import wx +import sys, os + +testscript = os.path.join(os.path.dirname(__file__), 'process_test.py') + +#--------------------------------------------------------------------------- + +class process_Tests(wtc.WidgetTestCase): + + 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.PortInfo: + p = wx.Process.Open('%s %s' % (sys.executable, testscript)) + pid = p.GetPid() + + + def test_process2(self): + flag = False + def onEndProcess(evt): + flag = True + + if 'wxMac' not in wx.PortInfo: + p = wx.Process(self.frame) + self.frame.Bind(wx.EVT_END_PROCESS, onEndProcess) + wx.Execute('%s %s' % (sys.executable, testscript), p) + +#--------------------------------------------------------------------------- + + +if __name__ == '__main__': + unittest.main() diff --git a/unittests/test_progdlg.py b/unittests/test_progdlg.py new file mode 100644 index 00000000..25cebb27 --- /dev/null +++ b/unittests/test_progdlg.py @@ -0,0 +1,33 @@ +import imp_unittest, unittest +import wtc +import wx + + +#--------------------------------------------------------------------------- + +class progdlg_Tests(wtc.WidgetTestCase): + + def test_progdlg1(self): + max = 50 + dlg = wx.ProgressDialog("Progress dialog example", + "An informative message", + parent=self.frame, + maximum=max) + + keepGoing = True + count = 0 + + while keepGoing and count < max: + count += 1 + #wx.MilliSleep(250) + self.myYield() + (keepGoing, skip) = dlg.Update(count) + + dlg.Destroy() + + +#--------------------------------------------------------------------------- + + +if __name__ == '__main__': + unittest.main() diff --git a/unittests/test_radiobox.py b/unittests/test_radiobox.py new file mode 100644 index 00000000..69723f97 --- /dev/null +++ b/unittests/test_radiobox.py @@ -0,0 +1,34 @@ +import imp_unittest, unittest +import wtc +import wx + +#--------------------------------------------------------------------------- + +class radiobox_Tests(wtc.WidgetTestCase): + + def test_radioboxCtor(self): + r = wx.RadioBox(self.frame, label='Label', choices='one two three four'.split(), + majorDimension=2) + + def test_radioboxDefaultCtor(self): + 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) + + +#--------------------------------------------------------------------------- + + +if __name__ == '__main__': + unittest.main() diff --git a/unittests/test_radiobut.py b/unittests/test_radiobut.py new file mode 100644 index 00000000..3cd7e7cc --- /dev/null +++ b/unittests/test_radiobut.py @@ -0,0 +1,29 @@ +import imp_unittest, unittest +import wtc +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') + b.Value = True + self.assertTrue(b.GetValue() == True) + b.Value = False + self.assertTrue(b.GetValue() == False) + + +#--------------------------------------------------------------------------- + + +if __name__ == '__main__': + unittest.main() diff --git a/unittests/test_region.py b/unittests/test_region.py new file mode 100644 index 00000000..f86059ee --- /dev/null +++ b/unittests/test_region.py @@ -0,0 +1,58 @@ +import imp_unittest, unittest +import wtc +import wx +import sys, os + +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) + r = wx.Region(wx.Point(10,10), wx.Point(100,100)) + r = wx.Region(wx.Rect(10,10, 100, 100)) + r2 = wx.Region(r) + r = wx.Region([(10,10), (100, 10), (100, 100), (10, 100)]) + 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) + count = 0 + while iterator: + rect = iterator.GetRect() + self.assertTrue(isinstance(rect, wx.Rect)) + iterator.Next() + count += 1 + self.assertTrue(count > 0) + + + def test_regionIterator2(self): + region = wx.Region([(10,10), (100, 100), (10, 100)]) + count = 0 + for rect in region: + self.assertTrue(isinstance(rect, wx.Rect)) + count += 1 + self.assertTrue(count > 0) + + + def test_regionOtherRandomStuff(self): + region = wx.Region([(10,10), (100, 100), (10, 100)]) + bmp = wx.Bitmap(pngFile) + region.Union(bmp) + region.Contains(10, 20) + region.Contains(wx.Point(10,20)) + region.Contains(wx.Rect(10,20,4,4)) + region.Subtract(wx.Rect(10,20,4,4)) + +#--------------------------------------------------------------------------- + + +if __name__ == '__main__': + unittest.main()