glib2 4.3.7 → 4.3.8

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,4 +1,4 @@
1
- # Copyright (C) 2015-2022 Ruby-GNOME Project Team
1
+ # Copyright (C) 2015-2026 Ruby-GNOME Project Team
2
2
  #
3
3
  # This library is free software; you can redistribute it and/or
4
4
  # modify it under the terms of the GNU Lesser General Public
@@ -15,6 +15,7 @@
15
15
  # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
16
16
 
17
17
  require "pathname"
18
+ require "weakref"
18
19
 
19
20
  require "test-unit"
20
21
 
@@ -40,6 +41,12 @@ module GLibTestUtils
40
41
  omit("Not for SCL environment") if ENV["SCL"]
41
42
  end
42
43
 
44
+ def only_girepository
45
+ unless GLib.const_defined?(:Repository)
46
+ omit("Need RUBY_GNOME_GLIB2_GIREPOSITORY_ENABLE=yes on build")
47
+ end
48
+ end
49
+
43
50
  def normalize_path(path)
44
51
  return path unless File::ALT_SEPARATOR
45
52
  path.gsub(File::ALT_SEPARATOR, File::SEPARATOR)
@@ -0,0 +1,79 @@
1
+ # Copyright (C) 2012-2026 Ruby-GNOME Project Team
2
+ #
3
+ # This library is free software; you can redistribute it and/or
4
+ # modify it under the terms of the GNU Lesser General Public
5
+ # License as published by the Free Software Foundation; either
6
+ # version 2.1 of the License, or (at your option) any later version.
7
+ #
8
+ # This library is distributed in the hope that it will be useful,
9
+ # but WITHOUT ANY WARRANTY; without even the implied warranty of
10
+ # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
11
+ # Lesser General Public License for more details.
12
+ #
13
+ # You should have received a copy of the GNU Lesser General Public
14
+ # License along with this library; if not, write to the Free Software
15
+ # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
16
+
17
+ class TestArgInfo < Test::Unit::TestCase
18
+ include GLibTestUtils
19
+
20
+ def setup
21
+ only_girepository
22
+ @repository = GLib::Repository.default
23
+ @repository.require("GObject")
24
+ @callable_info = @repository.find("GObject", "signal_name")
25
+ @info = @callable_info.get_arg(0)
26
+ end
27
+
28
+ def test_direction
29
+ assert_equal(GLib::Direction::IN,
30
+ @info.direction)
31
+ end
32
+
33
+ def test_caller_allocate?
34
+ assert do
35
+ not @info.caller_allocates?
36
+ end
37
+ end
38
+
39
+ def test_return_value?
40
+ assert do
41
+ not @info.return_value?
42
+ end
43
+ end
44
+
45
+ def test_optional?
46
+ assert do
47
+ not @info.optional?
48
+ end
49
+ end
50
+
51
+ def test_may_be_null?
52
+ assert do
53
+ not @info.may_be_null?
54
+ end
55
+ end
56
+
57
+ def test_ownership_transfer
58
+ assert_equal(GLib::Transfer::NOTHING,
59
+ @info.ownership_transfer)
60
+ end
61
+
62
+ def test_scope
63
+ assert_equal(GLib::ScopeType::INVALID,
64
+ @info.scope)
65
+ end
66
+
67
+ def test_closure_index
68
+ assert_nil(@info.closure_index)
69
+ end
70
+
71
+ def test_destroy_index
72
+ assert_nil(@info.destroy_index)
73
+ end
74
+
75
+ def test_type
76
+ assert_kind_of(GLib::TypeInfo,
77
+ @info.type)
78
+ end
79
+ end
@@ -0,0 +1,42 @@
1
+ # Copyright (C) 2012-2026 Ruby-GNOME Project Team
2
+ #
3
+ # This library is free software; you can redistribute it and/or
4
+ # modify it under the terms of the GNU Lesser General Public
5
+ # License as published by the Free Software Foundation; either
6
+ # version 2.1 of the License, or (at your option) any later version.
7
+ #
8
+ # This library is distributed in the hope that it will be useful,
9
+ # but WITHOUT ANY WARRANTY; without even the implied warranty of
10
+ # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
11
+ # Lesser General Public License for more details.
12
+ #
13
+ # You should have received a copy of the GNU Lesser General Public
14
+ # License along with this library; if not, write to the Free Software
15
+ # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
16
+
17
+ class TestBaseInfo < Test::Unit::TestCase
18
+ include GLibTestUtils
19
+
20
+ def setup
21
+ only_girepository
22
+ @repository = GLib::Repository.default
23
+ @repository.require("GObject")
24
+ @info = @repository.find("GObject", "Object")
25
+ end
26
+
27
+ def test_name
28
+ assert_equal("Object", @info.name)
29
+ end
30
+
31
+ def test_namespace
32
+ assert_equal("GObject", @info.namespace)
33
+ end
34
+
35
+ def test_container
36
+ assert_nil(@info.container)
37
+ end
38
+
39
+ def test_enumerable
40
+ assert_equal([], @info.to_a)
41
+ end
42
+ end
data/test/test-bytes.rb CHANGED
@@ -1,4 +1,4 @@
1
- # Copyright (C) 2017-2021 Ruby-GNOME Project Team
1
+ # Copyright (C) 2017-2026 Ruby-GNOME Project Team
2
2
  #
