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.
Files changed (278) hide show
  1. checksums.yaml +4 -4
  2. data/.yardopts +1 -0
  3. data/INSTALL.md +51 -22
  4. data/README.md +81 -6
  5. data/assets/hello_button-macos.png +0 -0
  6. data/assets/hello_button-msw.png +0 -0
  7. data/assets/hello_button.png +0 -0
  8. data/assets/hello_button_clicked-macos.png +0 -0
  9. data/assets/hello_button_clicked-msw.png +0 -0
  10. data/assets/hello_button_clicked.png +0 -0
  11. data/assets/hello_button_clicked_combi.png +0 -0
  12. data/assets/hello_world-macos.png +0 -0
  13. data/assets/hello_world-msw.png +0 -0
  14. data/assets/hello_world.png +0 -0
  15. data/assets/hello_world_combi.png +0 -0
  16. data/assets/repo-social-preview.png +0 -0
  17. data/ext/wxbase32u_gcc_custom.dll +0 -0
  18. data/ext/wxbase32u_net_gcc_custom.dll +0 -0
  19. data/ext/wxbase32u_xml_gcc_custom.dll +0 -0
  20. data/ext/wxmsw32u_aui_gcc_custom.dll +0 -0
  21. data/ext/wxmsw32u_core_gcc_custom.dll +0 -0
  22. data/ext/wxmsw32u_gl_gcc_custom.dll +0 -0
  23. data/ext/wxmsw32u_html_gcc_custom.dll +0 -0
  24. data/ext/wxmsw32u_media_gcc_custom.dll +0 -0
  25. data/ext/wxmsw32u_propgrid_gcc_custom.dll +0 -0
  26. data/ext/wxmsw32u_qa_gcc_custom.dll +0 -0
  27. data/ext/wxmsw32u_ribbon_gcc_custom.dll +0 -0
  28. data/ext/wxmsw32u_richtext_gcc_custom.dll +0 -0
  29. data/ext/wxmsw32u_stc_gcc_custom.dll +0 -0
  30. data/ext/wxmsw32u_webview_gcc_custom.dll +0 -0
  31. data/ext/wxmsw32u_xrc_gcc_custom.dll +0 -0
  32. data/lib/wx/core/art_locator.rb +2 -2
  33. data/lib/wx/core/artprovider.rb +2 -2
  34. data/lib/wx/core/bitmap.rb +6 -5
  35. data/lib/wx/core/bitmap_combobox.rb +34 -0
  36. data/lib/wx/core/brush.rb +6 -0
  37. data/lib/wx/core/controlwithitems.rb +52 -14
  38. data/lib/wx/core/cursor.rb +1 -1
  39. data/lib/wx/core/dc.rb +0 -20
  40. data/lib/wx/core/event_blocker.rb +14 -0
  41. data/lib/wx/core/events/evt_list.rb +19 -0
  42. data/lib/wx/core/evthandler.rb +48 -2
  43. data/lib/wx/core/find_replace_dialog.rb +24 -0
  44. data/lib/wx/core/font.rb +22 -14
  45. data/lib/wx/core/helpprovider.rb +2 -2
  46. data/lib/wx/core/icon.rb +1 -1
  47. data/lib/wx/core/image.rb +1 -1
  48. data/lib/wx/core/menu.rb +5 -0
  49. data/lib/wx/core/paintdc.rb +8 -0
  50. data/lib/wx/core/pen.rb +6 -0
  51. data/lib/wx/core/text_entry.rb +15 -0
  52. data/lib/wx/core/v_list_box.rb +13 -0
  53. data/lib/wx/core/window.rb +29 -2
  54. data/lib/wx/doc/app.rb +40 -0
  55. data/lib/wx/doc/brush.rb +17 -0
  56. data/lib/wx/doc/busy_info.rb +21 -0
  57. data/lib/wx/doc/client_dc.rb +28 -0
  58. data/lib/wx/doc/controlwithitems.rb +11 -0
  59. data/lib/wx/doc/dc.rb +0 -14
  60. data/lib/wx/doc/event_blocker.rb +27 -0
  61. data/lib/wx/doc/evthandler.rb +4 -0
  62. data/lib/wx/doc/extra/02_lifecycles.md +49 -0
  63. data/lib/wx/doc/extra/10_art.md +1 -1
  64. data/lib/wx/doc/extra/11_drawing_and_dc.md +62 -0
  65. data/lib/wx/doc/font.rb +27 -0
  66. data/lib/wx/doc/gen/about_dialog_info.rb +27 -24
  67. data/lib/wx/doc/gen/accelerator.rb +11 -12
  68. data/lib/wx/doc/gen/activity_indicator.rb +65 -0
  69. data/lib/wx/doc/gen/app.rb +6 -3
  70. data/lib/wx/doc/gen/art_provider.rb +53 -29
  71. data/lib/wx/doc/gen/aui/aui_manager.rb +4 -0
  72. data/lib/wx/doc/gen/aui/aui_mdi_child_frame.rb +1 -1
  73. data/lib/wx/doc/gen/aui/aui_pane_info.rb +2 -0
  74. data/lib/wx/doc/gen/aui/aui_tab_ctrl.rb +2 -0
  75. data/lib/wx/doc/gen/aui/aui_tool_bar.rb +2 -2
  76. data/lib/wx/doc/gen/bitmap.rb +25 -25
  77. data/lib/wx/doc/gen/bitmap_combo_box.rb +157 -0
  78. data/lib/wx/doc/gen/box_sizer.rb +6 -8
  79. data/lib/wx/doc/gen/brush.rb +2 -0
  80. data/lib/wx/doc/gen/busy_info.rb +52 -46
  81. data/lib/wx/doc/gen/caret.rb +0 -4
  82. data/lib/wx/doc/gen/check_list_box.rb +0 -2
  83. data/lib/wx/doc/gen/choice.rb +1 -5
  84. data/lib/wx/doc/gen/client_dc.rb +13 -18
  85. data/lib/wx/doc/gen/clipboard.rb +30 -27
  86. data/lib/wx/doc/gen/collapsible_pane.rb +11 -9
  87. data/lib/wx/doc/gen/colour.rb +6 -3
  88. data/lib/wx/doc/gen/colour_dialog.rb +111 -23
  89. data/lib/wx/doc/gen/combo_box.rb +2 -4
  90. data/lib/wx/doc/gen/context_help_button.rb +48 -0
  91. data/lib/wx/doc/gen/control.rb +20 -18
  92. data/lib/wx/doc/gen/core.rb +2 -2
  93. data/lib/wx/doc/gen/cursor.rb +18 -50
  94. data/lib/wx/doc/gen/data_format.rb +0 -2
  95. data/lib/wx/doc/gen/data_object.rb +37 -44
  96. data/lib/wx/doc/gen/dc.rb +16 -24
  97. data/lib/wx/doc/gen/defs.rb +3 -40
  98. data/lib/wx/doc/gen/dialog.rb +21 -17
  99. data/lib/wx/doc/gen/dir_dialog.rb +10 -8
  100. data/lib/wx/doc/gen/event.rb +2 -2
  101. data/lib/wx/doc/gen/event_blocker.rb +51 -0
  102. data/lib/wx/doc/gen/event_filter.rb +88 -0
  103. data/lib/wx/doc/gen/event_list.rb +23 -2
  104. data/lib/wx/doc/gen/events.rb +103 -112
  105. data/lib/wx/doc/gen/evt_handler.rb +28 -52
  106. data/lib/wx/doc/gen/file_dialog.rb +53 -50
  107. data/lib/wx/doc/gen/find_replace_dialog.rb +1 -1
  108. data/lib/wx/doc/gen/font.rb +19 -2
  109. data/lib/wx/doc/gen/font_data.rb +2 -0
  110. data/lib/wx/doc/gen/font_dialog.rb +1 -1
  111. data/lib/wx/doc/gen/frame.rb +4 -3
  112. data/lib/wx/doc/gen/fs_file.rb +8 -0
  113. data/lib/wx/doc/gen/gcdc.rb +2 -22
  114. data/lib/wx/doc/gen/gdi_common.rb +18 -2
  115. data/lib/wx/doc/gen/gdi_object.rb +2 -0
  116. data/lib/wx/doc/gen/graphics_context.rb +4 -43
  117. data/lib/wx/doc/gen/graphics_object.rb +2 -0
  118. data/lib/wx/doc/gen/grid/grid_cell_attr.rb +2 -1
  119. data/lib/wx/doc/gen/grid/grid_ctrl.rb +4 -2
  120. data/lib/wx/doc/gen/grid/grid_table_message.rb +2 -0
  121. data/lib/wx/doc/gen/grid_bag_sizer.rb +4 -0
  122. data/lib/wx/doc/gen/help_controller.rb +4 -1
  123. data/lib/wx/doc/gen/html/html_cell.rb +4 -1
  124. data/lib/wx/doc/gen/html/html_help_controller.rb +4 -1
  125. data/lib/wx/doc/gen/html/html_help_data.rb +4 -0
  126. data/lib/wx/doc/gen/html/html_help_window.rb +2 -1
  127. data/lib/wx/doc/gen/html/html_list_box.rb +138 -11
  128. data/lib/wx/doc/gen/html/html_window.rb +9 -3
  129. data/lib/wx/doc/gen/hyperlink_ctrl.rb +147 -0
  130. data/lib/wx/doc/gen/hyperlink_event.rb +43 -0
  131. data/lib/wx/doc/gen/icon.rb +7 -1
  132. data/lib/wx/doc/gen/icon_location.rb +2 -0
  133. data/lib/wx/doc/gen/image.rb +15 -8
  134. data/lib/wx/doc/gen/keyboard_state.rb +6 -0
  135. data/lib/wx/doc/gen/list_box.rb +0 -11
  136. data/lib/wx/doc/gen/list_ctrl.rb +10 -13
  137. data/lib/wx/doc/gen/locale.rb +7 -3
  138. data/lib/wx/doc/gen/log.rb +6 -2
  139. data/lib/wx/doc/gen/mdi_frame.rb +2 -0
  140. data/lib/wx/doc/gen/media_ctrl.rb +2 -0
  141. data/lib/wx/doc/gen/memory_dc.rb +105 -18
  142. data/lib/wx/doc/gen/menu.rb +4 -2
  143. data/lib/wx/doc/gen/menu_bar.rb +0 -8
  144. data/lib/wx/doc/gen/menu_item.rb +9 -3
  145. data/lib/wx/doc/gen/message_dialog.rb +6 -3
  146. data/lib/wx/doc/gen/mirror_dc.rb +2 -8
  147. data/lib/wx/doc/gen/mouse_state.rb +2 -0
  148. data/lib/wx/doc/gen/multi_choice_dialog.rb +0 -2
  149. data/lib/wx/doc/gen/non_owned_window.rb +2 -1
  150. data/lib/wx/doc/gen/notebook.rb +4 -2
  151. data/lib/wx/doc/gen/paint_dc.rb +2 -6
  152. data/lib/wx/doc/gen/palette.rb +3 -3
  153. data/lib/wx/doc/gen/pen.rb +6 -1
  154. data/lib/wx/doc/gen/pg/pg_editor.rb +2 -1
  155. data/lib/wx/doc/gen/pg/pg_multi_button.rb +4 -0
  156. data/lib/wx/doc/gen/pg/pg_properties.rb +30 -3
  157. data/lib/wx/doc/gen/pg/pg_property.rb +30 -4
  158. data/lib/wx/doc/gen/pg/pg_validation_info.rb +2 -0
  159. data/lib/wx/doc/gen/pg/property_grid.rb +5 -2
  160. data/lib/wx/doc/gen/pg/property_grid_interface.rb +6 -2
  161. data/lib/wx/doc/gen/pg/property_grid_manager.rb +2 -0
  162. data/lib/wx/doc/gen/pg/property_grid_page_state.rb +2 -0
  163. data/lib/wx/doc/gen/picker_base.rb +2 -1
  164. data/lib/wx/doc/gen/platform_info.rb +4 -1
  165. data/lib/wx/doc/gen/property_sheet_dialog.rb +2 -0
  166. data/lib/wx/doc/gen/prt/post_script_dc.rb +2 -8
  167. data/lib/wx/doc/gen/prt/print_data.rb +6 -0
  168. data/lib/wx/doc/gen/prt/printer.rb +0 -3
  169. data/lib/wx/doc/gen/prt/printer_dc.rb +2 -6
  170. data/lib/wx/doc/gen/radio_box.rb +2 -10
  171. data/lib/wx/doc/gen/rbn/ribbon_art_provider.rb +6 -0
  172. data/lib/wx/doc/gen/rbn/ribbon_panel.rb +1 -1
  173. data/lib/wx/doc/gen/region.rb +2 -0
  174. data/lib/wx/doc/gen/rtc/rich_text_buffer.rb +6 -0
  175. data/lib/wx/doc/gen/rtc/rich_text_ctrl.rb +0 -4
  176. data/lib/wx/doc/gen/rtc/rich_text_header_footer_data.rb +2 -0
  177. data/lib/wx/doc/gen/rtc/rich_text_html_handler.rb +2 -1
  178. data/lib/wx/doc/gen/rtc/symbol_picker_dialog.rb +2 -0
  179. data/lib/wx/doc/gen/screen_dc.rb +2 -0
  180. data/lib/wx/doc/gen/scroll_bar.rb +2 -1
  181. data/lib/wx/doc/gen/scrolled_canvas.rb +4 -8
  182. data/lib/wx/doc/gen/scrolled_control.rb +4 -8
  183. data/lib/wx/doc/gen/scrolled_window.rb +4 -8
  184. data/lib/wx/doc/gen/search_ctrl.rb +131 -0
  185. data/lib/wx/doc/gen/single_choice_dialog.rb +0 -2
  186. data/lib/wx/doc/gen/sizer.rb +14 -3
  187. data/lib/wx/doc/gen/splash_screen.rb +2 -0
  188. data/lib/wx/doc/gen/static_box.rb +6 -3
  189. data/lib/wx/doc/gen/static_box_sizer.rb +2 -1
  190. data/lib/wx/doc/gen/status_bar.rb +0 -5
  191. data/lib/wx/doc/gen/stc/styled_text_ctrl.rb +4 -5
  192. data/lib/wx/doc/gen/svg_file_dc.rb +10 -11
  193. data/lib/wx/doc/gen/text_ctrl.rb +10 -3
  194. data/lib/wx/doc/gen/text_entry.rb +8 -3
  195. data/lib/wx/doc/gen/text_entry_dialog.rb +4 -2
  196. data/lib/wx/doc/gen/timer_event.rb +2 -0
  197. data/lib/wx/doc/gen/tool_bar.rb +8 -4
  198. data/lib/wx/doc/gen/top_level_window.rb +5 -2
  199. data/lib/wx/doc/gen/tree_ctrl.rb +0 -6
  200. data/lib/wx/doc/gen/ui_action_simulator.rb +100 -0
  201. data/lib/wx/doc/gen/utils.rb +1 -1
  202. data/lib/wx/doc/gen/v_list_box.rb +36 -26
  203. data/lib/wx/doc/gen/validator.rb +2 -1
  204. data/lib/wx/doc/gen/variant.rb +10 -0
  205. data/lib/wx/doc/gen/window.rb +38 -17
  206. data/lib/wx/doc/gen/window_dc.rb +2 -0
  207. data/lib/wx/doc/gen/window_disabler.rb +2 -0
  208. data/lib/wx/doc/gen/wizard_page_simple.rb +2 -0
  209. data/lib/wx/doc/gen/xml_node.rb +6 -0
  210. data/lib/wx/doc/gen/xml_resource.rb +4 -1
  211. data/lib/wx/doc/memory_dc.rb +75 -0
  212. data/lib/wx/doc/mirror_dc.rb +16 -0
  213. data/lib/wx/doc/pen.rb +17 -0
  214. data/lib/wx/doc/prt/printer_dc.rb +26 -0
  215. data/lib/wx/doc/radio_box.rb +20 -0
  216. data/lib/wx/doc/screen_dc.rb +10 -6
  217. data/lib/wx/doc/svg_file_dc.rb +20 -0
  218. data/lib/wx/doc/v_list_box.rb +9 -0
  219. data/lib/wx/doc/window.rb +27 -0
  220. data/lib/wx/doc/window_disabler.rb +10 -0
  221. data/lib/wx/html/keyword_defs.rb +6 -7
  222. data/lib/wx/html/require.rb +1 -0
  223. data/lib/wx/html/simple_html_listbox.rb +105 -0
  224. data/lib/wx/keyword_defs.rb +83 -75
  225. data/lib/wx/prt/keyword_defs.rb +5 -1
  226. data/lib/wx/version.rb +1 -1
  227. data/lib/wx/wxruby/cmd/test.rb +1 -1
  228. data/lib/wxruby_aui.so +0 -0
  229. data/lib/wxruby_core.so +0 -0
  230. data/lib/wxruby_grid.so +0 -0
  231. data/lib/wxruby_html.so +0 -0
  232. data/lib/wxruby_pg.so +0 -0
  233. data/lib/wxruby_prt.so +0 -0
  234. data/lib/wxruby_rbn.so +0 -0
  235. data/lib/wxruby_rtc.so +0 -0
  236. data/lib/wxruby_stc.so +0 -0
  237. data/rakelib/install.rb +20 -7
  238. data/rakelib/lib/config/linux.rb +4 -2
  239. data/rakelib/lib/config/macosx.rb +120 -1
  240. data/rakelib/lib/config/mingw.rb +6 -1
  241. data/rakelib/lib/config/unixish.rb +26 -11
  242. data/rakelib/lib/config.rb +15 -6
  243. data/rakelib/yard/yard/relative_markdown_links.rb +5 -1
  244. data/samples/aui/aui.rb +432 -363
  245. data/samples/bigdemo/wxArtProvider.rbw +5 -4
  246. data/samples/controls/controls.rb +2 -2
  247. data/samples/controls/htlbox.rb +411 -0
  248. data/samples/controls/tn_htlbox.png +0 -0
  249. data/samples/drawing/graphics_drawing.rb +1 -2
  250. data/samples/drawing/{svgtest.rb → image_prt.rb} +49 -18
  251. data/samples/drawing/tn_image_prt.png +0 -0
  252. data/samples/propgrid/propgrid.rb +26 -21
  253. data/samples/ribbon/ribbon.rb +47 -46
  254. data/samples/sampler/editor.rb +33 -25
  255. data/samples/sampler/sample.rb +2 -2
  256. data/samples/sampler/stc_editor.rb +4 -2
  257. data/tests/lib/item_container_tests.rb +82 -0
  258. data/tests/lib/text_entry_tests.rb +80 -0
  259. data/tests/lib/wxapp_runner.rb +15 -3
  260. data/tests/lib/wxframe_runner.rb +144 -0
  261. data/tests/test_app_event_filter.rb +74 -0
  262. data/tests/test_art_provider.rb +52 -0
  263. data/tests/test_clipboard.rb +2 -1
  264. data/tests/test_event_handling.rb +199 -16
  265. data/tests/test_events.rb +4 -11
  266. data/tests/test_ext_controls.rb +28 -0
  267. data/tests/test_font.rb +239 -0
  268. data/tests/test_gdi_object.rb +161 -0
  269. data/tests/test_intl.rb +16 -15
  270. data/tests/test_item_data.rb +33 -1
  271. data/tests/test_std_controls.rb +373 -0
  272. data/tests/test_window.rb +340 -0
  273. metadata +61 -8
  274. data/lib/wx/doc/gen/auto_buffered_paint_dc.rb +0 -47
  275. data/lib/wx/doc/gen/buffered_dc.rb +0 -95
  276. data/lib/wx/doc/gen/buffered_paint_dc.rb +0 -55
  277. data/lib/wx/doc/gen/colour_data.rb +0 -96
  278. data/samples/drawing/tn_svgtest.png +0 -0
