Sha256: 87e5609746148b0a87f3cddbb196e2059f4afcc9ca82e43995b24455fe4ed570
Contents?: true
Size: 1.18 KB
Versions: 12
Compression:
Stored size: 1.18 KB
Contents
require File.expand_path(File.dirname(__FILE__) + '/spec_helper') require 'zpng/cli' each_sample("bad/*.png") do |fname| describe fname do before(:all) do @img = ZPNG::Image.load(fname, :verbose => -2) end it "returns dimensions" do lambda{ @img.width @img.height }.should_not raise_error end it "should access 1st pixel" do @img[0,0].should be_instance_of(ZPNG::Color) end describe "CLI" do it "shows info & chunks" do orig_stdout, out = $stdout, "" begin $stdout = StringIO.new(out) lambda { ZPNG::CLI.new([fname, "-qqq"]).run }.should_not raise_error ensure $stdout = orig_stdout end out.should include("#{@img.width}x#{@img.height}") end it "shows scanlines" do orig_stdout, out = $stdout, "" begin $stdout = StringIO.new(out) lambda { ZPNG::CLI.new([fname, "-qqq", "--scanlines"]).run }.should_not raise_error ensure $stdout = orig_stdout end sl = out.scan(/scanline/i) sl.size.should > 0 sl.size.should == @img.scanlines.size end end end end
Version data entries
12 entries across 12 versions & 1 rubygems