wxruby3 0.9.0.pre.rc.1-x64-mingw-ucrt → 0.9.0.pre.rc.3-x64-mingw-ucrt

Sign up to get free protection for your applications and to get access to all the features.
Files changed (383) hide show
  1. checksums.yaml +4 -4
  2. data/INSTALL.md +73 -22
  3. data/README.md +40 -8
  4. data/assets/hello_button-macos.png +0 -0
  5. data/assets/hello_button-msw.png +0 -0
  6. data/assets/hello_button_clicked-macos.png +0 -0
  7. data/assets/hello_button_clicked-msw.png +0 -0
  8. data/assets/hello_button_clicked_combi.png +0 -0
  9. data/assets/hello_world-macos.png +0 -0
  10. data/assets/hello_world-msw.png +0 -0
  11. data/assets/hello_world_combi.png +0 -0
  12. data/ext/wxbase32u_gcc_custom.dll +0 -0
  13. data/ext/wxbase32u_net_gcc_custom.dll +0 -0
  14. data/ext/wxbase32u_xml_gcc_custom.dll +0 -0
  15. data/ext/wxmsw32u_aui_gcc_custom.dll +0 -0
  16. data/ext/wxmsw32u_core_gcc_custom.dll +0 -0
  17. data/ext/wxmsw32u_gl_gcc_custom.dll +0 -0
  18. data/ext/wxmsw32u_html_gcc_custom.dll +0 -0
  19. data/ext/wxmsw32u_media_gcc_custom.dll +0 -0
  20. data/ext/wxmsw32u_propgrid_gcc_custom.dll +0 -0
  21. data/ext/wxmsw32u_qa_gcc_custom.dll +0 -0
  22. data/ext/wxmsw32u_ribbon_gcc_custom.dll +0 -0
  23. data/ext/wxmsw32u_richtext_gcc_custom.dll +0 -0
  24. data/ext/wxmsw32u_stc_gcc_custom.dll +0 -0
  25. data/ext/wxmsw32u_webview_gcc_custom.dll +0 -0
  26. data/ext/wxmsw32u_xrc_gcc_custom.dll +0 -0
  27. data/lib/wx/core/brush.rb +6 -0
  28. data/lib/wx/core/event_loop.rb +7 -0
  29. data/lib/wx/core/events/evt_list.rb +7 -0
  30. data/lib/wx/core/evthandler.rb +12 -2
  31. data/lib/wx/core/font.rb +22 -14
  32. data/lib/wx/core/helpprovider.rb +2 -2
  33. data/lib/wx/core/image.rb +33 -0
  34. data/lib/wx/core/listctrl.rb +17 -13
  35. data/lib/wx/core/log.rb +90 -0
  36. data/lib/wx/core/menu.rb +5 -0
  37. data/lib/wx/core/pen.rb +6 -0
  38. data/lib/wx/core/window.rb +28 -1
  39. data/lib/wx/doc/app.rb +40 -0
  40. data/lib/wx/doc/bitmap.rb +11 -15
  41. data/lib/wx/doc/brush.rb +17 -0
  42. data/lib/wx/doc/event_loop.rb +7 -0
  43. data/lib/wx/doc/extra/00_starting.md +6 -6
  44. data/lib/wx/doc/extra/02_lifecycles.md +9 -8
  45. data/lib/wx/doc/extra/09_exceptions.md +1 -1
  46. data/lib/wx/doc/extra/11_drawing_and_dc.md +4 -4
  47. data/lib/wx/doc/font.rb +27 -0
  48. data/lib/wx/doc/functions.rb +51 -23
  49. data/lib/wx/doc/gc_dc.rb +1 -1
  50. data/lib/wx/doc/gen/about_dialog_info.rb +1 -1
  51. data/lib/wx/doc/gen/accelerator.rb +6 -6
  52. data/lib/wx/doc/gen/accessible.rb +6 -2
  53. data/lib/wx/doc/gen/activity_indicator.rb +65 -0
  54. data/lib/wx/doc/gen/animation.rb +7 -7
  55. data/lib/wx/doc/gen/animation_ctrl.rb +7 -6
  56. data/lib/wx/doc/gen/any_button.rb +1 -1
  57. data/lib/wx/doc/gen/app.rb +17 -11
  58. data/lib/wx/doc/gen/art_provider.rb +61 -1
  59. data/lib/wx/doc/gen/aui/aui_dock_art.rb +12 -12
  60. data/lib/wx/doc/gen/aui/aui_floating_frame.rb +6 -6
  61. data/lib/wx/doc/gen/aui/aui_manager.rb +45 -27
  62. data/lib/wx/doc/gen/aui/aui_manager_event.rb +12 -6
  63. data/lib/wx/doc/gen/aui/aui_mdi_child_frame.rb +6 -6
  64. data/lib/wx/doc/gen/aui/aui_mdi_client_window.rb +6 -6
  65. data/lib/wx/doc/gen/aui/aui_mdi_parent_frame.rb +10 -10
  66. data/lib/wx/doc/gen/aui/aui_notebook.rb +34 -7
  67. data/lib/wx/doc/gen/aui/aui_notebook_event.rb +17 -2
  68. data/lib/wx/doc/gen/aui/aui_pane_info.rb +51 -51
  69. data/lib/wx/doc/gen/aui/aui_tab_art.rb +6 -6
  70. data/lib/wx/doc/gen/aui/aui_tool_bar.rb +35 -20
  71. data/lib/wx/doc/gen/aui/aui_tool_bar_art.rb +16 -16
  72. data/lib/wx/doc/gen/aui/aui_tool_bar_event.rb +4 -4
  73. data/lib/wx/doc/gen/aui/aui_tool_bar_item.rb +4 -4
  74. data/lib/wx/doc/gen/bitmap.rb +32 -26
  75. data/lib/wx/doc/gen/bitmap_button.rb +10 -6
  76. data/lib/wx/doc/gen/bitmap_combo_box.rb +12 -7
  77. data/lib/wx/doc/gen/book_ctrl_base.rb +7 -3
  78. data/lib/wx/doc/gen/book_ctrl_event.rb +2 -2
  79. data/lib/wx/doc/gen/box_sizer.rb +1 -1
  80. data/lib/wx/doc/gen/brush.rb +16 -4
  81. data/lib/wx/doc/gen/busy_info.rb +1 -1
  82. data/lib/wx/doc/gen/button.rb +19 -7
  83. data/lib/wx/doc/gen/calculate_layout_event.rb +2 -1
  84. data/lib/wx/doc/gen/calendar_ctrl.rb +28 -16
  85. data/lib/wx/doc/gen/calendar_date_attr.rb +2 -2
  86. data/lib/wx/doc/gen/calendar_event.rb +3 -3
  87. data/lib/wx/doc/gen/caret.rb +2 -2
  88. data/lib/wx/doc/gen/check_box.rb +10 -6
  89. data/lib/wx/doc/gen/check_list_box.rb +8 -7
  90. data/lib/wx/doc/gen/choice.rb +7 -6
  91. data/lib/wx/doc/gen/choicebook.rb +12 -6
  92. data/lib/wx/doc/gen/client_dc.rb +1 -1
  93. data/lib/wx/doc/gen/clipboard.rb +1 -1
  94. data/lib/wx/doc/gen/collapsible_pane.rb +9 -6
  95. data/lib/wx/doc/gen/collapsible_pane_event.rb +2 -1
  96. data/lib/wx/doc/gen/colour.rb +16 -6
  97. data/lib/wx/doc/gen/colour_dialog.rb +6 -6
  98. data/lib/wx/doc/gen/colour_picker_ctrl.rb +15 -9
  99. data/lib/wx/doc/gen/colour_picker_event.rb +7 -4
  100. data/lib/wx/doc/gen/combo_box.rb +22 -13
  101. data/lib/wx/doc/gen/context_help_button.rb +50 -1
  102. data/lib/wx/doc/gen/control.rb +9 -6
  103. data/lib/wx/doc/gen/core.rb +5 -2
  104. data/lib/wx/doc/gen/cursor.rb +16 -11
  105. data/lib/wx/doc/gen/data_format.rb +2 -2
  106. data/lib/wx/doc/gen/data_object.rb +23 -16
  107. data/lib/wx/doc/gen/date_event.rb +3 -3
  108. data/lib/wx/doc/gen/date_picker_ctrl.rb +11 -6
  109. data/lib/wx/doc/gen/dc.rb +37 -12
  110. data/lib/wx/doc/gen/defs.rb +16 -16
  111. data/lib/wx/doc/gen/dialog.rb +19 -5
  112. data/lib/wx/doc/gen/dir_dialog.rb +6 -2
  113. data/lib/wx/doc/gen/dir_filter_list_ctrl.rb +2 -2
  114. data/lib/wx/doc/gen/dir_picker_ctrl.rb +14 -9
  115. data/lib/wx/doc/gen/drag_drop.rb +15 -15
  116. data/lib/wx/doc/gen/drag_image.rb +6 -6
  117. data/lib/wx/doc/gen/editable_list_box.rb +7 -3
  118. data/lib/wx/doc/gen/event.rb +44 -13
  119. data/lib/wx/doc/gen/event_blocker.rb +19 -17
  120. data/lib/wx/doc/gen/event_filter.rb +43 -47
  121. data/lib/wx/doc/gen/event_list.rb +22 -15
  122. data/lib/wx/doc/gen/events.rb +215 -79
  123. data/lib/wx/doc/gen/evt_handler.rb +1 -1
  124. data/lib/wx/doc/gen/ext_help_controller.rb +1 -1
  125. data/lib/wx/doc/gen/file_dialog.rb +64 -56
  126. data/lib/wx/doc/gen/file_dir_picker_event.rb +5 -3
  127. data/lib/wx/doc/gen/file_picker_ctrl.rb +16 -8
  128. data/lib/wx/doc/gen/find_dialog_event.rb +7 -2
  129. data/lib/wx/doc/gen/find_replace_data.rb +1 -1
  130. data/lib/wx/doc/gen/find_replace_dialog.rb +1 -1
  131. data/lib/wx/doc/gen/flex_grid_sizer.rb +12 -6
  132. data/lib/wx/doc/gen/font.rb +39 -29
  133. data/lib/wx/doc/gen/font_data.rb +9 -5
  134. data/lib/wx/doc/gen/font_dialog.rb +3 -3
  135. data/lib/wx/doc/gen/font_picker_ctrl.rb +10 -6
  136. data/lib/wx/doc/gen/font_picker_event.rb +2 -1
  137. data/lib/wx/doc/gen/frame.rb +34 -11
  138. data/lib/wx/doc/gen/fs_file.rb +4 -17
  139. data/lib/wx/doc/gen/gauge.rb +11 -7
  140. data/lib/wx/doc/gen/gcdc.rb +5 -1
  141. data/lib/wx/doc/gen/gdi_common.rb +35 -33
  142. data/lib/wx/doc/gen/gdi_object.rb +1 -1
  143. data/lib/wx/doc/gen/generic_dir_ctrl.rb +13 -7
  144. data/lib/wx/doc/gen/graphics_context.rb +29 -28
  145. data/lib/wx/doc/gen/graphics_object.rb +1 -1
  146. data/lib/wx/doc/gen/grid/grid_cell_activatable_editor.rb +2 -2
  147. data/lib/wx/doc/gen/grid/grid_cell_attr.rb +10 -10
  148. data/lib/wx/doc/gen/grid/grid_cell_auto_wrap_string_editor.rb +1 -1
  149. data/lib/wx/doc/gen/grid/grid_cell_auto_wrap_string_renderer.rb +1 -1
  150. data/lib/wx/doc/gen/grid/grid_cell_bool_editor.rb +1 -1
  151. data/lib/wx/doc/gen/grid/grid_cell_bool_renderer.rb +1 -1
  152. data/lib/wx/doc/gen/grid/grid_cell_choice_editor.rb +2 -2
  153. data/lib/wx/doc/gen/grid/grid_cell_date_editor.rb +1 -1
  154. data/lib/wx/doc/gen/grid/grid_cell_date_renderer.rb +1 -1
  155. data/lib/wx/doc/gen/grid/grid_cell_date_time_renderer.rb +1 -1
  156. data/lib/wx/doc/gen/grid/grid_cell_editor.rb +13 -10
  157. data/lib/wx/doc/gen/grid/grid_cell_enum_editor.rb +1 -1
  158. data/lib/wx/doc/gen/grid/grid_cell_enum_renderer.rb +1 -1
  159. data/lib/wx/doc/gen/grid/grid_cell_float_editor.rb +1 -1
  160. data/lib/wx/doc/gen/grid/grid_cell_float_renderer.rb +1 -1
  161. data/lib/wx/doc/gen/grid/grid_cell_number_editor.rb +1 -1
  162. data/lib/wx/doc/gen/grid/grid_cell_number_renderer.rb +1 -1
  163. data/lib/wx/doc/gen/grid/grid_cell_renderer.rb +12 -12
  164. data/lib/wx/doc/gen/grid/grid_cell_string_renderer.rb +1 -1
  165. data/lib/wx/doc/gen/grid/grid_cell_text_editor.rb +1 -1
  166. data/lib/wx/doc/gen/grid/grid_ctrl.rb +32 -18
  167. data/lib/wx/doc/gen/grid/grid_editor_created_event.rb +5 -3
  168. data/lib/wx/doc/gen/grid/grid_event.rb +20 -3
  169. data/lib/wx/doc/gen/grid/grid_range_select_event.rb +7 -3
  170. data/lib/wx/doc/gen/grid/grid_size_event.rb +9 -3
  171. data/lib/wx/doc/gen/grid/grid_string_table.rb +2 -2
  172. data/lib/wx/doc/gen/grid/grid_table_base.rb +7 -7
  173. data/lib/wx/doc/gen/grid/grid_table_message.rb +5 -5
  174. data/lib/wx/doc/gen/grid_bag_sizer.rb +5 -5
  175. data/lib/wx/doc/gen/grid_sizer.rb +4 -4
  176. data/lib/wx/doc/gen/gui_event_loop.rb +132 -0
  177. data/lib/wx/doc/gen/help_controller.rb +18 -12
  178. data/lib/wx/doc/gen/html/html_cell.rb +36 -18
  179. data/lib/wx/doc/gen/html/html_cell_event.rb +5 -3
  180. data/lib/wx/doc/gen/html/html_easy_printing.rb +9 -4
  181. data/lib/wx/doc/gen/html/html_help_controller.rb +34 -8
  182. data/lib/wx/doc/gen/html/html_help_data.rb +3 -3
  183. data/lib/wx/doc/gen/html/html_help_frame.rb +6 -6
  184. data/lib/wx/doc/gen/html/html_help_window.rb +12 -8
  185. data/lib/wx/doc/gen/html/html_link_event.rb +4 -3
  186. data/lib/wx/doc/gen/html/html_list_box.rb +15 -7
  187. data/lib/wx/doc/gen/html/html_printout.rb +15 -5
  188. data/lib/wx/doc/gen/html/html_window.rb +19 -8
  189. data/lib/wx/doc/gen/hyperlink_ctrl.rb +152 -0
  190. data/lib/wx/doc/gen/hyperlink_event.rb +44 -0
  191. data/lib/wx/doc/gen/icon.rb +14 -14
  192. data/lib/wx/doc/gen/image.rb +119 -64
  193. data/lib/wx/doc/gen/image_list.rb +10 -6
  194. data/lib/wx/doc/gen/keyboard_state.rb +7 -7
  195. data/lib/wx/doc/gen/list_box.rb +30 -21
  196. data/lib/wx/doc/gen/list_ctrl.rb +169 -78
  197. data/lib/wx/doc/gen/list_event.rb +24 -2
  198. data/lib/wx/doc/gen/listbook.rb +12 -6
  199. data/lib/wx/doc/gen/locale.rb +11 -36
  200. data/lib/wx/doc/gen/log.rb +122 -45
  201. data/lib/wx/doc/gen/mdi_client_window.rb +2 -2
  202. data/lib/wx/doc/gen/mdi_frame.rb +15 -9
  203. data/lib/wx/doc/gen/media_ctrl.rb +7 -4
  204. data/lib/wx/doc/gen/media_event.rb +8 -2
  205. data/lib/wx/doc/gen/memory_dc.rb +23 -27
  206. data/lib/wx/doc/gen/menu.rb +9 -9
  207. data/lib/wx/doc/gen/menu_bar.rb +4 -10
  208. data/lib/wx/doc/gen/menu_item.rb +115 -34
  209. data/lib/wx/doc/gen/message_dialog.rb +48 -30
  210. data/lib/wx/doc/gen/mini_frame.rb +12 -3
  211. data/lib/wx/doc/gen/mouse_state.rb +1 -1
  212. data/lib/wx/doc/gen/multi_choice_dialog.rb +4 -2
  213. data/lib/wx/doc/gen/non_owned_window.rb +6 -7
  214. data/lib/wx/doc/gen/notebook.rb +20 -15
  215. data/lib/wx/doc/gen/number_entry_dialog.rb +2 -2
  216. data/lib/wx/doc/gen/object.rb +2 -2
  217. data/lib/wx/doc/gen/palette.rb +3 -3
  218. data/lib/wx/doc/gen/panel.rb +4 -3
  219. data/lib/wx/doc/gen/pen.rb +25 -12
  220. data/lib/wx/doc/gen/pg/numeric_property_validator.rb +1 -1
  221. data/lib/wx/doc/gen/pg/pg_array_editor_dialog.rb +3 -3
  222. data/lib/wx/doc/gen/pg/pg_cell.rb +12 -12
  223. data/lib/wx/doc/gen/pg/pg_editor.rb +76 -74
  224. data/lib/wx/doc/gen/pg/pg_multi_button.rb +3 -3
  225. data/lib/wx/doc/gen/pg/pg_properties.rb +221 -138
  226. data/lib/wx/doc/gen/pg/pg_property.rb +103 -54
  227. data/lib/wx/doc/gen/pg/pg_validation_info.rb +1 -1
  228. data/lib/wx/doc/gen/pg/property_grid.rb +19 -19
  229. data/lib/wx/doc/gen/pg/property_grid_event.rb +18 -5
  230. data/lib/wx/doc/gen/pg/property_grid_interface.rb +36 -24
  231. data/lib/wx/doc/gen/pg/property_grid_manager.rb +12 -12
  232. data/lib/wx/doc/gen/pg/property_grid_page.rb +12 -11
  233. data/lib/wx/doc/gen/pg/property_grid_page_state.rb +8 -8
  234. data/lib/wx/doc/gen/picker_base.rb +12 -11
  235. data/lib/wx/doc/gen/platform_info.rb +7 -7
  236. data/lib/wx/doc/gen/popup_window.rb +6 -6
  237. data/lib/wx/doc/gen/progress_dialog.rb +1 -1
  238. data/lib/wx/doc/gen/property_sheet_dialog.rb +19 -17
  239. data/lib/wx/doc/gen/prt/page_setup_dialog.rb +2 -2
  240. data/lib/wx/doc/gen/prt/preview_frame.rb +4 -1
  241. data/lib/wx/doc/gen/prt/print_abort_dialog.rb +1 -1
  242. data/lib/wx/doc/gen/prt/print_data.rb +24 -18
  243. data/lib/wx/doc/gen/prt/print_dialog.rb +4 -4
  244. data/lib/wx/doc/gen/prt/printer.rb +22 -22
  245. data/lib/wx/doc/gen/query_layout_info_event.rb +2 -1
  246. data/lib/wx/doc/gen/radio_box.rb +12 -18
  247. data/lib/wx/doc/gen/radio_button.rb +8 -6
  248. data/lib/wx/doc/gen/rbn/ribbon_art_provider.rb +39 -39
  249. data/lib/wx/doc/gen/rbn/ribbon_bar.rb +25 -7
  250. data/lib/wx/doc/gen/rbn/ribbon_bar_event.rb +5 -5
  251. data/lib/wx/doc/gen/rbn/ribbon_button_bar.rb +9 -2
  252. data/lib/wx/doc/gen/rbn/ribbon_button_bar_event.rb +5 -5
  253. data/lib/wx/doc/gen/rbn/ribbon_control.rb +4 -4
  254. data/lib/wx/doc/gen/rbn/ribbon_gallery.rb +6 -2
  255. data/lib/wx/doc/gen/rbn/ribbon_gallery_event.rb +5 -5
  256. data/lib/wx/doc/gen/rbn/ribbon_page.rb +5 -5
  257. data/lib/wx/doc/gen/rbn/ribbon_panel.rb +12 -6
  258. data/lib/wx/doc/gen/rbn/ribbon_panel_event.rb +5 -5
  259. data/lib/wx/doc/gen/rbn/ribbon_tool_bar.rb +4 -2
  260. data/lib/wx/doc/gen/rbn/ribbon_tool_bar_event.rb +5 -5
  261. data/lib/wx/doc/gen/region.rb +9 -8
  262. data/lib/wx/doc/gen/region_iterator.rb +2 -2
  263. data/lib/wx/doc/gen/rtc/rich_text_buffer.rb +92 -92
  264. data/lib/wx/doc/gen/rtc/rich_text_ctrl.rb +56 -34
  265. data/lib/wx/doc/gen/rtc/rich_text_event.rb +23 -4
  266. data/lib/wx/doc/gen/rtc/rich_text_file_handler.rb +6 -6
  267. data/lib/wx/doc/gen/rtc/rich_text_header_footer_data.rb +9 -5
  268. data/lib/wx/doc/gen/rtc/rich_text_html_handler.rb +6 -2
  269. data/lib/wx/doc/gen/rtc/rich_text_printing.rb +12 -12
  270. data/lib/wx/doc/gen/rtc/rich_text_xml_handler.rb +1 -1
  271. data/lib/wx/doc/gen/rtc/symbol_picker_dialog.rb +2 -2
  272. data/lib/wx/doc/gen/sash_event.rb +3 -1
  273. data/lib/wx/doc/gen/sash_layout_window.rb +5 -3
  274. data/lib/wx/doc/gen/sash_window.rb +8 -3
  275. data/lib/wx/doc/gen/scroll_bar.rb +29 -8
  276. data/lib/wx/doc/gen/scrolled_canvas.rb +41 -23
  277. data/lib/wx/doc/gen/scrolled_control.rb +41 -23
  278. data/lib/wx/doc/gen/scrolled_window.rb +41 -23
  279. data/lib/wx/doc/gen/search_ctrl.rb +15 -8
  280. data/lib/wx/doc/gen/simplebook.rb +2 -2
  281. data/lib/wx/doc/gen/single_choice_dialog.rb +4 -2
  282. data/lib/wx/doc/gen/sizer.rb +29 -28
  283. data/lib/wx/doc/gen/slider.rb +49 -16
  284. data/lib/wx/doc/gen/spin_button.rb +15 -9
  285. data/lib/wx/doc/gen/spin_ctrl.rb +12 -6
  286. data/lib/wx/doc/gen/spin_event.rb +5 -2
  287. data/lib/wx/doc/gen/splash_screen.rb +16 -12
  288. data/lib/wx/doc/gen/splitter_event.rb +6 -2
  289. data/lib/wx/doc/gen/splitter_window.rb +20 -4
  290. data/lib/wx/doc/gen/static_bitmap.rb +5 -5
  291. data/lib/wx/doc/gen/static_box.rb +36 -32
  292. data/lib/wx/doc/gen/static_box_sizer.rb +13 -10
  293. data/lib/wx/doc/gen/static_line.rb +5 -4
  294. data/lib/wx/doc/gen/static_text.rb +12 -6
  295. data/lib/wx/doc/gen/status_bar.rb +14 -5
  296. data/lib/wx/doc/gen/stc/styled_text_ctrl.rb +55 -7
  297. data/lib/wx/doc/gen/stc/styled_text_event.rb +224 -49
  298. data/lib/wx/doc/gen/std_dialog_button_sizer.rb +11 -2
  299. data/lib/wx/doc/gen/svg_file_dc.rb +3 -3
  300. data/lib/wx/doc/gen/system_options.rb +11 -1
  301. data/lib/wx/doc/gen/system_settings.rb +3 -3
  302. data/lib/wx/doc/gen/task_bar_icon.rb +10 -2
  303. data/lib/wx/doc/gen/task_bar_icon_event.rb +3 -3
  304. data/lib/wx/doc/gen/text_attr.rb +11 -7
  305. data/lib/wx/doc/gen/text_ctrl.rb +61 -92
  306. data/lib/wx/doc/gen/text_entry.rb +28 -40
  307. data/lib/wx/doc/gen/text_entry_dialog.rb +19 -19
  308. data/lib/wx/doc/gen/text_validator.rb +0 -11
  309. data/lib/wx/doc/gen/time_picker_ctrl.rb +6 -5
  310. data/lib/wx/doc/gen/timer.rb +8 -4
  311. data/lib/wx/doc/gen/timer_event.rb +19 -26
  312. data/lib/wx/doc/gen/tip_provider.rb +1 -1
  313. data/lib/wx/doc/gen/toggle_button.rb +6 -5
  314. data/lib/wx/doc/gen/tool_bar.rb +41 -24
  315. data/lib/wx/doc/gen/tool_tip.rb +2 -2
  316. data/lib/wx/doc/gen/toolbook.rb +6 -3
  317. data/lib/wx/doc/gen/top_level_window.rb +35 -25
  318. data/lib/wx/doc/gen/tree_ctrl.rb +63 -13
  319. data/lib/wx/doc/gen/tree_event.rb +23 -2
  320. data/lib/wx/doc/gen/treebook.rb +6 -2
  321. data/lib/wx/doc/gen/ui_action_simulator.rb +1 -1
  322. data/lib/wx/doc/gen/utils.rb +9 -3
  323. data/lib/wx/doc/gen/v_list_box.rb +2 -2
  324. data/lib/wx/doc/gen/v_scrolled_window.rb +2 -2
  325. data/lib/wx/doc/gen/validator.rb +7 -5
  326. data/lib/wx/doc/gen/variant.rb +34 -97
  327. data/lib/wx/doc/gen/window.rb +157 -102
  328. data/lib/wx/doc/gen/window_dc.rb +1 -1
  329. data/lib/wx/doc/gen/with_images.rb +1 -1
  330. data/lib/wx/doc/gen/wizard.rb +17 -4
  331. data/lib/wx/doc/gen/wizard_event.rb +9 -2
  332. data/lib/wx/doc/gen/wizard_page.rb +1 -1
  333. data/lib/wx/doc/gen/wizard_page_simple.rb +7 -7
  334. data/lib/wx/doc/gen/xml_node.rb +3 -3
  335. data/lib/wx/doc/gen/xml_resource.rb +12 -9
  336. data/lib/wx/doc/image.rb +42 -12
  337. data/lib/wx/doc/list_ctrl.rb +32 -0
  338. data/lib/wx/doc/log.rb +28 -0
  339. data/lib/wx/doc/pen.rb +17 -0
  340. data/lib/wx/doc/prt/printer_dc.rb +2 -2
  341. data/lib/wx/doc/radio_box.rb +20 -0
  342. data/lib/wx/doc/scaled_dc.rb +1 -1
  343. data/lib/wx/doc/text_validator.rb +12 -0
  344. data/lib/wx/doc/window.rb +27 -0
  345. data/lib/wx/keyword_defs.rb +77 -76
  346. data/lib/wx/prt/keyword_defs.rb +5 -1
  347. data/lib/wx/version.rb +1 -1
  348. data/lib/wxruby_aui.so +0 -0
  349. data/lib/wxruby_core.so +0 -0
  350. data/lib/wxruby_grid.so +0 -0
  351. data/lib/wxruby_html.so +0 -0
  352. data/lib/wxruby_pg.so +0 -0
  353. data/lib/wxruby_prt.so +0 -0
  354. data/lib/wxruby_rbn.so +0 -0
  355. data/lib/wxruby_rtc.so +0 -0
  356. data/lib/wxruby_stc.so +0 -0
  357. data/rakelib/install.rb +17 -6
  358. data/rakelib/lib/config/linux.rb +4 -2
  359. data/rakelib/lib/config/macosx.rb +120 -1
  360. data/rakelib/lib/config/mingw.rb +6 -1
  361. data/rakelib/lib/config/unixish.rb +26 -11
  362. data/rakelib/lib/config.rb +15 -6
  363. data/samples/aui/aui.rb +432 -363
  364. data/samples/propgrid/propgrid.rb +3 -0
  365. data/samples/sampler/editor.rb +33 -25
  366. data/samples/sampler/sample.rb +2 -2
  367. data/samples/sampler/stc_editor.rb +4 -2
  368. data/tests/lib/item_container_tests.rb +82 -0
  369. data/tests/lib/text_entry_tests.rb +80 -0
  370. data/tests/lib/wxapp_runner.rb +12 -0
  371. data/tests/lib/wxframe_runner.rb +89 -4
  372. data/tests/test_art.rb +9 -0
  373. data/tests/test_box_sizer.rb +161 -0
  374. data/tests/test_ext_controls.rb +28 -0
  375. data/tests/test_font.rb +239 -0
  376. data/tests/test_grid_sizer.rb +148 -0
  377. data/tests/test_intl.rb +5 -1
  378. data/tests/test_list_ctrl.rb +53 -0
  379. data/tests/test_log.rb +163 -0
  380. data/tests/test_std_controls.rb +321 -37
  381. data/tests/test_timer.rb +95 -0
  382. data/tests/test_window.rb +340 -0
  383. metadata +36 -2
