wxruby3-shapes 0.9.0.pre.beta.3 → 0.9.6

Sign up to get free protection for your applications and to get access to all the features.
Files changed (97) hide show
  1. checksums.yaml +4 -4
  2. data/INSTALL.md +5 -7
  3. data/README.md +38 -6
  4. data/assets/logo.svg +339 -0
  5. data/assets/logo.xpm +60 -0
  6. data/assets/screenshot.png +0 -0
  7. data/assets/social.png +0 -0
  8. data/bin/wx-shapes +1 -1
  9. data/lib/wx/shapes/arrow_base.rb +4 -11
  10. data/lib/wx/shapes/arrows/circle_arrow.rb +22 -11
  11. data/lib/wx/shapes/arrows/circle_prong_arrow.rb +48 -0
  12. data/lib/wx/shapes/arrows/cross_bar_arrow.rb +57 -0
  13. data/lib/wx/shapes/arrows/cross_bar_circle_arrow.rb +56 -0
  14. data/lib/wx/shapes/arrows/cross_bar_prong_arrow.rb +49 -0
  15. data/lib/wx/shapes/arrows/crossed_circle.rb +46 -0
  16. data/lib/wx/shapes/arrows/cup_arrow.rb +65 -0
  17. data/lib/wx/shapes/arrows/diamond_arrow.rb +8 -13
  18. data/lib/wx/shapes/arrows/double_cross_bar_arrow.rb +27 -0
  19. data/lib/wx/shapes/arrows/filled_arrow.rb +60 -0
  20. data/lib/wx/shapes/arrows/line_arrow.rb +67 -0
  21. data/lib/wx/shapes/arrows/open_arrow.rb +22 -23
  22. data/lib/wx/shapes/arrows/prong_arrow.rb +42 -0
  23. data/lib/wx/shapes/arrows/solid_arrow.rb +21 -35
  24. data/lib/wx/shapes/arrows/square_arrow.rb +37 -0
  25. data/lib/wx/shapes/auto_layout.rb +2 -2
  26. data/lib/wx/shapes/base.rb +1 -1
  27. data/lib/wx/shapes/canvas_history.rb +20 -0
  28. data/lib/wx/shapes/connection_point.rb +10 -6
  29. data/lib/wx/shapes/diagram.rb +98 -78
  30. data/lib/wx/shapes/events.rb +8 -8
  31. data/lib/wx/shapes/printout.rb +3 -16
  32. data/lib/wx/shapes/serializable.rb +2 -436
  33. data/lib/wx/shapes/serialize/wx.rb +30 -18
  34. data/lib/wx/shapes/shape.rb +211 -168
  35. data/lib/wx/shapes/shape_canvas.rb +728 -267
  36. data/lib/wx/shapes/shape_data_object.rb +99 -18
  37. data/lib/wx/shapes/shape_handle.rb +18 -11
  38. data/lib/wx/shapes/shape_list.rb +34 -67
  39. data/lib/wx/shapes/shapes/bitmap_shape.rb +23 -24
  40. data/lib/wx/shapes/shapes/box_shape.rb +389 -0
  41. data/lib/wx/shapes/shapes/circle_shape.rb +19 -22
  42. data/lib/wx/shapes/shapes/control_shape.rb +77 -41
  43. data/lib/wx/shapes/shapes/curve_shape.rb +38 -31
  44. data/lib/wx/shapes/shapes/diamond_shape.rb +7 -17
  45. data/lib/wx/shapes/shapes/edit_text_shape.rb +6 -9
  46. data/lib/wx/shapes/shapes/ellipse_shape.rb +12 -15
  47. data/lib/wx/shapes/shapes/flex_grid_shape.rb +58 -33
  48. data/lib/wx/shapes/shapes/grid_shape.rb +259 -161
  49. data/lib/wx/shapes/shapes/line_shape.rb +155 -161
  50. data/lib/wx/shapes/shapes/manager_shape.rb +77 -0
  51. data/lib/wx/shapes/shapes/multi_sel_rect.rb +8 -8
  52. data/lib/wx/shapes/shapes/ortho_shape.rb +31 -36
  53. data/lib/wx/shapes/shapes/polygon_shape.rb +23 -29
  54. data/lib/wx/shapes/shapes/rect_shape.rb +95 -53
  55. data/lib/wx/shapes/shapes/round_ortho_shape.rb +6 -8
  56. data/lib/wx/shapes/shapes/round_rect_shape.rb +20 -24
  57. data/lib/wx/shapes/shapes/square_shape.rb +14 -17
  58. data/lib/wx/shapes/shapes/text_shape.rb +95 -53
  59. data/lib/wx/shapes/version.rb +1 -1
  60. data/lib/wx/shapes/wx.rb +16 -7
  61. data/lib/wx/wx-shapes/cmd/test.rb +1 -1
  62. data/samples/demo/arrows.json +1 -0
  63. data/samples/demo/arrows.yaml +793 -0
  64. data/samples/demo/art/HBox.xpm +22 -0
  65. data/samples/demo/art/VBox.xpm +22 -0
  66. data/samples/demo/art/logo.xpm +60 -0
  67. data/samples/demo/class.json +1 -0
  68. data/samples/demo/class.yaml +5631 -0
  69. data/samples/demo/demo.rb +301 -91
  70. data/samples/demo/dialogs.rb +1405 -0
  71. data/samples/demo/erd.json +1 -0
  72. data/samples/demo/erd.yaml +4072 -0
  73. data/samples/demo/frame_canvas.rb +409 -33
  74. data/samples/sample1/art/logo.xpm +60 -0
  75. data/samples/sample1/sample.rb +11 -11
  76. data/samples/sample2/art/logo.xpm +60 -0
  77. data/samples/sample2/sample.rb +2 -2
  78. data/samples/sample2/sample_shape.rb +15 -15
  79. data/samples/sample3/art/logo.xpm +60 -0
  80. data/samples/sample3/sample.rb +3 -3
  81. data/samples/sample4/art/logo.xpm +60 -0
  82. data/samples/sample4/sample.rb +2 -2
  83. data/tests/lib/wxapp_runner.rb +4 -0
  84. data/tests/serializer_tests.rb +8 -441
  85. data/tests/test_grid_shapes.rb +2 -2
  86. data/tests/test_serialize_xml.rb +17 -0
  87. data/tests/test_serialize_yaml.rb +2 -2
  88. metadata +78 -28
  89. data/lib/wx/shapes/serialize/core.rb +0 -40
  90. data/lib/wx/shapes/serialize/id.rb +0 -82
  91. data/lib/wx/shapes/serializer/json.rb +0 -258
  92. data/lib/wx/shapes/serializer/yaml.rb +0 -125
  93. data/samples/demo/art/sample.xpm +0 -251
  94. data/samples/sample1/art/sample.xpm +0 -251
  95. data/samples/sample2/art/sample.xpm +0 -251
  96. data/samples/sample3/art/sample.xpm +0 -251
  97. data/samples/sample4/art/sample.xpm +0 -251
