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

Kouhei Sutou commit at pdx.freedesktop.org
Thu Jun 19 19:08:49 PDT 2008


Committed by: kou

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

Added Files:
	test_surface.rb 
Log Message:
* test/test_surface.rb: add.


--- NEW FILE: test_surface.rb ---
require 'cairo'
require 'stringio'

class SurfaceTest < Test::Unit::TestCase
  def test_new
    output = StringIO.new
    surface = Cairo::PDFSurface.new(output, 10, 10)
    assert_no_match(/%%EOF\s*\z/m, output.string)
    surface.finish
    assert_match(/%%EOF\s*\z/m, output.string)
  end

  def test_new_with_block
    output = StringIO.new
    Cairo::PDFSurface.new(output, 10, 10) do |surface|
      assert_no_match(/%%EOF\s*\z/m, output.string)
    end
    assert_match(/%%EOF\s*\z/m, output.string)
  end

  def test_new_with_block_and_finish
    assert_nothing_raised do
      Cairo::PDFSurface.new(StringIO.new, 10, 10) do |surface|
        surface.finish
      end
    end
  end
end



More information about the cairo-commit mailing list