@@ -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
@@ -0,0 +1,148 @@
1
+
2
+ require_relative './lib/wxframe_runner'
3
+
4
+ class GridSizerTests < WxRuby::Test::GUITests
5
+
6
+ def setup
7
+ super
8
+ @win = Wx::Window.new(test_frame, Wx::ID_ANY)
9
+ @win.set_client_size(127, 35)
10
+ @sizer = Wx::GridSizer.new(2)
11
+ @win.set_sizer(@sizer)
12
+ end
13
+
14
+ def cleanup
15
+ test_frame.destroy_children
16
+ @win = nil
17
+ @sizer = nil
18
+ super
19
+ end
20
+
21
+ attr_reader :win, :sizer
22
+
23
+ def set_children(children, flags)
24
+ @sizer.clear
25
+ children.each { |c| @sizer.add(c, flags) }
26
+ @win.layout
27
+ end
28
+
29
+ def test_layout
30
+ sizeTotal = win.get_client_size
31
+ sizeChild = Wx::Size.new(sizeTotal.x / 2, sizeTotal.y / 2)
32
+
33
+ children = [Wx::Window.new(win, Wx::ID_ANY),
34
+ Wx::Window.new(win, Wx::ID_ANY),
35
+ Wx::Window.new(win, Wx::ID_ANY)]
36
+
37
+ set_children(children, Wx::SizerFlags.new.expand)
38
+ assert(children[0].rect == Wx::Rect.new(Wx::Point.new(0, 0), sizeChild))
39
+ assert(children[1].rect == Wx::Rect.new(Wx::Point.new(sizeChild.x, 0), sizeChild))
40
+ assert(children[2].rect == Wx::Rect.new(Wx::Point.new(0, sizeChild.y), sizeChild))
41
+ end
42
+
43
+ end
44
+
45
+ class FlexGridSizerTests < WxRuby::Test::GUITests
46
+
47
+ def setup
48
+ super
49
+ @win = Wx::Window.new(test_frame, Wx::ID_ANY)
50
+ @win.set_client_size(127, 35)
51
+ @sizer = Wx::FlexGridSizer.new(2)
52
+ @win.set_sizer(@sizer)
53
+ end
54
+
55
+ def cleanup
56
+ test_frame.destroy_children
57
+ @win = nil
58
+ @sizer = nil
59
+ super
60
+ end
61
+
62
+ attr_reader :win, :sizer
63
+
64
+ def set_children(children, flags)
65
+ @sizer.clear
66
+ children.each { |c| @sizer.add(c, flags) }
67
+ @win.layout
68
+ end
69
+
70
+ def do_test_layout
71
+ sizeTotal = win.get_client_size
72
+ sizeChild = Wx::Size.new(sizeTotal.x / 4, sizeTotal.y / 4)
73
+ sizeRest = Wx::Size.new(sizeTotal.x - sizeTotal.x / 4,
74
+ sizeTotal.y - sizeTotal.y / 4)
75
+
76
+ children = [Wx::Window.new(win, Wx::ID_ANY, Wx::DEFAULT_POSITION, sizeChild),
77
+ Wx::Window.new(win, Wx::ID_ANY, Wx::DEFAULT_POSITION, sizeChild),
78
+ Wx::Window.new(win, Wx::ID_ANY, Wx::DEFAULT_POSITION, sizeChild),
79
+ Wx::Window.new(win, Wx::ID_ANY, Wx::DEFAULT_POSITION, sizeChild)]
80
+
81
+ sizer.add_growable_row(1)
82
+ sizer.add_growable_col(1)
83
+
84
+ yield(children, sizeTotal, sizeChild, sizeRest)
85
+ end
86
+
87
+ def test_layout
88
+ do_test_layout do |children, sizeTotal, sizeChild, sizeRest|
89
+ set_children(children, Wx::SizerFlags.new)
90
+ assert_equal( sizeChild, children[0].get_size)
91
+ assert_equal( sizeChild, children[1].get_size )
92
+ assert_equal( sizeChild, children[2].get_size )
93
+ assert_equal( sizeChild, children[3].get_size )
94
+ end
95
+ end
96
+
97
+ def test_layout_expand
98
+ do_test_layout do |children, sizeTotal, sizeChild, sizeRest|
99
+ set_children(children, Wx::SizerFlags.new.expand)
100
+ assert_equal(sizeChild, children[0].get_size)
101
+ assert_equal(Wx::Size.new(sizeRest.x, sizeChild.y), children[1].get_size)
102
+ assert_equal(Wx::Size.new(sizeChild.x, sizeRest.y), children[2].get_size)
103
+ assert_equal(sizeRest, children[3].get_size )
104
+ end
105
+ end
106
+
107
+ def test_layout_expand_centre_vertical
108
+ do_test_layout do |children, sizeTotal, sizeChild, sizeRest|
109
+ set_children(children, Wx::SizerFlags.new.expand.centre_vertical)
110
+ assert_equal(sizeChild, children[0].get_size)
111
+ assert_equal(Wx::Size.new(sizeRest.x, sizeChild.y), children[1].get_size)
112
+ assert_equal(sizeChild, children[2].get_size )
113
+ assert_equal(Wx::Size.new(sizeRest.x, sizeChild.y), children[3].get_size)
114
+ end
115
+ end
116
+
117
+ def test_layout_expand_centre_horizontal
118
+ do_test_layout do |children, sizeTotal, sizeChild, sizeRest|
119
+ set_children(children, Wx::SizerFlags.new.expand.centre_horizontal)
120
+ assert_equal(sizeChild, children[0].get_size)
121
+ assert_equal(sizeChild, children[1].get_size )
122
+ assert_equal(Wx::Size.new(sizeChild.x, sizeRest.y), children[2].get_size)
123
+ assert_equal(Wx::Size.new(sizeChild.x, sizeRest.y), children[3].get_size)
124
+ end
125
+ end
126
+
127
+ def test_layout_right
128
+ do_test_layout do |children, sizeTotal, sizeChild, sizeRest|
129
+ set_children(children, Wx::SizerFlags.new.right)
130
+ assert_equal( Wx::Point.new(0, 0), children[0].get_position)
131
+ assert_equal( Wx::Point.new(sizeRest.x, 0), children[1].get_position)
132
+ assert_equal( Wx::Point.new(0, sizeChild.y), children[2].get_position)
133
+ assert_equal( Wx::Point.new(sizeRest.x, sizeChild.y), children[3].get_position)
134
+ end
135
+ end
136
+
137
+ def test_layout_right_centre_vertical
138
+ do_test_layout do |children, sizeTotal, sizeChild, sizeRest|
139
+ set_children(children, Wx::SizerFlags.new.right.centre_vertical)
140
+ yMid = sizeChild.y + (sizeRest.y - sizeChild.y) / 2
141
+ assert_equal( Wx::Point.new(0, 0), children[0].get_position)
142
+ assert_equal( Wx::Point.new(sizeRest.x, 0), children[1].get_position)
143
+ assert_equal( Wx::Point.new(0, yMid), children[2].get_position)
144
+ assert_equal( Wx::Point.new(sizeRest.x, yMid), children[3].get_position)
145
+ end
146
+ end
147
+
148
+ end
data/tests/test_intl.rb CHANGED
@@ -86,6 +86,10 @@ class TestInternationalisation < Test::Unit::TestCase
86
86
  end
