Sha256: bcabe6cf76236a630d75607190b9d4d84ddf84a873c5420a38457c0c705c07b4
Contents?: true
Size: 1.46 KB
Versions: 2
Compression:
Stored size: 1.46 KB
Contents
require 'spec_helper' describe OilyPNG::Resampling do include OilyPNG::Resampling describe '#steps' do it "should generate the steps from 4 to 8 as [0,0,1,1,2,2,3,3]" do steps(4,8).should == [0,0,1,1,2,2,3,3] end it "should generate the steps the same as ChunkyPNG" do image = ChunkyPNG::Image.new(1,1) steps(2,8).should == image.send(:steps,2,8) steps(2,11).should == image.send(:steps,2,11) steps(11,5).should == image.send(:steps,11,5) end end describe '#resample_nearest_neighbor!' do before(:all) { @reference = ChunkyPNG::Canvas.from_file(resource_file('nonsquare.png'))} it "should resample [0,1,2,3] to 4x4 properly" do OilyPNG::Canvas.new(2,2,[0,1,2,3]).resample_nearest_neighbor(4,4).should == OilyPNG::Canvas.new(4,4,[0,0,1,1,0,0,1,1,2,2,3,3,2,2,3,3]) end it "should resample [0,1,2,3] to 99x45 as ChunkyPNG does" do ChunkyPNG::Canvas.new(2,2,[0,1,2,3]).resample_nearest_neighbor(99,45).should == OilyPNG::Canvas.new(2,2,[0,1,2,3]).resample_nearest_neighbor(99,45) end it "should resample an image to 10x20 as ChunkyPNG does" do @reference.resample_nearest_neighbor(10,20).should == OilyPNG::Canvas.from_canvas(@reference).resample_nearest_neighbor(10,20) end it "should resample an image to 11x19 as ChunkyPNG does" do @reference.resample_nearest_neighbor(11,19).should == OilyPNG::Canvas.from_canvas(@reference).resample_nearest_neighbor(11,19) end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
oily_png-1.0.3 | spec/resampling_spec.rb |
oily_png-1.0.2 | spec/resampling_spec.rb |