Fix subclassing of wx.TextCompleter and wx.TextCompleterSimple

Closes https://github.com/wxWidgets/Phoenix/issues/827
This commit is contained in:
Scott Talbert
2018-04-27 20:40:47 -04:00
parent d4bd2fe6c8
commit b0d5e2d875
3 changed files with 44 additions and 0 deletions

View File

@@ -61,6 +61,8 @@ Changes in this release include the following:
* Fixed bug in wx.lib.intctrl (#790)
* Fixed subclassing of wx.TextCompleter and wx.TextCompleterSimple (#827)

View File

@@ -35,8 +35,10 @@ def run():
c = module.find('wxTextCompleter')
assert isinstance(c, etgtools.ClassDef)
c.addPrivateCopyCtor()
c.addDefaultCtor(prot='public')
c = module.find('wxTextCompleterSimple')
c.addDefaultCtor(prot='public')
# TODO: Change GetCompletions to return the wxArrayString instead of
# passing it as a parameter?

View File

@@ -0,0 +1,40 @@
import unittest
from unittests import wtc
import wx
#---------------------------------------------------------------------------
class testcompleter_Tests(wtc.WidgetTestCase):
def test_textcompleterClasses(self):
wx.TextCompleter
wx.TextCompleterSimple
def test_textCompleter1(self):
class MyTextCompleter(wx.TextCompleter):
def __init__(self):
wx.TextCompleter.__init__(self)
def Start(self, prefix):
return False
def GetNext(self):
return ''
t = wx.TextCtrl(self.frame)
t.AutoComplete(MyTextCompleter())
def test_textCompleterSimple(self):
class MyTextCompleterSimple(wx.TextCompleterSimple):
def __init__(self):
wx.TextCompleterSimple.__init__(self)
def GetCompletions(self, prefix, res):
res.append("one")
res.append("two")
t = wx.TextCtrl(self.frame)
t.AutoComplete(MyTextCompleterSimple())
#---------------------------------------------------------------------------
if __name__ == '__main__':
unittest.main()