wxruby3 0.9.0.pre.beta.13-x64-mingw-ucrt → 0.9.0.pre.rc.1-x64-mingw-ucrt

Sign up to get free protection for your applications and to get access to all the features.
Files changed (240) hide show
  1. checksums.yaml +4 -4
  2. data/.yardopts +1 -0
  3. data/README.md +47 -4
  4. data/assets/hello_button.png +0 -0
  5. data/assets/hello_button_clicked.png +0 -0
  6. data/assets/hello_world.png +0 -0
  7. data/assets/repo-social-preview.png +0 -0
  8. data/ext/wxbase32u_gcc_custom.dll +0 -0
  9. data/ext/wxbase32u_net_gcc_custom.dll +0 -0
  10. data/ext/wxbase32u_xml_gcc_custom.dll +0 -0
  11. data/ext/wxmsw32u_aui_gcc_custom.dll +0 -0
  12. data/ext/wxmsw32u_core_gcc_custom.dll +0 -0
  13. data/ext/wxmsw32u_gl_gcc_custom.dll +0 -0
  14. data/ext/wxmsw32u_html_gcc_custom.dll +0 -0
  15. data/ext/wxmsw32u_media_gcc_custom.dll +0 -0
  16. data/ext/wxmsw32u_propgrid_gcc_custom.dll +0 -0
  17. data/ext/wxmsw32u_qa_gcc_custom.dll +0 -0
  18. data/ext/wxmsw32u_ribbon_gcc_custom.dll +0 -0
  19. data/ext/wxmsw32u_richtext_gcc_custom.dll +0 -0
  20. data/ext/wxmsw32u_stc_gcc_custom.dll +0 -0
  21. data/ext/wxmsw32u_webview_gcc_custom.dll +0 -0
  22. data/ext/wxmsw32u_xrc_gcc_custom.dll +0 -0
  23. data/lib/wx/accessors.rb +8 -2
  24. data/lib/wx/core/art_locator.rb +2 -2
  25. data/lib/wx/core/artprovider.rb +2 -2
  26. data/lib/wx/core/bitmap.rb +6 -5
  27. data/lib/wx/core/bitmap_combobox.rb +34 -0
  28. data/lib/wx/core/controlwithitems.rb +52 -14
  29. data/lib/wx/core/cursor.rb +1 -1
  30. data/lib/wx/core/dc.rb +0 -20
  31. data/lib/wx/core/event_blocker.rb +14 -0
  32. data/lib/wx/core/events/evt_list.rb +12 -0
  33. data/lib/wx/core/evthandler.rb +36 -0
  34. data/lib/wx/core/find_replace_dialog.rb +24 -0
  35. data/lib/wx/core/icon.rb +1 -1
  36. data/lib/wx/core/image.rb +1 -1
  37. data/lib/wx/core/paintdc.rb +8 -0
  38. data/lib/wx/core/text_entry.rb +15 -0
  39. data/lib/wx/core/v_list_box.rb +13 -0
  40. data/lib/wx/core/window.rb +1 -1
  41. data/lib/wx/doc/busy_info.rb +21 -0
  42. data/lib/wx/doc/client_dc.rb +28 -0
  43. data/lib/wx/doc/controlwithitems.rb +11 -0
  44. data/lib/wx/doc/dc.rb +0 -14
  45. data/lib/wx/doc/event_blocker.rb +27 -0
  46. data/lib/wx/doc/evthandler.rb +4 -0
  47. data/lib/wx/doc/extra/02_lifecycles.md +49 -0
  48. data/lib/wx/doc/extra/10_art.md +1 -1
  49. data/lib/wx/doc/extra/11_drawing_and_dc.md +62 -0
  50. data/lib/wx/doc/gen/about_dialog_info.rb +27 -24
  51. data/lib/wx/doc/gen/accelerator.rb +11 -12
  52. data/lib/wx/doc/gen/app.rb +6 -3
  53. data/lib/wx/doc/gen/art_provider.rb +53 -29
  54. data/lib/wx/doc/gen/aui/aui_manager.rb +4 -0
  55. data/lib/wx/doc/gen/aui/aui_mdi_child_frame.rb +1 -1
  56. data/lib/wx/doc/gen/aui/aui_pane_info.rb +2 -0
  57. data/lib/wx/doc/gen/aui/aui_tab_ctrl.rb +2 -0
  58. data/lib/wx/doc/gen/bitmap.rb +25 -25
  59. data/lib/wx/doc/gen/bitmap_combo_box.rb +157 -0
  60. data/lib/wx/doc/gen/box_sizer.rb +6 -8
  61. data/lib/wx/doc/gen/brush.rb +2 -0
  62. data/lib/wx/doc/gen/busy_info.rb +52 -46
  63. data/lib/wx/doc/gen/caret.rb +0 -4
  64. data/lib/wx/doc/gen/check_list_box.rb +0 -2
  65. data/lib/wx/doc/gen/choice.rb +1 -5
  66. data/lib/wx/doc/gen/client_dc.rb +13 -18
  67. data/lib/wx/doc/gen/clipboard.rb +30 -27
  68. data/lib/wx/doc/gen/collapsible_pane.rb +11 -9
  69. data/lib/wx/doc/gen/colour.rb +6 -3
  70. data/lib/wx/doc/gen/colour_dialog.rb +111 -23
  71. data/lib/wx/doc/gen/combo_box.rb +2 -4
  72. data/lib/wx/doc/gen/control.rb +20 -18
  73. data/lib/wx/doc/gen/core.rb +2 -2
  74. data/lib/wx/doc/gen/cursor.rb +18 -50
  75. data/lib/wx/doc/gen/data_format.rb +0 -2
  76. data/lib/wx/doc/gen/data_object.rb +37 -44
  77. data/lib/wx/doc/gen/dc.rb +16 -24
  78. data/lib/wx/doc/gen/defs.rb +3 -40
  79. data/lib/wx/doc/gen/dialog.rb +21 -17
  80. data/lib/wx/doc/gen/dir_dialog.rb +10 -8
  81. data/lib/wx/doc/gen/event.rb +2 -2
  82. data/lib/wx/doc/gen/event_blocker.rb +49 -0
  83. data/lib/wx/doc/gen/event_filter.rb +95 -0
  84. data/lib/wx/doc/gen/event_list.rb +16 -2
  85. data/lib/wx/doc/gen/events.rb +103 -112
  86. data/lib/wx/doc/gen/evt_handler.rb +28 -52
  87. data/lib/wx/doc/gen/file_dialog.rb +8 -4
  88. data/lib/wx/doc/gen/find_replace_dialog.rb +1 -1
  89. data/lib/wx/doc/gen/font.rb +10 -2
  90. data/lib/wx/doc/gen/font_data.rb +2 -0
  91. data/lib/wx/doc/gen/font_dialog.rb +1 -1
  92. data/lib/wx/doc/gen/frame.rb +4 -3
  93. data/lib/wx/doc/gen/fs_file.rb +8 -0
  94. data/lib/wx/doc/gen/gcdc.rb +2 -22
  95. data/lib/wx/doc/gen/gdi_common.rb +18 -2
  96. data/lib/wx/doc/gen/gdi_object.rb +2 -0
  97. data/lib/wx/doc/gen/graphics_context.rb +4 -43
  98. data/lib/wx/doc/gen/graphics_object.rb +2 -0
  99. data/lib/wx/doc/gen/grid/grid_cell_attr.rb +2 -1
  100. data/lib/wx/doc/gen/grid/grid_ctrl.rb +4 -2
  101. data/lib/wx/doc/gen/grid/grid_table_message.rb +2 -0
  102. data/lib/wx/doc/gen/grid_bag_sizer.rb +4 -0
  103. data/lib/wx/doc/gen/help_controller.rb +4 -1
  104. data/lib/wx/doc/gen/html/html_cell.rb +4 -1
  105. data/lib/wx/doc/gen/html/html_help_controller.rb +4 -1
  106. data/lib/wx/doc/gen/html/html_help_data.rb +4 -0
  107. data/lib/wx/doc/gen/html/html_help_window.rb +2 -1
  108. data/lib/wx/doc/gen/html/html_list_box.rb +138 -11
  109. data/lib/wx/doc/gen/html/html_window.rb +9 -3
  110. data/lib/wx/doc/gen/icon.rb +7 -1
  111. data/lib/wx/doc/gen/icon_location.rb +2 -0
  112. data/lib/wx/doc/gen/image.rb +15 -8
  113. data/lib/wx/doc/gen/keyboard_state.rb +6 -0
  114. data/lib/wx/doc/gen/list_box.rb +0 -11
  115. data/lib/wx/doc/gen/list_ctrl.rb +10 -13
  116. data/lib/wx/doc/gen/locale.rb +7 -3
  117. data/lib/wx/doc/gen/log.rb +6 -2
  118. data/lib/wx/doc/gen/mdi_frame.rb +2 -0
  119. data/lib/wx/doc/gen/media_ctrl.rb +2 -0
  120. data/lib/wx/doc/gen/memory_dc.rb +105 -18
  121. data/lib/wx/doc/gen/menu.rb +4 -2
  122. data/lib/wx/doc/gen/menu_bar.rb +0 -2
  123. data/lib/wx/doc/gen/menu_item.rb +9 -3
  124. data/lib/wx/doc/gen/message_dialog.rb +6 -3
  125. data/lib/wx/doc/gen/mirror_dc.rb +2 -8
  126. data/lib/wx/doc/gen/mouse_state.rb +2 -0
  127. data/lib/wx/doc/gen/multi_choice_dialog.rb +0 -2
  128. data/lib/wx/doc/gen/non_owned_window.rb +2 -1
  129. data/lib/wx/doc/gen/notebook.rb +4 -2
  130. data/lib/wx/doc/gen/paint_dc.rb +2 -6
  131. data/lib/wx/doc/gen/palette.rb +3 -3
  132. data/lib/wx/doc/gen/pen.rb +6 -1
  133. data/lib/wx/doc/gen/pg/pg_editor.rb +2 -1
  134. data/lib/wx/doc/gen/pg/pg_multi_button.rb +4 -0
  135. data/lib/wx/doc/gen/pg/pg_properties.rb +30 -3
  136. data/lib/wx/doc/gen/pg/pg_property.rb +30 -4
  137. data/lib/wx/doc/gen/pg/pg_validation_info.rb +2 -0
  138. data/lib/wx/doc/gen/pg/property_grid.rb +5 -2
  139. data/lib/wx/doc/gen/pg/property_grid_interface.rb +6 -2
  140. data/lib/wx/doc/gen/pg/property_grid_manager.rb +2 -0
  141. data/lib/wx/doc/gen/pg/property_grid_page_state.rb +2 -0
  142. data/lib/wx/doc/gen/picker_base.rb +2 -1
  143. data/lib/wx/doc/gen/platform_info.rb +4 -1
  144. data/lib/wx/doc/gen/property_sheet_dialog.rb +2 -0
  145. data/lib/wx/doc/gen/prt/post_script_dc.rb +2 -8
  146. data/lib/wx/doc/gen/prt/print_data.rb +6 -0
  147. data/lib/wx/doc/gen/prt/printer.rb +0 -3
  148. data/lib/wx/doc/gen/prt/printer_dc.rb +2 -6
  149. data/lib/wx/doc/gen/radio_box.rb +2 -2
  150. data/lib/wx/doc/gen/rbn/ribbon_art_provider.rb +6 -0
  151. data/lib/wx/doc/gen/rbn/ribbon_panel.rb +1 -1
  152. data/lib/wx/doc/gen/region.rb +2 -0
  153. data/lib/wx/doc/gen/rtc/rich_text_buffer.rb +6 -0
  154. data/lib/wx/doc/gen/rtc/rich_text_ctrl.rb +0 -4
  155. data/lib/wx/doc/gen/rtc/rich_text_header_footer_data.rb +2 -0
  156. data/lib/wx/doc/gen/rtc/rich_text_html_handler.rb +2 -1
  157. data/lib/wx/doc/gen/rtc/symbol_picker_dialog.rb +2 -0
  158. data/lib/wx/doc/gen/screen_dc.rb +2 -0
  159. data/lib/wx/doc/gen/scroll_bar.rb +2 -1
  160. data/lib/wx/doc/gen/scrolled_canvas.rb +4 -8
  161. data/lib/wx/doc/gen/scrolled_control.rb +4 -8
  162. data/lib/wx/doc/gen/scrolled_window.rb +4 -8
  163. data/lib/wx/doc/gen/search_ctrl.rb +131 -0
  164. data/lib/wx/doc/gen/single_choice_dialog.rb +0 -2
  165. data/lib/wx/doc/gen/sizer.rb +14 -3
  166. data/lib/wx/doc/gen/splash_screen.rb +2 -0
  167. data/lib/wx/doc/gen/static_box.rb +6 -3
  168. data/lib/wx/doc/gen/static_box_sizer.rb +2 -1
  169. data/lib/wx/doc/gen/status_bar.rb +0 -5
  170. data/lib/wx/doc/gen/stc/styled_text_ctrl.rb +4 -5
  171. data/lib/wx/doc/gen/svg_file_dc.rb +10 -11
  172. data/lib/wx/doc/gen/text_ctrl.rb +10 -3
  173. data/lib/wx/doc/gen/text_entry.rb +8 -3
  174. data/lib/wx/doc/gen/text_entry_dialog.rb +4 -2
  175. data/lib/wx/doc/gen/timer_event.rb +2 -0
  176. data/lib/wx/doc/gen/tool_bar.rb +8 -4
  177. data/lib/wx/doc/gen/top_level_window.rb +5 -2
  178. data/lib/wx/doc/gen/tree_ctrl.rb +0 -6
  179. data/lib/wx/doc/gen/ui_action_simulator.rb +100 -0
  180. data/lib/wx/doc/gen/utils.rb +1 -1
  181. data/lib/wx/doc/gen/v_list_box.rb +36 -26
  182. data/lib/wx/doc/gen/validator.rb +2 -1
  183. data/lib/wx/doc/gen/variant.rb +10 -0
  184. data/lib/wx/doc/gen/window.rb +38 -17
  185. data/lib/wx/doc/gen/window_dc.rb +2 -0
  186. data/lib/wx/doc/gen/window_disabler.rb +2 -0
  187. data/lib/wx/doc/gen/wizard_page_simple.rb +2 -0
  188. data/lib/wx/doc/gen/xml_node.rb +6 -0
  189. data/lib/wx/doc/gen/xml_resource.rb +4 -1
  190. data/lib/wx/doc/memory_dc.rb +75 -0
  191. data/lib/wx/doc/mirror_dc.rb +16 -0
  192. data/lib/wx/doc/prt/printer_dc.rb +26 -0
  193. data/lib/wx/doc/screen_dc.rb +10 -6
  194. data/lib/wx/doc/svg_file_dc.rb +20 -0
  195. data/lib/wx/doc/v_list_box.rb +9 -0
  196. data/lib/wx/doc/window_disabler.rb +10 -0
  197. data/lib/wx/global_const.rb +24 -18
  198. data/lib/wx/html/keyword_defs.rb +6 -7
  199. data/lib/wx/html/require.rb +1 -0
  200. data/lib/wx/html/simple_html_listbox.rb +105 -0
  201. data/lib/wx/keyword_defs.rb +7 -0
  202. data/lib/wx/version.rb +1 -1
  203. data/lib/wx/wxruby/cmd/test.rb +1 -1
  204. data/lib/wxruby_aui.so +0 -0
  205. data/lib/wxruby_core.so +0 -0
  206. data/lib/wxruby_grid.so +0 -0
  207. data/lib/wxruby_html.so +0 -0
  208. data/lib/wxruby_pg.so +0 -0
  209. data/lib/wxruby_prt.so +0 -0
  210. data/lib/wxruby_rbn.so +0 -0
  211. data/lib/wxruby_rtc.so +0 -0
  212. data/lib/wxruby_stc.so +0 -0
  213. data/rakelib/install.rb +3 -1
  214. data/rakelib/yard/yard/relative_markdown_links.rb +5 -1
  215. data/samples/bigdemo/wxArtProvider.rbw +5 -4
  216. data/samples/controls/controls.rb +2 -2
  217. data/samples/controls/htlbox.rb +411 -0
  218. data/samples/controls/tn_htlbox.png +0 -0
  219. data/samples/drawing/graphics_drawing.rb +1 -2
  220. data/samples/drawing/{svgtest.rb → image_prt.rb} +49 -18
  221. data/samples/drawing/tn_image_prt.png +0 -0
  222. data/samples/propgrid/propgrid.rb +23 -21
  223. data/samples/ribbon/ribbon.rb +47 -46
  224. data/tests/lib/wxapp_runner.rb +3 -3
  225. data/tests/lib/wxframe_runner.rb +59 -0
  226. data/tests/test_app_event_filter.rb +74 -0
  227. data/tests/test_art_provider.rb +52 -0
  228. data/tests/test_clipboard.rb +2 -1
  229. data/tests/test_event_handling.rb +199 -16
  230. data/tests/test_events.rb +4 -11
  231. data/tests/test_gdi_object.rb +161 -0
  232. data/tests/test_intl.rb +11 -14
  233. data/tests/test_item_data.rb +33 -1
  234. data/tests/test_std_controls.rb +147 -0
  235. metadata +38 -8
  236. data/lib/wx/doc/gen/auto_buffered_paint_dc.rb +0 -47
  237. data/lib/wx/doc/gen/buffered_dc.rb +0 -95
  238. data/lib/wx/doc/gen/buffered_paint_dc.rb +0 -55
  239. data/lib/wx/doc/gen/colour_data.rb +0 -96
  240. data/samples/drawing/tn_svgtest.png +0 -0