@@ -0,0 +1,52 @@
1
+
2
+ require_relative './lib/wxapp_runner'
3
+
4
+ class TestArtProvider < Test::Unit::TestCase
5
+
6
+ class MyArtProvider < Wx::ArtProvider
7
+
8
+ class << self
9
+ def is_called?
10
+ !!@called
11
+ end
12
+ def set_called(f = true)
13
+ @called = f
14
+ end
15
+ end
16
+
17
+ def create_bitmap(id, client, size)
18
+ if id == Wx::ArtProvider.get_message_box_icon_id(Wx::ICON_INFORMATION)
19
+ MyArtProvider.set_called
20
+ Wx::Bitmap(:sample3)
21
+ else
22
+ MyArtProvider.set_called(false)
23
+ super
24
+ end
25
+ end
26
+
27
+ end
28
+
29
+ def test_custom_provider
30
+ assert_not_nil(Wx::ArtProvider.get_message_box_icon(Wx::ICON_INFORMATION))
31
+ GC.start
32
+ assert(!MyArtProvider.is_called?)
33
+ GC.start
34
+ assert_nothing_raised { Wx::ArtProvider.push(MyArtProvider.new) }
35
+ GC.start
36
+ assert_not_nil(Wx::ArtProvider.get_message_box_icon(Wx::ICON_INFORMATION))
37
+ GC.start
38
+ assert(MyArtProvider.is_called?)
39
+ GC.start
40
+ assert_not_nil(Wx::ArtProvider.get_message_box_icon(Wx::ICON_ERROR))
41
+ GC.start
42
+ assert(!MyArtProvider.is_called?)
43
+ GC.start
44
+ assert_nothing_raised { Wx::ArtProvider.pop }
45
+ GC.start
46
+ assert_not_nil(Wx::ArtProvider.get_message_box_icon(Wx::ICON_INFORMATION))
47
+ GC.start
48
+ assert(!MyArtProvider.is_called?)
49
+ GC.start
50
+ end
51
+
52
+ end
@@ -54,6 +54,7 @@ if Wx.has_feature?(:USE_HTML) && Wx::WXWIDGETS_VERSION >= '3.3'
54
54
  Wx::Clipboard.open do | clip |
