Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
FSL
fsleyes
fsleyes-widgets
Commits
81020be0
Commit
81020be0
authored
Oct 06, 2021
by
Paul McCarthy
🚵
Browse files
TEST: Unit tests for new autotextctrl style
parent
842fd215
Changes
1
Show whitespace changes
Inline
Side-by-side
tests/test_autotextctrl.py
View file @
81020be0
...
...
@@ -211,3 +211,58 @@ def _test_popup_dblclick():
realYield
()
assert
atc
.
GetValue
()
==
'aaa'
def
test_popup_propagate_enter
():
run_with_wx
(
_test_popup_propagate_enter
)
def
_test_popup_propagate_enter
():
sim
=
wx
.
UIActionSimulator
()
parent
=
wx
.
GetApp
().
GetTopWindow
()
atc
=
autott
.
AutoTextCtrl
(
parent
,
modal
=
False
)
called
=
[
False
]
def
atcEnter
(
ev
):
called
[
0
]
=
True
addall
(
parent
,
[
atc
])
atc
.
Bind
(
autott
.
EVT_ATC_TEXT_ENTER
,
atcEnter
)
atc
.
AutoComplete
([
'aaa'
,
'aab'
,
'aba'
,
'bcc'
])
simtext
(
sim
,
atc
,
'ab'
,
enter
=
False
)
simkey
(
sim
,
atc
.
popup
.
textCtrl
,
wx
.
WXK_DOWN
)
simkey
(
sim
,
atc
.
popup
.
listBox
,
wx
.
WXK_RETURN
)
assert
atc
.
GetValue
()
==
'aba'
assert
called
[
0
]
def
test_popup_no_propagate_enter
():
run_with_wx
(
_test_popup_no_propagate_enter
)
def
_test_popup_no_propagate_enter
():
sim
=
wx
.
UIActionSimulator
()
parent
=
wx
.
GetApp
().
GetTopWindow
()
atc
=
autott
.
AutoTextCtrl
(
parent
,
modal
=
False
,
style
=
autott
.
ATC_NO_PROPAGATE_ENTER
)
called
=
[
False
]
def
atcEnter
(
ev
):
called
[
0
]
=
True
addall
(
parent
,
[
atc
])
atc
.
Bind
(
autott
.
EVT_ATC_TEXT_ENTER
,
atcEnter
)
atc
.
AutoComplete
([
'aaa'
,
'aab'
,
'aba'
,
'bcc'
])
simtext
(
sim
,
atc
,
'ab'
,
enter
=
False
)
simkey
(
sim
,
atc
.
popup
.
textCtrl
,
wx
.
WXK_DOWN
)
simkey
(
sim
,
atc
.
popup
.
listBox
,
wx
.
WXK_RETURN
)
assert
atc
.
GetValue
()
==
'aba'
assert
not
called
[
0
]
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment