gir_ffi 0.6.3 → 0.6.4
Sign up to get free protection for your applications and to get access to all the features.
- data/History.txt +11 -0
- data/README.md +24 -6
- data/lib/ffi-glib/ptr_array.rb +17 -1
- data/lib/ffi-glib/variant.rb +15 -0
- data/lib/ffi-glib.rb +1 -0
- data/lib/ffi-gobject/object.rb +1 -1
- data/lib/ffi-gobject/ruby_closure.rb +1 -1
- data/lib/ffi-gobject/value.rb +13 -3
- data/lib/ffi-gobject.rb +1 -2
- data/lib/ffi-gobject_introspection/i_enum_info.rb +14 -0
- data/lib/ffi-gobject_introspection/lib.rb +2 -0
- data/lib/gir_ffi/arg_helper.rb +2 -0
- data/lib/gir_ffi/argument_builder.rb +22 -21
- data/lib/gir_ffi/base_argument_builder.rb +2 -1
- data/lib/gir_ffi/builder/module.rb +2 -3
- data/lib/gir_ffi/builder/type/enum.rb +18 -1
- data/lib/gir_ffi/builder/type/object.rb +20 -18
- data/lib/gir_ffi/class_base.rb +0 -1
- data/lib/gir_ffi/enum_base.rb +25 -0
- data/lib/gir_ffi/ffi_ext.rb +1 -0
- data/lib/gir_ffi/function_builder.rb +50 -33
- data/lib/gir_ffi/in_out_pointer.rb +0 -5
- data/lib/gir_ffi/in_pointer.rb +7 -5
- data/lib/gir_ffi/info_ext/i_callable_info.rb +4 -0
- data/lib/gir_ffi/info_ext/i_enum_info.rb +13 -0
- data/lib/gir_ffi/info_ext/i_field_info.rb +1 -1
- data/lib/gir_ffi/info_ext/i_object_info.rb +11 -0
- data/lib/gir_ffi/info_ext/i_registered_type_info.rb +11 -0
- data/lib/gir_ffi/info_ext/i_struct_info.rb +11 -0
- data/lib/gir_ffi/info_ext/i_type_info.rb +10 -19
- data/lib/gir_ffi/info_ext/i_union_info.rb +12 -0
- data/lib/gir_ffi/info_ext/safe_constant_name.rb +0 -2
- data/lib/gir_ffi/info_ext.rb +4 -0
- data/lib/gir_ffi/interface_base.rb +0 -1
- data/lib/gir_ffi/return_value_builder.rb +3 -2
- data/lib/gir_ffi/type_map.rb +3 -0
- data/lib/gir_ffi/version.rb +1 -1
- data/lib/gir_ffi/zero_terminated.rb +36 -3
- data/lib/gir_ffi-base/gir_ffi/library.rb +17 -0
- data/lib/gir_ffi-base/gobject/lib.rb +2 -2
- data/lib/gir_ffi.rb +1 -0
- data/tasks/test.rake +1 -0
- data/test/base_test_helper.rb +22 -2
- data/test/ffi-glib/ruby_closure_test.rb +1 -1
- data/test/ffi-glib/variant_test.rb +10 -0
- data/test/ffi-gobject/value_test.rb +24 -8
- data/test/ffi-gobject_introspection/i_enum_info_test.rb +17 -0
- data/test/gir_ffi/argument_builder_test.rb +66 -24
- data/test/gir_ffi/builder_test.rb +1 -1
- data/test/gir_ffi/function_builder_test.rb +1 -3
- data/test/gir_ffi/in_out_pointer_test.rb +5 -3
- data/test/gir_ffi/in_pointer_test.rb +32 -2
- data/test/gir_ffi/info_ext/i_arg_info_test.rb +2 -2
- data/test/gir_ffi/info_ext/i_callable_info_test.rb +2 -2
- data/test/gir_ffi/info_ext/i_field_info_test.rb +14 -20
- data/test/gir_ffi/info_ext/i_function_info_test.rb +2 -2
- data/test/gir_ffi/info_ext/i_signal_info_test.rb +2 -2
- data/test/gir_ffi/info_ext/i_type_info_test.rb +8 -8
- data/test/gir_ffi/info_ext/safe_constant_name_test.rb +2 -2
- data/test/gir_ffi/info_ext/safe_function_name_test.rb +2 -2
- data/test/gir_ffi/return_value_builder_test.rb +18 -1
- data/test/gir_ffi/zero_terminated_test.rb +10 -0
- data/test/gir_ffi_test_helper.rb +0 -19
- data/test/integration/generated_gimarshallingtests_test.rb +291 -99
- data/test/integration/generated_regress_test.rb +138 -14
- data/test/lib/autogen.sh +6 -2
- metadata +14 -2
@@ -125,19 +125,26 @@ describe GIMarshallingTests do
|
|
125
125
|
end
|
126
126
|
|
127
127
|
it "has a working function #in" do
|
128
|
-
|
128
|
+
GIMarshallingTests::Flags.in :value2
|
129
129
|
end
|
130
|
+
|
130
131
|
it "has a working function #in_zero" do
|
131
|
-
|
132
|
+
GIMarshallingTests::Flags.in_zero 0
|
132
133
|
end
|
134
|
+
|
133
135
|
it "has a working function #inout" do
|
134
|
-
|
136
|
+
result = GIMarshallingTests::Flags.inout :value2
|
137
|
+
result.must_equal :value1
|
135
138
|
end
|
139
|
+
|
136
140
|
it "has a working function #out" do
|
137
|
-
|
141
|
+
result = GIMarshallingTests::Flags.out
|
142
|
+
result.must_equal :value2
|
138
143
|
end
|
144
|
+
|
139
145
|
it "has a working function #returnv" do
|
140
|
-
|
146
|
+
result = GIMarshallingTests::Flags.returnv
|
147
|
+
result.must_equal :value2
|
141
148
|
end
|
142
149
|
end
|
143
150
|
|
@@ -145,41 +152,50 @@ describe GIMarshallingTests do
|
|
145
152
|
it "has the member :value1" do
|
146
153
|
assert_equal 0, GIMarshallingTests::GEnum[:value1]
|
147
154
|
end
|
155
|
+
|
148
156
|
it "has the member :value2" do
|
149
157
|
assert_equal 1, GIMarshallingTests::GEnum[:value2]
|
150
158
|
end
|
159
|
+
|
151
160
|
it "has the member :value3" do
|
152
161
|
assert_equal 42, GIMarshallingTests::GEnum[:value3]
|
153
162
|
end
|
163
|
+
|
154
164
|
it "has a working function #in" do
|
155
|
-
|
165
|
+
GIMarshallingTests::GEnum.in :value3
|
156
166
|
end
|
167
|
+
|
157
168
|
it "has a working function #inout" do
|
158
|
-
|
169
|
+
result = GIMarshallingTests::GEnum.inout :value3
|
170
|
+
result.must_equal :value1
|
159
171
|
end
|
172
|
+
|
160
173
|
it "has a working function #out" do
|
161
|
-
|
174
|
+
result = GIMarshallingTests::GEnum.out
|
175
|
+
result.must_equal :value3
|
162
176
|
end
|
177
|
+
|
163
178
|
it "has a working function #returnv" do
|
164
|
-
|
179
|
+
result = GIMarshallingTests::GEnum.returnv
|
180
|
+
result.must_equal :value3
|
165
181
|
end
|
166
182
|
end
|
167
183
|
|
168
184
|
describe "GIMarshallingTests::Interface" do
|
169
185
|
it "has a working method #test_int8_in" do
|
170
|
-
skip
|
186
|
+
skip "Interfaces cannot be tested directly"
|
171
187
|
end
|
172
188
|
end
|
173
189
|
|
174
190
|
describe "GIMarshallingTests::Interface2" do
|
175
191
|
it "must be tested" do
|
176
|
-
skip
|
192
|
+
skip "Interfaces cannot be tested directly"
|
177
193
|
end
|
178
194
|
end
|
179
195
|
|
180
196
|
describe "GIMarshallingTests::Interface3" do
|
181
197
|
it "has a working method #test_variant_array_in" do
|
182
|
-
skip
|
198
|
+
skip "Interfaces cannot be tested directly"
|
183
199
|
end
|
184
200
|
end
|
185
201
|
|
@@ -280,6 +296,24 @@ describe GIMarshallingTests do
|
|
280
296
|
skip "This function is only found in the header"
|
281
297
|
end
|
282
298
|
|
299
|
+
it "has a working method #get_ref_info_for_vfunc_in_object_transfer_full" do
|
300
|
+
skip "Needs vfunc setup"
|
301
|
+
end
|
302
|
+
it "has a working method #get_ref_info_for_vfunc_in_object_transfer_none" do
|
303
|
+
skip "Needs vfunc setup"
|
304
|
+
end
|
305
|
+
it "has a working method #get_ref_info_for_vfunc_out_object_transfer_full" do
|
306
|
+
skip "Needs vfunc setup"
|
307
|
+
end
|
308
|
+
it "has a working method #get_ref_info_for_vfunc_out_object_transfer_none" do
|
309
|
+
skip "Needs vfunc setup"
|
310
|
+
end
|
311
|
+
it "has a working method #get_ref_info_for_vfunc_return_object_transfer_full" do
|
312
|
+
skip "Needs vfunc setup"
|
313
|
+
end
|
314
|
+
it "has a working method #get_ref_info_for_vfunc_return_object_transfer_none" do
|
315
|
+
skip "Needs vfunc setup"
|
316
|
+
end
|
283
317
|
it "has a working method #int8_in" do
|
284
318
|
skip "Needs vfunc setup"
|
285
319
|
end
|
@@ -314,6 +348,14 @@ describe GIMarshallingTests do
|
|
314
348
|
assert_equal [-1, 0, 1, 2], res.to_a
|
315
349
|
end
|
316
350
|
|
351
|
+
it "has a working method #method_int8_arg_and_out_callee" do
|
352
|
+
skip "Needs vfunc setup"
|
353
|
+
end
|
354
|
+
|
355
|
+
it "has a working method #method_int8_arg_and_out_caller" do
|
356
|
+
skip "Needs vfunc setup"
|
357
|
+
end
|
358
|
+
|
317
359
|
it "has a working method #method_int8_in" do
|
318
360
|
skip "Needs vfunc setup"
|
319
361
|
end
|
@@ -322,6 +364,10 @@ describe GIMarshallingTests do
|
|
322
364
|
skip "Needs vfunc setup"
|
323
365
|
end
|
324
366
|
|
367
|
+
it "has a working method #method_str_arg_out_ret" do
|
368
|
+
skip "Needs vfunc setup"
|
369
|
+
end
|
370
|
+
|
325
371
|
it "has a working method #method_variant_array_in" do
|
326
372
|
skip "Needs vfunc setup"
|
327
373
|
end
|
@@ -342,6 +388,10 @@ describe GIMarshallingTests do
|
|
342
388
|
pass
|
343
389
|
end
|
344
390
|
|
391
|
+
it "has a working method #vfunc_array_out_parameter" do
|
392
|
+
skip "Needs vfunc setup"
|
393
|
+
end
|
394
|
+
|
345
395
|
it "has a working method #vfunc_caller_allocated_out_parameter" do
|
346
396
|
skip "Needs vfunc setup"
|
347
397
|
end
|
@@ -354,6 +404,12 @@ describe GIMarshallingTests do
|
|
354
404
|
it "has a working method #vfunc_one_out_parameter" do
|
355
405
|
skip "Needs vfunc setup"
|
356
406
|
end
|
407
|
+
it "has a working method #vfunc_out_enum" do
|
408
|
+
skip "Needs vfunc setup"
|
409
|
+
end
|
410
|
+
it "has a working method #vfunc_return_enum" do
|
411
|
+
skip "Needs vfunc setup"
|
412
|
+
end
|
357
413
|
it "has a working method #vfunc_return_value_and_multiple_out_parameters" do
|
358
414
|
skip "Needs vfunc setup"
|
359
415
|
end
|
@@ -643,22 +699,33 @@ describe GIMarshallingTests do
|
|
643
699
|
end
|
644
700
|
|
645
701
|
it "has a working function #array_gvariant_container_in" do
|
646
|
-
|
702
|
+
v1 = GLib::Variant.new_int32(27)
|
703
|
+
v2 = GLib::Variant.new_string("Hello")
|
704
|
+
result = GIMarshallingTests.array_gvariant_container_in [v1, v2]
|
705
|
+
arr = result.to_a
|
706
|
+
arr.size.must_equal 2
|
707
|
+
arr[0].get_int32.must_equal 27
|
708
|
+
arr[1].get_string.must_equal "Hello"
|
647
709
|
end
|
710
|
+
|
648
711
|
it "has a working function #array_gvariant_full_in" do
|
649
|
-
|
712
|
+
v1 = GLib::Variant.new_int32(27)
|
713
|
+
v2 = GLib::Variant.new_string("Hello")
|
714
|
+
result = GIMarshallingTests.array_gvariant_full_in [v1, v2]
|
715
|
+
arr = result.to_a
|
716
|
+
arr.size.must_equal 2
|
717
|
+
arr[0].get_int32.must_equal 27
|
718
|
+
arr[1].get_string.must_equal "Hello"
|
650
719
|
end
|
651
720
|
|
652
721
|
it "has a working function #array_gvariant_none_in" do
|
653
|
-
skip "Test was disabled the return value was never correct"
|
654
722
|
v1 = GLib::Variant.new_int32(27)
|
655
723
|
v2 = GLib::Variant.new_string("Hello")
|
656
|
-
GIMarshallingTests.array_gvariant_none_in [v1, v2]
|
657
|
-
|
658
|
-
|
659
|
-
|
660
|
-
|
661
|
-
# assert_equal "Hello", res[1].get_string
|
724
|
+
result = GIMarshallingTests.array_gvariant_none_in [v1, v2]
|
725
|
+
arr = result.to_a
|
726
|
+
arr.size.must_equal 2
|
727
|
+
arr[0].get_int32.must_equal 27
|
728
|
+
arr[1].get_string.must_equal "Hello"
|
662
729
|
end
|
663
730
|
|
664
731
|
it "has a working function #array_in" do
|
@@ -667,19 +734,29 @@ describe GIMarshallingTests do
|
|
667
734
|
end
|
668
735
|
|
669
736
|
it "has a working function #array_in_guint64_len" do
|
670
|
-
|
737
|
+
GIMarshallingTests.array_in_guint64_len [-1, 0, 1, 2]
|
738
|
+
pass
|
671
739
|
end
|
740
|
+
|
672
741
|
it "has a working function #array_in_guint8_len" do
|
673
|
-
|
742
|
+
GIMarshallingTests.array_in_guint8_len [-1, 0, 1, 2]
|
743
|
+
pass
|
674
744
|
end
|
745
|
+
|
675
746
|
it "has a working function #array_in_len_before" do
|
676
|
-
|
747
|
+
GIMarshallingTests.array_in_len_before [-1, 0, 1, 2]
|
748
|
+
pass
|
677
749
|
end
|
750
|
+
|
678
751
|
it "has a working function #array_in_len_zero_terminated" do
|
679
|
-
|
752
|
+
GIMarshallingTests.array_in_len_zero_terminated [-1, 0, 1, 2]
|
753
|
+
pass
|
680
754
|
end
|
755
|
+
|
681
756
|
it "has a working function #array_in_nonzero_nonlen" do
|
682
|
-
skip
|
757
|
+
skip unless get_introspection_data 'GIMarshallingTests', 'array_in_nonzero_nonlen'
|
758
|
+
GIMarshallingTests.array_in_nonzero_nonlen 1, 'abcd'.bytes.to_a
|
759
|
+
pass
|
683
760
|
end
|
684
761
|
|
685
762
|
it "has a working function #array_inout" do
|
@@ -688,7 +765,9 @@ describe GIMarshallingTests do
|
|
688
765
|
end
|
689
766
|
|
690
767
|
it "has a working function #array_inout_etc" do
|
691
|
-
|
768
|
+
arr, sum = GIMarshallingTests.array_inout_etc 42, [-1, 0, 1, 2], 24
|
769
|
+
arr.to_a.must_equal [42, -1, 0, 1, 24]
|
770
|
+
sum.must_equal 42 + 24
|
692
771
|
end
|
693
772
|
|
694
773
|
it "has a working function #array_out" do
|
@@ -697,7 +776,9 @@ describe GIMarshallingTests do
|
|
697
776
|
end
|
698
777
|
|
699
778
|
it "has a working function #array_out_etc" do
|
700
|
-
|
779
|
+
arr, sum = GIMarshallingTests.array_out_etc 42, 24
|
780
|
+
arr.to_a.must_equal [42, 0, 1, 24]
|
781
|
+
sum.must_equal 42 + 24
|
701
782
|
end
|
702
783
|
|
703
784
|
it "has a working function #array_return" do
|
@@ -706,10 +787,13 @@ describe GIMarshallingTests do
|
|
706
787
|
end
|
707
788
|
|
708
789
|
it "has a working function #array_return_etc" do
|
709
|
-
|
790
|
+
arr, sum = GIMarshallingTests.array_return_etc 42, 24
|
791
|
+
arr.to_a.must_equal [42, 0, 1, 24]
|
792
|
+
sum.must_equal 42 + 24
|
710
793
|
end
|
794
|
+
|
711
795
|
it "has a working function #array_simple_struct_in" do
|
712
|
-
skip
|
796
|
+
skip "Non-pointer arrays of complex types are not supported yet"
|
713
797
|
end
|
714
798
|
|
715
799
|
it "has a working function #array_string_in" do
|
@@ -718,10 +802,22 @@ describe GIMarshallingTests do
|
|
718
802
|
end
|
719
803
|
|
720
804
|
it "has a working function #array_struct_in" do
|
721
|
-
|
805
|
+
arr = [1, 2, 3].map { |val|
|
806
|
+
GIMarshallingTests::BoxedStruct.new.tap { |struct| struct.long_ = val }
|
807
|
+
}
|
808
|
+
GIMarshallingTests.array_struct_in arr
|
722
809
|
end
|
810
|
+
|
811
|
+
# NOTE: Should be run with valgrind. See gimarhallingtests.c.
|
723
812
|
it "has a working function #array_struct_take_in" do
|
724
|
-
|
813
|
+
arr = [1, 2, 3].map { |val|
|
814
|
+
GIMarshallingTests::BoxedStruct.new.tap { |struct| struct.long_ = val }
|
815
|
+
}
|
816
|
+
GIMarshallingTests.array_struct_take_in arr
|
817
|
+
end
|
818
|
+
|
819
|
+
it "has a working function #array_struct_value_in" do
|
820
|
+
skip "Non-pointer arrays of complex types are not supported yet"
|
725
821
|
end
|
726
822
|
|
727
823
|
it "has a working function #array_uint8_in" do
|
@@ -736,7 +832,8 @@ describe GIMarshallingTests do
|
|
736
832
|
end
|
737
833
|
|
738
834
|
it "has a working function #array_zero_terminated_inout" do
|
739
|
-
|
835
|
+
res = GIMarshallingTests.array_zero_terminated_inout ["0", "1", "2"]
|
836
|
+
res.to_a.must_equal ["-1", "0", "1", "2"]
|
740
837
|
end
|
741
838
|
|
742
839
|
it "has a working function #array_zero_terminated_out" do
|
@@ -750,10 +847,13 @@ describe GIMarshallingTests do
|
|
750
847
|
end
|
751
848
|
|
752
849
|
it "has a working function #array_zero_terminated_return_null" do
|
753
|
-
|
850
|
+
res = GIMarshallingTests.array_zero_terminated_return_null
|
851
|
+
res.to_a.must_equal []
|
754
852
|
end
|
853
|
+
|
755
854
|
it "has a working function #array_zero_terminated_return_struct" do
|
756
|
-
|
855
|
+
res = GIMarshallingTests.array_zero_terminated_return_struct
|
856
|
+
res.to_a.map(&:long_).must_equal [42, 43, 44]
|
757
857
|
end
|
758
858
|
|
759
859
|
it "has a working function #boolean_in_false" do
|
@@ -831,19 +931,24 @@ describe GIMarshallingTests do
|
|
831
931
|
end
|
832
932
|
|
833
933
|
it "has a working function #callback_multiple_out_parameters" do
|
834
|
-
skip
|
934
|
+
skip "Out parameters for callbacks are not supported yet"
|
835
935
|
end
|
936
|
+
|
836
937
|
it "has a working function #callback_one_out_parameter" do
|
837
|
-
skip
|
938
|
+
skip "Out parameters for callbacks are not supported yet"
|
838
939
|
end
|
940
|
+
|
839
941
|
it "has a working function #callback_return_value_and_multiple_out_parameters" do
|
840
|
-
skip
|
942
|
+
skip "Out parameters for callbacks are not supported yet"
|
841
943
|
end
|
944
|
+
|
842
945
|
it "has a working function #callback_return_value_and_one_out_parameter" do
|
843
|
-
skip
|
946
|
+
skip "Out parameters for callbacks are not supported yet"
|
844
947
|
end
|
948
|
+
|
845
949
|
it "has a working function #callback_return_value_only" do
|
846
|
-
|
950
|
+
result = GIMarshallingTests.callback_return_value_only lambda { 42 }
|
951
|
+
result.must_equal 42
|
847
952
|
end
|
848
953
|
|
849
954
|
it "has a working function #double_in" do
|
@@ -941,8 +1046,7 @@ describe GIMarshallingTests do
|
|
941
1046
|
end
|
942
1047
|
|
943
1048
|
it "has a working function #garray_int_none_in" do
|
944
|
-
arr =
|
945
|
-
arr.append_vals [-1, 0, 1, 2]
|
1049
|
+
arr = [-1, 0, 1, 2]
|
946
1050
|
GIMarshallingTests.garray_int_none_in arr
|
947
1051
|
pass
|
948
1052
|
end
|
@@ -953,13 +1057,20 @@ describe GIMarshallingTests do
|
|
953
1057
|
end
|
954
1058
|
|
955
1059
|
it "has a working function #garray_uint64_none_in" do
|
956
|
-
skip
|
1060
|
+
skip unless get_introspection_data 'GIMarshallingTests', 'garray_uint64_none_in'
|
1061
|
+
GIMarshallingTests.garray_uint64_none_in [0, 0xffff_ffff_ffff_ffff]
|
1062
|
+
pass
|
957
1063
|
end
|
1064
|
+
|
958
1065
|
it "has a working function #garray_uint64_none_return" do
|
959
|
-
skip
|
1066
|
+
skip unless get_introspection_data 'GIMarshallingTests', 'garray_uint64_none_return'
|
1067
|
+
res = GIMarshallingTests.garray_uint64_none_return
|
1068
|
+
res.to_a.must_equal [0, 0xffff_ffff_ffff_ffff]
|
960
1069
|
end
|
1070
|
+
|
961
1071
|
it "has a working function #garray_utf8_container_inout" do
|
962
|
-
|
1072
|
+
res = GIMarshallingTests.garray_utf8_container_inout ["0", "1", "2"]
|
1073
|
+
res.to_a.must_equal ["-2", "-1", "0", "1"]
|
963
1074
|
end
|
964
1075
|
|
965
1076
|
it "has a working function #garray_utf8_container_out" do
|
@@ -972,10 +1083,8 @@ describe GIMarshallingTests do
|
|
972
1083
|
assert_equal ["0", "1", "2"], res.to_a
|
973
1084
|
end
|
974
1085
|
|
975
|
-
# TODO: Allow regular arrays as arguments directly.
|
976
1086
|
it "has a working function #garray_utf8_full_inout" do
|
977
|
-
arr =
|
978
|
-
arr.append_vals ["0", "1", "2"]
|
1087
|
+
arr = ["0", "1", "2"]
|
979
1088
|
res = GIMarshallingTests.garray_utf8_full_inout arr
|
980
1089
|
assert_equal ["-2", "-1", "0", "1"], res.to_a
|
981
1090
|
end
|
@@ -985,21 +1094,26 @@ describe GIMarshallingTests do
|
|
985
1094
|
assert_equal ["0", "1", "2"], res.to_a
|
986
1095
|
end
|
987
1096
|
|
1097
|
+
it "has a working function #garray_utf8_full_out_caller_allocated" do
|
1098
|
+
skip unless get_introspection_data 'GIMarshallingTests',
|
1099
|
+
'garray_utf8_full_out_caller_allocated'
|
1100
|
+
res = GIMarshallingTests.garray_utf8_full_out_caller_allocated
|
1101
|
+
assert_equal ["0", "1", "2"], res.to_a
|
1102
|
+
end
|
1103
|
+
|
988
1104
|
it "has a working function #garray_utf8_full_return" do
|
989
1105
|
res = GIMarshallingTests.garray_utf8_full_return
|
990
1106
|
assert_equal ["0", "1", "2"], res.to_a
|
991
1107
|
end
|
992
1108
|
|
993
1109
|
it "has a working function #garray_utf8_none_in" do
|
994
|
-
arr =
|
995
|
-
arr.append_vals ["0", "1", "2"]
|
1110
|
+
arr = ["0", "1", "2"]
|
996
1111
|
GIMarshallingTests.garray_utf8_none_in arr
|
997
1112
|
pass
|
998
1113
|
end
|
999
1114
|
|
1000
1115
|
it "has a working function #garray_utf8_none_inout" do
|
1001
|
-
arr =
|
1002
|
-
arr.append_vals ["0", "1", "2"]
|
1116
|
+
arr = ["0", "1", "2"]
|
1003
1117
|
res = GIMarshallingTests.garray_utf8_none_inout arr
|
1004
1118
|
assert_equal ["-2", "-1", "0", "1"], res.to_a
|
1005
1119
|
end
|
@@ -1014,6 +1128,13 @@ describe GIMarshallingTests do
|
|
1014
1128
|
assert_equal ["0", "1", "2"], res.to_a
|
1015
1129
|
end
|
1016
1130
|
|
1131
|
+
it "has a working function #gbytes_full_return" do
|
1132
|
+
skip "GBytes is not supported yet"
|
1133
|
+
end
|
1134
|
+
it "has a working function #gbytes_none_in" do
|
1135
|
+
skip "GBytes is not supported yet"
|
1136
|
+
end
|
1137
|
+
|
1017
1138
|
it "has a working function #gclosure_in" do
|
1018
1139
|
cl = GObject::RubyClosure.new { 42 }
|
1019
1140
|
GIMarshallingTests.gclosure_in cl
|
@@ -1023,7 +1144,7 @@ describe GIMarshallingTests do
|
|
1023
1144
|
cl = GIMarshallingTests.gclosure_return
|
1024
1145
|
gv = GObject::Value.wrap_ruby_value 0
|
1025
1146
|
cl.invoke gv, nil, nil
|
1026
|
-
assert_equal 42, gv.
|
1147
|
+
assert_equal 42, gv.get_value
|
1027
1148
|
end
|
1028
1149
|
|
1029
1150
|
it "has a working function #genum_in" do
|
@@ -1049,27 +1170,36 @@ describe GIMarshallingTests do
|
|
1049
1170
|
it "has a working function #gerror" do
|
1050
1171
|
begin
|
1051
1172
|
GIMarshallingTests.gerror
|
1173
|
+
flunk "Error should have been raised"
|
1052
1174
|
rescue RuntimeError => e
|
1053
|
-
|
1175
|
+
e.message.must_equal GIMarshallingTests::CONSTANT_GERROR_MESSAGE
|
1054
1176
|
end
|
1055
1177
|
end
|
1056
1178
|
|
1057
1179
|
it "has a working function #gerror_array_in" do
|
1058
1180
|
begin
|
1059
1181
|
GIMarshallingTests.gerror_array_in [1, 2, 3]
|
1182
|
+
flunk "Error should have been raised"
|
1060
1183
|
rescue RuntimeError => e
|
1061
|
-
|
1184
|
+
e.message.must_equal GIMarshallingTests::CONSTANT_GERROR_MESSAGE
|
1062
1185
|
end
|
1063
1186
|
end
|
1064
1187
|
|
1065
1188
|
it "has a working function #gerror_out" do
|
1066
|
-
|
1189
|
+
error, debug = GIMarshallingTests.gerror_out
|
1190
|
+
debug.must_equal GIMarshallingTests::CONSTANT_GERROR_DEBUG_MESSAGE
|
1191
|
+
error.message.must_equal GIMarshallingTests::CONSTANT_GERROR_MESSAGE
|
1067
1192
|
end
|
1193
|
+
|
1068
1194
|
it "has a working function #gerror_out_transfer_none" do
|
1069
|
-
|
1195
|
+
error, debug = GIMarshallingTests.gerror_out_transfer_none
|
1196
|
+
debug.must_equal GIMarshallingTests::CONSTANT_GERROR_DEBUG_MESSAGE
|
1197
|
+
error.message.must_equal GIMarshallingTests::CONSTANT_GERROR_MESSAGE
|
1070
1198
|
end
|
1199
|
+
|
1071
1200
|
it "has a working function #gerror_return" do
|
1072
|
-
|
1201
|
+
error = GIMarshallingTests.gerror_return
|
1202
|
+
error.message.must_equal GIMarshallingTests::CONSTANT_GERROR_MESSAGE
|
1073
1203
|
end
|
1074
1204
|
|
1075
1205
|
it "has a working function #ghashtable_int_none_in" do
|
@@ -1161,10 +1291,15 @@ describe GIMarshallingTests do
|
|
1161
1291
|
end
|
1162
1292
|
|
1163
1293
|
it "has a working function #glist_uint32_none_in" do
|
1164
|
-
skip
|
1294
|
+
skip unless get_introspection_data 'GIMarshallingTests', 'glist_uint32_none_in'
|
1295
|
+
GIMarshallingTests.glist_uint32_none_in [0, 0xffff_ffff]
|
1296
|
+
pass
|
1165
1297
|
end
|
1298
|
+
|
1166
1299
|
it "has a working function #glist_uint32_none_return" do
|
1167
|
-
skip
|
1300
|
+
skip unless get_introspection_data 'GIMarshallingTests', 'glist_uint32_none_return'
|
1301
|
+
res = GIMarshallingTests.glist_uint32_none_return
|
1302
|
+
res.to_a.must_equal [0, 0xffff_ffff]
|
1168
1303
|
end
|
1169
1304
|
|
1170
1305
|
it "has a working function #glist_utf8_container_inout" do
|
@@ -1217,34 +1352,52 @@ describe GIMarshallingTests do
|
|
1217
1352
|
end
|
1218
1353
|
|
1219
1354
|
it "has a working function #gptrarray_utf8_container_inout" do
|
1220
|
-
|
1355
|
+
res = GIMarshallingTests.gptrarray_utf8_container_inout ["0", "1", "2"]
|
1356
|
+
res.to_a.must_equal ["-2", "-1", "0", "1"]
|
1221
1357
|
end
|
1358
|
+
|
1222
1359
|
it "has a working function #gptrarray_utf8_container_out" do
|
1223
|
-
|
1360
|
+
res = GIMarshallingTests.gptrarray_utf8_container_out
|
1361
|
+
res.to_a.must_equal ["0", "1", "2"]
|
1224
1362
|
end
|
1363
|
+
|
1225
1364
|
it "has a working function #gptrarray_utf8_container_return" do
|
1226
|
-
|
1365
|
+
res = GIMarshallingTests.gptrarray_utf8_container_return
|
1366
|
+
res.to_a.must_equal ["0", "1", "2"]
|
1227
1367
|
end
|
1368
|
+
|
1228
1369
|
it "has a working function #gptrarray_utf8_full_inout" do
|
1229
|
-
|
1370
|
+
res = GIMarshallingTests.gptrarray_utf8_full_inout ["0", "1", "2"]
|
1371
|
+
res.to_a.must_equal ["-2", "-1", "0", "1"]
|
1230
1372
|
end
|
1373
|
+
|
1231
1374
|
it "has a working function #gptrarray_utf8_full_out" do
|
1232
|
-
|
1375
|
+
res = GIMarshallingTests.gptrarray_utf8_full_out
|
1376
|
+
res.to_a.must_equal ["0", "1", "2"]
|
1233
1377
|
end
|
1378
|
+
|
1234
1379
|
it "has a working function #gptrarray_utf8_full_return" do
|
1235
|
-
|
1380
|
+
res = GIMarshallingTests.gptrarray_utf8_full_return
|
1381
|
+
res.to_a.must_equal ["0", "1", "2"]
|
1236
1382
|
end
|
1383
|
+
|
1237
1384
|
it "has a working function #gptrarray_utf8_none_in" do
|
1238
|
-
|
1385
|
+
GIMarshallingTests.gptrarray_utf8_none_in ["0", "1", "2"]
|
1239
1386
|
end
|
1387
|
+
|
1240
1388
|
it "has a working function #gptrarray_utf8_none_inout" do
|
1241
|
-
|
1389
|
+
res = GIMarshallingTests.gptrarray_utf8_none_inout ["0", "1", "2"]
|
1390
|
+
res.to_a.must_equal ["-2", "-1", "0", "1"]
|
1242
1391
|
end
|
1392
|
+
|
1243
1393
|
it "has a working function #gptrarray_utf8_none_out" do
|
1244
|
-
|
1394
|
+
res = GIMarshallingTests.gptrarray_utf8_none_out
|
1395
|
+
res.to_a.must_equal ["0", "1", "2"]
|
1245
1396
|
end
|
1397
|
+
|
1246
1398
|
it "has a working function #gptrarray_utf8_none_return" do
|
1247
|
-
|
1399
|
+
res = GIMarshallingTests.gptrarray_utf8_none_return
|
1400
|
+
res.to_a.must_equal ["0", "1", "2"]
|
1248
1401
|
end
|
1249
1402
|
|
1250
1403
|
it "has a working function #gslist_int_none_in" do
|
@@ -1328,42 +1481,46 @@ describe GIMarshallingTests do
|
|
1328
1481
|
end
|
1329
1482
|
|
1330
1483
|
it "has a working function #gtype_in" do
|
1331
|
-
|
1484
|
+
GIMarshallingTests.gtype_in GObject::TYPE_NONE
|
1485
|
+
pass
|
1332
1486
|
end
|
1333
1487
|
|
1334
1488
|
it "has a working function #gtype_inout" do
|
1335
|
-
|
1336
|
-
res
|
1337
|
-
name = GObject.type_name res
|
1338
|
-
assert_equal "gint", name
|
1489
|
+
res = GIMarshallingTests.gtype_inout GObject::TYPE_NONE
|
1490
|
+
res.must_equal GObject::TYPE_INT
|
1339
1491
|
end
|
1340
1492
|
|
1341
1493
|
it "has a working function #gtype_out" do
|
1342
1494
|
res = GIMarshallingTests.gtype_out
|
1343
|
-
|
1344
|
-
assert_equal "void", name
|
1495
|
+
res.must_equal GObject::TYPE_NONE
|
1345
1496
|
end
|
1346
1497
|
|
1347
1498
|
it "has a working function #gtype_return" do
|
1348
1499
|
res = GIMarshallingTests.gtype_return
|
1349
|
-
|
1350
|
-
assert_equal "void", name
|
1500
|
+
res.must_equal GObject::TYPE_NONE
|
1351
1501
|
end
|
1352
1502
|
|
1353
1503
|
it "has a working function #gtype_string_in" do
|
1354
|
-
|
1504
|
+
GIMarshallingTests.gtype_string_in GObject::TYPE_STRING
|
1505
|
+
pass
|
1355
1506
|
end
|
1507
|
+
|
1356
1508
|
it "has a working function #gtype_string_out" do
|
1357
|
-
|
1509
|
+
res = GIMarshallingTests.gtype_string_out
|
1510
|
+
res.must_equal GObject::TYPE_STRING
|
1358
1511
|
end
|
1512
|
+
|
1359
1513
|
it "has a working function #gtype_string_return" do
|
1360
|
-
|
1514
|
+
res = GIMarshallingTests.gtype_string_return
|
1515
|
+
res.must_equal GObject::TYPE_STRING
|
1361
1516
|
end
|
1517
|
+
|
1362
1518
|
it "has a working function #gvalue_flat_array" do
|
1363
|
-
skip
|
1519
|
+
skip "Non-pointer arrays of complex types are not supported yet"
|
1364
1520
|
end
|
1521
|
+
|
1365
1522
|
it "has a working function #gvalue_flat_array_round_trip" do
|
1366
|
-
skip
|
1523
|
+
skip "Non-pointer arrays of complex types are not supported yet"
|
1367
1524
|
end
|
1368
1525
|
|
1369
1526
|
it "has a working function #gvalue_in" do
|
@@ -1381,40 +1538,54 @@ describe GIMarshallingTests do
|
|
1381
1538
|
end
|
1382
1539
|
|
1383
1540
|
it "has a working function #gvalue_in_with_type" do
|
1384
|
-
|
1541
|
+
gv = GObject::Value.new
|
1542
|
+
gv.init GIMarshallingTests::SubSubObject.get_gtype
|
1543
|
+
GIMarshallingTests.gvalue_in_with_type gv, GIMarshallingTests::Object.get_gtype
|
1385
1544
|
end
|
1386
1545
|
|
1387
1546
|
it "has a working function #gvalue_inout" do
|
1388
1547
|
res = GIMarshallingTests.gvalue_inout GObject::Value.wrap_ruby_value(42)
|
1389
|
-
assert_equal "42", res.
|
1548
|
+
assert_equal "42", res.get_value
|
1390
1549
|
|
1391
1550
|
res = GIMarshallingTests.gvalue_inout 42
|
1392
|
-
assert_equal "42", res.
|
1551
|
+
assert_equal "42", res.get_value
|
1393
1552
|
end
|
1394
1553
|
|
1395
1554
|
it "has a working function #gvalue_int64_in" do
|
1396
|
-
skip
|
1555
|
+
skip unless get_introspection_data 'GIMarshallingTests', 'gvalue_int64_in'
|
1556
|
+
gv = GObject::Value.new
|
1557
|
+
gv.init GObject::TYPE_INT64
|
1558
|
+
gv.set_value 0x7fff_ffff_ffff_ffff
|
1559
|
+
GIMarshallingTests.gvalue_int64_in gv
|
1560
|
+
pass
|
1397
1561
|
end
|
1562
|
+
|
1398
1563
|
it "has a working function #gvalue_int64_out" do
|
1399
|
-
skip
|
1564
|
+
skip unless get_introspection_data 'GIMarshallingTests', 'gvalue_int64_out'
|
1565
|
+
gv = GIMarshallingTests.gvalue_int64_out
|
1566
|
+
gv.get_value.must_equal 0x7fff_ffff_ffff_ffff
|
1400
1567
|
end
|
1401
1568
|
|
1402
1569
|
it "has a working function #gvalue_out" do
|
1403
1570
|
res = GIMarshallingTests.gvalue_out
|
1404
|
-
assert_equal 42, res.
|
1571
|
+
assert_equal 42, res.get_value
|
1405
1572
|
end
|
1406
1573
|
|
1407
1574
|
it "has a working function #gvalue_out_caller_allocates" do
|
1408
|
-
skip
|
1575
|
+
skip unless get_introspection_data 'GIMarshallingTests', 'gvalue_out_caller_allocates'
|
1576
|
+
res = GIMarshallingTests.gvalue_out_caller_allocates
|
1577
|
+
res.get_value.must_equal 42
|
1409
1578
|
end
|
1410
1579
|
|
1411
1580
|
it "has a working function #gvalue_return" do
|
1412
1581
|
res = GIMarshallingTests.gvalue_return
|
1413
|
-
assert_equal 42, res.
|
1582
|
+
assert_equal 42, res.get_value
|
1414
1583
|
end
|
1415
1584
|
|
1416
1585
|
it "has a working function #init_function" do
|
1417
|
-
|
1586
|
+
res, arr = GIMarshallingTests.init_function ["foo", "bar", "baz"]
|
1587
|
+
res.must_equal true
|
1588
|
+
arr.to_a.must_equal ["foo", "bar"]
|
1418
1589
|
end
|
1419
1590
|
|
1420
1591
|
it "has a working function #int16_in_max" do
|
@@ -1673,7 +1844,7 @@ describe GIMarshallingTests do
|
|
1673
1844
|
end
|
1674
1845
|
|
1675
1846
|
it "has a working function #multi_array_key_value_in" do
|
1676
|
-
skip
|
1847
|
+
skip "Non-pointer arrays of complex types are not supported yet"
|
1677
1848
|
end
|
1678
1849
|
|
1679
1850
|
it "has a working function #no_type_flags_in" do
|
@@ -1702,13 +1873,28 @@ describe GIMarshallingTests do
|
|
1702
1873
|
end
|
1703
1874
|
|
1704
1875
|
it "has a working function #overrides_struct_returnv" do
|
1705
|
-
|
1876
|
+
res = GIMarshallingTests.overrides_struct_returnv
|
1877
|
+
res.must_be_instance_of GIMarshallingTests::OverridesStruct
|
1878
|
+
end
|
1879
|
+
|
1880
|
+
it "has a working function #param_spec_in_bool" do
|
1881
|
+
skip "param_spec_in_bool tests the wrong type"
|
1882
|
+
ps = GObject.param_spec_boolean "mybool", "nick", "blurb", true, :readable
|
1883
|
+
GIMarshallingTests.param_spec_in_bool ps
|
1706
1884
|
end
|
1885
|
+
|
1707
1886
|
it "has a working function #param_spec_out" do
|
1708
|
-
skip
|
1887
|
+
skip unless get_introspection_data 'GIMarshallingTests', 'param_spec_out'
|
1888
|
+
res = GIMarshallingTests.param_spec_out
|
1889
|
+
res.value_type.must_equal GObject::TYPE_STRING
|
1890
|
+
res.get_name.must_equal "test-param"
|
1709
1891
|
end
|
1892
|
+
|
1710
1893
|
it "has a working function #param_spec_return" do
|
1711
|
-
skip
|
1894
|
+
skip unless get_introspection_data 'GIMarshallingTests', 'param_spec_return'
|
1895
|
+
res = GIMarshallingTests.param_spec_return
|
1896
|
+
res.value_type.must_equal GObject::TYPE_STRING
|
1897
|
+
res.get_name.must_equal "test-param"
|
1712
1898
|
end
|
1713
1899
|
|
1714
1900
|
it "has a working function #pointer_in_return" do
|
@@ -1730,7 +1916,7 @@ describe GIMarshallingTests do
|
|
1730
1916
|
end
|
1731
1917
|
|
1732
1918
|
it "has a working function #return_gvalue_flat_array" do
|
1733
|
-
skip
|
1919
|
+
skip "Non-pointer arrays of complex types are not supported yet"
|
1734
1920
|
end
|
1735
1921
|
|
1736
1922
|
it "has a working function #short_in_max" do
|
@@ -1840,7 +2026,7 @@ describe GIMarshallingTests do
|
|
1840
2026
|
end
|
1841
2027
|
|
1842
2028
|
it "has a working function #test_interface_test_int8_in" do
|
1843
|
-
skip
|
2029
|
+
skip "Needs implementation of TestInterface"
|
1844
2030
|
end
|
1845
2031
|
|
1846
2032
|
it "has a working function #time_t_in" do
|
@@ -2014,6 +2200,12 @@ describe GIMarshallingTests do
|
|
2014
2200
|
assert_equal max_ushort, res
|
2015
2201
|
end
|
2016
2202
|
|
2203
|
+
it "has a working function #utf8_as_uint8array_in" do
|
2204
|
+
skip unless get_introspection_data 'GIMarshallingTests', 'utf8_as_uint8array_in'
|
2205
|
+
GIMarshallingTests.utf8_as_uint8array_in GIMarshallingTests::CONSTANT_UTF8.bytes.to_a
|
2206
|
+
pass
|
2207
|
+
end
|
2208
|
+
|
2017
2209
|
it "has a working function #utf8_dangling_out" do
|
2018
2210
|
res = GIMarshallingTests.utf8_dangling_out
|
2019
2211
|
assert_nil res
|