55
55
  clip.fetch td_2
56
56
  end
57
+
57
58
  assert_equal('<html><body><h1>Header</h1></body></html>', td_2.html)
58
59
 
59
60
  Wx::Clipboard.open do | clip |
@@ -64,7 +65,7 @@ if Wx.has_feature?(:USE_HTML) && Wx::WXWIDGETS_VERSION >= '3.3'
64
65
  Wx::Clipboard.open do | clip |
65
66
  clip.fetch td_3
66
67
  end
67
- assert_equal('', td_3.get_data_here)
68
+ assert_equal('', td_3.get_html)
68
69
  end
69
70
  end
70
71
  end
@@ -41,6 +41,7 @@ class EventHandlingTests < Test::Unit::TestCase
41
41
  @child = Child.new(self)
42
42
  @test_event = false
43
43
  @test_cmd_event = false
44
+ @called_after = false
44
45
 
45
46
  evt_test_event { |evt| @test_event = true }
46
47
  evt_test_cmd_event { |evt| @test_cmd_event = true }
@@ -48,45 +49,227 @@ class EventHandlingTests < Test::Unit::TestCase
48
49
 
49
50
  attr_reader :child
50
51
  attr_reader :test_event, :test_cmd_event
52
+ attr_accessor :called_after
51
53
 
