aboutsummaryrefslogtreecommitdiffstats
path: root/lib/wx/test
diff options
context:
space:
mode:
authorDan Gudmundsson <[email protected]>2014-01-17 16:57:29 +0100
committerDan Gudmundsson <[email protected]>2014-01-22 16:33:01 +0100
commitfb767602c08159daa2190129622ebf185606fd35 (patch)
treead89eb12ac2f554a2151f3605c9122882b7eb386 /lib/wx/test
parent6459bb3e5c82cdd5474bdd77d8aff3a12ce88910 (diff)
downloadotp-fb767602c08159daa2190129622ebf185606fd35.tar.gz
otp-fb767602c08159daa2190129622ebf185606fd35.tar.bz2
otp-fb767602c08159daa2190129622ebf185606fd35.zip
wx: Delay memory cleanup until safe
Previously we could do a cleanup while we where recursed down and thus delete the objects we where invoking.
Diffstat (limited to 'lib/wx/test')
-rw-r--r--lib/wx/test/wx_basic_SUITE.erl16
-rw-r--r--lib/wx/test/wx_event_SUITE.erl51
2 files changed, 26 insertions, 41 deletions
diff --git a/lib/wx/test/wx_basic_SUITE.erl b/lib/wx/test/wx_basic_SUITE.erl
index 9174b80d52..79dbea0575 100644
--- a/lib/wx/test/wx_basic_SUITE.erl
+++ b/lib/wx/test/wx_basic_SUITE.erl
@@ -241,21 +241,6 @@ wx_misc(Config) ->
%% wx:shutdown() %% How do you test this?
- case os:type() of
- {win32, _} -> %% These hangs when running automatic tests
- skip; %% through ssh on windows. Works otherwise
- _ ->
- wx_misc:shell([{command,"echo TESTING close the popup shell"}])
- end,
-
- case wx_test_lib:user_available(Config) of
- true ->
- wx_misc:shell();
- false ->
- %% Don't want to spawn a shell if no user
- skip %% is available
- end,
-
?m(false, wx_misc:isBusy()),
?m(ok, wx_misc:beginBusyCursor([])),
?m(true, wx_misc:isBusy()),
@@ -356,6 +341,7 @@ wx_object(Config) ->
%% Which it did in my buggy handling of the sync_callback
wxWindow:refresh(Frame),
?m([{sync_event, #wx{event=#wxPaint{}}, _}], flush()),
+ timer:sleep(500),
?m([{cast, slept}], flush()),
Monitor = erlang:monitor(process, FramePid),
diff --git a/lib/wx/test/wx_event_SUITE.erl b/lib/wx/test/wx_event_SUITE.erl
index 2711943e5d..b9c2fafe0e 100644
--- a/lib/wx/test/wx_event_SUITE.erl
+++ b/lib/wx/test/wx_event_SUITE.erl
@@ -409,32 +409,31 @@ dialog(Config) ->
wxFrame:show(Frame),
Env = wx:get_env(),
Tester = self(),
- spawn_link(
- fun() ->
- wx:set_env(Env),
- PD = wxProgressDialog:new("Dialog","Testing",
- [%%{parent, Frame},
- {maximum,10},
- {style, ?wxPD_SMOOTH bor ?wxPD_AUTO_HIDE}]),
- wxDialog:connect(PD, init_dialog
- , [{callback, fun(#wx{event=#wxInitDialog{}}, Ev) ->
- ?mt(wxInitDialogEvent, Ev),
- io:format("Heyhoo~n", []),
- wxEvent:skip(Ev),
- Tester ! {progress_dialog,PD}
- end}]
- ),
- wxProgressDialog:showModal(PD),
- wxDialog:destroy(PD)
- end),
- receive {progress_dialog,PD} ->
- wxDialog:endModal(PD, ?wxID_OK)
- after 5000 ->
- exit(timeout)
- end,
-
- wx_test_lib:flush(),
-
+ PD = wxProgressDialog:new("Dialog","Testing",
+ [%%{parent, Frame},
+ {maximum,101},
+ {style, ?wxPD_SMOOTH bor ?wxPD_AUTO_HIDE}]),
+ Forward = fun(#wx{event=#wxInitDialog{}}, Ev) ->
+ ?mt(wxInitDialogEvent, Ev),
+ io:format("Heyhoo~n", []),
+ wxEvent:skip(Ev),
+ Tester ! {progress_dialog,PD}
+ end,
+ wxDialog:connect(PD, init_dialog, [{callback, Forward}]),
+ Recurse = fun(Recurse, N) ->
+ true = wxProgressDialog:update(PD, min(N,100)),
+ timer:sleep(5),
+ Recurse(Recurse,N+1)
+ end,
+ Run = fun() ->
+ wx:set_env(Env),
+ Recurse(Recurse, 0)
+ end,
+ Worker = spawn_link(Run),
+ timer:sleep(500),
+ io:format("Got ~p~n", [wx_test_lib:flush()]),
+ unlink(Worker),
+ wxProgressDialog:destroy(PD),
wx_test_lib:wx_destroy(Frame, Config).