Sha256: a787ab0d2d3d48777877c5060a682f10f672b9071738b292b7f620402f692b40

Contents?: true

Size: 1.11 KB

Versions: 1

Compression:

Stored size: 1.11 KB

Contents

if PLATFORM == 'java'
  require File.join(File.dirname(__FILE__),'..','..','lib','rmagick')
else
  require 'rubygems'
  require 'rmagick'
end

include Magick

describe Draw do
  
  before(:each) do
    @draw = Draw.new
  end
  
  it "should clone correctly the primitives" do
    @draw.line(0, 0, 100, 100)
    b = @draw.clone
    b.push
    
    @draw.inspect.should_not == b.inspect
  end
  
  it "should say that has no primitives defined" do
    @draw.inspect.should == '(no primitives defined)'
  end
  
  it "should add one line per primitive" do
    @draw.path 'M150,150
                l50,50'
    @draw.inspect.split(/\n/).size.should == 1
  end
  
  it "should have the maximum width" do
    string = "get\nmultiline\ntype\nmetrics"
    @draw.get_multiline_type_metrics(string).width.should == string.split(/\n/).map{|x| @draw.get_type_metrics(x).width }.max
  end
  
  it "should have the correct multiline height" do
    string = "get\nmultiline\ntype\nmetrics"
    @draw.get_multiline_type_metrics(string).height.should == string.split(/\n/).map{|x| @draw.get_type_metrics(x).height }.inject{|memo, obj| memo + obj}
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
rmagick4j-0.4.0-java test/spec/draw_spec.rb