52
54
  def reset
53
55
  @test_event = false
54
56
  @test_cmd_event = false
57
+ @called_after = false
55
58
  child.reset
56
59
  end
57
60
  end
58
61
 
59
62
  def test_event
60
63
  win = TestFrame.new
61
- assert_boolean(!win.test_event)
62
- assert_boolean(!win.child.test_event)
64
+ assert(!win.test_event)
65
+ assert(!win.child.test_event)
63
66
  win.child.event_handler.process_event(TestEvent.new)
64
- assert_boolean(!win.test_event)
65
- assert_boolean(win.child.test_event)
67
+ assert(!win.test_event)
68
+ assert(win.child.test_event)
66
69
  win.reset
67
70
  win.child.event_handler.process_event(TestEvent.new(1))
68
- assert_boolean(!win.test_event)
69
- assert_boolean(win.child.test_event)
71
+ assert(!win.test_event)
72
+ assert(win.child.test_event)
70
73
  win.reset
71
74
  win.event_handler.process_event(TestEvent.new)
72
- assert_boolean(win.test_event)
73
- assert_boolean(!win.child.test_event)
75
+ assert(win.test_event)
76
+ assert(!win.child.test_event)
77
+ win.destroy
78
+ Wx.get_app.yield
74
79
  end
75
80
 
