Sha256: 1bcbc2bda0ab9eca4d57c9a0231fcc8bbce7859cfdae0180e3bb7a7c0add0ea7

Contents?: true

Size: 1.11 KB

Versions: 3

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

3 entries across 3 versions & 1 rubygems

Version Path
rmagick4j-0.3.9-java test/spec/draw_spec.rb
rmagick4j-0.3.8 test/spec/draw_spec.rb
rmagick4j-0.3.7 test/spec/draw_spec.rb