~clint-fewbar/ubuntu/precise/erlang/merge-15b

« back to all changes in this revision

Viewing changes to lib/wx/test/wx_event_SUITE.erl

  • Committer: Package Import Robot
  • Author(s): Sergei Golovan
  • Date: 2011-12-15 19:20:10 UTC
  • mfrom: (1.1.18) (3.5.15 sid)
  • mto: (3.5.16 sid)
  • mto: This revision was merged to the branch mainline in revision 33.
  • Revision ID: package-import@ubuntu.com-20111215192010-jnxcfe3tbrpp0big
Tags: 1:15.b-dfsg-1
* New upstream release.
* Upload to experimental because this release breaks external drivers
  API along with ABI, so several applications are to be fixed.
* Removed SSL patch because the old SSL implementation is removed from
  the upstream distribution.
* Removed never used patch which added native code to erlang beam files.
* Removed the erlang-docbuilder binary package because the docbuilder
  application was dropped by upstream.
* Documented dropping ${erlang-docbuilder:Depends} substvar in
  erlang-depends(1) manpage.
* Made erlang-base and erlang-base-hipe provide virtual package
  erlang-abi-15.b (the number means the first erlang version, which
  provides current ABI).

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
1
%%
2
2
%% %CopyrightBegin%
3
3
%% 
4
 
%% Copyright Ericsson AB 2008-2009. All Rights Reserved.
 
4
%% Copyright Ericsson AB 2008-2011. All Rights Reserved.
5
5
%% 
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]).
27
28
 
28
29
-compile(export_all).
29
30
 
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).
45
44
 
46
45
%% SUITE specification
47
 
all() ->
48
 
    all(suite).
49
 
all(suite) ->
50
 
    [
51
 
     connect,
52
 
     disconnect,
53
 
     connect_msg_20,
54
 
     connect_cb_20,
55
 
     mouse_on_grid,
56
 
     spin_event,
57
 
     connect_in_callback
58
 
    ].
 
46
suite() -> [{ct_hooks,[ts_install_cth]}].
 
47
 
 
48
all() -> 
 
49
    [connect, disconnect, connect_msg_20, connect_cb_20,
 
50
     mouse_on_grid, spin_event, connect_in_callback, recursive].
 
51
 
 
52
groups() -> 
 
53
    [].
 
54
 
 
55
init_per_group(_GroupName, Config) ->
 
56
    Config.
 
57
 
 
58
end_per_group(_GroupName, Config) ->
 
59
    Config.
 
60
 
59
61
  
60
62
%% The test cases
61
63
 
329
331
    wx_test_lib:flush(),
330
332
    
331
333
    wx_test_lib:wx_destroy(Frame, Config).
 
334
 
 
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);
 
338
recursive(Config) ->
 
339
    Wx = wx:new(),
 
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,
 
347
                      [{callback,
 
348
                        fun(#wx{event=#wxCommand{commandInt=Id}}, _) ->
 
349
                                io:format("Selected ~p~n",[Id])
 
350
                        end}]),
 
351
    wxListBox:setSelection(ListBox, 0),
 
352
    wxListBox:connect(ListBox, size,
 
353
                      [{callback,
 
354
                        fun(#wx{event=#wxSize{}}, _) ->
 
355
                                io:format("Size init ~n",[]),
 
356
                                case wxListBox:getCount(ListBox) > 0 of
 
357
                                    true ->  wxListBox:delete(ListBox, 0);
 
358
                                    false -> ok
 
359
                                end,
 
360
                                io:format("Size done ~n",[])
 
361
                        end}]),
 
362
    wxFrame:show(Frame),
 
363
    wx_test_lib:flush(),
 
364
 
 
365
    wx_test_lib:wx_destroy(Frame, Config).