3
3
  # This library is free software; you can redistribute it and/or
4
4
  # modify it under the terms of the GNU Lesser General Public
@@ -42,14 +42,17 @@ class TestGLibBytes < Test::Unit::TestCase
42
42
  def create_bytes(options={})
43
43
  data = "Hello"
44
44
  data.freeze if options[:freeze]
45
- [data.object_id, GLib::Bytes.new(data)]
45
+ [WeakRef.new(data), GLib::Bytes.new(data)]
46
46
  end
47
47
 
48
48
  test "frozen" do
49
- id, bytes = create_bytes(:freeze => true)
49
+ ref, bytes = create_bytes(:freeze => true)
50
50
  GC.start
51
+ assert do
52
+ ref.weakref_alive?
53
+ end
51
54
  assert_equal(bytes.to_s,
52
- ObjectSpace._id2ref(id))
55
+ ref.to_s)
53
56
  end
54
57
  end
55
58
 
@@ -0,0 +1,60 @@
1
+ # Copyright (C) 2012-2026 Ruby-GNOME Project Team
2
+ #
3
+ # This library is free software; you can redistribute it and/or
4
+ # modify it under the terms of the GNU Lesser General Public
5
+ # License as published by the Free Software Foundation; either
6
+ # version 2.1 of the License, or (at your option) any later version.
7
+ #
8
+ # This library is distributed in the hope that it will be useful,
9
+ # but WITHOUT ANY WARRANTY; without even the implied warranty of
10
+ # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
11
+ # Lesser General Public License for more details.
12
+ #
13
+ # You should have received a copy of the GNU Lesser General Public
14
+ # License along with this library; if not, write to the Free Software
15
+ # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
16
+
17
+ class TestCallableInfo < Test::Unit::TestCase
18
+ include GLibTestUtils
19
+
20
+ def setup
21
+ only_girepository
22
+ @repository = GLib::Repository.default
23
+ @repository.require("GObject")
24
+ @info = @repository.find("GObject", "signal_name")
25
+ end
26
+
27
+ def test_can_throw_gerror
28
+ assert do
29
+ not @info.can_throw_gerror?
30
+ end
31
+ end
32
+
33
+ def test_return_type
34
+ assert_kind_of(GLib::TypeInfo,
35
+ @info.return_type)
36
+ end
37
+
38
+ def test_caller_owns
39
+ assert_equal(GLib::Transfer::NOTHING,
40
+ @info.caller_owns)
41
+ end
42
+
43
+ def test_may_return_null?
44
+ assert do
45
+ @info.may_return_null?
46
+ end
47
+ end
48
+
49
+ def test_n_args
50
+ assert_equal(1, @info.n_args)
51
+ end
52
+
53
+ def test_get_arg
54
+ assert_equal("signal_id", @info.get_arg(0).name)
55
+ end
56
+
57
+ def test_args
58
+ assert_equal(["signal_id"], @info.args.collect(&:name))
59
+ end
60
+ end
@@ -0,0 +1,124 @@
1
+ # Copyright (C) 2012-2026 Ruby-GNOME Project Team
2
+ #
3
+ # This library is free software; you can redistribute it and/or
4
+ # modify it under the terms of the GNU Lesser General Public
5
+ # License as published by the Free Software Foundation; either
6
+ # version 2.1 of the License, or (at your option) any later version.
7
+ #
8
+ # This library is distributed in the hope that it will be useful,
9
+ # but WITHOUT ANY WARRANTY; without even the implied warranty of
10
+ # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
11
+ # Lesser General Public License for more details.
12
+ #
13
+ # You should have received a copy of the GNU Lesser General Public
14
+ # License along with this library; if not, write to the Free Software
15
+ # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
16
+
17
+ class TestInterfaceInfo < Test::Unit::TestCase
18
+ include GLibTestUtils
19
+
20
+ def setup
21
+ only_girepository
22
+ @repository = GLib::Repository.default
23
+ @repository.require("Gio")
24
+ @info = @repository.find("Gio", "TlsServerConnection")
25
+ end
26
+
27
+ def test_n_prerequisites
28
+ assert_equal(1, @info.n_prerequisites)
29
+ end
30
+
31
+ def test_prerequisite
32
+ assert_kind_of(GLib::ObjectInfo,
33
+ @info.get_prerequisite(0))
34
+ end
35
+
36
+ def test_n_properties
37
+ assert_equal(1, @info.n_properties)
38
+ end
39
+
40
+ def test_property
41
+ assert_kind_of(GLib::PropertyInfo,
42
+ @info.get_property(0))
43
+ end
44
+
45
+ def test_n_methods
46
+ assert_equal(1, @info.n_methods)
47
+ end
48
+
49
+ def test_get_method_n
50
+ assert_kind_of(GLib::FunctionInfo,
51
+ @info.get_method(0))
52
+ end
53
+
54
+ def test_get_method_name
55
+ assert_kind_of(GLib::FunctionInfo,
56
+ @info.get_method("new"))
57
+ end
58
+
59
+ def test_n_signals
60
+ info = @repository.find("Gio", "Volume")
61
+ assert_equal(2, info.n_signals)
62
+ end
63
+
64
+ def test_get_signal_n
65
+ info = @repository.find("Gio", "Volume")
66
+ assert_kind_of(GLib::SignalInfo,
67
+ info.get_signal(0))
68
+ end
69
+
70
+ def test_get_signal_name
71
+ info = @repository.find("Gio", "Volume")
72
+ assert_kind_of(GLib::SignalInfo,
73
+ info.get_signal("changed"))
74
+ end
75
+
76
+ def test_n_vfuncs
77
+ info = @repository.find("Gio", "Volume")
78
+ assert do
79
+ info.n_vfuncs > 0
80
+ end
81
+ end
82
+
83
+ def test_get_vfunc_n
84
+ info = @repository.find("Gio", "Volume")
85
+ assert_kind_of(GLib::VFuncInfo,
86
+ info.get_vfunc(0))
87
+ end
88
+
89
+ def test_get_vfunc_name
90
+ info = @repository.find("Gio", "Volume")
91
+ assert_kind_of(GLib::VFuncInfo,
92
+ info.get_vfunc("can_eject"))
93
+ end
94
+
95
+ def test_n_constants
96
+ repository = GLib::Repository.new
97
+ begin
98
+ repository.require("GXml")
99
+ rescue GLib::RepositoryError
100
+ omit("GXml is needed")
101
+ end
102
+ info = repository.find("GXml", "IXsdSchema")
103
+ assert do
104
+ info.n_constants > 0
105
+ end
106
+ end
107
+
108
+ def test_get_constant
109
+ repository = GLib::Repository.new
110
+ begin
111
+ repository.require("GXml")
112
+ rescue GLib::RepositoryError
113
+ omit("GXml is needed")
114
+ end
115
+ info = repository.find("GXml", "IXsdSchema")
116
+ assert_kind_of(GLib::ConstantInfo,
117
+ info.get_constant(0))
118
+ end
119
+
120
+ def test_iface_struct
121
+ assert_kind_of(GLib::StructInfo,
122
+ @info.iface_struct)
123
+ end
124
+ end
@@ -0,0 +1,71 @@
1
+ # Copyright (C) 2012-2026 Ruby-GNOME Project Team
2
+ #
3
+ # This library is free software; you can redistribute it and/or
4
+ # modify it under the terms of the GNU Lesser General Public
5
+ # License as published by the Free Software Foundation; either
6
+ # version 2.1 of the License, or (at your option) any later version.
7
+ #
8
+ # This library is distributed in the hope that it will be useful,
9
+ # but WITHOUT ANY WARRANTY; without even the implied warranty of
10
+ # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
11
+ # Lesser General Public License for more details.
12
+ #
13
+ # You should have received a copy of the GNU Lesser General Public
14
+ # License along with this library; if not, write to the Free Software
15
+ # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
16
+
17
+ class TestRepository < Test::Unit::TestCase
18
+ include GLibTestUtils
19
+
20
+ def setup
21
+ only_girepository
22
+ @repository = GLib::Repository.default
23
+ @repository.require("GObject")
24
+ @repository.require("Gio")
25
+ end
26
+
27
+ def test_search_path
28
+ repository = GLib::Repository.new
29
+ path = repository.search_path
30
+ repository.prepend_search_path(__dir__)
31
+ assert_equal([__dir__] + path,
32
+ repository.search_path)
33
+ end
34
+
35
+ def test_get_n_infos
36
+ assert_kind_of(Integer, @repository.get_n_infos("GObject"))
37
+ end
38
+
39
+ def test_get_info
40
+ assert_kind_of(GLib::BaseInfo,
41
+ @repository.get_info("GObject", 0))
42
+ end
43
+
44
+ def test_get_dependencies
45
+ assert_equal(["GLib-2.0"].sort,
46
+ @repository.get_dependencies("GObject").sort)
47
+ end
48
+
49
+ def test_loaded_namespaces
50
+ assert_equal(["GLib", "GObject", "Gio", "GModule"].sort,
51
+ @repository.loaded_namespaces.sort - ["GioUnix"])
52
+ end
53
+
54
+ def test_enumerable
55
+ namespaces = @repository.collect do |info|
56
+ info.namespace
57
+ end
58
+ assert_equal(["GLib", "GObject", "Gio", "GModule"].sort,
59
+ namespaces.uniq.sort - ["GioUnix"])
60
+ end
61
+
62
+ def test_find_by_gtype
63
+ info = @repository.find(GLib::Object.gtype)
64
+ assert_equal("Object", info.name)
65
+ end
66
+
67
+ def test_find_by_name
68
+ info = @repository.find("GObject", "Object")
69
+ assert_equal("Object", info.name)
70
+ end
71
+ end
@@ -0,0 +1,65 @@
1
+ # Copyright (C) 2012-2026 Ruby-GNOME Project Team
2
+ #
3
+ # This library is free software; you can redistribute it and/or
4
+ # modify it under the terms of the GNU Lesser General Public
5
+ # License as published by the Free Software Foundation; either
6
+ # version 2.1 of the License, or (at your option) any later version.
7
+ #
8
+ # This library is distributed in the hope that it will be useful,
9
+ # but WITHOUT ANY WARRANTY; without even the implied warranty of
10
+ # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
11
+ # Lesser General Public License for more details.
12
+ #
13
+ # You should have received a copy of the GNU Lesser General Public
14
+ # License along with this library; if not, write to the Free Software
15
+ # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
16
+
17
+ class TestTypeInfo < Test::Unit::TestCase
18
+ include GLibTestUtils
19
+
20
+ def setup
21
+ only_girepository
22
+ @repository = GLib::Repository.default
23
+ @repository.require("GObject")
24
+ @function_info = @repository.find("GObject", "signal_list_ids")
25
+ @info = @function_info.return_type
26
+ end
27
+
28
+ def test_pointer?
29
+ assert_true(@info.pointer?)
30
+ end
31
+
32
+ def test_tag
33
+ assert_kind_of(GLib::TypeTag,
34
+ @info.tag)
35
+ end
36
+
37
+ def test_param_type
38
+ assert_kind_of(GLib::TypeInfo,
39
+ @info.get_param_type(0))
40
+ end
41
+
42
+ def test_interface
43
+ function_info = @repository.find("Gio", "app_info_create_from_commandline")
44
+ info = function_info.return_type
45
+ assert_kind_of(GLib::InterfaceInfo,
46
+ info.interface)
47
+ end
48
+
49
+ def test_array_length_index
50
+ assert_equal(1, @info.array_length_index)
51
+ end
52
+
53
+ def test_array_fixed_size
54
+ assert_nil(@info.array_fixed_size)
55
+ end
56
+
57
+ def test_zero_terminated?
58
+ assert_false(@info.zero_terminated?)
59
+ end
60
+
61
+ def test_array_type
62
+ assert_equal(GLib::ArrayType::C,
63
+ @info.array_type)
64
+ end
65
+ end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: glib2
3
3
  version: !ruby/object:Gem::Version
