diff --git a/tests/test_app_exit_exception.rb b/tests/test_app_exit_exception.rb new file mode 100644 index 00000000..2af80f4f --- /dev/null +++ b/tests/test_app_exit_exception.rb @@ -0,0 +1,36 @@ +# Copyright (c) 2023 M.J.N. Corino, The Netherlands +# +# This software is released under the MIT license. + +require 'test/unit' +require 'wx' + +class TestApp < Test::Unit::TestCase + + class TestFrame < Wx::Frame + def initialize + super(nil, -1, '') + evt_paint { on_paint } + end + + def on_paint + paint {} + close + end + end + + class TestApp < Wx::App + def on_init + TestFrame.new.show + end + + def on_exit + raise RuntimeError, 'on_exit exception' + end + end + + def test_self_closing_frame + assert_raise_kind_of(RuntimeError) { TestApp.run } + end + +end diff --git a/tests/test_app_init_exception.rb b/tests/test_app_init_exception.rb new file mode 100644 index 00000000..81a01fd2 --- /dev/null +++ b/tests/test_app_init_exception.rb @@ -0,0 +1,20 @@ +# Copyright (c) 2023 M.J.N. Corino, The Netherlands +# +# This software is released under the MIT license. + +require 'test/unit' +require 'wx' + +class AppInitExitExceptions < Test::Unit::TestCase + + class TestApp < Wx::App + def on_init + raise RuntimeError, 'on_init exception' + end + end + + def test_on_init_exception + assert_raise_kind_of(RuntimeError) { TestApp.run } + end + +end