glib2 0.20.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (86) hide show
  1. data/ChangeLog +3023 -0
  2. data/README +28 -0
  3. data/Rakefile +87 -0
  4. data/extconf.rb +61 -0
  5. data/sample/bookmarkfile.rb +66 -0
  6. data/sample/completion.rb +45 -0
  7. data/sample/idle.rb +41 -0
  8. data/sample/iochannel.rb +44 -0
  9. data/sample/keyfile.rb +62 -0
  10. data/sample/shell.rb +36 -0
  11. data/sample/spawn.rb +25 -0
  12. data/sample/timeout.rb +28 -0
  13. data/sample/timeout2.rb +35 -0
  14. data/sample/timer.rb +40 -0
  15. data/sample/type-register.rb +103 -0
  16. data/sample/type-register2.rb +104 -0
  17. data/sample/utils.rb +54 -0
  18. data/src/glib-enum-types.c +1032 -0
  19. data/src/glib-enum-types.h +140 -0
  20. data/src/lib/glib-mkenums.rb +199 -0
  21. data/src/lib/glib2.rb +220 -0
  22. data/src/lib/mkmf-gnome2.rb +390 -0
  23. data/src/lib/pkg-config.rb +137 -0
  24. data/src/rbgcompat.h +30 -0
  25. data/src/rbglib.c +320 -0
  26. data/src/rbglib.h +96 -0
  27. data/src/rbglib_bookmarkfile.c +595 -0
  28. data/src/rbglib_completion.c +192 -0
  29. data/src/rbglib_convert.c +195 -0
  30. data/src/rbglib_error.c +95 -0
  31. data/src/rbglib_fileutils.c +83 -0
  32. data/src/rbglib_i18n.c +44 -0
  33. data/src/rbglib_int64.c +157 -0
  34. data/src/rbglib_iochannel.c +883 -0
  35. data/src/rbglib_keyfile.c +846 -0
  36. data/src/rbglib_maincontext.c +917 -0
  37. data/src/rbglib_mainloop.c +87 -0
  38. data/src/rbglib_messages.c +150 -0
  39. data/src/rbglib_pollfd.c +111 -0
  40. data/src/rbglib_shell.c +68 -0
  41. data/src/rbglib_source.c +190 -0
  42. data/src/rbglib_spawn.c +345 -0
  43. data/src/rbglib_threads.c +51 -0
  44. data/src/rbglib_timer.c +127 -0
  45. data/src/rbglib_unicode.c +611 -0
  46. data/src/rbglib_utils.c +386 -0
  47. data/src/rbglib_win32.c +136 -0
  48. data/src/rbgobj_boxed.c +251 -0
  49. data/src/rbgobj_closure.c +337 -0
  50. data/src/rbgobj_convert.c +167 -0
  51. data/src/rbgobj_enums.c +961 -0
  52. data/src/rbgobj_fundamental.c +30 -0
  53. data/src/rbgobj_object.c +892 -0
  54. data/src/rbgobj_param.c +390 -0
  55. data/src/rbgobj_paramspecs.c +305 -0
  56. data/src/rbgobj_signal.c +963 -0
  57. data/src/rbgobj_strv.c +61 -0
  58. data/src/rbgobj_type.c +851 -0
  59. data/src/rbgobj_typeinstance.c +121 -0
  60. data/src/rbgobj_typeinterface.c +148 -0
  61. data/src/rbgobj_typemodule.c +66 -0
  62. data/src/rbgobj_typeplugin.c +49 -0
  63. data/src/rbgobj_value.c +313 -0
  64. data/src/rbgobj_valuearray.c +59 -0
  65. data/src/rbgobj_valuetypes.c +298 -0
  66. data/src/rbgobject.c +406 -0
  67. data/src/rbgobject.h +265 -0
  68. data/src/rbgprivate.h +88 -0
  69. data/src/rbgutil.c +222 -0
  70. data/src/rbgutil.h +82 -0
  71. data/src/rbgutil_callback.c +231 -0
  72. data/test/glib-test-init.rb +6 -0
  73. data/test/glib-test-utils.rb +12 -0
  74. data/test/run-test.rb +25 -0
  75. data/test/test_enum.rb +99 -0
  76. data/test/test_file_utils.rb +15 -0
  77. data/test/test_glib2.rb +120 -0
  78. data/test/test_iochannel.rb +275 -0
  79. data/test/test_key_file.rb +38 -0
  80. data/test/test_mkenums.rb +25 -0
  81. data/test/test_signal.rb +20 -0
  82. data/test/test_timeout.rb +28 -0
  83. data/test/test_unicode.rb +369 -0
  84. data/test/test_utils.rb +37 -0
  85. data/test/test_win32.rb +13 -0
  86. metadata +165 -0
