[cairo-commit] rcairo/test test_font_extents.rb, NONE, 1.1 test_text_extents.rb, NONE, 1.1
Kouhei Sutou
commit at pdx.freedesktop.org
Sat Aug 16 22:41:30 PDT 2008
Committed by: kou
Update of /cvs/cairo/rcairo/test
In directory kemper:/tmp/cvs-serv17584/test
Added Files:
test_font_extents.rb test_text_extents.rb
Log Message:
* src/rb_cairo_text_extents.c: add Cairo::TextExtents#initialize
and setters.
* test/test_text_extents.rb: add.
--- NEW FILE: test_font_extents.rb ---
require 'cairo'
class FontExtentsTest < Test::Unit::TestCase
include CairoTestUtils
def test_new
extents = Cairo::FontExtents.new
assert_equal([1.0, 0.0, 1.0, 1.0, 0.0],
[extents.ascent, extents.descent, extents.height,
extents.max_x_advance, extents.max_y_advance])
end
def test_accessor
extents = Cairo::FontExtents.new
extents.ascent = 0.1
extents.descent = 0.2
extents.height = 0.3
extents.max_x_advance = 0.4
extents.max_y_advance = 0.5
assert_equal([0.1, 0.2, 0.3, 0.4, 0.5],
[extents.ascent, extents.descent, extents.height,
extents.max_x_advance, extents.max_y_advance])
end
def test_to_s
extents = Cairo::FontExtents.new
extents.ascent = 0.1
extents.descent = 0.2
extents.height = 0.3
extents.max_x_advance = 0.4
extents.max_y_advance = 0.5
assert_equal("#<Cairo::FontExtents: ascent=0.1, descent=0.2, " +
"height=0.3, max_x_advance=0.4, max_y_advance=0.5>",
extents.to_s)
end
end
--- NEW FILE: test_text_extents.rb ---
require 'cairo'
class TextExtentsTest < Test::Unit::TestCase
include CairoTestUtils
def test_new
extents = Cairo::TextExtents.new
assert_equal([0.0, -1.0, 0.0, 1.0, 1.0, 0.0],
[extents.x_bearing, extents.y_bearing,
extents.width, extents.height,
extents.x_advance, extents.y_advance])
end
def test_accessor
extents = Cairo::TextExtents.new
extents.x_bearing = 0.1
extents.y_bearing = 0.2
extents.width = 0.3
extents.height = 0.4
extents.x_advance = 0.5
extents.y_advance = 0.6
assert_equal([0.1, 0.2, 0.3, 0.4, 0.5, 0.6],
[extents.x_bearing, extents.y_bearing,
extents.width, extents.height,
extents.x_advance, extents.y_advance])
end
def test_to_s
extents = Cairo::TextExtents.new
extents.x_bearing = 0.1
extents.y_bearing = 0.2
extents.width = 0.3
extents.height = 0.4
extents.x_advance = 0.5
extents.y_advance = 0.6
assert_equal("#<Cairo::TextExtents: x_bearing=0.1, y_bearing=0.2, " +
"width=0.3, height=0.4, x_advance=0.5, y_advance=0.6>",
extents.to_s)
end
end
More information about the cairo-commit
mailing list