summaryrefslogtreecommitdiff
path: root/lib/wx/test/wx_test_lib.erl
diff options
context:
space:
mode:
Diffstat (limited to 'lib/wx/test/wx_test_lib.erl')
-rw-r--r--lib/wx/test/wx_test_lib.erl41
1 files changed, 22 insertions, 19 deletions
diff --git a/lib/wx/test/wx_test_lib.erl b/lib/wx/test/wx_test_lib.erl
index 8509d6be6f..9f26b8cb9d 100644
--- a/lib/wx/test/wx_test_lib.erl
+++ b/lib/wx/test/wx_test_lib.erl
@@ -1,18 +1,19 @@
%%
%% %CopyrightBegin%
%%
-%% Copyright Ericsson AB 2008-2010. All Rights Reserved.
+%% Copyright Ericsson AB 2008-2016. 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
-%% compliance with the License. You should have received a copy of the
-%% Erlang Public License along with this software. If not, it can be
-%% retrieved online at http://www.erlang.org/.
-%%
-%% Software distributed under the License is distributed on an "AS IS"
-%% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See
-%% the License for the specific language governing rights and limitations
-%% under the License.
+%% Licensed under the Apache License, Version 2.0 (the "License");
+%% you may not use this file except in compliance with the License.
+%% You may obtain a copy of the License at
+%%
+%% http://www.apache.org/licenses/LICENSE-2.0
+%%
+%% Unless required by applicable law or agreed to in writing, software
+%% distributed under the License is distributed on an "AS IS" BASIS,
+%% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+%% See the License for the specific language governing permissions and
+%% limitations under the License.
%%
%% %CopyrightEnd%
%%%-------------------------------------------------------------------
@@ -129,28 +130,30 @@ pick_msg() ->
user_available(Config) ->
false /= proplists:get_value(user, Config, false).
-
wx_destroy(Frame, Config) ->
+ wx_close(Frame, Config),
+ ?m(ok, wx:destroy()).
+
+wx_close(Frame, Config) ->
case proplists:get_value(user, Config, false) of
false ->
timer:sleep(100),
- ?m(ok, wxFrame:destroy(Frame)),
- ?m(ok, wx:destroy());
+ ?m(ok, wxWindow:destroy(Frame));
true ->
timer:sleep(500),
- ?m(ok, wxFrame:destroy(Frame)),
- ?m(ok, wx:destroy());
+ ?m(ok, wxWindow:destroy(Frame));
step -> %% Wait for user to close window
?m(ok, wxEvtHandler:connect(Frame, close_window, [{skip,true}])),
- wait_for_close()
+ wait_for_close(),
+ catch wxEvtHandler:disconnect(Frame, close_window),
+ ok
end.
wait_for_close() ->
receive
#wx{event=#wxClose{}} ->
- ?log("Got close~n",[]),
- ?m(ok, wx:destroy());
+ ?log("Got close~n",[]);
#wx{obj=Obj, event=Event} ->
try
Name = wxTopLevelWindow:getTitle(Obj),