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,27 +1,27 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
|
-
require
|
3
|
+
require "gir_ffi_test_helper"
|
4
4
|
|
5
5
|
GirFFI.setup :Gio
|
6
6
|
|
7
7
|
# Tests generated methods and functions in the Gio namespace.
|
8
|
-
describe
|
9
|
-
describe
|
10
|
-
it
|
11
|
-
file = Gio::File.new_for_path(
|
12
|
-
file.class.registered_ancestors.must_equal [file.class, Gio::File, GObject::Object]
|
8
|
+
describe "The generated Gio module" do
|
9
|
+
describe "File#new_for_path, a method returning an interface," do
|
10
|
+
it "returns an object of a more specific class" do
|
11
|
+
file = Gio::File.new_for_path("/")
|
12
|
+
_(file.class.registered_ancestors).must_equal [file.class, Gio::File, GObject::Object]
|
13
13
|
|
14
14
|
refute_instance_of Gio::File, file
|
15
15
|
assert_includes file.class.registered_ancestors, Gio::File
|
16
16
|
end
|
17
17
|
end
|
18
18
|
|
19
|
-
describe
|
19
|
+
describe "the result of #file_new_from_path" do
|
20
20
|
before do
|
21
|
-
@it = Gio.file_new_for_path(
|
21
|
+
@it = Gio.file_new_for_path("/")
|
22
22
|
end
|
23
23
|
|
24
|
-
it
|
24
|
+
it "is able to set up a method in a class that is not the first ancestor" do
|
25
25
|
refute_defines_instance_method @it.class, :get_qdata
|
26
26
|
refute_defines_instance_method Gio::File, :get_qdata
|
27
27
|
assert_defines_instance_method GObject::Object, :get_qdata
|
@@ -29,88 +29,88 @@ describe 'The generated Gio module' do
|
|
29
29
|
@it.setup_and_call :get_qdata, 1
|
30
30
|
end
|
31
31
|
|
32
|
-
it
|
32
|
+
it "knows its GType" do
|
33
33
|
instance_gtype = GObject.type_from_instance @it
|
34
|
-
@it.class.gtype.must_equal instance_gtype
|
34
|
+
_(@it.class.gtype).must_equal instance_gtype
|
35
35
|
end
|
36
36
|
end
|
37
37
|
|
38
|
-
describe
|
39
|
-
describe
|
38
|
+
describe "the FileInfo class" do
|
39
|
+
describe "an instance" do
|
40
40
|
before do
|
41
|
-
file = Gio.file_new_for_path(
|
42
|
-
@fileinfo = file.query_info
|
41
|
+
file = Gio.file_new_for_path("/")
|
42
|
+
@fileinfo = file.query_info "*", :none, nil
|
43
43
|
end
|
44
44
|
|
45
|
-
it
|
46
|
-
type = @fileinfo.get_attribute_type
|
45
|
+
it "has a working #get_attribute_type method" do
|
46
|
+
type = @fileinfo.get_attribute_type "standard::display-name"
|
47
47
|
assert_equal :string, type
|
48
48
|
end
|
49
49
|
end
|
50
50
|
end
|
51
51
|
|
52
|
-
describe
|
52
|
+
describe "the action-added signal" do
|
53
53
|
before do
|
54
54
|
@grp = Gio::SimpleActionGroup.new
|
55
55
|
end
|
56
56
|
|
57
57
|
it "correctly passes on the string parameter 'action_name'" do
|
58
58
|
a = nil
|
59
|
-
GObject.signal_connect @grp,
|
59
|
+
GObject.signal_connect @grp, "action-added" do |_grp, action_name, _user_data|
|
60
60
|
a = action_name
|
61
61
|
end
|
62
|
-
GObject.signal_emit @grp,
|
63
|
-
assert_equal
|
62
|
+
GObject.signal_emit @grp, "action-added", "foo"
|
63
|
+
assert_equal "foo", a
|
64
64
|
end
|
65
65
|
end
|
66
66
|
|
67
|
-
describe
|
67
|
+
describe "the reply signal" do
|
68
68
|
before do
|
69
69
|
@mo = Gio::MountOperation.new
|
70
70
|
end
|
71
71
|
|
72
72
|
it "correctly passes on the enum parameter 'result'" do
|
73
73
|
a = nil
|
74
|
-
GObject.signal_connect @mo,
|
74
|
+
GObject.signal_connect @mo, "reply" do |_mnt, result, _user_data|
|
75
75
|
a = result
|
76
76
|
end
|
77
|
-
GObject.signal_emit @mo,
|
77
|
+
GObject.signal_emit @mo, "reply", :unhandled
|
78
78
|
assert_equal :unhandled, a
|
79
79
|
end
|
80
80
|
end
|
81
81
|
|
82
|
-
describe
|
83
|
-
it
|
82
|
+
describe "the CharsetConverter class" do
|
83
|
+
it "includes two interfaces" do
|
84
84
|
klass = Gio::CharsetConverter
|
85
|
-
klass.included_interfaces.must_equal [Gio::Initable, Gio::Converter]
|
85
|
+
_(klass.included_interfaces).must_equal [Gio::Initable, Gio::Converter]
|
86
86
|
end
|
87
87
|
|
88
|
-
it
|
89
|
-
cnv = Gio::CharsetConverter.new
|
88
|
+
it "allows an instance to find the #reset method" do
|
89
|
+
cnv = Gio::CharsetConverter.new "utf8", "utf8"
|
90
90
|
cnv.reset
|
91
91
|
pass
|
92
92
|
end
|
93
93
|
end
|
94
94
|
|
95
|
-
describe
|
96
|
-
it
|
95
|
+
describe "the SocketSourceFunc callback" do
|
96
|
+
it "can be cast to a native function" do
|
97
97
|
Gio::SocketSourceFunc.new { |*args| p args }.to_native
|
98
98
|
end
|
99
99
|
end
|
100
100
|
|
101
|
-
describe
|
102
|
-
let(:simple_action) { Gio::SimpleAction.new(
|
101
|
+
describe "Gio::SimpleAction" do
|
102
|
+
let(:simple_action) { Gio::SimpleAction.new("test", "d") }
|
103
103
|
|
104
104
|
it 'can read the property "state-type" with #get_property' do
|
105
|
-
simple_action.get_property(
|
105
|
+
_(simple_action.get_property("state-type")).must_be_nil
|
106
106
|
end
|
107
107
|
|
108
108
|
it 'can read the property "state-type" with #state_type' do
|
109
|
-
simple_action.state_type.must_be_nil
|
109
|
+
_(simple_action.state_type).must_be_nil
|
110
110
|
end
|
111
111
|
|
112
112
|
it 'cannot write the property "state-type" with #state_type=' do
|
113
|
-
simple_action.wont_respond_to :state_type=
|
113
|
+
_(simple_action).wont_respond_to :state_type=
|
114
114
|
end
|
115
115
|
end
|
116
116
|
end
|
@@ -1,12 +1,10 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
|
-
require
|
3
|
+
require "gir_ffi_test_helper"
|
4
4
|
|
5
5
|
# Tests generated classes, methods and functions in the GLib namespace.
|
6
|
-
describe
|
7
|
-
it
|
8
|
-
|
9
|
-
|
10
|
-
GLib::SOURCE_REMOVE.must_equal false
|
6
|
+
describe "The generated GLib module" do
|
7
|
+
it "can auto-generate the GLib::SOURCE_REMOVE constant" do
|
8
|
+
_(GLib::SOURCE_REMOVE).must_equal false
|
11
9
|
end
|
12
10
|
end
|
@@ -1,44 +1,44 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
|
-
require
|
3
|
+
require "gir_ffi_test_helper"
|
4
4
|
|
5
5
|
GirFFI.setup :Regress
|
6
6
|
|
7
7
|
describe GObject do
|
8
|
-
describe
|
9
|
-
it
|
8
|
+
describe ".type_interfaces" do
|
9
|
+
it "works, showing that returning an array of GType works" do
|
10
10
|
klass = GObject::TypeModule
|
11
11
|
ifcs = GObject.type_interfaces klass.gtype
|
12
12
|
assert_equal 1, ifcs.size
|
13
13
|
end
|
14
14
|
end
|
15
15
|
|
16
|
-
describe
|
17
|
-
it
|
18
|
-
result = GObject.setup_method
|
19
|
-
result.must_equal true
|
16
|
+
describe ".signal_set_va_marshaller" do
|
17
|
+
it "can be set up" do
|
18
|
+
result = GObject.setup_method "signal_set_va_marshaller"
|
19
|
+
_(result).must_equal true
|
20
20
|
end
|
21
21
|
end
|
22
22
|
|
23
23
|
describe GObject::TypeInfo do
|
24
24
|
let(:instance) { GObject::TypeInfo.new }
|
25
|
-
it
|
25
|
+
it "has a working field setter for class_init" do
|
26
26
|
instance.class_init = proc do |_object_class, _data|
|
27
27
|
end
|
28
28
|
end
|
29
29
|
|
30
|
-
it
|
31
|
-
instance.class_init.must_be_nil
|
30
|
+
it "has a working field getter for class_init" do
|
31
|
+
_(instance.class_init).must_be_nil
|
32
32
|
instance.class_init = proc do |_object_class, _data|
|
33
33
|
end
|
34
34
|
result = instance.class_init
|
35
|
-
result.wont_be_nil
|
36
|
-
result.must_be_instance_of FFI::Function
|
35
|
+
_(result).wont_be_nil
|
36
|
+
_(result).must_be_instance_of FFI::Function
|
37
37
|
end
|
38
38
|
end
|
39
39
|
|
40
40
|
describe GObject::TypePlugin do
|
41
|
-
it
|
41
|
+
it "is implemented as a module" do
|
42
42
|
mod = GObject::TypePlugin
|
43
43
|
assert_instance_of Module, mod
|
44
44
|
refute_instance_of Class, mod
|
@@ -46,71 +46,79 @@ describe GObject do
|
|
46
46
|
end
|
47
47
|
|
48
48
|
describe GObject::TypeModule do
|
49
|
-
it
|
49
|
+
it "has the GObject::TypePlugin module as an ancestor" do
|
50
50
|
klass = GObject::TypeModule
|
51
51
|
assert_includes klass.registered_ancestors, GObject::TypePlugin
|
52
52
|
end
|
53
53
|
end
|
54
54
|
|
55
55
|
describe GObject::ValueArray do
|
56
|
-
it
|
56
|
+
it "uses the constructor provided by GObject" do
|
57
57
|
instance = GObject::ValueArray.new 16
|
58
|
-
instance.n_prealloced.must_equal 16
|
59
|
-
instance.n_values.must_equal 0
|
58
|
+
_(instance.n_prealloced).must_equal 16
|
59
|
+
_(instance.n_values).must_equal 0
|
60
60
|
end
|
61
61
|
end
|
62
62
|
|
63
63
|
describe GObject::SignalQuery do
|
64
|
-
it
|
64
|
+
it "works" do
|
65
65
|
GObject::SignalQuery.new
|
66
66
|
pass
|
67
67
|
end
|
68
68
|
|
69
|
-
it
|
70
|
-
field_info = get_field_introspection_data 'GObject', 'SignalQuery', 'param_types'
|
71
|
-
skip if field_info.field_type.array_length < 0
|
69
|
+
it "uses the n_params field for the length of param_types" do
|
72
70
|
gtype = GObject::Object.gtype
|
73
71
|
signals = GObject.signal_list_ids gtype
|
74
72
|
signal_query = GObject.signal_query signals.first
|
75
|
-
signal_query.n_params.must_equal 1
|
76
|
-
signal_query.param_types.size.must_equal 1
|
73
|
+
_(signal_query.n_params).must_equal 1
|
74
|
+
_(signal_query.param_types.size).must_equal 1
|
77
75
|
end
|
78
76
|
end
|
79
77
|
|
80
78
|
describe GObject::Binding do
|
81
|
-
it
|
79
|
+
it "is created with GObject::Object#bind_property" do
|
82
80
|
source = Regress::TestObj.constructor
|
83
81
|
target = Regress::TestObj.constructor
|
84
|
-
binding = source.bind_property
|
85
|
-
binding.must_be_kind_of GObject::Binding
|
82
|
+
binding = source.bind_property "double", target, "double", :default
|
83
|
+
_(binding).must_be_kind_of GObject::Binding
|
86
84
|
end
|
87
85
|
|
88
|
-
describe
|
86
|
+
describe "an instance" do
|
89
87
|
let(:source) { Regress::TestObj.constructor }
|
90
88
|
let(:target) { Regress::TestObj.constructor }
|
91
|
-
let(:binding) { source.bind_property
|
89
|
+
let(:binding) { source.bind_property "double", target, "double", :default }
|
92
90
|
|
93
91
|
it 'can read the property "target-property" with #get_property' do
|
94
|
-
binding.get_property(
|
92
|
+
_(binding.get_property("target-property")).must_equal "double"
|
95
93
|
end
|
96
94
|
|
97
95
|
it 'can read the property "target-property" with #target_property' do
|
98
|
-
binding.target_property.must_equal
|
96
|
+
_(binding.target_property).must_equal "double"
|
99
97
|
end
|
100
98
|
|
101
99
|
it 'cannot write the property "target-property" with #target_property=' do
|
102
|
-
binding.wont_respond_to :target_property=
|
100
|
+
_(binding).wont_respond_to :target_property=
|
103
101
|
end
|
104
102
|
end
|
105
103
|
end
|
106
104
|
|
107
105
|
describe GObject::ParamSpec do
|
108
|
-
it
|
109
|
-
pspec = GObject.param_spec_int(
|
110
|
-
|
106
|
+
it "has a generated field accessor for #flags but not #get_flags method" do
|
107
|
+
pspec = GObject.param_spec_int("foo", "foo bar",
|
108
|
+
"The Foo Bar Property",
|
111
109
|
10, 20, 15,
|
112
110
|
3)
|
113
|
-
pspec.wont_respond_to :
|
111
|
+
_(pspec).wont_respond_to :get_flags
|
112
|
+
_(pspec.method(:flags).original_name).must_equal :flags
|
113
|
+
end
|
114
|
+
|
115
|
+
it "aliases #get_name to #name instead of having a separate field accessor" do
|
116
|
+
pspec = GObject.param_spec_int("foo", "foo bar",
|
117
|
+
"The Foo Bar Property",
|
118
|
+
10, 20, 15,
|
119
|
+
3)
|
120
|
+
_(pspec).must_respond_to :get_name
|
121
|
+
_(pspec.method(:name).original_name).must_equal :get_name
|
114
122
|
end
|
115
123
|
end
|
116
124
|
end
|
@@ -1,34 +1,34 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
|
-
require
|
3
|
+
require "gir_ffi_test_helper"
|
4
4
|
|
5
5
|
GirFFI.setup :Gst
|
6
6
|
Gst.init []
|
7
7
|
|
8
8
|
# Tests behavior of objects in the generated Gio namespace.
|
9
|
-
describe
|
10
|
-
describe
|
11
|
-
let(:instance) { Gst::ElementFactory.make(
|
9
|
+
describe "the generated Gst module" do
|
10
|
+
describe "Gst::FakeSink" do
|
11
|
+
let(:instance) { Gst::ElementFactory.make("fakesink", "sink") }
|
12
12
|
|
13
|
-
it
|
13
|
+
it "allows the handoff signal to be connected and emitted" do
|
14
14
|
a = nil
|
15
|
-
instance.signal_connect(
|
16
|
-
GObject.signal_emit(instance,
|
17
|
-
a.must_equal 10
|
15
|
+
instance.signal_connect("handoff") { a = 10 }
|
16
|
+
GObject.signal_emit(instance, "handoff")
|
17
|
+
_(a).must_equal 10
|
18
18
|
end
|
19
19
|
|
20
|
-
it
|
21
|
-
instance.name.must_equal
|
20
|
+
it "correctly fetches the name" do
|
21
|
+
_(instance.name).must_equal "sink"
|
22
22
|
end
|
23
23
|
end
|
24
24
|
|
25
|
-
describe
|
26
|
-
let(:instance) { Gst::ElementFactory.make(
|
25
|
+
describe "Gst::AutoAudioSink" do
|
26
|
+
let(:instance) { Gst::ElementFactory.make("autoaudiosink", "audiosink") }
|
27
27
|
|
28
|
-
it
|
29
|
-
skip
|
30
|
-
instance.get_name.must_equal
|
31
|
-
instance.name.must_equal
|
28
|
+
it "correctly fetches the name" do
|
29
|
+
skip "Audio sink was not created" unless instance
|
30
|
+
_(instance.get_name).must_equal "audiosink"
|
31
|
+
_(instance.name).must_equal "audiosink"
|
32
32
|
end
|
33
33
|
end
|
34
34
|
end
|
@@ -1,26 +1,31 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
|
-
require
|
3
|
+
require "gir_ffi_test_helper"
|
4
4
|
|
5
|
-
|
6
|
-
describe 'The generated GtkSource module' do
|
7
|
-
before do
|
8
|
-
begin
|
9
|
-
GirFFI.setup :GtkSource
|
10
|
-
rescue RuntimeError
|
11
|
-
skip 'GtkSource GIR not available'
|
12
|
-
end
|
13
|
-
end
|
5
|
+
GirFFI.setup :GtkSource
|
14
6
|
|
15
|
-
|
7
|
+
# Tests behavior of objects in the generated GtkSource namespace.
|
8
|
+
describe "The generated GtkSource module" do
|
9
|
+
describe "GtkSource::CompletionContext" do
|
16
10
|
let(:instance) { GtkSource::CompletionContext.new }
|
17
11
|
|
18
|
-
it
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
12
|
+
it "allows adding proposals" do
|
13
|
+
# Interface changed in GtkSourceView 3.24
|
14
|
+
proposals = if GtkSource::CompletionItem.instance_methods.include? :set_label
|
15
|
+
Array.new(3) do |i|
|
16
|
+
GtkSource::CompletionItem.new.tap do |item|
|
17
|
+
item.label = "Proposal #{i}"
|
18
|
+
item.text = "Proposal #{i}"
|
19
|
+
item.info = "blah #{i}"
|
20
|
+
end
|
21
|
+
end
|
22
|
+
else
|
23
|
+
[
|
24
|
+
GtkSource::CompletionItem.new("Proposal 1", "Proposal 1", nil, "blah 1"),
|
25
|
+
GtkSource::CompletionItem.new("Proposal 2", "Proposal 2", nil, "blah 2"),
|
26
|
+
GtkSource::CompletionItem.new("Proposal 3", "Proposal 3", nil, "blah 3")
|
27
|
+
]
|
28
|
+
end
|
24
29
|
instance.add_proposals nil, proposals, true
|
25
30
|
end
|
26
31
|
end
|
@@ -1,29 +1,22 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
|
-
require
|
3
|
+
require "gir_ffi_test_helper"
|
4
|
+
|
5
|
+
GirFFI.setup :GTop
|
4
6
|
|
5
7
|
# Tests generated methods and functions in the GTop namespace. This namespace
|
6
8
|
# contains types with bad names, like 'glibtop_cpu'.
|
7
|
-
describe
|
8
|
-
|
9
|
-
|
10
|
-
GirFFI.setup :GTop
|
11
|
-
rescue RuntimeError
|
12
|
-
skip 'No GIR data for GTop available'
|
13
|
-
end
|
14
|
-
end
|
15
|
-
|
16
|
-
describe 'Glibtop' do
|
17
|
-
it 'is a valid struct class' do
|
9
|
+
describe "The generated GTop module" do
|
10
|
+
describe "Glibtop" do
|
11
|
+
it "is a valid struct class" do
|
18
12
|
# Superclass is either BoxedBase or StructBase, depending on library
|
19
13
|
# versions. This means StructBase is always one of the ancestors.
|
20
14
|
assert GTop::Glibtop < GirFFI::StructBase
|
21
15
|
end
|
22
16
|
|
23
|
-
it
|
24
|
-
skip unless get_method_introspection_data 'GTop', 'glibtop', 'init'
|
17
|
+
it "can be created using Glibtop.init" do
|
25
18
|
instance = GTop::Glibtop.init
|
26
|
-
instance.must_be_kind_of GTop::Glibtop
|
19
|
+
_(instance).must_be_kind_of GTop::Glibtop
|
27
20
|
end
|
28
21
|
end
|
29
22
|
end
|