glib2 2.2.5 → 3.0.1

Sign up to get free protection for your applications and to get access to all the features.
@@ -36,11 +36,11 @@ class TestEnum < Test::Unit::TestCase
36
36
  assert_key_file_load(GLib::KeyFile::KEEP_COMMENTS, "KEEP_COMMENTS")
37
37
  assert_key_file_load(GLib::KeyFile::KEEP_COMMENTS, "keep COMMENTS")
38
38
 
39
- assert_raise(TypeError) do
39
+ assert_raise(ArgumentError) do
40
40
  assert_key_file_load(GLib::KeyFile::KEEP_COMMENTS, :unknown)
41
41
  end
42
42
 
43
- assert_raise(TypeError) do
43
+ assert_raise(ArgumentError) do
44
44
  assert_key_file_load(GLib::KeyFile::KEEP_COMMENTS, "UNKNOWN")
45
45
  end
46
46
  end
@@ -58,12 +58,9 @@ class TestEnum < Test::Unit::TestCase
58
58
  assert_key_file_load(GLib::KeyFile::KEEP_COMMENTS |
59
59
  GLib::KeyFile::KEEP_TRANSLATIONS,
60
60
  [:keep_comments, GLib::KeyFile::KEEP_TRANSLATIONS])
61
-
62
- assert_raise(TypeError) do
63
- assert_key_file_load(GLib::KeyFile::KEEP_COMMENTS |
64
- GLib::KeyFile::KEEP_TRANSLATIONS,
65
- [:keep_comments, nil, :keep_translations])
66
- end
61
+ assert_key_file_load(GLib::KeyFile::KEEP_COMMENTS |
62
+ GLib::KeyFile::KEEP_TRANSLATIONS,
63
+ [:keep_comments, nil, :keep_translations])
67
64
  end
68
65
 
69
66
  def test_flags_or
@@ -3,14 +3,31 @@
3
3
  class TestGLibFileUtils < Test::Unit::TestCase
4
4
  include GLibTestUtils
5
5
 
6
- def test_format_size_for_display
7
- only_glib_version(2, 16, 0)
8
-
9
- assert_equal("1.0 KB", GLib.format_size_for_display(1024))
10
- assert_equal("10.0 KB", GLib.format_size_for_display(1024 * 10))
11
- assert_equal("1.0 MB", GLib.format_size_for_display(1024 * 1024))
12
- assert_equal("1.5 MB", GLib.format_size_for_display(1024 * 1024 * 1.5))
13
- assert_equal("1.0 GB", GLib.format_size_for_display(1024 * 1024 * 1024))
6
+ sub_test_case "#format_size_for_display" do
7
+ def setup
8
+ only_glib_version(2, 16, 0)
9
+ end
10
+
11
+ def test_kb
12
+ assert_equal("1.0 KB", GLib.format_size_for_display(1024))
13
+ end
14
+
15
+ def test_10kb
16
+ assert_equal("10.0 KB", GLib.format_size_for_display(1024 * 10))
17
+ end
18
+
19
+ def test_mb
20
+ assert_equal("1.0 MB", GLib.format_size_for_display(1024 * 1024))
21
+ end
22
+
23
+ def test_gb
24
+ assert_equal("1.0 GB", GLib.format_size_for_display(1024 * 1024 * 1024))
25
+ end
26
+
27
+ def test_over_guint32_value
28
+ guint32_max = 2 ** 32 - 1
29
+ assert_equal("4.0 GB", GLib.format_size_for_display(guint32_max + 1))
30
+ end
14
31
  end
15
32
 
16
33
  sub_test_case "#format_size" do
@@ -30,6 +47,11 @@ class TestGLibFileUtils < Test::Unit::TestCase
30
47
  assert_equal("1.0 GB", GLib.format_size(1000 * 1000 * 1000))
31
48
  end
32
49
 
50
+ def test_over_guint32_value
51
+ guint32_max = 2 ** 32 - 1
52
+ assert_equal("4.3 GB", GLib.format_size(guint32_max + 1))
53
+ end
54
+
33
55
  sub_test_case "flags" do
34
56
  sub_test_case ":iec_units" do
35
57
  def format_size(size)
@@ -32,12 +32,23 @@ class TestGLibSource < Test::Unit::TestCase
32
32
  end
33
33
 
34
34
  def test_destroy
