wxruby3 0.9.0.pre.rc.1 → 0.9.0.pre.rc.2

Sign up to get free protection for your applications and to get access to all the features.
Files changed (77) hide show
  1. checksums.yaml +4 -4
  2. data/INSTALL.md +51 -22
  3. data/README.md +38 -6
  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/lib/wx/core/brush.rb +6 -0
  13. data/lib/wx/core/evthandler.rb +12 -2
  14. data/lib/wx/core/font.rb +22 -14
  15. data/lib/wx/core/helpprovider.rb +2 -2
  16. data/lib/wx/core/menu.rb +5 -0
  17. data/lib/wx/core/pen.rb +6 -0
  18. data/lib/wx/core/window.rb +28 -1
  19. data/lib/wx/doc/app.rb +40 -0
  20. data/lib/wx/doc/brush.rb +17 -0
  21. data/lib/wx/doc/font.rb +27 -0
  22. data/lib/wx/doc/pen.rb +17 -0
  23. data/lib/wx/doc/radio_box.rb +20 -0
  24. data/lib/wx/doc/window.rb +27 -0
  25. data/lib/wx/keyword_defs.rb +77 -76
  26. data/lib/wx/prt/keyword_defs.rb +5 -1
  27. data/lib/wx/version.rb +1 -1
  28. data/rakelib/install.rb +17 -6
  29. data/rakelib/lib/config/linux.rb +4 -2
  30. data/rakelib/lib/config/macosx.rb +120 -1
  31. data/rakelib/lib/config/mingw.rb +6 -1
  32. data/rakelib/lib/config/unixish.rb +26 -11
  33. data/rakelib/lib/config.rb +15 -6
  34. data/rakelib/lib/core/package.rb +1 -1
  35. data/rakelib/lib/core/spec.rb +2 -2
  36. data/rakelib/lib/director/app.rb +30 -1
  37. data/rakelib/lib/director/aui_toolbar.rb +41 -0
  38. data/rakelib/lib/director/brush.rb +10 -1
  39. data/rakelib/lib/director/combobox.rb +1 -1
  40. data/rakelib/lib/director/context_help_button.rb +23 -0
  41. data/rakelib/lib/director/dialog.rb +8 -2
  42. data/rakelib/lib/director/font.rb +12 -3
  43. data/rakelib/lib/director/help_provider.rb +8 -10
  44. data/rakelib/lib/director/hyperlink_event.rb +22 -0
  45. data/rakelib/lib/director/menu.rb +0 -3
  46. data/rakelib/lib/director/menu_bar.rb +3 -0
  47. data/rakelib/lib/director/pen.rb +10 -1
  48. data/rakelib/lib/director/popup_window.rb +18 -0
  49. data/rakelib/lib/director/radio_box.rb +15 -4
  50. data/rakelib/lib/director/searchctrl.rb +2 -1
  51. data/rakelib/lib/director/static_box.rb +1 -1
  52. data/rakelib/lib/director/styled_text_ctrl.rb +1 -1
  53. data/rakelib/lib/director/text_entry.rb +5 -0
  54. data/rakelib/lib/director/textctrl.rb +1 -1
  55. data/rakelib/lib/director/window.rb +37 -1
  56. data/rakelib/lib/generate/doc/context_help_button.yaml +16 -0
  57. data/rakelib/lib/generate/doc/event_blocker.yaml +27 -0
  58. data/rakelib/lib/generate/doc/event_filter.yaml +47 -0
  59. data/rakelib/lib/generate/doc/file_dialog.yaml +68 -0
  60. data/rakelib/lib/generate/doc.rb +1 -1
  61. data/rakelib/lib/generate/interface.rb +11 -10
  62. data/rakelib/lib/specs/interfaces.rb +4 -1
  63. data/samples/aui/aui.rb +432 -363
  64. data/samples/propgrid/propgrid.rb +3 -0
  65. data/samples/sampler/editor.rb +33 -25
  66. data/samples/sampler/sample.rb +2 -2
  67. data/samples/sampler/stc_editor.rb +4 -2
  68. data/tests/lib/item_container_tests.rb +82 -0
  69. data/tests/lib/text_entry_tests.rb +80 -0
  70. data/tests/lib/wxapp_runner.rb +12 -0
  71. data/tests/lib/wxframe_runner.rb +89 -4
  72. data/tests/test_ext_controls.rb +28 -0
  73. data/tests/test_font.rb +239 -0
  74. data/tests/test_intl.rb +5 -1
  75. data/tests/test_std_controls.rb +263 -37
  76. data/tests/test_window.rb +340 -0
  77. metadata +28 -2