76
81
  def test_cmd_event
77
82
  win = TestFrame.new
78
- assert_boolean(!win.test_cmd_event)
79
- assert_boolean(!win.child.test_cmd_event)
83
+ assert(!win.test_cmd_event)
84
+ assert(!win.child.test_cmd_event)
80
85
  win.child.event_handler.process_event(TestCmdEvent.new)
81
- assert_boolean(!win.test_cmd_event)
82
- assert_boolean(win.child.test_cmd_event)
86
+ assert(!win.test_cmd_event)
87
+ assert(win.child.test_cmd_event)
83
88
  win.reset
84
89
  win.child.event_handler.process_event(TestCmdEvent.new(1))
85
- assert_boolean(win.test_cmd_event)
86
- assert_boolean(win.child.test_cmd_event)
90
+ assert(win.test_cmd_event)
91
+ assert(win.child.test_cmd_event)
87
92
  win.reset
88
93
  win.event_handler.process_event(TestCmdEvent.new)
89
- assert_boolean(win.test_cmd_event)
90
- assert_boolean(!win.child.test_cmd_event)
94
+ assert(win.test_cmd_event)
95
+ assert(!win.child.test_cmd_event)
96
+ win.destroy
97
+ Wx.get_app.yield
91
98
  end
99
+
100
+ def test_queue_event
101
+ win = TestFrame.new
102
+ assert(!win.test_cmd_event)
103
+ assert(!win.child.test_cmd_event)
104
+ win.child.event_handler.queue_event(TestCmdEvent.new)
105
+ Wx.get_app.yield
106
+ assert(!win.test_cmd_event)
107
+ assert(win.child.test_cmd_event)
108
+ win.reset
109
+ win.child.event_handler.queue_event(TestCmdEvent.new(1))
110
+ Wx.get_app.yield
111
+ assert(win.test_cmd_event)
112
+ assert(win.child.test_cmd_event)
113
+ win.reset
114
+ win.event_handler.queue_event(TestCmdEvent.new)
115
+ Wx.get_app.yield
116
+ assert(win.test_cmd_event)
117
+ assert(!win.child.test_cmd_event)
118
+ win.destroy
119
+ Wx.get_app.yield
120
+ end
121
+
122
+ def test_pending_event
123
+ win = TestFrame.new
124
+ assert(!win.test_cmd_event)
125
+ assert(!win.child.test_cmd_event)
126
+ win.child.event_handler.add_pending_event(TestCmdEvent.new)
127
+ Wx.get_app.yield
128
+ assert(!win.test_cmd_event)
129
+ assert(win.child.test_cmd_event)
130
+ win.reset
131
+ win.child.event_handler.add_pending_event(TestCmdEvent.new(1))
132
+ Wx.get_app.yield
133
+ assert(win.test_cmd_event)
134
+ assert(win.child.test_cmd_event)
135
+ win.reset
136
+ win.event_handler.add_pending_event(TestCmdEvent.new)
137
+ Wx.get_app.yield
138
+ assert(win.test_cmd_event)
139
+ assert(!win.child.test_cmd_event)
140
+ win.destroy
141
+ Wx.get_app.yield
142
+ end
143
+
144
+ def test_post_event
145
+ win = TestFrame.new
146
+ assert(!win.test_cmd_event)
147
+ assert(!win.child.test_cmd_event)
148
+ Wx.post_event(win.child.event_handler, TestCmdEvent.new)
149
+ Wx.get_app.yield
150
+ assert(!win.test_cmd_event)
151
+ assert(win.child.test_cmd_event)
152
+ win.reset
153
+ Wx.post_event(win.child.event_handler, TestCmdEvent.new(1))
154
+ Wx.get_app.yield
155
+ assert(win.test_cmd_event)
156
+ assert(win.child.test_cmd_event)
157
+ win.reset
158
+ Wx.post_event(win.event_handler, TestCmdEvent.new)
159
+ Wx.get_app.yield
160
+ assert(win.test_cmd_event)
161
+ assert(!win.child.test_cmd_event)
162
+ win.destroy
163
+ Wx.get_app.yield
164
+ end
165
+
166
+ def test_call_after
167
+ win = TestFrame.new
168
+ assert(!win.called_after)
169
+ win.event_handler.call_after { win.called_after = true }
170
+ Wx.get_app.yield
171
+ assert(win.called_after)
172
+ win.reset
173
+ win.child.event_handler.call_after { win.called_after = true }
174
+ Wx.get_app.yield
175
+ assert(win.called_after)
176
+ win.destroy
177
+ Wx.get_app.yield
178
+ end
179
+
180
+ def test_event_blocker
181
+ win = TestFrame.new
182
+ assert(!win.test_event)
183
+ win.event_handler.process_event(TestEvent.new)
184
+ assert(win.test_event)
185
+ win.reset
186
+ Wx::EventBlocker.blocked_for(win) do |blkr|
187
+ win.event_handler.process_event(TestEvent.new(1))
188
+ end
189
+ assert(!win.test_event)
190
+ win.event_handler.process_event(TestEvent.new)
191
+ assert(win.test_event)
192
+ win.reset
193
+ Wx::EventBlocker.blocked_for(win, TestEvent::EVT_TEST_EVENT) do |blkr|
194
+ win.event_handler.process_event(TestEvent.new(1))
195
+ end
196
+ assert(!win.test_event)
197
+ win.event_handler.process_event(TestEvent.new)
198
+ assert(win.test_event)
199
+ win.reset
200
+ Wx::EventBlocker.blocked_for(win, Wx::EVT_ACTIVATE) do |blkr|
201
+ win.event_handler.process_event(TestEvent.new(1))
202
+ end
203
+ assert(win.test_event)
204
+ win.destroy
205
+ Wx.get_app.yield
206
+ end
207
+
208
+ class MyEventFilter < Wx::EventFilter
209
+ def initialize
210
+ super
211
+ @filtered = false
212
+ end
213
+
214
+ attr_accessor :filtered
215
+
216
+ def filter_event(event)
217
+ @filtered = true if event.is_a?(TestEvent)
218
+ Wx::EventFilter::Event_Skip
219
+ end
220
+ end
221
+
222
+ def test_event_filter
223
+ filter = MyEventFilter.new
224
+ assert_nothing_raised { Wx::EvtHandler.add_filter(filter) }
225
+ GC.start
226
+ win = TestFrame.new
227
+ win.child.event_handler.process_event(TestEvent.new)
228
+ GC.start
229
+ assert(filter.filtered)
230
+ filter.filtered = false
231
+ win.child.event_handler.process_event(TestCmdEvent.new)
232
+ GC.start
233
+ assert(!filter.filtered)
234
+ assert_nothing_raised { Wx::EvtHandler.remove_filter(filter) }
235
+ GC.start
236
+ win.child.event_handler.process_event(TestEvent.new)
237
+ assert(!filter.filtered)
238
+ GC.start
239
+ win.destroy
240
+ Wx.get_app.yield
241
+ end
242
+
243
+ class MyEventFilter2 < Wx::EventFilter
244
+
245
+ class << self
246
+ attr_accessor :filtered
247
+ end
248
+
249
+ def filter_event(event)
250
+ MyEventFilter2.filtered = true if event.is_a?(TestEvent)
251
+ Wx::EventFilter::Event_Skip
252
+ end
253
+ end
254
+
255
+ def test_event_filter_clear
256
+ assert_nothing_raised { Wx::EvtHandler.add_filter(MyEventFilter2.new) }
257
+ GC.start
258
+ win = TestFrame.new
259
+ win.child.event_handler.process_event(TestEvent.new)
260
+ GC.start
261
+ assert(MyEventFilter2.filtered)
262
+ MyEventFilter2.filtered = false
263
+ win.child.event_handler.process_event(TestCmdEvent.new)
264
+ GC.start
265
+ assert(!MyEventFilter2.filtered)
266
+ assert_nothing_raised { Wx::EvtHandler.clear_filters }
267
+ GC.start
268
+ win.child.event_handler.process_event(TestEvent.new)
269
+ assert(!MyEventFilter2.filtered)
270
+ GC.start
271
+ win.destroy
272
+ Wx.get_app.yield
273
+ end
274
+
92
275
  end