@@ -2,445 +2,12 @@ require 'wx/shapes'
2
2
 
3
3
  module SerializerTestMixin
4
4
 
5
- class PropTest
6
-
7
- include Wx::SF::Serializable
8
-
9
- property :prop_a
10
- property prop_b: ->(obj, *val) { obj.instance_variable_set(:@prop_b, val.first) unless val.empty?; obj.instance_variable_get(:@prop_b) }
11
- property prop_c: :serialize_prop_c
12
- property(:prop_d, :prop_e) do |id, obj, *val|
13
- case id
14
- when :prop_d
15
- obj.instance_variable_set('@prop_d', val.first) unless val.empty?
16
- obj.instance_variable_get('@prop_d')
17
- when :prop_e
18
- obj.instance_variable_set('@prop_e', val.first) unless val.empty?
19
- obj.instance_variable_get('@prop_e')
20
- end
21
- end
22
- property :prop_f, :prop_g, handler: :serialize_props_f_and_g
23
-
24
- def initialize
25
- @prop_a = 'string'
26
- @prop_b = 123
27
- @prop_c = :symbol
28
- @prop_d = 100.123
29
- @prop_e = [1,2,3]
30
- @prop_f = {_1: 1, _2: 2, _3: 3}
31
- @prop_g = 1..10
32
- end
33
-
34
- attr_accessor :prop_a
35
-
36
- def serialize_prop_c(*val)
37
- @prop_c = val.first unless val.empty?
38
- @prop_c
39
- end
40
- private :serialize_prop_c
41
-
42
- def serialize_props_f_and_g(id, *val)
43
- case id
44
- when :prop_f
45
- @prop_f = val.shift unless val.empty?
46
- @prop_f
47
- when :prop_g
48
- @prop_g = val.shift unless val.empty?
49
- @prop_g
50
- end
51
- end
52
-
53
- def ==(other)
54
- self.class === other &&
55
- @prop_a == other.prop_a &&
56
- @prop_b == other.instance_variable_get('@prop_b') &&
57
- @prop_c == other.instance_variable_get('@prop_c') &&
58
- @prop_d == other.instance_variable_get('@prop_d') &&
59
- @prop_e == other.instance_variable_get('@prop_e') &&
60
- @prop_g == other.instance_variable_get('@prop_g') &&
61
- @prop_f == other.instance_variable_get('@prop_f')
62
- end
63
- end
64
-
65
- def test_properties
66
- obj = PropTest.new
67
- obj_serial = obj.serialize
68
- obj_new = nil
69
- assert_nothing_raised { obj_new = Wx::SF::Serializable.deserialize(obj_serial) }
70
- assert_instance_of(PropTest, obj_new)
71
- assert_equal(obj, obj_new)
72
- end
73
-
74
- def test_wx_data
75
- obj = Wx::Point.new(10, 90)
76
- obj_serial = obj.serialize
77
- obj_new = nil
78
- assert_nothing_raised { obj_new = Wx::SF::Serializable.deserialize(obj_serial) }
79
- assert_instance_of(Wx::Point, obj_new)
80
- assert_equal(obj, obj_new)
81
-
82
- obj = Wx::RealPoint.new(10, 90)
83
- obj_serial = obj.serialize
84
- assert_nothing_raised { obj_new = Wx::SF::Serializable.deserialize(obj_serial) }
85
- assert_instance_of(Wx::RealPoint, obj_new)
86
- assert_equal(obj, obj_new)
87
-
88
- obj = Wx::Size.new(100, 900)
89
- obj_serial = obj.serialize
90
- assert_nothing_raised { obj_new = Wx::SF::Serializable.deserialize(obj_serial) }
91
- assert_instance_of(Wx::Size, obj_new)
92
- assert_equal(obj, obj_new)
93
-
94
- obj = Wx::Rect.new(10, 20, 100, 900)
95
- obj_serial = obj.serialize
96
- assert_nothing_raised { obj_new = Wx::SF::Serializable.deserialize(obj_serial) }
97
- assert_instance_of(Wx::Rect, obj_new)
98
- assert_equal(obj, obj_new)
99
-
100
- obj = Wx::Colour.new('red')
101
- obj_serial = obj.serialize
102
- assert_nothing_raised { obj_new = Wx::SF::Serializable.deserialize(obj_serial) }
103
- assert_instance_of(Wx::Colour, obj_new)
104
- assert_equal(obj, obj_new)
105
-
106
- obj = Wx::Pen.new('black')
107
- obj_serial = obj.serialize
108
- assert_nothing_raised { obj_new = Wx::SF::Serializable.deserialize(obj_serial) }
109
- assert_instance_of(Wx::Pen, obj_new)
110
- assert_equal(obj, obj_new)
111
- end
112
-
113
- def test_core
114
- obj = [Wx::Point.new(10, 90), Wx::Point.new(20, 80)]
115
- obj_serial = obj.serialize
116
- obj_new = nil
117
- assert_nothing_raised { obj_new = Wx::SF::Serializable.deserialize(obj_serial) }
118
- assert_equal(obj, obj_new)
119
-
120
- obj = { '1' => Wx::Point.new(10, 90), '2' => Wx::Point.new(20, 80) }
121
- obj_serial = obj.serialize
122
- assert_nothing_raised { obj_new = Wx::SF::Serializable.deserialize(obj_serial) }
123
- assert_equal(obj, obj_new)
124
-
125
- Struct.new('MyStruct', :one, :two) unless defined? Struct::MyStruct
126
- obj = Struct::MyStruct.new(one: Wx::Point.new(10, 90), two: Wx::Point.new(20, 80))
127
- obj_serial = obj.serialize
128
- assert_nothing_raised { obj_new = Wx::SF::Serializable.deserialize(obj_serial) }
129
- assert_equal(obj, obj_new)
130
-
131
- obj = ::Set.new(%i[one two three])
132
- obj_serial = obj.serialize
133
- assert_nothing_raised { obj_new = Wx::SF::Serializable.deserialize(obj_serial) }
134
- assert_equal(obj, obj_new)
135
-
136
- obj = OpenStruct.new(one: Wx::Point.new(10, 90), two: Wx::Point.new(20, 80))
137
- obj_serial = obj.serialize
138
- assert_nothing_raised { obj_new = Wx::SF::Serializable.deserialize(obj_serial) }
139
- assert_equal(obj, obj_new)
140
-
141
- obj = [1, nil, 2]
142
- obj_serial = obj.serialize
143
- assert_nothing_raised { obj_new = Wx::SF::Serializable.deserialize(obj_serial) }
144
- assert_equal(obj, obj_new)
145
- end
146
-
147
- class PointsOwner
148
- include Wx::SF::Serializable
149
-
150
- property :points
151
-
152
- def initialize(points = [])
153
- @points = points
154
- end
155
-
156
- attr_accessor :points
157
-
158
- def ==(other)
159
- self.class === other && @points == other.points
160
- end
161
- end
162
-
163
- def test_composition
164
- obj = PointsOwner.new([Wx::Point.new(10, 90), Wx::Point.new(20, 80)])
165
- obj_serial = obj.serialize
166
- obj_new = nil
167
- assert_nothing_raised { obj_new = Wx::SF::Serializable.deserialize(obj_serial) }
168
- assert_equal(obj, obj_new)
169
- end
170
-
171
- def test_connection_point
172
- obj = Wx::SF::ConnectionPoint.new(nil, Wx::SF::ConnectionPoint::CPTYPE::TOPLEFT)
173
- obj_serial = obj.serialize
174
- obj_new = nil
175
- assert_nothing_raised { obj_new = Wx::SF::Serializable.deserialize(obj_serial) }
176
- assert_instance_of(obj.class, obj_new)
177
- assert_equal(obj.type, obj_new.type)
178
- assert_equal(obj.relative_position, obj_new.relative_position)
179
- assert_equal(obj.ortho_direction, obj_new.ortho_direction)
180
- end
181
-
182
- class SerializedBase
183
- include Wx::SF::Serializable
184
-
185
- property :a
186
- property :b
187
- property :c
188
-
189
- def initialize(a=nil, b=nil, c=nil)
190
- @a = a
191
- @b = b
192
- @c = c
193
- end
194
-
195
- attr_accessor :a, :b, :c
196
-
197
- def ==(other)
198
- self.class === other && self.a == other.a && self.b == other.b && self.c == other.c
199
- end
200
- end
201
-
202
- class SerializedDerived < SerializedBase
203
- contains :d
204
- excludes :c
205
-
206
- def initialize(a=nil, b=nil, d=nil)
207
- super(a, b)
208
- @d = d
209
- self.c = 'FIXED'
210
- end
211
-
212
- attr_accessor :d
213
-
214
- def ==(other)
215
- super && self.d == other.d
216
- end
217
- end
218
-
219
- def test_exclusion
220
- obj = SerializedBase.new(1, :hello, 'World')
221
- obj_serial = obj.serialize
222
- obj_new = nil
223
- assert_nothing_raised { obj_new = Wx::SF::Serializable.deserialize(obj_serial) }
224
- assert_equal(obj, obj_new)
225
-
226
- obj = SerializedDerived.new(2, :derived, 103.50)
227
- obj_serial = obj.serialize
228
- assert_nothing_raised { obj_new = Wx::SF::Serializable.deserialize(obj_serial) }
229
- assert_equal(obj, obj_new)
230
- end
231
-
232
- class SerializedBase2
233
- include Wx::SF::Serializable
234
-
235
- property :list
236
-
237
- def initialize(list = [])
238
- @list = list
239
- end
240
-
241
- attr_reader :list
242
-
243
- def set_list(list)
244
- @list.insert(0, *(list || []))
245
- end
246
- private :set_list
247
-
248
- def ==(other)
249
- self.class === other && self.list == other.list
250
- end
251
- end
252
-
253
- class SerializedDerived2 < SerializedBase2
254
-
255
- def initialize(list = [])
256
- super
257
- @fixed_item = Wx::Point.new(30, 30)
258
- @fixed_item.disable_serialize
259
- self.list << @fixed_item
260
- end
261
-
262
- end
263
-
264
- class SerializedDerived2_1 < SerializedBase2
265
- property :extra_item, force: true
266
-
267
- def initialize(list = [], extra = nil)
268
- super(list)
269
- set_extra_item(extra)
270
- end
271
-
272
- attr_reader :extra_item
273
-
274
- def set_extra_item(extra)
275
- @extra_item = extra
276
- if @extra_item
277
- @extra_item.disable_serialize
278
- list << @extra_item
279
- end
280
- end
281
- private :set_extra_item
282
-
283
- def ==(other)
284
- super(other) && @extra_item == other.extra_item
285
- end
286
- end
287
-
288
- class SerializedBase3
289
- include Wx::SF::Serializable
290
-
291
- property :list
292
-
293
- def initialize(list = ::Set.new)
294
- @list = ::Set === list ? list : ::Set.new(list)
295
- end
296
-
297
- attr_reader :list
298
-
299
- def set_list(list)
300
- @list.merge(list || [])
301
- end
302
- private :set_list
303
-
304
- def ==(other)
305
- self.class === other && self.list == other.list
306
- end
307
- end
308
-
309
- class SerializedDerived3 < SerializedBase3
310
-
311
- def initialize(list = [])
312
- super
313
- @fixed_item = Wx::Point.new(30, 30)
314
- @fixed_item.disable_serialize
315
- self.list << @fixed_item
316
- end
317
-
318
- end
319
-
320
- def test_disable
321
- obj = SerializedBase2.new([Wx::Point.new(1,1), Wx::Point.new(2,2), Wx::Point.new(3,3)])
322
- obj_serial = obj.serialize
323
- obj_new = nil
324
- assert_nothing_raised { obj_new = Wx::SF::Serializable.deserialize(obj_serial) }
325
- assert_equal(obj, obj_new)
326
-
327
- obj = SerializedDerived2.new([Wx::Point.new(1,1), Wx::Point.new(2,2), Wx::Point.new(3,3)])
328
- obj_serial = obj.serialize
329
- assert_nothing_raised { obj_new = Wx::SF::Serializable.deserialize(obj_serial) }
330
- assert_equal(obj, obj_new)
331
-
332
- obj = SerializedDerived2_1.new([Wx::Point.new(1,1), Wx::Point.new(2,2), Wx::Point.new(3,3)], Wx::Size.new(40, 40))
333
- obj_serial = obj.serialize
334
- assert_nothing_raised { obj_new = Wx::SF::Serializable.deserialize(obj_serial) }
335
- assert_equal(obj, obj_new)
336
-
337
- obj = SerializedDerived3.new([Wx::Point.new(1,1), Wx::Point.new(2,2), Wx::Point.new(3,3)])
338
- obj_serial = obj.serialize
339
- assert_nothing_raised { obj_new = Wx::SF::Serializable.deserialize(obj_serial) }
340
- assert_equal(obj, obj_new)
341
- end
342
-
343
- class Identifiable
344
- include Wx::SF::Serializable
345
-
346
- property :id, :sym
347
-
348
- def initialize(sym = nil)
349
- @id = sym ? Wx::SF::Serializable::ID.new : nil
350
- @sym = sym
351
- end
352
-
353
- attr_accessor :sym
354
- attr_reader :id
355
-
356
- def set_id(id)
357
- @id = id
358
- end
359
- private :set_id
360
- end
361
-
362
- class Container
363
- include Wx::SF::Serializable
364
-
365
- property :map
366
-
367
- def initialize(map = {})
368
- @map = map
369
- end
370
-
371
- attr_reader :map
372
-
373
- def set_map(map)
374
- @map.replace(map)
375
- end
376
- private :set_map
377
- end
378
-
379
- class RefUser
380
- include Wx::SF::Serializable
381
-
382
- property :ref1, :ref2, :ref3
383
-
384
- def initialize(*rids)
385
- @ref1, @ref2, @ref3 = *rids
386
- end
387
-
388
- attr_accessor :ref1, :ref2, :ref3
389
- end
390
-
391
- def test_ids
392
- container = Container.new
393
- id_obj = Identifiable.new(:one)
394
- container.map[id_obj.id] = id_obj
395
- id_obj = Identifiable.new(:two)
396
- container.map[id_obj.id] = id_obj
397
- id_obj = Identifiable.new(:three)
398
- container.map[id_obj.id] = id_obj
399
- ref_obj = RefUser.new(*container.map.keys)
400
- obj_serial = [container, ref_obj].serialize
401
- obj_new = nil
402
- assert_nothing_raised { obj_new = Wx::SF::Serializable.deserialize(obj_serial) }
403
- assert_instance_of(Array, obj_new)
404
- assert_instance_of(Container, obj_new.first)
405
- assert_instance_of(RefUser, obj_new.last)
406
- assert_instance_of(Wx::SF::Serializable::ID, obj_new.last.ref1)
407
- assert_instance_of(Wx::SF::Serializable::ID, obj_new.last.ref2)
408
- assert_instance_of(Wx::SF::Serializable::ID, obj_new.last.ref3)
409
- assert_equal(:one, obj_new.first.map[obj_new.last.ref1].sym)
410
- assert_equal(:two, obj_new.first.map[obj_new.last.ref2].sym)
411
- assert_equal(:three, obj_new.first.map[obj_new.last.ref3].sym)
412
- end
413
-
414
- def test_nested_hash_with_complex_keys
415
- id_obj = Identifiable.new(:one)
416
- id_obj2 = Identifiable.new(:two)
417
- h = {
418
- [
419
- { id_obj.id => id_obj }
420
- ] => 'one',
421
- [
422
- { id_obj2.id => id_obj2 }
423
- ] => 'two'
424
- }
425
- obj_serial = h.serialize
426
- obj_new = nil
427
- assert_nothing_raised { obj_new = Wx::SF::Serializable.deserialize(obj_serial) }
428
- assert_instance_of(::Hash, obj_new)
429
- obj_new.each_pair do |k,v|
430
- assert_instance_of(::Array, k)
431
- assert_instance_of(::String, v)
432
- assert_instance_of(::Hash, k.first)
433
- assert_instance_of(Wx::SF::Serializable::ID, k.first.first.first)
434
- assert_equal(v, k.first[k.first.first.first].sym.to_s)
435
- end
436
- end
437
-
438
5
  def test_shape