@@ -0,0 +1,340 @@
1
+
2
+ require_relative './lib/wxframe_runner'
3
+
4
+ class WindowTests < WxRuby::Test::GUITests
5
+
6
+ def setup
7
+ super
8
+ @window = Wx::Window.new(test_frame)
9
+ end
10
+
11
+ def cleanup
12
+ test_frame.destroy_children
13
+ @window = nil
14
+ super
15
+ end
16
+
17
+ attr_reader :window
18
+
19
+
20
+ def do_show_hide_event
21
+ count = count_events(window, :evt_show) do
22
+
23
+ assert(window.shown?)
24
+
25
+ window.show(false)
26
+
27
+ assert(!window.shown?)
28
+
29
+ window.show
30
+
31
+ assert(window.shown?)
32
+ end
33
+
34
+ assert_equal(2, count)
35
+ end
36
+
37
+ def test_show_hide_event
38
+
39
+ # normal
40
+ do_show_hide_event
41
+
42
+ # locked
43
+ window.locked do
44
+ assert(window.frozen?)
45
+
46
+ do_show_hide_event
47
+ end
48
+
49
+ end
50
+
51
+ if has_ui_simulator?
52
+
53
+ def test_key_event
54
+ if Wx::PLATFORM == 'WXGTK' || !is_ci_build?
55
+ count_events(window, :evt_key_down) do |c_keydown|
56
+ count_events(window, :evt_key_up) do |c_keyup|
57
+ count_events(window, :evt_char) do |c_keychar|
58
+
59
+ sim = Wx::UIActionSimulator.new
60
+
61
+ window.set_focus
62
+ Wx.get_app.yield
63
+
64
+ sim.text("text")
65
+ sim.char(Wx::K_SHIFT)
66
+ Wx.get_app.yield
67
+
68
+ assert_equal(5, c_keydown.count)
69
+ assert_equal(5, c_keyup.count)
70
+ assert_equal(4, c_keychar.count)
71
+
72
+ end
73
+ end
74
+ end
75
+ end
76
+ end
77
+
78
+ end
79
+
80
+ def test_focus_event
81
+ if Wx::PLATFORM != 'WXOSX'
82
+ count_events(window, :evt_set_focus) do |c_setfocus|
83
+ count_events(window, :evt_kill_focus) do |c_killfocus|
84
+ window.set_focus
85
+
86
+ assert(c_setfocus.wait_event(500))
87
+ assert_equal(window, Wx::Window.find_focus)
88
+
89
+ button = Wx::Button.new(test_frame, Wx::ID_ANY)
90
+
91
+ Wx.get_app.yield
92
+ button.set_focus
93
+
94
+ assert_equal(1, c_killfocus.count)
95
+ assert(!window.has_focus)
96
+ end
97
+ end
98
+ end
99
+ end
100
+
101
+ def test_mouse
102
+ cursor = Wx::Cursor.new(Wx::CURSOR_CHAR)
103
+ window.set_cursor(cursor)
104
+
105
+ assert(window.get_cursor.is_ok)
106
+
107
+ if Wx.has_feature?(:USE_CARET)
108
+ assert(!window.get_caret)
109
+
110
+ caret = nil
111
+
112
+ # Try creating the caret in two different, but normally equivalent, ways.
113
+ assert_nothing_raised("Caret 1-step") do
114
+ caret = Wx::Caret.new(window, [16, 16])
115
+
116
+ window.set_caret(caret)
117
+
118
+ assert(window.get_caret.ok?)
119
+ end
120
+
121
+ assert_nothing_raised("Caret 2-step") do
122
+ caret = Wx::Caret.new
123
+ caret.create(window, [16, 16])
124
+
125
+ window.set_caret(caret)
126
+
127
+ assert(window.get_caret.ok?)
128
+ end
129
+ end
130
+
131
+ window.capture_mouse
132
+
133
+ assert(window.has_capture)
134
+
135
+ window.release_mouse
136
+
137
+ assert(!window.has_capture)
138
+ end
139
+
140
+ def test_properties
141
+ window.set_label("label")
142
+
143
+ assert_equal('label', window.get_label)
144
+
145
+ window.set_name('name')
146
+
147
+ assert_equal('name', window.get_name)
148
+
149
+ #As we used wxID_ANY we should have a negative id
150
+ assert(window.get_id < 0)
151
+
152
+ window.set_id(Wx::ID_HIGHEST + 10)
153
+
154
+ assert_equal(Wx::ID_HIGHEST + 10, window.get_id)
155
+ end
156
+
157
+ if Wx.has_feature?(:USE_TOOLTIPS)
158
+ def test_tool_tip
159
+ assert(!window.get_tool_tip)
160
+ assert_equal('', window.get_tool_tip_text)
161
+
162
+ window.set_tool_tip("text tip")
163
+
164
+ assert_equal('text tip', window.get_tool_tip_text)
165
+
166
+ window.unset_tool_tip
167
+
168
+ assert(!window.get_tool_tip)
169
+ assert_equal('', window.get_tool_tip_text)
170
+
171
+ tip = Wx::ToolTip.new("other tip")
172
+
173
+ window.set_tool_tip(tip)
174
+
175
+ assert_equal(tip, window.get_tool_tip)
176
+ assert_equal('other tip', window.get_tool_tip_text)
177
+ end
178
+ end # wxUSE_TOOLTIPS
179
+
180
+ def test_help
181
+ if Wx.has_feature?(:USE_HELP)
182
+ Wx::HelpProvider.set(Wx::SimpleHelpProvider.new)
183
+
184
+ assert_equal('', window.get_help_text)
185
+
186
+ window.set_help_text("helptext")
187
+
188
+ assert_equal('helptext', window.get_help_text)
189
+ end
190
+ end
191
+
192
+ def test_parent
193
+ assert_equal(nil, window.get_grand_parent)
194
+ assert_equal(test_frame, window.get_parent)
195
+ end
196
+
197
+ def test_sibling
198
+ assert_equal(nil, window.get_next_sibling)
199
+ assert_equal(nil, window.get_prev_sibling)
200
+
201
+ newwin = Wx::Window.new(test_frame, Wx::ID_ANY)
202
+
203
+ assert_equal(newwin, window.get_next_sibling)
204
+ assert_equal(nil, window.get_prev_sibling)
205
+
206
+ assert_equal(nil, newwin.get_next_sibling)
207
+ assert_equal(window, newwin.get_prev_sibling)
208
+ end
209
+
210
+ def test_children
211
+ assert_equal(0, window.get_children.count)
212
+
213
+ child1 = Wx::Window.new(window, Wx::ID_ANY)
214
+
215
+ assert_equal(1, window.get_children.count)
216
+
217
+ window.remove_child(child1)
218
+
219
+ assert_equal(0, window.get_children.count)
220
+
221
+ child1.set_id(Wx::ID_HIGHEST + 1)
222
+ child1.set_name("child1")
223
+
224
+ window.add_child(child1)
225
+
226
+ assert_equal(1, window.get_children.count)
227
+ assert_equal(child1, window.find_window_by_id(Wx::ID_HIGHEST + 1))
228
+ assert_equal(child1, window.find_window_by_name("child1"))
229
+
230
+ window.destroy_children
231
+
232
+ assert_equal(0, window.get_children.count)
233
+ end
234
+
235
+ def test_focus
236
+ if Wx::PLATFORM != 'WXOSX'
237
+ assert(!window.has_focus)
238
+
239
+ if window.accepts_focus
240
+ window.set_focus
241
+ assert_equal(window, Wx::Window.find_focus)
242
+ end
243
+
244
+ # Set the focus back to the main window
245
+ test_frame.set_focus
246
+
247
+ if window.accepts_focus_from_keyboard
248
+ window.set_focus_from_kbd
249
+ assert_equal(window, Wx::Window.find_focus)
250
+ end
251
+ end
252
+ end
253
+
254
+ def test_positioning
255
+ # Some basic tests for consistency
256
+ pos = window.get_position
257
+ assert_equal(pos, window.get_position)
258
+ assert_equal(pos, window.get_rect.top_left)
259
+
260
+ pos = window.get_screen_position
261
+ assert_equal(pos, window.get_screen_position)
262
+ assert_equal(pos, window.get_screen_rect.top_left)
263
+ end
264
+
265
+ def test_show
266
+ assert(window.is_shown)
267
+
268
+ window.hide
269
+
270
+ assert(!window.is_shown)
271
+
272
+ window.show
273
+
274
+ assert(window.is_shown)
275
+
276
+ window.show(false)
277
+
278
+ assert(!window.is_shown)
279
+
280
+ window.show_with_effect(Wx::SHOW_EFFECT_BLEND)
281
+
282
+ assert(window.is_shown)
283
+
284
+ window.hide_with_effect(Wx::SHOW_EFFECT_BLEND)
285
+
286
+ assert(!window.is_shown)
287
+ end
288
+
289
+ def test_enable
290
+ assert(window.is_enabled)
291
+
292
+ window.disable
293
+
294
+ assert(!window.is_enabled)
295
+
296
+ window.enable
297
+
298
+ assert(window.is_enabled)
299
+
300
+ window.enable(false)
301
+
302
+ assert(!window.is_enabled)
303
+ window.enable
304
+
305
+
306
+ child = Wx::Window.new(window, Wx::ID_ANY)
307
+ assert(child.is_enabled)
308
+ assert(child.is_this_enabled)
309
+
310
+ window.disable
311
+ assert(!child.is_enabled)
312
+ assert(child.is_this_enabled)
313
+
314
+ child.disable
315
+ assert(!child.is_enabled)
316
+ assert(!child.is_this_enabled)
317
+
318
+ window.enable
319
+ assert(!child.is_enabled)
320
+ assert(!child.is_this_enabled)
321
+
322
+ child.enable
323
+ assert(child.is_enabled)
324
+ assert(child.is_this_enabled)
325
+ end
326
+
327
+ def test_find_window_by
328
+ window.set_id(Wx::ID_HIGHEST + 1)
329
+ window.set_name("name")
330
+ window.set_label("label")
331
+
332
+ assert_equal(window, Wx::Window.find_window_by_id(Wx::ID_HIGHEST + 1))
333
+ assert_equal(window, Wx::Window.find_window_by_name("name"))
334
+ assert_equal(window, Wx::Window.find_window_by_label("label"))
335
+
336
+ assert_equal(nil, Wx::Window.find_window_by_id(Wx::ID_HIGHEST + 3))
337
+ assert_equal(nil, Wx::Window.find_window_by_name("noname"))
338
+ assert_equal(nil, Wx::Window.find_window_by_label("nolabel"))
339
+ end
340
+ end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: wxruby3
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.9.0.pre.rc.1
4
+ version: 0.9.0.pre.rc.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Martin Corino
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2023-06-30 00:00:00.000000000 Z
11
+ date: 2023-07-15 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: nokogiri
@@ -80,9 +80,17 @@ files:
80
80
  - INSTALL.md