4
- version: 4.3.7
4
+ version: 4.3.8
5
5
  platform: ruby
6
6
  authors:
7
7
  - The Ruby-GNOME Project Team
@@ -52,6 +52,14 @@ files:
52
52
  - ext/glib2/extconf.rb
53
53
  - ext/glib2/glib2.def
54
54
  - ext/glib2/rbgcompat.h
55
+ - ext/glib2/rbgi-arg-info.c
56
+ - ext/glib2/rbgi-base-info.c
57
+ - ext/glib2/rbgi-callable-info.c
58
+ - ext/glib2/rbgi-conversions.h
59
+ - ext/glib2/rbgi-interface-info.c
60
+ - ext/glib2/rbgi-private.h
61
+ - ext/glib2/rbgi-repository.c
62
+ - ext/glib2/rbgi-type-info.c
55
63
  - ext/glib2/rbglib-bytes.c
56
64
  - ext/glib2/rbglib-gc.c
57
65
  - ext/glib2/rbglib-option.c
@@ -131,11 +139,16 @@ files:
131
139
  - glib2.gemspec
132
140
  - lib/glib-mkenums.rb
133
141
  - lib/glib2.rb
142
+ - lib/glib2/callable-info.rb
143
+ - lib/glib2/collection-reader.rb
134
144
  - lib/glib2/date-time.rb
