Skip to content

Commit

Permalink
Merge branch 'fix_fshandler_subclasses' of https://github.com/swt2c/P…
Browse files Browse the repository at this point in the history
…hoenix into swt2c-fix_fshandler_subclasses

# Conflicts:
#	unittests/test_filesys.py
  • Loading branch information
RobinD42 committed Dec 10, 2016
2 parents d550c79 + ed8a8f8 commit 08baaf9
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 8 deletions.
11 changes: 6 additions & 5 deletions etg/filesys.py
Original file line number Diff line number Diff line change
Expand Up @@ -54,30 +54,31 @@ def _fixHandlerClass(klass):
klass.addItem(etgtools.WigCode("""\
virtual bool CanOpen(const wxString& location);
virtual wxFSFile* OpenFile(wxFileSystem& fs, const wxString& location);
virtual wxString FindFirst(const wxString& spec, int flags = 0);
virtual wxString FindNext();
"""))


c = module.find('wxArchiveFSHandler')
_fixHandlerClass(c)
c.addPrivateCopyCtor()
module.addPyCode('ZipFSHandler = wx.deprecated(ArchiveFSHandler, "Use ArchiveFSHandler instead.")')
_fixHandlerClass(c)

c = module.find('wxFSFile')
c.addPrivateCopyCtor()
_fixHandlerClass(c)

c = module.find('wxFilterFSHandler')
c.addPrivateCopyCtor()
_fixHandlerClass(c)
c.addPrivateCopyCtor()

c = module.find('wxInternetFSHandler')
c.addPrivateCopyCtor()
_fixHandlerClass(c)
c.addPrivateCopyCtor()


c = module.find('wxMemoryFSHandler')
c.addPrivateCopyCtor()
_fixHandlerClass(c)
c.addPrivateCopyCtor()

# Make some more python-friendly versions of the AddFile methods accepting raw data
c.find('AddFile').findOverload('binarydata').ignore()
Expand Down
10 changes: 7 additions & 3 deletions unittests/test_filesys.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
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
Expand All @@ -21,16 +21,20 @@ def test_filesysClasses(self):

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())

def test_filesysMemoryFSHandler(self):
memoryFS = wx.MemoryFSHandler()
memoryFS.AddFile('test.txt', 'This is a test')
self.assertTrue(memoryFS.FindFirst('test.txt') == 'test.txt')

# TODO: Add more tests.

#---------------------------------------------------------------------------


Expand Down

0 comments on commit 08baaf9

Please sign in to comment.