439
6
  obj = Wx::SF::Shape.new
440
7
  obj.set_relative_position(Wx::RealPoint.new(100, 99))
441
8
  obj_serial = obj.serialize
442
9
  obj_new = nil
443
- assert_nothing_raised { obj_new = Wx::SF::Serializable.deserialize(obj_serial) }
10
+ assert_nothing_raised { obj_new = FIRM.deserialize(obj_serial) }
444
11
  assert_instance_of(Wx::SF::Shape, obj_new)
445
12
  assert_equal(obj.get_relative_position, obj_new.get_relative_position)
446
13
  end
@@ -451,14 +18,14 @@ module SerializerTestMixin
451
18
  obj.set_trg_arrow(Wx::SF::SolidArrow)
452
19
  obj_serial = obj.serialize
453
20
  obj_new = nil
454
- assert_nothing_raised { obj_new = Wx::SF::Serializable.deserialize(obj_serial) }
21
+ assert_nothing_raised { obj_new = FIRM.deserialize(obj_serial) }
455
22
  assert_instance_of(Wx::SF::LineShape, obj_new)
456
23
  assert_equal(obj.get_src_point, obj_new.get_src_point)
457
24
  assert_equal(obj.get_trg_point, obj_new.get_trg_point)
458
25
  assert_instance_of(Wx::SF::SolidArrow, obj_new.get_src_arrow)
