Sha256: 17b04a2d7ba7e2c5f3eb4f550ab2f79a596a4ff6aed0237ac92f4f25bd429ae7

Contents?: true

Size: 946 Bytes

Versions: 7

Compression:

Stored size: 946 Bytes

Contents

require 'rubygems'
require 'bundler/setup'
require 'chunky_png'

module PNGSuite
  
  def png_suite_file(kind, file)
    File.join(png_suite_dir(kind), file)
  end
  
  def png_suite_dir(kind)
    File.expand_path("./png_suite/#{kind}", File.dirname(__FILE__))
  end
  
  def png_suite_files(kind, pattern = '*.png')
    Dir[File.join(png_suite_dir(kind), pattern)]
  end
end


module ResourceFileHelper
  
  def resource_file(name)
    File.expand_path("./resources/#{name}", File.dirname(__FILE__))
  end  
  
  def reference_canvas(name)
    ChunkyPNG::Canvas.from_file(resource_file("#{name}.png"))
  end
  
  def reference_image(name)
    ChunkyPNG::Image.from_file(resource_file("#{name}.png"))
  end
  
  def display(png)
    filename = resource_file('_tmp.png')
    png.save(filename)
    `open #{filename}`
  end
end

RSpec.configure do |config|
  config.extend PNGSuite
  config.include PNGSuite
  config.include ResourceFileHelper
end

Version data entries

7 entries across 7 versions & 1 rubygems

Version Path
chunky_png-1.1.0 spec/spec_helper.rb
chunky_png-1.0.1 spec/spec_helper.rb
chunky_png-1.0.0 spec/spec_helper.rb
chunky_png-1.0.0.rc2 spec/spec_helper.rb
chunky_png-1.0.0.rc1 spec/spec_helper.rb
chunky_png-1.0.0.beta2 spec/spec_helper.rb
chunky_png-1.0.0.beta1 spec/spec_helper.rb