81
81
  - LICENSE
82
82
  - README.md
83
+ - assets/hello_button-macos.png
84
+ - assets/hello_button-msw.png
83
85
  - assets/hello_button.png
86
+ - assets/hello_button_clicked-macos.png
87
+ - assets/hello_button_clicked-msw.png
84
88
  - assets/hello_button_clicked.png
89
+ - assets/hello_button_clicked_combi.png
90
+ - assets/hello_world-macos.png
91
+ - assets/hello_world-msw.png
85
92
  - assets/hello_world.png
93
+ - assets/hello_world_combi.png
86
94
  - assets/logo.png
87
95
  - assets/logo.svg
88
96
  - assets/logo.xcf
@@ -118,6 +126,7 @@ files:
118
126
  - lib/wx/core/artprovider.rb
119
127
  - lib/wx/core/bitmap.rb
120
128
  - lib/wx/core/bitmap_combobox.rb
129
+ - lib/wx/core/brush.rb
121
130
  - lib/wx/core/busycursor.rb
122
131
  - lib/wx/core/choice.rb
123
132
  - lib/wx/core/choicedlg.rb
@@ -160,6 +169,7 @@ files:
160
169
  - lib/wx/core/notebook.rb
161
170
  - lib/wx/core/object.rb
162
171
  - lib/wx/core/paintdc.rb