87
87
 
88
88
  assert_raises(ArgumentError) { Wx::Locale.set_locale('bad') }
89
- locale = Wx::Locale.new(Wx::LANGUAGE_DEFAULT)
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
90
94
  end
91
95
  end
@@ -0,0 +1,53 @@
1
+
2
+ require_relative './lib/wxframe_runner'
3
+
4
+ class ButtonTests < WxRuby::Test::GUITests
5
+
6
+ def setup
7
+ super
8
+ @list = Wx::ListCtrl.new(test_frame)
9
+ @list.set_window_style(Wx::LC_REPORT | Wx::LC_EDIT_LABELS)
10
+ @list.set_size([400, 200])
11
+ end
12
+
13
+ def cleanup
14
+ @list.destroy
15
+ super
16
+ end
17
+
18
+ attr_reader :list
19
+
20
+ def test_sort
21
+ list.insert_column(0, "Column 0")
22
+
23
+ list.insert_item(0, "Item 0")
24
+ list.set_item_data(0, 0)
25
+ list.insert_item(1, "Item 1")
26
+ list.set_item_data(1, 1)
27
+
28
+ list.sort_items { |i1, i2, _| i2 <=> i1 } # inverted compare
29
+
30
+ assert_equal("Item 1", list.get_item_text(0))
31
+ assert_equal("Item 0", list.get_item_text(1))
32
+ end
33
+
34
+ if Wx.has_feature?(:HAS_LISTCTRL_COLUMN_ORDER)
35
+
36
+ def test_columns_order
37
+ 3.times { |i| list.insert_column(i, "Column #{i}") }
38
+
39
+ order = [2, 0, 1]
40
+ list.set_columns_order(order)
41
+
42
+ # now list.get_columns_order() will return order
43
+ assert_equal(order, list.get_columns_order)
44
+ # and list.get_column_index_from_order(n) will return order[n]
45
+ assert_equal(order[1], list.get_column_index_from_order(1))
46
+ # and list.get_column_order() will return 1, 2 and 0 for the column 0,
47
+ # 1 and 2 respectively
48
+ assert_equal(1, list.get_column_order(0))
49
+ end
50
+
51
+ end
52
+
53
+ end
data/tests/test_log.rb ADDED
@@ -0,0 +1,163 @@
1
+
2
+ require_relative './lib/wxapp_runner'
3
+
4
+ class LogTests < Test::Unit::TestCase
5
+
6
+ class TestLogBase < Wx::Log
7
+
8
+ def initialize
9
+ super
10
+ @logs = ::Array.new(Wx::LOG_Trace + 1)
11
+ @logsInfo = ::Array.new(Wx::LOG_Trace + 1)
12
+ end
13
+
14
+ def get_log(level)
15
+ @logs[level].to_s
16
+ end
17
+
18
+ def get_info(level)
19
+ @logsInfo[level]
20
+ end
21
+
22
+ def clear
23
+ @logs = ::Array.new(Wx::LOG_Trace + 1)
24
+ @logsInfo = ::Array.new(Wx::LOG_Trace + 1)
25
+ end
26
+
27
+ end
28
+
29
+ class TestLog < TestLogBase
30
+
31
+ protected
32
+
33
+ def do_log_record(level, msg, info)
34
+ @logs[level] = msg
35
+ # do not keep log info objects because these (and their state) are purely transient data
36
+ # that can only be reliably accessed (or passed on) within this call scope
37
+ @logsInfo[level] = { filename: info.filename, line: info.line, func: info.func, component: info.component }
38
+ end
39
+
40
+ end
41
+
42
+ def setup
43
+ super
44
+ @logOld = Wx::Log.set_active_target(@log = TestLog.new)
45
+ @logWasEnabled = Wx::Log.enable_logging
46
+ end
47
+
48
+ def cleanup
49
+ Wx::Log.set_active_target(@logOld)
50
+ Wx::Log.enable_logging(@logWasEnabled)
51
+ super
52
+ end
53
+
54
+ def test_functions
55
+ Wx.log_message("Message")
56
+ assert_equal("Message", @log.get_log(Wx::LOG_Message))
57
+
58
+ Wx.log_error("Error %d", 17)
59
+ assert_equal("Error 17", @log.get_log(Wx::LOG_Error))
60
+
61
+ Wx.log_debug("Debug")
62
+ if Wx::WXWIDGETS_DEBUG_LEVEL > 0
63
+ assert_equal( "Debug", @log.get_log(Wx::LOG_Debug))
64
+ else
65
+ assert_equal( "", @log.get_log(Wx::LOG_Debug))
66
+ end
67
+ end
68
+
69
+ def test_null
70
+ Wx::LogNull.no_log do
71
+ Wx.log_warning("%s warning", "Not important")
72
+
73
+ assert_equal("", @log.get_log(Wx::LOG_Warning))
74
+ end
75
+
76
+ Wx.log_warning("%s warning", "Important")
77
+ assert_equal("Important warning", @log.get_log(Wx::LOG_Warning))
78
+ end
79
+
80
+ def test_component
81
+ Wx.log_message('Message')
82
+ assert_equal('wxapp',
83
+ @log.get_info(Wx::LOG_Message)[:component])
84
+
85
+ # completely disable logging for this component
86
+ Wx::Log.set_component_level('test/ignore', Wx::LOG_FatalError)
87
+
88
+ # but enable it for one of its subcomponents
89
+ Wx::Log.set_component_level('test/ignore/not', Wx::LOG_Max)
90
+
91
+ Wx::Log.for_component('test/ignore') do
92
+ # this shouldn't be output as this component is ignored
93
+ Wx::log_error('Error')
94
+ assert_equal('', @log.get_log(Wx::LOG_Error))
95
+
96
+ # and so are its subcomponents
97
+ Wx.log_error('Error', component: 'test/ignore/sub/subsub') # explicit component: overrules scoped setting
98
+ assert_equal('', @log.get_log(Wx::LOG_Error))
99
+
100
+ Wx.log_error('Error', component: 'test/ignore/not')
101
+ assert_equal('Error', @log.get_log(Wx::LOG_Error))
102
+
103
+ # restore the original component value
104
+ end
105
+ end
106
+
107
+ def test_repetition_counting
108
+ Wx::Log.set_repetition_counting(true)
109
+
110
+ Wx.log_message('Message')
111
+ assert_equal('Message', @log.get_log(Wx::LOG_Message))
112
+
113
+ @log.clear
114
+ Wx.log_message('Message')
115
+ assert_equal('', @log.get_log(Wx::LOG_Message))
116
+ Wx.log_message('Message')
117
+ assert_equal('', @log.get_log(Wx::LOG_Message))
118
+
119
+ Wx.log_info('Another message')
120
+ if Wx.has_feature?(:USE_INTL)
121
+ # don't what language may come out so just test if not empty anymore
122
+ assert_not_empty(@log.get_log(Wx::LOG_Message))
123
+ else
124
+ assert_match(/The previous message.*repeated/, @log.get_log(Wx::LOG_Message))
125
+ end
126
+ assert_equal('Another message', @log.get_log(Wx::LOG_Info))
127
+
128
+ Wx::Log.set_repetition_counting(false)
129
+ end
130
+
131
+ class MyBufferInterposer < Wx::LogInterposer
132
+
133
+ def initialize
134
+ super
135
+ @buffer = []
136
+ end
137
+
138
+ attr_reader :buffer
139
+
140
+ def do_log_text(msg)
141
+ @buffer << msg
142
+ end
143
+ protected :do_log_text
144
+
145
+ end
146
+
147
+ def test_log_interposer
148
+ buffer_log = MyBufferInterposer.new
149
+ assert_empty(buffer_log.buffer)
150
+
151
+ Wx.log_message('Message')
152
+ assert_equal("Message", @log.get_log(Wx::LOG_Message))
153
+ assert_equal(1, buffer_log.buffer.size)
154
+ assert_match(/Message/, buffer_log.buffer.first)
155
+
156
+ Wx.log_warning('Message')
157
+ assert_equal("Message", @log.get_log(Wx::LOG_Warning))
158
+ assert_equal(2, buffer_log.buffer.size)
159
+ assert_match(/Message/, buffer_log.buffer.last)
160
+
161
+ end
162
+
163
+ end