diff options
author | Dan Gudmundsson <[email protected]> | 2013-08-29 10:50:00 +0200 |
---|---|---|
committer | Dan Gudmundsson <[email protected]> | 2013-08-29 10:50:00 +0200 |
commit | 18d4e3e1a8aa59afbf360c41a540062194ff3dd1 (patch) | |
tree | d7fc6345dbdf93b972fa00eec01cc2273bdb207b /lib/wx/test/wx_event_SUITE.erl | |
parent | 3bbfd3bd72601f7881115284ebf41bc25711a6d8 (diff) | |
parent | 6a6bc2560c60ea790780dcfbc91336a734eff1be (diff) | |
download | otp-18d4e3e1a8aa59afbf360c41a540062194ff3dd1.tar.gz otp-18d4e3e1a8aa59afbf360c41a540062194ff3dd1.tar.bz2 otp-18d4e3e1a8aa59afbf360c41a540062194ff3dd1.zip |
Merge branch 'maint'
Diffstat (limited to 'lib/wx/test/wx_event_SUITE.erl')
-rw-r--r-- | lib/wx/test/wx_event_SUITE.erl | 26 |
1 files changed, 24 insertions, 2 deletions
diff --git a/lib/wx/test/wx_event_SUITE.erl b/lib/wx/test/wx_event_SUITE.erl index 53a2ee7d7b..f19adb430d 100644 --- a/lib/wx/test/wx_event_SUITE.erl +++ b/lib/wx/test/wx_event_SUITE.erl @@ -1,7 +1,7 @@ %% %% %CopyrightBegin% %% -%% Copyright Ericsson AB 2008-2012. All Rights Reserved. +%% Copyright Ericsson AB 2008-2013. All Rights Reserved. %% %% The contents of this file are subject to the Erlang Public License, %% Version 1.1, (the "License"); you may not use this file except in @@ -47,7 +47,9 @@ suite() -> [{ct_hooks,[ts_install_cth]}]. all() -> [connect, disconnect, connect_msg_20, connect_cb_20, - mouse_on_grid, spin_event, connect_in_callback, recursive]. + mouse_on_grid, spin_event, connect_in_callback, recursive, + char_events + ]. groups() -> []. @@ -398,3 +400,23 @@ recursive(Config) -> wx_test_lib:flush(), wx_test_lib:wx_destroy(Frame, Config). + + +char_events(TestInfo) when is_atom(TestInfo) -> wx_test_lib:tc_info(TestInfo); +char_events(Config) -> + Wx = wx:new(), + Frame = wxFrame:new(Wx, ?wxID_ANY, "Press any key"), + Panel = wxPanel:new(Frame, []), + wxFrame:connect(Frame, enter_window, [{callback, fun(_,_) -> + io:format("Set focus~n"), + wxWindow:setFocus(Panel) + end}]), + KeyEvent = fun(Ev,Obj) -> io:format("Got ~p~n",[Ev]), wxEvent:skip(Obj) end, + [wxWindow:connect(Panel, Types, [{callback,KeyEvent}]) + || Types <- [key_down, key_up, char]], + wxWindow:connect(Frame, char_hook, [{callback,KeyEvent}]), + + wxFrame:show(Frame), + wx_test_lib:flush(), + + wx_test_lib:wx_destroy(Frame, Config). |