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

Kouhei Sutou commit at pdx.freedesktop.org
Wed Aug 13 01:27:46 PDT 2008


Committed by: kou

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

Added Files:
	cairo-test-utils.rb test_exception.rb 
Log Message:
        * src/rb_cairo_exception.c: support new statuses appeared since
        cairo 1.7.2.

        * src/rb_cairo.c (Cairo.satisfied_version?): add.

        * test/test_exception.rb: add.

        * test/cairo-test-utils.rb: add.


--- NEW FILE: cairo-test-utils.rb ---
require 'cairo'

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
end

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

class ExceptionTest < Test::Unit::TestCase
  def test_new_symbols_since_1_7_2
    if Cairo.satisfied_version?(1, 7, 2)
      assertion = :assert_defined
    else
      assertion = :assert_not_defined
    end
    send(assertion, "FontTypeMismatch")
    send(assertion, "UserFontImmutable")
    send(assertion, "UserFontError")
    send(assertion, "NegativeCount")
    send(assertion, "InvalidClusters")
    send(assertion, "InvalidSlant")
    send(assertion, "InvalidWeight")
  end

  private
  def assert_defined(name)
    assert_true(Cairo.const_defined?(name))
  end

  def assert_not_defined(name)
    assert_false(Cairo.const_defined?(name))
  end
end



More information about the cairo-commit mailing list