Sha256: ac13218008b4d972a37e3f3cc1451a35f9c17a6f18addd9609c4b7a3c7f91151
Contents?: true
Size: 1.39 KB
Versions: 2
Compression:
Stored size: 1.39 KB
Contents
# encoding: UTF-8 require File.join(File.dirname(__FILE__),'test_helper') require 'test/unit' class BitmapTest < Test::Unit::TestCase def test_bits bytes = sample_image.bits assert_equal(6466, bytes.size) if defined?(Encoding) assert_equal(Encoding::BINARY, bytes.encoding) assert_equal(bytes.size, bytes.bytesize) end end def test_open bitmap = FreeImage::Bitmap.open(image_path('lena.png')) assert_kind_of(FreeImage::Bitmap, bitmap) end def test_open_yield FreeImage::Bitmap.open(image_path('lena.png')) do |bitmap| assert_kind_of(FreeImage::Bitmap, bitmap) end end def test_open_yield_error assert_raise(ArgumentError) do FreeImage::Bitmap.open(image_path('lena.png')) do |bitmap| raise(ArgumentError, "Let's mess things up") end end end def test_new_from_nil ptr = FFI::Pointer::NULL error = assert_raise(FreeImage::Error) do FreeImage::Bitmap.new(ptr) end assert_equal("Cannot create a bitmap from a null pointer", error.message) end def test_clone image = lena_image clone = image.clone assert(!clone.equal?(image)) end def test_clone_block lena_image.clone do |image| assert_not_nil(image) end end def test_free 1000.times do image = sample_image image.free end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
free-image-0.7.1 | test/test_bitmap.rb |
free-image-0.7.0 | test/test_bitmap.rb |