35
+ # only_glib_version(2, 35, 4)
36
+ # GMainContext may be freed before GSource by Ruby's GC.
37
+ # If GMainContext is freed before GSource, GLib 2.35.3 or earlier is
38
+ # crashed.
39
+ #
40
+ # See also:
41
+ # * https://bugzilla.gnome.org/show_bug.cgi?id=661767
42
+ # * https://git.gnome.org/browse/glib/commit/?id=26056558be4656ee6e891a4fae5d4198de7519cf
43
+
35
44
  context = GLib::MainContext.new
36
45
  source = GLib::Idle.source_new
37
46
  id = source.attach(context)
38
47
  assert_not_nil(context.find_source(id))
39
48
  source.destroy
40
49
  assert_nil(context.find_source(id))
50
+ source = nil
51
+ GC.start
41
52
  end
42
53
 
43
54
  def test_name
@@ -28,4 +28,9 @@ class TestGLibValue < Test::Unit::TestCase
28
28
  value = GLib::Value.new(GLib::Type::UINT, 29)
29
29
  assert_equal(29, value.value)
30
30
  end
31
+
32
+ def test_no_value
33
+ value = GLib::Value.new(GLib::Type::UINT)
34
+ assert_equal(0, value.value)
35
+ end
31
36
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: glib2
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.2.5
4
+ version: 3.0.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - The Ruby-GNOME2 Project Team
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-04-24 00:00:00.000000000 Z
11
+ date: 2015-09-11 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: pkg-config
@@ -45,7 +45,6 @@ extensions:
45
45
  - ext/glib2/extconf.rb
46
46
  extra_rdoc_files: []
47
47
  files:
48
- - README
49
48
  - Rakefile
50
49
  - ext/glib2/depend
51
50
  - ext/glib2/extconf.rb
@@ -53,6 +52,8 @@ files:
53
52
  - ext/glib2/glib-enum-types.h
54
53
  - ext/glib2/glib2.def
55
54
  - ext/glib2/rbgcompat.h
55
+ - ext/glib2/rbglib-variant-type.c
56
+ - ext/glib2/rbglib-variant.c
56
57
  - ext/glib2/rbglib.c
57
58
  - ext/glib2/rbglib.h
58
59
  - ext/glib2/rbglib2conversions.h
@@ -88,6 +89,7 @@ files:
88
89
  - ext/glib2/rbglib_win32.c
89
90
  - ext/glib2/rbglibdeprecated.c
90
91
  - ext/glib2/rbglibdeprecated.h
92
+ - ext/glib2/rbgobj_binding.c
91
93
  - ext/glib2/rbgobj_boxed.c
92
94
  - ext/glib2/rbgobj_closure.c
93
95
  - ext/glib2/rbgobj_convert.c
@@ -145,6 +147,8 @@ files:
145
147
  - test/glib-test-init.rb
146
148
  - test/glib-test-utils.rb
147
149
  - test/run-test.rb
150
+ - test/test-binding.rb
151
+ - test/test-variant-type.rb
148
152
  - test/test_enum.rb
149
153
  - test/test_file_utils.rb
150
154
  - test/test_flags.rb
data/README DELETED
@@ -1,40 +0,0 @@
1
- Ruby/GLib2
2
- ==========
3
- Ruby/GLib2 is a Ruby binding of GLib-2.12.x.
4
-
5
- Requirements
6
- ------------
7
-
8
- Ruby >= 1.9.x: http://www.ruby-lang.org/
9
- pkg-config.rb: http://github.com/rcairo/pkg-config
10
- GLib >= 2.12.x: http://www.gtk.org/
11
-
12
- Install (RubyGems)
13
- ------------------
14
-
15
- % sudo gem install glib2
16
-
17
- Windows:
18
-
19
- > gem install glib2 --platform x86-mingw32
20
-
21
- Install (traditional)
22
- ---------------------
23
-
24
- Install ruby-1.9.x or later, pkg-config.rb and GLib-2.12.x.
25
-
26
- % ruby extconf.rb
27
- % make
28
- % sudo make install
29
-
30
- Copying
31
- -------
32
- Copyright (c) 2002-2010 Ruby-GNOME2 Project Team
33
-
34
- This program is free software.
35
- You can distribute/modify this program under the terms of
36
- the GNU LESSER GENERAL PUBLIC LICENSE Version 2.1.
37
-
38
- Project Website
39
- ---------------
40
- http://ruby-gnome2.sourceforge.jp/