-
Notifications
You must be signed in to change notification settings - Fork 7
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
2 changed files
with
56 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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 |