pango 1.2.4 → 1.2.5

Sign up to get free protection for your applications and to get access to all the features.
@@ -51,8 +51,8 @@ pango_analysis_get_type(void)
51
51
  static VALUE
52
52
  rg_initialize(VALUE self)
53
53
  {
54
- PangoAnalysis ana = { NULL, NULL, NULL, 0, 0, 0, 0, NULL, NULL };
55
- G_INITIALIZE(self, &ana);
54
+ PangoAnalysis analysis = { NULL, NULL, NULL, 0, 0, 0, 0, NULL, NULL };
55
+ G_INITIALIZE(self, g_boxed_copy(PANGO_TYPE_ANALYSIS, &analysis));
56
56
  return Qnil;
57
57
  }
58
58
 
@@ -27,12 +27,13 @@
27
27
  static VALUE
28
28
  rg_initialize(VALUE self, VALUE red, VALUE green, VALUE blue)
29
29
  {
30
- PangoColor c;
31
- c.red = NUM2INT(red);
32
- c.green = NUM2INT(green);
33
- c.blue = NUM2INT(blue);
30
+ PangoColor color;
34
31
 
35
- G_INITIALIZE(self, &c);
32
+ color.red = NUM2UINT(red);
33
+ color.green = NUM2UINT(green);
34
+ color.blue = NUM2UINT(blue);
35
+
36
+ G_INITIALIZE(self, g_boxed_copy(PANGO_TYPE_COLOR, &color));
36
37
  return Qnil;
37
38
  }
38
39
 
@@ -45,39 +46,39 @@ rg_parse(VALUE self, VALUE spec)
45
46
  static VALUE
46
47
  rg_red(VALUE self)
47
48
  {
48
- return INT2FIX(_SELF(self)->red);
49
+ return UINT2NUM(_SELF(self)->red);
49
50
  }
50
51
 
51
52
  static VALUE
52
53
  rg_set_red(VALUE self, VALUE red)
53
54
  {
54
- _SELF(self)->red = NUM2INT(red);
55
+ _SELF(self)->red = NUM2UINT(red);
55
56
  return self;
56
57
  }
57
58
 
58
59
  static VALUE
59
60
  rg_green(VALUE self)
60
61
  {
61
- return INT2FIX(_SELF(self)->green);
62
+ return UINT2NUM(_SELF(self)->green);
62
63
  }
63
64
 
64
65
  static VALUE
65
66
  rg_set_green(VALUE self, VALUE green)
66
67
  {
67
- _SELF(self)->green = NUM2INT(green);
68
+ _SELF(self)->green = NUM2UINT(green);
68
69
  return self;
69
70
  }
70
71
 
71
72
  static VALUE
72
73
  rg_blue(VALUE self)
73
74
  {
74
- return INT2FIX(_SELF(self)->blue);
75
+ return UINT2NUM(_SELF(self)->blue);
75
76
  }
76
77
 
77
78
  static VALUE
78
79
  rg_set_blue(VALUE self, VALUE blue)
79
80
  {
80
- _SELF(self)->blue = NUM2INT(blue);
81
+ _SELF(self)->blue = NUM2UINT(blue);
81
82
  return self;
82
83
  }
83
84
 
@@ -85,8 +86,10 @@ static VALUE
85
86
  rg_to_a(VALUE self)
86
87
  {
87
88
  PangoColor *c = _SELF(self);
88
- return rb_ary_new3(3, INT2FIX(c->red),
89
- INT2FIX(c->green), INT2FIX(c->blue));
89
+ return rb_ary_new3(3,
90
+ UINT2NUM(c->red),
91
+ UINT2NUM(c->green),
92
+ UINT2NUM(c->blue));
90
93
  }
91
94
 
92
95
  static VALUE
@@ -1,6 +1,6 @@
1
1
  /* -*- c-file-style: "ruby"; indent-tabs-mode: nil -*- */
