Sha256: da2c49eedbe18a6c33d38afe283cd6940f5b3c0c63653f911df83fb882ba7a8d

Contents?: true

Size: 1.01 KB

Versions: 33

Compression:

Stored size: 1.01 KB

Contents

require 'cairo'

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

  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
end

Version data entries

33 entries across 33 versions & 1 rubygems

Version Path
cairo-1.15.12-x64-mingw32 test/test_font_options.rb
cairo-1.15.12-x86-mingw32 test/test_font_options.rb
cairo-1.15.12 test/test_font_options.rb
cairo-1.15.11-x64-mingw32 test/test_font_options.rb
cairo-1.15.11-x86-mingw32 test/test_font_options.rb
cairo-1.15.11 test/test_font_options.rb
cairo-1.15.10-x86-mingw32 test/test_font_options.rb
cairo-1.15.10-x64-mingw32 test/test_font_options.rb
cairo-1.15.10 test/test_font_options.rb
cairo-1.15.9-x64-mingw32 test/test_font_options.rb
cairo-1.15.9 test/test_font_options.rb
cairo-1.15.9-x86-mingw32 test/test_font_options.rb
cairo-1.15.8-x86-mingw32 test/test_font_options.rb
cairo-1.15.8-x64-mingw32 test/test_font_options.rb
cairo-1.15.8 test/test_font_options.rb
cairo-1.15.7-x64-mingw32 test/test_font_options.rb
cairo-1.15.7-x86-mingw32 test/test_font_options.rb
cairo-1.15.7 test/test_font_options.rb
cairo-1.15.6-x86-mingw32 test/test_font_options.rb
cairo-1.15.6-x64-mingw32 test/test_font_options.rb