135
145
  - lib/glib2/deprecatable.rb
136
146
  - lib/glib2/deprecated.rb
147
+ - lib/glib2/interface-info.rb
137
148
  - lib/glib2/regex.rb
149
+ - lib/glib2/repository.rb
138
150
  - lib/glib2/time-zone.rb
151
+ - lib/glib2/type-info.rb
139
152
  - lib/glib2/value.rb
140
153
  - lib/glib2/variant-type.rb
141
154
  - lib/glib2/variant.rb
@@ -165,14 +178,18 @@ files:
165
178
  - sample/utils.rb
166
179
  - test/glib-test-utils.rb
167
180
  - test/run-test.rb
181
+ - test/test-arg-info.rb
182
+ - test/test-base-info.rb
168
183
  - test/test-binding.rb
169
184
  - test/test-bytes.rb
185
+ - test/test-callable-info.rb
170
186
  - test/test-date-time.rb
171
187
  - test/test-enum.rb
172
188
  - test/test-error.rb
173
189
  - test/test-file-utils.rb
174
190
  - test/test-flags.rb
175
191
  - test/test-glib2.rb
192
+ - test/test-interface-info.rb
176
193
  - test/test-iochannel.rb
177
194
  - test/test-key-file.rb
178
195
  - test/test-match-info.rb
@@ -181,11 +198,13 @@ files:
181
198
  - test/test-pointer.rb
182
199
  - test/test-poll-fd.rb
183
200
  - test/test-regex.rb
201
+ - test/test-repository.rb
184
202
  - test/test-signal.rb
185
203
  - test/test-source.rb
186
204
  - test/test-spawn.rb
187
205
  - test/test-time-zone.rb
188
206
  - test/test-timeout.rb
207
+ - test/test-type-info.rb
189
208
  - test/test-type-interface.rb
190
209
  - test/test-type.rb
191
210
  - test/test-unicode.rb
@@ -226,7 +245,7 @@ requirements:
226
245
  - 'system: gobject-2.0>=2.56.0: macports: glib2'
227
246
  - 'system: gobject-2.0>=2.56.0: msys2: glib2'
228
247
  - 'system: gobject-2.0>=2.56.0: rhel: pkgconfig(gobject-2.0)'
229
- rubygems_version: 4.0.10
248
+ rubygems_version: 4.0.16
230
249
  specification_version: 4
231
250
  summary: Ruby/GLib2 is a Ruby binding of GLib-2.x.
232
251
  test_files: []