459
- assert_equal(obj_new.id, obj_new.get_src_arrow.get_parent_shape.id)
26
+ assert_equal(obj_new.object_id, obj_new.get_src_arrow.get_parent_shape.object_id)
460
27
  assert_instance_of(Wx::SF::SolidArrow, obj_new.get_trg_arrow)
461
- assert_equal(obj_new.id, obj_new.get_trg_arrow.get_parent_shape.id)
28
+ assert_equal(obj_new.object_id, obj_new.get_trg_arrow.get_parent_shape.object_id)
462
29
  end
463
30
 
464
31
  def test_rect_shape
@@ -467,7 +34,7 @@ module SerializerTestMixin
467
34
  obj.set_rect_size(20.0, 20.0)
468
35
  obj_serial = obj.serialize
469
36
  obj_new = nil
470
- assert_nothing_raised { obj_new = Wx::SF::Serializable.deserialize(obj_serial) }
37
+ assert_nothing_raised { obj_new = FIRM.deserialize(obj_serial) }
471
38
  assert_instance_of(Wx::SF::RectShape, obj_new)
472
39
  assert_equal(obj.get_relative_position, obj_new.get_relative_position)
473
40
  assert_equal(Wx::RealPoint.new(20.0, 20.0), obj_new.get_rect_size)