172
+ - lib/wx/core/pen.rb
163
173
  - lib/wx/core/pen_info.rb
164
174
  - lib/wx/core/platform_info.rb
165
175
  - lib/wx/core/point.rb
@@ -183,11 +193,13 @@ files:
183
193
  - lib/wx/core/window.rb
184
194
  - lib/wx/core/window_update_locker.rb
185
195
  - lib/wx/core/xmlresource.rb
196
+ - lib/wx/doc/app.rb
186
197
  - lib/wx/doc/array_ext.rb
187
198
  - lib/wx/doc/art_locator.rb
188
199
  - lib/wx/doc/aui/auimanager.rb
189
200
  - lib/wx/doc/aui/auinotebook.rb
190
201
  - lib/wx/doc/bitmap.rb
202
+ - lib/wx/doc/brush.rb
191
203
  - lib/wx/doc/busy_info.rb
192
204
  - lib/wx/doc/client_dc.rb
193
205
  - lib/wx/doc/clipboard.rb
@@ -215,6 +227,7 @@ files:
215
227
  - lib/wx/doc/extra/09_exceptions.md
216
228
  - lib/wx/doc/extra/10_art.md
217
229
  - lib/wx/doc/extra/11_drawing_and_dc.md
230
+ - lib/wx/doc/font.rb
218
231
  - lib/wx/doc/functions.rb
