wxruby3 0.9.0.pre.beta.14-x64-mingw-ucrt → 0.9.0.pre.rc.2-x64-mingw-ucrt
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.yardopts +1 -0
- data/INSTALL.md +51 -22
- data/README.md +81 -6
- data/assets/hello_button-macos.png +0 -0
- data/assets/hello_button-msw.png +0 -0
- data/assets/hello_button.png +0 -0
- data/assets/hello_button_clicked-macos.png +0 -0
- data/assets/hello_button_clicked-msw.png +0 -0
- data/assets/hello_button_clicked.png +0 -0
- data/assets/hello_button_clicked_combi.png +0 -0
- data/assets/hello_world-macos.png +0 -0
- data/assets/hello_world-msw.png +0 -0
- data/assets/hello_world.png +0 -0
- data/assets/hello_world_combi.png +0 -0
- data/assets/repo-social-preview.png +0 -0
- data/ext/wxbase32u_gcc_custom.dll +0 -0
- data/ext/wxbase32u_net_gcc_custom.dll +0 -0
- data/ext/wxbase32u_xml_gcc_custom.dll +0 -0
- data/ext/wxmsw32u_aui_gcc_custom.dll +0 -0
- data/ext/wxmsw32u_core_gcc_custom.dll +0 -0
- data/ext/wxmsw32u_gl_gcc_custom.dll +0 -0
- data/ext/wxmsw32u_html_gcc_custom.dll +0 -0
- data/ext/wxmsw32u_media_gcc_custom.dll +0 -0
- data/ext/wxmsw32u_propgrid_gcc_custom.dll +0 -0
- data/ext/wxmsw32u_qa_gcc_custom.dll +0 -0
- data/ext/wxmsw32u_ribbon_gcc_custom.dll +0 -0
- data/ext/wxmsw32u_richtext_gcc_custom.dll +0 -0
- data/ext/wxmsw32u_stc_gcc_custom.dll +0 -0
- data/ext/wxmsw32u_webview_gcc_custom.dll +0 -0
- data/ext/wxmsw32u_xrc_gcc_custom.dll +0 -0
- data/lib/wx/core/art_locator.rb +2 -2
- data/lib/wx/core/artprovider.rb +2 -2
- data/lib/wx/core/bitmap.rb +6 -5
- data/lib/wx/core/bitmap_combobox.rb +34 -0
- data/lib/wx/core/brush.rb +6 -0
- data/lib/wx/core/controlwithitems.rb +52 -14
- data/lib/wx/core/cursor.rb +1 -1
- data/lib/wx/core/dc.rb +0 -20
- data/lib/wx/core/event_blocker.rb +14 -0
- data/lib/wx/core/events/evt_list.rb +19 -0
- data/lib/wx/core/evthandler.rb +48 -2
- data/lib/wx/core/find_replace_dialog.rb +24 -0
- data/lib/wx/core/font.rb +22 -14
- data/lib/wx/core/helpprovider.rb +2 -2
- data/lib/wx/core/icon.rb +1 -1
- data/lib/wx/core/image.rb +1 -1
- data/lib/wx/core/menu.rb +5 -0
- data/lib/wx/core/paintdc.rb +8 -0
- data/lib/wx/core/pen.rb +6 -0
- data/lib/wx/core/text_entry.rb +15 -0
- data/lib/wx/core/v_list_box.rb +13 -0
- data/lib/wx/core/window.rb +29 -2
- data/lib/wx/doc/app.rb +40 -0
- data/lib/wx/doc/brush.rb +17 -0
- data/lib/wx/doc/busy_info.rb +21 -0
- data/lib/wx/doc/client_dc.rb +28 -0
- data/lib/wx/doc/controlwithitems.rb +11 -0
- data/lib/wx/doc/dc.rb +0 -14
- data/lib/wx/doc/event_blocker.rb +27 -0
- data/lib/wx/doc/evthandler.rb +4 -0
- data/lib/wx/doc/extra/02_lifecycles.md +49 -0
- data/lib/wx/doc/extra/10_art.md +1 -1
- data/lib/wx/doc/extra/11_drawing_and_dc.md +62 -0
- data/lib/wx/doc/font.rb +27 -0
- data/lib/wx/doc/gen/about_dialog_info.rb +27 -24
- data/lib/wx/doc/gen/accelerator.rb +11 -12
- data/lib/wx/doc/gen/activity_indicator.rb +65 -0
- data/lib/wx/doc/gen/app.rb +6 -3
- data/lib/wx/doc/gen/art_provider.rb +53 -29
- data/lib/wx/doc/gen/aui/aui_manager.rb +4 -0
- data/lib/wx/doc/gen/aui/aui_mdi_child_frame.rb +1 -1
- data/lib/wx/doc/gen/aui/aui_pane_info.rb +2 -0
- data/lib/wx/doc/gen/aui/aui_tab_ctrl.rb +2 -0
- data/lib/wx/doc/gen/aui/aui_tool_bar.rb +2 -2
- data/lib/wx/doc/gen/bitmap.rb +25 -25
- data/lib/wx/doc/gen/bitmap_combo_box.rb +157 -0
- data/lib/wx/doc/gen/box_sizer.rb +6 -8
- data/lib/wx/doc/gen/brush.rb +2 -0
- data/lib/wx/doc/gen/busy_info.rb +52 -46
- data/lib/wx/doc/gen/caret.rb +0 -4
- data/lib/wx/doc/gen/check_list_box.rb +0 -2
- data/lib/wx/doc/gen/choice.rb +1 -5
- data/lib/wx/doc/gen/client_dc.rb +13 -18
- data/lib/wx/doc/gen/clipboard.rb +30 -27
- data/lib/wx/doc/gen/collapsible_pane.rb +11 -9
- data/lib/wx/doc/gen/colour.rb +6 -3
- data/lib/wx/doc/gen/colour_dialog.rb +111 -23
- data/lib/wx/doc/gen/combo_box.rb +2 -4
- data/lib/wx/doc/gen/context_help_button.rb +48 -0
- data/lib/wx/doc/gen/control.rb +20 -18
- data/lib/wx/doc/gen/core.rb +2 -2
- data/lib/wx/doc/gen/cursor.rb +18 -50
- data/lib/wx/doc/gen/data_format.rb +0 -2
- data/lib/wx/doc/gen/data_object.rb +37 -44
- data/lib/wx/doc/gen/dc.rb +16 -24
- data/lib/wx/doc/gen/defs.rb +3 -40
- data/lib/wx/doc/gen/dialog.rb +21 -17
- data/lib/wx/doc/gen/dir_dialog.rb +10 -8
- data/lib/wx/doc/gen/event.rb +2 -2
- data/lib/wx/doc/gen/event_blocker.rb +51 -0
- data/lib/wx/doc/gen/event_filter.rb +88 -0
- data/lib/wx/doc/gen/event_list.rb +23 -2
- data/lib/wx/doc/gen/events.rb +103 -112
- data/lib/wx/doc/gen/evt_handler.rb +28 -52
- data/lib/wx/doc/gen/file_dialog.rb +53 -50
- data/lib/wx/doc/gen/find_replace_dialog.rb +1 -1
- data/lib/wx/doc/gen/font.rb +19 -2
- data/lib/wx/doc/gen/font_data.rb +2 -0
- data/lib/wx/doc/gen/font_dialog.rb +1 -1
- data/lib/wx/doc/gen/frame.rb +4 -3
- data/lib/wx/doc/gen/fs_file.rb +8 -0
- data/lib/wx/doc/gen/gcdc.rb +2 -22
- data/lib/wx/doc/gen/gdi_common.rb +18 -2
- data/lib/wx/doc/gen/gdi_object.rb +2 -0
- data/lib/wx/doc/gen/graphics_context.rb +4 -43
- data/lib/wx/doc/gen/graphics_object.rb +2 -0
- data/lib/wx/doc/gen/grid/grid_cell_attr.rb +2 -1
- data/lib/wx/doc/gen/grid/grid_ctrl.rb +4 -2
- data/lib/wx/doc/gen/grid/grid_table_message.rb +2 -0
- data/lib/wx/doc/gen/grid_bag_sizer.rb +4 -0
- data/lib/wx/doc/gen/help_controller.rb +4 -1
- data/lib/wx/doc/gen/html/html_cell.rb +4 -1
- data/lib/wx/doc/gen/html/html_help_controller.rb +4 -1
- data/lib/wx/doc/gen/html/html_help_data.rb +4 -0
- data/lib/wx/doc/gen/html/html_help_window.rb +2 -1
- data/lib/wx/doc/gen/html/html_list_box.rb +138 -11
- data/lib/wx/doc/gen/html/html_window.rb +9 -3
- data/lib/wx/doc/gen/hyperlink_ctrl.rb +147 -0
- data/lib/wx/doc/gen/hyperlink_event.rb +43 -0
- data/lib/wx/doc/gen/icon.rb +7 -1
- data/lib/wx/doc/gen/icon_location.rb +2 -0
- data/lib/wx/doc/gen/image.rb +15 -8
- data/lib/wx/doc/gen/keyboard_state.rb +6 -0
- data/lib/wx/doc/gen/list_box.rb +0 -11
- data/lib/wx/doc/gen/list_ctrl.rb +10 -13
- data/lib/wx/doc/gen/locale.rb +7 -3
- data/lib/wx/doc/gen/log.rb +6 -2
- data/lib/wx/doc/gen/mdi_frame.rb +2 -0
- data/lib/wx/doc/gen/media_ctrl.rb +2 -0
- data/lib/wx/doc/gen/memory_dc.rb +105 -18
- data/lib/wx/doc/gen/menu.rb +4 -2
- data/lib/wx/doc/gen/menu_bar.rb +0 -8
- data/lib/wx/doc/gen/menu_item.rb +9 -3
- data/lib/wx/doc/gen/message_dialog.rb +6 -3
- data/lib/wx/doc/gen/mirror_dc.rb +2 -8
- data/lib/wx/doc/gen/mouse_state.rb +2 -0
- data/lib/wx/doc/gen/multi_choice_dialog.rb +0 -2
- data/lib/wx/doc/gen/non_owned_window.rb +2 -1
- data/lib/wx/doc/gen/notebook.rb +4 -2
- data/lib/wx/doc/gen/paint_dc.rb +2 -6
- data/lib/wx/doc/gen/palette.rb +3 -3
- data/lib/wx/doc/gen/pen.rb +6 -1
- data/lib/wx/doc/gen/pg/pg_editor.rb +2 -1
- data/lib/wx/doc/gen/pg/pg_multi_button.rb +4 -0
- data/lib/wx/doc/gen/pg/pg_properties.rb +30 -3
- data/lib/wx/doc/gen/pg/pg_property.rb +30 -4
- data/lib/wx/doc/gen/pg/pg_validation_info.rb +2 -0
- data/lib/wx/doc/gen/pg/property_grid.rb +5 -2
- data/lib/wx/doc/gen/pg/property_grid_interface.rb +6 -2
- data/lib/wx/doc/gen/pg/property_grid_manager.rb +2 -0
- data/lib/wx/doc/gen/pg/property_grid_page_state.rb +2 -0
- data/lib/wx/doc/gen/picker_base.rb +2 -1
- data/lib/wx/doc/gen/platform_info.rb +4 -1
- data/lib/wx/doc/gen/property_sheet_dialog.rb +2 -0
- data/lib/wx/doc/gen/prt/post_script_dc.rb +2 -8
- data/lib/wx/doc/gen/prt/print_data.rb +6 -0
- data/lib/wx/doc/gen/prt/printer.rb +0 -3
- data/lib/wx/doc/gen/prt/printer_dc.rb +2 -6
- data/lib/wx/doc/gen/radio_box.rb +2 -10
- data/lib/wx/doc/gen/rbn/ribbon_art_provider.rb +6 -0
- data/lib/wx/doc/gen/rbn/ribbon_panel.rb +1 -1
- data/lib/wx/doc/gen/region.rb +2 -0
- data/lib/wx/doc/gen/rtc/rich_text_buffer.rb +6 -0
- data/lib/wx/doc/gen/rtc/rich_text_ctrl.rb +0 -4
- data/lib/wx/doc/gen/rtc/rich_text_header_footer_data.rb +2 -0
- data/lib/wx/doc/gen/rtc/rich_text_html_handler.rb +2 -1
- data/lib/wx/doc/gen/rtc/symbol_picker_dialog.rb +2 -0
- data/lib/wx/doc/gen/screen_dc.rb +2 -0
- data/lib/wx/doc/gen/scroll_bar.rb +2 -1
- data/lib/wx/doc/gen/scrolled_canvas.rb +4 -8
- data/lib/wx/doc/gen/scrolled_control.rb +4 -8
- data/lib/wx/doc/gen/scrolled_window.rb +4 -8
- data/lib/wx/doc/gen/search_ctrl.rb +131 -0
- data/lib/wx/doc/gen/single_choice_dialog.rb +0 -2
- data/lib/wx/doc/gen/sizer.rb +14 -3
- data/lib/wx/doc/gen/splash_screen.rb +2 -0
- data/lib/wx/doc/gen/static_box.rb +6 -3
- data/lib/wx/doc/gen/static_box_sizer.rb +2 -1
- data/lib/wx/doc/gen/status_bar.rb +0 -5
- data/lib/wx/doc/gen/stc/styled_text_ctrl.rb +4 -5
- data/lib/wx/doc/gen/svg_file_dc.rb +10 -11
- data/lib/wx/doc/gen/text_ctrl.rb +10 -3
- data/lib/wx/doc/gen/text_entry.rb +8 -3
- data/lib/wx/doc/gen/text_entry_dialog.rb +4 -2
- data/lib/wx/doc/gen/timer_event.rb +2 -0
- data/lib/wx/doc/gen/tool_bar.rb +8 -4
- data/lib/wx/doc/gen/top_level_window.rb +5 -2
- data/lib/wx/doc/gen/tree_ctrl.rb +0 -6
- data/lib/wx/doc/gen/ui_action_simulator.rb +100 -0
- data/lib/wx/doc/gen/utils.rb +1 -1
- data/lib/wx/doc/gen/v_list_box.rb +36 -26
- data/lib/wx/doc/gen/validator.rb +2 -1
- data/lib/wx/doc/gen/variant.rb +10 -0
- data/lib/wx/doc/gen/window.rb +38 -17
- data/lib/wx/doc/gen/window_dc.rb +2 -0
- data/lib/wx/doc/gen/window_disabler.rb +2 -0
- data/lib/wx/doc/gen/wizard_page_simple.rb +2 -0
- data/lib/wx/doc/gen/xml_node.rb +6 -0
- data/lib/wx/doc/gen/xml_resource.rb +4 -1
- data/lib/wx/doc/memory_dc.rb +75 -0
- data/lib/wx/doc/mirror_dc.rb +16 -0
- data/lib/wx/doc/pen.rb +17 -0
- data/lib/wx/doc/prt/printer_dc.rb +26 -0
- data/lib/wx/doc/radio_box.rb +20 -0
- data/lib/wx/doc/screen_dc.rb +10 -6
- data/lib/wx/doc/svg_file_dc.rb +20 -0
- data/lib/wx/doc/v_list_box.rb +9 -0
- data/lib/wx/doc/window.rb +27 -0
- data/lib/wx/doc/window_disabler.rb +10 -0
- data/lib/wx/html/keyword_defs.rb +6 -7
- data/lib/wx/html/require.rb +1 -0
- data/lib/wx/html/simple_html_listbox.rb +105 -0
- data/lib/wx/keyword_defs.rb +83 -75
- data/lib/wx/prt/keyword_defs.rb +5 -1
- data/lib/wx/version.rb +1 -1
- data/lib/wx/wxruby/cmd/test.rb +1 -1
- data/lib/wxruby_aui.so +0 -0
- data/lib/wxruby_core.so +0 -0
- data/lib/wxruby_grid.so +0 -0
- data/lib/wxruby_html.so +0 -0
- data/lib/wxruby_pg.so +0 -0
- data/lib/wxruby_prt.so +0 -0
- data/lib/wxruby_rbn.so +0 -0
- data/lib/wxruby_rtc.so +0 -0
- data/lib/wxruby_stc.so +0 -0
- data/rakelib/install.rb +20 -7
- data/rakelib/lib/config/linux.rb +4 -2
- data/rakelib/lib/config/macosx.rb +120 -1
- data/rakelib/lib/config/mingw.rb +6 -1
- data/rakelib/lib/config/unixish.rb +26 -11
- data/rakelib/lib/config.rb +15 -6
- data/rakelib/yard/yard/relative_markdown_links.rb +5 -1
- data/samples/aui/aui.rb +432 -363
- data/samples/bigdemo/wxArtProvider.rbw +5 -4
- data/samples/controls/controls.rb +2 -2
- data/samples/controls/htlbox.rb +411 -0
- data/samples/controls/tn_htlbox.png +0 -0
- data/samples/drawing/graphics_drawing.rb +1 -2
- data/samples/drawing/{svgtest.rb → image_prt.rb} +49 -18
- data/samples/drawing/tn_image_prt.png +0 -0
- data/samples/propgrid/propgrid.rb +26 -21
- data/samples/ribbon/ribbon.rb +47 -46
- data/samples/sampler/editor.rb +33 -25
- data/samples/sampler/sample.rb +2 -2
- data/samples/sampler/stc_editor.rb +4 -2
- data/tests/lib/item_container_tests.rb +82 -0
- data/tests/lib/text_entry_tests.rb +80 -0
- data/tests/lib/wxapp_runner.rb +15 -3
- data/tests/lib/wxframe_runner.rb +144 -0
- data/tests/test_app_event_filter.rb +74 -0
- data/tests/test_art_provider.rb +52 -0
- data/tests/test_clipboard.rb +2 -1
- data/tests/test_event_handling.rb +199 -16
- data/tests/test_events.rb +4 -11
- data/tests/test_ext_controls.rb +28 -0
- data/tests/test_font.rb +239 -0
- data/tests/test_gdi_object.rb +161 -0
- data/tests/test_intl.rb +16 -15
- data/tests/test_item_data.rb +33 -1
- data/tests/test_std_controls.rb +373 -0
- data/tests/test_window.rb +340 -0
- metadata +61 -8
- data/lib/wx/doc/gen/auto_buffered_paint_dc.rb +0 -47
- data/lib/wx/doc/gen/buffered_dc.rb +0 -95
- data/lib/wx/doc/gen/buffered_paint_dc.rb +0 -55
- data/lib/wx/doc/gen/colour_data.rb +0 -96
- data/samples/drawing/tn_svgtest.png +0 -0
@@ -0,0 +1,161 @@
|
|
1
|
+
|
2
|
+
require_relative './lib/wxapp_runner'
|
3
|
+
|
4
|
+
class TestGDIObjects < Test::Unit::TestCase
|
5
|
+
|
6
|
+
def test_icon
|
7
|
+
ico = Wx::Icon(:sample3)
|
8
|
+
assert(ico.ok?)
|
9
|
+
frame = Wx::Frame.new(nil)
|
10
|
+
frame.set_icon(ico)
|
11
|
+
GC.start
|
12
|
+
ico_cpy = frame.get_icon
|
13
|
+
GC.start
|
14
|
+
assert(ico_cpy.ok?)
|
15
|
+
assert_not_equal(ico.object_id, ico_cpy.object_id)
|
16
|
+
ico = nil
|
17
|
+
ico_cpy = nil
|
18
|
+
GC.start
|
19
|
+
ico_cpy = frame.get_icon
|
20
|
+
GC.start
|
21
|
+
assert(ico_cpy.ok?)
|
22
|
+
assert_not_equal(ico.object_id, ico_cpy.object_id)
|
23
|
+
end
|
24
|
+
|
25
|
+
def test_icon_bundle
|
26
|
+
ib = Wx::IconBundle.new
|
27
|
+
ib.add_icon(Wx::Icon(:sample3))
|
28
|
+
img = Wx::Image(:sample3)
|
29
|
+
ib.add_icon(Wx::Icon.from_bitmap(img.scale(img.get_size.width*2, img.get_size.height*2).to_bitmap))
|
30
|
+
assert_equal(2, ib.get_icon_count)
|
31
|
+
frame = Wx::Frame.new(nil)
|
32
|
+
frame.set_icons(ib)
|
33
|
+
GC.start
|
34
|
+
ib_cpy = frame.get_icons
|
35
|
+
GC.start
|
36
|
+
assert_equal(2, ib_cpy.get_icon_count)
|
37
|
+
assert_not_equal(ib.object_id, ib_cpy.object_id)
|
38
|
+
ib = nil
|
39
|
+
ib_cpy = nil
|
40
|
+
GC.start
|
41
|
+
ib_cpy = frame.get_icons
|
42
|
+
GC.start
|
43
|
+
assert_equal(2, ib_cpy.get_icon_count)
|
44
|
+
assert_not_equal(ib.object_id, ib_cpy.object_id)
|
45
|
+
end
|
46
|
+
|
47
|
+
def test_bitmap_bundle
|
48
|
+
bb = Wx::BitmapBundle.from_bitmaps(Wx::Bitmap(:sample3), Wx::Bitmap.new(Wx::ArtLocator.find_art(:sample, art_section: 'my_art')))
|
49
|
+
assert(bb.ok?)
|
50
|
+
mi = Wx::MenuItem.new(nil, 1, 'test')
|
51
|
+
mi.set_bitmap(bb)
|
52
|
+
GC.start
|
53
|
+
bb_cpy = mi.get_bitmap_bundle
|
54
|
+
GC.start
|
55
|
+
assert(bb_cpy.ok?)
|
56
|
+
assert_not_equal(bb.object_id, bb_cpy.object_id)
|
57
|
+
bb = nil
|
58
|
+
bb_cpy = nil
|
59
|
+
GC.start
|
60
|
+
bb_cpy = mi.get_bitmap_bundle
|
61
|
+
GC.start
|
62
|
+
assert(bb_cpy.ok?)
|
63
|
+
assert_not_equal(bb.object_id, bb_cpy.object_id)
|
64
|
+
end
|
65
|
+
|
66
|
+
def test_bitmap
|
67
|
+
bmp = Wx::Bitmap(:sample3)
|
68
|
+
assert(bmp.ok?)
|
69
|
+
mi = Wx::MenuItem.new(nil, 1, 'test')
|
70
|
+
mi.set_bitmap(bmp)
|
71
|
+
GC.start
|
72
|
+
bmp_cpy = mi.get_bitmap
|
73
|
+
GC.start
|
74
|
+
assert(bmp_cpy.ok?)
|
75
|
+
assert_not_equal(bmp.object_id, bmp_cpy.object_id)
|
76
|
+
bmp = nil
|
77
|
+
bmp_cpy = nil
|
78
|
+
GC.start
|
79
|
+
bmp_cpy = mi.get_bitmap
|
80
|
+
GC.start
|
81
|
+
assert(bmp_cpy.ok?)
|
82
|
+
assert_not_equal(bmp.object_id, bmp_cpy.object_id)
|
83
|
+
end
|
84
|
+
|
85
|
+
def test_colour
|
86
|
+
col = Wx::Colour.new('red')
|
87
|
+
assert(col.ok?)
|
88
|
+
Wx::MemoryDC.draw_on(Wx::Bitmap.new(600, 400)) do |dc|
|
89
|
+
dc.set_text_background(col)
|
90
|
+
GC.start
|
91
|
+
col_cpy = dc.get_text_background
|
92
|
+
GC.start
|
93
|
+
assert(col_cpy.ok?)
|
94
|
+
assert_not_equal(col.object_id, col_cpy.object_id)
|
95
|
+
col = col_cpy = nil
|
96
|
+
GC.start
|
97
|
+
col_cpy = dc.get_text_background
|
98
|
+
GC.start
|
99
|
+
assert(col_cpy.ok?)
|
100
|
+
assert_not_equal(col.object_id, col_cpy.object_id)
|
101
|
+
end
|
102
|
+
end
|
103
|
+
|
104
|
+
def test_font
|
105
|
+
font = Wx::Font.new(10, Wx::FontFamily::FONTFAMILY_DEFAULT, Wx::FontStyle::FONTSTYLE_NORMAL, Wx::FontWeight::FONTWEIGHT_BOLD)
|
106
|
+
assert(font.ok?)
|
107
|
+
Wx::MemoryDC.draw_on(Wx::Bitmap.new(600, 400)) do |dc|
|
108
|
+
dc.set_font(font)
|
109
|
+
GC.start
|
110
|
+
font_cpy = dc.get_font
|
111
|
+
GC.start
|
112
|
+
assert(font_cpy.ok?)
|
113
|
+
assert_not_equal(font.object_id, font_cpy.object_id)
|
114
|
+
font = font_cpy = nil
|
115
|
+
GC.start
|
116
|
+
font_cpy = dc.get_font
|
117
|
+
GC.start
|
118
|
+
assert(font_cpy.ok?)
|
119
|
+
assert_not_equal(font.object_id, font_cpy.object_id)
|
120
|
+
end
|
121
|
+
end
|
122
|
+
|
123
|
+
def test_brush
|
124
|
+
brush = Wx::Brush.new(:black)
|
125
|
+
assert(brush.ok?)
|
126
|
+
Wx::MemoryDC.draw_on(Wx::Bitmap.new(600, 400)) do |dc|
|
127
|
+
dc.set_brush(brush)
|
128
|
+
GC.start
|
129
|
+
brush_cpy = dc.get_brush
|
130
|
+
GC.start
|
131
|
+
assert(brush_cpy.ok?)
|
132
|
+
assert_not_equal(brush.object_id, brush_cpy.object_id)
|
133
|
+
brush = brush_cpy = nil
|
134
|
+
GC.start
|
135
|
+
brush_cpy = dc.get_brush
|
136
|
+
GC.start
|
137
|
+
assert(brush_cpy.ok?)
|
138
|
+
assert_not_equal(brush.object_id, brush_cpy.object_id)
|
139
|
+
end
|
140
|
+
end
|
141
|
+
|
142
|
+
def test_pen
|
143
|
+
pen = Wx::Pen.new(:black, 1, Wx::PenStyle::PENSTYLE_SOLID)
|
144
|
+
assert(pen.ok?)
|
145
|
+
Wx::MemoryDC.draw_on(Wx::Bitmap.new(600, 400)) do |dc|
|
146
|
+
dc.set_pen(pen)
|
147
|
+
GC.start
|
148
|
+
pen_cpy = dc.get_pen
|
149
|
+
GC.start
|
150
|
+
assert(pen_cpy.ok?)
|
151
|
+
assert_not_equal(pen.object_id, pen_cpy.object_id)
|
152
|
+
pen = pen_cpy = nil
|
153
|
+
GC.start
|
154
|
+
pen_cpy = dc.get_pen
|
155
|
+
GC.start
|
156
|
+
assert(pen_cpy.ok?)
|
157
|
+
assert_not_equal(pen.object_id, pen_cpy.object_id)
|
158
|
+
end
|
159
|
+
end
|
160
|
+
|
161
|
+
end
|
data/tests/test_intl.rb
CHANGED
@@ -35,20 +35,17 @@ class TestInternationalisation < Test::Unit::TestCase
|
|
35
35
|
assert_nil( Wx::Locale.find_language_info('xx') )
|
36
36
|
end
|
37
37
|
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
# assert_equal('ma_MA', lang_info.canonical_name)
|
50
|
-
# assert_equal('Marain', lang_info.description)
|
51
|
-
# end
|
38
|
+
def test_add_language_info
|
39
|
+
new_lang_info = Wx::LanguageInfo.new
|
40
|
+
new_lang_info.canonical_name = 'ma_MA'
|
41
|
+
new_lang_info.description = 'Marain'
|
42
|
+
new_lang_info.language = 1000
|
43
|
+
Wx::Locale.add_language(new_lang_info)
|
44
|
+
lang_info = Wx::Locale.find_language_info('ma_MA')
|
45
|
+
assert_equal(1000, lang_info.language)
|
46
|
+
assert_equal('ma_MA', lang_info.canonical_name)
|
47
|
+
assert_equal('Marain', lang_info.description)
|
48
|
+
end
|
52
49
|
|
53
50
|
def test_get_system_language
|
54
51
|
sys_lang = Wx::Locale.get_system_language
|
@@ -89,6 +86,10 @@ class TestInternationalisation < Test::Unit::TestCase
|
|
89
86
|
end
|
90
87
|
|
91
88
|
assert_raises(ArgumentError) { Wx::Locale.set_locale('bad') }
|
92
|
-
|
89
|
+
# this causes problems on MacOSX if the language / region combination is unusual
|
90
|
+
# like on my system (US English language / NL region)
|
91
|
+
unless Wx::PLATFORM == 'WXOSX'
|
92
|
+
locale = Wx::Locale.new(Wx::LANGUAGE_DEFAULT)
|
93
|
+
end
|
93
94
|
end
|
94
95
|
end
|
data/tests/test_item_data.rb
CHANGED
@@ -91,6 +91,31 @@ class TestItemData < Test::Unit::TestCase
|
|
91
91
|
GC.start
|
92
92
|
end
|
93
93
|
|
94
|
+
def do_sorted_control_with_items_assertions(f)
|
95
|
+
f.control.append(%w[Beta Alpha Gamma Delta], [1, 'a', :sym, true])
|
96
|
+
assert_equal(4, f.control.count)
|
97
|
+
assert_equal('a', f.control.get_item_data(0))
|
98
|
+
assert_equal(1, f.control.get_item_data(1))
|
99
|
+
assert_equal(true, f.control.get_item_data(2))
|
100
|
+
assert_equal(:sym, f.control.get_item_data(3))
|
101
|
+
GC.start
|
102
|
+
assert_equal('a', f.control.get_client_data(0))
|
103
|
+
assert_equal(1, f.control.get_client_data(1))
|
104
|
+
assert_equal(true, f.control.get_client_data(2))
|
105
|
+
assert_equal(:sym, f.control.get_client_data(3))
|
106
|
+
GC.start
|
107
|
+
f.control.delete(2)
|
108
|
+
GC.start
|
109
|
+
assert_equal(3, f.control.count)
|
110
|
+
assert_equal('a', f.control.get_item_data(0))
|
111
|
+
assert_equal(1, f.control.get_item_data(1))
|
112
|
+
assert_equal(:sym, f.control.get_item_data(2))
|
113
|
+
GC.start
|
114
|
+
assert_equal('a', f.control.get_client_data(0))
|
115
|
+
assert_equal(1, f.control.get_client_data(1))
|
116
|
+
assert_equal(:sym, f.control.get_client_data(2))
|
117
|
+
end
|
118
|
+
|
94
119
|
def test_treectrl_itemdata
|
95
120
|
f = CtrlContainerFrame.new(Wx::TreeCtrl)
|
96
121
|
tree = f.control
|
@@ -157,7 +182,14 @@ class TestItemData < Test::Unit::TestCase
|
|
157
182
|
do_control_with_items_assertions(f)
|
158
183
|
f.close(true)
|
159
184
|
end
|
160
|
-
|
185
|
+
|
186
|
+
def test_sorted_listbox_itemdata
|
187
|
+
f = CtrlContainerFrame.new(Wx::ListBox, Wx::DEFAULT_POSITION,
|
188
|
+
Wx::DEFAULT_SIZE, [], Wx::LB_SORT)
|
189
|
+
do_sorted_control_with_items_assertions(f)
|
190
|
+
f.close(true)
|
191
|
+
end
|
192
|
+
|
161
193
|
def test_combobox_itemdata
|
162
194
|
f = CtrlContainerFrame.new(Wx::ComboBox, '', Wx::DEFAULT_POSITION,
|
163
195
|
Wx::DEFAULT_SIZE, %w[hash string float])
|
@@ -0,0 +1,373 @@
|
|
1
|
+
|
2
|
+
require_relative './lib/wxframe_runner'
|
3
|
+
require_relative './lib/text_entry_tests'
|
4
|
+
require_relative './lib/item_container_tests'
|
5
|
+
|
6
|
+
class ButtonTests < WxRuby::Test::GUITests
|
7
|
+
|
8
|
+
def setup
|
9
|
+
super
|
10
|
+
@button = Wx::Button.new(test_frame, label: 'Button')
|
11
|
+
end
|
12
|
+
|
13
|
+
def cleanup
|
14
|
+
@button.destroy
|
15
|
+
super
|
16
|
+
end
|
17
|
+
|
18
|
+
attr_reader :button
|
19
|
+
|
20
|
+
if has_ui_simulator?
|
21
|
+
|
22
|
+
def test_click
|
23
|
+
count = count_events(button, :evt_button) do
|
24
|
+
sim = Wx::UIActionSimulator.new
|
25
|
+
|
26
|
+
# We move in to the middle of the widget, we need to yield
|
27
|
+
# after every Wx::UIActionSimulator action to keep everything working in GTK
|
28
|
+
sim.mouse_move(button.get_screen_position + (button.size / 2))
|
29
|
+
Wx.get_app.yield
|
30
|
+
|
31
|
+
sim.mouse_click
|
32
|
+
Wx.get_app.yield
|
33
|
+
end
|
34
|
+
|
35
|
+
assert_equal(1, count)
|
36
|
+
end
|
37
|
+
|
38
|
+
def test_disabled
|
39
|
+
button.disable
|
40
|
+
count = count_events(button, :evt_button) do
|
41
|
+
sim = Wx::UIActionSimulator.new
|
42
|
+
|
43
|
+
# We move in to the middle of the widget, we need to yield
|
44
|
+
# after every Wx::UIActionSimulator action to keep everything working in GTK
|
45
|
+
sim.mouse_move(button.get_screen_position + (button.size / 2))
|
46
|
+
Wx.get_app.yield
|
47
|
+
|
48
|
+
sim.mouse_click
|
49
|
+
Wx.get_app.yield
|
50
|
+
end
|
51
|
+
|
52
|
+
assert_equal(0, count)
|
53
|
+
end
|
54
|
+
|
55
|
+
end # has_ui_simulator?
|
56
|
+
|
57
|
+
def test_bitmap
|
58
|
+
# We start with no bitmaps
|
59
|
+
assert(!button.get_bitmap.ok?)
|
60
|
+
|
61
|
+
# Some bitmap, doesn't really matter which.
|
62
|
+
bmp = Wx::ArtProvider.get_bitmap(Wx::ART_INFORMATION)
|
63
|
+
|
64
|
+
button.set_bitmap(bmp)
|
65
|
+
|
66
|
+
assert(button.get_bitmap.ok?)
|
67
|
+
|
68
|
+
# The call above shouldn't affect any other bitmaps as returned by the API
|
69
|
+
# even though the same (normal) bitmap does appear for all the states.
|
70
|
+
assert( !button.get_bitmap_current.ok? )
|
71
|
+
assert( !button.get_bitmap_disabled.ok? )
|
72
|
+
assert( !button.get_bitmap_focus.ok? )
|
73
|
+
assert( !button.get_bitmap_pressed.ok? )
|
74
|
+
|
75
|
+
# Do set one of the bitmaps now.
|
76
|
+
button.set_bitmap_pressed(Wx::ArtProvider.get_bitmap(Wx::ART_ERROR))
|
77
|
+
assert( button.get_bitmap_pressed.ok? )
|
78
|
+
|
79
|
+
# Check that resetting the button label doesn't result in problems when
|
80
|
+
# updating the bitmap later, as it used to be the case in wxGTK (#18898).
|
81
|
+
button.set_label('')
|
82
|
+
assert_nothing_raised { button.disable }
|
83
|
+
|
84
|
+
# Also check that setting an invalid bitmap doesn't do anything untoward,
|
85
|
+
# such as crashing, as it used to do in wxOSX (#19257).
|
86
|
+
assert_nothing_raised { button.set_bitmap_pressed(Wx::NULL_BITMAP) }
|
87
|
+
assert( !button.get_bitmap_pressed.ok? )
|
88
|
+
end
|
89
|
+
|
90
|
+
end
|
91
|
+
|
92
|
+
class TextCtrlTests < WxRuby::Test::GUITests
|
93
|
+
|
94
|
+
include TextEntryTests
|
95
|
+
|
96
|
+
def setup
|
97
|
+
super
|
98
|
+
@text = Wx::TextCtrl.new(test_frame, name: 'Text')
|
99
|
+
end
|
100
|
+
|
101
|
+
def cleanup
|
102
|
+
@text.destroy
|
103
|
+
super
|
104
|
+
end
|
105
|
+
|
106
|
+
attr_reader :text
|
107
|
+
alias :text_entry :text
|
108
|
+
|
109
|
+
def test_text
|
110
|
+
assert_equal('', text.get_value)
|
111
|
+
end
|
112
|
+
|
113
|
+
if has_ui_simulator?
|
114
|
+
def test_max_length
|
115
|
+
sim = Wx::UIActionSimulator.new
|
116
|
+
|
117
|
+
updates = count_events(text_entry, :evt_text) do |c_upd|
|
118
|
+
maxlen_count = count_events(text_entry, :evt_text_maxlen) do |c_maxlen|
|
119
|
+
# set focus to text_entry text_entry
|
120
|
+
text_entry.set_focus
|
121
|
+
Wx.get_app.yield
|
122
|
+
|
123
|
+
sim.text('Hello')
|
124
|
+
Wx.get_app.yield
|
125
|
+
|
126
|
+
assert_equal('Hello', text_entry.get_value)
|
127
|
+
assert_equal(5, c_upd.count)
|
128
|
+
|
129
|
+
text_entry.set_max_length(10)
|
130
|
+
sim.text('World')
|
131
|
+
Wx.get_app.yield
|
132
|
+
|
133
|
+
assert_equal('HelloWorld', text_entry.get_value)
|
134
|
+
assert_equal(10, c_upd.count)
|
135
|
+
assert_equal(0, c_maxlen.count)
|
136
|
+
|
137
|
+
sim.text('!')
|
138
|
+
Wx.get_app.yield
|
139
|
+
|
140
|
+
assert_equal('HelloWorld', text_entry.get_value)
|
141
|
+
assert_equal(10, c_upd.count)
|
142
|
+
assert_equal(1, c_maxlen.count)
|
143
|
+
end
|
144
|
+
end
|
145
|
+
end
|
146
|
+
|
147
|
+
end # has_ui_simulator?
|
148
|
+
|
149
|
+
end
|
150
|
+
|
151
|
+
class ComboBoxTests < WxRuby::Test::GUITests
|
152
|
+
|
153
|
+
include TextEntryTests
|
154
|
+
|
155
|
+
def setup
|
156
|
+
super
|
157
|
+
@combo = Wx::ComboBox.new(test_frame, name: 'ComboBox', choices: %w[One Two Three])
|
158
|
+
@combo.clear
|
159
|
+
end
|
160
|
+
|
161
|
+
def cleanup
|
162
|
+
@combo.destroy
|
163
|
+
super
|
164
|
+
end
|
165
|
+
|
166
|
+
attr_reader :combo
|
167
|
+
alias :text_entry :combo
|
168
|
+
|
169
|
+
def test_combo
|
170
|
+
assert_equal('', combo.get_value)
|
171
|
+
end
|
172
|
+
|
173
|
+
end
|
174
|
+
|
175
|
+
class CheckBoxTests < WxRuby::Test::GUITests
|
176
|
+
|
177
|
+
def setup
|
178
|
+
super
|
179
|
+
@check = Wx::CheckBox.new(test_frame, label: 'Check Box')
|
180
|
+
end
|
181
|
+
|
182
|
+
def cleanup
|
183
|
+
@check.destroy
|
184
|
+
super
|
185
|
+
end
|
186
|
+
|
187
|
+
def create_checkbox(style)
|
188
|
+
@check.destroy
|
189
|
+
@check = nil
|
190
|
+
@check = Wx::CheckBox.new(test_frame, label: 'Check Box', style: style)
|
191
|
+
end
|
192
|
+
|
193
|
+
attr_reader :check
|
194
|
+
|
195
|
+
def test_check
|
196
|
+
count = count_events(check, :evt_checkbox) do
|
197
|
+
assert(!check.checked?)
|
198
|
+
|
199
|
+
check.set_value(true)
|
200
|
+
|
201
|
+
assert(check.checked?)
|
202
|
+
|
203
|
+
check.set_value(false)
|
204
|
+
|
205
|
+
assert(!check.checked?)
|
206
|
+
|
207
|
+
check.set3state_value(Wx::CheckBoxState::CHK_CHECKED)
|
208
|
+
|
209
|
+
assert(check.checked?)
|
210
|
+
|
211
|
+
check.set3state_value(Wx::CheckBoxState::CHK_UNCHECKED)
|
212
|
+
|
213
|
+
assert(!check.checked?)
|
214
|
+
|
215
|
+
end
|
216
|
+
|
217
|
+
assert_equal(0, count) # should not have emitted any events
|
218
|
+
end
|
219
|
+
|
220
|
+
def test_third_state
|
221
|
+
|
222
|
+
create_checkbox(Wx::CHK_3STATE)
|
223
|
+
|
224
|
+
assert_equal(Wx::CheckBoxState::CHK_UNCHECKED, check.get3state_value)
|
225
|
+
assert(check.is3state)
|
226
|
+
assert(!check.is3rd_state_allowed_for_user)
|
227
|
+
|
228
|
+
check.value = true
|
229
|
+
|
230
|
+
assert_equal(Wx::CheckBoxState::CHK_CHECKED, check.get3state_value)
|
231
|
+
|
232
|
+
check.set3state_value(Wx::CheckBoxState::CHK_UNDETERMINED)
|
233
|
+
|
234
|
+
assert_equal(Wx::CheckBoxState::CHK_UNDETERMINED, check.get3state_value)
|
235
|
+
end
|
236
|
+
|
237
|
+
def test_third_state_user
|
238
|
+
|
239
|
+
create_checkbox(Wx::CHK_3STATE | Wx::CHK_ALLOW_3RD_STATE_FOR_USER)
|
240
|
+
|
241
|
+
assert_equal(Wx::CheckBoxState::CHK_UNCHECKED, check.get3state_value)
|
242
|
+
assert(check.is3state)
|
243
|
+
assert(check.is3rd_state_allowed_for_user)
|
244
|
+
|
245
|
+
check.value = true
|
246
|
+
|
247
|
+
assert_equal(Wx::CheckBoxState::CHK_CHECKED, check.get3state_value)
|
248
|
+
|
249
|
+
check.set3state_value(Wx::CheckBoxState::CHK_UNDETERMINED)
|
250
|
+
|
251
|
+
assert_equal(Wx::CheckBoxState::CHK_UNDETERMINED, check.get3state_value)
|
252
|
+
end
|
253
|
+
|
254
|
+
def test_invalid_style
|
255
|
+
|
256
|
+
# prints assertion warning and creates default checkbox
|
257
|
+
assert_with_assertion_failure { create_checkbox(Wx::CHK_3STATE | Wx::CHK_2STATE) }
|
258
|
+
|
259
|
+
end
|
260
|
+
|
261
|
+
end
|
262
|
+
|
263
|
+
|
264
|
+
class RadioBoxTests < WxRuby::Test::GUITests
|
265
|
+
|
266
|
+
def setup
|
267
|
+
super
|
268
|
+
@radiobox = Wx::RadioBox.new(test_frame, label: 'Radio Box', choices: ['item 0', 'item 1', 'item 2'])
|
269
|
+
end
|
270
|
+
|
271
|
+
def cleanup
|
272
|
+
@radiobox.destroy
|
273
|
+
super
|
274
|
+
end
|
275
|
+
|
276
|
+
attr_reader :radiobox
|
277
|
+
|
278
|
+
def test_find_string
|
279
|
+
assert_equal(Wx::NOT_FOUND, radiobox.find_string('Not An Item'))
|
280
|
+
assert_equal(1, radiobox.find_string('item 1'))
|
281
|
+
assert_equal(2, radiobox.find_string('ITEM 2'))
|
282
|
+
assert_equal(Wx::NOT_FOUND, radiobox.find_string('ITEM 2', true))
|
283
|
+
end
|
284
|
+
|
285
|
+
def test_show
|
286
|
+
radiobox.show(false)
|
287
|
+
|
288
|
+
assert(!radiobox.is_item_shown(0))
|
289
|
+
|
290
|
+
radiobox.show_item(1, true)
|
291
|
+
|
292
|
+
assert(!radiobox.is_item_shown(0))
|
293
|
+
assert(radiobox.is_item_shown(1))
|
294
|
+
assert(!radiobox.is_item_shown(2))
|
295
|
+
|
296
|
+
radiobox.show(true)
|
297
|
+
|
298
|
+
assert(radiobox.is_item_shown(0))
|
299
|
+
assert(radiobox.is_item_shown(1))
|
300
|
+
assert(radiobox.is_item_shown(2))
|
301
|
+
|
302
|
+
radiobox.show_item(0, false)
|
303
|
+
|
304
|
+
assert(!radiobox.is_item_shown(0))
|
305
|
+
assert(radiobox.is_item_shown(1))
|
306
|
+
assert(radiobox.is_item_shown(2))
|
307
|
+
end
|
308
|
+
|
309
|
+
def test_selection
|
310
|
+
# by default first item selected
|
311
|
+
assert_equal(0, radiobox.get_selection)
|
312
|
+
assert_equal('item 0', radiobox.get_string_selection)
|
313
|
+
|
314
|
+
radiobox.set_selection(1)
|
315
|
+
|
316
|
+
assert_equal(1, radiobox.get_selection)
|
317
|
+
assert_equal('item 1', radiobox.get_string_selection)
|
318
|
+
|
319
|
+
radiobox.string_selection = 'item 2'
|
320
|
+
|
321
|
+
assert_equal(2, radiobox.selection)
|
322
|
+
assert_equal('item 2', radiobox.string_selection)
|
323
|
+
end
|
324
|
+
|
325
|
+
def test_set_string
|
326
|
+
radiobox.set_string(0, 'new item 0')
|
327
|
+
radiobox.set_string(2, '')
|
328
|
+
|
329
|
+
assert_equal('new item 0', radiobox.get_string(0))
|
330
|
+
assert_equal('', radiobox.string(2))
|
331
|
+
end
|
332
|
+
|
333
|
+
def test_count
|
334
|
+
assert_equal(3, radiobox.get_count)
|
335
|
+
assert(!radiobox.empty?)
|
336
|
+
end
|
337
|
+
|
338
|
+
def test_help_text
|
339
|
+
assert(radiobox.get_item_help_text(1).empty?)
|
340
|
+
|
341
|
+
radiobox.set_item_help_text(1, 'Item 1 Help')
|
342
|
+
|
343
|
+
assert_equal('Item 1 Help', radiobox.get_item_help_text(1))
|
344
|
+
|
345
|
+
radiobox.set_item_help_text(1, '')
|
346
|
+
|
347
|
+
assert(radiobox.get_item_help_text(1).empty?)
|
348
|
+
end
|
349
|
+
|
350
|
+
end
|
351
|
+
|
352
|
+
class ChoiceTests < WxRuby::Test::GUITests
|
353
|
+
|
354
|
+
include ItemContainerTests
|
355
|
+
|
356
|
+
def setup
|
357
|
+
super
|
358
|
+
@choice = Wx::Choice.new(test_frame, name: 'Choice')
|
359
|
+
end
|
360
|
+
|
361
|
+
def cleanup
|
362
|
+
@choice.destroy
|
363
|
+
super
|
364
|
+
end
|
365
|
+
|
366
|
+
attr_reader :choice
|
367
|
+
alias :container :choice
|
368
|
+
|
369
|
+
def test_choice
|
370
|
+
assert_equal(Wx::NOT_FOUND, choice.get_selection)
|
371
|
+
end
|
372
|
+
|
373
|
+
end
|