Sha256: d272617f3377af0734d85882108425730dad3f08975c8721783ff7166f3bb61d

Contents?: true

Size: 1.04 KB

Versions: 19

Compression:

Stored size: 1.04 KB

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 resource_data(name)
    data = nil
    File.open(resource_file(name), 'rb') { |f| data = f.read } 
    data
  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

19 entries across 18 versions & 4 rubygems

Version Path
bench9000-0.1 vendor/chunky_png/spec/spec_helper.rb
chunky_png-1.3.2 spec/spec_helper.rb
chunky_png-1.3.1 spec/spec_helper.rb
sadui-0.0.4 vendor/bundle/ruby/2.0.0/gems/chunky_png-1.3.0/spec/spec_helper.rb
sadui-0.0.4 vendor/bundle/ruby/2.1.0/gems/chunky_png-1.3.0/spec/spec_helper.rb
chunky_png-1.3.0 spec/spec_helper.rb
chunky_png-1.2.9 spec/spec_helper.rb
chunky_png-1.2.8 spec/spec_helper.rb
chunky_png-1.2.7 spec/spec_helper.rb
chunky_png-1.2.6 spec/spec_helper.rb
radiant-1.0.0 ruby-debug/ruby/1.8/gems/chunky_png-1.2.5/spec/spec_helper.rb
chunky_png-1.2.5 spec/spec_helper.rb
chunky_png-1.2.4 spec/spec_helper.rb
chunky_png-1.2.3 spec/spec_helper.rb
chunky_png-1.2.2 spec/spec_helper.rb
chunky_png-1.2.1 spec/spec_helper.rb
chunky_png-1.2.0 spec/spec_helper.rb
chunky_png-1.1.2 spec/spec_helper.rb
chunky_png-1.1.1 spec/spec_helper.rb