[cairo-commit] rcairo/test test_text_to_glyphs_data.rb,NONE,1.1

Kouhei Sutou commit at pdx.freedesktop.org
Sat Aug 16 20:16:04 PDT 2008


Committed by: kou

Update of /cvs/cairo/rcairo/test
In directory kemper:/tmp/cvs-serv4319/test

Added Files:
	test_text_to_glyphs_data.rb 
Log Message:
        * src/rb_cairo_font_face.c: add
        Cairo::UserFontFace::TextToGlyphsData#need_backward?.

        * test/test_text_to_glyphs_data.rb: add tests for
        Cairo::UserFontFace::TextToGlyphsData.


--- NEW FILE: test_text_to_glyphs_data.rb ---
require 'cairo'

class TextToGlyphsDataTest < Test::Unit::TestCase
  include CairoTestUtils

  def test_new
    only_cairo_version(1, 7, 2)

    data = Cairo::UserFontFace::TextToGlyphsData.new(false, false, false)
    assert_equal([false, false, false],
                 [data.need_glyphs?, data.need_clusters?, data.need_backward?])

    data = Cairo::UserFontFace::TextToGlyphsData.new(true, false, false)
    assert_equal([true, false, false],
                 [data.need_glyphs?, data.need_clusters?, data.need_backward?])

    data = Cairo::UserFontFace::TextToGlyphsData.new(false, true, false)
    assert_equal([false, true, false],
                 [data.need_glyphs?, data.need_clusters?, data.need_backward?])

    data = Cairo::UserFontFace::TextToGlyphsData.new(false, false, true)
    assert_equal([false, false, true],
                 [data.need_glyphs?, data.need_clusters?, data.need_backward?])
  end

  def test_accessor
    only_cairo_version(1, 7, 2)

    data = Cairo::UserFontFace::TextToGlyphsData.new(true, true, true)
    assert_equal([nil, nil, false],
                 [data.glyphs, data.clusters, data.backward?])

    glyph = Cairo::Glyph.new(0, 5, 10)
    data.glyphs = [glyph]
    assert_equal([[glyph], nil, false],
                 [data.glyphs, data.clusters, data.backward?])

    cluster = Cairo::TextCluster.new(0, 1)
    data.clusters = [cluster]
    assert_equal([[glyph], [cluster], false],
                 [data.glyphs, data.clusters, data.backward?])

    data.backward = true
    assert_equal([[glyph], [cluster], true],
                 [data.glyphs, data.clusters, data.backward?])
  end
end



More information about the cairo-commit mailing list