File: test_exception.rb

package info (click to toggle)
ruby-cairo 1.17.13-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 1,532 kB
  • sloc: ruby: 11,997; ansic: 10,183; sh: 48; makefile: 4
file content (36 lines) | stat: -rw-r--r-- 889 bytes parent folder | download | duplicates (5)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
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

  def test_new_symbols_since_1_14_0
    if Cairo.satisfied_version?(1, 14, 0)
      assertion = :assert_defined
    else
      assertion = :assert_not_defined
    end
    send(assertion, "JBIG2GlobalMissing")
  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