Sha256: 914f1006dd44ed9d110ef5b2df787624dfb62ca40362b69f85cd3f785fd95ee8
Contents?: true
Size: 1.1 KB
Versions: 1
Compression:
Stored size: 1.1 KB
Contents
require 'spec_helper' describe ChunkyPNG::Canvas::Resampling do subject { reference_canvas('clock') } describe '#resample_nearest_neighbor' do it "should downscale from 2x2 to 1x1 correctly" do canvas = ChunkyPNG::Canvas.new(2, 2, [1, 2, 3, 4]) canvas.resample_nearest_neighbor(1, 1).should == ChunkyPNG::Canvas.new(1, 1, [1]) end it "should downscale from 2x2 to 4x4 correctly" do canvas = ChunkyPNG::Canvas.new(2, 2, [1, 2, 3, 4]) canvas.resample_nearest_neighbor(4, 4).should == ChunkyPNG::Canvas.new(4, 4, [1,1,1,2,1,1,1,2,1,1,1,2,3,3,3,4]) end it "should upscale both axis of the image" do subject.resample_nearest_neighbor(45, 45).should == reference_canvas('clock_nn_xup_yup') end it "should downscale both axis of the image" do subject.resample_nearest_neighbor(12, 12).should == reference_canvas('clock_nn_xdown_ydown') end it "should downscale the x-axis and upscale the y-axis of the image" do subject.resample_nearest_neighbor(20, 50).should == reference_canvas('clock_nn_xdown_yup') end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
chunky_png-1.0.0.rc1 | spec/chunky_png/canvas/resampling_spec.rb |