Sha256: 88762d88ebbd55feba65e2de5419de2b7f317da1016aeea450803b68579001f9

Contents?: true

Size: 1.15 KB

Versions: 8

Compression:

Stored size: 1.15 KB

Contents

require 'spec_helper'

describe SugarPNG do
  describe "border" do
    it "draws image entirely of border" do
      SugarPNG.new do |img|
        img.border 10

        img = ZPNG::Image.new(img.to_s)
        img.width.should == 20
        img.height.should == 20
        img.pixels.each do |c|
          c.should == ZPNG::Color::BLACK # SugarPNG::DEFAULT_FG
        end
      end
    end

    it "draws image entirely of padding" do
      SugarPNG.new do |img|
        img.padding 10

        img = ZPNG::Image.new(img.to_s)
        img.width.should == 20
        img.height.should == 20
        img.pixels.each do |c|
          c.should == ZPNG::Color::TRANSPARENT # SugarPNG::DEFAULT_BG
        end
      end
    end

    it "draws image of 2 borders" do
      SugarPNG.new do |img|
        img.border 1, :red
        img.border 1, :blue

        img = ZPNG::Image.new(img.to_s)
        img.width.should == 4
        img.height.should == 4
        img.each_pixel do |c,x,y|
          if x==0 || x==3 || y == 0 || y == 3
            c.should == ZPNG::Color::RED
          else
            c.should == ZPNG::Color::BLUE
          end
        end
      end
    end
  end
end

Version data entries

8 entries across 8 versions & 1 rubygems

Version Path
sugar_png-0.5.5 spec/magic/border_spec.rb
sugar_png-0.5.4 spec/magic/border_spec.rb
sugar_png-0.5.3 spec/magic/border_spec.rb
sugar_png-0.5.2 spec/magic/border_spec.rb
sugar_png-0.5.1 spec/magic/border_spec.rb
sugar_png-0.5.0 spec/magic/border_spec.rb
sugar_png-0.4.1 spec/magic/border_spec.rb
sugar_png-0.4.0 spec/magic/border_spec.rb