@@ -0,0 +1,25 @@
1
+ # -*- coding: utf-8 -*-
2
+
3
+ require 'glib-mkenums'
4
+
5
+ class TestGLibMkEnums < Test::Unit::TestCase
6
+ def test_parse_flags
7
+ source = <<-EOS
8
+ G_MARKUP_COLLECT_INVALID,
9
+ G_MARKUP_COLLECT_STRING,
10
+ G_MARKUP_COLLECT_STRDUP,
11
+ G_MARKUP_COLLECT_BOOLEAN,
12
+ G_MARKUP_COLLECT_TRISTATE,
13
+
14
+ G_MARKUP_COLLECT_OPTIONAL = (1 << 16)
15
+ EOS
16
+ enum = GLib::EnumDefinition.new("GMarkupCollectType", source, 'G_TYPE_')
17
+ assert_equal([["G_MARKUP_COLLECT_INVALID", "invalid"],
18
+ ["G_MARKUP_COLLECT_STRING", "string"],
19
+ ["G_MARKUP_COLLECT_STRDUP", "strdup"],
20
+ ["G_MARKUP_COLLECT_BOOLEAN", "boolean"],
21
+ ["G_MARKUP_COLLECT_TRISTATE", "tristate"],
22
+ ["G_MARKUP_COLLECT_OPTIONAL", "optional"]],
23
+ enum.constants)
24
+ end
25
+ end
@@ -0,0 +1,20 @@
1
+ # -*- coding: utf-8 -*-
2
+
3
+ class TestSignal < Test::Unit::TestCase
4
+ def test_signal_flags
5
+ assert_const_defined(GLib, :SignalFlags)
6
+ assert_kind_of(GLib::SignalFlags, GLib::Signal::RUN_FIRST)
7
+ assert_equal(GLib::SignalFlags::MASK, GLib::Signal::FLAGS_MASK)
8
+ end
9
+
10
+ def test_connect_flags
11
+ assert_const_defined(GLib, :ConnectFlags)
12
+ assert_kind_of(GLib::ConnectFlags, GLib::Signal::CONNECT_AFTER)
13
+ end
14
+
15
+ def test_signal_match_type
16
+ assert_const_defined(GLib, :SignalMatchType)
17
+ assert_kind_of(GLib::SignalMatchType, GLib::Signal::MATCH_ID)
18
+ assert_equal(GLib::SignalMatchType::MASK, GLib::Signal::MATCH_MASK)
19
+ end
20
+ end
@@ -0,0 +1,28 @@
1
+ # -*- coding: utf-8 -*-
2
+
3
+ class TestGLibTimeout < Test::Unit::TestCase
4
+ include GLibTestUtils
5
+
6
+ def setup
7
+ @id = nil
8
+ end
9
+
10
+ def teardown
11
+ GLib::Source.remove(@id) if @id
12
+ end
13
+
14
+ def test_timeout_add_priority
15
+ priority = GLib::PRIORITY_HIGH
16
+ @id = GLib::Timeout.add(10, priority)
17
+ source = GLib::MainContext.default.find_source(@id)
18
+ assert_equal(priority, source.priority)
19
+ end
20
+
21
+ def test_timeout_add_seconds_priority
22
+ only_glib_version(2, 14, 0)
23
+ priority = GLib::PRIORITY_HIGH
24
+ @id = GLib::Timeout.add_seconds(10, priority)
25
+ source = GLib::MainContext.default.find_source(@id)
26
+ assert_equal(priority, source.priority)
27
+ end
28
+ end
@@ -0,0 +1,369 @@
1
+ # -*- coding: utf-8 -*-
2
+
3
+ class TestGLibUnicode < Test::Unit::TestCase
4
+ include GLibTestUtils
5
+
6
+ def test_gunicode_type
7
+ assert_nothing_raised do
8
+ GLib::Unicode::CONTROL
9
+ end
10
+ end
11
+
12
+ def test_gunicode_break_type
13
+ assert_nothing_raised do
14
+ GLib::Unicode::BREAK_MANDATORY
15
+ end
16
+ end
17
+
18
+ def test_unichar_alnum?
19
+ assert(GLib::UniChar.alnum?(unichar("a")))
20
+ assert(GLib::UniChar.alnum?(unichar("1")))
21
+ assert(!GLib::UniChar.alnum?(unichar("!")))
22
+ end
23
+
24
+ def test_unichar_alpha?
25
+ assert(GLib::UniChar.alpha?(unichar("a")))
26
+ assert(GLib::UniChar.alpha?(unichar("A")))
27
+ assert(!GLib::UniChar.alpha?(unichar("1")))
28
+ end
29
+
30
+ def test_unichar_cntrl?
31
+ assert(GLib::UniChar.cntrl?(unichar("\t")))
32
+ assert(!GLib::UniChar.cntrl?(unichar("\h")))
33
+ assert(!GLib::UniChar.cntrl?(unichar("a")))
34
+ assert(!GLib::UniChar.cntrl?(unichar("1")))
35
+ end
36
+
37
+ def test_unichar_digit?
38
+ assert(GLib::UniChar.digit?(unichar("1")))
39
+ assert(!GLib::UniChar.digit?(unichar("a")))
40
+ end
41
+
42
+ def test_unichar_graph?
43
+ assert(GLib::UniChar.graph?(unichar("a")))
44
+ assert(!GLib::UniChar.graph?(unichar(" ")))
45
+ assert(!GLib::UniChar.graph?(unichar("\t")))
46
+ end
47
+
48
+ def test_unichar_lower?
49
+ assert(GLib::UniChar.lower?(unichar("a")))
50
+ assert(!GLib::UniChar.lower?(unichar("A")))
51
+ assert(!GLib::UniChar.lower?(unichar("1")))
52
+ end
53
+
54
+ def test_unichar_print?
55
+ assert(GLib::UniChar.print?(unichar("a")))
56
+ assert(GLib::UniChar.print?(unichar(" ")))
57
+ assert(!GLib::UniChar.print?(unichar("\t")))
58
+ end
59
+
60
+ def test_unichar_punct?
61
+ assert(GLib::UniChar.punct?(unichar(",")))
62
+ assert(GLib::UniChar.punct?(unichar(".")))
63
+ assert(!GLib::UniChar.punct?(unichar("a")))
64
+ assert(!GLib::UniChar.punct?(unichar("\t")))
65
+ end
66
+
67
+ def test_unichar_space?
68
+ assert(GLib::UniChar.space?(unichar(" ")))
69
+ assert(GLib::UniChar.space?(unichar("\t")))
70
+ assert(GLib::UniChar.space?(unichar("\r")))
71
+ assert(GLib::UniChar.space?(unichar("\n")))
72
+ assert(!GLib::UniChar.space?(unichar("a")))
73
+ end
74
+
75
+ def test_unichar_upper?
76
+ assert(GLib::UniChar.upper?(unichar("A")))
77
+ assert(!GLib::UniChar.upper?(unichar("a")))
78
+ assert(!GLib::UniChar.upper?(unichar("1")))
79
+ end
80
+
81
+ def test_unichar_xdigit?
82
+ assert(GLib::UniChar.xdigit?(unichar("1")))
83
+ assert(GLib::UniChar.xdigit?(unichar("a")))
84
+ assert(GLib::UniChar.xdigit?(unichar("A")))
85
+ assert(GLib::UniChar.xdigit?(unichar("F")))
86
+ assert(!GLib::UniChar.xdigit?(unichar("X")))
87
+ end
88
+
89
+ def test_unichar_title?
90
+ end
91
+
92
+ def test_unichar_defined?
93
+ end
94
+
95
+ def test_unichar_wide?
96
+ assert(GLib::UniChar.wide?(unichar("あ")))
97
+ assert(GLib::UniChar.wide?(unichar("A")))
98
+ assert(!GLib::UniChar.wide?(unichar("a")))
99
+ end
100
+
101
+ def test_unichar_wide_cjk?
102
+ only_glib_version(2, 12, 0)
103
+ assert(GLib::UniChar.wide_cjk?(unichar("あ")))
104
+ assert(GLib::UniChar.wide_cjk?(0xD55C)) # HANGUL SYLLABLE HAN
105
+ assert(!GLib::UniChar.wide_cjk?(unichar("a")))
106
+ end
107
+
108
+ def test_unichar_to_upper
109
+ assert_equal(unichar("A"), GLib::UniChar.to_upper(unichar("a")))
110
+ assert_equal(unichar("A"), GLib::UniChar.to_upper(unichar("A")))
111
+ assert_equal(unichar("*"), GLib::UniChar.to_title(unichar("*")))
112
+ end
113
+
114
+ def test_unichar_to_lower
115
+ assert_equal(unichar("a"), GLib::UniChar.to_lower(unichar("A")))
116
+ assert_equal(unichar("a"), GLib::UniChar.to_lower(unichar("a")))
117
+ assert_equal(unichar("*"), GLib::UniChar.to_title(unichar("*")))
118
+ end
119
+
120
+ def test_unichar_to_title
121
+ assert_equal(unichar("A"), GLib::UniChar.to_title(unichar("a")))
122
+ assert_equal(unichar("A"), GLib::UniChar.to_title(unichar("A")))
123
+ assert_equal(unichar("*"), GLib::UniChar.to_title(unichar("*")))
124
+ end
125
+
126
+ def test_unichar_digit_value
127
+ assert_equal(0, GLib::UniChar.digit_value(unichar("0")))
128
+ assert_equal(9, GLib::UniChar.digit_value(unichar("9")))
129
+ assert_equal(-1, GLib::UniChar.digit_value(unichar("a")))
130
+ end
131
+
132
+ def test_unichar_xdigit_value
133
+ assert_equal(0, GLib::UniChar.xdigit_value(unichar("0")))
134
+ assert_equal(9, GLib::UniChar.xdigit_value(unichar("9")))
135
+ assert_equal(10, GLib::UniChar.xdigit_value(unichar("a")))
136
+ assert_equal(15, GLib::UniChar.xdigit_value(unichar("F")))
137
+ assert_equal(-1, GLib::UniChar.xdigit_value(unichar("g")))
138
+ end
139
+
140
+ def test_unichar_type
141
+ assert_equal(GLib::Unicode::DECIMAL_NUMBER,
142
+ GLib::UniChar.type(unichar("0")))
143
+ assert_equal(GLib::Unicode::LOWERCASE_LETTER,
144
+ GLib::UniChar.type(unichar("a")))
145
+ assert_equal(GLib::Unicode::UPPERCASE_LETTER,
146
+ GLib::UniChar.type(unichar("A")))
147
+ end
148
+
149
+ def test_unichar_break_type
150
+ assert_equal(GLib::Unicode::BREAK_HYPHEN,
151
+ GLib::UniChar.break_type(unichar("-")))
152
+ assert_equal(GLib::Unicode::BREAK_NUMERIC,
153
+ GLib::UniChar.break_type(unichar("0")))
154
+ end
155
+
156
+ def test_unicode_canonical_ordering
157
+ require_uconv
158
+ original = [unichar("a"), 0x0308, 0x0323,
159
+ unichar("e"), 0x0304, 0x0301, 0x0323].pack("U*")
160
+ expected = [unichar("a"), 0x0323, 0x0308,
161
+ unichar("e"), 0x0323, 0x0304, 0x0301].pack("U*")
162
+ assert_equal(Uconv.u8tou4(expected),
163
+ GLib::Unicode.canonical_ordering(Uconv.u8tou4(original)))
164
+ end
165
+
166
+ def test_unicode_canonical_decomposition
167
+ require_uconv
168
+ a_with_acute = 0x00E1
169
+ expected = [unichar("a"), 0x0301].pack("U*")
170
+ assert_equal(Uconv.u8tou4(expected),
171
+ GLib::Unicode.canonical_decomposition(a_with_acute))
172
+
173
+ hiragana_ga = 0x304C
174
+ hiragana_ka = 0x304B
175
+ expected = [hiragana_ka, 0x3099].pack("U*")
176
+ assert_equal(Uconv.u8tou4(expected),
177
+ GLib::Unicode.canonical_decomposition(hiragana_ga))
178
+ end
179
+
180
+ def test_unichar_get_mirror_char
181
+ assert_equal(unichar("("), GLib::UniChar.get_mirror_char(unichar(")")))
182
+ assert_equal(unichar(")"), GLib::UniChar.get_mirror_char(unichar("(")))
183
+ assert_equal(unichar("x"), GLib::UniChar.get_mirror_char(unichar("x")))
184
+ end
185
+
186
+ def test_unichar_get_script
187
+ only_glib_version(2, 14, 0)
188
+ assert_equal(GLib::Unicode::SCRIPT_HIRAGANA,
189
+ GLib::UniChar.get_script(unichar("あ")))
190
+ end
191
+
192
+ def test_utf8_get_char
193
+ require_uconv
194
+ assert_equal(Uconv.u8tou4("あ").unpack("L*")[0],
195
+ GLib::UTF8.get_char("あ"))
196
+
197
+ assert_equal(Uconv.u8tou4("あ").unpack("L*")[0],
198
+ GLib::UTF8.get_char("あ", true))
199
+ partial_input = "あ".unpack("c*")[0..-2].pack("c*")
200
+ assert_equal(-2, GLib::UTF8.get_char(partial_input, true))
201
+ invalid_input = "あ".unpack("c*")[2..-1].pack("c*")
202
+ assert_equal(-1, GLib::UTF8.get_char(invalid_input, true))
203
+ end
204
+
205
+ def test_utf8_size
206
+ assert_equal(1, GLib::UTF8.size("あ"))
207
+ assert_equal(2, GLib::UTF8.size("あい"))
208
+ end
209
+
210
+ def test_utf8_reverse
211
+ assert_equal("おえういあ", GLib::UTF8.reverse("あいうえお"))
212
+ end
213
+
214
+ def test_utf8_validate
215
+ assert(GLib::UTF8.validate("あ"))
216
+ assert(!GLib::UTF8.validate("あ"[1..-1]))
217
+ end
218
+
219
+ def test_utf8_upcase
220
+ assert_equal("ABCあいう", GLib::UTF8.upcase("aBcあいう"))
221
+ end
222
+
223
+ def test_utf8_downcase
224
+ assert_equal("abcあいう", GLib::UTF8.downcase("aBcあいう"))
225
+ end
226
+
227
+ def test_utf8_casefold
228
+ assert_equal(GLib::UTF8.casefold("AbCあいう"),
229
+ GLib::UTF8.casefold("aBcあいう"))
230
+ end
231
+
232
+ def test_utf8_normalize
233
+ original = [0x00c1].pack("U*") # A with acute
234
+
235
+ nfd = [0x0041, 0x0301].pack("U*")
236
+ assert_equal(nfd,
237
+ GLib::UTF8.normalize(original, GLib::NormalizeMode::NFD))
238
+
239
+ nfc = [0x00c1].pack("U*")
240
+ assert_equal(nfc,
241
+ GLib::UTF8.normalize(original, GLib::NormalizeMode::NFC))
242
+
243
+ nfkd = [0x0041, 0x0301].pack("U*")
244
+ assert_equal(nfkd,
245
+ GLib::UTF8.normalize(original, GLib::NormalizeMode::NFKD))
246
+
247
+ nfkc = [0x00c1].pack("U*")
248
+ assert_equal(nfkc,
249
+ GLib::UTF8.normalize(original, GLib::NormalizeMode::NFKC))
250
+ end
251
+
252
+ def test_utf8_collate
253
+ only_glib_version(2, 16, 0)
254
+ require_uconv
255
+ assert_operator(0, :>, GLib::UTF8.collate("あ", "い"))
256
+ assert_operator(0, :<, GLib::UTF8.collate("い", "あ"))
257
+ assert_equal(0, GLib::UTF8.collate("あ", "あ"))
258
+ end
259
+
260
+ def test_utf8_collate_key
261
+ only_glib_version(2, 16, 0)
262
+ require_uconv
263
+ assert_operator(0, :>,
264
+ GLib::UTF8.collate_key("あ") <=>
265
+ GLib::UTF8.collate_key("い"))
266
+ assert_operator(0, :<,
267
+ GLib::UTF8.collate_key("い") <=>
268
+ GLib::UTF8.collate_key("あ"))
269
+ assert_equal(0,
270
+ GLib::UTF8.collate_key("あ") <=>
271
+ GLib::UTF8.collate_key("あ"))
272
+ end
273
+
274
+ def test_utf8_collate_key_for_filename
275
+ assert_equal(["event.c", "event.h", "eventgenerator.c"],
276
+ ["event.c", "eventgenerator.c", "event.h"].sort_by do |f|
277
+ GLib::UTF8.collate_key(f, true)
278
+ end)
279
+
280
+ assert_equal(["file1", "file5", "file10"],
281
+ ["file1", "file10", "file5"].sort_by do |f|
282
+ GLib::UTF8.collate_key(f, true)
283
+ end)
284
+ end
285
+
286
+ def test_utf8_to_utf16
287
+ require_uconv
288
+ assert_equal(Uconv.u8tou16("あいうえお"),
289
+ GLib::UTF8.to_utf16("あいうえお"))
290
+ end
291
+
292
+ def test_utf8_to_ucs4
293
+ require_uconv
294
+ assert_equal(Uconv.u8tou4("あいうえお"),
295
+ GLib::UTF8.to_ucs4("あいうえお"))
296
+
297
+ assert_raise(GLib::ConvertError) do
298
+ GLib::UTF8.to_ucs4("あいうえお"[1..-1])
299
+ end
300
+ assert_nothing_raised do
301
+ GLib::UTF8.to_ucs4("あいうえお"[1..-1], true)
302
+ end
303
+ end
304
+
305
+ def test_utf16_to_ucs4
306
+ require_uconv
307
+ assert_equal(Uconv.u8tou4("あいうえお"),
308
+ GLib::UTF16.to_ucs4(Uconv.u8tou16("あいうえお")))
309
+ end
310
+
311
+ def test_utf16_to_utf8
312
+ require_uconv
313
+ assert_equal("あいうえお",
314
+ GLib::UTF16.to_utf8(Uconv.u8tou16("あいうえお")))
315
+ end
316
+
317
+
318
+ def test_ucs4_to_utf16
319
+ require_uconv
320
+ assert_equal(Uconv.u8tou16("あいうえお"),
321
+ GLib::UCS4.to_utf16(Uconv.u8tou4("あいうえお")))
322
+
323
+ assert_raise(GLib::ConvertError) do
324
+ GLib::UCS4.to_utf16(Uconv.u8tou4("あいうえお")[1..-1])
325
+ end
326
+ end
327
+
328
+ def test_ucs4_to_utf8
329
+ require_uconv
330
+ assert_equal("あいうえお",
331
+ GLib::UCS4.to_utf8(Uconv.u8tou4("あいうえお")))
332
+ end
333
+
334
+ def test_unichar_to_utf8
335
+ require_uconv
336
+ assert_equal("あ",
337
+ GLib::UniChar.to_utf8(Uconv.u8tou4("あ").unpack("L*")[0]))
338
+ end
339
+
340
+ def test_unichar_combining_class
341
+ only_glib_version(2, 14, 0)
342
+ assert_equal(0, GLib::UniChar.combining_class(unichar("a")))
343
+ assert_equal(230, GLib::UniChar.combining_class(unichar("́")))
344
+ end
345
+
346
+ def test_unichar_mark?
347
+ only_glib_version(2, 14, 0)
348
+ assert(!GLib::UniChar.mark?(unichar("a")))
349
+ assert(!GLib::UniChar.mark?(0x200E)) # LEFT-TO-RIGHT MARK
350
+ assert(GLib::UniChar.mark?(0x1DC3)) # COMBINING SUSPENSION MARK
351
+ end
352
+
353
+ def test_unichar_zero_width?
354
+ only_glib_version(2, 14, 0)
355
+ assert(!GLib::UniChar.zero_width?(unichar("a")))
356
+ assert(GLib::UniChar.zero_width?(0x200B)) # ZERO WIDTH SPACE
357
+ end
358
+
359
+ private
360
+ def unichar(char)
361
+ GLib::UTF8.get_char(char)
362
+ end
363
+
364
+ def require_uconv
365
+ require 'uconv'
366
+ rescue LoadError
367
+ omit("Need uconv to run this test.")
368
+ end
369
+ end
@@ -0,0 +1,37 @@
1
+ # -*- coding: utf-8 -*-
2
+
3
+ class TestGLibUtils < Test::Unit::TestCase
4
+ include GLibTestUtils
5
+
6
+ def test_user_cache_dir
7
+ only_glib_version(2, 6, 0)
8
+ assert_kind_of(String, GLib.user_cache_dir)
9
+ end
10
+
11
+ def test_user_data_dir
12
+ only_glib_version(2, 6, 0)
13
+ assert_kind_of(String, GLib.user_data_dir)
14
+ end
15
+
16
+ def test_user_config_dir
17
+ only_glib_version(2, 6, 0)
18
+ assert_kind_of(String, GLib.user_config_dir)
19
+ end
20
+
21
+ def test_system_data_dirs
22
+ only_glib_version(2, 6, 0)
23
+ assert_kind_of(Array, GLib.system_data_dirs)
24
+ end
25
+
26
+ def test_system_config_dirs
27
+ only_glib_version(2, 6, 0)
28
+ assert_kind_of(Array, GLib.system_config_dirs)
29
+ end
30
+
31
+ def test_get_user_special_dir
32
+ only_glib_version(2, 14, 0)
33
+ assert_nothing_raised do
34
+ GLib.get_user_special_dir(GLib::UserDirectory::DESKTOP)
35
+ end
36
+ end
37
+ end