219
232
  - lib/wx/doc/gc_dc.rb
220
233
  - lib/wx/doc/gdi_common.rb
@@ -227,6 +240,7 @@ files:
227
240
  - lib/wx/doc/image.rb
228
241
  - lib/wx/doc/memory_dc.rb
229
242
  - lib/wx/doc/mirror_dc.rb
243
+ - lib/wx/doc/pen.rb
230
244
  - lib/wx/doc/pg/events.rb
231
245
  - lib/wx/doc/pg/pg_property.rb
232
246
  - lib/wx/doc/pg/pgeditor.rb
@@ -238,6 +252,7 @@ files:
238
252
  - lib/wx/doc/prt/print_dialog.rb
239
253
  - lib/wx/doc/prt/printer.rb
240
254
  - lib/wx/doc/prt/printer_dc.rb
255
+ - lib/wx/doc/radio_box.rb
241
256
  - lib/wx/doc/rbn/ribbon_bar.rb
242
257
  - lib/wx/doc/rbn/ribbon_button_bar.rb
243
258
  - lib/wx/doc/rbn/ribbon_gallery.rb
@@ -371,6 +386,7 @@ files:
371
386
  - rakelib/lib/director/colour.rb
372
387
  - rakelib/lib/director/colour_picker_ctrl.rb
373
388
  - rakelib/lib/director/combobox.rb
389
+ - rakelib/lib/director/context_help_button.rb
374
390
  - rakelib/lib/director/control.rb
375
391
  - rakelib/lib/director/ctrl_with_items.rb
376
392
  - rakelib/lib/director/cursor.rb
@@ -425,6 +441,7 @@ files:
425
441
  - rakelib/lib/director/html_listbox.rb
426
442
  - rakelib/lib/director/html_printout.rb
427
443
  - rakelib/lib/director/html_window.rb
444
+ - rakelib/lib/director/hyperlink_event.rb
428
445
  - rakelib/lib/director/icon.rb
429
446
  - rakelib/lib/director/image.rb
430
447
  - rakelib/lib/director/image_list.rb
@@ -552,14 +569,18 @@ files:
552
569
  - rakelib/lib/generate/doc/clipboard.yaml
553
570
  - rakelib/lib/generate/doc/collapsible_pane.yaml
554
571
  - rakelib/lib/generate/doc/colour_dialog.yaml
572
+ - rakelib/lib/generate/doc/context_help_button.yaml
555
573
  - rakelib/lib/generate/doc/control.yaml
556
574
  - rakelib/lib/generate/doc/cursor.yaml
557
575
  - rakelib/lib/generate/doc/data_object.yaml
558
576
  - rakelib/lib/generate/doc/dc.yaml
559
577
  - rakelib/lib/generate/doc/dialog.yaml
560
578
  - rakelib/lib/generate/doc/dir_dialog.yaml
579
+ - rakelib/lib/generate/doc/event_blocker.yaml
580
+ - rakelib/lib/generate/doc/event_filter.yaml
561
581
  - rakelib/lib/generate/doc/events.yaml
562
582
  - rakelib/lib/generate/doc/evt_handler.yaml
583
+ - rakelib/lib/generate/doc/file_dialog.yaml
563
584
  - rakelib/lib/generate/interface.rb
564
585
  - rakelib/lib/generate/rakedep.rb
565
586
  - rakelib/lib/specs/interfaces.rb
@@ -912,6 +933,8 @@ files:
912
933
  - tests/art/test_art/image/wxruby.jpg
913
934
  - tests/art/test_art/image/wxruby.png
914
935
  - tests/art/test_art/sample2.xpm
936
+ - tests/lib/item_container_tests.rb
937
+ - tests/lib/text_entry_tests.rb
915
938
  - tests/lib/wxapp_runner.rb
916
939
  - tests/lib/wxframe_runner.rb
917
940
  - tests/test_app_event_filter.rb
@@ -923,12 +946,15 @@ files:
923
946
  - tests/test_dialog.rb
924
947
  - tests/test_event_handling.rb
925
948
  - tests/test_events.rb
949
+ - tests/test_ext_controls.rb
950
+ - tests/test_font.rb
926
951
  - tests/test_gdi_object.rb
927
952
  - tests/test_geometry.rb
928
953
  - tests/test_intl.rb
929
954
  - tests/test_item_data.rb
930
955
  - tests/test_std_controls.rb
931
956
  - tests/test_variant.rb
957
+ - tests/test_window.rb
932
958
  - tests/testapp.rb
933
959
  - tests/testapp_noframe.rb
934
960
  homepage: https://github.com/mcorino/wxRuby3