Sha256: f2b82a52966e3f9d125e46e3485a5956b5a9cf6b79c9159fa7dca57bcd23ee3d

Contents?: true

Size: 1.07 KB

Versions: 2

Compression:

Stored size: 1.07 KB

Contents

# encoding: UTF-8

# To make testing/debugging easier, test within this source tree versus an installed gem
dir = File.dirname(__FILE__)
ROOT_DIR = File.expand_path(File.join(dir, '..'))
LIB_DIR = File.expand_path(File.join(ROOT_DIR, 'lib'))

$LOAD_PATH << LIB_DIR

require 'rubygems'
require 'free-image'
require 'tempfile'

def image_path(image)
  File.join(ROOT_DIR, 'test', 'images', image)
end

def image_data(image)
  path = File.join(ROOT_DIR, 'test', 'images', image)
  result = nil
  File.open(path, 'rb') do |file|
    result = file.read
  end
  result
end

def sample_image
  path = File.join(ROOT_DIR, 'test', 'images', 'sample.png')
  FreeImage::Bitmap.open(path)
end

def lena_image
  path = File.join(ROOT_DIR, 'test', 'images', 'lena.png')
  FreeImage::Bitmap.open(path)
end

def bit16_bmp(bitfield=nil)
  suffix = begin
    if bitfield == 555
      'bf555'
    elsif bitfield == 565
      'bf565'
    else
      ''
    end
  end
  path = File.join(ROOT_DIR, 'test', 'images', "test16#{suffix}.bmp")
  FreeImage::Bitmap.open(path)
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
free-image-0.7.1 test/test_helper.rb
free-image-0.7.0 test/test_helper.rb