Sha256: 613ae54f2580cca79474799b3d4633047a7395aef638bc87f97fa79ac25007fd

Contents?: true

Size: 1 KB

Versions: 6

Compression:

Stored size: 1 KB

Contents

require 'cairo'
#require 'poppler'
require 'stringio'
require 'test/unit/notify'

module CairoTestUtils
  private
  def only_cairo_version(major, minor, micro=nil)
    unless Cairo.satisfied_version?(major, minor, micro)
      omit("Require cairo >= #{major}.#{minor}.#{micro}")
    end
  end

  def only_win32
    omit("Only for Win32 platform") unless win32
  end

  def win32?
    /cygwin|mingw|mswin32|bccwin32/.match(RUBY_PLATFORM) ? true : false
  end

  def quartz?
    Cairo::FontFace.quartz_supported?
  end

  def only_device(name)
    only_cairo_version(1, 10)

    unless Cairo::Device.supported?(name)
      omit("Only for #{name} device available")
    end
  end

  def only_surface(name)
    unless Cairo::Surface.supported?(name)
      omit("Only for #{name} device available")
    end
  end

  def only_pattern(name)
    unless Cairo::Pattern.supported?(name)
      omit("Only for #{name} device available")
    end
  end

  def fixture_path(*components)
    File.join(__dir__, "fixture", *components)
  end
end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
cairo-1.15.9-x64-mingw32 test/cairo-test-utils.rb
cairo-1.15.9 test/cairo-test-utils.rb
cairo-1.15.9-x86-mingw32 test/cairo-test-utils.rb
cairo-1.15.8-x86-mingw32 test/cairo-test-utils.rb
cairo-1.15.8-x64-mingw32 test/cairo-test-utils.rb
cairo-1.15.8 test/cairo-test-utils.rb