gir_ffi 0.14.1 → 0.15.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Changelog.md +21 -0
- data/Gemfile +6 -4
- data/README.md +4 -4
- data/Rakefile +5 -5
- data/lib/ffi-glib/array.rb +14 -4
- data/lib/ffi-glib/byte_array.rb +7 -2
- data/lib/ffi-glib/container_class_methods.rb +1 -1
- data/lib/ffi-glib/error.rb +1 -1
- data/lib/ffi-glib/hash_table.rb +3 -3
- data/lib/ffi-glib/list.rb +1 -1
- data/lib/ffi-glib/list_methods.rb +1 -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 +1 -1
- data/lib/ffi-glib/variant.rb +1 -1
- data/lib/ffi-glib.rb +16 -16
- data/lib/ffi-gobject/object.rb +23 -32
- data/lib/ffi-gobject/param_spec.rb +1 -1
- data/lib/ffi-gobject/ruby_closure.rb +2 -2
- data/lib/ffi-gobject/value.rb +37 -28
- data/lib/ffi-gobject.rb +13 -13
- 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 +27 -17
- 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/ffi-gobject_introspection.rb +20 -20
- 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 -23
- data/lib/gir_ffi/boolean.rb +1 -1
- data/lib/gir_ffi/boxed_base.rb +1 -1
- data/lib/gir_ffi/builder.rb +18 -10
- data/lib/gir_ffi/builders/argument_builder.rb +17 -17
- data/lib/gir_ffi/builders/base_argument_builder.rb +1 -0
- data/lib/gir_ffi/builders/base_method_builder.rb +7 -7
- data/lib/gir_ffi/builders/base_return_value_builder.rb +1 -1
- data/lib/gir_ffi/builders/base_type_builder.rb +1 -1
- data/lib/gir_ffi/builders/c_to_ruby_convertor.rb +5 -5
- data/lib/gir_ffi/builders/callback_argument_builder.rb +8 -8
- data/lib/gir_ffi/builders/callback_builder.rb +3 -3
- data/lib/gir_ffi/builders/callback_return_value_builder.rb +2 -2
- 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 +2 -2
- data/lib/gir_ffi/builders/field_builder.rb +16 -15
- 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 +2 -2
- data/lib/gir_ffi/builders/mapping_method_builder.rb +9 -9
- data/lib/gir_ffi/builders/marshalling_method_builder.rb +7 -7
- data/lib/gir_ffi/builders/method_template.rb +1 -1
- data/lib/gir_ffi/builders/module_builder.rb +4 -6
- data/lib/gir_ffi/builders/object_builder.rb +6 -6
- data/lib/gir_ffi/builders/property_argument_builder.rb +1 -1
- data/lib/gir_ffi/builders/property_builder.rb +13 -12
- 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 +2 -2
- data/lib/gir_ffi/builders/struct_builder.rb +4 -4
- 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 +2 -2
- data/lib/gir_ffi/builders/vfunc_argument_builder.rb +1 -1
- data/lib/gir_ffi/builders/vfunc_builder.rb +6 -6
- data/lib/gir_ffi/builders/with_layout.rb +2 -2
- data/lib/gir_ffi/callback_base.rb +1 -1
- data/lib/gir_ffi/class_base.rb +5 -5
- data/lib/gir_ffi/core.rb +19 -20
- 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/pointer.rb +1 -1
- data/lib/gir_ffi/ffi_ext.rb +1 -1
- data/lib/gir_ffi/flags_base.rb +1 -1
- data/lib/gir_ffi/in_pointer.rb +10 -0
- 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/info_ext.rb +15 -15
- 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 +3 -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/sized_array.rb +4 -2
- data/lib/gir_ffi/struct.rb +1 -1
- data/lib/gir_ffi/struct_base.rb +1 -1
- 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 +1 -1
- data/lib/gir_ffi/union.rb +1 -1
- data/lib/gir_ffi/union_base.rb +1 -1
- data/lib/gir_ffi/user_defined_object_info.rb +6 -2
- data/lib/gir_ffi/user_defined_property_info.rb +33 -33
- data/lib/gir_ffi/version.rb +1 -1
- data/lib/gir_ffi-base/gobject/lib.rb +3 -2
- data/lib/gir_ffi-base/gobject.rb +26 -25
- data/lib/gir_ffi-base.rb +1 -1
- data/lib/gir_ffi.rb +3 -3
- data/tasks/test.rake +3 -2
- data/test/base_test_helper.rb +16 -9
- data/test/ffi-glib/array_test.rb +71 -56
- data/test/ffi-glib/byte_array_test.rb +13 -7
- data/test/ffi-glib/bytes_test.rb +24 -19
- data/test/ffi-glib/closure_test.rb +11 -11
- data/test/ffi-glib/destroy_notify_test.rb +6 -6
- data/test/ffi-glib/hash_table_test.rb +27 -27
- data/test/ffi-glib/list_test.rb +22 -22
- data/test/ffi-glib/main_loop_test.rb +12 -12
- data/test/ffi-glib/ptr_array_test.rb +39 -39
- data/test/ffi-glib/ruby_closure_test.rb +10 -10
- data/test/ffi-glib/s_list_test.rb +20 -20
- data/test/ffi-glib/strv_test.rb +19 -19
- data/test/ffi-glib/variant_test.rb +5 -5
- data/test/ffi-gobject/gobject_test.rb +48 -44
- data/test/ffi-gobject/object_class_test.rb +8 -8
- data/test/ffi-gobject/object_test.rb +49 -67
- data/test/ffi-gobject/param_spec_test.rb +12 -12
- data/test/ffi-gobject/value_test.rb +145 -125
- data/test/ffi-gobject_introspection/gobject_type_init_test.rb +8 -8
- data/test/ffi-gobject_introspection/i_base_info_test.rb +15 -16
- data/test/ffi-gobject_introspection/i_constant_info_test.rb +9 -13
- data/test/ffi-gobject_introspection/i_enum_info_test.rb +7 -7
- data/test/ffi-gobject_introspection/i_function_info_test.rb +1 -1
- data/test/ffi-gobject_introspection/i_interface_info_test.rb +10 -10
- data/test/ffi-gobject_introspection/i_object_info_test.rb +23 -23
- data/test/ffi-gobject_introspection/i_property_info_test.rb +19 -19
- data/test/ffi-gobject_introspection/i_registered_type_info_test.rb +10 -10
- data/test/ffi-gobject_introspection/i_repository_test.rb +31 -31
- data/test/ffi-gobject_introspection/i_struct_info_test.rb +10 -10
- data/test/ffi-gobject_introspection/i_type_info_test.rb +12 -15
- data/test/ffi-gobject_introspection/i_union_info_test.rb +7 -7
- data/test/ffi-gobject_introspection/i_vfunc_info_test.rb +16 -16
- data/test/ffi-gobject_introspection/lib_test.rb +3 -3
- data/test/ffi-gobject_introspection/strv_test.rb +9 -9
- data/test/ffi-gobject_test.rb +44 -44
- data/test/gir_ffi/allocation_helper_test.rb +13 -13
- data/test/gir_ffi/arg_helper_test.rb +63 -64
- data/test/gir_ffi/boolean_test.rb +20 -20
- data/test/gir_ffi/boxed_base_test.rb +18 -18
- data/test/gir_ffi/builder_test.rb +115 -93
- data/test/gir_ffi/builders/argument_builder_test.rb +280 -286
- data/test/gir_ffi/builders/base_argument_builder_test.rb +1 -1
- data/test/gir_ffi/builders/callback_argument_builder_test.rb +53 -56
- data/test/gir_ffi/builders/callback_builder_test.rb +71 -72
- data/test/gir_ffi/builders/callback_return_value_builder_test.rb +36 -40
- data/test/gir_ffi/builders/constant_builder_test.rb +1 -1
- data/test/gir_ffi/builders/constructor_builder_test.rb +10 -10
- data/test/gir_ffi/builders/enum_builder_test.rb +10 -10
- data/test/gir_ffi/builders/field_builder_test.rb +42 -42
- data/test/gir_ffi/builders/function_builder_test.rb +236 -224
- data/test/gir_ffi/builders/initializer_builder_test.rb +14 -14
- data/test/gir_ffi/builders/interface_builder_test.rb +9 -9
- data/test/gir_ffi/builders/module_builder_test.rb +18 -18
- data/test/gir_ffi/builders/object_builder_test.rb +38 -38
- data/test/gir_ffi/builders/property_builder_test.rb +91 -94
- data/test/gir_ffi/builders/registered_type_builder_test.rb +35 -11
- data/test/gir_ffi/builders/return_value_builder_test.rb +215 -222
- data/test/gir_ffi/builders/signal_closure_builder_test.rb +122 -113
- data/test/gir_ffi/builders/struct_builder_test.rb +32 -32
- data/test/gir_ffi/builders/unintrospectable_boxed_builder_test.rb +8 -14
- data/test/gir_ffi/builders/unintrospectable_builder_test.rb +23 -23
- data/test/gir_ffi/builders/union_builder_test.rb +12 -15
- data/test/gir_ffi/builders/user_defined_builder_test.rb +147 -147
- data/test/gir_ffi/builders/vfunc_argument_builder_test.rb +40 -40
- data/test/gir_ffi/builders/vfunc_builder_test.rb +145 -157
- data/test/gir_ffi/callback_base_test.rb +9 -9
- data/test/gir_ffi/class_base_test.rb +49 -51
- data/test/gir_ffi/core_test.rb +32 -32
- data/test/gir_ffi/enum_base_test.rb +19 -19
- data/test/gir_ffi/error_type_info_test.rb +23 -23
- data/test/gir_ffi/ffi_ext/pointer_test.rb +5 -5
- data/test/gir_ffi/g_type_test.rb +11 -11
- data/test/gir_ffi/in_pointer_test.rb +70 -50
- data/test/gir_ffi/info_ext/i_callable_info_test.rb +5 -5
- data/test/gir_ffi/info_ext/i_callback_info_test.rb +4 -4
- data/test/gir_ffi/info_ext/i_field_info_test.rb +6 -6
- data/test/gir_ffi/info_ext/i_function_info_test.rb +17 -17
- data/test/gir_ffi/info_ext/i_signal_info_test.rb +8 -8
- data/test/gir_ffi/info_ext/i_type_info_test.rb +229 -215
- data/test/gir_ffi/info_ext/i_unresolved_info_test.rb +4 -4
- data/test/gir_ffi/info_ext/safe_constant_name_test.rb +8 -8
- data/test/gir_ffi/info_ext/safe_function_name_test.rb +8 -8
- data/test/gir_ffi/interface_base_test.rb +8 -8
- data/test/gir_ffi/method_stubber_test.rb +19 -19
- data/test/gir_ffi/object_base_test.rb +19 -19
- data/test/gir_ffi/object_store_test.rb +13 -13
- data/test/gir_ffi/receiver_argument_info_test.rb +15 -15
- data/test/gir_ffi/sized_array_test.rb +68 -68
- data/test/gir_ffi/struct_base_test.rb +8 -8
- data/test/gir_ffi/struct_like_base_test.rb +64 -64
- data/test/gir_ffi/type_map_test.rb +6 -6
- data/test/gir_ffi/unintrospectable_type_info_test.rb +33 -33
- data/test/gir_ffi/union_base_test.rb +8 -8
- data/test/gir_ffi/user_defined_object_info_test.rb +34 -34
- data/test/gir_ffi/user_defined_property_info_test.rb +16 -16
- data/test/gir_ffi/variable_name_generator_test.rb +8 -8
- data/test/gir_ffi/version_test.rb +4 -4
- data/test/gir_ffi/zero_terminated_test.rb +34 -34
- data/test/gir_ffi_test_helper.rb +3 -3
- data/test/integration/callback_exceptions_test.rb +17 -21
- data/test/integration/derived_classes_test.rb +13 -13
- data/test/integration/generated_everything_test.rb +224 -224
- data/test/integration/generated_gimarshallingtests_test.rb +1118 -1017
- data/test/integration/generated_gio_test.rb +36 -36
- data/test/integration/generated_glib_test.rb +4 -6
- data/test/integration/generated_gobject_test.rb +43 -35
- data/test/integration/generated_gst_test.rb +16 -16
- data/test/integration/generated_gtk_source_test.rb +22 -17
- data/test/integration/generated_gtop_test.rb +8 -15
- data/test/integration/generated_pango_ft2_test.rb +2 -2
- data/test/integration/generated_pango_test.rb +4 -4
- data/test/integration/generated_regress_test.rb +1809 -1621
- data/test/integration/generated_secret_test.rb +8 -11
- data/test/integration/generated_utility_test.rb +81 -81
- data/test/integration/generated_warnlib_test.rb +13 -19
- data/test/integration/method_lookup_test.rb +6 -6
- data/test/introspection_test_helper.rb +48 -7
- data/test/minitest/stats_plugin.rb +1 -1
- metadata +11 -28
- data/lib/ffi-glib/array_methods.rb +0 -16
- data/test/gir_ffi/in_out_pointer_test.rb +0 -56
@@ -1,17 +1,14 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
|
-
require
|
3
|
+
require "gir_ffi_test_helper"
|
4
4
|
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
end
|
13
|
-
instance = Secret::Schema.new('foo', :none, 'bar' => :string)
|
14
|
-
instance.must_be_instance_of Secret::Schema
|
5
|
+
GirFFI.setup :Secret
|
6
|
+
|
7
|
+
describe "The generated Secret module" do
|
8
|
+
describe "Secret::Schema" do
|
9
|
+
it "has a working constructor" do
|
10
|
+
instance = Secret::Schema.new("foo", :none, "bar" => :string)
|
11
|
+
_(instance).must_be_instance_of Secret::Schema
|
15
12
|
end
|
16
13
|
end
|
17
14
|
end
|
@@ -1,174 +1,174 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
|
-
require
|
3
|
+
require "gir_ffi_test_helper"
|
4
4
|
|
5
5
|
GirFFI.setup :Utility
|
6
6
|
|
7
7
|
describe Utility do
|
8
|
-
describe
|
8
|
+
describe "Utility::Buffer" do
|
9
9
|
let(:instance) { Utility::Buffer.new }
|
10
10
|
|
11
|
-
it
|
12
|
-
instance.data.must_equal FFI::Pointer::NULL
|
11
|
+
it "has a writable field data" do
|
12
|
+
_(instance.data).must_equal FFI::Pointer::NULL
|
13
13
|
instance.data = FFI::Pointer.new 54_321
|
14
|
-
instance.data.must_equal FFI::Pointer.new 54_321
|
14
|
+
_(instance.data).must_equal FFI::Pointer.new 54_321
|
15
15
|
end
|
16
16
|
|
17
|
-
it
|
18
|
-
instance.length.must_equal 0
|
17
|
+
it "has a writable field length" do
|
18
|
+
_(instance.length).must_equal 0
|
19
19
|
instance.length = 42
|
20
|
-
instance.length.must_equal 42
|
20
|
+
_(instance.length).must_equal 42
|
21
21
|
end
|
22
22
|
end
|
23
23
|
|
24
|
-
describe
|
24
|
+
describe "Utility::Byte" do
|
25
25
|
let(:instance) { Utility::Byte.new }
|
26
26
|
|
27
|
-
it
|
28
|
-
instance.value.must_equal 0
|
27
|
+
it "has a writable field value" do
|
28
|
+
_(instance.value).must_equal 0
|
29
29
|
instance.value = 42
|
30
|
-
instance.value.must_equal 42
|
30
|
+
_(instance.value).must_equal 42
|
31
31
|
end
|
32
32
|
|
33
|
-
it
|
34
|
-
skip
|
33
|
+
it "has a writable field first_nibble" do
|
34
|
+
skip "This field is not exposed in the GIR"
|
35
35
|
instance.value = 0xAB
|
36
|
-
instance.first_nibble.must_equal 0xA
|
36
|
+
_(instance.first_nibble).must_equal 0xA
|
37
37
|
instance.first_nibble = 0x4
|
38
|
-
instance.value.must_equal 0x4B
|
38
|
+
_(instance.value).must_equal 0x4B
|
39
39
|
end
|
40
40
|
|
41
|
-
it
|
42
|
-
skip
|
41
|
+
it "has a writable field second_nibble" do
|
42
|
+
skip "This field is not exposed in the GIR"
|
43
43
|
instance.value = 0xAB
|
44
|
-
instance.second_nibble.must_equal 0xB
|
44
|
+
_(instance.second_nibble).must_equal 0xB
|
45
45
|
instance.second_nibble = 0x4
|
46
|
-
instance.value.must_equal 0xA4
|
46
|
+
_(instance.value).must_equal 0xA4
|
47
47
|
end
|
48
48
|
end
|
49
49
|
|
50
|
-
describe
|
51
|
-
it
|
52
|
-
Utility::EnumType[:a].must_equal 0
|
50
|
+
describe "Utility::EnumType" do
|
51
|
+
it "has the member :a" do
|
52
|
+
_(Utility::EnumType[:a]).must_equal 0
|
53
53
|
end
|
54
54
|
|
55
|
-
it
|
56
|
-
Utility::EnumType[:b].must_equal 1
|
55
|
+
it "has the member :b" do
|
56
|
+
_(Utility::EnumType[:b]).must_equal 1
|
57
57
|
end
|
58
58
|
|
59
|
-
it
|
60
|
-
Utility::EnumType[:c].must_equal 2
|
59
|
+
it "has the member :c" do
|
60
|
+
_(Utility::EnumType[:c]).must_equal 2
|
61
61
|
end
|
62
62
|
end
|
63
63
|
|
64
|
-
describe
|
65
|
-
it
|
66
|
-
Utility::FlagType[:a].must_equal 1
|
64
|
+
describe "Utility::FlagType" do
|
65
|
+
it "has the member :a" do
|
66
|
+
_(Utility::FlagType[:a]).must_equal 1
|
67
67
|
end
|
68
68
|
|
69
|
-
it
|
70
|
-
Utility::FlagType[:b].must_equal 2
|
69
|
+
it "has the member :b" do
|
70
|
+
_(Utility::FlagType[:b]).must_equal 2
|
71
71
|
end
|
72
72
|
|
73
|
-
it
|
74
|
-
Utility::FlagType[:c].must_equal 4
|
73
|
+
it "has the member :c" do
|
74
|
+
_(Utility::FlagType[:c]).must_equal 4
|
75
75
|
end
|
76
76
|
end
|
77
77
|
|
78
|
-
describe
|
78
|
+
describe "Utility::Object" do
|
79
79
|
let(:instance) { Utility::Object.new }
|
80
80
|
|
81
|
-
it
|
81
|
+
it "has a working method #watch_dir" do
|
82
82
|
# This method doesn't actually do anything
|
83
|
-
instance.watch_dir(
|
83
|
+
instance.watch_dir("/") {}
|
84
84
|
pass
|
85
85
|
end
|
86
86
|
end
|
87
87
|
|
88
|
-
describe
|
88
|
+
describe "Utility::Struct" do
|
89
89
|
let(:instance) { Utility::Struct.new }
|
90
90
|
|
91
|
-
it
|
92
|
-
instance.field.must_equal 0
|
91
|
+
it "has a writable field field" do
|
92
|
+
_(instance.field).must_equal 0
|
93
93
|
instance.field = 42
|
94
|
-
instance.field.must_equal 42
|
94
|
+
_(instance.field).must_equal 42
|
95
95
|
end
|
96
96
|
|
97
|
-
it
|
98
|
-
skip
|
99
|
-
instance.bitfield1.must_equal 0
|
97
|
+
it "has a writable field bitfield1" do
|
98
|
+
skip "Bitfield bit width is not implemented yet"
|
99
|
+
_(instance.bitfield1).must_equal 0
|
100
100
|
instance.bitfield1 = 15
|
101
|
-
instance.bitfield1.must_equal 7
|
101
|
+
_(instance.bitfield1).must_equal 7
|
102
102
|
end
|
103
103
|
|
104
|
-
it
|
105
|
-
skip
|
106
|
-
instance.bitfield2.must_equal 0
|
104
|
+
it "has a writable field bitfield2" do
|
105
|
+
skip "Bitfield bit width is not implemented yet"
|
106
|
+
_(instance.bitfield2).must_equal 0
|
107
107
|
instance.bitfield2 = 15
|
108
|
-
instance.bitfield2.must_equal 3
|
108
|
+
_(instance.bitfield2).must_equal 3
|
109
109
|
end
|
110
110
|
|
111
|
-
it
|
112
|
-
instance.data.to_a.must_equal [0] * 16
|
111
|
+
it "has a writable field data" do
|
112
|
+
_(instance.data.to_a).must_equal [0] * 16
|
113
113
|
end
|
114
114
|
end
|
115
115
|
|
116
|
-
describe
|
116
|
+
describe "Utility::TaggedValue" do
|
117
117
|
let(:instance) { Utility::TaggedValue.new }
|
118
118
|
|
119
|
-
it
|
120
|
-
instance.tag.must_equal 0
|
119
|
+
it "has a writable field tag" do
|
120
|
+
_(instance.tag).must_equal 0
|
121
121
|
instance.tag = 42
|
122
|
-
instance.tag.must_equal 42
|
122
|
+
_(instance.tag).must_equal 42
|
123
123
|
end
|
124
124
|
|
125
|
-
it
|
126
|
-
skip
|
127
|
-
instance.v_pointer.must_equal FFI::Pointer::NULL
|
125
|
+
it "has a writable field v_pointer" do
|
126
|
+
skip "This field is not exposed in the GIR"
|
127
|
+
_(instance.v_pointer).must_equal FFI::Pointer::NULL
|
128
128
|
instance.v_pointer = FFI::Pointer.new(4321)
|
129
|
-
instance.v_pointer.must_equal FFI::Pointer.new(4321)
|
129
|
+
_(instance.v_pointer).must_equal FFI::Pointer.new(4321)
|
130
130
|
end
|
131
131
|
|
132
|
-
it
|
133
|
-
skip
|
134
|
-
instance.v_real.must_equal 0.0
|
132
|
+
it "has a writable field v_real" do
|
133
|
+
skip "This field is not exposed in the GIR"
|
134
|
+
_(instance.v_real).must_equal 0.0
|
135
135
|
instance.v_real = 42.23
|
136
|
-
instance.v_real.must_equal 42.23
|
136
|
+
_(instance.v_real).must_equal 42.23
|
137
137
|
end
|
138
138
|
|
139
|
-
it
|
140
|
-
skip
|
141
|
-
instance.v_integer.must_equal 0
|
139
|
+
it "has a writable field v_integer" do
|
140
|
+
skip "This field is not exposed in the GIR"
|
141
|
+
_(instance.v_integer).must_equal 0
|
142
142
|
instance.v_integer = 42
|
143
|
-
instance.v_integer.must_equal 42
|
143
|
+
_(instance.v_integer).must_equal 42
|
144
144
|
end
|
145
145
|
end
|
146
146
|
|
147
|
-
describe
|
147
|
+
describe "Utility::Union" do
|
148
148
|
let(:instance) { Utility::Union.new }
|
149
149
|
|
150
|
-
it
|
151
|
-
instance.pointer.must_be_nil
|
152
|
-
instance.pointer =
|
153
|
-
instance.pointer.must_equal
|
150
|
+
it "has a writable field pointer" do
|
151
|
+
_(instance.pointer).must_be_nil
|
152
|
+
instance.pointer = "hello 42"
|
153
|
+
_(instance.pointer).must_equal "hello 42"
|
154
154
|
end
|
155
155
|
|
156
|
-
it
|
157
|
-
instance.integer.must_equal 0
|
156
|
+
it "has a writable field integer" do
|
157
|
+
_(instance.integer).must_equal 0
|
158
158
|
instance.integer = 42
|
159
|
-
instance.integer.must_equal 42
|
159
|
+
_(instance.integer).must_equal 42
|
160
160
|
end
|
161
161
|
|
162
|
-
it
|
163
|
-
instance.real.must_equal 0.0
|
162
|
+
it "has a writable field real" do
|
163
|
+
_(instance.real).must_equal 0.0
|
164
164
|
instance.real = 42.23
|
165
|
-
instance.real.must_equal 42.23
|
165
|
+
_(instance.real).must_equal 42.23
|
166
166
|
end
|
167
167
|
end
|
168
168
|
|
169
|
-
it
|
169
|
+
it "has a working function #dir_foreach" do
|
170
170
|
# This method doesn't actually do anything
|
171
|
-
result = Utility.dir_foreach(
|
172
|
-
result.must_be_nil
|
171
|
+
result = Utility.dir_foreach("/") {}
|
172
|
+
_(result).must_be_nil
|
173
173
|
end
|
174
174
|
end
|
@@ -1,17 +1,11 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
|
-
require
|
4
|
-
|
5
|
-
|
6
|
-
before do
|
7
|
-
begin
|
8
|
-
GirFFI.setup :WarnLib
|
9
|
-
rescue RuntimeError
|
10
|
-
skip 'WarnLib GIR not available'
|
11
|
-
end
|
12
|
-
end
|
3
|
+
require "gir_ffi_test_helper"
|
4
|
+
|
5
|
+
GirFFI.setup :WarnLib
|
13
6
|
|
14
|
-
|
7
|
+
describe "The generated WarnLib module" do
|
8
|
+
describe "WarnLib::Whatever" do
|
15
9
|
let(:derived_klass) do
|
16
10
|
Object.const_set("DerivedClass#{Sequence.next}", Class.new(GObject::Object))
|
17
11
|
end
|
@@ -27,23 +21,23 @@ describe 'The generated WarnLib module' do
|
|
27
21
|
|
28
22
|
let(:instance) { derived_klass.new }
|
29
23
|
|
30
|
-
it
|
24
|
+
it "has a working method #do_boo" do
|
31
25
|
instance.do_boo 42, nil
|
32
|
-
@result.must_equal
|
26
|
+
_(@result).must_equal "boo42"
|
33
27
|
end
|
34
28
|
|
35
|
-
it
|
29
|
+
it "has a working method #do_moo" do
|
36
30
|
instance.do_moo 23, nil
|
37
|
-
@result.must_equal
|
31
|
+
_(@result).must_equal "moo23"
|
38
32
|
end
|
39
33
|
end
|
40
34
|
|
41
|
-
it
|
42
|
-
proc { WarnLib.throw_unpaired }.must_raise GirFFI::GLibError
|
35
|
+
it "has a working function #throw_unpaired" do
|
36
|
+
_(proc { WarnLib.throw_unpaired }).must_raise GirFFI::GLibError
|
43
37
|
end
|
44
38
|
|
45
|
-
it
|
39
|
+
it "has a working function #unpaired_error_quark" do
|
46
40
|
result = WarnLib.unpaired_error_quark
|
47
|
-
GLib.quark_to_string(result).must_equal
|
41
|
+
_(GLib.quark_to_string(result)).must_equal "warnlib-unpaired-error"
|
48
42
|
end
|
49
43
|
end
|
@@ -1,16 +1,16 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
|
-
require
|
3
|
+
require "gir_ffi_test_helper"
|
4
4
|
|
5
5
|
# Tests how methods are looked up and generated on first use.
|
6
|
-
describe
|
6
|
+
describe "Looking up methods" do
|
7
7
|
before do
|
8
8
|
save_module :Regress
|
9
9
|
GirFFI.setup :Regress
|
10
10
|
end
|
11
11
|
|
12
|
-
describe
|
13
|
-
it
|
12
|
+
describe "an instance method" do
|
13
|
+
it "is found from a subclass" do
|
14
14
|
assert_defines_instance_method Regress::TestObj, :forced_method
|
15
15
|
refute_defines_instance_method Regress::TestSubObj, :forced_method
|
16
16
|
|
@@ -19,8 +19,8 @@ describe 'Looking up methods' do
|
|
19
19
|
end
|
20
20
|
end
|
21
21
|
|
22
|
-
describe
|
23
|
-
it
|
22
|
+
describe "a class method" do
|
23
|
+
it "is found from a subclass" do
|
24
24
|
assert_defines_singleton_method Regress::TestObj, :static_method
|
25
25
|
refute_defines_singleton_method Regress::TestSubObj, :static_method
|
26
26
|
|
@@ -1,16 +1,16 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
|
-
require
|
3
|
+
require "base_test_helper"
|
4
4
|
|
5
|
-
require
|
5
|
+
require "ffi-gobject_introspection"
|
6
6
|
|
7
|
-
GObjectIntrospection::IRepository.prepend_search_path File.join(File.dirname(__FILE__),
|
7
|
+
GObjectIntrospection::IRepository.prepend_search_path File.join(File.dirname(__FILE__), "lib")
|
8
8
|
|
9
9
|
module LocalSharedLibrary
|
10
10
|
def shared_library(namespace)
|
11
11
|
case namespace
|
12
|
-
when
|
13
|
-
File.join(File.dirname(__FILE__),
|
12
|
+
when "Everything", "GIMarshallingTests", "Regress", "Utility", "WarnLib"
|
13
|
+
File.join(File.dirname(__FILE__), "lib", "lib#{namespace.downcase}.so")
|
14
14
|
else
|
15
15
|
super
|
16
16
|
end
|
@@ -20,7 +20,9 @@ end
|
|
20
20
|
GObjectIntrospection::IRepository.prepend LocalSharedLibrary
|
21
21
|
|
22
22
|
module IntrospectionTestExtensions
|
23
|
-
|
23
|
+
class << self
|
24
|
+
attr_accessor :version
|
25
|
+
end
|
24
26
|
|
25
27
|
def get_introspection_data(namespace, name)
|
26
28
|
gir = GObjectIntrospection::IRepository.default
|
@@ -47,6 +49,45 @@ module IntrospectionTestExtensions
|
|
47
49
|
def get_vfunc_introspection_data(namespace, klass, name)
|
48
50
|
get_introspection_data(namespace, klass).find_vfunc name
|
49
51
|
end
|
52
|
+
|
53
|
+
def skip_below(introduction_version);
|
54
|
+
unless LATEST_VERSION >= introduction_version
|
55
|
+
raise "Version #{introduction_version} is too new and would always be skipped"
|
56
|
+
end
|
57
|
+
|
58
|
+
skip "Introduced in #{introduction_version}" if introduction_version > version
|
59
|
+
end
|
60
|
+
|
61
|
+
def version
|
62
|
+
IntrospectionTestExtensions.version ||= calculate_version
|
63
|
+
end
|
64
|
+
|
65
|
+
VERSION_GUARDS = {
|
66
|
+
"1.61.1" => %w(Regress TestObj emit_sig_with_error),
|
67
|
+
"1.59.4" => %w(Regress test_array_struct_in_none),
|
68
|
+
"1.58.3" => %w(Regress TestReferenceCounters),
|
69
|
+
"1.57.2" => %w(Regress TestInterface emit_signal),
|
70
|
+
"1.55.2" => %w(Regress FOO_FLAGS_SECOND_AND_THIRD),
|
71
|
+
"1.53.4" => %w(Regress TestObj name_conflict),
|
72
|
+
"1.49.1" => %w(Regress AnonymousUnionAndStruct),
|
73
|
+
"1.47.92" => %w(Regress get_variant),
|
74
|
+
"1.47.1" => %w(Regress test_noptr_callback)
|
75
|
+
}.freeze
|
76
|
+
|
77
|
+
LATEST_VERSION = VERSION_GUARDS.keys.first
|
78
|
+
|
79
|
+
def calculate_version
|
80
|
+
VERSION_GUARDS.each do |version, (namespace, klass, methodname)|
|
81
|
+
result = if methodname
|
82
|
+
get_method_introspection_data(namespace, klass, methodname)
|
83
|
+
else
|
84
|
+
get_introspection_data(namespace, klass)
|
85
|
+
end
|
86
|
+
return version if result
|
87
|
+
end
|
88
|
+
|
89
|
+
"1.46.0" # Minimum supported version
|
90
|
+
end
|
50
91
|
end
|
51
92
|
|
52
|
-
Minitest::Test.
|
93
|
+
Minitest::Test.include IntrospectionTestExtensions
|
@@ -17,7 +17,7 @@ module Minitest
|
|
17
17
|
def report
|
18
18
|
slowest = @results.sort_by(&:time).reverse.first(10)
|
19
19
|
slowest.each do |result|
|
20
|
-
puts format(
|
20
|
+
puts format("%<time>10.4f %<location>s",
|
21
21
|
time: result.time,
|
22
22
|
location: result.location)
|
23
23
|
end
|