2
2
  /*
3
- * Copyright (C) 2011 Ruby-GNOME2 Project Team
3
+ * Copyright (C) 2011-2013 Ruby-GNOME2 Project Team
4
4
  * Copyright (C) 2002-2005 Masao Mutoh
5
5
  *
6
6
  * This library is free software; you can redistribute it and/or
@@ -39,7 +39,6 @@ rg_initialize(int argc, VALUE *argv, VALUE self)
39
39
  }
40
40
 
41
41
  G_INITIALIZE(self, description);
42
- pango_font_description_free(description);
43
42
 
44
43
  return Qnil;
45
44
  }
@@ -64,8 +64,9 @@ log_set_ ## name (VALUE self, VALUE val)\
64
64
  static VALUE
65
65
  rg_initialize(VALUE self)
66
66
  {
67
- PangoLogAttr log;
68
- G_INITIALIZE(self, &log);
67
+ PangoLogAttr attribute;
68
+ memset(&attribute, 0, sizeof(PangoLogAttr));
69
+ G_INITIALIZE(self, g_boxed_copy(PANGO_TYPE_LOG_ATTR, &attribute));
69
70
  return Qnil;
70
71
  }
71
72
 
@@ -59,7 +59,7 @@ rg_initialize(int argc, VALUE *argv, VALUE self)
59
59
  matrix.x0 = NUM2DBL(x0);
60
60
  matrix.y0 = NUM2DBL(y0);
61
61
  }
62
- G_INITIALIZE(self, &matrix);
62
+ G_INITIALIZE(self, g_boxed_copy(PANGO_TYPE_MATRIX, &matrix));
63
63
  return Qnil;
64
64
  }
65
65
 
@@ -51,14 +51,14 @@ pango_rectangle_get_type(void)
51
51
  static VALUE
52
52
  rg_initialize(VALUE self, VALUE x, VALUE y, VALUE width, VALUE height)
53
53
  {
54
- PangoRectangle new;
54
+ PangoRectangle rectangle;
55
55
 
56
- new.x = NUM2INT(x);
57
- new.y = NUM2INT(y);
58
- new.width = NUM2INT(width);
59
- new.height = NUM2INT(height);
56
+ rectangle.x = NUM2INT(x);
57
+ rectangle.y = NUM2INT(y);
58
+ rectangle.width = NUM2INT(width);
59
+ rectangle.height = NUM2INT(height);
60
60
 
61
- G_INITIALIZE(self, &new);
61
+ G_INITIALIZE(self, g_boxed_copy(PANGO_TYPE_RECTANGLE, &rectangle));
62
62
  return Qnil;
63
63
  }
64
64
 
@@ -0,0 +1,26 @@
1
+ # -*- coding: utf-8 -*-
2
+ #
3
+ # Copyright (C) 2013 Ruby-GNOME2 Project Team
4
+ #
5
+ # This library is free software; you can redistribute it and/or
6
+ # modify it under the terms of the GNU Lesser General Public
7
+ # License as published by the Free Software Foundation; either
8
+ # version 2.1 of the License, or (at your option) any later version.
9
+ #
10
+ # This library is distributed in the hope that it will be useful,
11
+ # but WITHOUT ANY WARRANTY; without even the implied warranty of
12
+ # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13
+ # Lesser General Public License for more details.
14
+ #
15
+ # You should have received a copy of the GNU Lesser General Public
16
+ # License along with this library; if not, write to the Free Software
17
+ # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
18
+
19
+ class TestPangoAnalysis < Test::Unit::TestCase
20
+ include PangoTestUtils
21
+
22
+ def test_level
23
+ analysis = Pango::Analysis.new
24
+ assert_equal(0, analysis.level)
25
+ end
26
+ end
@@ -0,0 +1,47 @@
1
+ # -*- coding: utf-8 -*-
2
+ #
3
+ # Copyright (C) 2013 Ruby-GNOME2 Project Team
4
+ #
5
+ # This library is free software; you can redistribute it and/or
6
+ # modify it under the terms of the GNU Lesser General Public
7
+ # License as published by the Free Software Foundation; either
8
+ # version 2.1 of the License, or (at your option) any later version.
9
+ #
10
+ # This library is distributed in the hope that it will be useful,
11
+ # but WITHOUT ANY WARRANTY; without even the implied warranty of
12
+ # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13
+ # Lesser General Public License for more details.
14
+ #
15
+ # You should have received a copy of the GNU Lesser General Public
16
+ # License along with this library; if not, write to the Free Software
17
+ # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
18
+
19
+ class TestPangoColor < Test::Unit::TestCase
20
+ include PangoTestUtils
21
+
22
+ def test_red
23
+ color = Pango::Color.new(0, 0, 0)
24
+ assert_equal(0, color.red)
25
+ color.red = 32768
26
+ assert_equal(32768, color.red)
27
+ end
28
+
29
+ def test_blue
30
+ color = Pango::Color.new(0, 0, 0)
31
+ assert_equal(0, color.blue)
32
+ color.blue = 32768
33
+ assert_equal(32768, color.blue)
34
+ end
35
+
36
+ def test_green
37
+ color = Pango::Color.new(0, 0, 0)
38
+ assert_equal(0, color.green)
39
+ color.green = 32768
40
+ assert_equal(32768, color.green)
41
+ end
42
+
43
+ def test_to_a
44
+ color = Pango::Color.new(65535, 32768, 0)
45
+ assert_equal([65535, 32768, 0], color.to_a)
46
+ end
47
+ end
@@ -0,0 +1,26 @@
1
+ # -*- coding: utf-8 -*-
2
+ #
3
+ # Copyright (C) 2013 Ruby-GNOME2 Project Team
4
+ #
5
+ # This library is free software; you can redistribute it and/or
6
+ # modify it under the terms of the GNU Lesser General Public
7
+ # License as published by the Free Software Foundation; either
8
+ # version 2.1 of the License, or (at your option) any later version.
9
+ #
10
+ # This library is distributed in the hope that it will be useful,
11
+ # but WITHOUT ANY WARRANTY; without even the implied warranty of
12
+ # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13
+ # Lesser General Public License for more details.
14
+ #
15
+ # You should have received a copy of the GNU Lesser General Public
16
+ # License along with this library; if not, write to the Free Software
17
+ # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
18
+
19
+ class TestPangoLogAttr < Test::Unit::TestCase
20
+ include PangoTestUtils
21
+
22
+ def test_line_break?
23
+ attribute = Pango::LogAttr.new
24
+ assert_false(attribute.line_break?)
25
+ end
26
+ end
@@ -0,0 +1,26 @@
1
+ # -*- coding: utf-8 -*-
2
+ #
3
+ # Copyright (C) 2013 Ruby-GNOME2 Project Team
4
+ #
5
+ # This library is free software; you can redistribute it and/or
6
+ # modify it under the terms of the GNU Lesser General Public
7
+ # License as published by the Free Software Foundation; either
8
+ # version 2.1 of the License, or (at your option) any later version.
9
+ #
10
+ # This library is distributed in the hope that it will be useful,
11
+ # but WITHOUT ANY WARRANTY; without even the implied warranty of
12
+ # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13
+ # Lesser General Public License for more details.
14
+ #
15
+ # You should have received a copy of the GNU Lesser General Public
16
+ # License along with this library; if not, write to the Free Software
17
+ # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
18
+
19
+ class TestPangoMatrix < Test::Unit::TestCase
20
+ include PangoTestUtils
21
+
22
+ def test_xx
23
+ matrix = Pango::Matrix.new
24
+ assert_equal(1.0, matrix.xx)
25
+ end
26
+ end
@@ -0,0 +1,26 @@
1
+ # -*- coding: utf-8 -*-
2
+ #
3
+ # Copyright (C) 2013 Ruby-GNOME2 Project Team
4
+ #
5
+ # This library is free software; you can redistribute it and/or
6
+ # modify it under the terms of the GNU Lesser General Public
7
+ # License as published by the Free Software Foundation; either
8
+ # version 2.1 of the License, or (at your option) any later version.
9
+ #
10
+ # This library is distributed in the hope that it will be useful,
11
+ # but WITHOUT ANY WARRANTY; without even the implied warranty of
12
+ # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13
+ # Lesser General Public License for more details.
14
+ #
15
+ # You should have received a copy of the GNU Lesser General Public
16
+ # License along with this library; if not, write to the Free Software
17
+ # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
18
+
19
+ class TestPangoRectangle < Test::Unit::TestCase
20
+ include PangoTestUtils
21
+
22
+ def test_width
23
+ rectangle = Pango::Rectangle.new(0, 10, 20, 30)
24
+ assert_equal(20, rectangle.width)
25
+ end
26
+ end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: pango
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.2.4
4
+ version: 1.2.5
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2013-03-24 00:00:00.000000000 Z
12
+ date: 2013-03-27 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: cairo
@@ -34,7 +34,7 @@ dependencies:
34
34
  requirements:
35
35
  - - ! '>='
36
36
  - !ruby/object:Gem::Version
37
- version: 1.2.4
37
+ version: 1.2.5
38
38
  type: :runtime
39
39
  prerelease: false
40
40
  version_requirements: !ruby/object:Gem::Requirement
@@ -42,7 +42,7 @@ dependencies:
42
42
  requirements:
43
43
  - - ! '>='
44
44
  - !ruby/object:Gem::Version
45
- version: 1.2.4
45
+ version: 1.2.5
46
46
  description: Ruby/Pango is a Ruby binding of pango-1.x.
47
47
  email: ruby-gnome2-devel-en@lists.sourceforge.net
48
48
  executables: []
@@ -108,8 +108,13 @@ files:
108
108
  - sample/script.rb
109
109
  - test/pango-test-utils.rb
110
110
  - test/run-test.rb
111
+ - test/test-analysis.rb
111
112
  - test/test-attribute.rb
113
+ - test/test-color.rb
112
114
  - test/test-language.rb
115
+ - test/test-log-attr.rb
116
+ - test/test-matrix.rb
117
+ - test/test-rectangle.rb
113
118
  - test/test_layout.rb
114
119
  homepage: http://ruby-gnome2.sourceforge.jp/
115
120
  licenses: []