-
Notifications
You must be signed in to change notification settings - Fork 8
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #200 from mcorino/develop
Develop
- Loading branch information
Showing
13 changed files
with
170 additions
and
54 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
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
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
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
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
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
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
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
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
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
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,29 @@ | ||
# Copyright (c) 2023 M.J.N. Corino, The Netherlands | ||
# | ||
# This software is released under the MIT license. | ||
|
||
require_relative './lib/wxframe_runner' | ||
|
||
class BookCtrlTests < WxRuby::Test::GUITests | ||
|
||
def setup | ||
super | ||
@book = Wx::Choicebook.new(frame_win, name: 'ChoiceBook') | ||
end | ||
|
||
def cleanup | ||
@book.destroy | ||
super | ||
GC.start | ||
end | ||
|
||
attr_reader :book | ||
|
||
def test_control_sizer | ||
btn = Wx::Button.new(book, Wx::ID_ANY, 'First') | ||
# issue #199 : returning the control sizer should not cause it to be owned by Ruby | ||
# because that would cause double deletes | ||
book.get_control_sizer.add(btn, Wx::SizerFlags.new.expand.border(Wx::ALL)) | ||
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,43 @@ | ||
# Copyright (c) 2023 M.J.N. Corino, The Netherlands | ||
# | ||
# This software is released under the MIT license. | ||
|
||
require_relative './lib/wxframe_runner' | ||
|
||
class SizerTests < WxRuby::Test::GUITests | ||
|
||
def setup | ||
super | ||
frame_win.set_sizer(Wx::VBoxSizer.new) | ||
end | ||
|
||
def cleanup | ||
super | ||
GC.start | ||
end | ||
|
||
def test_detach | ||
frame_win.get_sizer.add(Wx::HBoxSizer.new) | ||
frame_win.get_sizer.add_spacer(5) | ||
# detaches HBoxSizer transferring ownership to Ruby; should not cause segfaults at GC | ||
frame_win.get_sizer.detach(0) | ||
end | ||
|
||
def test_sizer_item_detach_and_re_attach | ||
frame_win.get_sizer.add(Wx::HBoxSizer.new) | ||
frame_win.get_sizer.add_spacer(5) | ||
# get and detach | ||
szr_itm = frame_win.get_sizer.get_item(0) | ||
assert_not_nil(szr_itm) | ||
assert_true(szr_itm.is_sizer) | ||
szr = szr_itm.get_sizer | ||
assert_not_nil(szr) | ||
szr_itm.detach_sizer | ||
assert_nil(szr_itm.get_sizer) | ||
# remove sizer item | ||
assert_true(frame_win.get_sizer.remove(0)) | ||
# re-attach detached sizer (should not cause segfaults at close due to incorrect ownership transfers) | ||
assert_not_nil(frame_win.get_sizer.prepend(szr)) | ||
end | ||
|
||
end |