File: test_constants.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 (39 lines) | stat: -rw-r--r-- 1,187 bytes parent folder | download
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
37
38
39
require 'cairo'

class ConstantsTest < Test::Unit::TestCase
  def test_text_cluster_flags
    constant_name = "TextClusterFlag"
    unless Cairo.satisfied_version?(1, 7, 6)
      assert_false(Cairo.const_defined?(constant_name))
      return
    end

    assert_true(Cairo.const_defined?(constant_name))
    assert_equal((0..1).to_a,
                 [0,
                  Cairo::TextClusterFlag::BACKWARD])
  end

  def test_new_constants_since_1_14_0
    if Cairo.satisfied_version?(1, 14, 0)
      assertion = :assert_const_defined
    else
      assertion = :assert_not_const_defined
    end
    send(assertion, Cairo::MimeType, :JBIG2)
    send(assertion, Cairo::MimeType, :JBIG2_GLOBAL)
    send(assertion, Cairo::MimeType, :JBIG2_GLOBAL_ID)
  end

  def test_new_constants_since_1_17_8
    if Cairo.satisfied_version?(1, 17, 8)
      assert_const_defined(Cairo::ColorMode, :DEFAULT)
      assert_const_defined(Cairo::ColorMode, :COLOR)
      assert_const_defined(Cairo::ColorMode, :NO_COLOR)
      assert_const_defined(Cairo::ColorPalette, :DEFAULT)
    else
      assert_not_const_defined(Cairo, :ColorMode)
      assert_not_const_defined(Cairo, :ColorPalette)
    end
  end
end