Sha256: bb2403b579061653a6c79fb2d5ad1276b0fbcaebfe465acbc6606af57186ca0d

Contents?: true

Size: 1.18 KB

Versions: 19

Compression:

Stored size: 1.18 KB

Contents

require 'cairo'

class FontOptionsTest < Test::Unit::TestCase
  include Helper

  def setup
    @options = Cairo::FontOptions.new
  end

  sub_test_case "#==" do
    test "not FontOptions" do
      assert do
        !(@options == nil)
      end
    end

    test "same object" do
      assert do
        @options == @options
      end
    end

    test "same content" do
      assert do
        @options == @options.dup
      end
    end
  end

  sub_test_case "#eql? and #hash" do
    test "not FontOptions" do
      object = Object.new
      options = @options
      object.singleton_class.__send__(:define_method, :hash) do
        options.hash
      end

      hash = {
        object => :value,
      }
      assert_nil(hash[@options])
    end

    test "same object" do
      hash = {
        @options => :value,
      }
      assert_equal(:value, hash[@options])
    end

    test "same content" do
      hash = {
        @options => :value,
      }
      assert_equal(:value, hash[@options.dup])
    end
  end

  test "variations" do
    only_cairo_version(1, 15, 12)
    assert_nil(@options.variations)
    @options.variations = "wdth=200"
    assert_equal("wdth=200", @options.variations)
  end
end

Version data entries

19 entries across 19 versions & 1 rubygems

Version Path
cairo-1.17.8 test/test_font_options.rb
cairo-1.17.7 test/test_font_options.rb
cairo-1.17.6 test/test_font_options.rb
cairo-1.17.5 test/test_font_options.rb
cairo-1.17.4 test/test_font_options.rb
cairo-1.16.6 test/test_font_options.rb
cairo-1.16.5 test/test_font_options.rb
cairo-1.16.4 test/test_font_options.rb
cairo-1.16.3 test/test_font_options.rb
cairo-1.16.2 test/test_font_options.rb
cairo-1.16.1-x86-mingw32 test/test_font_options.rb
cairo-1.16.1-x64-mingw32 test/test_font_options.rb
cairo-1.16.1 test/test_font_options.rb
cairo-1.16.0-x86-mingw32 test/test_font_options.rb
cairo-1.16.0-x64-mingw32 test/test_font_options.rb
cairo-1.16.0 test/test_font_options.rb
cairo-1.15.14-x86-mingw32 test/test_font_options.rb
cairo-1.15.14-x64-mingw32 test/test_font_options.rb
cairo-1.15.14 test/test_font_options.rb