data/tests/test_events.rb CHANGED
@@ -7,9 +7,9 @@ class EventTests < Test::Unit::TestCase
7
7
  evt = Wx::Event.new(100, 1)
8
8
  assert_equal(100, evt.event_type)
9
9
  assert_equal(1, evt.id)
10
- assert_boolean(!evt.should_propagate)
10
+ assert(!evt.should_propagate)
11
11
  evt.skip
12
- assert_boolean(evt.skipped)
12
+ assert(evt.skipped)
13
13
  evt_dup = evt.clone
14
14
  assert_not_equal(evt, evt_dup)
15
15
  assert_equal(evt.event_type, evt_dup.event_type)
@@ -20,9 +20,9 @@ class EventTests < Test::Unit::TestCase
20
20
  evt = Wx::CommandEvent.new(100, 1)
21
21
  assert_equal(100, evt.event_type)
22
22
  assert_equal(1, evt.id)
23
- assert_boolean(evt.should_propagate)
23
+ assert(evt.should_propagate)
24
24
  evt.skip
25
- assert_boolean(evt.skipped)
25
+ assert(evt.skipped)
26
26
  evt.string = 'CommandEvent Test'
27
27
  assert_equal('CommandEvent Test', evt.string)
28
28
  evt_dup = evt.clone
@@ -44,10 +44,3 @@ class EventTests < Test::Unit::TestCase
44
44
  assert_equal(evt.position, evt_dup.position)
45
45
  end
46
46
  end
