Commit 0e2abaf3 authored by Paul McCarthy's avatar Paul McCarthy 🚵
Browse files

TEST: These tests are impossible to maintain, because gtk/wxpython are shit

parent 4d5da82a
......@@ -188,12 +188,16 @@ def test_popup_dblclick():
run_with_wx(_test_popup_dblclick)
def _test_popup_dblclick():
class FakeEv:
def __init__(self, keycode=None):
self.keycode = keycode
def GetKeyCode(self):
return self.keycode
def Skip(self):
pass
def ResumePropagation(self, a):
pass
sim = wx.UIActionSimulator()
parent = wx.GetApp().GetTopWindow()
atc = autott.AutoTextCtrl(parent, modal=False)
......@@ -201,7 +205,7 @@ def _test_popup_dblclick():
addall(parent, [atc])
simkey( sim, atc.textCtrl, wx.WXK_RETURN)
atc._AutoTextCtrl__onKeyDown(FakeEv(wx.WXK_RETURN))
atc.popup.listBox.SetSelection(0)
atc.popup._AutoCompletePopup__onListMouseDblClick(FakeEv())
realYield()
......
......@@ -140,7 +140,6 @@ def test_TextTagPanel_nostyle():
run_with_wx(_test_TextTagPanel_nostyle)
def _test_TextTagPanel_nostyle():
sim = wx.UIActionSimulator()
frame = wx.GetApp().GetTopWindow()
panel = tt.TextTagPanel(frame, style=0)
......@@ -148,10 +147,9 @@ def _test_TextTagPanel_nostyle():
result = [None]
def handler(ev):
result[0] = ev.tag
panel.Bind(tt.EVT_TTP_TAG_ADDED, handler)
def simtext(text):
panel.newTagCtrl.ChangeValue(text)
panel._TextTagPanel__onTextCtrl(None)
tags = ['Tag1', 'Tag2', 'Tag3']
......@@ -159,30 +157,24 @@ def _test_TextTagPanel_nostyle():
# Add an existing tag
realYield()
simtext(sim, panel.newTagCtrl.textCtrl, tags[0])
simtext(tags[0])
assert panel.GetTags() == [tags[0]]
assert result[0] == tags[0]
simtext(sim, panel.newTagCtrl.textCtrl, tags[2])
simtext(tags[2])
assert panel.GetTags() == [tags[0], tags[2]]
assert result[0] == tags[2]
# Duplicate
result[0] = None
simtext(sim, panel.newTagCtrl.textCtrl, tags[2])
simtext(tags[2])
assert panel.GetTags() == [tags[0], tags[2], tags[2]]
assert result[0] == tags[2]
# Case insensitive
simtext(sim, panel.newTagCtrl.textCtrl, tags[1].lower())
simtext(tags[1].lower())
assert panel.GetTags() == [tags[0], tags[2], tags[2], tags[1]]
assert result[0] == tags[1]
# Not in known tags
result[0] = None
simtext(sim, panel.newTagCtrl.textCtrl, 'notag')
simtext('notag')
assert panel.GetTags() == [tags[0], tags[2], tags[2], tags[1]]
assert result[0] is None
def test_TextTagPanel_close_event():
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment