Merge branch 'fix_fshandler_subclasses' of https://github.com/swt2c/Phoenix into swt2c-fix_fshandler_subclasses

# Conflicts:
#	unittests/test_filesys.py
This commit is contained in:
Robin Dunn
2016-12-09 17:47:16 -08:00
2 changed files with 13 additions and 8 deletions

View File

@@ -54,30 +54,31 @@ def run():
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()

View File

@@ -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,20 @@ 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())
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.
#---------------------------------------------------------------------------