aboutsummaryrefslogtreecommitdiffstats
path: root/lib/wx/test/wx_event_SUITE.erl
diff options
context:
space:
mode:
authorDan Gudmundsson <[email protected]>2011-11-18 08:55:33 +0100
committerDan Gudmundsson <[email protected]>2011-11-18 08:56:54 +0100
commit1d4c9de4304de621a41dcbe5eef866d449b03a12 (patch)
tree071f151cd2e32e33580b2c15128e3dbbdd2ed7ae /lib/wx/test/wx_event_SUITE.erl
parent1a2d7fd6f8fd88f2dad49152fb10f30b952709ce (diff)
parent5cd8a13c24cbb9e3c514807b56460bb90a777235 (diff)
downloadotp-1d4c9de4304de621a41dcbe5eef866d449b03a12.tar.gz
otp-1d4c9de4304de621a41dcbe5eef866d449b03a12.tar.bz2
otp-1d4c9de4304de621a41dcbe5eef866d449b03a12.zip
Merge branch 'dgud/wx/system_opts/OTP-9702'
* dgud/wx/system_opts/OTP-9702: [wx] Change libGL loading [wx] Fix deadlock in callback handling [wx] Add wxSystemOptions [wx] Fix whitespaces OTP-9725
Diffstat (limited to 'lib/wx/test/wx_event_SUITE.erl')
-rw-r--r--lib/wx/test/wx_event_SUITE.erl34
1 files changed, 33 insertions, 1 deletions
diff --git a/lib/wx/test/wx_event_SUITE.erl b/lib/wx/test/wx_event_SUITE.erl
index 0d8dd4852e..8f364049b4 100644
--- a/lib/wx/test/wx_event_SUITE.erl
+++ b/lib/wx/test/wx_event_SUITE.erl
@@ -47,7 +47,7 @@ suite() -> [{ct_hooks,[ts_install_cth]}].
all() ->
[connect, disconnect, connect_msg_20, connect_cb_20,
- mouse_on_grid, spin_event, connect_in_callback].
+ mouse_on_grid, spin_event, connect_in_callback, recursive].
groups() ->
[].
@@ -331,3 +331,35 @@ connect_in_callback(Config) ->
wx_test_lib:flush(),
wx_test_lib:wx_destroy(Frame, Config).
+
+%% Test that event callback which triggers another callback works
+%% i.e. the callback invoker in driver will recurse
+recursive(TestInfo) when is_atom(TestInfo) -> wx_test_lib:tc_info(TestInfo);
+recursive(Config) ->
+ Wx = wx:new(),
+ Frame = wxFrame:new(Wx, ?wxID_ANY, "Connect in callback"),
+ Panel = wxPanel:new(Frame, []),
+ Sz = wxBoxSizer:new(?wxVERTICAL),
+ ListBox = wxListBox:new(Panel, ?wxID_ANY, [{choices, ["foo", "bar", "baz"]}]),
+ wxSizer:add(Sz, ListBox, [{proportion, 1},{flag, ?wxEXPAND}]),
+ wxWindow:setSizer(Panel, Sz),
+ wxListBox:connect(ListBox, command_listbox_selected,
+ [{callback,
+ fun(#wx{event=#wxCommand{commandInt=Id}}, _) ->
+ io:format("Selected ~p~n",[Id])
+ end}]),
+ wxListBox:setSelection(ListBox, 0),
+ wxListBox:connect(ListBox, size,
+ [{callback,
+ fun(#wx{event=#wxSize{}}, _) ->
+ io:format("Size init ~n",[]),
+ case wxListBox:getCount(ListBox) > 0 of
+ true -> wxListBox:delete(ListBox, 0);
+ false -> ok
+ end,
+ io:format("Size done ~n",[])
+ end}]),
+ wxFrame:show(Frame),
+ wx_test_lib:flush(),
+
+ wx_test_lib:wx_destroy(Frame, Config).