@@ -481,9 +48,9 @@ module SerializerTestMixin
481
48
  obj.accept_child(Wx::SF::RectShape)
482
49
  assert(obj.append_to_grid(Wx::SF::RectShape.new)) # should be cell 0,0
483
50
  assert(obj.insert_to_grid(1, 0, Wx::SF::RectShape.new)) # cell 1,0
484
- obj_serial = obj.serialize
51
+ obj_serial = obj.serialize(pretty: true)
485
52
  obj_new = nil
486
- assert_nothing_raised { obj_new = Wx::SF::Serializable.deserialize(obj_serial) }
53
+ assert_nothing_raised { obj_new = FIRM.deserialize(obj_serial) }
487
54
  assert_instance_of(Wx::SF::GridShape, obj_new)
488
55
  assert_equal(obj.get_relative_position, obj_new.get_relative_position)
489
56
  assert_equal(Wx::RealPoint.new(20.0, 20.0), obj_new.get_rect_size)
@@ -501,7 +68,7 @@ module SerializerTestMixin
501
68
  obj.set_relative_position(Wx::RealPoint.new(100, 99))
502
69
  obj_serial = obj.serialize(pretty: true)
503
70
  obj_new = nil
504
- assert_nothing_raised { obj_new = Wx::SF::Serializable.deserialize(obj_serial) }
71
+ assert_nothing_raised { obj_new = FIRM.deserialize(obj_serial) }
505
72
  assert_instance_of(Wx::SF::BitmapShape, obj_new)