@@ -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,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
- # def test_add_language_info
39
- # flunk 'Wx::Locale.add_language is not yet implemented'
40
- # # FIXME - typemaps for wxString are not picked up when SWIG converts
41
- # # the struct definition; so maybe do an %extend for this method that
42
- # # accepts string canonical name and description and Win32
43
- # # identifiers, and returns an integer id. See Locale.i
44
- # language_marain = Wx::Locale.add_language('ma_MA', 'Marain',
45
- # 0, 0)
46
- # assert_kind_of(Integer, language_marain)
47
- # lang_info = Wx::Locale.find_language_info('ma_MA')
48
- # assert_equal(Wx::LANGUAGE_MARAIN, lang_info.language)
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
@@ -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,147 @@
1
+
2
+ require_relative './lib/wxframe_runner'
3
+
4
+ class ButtonTests < WxRuby::Test::GUITests
5
+
6
+ def setup
7
+ super
8
+ @button = Wx::Button.new(test_frame, name: 'Button')
9
+ Wx.get_app.yield
10
+ end
11
+
12
+ def cleanup
13
+ @button.destroy
14
+ Wx.get_app.yield
15
+ super
16
+ end
17
+
18
+ attr_reader :button
19
+
20
+ if Wx.has_feature?(:USE_UIACTIONSIMULATOR)
21
+
22
+ def test_click
23
+ count = count_events(button, :evt_button) do
24
+ sim = Wx::UIActionSimulator.new
25
+
26
+ # We move in slightly to account for window decorations, we need to yield
27
+ # after every Wx::UIActionSimulator action to keep everything working in GTK
28
+ sim.mouse_move(button.get_screen_position + Wx::Point.new(10, 10))
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 slightly to account for window decorations, we need to yield
44
+ # after every Wx::UIActionSimulator action to keep everything working in GTK
45
+ sim.mouse_move(button.get_screen_position + Wx::Point.new(10, 10))
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 # wxUSE_UIACTIONSIMULATOR
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
+ def setup
95
+ super
96
+ @text = Wx::TextCtrl.new(test_frame, name: 'Text')
97
+ Wx.get_app.yield
98
+ end
99
+
100
+ def cleanup
101
+ @text.destroy
102
+ Wx.get_app.yield
103
+ super
104
+ end
105
+
106
+ attr_reader :text
107
+
108
+
109
+ if Wx.has_feature?(:USE_UIACTIONSIMULATOR)
110
+
111
+ def test_text
112
+ assert_equal('', text.get_value)
113
+ sim = Wx::UIActionSimulator.new
114
+
115
+ updates = count_events(text, :evt_text) do |c_upd|
116
+ maxlen_count = count_events(text, :evt_text_maxlen) do |c_maxlen|
117
+ # set focus to text control
118
+ text.set_focus
119
+ Wx.get_app.yield
120
+
121
+ sim.text('Hello')
122
+ Wx.get_app.yield
123
+
124
+ assert_equal('Hello', text.get_value)
125
+ assert_equal(5, c_upd.count)
126
+
127
+ text.set_max_length(10)
128
+ sim.text('World')
129
+ Wx.get_app.yield
130
+
131
+ assert_equal('HelloWorld', text.get_value)
132
+ assert_equal(10, c_upd.count)
133
+ assert_equal(0, c_maxlen.count)
134
+
135
+ sim.text('!')
136
+ Wx.get_app.yield
137
+
138
+ assert_equal('HelloWorld', text.get_value)
139
+ assert_equal(10, c_upd.count)
140
+ assert_equal(1, c_maxlen.count)
141
+ end
142
+ end
143
+ end
144
+
145
+ end
146
+
147
+ end