gir_ffi 0.9.5 → 0.10.0.pre1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Changelog.md +9 -0
- data/lib/ffi-glib/byte_array.rb +1 -1
- data/lib/ffi-glib/bytes.rb +4 -4
- data/lib/ffi-glib/container_class_methods.rb +2 -0
- data/lib/ffi-glib/iconv.rb +2 -2
- data/lib/ffi-glib/variant.rb +10 -2
- data/lib/ffi-gobject.rb +6 -14
- data/lib/ffi-gobject/object.rb +7 -0
- data/lib/ffi-gobject/object_class.rb +1 -1
- data/lib/ffi-gobject/param_spec.rb +12 -0
- data/lib/ffi-gobject/value.rb +20 -11
- data/lib/gir_ffi-base/gobject.rb +35 -3
- data/lib/gir_ffi-base/gobject/lib.rb +2 -0
- data/lib/gir_ffi/allocation_helper.rb +11 -0
- data/lib/gir_ffi/arg_helper.rb +4 -0
- data/lib/gir_ffi/boxed_base.rb +28 -32
- data/lib/gir_ffi/builders/argument_builder.rb +31 -6
- data/lib/gir_ffi/builders/c_to_ruby_convertor.rb +36 -7
- data/lib/gir_ffi/builders/callback_argument_builder.rb +24 -10
- data/lib/gir_ffi/builders/closure_to_pointer_convertor.rb +1 -1
- data/lib/gir_ffi/builders/field_builder.rb +28 -10
- data/lib/gir_ffi/builders/full_c_to_ruby_convertor.rb +2 -3
- data/lib/gir_ffi/builders/initializer_return_value_builder.rb +5 -1
- data/lib/gir_ffi/builders/null_argument_builder.rb +0 -12
- data/lib/gir_ffi/builders/pointer_value_convertor.rb +38 -0
- data/lib/gir_ffi/builders/return_value_builder.rb +12 -10
- data/lib/gir_ffi/builders/ruby_to_c_convertor.rb +21 -2
- data/lib/gir_ffi/builders/struct_builder.rb +9 -2
- data/lib/gir_ffi/builders/{boxed_builder.rb → struct_like.rb} +2 -5
- data/lib/gir_ffi/builders/unintrospectable_boxed_builder.rb +5 -2
- data/lib/gir_ffi/builders/union_builder.rb +5 -2
- data/lib/gir_ffi/enum_base.rb +4 -0
- data/lib/gir_ffi/error_argument_info.rb +0 -16
- data/lib/gir_ffi/ffi_ext/pointer.rb +11 -5
- data/lib/gir_ffi/flags_base.rb +4 -0
- data/lib/gir_ffi/in_out_pointer.rb +5 -30
- data/lib/gir_ffi/in_pointer.rb +5 -4
- data/lib/gir_ffi/info_ext/i_type_info.rb +3 -5
- data/lib/gir_ffi/object_base.rb +4 -0
- data/lib/gir_ffi/sized_array.rb +20 -0
- data/lib/gir_ffi/struct_base.rb +13 -2
- data/lib/gir_ffi/struct_like_base.rb +53 -0
- data/lib/gir_ffi/union_base.rb +7 -1
- data/lib/gir_ffi/version.rb +1 -1
- data/test/ffi-glib/destroy_notify_test.rb +4 -1
- data/test/ffi-gobject/param_spec_test.rb +18 -0
- data/test/gir_ffi/arg_helper_test.rb +17 -0
- data/test/gir_ffi/boxed_base_test.rb +24 -0
- data/test/gir_ffi/builders/argument_builder_test.rb +156 -63
- data/test/gir_ffi/builders/callback_argument_builder_test.rb +10 -10
- data/test/gir_ffi/builders/callback_builder_test.rb +31 -8
- data/test/gir_ffi/builders/field_builder_test.rb +32 -30
- data/test/gir_ffi/builders/function_builder_test.rb +251 -45
- data/test/gir_ffi/builders/initializer_builder_test.rb +17 -1
- data/test/gir_ffi/builders/return_value_builder_test.rb +115 -68
- data/test/gir_ffi/builders/struct_builder_test.rb +6 -0
- data/test/gir_ffi/builders/unintrospectable_builder_test.rb +4 -1
- data/test/gir_ffi/builders/vfunc_builder_test.rb +10 -10
- data/test/gir_ffi/in_out_pointer_test.rb +12 -81
- data/test/gir_ffi/in_pointer_test.rb +0 -17
- data/test/gir_ffi/info_ext/i_type_info_test.rb +0 -10
- data/test/gir_ffi/sized_array_test.rb +62 -0
- data/test/gir_ffi/struct_base_test.rb +24 -0
- data/test/gir_ffi/union_base_test.rb +24 -0
- data/test/gir_ffi/version_test.rb +1 -1
- data/test/integration/generated_gimarshallingtests_test.rb +32 -12
- data/test/integration/generated_regress_test.rb +9 -12
- metadata +12 -8
- data/lib/ffi-gobject/base.rb +0 -27
- data/lib/gir_ffi/user_data_argument_info.rb +0 -24
- data/lib/gir_ffi/user_data_type_info.rb +0 -22
@@ -24,7 +24,7 @@ describe GirFFI::Builders::InitializerBuilder do
|
|
24
24
|
it 'builds a custom initializer' do
|
25
25
|
code.must_equal <<-CODE.reset_indentation
|
26
26
|
def initialize_from_file(x)
|
27
|
-
_v1 = GirFFI::InPointer.
|
27
|
+
_v1 = GirFFI::InPointer.from_utf8(x)
|
28
28
|
_v2 = FFI::MemoryPointer.new(:pointer).write_pointer nil
|
29
29
|
_v3 = Regress::Lib.regress_test_obj_new_from_file _v1, _v2
|
30
30
|
GirFFI::ArgHelper.check_error(_v2)
|
@@ -33,5 +33,21 @@ describe GirFFI::Builders::InitializerBuilder do
|
|
33
33
|
CODE
|
34
34
|
end
|
35
35
|
end
|
36
|
+
|
37
|
+
describe 'for constructors for boxed types' do
|
38
|
+
let(:function_info) do
|
39
|
+
get_method_introspection_data 'GIMarshallingTests', 'BoxedStruct', 'new'
|
40
|
+
end
|
41
|
+
|
42
|
+
it 'builds an initializer that sets autorelease to true' do
|
43
|
+
code.must_equal <<-CODE.reset_indentation
|
44
|
+
def initialize
|
45
|
+
_v1 = GIMarshallingTests::Lib.gi_marshalling_tests_boxed_struct_new
|
46
|
+
_v1.autorelease = true
|
47
|
+
store_pointer(_v1)
|
48
|
+
end
|
49
|
+
CODE
|
50
|
+
end
|
51
|
+
end
|
36
52
|
end
|
37
53
|
end
|
@@ -3,15 +3,17 @@ require 'gir_ffi_test_helper'
|
|
3
3
|
|
4
4
|
describe GirFFI::Builders::ReturnValueBuilder do
|
5
5
|
let(:var_gen) { GirFFI::VariableNameGenerator.new }
|
6
|
-
let(:
|
6
|
+
let(:type_info) { method_info.return_type }
|
7
|
+
let(:ownership_transfer) { method_info.caller_owns }
|
8
|
+
let(:return_type_info) { GirFFI::ReturnValueInfo.new(type_info, ownership_transfer, false) }
|
7
9
|
let(:builder) do
|
8
10
|
GirFFI::Builders::ReturnValueBuilder.new(var_gen, return_type_info)
|
9
11
|
end
|
10
12
|
|
11
13
|
describe 'for :gint32' do
|
12
|
-
let(:
|
14
|
+
let(:method_info) do
|
13
15
|
get_introspection_data('GIMarshallingTests',
|
14
|
-
'int_return_min')
|
16
|
+
'int_return_min')
|
15
17
|
end
|
16
18
|
|
17
19
|
it 'has no statements in #post_conversion' do
|
@@ -25,33 +27,35 @@ describe GirFFI::Builders::ReturnValueBuilder do
|
|
25
27
|
end
|
26
28
|
|
27
29
|
describe 'for :struct' do
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
30
|
+
describe 'with transfer :nothing' do
|
31
|
+
let(:method_info) do
|
32
|
+
get_method_introspection_data('GIMarshallingTests',
|
33
|
+
'BoxedStruct',
|
34
|
+
'returnv')
|
35
|
+
end
|
33
36
|
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
37
|
+
it 'wraps and copies the result in #post_conversion' do
|
38
|
+
builder.capture_variable_name.must_equal '_v1'
|
39
|
+
builder.post_conversion.must_equal ['_v2 = GIMarshallingTests::BoxedStruct.wrap_copy(_v1)']
|
40
|
+
end
|
38
41
|
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
+
it 'returns the copied result' do
|
43
|
+
builder.capture_variable_name.must_equal '_v1'
|
44
|
+
builder.return_value_name.must_equal '_v2'
|
45
|
+
end
|
42
46
|
end
|
43
47
|
end
|
44
48
|
|
45
49
|
describe 'for :union' do
|
46
|
-
let(:
|
50
|
+
let(:method_info) do
|
47
51
|
get_method_introspection_data('GIMarshallingTests',
|
48
52
|
'Union',
|
49
|
-
'returnv')
|
53
|
+
'returnv')
|
50
54
|
end
|
51
55
|
|
52
56
|
it 'wraps the result in #post_conversion' do
|
53
57
|
builder.capture_variable_name.must_equal '_v1'
|
54
|
-
builder.post_conversion.must_equal ['_v2 = GIMarshallingTests::Union.
|
58
|
+
builder.post_conversion.must_equal ['_v2 = GIMarshallingTests::Union.wrap_copy(_v1)']
|
55
59
|
end
|
56
60
|
|
57
61
|
it 'returns the wrapped result' do
|
@@ -61,10 +65,10 @@ describe GirFFI::Builders::ReturnValueBuilder do
|
|
61
65
|
end
|
62
66
|
|
63
67
|
describe 'for :interface' do
|
64
|
-
let(:
|
68
|
+
let(:method_info) do
|
65
69
|
get_method_introspection_data('Gio',
|
66
70
|
'File',
|
67
|
-
'new_for_commandline_arg')
|
71
|
+
'new_for_commandline_arg')
|
68
72
|
end
|
69
73
|
|
70
74
|
it 'wraps the result in #post_conversion' do
|
@@ -79,28 +83,49 @@ describe GirFFI::Builders::ReturnValueBuilder do
|
|
79
83
|
end
|
80
84
|
|
81
85
|
describe 'for :object' do
|
82
|
-
|
83
|
-
|
84
|
-
|
85
|
-
|
86
|
-
|
86
|
+
describe 'with full ownership transfer' do
|
87
|
+
let(:method_info) do
|
88
|
+
get_method_introspection_data('GIMarshallingTests',
|
89
|
+
'Object',
|
90
|
+
'full_return')
|
91
|
+
end
|
87
92
|
|
88
|
-
|
89
|
-
|
90
|
-
|
93
|
+
it 'wraps the result in #post_conversion' do
|
94
|
+
builder.capture_variable_name.must_equal '_v1'
|
95
|
+
builder.post_conversion.must_equal ['_v2 = GIMarshallingTests::Object.wrap(_v1)']
|
96
|
+
end
|
97
|
+
|
98
|
+
it 'returns the wrapped result' do
|
99
|
+
builder.capture_variable_name.must_equal '_v1'
|
100
|
+
builder.return_value_name.must_equal '_v2'
|
101
|
+
end
|
91
102
|
end
|
92
103
|
|
93
|
-
|
94
|
-
|
95
|
-
|
104
|
+
describe 'with no ownership transfer' do
|
105
|
+
let(:method_info) do
|
106
|
+
get_method_introspection_data('GIMarshallingTests',
|
107
|
+
'Object',
|
108
|
+
'none_return')
|
109
|
+
end
|
110
|
+
|
111
|
+
it 'wraps the result in #post_conversion' do
|
112
|
+
builder.capture_variable_name.must_equal '_v1'
|
113
|
+
builder.post_conversion.
|
114
|
+
must_equal ['_v2 = GIMarshallingTests::Object.wrap(_v1).tap { |it| it && it.ref }']
|
115
|
+
end
|
116
|
+
|
117
|
+
it 'returns the wrapped result' do
|
118
|
+
builder.capture_variable_name.must_equal '_v1'
|
119
|
+
builder.return_value_name.must_equal '_v2'
|
120
|
+
end
|
96
121
|
end
|
97
122
|
end
|
98
123
|
|
99
124
|
describe 'for :strv' do
|
100
|
-
let(:
|
125
|
+
let(:method_info) do
|
101
126
|
get_method_introspection_data('GLib',
|
102
127
|
'KeyFile',
|
103
|
-
'get_locale_string_list')
|
128
|
+
'get_locale_string_list')
|
104
129
|
end
|
105
130
|
|
106
131
|
it 'wraps the result in #post_conversion' do
|
@@ -115,10 +140,10 @@ describe GirFFI::Builders::ReturnValueBuilder do
|
|
115
140
|
end
|
116
141
|
|
117
142
|
describe 'for :zero_terminated' do
|
118
|
-
let(:
|
143
|
+
let(:method_info) do
|
119
144
|
get_method_introspection_data('GLib',
|
120
145
|
'Variant',
|
121
|
-
'dup_bytestring')
|
146
|
+
'dup_bytestring')
|
122
147
|
end
|
123
148
|
before do
|
124
149
|
skip unless type_info.zero_terminated?
|
@@ -136,9 +161,9 @@ describe GirFFI::Builders::ReturnValueBuilder do
|
|
136
161
|
end
|
137
162
|
|
138
163
|
describe 'for :byte_array' do
|
139
|
-
let(:
|
164
|
+
let(:method_info) do
|
140
165
|
get_introspection_data('GIMarshallingTests',
|
141
|
-
'bytearray_full_return')
|
166
|
+
'bytearray_full_return')
|
142
167
|
end
|
143
168
|
|
144
169
|
it 'wraps the result in #post_conversion' do
|
@@ -153,9 +178,9 @@ describe GirFFI::Builders::ReturnValueBuilder do
|
|
153
178
|
end
|
154
179
|
|
155
180
|
describe 'for :ptr_array' do
|
156
|
-
let(:
|
181
|
+
let(:method_info) do
|
157
182
|
get_introspection_data('GIMarshallingTests',
|
158
|
-
'gptrarray_utf8_none_return')
|
183
|
+
'gptrarray_utf8_none_return')
|
159
184
|
end
|
160
185
|
|
161
186
|
it 'wraps the result in #post_conversion' do
|
@@ -170,9 +195,9 @@ describe GirFFI::Builders::ReturnValueBuilder do
|
|
170
195
|
end
|
171
196
|
|
172
197
|
describe 'for :glist' do
|
173
|
-
let(:
|
198
|
+
let(:method_info) do
|
174
199
|
get_introspection_data('GIMarshallingTests',
|
175
|
-
'glist_int_none_return')
|
200
|
+
'glist_int_none_return')
|
176
201
|
end
|
177
202
|
|
178
203
|
it 'wraps the result in #post_conversion' do
|
@@ -187,9 +212,9 @@ describe GirFFI::Builders::ReturnValueBuilder do
|
|
187
212
|
end
|
188
213
|
|
189
214
|
describe 'for :gslist' do
|
190
|
-
let(:
|
215
|
+
let(:method_info) do
|
191
216
|
get_introspection_data('GIMarshallingTests',
|
192
|
-
'gslist_int_none_return')
|
217
|
+
'gslist_int_none_return')
|
193
218
|
end
|
194
219
|
|
195
220
|
it 'wraps the result in #post_conversion' do
|
@@ -204,9 +229,9 @@ describe GirFFI::Builders::ReturnValueBuilder do
|
|
204
229
|
end
|
205
230
|
|
206
231
|
describe 'for :ghash' do
|
207
|
-
let(:
|
232
|
+
let(:method_info) do
|
208
233
|
get_introspection_data('GIMarshallingTests',
|
209
|
-
'ghashtable_int_none_return')
|
234
|
+
'ghashtable_int_none_return')
|
210
235
|
end
|
211
236
|
|
212
237
|
it 'wraps the result in #post_conversion' do
|
@@ -221,9 +246,9 @@ describe GirFFI::Builders::ReturnValueBuilder do
|
|
221
246
|
end
|
222
247
|
|
223
248
|
describe 'for :array' do
|
224
|
-
let(:
|
249
|
+
let(:method_info) do
|
225
250
|
get_introspection_data('GIMarshallingTests',
|
226
|
-
'garray_int_none_return')
|
251
|
+
'garray_int_none_return')
|
227
252
|
end
|
228
253
|
|
229
254
|
it 'wraps the result in #post_conversion' do
|
@@ -238,9 +263,9 @@ describe GirFFI::Builders::ReturnValueBuilder do
|
|
238
263
|
end
|
239
264
|
|
240
265
|
describe 'for :error' do
|
241
|
-
let(:
|
266
|
+
let(:method_info) do
|
242
267
|
get_introspection_data('GIMarshallingTests',
|
243
|
-
'gerror_return')
|
268
|
+
'gerror_return')
|
244
269
|
end
|
245
270
|
|
246
271
|
it 'wraps the result in #post_conversion' do
|
@@ -256,9 +281,9 @@ describe GirFFI::Builders::ReturnValueBuilder do
|
|
256
281
|
|
257
282
|
describe 'for :c' do
|
258
283
|
describe 'with fixed size' do
|
259
|
-
let(:
|
284
|
+
let(:method_info) do
|
260
285
|
get_introspection_data('GIMarshallingTests',
|
261
|
-
'array_fixed_int_return')
|
286
|
+
'array_fixed_int_return')
|
262
287
|
end
|
263
288
|
|
264
289
|
it 'converts the result in #post_conversion' do
|
@@ -274,10 +299,10 @@ describe GirFFI::Builders::ReturnValueBuilder do
|
|
274
299
|
|
275
300
|
describe 'with separate size parameter' do
|
276
301
|
let(:length_argument) { Object.new }
|
277
|
-
let(:
|
302
|
+
let(:method_info) do
|
278
303
|
get_method_introspection_data('GIMarshallingTests',
|
279
304
|
'Object',
|
280
|
-
'method_array_return')
|
305
|
+
'method_array_return')
|
281
306
|
end
|
282
307
|
|
283
308
|
before do
|
@@ -298,22 +323,42 @@ describe GirFFI::Builders::ReturnValueBuilder do
|
|
298
323
|
end
|
299
324
|
|
300
325
|
describe 'for :utf8' do
|
301
|
-
|
302
|
-
|
303
|
-
|
326
|
+
describe 'with no transfer' do
|
327
|
+
let(:method_info) do
|
328
|
+
get_introspection_data('GIMarshallingTests', 'utf8_none_return')
|
329
|
+
end
|
304
330
|
|
305
|
-
|
306
|
-
|
307
|
-
|
331
|
+
it 'converts the result in #post_conversion' do
|
332
|
+
builder.capture_variable_name.must_equal '_v1'
|
333
|
+
builder.post_conversion.must_equal ['_v2 = _v1.to_utf8']
|
334
|
+
end
|
335
|
+
|
336
|
+
it 'returns the converted result' do
|
337
|
+
builder.capture_variable_name.must_equal '_v1'
|
338
|
+
builder.return_value_name.must_equal '_v2'
|
339
|
+
end
|
308
340
|
end
|
309
341
|
|
310
|
-
|
311
|
-
|
312
|
-
|
342
|
+
describe 'with full transfer' do
|
343
|
+
let(:method_info) do
|
344
|
+
get_introspection_data('GIMarshallingTests', 'utf8_full_return')
|
345
|
+
end
|
346
|
+
|
347
|
+
it 'autoreleases and converts the result in #post_conversion' do
|
348
|
+
builder.capture_variable_name.must_equal '_v1'
|
349
|
+
builder.post_conversion.
|
350
|
+
must_equal ['_v2 = _v1.tap { |it| it.autorelease = true }.to_utf8']
|
351
|
+
end
|
352
|
+
|
353
|
+
it 'returns the converted result' do
|
354
|
+
builder.capture_variable_name.must_equal '_v1'
|
355
|
+
builder.return_value_name.must_equal '_v2'
|
356
|
+
end
|
313
357
|
end
|
314
358
|
end
|
315
359
|
|
316
360
|
describe 'for :void pointer' do
|
361
|
+
let(:ownership_transfer) { :nothing }
|
317
362
|
let(:callback_info) do
|
318
363
|
get_introspection_data('GIMarshallingTests', 'CallbackIntInt')
|
319
364
|
end
|
@@ -334,8 +379,8 @@ describe GirFFI::Builders::ReturnValueBuilder do
|
|
334
379
|
end
|
335
380
|
|
336
381
|
describe 'for :void' do
|
337
|
-
let(:
|
338
|
-
get_method_introspection_data('Regress', 'TestObj', 'null_out')
|
382
|
+
let(:method_info) do
|
383
|
+
get_method_introspection_data('Regress', 'TestObj', 'null_out')
|
339
384
|
end
|
340
385
|
|
341
386
|
it 'has no statements in #post_conversion' do
|
@@ -352,9 +397,11 @@ describe GirFFI::Builders::ReturnValueBuilder do
|
|
352
397
|
end
|
353
398
|
|
354
399
|
describe 'for a closure argument' do
|
355
|
-
let(:
|
356
|
-
|
400
|
+
let(:ownership_transfer) { :nothing }
|
401
|
+
let(:callback_info) do
|
402
|
+
get_introspection_data('Regress', 'TestCallbackUserData')
|
357
403
|
end
|
404
|
+
let(:type_info) { callback_info.args[0].argument_type }
|
358
405
|
|
359
406
|
before do
|
360
407
|
builder.closure = true
|
@@ -372,8 +419,8 @@ describe GirFFI::Builders::ReturnValueBuilder do
|
|
372
419
|
end
|
373
420
|
|
374
421
|
describe 'for a skipped return value' do
|
375
|
-
let(:
|
376
|
-
get_method_introspection_data('Regress', 'TestObj', 'skip_return_val')
|
422
|
+
let(:method_info) do
|
423
|
+
get_method_introspection_data('Regress', 'TestObj', 'skip_return_val')
|
377
424
|
end
|
378
425
|
let(:return_type_info) { GirFFI::ReturnValueInfo.new(type_info, :nothing, true) }
|
379
426
|
|
@@ -54,6 +54,12 @@ describe GirFFI::Builders::StructBuilder do
|
|
54
54
|
builder.superclass.must_equal GirFFI::StructBase
|
55
55
|
end
|
56
56
|
|
57
|
+
it 'returns BoxedBase for a boxed type' do
|
58
|
+
info = get_introspection_data 'Regress', 'TestSimpleBoxedB'
|
59
|
+
builder = GirFFI::Builders::StructBuilder.new info
|
60
|
+
builder.superclass.must_equal GirFFI::BoxedBase
|
61
|
+
end
|
62
|
+
|
57
63
|
it 'returns the GObject parent class for a type class' do
|
58
64
|
info = get_introspection_data 'GIMarshallingTests', 'SubSubObjectClass'
|
59
65
|
builder = GirFFI::Builders::StructBuilder.new info
|
@@ -3,7 +3,6 @@ require 'gir_ffi_test_helper'
|
|
3
3
|
|
4
4
|
GirFFI.setup :Gio
|
5
5
|
GirFFI.setup :Gst
|
6
|
-
Gst.init []
|
7
6
|
|
8
7
|
describe GirFFI::Builders::UnintrospectableBuilder do
|
9
8
|
describe 'building the GLocalFile type' do
|
@@ -58,6 +57,10 @@ describe GirFFI::Builders::UnintrospectableBuilder do
|
|
58
57
|
let(:klass) { instance.class }
|
59
58
|
let(:builder) { klass.gir_ffi_builder }
|
60
59
|
|
60
|
+
before do
|
61
|
+
Gst.init []
|
62
|
+
end
|
63
|
+
|
61
64
|
describe 'its #find_signal method' do
|
62
65
|
it 'finds signals that are not defined in the GIR' do
|
63
66
|
signal = builder.find_signal 'handoff'
|
@@ -78,9 +78,9 @@ describe GirFFI::Builders::VFuncBuilder do
|
|
78
78
|
def self.call_with_argument_mapping(_proc, _instance, arg, out)
|
79
79
|
_v1 = GIMarshallingTests::Object.wrap(_instance)
|
80
80
|
_v2 = arg
|
81
|
-
_v3 =
|
81
|
+
_v3 = out
|
82
82
|
_v4 = _proc.call(_v1, _v2)
|
83
|
-
_v3.
|
83
|
+
_v3.put_int8 0, _v4
|
84
84
|
end
|
85
85
|
CODE
|
86
86
|
|
@@ -99,9 +99,9 @@ describe GirFFI::Builders::VFuncBuilder do
|
|
99
99
|
def self.call_with_argument_mapping(_proc, _instance, arg, out)
|
100
100
|
_v1 = GIMarshallingTests::Object.wrap(_instance)
|
101
101
|
_v2 = arg
|
102
|
-
_v3 = GirFFI::
|
102
|
+
_v3 = GirFFI::AllocationHelper.allocate(:int8).tap { |ptr| out.put_pointer 0, ptr }
|
103
103
|
_v4 = _proc.call(_v1, _v2)
|
104
|
-
_v3.
|
104
|
+
_v3.put_pointer 0, _v4
|
105
105
|
end
|
106
106
|
CODE
|
107
107
|
|
@@ -119,9 +119,9 @@ describe GirFFI::Builders::VFuncBuilder do
|
|
119
119
|
expected = <<-CODE.reset_indentation
|
120
120
|
def self.call_with_argument_mapping(_proc, _instance, a)
|
121
121
|
_v1 = GIMarshallingTests::Object.wrap(_instance)
|
122
|
-
_v2 =
|
122
|
+
_v2 = a
|
123
123
|
_v3 = _proc.call(_v1)
|
124
|
-
|
124
|
+
GObject::Value.copy_value_to_pointer(GObject::Value.from(_v3), _v2)
|
125
125
|
end
|
126
126
|
CODE
|
127
127
|
|
@@ -140,11 +140,11 @@ describe GirFFI::Builders::VFuncBuilder do
|
|
140
140
|
def self.call_with_argument_mapping(_proc, _instance, x, _error)
|
141
141
|
_v1 = GIMarshallingTests::Object.wrap(_instance)
|
142
142
|
_v2 = x
|
143
|
-
_v3 =
|
143
|
+
_v3 = _error
|
144
144
|
begin
|
145
145
|
_v4 = _proc.call(_v1, _v2)
|
146
146
|
rescue => _v5
|
147
|
-
_v3.
|
147
|
+
_v3.put_pointer 0, GLib::Error.from(_v5)
|
148
148
|
end
|
149
149
|
return _v4
|
150
150
|
end
|
@@ -201,9 +201,9 @@ describe GirFFI::Builders::VFuncBuilder do
|
|
201
201
|
expected = <<-CODE.reset_indentation
|
202
202
|
def self.call_with_argument_mapping(_proc, _instance, object)
|
203
203
|
_v1 = GIMarshallingTests::Object.wrap(_instance)
|
204
|
-
_v2 =
|
204
|
+
_v2 = object
|
205
205
|
_v3 = _proc.call(_v1)
|
206
|
-
_v2.
|
206
|
+
_v2.put_pointer 0, GObject::Object.from(_v3.ref)
|
207
207
|
end
|
208
208
|
CODE
|
209
209
|
|