mirror of
https://github.com/wxWidgets/Phoenix.git
synced 2026-01-07 04:20:07 +01:00
Fix subclassing of wx.TextCompleter and wx.TextCompleterSimple
Closes https://github.com/wxWidgets/Phoenix/issues/827
This commit is contained in:
@@ -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)
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -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?
|
||||
|
||||
|
||||
40
unittests/test_textcompleter.py
Normal file
40
unittests/test_textcompleter.py
Normal 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()
|
||||
Reference in New Issue
Block a user