506
73
  assert_equal(obj.get_relative_position, obj_new.get_relative_position)
507
74
  assert(obj_new.instance_variable_get('@bitmap').ok?)
@@ -18,7 +18,7 @@ class GridShapeTests < Test::Unit::TestCase
18
18
  assert_instance_of(Wx::SF::RectShape, obj.get_managed_shape(1, 0))
19
19
  assert_nil(obj.get_managed_shape(1, 1))
20
20
  assert_nil(obj.get_managed_shape(1, 2))
21
- assert_nothing_raised { obj.do_children_layout }
21
+ assert_nothing_raised { obj.update }
22
22
  end
23
23
 
24
24
  def test_flex_grid_shape
@@ -35,7 +35,7 @@ class GridShapeTests < Test::Unit::TestCase
35
35
  assert_instance_of(Wx::SF::RectShape, obj.get_managed_shape(1, 0))
36
36
  assert_nil(obj.get_managed_shape(1, 1))
37
37
  assert_nil(obj.get_managed_shape(1, 2))
38
- assert_nothing_raised { obj.do_children_layout }
38
+ assert_nothing_raised { obj.update }
39
39
  end
40
40
 
41
41
 
@@ -0,0 +1,17 @@
1
+
2
+ require_relative './lib/wxapp_runner'
3
+ require_relative './serializer_tests'
4
+
5
+ class XMLSerializeTests < Test::Unit::TestCase
6
+
7
+ include SerializerTestMixin
8
+
9
+ def self.startup
10
+ FIRM::Serializable.default_format = :xml
11
+ end
12
+
13
+ def self.shutdown
14
+ FIRM::Serializable.default_format = nil
15
+ end
16
+
17
+ end
@@ -7,11 +7,11 @@ class YamlSerializeTests < Test::Unit::TestCase
7
7
  include SerializerTestMixin
8
8
 
9
9
  def self.startup
10
- Wx::SF::Serializable.default_format = :yaml
10
+ FIRM::Serializable.default_format = :yaml
11
11
  end
12
12
 
13
13
  def self.shutdown
14
- Wx::SF::Serializable.default_format = nil
14
+ FIRM::Serializable.default_format = nil
15
15
  end
16
16
 
17
17
  end