Ignore the GetFirst/GetNext methods in wx.FileConfig so it will use the custom ones in wx.ConfigBase instead.

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxPython/Phoenix/trunk@73813 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Robin Dunn
2013-04-13 01:46:09 +00:00
parent b0f18532d4
commit bea3258b0b
2 changed files with 60 additions and 5 deletions

View File

@@ -162,12 +162,19 @@ def run():
#-----------------------------------------------------------------
c = module.find('wxFileConfig')
c.addPrivateCopyCtor()
c.find('wxFileConfig').findOverload('wxInputStream').ignore()
ctor = c.find('wxFileConfig').findOverload('wxString')
ctor.items.remove(ctor.find('conv'))
ctor = c.find('Save').ignore()
c.find('wxFileConfig').findOverload('wxInputStream').find('conv').ignore()
ctor = c.find('wxFileConfig').findOverload('wxString').find('conv').ignore()
#ctor.items.remove(ctor.find('conv'))
ctor = c.find('Save').find('conv').ignore()
c.find('GetGlobalFile').ignore()
c.find('GetLocalFile').ignore()
c.find('GetFirstGroup').ignore()
c.find('GetNextGroup').ignore()
c.find('GetFirstEntry').ignore()
c.find('GetNextEntry').ignore()
#-----------------------------------------------------------------
# In C++ wxConfig is a #define to some other config class. We'll let our

View File

@@ -65,7 +65,7 @@ class ConfigTests(wtc.WidgetTestCase):
os.remove(name)
def _test_Config4(self): # disabled for now...
def test_Config4(self): # disabled for now...
null = wx.LogNull()
name = cfgFilename + '_4'
@@ -139,6 +139,54 @@ class ConfigTests(wtc.WidgetTestCase):
del cfg
if os.path.exists(name):
os.remove(name)
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')
cfg.Write('key3', 'value')
cfg.SetPath('/two')
cfg.Write('key1', 'value')
cfg.Write('key2', 'value')
cfg.Write('key3', 'value')
cfg.SetPath('/three')
cfg.Write('key1', 'value')
cfg.Write('key2', 'value')
cfg.Write('key3', 'value')
cfg.Flush()
cfg.SetPath('/')
count = 0
more, group, index = cfg.GetFirstGroup()
while more:
count += 1
more, group, index = cfg.GetNextGroup(index)
self.assertEqual(count, 4)
cfg.SetPath('/two')
count = 0
more, entry, index = cfg.GetFirstEntry()
while more:
count += 1
more, entry, index = cfg.GetNextEntry(index)
self.assertEqual(count, 3)
del cfg
if os.path.exists(name):
os.remove(name)
#---------------------------------------------------------------------------