diff --git a/etg/clipbrd.py b/etg/clipbrd.py index 984222bf..794eed31 100644 --- a/etg/clipbrd.py +++ b/etg/clipbrd.py @@ -41,6 +41,7 @@ def run(): c.addPyMethod('__enter__', '(self)', 'return self') c.addPyMethod('__exit__', '(self, exc_type, exc_val, exc_tb)', 'self.Close()') + # TODO: This init wrapper class may be useful elsewhere... module.addPyCode("""\ # Since wxTheClipoard is not really a global varaiable (it is a macro # that calls the Get static method) we can't declare it as a global diff --git a/unittests/test_clipbrd.py b/unittests/test_clipbrd.py index 13cdfe36..e631f12f 100644 --- a/unittests/test_clipbrd.py +++ b/unittests/test_clipbrd.py @@ -6,9 +6,20 @@ import wx class clipbrd_Tests(wtc.WidgetTestCase): - # TODO: Remove this test and add real ones. def test_clipbrd1(self): - self.fail("Unit tests for clipbrd not implemented yet.") + # copy + data1 = wx.TextDataObject('This is some data.') + if wx.TheClipboard.Open(): + wx.TheClipboard.SetData(data1) + wx.TheClipboard.Close() + + # paste + data2 = wx.TextDataObject() + if wx.TheClipboard.Open(): + wx.TheClipboard.GetData(data2) + wx.TheClipboard.Close() + + self.assertEqual(data2.GetText(), 'This is some data.') #---------------------------------------------------------------------------