Skip to content

Commit

Permalink
Spec cleanup.
Browse files Browse the repository at this point in the history
  • Loading branch information
wvanbergen committed Apr 22, 2011
1 parent d3498df commit 40b6a9c
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 32 deletions.
35 changes: 3 additions & 32 deletions spec/chunky_png_spec.rb
@@ -1,37 +1,8 @@
require 'spec_helper'

describe ChunkyPNG do

# it "should create reference images for all color modes" do
# image = ChunkyPNG::Image.new(10, 10, ChunkyPNG::Color.rgb(100, 100, 100))
# [:indexed, :grayscale, :grayscale_alpha, :truecolor, :truecolor_alpha].each do |color_mode|
#
# color_mode_id = ChunkyPNG.const_get("COLOR_#{color_mode.to_s.upcase}")
# filename = resource_file("gray_10x10_#{color_mode}.png")
# image.save(filename, :color_mode => color_mode_id)
# end
# end

# it "should create a reference image for operations" do
# image = ChunkyPNG::Image.new(16, 16, ChunkyPNG::Color::WHITE)
# r = 0
# image.width.times do |x|
# g = 0
# image.height.times do |y|
# image[x, y] = ChunkyPNG::Color.rgb(r, g, 255)
# g += 16
# end
# r += 16
# end
# filename = resource_file('operations.png')
# image.save(filename)
# # `open #{filename}`
# end

# it "should create damaged CRC values" do
# Zlib.stub!(:crc32).and_return(12345)
# image = ChunkyPNG::Image.new(10, 10, ChunkyPNG::Color::BLACK)
# image.save(resource_file('damaged_chunk.png'))
# end
it "should have a VERSION constant" do
ChunkyPNG.const_defined?('VERSION').should be_true
end
end

6 changes: 6 additions & 0 deletions spec/spec_helper.rb
Expand Up @@ -24,6 +24,12 @@ 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
Expand Down

0 comments on commit 40b6a9c

Please sign in to comment.