gir_ffi 0.6.7 → 0.7.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +7 -0
- data/{History.txt → Changelog.md} +93 -61
- data/{DESIGN.rdoc → DESIGN.md} +7 -7
- data/README.md +5 -7
- data/TODO.md +90 -0
- data/lib/ffi-glib.rb +0 -1
- data/lib/ffi-glib/array.rb +13 -29
- data/lib/ffi-glib/array_methods.rb +13 -0
- data/lib/ffi-glib/container_class_methods.rb +6 -1
- data/lib/ffi-glib/hash_table.rb +3 -2
- data/lib/ffi-glib/list.rb +3 -17
- data/lib/ffi-glib/list_methods.rb +22 -3
- data/lib/ffi-glib/ptr_array.rb +19 -19
- data/lib/ffi-glib/s_list.rb +3 -17
- data/lib/ffi-gobject.rb +10 -17
- data/lib/ffi-gobject/object.rb +19 -9
- data/lib/ffi-gobject/object_class.rb +14 -0
- data/lib/ffi-gobject/ruby_closure.rb +4 -5
- data/lib/ffi-gobject/value.rb +7 -5
- data/lib/ffi-gobject_introspection/i_vfunc_info.rb +1 -1
- data/lib/gir_ffi-base.rb +0 -2
- data/lib/gir_ffi-base/gobject.rb +1 -0
- data/lib/gir_ffi-base/gobject/lib.rb +1 -1
- data/lib/gir_ffi.rb +2 -0
- data/lib/gir_ffi/arg_helper.rb +18 -8
- data/lib/gir_ffi/builders/argument_builder.rb +62 -55
- data/lib/gir_ffi/builders/base_argument_builder.rb +52 -106
- data/lib/gir_ffi/builders/base_type_builder.rb +3 -3
- data/lib/gir_ffi/builders/c_to_ruby_convertor.rb +34 -0
- data/lib/gir_ffi/builders/callback_argument_builder.rb +73 -0
- data/lib/gir_ffi/builders/callback_builder.rb +19 -9
- data/lib/gir_ffi/builders/callback_return_value_builder.rb +54 -0
- data/lib/gir_ffi/builders/closure_convertor.rb +9 -0
- data/lib/gir_ffi/builders/closure_to_pointer_convertor.rb +9 -0
- data/lib/gir_ffi/builders/constructor_result_convertor.rb +9 -0
- data/lib/gir_ffi/builders/enum_builder.rb +16 -16
- data/lib/gir_ffi/builders/field_builder.rb +36 -15
- data/lib/gir_ffi/builders/function_builder.rb +32 -27
- data/lib/gir_ffi/builders/interface_builder.rb +14 -4
- data/lib/gir_ffi/builders/mapping_method_builder.rb +95 -43
- data/lib/gir_ffi/builders/module_builder.rb +22 -35
- data/lib/gir_ffi/builders/null_convertor.rb +9 -0
- data/lib/gir_ffi/builders/object_builder.rb +11 -14
- data/lib/gir_ffi/builders/property_builder.rb +107 -9
- data/lib/gir_ffi/builders/registered_type_builder.rb +2 -2
- data/lib/gir_ffi/builders/return_value_builder.rb +42 -33
- data/lib/gir_ffi/builders/ruby_to_c_convertor.rb +15 -0
- data/lib/gir_ffi/builders/signal_builder.rb +18 -58
- data/lib/gir_ffi/builders/struct_builder.rb +1 -2
- data/lib/gir_ffi/builders/type_builder.rb +1 -0
- data/lib/gir_ffi/builders/unintrospectable_builder.rb +4 -4
- data/lib/gir_ffi/builders/user_defined_builder.rb +151 -26
- data/lib/gir_ffi/builders/vfunc_builder.rb +57 -0
- data/lib/gir_ffi/builders/with_layout.rb +10 -8
- data/lib/gir_ffi/builders/with_methods.rb +1 -1
- data/lib/gir_ffi/callback_base.rb +42 -8
- data/lib/gir_ffi/class_base.rb +1 -2
- data/lib/gir_ffi/enum_base.rb +26 -4
- data/lib/gir_ffi/error_argument_info.rb +21 -0
- data/lib/gir_ffi/{setter_argument_info.rb → field_argument_info.rb} +2 -1
- data/lib/gir_ffi/g_type.rb +25 -0
- data/lib/gir_ffi/in_out_pointer.rb +3 -14
- data/lib/gir_ffi/in_pointer.rb +20 -21
- data/lib/gir_ffi/info_ext.rb +2 -0
- data/lib/gir_ffi/info_ext/i_callable_info.rb +0 -9
- data/lib/gir_ffi/info_ext/i_callback_info.rb +17 -0
- data/lib/gir_ffi/info_ext/i_function_info.rb +4 -0
- data/lib/gir_ffi/info_ext/i_property_info.rb +4 -0
- data/lib/gir_ffi/info_ext/i_registered_type_info.rb +1 -0
- data/lib/gir_ffi/info_ext/i_signal_info.rb +14 -16
- data/lib/gir_ffi/info_ext/i_type_info.rb +72 -34
- data/lib/gir_ffi/info_ext/i_vfunc_info.rb +12 -0
- data/lib/gir_ffi/info_ext/safe_constant_name.rb +3 -2
- data/lib/gir_ffi/interface_base.rb +8 -3
- data/lib/gir_ffi/module_base.rb +3 -5
- data/lib/gir_ffi/object_base.rb +8 -0
- data/lib/gir_ffi/receiver_argument_info.rb +21 -0
- data/lib/gir_ffi/receiver_type_info.rb +27 -0
- data/lib/gir_ffi/return_value_info.rb +23 -0
- data/lib/gir_ffi/signal_base.rb +1 -1
- data/lib/{ffi-glib → gir_ffi}/sized_array.rb +10 -6
- data/lib/gir_ffi/struct_base.rb +10 -9
- data/lib/gir_ffi/type_base.rb +1 -0
- data/lib/gir_ffi/type_map.rb +3 -0
- data/lib/gir_ffi/unintrospectable_type_info.rb +4 -1
- data/lib/gir_ffi/union_base.rb +4 -21
- data/lib/gir_ffi/user_data_argument_info.rb +21 -0
- data/lib/gir_ffi/user_data_type_info.rb +17 -0
- data/lib/gir_ffi/user_defined_type_info.rb +18 -4
- data/lib/gir_ffi/version.rb +1 -1
- data/lib/gir_ffi/vfunc_base.rb +8 -0
- data/lib/gir_ffi/vfunc_implementation.rb +11 -0
- data/lib/gir_ffi/zero_terminated.rb +18 -24
- data/test/base_test_helper.rb +2 -3
- data/test/ffi-glib/array_test.rb +3 -3
- data/test/ffi-glib/ruby_closure_test.rb +3 -3
- data/test/ffi-gobject/value_test.rb +15 -1
- data/test/ffi-gobject_test.rb +2 -1
- data/test/gir_ffi/arg_helper_test.rb +21 -2
- data/test/gir_ffi/builders/argument_builder_test.rb +213 -287
- data/test/gir_ffi/builders/base_argument_builder_test.rb +1 -1
- data/test/gir_ffi/builders/callback_builder_test.rb +26 -8
- data/test/gir_ffi/builders/field_builder_test.rb +18 -3
- data/test/gir_ffi/builders/function_builder_test.rb +30 -12
- data/test/gir_ffi/builders/interface_builder_test.rb +9 -0
- data/test/gir_ffi/builders/module_builder_test.rb +0 -39
- data/test/gir_ffi/builders/object_builder_test.rb +27 -27
- data/test/gir_ffi/builders/property_builder_test.rb +110 -0
- data/test/gir_ffi/builders/return_value_builder_test.rb +168 -200
- data/test/gir_ffi/builders/signal_builder_test.rb +58 -14
- data/test/gir_ffi/builders/struct_builder_test.rb +2 -41
- data/test/gir_ffi/builders/user_defined_builder_test.rb +88 -20
- data/test/gir_ffi/builders/vfunc_builder_test.rb +44 -0
- data/test/gir_ffi/g_type_test.rb +29 -0
- data/test/gir_ffi/in_pointer_test.rb +28 -9
- data/test/gir_ffi/info_ext/i_callable_info_test.rb +0 -9
- data/test/gir_ffi/info_ext/i_callback_info_test.rb +19 -0
- data/test/gir_ffi/info_ext/i_function_info_test.rb +9 -0
- data/test/gir_ffi/info_ext/i_signal_info_test.rb +8 -11
- data/test/gir_ffi/info_ext/i_type_info_test.rb +140 -16
- data/test/gir_ffi/interface_base_test.rb +9 -3
- data/test/gir_ffi/object_base_test.rb +1 -2
- data/test/{ffi-glib → gir_ffi}/sized_array_test.rb +28 -28
- data/test/gir_ffi/type_map_test.rb +1 -1
- data/test/gir_ffi/user_defined_type_info_test.rb +36 -4
- data/test/gir_ffi_test.rb +5 -5
- data/test/gir_ffi_test_helper.rb +4 -0
- data/test/integration/generated_gimarshallingtests_test.rb +163 -59
- data/test/integration/generated_gobject_test.rb +21 -8
- data/test/integration/generated_pango_test.rb +2 -2
- data/test/integration/generated_regress_test.rb +361 -101
- data/test/lib/autogen.sh +5 -1
- metadata +51 -35
- data/TODO.rdoc +0 -63
- data/lib/gir_ffi-base/gir_ffi/library.rb +0 -17
- data/lib/gir_ffi-base/gir_ffi/struct.rb +0 -27
data/test/gir_ffi_test.rb
CHANGED
@@ -67,11 +67,11 @@ describe GirFFI do
|
|
67
67
|
before do
|
68
68
|
@klass = Class.new GIMarshallingTests::OverridesObject
|
69
69
|
Object.const_set "DerivedB#{Sequence.next}", @klass
|
70
|
-
@gtype = GirFFI.define_type @klass do
|
71
|
-
install_property GObject.param_spec_int("foo", "foo bar",
|
72
|
-
|
73
|
-
|
74
|
-
|
70
|
+
@gtype = GirFFI.define_type @klass do |info|
|
71
|
+
info.install_property GObject.param_spec_int("foo", "foo bar",
|
72
|
+
"The Foo Bar Property",
|
73
|
+
10, 20, 15,
|
74
|
+
3)
|
75
75
|
end
|
76
76
|
end
|
77
77
|
|
data/test/gir_ffi_test_helper.rb
CHANGED
@@ -31,6 +31,10 @@ class Minitest::Test
|
|
31
31
|
get_introspection_data(namespace, klass).find_signal name
|
32
32
|
end
|
33
33
|
|
34
|
+
def get_vfunc_introspection_data namespace, klass, name
|
35
|
+
get_introspection_data(namespace, klass).find_vfunc name
|
36
|
+
end
|
37
|
+
|
34
38
|
SAVED_MODULES = {}
|
35
39
|
|
36
40
|
def save_module name
|
@@ -7,6 +7,16 @@ GirFFI.setup :GIMarshallingTests
|
|
7
7
|
|
8
8
|
# Tests generated methods and functions in the GIMarshallingTests namespace.
|
9
9
|
describe GIMarshallingTests do
|
10
|
+
let(:derived_klass) { Object.const_set("DerivedClass#{Sequence.next}",
|
11
|
+
Class.new(GIMarshallingTests::Object)) }
|
12
|
+
|
13
|
+
def make_derived_instance
|
14
|
+
GirFFI.define_type derived_klass do |info|
|
15
|
+
yield info if block_given?
|
16
|
+
end
|
17
|
+
derived_klass.new
|
18
|
+
end
|
19
|
+
|
10
20
|
describe "GIMarshallingTests::BoxedStruct" do
|
11
21
|
let(:instance) { GIMarshallingTests::BoxedStruct.new }
|
12
22
|
|
@@ -183,19 +193,30 @@ describe GIMarshallingTests do
|
|
183
193
|
|
184
194
|
describe "GIMarshallingTests::Interface" do
|
185
195
|
it "has a working method #test_int8_in" do
|
186
|
-
|
196
|
+
derived_klass.class_eval { include GIMarshallingTests::Interface }
|
197
|
+
instance = make_derived_instance do |info|
|
198
|
+
info.install_vfunc_implementation :test_int8_in, proc {|obj, in_| obj.int = in_ }
|
199
|
+
end
|
200
|
+
instance.test_int8_in 8
|
201
|
+
instance.int.must_equal 8
|
187
202
|
end
|
188
203
|
end
|
189
204
|
|
190
205
|
describe "GIMarshallingTests::Interface2" do
|
191
|
-
it "must be tested" do
|
192
|
-
skip "
|
206
|
+
it "must be tested for clashes with Interface" do
|
207
|
+
skip "Needs more work to determine desired behavior"
|
193
208
|
end
|
194
209
|
end
|
195
210
|
|
196
211
|
describe "GIMarshallingTests::Interface3" do
|
197
212
|
it "has a working method #test_variant_array_in" do
|
198
|
-
|
213
|
+
derived_klass.class_eval { include GIMarshallingTests::Interface3 }
|
214
|
+
instance = make_derived_instance do |info|
|
215
|
+
info.install_vfunc_implementation :test_variant_array_in, proc {|obj, in_|
|
216
|
+
obj.int = in_.to_a.first.get_byte }
|
217
|
+
end
|
218
|
+
instance.test_variant_array_in [GLib::Variant.new_byte(42)]
|
219
|
+
instance.int.must_equal 42
|
199
220
|
end
|
200
221
|
end
|
201
222
|
|
@@ -325,8 +346,13 @@ describe GIMarshallingTests do
|
|
325
346
|
it "has a working method #get_ref_info_for_vfunc_return_object_transfer_none" do
|
326
347
|
skip "Needs vfunc setup"
|
327
348
|
end
|
349
|
+
|
328
350
|
it "has a working method #int8_in" do
|
329
|
-
|
351
|
+
derived_instance = make_derived_instance do |info|
|
352
|
+
info.install_vfunc_implementation :method_int8_in, proc {|obj, in_| obj.int = in_ }
|
353
|
+
end
|
354
|
+
derived_instance.int8_in 23
|
355
|
+
derived_instance.int.must_equal 23
|
330
356
|
end
|
331
357
|
|
332
358
|
it "has a working method #int8_out" do
|
@@ -367,19 +393,31 @@ describe GIMarshallingTests do
|
|
367
393
|
end
|
368
394
|
|
369
395
|
it "has a working method #method_int8_in" do
|
370
|
-
|
396
|
+
derived_instance = make_derived_instance do |info|
|
397
|
+
info.install_vfunc_implementation :method_int8_in, proc {|obj, in_| obj.int = in_ }
|
398
|
+
end
|
399
|
+
derived_instance.method_int8_in 108
|
400
|
+
derived_instance.int.must_equal 108
|
371
401
|
end
|
372
402
|
|
373
403
|
it "has a working method #method_int8_out" do
|
374
|
-
|
404
|
+
derived_instance = make_derived_instance do |info|
|
405
|
+
info.install_vfunc_implementation :method_int8_out, proc {|obj| 42 }
|
406
|
+
end
|
407
|
+
derived_instance.method_int8_out.must_equal 42
|
375
408
|
end
|
376
409
|
|
377
410
|
it "has a working method #method_str_arg_out_ret" do
|
378
|
-
skip "
|
411
|
+
skip unless get_vfunc_introspection_data("GIMarshallingTests", "Object",
|
412
|
+
"method_str_arg_out_ret")
|
413
|
+
derived_instance = make_derived_instance do |info|
|
414
|
+
info.install_vfunc_implementation :method_str_arg_out_ret, proc {|obj, arg| [arg, 42] }
|
415
|
+
end
|
416
|
+
derived_instance.method_str_arg_out_ret("foo").must_equal ["foo", 42]
|
379
417
|
end
|
380
418
|
|
381
419
|
it "has a working method #method_variant_array_in" do
|
382
|
-
skip "
|
420
|
+
skip "This function is only found in the header"
|
383
421
|
end
|
384
422
|
|
385
423
|
it "has a working method #method_with_default_implementation" do
|
@@ -405,44 +443,92 @@ describe GIMarshallingTests do
|
|
405
443
|
it "has a working method #vfunc_caller_allocated_out_parameter" do
|
406
444
|
skip "Needs vfunc setup"
|
407
445
|
end
|
446
|
+
|
408
447
|
it "has a working method #vfunc_meth_with_error" do
|
409
448
|
skip "Needs vfunc setup"
|
410
449
|
end
|
450
|
+
|
411
451
|
it "has a working method #vfunc_multiple_out_parameters" do
|
412
|
-
|
452
|
+
derived_instance = make_derived_instance do |info|
|
453
|
+
info.install_vfunc_implementation(
|
454
|
+
:vfunc_multiple_out_parameters,
|
455
|
+
proc {|*args| [42.1, -142.3] })
|
456
|
+
end
|
457
|
+
result = derived_instance.vfunc_multiple_out_parameters
|
458
|
+
result[0].must_be_close_to 42.1
|
459
|
+
result[1].must_be_close_to(-142.3)
|
413
460
|
end
|
461
|
+
|
414
462
|
it "has a working method #vfunc_one_out_parameter" do
|
415
|
-
|
463
|
+
derived_instance = make_derived_instance do |info|
|
464
|
+
info.install_vfunc_implementation(
|
465
|
+
:vfunc_one_out_parameter,
|
466
|
+
proc {|*args| 23.4 })
|
467
|
+
end
|
468
|
+
derived_instance.vfunc_one_out_parameter.
|
469
|
+
must_be_within_epsilon 23.4
|
416
470
|
end
|
471
|
+
|
417
472
|
it "has a working method #vfunc_out_enum" do
|
418
|
-
skip "
|
473
|
+
skip unless get_vfunc_introspection_data("GIMarshallingTests", "Object",
|
474
|
+
"vfunc_out_enum")
|
475
|
+
derived_instance = make_derived_instance do |info|
|
476
|
+
info.install_vfunc_implementation :vfunc_out_enum, proc {|obj| :value2 }
|
477
|
+
end
|
478
|
+
derived_instance.vfunc_out_enum.must_equal :value2
|
419
479
|
end
|
480
|
+
|
420
481
|
it "has a working method #vfunc_return_enum" do
|
421
|
-
skip "
|
482
|
+
skip unless get_vfunc_introspection_data("GIMarshallingTests", "Object",
|
483
|
+
"vfunc_return_enum")
|
484
|
+
derived_instance = make_derived_instance do |info|
|
485
|
+
info.install_vfunc_implementation :vfunc_return_enum, proc {|obj| :value2 }
|
486
|
+
end
|
487
|
+
derived_instance.vfunc_return_enum.must_equal :value2
|
422
488
|
end
|
489
|
+
|
423
490
|
it "has a working method #vfunc_return_value_and_multiple_out_parameters" do
|
424
|
-
|
491
|
+
derived_instance = make_derived_instance do |info|
|
492
|
+
info.install_vfunc_implementation(
|
493
|
+
:vfunc_return_value_and_multiple_out_parameters,
|
494
|
+
proc {|*args| [42, -142, 3] })
|
495
|
+
end
|
496
|
+
derived_instance.vfunc_return_value_and_multiple_out_parameters.
|
497
|
+
must_equal [42, -142, 3]
|
425
498
|
end
|
499
|
+
|
426
500
|
it "has a working method #vfunc_return_value_and_one_out_parameter" do
|
427
|
-
|
501
|
+
derived_instance = make_derived_instance do |info|
|
502
|
+
info.install_vfunc_implementation(
|
503
|
+
:vfunc_return_value_and_one_out_parameter,
|
504
|
+
proc {|*args| [42, -142] })
|
505
|
+
end
|
506
|
+
derived_instance.vfunc_return_value_and_one_out_parameter.
|
507
|
+
must_equal [42, -142]
|
428
508
|
end
|
509
|
+
|
429
510
|
it "has a working method #vfunc_return_value_only" do
|
430
|
-
|
511
|
+
derived_instance = make_derived_instance do |info|
|
512
|
+
info.install_vfunc_implementation :vfunc_return_value_only, proc {|obj| 0xdeadbeef }
|
513
|
+
end
|
514
|
+
result = derived_instance.vfunc_return_value_only
|
515
|
+
result.must_equal 0xdeadbeef
|
431
516
|
end
|
517
|
+
|
432
518
|
it "has a working method #vfunc_with_callback" do
|
433
519
|
skip "Needs vfunc setup"
|
434
520
|
end
|
435
521
|
|
436
522
|
describe "its 'int' property" do
|
437
523
|
it "can be retrieved with #get_property" do
|
438
|
-
assert_equal 42, instance.get_property("int")
|
524
|
+
assert_equal 42, instance.get_property("int").get_value
|
439
525
|
end
|
440
526
|
it "can be retrieved with #int" do
|
441
527
|
assert_equal 42, instance.int
|
442
528
|
end
|
443
529
|
it "can be set with #set_property" do
|
444
530
|
instance.set_property("int", 13)
|
445
|
-
assert_equal 13, instance.get_property("int")
|
531
|
+
assert_equal 13, instance.get_property("int").get_value
|
446
532
|
end
|
447
533
|
it "can be set with #int=" do
|
448
534
|
instance.int = 1
|
@@ -536,7 +622,7 @@ describe GIMarshallingTests do
|
|
536
622
|
|
537
623
|
describe "its 'some-boolean' property" do
|
538
624
|
it "can be retrieved with #get_property" do
|
539
|
-
instance.get_property("some-boolean").must_equal false
|
625
|
+
instance.get_property("some-boolean").get_value.must_equal false
|
540
626
|
end
|
541
627
|
|
542
628
|
it "can be retrieved with #some_boolean" do
|
@@ -545,12 +631,12 @@ describe GIMarshallingTests do
|
|
545
631
|
|
546
632
|
it "can be set with #set_property" do
|
547
633
|
instance.set_property("some-boolean", true)
|
548
|
-
instance.get_property("some-boolean").must_equal true
|
634
|
+
instance.get_property("some-boolean").get_value.must_equal true
|
549
635
|
end
|
550
636
|
|
551
637
|
it "can be set with #some_boolean=" do
|
552
638
|
instance.some_boolean = true
|
553
|
-
instance.get_property("some-boolean").must_equal true
|
639
|
+
instance.get_property("some-boolean").get_value.must_equal true
|
554
640
|
end
|
555
641
|
end
|
556
642
|
|
@@ -562,21 +648,22 @@ describe GIMarshallingTests do
|
|
562
648
|
end
|
563
649
|
|
564
650
|
it "can be retrieved with #get_property" do
|
565
|
-
instance.get_property("some-boxed-glist").must_equal nil
|
651
|
+
instance.get_property("some-boxed-glist").get_value.must_equal nil
|
566
652
|
end
|
567
653
|
|
568
654
|
it "can be retrieved with #some_boxed_glist" do
|
569
655
|
instance.some_boxed_glist.must_equal nil
|
570
656
|
end
|
571
657
|
|
572
|
-
it "can be set with #
|
573
|
-
instance.
|
574
|
-
instance.
|
658
|
+
it "can be set with #set_property_extended" do
|
659
|
+
instance.set_property_extended("some-boxed-glist", [1, 2, 3])
|
660
|
+
instance.some_boxed_glist.to_a.must_equal [1, 2, 3]
|
575
661
|
end
|
576
662
|
|
577
663
|
it "can be set with #some_boxed_glist=" do
|
578
664
|
instance.some_boxed_glist = [1, 2, 3]
|
579
665
|
instance.some_boxed_glist.to_a.must_equal [1, 2, 3]
|
666
|
+
instance.get_property_extended("some-boxed-glist").to_a.must_equal [1, 2, 3]
|
580
667
|
end
|
581
668
|
end
|
582
669
|
|
@@ -588,7 +675,7 @@ describe GIMarshallingTests do
|
|
588
675
|
end
|
589
676
|
|
590
677
|
it "can be retrieved with #get_property" do
|
591
|
-
instance.get_property("some-boxed-struct").must_equal nil
|
678
|
+
instance.get_property("some-boxed-struct").get_value.must_equal nil
|
592
679
|
end
|
593
680
|
|
594
681
|
it "can be retrieved with #some_boxed_struct" do
|
@@ -599,7 +686,7 @@ describe GIMarshallingTests do
|
|
599
686
|
boxed = GIMarshallingTests::BoxedStruct.new
|
600
687
|
boxed.long_ = 42
|
601
688
|
instance.set_property("some-boxed-struct", boxed)
|
602
|
-
instance.get_property("some-boxed-struct").long_.must_equal 42
|
689
|
+
instance.get_property("some-boxed-struct").get_value.long_.must_equal 42
|
603
690
|
end
|
604
691
|
|
605
692
|
it "can be set with #some_boxed_struct=" do
|
@@ -612,7 +699,7 @@ describe GIMarshallingTests do
|
|
612
699
|
|
613
700
|
describe "its 'some-char' property" do
|
614
701
|
it "can be retrieved with #get_property" do
|
615
|
-
instance.get_property("some-char").must_equal 0
|
702
|
+
instance.get_property("some-char").get_value.must_equal 0
|
616
703
|
end
|
617
704
|
|
618
705
|
it "can be retrieved with #some_char" do
|
@@ -621,7 +708,7 @@ describe GIMarshallingTests do
|
|
621
708
|
|
622
709
|
it "can be set with #set_property" do
|
623
710
|
instance.set_property "some-char", 42
|
624
|
-
instance.get_property("some-char").must_equal 42
|
711
|
+
instance.get_property("some-char").get_value.must_equal 42
|
625
712
|
end
|
626
713
|
|
627
714
|
it "can be set with #some_char=" do
|
@@ -632,7 +719,7 @@ describe GIMarshallingTests do
|
|
632
719
|
|
633
720
|
describe "its 'some-double' property" do
|
634
721
|
it "can be retrieved with #get_property" do
|
635
|
-
instance.get_property("some-double").must_equal 0.0
|
722
|
+
instance.get_property("some-double").get_value.must_equal 0.0
|
636
723
|
end
|
637
724
|
|
638
725
|
it "can be retrieved with #some_double" do
|
@@ -641,7 +728,7 @@ describe GIMarshallingTests do
|
|
641
728
|
|
642
729
|
it "can be set with #set_property" do
|
643
730
|
instance.set_property("some-double", 3.14)
|
644
|
-
instance.get_property("some-double").must_equal 3.14
|
731
|
+
instance.get_property("some-double").get_value.must_equal 3.14
|
645
732
|
end
|
646
733
|
|
647
734
|
it "can be set with #some_double=" do
|
@@ -652,7 +739,7 @@ describe GIMarshallingTests do
|
|
652
739
|
|
653
740
|
describe "its 'some-float' property" do
|
654
741
|
it "can be retrieved with #get_property" do
|
655
|
-
instance.get_property("some-float").must_equal 0.0
|
742
|
+
instance.get_property("some-float").get_value.must_equal 0.0
|
656
743
|
end
|
657
744
|
|
658
745
|
it "can be retrieved with #some_float" do
|
@@ -661,7 +748,7 @@ describe GIMarshallingTests do
|
|
661
748
|
|
662
749
|
it "can be set with #set_property" do
|
663
750
|
instance.set_property("some-float", 3.14)
|
664
|
-
instance.get_property("some-float").must_be_close_to 3.14
|
751
|
+
instance.get_property("some-float").get_value.must_be_close_to 3.14
|
665
752
|
end
|
666
753
|
|
667
754
|
it "can be set with #some_float=" do
|
@@ -672,7 +759,7 @@ describe GIMarshallingTests do
|
|
672
759
|
|
673
760
|
describe "its 'some-int' property" do
|
674
761
|
it "can be retrieved with #get_property" do
|
675
|
-
instance.get_property("some-int").must_equal 0
|
762
|
+
instance.get_property("some-int").get_value.must_equal 0
|
676
763
|
end
|
677
764
|
|
678
765
|
it "can be retrieved with #some_int" do
|
@@ -681,7 +768,7 @@ describe GIMarshallingTests do
|
|
681
768
|
|
682
769
|
it "can be set with #set_property" do
|
683
770
|
instance.set_property "some-int", 4242
|
684
|
-
instance.get_property("some-int").must_equal 4242
|
771
|
+
instance.get_property("some-int").get_value.must_equal 4242
|
685
772
|
end
|
686
773
|
|
687
774
|
it "can be set with #some_int=" do
|
@@ -692,7 +779,7 @@ describe GIMarshallingTests do
|
|
692
779
|
|
693
780
|
describe "its 'some-int64' property" do
|
694
781
|
it "can be retrieved with #get_property" do
|
695
|
-
instance.get_property("some-int64").must_equal 0
|
782
|
+
instance.get_property("some-int64").get_value.must_equal 0
|
696
783
|
end
|
697
784
|
|
698
785
|
it "can be retrieved with #some_int64" do
|
@@ -701,7 +788,7 @@ describe GIMarshallingTests do
|
|
701
788
|
|
702
789
|
it "can be set with #set_property" do
|
703
790
|
instance.set_property "some-int64", 42_000_000_000_000
|
704
|
-
instance.get_property("some-int64").must_equal 42_000_000_000_000
|
791
|
+
instance.get_property("some-int64").get_value.must_equal 42_000_000_000_000
|
705
792
|
end
|
706
793
|
|
707
794
|
it "can be set with #some_int64=" do
|
@@ -712,7 +799,7 @@ describe GIMarshallingTests do
|
|
712
799
|
|
713
800
|
describe "its 'some-long' property" do
|
714
801
|
it "can be retrieved with #get_property" do
|
715
|
-
instance.get_property("some-long").must_equal 0
|
802
|
+
instance.get_property("some-long").get_value.must_equal 0
|
716
803
|
end
|
717
804
|
|
718
805
|
it "can be retrieved with #some_long" do
|
@@ -721,7 +808,7 @@ describe GIMarshallingTests do
|
|
721
808
|
|
722
809
|
it "can be set with #set_property" do
|
723
810
|
instance.set_property "some-long", 4242
|
724
|
-
instance.get_property("some-long").must_equal 4242
|
811
|
+
instance.get_property("some-long").get_value.must_equal 4242
|
725
812
|
end
|
726
813
|
|
727
814
|
it "can be set with #some_long=" do
|
@@ -738,7 +825,7 @@ describe GIMarshallingTests do
|
|
738
825
|
end
|
739
826
|
|
740
827
|
it "can be retrieved with #get_property" do
|
741
|
-
instance.get_property("some-object").must_be_nil
|
828
|
+
instance.get_property("some-object").get_value.must_be_nil
|
742
829
|
end
|
743
830
|
|
744
831
|
it "can be retrieved with #some_object" do
|
@@ -748,7 +835,7 @@ describe GIMarshallingTests do
|
|
748
835
|
it "can be set with #set_property" do
|
749
836
|
ob = GIMarshallingTests::Object.new 42
|
750
837
|
instance.set_property "some-object", ob
|
751
|
-
instance.get_property("some-object").must_equal ob
|
838
|
+
instance.get_property("some-object").get_value.must_equal ob
|
752
839
|
end
|
753
840
|
|
754
841
|
it "can be set with #some_object=" do
|
@@ -766,16 +853,16 @@ describe GIMarshallingTests do
|
|
766
853
|
end
|
767
854
|
|
768
855
|
it "can be retrieved with #get_property" do
|
769
|
-
instance.get_property("some-strv").must_be :==, []
|
856
|
+
instance.get_property("some-strv").get_value.must_be :==, []
|
770
857
|
end
|
771
858
|
|
772
859
|
it "can be retrieved with #some_strv" do
|
773
860
|
instance.some_strv.must_be :==, []
|
774
861
|
end
|
775
862
|
|
776
|
-
it "can be set with #
|
777
|
-
instance.
|
778
|
-
instance.get_property("some-strv").must_be :==, ["foo", "bar"]
|
863
|
+
it "can be set with #set_property_extended" do
|
864
|
+
instance.set_property_extended("some-strv", ["foo", "bar"])
|
865
|
+
instance.get_property("some-strv").get_value.must_be :==, ["foo", "bar"]
|
779
866
|
end
|
780
867
|
|
781
868
|
it "can be set with #some_strv=" do
|
@@ -786,7 +873,7 @@ describe GIMarshallingTests do
|
|
786
873
|
|
787
874
|
describe "its 'some-uchar' property" do
|
788
875
|
it "can be retrieved with #get_property" do
|
789
|
-
instance.get_property("some-uchar").must_equal 0
|
876
|
+
instance.get_property("some-uchar").get_value.must_equal 0
|
790
877
|
end
|
791
878
|
|
792
879
|
it "can be retrieved with #some_uchar" do
|
@@ -795,7 +882,7 @@ describe GIMarshallingTests do
|
|
795
882
|
|
796
883
|
it "can be set with #set_property" do
|
797
884
|
instance.set_property "some-uchar", 42
|
798
|
-
instance.get_property("some-uchar").must_equal 42
|
885
|
+
instance.get_property("some-uchar").get_value.must_equal 42
|
799
886
|
end
|
800
887
|
|
801
888
|
it "can be set with #some_uchar=" do
|
@@ -806,7 +893,7 @@ describe GIMarshallingTests do
|
|
806
893
|
|
807
894
|
describe "its 'some-uuint' property" do
|
808
895
|
it "can be retrieved with #get_property" do
|
809
|
-
instance.get_property("some-uint").must_equal 0
|
896
|
+
instance.get_property("some-uint").get_value.must_equal 0
|
810
897
|
end
|
811
898
|
|
812
899
|
it "can be retrieved with #some_uint" do
|
@@ -815,7 +902,7 @@ describe GIMarshallingTests do
|
|
815
902
|
|
816
903
|
it "can be set with #set_property" do
|
817
904
|
instance.set_property "some-uint", 4242
|
818
|
-
instance.get_property("some-uint").must_equal 4242
|
905
|
+
instance.get_property("some-uint").get_value.must_equal 4242
|
819
906
|
end
|
820
907
|
|
821
908
|
it "can be set with #some_uint=" do
|
@@ -826,7 +913,7 @@ describe GIMarshallingTests do
|
|
826
913
|
|
827
914
|
describe "its 'some-uint64' property" do
|
828
915
|
it "can be retrieved with #get_property" do
|
829
|
-
instance.get_property("some-uint64").must_equal 0
|
916
|
+
instance.get_property("some-uint64").get_value.must_equal 0
|
830
917
|
end
|
831
918
|
|
832
919
|
it "can be retrieved with #some_uint64" do
|
@@ -835,7 +922,7 @@ describe GIMarshallingTests do
|
|
835
922
|
|
836
923
|
it "can be set with #set_property" do
|
837
924
|
instance.set_property "some-uint64", 42_000_000_000_000
|
838
|
-
instance.get_property("some-uint64").must_equal 42_000_000_000_000
|
925
|
+
instance.get_property("some-uint64").get_value.must_equal 42_000_000_000_000
|
839
926
|
end
|
840
927
|
|
841
928
|
it "can be set with #some_uint64=" do
|
@@ -846,7 +933,7 @@ describe GIMarshallingTests do
|
|
846
933
|
|
847
934
|
describe "its 'some-ulong' property" do
|
848
935
|
it "can be retrieved with #get_property" do
|
849
|
-
instance.get_property("some-ulong").must_equal 0
|
936
|
+
instance.get_property("some-ulong").get_value.must_equal 0
|
850
937
|
end
|
851
938
|
|
852
939
|
it "can be retrieved with #some_ulong" do
|
@@ -855,7 +942,7 @@ describe GIMarshallingTests do
|
|
855
942
|
|
856
943
|
it "can be set with #set_property" do
|
857
944
|
instance.set_property "some-ulong", 4242
|
858
|
-
instance.get_property("some-ulong").must_equal 4242
|
945
|
+
instance.get_property("some-ulong").get_value.must_equal 4242
|
859
946
|
end
|
860
947
|
|
861
948
|
it "can be set with #some_ulong=" do
|
@@ -872,7 +959,7 @@ describe GIMarshallingTests do
|
|
872
959
|
end
|
873
960
|
|
874
961
|
it "can be retrieved with #get_property" do
|
875
|
-
instance.get_property("some-variant").must_be_nil
|
962
|
+
instance.get_property("some-variant").get_value.must_be_nil
|
876
963
|
end
|
877
964
|
|
878
965
|
it "can be retrieved with #some_variant" do
|
@@ -882,7 +969,7 @@ describe GIMarshallingTests do
|
|
882
969
|
it "can be set with #set_property" do
|
883
970
|
value = GLib::Variant.new_string("Foo")
|
884
971
|
instance.set_property "some-variant", value
|
885
|
-
instance.get_property("some-variant").must_equal value
|
972
|
+
instance.get_property("some-variant").get_value.must_equal value
|
886
973
|
end
|
887
974
|
|
888
975
|
it "can be set with #some_variant=" do
|
@@ -1299,19 +1386,29 @@ describe GIMarshallingTests do
|
|
1299
1386
|
end
|
1300
1387
|
|
1301
1388
|
it "has a working function #callback_multiple_out_parameters" do
|
1302
|
-
|
1389
|
+
result = GIMarshallingTests.callback_multiple_out_parameters proc { |*args|
|
1390
|
+
[12.0, 13.0]
|
1391
|
+
}
|
1392
|
+
result.must_equal [12.0, 13.0]
|
1303
1393
|
end
|
1304
1394
|
|
1305
1395
|
it "has a working function #callback_one_out_parameter" do
|
1306
|
-
|
1396
|
+
result = GIMarshallingTests.callback_one_out_parameter proc { 42.0 }
|
1397
|
+
result.must_equal 42.0
|
1307
1398
|
end
|
1308
1399
|
|
1309
1400
|
it "has a working function #callback_return_value_and_multiple_out_parameters" do
|
1310
|
-
|
1401
|
+
result = GIMarshallingTests.callback_return_value_and_multiple_out_parameters proc { |*args|
|
1402
|
+
[42, -142, 3]
|
1403
|
+
}
|
1404
|
+
result.must_equal [42, -142, 3]
|
1311
1405
|
end
|
1312
1406
|
|
1313
1407
|
it "has a working function #callback_return_value_and_one_out_parameter" do
|
1314
|
-
|
1408
|
+
result = GIMarshallingTests.callback_return_value_and_one_out_parameter proc { |*args|
|
1409
|
+
[42, -142]
|
1410
|
+
}
|
1411
|
+
result.must_equal [42, -142]
|
1315
1412
|
end
|
1316
1413
|
|
1317
1414
|
it "has a working function #callback_return_value_only" do
|
@@ -1906,6 +2003,13 @@ describe GIMarshallingTests do
|
|
1906
2003
|
pass
|
1907
2004
|
end
|
1908
2005
|
|
2006
|
+
it "has a working function #gvalue_in_with_modification" do
|
2007
|
+
skip unless get_introspection_data 'GIMarshallingTests', 'gvalue_in_with_modification'
|
2008
|
+
gv = GObject::Value.wrap_ruby_value(42)
|
2009
|
+
GIMarshallingTests.gvalue_in_with_modification gv
|
2010
|
+
gv.get_value.must_equal 24
|
2011
|
+
end
|
2012
|
+
|
1909
2013
|
it "has a working function #gvalue_in_with_type" do
|
1910
2014
|
gv = GObject::Value.new
|
1911
2015
|
gv.init GIMarshallingTests::SubSubObject.get_gtype
|