Sha256: 5adf23647ca484192356921478012af91bbbf15aa27b794bde2ae1b5f836385e
Contents?: true
Size: 1.21 KB
Versions: 1
Compression:
Stored size: 1.21 KB
Contents
require File.expand_path(File.join(File.dirname(__FILE__), '/spec_helper')) require 'zpng/cli' require 'set' PNGSuite.each_good do |fname| describe fname.sub(%r|\A#{Regexp::escape(Dir.getwd)}/?|, '') do it "accessess all pixels" do img = ZPNG::Image.load(fname) n = 0 img.each_pixel do |px| px.should be_instance_of(ZPNG::Color) n += 1 end n.should == img.width*img.height end it "accessess all pixels with coords" do img = ZPNG::Image.load(fname) n = 0 ax = Set.new ay = Set.new img.each_pixel do |px, x, y| px.should be_instance_of(ZPNG::Color) n += 1 ax << x ay << y end n.should == img.width*img.height ax.size.should == img.width ay.size.should == img.height end it "accessess all pixels using method #2" do img = ZPNG::Image.load(fname) n = 0 a = img.each_pixel.to_a ax = Set.new ay = Set.new a.each do |px, x, y| px.should be_instance_of(ZPNG::Color) n += 1 ax << x ay << y end n.should == img.width*img.height ax.size.should == img.width ay.size.should == img.height end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
zpng-0.4.5 | spec/pixel_access_spec.rb |