gir_ffi 0.15.3 → 0.15.4
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Changelog.md +15 -0
- data/README.md +5 -6
- data/TODO.md +14 -35
- data/docs/Documentation.md +6 -0
- data/docs/Subclassing.md +38 -0
- data/lib/ffi-glib.rb +8 -3
- data/lib/ffi-glib/byte_array.rb +2 -1
- data/lib/ffi-glib/destroy_notify.rb +2 -2
- data/lib/ffi-glib/hash_table.rb +1 -2
- data/lib/ffi-glib/list.rb +11 -5
- data/lib/ffi-glib/list_methods.rb +12 -0
- data/lib/ffi-glib/s_list.rb +10 -4
- data/lib/ffi-gobject.rb +0 -3
- data/lib/ffi-gobject/object.rb +77 -73
- data/lib/ffi-gobject/object_class.rb +1 -1
- data/lib/ffi-gobject/value.rb +107 -108
- data/lib/ffi-gobject_introspection/i_base_info.rb +20 -19
- data/lib/gir_ffi-base/gobject/lib.rb +4 -0
- data/lib/gir_ffi/array_element_convertor.rb +1 -2
- data/lib/gir_ffi/boxed_base.rb +1 -5
- data/lib/gir_ffi/builder.rb +1 -1
- data/lib/gir_ffi/builder_helper.rb +7 -4
- data/lib/gir_ffi/builders/base_argument_builder.rb +2 -2
- data/lib/gir_ffi/builders/base_method_builder.rb +1 -1
- data/lib/gir_ffi/builders/base_type_builder.rb +1 -1
- data/lib/gir_ffi/builders/callback_argument_builder.rb +2 -0
- data/lib/gir_ffi/builders/callback_builder.rb +14 -12
- data/lib/gir_ffi/builders/callback_return_value_builder.rb +4 -6
- data/lib/gir_ffi/builders/class_struct_builder.rb +24 -0
- data/lib/gir_ffi/builders/enum_builder.rb +3 -3
- data/lib/gir_ffi/builders/interface_builder.rb +3 -1
- data/lib/gir_ffi/builders/mapping_method_builder.rb +1 -1
- data/lib/gir_ffi/builders/marshalling_method_builder.rb +5 -2
- data/lib/gir_ffi/builders/method_template.rb +4 -4
- 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 +16 -6
- data/lib/gir_ffi/builders/property_builder.rb +1 -2
- data/lib/gir_ffi/builders/signal_closure_builder.rb +3 -5
- data/lib/gir_ffi/builders/struct_builder.rb +5 -5
- data/lib/gir_ffi/builders/user_defined_builder.rb +8 -1
- data/lib/gir_ffi/builders/vfunc_argument_builder.rb +1 -1
- data/lib/gir_ffi/callback_base.rb +3 -3
- data/lib/gir_ffi/core.rb +17 -2
- data/lib/gir_ffi/glib_error.rb +1 -2
- data/lib/gir_ffi/in_pointer.rb +7 -0
- data/lib/gir_ffi/object_base.rb +27 -0
- data/lib/gir_ffi/return_value_info.rb +1 -2
- data/lib/gir_ffi/struct_base.rb +1 -9
- data/lib/gir_ffi/struct_like_base.rb +9 -5
- data/lib/gir_ffi/unintrospectable_type_info.rb +1 -1
- data/lib/gir_ffi/union_base.rb +1 -9
- data/lib/gir_ffi/user_defined_object_info.rb +3 -2
- data/lib/gir_ffi/version.rb +1 -1
- data/lib/gir_ffi/vfunc_implementation.rb +1 -0
- metadata +86 -136
- data/Gemfile +0 -14
- data/Rakefile +0 -9
- data/tasks/test.rake +0 -204
- data/test/base_test_helper.rb +0 -70
- data/test/ffi-glib/array_test.rb +0 -203
- data/test/ffi-glib/byte_array_test.rb +0 -28
- data/test/ffi-glib/bytes_test.rb +0 -61
- 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 -76
- data/test/ffi-gobject/object_class_test.rb +0 -31
- data/test/ffi-gobject/object_test.rb +0 -123
- data/test/ffi-gobject/param_spec_test.rb +0 -32
- data/test/ffi-gobject/value_test.rb +0 -390
- data/test/ffi-gobject_introspection/gobject_type_init_test.rb +0 -26
- data/test/ffi-gobject_introspection/i_base_info_test.rb +0 -52
- data/test/ffi-gobject_introspection/i_constant_info_test.rb +0 -29
- 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 -30
- 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 -153
- data/test/gir_ffi/allocation_helper_test.rb +0 -36
- data/test/gir_ffi/arg_helper_test.rb +0 -146
- 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 -168
- data/test/gir_ffi/builders/argument_builder_test.rb +0 -691
- data/test/gir_ffi/builders/base_argument_builder_test.rb +0 -6
- data/test/gir_ffi/builders/callback_argument_builder_test.rb +0 -130
- data/test/gir_ffi/builders/callback_builder_test.rb +0 -117
- data/test/gir_ffi/builders/callback_return_value_builder_test.rb +0 -84
- data/test/gir_ffi/builders/constant_builder_test.rb +0 -6
- data/test/gir_ffi/builders/constructor_builder_test.rb +0 -39
- data/test/gir_ffi/builders/enum_builder_test.rb +0 -23
- data/test/gir_ffi/builders/field_builder_test.rb +0 -140
- data/test/gir_ffi/builders/function_builder_test.rb +0 -570
- data/test/gir_ffi/builders/initializer_builder_test.rb +0 -56
- 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 -54
- data/test/gir_ffi/builders/return_value_builder_test.rb +0 -444
- data/test/gir_ffi/builders/signal_closure_builder_test.rb +0 -199
- data/test/gir_ffi/builders/struct_builder_test.rb +0 -96
- data/test/gir_ffi/builders/unintrospectable_boxed_builder_test.rb +0 -29
- data/test/gir_ffi/builders/unintrospectable_builder_test.rb +0 -84
- data/test/gir_ffi/builders/union_builder_test.rb +0 -28
- data/test/gir_ffi/builders/user_defined_builder_test.rb +0 -528
- data/test/gir_ffi/builders/vfunc_argument_builder_test.rb +0 -107
- data/test/gir_ffi/builders/vfunc_builder_test.rb +0 -245
- data/test/gir_ffi/callback_base_test.rb +0 -22
- data/test/gir_ffi/class_base_test.rb +0 -171
- data/test/gir_ffi/core_test.rb +0 -99
- 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 -22
- data/test/gir_ffi/g_type_test.rb +0 -31
- data/test/gir_ffi/in_pointer_test.rb +0 -203
- 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 -22
- 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 -712
- 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 -67
- 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 -59
- data/test/integration/derived_classes_test.rb +0 -54
- data/test/integration/generated_everything_test.rb +0 -453
- data/test/integration/generated_gimarshallingtests_test.rb +0 -3109
- data/test/integration/generated_gio_test.rb +0 -116
- data/test/integration/generated_glib_test.rb +0 -10
- data/test/integration/generated_gobject_test.rb +0 -124
- data/test/integration/generated_gst_test.rb +0 -38
- data/test/integration/generated_gtk_source_test.rb +0 -21
- data/test/integration/generated_gtop_test.rb +0 -22
- 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 -4076
- data/test/integration/generated_secret_test.rb +0 -14
- data/test/integration/generated_utility_test.rb +0 -174
- data/test/integration/generated_warnlib_test.rb +0 -45
- data/test/integration/method_lookup_test.rb +0 -34
- data/test/introspection_test_helper.rb +0 -94
- 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,3109 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
require "gir_ffi_test_helper"
|
4
|
-
|
5
|
-
require "gir_ffi"
|
6
|
-
|
7
|
-
GirFFI.setup :GIMarshallingTests
|
8
|
-
|
9
|
-
# Tests generated methods and functions in the GIMarshallingTests namespace.
|
10
|
-
describe GIMarshallingTests do
|
11
|
-
let(:derived_klass) do
|
12
|
-
Object.const_set("DerivedClass#{Sequence.next}",
|
13
|
-
Class.new(GIMarshallingTests::Object))
|
14
|
-
end
|
15
|
-
|
16
|
-
def make_derived_instance
|
17
|
-
GirFFI.define_type derived_klass do |info|
|
18
|
-
yield info if block_given?
|
19
|
-
end
|
20
|
-
derived_klass.new
|
21
|
-
end
|
22
|
-
|
23
|
-
describe "GIMarshallingTests::BoxedStruct" do
|
24
|
-
let(:instance) { GIMarshallingTests::BoxedStruct.new }
|
25
|
-
|
26
|
-
it "has a writable field long_" do
|
27
|
-
instance.long_ = 42
|
28
|
-
assert_equal 42, instance.long_
|
29
|
-
instance.long_ = 43
|
30
|
-
assert_equal 43, instance.long_
|
31
|
-
end
|
32
|
-
|
33
|
-
it "has a writable field string_" do
|
34
|
-
instance.string_ = "foobar"
|
35
|
-
_(instance.string_).must_equal "foobar"
|
36
|
-
end
|
37
|
-
|
38
|
-
it "has a writable field g_strv" do
|
39
|
-
_(instance.g_strv).must_be :==, []
|
40
|
-
instance.g_strv = %w(foo bar)
|
41
|
-
_(instance.g_strv).must_be :==, %w(foo bar)
|
42
|
-
end
|
43
|
-
|
44
|
-
it "creates an instance using #new" do
|
45
|
-
bx = GIMarshallingTests::BoxedStruct.new
|
46
|
-
assert_instance_of GIMarshallingTests::BoxedStruct, bx
|
47
|
-
_(bx.struct).must_be :owned?
|
48
|
-
end
|
49
|
-
|
50
|
-
it "has a working method #inv" do
|
51
|
-
instance.long_ = 42
|
52
|
-
instance.inv
|
53
|
-
pass
|
54
|
-
end
|
55
|
-
|
56
|
-
it "has a working function #inout" do
|
57
|
-
bx = GIMarshallingTests::BoxedStruct.new
|
58
|
-
bx.long_ = 42
|
59
|
-
_(bx.struct).must_be :owned?
|
60
|
-
|
61
|
-
res = GIMarshallingTests::BoxedStruct.inout bx
|
62
|
-
_(bx.struct).must_be :owned?
|
63
|
-
_(res.struct).must_be :owned?
|
64
|
-
|
65
|
-
assert_equal 0, res.long_
|
66
|
-
end
|
67
|
-
|
68
|
-
it "has a working function #out" do
|
69
|
-
res = GIMarshallingTests::BoxedStruct.out
|
70
|
-
_(res.struct).must_be :owned?
|
71
|
-
assert_equal 42, res.long_
|
72
|
-
end
|
73
|
-
|
74
|
-
it "has a working function #returnv" do
|
75
|
-
res = GIMarshallingTests::BoxedStruct.returnv
|
76
|
-
_(res.struct).must_be :owned?
|
77
|
-
assert_equal 42, res.long_
|
78
|
-
_(res.g_strv).must_be :==, %w(0 1 2)
|
79
|
-
end
|
80
|
-
end
|
81
|
-
|
82
|
-
it "has the constant CONSTANT_GERROR_CODE" do
|
83
|
-
assert_equal 5, GIMarshallingTests::CONSTANT_GERROR_CODE
|
84
|
-
end
|
85
|
-
|
86
|
-
it "has the constant CONSTANT_GERROR_DEBUG_MESSAGE" do
|
87
|
-
_(GIMarshallingTests::CONSTANT_GERROR_DEBUG_MESSAGE).must_equal(
|
88
|
-
"we got an error, life is shit")
|
89
|
-
end
|
90
|
-
|
91
|
-
it "has the constant CONSTANT_GERROR_DOMAIN" do
|
92
|
-
assert_equal "gi-marshalling-tests-gerror-domain",
|
93
|
-
GIMarshallingTests::CONSTANT_GERROR_DOMAIN
|
94
|
-
end
|
95
|
-
|
96
|
-
it "has the constant CONSTANT_GERROR_MESSAGE" do
|
97
|
-
assert_equal "gi-marshalling-tests-gerror-message",
|
98
|
-
GIMarshallingTests::CONSTANT_GERROR_MESSAGE
|
99
|
-
end
|
100
|
-
|
101
|
-
it "has the constant CONSTANT_NUMBER" do
|
102
|
-
assert_equal 42, GIMarshallingTests::CONSTANT_NUMBER
|
103
|
-
end
|
104
|
-
|
105
|
-
it "has the constant CONSTANT_UTF8" do
|
106
|
-
assert_equal "const ♥ utf8", GIMarshallingTests::CONSTANT_UTF8
|
107
|
-
end
|
108
|
-
|
109
|
-
describe "GIMarshallingTests::Enum" do
|
110
|
-
it "has the member :value1" do
|
111
|
-
assert_equal 0, GIMarshallingTests::Enum[:value1]
|
112
|
-
end
|
113
|
-
|
114
|
-
it "has the member :value2" do
|
115
|
-
assert_equal 1, GIMarshallingTests::Enum[:value2]
|
116
|
-
end
|
117
|
-
|
118
|
-
it "has the member :value3" do
|
119
|
-
assert_equal 42, GIMarshallingTests::Enum[:value3]
|
120
|
-
end
|
121
|
-
end
|
122
|
-
|
123
|
-
describe "GIMarshallingTests::Flags" do
|
124
|
-
it "has the member :value1" do
|
125
|
-
assert_equal 1, GIMarshallingTests::Flags[:value1]
|
126
|
-
end
|
127
|
-
|
128
|
-
it "has the member :value2" do
|
129
|
-
assert_equal 2, GIMarshallingTests::Flags[:value2]
|
130
|
-
end
|
131
|
-
|
132
|
-
it "has the member :value3" do
|
133
|
-
assert_equal 4, GIMarshallingTests::Flags[:value3]
|
134
|
-
end
|
135
|
-
|
136
|
-
it "has the member :mask" do
|
137
|
-
assert_equal 3, GIMarshallingTests::Flags[:mask]
|
138
|
-
end
|
139
|
-
|
140
|
-
it "has the member :mask2" do
|
141
|
-
assert_equal 3, GIMarshallingTests::Flags[:mask2]
|
142
|
-
end
|
143
|
-
|
144
|
-
it "has a working function #in" do
|
145
|
-
GIMarshallingTests::Flags.in value2: true
|
146
|
-
end
|
147
|
-
|
148
|
-
it "has a working function #in_zero" do
|
149
|
-
GIMarshallingTests::Flags.in_zero 0
|
150
|
-
end
|
151
|
-
|
152
|
-
it "has a working function #inout" do
|
153
|
-
result = GIMarshallingTests::Flags.inout value2: true
|
154
|
-
_(result).must_equal(value1: true)
|
155
|
-
end
|
156
|
-
|
157
|
-
it "has a working function #out" do
|
158
|
-
result = GIMarshallingTests::Flags.out
|
159
|
-
_(result).must_equal(value2: true)
|
160
|
-
end
|
161
|
-
|
162
|
-
it "has a working function #returnv" do
|
163
|
-
result = GIMarshallingTests::Flags.returnv
|
164
|
-
_(result).must_equal(value2: true)
|
165
|
-
end
|
166
|
-
end
|
167
|
-
|
168
|
-
describe "GIMarshallingTests::GEnum" do
|
169
|
-
it "has the member :value1" do
|
170
|
-
assert_equal 0, GIMarshallingTests::GEnum[:value1]
|
171
|
-
end
|
172
|
-
|
173
|
-
it "has the member :value2" do
|
174
|
-
assert_equal 1, GIMarshallingTests::GEnum[:value2]
|
175
|
-
end
|
176
|
-
|
177
|
-
it "has the member :value3" do
|
178
|
-
assert_equal 42, GIMarshallingTests::GEnum[:value3]
|
179
|
-
end
|
180
|
-
|
181
|
-
it "has a working function #in" do
|
182
|
-
GIMarshallingTests::GEnum.in :value3
|
183
|
-
end
|
184
|
-
|
185
|
-
it "has a working function #inout" do
|
186
|
-
result = GIMarshallingTests::GEnum.inout :value3
|
187
|
-
_(result).must_equal :value1
|
188
|
-
end
|
189
|
-
|
190
|
-
it "has a working function #out" do
|
191
|
-
result = GIMarshallingTests::GEnum.out
|
192
|
-
_(result).must_equal :value3
|
193
|
-
end
|
194
|
-
|
195
|
-
it "has a working function #returnv" do
|
196
|
-
result = GIMarshallingTests::GEnum.returnv
|
197
|
-
_(result).must_equal :value3
|
198
|
-
end
|
199
|
-
end
|
200
|
-
|
201
|
-
describe "GIMarshallingTests::Interface" do
|
202
|
-
it "has a working method #test_int8_in" do
|
203
|
-
derived_klass.class_eval { include GIMarshallingTests::Interface }
|
204
|
-
derived_instance = make_derived_instance do |info|
|
205
|
-
info.install_vfunc_implementation :test_int8_in, proc { |obj, in_| obj.int = in_ }
|
206
|
-
end
|
207
|
-
derived_instance.test_int8_in 8
|
208
|
-
_(derived_instance.int).must_equal 8
|
209
|
-
end
|
210
|
-
end
|
211
|
-
|
212
|
-
describe "GIMarshallingTests::Interface2" do
|
213
|
-
it "must be tested for clashes with Interface" do
|
214
|
-
skip "Needs more work to determine desired behavior"
|
215
|
-
end
|
216
|
-
end
|
217
|
-
|
218
|
-
describe "GIMarshallingTests::Interface3" do
|
219
|
-
it "has a working method #test_variant_array_in" do
|
220
|
-
derived_klass.class_eval { include GIMarshallingTests::Interface3 }
|
221
|
-
derived_instance = make_derived_instance do |info|
|
222
|
-
info.install_vfunc_implementation :test_variant_array_in, proc { |obj, in_|
|
223
|
-
obj.int = in_.to_a.first.get_byte
|
224
|
-
}
|
225
|
-
end
|
226
|
-
derived_instance.test_variant_array_in [GLib::Variant.new_byte(42)]
|
227
|
-
_(derived_instance.int).must_equal 42
|
228
|
-
end
|
229
|
-
end
|
230
|
-
|
231
|
-
describe "GIMarshallingTests::InterfaceImpl" do
|
232
|
-
it "has a working method #get_as_interface" do
|
233
|
-
obj = GIMarshallingTests::InterfaceImpl.new []
|
234
|
-
result = obj.get_as_interface
|
235
|
-
_(result).must_be_kind_of GIMarshallingTests::Interface
|
236
|
-
end
|
237
|
-
end
|
238
|
-
|
239
|
-
describe "GIMarshallingTests::NestedStruct" do
|
240
|
-
let(:instance) { GIMarshallingTests::NestedStruct.new }
|
241
|
-
it "has a writable field simple_struct" do
|
242
|
-
assert_instance_of GIMarshallingTests::SimpleStruct,
|
243
|
-
instance.simple_struct
|
244
|
-
new_struct = GIMarshallingTests::SimpleStruct.new
|
245
|
-
new_struct.int8 = 42
|
246
|
-
instance.simple_struct = new_struct
|
247
|
-
_(instance.simple_struct.int8).must_equal 42
|
248
|
-
end
|
249
|
-
end
|
250
|
-
|
251
|
-
describe "GIMarshallingTests::NoTypeFlags" do
|
252
|
-
it "has the member :value1" do
|
253
|
-
assert_equal 1, GIMarshallingTests::NoTypeFlags[:value1]
|
254
|
-
end
|
255
|
-
it "has the member :value2" do
|
256
|
-
assert_equal 2, GIMarshallingTests::NoTypeFlags[:value2]
|
257
|
-
end
|
258
|
-
it "has the member :value3" do
|
259
|
-
assert_equal 4, GIMarshallingTests::NoTypeFlags[:value3]
|
260
|
-
end
|
261
|
-
it "has the member :mask" do
|
262
|
-
assert_equal 3, GIMarshallingTests::NoTypeFlags[:mask]
|
263
|
-
end
|
264
|
-
it "has the member :mask2" do
|
265
|
-
assert_equal 3, GIMarshallingTests::NoTypeFlags[:mask2]
|
266
|
-
end
|
267
|
-
end
|
268
|
-
|
269
|
-
describe "GIMarshallingTests::NotSimpleStruct" do
|
270
|
-
let(:instance) { GIMarshallingTests::NotSimpleStruct.new }
|
271
|
-
|
272
|
-
it "has a writable field pointer" do
|
273
|
-
_(instance.pointer).must_be_nil
|
274
|
-
nested = GIMarshallingTests::NestedStruct.new
|
275
|
-
nested.simple_struct.int8 = 23
|
276
|
-
instance.pointer = nested
|
277
|
-
_(instance.pointer.simple_struct.int8).must_equal 23
|
278
|
-
end
|
279
|
-
end
|
280
|
-
|
281
|
-
it "has the constant OVERRIDES_CONSTANT" do
|
282
|
-
assert_equal 42, GIMarshallingTests::OVERRIDES_CONSTANT
|
283
|
-
end
|
284
|
-
|
285
|
-
describe "GIMarshallingTests::Object" do
|
286
|
-
it "creates an instance using #new" do
|
287
|
-
ob = GIMarshallingTests::Object.new 42
|
288
|
-
assert_instance_of GIMarshallingTests::Object, ob
|
289
|
-
assert_equal 42, ob.int
|
290
|
-
end
|
291
|
-
|
292
|
-
it "fails to create an instance using #new_fail" do
|
293
|
-
_(proc { GIMarshallingTests::Object.new_fail 42 }).must_raise GirFFI::GLibError
|
294
|
-
end
|
295
|
-
|
296
|
-
it "has a working function #full_inout" do
|
297
|
-
ob = GIMarshallingTests::Object.new 42
|
298
|
-
_(object_ref_count(ob)).must_equal 1
|
299
|
-
|
300
|
-
res = GIMarshallingTests::Object.full_inout ob
|
301
|
-
|
302
|
-
_(object_ref_count(ob)).must_equal 1
|
303
|
-
_(object_ref_count(res)).must_equal 1
|
304
|
-
|
305
|
-
_(res).must_be_instance_of GIMarshallingTests::Object
|
306
|
-
_(res.int).must_equal 0
|
307
|
-
end
|
308
|
-
|
309
|
-
it "has a working function #full_out" do
|
310
|
-
res = GIMarshallingTests::Object.full_out
|
311
|
-
_(res).must_be_instance_of GIMarshallingTests::Object
|
312
|
-
_(object_ref_count(res)).must_equal 1
|
313
|
-
end
|
314
|
-
|
315
|
-
it "has a working function #full_return" do
|
316
|
-
res = GIMarshallingTests::Object.full_return
|
317
|
-
_(res).must_be_instance_of GIMarshallingTests::Object
|
318
|
-
_(object_ref_count(res)).must_equal 1
|
319
|
-
end
|
320
|
-
|
321
|
-
it "has a working function #none_inout" do
|
322
|
-
ob = GIMarshallingTests::Object.new 42
|
323
|
-
_(object_ref_count(ob)).must_equal 1
|
324
|
-
|
325
|
-
res = GIMarshallingTests::Object.none_inout ob
|
326
|
-
|
327
|
-
_(object_ref_count(ob)).must_equal 1
|
328
|
-
_(object_ref_count(res)).must_equal 2
|
329
|
-
|
330
|
-
_(res).must_be_instance_of GIMarshallingTests::Object
|
331
|
-
_(ob.int).must_equal 42
|
332
|
-
_(res.int).must_equal 0
|
333
|
-
end
|
334
|
-
|
335
|
-
it "has a working function #none_out" do
|
336
|
-
res = GIMarshallingTests::Object.none_out
|
337
|
-
_(res).must_be_instance_of GIMarshallingTests::Object
|
338
|
-
_(object_ref_count(res)).must_equal 2
|
339
|
-
end
|
340
|
-
|
341
|
-
it "has a working function #none_return" do
|
342
|
-
res = GIMarshallingTests::Object.none_return
|
343
|
-
_(res).must_be_instance_of GIMarshallingTests::Object
|
344
|
-
_(object_ref_count(res)).must_equal 2
|
345
|
-
end
|
346
|
-
|
347
|
-
it "has a working function #static_method" do
|
348
|
-
GIMarshallingTests::Object.static_method
|
349
|
-
pass
|
350
|
-
end
|
351
|
-
|
352
|
-
let(:instance) { GIMarshallingTests::Object.new 42 }
|
353
|
-
|
354
|
-
it "has a working method #call_vfunc_with_callback" do
|
355
|
-
cb = nil
|
356
|
-
user_data = nil
|
357
|
-
result = nil
|
358
|
-
|
359
|
-
derived_instance = make_derived_instance do |info|
|
360
|
-
info.install_vfunc_implementation(
|
361
|
-
:vfunc_with_callback,
|
362
|
-
proc { |_obj, callback, callback_data|
|
363
|
-
cb = callback
|
364
|
-
user_data = callback_data.address
|
365
|
-
result = callback.call(42, callback_data)
|
366
|
-
})
|
367
|
-
end
|
368
|
-
derived_instance.call_vfunc_with_callback
|
369
|
-
|
370
|
-
_(user_data).must_equal 0xdeadbeef
|
371
|
-
# TODO: Change implementation of CallbackBase so that this becomes an
|
372
|
-
# instance of GIMarshallingTests::CallbackIntInt
|
373
|
-
_(cb).must_be_instance_of FFI::Function
|
374
|
-
_(result).must_equal 42
|
375
|
-
end
|
376
|
-
|
377
|
-
it "has a working method #full_in" do
|
378
|
-
skip "This function is defined in the header but not implemented"
|
379
|
-
end
|
380
|
-
|
381
|
-
it "has a working method #get_ref_info_for_vfunc_in_object_transfer_full" do
|
382
|
-
obj = nil
|
383
|
-
derived_instance = make_derived_instance do |info|
|
384
|
-
info.install_vfunc_implementation(
|
385
|
-
:vfunc_in_object_transfer_full,
|
386
|
-
proc { |_this, object|
|
387
|
-
obj = object
|
388
|
-
})
|
389
|
-
end
|
390
|
-
result = derived_instance
|
391
|
-
.get_ref_info_for_vfunc_in_object_transfer_full GIMarshallingTests::Object.gtype
|
392
|
-
_(result).must_equal [1, false]
|
393
|
-
_(obj).must_be_instance_of GIMarshallingTests::Object
|
394
|
-
end
|
395
|
-
|
396
|
-
it "has a working method #get_ref_info_for_vfunc_in_object_transfer_none" do
|
397
|
-
obj = nil
|
398
|
-
derived_instance = make_derived_instance do |info|
|
399
|
-
info.install_vfunc_implementation(
|
400
|
-
:vfunc_in_object_transfer_none,
|
401
|
-
proc { |_this, object|
|
402
|
-
obj = object
|
403
|
-
})
|
404
|
-
end
|
405
|
-
result = derived_instance
|
406
|
-
.get_ref_info_for_vfunc_in_object_transfer_none GIMarshallingTests::Object.gtype
|
407
|
-
_(object_ref_count(obj)).must_be :>, 0
|
408
|
-
_(result).must_equal [2, false]
|
409
|
-
_(obj).must_be_instance_of GIMarshallingTests::Object
|
410
|
-
end
|
411
|
-
|
412
|
-
it "has a working method #get_ref_info_for_vfunc_out_object_transfer_full" do
|
413
|
-
obj = nil
|
414
|
-
derived_instance = make_derived_instance do |info|
|
415
|
-
info.install_vfunc_implementation :vfunc_out_object_transfer_full, proc { |_obj|
|
416
|
-
obj = GIMarshallingTests::Object.new(42)
|
417
|
-
}
|
418
|
-
end
|
419
|
-
result = derived_instance.get_ref_info_for_vfunc_out_object_transfer_full
|
420
|
-
_(object_ref_count(obj)).must_be :>, 0
|
421
|
-
# TODO: Check desired result
|
422
|
-
_(result).must_equal [2, false]
|
423
|
-
end
|
424
|
-
|
425
|
-
it "has a working method #get_ref_info_for_vfunc_out_object_transfer_none" do
|
426
|
-
derived_instance = make_derived_instance do |info|
|
427
|
-
info.install_vfunc_implementation :vfunc_out_object_transfer_none, proc { |_obj|
|
428
|
-
GIMarshallingTests::Object.new 42
|
429
|
-
}
|
430
|
-
end
|
431
|
-
result = derived_instance.get_ref_info_for_vfunc_out_object_transfer_none
|
432
|
-
_(result).must_equal [1, false]
|
433
|
-
end
|
434
|
-
|
435
|
-
it "has a working method #get_ref_info_for_vfunc_return_object_transfer_full" do
|
436
|
-
derived_instance = make_derived_instance do |info|
|
437
|
-
info.install_vfunc_implementation :vfunc_return_object_transfer_full, proc { |_obj|
|
438
|
-
GIMarshallingTests::Object.new 42
|
439
|
-
}
|
440
|
-
end
|
441
|
-
result = derived_instance.get_ref_info_for_vfunc_return_object_transfer_full
|
442
|
-
_(result).must_equal [2, false]
|
443
|
-
end
|
444
|
-
|
445
|
-
it "has a working method #get_ref_info_for_vfunc_return_object_transfer_none" do
|
446
|
-
derived_instance = make_derived_instance do |info|
|
447
|
-
info.install_vfunc_implementation :vfunc_return_object_transfer_none, proc { |_obj|
|
448
|
-
GIMarshallingTests::Object.new 42
|
449
|
-
}
|
450
|
-
end
|
451
|
-
result = derived_instance.get_ref_info_for_vfunc_return_object_transfer_none
|
452
|
-
_(result).must_equal [1, false]
|
453
|
-
end
|
454
|
-
|
455
|
-
it "has a working method #int8_in" do
|
456
|
-
derived_instance = make_derived_instance do |info|
|
457
|
-
info.install_vfunc_implementation :method_int8_in, proc { |obj, in_| obj.int = in_ }
|
458
|
-
end
|
459
|
-
derived_instance.int8_in 23
|
460
|
-
_(derived_instance.int).must_equal 23
|
461
|
-
end
|
462
|
-
|
463
|
-
it "has a working method #int8_out" do
|
464
|
-
derived_instance = make_derived_instance do |info|
|
465
|
-
info.install_vfunc_implementation :method_int8_out, proc { |_obj| 42 }
|
466
|
-
end
|
467
|
-
|
468
|
-
_(derived_instance.int8_out).must_equal 42
|
469
|
-
end
|
470
|
-
|
471
|
-
it "has a working method #method" do
|
472
|
-
instance.method
|
473
|
-
pass
|
474
|
-
end
|
475
|
-
|
476
|
-
it "has a working method #method_array_in" do
|
477
|
-
instance.method_array_in [-1, 0, 1, 2]
|
478
|
-
pass
|
479
|
-
end
|
480
|
-
|
481
|
-
it "has a working method #method_array_inout" do
|
482
|
-
res = instance.method_array_inout [-1, 0, 1, 2]
|
483
|
-
_(res).must_be :==, [-2, -1, 0, 1, 2]
|
484
|
-
end
|
485
|
-
|
486
|
-
it "has a working method #method_array_out" do
|
487
|
-
res = instance.method_array_out
|
488
|
-
_(res).must_be :==, [-1, 0, 1, 2]
|
489
|
-
end
|
490
|
-
|
491
|
-
it "has a working method #method_array_return" do
|
492
|
-
res = instance.method_array_return
|
493
|
-
_(res).must_be :==, [-1, 0, 1, 2]
|
494
|
-
end
|
495
|
-
|
496
|
-
it "has a working method #method_int8_arg_and_out_callee" do
|
497
|
-
derived_instance = make_derived_instance do |info|
|
498
|
-
info.install_vfunc_implementation(
|
499
|
-
:method_int8_arg_and_out_callee,
|
500
|
-
proc { |_obj, arg|
|
501
|
-
2 * arg
|
502
|
-
})
|
503
|
-
end
|
504
|
-
result = derived_instance.method_int8_arg_and_out_callee 32
|
505
|
-
_(result).must_equal 64
|
506
|
-
end
|
507
|
-
|
508
|
-
it "has a working method #method_int8_arg_and_out_caller" do
|
509
|
-
derived_instance = make_derived_instance do |info|
|
510
|
-
info.install_vfunc_implementation(
|
511
|
-
:method_int8_arg_and_out_caller,
|
512
|
-
proc { |_obj, arg|
|
513
|
-
2 * arg
|
514
|
-
})
|
515
|
-
end
|
516
|
-
result = derived_instance.method_int8_arg_and_out_caller 32
|
517
|
-
_(result).must_equal 64
|
518
|
-
end
|
519
|
-
|
520
|
-
it "has a working method #method_int8_in" do
|
521
|
-
derived_instance = make_derived_instance do |info|
|
522
|
-
info.install_vfunc_implementation :method_int8_in, proc { |obj, in_| obj.int = in_ }
|
523
|
-
end
|
524
|
-
derived_instance.method_int8_in 108
|
525
|
-
_(derived_instance.int).must_equal 108
|
526
|
-
end
|
527
|
-
|
528
|
-
it "has a working method #method_int8_out" do
|
529
|
-
derived_instance = make_derived_instance do |info|
|
530
|
-
info.install_vfunc_implementation :method_int8_out, proc { |_obj| 42 }
|
531
|
-
end
|
532
|
-
_(derived_instance.method_int8_out).must_equal 42
|
533
|
-
end
|
534
|
-
|
535
|
-
it "has a working method #method_str_arg_out_ret" do
|
536
|
-
derived_instance = make_derived_instance do |info|
|
537
|
-
info.install_vfunc_implementation(:method_str_arg_out_ret,
|
538
|
-
proc { |_obj, arg| [arg, 42] })
|
539
|
-
end
|
540
|
-
_(derived_instance.method_str_arg_out_ret("foo")).must_equal ["foo", 42]
|
541
|
-
end
|
542
|
-
|
543
|
-
it "has a working method #method_variant_array_in" do
|
544
|
-
skip "This function is defined in the header but not implemented"
|
545
|
-
end
|
546
|
-
|
547
|
-
it "has a working method #method_with_default_implementation" do
|
548
|
-
instance.method_with_default_implementation 104
|
549
|
-
assert_equal 104, instance.int
|
550
|
-
end
|
551
|
-
|
552
|
-
it "has a working method #none_in" do
|
553
|
-
instance.none_in
|
554
|
-
pass
|
555
|
-
end
|
556
|
-
|
557
|
-
it "has a working method #overridden_method" do
|
558
|
-
instance.set_property("int", 0)
|
559
|
-
instance.overridden_method
|
560
|
-
pass
|
561
|
-
end
|
562
|
-
|
563
|
-
it "has a working method #vfunc_array_out_parameter" do
|
564
|
-
derived_instance = make_derived_instance do |info|
|
565
|
-
info.install_vfunc_implementation :vfunc_array_out_parameter, proc { |_obj|
|
566
|
-
[1.1, 2.2, 3.3]
|
567
|
-
}
|
568
|
-
end
|
569
|
-
result = derived_instance.vfunc_array_out_parameter
|
570
|
-
arr = result.to_a
|
571
|
-
_(arr.length).must_equal 3
|
572
|
-
_(arr[0]).must_be_close_to 1.1
|
573
|
-
_(arr[1]).must_be_close_to 2.2
|
574
|
-
_(arr[2]).must_be_close_to 3.3
|
575
|
-
end
|
576
|
-
|
577
|
-
it "has a working method #vfunc_caller_allocated_out_parameter" do
|
578
|
-
derived_instance = make_derived_instance do |info|
|
579
|
-
info.install_vfunc_implementation(
|
580
|
-
:vfunc_caller_allocated_out_parameter,
|
581
|
-
proc { |_obj|
|
582
|
-
"Hello!"
|
583
|
-
})
|
584
|
-
end
|
585
|
-
result = derived_instance.vfunc_caller_allocated_out_parameter
|
586
|
-
_(result).must_equal "Hello!"
|
587
|
-
end
|
588
|
-
|
589
|
-
it "has a working method #vfunc_meth_with_error" do
|
590
|
-
derived_instance = make_derived_instance do |info|
|
591
|
-
info.install_vfunc_implementation :vfunc_meth_with_err, proc { |_object, x|
|
592
|
-
raise "This is not the answer!" unless x == 42
|
593
|
-
|
594
|
-
true
|
595
|
-
}
|
596
|
-
end
|
597
|
-
result = derived_instance.vfunc_meth_with_error 42
|
598
|
-
_(result).must_equal true
|
599
|
-
|
600
|
-
err = _(proc { derived_instance.vfunc_meth_with_error(21) })
|
601
|
-
.must_raise GirFFI::GLibError
|
602
|
-
_(err.message).must_equal "This is not the answer!"
|
603
|
-
_(err.domain).must_equal "gir_ffi"
|
604
|
-
_(err.code).must_equal 0
|
605
|
-
end
|
606
|
-
|
607
|
-
it "has a working method #vfunc_multiple_out_parameters" do
|
608
|
-
derived_instance = make_derived_instance do |info|
|
609
|
-
info.install_vfunc_implementation(
|
610
|
-
:vfunc_multiple_out_parameters,
|
611
|
-
proc { |*_args| [42.1, -142.3] })
|
612
|
-
end
|
613
|
-
result = derived_instance.vfunc_multiple_out_parameters
|
614
|
-
_(result[0]).must_be_close_to 42.1
|
615
|
-
_(result[1]).must_be_close_to(-142.3)
|
616
|
-
end
|
617
|
-
|
618
|
-
it "has a working method #vfunc_one_out_parameter" do
|
619
|
-
derived_instance = make_derived_instance do |info|
|
620
|
-
info.install_vfunc_implementation(
|
621
|
-
:vfunc_one_out_parameter,
|
622
|
-
proc { |*_args| 23.4 })
|
623
|
-
end
|
624
|
-
_(derived_instance.vfunc_one_out_parameter)
|
625
|
-
.must_be_within_epsilon 23.4
|
626
|
-
end
|
627
|
-
|
628
|
-
it "has a working method #vfunc_out_enum" do
|
629
|
-
derived_instance = make_derived_instance do |info|
|
630
|
-
info.install_vfunc_implementation :vfunc_out_enum, proc { |_obj| :value2 }
|
631
|
-
end
|
632
|
-
_(derived_instance.vfunc_out_enum).must_equal :value2
|
633
|
-
end
|
634
|
-
|
635
|
-
it "has a working method #vfunc_return_enum" do
|
636
|
-
derived_instance = make_derived_instance do |info|
|
637
|
-
info.install_vfunc_implementation :vfunc_return_enum, proc { |_obj| :value2 }
|
638
|
-
end
|
639
|
-
_(derived_instance.vfunc_return_enum).must_equal :value2
|
640
|
-
end
|
641
|
-
|
642
|
-
it "has a working method #vfunc_return_value_and_multiple_out_parameters" do
|
643
|
-
derived_instance = make_derived_instance do |info|
|
644
|
-
info.install_vfunc_implementation(
|
645
|
-
:vfunc_return_value_and_multiple_out_parameters,
|
646
|
-
proc { |*_args| [42, -142, 3] })
|
647
|
-
end
|
648
|
-
_(derived_instance.vfunc_return_value_and_multiple_out_parameters)
|
649
|
-
.must_equal [42, -142, 3]
|
650
|
-
end
|
651
|
-
|
652
|
-
it "has a working method #vfunc_return_value_and_one_out_parameter" do
|
653
|
-
derived_instance = make_derived_instance do |info|
|
654
|
-
info.install_vfunc_implementation(
|
655
|
-
:vfunc_return_value_and_one_out_parameter,
|
656
|
-
proc { |*_args| [42, -142] })
|
657
|
-
end
|
658
|
-
_(derived_instance.vfunc_return_value_and_one_out_parameter)
|
659
|
-
.must_equal [42, -142]
|
660
|
-
end
|
661
|
-
|
662
|
-
it "has a working method #vfunc_return_value_only" do
|
663
|
-
derived_instance = make_derived_instance do |info|
|
664
|
-
info.install_vfunc_implementation(:vfunc_return_value_only,
|
665
|
-
proc { |_obj| 0x1234_5678 })
|
666
|
-
end
|
667
|
-
result = derived_instance.vfunc_return_value_only
|
668
|
-
_(result).must_equal 0x1234_5678
|
669
|
-
end
|
670
|
-
|
671
|
-
it "has a working method #vfunc_with_callback" do
|
672
|
-
result = 1
|
673
|
-
|
674
|
-
derived_instance = make_derived_instance do |info|
|
675
|
-
info.install_vfunc_implementation(
|
676
|
-
:vfunc_with_callback,
|
677
|
-
proc { |_obj, callback, callback_data|
|
678
|
-
callback.call(42, callback_data)
|
679
|
-
})
|
680
|
-
end
|
681
|
-
|
682
|
-
derived_instance.vfunc_with_callback { |val, user_data| result = val + user_data }
|
683
|
-
|
684
|
-
# The current implementation of the vfunc_with_callback method currently
|
685
|
-
# doesn't actually call the virtual function vfunc_with_callback.
|
686
|
-
_(result).must_equal 1
|
687
|
-
_(result).wont_equal 42 + 23
|
688
|
-
end
|
689
|
-
|
690
|
-
describe "its 'int' property" do
|
691
|
-
it "can be retrieved with #get_property" do
|
692
|
-
assert_equal 42, instance.get_property("int")
|
693
|
-
end
|
694
|
-
it "can be retrieved with #int" do
|
695
|
-
assert_equal 42, instance.int
|
696
|
-
end
|
697
|
-
it "can be set with #set_property" do
|
698
|
-
instance.set_property("int", 13)
|
699
|
-
assert_equal 13, instance.get_property("int")
|
700
|
-
end
|
701
|
-
it "can be set with #int=" do
|
702
|
-
instance.int = 1
|
703
|
-
assert_equal 1, instance.int
|
704
|
-
end
|
705
|
-
end
|
706
|
-
end
|
707
|
-
|
708
|
-
describe "GIMarshallingTests::OverridesObject" do
|
709
|
-
it "creates an instance using #new" do
|
710
|
-
ob = GIMarshallingTests::OverridesObject.new
|
711
|
-
assert_instance_of GIMarshallingTests::OverridesObject, ob
|
712
|
-
end
|
713
|
-
|
714
|
-
it "has a working function #returnv" do
|
715
|
-
ob = GIMarshallingTests::OverridesObject.returnv
|
716
|
-
assert_instance_of GIMarshallingTests::OverridesObject, ob
|
717
|
-
end
|
718
|
-
|
719
|
-
let(:instance) { GIMarshallingTests::OverridesObject.new }
|
720
|
-
|
721
|
-
it "has a working method #method" do
|
722
|
-
result = instance.method
|
723
|
-
_(result).must_equal 42
|
724
|
-
end
|
725
|
-
|
726
|
-
it "does not have accessors for its parent instance" do
|
727
|
-
_(instance).wont_respond_to :parent_instance
|
728
|
-
_(instance).wont_respond_to :parent_instance=
|
729
|
-
end
|
730
|
-
end
|
731
|
-
|
732
|
-
describe "GIMarshallingTests::OverridesStruct" do
|
733
|
-
let(:instance) { GIMarshallingTests::OverridesStruct.new }
|
734
|
-
|
735
|
-
it "has a writable field long_" do
|
736
|
-
instance.long_ = 43
|
737
|
-
_(instance.long_).must_equal 43
|
738
|
-
end
|
739
|
-
|
740
|
-
it "creates an instance using #new" do
|
741
|
-
ob = GIMarshallingTests::OverridesStruct.new
|
742
|
-
assert_instance_of GIMarshallingTests::OverridesStruct, ob
|
743
|
-
end
|
744
|
-
|
745
|
-
it "has a working method #method" do
|
746
|
-
_(instance.method).must_equal 42
|
747
|
-
end
|
748
|
-
|
749
|
-
it "has a working function #returnv" do
|
750
|
-
ob = GIMarshallingTests::OverridesStruct.returnv
|
751
|
-
assert_instance_of GIMarshallingTests::OverridesStruct, ob
|
752
|
-
end
|
753
|
-
end
|
754
|
-
|
755
|
-
describe "GIMarshallingTests::PointerStruct" do
|
756
|
-
it "creates an instance using #new" do
|
757
|
-
ps = GIMarshallingTests::PointerStruct.new
|
758
|
-
assert_instance_of GIMarshallingTests::PointerStruct, ps
|
759
|
-
end
|
760
|
-
|
761
|
-
let(:instance) { GIMarshallingTests::PointerStruct.new }
|
762
|
-
|
763
|
-
it "has a writable field long_" do
|
764
|
-
assert_equal 0, instance.long_
|
765
|
-
instance.long_ = 1056
|
766
|
-
assert_equal 1056, instance.long_
|
767
|
-
end
|
768
|
-
|
769
|
-
it "has a working method #inv" do
|
770
|
-
instance.long_ = 42
|
771
|
-
instance.inv
|
772
|
-
pass
|
773
|
-
end
|
774
|
-
|
775
|
-
it "has a working function #returnv" do
|
776
|
-
ob = GIMarshallingTests::PointerStruct.returnv
|
777
|
-
assert_instance_of GIMarshallingTests::PointerStruct, ob
|
778
|
-
end
|
779
|
-
end
|
780
|
-
|
781
|
-
describe "GIMarshallingTests::PropertiesObject" do
|
782
|
-
it "creates an instance using #new" do
|
783
|
-
ob = GIMarshallingTests::PropertiesObject.new
|
784
|
-
assert_instance_of GIMarshallingTests::PropertiesObject, ob
|
785
|
-
end
|
786
|
-
|
787
|
-
let(:instance) { GIMarshallingTests::PropertiesObject.new }
|
788
|
-
|
789
|
-
describe "its 'some-boolean' property" do
|
790
|
-
it "can be retrieved with #get_property" do
|
791
|
-
_(instance.get_property("some-boolean")).must_equal false
|
792
|
-
end
|
793
|
-
|
794
|
-
it "can be retrieved with #some_boolean" do
|
795
|
-
_(instance.some_boolean).must_equal false
|
796
|
-
end
|
797
|
-
|
798
|
-
it "can be set with #set_property" do
|
799
|
-
instance.set_property("some-boolean", true)
|
800
|
-
_(instance.get_property("some-boolean")).must_equal true
|
801
|
-
end
|
802
|
-
|
803
|
-
it "can be set with #some_boolean=" do
|
804
|
-
instance.some_boolean = true
|
805
|
-
_(instance.get_property("some-boolean")).must_equal true
|
806
|
-
end
|
807
|
-
end
|
808
|
-
|
809
|
-
describe "its 'some-boxed-glist' property" do
|
810
|
-
it "can be retrieved with #get_property" do
|
811
|
-
_(instance.get_property("some-boxed-glist")).must_be_nil
|
812
|
-
end
|
813
|
-
|
814
|
-
it "can be retrieved with #some_boxed_glist" do
|
815
|
-
_(instance.some_boxed_glist).must_be_nil
|
816
|
-
end
|
817
|
-
|
818
|
-
it "can be set with #set_property" do
|
819
|
-
instance.set_property("some-boxed-glist", [1, 2, 3])
|
820
|
-
_(instance.some_boxed_glist.to_a).must_equal [1, 2, 3]
|
821
|
-
end
|
822
|
-
|
823
|
-
it "can be set with #some_boxed_glist=" do
|
824
|
-
instance.some_boxed_glist = [1, 2, 3]
|
825
|
-
_(instance.some_boxed_glist.to_a).must_equal [1, 2, 3]
|
826
|
-
_(instance.get_property("some-boxed-glist").to_a).must_equal [1, 2, 3]
|
827
|
-
end
|
828
|
-
end
|
829
|
-
|
830
|
-
describe "its 'some-boxed-struct' property" do
|
831
|
-
it "can be retrieved with #get_property" do
|
832
|
-
_(instance.get_property("some-boxed-struct")).must_be_nil
|
833
|
-
end
|
834
|
-
|
835
|
-
it "can be retrieved with #some_boxed_struct" do
|
836
|
-
_(instance.some_boxed_struct).must_be_nil
|
837
|
-
end
|
838
|
-
|
839
|
-
it "can be set with #set_property" do
|
840
|
-
boxed = GIMarshallingTests::BoxedStruct.new
|
841
|
-
boxed.long_ = 42
|
842
|
-
instance.set_property("some-boxed-struct", boxed)
|
843
|
-
_(instance.get_property("some-boxed-struct").long_).must_equal 42
|
844
|
-
end
|
845
|
-
|
846
|
-
it "can be set with #some_boxed_struct=" do
|
847
|
-
boxed = GIMarshallingTests::BoxedStruct.new
|
848
|
-
boxed.long_ = 43
|
849
|
-
instance.some_boxed_struct = boxed
|
850
|
-
_(instance.some_boxed_struct.long_).must_equal 43
|
851
|
-
end
|
852
|
-
end
|
853
|
-
|
854
|
-
describe "its 'some-byte-array' property" do
|
855
|
-
before { skip_below("1.57.2") }
|
856
|
-
|
857
|
-
it "can be retrieved with #get_property" do
|
858
|
-
_(instance.get_property("some-byte-array")).must_be_nil
|
859
|
-
end
|
860
|
-
|
861
|
-
it "can be retrieved with #some_byte_array" do
|
862
|
-
_(instance.some_byte_array).must_be_nil
|
863
|
-
end
|
864
|
-
|
865
|
-
it "can be set with #set_property" do
|
866
|
-
instance.set_property "some-byte-array", "some bytes"
|
867
|
-
_(instance.get_property("some-byte-array").to_string).must_equal "some bytes"
|
868
|
-
end
|
869
|
-
|
870
|
-
it "can be set with #some_byte_array=" do
|
871
|
-
instance.some_byte_array = "some bytes"
|
872
|
-
_(instance.some_byte_array.to_string).must_equal "some bytes"
|
873
|
-
end
|
874
|
-
end
|
875
|
-
|
876
|
-
describe "its 'some-char' property" do
|
877
|
-
it "can be retrieved with #get_property" do
|
878
|
-
_(instance.get_property("some-char")).must_equal 0
|
879
|
-
end
|
880
|
-
|
881
|
-
it "can be retrieved with #some_char" do
|
882
|
-
_(instance.some_char).must_equal 0
|
883
|
-
end
|
884
|
-
|
885
|
-
it "can be set with #set_property" do
|
886
|
-
instance.set_property "some-char", 42
|
887
|
-
_(instance.get_property("some-char")).must_equal 42
|
888
|
-
end
|
889
|
-
|
890
|
-
it "can be set with #some_char=" do
|
891
|
-
instance.some_char = 43
|
892
|
-
_(instance.some_char).must_equal 43
|
893
|
-
end
|
894
|
-
end
|
895
|
-
|
896
|
-
describe "its 'some-double' property" do
|
897
|
-
it "can be retrieved with #get_property" do
|
898
|
-
_(instance.get_property("some-double")).must_equal 0.0
|
899
|
-
end
|
900
|
-
|
901
|
-
it "can be retrieved with #some_double" do
|
902
|
-
_(instance.some_double).must_equal 0.0
|
903
|
-
end
|
904
|
-
|
905
|
-
it "can be set with #set_property" do
|
906
|
-
instance.set_property("some-double", 3.14)
|
907
|
-
_(instance.get_property("some-double")).must_equal 3.14
|
908
|
-
end
|
909
|
-
|
910
|
-
it "can be set with #some_double=" do
|
911
|
-
instance.some_double = 3.14
|
912
|
-
_(instance.some_double).must_equal 3.14
|
913
|
-
end
|
914
|
-
end
|
915
|
-
|
916
|
-
describe "its 'some-enum' property" do
|
917
|
-
before { skip_below("1.52.1") }
|
918
|
-
|
919
|
-
it "can be retrieved with #get_property" do
|
920
|
-
_(instance.get_property("some-enum")).must_equal :value1
|
921
|
-
end
|
922
|
-
|
923
|
-
it "can be retrieved with #some_enum" do
|
924
|
-
_(instance.some_enum).must_equal :value1
|
925
|
-
end
|
926
|
-
|
927
|
-
it "can be set with #set_property" do
|
928
|
-
instance.set_property("some-enum", :value3)
|
929
|
-
_(instance.get_property("some-enum")).must_equal :value3
|
930
|
-
end
|
931
|
-
|
932
|
-
it "can be set with #some_enum=" do
|
933
|
-
instance.some_enum = :value3
|
934
|
-
_(instance.some_enum).must_equal :value3
|
935
|
-
_(instance.get_property("some-enum")).must_equal :value3
|
936
|
-
end
|
937
|
-
end
|
938
|
-
|
939
|
-
describe "its 'some-flags' property" do
|
940
|
-
before { skip_below("1.52.1") }
|
941
|
-
|
942
|
-
it "can be retrieved with #get_property" do
|
943
|
-
_(instance.get_property("some-flags")).must_equal value1: true
|
944
|
-
end
|
945
|
-
|
946
|
-
it "can be retrieved with #some_flags" do
|
947
|
-
_(instance.some_flags).must_equal value1: true
|
948
|
-
end
|
949
|
-
|
950
|
-
it "can be set with #set_property" do
|
951
|
-
instance.set_property("some-flags", value3: true)
|
952
|
-
_(instance.get_property("some-flags")).must_equal value3: true
|
953
|
-
end
|
954
|
-
|
955
|
-
it "can be set with #some_flags=" do
|
956
|
-
instance.some_flags = :value3
|
957
|
-
_(instance.some_flags).must_equal(value3: true)
|
958
|
-
_(instance.get_property("some-flags")).must_equal(value3: true)
|
959
|
-
end
|
960
|
-
end
|
961
|
-
|
962
|
-
describe "its 'some-float' property" do
|
963
|
-
it "can be retrieved with #get_property" do
|
964
|
-
_(instance.get_property("some-float")).must_equal 0.0
|
965
|
-
end
|
966
|
-
|
967
|
-
it "can be retrieved with #some_float" do
|
968
|
-
_(instance.some_float).must_equal 0.0
|
969
|
-
end
|
970
|
-
|
971
|
-
it "can be set with #set_property" do
|
972
|
-
instance.set_property("some-float", 3.14)
|
973
|
-
_(instance.get_property("some-float")).must_be_close_to 3.14
|
974
|
-
end
|
975
|
-
|
976
|
-
it "can be set with #some_float=" do
|
977
|
-
instance.some_float = 3.14
|
978
|
-
_(instance.some_float).must_be_close_to 3.14
|
979
|
-
end
|
980
|
-
end
|
981
|
-
|
982
|
-
describe "its 'some-gvalue' property" do
|
983
|
-
before { skip_below "1.52.1" }
|
984
|
-
|
985
|
-
it "can be retrieved with #get_property" do
|
986
|
-
_(instance.get_property("some-gvalue")).must_be_nil
|
987
|
-
end
|
988
|
-
|
989
|
-
it "can be retrieved with #some_gvalue" do
|
990
|
-
_(instance.some_gvalue).must_be_nil
|
991
|
-
end
|
992
|
-
|
993
|
-
it "can be set with #set_property" do
|
994
|
-
value = GObject::Value.from 42
|
995
|
-
instance.set_property("some-gvalue", value)
|
996
|
-
_(instance.get_property("some-gvalue").get_value).must_equal 42
|
997
|
-
end
|
998
|
-
|
999
|
-
it "can be set with #some_gvalue=" do
|
1000
|
-
value = GObject::Value.from 42
|
1001
|
-
instance.some_gvalue = value
|
1002
|
-
_(instance.some_gvalue.get_value).must_equal 42
|
1003
|
-
_(instance.get_property("some-gvalue").get_value).must_equal 42
|
1004
|
-
end
|
1005
|
-
end
|
1006
|
-
|
1007
|
-
describe "its 'some-int' property" do
|
1008
|
-
it "can be retrieved with #get_property" do
|
1009
|
-
_(instance.get_property("some-int")).must_equal 0
|
1010
|
-
end
|
1011
|
-
|
1012
|
-
it "can be retrieved with #some_int" do
|
1013
|
-
_(instance.some_int).must_equal 0
|
1014
|
-
end
|
1015
|
-
|
1016
|
-
it "can be set with #set_property" do
|
1017
|
-
instance.set_property "some-int", 4242
|
1018
|
-
_(instance.get_property("some-int")).must_equal 4242
|
1019
|
-
end
|
1020
|
-
|
1021
|
-
it "can be set with #some_int=" do
|
1022
|
-
instance.some_int = 4243
|
1023
|
-
_(instance.some_int).must_equal 4243
|
1024
|
-
end
|
1025
|
-
end
|
1026
|
-
|
1027
|
-
describe "its 'some-int64' property" do
|
1028
|
-
it "can be retrieved with #get_property" do
|
1029
|
-
_(instance.get_property("some-int64")).must_equal 0
|
1030
|
-
end
|
1031
|
-
|
1032
|
-
it "can be retrieved with #some_int64" do
|
1033
|
-
_(instance.some_int64).must_equal 0
|
1034
|
-
end
|
1035
|
-
|
1036
|
-
it "can be set with #set_property" do
|
1037
|
-
instance.set_property "some-int64", 42_000_000_000_000
|
1038
|
-
_(instance.get_property("some-int64")).must_equal 42_000_000_000_000
|
1039
|
-
end
|
1040
|
-
|
1041
|
-
it "can be set with #some_int64=" do
|
1042
|
-
instance.some_int64 = 43_000_000_000_000
|
1043
|
-
_(instance.some_int64).must_equal 43_000_000_000_000
|
1044
|
-
end
|
1045
|
-
end
|
1046
|
-
|
1047
|
-
describe "its 'some-long' property" do
|
1048
|
-
it "can be retrieved with #get_property" do
|
1049
|
-
_(instance.get_property("some-long")).must_equal 0
|
1050
|
-
end
|
1051
|
-
|
1052
|
-
it "can be retrieved with #some_long" do
|
1053
|
-
_(instance.some_long).must_equal 0
|
1054
|
-
end
|
1055
|
-
|
1056
|
-
it "can be set with #set_property" do
|
1057
|
-
instance.set_property "some-long", 4242
|
1058
|
-
_(instance.get_property("some-long")).must_equal 4242
|
1059
|
-
end
|
1060
|
-
|
1061
|
-
it "can be set with #some_long=" do
|
1062
|
-
instance.some_long = 4243
|
1063
|
-
_(instance.some_long).must_equal 4243
|
1064
|
-
end
|
1065
|
-
end
|
1066
|
-
|
1067
|
-
describe "its 'some-object' property" do
|
1068
|
-
it "can be retrieved with #get_property" do
|
1069
|
-
_(instance.get_property("some-object")).must_be_nil
|
1070
|
-
end
|
1071
|
-
|
1072
|
-
it "can be retrieved with #some_object" do
|
1073
|
-
_(instance.some_object).must_be_nil
|
1074
|
-
end
|
1075
|
-
|
1076
|
-
it "can be set with #set_property" do
|
1077
|
-
ob = GIMarshallingTests::Object.new 42
|
1078
|
-
instance.set_property "some-object", ob
|
1079
|
-
_(instance.get_property("some-object")).must_equal ob
|
1080
|
-
end
|
1081
|
-
|
1082
|
-
it "can be set with #some_object=" do
|
1083
|
-
ob = GIMarshallingTests::Object.new 42
|
1084
|
-
instance.some_object = ob
|
1085
|
-
_(instance.some_object).must_equal ob
|
1086
|
-
end
|
1087
|
-
end
|
1088
|
-
|
1089
|
-
describe "its 'some-readonly' property" do
|
1090
|
-
before { skip_below("1.57.2") }
|
1091
|
-
|
1092
|
-
it "can be retrieved with #get_property" do
|
1093
|
-
_(instance.get_property("some-readonly")).must_equal 42
|
1094
|
-
end
|
1095
|
-
|
1096
|
-
it "can be retrieved with #some_readonly" do
|
1097
|
-
_(instance.some_readonly).must_equal 42
|
1098
|
-
end
|
1099
|
-
end
|
1100
|
-
|
1101
|
-
describe "its 'some-strv' property" do
|
1102
|
-
it "can be retrieved with #get_property" do
|
1103
|
-
_(instance.get_property("some-strv")).must_be :==, []
|
1104
|
-
end
|
1105
|
-
|
1106
|
-
it "can be retrieved with #some_strv" do
|
1107
|
-
_(instance.some_strv).must_be :==, []
|
1108
|
-
end
|
1109
|
-
|
1110
|
-
it "can be set with #set_property" do
|
1111
|
-
instance.set_property("some-strv", %w(foo bar))
|
1112
|
-
_(instance.get_property("some-strv")).must_be :==, %w(foo bar)
|
1113
|
-
end
|
1114
|
-
|
1115
|
-
it "can be set with #some_strv=" do
|
1116
|
-
instance.some_strv = %w(foo bar)
|
1117
|
-
_(instance.some_strv).must_be :==, %w(foo bar)
|
1118
|
-
end
|
1119
|
-
end
|
1120
|
-
|
1121
|
-
describe "its 'some-uchar' property" do
|
1122
|
-
it "can be retrieved with #get_property" do
|
1123
|
-
_(instance.get_property("some-uchar")).must_equal 0
|
1124
|
-
end
|
1125
|
-
|
1126
|
-
it "can be retrieved with #some_uchar" do
|
1127
|
-
_(instance.some_uchar).must_equal 0
|
1128
|
-
end
|
1129
|
-
|
1130
|
-
it "can be set with #set_property" do
|
1131
|
-
instance.set_property "some-uchar", 42
|
1132
|
-
_(instance.get_property("some-uchar")).must_equal 42
|
1133
|
-
end
|
1134
|
-
|
1135
|
-
it "can be set with #some_uchar=" do
|
1136
|
-
instance.some_uchar = 43
|
1137
|
-
_(instance.some_uchar).must_equal 43
|
1138
|
-
end
|
1139
|
-
end
|
1140
|
-
|
1141
|
-
describe "its 'some-uint' property" do
|
1142
|
-
it "can be retrieved with #get_property" do
|
1143
|
-
_(instance.get_property("some-uint")).must_equal 0
|
1144
|
-
end
|
1145
|
-
|
1146
|
-
it "can be retrieved with #some_uint" do
|
1147
|
-
_(instance.some_uint).must_equal 0
|
1148
|
-
end
|
1149
|
-
|
1150
|
-
it "can be set with #set_property" do
|
1151
|
-
instance.set_property "some-uint", 4242
|
1152
|
-
_(instance.get_property("some-uint")).must_equal 4242
|
1153
|
-
end
|
1154
|
-
|
1155
|
-
it "can be set with #some_uint=" do
|
1156
|
-
instance.some_uint = 4243
|
1157
|
-
_(instance.some_uint).must_equal 4243
|
1158
|
-
end
|
1159
|
-
end
|
1160
|
-
|
1161
|
-
describe "its 'some-uint64' property" do
|
1162
|
-
it "can be retrieved with #get_property" do
|
1163
|
-
_(instance.get_property("some-uint64")).must_equal 0
|
1164
|
-
end
|
1165
|
-
|
1166
|
-
it "can be retrieved with #some_uint64" do
|
1167
|
-
_(instance.some_uint64).must_equal 0
|
1168
|
-
end
|
1169
|
-
|
1170
|
-
it "can be set with #set_property" do
|
1171
|
-
instance.set_property "some-uint64", 42_000_000_000_000
|
1172
|
-
_(instance.get_property("some-uint64")).must_equal 42_000_000_000_000
|
1173
|
-
end
|
1174
|
-
|
1175
|
-
it "can be set with #some_uint64=" do
|
1176
|
-
instance.some_uint64 = 43_000_000_000_000
|
1177
|
-
_(instance.some_uint64).must_equal 43_000_000_000_000
|
1178
|
-
end
|
1179
|
-
end
|
1180
|
-
|
1181
|
-
describe "its 'some-ulong' property" do
|
1182
|
-
it "can be retrieved with #get_property" do
|
1183
|
-
_(instance.get_property("some-ulong")).must_equal 0
|
1184
|
-
end
|
1185
|
-
|
1186
|
-
it "can be retrieved with #some_ulong" do
|
1187
|
-
_(instance.some_ulong).must_equal 0
|
1188
|
-
end
|
1189
|
-
|
1190
|
-
it "can be set with #set_property" do
|
1191
|
-
instance.set_property "some-ulong", 4242
|
1192
|
-
_(instance.get_property("some-ulong")).must_equal 4242
|
1193
|
-
end
|
1194
|
-
|
1195
|
-
it "can be set with #some_ulong=" do
|
1196
|
-
instance.some_ulong = 4243
|
1197
|
-
_(instance.some_ulong).must_equal 4243
|
1198
|
-
end
|
1199
|
-
end
|
1200
|
-
|
1201
|
-
describe "its 'some-variant' property" do
|
1202
|
-
it "can be retrieved with #get_property" do
|
1203
|
-
_(instance.get_property("some-variant")).must_be_nil
|
1204
|
-
end
|
1205
|
-
|
1206
|
-
it "can be retrieved with #some_variant" do
|
1207
|
-
_(instance.some_variant).must_be_nil
|
1208
|
-
end
|
1209
|
-
|
1210
|
-
it "can be set with #set_property" do
|
1211
|
-
value = GLib::Variant.new_string("Foo")
|
1212
|
-
instance.set_property "some-variant", value
|
1213
|
-
_(instance.get_property("some-variant")).must_equal value
|
1214
|
-
end
|
1215
|
-
|
1216
|
-
it "can be set with #some_variant=" do
|
1217
|
-
value = GLib::Variant.new_string("Foo")
|
1218
|
-
instance.some_variant = value
|
1219
|
-
_(instance.some_variant).must_equal value
|
1220
|
-
end
|
1221
|
-
end
|
1222
|
-
end
|
1223
|
-
|
1224
|
-
describe "GIMarshallingTests::SecondEnum" do
|
1225
|
-
it "has the member :secondvalue1" do
|
1226
|
-
assert_equal 0, GIMarshallingTests::SecondEnum[:secondvalue1]
|
1227
|
-
end
|
1228
|
-
it "has the member :secondvalue2" do
|
1229
|
-
assert_equal 1, GIMarshallingTests::SecondEnum[:secondvalue2]
|
1230
|
-
end
|
1231
|
-
end
|
1232
|
-
|
1233
|
-
describe "GIMarshallingTests::SimpleStruct" do
|
1234
|
-
it "creates an instance using #new" do
|
1235
|
-
ss = GIMarshallingTests::SimpleStruct.new
|
1236
|
-
assert_instance_of GIMarshallingTests::SimpleStruct, ss
|
1237
|
-
end
|
1238
|
-
|
1239
|
-
let(:instance) { GIMarshallingTests::SimpleStruct.new }
|
1240
|
-
|
1241
|
-
it "has a writable field long_" do
|
1242
|
-
_(instance.long_).must_equal 0
|
1243
|
-
instance.long_ = 1056
|
1244
|
-
_(instance.long_).must_equal 1056
|
1245
|
-
end
|
1246
|
-
|
1247
|
-
it "has a writable field int8" do
|
1248
|
-
_(instance.int8).must_equal 0
|
1249
|
-
instance.int8 = -43
|
1250
|
-
_(instance.int8).must_equal(-43)
|
1251
|
-
end
|
1252
|
-
|
1253
|
-
it "has a working method #inv" do
|
1254
|
-
instance.long_ = 6
|
1255
|
-
instance.int8 = 7
|
1256
|
-
instance.inv
|
1257
|
-
pass
|
1258
|
-
end
|
1259
|
-
|
1260
|
-
it "has a working method #method" do
|
1261
|
-
instance.long_ = 6
|
1262
|
-
instance.int8 = 7
|
1263
|
-
instance.method
|
1264
|
-
pass
|
1265
|
-
end
|
1266
|
-
|
1267
|
-
it "has a working function #returnv" do
|
1268
|
-
ss = GIMarshallingTests::SimpleStruct.returnv
|
1269
|
-
assert_instance_of GIMarshallingTests::SimpleStruct, ss
|
1270
|
-
end
|
1271
|
-
end
|
1272
|
-
|
1273
|
-
describe "GIMarshallingTests::SubObject" do
|
1274
|
-
it "creates an instance using #new" do
|
1275
|
-
so = GIMarshallingTests::SubObject.new
|
1276
|
-
_(so).must_be_instance_of GIMarshallingTests::SubObject
|
1277
|
-
_(GObject.type_name_from_instance(so))
|
1278
|
-
.must_equal "GIMarshallingTestsSubObject"
|
1279
|
-
end
|
1280
|
-
|
1281
|
-
let(:instance) { GIMarshallingTests::SubObject.new }
|
1282
|
-
|
1283
|
-
it "has a working method #overwritten_method" do
|
1284
|
-
instance.overwritten_method
|
1285
|
-
pass
|
1286
|
-
end
|
1287
|
-
|
1288
|
-
it "has a working method #sub_method" do
|
1289
|
-
instance.sub_method
|
1290
|
-
pass
|
1291
|
-
end
|
1292
|
-
|
1293
|
-
it "does not have accessors for its parent instance" do
|
1294
|
-
_(instance).wont_respond_to :parent_instance
|
1295
|
-
_(instance).wont_respond_to :parent_instance=
|
1296
|
-
end
|
1297
|
-
end
|
1298
|
-
|
1299
|
-
describe "GIMarshallingTests::SubSubObject" do
|
1300
|
-
it "creates an instance using #new" do
|
1301
|
-
so = GIMarshallingTests::SubSubObject.new
|
1302
|
-
assert_instance_of GIMarshallingTests::SubSubObject, so
|
1303
|
-
_(GObject.type_name_from_instance(so))
|
1304
|
-
.must_equal "GIMarshallingTestsSubSubObject"
|
1305
|
-
end
|
1306
|
-
|
1307
|
-
let(:instance) { GIMarshallingTests::SubSubObject.new }
|
1308
|
-
|
1309
|
-
it "does not have accessors for its parent instance" do
|
1310
|
-
_(instance).wont_respond_to :parent_instance
|
1311
|
-
_(instance).wont_respond_to :parent_instance=
|
1312
|
-
end
|
1313
|
-
end
|
1314
|
-
|
1315
|
-
describe "GIMarshallingTests::Union" do
|
1316
|
-
it "creates an instance with #new" do
|
1317
|
-
u = GIMarshallingTests::Union.new
|
1318
|
-
assert_instance_of GIMarshallingTests::Union, u
|
1319
|
-
end
|
1320
|
-
|
1321
|
-
let(:instance) { GIMarshallingTests::Union.new }
|
1322
|
-
|
1323
|
-
it "has a writable field long_" do
|
1324
|
-
assert_equal 0, instance.long_
|
1325
|
-
instance.long_ = 1056
|
1326
|
-
assert_equal 1056, instance.long_
|
1327
|
-
end
|
1328
|
-
|
1329
|
-
it "has a working method #inv" do
|
1330
|
-
instance.long_ = 42
|
1331
|
-
instance.inv
|
1332
|
-
pass
|
1333
|
-
end
|
1334
|
-
|
1335
|
-
it "has a working method #method" do
|
1336
|
-
instance.long_ = 42
|
1337
|
-
instance.method
|
1338
|
-
pass
|
1339
|
-
end
|
1340
|
-
|
1341
|
-
it "has a working function #inout" do
|
1342
|
-
skip "This function is defined in the header but not implemented"
|
1343
|
-
end
|
1344
|
-
|
1345
|
-
it "has a working function #out" do
|
1346
|
-
skip "This function is defined in the header but not implemented"
|
1347
|
-
end
|
1348
|
-
|
1349
|
-
it "has a working function #returnv" do
|
1350
|
-
u = GIMarshallingTests::Union.returnv
|
1351
|
-
assert_instance_of GIMarshallingTests::Union, u
|
1352
|
-
end
|
1353
|
-
end
|
1354
|
-
|
1355
|
-
it "has a working function #array_bool_in" do
|
1356
|
-
skip_below "1.51.1"
|
1357
|
-
GIMarshallingTests.array_bool_in [true, false, true, true]
|
1358
|
-
end
|
1359
|
-
|
1360
|
-
it "has a working function #array_bool_out" do
|
1361
|
-
skip_below "1.51.1"
|
1362
|
-
result = GIMarshallingTests.array_bool_out
|
1363
|
-
_(result.to_a).must_equal [true, false, true, true]
|
1364
|
-
end
|
1365
|
-
|
1366
|
-
it "has a working function #array_enum_in" do
|
1367
|
-
GIMarshallingTests.array_enum_in [:value1, :value2, :value3]
|
1368
|
-
end
|
1369
|
-
|
1370
|
-
it "has a working function #array_fixed_inout" do
|
1371
|
-
res = GIMarshallingTests.array_fixed_inout [-1, 0, 1, 2]
|
1372
|
-
_(res).must_be :==, [2, 1, 0, -1]
|
1373
|
-
end
|
1374
|
-
|
1375
|
-
it "has a working function #array_fixed_int_in" do
|
1376
|
-
GIMarshallingTests.array_fixed_int_in [-1, 0, 1, 2]
|
1377
|
-
pass
|
1378
|
-
end
|
1379
|
-
|
1380
|
-
it "has a working function #array_fixed_int_return" do
|
1381
|
-
res = GIMarshallingTests.array_fixed_int_return
|
1382
|
-
_(res).must_be :==, [-1, 0, 1, 2]
|
1383
|
-
end
|
1384
|
-
|
1385
|
-
it "has a working function #array_fixed_out" do
|
1386
|
-
res = GIMarshallingTests.array_fixed_out
|
1387
|
-
_(res).must_be :==, [-1, 0, 1, 2]
|
1388
|
-
end
|
1389
|
-
|
1390
|
-
it "has a working function #array_fixed_out_struct" do
|
1391
|
-
res = GIMarshallingTests.array_fixed_out_struct
|
1392
|
-
assert_equal [[7, 6], [6, 7]], res.map { |s| [s.long_, s.int8] }
|
1393
|
-
end
|
1394
|
-
|
1395
|
-
it "has a working function #array_fixed_short_in" do
|
1396
|
-
GIMarshallingTests.array_fixed_short_in [-1, 0, 1, 2]
|
1397
|
-
pass
|
1398
|
-
end
|
1399
|
-
|
1400
|
-
it "has a working function #array_fixed_short_return" do
|
1401
|
-
res = GIMarshallingTests.array_fixed_short_return
|
1402
|
-
_(res).must_be :==, [-1, 0, 1, 2]
|
1403
|
-
end
|
1404
|
-
|
1405
|
-
it "has a working function #array_gvariant_container_in" do
|
1406
|
-
v1 = GLib::Variant.new_int32(27)
|
1407
|
-
v2 = GLib::Variant.new_string("Hello")
|
1408
|
-
result = GIMarshallingTests.array_gvariant_container_in [v1, v2]
|
1409
|
-
arr = result.to_a
|
1410
|
-
_(arr.size).must_equal 2
|
1411
|
-
_(arr[0].get_int32).must_equal 27
|
1412
|
-
_(arr[1].get_string).must_equal "Hello"
|
1413
|
-
end
|
1414
|
-
|
1415
|
-
it "has a working function #array_gvariant_full_in" do
|
1416
|
-
v1 = GLib::Variant.new_int32(27)
|
1417
|
-
v2 = GLib::Variant.new_string("Hello")
|
1418
|
-
result = GIMarshallingTests.array_gvariant_full_in [v1, v2]
|
1419
|
-
arr = result.to_a
|
1420
|
-
_(arr.size).must_equal 2
|
1421
|
-
_(arr[0].get_int32).must_equal 27
|
1422
|
-
_(arr[1].get_string).must_equal "Hello"
|
1423
|
-
end
|
1424
|
-
|
1425
|
-
it "has a working function #array_gvariant_none_in" do
|
1426
|
-
v1 = GLib::Variant.new_int32(27)
|
1427
|
-
v2 = GLib::Variant.new_string("Hello")
|
1428
|
-
result = GIMarshallingTests.array_gvariant_none_in [v1, v2]
|
1429
|
-
arr = result.to_a
|
1430
|
-
_(arr.size).must_equal 2
|
1431
|
-
_(arr[0].get_int32).must_equal 27
|
1432
|
-
_(arr[1].get_string).must_equal "Hello"
|
1433
|
-
end
|
1434
|
-
|
1435
|
-
it "has a working function #array_in" do
|
1436
|
-
GIMarshallingTests.array_in [-1, 0, 1, 2]
|
1437
|
-
pass
|
1438
|
-
end
|
1439
|
-
|
1440
|
-
it "has a working function #array_in_guint64_len" do
|
1441
|
-
GIMarshallingTests.array_in_guint64_len [-1, 0, 1, 2]
|
1442
|
-
pass
|
1443
|
-
end
|
1444
|
-
|
1445
|
-
it "has a working function #array_in_guint8_len" do
|
1446
|
-
GIMarshallingTests.array_in_guint8_len [-1, 0, 1, 2]
|
1447
|
-
pass
|
1448
|
-
end
|
1449
|
-
|
1450
|
-
it "has a working function #array_in_len_before" do
|
1451
|
-
GIMarshallingTests.array_in_len_before [-1, 0, 1, 2]
|
1452
|
-
pass
|
1453
|
-
end
|
1454
|
-
|
1455
|
-
it "has a working function #array_in_len_zero_terminated" do
|
1456
|
-
GIMarshallingTests.array_in_len_zero_terminated [-1, 0, 1, 2]
|
1457
|
-
pass
|
1458
|
-
end
|
1459
|
-
|
1460
|
-
it "has a working function #array_in_nonzero_nonlen" do
|
1461
|
-
GIMarshallingTests.array_in_nonzero_nonlen 1, "abcd".bytes.to_a
|
1462
|
-
pass
|
1463
|
-
end
|
1464
|
-
|
1465
|
-
it "has a working function #array_in_utf8_two_in" do
|
1466
|
-
GIMarshallingTests.array_in_utf8_two_in [-1, 0, 1, 2], "1", "2"
|
1467
|
-
pass
|
1468
|
-
end
|
1469
|
-
|
1470
|
-
it "has a working function #array_in_utf8_two_in_out_of_order" do
|
1471
|
-
GIMarshallingTests.array_in_utf8_two_in_out_of_order "1", [-1, 0, 1, 2], "2"
|
1472
|
-
pass
|
1473
|
-
end
|
1474
|
-
|
1475
|
-
it "has a working function #array_inout" do
|
1476
|
-
res = GIMarshallingTests.array_inout [-1, 0, 1, 2]
|
1477
|
-
_(res).must_be :==, [-2, -1, 0, 1, 2]
|
1478
|
-
end
|
1479
|
-
|
1480
|
-
it "has a working function #array_inout_etc" do
|
1481
|
-
arr, sum = GIMarshallingTests.array_inout_etc 42, [-1, 0, 1, 2], 24
|
1482
|
-
_(arr).must_be :==, [42, -1, 0, 1, 24]
|
1483
|
-
_(sum).must_equal 42 + 24
|
1484
|
-
end
|
1485
|
-
|
1486
|
-
it "has a working function #array_int64_in" do
|
1487
|
-
skip_below "1.51.1"
|
1488
|
-
GIMarshallingTests.array_int64_in [-1, 0, 1, 2]
|
1489
|
-
end
|
1490
|
-
|
1491
|
-
it "has a working function #array_out" do
|
1492
|
-
res = GIMarshallingTests.array_out
|
1493
|
-
_(res).must_be :==, [-1, 0, 1, 2]
|
1494
|
-
end
|
1495
|
-
|
1496
|
-
it "has a working function #array_out_etc" do
|
1497
|
-
arr, sum = GIMarshallingTests.array_out_etc 42, 24
|
1498
|
-
_(arr).must_be :==, [42, 0, 1, 24]
|
1499
|
-
_(sum).must_equal 42 + 24
|
1500
|
-
end
|
1501
|
-
|
1502
|
-
it "has a working function #array_return" do
|
1503
|
-
res = GIMarshallingTests.array_return
|
1504
|
-
_(res).must_be :==, [-1, 0, 1, 2]
|
1505
|
-
end
|
1506
|
-
|
1507
|
-
it "has a working function #array_return_etc" do
|
1508
|
-
arr, sum = GIMarshallingTests.array_return_etc 42, 24
|
1509
|
-
_(arr).must_be :==, [42, 0, 1, 24]
|
1510
|
-
_(sum).must_equal 42 + 24
|
1511
|
-
end
|
1512
|
-
|
1513
|
-
it "has a working function #array_simple_struct_in" do
|
1514
|
-
arr = [1, 2, 3].map do |val|
|
1515
|
-
GIMarshallingTests::SimpleStruct.new.tap { |struct| struct.long_ = val }
|
1516
|
-
end
|
1517
|
-
GIMarshallingTests.array_simple_struct_in arr
|
1518
|
-
end
|
1519
|
-
|
1520
|
-
it "has a working function #array_string_in" do
|
1521
|
-
GIMarshallingTests.array_string_in %w(foo bar)
|
1522
|
-
pass
|
1523
|
-
end
|
1524
|
-
|
1525
|
-
it "has a working function #array_struct_in" do
|
1526
|
-
arr = [1, 2, 3].map do |val|
|
1527
|
-
GIMarshallingTests::BoxedStruct.new.tap { |struct| struct.long_ = val }
|
1528
|
-
end
|
1529
|
-
GIMarshallingTests.array_struct_in arr
|
1530
|
-
end
|
1531
|
-
|
1532
|
-
it "has a working function #array_struct_take_in" do
|
1533
|
-
arr = [1, 2, 3].map do |val|
|
1534
|
-
GIMarshallingTests::BoxedStruct.new.tap { |struct| struct.long_ = val }
|
1535
|
-
end
|
1536
|
-
# NOTE: This copies values so arr's elements stay valid
|
1537
|
-
GIMarshallingTests.array_struct_take_in arr
|
1538
|
-
|
1539
|
-
_(arr.map(&:long_)).must_equal [1, 2, 3]
|
1540
|
-
end
|
1541
|
-
|
1542
|
-
it "has a working function #array_struct_value_in" do
|
1543
|
-
arr = [1, 2, 3].map do |val|
|
1544
|
-
GIMarshallingTests::BoxedStruct.new.tap { |struct| struct.long_ = val }
|
1545
|
-
end
|
1546
|
-
GIMarshallingTests.array_struct_value_in arr
|
1547
|
-
end
|
1548
|
-
|
1549
|
-
it "has a working function #array_uint64_in" do
|
1550
|
-
skip_below "1.51.1"
|
1551
|
-
GIMarshallingTests.array_uint64_in [-1, 0, 1, 2]
|
1552
|
-
end
|
1553
|
-
|
1554
|
-
it "has a working function #array_uint8_in" do
|
1555
|
-
arr = "abcd".bytes.to_a
|
1556
|
-
GIMarshallingTests.array_uint8_in arr
|
1557
|
-
pass
|
1558
|
-
end
|
1559
|
-
|
1560
|
-
it "has a working function #array_unichar_in" do
|
1561
|
-
skip_below "1.51.1"
|
1562
|
-
arr = [0x63, 0x6f, 0x6e, 0x73, 0x74,
|
1563
|
-
0x20, 0x2665, 0x20, 0x75, 0x74,
|
1564
|
-
0x66, 0x38]
|
1565
|
-
GIMarshallingTests.array_unichar_in arr
|
1566
|
-
end
|
1567
|
-
|
1568
|
-
it "has a working function #array_unichar_out" do
|
1569
|
-
skip_below "1.51.1"
|
1570
|
-
result = GIMarshallingTests.array_unichar_out
|
1571
|
-
_(result.to_a).must_equal [0x63, 0x6f, 0x6e, 0x73, 0x74,
|
1572
|
-
0x20, 0x2665, 0x20, 0x75, 0x74,
|
1573
|
-
0x66, 0x38]
|
1574
|
-
end
|
1575
|
-
|
1576
|
-
it "has a working function #array_zero_terminated_in" do
|
1577
|
-
GIMarshallingTests.array_zero_terminated_in %w(0 1 2)
|
1578
|
-
pass
|
1579
|
-
end
|
1580
|
-
|
1581
|
-
it "has a working function #array_zero_terminated_inout" do
|
1582
|
-
res = GIMarshallingTests.array_zero_terminated_inout %w(0 1 2)
|
1583
|
-
_(res).must_be :==, ["-1", "0", "1", "2"]
|
1584
|
-
end
|
1585
|
-
|
1586
|
-
it "has a working function #array_zero_terminated_out" do
|
1587
|
-
res = GIMarshallingTests.array_zero_terminated_out
|
1588
|
-
_(res).must_be :==, %w(0 1 2)
|
1589
|
-
end
|
1590
|
-
|
1591
|
-
it "has a working function #array_zero_terminated_return" do
|
1592
|
-
res = GIMarshallingTests.array_zero_terminated_return
|
1593
|
-
_(res).must_be :==, %w(0 1 2)
|
1594
|
-
end
|
1595
|
-
|
1596
|
-
it "has a working function #array_zero_terminated_return_null" do
|
1597
|
-
res = GIMarshallingTests.array_zero_terminated_return_null
|
1598
|
-
_(res).must_be :==, []
|
1599
|
-
end
|
1600
|
-
|
1601
|
-
it "has a working function #array_zero_terminated_return_struct" do
|
1602
|
-
res = GIMarshallingTests.array_zero_terminated_return_struct
|
1603
|
-
_(res.to_a.map(&:long_)).must_equal [42, 43, 44]
|
1604
|
-
end
|
1605
|
-
|
1606
|
-
it "has a working function #array_zero_terminated_return_unichar" do
|
1607
|
-
skip_below "1.51.1"
|
1608
|
-
res = GIMarshallingTests.array_zero_terminated_return_unichar
|
1609
|
-
_(res.to_a).must_equal [0x63, 0x6f, 0x6e, 0x73, 0x74,
|
1610
|
-
0x20, 0x2665, 0x20, 0x75, 0x74,
|
1611
|
-
0x66, 0x38]
|
1612
|
-
end
|
1613
|
-
|
1614
|
-
it "has a working function #boolean_in_false" do
|
1615
|
-
GIMarshallingTests.boolean_in_false false
|
1616
|
-
pass
|
1617
|
-
end
|
1618
|
-
|
1619
|
-
it "has a working function #boolean_in_true" do
|
1620
|
-
GIMarshallingTests.boolean_in_true true
|
1621
|
-
pass
|
1622
|
-
end
|
1623
|
-
|
1624
|
-
it "has a working function #boolean_inout_false_true" do
|
1625
|
-
res = GIMarshallingTests.boolean_inout_false_true false
|
1626
|
-
_(res).must_equal true
|
1627
|
-
end
|
1628
|
-
|
1629
|
-
it "has a working function #boolean_inout_true_false" do
|
1630
|
-
res = GIMarshallingTests.boolean_inout_true_false true
|
1631
|
-
_(res).must_equal false
|
1632
|
-
end
|
1633
|
-
|
1634
|
-
it "has a working function #boolean_out_false" do
|
1635
|
-
res = GIMarshallingTests.boolean_out_false
|
1636
|
-
_(res).must_equal false
|
1637
|
-
end
|
1638
|
-
|
1639
|
-
it "has a working function #boolean_out_true" do
|
1640
|
-
res = GIMarshallingTests.boolean_out_true
|
1641
|
-
_(res).must_equal true
|
1642
|
-
end
|
1643
|
-
|
1644
|
-
it "has a working function #boolean_return_false" do
|
1645
|
-
res = GIMarshallingTests.boolean_return_false
|
1646
|
-
_(res).must_equal false
|
1647
|
-
end
|
1648
|
-
|
1649
|
-
it "has a working function #boolean_return_true" do
|
1650
|
-
res = GIMarshallingTests.boolean_return_true
|
1651
|
-
_(res).must_equal true
|
1652
|
-
end
|
1653
|
-
|
1654
|
-
it "has a working function #boxed_struct_inout" do
|
1655
|
-
bx = GIMarshallingTests::BoxedStruct.new
|
1656
|
-
bx.long_ = 42
|
1657
|
-
res = GIMarshallingTests.boxed_struct_inout bx
|
1658
|
-
_(res.long_).must_equal 0
|
1659
|
-
end
|
1660
|
-
|
1661
|
-
it "has a working function #boxed_struct_out" do
|
1662
|
-
res = GIMarshallingTests.boxed_struct_out
|
1663
|
-
_(res.long_).must_equal 42
|
1664
|
-
end
|
1665
|
-
|
1666
|
-
it "has a working function #boxed_struct_returnv" do
|
1667
|
-
res = GIMarshallingTests.boxed_struct_returnv
|
1668
|
-
_(res.long_).must_equal 42
|
1669
|
-
_(res.g_strv).must_be :==, %w(0 1 2)
|
1670
|
-
end
|
1671
|
-
|
1672
|
-
it "has a working function #bytearray_full_return" do
|
1673
|
-
ret = GIMarshallingTests.bytearray_full_return
|
1674
|
-
assert_instance_of GLib::ByteArray, ret
|
1675
|
-
assert_includes(
|
1676
|
-
["0123".bytes.to_a, "\x001\xFF3".bytes.to_a],
|
1677
|
-
ret.to_string.bytes.to_a)
|
1678
|
-
end
|
1679
|
-
|
1680
|
-
it "has a working function #bytearray_none_in" do
|
1681
|
-
val = GIMarshallingTests.bytearray_full_return.to_string
|
1682
|
-
ba = GLib::ByteArray.new
|
1683
|
-
ba = ba.append val
|
1684
|
-
GIMarshallingTests.bytearray_none_in ba
|
1685
|
-
pass
|
1686
|
-
end
|
1687
|
-
|
1688
|
-
it "has a working function #callback_multiple_out_parameters" do
|
1689
|
-
result = GIMarshallingTests.callback_multiple_out_parameters do |*_args|
|
1690
|
-
[12.0, 13.0]
|
1691
|
-
end
|
1692
|
-
_(result).must_equal [12.0, 13.0]
|
1693
|
-
end
|
1694
|
-
|
1695
|
-
it "has a working function #callback_one_out_parameter" do
|
1696
|
-
result = GIMarshallingTests.callback_one_out_parameter { 42.0 }
|
1697
|
-
_(result).must_equal 42.0
|
1698
|
-
end
|
1699
|
-
|
1700
|
-
it "has a working function #callback_owned_boxed" do
|
1701
|
-
a = nil
|
1702
|
-
|
1703
|
-
callback = proc { |box, _callback_data| a = box.long_ * 2 }
|
1704
|
-
|
1705
|
-
result = GIMarshallingTests.callback_owned_boxed(&callback)
|
1706
|
-
_(result).must_equal 1
|
1707
|
-
_(a).must_equal 2
|
1708
|
-
|
1709
|
-
result = GIMarshallingTests.callback_owned_boxed(&callback)
|
1710
|
-
_(result).must_equal 2
|
1711
|
-
_(a).must_equal 4
|
1712
|
-
end
|
1713
|
-
|
1714
|
-
it "has a working function #callback_return_value_and_multiple_out_parameters" do
|
1715
|
-
result =
|
1716
|
-
GIMarshallingTests.callback_return_value_and_multiple_out_parameters do |*_args|
|
1717
|
-
[42, -142, 3]
|
1718
|
-
end
|
1719
|
-
_(result).must_equal [42, -142, 3]
|
1720
|
-
end
|
1721
|
-
|
1722
|
-
it "has a working function #callback_return_value_and_one_out_parameter" do
|
1723
|
-
result = GIMarshallingTests.callback_return_value_and_one_out_parameter do |*_args|
|
1724
|
-
[42, -142]
|
1725
|
-
end
|
1726
|
-
_(result).must_equal [42, -142]
|
1727
|
-
end
|
1728
|
-
|
1729
|
-
it "has a working function #callback_return_value_only" do
|
1730
|
-
result = GIMarshallingTests.callback_return_value_only { 42 }
|
1731
|
-
_(result).must_equal 42
|
1732
|
-
end
|
1733
|
-
|
1734
|
-
it "has a working function #double_in" do
|
1735
|
-
GIMarshallingTests.double_in Float::MAX
|
1736
|
-
pass
|
1737
|
-
end
|
1738
|
-
|
1739
|
-
it "has a working function #double_inout" do
|
1740
|
-
ret = GIMarshallingTests.double_inout Float::MAX
|
1741
|
-
assert_in_epsilon 2.225e-308, ret
|
1742
|
-
end
|
1743
|
-
|
1744
|
-
it "has a working function #double_out" do
|
1745
|
-
ret = GIMarshallingTests.double_out
|
1746
|
-
_(ret).must_equal Float::MAX
|
1747
|
-
end
|
1748
|
-
|
1749
|
-
it "has a working function #double_return" do
|
1750
|
-
ret = GIMarshallingTests.double_return
|
1751
|
-
_(ret).must_equal Float::MAX
|
1752
|
-
end
|
1753
|
-
|
1754
|
-
it "has a working function #enum_in" do
|
1755
|
-
GIMarshallingTests.enum_in :value3
|
1756
|
-
pass
|
1757
|
-
end
|
1758
|
-
|
1759
|
-
it "has a working function #enum_inout" do
|
1760
|
-
e = GIMarshallingTests.enum_inout :value3
|
1761
|
-
_(e).must_equal :value1
|
1762
|
-
end
|
1763
|
-
|
1764
|
-
it "has a working function #enum_out" do
|
1765
|
-
e = GIMarshallingTests.enum_out
|
1766
|
-
_(e).must_equal :value3
|
1767
|
-
end
|
1768
|
-
|
1769
|
-
it "has a working function #enum_returnv" do
|
1770
|
-
e = GIMarshallingTests.enum_returnv
|
1771
|
-
_(e).must_equal :value3
|
1772
|
-
end
|
1773
|
-
|
1774
|
-
it "has a working function #filename_list_return" do
|
1775
|
-
fl = GIMarshallingTests.filename_list_return
|
1776
|
-
_(fl).must_be_nil
|
1777
|
-
end
|
1778
|
-
|
1779
|
-
it "has a working function #flags_in" do
|
1780
|
-
GIMarshallingTests.flags_in value2: true
|
1781
|
-
pass
|
1782
|
-
end
|
1783
|
-
|
1784
|
-
it "has a working function #flags_in_zero" do
|
1785
|
-
GIMarshallingTests.flags_in_zero 0
|
1786
|
-
pass
|
1787
|
-
end
|
1788
|
-
|
1789
|
-
it "has a working function #flags_inout" do
|
1790
|
-
res = GIMarshallingTests.flags_inout value2: true
|
1791
|
-
_(res).must_equal(value1: true)
|
1792
|
-
end
|
1793
|
-
|
1794
|
-
it "has a working function #flags_out" do
|
1795
|
-
res = GIMarshallingTests.flags_out
|
1796
|
-
_(res).must_equal(value2: true)
|
1797
|
-
end
|
1798
|
-
|
1799
|
-
it "has a working function #flags_returnv" do
|
1800
|
-
res = GIMarshallingTests.flags_returnv
|
1801
|
-
_(res).must_equal(value2: true)
|
1802
|
-
end
|
1803
|
-
|
1804
|
-
it "has a working function #float_in" do
|
1805
|
-
# float_return returns MAX_FLT
|
1806
|
-
flt = GIMarshallingTests.float_return
|
1807
|
-
GIMarshallingTests.float_in flt
|
1808
|
-
pass
|
1809
|
-
end
|
1810
|
-
|
1811
|
-
it "has a working function #float_inout" do
|
1812
|
-
# float_return returns MAX_FLT
|
1813
|
-
flt = GIMarshallingTests.float_return
|
1814
|
-
res = GIMarshallingTests.float_inout flt
|
1815
|
-
assert_in_epsilon 1.175e-38, res
|
1816
|
-
end
|
1817
|
-
|
1818
|
-
it "has a working function #float_out" do
|
1819
|
-
flt = GIMarshallingTests.float_out
|
1820
|
-
assert_in_epsilon 3.402e+38, flt
|
1821
|
-
end
|
1822
|
-
|
1823
|
-
it "has a working function #float_return" do
|
1824
|
-
flt = GIMarshallingTests.float_return
|
1825
|
-
assert_in_epsilon 3.402e+38, flt
|
1826
|
-
end
|
1827
|
-
|
1828
|
-
it "has a working function #garray_bool_none_in" do
|
1829
|
-
skip_below "1.51.1"
|
1830
|
-
GIMarshallingTests.garray_bool_none_in [true, false, true, true]
|
1831
|
-
end
|
1832
|
-
|
1833
|
-
it "has a working function #garray_boxed_struct_full_return" do
|
1834
|
-
skip_below "1.61.1"
|
1835
|
-
result = GIMarshallingTests.garray_boxed_struct_full_return
|
1836
|
-
_(result.map(&:long_)).must_equal [42, 43, 44]
|
1837
|
-
end
|
1838
|
-
|
1839
|
-
it "has a working function #garray_int_none_in" do
|
1840
|
-
arr = [-1, 0, 1, 2]
|
1841
|
-
GIMarshallingTests.garray_int_none_in arr
|
1842
|
-
pass
|
1843
|
-
end
|
1844
|
-
|
1845
|
-
it "has a working function #garray_int_none_return" do
|
1846
|
-
arr = GIMarshallingTests.garray_int_none_return
|
1847
|
-
_(arr).must_be :==, [-1, 0, 1, 2]
|
1848
|
-
end
|
1849
|
-
|
1850
|
-
it "has a working function #garray_uint64_none_in" do
|
1851
|
-
GIMarshallingTests.garray_uint64_none_in [0, 0xffff_ffff_ffff_ffff]
|
1852
|
-
pass
|
1853
|
-
end
|
1854
|
-
|
1855
|
-
it "has a working function #garray_uint64_none_return" do
|
1856
|
-
res = GIMarshallingTests.garray_uint64_none_return
|
1857
|
-
_(res).must_be :==, [0, 0xffff_ffff_ffff_ffff]
|
1858
|
-
end
|
1859
|
-
|
1860
|
-
it "has a working function #garray_unichar_none_in" do
|
1861
|
-
skip_below "1.51.1"
|
1862
|
-
arr = [0x63, 0x6f, 0x6e, 0x73, 0x74,
|
1863
|
-
0x20, 0x2665, 0x20, 0x75, 0x74,
|
1864
|
-
0x66, 0x38]
|
1865
|
-
GIMarshallingTests.garray_unichar_none_in arr
|
1866
|
-
end
|
1867
|
-
|
1868
|
-
it "has a working function #garray_utf8_container_inout" do
|
1869
|
-
res = GIMarshallingTests.garray_utf8_container_inout %w(0 1 2)
|
1870
|
-
_(res).must_be :==, ["-2", "-1", "0", "1"]
|
1871
|
-
end
|
1872
|
-
|
1873
|
-
it "has a working function #garray_utf8_container_out" do
|
1874
|
-
res = GIMarshallingTests.garray_utf8_container_out
|
1875
|
-
_(res).must_be :==, %w(0 1 2)
|
1876
|
-
end
|
1877
|
-
|
1878
|
-
it "has a working function #garray_utf8_container_return" do
|
1879
|
-
res = GIMarshallingTests.garray_utf8_container_return
|
1880
|
-
_(res).must_be :==, %w(0 1 2)
|
1881
|
-
end
|
1882
|
-
|
1883
|
-
it "has a working function #garray_utf8_full_inout" do
|
1884
|
-
arr = %w(0 1 2)
|
1885
|
-
res = GIMarshallingTests.garray_utf8_full_inout arr
|
1886
|
-
_(res).must_be :==, ["-2", "-1", "0", "1"]
|
1887
|
-
end
|
1888
|
-
|
1889
|
-
it "has a working function #garray_utf8_full_out" do
|
1890
|
-
res = GIMarshallingTests.garray_utf8_full_out
|
1891
|
-
_(res).must_be :==, %w(0 1 2)
|
1892
|
-
end
|
1893
|
-
|
1894
|
-
it "has a working function #garray_utf8_full_out_caller_allocated" do
|
1895
|
-
res = GIMarshallingTests.garray_utf8_full_out_caller_allocated
|
1896
|
-
_(res).must_be :==, %w(0 1 2)
|
1897
|
-
end
|
1898
|
-
|
1899
|
-
it "has a working function #garray_utf8_full_return" do
|
1900
|
-
res = GIMarshallingTests.garray_utf8_full_return
|
1901
|
-
_(res).must_be :==, %w(0 1 2)
|
1902
|
-
end
|
1903
|
-
|
1904
|
-
it "has a working function #garray_utf8_none_in" do
|
1905
|
-
arr = %w(0 1 2)
|
1906
|
-
GIMarshallingTests.garray_utf8_none_in arr
|
1907
|
-
pass
|
1908
|
-
end
|
1909
|
-
|
1910
|
-
it "has a working function #garray_utf8_none_inout" do
|
1911
|
-
arr = %w(0 1 2)
|
1912
|
-
res = GIMarshallingTests.garray_utf8_none_inout arr
|
1913
|
-
_(res).must_be :==, ["-2", "-1", "0", "1"]
|
1914
|
-
end
|
1915
|
-
|
1916
|
-
it "has a working function #garray_utf8_none_out" do
|
1917
|
-
res = GIMarshallingTests.garray_utf8_none_out
|
1918
|
-
_(res).must_be :==, %w(0 1 2)
|
1919
|
-
end
|
1920
|
-
|
1921
|
-
it "has a working function #garray_utf8_none_return" do
|
1922
|
-
res = GIMarshallingTests.garray_utf8_none_return
|
1923
|
-
_(res).must_be :==, %w(0 1 2)
|
1924
|
-
end
|
1925
|
-
|
1926
|
-
it "has a working function #gbytes_full_return" do
|
1927
|
-
res = GIMarshallingTests.gbytes_full_return
|
1928
|
-
_(res.to_a).must_equal [0, 49, 0xFF, 51]
|
1929
|
-
end
|
1930
|
-
|
1931
|
-
it "has a working function #gbytes_none_in" do
|
1932
|
-
GIMarshallingTests.gbytes_none_in [0, 49, 0xFF, 51]
|
1933
|
-
pass
|
1934
|
-
end
|
1935
|
-
|
1936
|
-
it "has a working function #gclosure_in" do
|
1937
|
-
cl = GObject::RubyClosure.new { 42 }
|
1938
|
-
GIMarshallingTests.gclosure_in cl
|
1939
|
-
pass
|
1940
|
-
end
|
1941
|
-
|
1942
|
-
it "has a working function #gclosure_return" do
|
1943
|
-
cl = GIMarshallingTests.gclosure_return
|
1944
|
-
gv = GObject::Value.wrap_ruby_value 0
|
1945
|
-
result = cl.invoke gv, []
|
1946
|
-
_(gv.get_value).must_equal 42
|
1947
|
-
_(result).must_equal 42
|
1948
|
-
end
|
1949
|
-
|
1950
|
-
it "has a working function #genum_in" do
|
1951
|
-
GIMarshallingTests.genum_in :value3
|
1952
|
-
pass
|
1953
|
-
end
|
1954
|
-
|
1955
|
-
it "has a working function #genum_inout" do
|
1956
|
-
res = GIMarshallingTests.genum_inout :value3
|
1957
|
-
_(res).must_equal :value1
|
1958
|
-
end
|
1959
|
-
|
1960
|
-
it "has a working function #genum_out" do
|
1961
|
-
res = GIMarshallingTests.genum_out
|
1962
|
-
_(res).must_equal :value3
|
1963
|
-
end
|
1964
|
-
|
1965
|
-
it "has a working function #genum_returnv" do
|
1966
|
-
res = GIMarshallingTests.genum_returnv
|
1967
|
-
_(res).must_equal :value3
|
1968
|
-
end
|
1969
|
-
|
1970
|
-
it "has a working function #gerror" do
|
1971
|
-
GIMarshallingTests.gerror
|
1972
|
-
flunk "Error should have been raised"
|
1973
|
-
rescue GirFFI::GLibError => e
|
1974
|
-
_(e.message).must_equal GIMarshallingTests::CONSTANT_GERROR_MESSAGE
|
1975
|
-
_(e.domain).must_equal GIMarshallingTests::CONSTANT_GERROR_DOMAIN
|
1976
|
-
_(e.code).must_equal GIMarshallingTests::CONSTANT_GERROR_CODE
|
1977
|
-
end
|
1978
|
-
|
1979
|
-
it "has a working function #gerror_array_in" do
|
1980
|
-
GIMarshallingTests.gerror_array_in [1, 2, 3]
|
1981
|
-
flunk "Error should have been raised"
|
1982
|
-
rescue GirFFI::GLibError => e
|
1983
|
-
_(e.message).must_equal GIMarshallingTests::CONSTANT_GERROR_MESSAGE
|
1984
|
-
_(e.domain).must_equal GIMarshallingTests::CONSTANT_GERROR_DOMAIN
|
1985
|
-
_(e.code).must_equal GIMarshallingTests::CONSTANT_GERROR_CODE
|
1986
|
-
end
|
1987
|
-
|
1988
|
-
it "has a working function #gerror_out" do
|
1989
|
-
error, debug = GIMarshallingTests.gerror_out
|
1990
|
-
_(debug).must_equal GIMarshallingTests::CONSTANT_GERROR_DEBUG_MESSAGE
|
1991
|
-
_(error.message).must_equal GIMarshallingTests::CONSTANT_GERROR_MESSAGE
|
1992
|
-
end
|
1993
|
-
|
1994
|
-
it "has a working function #gerror_out_transfer_none" do
|
1995
|
-
error, debug = GIMarshallingTests.gerror_out_transfer_none
|
1996
|
-
_(debug).must_equal GIMarshallingTests::CONSTANT_GERROR_DEBUG_MESSAGE
|
1997
|
-
_(error.message).must_equal GIMarshallingTests::CONSTANT_GERROR_MESSAGE
|
1998
|
-
end
|
1999
|
-
|
2000
|
-
it "has a working function #gerror_return" do
|
2001
|
-
error = GIMarshallingTests.gerror_return
|
2002
|
-
_(error.message).must_equal GIMarshallingTests::CONSTANT_GERROR_MESSAGE
|
2003
|
-
end
|
2004
|
-
|
2005
|
-
it "has a working function #ghashtable_double_in" do
|
2006
|
-
skip_below "1.51.2"
|
2007
|
-
GIMarshallingTests.ghashtable_double_in(
|
2008
|
-
"-1" => -0.1, "0" => 0.0, "1" => 0.1, "2" => 0.2)
|
2009
|
-
end
|
2010
|
-
|
2011
|
-
it "has a working function #ghashtable_float_in" do
|
2012
|
-
skip_below "1.51.2"
|
2013
|
-
GIMarshallingTests.ghashtable_float_in(
|
2014
|
-
"-1" => -0.1, "0" => 0.0, "1" => 0.1, "2" => 0.2)
|
2015
|
-
end
|
2016
|
-
|
2017
|
-
it "has a working function #ghashtable_int64_in" do
|
2018
|
-
skip_below "1.51.2"
|
2019
|
-
GIMarshallingTests.ghashtable_int64_in(
|
2020
|
-
"-1" => -1, "0" => 0, "1" => 1, "2" => 0x100000000)
|
2021
|
-
end
|
2022
|
-
|
2023
|
-
it "has a working function #ghashtable_int_none_in" do
|
2024
|
-
GIMarshallingTests.ghashtable_int_none_in(
|
2025
|
-
-1 => 1, 0 => 0, 1 => -1, 2 => -2)
|
2026
|
-
end
|
2027
|
-
|
2028
|
-
it "has a working function #ghashtable_int_none_return" do
|
2029
|
-
gh = GIMarshallingTests.ghashtable_int_none_return
|
2030
|
-
assert_equal({ -1 => 1, 0 => 0, 1 => -1, 2 => -2 }, gh.to_hash)
|
2031
|
-
end
|
2032
|
-
|
2033
|
-
it "has a working function #ghashtable_uint64_in" do
|
2034
|
-
skip_below "1.51.2"
|
2035
|
-
GIMarshallingTests.ghashtable_uint64_in(
|
2036
|
-
"-1" => 0x100000000, "0" => 0, "1" => 1, "2" => 2)
|
2037
|
-
end
|
2038
|
-
|
2039
|
-
it "has a working function #ghashtable_utf8_container_in" do
|
2040
|
-
skip "This function is defined in the header but not implemented"
|
2041
|
-
end
|
2042
|
-
|
2043
|
-
it "has a working function #ghashtable_utf8_container_inout" do
|
2044
|
-
hsh = { "-1" => "1", "0" => "0", "1" => "-1", "2" => "-2" }
|
2045
|
-
res = GIMarshallingTests.ghashtable_utf8_container_inout hsh
|
2046
|
-
assert_equal({ "-1" => "1", "0" => "0", "1" => "1" }, res.to_hash)
|
2047
|
-
end
|
2048
|
-
|
2049
|
-
it "has a working function #ghashtable_utf8_container_out" do
|
2050
|
-
res = GIMarshallingTests.ghashtable_utf8_container_out
|
2051
|
-
assert_equal({ "-1" => "1", "0" => "0", "1" => "-1", "2" => "-2" },
|
2052
|
-
res.to_hash)
|
2053
|
-
end
|
2054
|
-
|
2055
|
-
it "has a working function #ghashtable_utf8_container_return" do
|
2056
|
-
res = GIMarshallingTests.ghashtable_utf8_container_return
|
2057
|
-
assert_equal({ "-1" => "1", "0" => "0", "1" => "-1", "2" => "-2" },
|
2058
|
-
res.to_hash)
|
2059
|
-
end
|
2060
|
-
|
2061
|
-
it "has a working function #ghashtable_utf8_full_in" do
|
2062
|
-
skip "This function is defined in the header but not implemented"
|
2063
|
-
end
|
2064
|
-
|
2065
|
-
it "has a working function #ghashtable_utf8_full_inout" do
|
2066
|
-
hsh = { "-1" => "1", "0" => "0", "1" => "-1", "2" => "-2" }
|
2067
|
-
res = GIMarshallingTests.ghashtable_utf8_full_inout hsh
|
2068
|
-
assert_equal({ "-1" => "1", "0" => "0", "1" => "1" }, res.to_hash)
|
2069
|
-
end
|
2070
|
-
|
2071
|
-
it "has a working function #ghashtable_utf8_full_out" do
|
2072
|
-
res = GIMarshallingTests.ghashtable_utf8_full_out
|
2073
|
-
assert_equal({ "-1" => "1", "0" => "0", "1" => "-1", "2" => "-2" },
|
2074
|
-
res.to_hash)
|
2075
|
-
end
|
2076
|
-
|
2077
|
-
it "has a working function #ghashtable_utf8_full_return" do
|
2078
|
-
res = GIMarshallingTests.ghashtable_utf8_full_return
|
2079
|
-
assert_equal({ "-1" => "1", "0" => "0", "1" => "-1", "2" => "-2" },
|
2080
|
-
res.to_hash)
|
2081
|
-
end
|
2082
|
-
|
2083
|
-
it "has a working function #ghashtable_utf8_none_in" do
|
2084
|
-
hsh = { "-1" => "1", "0" => "0", "1" => "-1", "2" => "-2" }
|
2085
|
-
GIMarshallingTests.ghashtable_utf8_none_in hsh
|
2086
|
-
pass
|
2087
|
-
end
|
2088
|
-
|
2089
|
-
it "has a working function #ghashtable_utf8_none_inout" do
|
2090
|
-
hsh = { "-1" => "1", "0" => "0", "1" => "-1", "2" => "-2" }
|
2091
|
-
res = GIMarshallingTests.ghashtable_utf8_none_inout hsh
|
2092
|
-
assert_equal({ "-1" => "1", "0" => "0", "1" => "1" }, res.to_hash)
|
2093
|
-
end
|
2094
|
-
|
2095
|
-
it "has a working function #ghashtable_utf8_none_out" do
|
2096
|
-
res = GIMarshallingTests.ghashtable_utf8_none_out
|
2097
|
-
assert_equal({ "-1" => "1", "0" => "0", "1" => "-1", "2" => "-2" },
|
2098
|
-
res.to_hash)
|
2099
|
-
end
|
2100
|
-
|
2101
|
-
it "has a working function #ghashtable_utf8_none_return" do
|
2102
|
-
res = GIMarshallingTests.ghashtable_utf8_none_return
|
2103
|
-
assert_equal({ "-1" => "1", "0" => "0", "1" => "-1", "2" => "-2" },
|
2104
|
-
res.to_hash)
|
2105
|
-
end
|
2106
|
-
|
2107
|
-
it "has a working function #glist_int_none_in" do
|
2108
|
-
GIMarshallingTests.glist_int_none_in [-1, 0, 1, 2]
|
2109
|
-
pass
|
2110
|
-
end
|
2111
|
-
|
2112
|
-
it "has a working function #glist_int_none_return" do
|
2113
|
-
res = GIMarshallingTests.glist_int_none_return
|
2114
|
-
_(res).must_be :==, [-1, 0, 1, 2]
|
2115
|
-
end
|
2116
|
-
|
2117
|
-
it "has a working function #glist_uint32_none_in" do
|
2118
|
-
GIMarshallingTests.glist_uint32_none_in [0, 0xffff_ffff]
|
2119
|
-
pass
|
2120
|
-
end
|
2121
|
-
|
2122
|
-
it "has a working function #glist_uint32_none_return" do
|
2123
|
-
res = GIMarshallingTests.glist_uint32_none_return
|
2124
|
-
_(res).must_be :==, [0, 0xffff_ffff]
|
2125
|
-
end
|
2126
|
-
|
2127
|
-
it "has a working function #glist_utf8_container_inout" do
|
2128
|
-
res = GIMarshallingTests.glist_utf8_container_inout %w(0 1 2)
|
2129
|
-
_(res).must_be :==, ["-2", "-1", "0", "1"]
|
2130
|
-
end
|
2131
|
-
|
2132
|
-
it "has a working function #glist_utf8_container_out" do
|
2133
|
-
res = GIMarshallingTests.glist_utf8_container_out
|
2134
|
-
_(res).must_be :==, %w(0 1 2)
|
2135
|
-
end
|
2136
|
-
|
2137
|
-
it "has a working function #glist_utf8_container_return" do
|
2138
|
-
res = GIMarshallingTests.glist_utf8_container_return
|
2139
|
-
_(res).must_be :==, %w(0 1 2)
|
2140
|
-
end
|
2141
|
-
|
2142
|
-
it "has a working function #glist_utf8_full_inout" do
|
2143
|
-
res = GIMarshallingTests.glist_utf8_full_inout %w(0 1 2)
|
2144
|
-
_(res).must_be :==, ["-2", "-1", "0", "1"]
|
2145
|
-
end
|
2146
|
-
|
2147
|
-
it "has a working function #glist_utf8_full_out" do
|
2148
|
-
res = GIMarshallingTests.glist_utf8_full_out
|
2149
|
-
_(res).must_be :==, %w(0 1 2)
|
2150
|
-
end
|
2151
|
-
|
2152
|
-
it "has a working function #glist_utf8_full_return" do
|
2153
|
-
res = GIMarshallingTests.glist_utf8_full_return
|
2154
|
-
_(res).must_be :==, %w(0 1 2)
|
2155
|
-
end
|
2156
|
-
|
2157
|
-
it "has a working function #glist_utf8_none_in" do
|
2158
|
-
GIMarshallingTests.glist_utf8_none_in %w(0 1 2)
|
2159
|
-
end
|
2160
|
-
|
2161
|
-
it "has a working function #glist_utf8_none_inout" do
|
2162
|
-
res = GIMarshallingTests.glist_utf8_none_inout %w(0 1 2)
|
2163
|
-
_(res).must_be :==, ["-2", "-1", "0", "1"]
|
2164
|
-
end
|
2165
|
-
|
2166
|
-
it "has a working function #glist_utf8_none_out" do
|
2167
|
-
res = GIMarshallingTests.glist_utf8_none_out
|
2168
|
-
_(res).must_be :==, %w(0 1 2)
|
2169
|
-
end
|
2170
|
-
|
2171
|
-
it "has a working function #glist_utf8_none_return" do
|
2172
|
-
res = GIMarshallingTests.glist_utf8_none_return
|
2173
|
-
_(res).must_be :==, %w(0 1 2)
|
2174
|
-
end
|
2175
|
-
|
2176
|
-
it "has a working function #gptrarray_boxed_struct_full_return" do
|
2177
|
-
skip_below "1.61.1"
|
2178
|
-
result = GIMarshallingTests.gptrarray_boxed_struct_full_return
|
2179
|
-
_(result.map(&:long_)).must_equal [42, 43, 44]
|
2180
|
-
end
|
2181
|
-
|
2182
|
-
it "has a working function #gptrarray_utf8_container_inout" do
|
2183
|
-
res = GIMarshallingTests.gptrarray_utf8_container_inout %w(0 1 2)
|
2184
|
-
_(res).must_be :==, ["-2", "-1", "0", "1"]
|
2185
|
-
end
|
2186
|
-
|
2187
|
-
it "has a working function #gptrarray_utf8_container_out" do
|
2188
|
-
res = GIMarshallingTests.gptrarray_utf8_container_out
|
2189
|
-
_(res).must_be :==, %w(0 1 2)
|
2190
|
-
end
|
2191
|
-
|
2192
|
-
it "has a working function #gptrarray_utf8_container_return" do
|
2193
|
-
res = GIMarshallingTests.gptrarray_utf8_container_return
|
2194
|
-
_(res).must_be :==, %w(0 1 2)
|
2195
|
-
end
|
2196
|
-
|
2197
|
-
it "has a working function #gptrarray_utf8_full_inout" do
|
2198
|
-
res = GIMarshallingTests.gptrarray_utf8_full_inout %w(0 1 2)
|
2199
|
-
_(res).must_be :==, ["-2", "-1", "0", "1"]
|
2200
|
-
end
|
2201
|
-
|
2202
|
-
it "has a working function #gptrarray_utf8_full_out" do
|
2203
|
-
res = GIMarshallingTests.gptrarray_utf8_full_out
|
2204
|
-
_(res).must_be :==, %w(0 1 2)
|
2205
|
-
end
|
2206
|
-
|
2207
|
-
it "has a working function #gptrarray_utf8_full_return" do
|
2208
|
-
res = GIMarshallingTests.gptrarray_utf8_full_return
|
2209
|
-
_(res).must_be :==, %w(0 1 2)
|
2210
|
-
end
|
2211
|
-
|
2212
|
-
it "has a working function #gptrarray_utf8_none_in" do
|
2213
|
-
GIMarshallingTests.gptrarray_utf8_none_in %w(0 1 2)
|
2214
|
-
end
|
2215
|
-
|
2216
|
-
it "has a working function #gptrarray_utf8_none_inout" do
|
2217
|
-
res = GIMarshallingTests.gptrarray_utf8_none_inout %w(0 1 2)
|
2218
|
-
_(res).must_be :==, ["-2", "-1", "0", "1"]
|
2219
|
-
end
|
2220
|
-
|
2221
|
-
it "has a working function #gptrarray_utf8_none_out" do
|
2222
|
-
res = GIMarshallingTests.gptrarray_utf8_none_out
|
2223
|
-
_(res).must_be :==, %w(0 1 2)
|
2224
|
-
end
|
2225
|
-
|
2226
|
-
it "has a working function #gptrarray_utf8_none_return" do
|
2227
|
-
res = GIMarshallingTests.gptrarray_utf8_none_return
|
2228
|
-
_(res).must_be :==, %w(0 1 2)
|
2229
|
-
end
|
2230
|
-
|
2231
|
-
it "has a working function #gslist_int_none_in" do
|
2232
|
-
GIMarshallingTests.gslist_int_none_in [-1, 0, 1, 2]
|
2233
|
-
pass
|
2234
|
-
end
|
2235
|
-
|
2236
|
-
it "has a working function #gslist_int_none_return" do
|
2237
|
-
res = GIMarshallingTests.gslist_int_none_return
|
2238
|
-
_(res).must_be :==, [-1, 0, 1, 2]
|
2239
|
-
end
|
2240
|
-
|
2241
|
-
it "has a working function #gslist_utf8_container_inout" do
|
2242
|
-
res = GIMarshallingTests.gslist_utf8_container_inout %w(0 1 2)
|
2243
|
-
_(res).must_be :==, ["-2", "-1", "0", "1"]
|
2244
|
-
end
|
2245
|
-
|
2246
|
-
it "has a working function #gslist_utf8_container_out" do
|
2247
|
-
res = GIMarshallingTests.gslist_utf8_container_out
|
2248
|
-
_(res).must_be :==, %w(0 1 2)
|
2249
|
-
end
|
2250
|
-
|
2251
|
-
it "has a working function #gslist_utf8_container_return" do
|
2252
|
-
res = GIMarshallingTests.gslist_utf8_container_return
|
2253
|
-
_(res).must_be :==, %w(0 1 2)
|
2254
|
-
end
|
2255
|
-
|
2256
|
-
it "has a working function #gslist_utf8_full_inout" do
|
2257
|
-
res = GIMarshallingTests.gslist_utf8_full_inout %w(0 1 2)
|
2258
|
-
_(res).must_be :==, ["-2", "-1", "0", "1"]
|
2259
|
-
end
|
2260
|
-
|
2261
|
-
it "has a working function #gslist_utf8_full_out" do
|
2262
|
-
res = GIMarshallingTests.gslist_utf8_full_out
|
2263
|
-
_(res).must_be :==, %w(0 1 2)
|
2264
|
-
end
|
2265
|
-
|
2266
|
-
it "has a working function #gslist_utf8_full_return" do
|
2267
|
-
res = GIMarshallingTests.gslist_utf8_full_return
|
2268
|
-
_(res).must_be :==, %w(0 1 2)
|
2269
|
-
end
|
2270
|
-
|
2271
|
-
it "has a working function #gslist_utf8_none_in" do
|
2272
|
-
GIMarshallingTests.gslist_utf8_none_in %w(0 1 2)
|
2273
|
-
pass
|
2274
|
-
end
|
2275
|
-
|
2276
|
-
it "has a working function #gslist_utf8_none_inout" do
|
2277
|
-
res = GIMarshallingTests.gslist_utf8_none_inout %w(0 1 2)
|
2278
|
-
_(res).must_be :==, ["-2", "-1", "0", "1"]
|
2279
|
-
end
|
2280
|
-
|
2281
|
-
it "has a working function #gslist_utf8_none_out" do
|
2282
|
-
res = GIMarshallingTests.gslist_utf8_none_out
|
2283
|
-
_(res).must_be :==, %w(0 1 2)
|
2284
|
-
end
|
2285
|
-
|
2286
|
-
it "has a working function #gslist_utf8_none_return" do
|
2287
|
-
res = GIMarshallingTests.gslist_utf8_none_return
|
2288
|
-
_(res).must_be :==, %w(0 1 2)
|
2289
|
-
end
|
2290
|
-
|
2291
|
-
it "has a working function #gstrv_in" do
|
2292
|
-
GIMarshallingTests.gstrv_in %w(0 1 2)
|
2293
|
-
pass
|
2294
|
-
end
|
2295
|
-
|
2296
|
-
it "has a working function #gstrv_inout" do
|
2297
|
-
res = GIMarshallingTests.gstrv_inout %w(0 1 2)
|
2298
|
-
_(res).must_be :==, ["-1", "0", "1", "2"]
|
2299
|
-
end
|
2300
|
-
|
2301
|
-
it "has a working function #gstrv_out" do
|
2302
|
-
res = GIMarshallingTests.gstrv_out
|
2303
|
-
_(res).must_be :==, %w(0 1 2)
|
2304
|
-
end
|
2305
|
-
|
2306
|
-
it "has a working function #gstrv_return" do
|
2307
|
-
res = GIMarshallingTests.gstrv_return
|
2308
|
-
_(res).must_be :==, %w(0 1 2)
|
2309
|
-
end
|
2310
|
-
|
2311
|
-
it "has a working function #gtype_in" do
|
2312
|
-
GIMarshallingTests.gtype_in GObject::TYPE_NONE
|
2313
|
-
pass
|
2314
|
-
end
|
2315
|
-
|
2316
|
-
it "has a working function #gtype_inout" do
|
2317
|
-
res = GIMarshallingTests.gtype_inout GObject::TYPE_NONE
|
2318
|
-
_(res).must_equal GObject::TYPE_INT
|
2319
|
-
end
|
2320
|
-
|
2321
|
-
it "has a working function #gtype_out" do
|
2322
|
-
res = GIMarshallingTests.gtype_out
|
2323
|
-
_(res).must_equal GObject::TYPE_NONE
|
2324
|
-
end
|
2325
|
-
|
2326
|
-
it "has a working function #gtype_return" do
|
2327
|
-
res = GIMarshallingTests.gtype_return
|
2328
|
-
_(res).must_equal GObject::TYPE_NONE
|
2329
|
-
end
|
2330
|
-
|
2331
|
-
it "has a working function #gtype_string_in" do
|
2332
|
-
GIMarshallingTests.gtype_string_in GObject::TYPE_STRING
|
2333
|
-
pass
|
2334
|
-
end
|
2335
|
-
|
2336
|
-
it "has a working function #gtype_string_out" do
|
2337
|
-
res = GIMarshallingTests.gtype_string_out
|
2338
|
-
_(res).must_equal GObject::TYPE_STRING
|
2339
|
-
end
|
2340
|
-
|
2341
|
-
it "has a working function #gtype_string_return" do
|
2342
|
-
res = GIMarshallingTests.gtype_string_return
|
2343
|
-
_(res).must_equal GObject::TYPE_STRING
|
2344
|
-
end
|
2345
|
-
|
2346
|
-
it "has a working function #gvalue_flat_array" do
|
2347
|
-
GIMarshallingTests.gvalue_flat_array [42, "42", true]
|
2348
|
-
pass
|
2349
|
-
end
|
2350
|
-
|
2351
|
-
it "has a working function #gvalue_flat_array_round_trip" do
|
2352
|
-
result = GIMarshallingTests.gvalue_flat_array_round_trip 42, "42", true
|
2353
|
-
arr = result.to_a
|
2354
|
-
_(arr[0].get_value).must_equal 42
|
2355
|
-
_(arr[1].get_value).must_equal "42"
|
2356
|
-
_(arr[2].get_value).must_equal true
|
2357
|
-
end
|
2358
|
-
|
2359
|
-
it "has a working function #gvalue_in" do
|
2360
|
-
GIMarshallingTests.gvalue_in GObject::Value.wrap_ruby_value(42)
|
2361
|
-
GIMarshallingTests.gvalue_in 42
|
2362
|
-
pass
|
2363
|
-
end
|
2364
|
-
|
2365
|
-
it "has a working function #gvalue_in_enum" do
|
2366
|
-
gv = GObject::Value.new
|
2367
|
-
gv.init GIMarshallingTests::GEnum.gtype
|
2368
|
-
gv.set_enum GIMarshallingTests::GEnum[:value3]
|
2369
|
-
GIMarshallingTests.gvalue_in_enum gv
|
2370
|
-
pass
|
2371
|
-
end
|
2372
|
-
|
2373
|
-
it "has a working function #gvalue_in_with_modification" do
|
2374
|
-
gv = GObject::Value.wrap_ruby_value(42)
|
2375
|
-
GIMarshallingTests.gvalue_in_with_modification gv
|
2376
|
-
_(gv.get_value).must_equal 24
|
2377
|
-
end
|
2378
|
-
|
2379
|
-
it "has a working function #gvalue_in_with_type" do
|
2380
|
-
gv = GObject::Value.new
|
2381
|
-
gv.init GIMarshallingTests::SubSubObject.gtype
|
2382
|
-
GIMarshallingTests.gvalue_in_with_type gv, GIMarshallingTests::Object.gtype
|
2383
|
-
end
|
2384
|
-
|
2385
|
-
it "has a working function #gvalue_inout" do
|
2386
|
-
res = GIMarshallingTests.gvalue_inout GObject::Value.wrap_ruby_value(42)
|
2387
|
-
_(res).must_equal "42"
|
2388
|
-
|
2389
|
-
res = GIMarshallingTests.gvalue_inout 42
|
2390
|
-
_(res).must_equal "42"
|
2391
|
-
end
|
2392
|
-
|
2393
|
-
it "has a working function #gvalue_int64_in" do
|
2394
|
-
gv = GObject::Value.new
|
2395
|
-
gv.init GObject::TYPE_INT64
|
2396
|
-
gv.set_value 0x7fff_ffff_ffff_ffff
|
2397
|
-
GIMarshallingTests.gvalue_int64_in gv
|
2398
|
-
pass
|
2399
|
-
end
|
2400
|
-
|
2401
|
-
it "has a working function #gvalue_int64_out" do
|
2402
|
-
gv = GIMarshallingTests.gvalue_int64_out
|
2403
|
-
_(gv).must_equal 0x7fff_ffff_ffff_ffff
|
2404
|
-
end
|
2405
|
-
|
2406
|
-
it "has a working function #gvalue_out" do
|
2407
|
-
res = GIMarshallingTests.gvalue_out
|
2408
|
-
_(res).must_equal 42
|
2409
|
-
end
|
2410
|
-
|
2411
|
-
it "has a working function #gvalue_out_caller_allocates" do
|
2412
|
-
res = GIMarshallingTests.gvalue_out_caller_allocates
|
2413
|
-
_(res).must_equal 42
|
2414
|
-
end
|
2415
|
-
|
2416
|
-
it "has a working function #gvalue_return" do
|
2417
|
-
res = GIMarshallingTests.gvalue_return
|
2418
|
-
_(res).must_equal 42
|
2419
|
-
end
|
2420
|
-
|
2421
|
-
it "has a working function #init_function" do
|
2422
|
-
res, arr = GIMarshallingTests.init_function %w(foo bar baz)
|
2423
|
-
_(res).must_equal true
|
2424
|
-
_(arr).must_be :==, %w(foo bar)
|
2425
|
-
end
|
2426
|
-
|
2427
|
-
it "has a working function #int16_in_max" do
|
2428
|
-
GIMarshallingTests.int16_in_max 0x7fff
|
2429
|
-
pass
|
2430
|
-
end
|
2431
|
-
|
2432
|
-
it "has a working function #int16_in_min" do
|
2433
|
-
GIMarshallingTests.int16_in_min(-0x8000)
|
2434
|
-
pass
|
2435
|
-
end
|
2436
|
-
|
2437
|
-
it "has a working function #int16_inout_max_min" do
|
2438
|
-
res = GIMarshallingTests.int16_inout_max_min 0x7fff
|
2439
|
-
assert_equal res, -0x8000
|
2440
|
-
end
|
2441
|
-
|
2442
|
-
it "has a working function #int16_inout_min_max" do
|
2443
|
-
res = GIMarshallingTests.int16_inout_min_max(-0x8000)
|
2444
|
-
assert_equal 0x7fff, res
|
2445
|
-
end
|
2446
|
-
|
2447
|
-
it "has a working function #int16_out_max" do
|
2448
|
-
res = GIMarshallingTests.int16_out_max
|
2449
|
-
assert_equal 0x7fff, res
|
2450
|
-
end
|
2451
|
-
|
2452
|
-
it "has a working function #int16_out_min" do
|
2453
|
-
res = GIMarshallingTests.int16_out_min
|
2454
|
-
assert_equal(-0x8000, res)
|
2455
|
-
end
|
2456
|
-
|
2457
|
-
it "has a working function #int16_return_max" do
|
2458
|
-
res = GIMarshallingTests.int16_return_max
|
2459
|
-
assert_equal 0x7fff, res
|
2460
|
-
end
|
2461
|
-
|
2462
|
-
it "has a working function #int16_return_min" do
|
2463
|
-
res = GIMarshallingTests.int16_return_min
|
2464
|
-
assert_equal(-0x8000, res)
|
2465
|
-
end
|
2466
|
-
|
2467
|
-
it "has a working function #int32_in_max" do
|
2468
|
-
GIMarshallingTests.int32_in_max 0x7fffffff
|
2469
|
-
pass
|
2470
|
-
end
|
2471
|
-
|
2472
|
-
it "has a working function #int32_in_min" do
|
2473
|
-
GIMarshallingTests.int32_in_min(-0x80000000)
|
2474
|
-
pass
|
2475
|
-
end
|
2476
|
-
|
2477
|
-
it "has a working function #int32_inout_max_min" do
|
2478
|
-
res = GIMarshallingTests.int32_inout_max_min 0x7fffffff
|
2479
|
-
assert_equal(-0x80000000, res)
|
2480
|
-
end
|
2481
|
-
|
2482
|
-
it "has a working function #int32_inout_min_max" do
|
2483
|
-
res = GIMarshallingTests.int32_inout_min_max(-0x80000000)
|
2484
|
-
assert_equal 0x7fffffff, res
|
2485
|
-
end
|
2486
|
-
|
2487
|
-
it "has a working function #int32_out_max" do
|
2488
|
-
res = GIMarshallingTests.int32_out_max
|
2489
|
-
assert_equal 0x7fffffff, res
|
2490
|
-
end
|
2491
|
-
|
2492
|
-
it "has a working function #int32_out_min" do
|
2493
|
-
res = GIMarshallingTests.int32_out_min
|
2494
|
-
assert_equal(-0x80000000, res)
|
2495
|
-
end
|
2496
|
-
|
2497
|
-
it "has a working function #int32_return_max" do
|
2498
|
-
res = GIMarshallingTests.int32_return_max
|
2499
|
-
assert_equal 0x7fffffff, res
|
2500
|
-
end
|
2501
|
-
|
2502
|
-
it "has a working function #int32_return_min" do
|
2503
|
-
res = GIMarshallingTests.int32_return_min
|
2504
|
-
assert_equal(-0x80000000, res)
|
2505
|
-
end
|
2506
|
-
|
2507
|
-
it "has a working function #int64_in_max" do
|
2508
|
-
GIMarshallingTests.int64_in_max 0x7fffffffffffffff
|
2509
|
-
pass
|
2510
|
-
end
|
2511
|
-
|
2512
|
-
it "has a working function #int64_in_min" do
|
2513
|
-
GIMarshallingTests.int64_in_min(-0x8000000000000000)
|
2514
|
-
pass
|
2515
|
-
end
|
2516
|
-
|
2517
|
-
it "has a working function #int64_inout_max_min" do
|
2518
|
-
res = GIMarshallingTests.int64_inout_max_min 0x7fffffffffffffff
|
2519
|
-
assert_equal(-0x8000000000000000, res)
|
2520
|
-
end
|
2521
|
-
|
2522
|
-
it "has a working function #int64_inout_min_max" do
|
2523
|
-
res = GIMarshallingTests.int64_inout_min_max(-0x8000000000000000)
|
2524
|
-
assert_equal 0x7fffffffffffffff, res
|
2525
|
-
end
|
2526
|
-
|
2527
|
-
it "has a working function #int64_out_max" do
|
2528
|
-
res = GIMarshallingTests.int64_out_max
|
2529
|
-
assert_equal 0x7fffffffffffffff, res
|
2530
|
-
end
|
2531
|
-
|
2532
|
-
it "has a working function #int64_out_min" do
|
2533
|
-
res = GIMarshallingTests.int64_out_min
|
2534
|
-
assert_equal(-0x8000000000000000, res)
|
2535
|
-
end
|
2536
|
-
|
2537
|
-
it "has a working function #int64_return_max" do
|
2538
|
-
res = GIMarshallingTests.int64_return_max
|
2539
|
-
assert_equal 0x7fffffffffffffff, res
|
2540
|
-
end
|
2541
|
-
|
2542
|
-
it "has a working function #int64_return_min" do
|
2543
|
-
res = GIMarshallingTests.int64_return_min
|
2544
|
-
assert_equal(-0x8000000000000000, res)
|
2545
|
-
end
|
2546
|
-
|
2547
|
-
it "has a working function #int8_in_max" do
|
2548
|
-
GIMarshallingTests.int8_in_max 0x7f
|
2549
|
-
pass
|
2550
|
-
end
|
2551
|
-
|
2552
|
-
it "has a working function #int8_in_min" do
|
2553
|
-
GIMarshallingTests.int8_in_min(-0x80)
|
2554
|
-
pass
|
2555
|
-
end
|
2556
|
-
|
2557
|
-
it "has a working function #int8_inout_max_min" do
|
2558
|
-
res = GIMarshallingTests.int8_inout_max_min 0x7f
|
2559
|
-
assert_equal(-0x80, res)
|
2560
|
-
end
|
2561
|
-
|
2562
|
-
it "has a working function #int8_inout_min_max" do
|
2563
|
-
res = GIMarshallingTests.int8_inout_min_max(-0x80)
|
2564
|
-
assert_equal 0x7f, res
|
2565
|
-
end
|
2566
|
-
|
2567
|
-
it "has a working function #int8_out_max" do
|
2568
|
-
res = GIMarshallingTests.int8_out_max
|
2569
|
-
assert_equal 0x7f, res
|
2570
|
-
end
|
2571
|
-
|
2572
|
-
it "has a working function #int8_out_min" do
|
2573
|
-
res = GIMarshallingTests.int8_out_min
|
2574
|
-
assert_equal(-0x80, res)
|
2575
|
-
end
|
2576
|
-
|
2577
|
-
it "has a working function #int8_return_max" do
|
2578
|
-
res = GIMarshallingTests.int8_return_max
|
2579
|
-
assert_equal 0x7f, res
|
2580
|
-
end
|
2581
|
-
|
2582
|
-
it "has a working function #int8_return_min" do
|
2583
|
-
res = GIMarshallingTests.int8_return_min
|
2584
|
-
assert_equal(-0x80, res)
|
2585
|
-
end
|
2586
|
-
|
2587
|
-
it "has a working function #int_in_max" do
|
2588
|
-
GIMarshallingTests.int_in_max 0x7fffffff
|
2589
|
-
pass
|
2590
|
-
end
|
2591
|
-
|
2592
|
-
it "has a working function #int_in_min" do
|
2593
|
-
GIMarshallingTests.int_in_min(-0x80000000)
|
2594
|
-
pass
|
2595
|
-
end
|
2596
|
-
|
2597
|
-
it "has a working function #int_inout_max_min" do
|
2598
|
-
res = GIMarshallingTests.int_inout_max_min 0x7fffffff
|
2599
|
-
assert_equal(-0x80000000, res)
|
2600
|
-
end
|
2601
|
-
|
2602
|
-
it "has a working function #int_inout_min_max" do
|
2603
|
-
res = GIMarshallingTests.int_inout_min_max(-0x80000000)
|
2604
|
-
assert_equal 0x7fffffff, res
|
2605
|
-
end
|
2606
|
-
|
2607
|
-
it "has a working function #int_one_in_utf8_two_in_one_allows_none" do
|
2608
|
-
GIMarshallingTests.int_one_in_utf8_two_in_one_allows_none 1, "2", "3"
|
2609
|
-
GIMarshallingTests.int_one_in_utf8_two_in_one_allows_none 1, nil, "3"
|
2610
|
-
pass
|
2611
|
-
end
|
2612
|
-
|
2613
|
-
it "has a working function #int_out_max" do
|
2614
|
-
res = GIMarshallingTests.int_out_max
|
2615
|
-
assert_equal 0x7fffffff, res
|
2616
|
-
end
|
2617
|
-
|
2618
|
-
it "has a working function #int_out_min" do
|
2619
|
-
res = GIMarshallingTests.int_out_min
|
2620
|
-
assert_equal(-0x80000000, res)
|
2621
|
-
end
|
2622
|
-
|
2623
|
-
it "has a working function #int_out_out" do
|
2624
|
-
res = GIMarshallingTests.int_out_out
|
2625
|
-
assert_equal [6, 7], res
|
2626
|
-
end
|
2627
|
-
|
2628
|
-
it "has a working function #int_return_max" do
|
2629
|
-
res = GIMarshallingTests.int_return_max
|
2630
|
-
assert_equal 0x7fffffff, res
|
2631
|
-
end
|
2632
|
-
|
2633
|
-
it "has a working function #int_return_min" do
|
2634
|
-
res = GIMarshallingTests.int_return_min
|
2635
|
-
assert_equal(-0x80000000, res)
|
2636
|
-
end
|
2637
|
-
|
2638
|
-
it "has a working function #int_return_out" do
|
2639
|
-
res = GIMarshallingTests.int_return_out
|
2640
|
-
assert_equal [6, 7], res
|
2641
|
-
end
|
2642
|
-
|
2643
|
-
it "has a working function #int_three_in_three_out" do
|
2644
|
-
res = GIMarshallingTests.int_three_in_three_out 4, 5, 6
|
2645
|
-
assert_equal [4, 5, 6], res
|
2646
|
-
end
|
2647
|
-
|
2648
|
-
it "has a working function #int_two_in_utf8_two_in_with_allow_none" do
|
2649
|
-
GIMarshallingTests.int_two_in_utf8_two_in_with_allow_none 1, 2, "3", "4"
|
2650
|
-
GIMarshallingTests.int_two_in_utf8_two_in_with_allow_none 1, 2, nil, nil
|
2651
|
-
pass
|
2652
|
-
end
|
2653
|
-
|
2654
|
-
it "has a working function #long_in_max" do
|
2655
|
-
GIMarshallingTests.long_in_max max_long
|
2656
|
-
pass
|
2657
|
-
end
|
2658
|
-
|
2659
|
-
it "has a working function #long_in_min" do
|
2660
|
-
GIMarshallingTests.long_in_min min_long
|
2661
|
-
pass
|
2662
|
-
end
|
2663
|
-
|
2664
|
-
it "has a working function #long_inout_max_min" do
|
2665
|
-
res = GIMarshallingTests.long_inout_max_min max_long
|
2666
|
-
assert_equal min_long, res
|
2667
|
-
end
|
2668
|
-
|
2669
|
-
it "has a working function #long_inout_min_max" do
|
2670
|
-
res = GIMarshallingTests.long_inout_min_max min_long
|
2671
|
-
assert_equal max_long, res
|
2672
|
-
end
|
2673
|
-
|
2674
|
-
it "has a working function #long_out_max" do
|
2675
|
-
res = GIMarshallingTests.long_out_max
|
2676
|
-
assert_equal max_long, res
|
2677
|
-
end
|
2678
|
-
|
2679
|
-
it "has a working function #long_out_min" do
|
2680
|
-
res = GIMarshallingTests.long_out_min
|
2681
|
-
assert_equal min_long, res
|
2682
|
-
end
|
2683
|
-
|
2684
|
-
it "has a working function #long_return_max" do
|
2685
|
-
res = GIMarshallingTests.long_return_max
|
2686
|
-
assert_equal max_long, res
|
2687
|
-
end
|
2688
|
-
|
2689
|
-
it "has a working function #long_return_min" do
|
2690
|
-
res = GIMarshallingTests.long_return_min
|
2691
|
-
assert_equal min_long, res
|
2692
|
-
end
|
2693
|
-
|
2694
|
-
it "has a working function #multi_array_key_value_in" do
|
2695
|
-
keys = %w(one two three)
|
2696
|
-
values = [1, 2, 3].map { |val| GObject::Value.wrap_ruby_value val }
|
2697
|
-
GIMarshallingTests.multi_array_key_value_in keys, values
|
2698
|
-
end
|
2699
|
-
|
2700
|
-
it "has a working function #no_type_flags_in" do
|
2701
|
-
GIMarshallingTests.no_type_flags_in value2: true
|
2702
|
-
pass
|
2703
|
-
end
|
2704
|
-
|
2705
|
-
it "has a working function #no_type_flags_in_zero" do
|
2706
|
-
GIMarshallingTests.no_type_flags_in_zero 0
|
2707
|
-
pass
|
2708
|
-
end
|
2709
|
-
|
2710
|
-
it "has a working function #no_type_flags_inout" do
|
2711
|
-
res = GIMarshallingTests.no_type_flags_inout value2: true
|
2712
|
-
_(res).must_equal(value1: true)
|
2713
|
-
end
|
2714
|
-
|
2715
|
-
it "has a working function #no_type_flags_out" do
|
2716
|
-
res = GIMarshallingTests.no_type_flags_out
|
2717
|
-
_(res).must_equal(value2: true)
|
2718
|
-
end
|
2719
|
-
|
2720
|
-
it "has a working function #no_type_flags_returnv" do
|
2721
|
-
res = GIMarshallingTests.no_type_flags_returnv
|
2722
|
-
_(res).must_equal(value2: true)
|
2723
|
-
end
|
2724
|
-
|
2725
|
-
it "has a working function #overrides_struct_returnv" do
|
2726
|
-
res = GIMarshallingTests.overrides_struct_returnv
|
2727
|
-
_(res).must_be_instance_of GIMarshallingTests::OverridesStruct
|
2728
|
-
end
|
2729
|
-
|
2730
|
-
it "has a working function #param_spec_in_bool" do
|
2731
|
-
ps = GObject.param_spec_boolean "mybool", "nick", "blurb", true, :readable
|
2732
|
-
GIMarshallingTests.param_spec_in_bool ps
|
2733
|
-
pass
|
2734
|
-
end
|
2735
|
-
|
2736
|
-
it "has a working function #param_spec_out" do
|
2737
|
-
res = GIMarshallingTests.param_spec_out
|
2738
|
-
_(res.value_type).must_equal GObject::TYPE_STRING
|
2739
|
-
_(res.get_name).must_equal "test-param"
|
2740
|
-
end
|
2741
|
-
|
2742
|
-
it "has a working function #param_spec_return" do
|
2743
|
-
res = GIMarshallingTests.param_spec_return
|
2744
|
-
_(res.value_type).must_equal GObject::TYPE_STRING
|
2745
|
-
_(res.get_name).must_equal "test-param"
|
2746
|
-
end
|
2747
|
-
|
2748
|
-
it "has a working function #pointer_in_return" do
|
2749
|
-
ptr = FFI::MemoryPointer.new 1
|
2750
|
-
res = GIMarshallingTests.pointer_in_return ptr
|
2751
|
-
assert_equal ptr.address, res.address
|
2752
|
-
end
|
2753
|
-
|
2754
|
-
it "has a working function #pointer_struct_get_type" do
|
2755
|
-
res = GIMarshallingTests.pointer_struct_get_type
|
2756
|
-
gtype = GObject.type_from_name "GIMarshallingTestsPointerStruct"
|
2757
|
-
assert_equal gtype, res
|
2758
|
-
end
|
2759
|
-
|
2760
|
-
it "has a working function #pointer_struct_returnv" do
|
2761
|
-
res = GIMarshallingTests.pointer_struct_returnv
|
2762
|
-
assert_instance_of GIMarshallingTests::PointerStruct, res
|
2763
|
-
assert_equal 42, res.long_
|
2764
|
-
end
|
2765
|
-
|
2766
|
-
it "has a working function #return_gvalue_flat_array" do
|
2767
|
-
result = GIMarshallingTests.return_gvalue_flat_array
|
2768
|
-
arr = result.to_a
|
2769
|
-
_(arr[0].get_value).must_equal 42
|
2770
|
-
_(arr[1].get_value).must_equal "42"
|
2771
|
-
_(arr[2].get_value).must_equal true
|
2772
|
-
end
|
2773
|
-
|
2774
|
-
it "has a working function #short_in_max" do
|
2775
|
-
GIMarshallingTests.short_in_max 0x7fff
|
2776
|
-
pass
|
2777
|
-
end
|
2778
|
-
|
2779
|
-
it "has a working function #short_in_min" do
|
2780
|
-
GIMarshallingTests.short_in_min(-0x8000)
|
2781
|
-
pass
|
2782
|
-
end
|
2783
|
-
|
2784
|
-
it "has a working function #short_inout_max_min" do
|
2785
|
-
res = GIMarshallingTests.short_inout_max_min 0x7fff
|
2786
|
-
assert_equal(-0x8000, res)
|
2787
|
-
end
|
2788
|
-
|
2789
|
-
it "has a working function #short_inout_min_max" do
|
2790
|
-
res = GIMarshallingTests.short_inout_min_max(-0x8000)
|
2791
|
-
assert_equal 0x7fff, res
|
2792
|
-
end
|
2793
|
-
|
2794
|
-
it "has a working function #short_out_max" do
|
2795
|
-
res = GIMarshallingTests.short_out_max
|
2796
|
-
assert_equal 0x7fff, res
|
2797
|
-
end
|
2798
|
-
|
2799
|
-
it "has a working function #short_out_min" do
|
2800
|
-
res = GIMarshallingTests.short_out_min
|
2801
|
-
assert_equal(-0x8000, res)
|
2802
|
-
end
|
2803
|
-
|
2804
|
-
it "has a working function #short_return_max" do
|
2805
|
-
res = GIMarshallingTests.short_return_max
|
2806
|
-
assert_equal 0x7fff, res
|
2807
|
-
end
|
2808
|
-
|
2809
|
-
it "has a working function #short_return_min" do
|
2810
|
-
res = GIMarshallingTests.short_return_min
|
2811
|
-
assert_equal(-0x8000, res)
|
2812
|
-
end
|
2813
|
-
|
2814
|
-
it "has a working function #simple_struct_returnv" do
|
2815
|
-
res = GIMarshallingTests.simple_struct_returnv
|
2816
|
-
assert_instance_of GIMarshallingTests::SimpleStruct, res
|
2817
|
-
assert_equal 6, res.long_
|
2818
|
-
assert_equal 7, res.int8
|
2819
|
-
end
|
2820
|
-
|
2821
|
-
it "has a working function #size_in" do
|
2822
|
-
GIMarshallingTests.size_in max_size_t
|
2823
|
-
end
|
2824
|
-
|
2825
|
-
it "has a working function #size_inout" do
|
2826
|
-
res = GIMarshallingTests.size_inout max_size_t
|
2827
|
-
assert_equal 0, res
|
2828
|
-
end
|
2829
|
-
|
2830
|
-
it "has a working function #size_out" do
|
2831
|
-
res = GIMarshallingTests.size_out
|
2832
|
-
assert_equal max_size_t, res
|
2833
|
-
end
|
2834
|
-
|
2835
|
-
it "has a working function #size_return" do
|
2836
|
-
res = GIMarshallingTests.size_return
|
2837
|
-
assert_equal max_size_t, res
|
2838
|
-
end
|
2839
|
-
|
2840
|
-
it "has a working function #ssize_in_max" do
|
2841
|
-
GIMarshallingTests.ssize_in_max max_ssize_t
|
2842
|
-
pass
|
2843
|
-
end
|
2844
|
-
|
2845
|
-
it "has a working function #ssize_in_min" do
|
2846
|
-
GIMarshallingTests.ssize_in_min min_ssize_t
|
2847
|
-
pass
|
2848
|
-
end
|
2849
|
-
|
2850
|
-
it "has a working function #ssize_inout_max_min" do
|
2851
|
-
res = GIMarshallingTests.ssize_inout_max_min max_ssize_t
|
2852
|
-
assert_equal min_ssize_t, res
|
2853
|
-
end
|
2854
|
-
|
2855
|
-
it "has a working function #ssize_inout_min_max" do
|
2856
|
-
res = GIMarshallingTests.ssize_inout_min_max min_ssize_t
|
2857
|
-
assert_equal max_ssize_t, res
|
2858
|
-
end
|
2859
|
-
|
2860
|
-
it "has a working function #ssize_out_max" do
|
2861
|
-
res = GIMarshallingTests.ssize_out_max
|
2862
|
-
assert_equal max_ssize_t, res
|
2863
|
-
end
|
2864
|
-
|
2865
|
-
it "has a working function #ssize_out_min" do
|
2866
|
-
res = GIMarshallingTests.ssize_out_min
|
2867
|
-
assert_equal min_ssize_t, res
|
2868
|
-
end
|
2869
|
-
|
2870
|
-
it "has a working function #ssize_return_max" do
|
2871
|
-
res = GIMarshallingTests.ssize_return_max
|
2872
|
-
assert_equal max_ssize_t, res
|
2873
|
-
end
|
2874
|
-
|
2875
|
-
it "has a working function #ssize_return_min" do
|
2876
|
-
res = GIMarshallingTests.ssize_return_min
|
2877
|
-
assert_equal min_ssize_t, res
|
2878
|
-
end
|
2879
|
-
|
2880
|
-
it "has a working function #test_interface_test_int8_in" do
|
2881
|
-
derived_klass.class_eval { include GIMarshallingTests::Interface }
|
2882
|
-
instance = make_derived_instance do |info|
|
2883
|
-
info.install_vfunc_implementation :test_int8_in, proc { |obj, in_| obj.int = in_ }
|
2884
|
-
end
|
2885
|
-
_(instance.int).must_equal 0
|
2886
|
-
GIMarshallingTests.test_interface_test_int8_in instance, 8
|
2887
|
-
_(instance.int).must_equal 8
|
2888
|
-
end
|
2889
|
-
|
2890
|
-
it "has a working function #time_t_in" do
|
2891
|
-
GIMarshallingTests.time_t_in 1_234_567_890
|
2892
|
-
pass
|
2893
|
-
end
|
2894
|
-
|
2895
|
-
it "has a working function #time_t_inout" do
|
2896
|
-
res = GIMarshallingTests.time_t_inout 1_234_567_890
|
2897
|
-
assert_equal 0, res
|
2898
|
-
end
|
2899
|
-
|
2900
|
-
it "has a working function #time_t_out" do
|
2901
|
-
res = GIMarshallingTests.time_t_out
|
2902
|
-
assert_equal 1_234_567_890, res
|
2903
|
-
end
|
2904
|
-
|
2905
|
-
it "has a working function #time_t_return" do
|
2906
|
-
res = GIMarshallingTests.time_t_return
|
2907
|
-
assert_equal 1_234_567_890, res
|
2908
|
-
end
|
2909
|
-
|
2910
|
-
it "has a working function #uint16_in" do
|
2911
|
-
GIMarshallingTests.uint16_in 0xffff
|
2912
|
-
pass
|
2913
|
-
end
|
2914
|
-
|
2915
|
-
it "has a working function #uint16_inout" do
|
2916
|
-
res = GIMarshallingTests.uint16_inout 0xffff
|
2917
|
-
assert_equal 0, res
|
2918
|
-
end
|
2919
|
-
|
2920
|
-
it "has a working function #uint16_out" do
|
2921
|
-
res = GIMarshallingTests.uint16_out
|
2922
|
-
assert_equal 0xffff, res
|
2923
|
-
end
|
2924
|
-
|
2925
|
-
it "has a working function #uint16_return" do
|
2926
|
-
res = GIMarshallingTests.uint16_return
|
2927
|
-
assert_equal 0xffff, res
|
2928
|
-
end
|
2929
|
-
|
2930
|
-
it "has a working function #uint32_in" do
|
2931
|
-
GIMarshallingTests.uint32_in 0xffffffff
|
2932
|
-
end
|
2933
|
-
|
2934
|
-
it "has a working function #uint32_inout" do
|
2935
|
-
res = GIMarshallingTests.uint32_inout 0xffffffff
|
2936
|
-
assert_equal 0, res
|
2937
|
-
end
|
2938
|
-
|
2939
|
-
it "has a working function #uint32_out" do
|
2940
|
-
res = GIMarshallingTests.uint32_out
|
2941
|
-
assert_equal 0xffffffff, res
|
2942
|
-
end
|
2943
|
-
|
2944
|
-
it "has a working function #uint32_return" do
|
2945
|
-
res = GIMarshallingTests.uint32_return
|
2946
|
-
assert_equal 0xffffffff, res
|
2947
|
-
end
|
2948
|
-
|
2949
|
-
it "has a working function #uint64_in" do
|
2950
|
-
GIMarshallingTests.uint64_in 0xffff_ffff_ffff_ffff
|
2951
|
-
pass
|
2952
|
-
end
|
2953
|
-
|
2954
|
-
it "has a working function #uint64_inout" do
|
2955
|
-
res = GIMarshallingTests.uint64_inout 0xffff_ffff_ffff_ffff
|
2956
|
-
assert_equal 0, res
|
2957
|
-
end
|
2958
|
-
|
2959
|
-
it "has a working function #uint64_out" do
|
2960
|
-
res = GIMarshallingTests.uint64_out
|
2961
|
-
assert_equal 0xffff_ffff_ffff_ffff, res
|
2962
|
-
end
|
2963
|
-
|
2964
|
-
it "has a working function #uint64_return" do
|
2965
|
-
res = GIMarshallingTests.uint64_return
|
2966
|
-
assert_equal 0xffff_ffff_ffff_ffff, res
|
2967
|
-
end
|
2968
|
-
|
2969
|
-
it "has a working function #uint8_in" do
|
2970
|
-
GIMarshallingTests.uint8_in 0xff
|
2971
|
-
end
|
2972
|
-
|
2973
|
-
it "has a working function #uint8_inout" do
|
2974
|
-
res = GIMarshallingTests.uint8_inout 0xff
|
2975
|
-
assert_equal 0, res
|
2976
|
-
end
|
2977
|
-
|
2978
|
-
it "has a working function #uint8_out" do
|
2979
|
-
res = GIMarshallingTests.uint8_out
|
2980
|
-
assert_equal 0xff, res
|
2981
|
-
end
|
2982
|
-
|
2983
|
-
it "has a working function #uint8_return" do
|
2984
|
-
res = GIMarshallingTests.uint8_return
|
2985
|
-
assert_equal 0xff, res
|
2986
|
-
end
|
2987
|
-
|
2988
|
-
it "has a working function #uint_in" do
|
2989
|
-
GIMarshallingTests.uint_in max_uint
|
2990
|
-
pass
|
2991
|
-
end
|
2992
|
-
|
2993
|
-
it "has a working function #uint_inout" do
|
2994
|
-
res = GIMarshallingTests.uint_inout max_uint
|
2995
|
-
assert_equal 0, res
|
2996
|
-
end
|
2997
|
-
|
2998
|
-
it "has a working function #uint_out" do
|
2999
|
-
res = GIMarshallingTests.uint_out
|
3000
|
-
assert_equal max_uint, res
|
3001
|
-
end
|
3002
|
-
|
3003
|
-
it "has a working function #uint_return" do
|
3004
|
-
res = GIMarshallingTests.uint_return
|
3005
|
-
assert_equal max_uint, res
|
3006
|
-
end
|
3007
|
-
|
3008
|
-
it "has a working function #ulong_in" do
|
3009
|
-
GIMarshallingTests.ulong_in max_ulong
|
3010
|
-
end
|
3011
|
-
|
3012
|
-
it "has a working function #ulong_inout" do
|
3013
|
-
res = GIMarshallingTests.ulong_inout max_ulong
|
3014
|
-
assert_equal 0, res
|
3015
|
-
end
|
3016
|
-
|
3017
|
-
it "has a working function #ulong_out" do
|
3018
|
-
res = GIMarshallingTests.ulong_out
|
3019
|
-
assert_equal max_ulong, res
|
3020
|
-
end
|
3021
|
-
|
3022
|
-
it "has a working function #ulong_return" do
|
3023
|
-
res = GIMarshallingTests.ulong_return
|
3024
|
-
assert_equal max_ulong, res
|
3025
|
-
end
|
3026
|
-
|
3027
|
-
it "has a working function #union_inout" do
|
3028
|
-
skip "This function is defined in the header but not implemented"
|
3029
|
-
end
|
3030
|
-
|
3031
|
-
it "has a working function #union_out" do
|
3032
|
-
skip "This function is defined in the header but not implemented"
|
3033
|
-
end
|
3034
|
-
|
3035
|
-
it "has a working function #union_returnv" do
|
3036
|
-
res = GIMarshallingTests.union_returnv
|
3037
|
-
assert_instance_of GIMarshallingTests::Union, res
|
3038
|
-
assert_equal 42, res.long_
|
3039
|
-
end
|
3040
|
-
|
3041
|
-
it "has a working function #ushort_in" do
|
3042
|
-
GIMarshallingTests.ushort_in max_ushort
|
3043
|
-
pass
|
3044
|
-
end
|
3045
|
-
|
3046
|
-
it "has a working function #ushort_inout" do
|
3047
|
-
res = GIMarshallingTests.ushort_inout max_ushort
|
3048
|
-
assert_equal 0, res
|
3049
|
-
end
|
3050
|
-
|
3051
|
-
it "has a working function #ushort_out" do
|
3052
|
-
res = GIMarshallingTests.ushort_out
|
3053
|
-
assert_equal max_ushort, res
|
3054
|
-
end
|
3055
|
-
|
3056
|
-
it "has a working function #ushort_return" do
|
3057
|
-
res = GIMarshallingTests.ushort_return
|
3058
|
-
assert_equal max_ushort, res
|
3059
|
-
end
|
3060
|
-
|
3061
|
-
it "has a working function #utf8_as_uint8array_in" do
|
3062
|
-
GIMarshallingTests.utf8_as_uint8array_in GIMarshallingTests::CONSTANT_UTF8.bytes.to_a
|
3063
|
-
pass
|
3064
|
-
end
|
3065
|
-
|
3066
|
-
it "has a working function #utf8_dangling_out" do
|
3067
|
-
res = GIMarshallingTests.utf8_dangling_out
|
3068
|
-
assert_nil res
|
3069
|
-
end
|
3070
|
-
|
3071
|
-
it "has a working function #utf8_full_in" do
|
3072
|
-
skip "This function is defined in the header but not implemented"
|
3073
|
-
end
|
3074
|
-
|
3075
|
-
it "has a working function #utf8_full_inout" do
|
3076
|
-
res = GIMarshallingTests.utf8_full_inout "const ♥ utf8"
|
3077
|
-
assert_equal "", res
|
3078
|
-
end
|
3079
|
-
|
3080
|
-
it "has a working function #utf8_full_out" do
|
3081
|
-
res = GIMarshallingTests.utf8_full_out
|
3082
|
-
assert_equal "const ♥ utf8", res
|
3083
|
-
end
|
3084
|
-
|
3085
|
-
it "has a working function #utf8_full_return" do
|
3086
|
-
res = GIMarshallingTests.utf8_full_return
|
3087
|
-
assert_equal "const ♥ utf8", res
|
3088
|
-
end
|
3089
|
-
|
3090
|
-
it "has a working function #utf8_none_in" do
|
3091
|
-
GIMarshallingTests.utf8_none_in "const ♥ utf8"
|
3092
|
-
pass
|
3093
|
-
end
|
3094
|
-
|
3095
|
-
it "has a working function #utf8_none_inout" do
|
3096
|
-
res = GIMarshallingTests.utf8_none_inout "const ♥ utf8"
|
3097
|
-
assert_equal "", res
|
3098
|
-
end
|
3099
|
-
|
3100
|
-
it "has a working function #utf8_none_out" do
|
3101
|
-
res = GIMarshallingTests.utf8_none_out
|
3102
|
-
assert_equal "const ♥ utf8", res
|
3103
|
-
end
|
3104
|
-
|
3105
|
-
it "has a working function #utf8_none_return" do
|
3106
|
-
res = GIMarshallingTests.utf8_none_return
|
3107
|
-
assert_equal "const ♥ utf8", res
|
3108
|
-
end
|
3109
|
-
end
|