47
-
48
- class TestApp < Wx::App
49
- def on_init
50
- Test::Unit::UI::Console::TestRunner.run(EventTests)
51
- false
52
- end
53
- end
@@ -0,0 +1,28 @@
1
+
2
+ require_relative './lib/wxframe_runner'
3
+ require_relative './lib/text_entry_tests'
4
+
5
+ class SearchCtrlTests < WxRuby::Test::GUITests
6
+
7
+ include TextEntryTests
8
+
9
+ def setup
10
+ super
11
+ @search = Wx::SearchCtrl.new(test_frame, name: 'SearchCtrl')
12
+ Wx.get_app.yield
13
+ end
14
+
15
+ def cleanup
16
+ @search.destroy
17
+ Wx.get_app.yield
18
+ super
19
+ end
20
+
21
+ attr_reader :search
22
+ alias :text_entry :search
23
+
24
+ def test_search
25
+ assert_equal('', search.get_value)
26
+ end
27
+
28
+ end
@@ -0,0 +1,239 @@
1
+
2
+ require_relative './lib/wxapp_runner'
3
+
4
+ class FontTests < Test::Unit::TestCase
5
+
6
+ def get_test_fonts
7
+ [
8
+ Wx::Font.new(Wx::NORMAL_FONT),
9
+ Wx::Font.new(Wx::SMALL_FONT),
10
+ Wx::Font.new(Wx::ITALIC_FONT),
11
+ Wx::Font.new(Wx::SWISS_FONT),
12
+ Wx::Font.new(5, Wx::FontFamily::FONTFAMILY_TELETYPE, Wx::FontStyle::FONTSTYLE_NORMAL, Wx::FontWeight::FONTWEIGHT_NORMAL)
13
+ ]
14
+ end
15
+
16
+ def test_size
17
+ sz_klass = Struct.new(:specified, # Size in points specified in the ctor.
18
+ :expected) # Expected GetPointSize() return value,
19
+ # -1 here means "same as wxNORMAL_FONT".
20
+ sizes = [
21
+ sz_klass.new(9,9),
22
+ sz_klass.new(10, 10),
23
+ sz_klass.new(11, 11),
24
+ sz_klass.new(-1, -1),
25
+ sz_klass.new(70, -1),
26
+ sz_klass.new(90, 90),
27
+ ]
28
+
29
+ size_default = Wx::Font.new(Wx::FontInfo.new).get_point_size
30
+
31
+ sizes.each do |size|
32
+ # Note: use the old-style wxFont ctor as wxFontInfo doesn't implement
33
+ # any compatibility hacks.
34
+ font = Wx::Font.new(size.specified,
35
+ Wx::FONTFAMILY_DEFAULT,
36
+ Wx::FONTSTYLE_NORMAL,
37
+ Wx::FONTWEIGHT_NORMAL)
38
+
39
+ expected = size.expected
40
+ expected = size_default if expected == -1
41
+
42
+ puts "specified = #{size.specified}, expected = #{size.expected}" unless is_ci_build?
43
+ assert_equal(expected, font.get_point_size)
44
+ end
45
+
46
+ # Note that the compatibility hacks only apply to the old ctors, the newer
47
+ # one, taking wxFontInfo, doesn't support them.
48
+ assert_equal(70, Wx::Font.new(Wx::FontInfo.new(70)).get_point_size)
49
+ assert_equal(90, Wx::Font.new(Wx::FontInfo.new(90)).get_point_size)
50
+
51
+ # assert_equal fractional point sizes as well.
52
+ font = Wx::Font.new(Wx::FontInfo.new(12.25))
53
+ assert_equal(12.25, font.get_fractional_point_size)
54
+ assert_equal(12, font.get_point_size)
55
+
56
+ font = Wx::NORMAL_FONT
57
+ font.set_fractional_point_size(9.5)
58
+ assert_equal(9.5, font.get_fractional_point_size)
59
+ assert_equal(10, font.get_point_size)
60
+ end
61
+
62
+ def test_weight
63
+ font = Wx::Font.new
64
+ font.set_numeric_weight(123)
65
+
66
+ assert_equal(123, font.get_numeric_weight) unless Wx::PLATFORM == 'WXOSX'
67
+
68
+ assert_equal(Wx::FontWeight::FONTWEIGHT_THIN, font.get_weight)
69
+
70
+ font.set_numeric_weight(Wx::FontWeight::FONTWEIGHT_SEMIBOLD)
71
+ assert_equal(Wx::FontWeight::FONTWEIGHT_SEMIBOLD, font.get_numeric_weight)
72
+ assert_equal(Wx::FontWeight::FONTWEIGHT_SEMIBOLD, font.get_weight)
73
+ end
74
+
75
+ def test_get_set
76
+
77
+ get_test_fonts.each_with_index do |test, n|
78
+
79
+ assert(test.ok?)
80
+
81
+ # test Get/SetFaceName()
82
+ assert( !test.set_face_name("a dummy face name") )
83
+ assert( !test.ok? )
84
+
85
+ # if the call to set_face_name() below fails on your system/port,
86
+ # consider adding another branch to this if
87
+ known_good_face_name = if Wx::PLATFORM == 'WXMSW' || Wx::PLATFORM == 'WXOSX'
88
+ "Arial"
89
+ else
90
+ "Monospace"
91
+ end
92
+
93
+ puts("Testing font ##{n}") unless is_ci_build?
94
+
95
+ puts("setting face name to #{known_good_face_name}") unless is_ci_build?
96
+ assert( test.set_face_name(known_good_face_name) )
97
+ assert( test.ok? )
98
+
99
+
100
+ # test get/set_family()
101
+
102
+ test.set_family(Wx::FontFamily::FONTFAMILY_ROMAN )
103
+ assert( test.ok? )
104
+
105
+ # note that there is always the possibility that get_family() returns
106
+ # Wx::FONTFAMILY_DEFAULT (meaning "unknown" in this case) so that we
107
+ # consider it as a valid return value
108
+ family = test.get_family
109
+ if family != Wx::FONTFAMILY_DEFAULT
110
+ assert_equal(Wx::FONTFAMILY_ROMAN, family )
111
+ end
112
+
113
+
114
+ # test get/set_point_size()
115
+
116
+ test.set_point_size(30)
117
+ assert( test.ok? )
118
+ assert_equal( 30, test.get_point_size )
119
+
120
+
121
+ # test get/set_pixel_size()
122
+
123
+ test.set_pixel_size(Wx::Size.new(0,30))
124
+ assert( test.ok? )
125
+ assert( test.get_pixel_size.get_height <= 30 )
126
+ # NOTE: the match found by set_pixel_size() may be not 100% precise it
127
+ # only grants that a font smaller than the required height will
128
+ # be selected
129
+
130
+
131
+ # test get/set_style()
132
+
133
+ test.set_style(Wx::FONTSTYLE_SLANT)
134
+ assert( test.ok? )
135
+ # on wxMSW Wx::FONTSTYLE_SLANT==Wx::FONTSTYLE_ITALIC, so accept the latter
136
+ # as a valid value too.
137
+ if ( test.get_style != Wx::FONTSTYLE_SLANT )
138
+ assert( Wx::PLATFORM == 'WXMSW' && Wx::FONTSTYLE_ITALIC == test.get_style )
139
+ end
140
+
141
+ # test get/set_underlined()
142
+
143
+ test.set_underlined(true)
144
+ assert( test.ok? )
145
+ assert( test.get_underlined )
146
+
147
+ fontBase = test.get_base_font
148
+ assert( fontBase.ok? )
149
+ assert( !fontBase.get_underlined )
150
+ assert( !fontBase.get_strikethrough )
151
+ assert_equal( Wx::FONTWEIGHT_NORMAL, fontBase.get_weight )
152
+ assert_equal( Wx::FONTSTYLE_NORMAL, fontBase.get_style )
153
+
154
+ # test get/set_strikethrough()
155
+
156
+ test.set_strikethrough(true)
157
+ assert( test.ok? )
158
+ assert( test.get_strikethrough )
159
+
160
+
161
+ # test get/set_weight()
162
+
163
+ test.set_weight(Wx::FONTWEIGHT_BOLD)
164
+ assert( test.ok? )
165
+ assert_equal( Wx::FONTWEIGHT_BOLD, test.get_weight )
166
+ end
167
+
168
+ end
169
+
170
+ def test_native_font_info
171
+ get_test_fonts.each_with_index do |test, n|
172
+ nid = test.get_native_font_info_desc
173
+ assert( !nid.empty? )
174
+ # documented to be never empty
175
+
176
+ temp = Wx::Font.new
177
+ assert( temp.set_native_font_info(nid) )
178
+ assert( temp.ok? )
179
+
180
+ puts("Testing font ##{n}") unless is_ci_build?
181
+ puts("original font user description: #{test.get_native_font_info_user_desc}") unless is_ci_build?
182
+ puts("the other font description: #{temp.get_native_font_info_user_desc}") unless is_ci_build?
183
+
184
+ assert_equal( temp, test ) unless Wx::PLATFORM == 'WXOSX'
185
+ end
186
+
187
+ # test that clearly invalid font info strings do not work
188
+ font = Wx::Font.new
189
+ assert( !font.set_native_font_info('') )
190
+
191
+ # pango_font_description_from_string() used by Wx::Font in wxGTK and wxX11
192
+ # never returns an error at all so this assertion fails there -- and as it
193
+ # doesn't seem to be possible to do anything about it maybe we should
194
+ # change wxMSW and other ports to also accept any strings?
195
+ unless %w[WXGTK WXX11 WXQT].include?(Wx::PLATFORM)
196
+ assert( !font.set_native_font_info("bloordyblop") )
197
+ end
198
+
199
+ font.set_underlined(true)
200
+ font.set_strikethrough(true)
201
+ assert(font == Wx::Font.new(font))
202
+ assert(font == Wx::Font.new(font.get_native_font_info_desc)) unless Wx::PLATFORM == 'WXOSX'
203
+ assert(Wx::Font.new(font.get_native_font_info_desc).get_underlined)
204
+ assert(Wx::Font.new(font.get_native_font_info_desc).get_strikethrough)
205
+ font.set_underlined(false)
206
+ assert(font == Wx::Font.new(font))
207
+ assert(font == Wx::Font.new(font.get_native_font_info_desc)) unless Wx::PLATFORM == 'WXOSX'
208
+ assert(!Wx::Font.new(font.get_native_font_info_desc).get_underlined)
209
+ font.set_underlined(true)
210
+ font.set_strikethrough(false)
211
+ assert(font == Wx::Font.new(font))
212
+ assert(font == Wx::Font.new(font.get_native_font_info_desc)) unless Wx::PLATFORM == 'WXOSX'
213
+ assert(Wx::Font.new(font.get_native_font_info_desc).get_underlined)
214
+ assert(!Wx::Font.new(font.get_native_font_info_desc).get_strikethrough)
215
+ end
216
+
217
+ def test_find_or_create
218
+ [10.5, Wx::Size.new(0, 32)].each do |pt_sz|
219
+ info = Wx::FontInfo.new(pt_sz)
220
+
221
+ font1 = Wx::Font.find_or_create_font(info)
222
+ assert(font1)
223
+ assert(font1.ok?)
224
+
225
+ puts "Font from font list: #{font1.get_native_font_info_user_desc}" unless is_ci_build?
226
+
227
+ if pt_sz.is_a?(Wx::Size)
228
+ assert(pt_sz.y >= font1.get_pixel_size.y)
229
+ else
230
+ assert_equal(pt_sz, font1.get_fractional_point_size) unless is_ci_build?
231
+ end
232
+
233
+ # font 2 should be font1 from the font list "cache"
234
+ font2 = Wx::TheFontList.find_or_create_font(info)
235
+ assert_equal(font1, font2)
236
+ end
237
+ end
238
+
239
+ end