Sha256: a29f72e454972aea2f13b477bb5abc312ae463ee8771d46601613d3cc69fa9d4

Contents?: true

Size: 1007 Bytes

Versions: 12

Compression:

Stored size: 1007 Bytes

Contents

require 'cairo'
require 'stringio'

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

  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

  def test_fallback_resolution
    only_cairo_version(1, 7, 2)

    surface = Cairo::ImageSurface.new(100, 100)

    assert_equal([300.0, 300.0], surface.fallback_resolution)

    surface.set_fallback_resolution(95, 95)
    assert_equal([95.0, 95.0], surface.fallback_resolution)
  end
end

Version data entries

12 entries across 12 versions & 1 rubygems

Version Path
cairo-1.8.5-x86-mingw32 test/test_surface.rb
cairo-1.8.5 test/test_surface.rb
cairo-1.8.4 test/test_surface.rb
cairo-1.8.4-x86-mingw32 test/test_surface.rb
cairo-1.8.3-x86-mingw32 test/test_surface.rb
cairo-1.8.3 test/test_surface.rb
cairo-1.8.1-x86-mswin32 test/test_surface.rb
cairo-1.8.1 test/test_surface.rb
cairo-1.8.0-x86-mswin32 test/test_surface.rb
cairo-1.7.0-x86-mswin32 test/test_surface.rb
cairo-1.7.0 test/test_surface.rb
cairo-1.8.0 test/test_surface.rb