diff options
Diffstat (limited to 'lib/wx/test')
-rw-r--r-- | lib/wx/test/wx_class_SUITE.erl | 19 | ||||
-rw-r--r-- | lib/wx/test/wx_event_SUITE.erl | 26 |
2 files changed, 42 insertions, 3 deletions
diff --git a/lib/wx/test/wx_class_SUITE.erl b/lib/wx/test/wx_class_SUITE.erl index 7c3eda0be1..0e151ccc9b 100644 --- a/lib/wx/test/wx_class_SUITE.erl +++ b/lib/wx/test/wx_class_SUITE.erl @@ -50,7 +50,7 @@ suite() -> [{ct_hooks,[ts_install_cth]}]. all() -> [calendarCtrl, treeCtrl, notebook, staticBoxSizer, clipboard, helpFrame, htmlWindow, listCtrlSort, listCtrlVirtual, - radioBox, systemSettings, taskBarIcon]. + radioBox, systemSettings, taskBarIcon, toolbar]. groups() -> []. @@ -493,3 +493,20 @@ taskBarIcon(Config) -> wxTaskBarIcon:connect(TBI, taskbar_left_down, [{callback, fun(Ev,_) -> io:format("Left clicked: ~p~n",[Ev]) end}]), wxTaskBarIcon:connect(TBI, taskbar_right_down, [{callback,fun(Ev,_) -> io:format("Right clicked: ~p~n",[Ev]) end}]), wx_test_lib:wx_destroy(Frame,Config). + +toolbar(TestInfo) when is_atom(TestInfo) -> wx_test_lib:tc_info(TestInfo); +toolbar(Config) -> + Wx = wx:new(), + Frame = wxFrame:new(Wx, ?wxID_ANY, "Frame"), + TB = wxFrame:createToolBar(Frame), + wxToolBar:addTool(TB, 747, "PressMe", wxArtProvider:getBitmap("wxART_COPY", [{size, {16,16}}]), + [{shortHelp, "Press Me"}]), + + Add = fun(#wx{}, _) -> + wxToolBar:addTool(TB, -1, "Added", wxArtProvider:getBitmap("wxART_TICK_MARK", [{size, {16,16}}]), + [{shortHelp, "Test 2 popup text"}]) + end, + + wxFrame:connect(Frame, command_menu_selected, [{callback, Add}, {id, 747}]), + wxFrame:show(Frame), + wx_test_lib:wx_destroy(Frame,Config). 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). |