4
%% Copyright Ericsson AB 2008-2009. All Rights Reserved.
4
%% Copyright Ericsson AB 2008-2011. All Rights Reserved.
6
6
%% The contents of this file are subject to the Erlang Public License,
7
7
%% Version 1.1, (the "License"); you may not use this file except in
22
22
%%% Created : 3 Nov 2008 by Dan Gudmundsson <dan.gudmundsson@ericsson.com>
23
23
%%%-------------------------------------------------------------------
24
24
-module(wx_event_SUITE).
25
-export([all/0, init_per_suite/1, end_per_suite/1,
26
init_per_testcase/2, fin_per_testcase/2, end_per_testcase/2]).
25
-export([all/0, suite/0,groups/0,init_per_group/2,end_per_group/2,
26
init_per_suite/1, end_per_suite/1,
27
init_per_testcase/2, end_per_testcase/2]).
28
29
-compile(export_all).
40
41
wx_test_lib:init_per_testcase(Func,Config).
41
42
end_per_testcase(Func,Config) ->
42
43
wx_test_lib:end_per_testcase(Func,Config).
43
fin_per_testcase(Func,Config) -> %% For test_server
44
wx_test_lib:end_per_testcase(Func,Config).
46
45
%% SUITE specification
46
suite() -> [{ct_hooks,[ts_install_cth]}].
49
[connect, disconnect, connect_msg_20, connect_cb_20,
50
mouse_on_grid, spin_event, connect_in_callback, recursive].
55
init_per_group(_GroupName, Config) ->
58
end_per_group(_GroupName, Config) ->
329
331
wx_test_lib:flush(),
331
333
wx_test_lib:wx_destroy(Frame, Config).
335
%% Test that event callback which triggers another callback works
336
%% i.e. the callback invoker in driver will recurse
337
recursive(TestInfo) when is_atom(TestInfo) -> wx_test_lib:tc_info(TestInfo);
340
Frame = wxFrame:new(Wx, ?wxID_ANY, "Connect in callback"),
341
Panel = wxPanel:new(Frame, []),
342
Sz = wxBoxSizer:new(?wxVERTICAL),
343
ListBox = wxListBox:new(Panel, ?wxID_ANY, [{choices, ["foo", "bar", "baz"]}]),
344
wxSizer:add(Sz, ListBox, [{proportion, 1},{flag, ?wxEXPAND}]),
345
wxWindow:setSizer(Panel, Sz),
346
wxListBox:connect(ListBox, command_listbox_selected,
348
fun(#wx{event=#wxCommand{commandInt=Id}}, _) ->
349
io:format("Selected ~p~n",[Id])
351
wxListBox:setSelection(ListBox, 0),
352
wxListBox:connect(ListBox, size,
354
fun(#wx{event=#wxSize{}}, _) ->
355
io:format("Size init ~n",[]),
356
case wxListBox:getCount(ListBox) > 0 of
357
true -> wxListBox:delete(ListBox, 0);
360
io:format("Size done ~n",[])
365
wx_test_lib:wx_destroy(Frame, Config).