gir_ffi 0.14.1 → 0.15.4
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 +4 -4
- data/Changelog.md +56 -0
- data/README.md +12 -12
- data/TODO.md +14 -35
- data/docs/Documentation.md +6 -0
- data/docs/Subclassing.md +38 -0
- data/lib/ffi-glib.rb +26 -21
- data/lib/ffi-glib/array.rb +14 -4
- data/lib/ffi-glib/byte_array.rb +9 -3
- data/lib/ffi-glib/container_class_methods.rb +1 -1
- data/lib/ffi-glib/destroy_notify.rb +2 -2
- data/lib/ffi-glib/error.rb +1 -1
- data/lib/ffi-glib/hash_table.rb +4 -5
- data/lib/ffi-glib/list.rb +12 -6
- data/lib/ffi-glib/list_methods.rb +13 -1
- data/lib/ffi-glib/main_loop.rb +3 -3
- data/lib/ffi-glib/ptr_array.rb +30 -8
- data/lib/ffi-glib/s_list.rb +11 -5
- data/lib/ffi-glib/variant.rb +1 -1
- data/lib/ffi-gobject.rb +13 -16
- data/lib/ffi-gobject/object.rb +82 -87
- data/lib/ffi-gobject/object_class.rb +1 -1
- data/lib/ffi-gobject/param_spec.rb +1 -1
- data/lib/ffi-gobject/ruby_closure.rb +2 -2
- data/lib/ffi-gobject/value.rb +136 -126
- data/lib/ffi-gobject_introspection.rb +20 -20
- data/lib/ffi-gobject_introspection/gobject_type_init.rb +2 -2
- data/lib/ffi-gobject_introspection/i_arg_info.rb +2 -2
- data/lib/ffi-gobject_introspection/i_base_info.rb +34 -23
- data/lib/ffi-gobject_introspection/i_callable_info.rb +4 -4
- data/lib/ffi-gobject_introspection/i_constant_info.rb +2 -2
- data/lib/ffi-gobject_introspection/i_enum_info.rb +1 -0
- data/lib/ffi-gobject_introspection/i_field_info.rb +1 -1
- data/lib/ffi-gobject_introspection/i_function_info.rb +1 -1
- data/lib/ffi-gobject_introspection/i_interface_info.rb +1 -1
- data/lib/ffi-gobject_introspection/i_object_info.rb +2 -2
- data/lib/ffi-gobject_introspection/i_property_info.rb +2 -2
- data/lib/ffi-gobject_introspection/i_repository.rb +9 -6
- data/lib/ffi-gobject_introspection/i_struct_info.rb +2 -1
- data/lib/ffi-gobject_introspection/i_type_info.rb +13 -7
- data/lib/ffi-gobject_introspection/i_unresolved_info.rb +1 -1
- data/lib/ffi-gobject_introspection/i_vfunc_info.rb +1 -1
- data/lib/ffi-gobject_introspection/lib.rb +30 -19
- data/lib/ffi-gobject_introspection/strv.rb +1 -1
- data/lib/gir_ffi-base.rb +1 -1
- data/lib/gir_ffi-base/gobject.rb +26 -25
- data/lib/gir_ffi-base/gobject/lib.rb +7 -2
- data/lib/gir_ffi.rb +3 -3
- data/lib/gir_ffi/allocation_helper.rb +1 -1
- data/lib/gir_ffi/arg_helper.rb +4 -4
- data/lib/gir_ffi/{in_out_pointer.rb → array_element_convertor.rb} +16 -24
- data/lib/gir_ffi/boolean.rb +1 -1
- data/lib/gir_ffi/boxed_base.rb +2 -6
- data/lib/gir_ffi/builder.rb +19 -11
- data/lib/gir_ffi/builder_helper.rb +10 -2
- data/lib/gir_ffi/builders/argument_builder.rb +19 -19
- data/lib/gir_ffi/builders/argument_builder_collection.rb +2 -2
- data/lib/gir_ffi/builders/base_argument_builder.rb +2 -1
- data/lib/gir_ffi/builders/base_method_builder.rb +8 -8
- data/lib/gir_ffi/builders/base_return_value_builder.rb +1 -1
- data/lib/gir_ffi/builders/base_type_builder.rb +2 -2
- data/lib/gir_ffi/builders/c_to_ruby_convertor.rb +5 -5
- data/lib/gir_ffi/builders/callback_argument_builder.rb +10 -8
- data/lib/gir_ffi/builders/callback_builder.rb +28 -14
- data/lib/gir_ffi/builders/callback_return_value_builder.rb +6 -8
- data/lib/gir_ffi/builders/class_struct_builder.rb +24 -0
- data/lib/gir_ffi/builders/closure_argument_builder.rb +1 -1
- data/lib/gir_ffi/builders/closure_return_value_builder.rb +1 -1
- data/lib/gir_ffi/builders/constant_builder.rb +1 -1
- data/lib/gir_ffi/builders/constructor_builder.rb +9 -9
- data/lib/gir_ffi/builders/enum_builder.rb +11 -7
- data/lib/gir_ffi/builders/field_builder.rb +20 -18
- data/lib/gir_ffi/builders/flags_builder.rb +2 -2
- data/lib/gir_ffi/builders/full_c_to_ruby_convertor.rb +1 -1
- data/lib/gir_ffi/builders/function_builder.rb +11 -5
- data/lib/gir_ffi/builders/initializer_builder.rb +3 -3
- data/lib/gir_ffi/builders/initializer_return_value_builder.rb +2 -2
- data/lib/gir_ffi/builders/interface_builder.rb +5 -3
- data/lib/gir_ffi/builders/mapping_method_builder.rb +10 -10
- data/lib/gir_ffi/builders/marshalling_method_builder.rb +12 -9
- data/lib/gir_ffi/builders/method_template.rb +5 -5
- data/lib/gir_ffi/builders/module_builder.rb +7 -7
- data/lib/gir_ffi/builders/null_argument_builder.rb +0 -2
- data/lib/gir_ffi/builders/null_return_value_builder.rb +0 -2
- data/lib/gir_ffi/builders/object_builder.rb +22 -12
- data/lib/gir_ffi/builders/property_argument_builder.rb +1 -1
- data/lib/gir_ffi/builders/property_builder.rb +14 -14
- data/lib/gir_ffi/builders/property_return_value_builder.rb +1 -1
- data/lib/gir_ffi/builders/registered_type_builder.rb +14 -5
- data/lib/gir_ffi/builders/return_value_builder.rb +4 -4
- data/lib/gir_ffi/builders/ruby_to_c_convertor.rb +6 -6
- data/lib/gir_ffi/builders/signal_closure_builder.rb +5 -7
- data/lib/gir_ffi/builders/struct_builder.rb +8 -6
- data/lib/gir_ffi/builders/struct_like.rb +1 -1
- data/lib/gir_ffi/builders/type_builder.rb +12 -12
- data/lib/gir_ffi/builders/unintrospectable_boxed_builder.rb +2 -2
- data/lib/gir_ffi/builders/unintrospectable_builder.rb +2 -2
- data/lib/gir_ffi/builders/union_builder.rb +4 -4
- data/lib/gir_ffi/builders/user_defined_builder.rb +10 -3
- data/lib/gir_ffi/builders/vfunc_argument_builder.rb +2 -2
- data/lib/gir_ffi/builders/vfunc_builder.rb +8 -8
- data/lib/gir_ffi/builders/with_layout.rb +2 -2
- data/lib/gir_ffi/callback_base.rb +7 -9
- data/lib/gir_ffi/class_base.rb +6 -5
- data/lib/gir_ffi/core.rb +36 -22
- data/lib/gir_ffi/enum_base.rb +1 -1
- data/lib/gir_ffi/enum_like_base.rb +2 -2
- data/lib/gir_ffi/error_argument_info.rb +2 -2
- data/lib/gir_ffi/error_type_info.rb +1 -1
- data/lib/gir_ffi/ffi_ext.rb +1 -1
- data/lib/gir_ffi/ffi_ext/pointer.rb +1 -1
- data/lib/gir_ffi/flags_base.rb +1 -1
- data/lib/gir_ffi/glib_error.rb +1 -2
- data/lib/gir_ffi/in_pointer.rb +17 -0
- data/lib/gir_ffi/info_ext.rb +15 -15
- data/lib/gir_ffi/info_ext/full_type_name.rb +3 -3
- data/lib/gir_ffi/info_ext/i_arg_info.rb +1 -1
- data/lib/gir_ffi/info_ext/i_callable_info.rb +1 -1
- data/lib/gir_ffi/info_ext/i_callback_info.rb +1 -1
- data/lib/gir_ffi/info_ext/i_field_info.rb +1 -1
- data/lib/gir_ffi/info_ext/i_function_info.rb +1 -1
- data/lib/gir_ffi/info_ext/i_property_info.rb +2 -2
- data/lib/gir_ffi/info_ext/i_registered_type_info.rb +4 -5
- data/lib/gir_ffi/info_ext/i_signal_info.rb +7 -3
- data/lib/gir_ffi/info_ext/i_type_info.rb +48 -26
- data/lib/gir_ffi/info_ext/i_unresolved_info.rb +1 -1
- data/lib/gir_ffi/info_ext/i_value_info.rb +2 -2
- data/lib/gir_ffi/info_ext/i_vfunc_info.rb +2 -2
- data/lib/gir_ffi/info_ext/safe_constant_name.rb +8 -8
- data/lib/gir_ffi/info_ext/safe_function_name.rb +2 -2
- data/lib/gir_ffi/interface_base.rb +3 -3
- data/lib/gir_ffi/lib_c.rb +1 -1
- data/lib/gir_ffi/method_stubber.rb +1 -1
- data/lib/gir_ffi/module_base.rb +1 -1
- data/lib/gir_ffi/object_base.rb +30 -4
- data/lib/gir_ffi/receiver_argument_info.rb +1 -1
- data/lib/gir_ffi/receiver_type_info.rb +2 -2
- data/lib/gir_ffi/registered_type_base.rb +1 -1
- data/lib/gir_ffi/return_value_info.rb +1 -2
- data/lib/gir_ffi/sized_array.rb +4 -2
- data/lib/gir_ffi/struct.rb +1 -1
- data/lib/gir_ffi/struct_base.rb +2 -10
- data/lib/gir_ffi/struct_like_base.rb +9 -5
- data/lib/gir_ffi/type_map.rb +2 -23
- data/lib/gir_ffi/unintrospectable_boxed_info.rb +2 -2
- data/lib/gir_ffi/unintrospectable_type_info.rb +6 -2
- data/lib/gir_ffi/union.rb +1 -1
- data/lib/gir_ffi/union_base.rb +2 -10
- data/lib/gir_ffi/user_defined_object_info.rb +9 -4
- data/lib/gir_ffi/user_defined_property_info.rb +33 -33
- data/lib/gir_ffi/version.rb +1 -1
- data/lib/gir_ffi/vfunc_implementation.rb +1 -0
- metadata +102 -155
- data/Gemfile +0 -12
- data/Rakefile +0 -9
- data/lib/ffi-glib/array_methods.rb +0 -16
- data/tasks/test.rake +0 -203
- data/test/base_test_helper.rb +0 -63
- data/test/ffi-glib/array_test.rb +0 -188
- data/test/ffi-glib/byte_array_test.rb +0 -22
- data/test/ffi-glib/bytes_test.rb +0 -56
- data/test/ffi-glib/closure_test.rb +0 -38
- data/test/ffi-glib/destroy_notify_test.rb +0 -18
- data/test/ffi-glib/hash_table_test.rb +0 -68
- data/test/ffi-glib/list_test.rb +0 -86
- data/test/ffi-glib/main_loop_test.rb +0 -53
- data/test/ffi-glib/ptr_array_test.rb +0 -112
- data/test/ffi-glib/ruby_closure_test.rb +0 -62
- data/test/ffi-glib/s_list_test.rb +0 -76
- data/test/ffi-glib/strv_test.rb +0 -60
- data/test/ffi-glib/variant_test.rb +0 -12
- data/test/ffi-gobject/gobject_test.rb +0 -72
- data/test/ffi-gobject/object_class_test.rb +0 -31
- data/test/ffi-gobject/object_test.rb +0 -140
- data/test/ffi-gobject/param_spec_test.rb +0 -32
- data/test/ffi-gobject/value_test.rb +0 -370
- data/test/ffi-gobject_introspection/gobject_type_init_test.rb +0 -26
- data/test/ffi-gobject_introspection/i_base_info_test.rb +0 -53
- data/test/ffi-gobject_introspection/i_constant_info_test.rb +0 -33
- data/test/ffi-gobject_introspection/i_enum_info_test.rb +0 -18
- data/test/ffi-gobject_introspection/i_function_info_test.rb +0 -6
- data/test/ffi-gobject_introspection/i_interface_info_test.rb +0 -23
- data/test/ffi-gobject_introspection/i_object_info_test.rb +0 -49
- data/test/ffi-gobject_introspection/i_property_info_test.rb +0 -47
- data/test/ffi-gobject_introspection/i_registered_type_info_test.rb +0 -27
- data/test/ffi-gobject_introspection/i_repository_test.rb +0 -81
- data/test/ffi-gobject_introspection/i_struct_info_test.rb +0 -23
- data/test/ffi-gobject_introspection/i_type_info_test.rb +0 -33
- data/test/ffi-gobject_introspection/i_union_info_test.rb +0 -17
- data/test/ffi-gobject_introspection/i_vfunc_info_test.rb +0 -41
- data/test/ffi-gobject_introspection/lib_test.rb +0 -13
- data/test/ffi-gobject_introspection/strv_test.rb +0 -46
- data/test/ffi-gobject_test.rb +0 -151
- data/test/gir_ffi/allocation_helper_test.rb +0 -36
- data/test/gir_ffi/arg_helper_test.rb +0 -140
- data/test/gir_ffi/boolean_test.rb +0 -43
- data/test/gir_ffi/boxed_base_test.rb +0 -65
- data/test/gir_ffi/builder_test.rb +0 -300
- data/test/gir_ffi/builders/argument_builder_test.rb +0 -657
- data/test/gir_ffi/builders/base_argument_builder_test.rb +0 -6
- data/test/gir_ffi/builders/callback_argument_builder_test.rb +0 -129
- data/test/gir_ffi/builders/callback_builder_test.rb +0 -118
- data/test/gir_ffi/builders/callback_return_value_builder_test.rb +0 -85
- data/test/gir_ffi/builders/constant_builder_test.rb +0 -6
- data/test/gir_ffi/builders/constructor_builder_test.rb +0 -37
- data/test/gir_ffi/builders/enum_builder_test.rb +0 -23
- data/test/gir_ffi/builders/field_builder_test.rb +0 -134
- data/test/gir_ffi/builders/function_builder_test.rb +0 -538
- data/test/gir_ffi/builders/initializer_builder_test.rb +0 -54
- data/test/gir_ffi/builders/interface_builder_test.rb +0 -32
- data/test/gir_ffi/builders/module_builder_test.rb +0 -43
- data/test/gir_ffi/builders/object_builder_test.rb +0 -98
- data/test/gir_ffi/builders/property_builder_test.rb +0 -161
- data/test/gir_ffi/builders/registered_type_builder_test.rb +0 -30
- data/test/gir_ffi/builders/return_value_builder_test.rb +0 -440
- data/test/gir_ffi/builders/signal_closure_builder_test.rb +0 -188
- data/test/gir_ffi/builders/struct_builder_test.rb +0 -93
- data/test/gir_ffi/builders/unintrospectable_boxed_builder_test.rb +0 -35
- data/test/gir_ffi/builders/unintrospectable_builder_test.rb +0 -73
- data/test/gir_ffi/builders/union_builder_test.rb +0 -31
- data/test/gir_ffi/builders/user_defined_builder_test.rb +0 -524
- data/test/gir_ffi/builders/vfunc_argument_builder_test.rb +0 -101
- data/test/gir_ffi/builders/vfunc_builder_test.rb +0 -253
- data/test/gir_ffi/callback_base_test.rb +0 -22
- data/test/gir_ffi/class_base_test.rb +0 -168
- data/test/gir_ffi/core_test.rb +0 -98
- data/test/gir_ffi/enum_base_test.rb +0 -43
- data/test/gir_ffi/error_type_info_test.rb +0 -50
- data/test/gir_ffi/ffi_ext/pointer_test.rb +0 -20
- data/test/gir_ffi/g_type_test.rb +0 -31
- data/test/gir_ffi/in_out_pointer_test.rb +0 -56
- data/test/gir_ffi/in_pointer_test.rb +0 -183
- data/test/gir_ffi/info_ext/i_callable_info_test.rb +0 -26
- data/test/gir_ffi/info_ext/i_callback_info_test.rb +0 -21
- data/test/gir_ffi/info_ext/i_field_info_test.rb +0 -37
- data/test/gir_ffi/info_ext/i_function_info_test.rb +0 -74
- data/test/gir_ffi/info_ext/i_signal_info_test.rb +0 -32
- data/test/gir_ffi/info_ext/i_type_info_test.rb +0 -697
- data/test/gir_ffi/info_ext/i_unresolved_info_test.rb +0 -19
- data/test/gir_ffi/info_ext/safe_constant_name_test.rb +0 -26
- data/test/gir_ffi/info_ext/safe_function_name_test.rb +0 -26
- data/test/gir_ffi/interface_base_test.rb +0 -20
- data/test/gir_ffi/method_stubber_test.rb +0 -65
- data/test/gir_ffi/object_base_test.rb +0 -64
- data/test/gir_ffi/object_store_test.rb +0 -41
- data/test/gir_ffi/receiver_argument_info_test.rb +0 -33
- data/test/gir_ffi/sized_array_test.rb +0 -206
- data/test/gir_ffi/struct_base_test.rb +0 -23
- data/test/gir_ffi/struct_like_base_test.rb +0 -167
- data/test/gir_ffi/type_map_test.rb +0 -17
- data/test/gir_ffi/unintrospectable_type_info_test.rb +0 -121
- data/test/gir_ffi/union_base_test.rb +0 -23
- data/test/gir_ffi/user_defined_object_info_test.rb +0 -119
- data/test/gir_ffi/user_defined_property_info_test.rb +0 -39
- data/test/gir_ffi/variable_name_generator_test.rb +0 -18
- data/test/gir_ffi/version_test.rb +0 -9
- data/test/gir_ffi/zero_terminated_test.rb +0 -108
- data/test/gir_ffi_test_helper.rb +0 -84
- data/test/integration/callback_exceptions_test.rb +0 -63
- data/test/integration/derived_classes_test.rb +0 -53
- data/test/integration/generated_everything_test.rb +0 -452
- data/test/integration/generated_gimarshallingtests_test.rb +0 -2995
- data/test/integration/generated_gio_test.rb +0 -116
- data/test/integration/generated_glib_test.rb +0 -12
- data/test/integration/generated_gobject_test.rb +0 -116
- data/test/integration/generated_gst_test.rb +0 -34
- data/test/integration/generated_gtk_source_test.rb +0 -27
- data/test/integration/generated_gtop_test.rb +0 -29
- data/test/integration/generated_pango_ft2_test.rb +0 -17
- data/test/integration/generated_pango_test.rb +0 -24
- data/test/integration/generated_regress_test.rb +0 -3850
- data/test/integration/generated_secret_test.rb +0 -17
- data/test/integration/generated_utility_test.rb +0 -174
- data/test/integration/generated_warnlib_test.rb +0 -49
- data/test/integration/method_lookup_test.rb +0 -34
- data/test/introspection_test_helper.rb +0 -52
- data/test/lib/Makefile.am +0 -110
- data/test/lib/autogen.sh +0 -4
- data/test/lib/configure.ac +0 -34
- data/test/lib/m4/jhflags.m4 +0 -21
- data/test/minitest/stats_plugin.rb +0 -30
@@ -1,39 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
require 'gir_ffi_test_helper'
|
4
|
-
require 'gir_ffi/user_defined_property_info'
|
5
|
-
|
6
|
-
describe GirFFI::UserDefinedPropertyInfo do
|
7
|
-
let(:pspec) do
|
8
|
-
GObject.param_spec_int('foo-bar', 'foo bar',
|
9
|
-
'Foo Bar',
|
10
|
-
1, 3, 2,
|
11
|
-
readable: true, writable: true)
|
12
|
-
end
|
13
|
-
let(:container) { Object.new }
|
14
|
-
let(:info) { GirFFI::UserDefinedPropertyInfo.new pspec, container, 24 }
|
15
|
-
|
16
|
-
describe '#param_spec' do
|
17
|
-
it 'returns the passed in parameter specification' do
|
18
|
-
info.param_spec.must_equal pspec
|
19
|
-
end
|
20
|
-
end
|
21
|
-
|
22
|
-
describe '#name' do
|
23
|
-
it 'returns the accessor name from the parameter specification' do
|
24
|
-
info.name.must_equal 'foo_bar'
|
25
|
-
end
|
26
|
-
end
|
27
|
-
|
28
|
-
describe '#ffi_type' do
|
29
|
-
it 'returns the ffi type corresponding to the type tag' do
|
30
|
-
info.ffi_type.must_equal :int
|
31
|
-
end
|
32
|
-
end
|
33
|
-
|
34
|
-
describe '#field_type.tag' do
|
35
|
-
it 'returns the mapped type symbol' do
|
36
|
-
info.field_type.tag.must_equal :gint
|
37
|
-
end
|
38
|
-
end
|
39
|
-
end
|
@@ -1,18 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
require 'gir_ffi_test_helper'
|
4
|
-
|
5
|
-
require 'gir_ffi/variable_name_generator'
|
6
|
-
|
7
|
-
describe GirFFI::VariableNameGenerator do
|
8
|
-
describe '#new_var' do
|
9
|
-
it 'generates a sequence of predictable variable names' do
|
10
|
-
gen = GirFFI::VariableNameGenerator.new
|
11
|
-
|
12
|
-
assert_equal '_v1', gen.new_var
|
13
|
-
assert_equal '_v2', gen.new_var
|
14
|
-
assert_equal '_v3', gen.new_var
|
15
|
-
assert_equal '_v4', gen.new_var
|
16
|
-
end
|
17
|
-
end
|
18
|
-
end
|
@@ -1,108 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
require 'gir_ffi_test_helper'
|
4
|
-
|
5
|
-
describe GirFFI::ZeroTerminated do
|
6
|
-
describe '.from' do
|
7
|
-
let(:result) { GirFFI::ZeroTerminated.from :int32, [1, 2, 3] }
|
8
|
-
|
9
|
-
it 'converts the passed array into a zero-terminated c array' do
|
10
|
-
ptr = result.to_ptr
|
11
|
-
ptr.read_array_of_int32(4).must_equal [1, 2, 3, 0]
|
12
|
-
end
|
13
|
-
|
14
|
-
it 'returns a GirFFI::ZeroTerminated object' do
|
15
|
-
result.must_be_instance_of GirFFI::ZeroTerminated
|
16
|
-
end
|
17
|
-
|
18
|
-
it 'works for Regress::TestEnum from numbers' do
|
19
|
-
GirFFI.setup :Regress
|
20
|
-
enum_arr = GirFFI::ZeroTerminated.from Regress::TestEnum, [1, -1, 48]
|
21
|
-
ptr = enum_arr.to_ptr
|
22
|
-
ptr.read_array_of_int32(4).must_equal [1, -1, 48, 0]
|
23
|
-
end
|
24
|
-
|
25
|
-
it 'works for Regress::TestEnum from symbols' do
|
26
|
-
GirFFI.setup :Regress
|
27
|
-
enum_arr = GirFFI::ZeroTerminated.from Regress::TestEnum, [:value2, :value3, :value4]
|
28
|
-
ptr = enum_arr.to_ptr
|
29
|
-
ptr.read_array_of_int32(4).must_equal [1, -1, 48, 0]
|
30
|
-
end
|
31
|
-
end
|
32
|
-
|
33
|
-
describe '.wrap' do
|
34
|
-
it 'wraps the given type and pointer' do
|
35
|
-
ptr = GirFFI::InPointer.from_array :int32, [1, 2, 3, 0]
|
36
|
-
zt = GirFFI::ZeroTerminated.wrap :foo, ptr
|
37
|
-
zt.element_type.must_equal :foo
|
38
|
-
zt.to_ptr.must_equal ptr
|
39
|
-
end
|
40
|
-
end
|
41
|
-
|
42
|
-
describe '#each' do
|
43
|
-
it 'yields each element' do
|
44
|
-
zt = GirFFI::ZeroTerminated.from :int32, [1, 2, 3]
|
45
|
-
arr = []
|
46
|
-
zt.each do |int|
|
47
|
-
arr << int
|
48
|
-
end
|
49
|
-
arr.must_equal [1, 2, 3]
|
50
|
-
end
|
51
|
-
|
52
|
-
it 'yields zero times for a ZeroTerminated wrapping a null pointer' do
|
53
|
-
zt = GirFFI::ZeroTerminated.wrap :int32, FFI::Pointer.new(0)
|
54
|
-
zt.each do |_str|
|
55
|
-
flunk
|
56
|
-
end
|
57
|
-
end
|
58
|
-
|
59
|
-
it 'works for :int8' do
|
60
|
-
zt = GirFFI::ZeroTerminated.from :int8, [1, 2, 3]
|
61
|
-
arr = []
|
62
|
-
zt.each do |int|
|
63
|
-
arr << int
|
64
|
-
end
|
65
|
-
arr.must_equal [1, 2, 3]
|
66
|
-
end
|
67
|
-
end
|
68
|
-
|
69
|
-
describe '#==' do
|
70
|
-
it 'returns true when comparing to an array with the same elements' do
|
71
|
-
zero_terminated = GirFFI::ZeroTerminated.from :int32, [1, 2, 3]
|
72
|
-
|
73
|
-
(zero_terminated == [1, 2, 3]).must_equal true
|
74
|
-
end
|
75
|
-
|
76
|
-
it 'returns false when comparing to an array with different elements' do
|
77
|
-
zero_terminated = GirFFI::ZeroTerminated.from :int32, [1, 2, 3]
|
78
|
-
|
79
|
-
(zero_terminated == [1, 2]).must_equal false
|
80
|
-
end
|
81
|
-
|
82
|
-
it 'returns true when comparing to a zero-terminated array with the same elements' do
|
83
|
-
zero_terminated = GirFFI::ZeroTerminated.from :int32, [1, 2, 3]
|
84
|
-
other = GirFFI::ZeroTerminated.from :int32, [1, 2, 3]
|
85
|
-
|
86
|
-
(zero_terminated == other).must_equal true
|
87
|
-
end
|
88
|
-
|
89
|
-
it 'returns false when comparing to a zero-terminated array with different elements' do
|
90
|
-
zero_terminated = GirFFI::ZeroTerminated.from :int32, [1, 2, 3]
|
91
|
-
other = GirFFI::ZeroTerminated.from :int32, [1, 2]
|
92
|
-
|
93
|
-
(zero_terminated == other).must_equal false
|
94
|
-
end
|
95
|
-
end
|
96
|
-
|
97
|
-
it 'includes Enumerable' do
|
98
|
-
GirFFI::ZeroTerminated.must_include Enumerable
|
99
|
-
end
|
100
|
-
|
101
|
-
describe '#to_a' do
|
102
|
-
it 'works for Regress::TestEnum' do
|
103
|
-
GirFFI.setup :Regress
|
104
|
-
enum_arr = GirFFI::ZeroTerminated.from Regress::TestEnum, [1, 48, -1]
|
105
|
-
enum_arr.to_a.must_equal [:value2, :value4, :value3]
|
106
|
-
end
|
107
|
-
end
|
108
|
-
end
|
data/test/gir_ffi_test_helper.rb
DELETED
@@ -1,84 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
require 'introspection_test_helper'
|
4
|
-
|
5
|
-
require 'gir_ffi'
|
6
|
-
|
7
|
-
# Global sequence provider. Needed to make unique class names.
|
8
|
-
class Sequence
|
9
|
-
def self.next
|
10
|
-
@seq ||= 0
|
11
|
-
@seq += + 1
|
12
|
-
end
|
13
|
-
end
|
14
|
-
|
15
|
-
module GirFFITestExtensions
|
16
|
-
SAVED_MODULES = {}
|
17
|
-
|
18
|
-
def save_module(name)
|
19
|
-
return unless Object.const_defined? name
|
20
|
-
|
21
|
-
puts "Saving #{name} over existing" if SAVED_MODULES.key? name
|
22
|
-
SAVED_MODULES[name] = Object.const_get name
|
23
|
-
Object.send(:remove_const, name)
|
24
|
-
end
|
25
|
-
|
26
|
-
def restore_module(name)
|
27
|
-
Object.send(:remove_const, name) if Object.const_defined? name
|
28
|
-
return unless SAVED_MODULES.key? name
|
29
|
-
|
30
|
-
Object.const_set name, SAVED_MODULES[name]
|
31
|
-
SAVED_MODULES.delete name
|
32
|
-
end
|
33
|
-
|
34
|
-
def object_ref_count(ptr)
|
35
|
-
GObject::Object::Struct.new(ptr.to_ptr)[:ref_count]
|
36
|
-
end
|
37
|
-
|
38
|
-
def max_for_unsigned_type(type)
|
39
|
-
(1 << (FFI.type_size(type) * 8)) - 1
|
40
|
-
end
|
41
|
-
|
42
|
-
def max_for_type(type)
|
43
|
-
(1 << (FFI.type_size(type) * 8 - 1)) - 1
|
44
|
-
end
|
45
|
-
|
46
|
-
def min_for_type(type)
|
47
|
-
~max_for_type(type)
|
48
|
-
end
|
49
|
-
|
50
|
-
def max_long
|
51
|
-
max_for_type :long
|
52
|
-
end
|
53
|
-
|
54
|
-
def min_long
|
55
|
-
min_for_type :long
|
56
|
-
end
|
57
|
-
|
58
|
-
def max_size_t
|
59
|
-
max_for_unsigned_type :size_t
|
60
|
-
end
|
61
|
-
|
62
|
-
def max_ssize_t
|
63
|
-
# FFI has no :ssize_t, but it's the same number of bits as :size_t
|
64
|
-
max_for_type :size_t
|
65
|
-
end
|
66
|
-
|
67
|
-
def min_ssize_t
|
68
|
-
min_for_type :size_t
|
69
|
-
end
|
70
|
-
|
71
|
-
def max_ushort
|
72
|
-
max_for_unsigned_type :ushort
|
73
|
-
end
|
74
|
-
|
75
|
-
def max_uint
|
76
|
-
max_for_unsigned_type :uint
|
77
|
-
end
|
78
|
-
|
79
|
-
def max_ulong
|
80
|
-
max_for_unsigned_type :ulong
|
81
|
-
end
|
82
|
-
end
|
83
|
-
|
84
|
-
Minitest::Test.send :include, GirFFITestExtensions
|
@@ -1,63 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
require 'gir_ffi_test_helper'
|
4
|
-
|
5
|
-
GirFFI.setup :Regress
|
6
|
-
|
7
|
-
class CallbackTestException < RuntimeError; end
|
8
|
-
|
9
|
-
describe 'An exception in a callback' do
|
10
|
-
describe 'for signals' do
|
11
|
-
let(:object) { Regress::TestSubObj.new }
|
12
|
-
|
13
|
-
before do
|
14
|
-
object.signal_connect 'test' do
|
15
|
-
raise CallbackTestException, 'Boom'
|
16
|
-
end
|
17
|
-
end
|
18
|
-
|
19
|
-
describe 'when the signal is emitted synchronously' do
|
20
|
-
it 'raises an error' do
|
21
|
-
proc { GObject.signal_emit object, 'test' }.must_raise CallbackTestException
|
22
|
-
end
|
23
|
-
end
|
24
|
-
|
25
|
-
describe 'when the signal is emitted during an event loop' do
|
26
|
-
it 'causes loop run to be terminated with an exception' do
|
27
|
-
main_loop = GLib::MainLoop.new nil, false
|
28
|
-
|
29
|
-
GLib.timeout_add GLib::PRIORITY_DEFAULT, 1 do
|
30
|
-
GObject.signal_emit object, 'test'
|
31
|
-
false
|
32
|
-
end
|
33
|
-
# Guard against runaway loop
|
34
|
-
GLib.timeout_add GLib::PRIORITY_DEFAULT, 500 do
|
35
|
-
main_loop.quit
|
36
|
-
end
|
37
|
-
proc do
|
38
|
-
main_loop.run
|
39
|
-
end.must_raise CallbackTestException
|
40
|
-
end
|
41
|
-
end
|
42
|
-
end
|
43
|
-
|
44
|
-
describe 'for other callbacks' do
|
45
|
-
describe 'when the callback occurs during an event loop' do
|
46
|
-
it 'causes loop run to be terminated with an exception' do
|
47
|
-
main_loop = GLib::MainLoop.new nil, false
|
48
|
-
|
49
|
-
GLib.timeout_add GLib::PRIORITY_DEFAULT, 1 do
|
50
|
-
raise CallbackTestException, 'Boom'
|
51
|
-
end
|
52
|
-
# Guard against runaway loop
|
53
|
-
GLib.timeout_add GLib::PRIORITY_DEFAULT, 500 do
|
54
|
-
main_loop.quit
|
55
|
-
end
|
56
|
-
|
57
|
-
proc do
|
58
|
-
main_loop.run
|
59
|
-
end.must_raise CallbackTestException
|
60
|
-
end
|
61
|
-
end
|
62
|
-
end
|
63
|
-
end
|
@@ -1,53 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
require 'gir_ffi_test_helper'
|
4
|
-
|
5
|
-
GirFFI.setup :Regress
|
6
|
-
|
7
|
-
# Tests deriving Ruby classes from GObject classes.
|
8
|
-
describe 'For derived classes' do
|
9
|
-
describe 'setting up methods when first called' do
|
10
|
-
before do
|
11
|
-
save_module :GIMarshallingTests
|
12
|
-
GirFFI.setup :GIMarshallingTests
|
13
|
-
end
|
14
|
-
|
15
|
-
describe 'when an interface is mixed in' do
|
16
|
-
before do
|
17
|
-
@klass = Class.new GIMarshallingTests::OverridesObject
|
18
|
-
@klass.send :include, GIMarshallingTests::Interface
|
19
|
-
end
|
20
|
-
|
21
|
-
it 'finds class methods in the superclass' do
|
22
|
-
@klass.returnv
|
23
|
-
end
|
24
|
-
|
25
|
-
it 'finds instance methods in the superclass' do
|
26
|
-
obj = @klass.new
|
27
|
-
result = obj.method
|
28
|
-
result.must_equal 42
|
29
|
-
end
|
30
|
-
end
|
31
|
-
|
32
|
-
after do
|
33
|
-
restore_module :GIMarshallingTests
|
34
|
-
end
|
35
|
-
end
|
36
|
-
|
37
|
-
describe 'the initializer' do
|
38
|
-
it 'works if it calls super' do
|
39
|
-
klass = Class.new Regress::TestSubObj do
|
40
|
-
attr_reader :animal
|
41
|
-
def initialize(animal)
|
42
|
-
super()
|
43
|
-
@animal = animal
|
44
|
-
end
|
45
|
-
end
|
46
|
-
|
47
|
-
obj = klass.new 'dog'
|
48
|
-
obj.must_be_instance_of klass
|
49
|
-
obj.to_ptr.wont_be_nil
|
50
|
-
obj.animal.must_equal 'dog'
|
51
|
-
end
|
52
|
-
end
|
53
|
-
end
|
@@ -1,452 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
require 'gir_ffi_test_helper'
|
4
|
-
|
5
|
-
GirFFI.setup :Everything
|
6
|
-
|
7
|
-
describe Everything do
|
8
|
-
it 'has a working function #const_return_GType' do
|
9
|
-
Everything.const_return_GType.must_equal GObject::TYPE_OBJECT
|
10
|
-
end
|
11
|
-
|
12
|
-
it 'has a working function #const_return_filename' do
|
13
|
-
Everything.const_return_filename.must_equal ''
|
14
|
-
end
|
15
|
-
|
16
|
-
it 'has a working function #const_return_gboolean' do
|
17
|
-
Everything.const_return_gboolean.must_equal false
|
18
|
-
end
|
19
|
-
|
20
|
-
it 'has a working function #const_return_gchar' do
|
21
|
-
Everything.const_return_gchar.must_equal 0
|
22
|
-
end
|
23
|
-
|
24
|
-
it 'has a working function #const_return_gdouble' do
|
25
|
-
Everything.const_return_gdouble.must_equal 0
|
26
|
-
end
|
27
|
-
|
28
|
-
it 'has a working function #const_return_gfloat' do
|
29
|
-
Everything.const_return_gfloat.must_equal 0
|
30
|
-
end
|
31
|
-
|
32
|
-
it 'has a working function #const_return_gint' do
|
33
|
-
Everything.const_return_gint.must_equal 0
|
34
|
-
end
|
35
|
-
|
36
|
-
it 'has a working function #const_return_gint16' do
|
37
|
-
Everything.const_return_gint16.must_equal 0
|
38
|
-
end
|
39
|
-
|
40
|
-
it 'has a working function #const_return_gint32' do
|
41
|
-
Everything.const_return_gint32.must_equal 0
|
42
|
-
end
|
43
|
-
|
44
|
-
it 'has a working function #const_return_gint64' do
|
45
|
-
Everything.const_return_gint64.must_equal 0
|
46
|
-
end
|
47
|
-
|
48
|
-
it 'has a working function #const_return_gint8' do
|
49
|
-
Everything.const_return_gint8.must_equal 0
|
50
|
-
end
|
51
|
-
|
52
|
-
it 'has a working function #const_return_gintptr' do
|
53
|
-
Everything.const_return_gintptr.must_equal 0
|
54
|
-
end
|
55
|
-
|
56
|
-
it 'has a working function #const_return_glong' do
|
57
|
-
Everything.const_return_glong.must_equal 0
|
58
|
-
end
|
59
|
-
|
60
|
-
it 'has a working function #const_return_gpointer' do
|
61
|
-
skip unless get_introspection_data 'Everything', 'const_return_gpointer'
|
62
|
-
Everything.const_return_gpointer.must_be :null?
|
63
|
-
end
|
64
|
-
|
65
|
-
it 'has a working function #const_return_gshort' do
|
66
|
-
Everything.const_return_gshort.must_equal 0
|
67
|
-
end
|
68
|
-
|
69
|
-
it 'has a working function #const_return_gsize' do
|
70
|
-
Everything.const_return_gsize.must_equal 0
|
71
|
-
end
|
72
|
-
|
73
|
-
it 'has a working function #const_return_gssize' do
|
74
|
-
Everything.const_return_gssize.must_equal 0
|
75
|
-
end
|
76
|
-
|
77
|
-
it 'has a working function #const_return_guint' do
|
78
|
-
Everything.const_return_guint.must_equal 0
|
79
|
-
end
|
80
|
-
|
81
|
-
it 'has a working function #const_return_guint16' do
|
82
|
-
Everything.const_return_guint16.must_equal 0
|
83
|
-
end
|
84
|
-
|
85
|
-
it 'has a working function #const_return_guint32' do
|
86
|
-
Everything.const_return_guint32.must_equal 0
|
87
|
-
end
|
88
|
-
|
89
|
-
it 'has a working function #const_return_guint64' do
|
90
|
-
Everything.const_return_guint64.must_equal 0
|
91
|
-
end
|
92
|
-
|
93
|
-
it 'has a working function #const_return_guint8' do
|
94
|
-
Everything.const_return_guint8.must_equal 0
|
95
|
-
end
|
96
|
-
|
97
|
-
it 'has a working function #const_return_guintptr' do
|
98
|
-
Everything.const_return_guintptr.must_equal 0
|
99
|
-
end
|
100
|
-
|
101
|
-
it 'has a working function #const_return_gulong' do
|
102
|
-
Everything.const_return_gulong.must_equal 0
|
103
|
-
end
|
104
|
-
|
105
|
-
it 'has a working function #const_return_gunichar' do
|
106
|
-
Everything.const_return_gunichar.must_equal 0
|
107
|
-
end
|
108
|
-
|
109
|
-
it 'has a working function #const_return_gushort' do
|
110
|
-
Everything.const_return_gushort.must_equal 0
|
111
|
-
end
|
112
|
-
|
113
|
-
it 'has a working function #const_return_utf8' do
|
114
|
-
Everything.const_return_utf8.must_equal ''
|
115
|
-
end
|
116
|
-
|
117
|
-
it 'has a working function #nullfunc' do
|
118
|
-
Everything.nullfunc.must_be_nil
|
119
|
-
end
|
120
|
-
|
121
|
-
it 'has a working function #one_outparam_GType' do
|
122
|
-
Everything.one_outparam_GType.must_equal 0
|
123
|
-
end
|
124
|
-
|
125
|
-
it 'has a working function #one_outparam_filename' do
|
126
|
-
# NOTE: This function stores a null pointer in its output parameter.
|
127
|
-
Everything.one_outparam_filename.must_be_nil
|
128
|
-
end
|
129
|
-
|
130
|
-
it 'has a working function #one_outparam_gboolean' do
|
131
|
-
Everything.one_outparam_gboolean.must_equal false
|
132
|
-
end
|
133
|
-
|
134
|
-
it 'has a working function #one_outparam_gchar' do
|
135
|
-
skip 'GIR gives the incorrect type: utf8 instead of gchar'
|
136
|
-
Everything.one_outparam_gchar.must_equal 0
|
137
|
-
end
|
138
|
-
|
139
|
-
it 'has a working function #one_outparam_gdouble' do
|
140
|
-
Everything.one_outparam_gdouble.must_equal 0
|
141
|
-
end
|
142
|
-
|
143
|
-
it 'has a working function #one_outparam_gfloat' do
|
144
|
-
Everything.one_outparam_gfloat.must_equal 0
|
145
|
-
end
|
146
|
-
|
147
|
-
it 'has a working function #one_outparam_gint' do
|
148
|
-
Everything.one_outparam_gint.must_equal 0
|
149
|
-
end
|
150
|
-
|
151
|
-
it 'has a working function #one_outparam_gint16' do
|
152
|
-
Everything.one_outparam_gint16.must_equal 0
|
153
|
-
end
|
154
|
-
|
155
|
-
it 'has a working function #one_outparam_gint32' do
|
156
|
-
Everything.one_outparam_gint32.must_equal 0
|
157
|
-
end
|
158
|
-
|
159
|
-
it 'has a working function #one_outparam_gint64' do
|
160
|
-
Everything.one_outparam_gint64.must_equal 0
|
161
|
-
end
|
162
|
-
|
163
|
-
it 'has a working function #one_outparam_gint8' do
|
164
|
-
Everything.one_outparam_gint8.must_equal 0
|
165
|
-
end
|
166
|
-
|
167
|
-
it 'has a working function #one_outparam_gintptr' do
|
168
|
-
Everything.one_outparam_gintptr.must_equal 0
|
169
|
-
end
|
170
|
-
|
171
|
-
it 'has a working function #one_outparam_glong' do
|
172
|
-
Everything.one_outparam_glong.must_equal 0
|
173
|
-
end
|
174
|
-
|
175
|
-
it 'has a working function #one_outparam_gpointer' do
|
176
|
-
skip unless get_introspection_data 'Everything', 'one_outparam_gpointer'
|
177
|
-
Everything.one_outparam_gpointer.must_be :null?
|
178
|
-
end
|
179
|
-
|
180
|
-
it 'has a working function #one_outparam_gshort' do
|
181
|
-
Everything.one_outparam_gshort.must_equal 0
|
182
|
-
end
|
183
|
-
|
184
|
-
it 'has a working function #one_outparam_gsize' do
|
185
|
-
Everything.one_outparam_gsize.must_equal 0
|
186
|
-
end
|
187
|
-
|
188
|
-
it 'has a working function #one_outparam_gssize' do
|
189
|
-
Everything.one_outparam_gssize.must_equal 0
|
190
|
-
end
|
191
|
-
|
192
|
-
it 'has a working function #one_outparam_guint' do
|
193
|
-
Everything.one_outparam_guint.must_equal 0
|
194
|
-
end
|
195
|
-
|
196
|
-
it 'has a working function #one_outparam_guint16' do
|
197
|
-
Everything.one_outparam_guint16.must_equal 0
|
198
|
-
end
|
199
|
-
|
200
|
-
it 'has a working function #one_outparam_guint32' do
|
201
|
-
Everything.one_outparam_guint32.must_equal 0
|
202
|
-
end
|
203
|
-
|
204
|
-
it 'has a working function #one_outparam_guint64' do
|
205
|
-
Everything.one_outparam_guint64.must_equal 0
|
206
|
-
end
|
207
|
-
|
208
|
-
it 'has a working function #one_outparam_guint8' do
|
209
|
-
Everything.one_outparam_guint8.must_equal 0
|
210
|
-
end
|
211
|
-
|
212
|
-
it 'has a working function #one_outparam_guintptr' do
|
213
|
-
Everything.one_outparam_guintptr.must_equal 0
|
214
|
-
end
|
215
|
-
|
216
|
-
it 'has a working function #one_outparam_gulong' do
|
217
|
-
Everything.one_outparam_gulong.must_equal 0
|
218
|
-
end
|
219
|
-
|
220
|
-
it 'has a working function #one_outparam_gunichar' do
|
221
|
-
Everything.one_outparam_gunichar.must_equal 0
|
222
|
-
end
|
223
|
-
|
224
|
-
it 'has a working function #one_outparam_gushort' do
|
225
|
-
Everything.one_outparam_gushort.must_equal 0
|
226
|
-
end
|
227
|
-
|
228
|
-
it 'has a working function #one_outparam_utf8' do
|
229
|
-
# NOTE: This function stores a null pointer in its output parameter.
|
230
|
-
Everything.one_outparam_utf8.must_be_nil
|
231
|
-
end
|
232
|
-
|
233
|
-
it 'has a working function #oneparam_GType' do
|
234
|
-
Everything.oneparam_GType(0).must_be_nil
|
235
|
-
end
|
236
|
-
|
237
|
-
it 'has a working function #oneparam_filename' do
|
238
|
-
Everything.oneparam_filename('').must_be_nil
|
239
|
-
end
|
240
|
-
|
241
|
-
it 'has a working function #oneparam_gboolean' do
|
242
|
-
Everything.oneparam_gboolean(false).must_be_nil
|
243
|
-
end
|
244
|
-
|
245
|
-
it 'has a working function #oneparam_gchar' do
|
246
|
-
Everything.oneparam_gchar(0).must_be_nil
|
247
|
-
end
|
248
|
-
|
249
|
-
it 'has a working function #oneparam_gdouble' do
|
250
|
-
Everything.oneparam_gdouble(0.0).must_be_nil
|
251
|
-
end
|
252
|
-
|
253
|
-
it 'has a working function #oneparam_gfloat' do
|
254
|
-
Everything.oneparam_gfloat(0.0).must_be_nil
|
255
|
-
end
|
256
|
-
|
257
|
-
it 'has a working function #oneparam_gint' do
|
258
|
-
Everything.oneparam_gint(0).must_be_nil
|
259
|
-
end
|
260
|
-
|
261
|
-
it 'has a working function #oneparam_gint16' do
|
262
|
-
Everything.oneparam_gint16(0).must_be_nil
|
263
|
-
end
|
264
|
-
|
265
|
-
it 'has a working function #oneparam_gint32' do
|
266
|
-
Everything.oneparam_gint32(0).must_be_nil
|
267
|
-
end
|
268
|
-
|
269
|
-
it 'has a working function #oneparam_gint64' do
|
270
|
-
Everything.oneparam_gint64(0).must_be_nil
|
271
|
-
end
|
272
|
-
|
273
|
-
it 'has a working function #oneparam_gint8' do
|
274
|
-
Everything.oneparam_gint8(0).must_be_nil
|
275
|
-
end
|
276
|
-
|
277
|
-
it 'has a working function #oneparam_gintptr' do
|
278
|
-
Everything.oneparam_gintptr(0).must_be_nil
|
279
|
-
end
|
280
|
-
|
281
|
-
it 'has a working function #oneparam_glong' do
|
282
|
-
Everything.oneparam_glong(0).must_be_nil
|
283
|
-
end
|
284
|
-
|
285
|
-
it 'has a working function #oneparam_gpointer' do
|
286
|
-
skip unless get_introspection_data 'Everything', 'oneparam_gpointer'
|
287
|
-
Everything.oneparam_gpointer(FFI::MemoryPointer.new(:int)).must_be_nil
|
288
|
-
end
|
289
|
-
|
290
|
-
it 'has a working function #oneparam_gshort' do
|
291
|
-
Everything.oneparam_gshort(0).must_be_nil
|
292
|
-
end
|
293
|
-
|
294
|
-
it 'has a working function #oneparam_gsize' do
|
295
|
-
Everything.oneparam_gsize(0).must_be_nil
|
296
|
-
end
|
297
|
-
|
298
|
-
it 'has a working function #oneparam_gssize' do
|
299
|
-
Everything.oneparam_gssize(0).must_be_nil
|
300
|
-
end
|
301
|
-
|
302
|
-
it 'has a working function #oneparam_guint' do
|
303
|
-
Everything.oneparam_guint(0).must_be_nil
|
304
|
-
end
|
305
|
-
|
306
|
-
it 'has a working function #oneparam_guint16' do
|
307
|
-
Everything.oneparam_guint16(0).must_be_nil
|
308
|
-
end
|
309
|
-
|
310
|
-
it 'has a working function #oneparam_guint32' do
|
311
|
-
Everything.oneparam_guint32(0).must_be_nil
|
312
|
-
end
|
313
|
-
|
314
|
-
it 'has a working function #oneparam_guint64' do
|
315
|
-
Everything.oneparam_guint64(0).must_be_nil
|
316
|
-
end
|
317
|
-
|
318
|
-
it 'has a working function #oneparam_guint8' do
|
319
|
-
Everything.oneparam_guint8(0).must_be_nil
|
320
|
-
end
|
321
|
-
|
322
|
-
it 'has a working function #oneparam_guintptr' do
|
323
|
-
Everything.oneparam_guintptr(0).must_be_nil
|
324
|
-
end
|
325
|
-
|
326
|
-
it 'has a working function #oneparam_gulong' do
|
327
|
-
Everything.oneparam_gulong(0).must_be_nil
|
328
|
-
end
|
329
|
-
|
330
|
-
it 'has a working function #oneparam_gunichar' do
|
331
|
-
Everything.oneparam_gunichar(0).must_be_nil
|
332
|
-
end
|
333
|
-
|
334
|
-
it 'has a working function #oneparam_gushort' do
|
335
|
-
Everything.oneparam_gushort(0).must_be_nil
|
336
|
-
end
|
337
|
-
|
338
|
-
it 'has a working function #oneparam_utf8' do
|
339
|
-
Everything.oneparam_utf8('').must_be_nil
|
340
|
-
end
|
341
|
-
|
342
|
-
it 'has a working function #passthrough_one_GType' do
|
343
|
-
Everything.passthrough_one_GType(GObject::TYPE_OBJECT).must_equal GObject::TYPE_OBJECT
|
344
|
-
end
|
345
|
-
|
346
|
-
it 'has a working function #passthrough_one_filename' do
|
347
|
-
Everything.passthrough_one_filename('foo').must_equal 'foo'
|
348
|
-
end
|
349
|
-
|
350
|
-
it 'has a working function #passthrough_one_gboolean' do
|
351
|
-
Everything.passthrough_one_gboolean(true).must_equal true
|
352
|
-
end
|
353
|
-
|
354
|
-
it 'has a working function #passthrough_one_gchar' do
|
355
|
-
Everything.passthrough_one_gchar(42).must_equal 42
|
356
|
-
end
|
357
|
-
|
358
|
-
it 'has a working function #passthrough_one_gdouble' do
|
359
|
-
Everything.passthrough_one_gdouble(23.42).must_equal 23.42
|
360
|
-
end
|
361
|
-
|
362
|
-
it 'has a working function #passthrough_one_gfloat' do
|
363
|
-
Everything.passthrough_one_gfloat(23.42).must_be_close_to 23.42
|
364
|
-
end
|
365
|
-
|
366
|
-
it 'has a working function #passthrough_one_gint' do
|
367
|
-
Everything.passthrough_one_gint(42).must_equal 42
|
368
|
-
end
|
369
|
-
|
370
|
-
it 'has a working function #passthrough_one_gint16' do
|
371
|
-
Everything.passthrough_one_gint16(42).must_equal 42
|
372
|
-
end
|
373
|
-
|
374
|
-
it 'has a working function #passthrough_one_gint32' do
|
375
|
-
Everything.passthrough_one_gint32(42).must_equal 42
|
376
|
-
end
|
377
|
-
|
378
|
-
it 'has a working function #passthrough_one_gint64' do
|
379
|
-
Everything.passthrough_one_gint64(42).must_equal 42
|
380
|
-
end
|
381
|
-
|
382
|
-
it 'has a working function #passthrough_one_gint8' do
|
383
|
-
Everything.passthrough_one_gint8(42).must_equal 42
|
384
|
-
end
|
385
|
-
|
386
|
-
it 'has a working function #passthrough_one_gintptr' do
|
387
|
-
Everything.passthrough_one_gintptr(42).must_equal 42
|
388
|
-
end
|
389
|
-
|
390
|
-
it 'has a working function #passthrough_one_glong' do
|
391
|
-
Everything.passthrough_one_glong(42).must_equal 42
|
392
|
-
end
|
393
|
-
|
394
|
-
it 'has a working function #passthrough_one_gpointer' do
|
395
|
-
skip unless get_introspection_data 'Everything', 'passthrough_one_gpointer'
|
396
|
-
ptr = FFI::MemoryPointer.new(:int)
|
397
|
-
result = Everything.passthrough_one_gpointer(ptr)
|
398
|
-
result.must_be :==, ptr
|
399
|
-
end
|
400
|
-
|
401
|
-
it 'has a working function #passthrough_one_gshort' do
|
402
|
-
Everything.passthrough_one_gshort(42).must_equal 42
|
403
|
-
end
|
404
|
-
|
405
|
-
it 'has a working function #passthrough_one_gsize' do
|
406
|
-
Everything.passthrough_one_gsize(42).must_equal 42
|
407
|
-
end
|
408
|
-
|
409
|
-
it 'has a working function #passthrough_one_gssize' do
|
410
|
-
Everything.passthrough_one_gssize(42).must_equal 42
|
411
|
-
end
|
412
|
-
|
413
|
-
it 'has a working function #passthrough_one_guint' do
|
414
|
-
Everything.passthrough_one_guint(42).must_equal 42
|
415
|
-
end
|
416
|
-
|
417
|
-
it 'has a working function #passthrough_one_guint16' do
|
418
|
-
Everything.passthrough_one_guint16(42).must_equal 42
|
419
|
-
end
|
420
|
-
|
421
|
-
it 'has a working function #passthrough_one_guint32' do
|
422
|
-
Everything.passthrough_one_guint32(42).must_equal 42
|
423
|
-
end
|
424
|
-
|
425
|
-
it 'has a working function #passthrough_one_guint64' do
|
426
|
-
Everything.passthrough_one_guint64(42).must_equal 42
|
427
|
-
end
|
428
|
-
|
429
|
-
it 'has a working function #passthrough_one_guint8' do
|
430
|
-
Everything.passthrough_one_guint8(42).must_equal 42
|
431
|
-
end
|
432
|
-
|
433
|
-
it 'has a working function #passthrough_one_guintptr' do
|
434
|
-
Everything.passthrough_one_guintptr(42).must_equal 42
|
435
|
-
end
|
436
|
-
|
437
|
-
it 'has a working function #passthrough_one_gulong' do
|
438
|
-
Everything.passthrough_one_gulong(42).must_equal 42
|
439
|
-
end
|
440
|
-
|
441
|
-
it 'has a working function #passthrough_one_gunichar' do
|
442
|
-
Everything.passthrough_one_gunichar(42).must_equal 42
|
443
|
-
end
|
444
|
-
|
445
|
-
it 'has a working function #passthrough_one_gushort' do
|
446
|
-
Everything.passthrough_one_gushort(42).must_equal 42
|
447
|
-
end
|
448
|
-
|
449
|
-
it 'has a working function #passthrough_one_utf8' do
|
450
|
-
Everything.passthrough_one_utf8('42').must_equal '42'
|
451
|
-
end
|
452
|
-
end
|