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,21 +1,21 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
|
-
require
|
3
|
+
require "introspection_test_helper"
|
4
4
|
|
5
5
|
describe GObjectIntrospection::GObjectTypeInit do
|
6
|
-
describe
|
7
|
-
it
|
8
|
-
GObjectIntrospection::GObjectTypeInit::Lib.ffi_libraries.first.name.
|
6
|
+
describe "Lib" do
|
7
|
+
it "represents the gobject-2.0 library" do
|
8
|
+
_(GObjectIntrospection::GObjectTypeInit::Lib.ffi_libraries.first.name).
|
9
9
|
must_match(/gobject-2\.0/)
|
10
10
|
end
|
11
11
|
|
12
|
-
it
|
13
|
-
GObjectIntrospection::GObjectTypeInit::Lib.must_respond_to :g_type_init
|
12
|
+
it "provides the g_type_init function" do
|
13
|
+
_(GObjectIntrospection::GObjectTypeInit::Lib).must_respond_to :g_type_init
|
14
14
|
end
|
15
15
|
end
|
16
16
|
|
17
|
-
describe
|
18
|
-
it
|
17
|
+
describe ".type_init" do
|
18
|
+
it "calls the g_type_init function from the gobject-2.0 library" do
|
19
19
|
allow(GObjectIntrospection::GObjectTypeInit::Lib).to receive(:g_type_init)
|
20
20
|
|
21
21
|
GObjectIntrospection::GObjectTypeInit.type_init
|
@@ -1,39 +1,38 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
|
-
require
|
3
|
+
require "introspection_test_helper"
|
4
4
|
|
5
5
|
describe GObjectIntrospection::IBaseInfo do
|
6
6
|
let(:described_class) { GObjectIntrospection::IBaseInfo }
|
7
|
-
describe
|
8
|
-
it
|
7
|
+
describe "#initialize" do
|
8
|
+
it "raises an error if a null pointer is passed" do
|
9
9
|
expect(ptr = Object.new).to receive(:null?).and_return true
|
10
|
-
proc { described_class.new ptr }.must_raise ArgumentError
|
10
|
+
_(proc { described_class.new ptr }).must_raise ArgumentError
|
11
11
|
end
|
12
12
|
|
13
|
-
it
|
13
|
+
it "raises no error if a non-null pointer is passed" do
|
14
14
|
expect(ptr = Object.new).to receive(:null?).and_return false
|
15
15
|
described_class.new ptr
|
16
16
|
pass
|
17
17
|
end
|
18
18
|
end
|
19
19
|
|
20
|
-
describe
|
21
|
-
let(:deprecated_info) { get_introspection_data
|
22
|
-
let(:other_info) { get_introspection_data
|
20
|
+
describe "#deprecated?" do
|
21
|
+
let(:deprecated_info) { get_introspection_data "Regress", "test_versioning" }
|
22
|
+
let(:other_info) { get_introspection_data "Regress", "test_value_return" }
|
23
23
|
|
24
|
-
it
|
25
|
-
|
26
|
-
deprecated_info.must_be :deprecated?
|
24
|
+
it "returns true for a deprecated item" do
|
25
|
+
_(deprecated_info).must_be :deprecated?
|
27
26
|
end
|
28
27
|
|
29
|
-
it
|
30
|
-
other_info.wont_be :deprecated?
|
28
|
+
it "returns false for a non-deprecated item" do
|
29
|
+
_(other_info).wont_be :deprecated?
|
31
30
|
end
|
32
31
|
end
|
33
32
|
|
34
|
-
describe
|
35
|
-
it
|
36
|
-
skip
|
33
|
+
describe "upon garbage collection" do
|
34
|
+
it "calls g_base_info_unref" do
|
35
|
+
skip "cannot be reliably tested on JRuby and Rubinius" if jruby? || rubinius?
|
37
36
|
|
38
37
|
expect(ptr = Object.new).to receive(:null?).and_return false
|
39
38
|
expect(lib = Object.new).to receive(:g_base_info_unref).with(ptr).and_return nil
|
@@ -1,32 +1,28 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
|
-
require
|
3
|
+
require "introspection_test_helper"
|
4
4
|
|
5
5
|
describe GObjectIntrospection::IConstantInfo do
|
6
|
-
describe
|
7
|
-
let(:constant_info) { get_introspection_data
|
6
|
+
describe "for GLib::USEC_PER_SEC, a constant of type :gint32" do
|
7
|
+
let(:constant_info) { get_introspection_data "GLib", "USEC_PER_SEC" }
|
8
8
|
|
9
|
-
it
|
9
|
+
it "returns :gint32 as its type" do
|
10
10
|
assert_equal :gint32, constant_info.constant_type.tag
|
11
11
|
end
|
12
12
|
|
13
|
-
it
|
13
|
+
it "returns 1_000_000 as its value" do
|
14
14
|
assert_equal 1_000_000, constant_info.value
|
15
15
|
end
|
16
16
|
end
|
17
17
|
|
18
|
-
describe
|
19
|
-
let(:constant_info) { get_introspection_data
|
18
|
+
describe "for GLib::SOURCE_CONTINUE, a constant of type :gboolean" do
|
19
|
+
let(:constant_info) { get_introspection_data "GLib", "SOURCE_CONTINUE" }
|
20
20
|
|
21
|
-
|
22
|
-
skip unless constant_info
|
23
|
-
end
|
24
|
-
|
25
|
-
it 'returns :gboolean as its type' do
|
21
|
+
it "returns :gboolean as its type" do
|
26
22
|
assert_equal :gboolean, constant_info.constant_type.tag
|
27
23
|
end
|
28
24
|
|
29
|
-
it
|
25
|
+
it "returns true as its value" do
|
30
26
|
assert_equal true, constant_info.value
|
31
27
|
end
|
32
28
|
end
|
@@ -1,18 +1,18 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
|
-
require
|
3
|
+
require "introspection_test_helper"
|
4
4
|
|
5
5
|
describe GObjectIntrospection::IEnumInfo do
|
6
|
-
describe
|
6
|
+
describe "#find_method" do
|
7
7
|
before do
|
8
8
|
gir = GObjectIntrospection::IRepository.default
|
9
|
-
gir.require
|
10
|
-
@info = gir.find_by_name
|
9
|
+
gir.require "Regress", nil
|
10
|
+
@info = gir.find_by_name "Regress", "TestEnum"
|
11
11
|
end
|
12
12
|
|
13
|
-
it
|
14
|
-
result = @info.find_method(
|
15
|
-
result.name.must_equal
|
13
|
+
it "finds a method by name" do
|
14
|
+
result = @info.find_method("param")
|
15
|
+
_(result.name).must_equal "param"
|
16
16
|
end
|
17
17
|
end
|
18
18
|
end
|
@@ -1,23 +1,23 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
|
-
require
|
3
|
+
require "introspection_test_helper"
|
4
4
|
|
5
5
|
describe GObjectIntrospection::IInterfaceInfo do
|
6
|
-
let(:object_info) { get_introspection_data(
|
6
|
+
let(:object_info) { get_introspection_data("GObject", "TypePlugin") }
|
7
7
|
|
8
|
-
describe
|
9
|
-
it
|
10
|
-
object_info.find_method(
|
8
|
+
describe "#find_method" do
|
9
|
+
it "finds a method by name string" do
|
10
|
+
_(object_info.find_method("complete_interface_info")).wont_be_nil
|
11
11
|
end
|
12
12
|
|
13
|
-
it
|
14
|
-
object_info.find_method(:complete_interface_info).wont_be_nil
|
13
|
+
it "finds a method by name symbol" do
|
14
|
+
_(object_info.find_method(:complete_interface_info)).wont_be_nil
|
15
15
|
end
|
16
16
|
end
|
17
17
|
|
18
|
-
describe
|
19
|
-
it
|
20
|
-
object_info.type_name.must_equal
|
18
|
+
describe "#type_name" do
|
19
|
+
it "returns the correct name" do
|
20
|
+
_(object_info.type_name).must_equal "GTypePlugin"
|
21
21
|
end
|
22
22
|
end
|
23
23
|
end
|
@@ -1,49 +1,49 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
|
-
require
|
3
|
+
require "introspection_test_helper"
|
4
4
|
|
5
5
|
describe GObjectIntrospection::IObjectInfo do
|
6
|
-
let(:object_info) { get_introspection_data(
|
6
|
+
let(:object_info) { get_introspection_data("GObject", "Object") }
|
7
7
|
|
8
|
-
describe
|
9
|
-
it
|
10
|
-
object_info.find_vfunc(
|
8
|
+
describe "#find_vfunc" do
|
9
|
+
it "finds a vfunc by name string" do
|
10
|
+
_(object_info.find_vfunc("finalize")).wont_be_nil
|
11
11
|
end
|
12
12
|
|
13
|
-
it
|
14
|
-
object_info.find_vfunc(:finalize).wont_be_nil
|
13
|
+
it "finds a vfunc by name symbol" do
|
14
|
+
_(object_info.find_vfunc(:finalize)).wont_be_nil
|
15
15
|
end
|
16
16
|
end
|
17
17
|
|
18
|
-
describe
|
19
|
-
it
|
20
|
-
object_info.find_method(
|
18
|
+
describe "#find_method" do
|
19
|
+
it "finds a method by name string" do
|
20
|
+
_(object_info.find_method("bind_property")).wont_be_nil
|
21
21
|
end
|
22
22
|
|
23
|
-
it
|
24
|
-
object_info.find_method(:bind_property).wont_be_nil
|
23
|
+
it "finds a method by name symbol" do
|
24
|
+
_(object_info.find_method(:bind_property)).wont_be_nil
|
25
25
|
end
|
26
26
|
end
|
27
27
|
|
28
|
-
describe
|
29
|
-
let(:object_info) { get_introspection_data(
|
28
|
+
describe "#find_property" do
|
29
|
+
let(:object_info) { get_introspection_data("GObject", "Binding") }
|
30
30
|
|
31
|
-
it
|
32
|
-
object_info.find_property(
|
31
|
+
it "finds a property by name string" do
|
32
|
+
_(object_info.find_property("source-property")).wont_be_nil
|
33
33
|
end
|
34
34
|
|
35
|
-
it
|
36
|
-
object_info.find_property(
|
35
|
+
it "finds a property by snake case string" do
|
36
|
+
_(object_info.find_property("source_property")).wont_be_nil
|
37
37
|
end
|
38
38
|
|
39
|
-
it
|
40
|
-
object_info.find_property(:source).wont_be_nil
|
39
|
+
it "finds a property by name symbol" do
|
40
|
+
_(object_info.find_property(:source)).wont_be_nil
|
41
41
|
end
|
42
42
|
end
|
43
43
|
|
44
|
-
describe
|
45
|
-
it
|
46
|
-
object_info.type_name.must_equal
|
44
|
+
describe "#type_name" do
|
45
|
+
it "returns the correct name" do
|
46
|
+
_(object_info.type_name).must_equal "GObject"
|
47
47
|
end
|
48
48
|
end
|
49
49
|
end
|
@@ -1,47 +1,47 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
|
-
require
|
3
|
+
require "introspection_test_helper"
|
4
4
|
|
5
5
|
describe GObjectIntrospection::IPropertyInfo do
|
6
6
|
describe "for Regress::TestObj's 'double' property" do
|
7
|
-
let(:property_info) { get_property_introspection_data
|
7
|
+
let(:property_info) { get_property_introspection_data "Regress", "TestObj", "double" }
|
8
8
|
|
9
|
-
it
|
10
|
-
property_info.property_type.tag.must_equal :gdouble
|
9
|
+
it "returns :gdouble as its type" do
|
10
|
+
_(property_info.property_type.tag).must_equal :gdouble
|
11
11
|
end
|
12
12
|
|
13
|
-
it
|
14
|
-
property_info.readable
|
13
|
+
it "flags the property as readable" do
|
14
|
+
_(property_info.readable?).must_equal true
|
15
15
|
end
|
16
16
|
|
17
|
-
it
|
18
|
-
property_info.writeable
|
17
|
+
it "flags the property as writeable" do
|
18
|
+
_(property_info.writeable?).must_equal true
|
19
19
|
end
|
20
20
|
|
21
|
-
it
|
22
|
-
property_info.construct_only
|
21
|
+
it "flags the property as not construct-only" do
|
22
|
+
_(property_info.construct_only?).must_equal false
|
23
23
|
end
|
24
24
|
end
|
25
25
|
|
26
26
|
describe "for GObject::Binding's 'target-property' property" do
|
27
27
|
let(:property_info) do
|
28
|
-
get_property_introspection_data
|
28
|
+
get_property_introspection_data "GObject", "Binding", "target-property"
|
29
29
|
end
|
30
30
|
|
31
|
-
it
|
32
|
-
property_info.property_type.tag.must_equal :utf8
|
31
|
+
it "returns :utf8 as its type" do
|
32
|
+
_(property_info.property_type.tag).must_equal :utf8
|
33
33
|
end
|
34
34
|
|
35
|
-
it
|
36
|
-
property_info.readable
|
35
|
+
it "flags the property as readable" do
|
36
|
+
_(property_info.readable?).must_equal true
|
37
37
|
end
|
38
38
|
|
39
|
-
it
|
40
|
-
property_info.writeable
|
39
|
+
it "flags the property as writeable" do
|
40
|
+
_(property_info.writeable?).must_equal true
|
41
41
|
end
|
42
42
|
|
43
|
-
it
|
44
|
-
property_info.construct_only
|
43
|
+
it "flags the property as construct-only" do
|
44
|
+
_(property_info.construct_only?).must_equal true
|
45
45
|
end
|
46
46
|
end
|
47
47
|
end
|
@@ -1,26 +1,26 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
|
-
require
|
3
|
+
require "introspection_test_helper"
|
4
4
|
|
5
5
|
describe GObjectIntrospection::IRegisteredTypeInfo do
|
6
|
-
describe
|
7
|
-
describe
|
6
|
+
describe "#get_type_name" do
|
7
|
+
describe "for an interface" do
|
8
8
|
let(:registered_type_info) do
|
9
|
-
get_introspection_data(
|
9
|
+
get_introspection_data("GIMarshallingTests", "Interface")
|
10
10
|
end
|
11
11
|
|
12
|
-
it
|
13
|
-
registered_type_info.type_name.must_equal
|
12
|
+
it "returns interface name" do
|
13
|
+
_(registered_type_info.type_name).must_equal "GIMarshallingTestsInterface"
|
14
14
|
end
|
15
15
|
end
|
16
16
|
|
17
|
-
describe
|
17
|
+
describe "for a type that is not an interface" do
|
18
18
|
let(:registered_type_info) do
|
19
|
-
get_introspection_data(
|
19
|
+
get_introspection_data("GIMarshallingTests", "Enum")
|
20
20
|
end
|
21
21
|
|
22
|
-
it
|
23
|
-
registered_type_info.type_name.must_be_nil
|
22
|
+
it "returns nil" do
|
23
|
+
_(registered_type_info.type_name).must_be_nil
|
24
24
|
end
|
25
25
|
end
|
26
26
|
end
|
@@ -1,81 +1,81 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
|
-
require
|
3
|
+
require "introspection_test_helper"
|
4
4
|
|
5
5
|
describe GObjectIntrospection::IRepository do
|
6
6
|
let(:gir) { GObjectIntrospection::IRepository.default }
|
7
7
|
|
8
|
-
describe
|
9
|
-
it
|
8
|
+
describe "an instance" do
|
9
|
+
it "is not created by calling new()" do
|
10
10
|
assert_raises NoMethodError do
|
11
11
|
GObjectIntrospection::IRepository.new
|
12
12
|
end
|
13
13
|
end
|
14
14
|
|
15
|
-
it
|
15
|
+
it "is created by calling default()" do
|
16
16
|
assert_kind_of GObjectIntrospection::IRepository, gir
|
17
17
|
end
|
18
18
|
|
19
|
-
it
|
19
|
+
it "is a singleton" do
|
20
20
|
gir2 = GObjectIntrospection::IRepository.default
|
21
21
|
assert_equal gir, gir2
|
22
22
|
end
|
23
23
|
end
|
24
24
|
|
25
|
-
describe
|
25
|
+
describe "#require" do
|
26
26
|
it "raises an error if the namespace doesn't exist" do
|
27
27
|
assert_raises RuntimeError do
|
28
|
-
gir.require
|
28
|
+
gir.require "VeryUnlikelyGObjectNamespaceName", nil
|
29
29
|
end
|
30
30
|
end
|
31
31
|
|
32
|
-
it
|
33
|
-
gir.require
|
32
|
+
it "allows version to be nil" do
|
33
|
+
gir.require "GObject", nil
|
34
34
|
pass
|
35
35
|
end
|
36
36
|
|
37
|
-
it
|
38
|
-
gir.require
|
37
|
+
it "allows version to be left out" do
|
38
|
+
gir.require "GObject"
|
39
39
|
pass
|
40
40
|
end
|
41
41
|
end
|
42
42
|
|
43
|
-
describe
|
44
|
-
it
|
45
|
-
proc { gir.find_by_gtype 0 }.must_raise ArgumentError
|
43
|
+
describe "#find_by_gtype" do
|
44
|
+
it "raises an error if 0 is passed as the gtype" do
|
45
|
+
_(proc { gir.find_by_gtype 0 }).must_raise ArgumentError
|
46
46
|
end
|
47
47
|
end
|
48
48
|
|
49
|
-
describe
|
50
|
-
it
|
51
|
-
gir.require
|
52
|
-
assert_operator gir.n_infos(
|
49
|
+
describe "#n_infos" do
|
50
|
+
it "yields more than one object for the GObject namespace" do
|
51
|
+
gir.require "GObject", "2.0"
|
52
|
+
assert_operator gir.n_infos("GObject"), :>, 0
|
53
53
|
end
|
54
54
|
end
|
55
55
|
|
56
|
-
describe
|
57
|
-
it
|
58
|
-
gir.require
|
59
|
-
assert_kind_of GObjectIntrospection::IBaseInfo, gir.info(
|
56
|
+
describe "#info" do
|
57
|
+
it "yields IBaseInfo objects" do
|
58
|
+
gir.require "GObject", "2.0"
|
59
|
+
assert_kind_of GObjectIntrospection::IBaseInfo, gir.info("GObject", 0)
|
60
60
|
end
|
61
61
|
end
|
62
62
|
|
63
|
-
describe
|
64
|
-
it
|
65
|
-
gir.require
|
66
|
-
result = gir.dependencies(
|
67
|
-
result.must_equal [
|
63
|
+
describe "#dependencies" do
|
64
|
+
it "returns a list of dependencies of the given namespace" do
|
65
|
+
gir.require "GObject", "2.0"
|
66
|
+
result = gir.dependencies("GObject")
|
67
|
+
_(result).must_equal ["GLib-2.0"]
|
68
68
|
end
|
69
69
|
|
70
|
-
it
|
71
|
-
gir.require
|
70
|
+
it "passes its struct pointer to the c function just in case" do
|
71
|
+
gir.require "GObject", "2.0"
|
72
72
|
allow(GObjectIntrospection::Lib).to receive(:g_irepository_get_dependencies).
|
73
73
|
and_call_original
|
74
74
|
|
75
|
-
gir.dependencies(
|
75
|
+
gir.dependencies("GObject")
|
76
76
|
|
77
77
|
expect(GObjectIntrospection::Lib).to have_received(:g_irepository_get_dependencies).
|
78
|
-
with(gir,
|
78
|
+
with(gir, "GObject")
|
79
79
|
end
|
80
80
|
end
|
81
81
|
end
|